Skip to content

Commit 74faf89

Browse files
authored
build: Release (#2895)
2 parents 7390b44 + 8627a14 commit 74faf89

9 files changed

Lines changed: 495 additions & 328 deletions

changelogs/CHANGELOG_alpha.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# [8.1.0-alpha.1](https://github.com/parse-community/Parse-SDK-JS/compare/8.0.4-alpha.1...8.1.0-alpha.1) (2026-02-05)
2+
3+
4+
### Features
5+
6+
* Add `LiveQuerySubscription.find()` to execute a query based on a LiveQuery subscription ([#2735](https://github.com/parse-community/Parse-SDK-JS/issues/2735)) ([82b40da](https://github.com/parse-community/Parse-SDK-JS/commit/82b40da2096eeab7b0994eb6af51774e5a992b4e))
7+
8+
## [8.0.4-alpha.1](https://github.com/parse-community/Parse-SDK-JS/compare/8.0.3...8.0.4-alpha.1) (2026-01-27)
9+
10+
11+
### Bug Fixes
12+
13+
* `ws` package causes React-Native build failure ([#2857](https://github.com/parse-community/Parse-SDK-JS/issues/2857)) ([2b0b76b](https://github.com/parse-community/Parse-SDK-JS/commit/2b0b76b3d6fbd6ae236d3db6b92f4fbc2c98871f))
14+
115
## [8.0.3-alpha.1](https://github.com/parse-community/Parse-SDK-JS/compare/8.0.2...8.0.3-alpha.1) (2026-01-27)
216

317

package-lock.json

Lines changed: 259 additions & 286 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "parse",
3-
"version": "8.0.3",
3+
"version": "8.1.0-alpha.1",
44
"description": "Parse JavaScript SDK",
55
"homepage": "https://parseplatform.org",
66
"keywords": [
@@ -67,14 +67,14 @@
6767
},
6868
"dependencies": {
6969
"@babel/runtime": "7.28.6",
70-
"@babel/runtime-corejs3": "7.28.6",
70+
"@babel/runtime-corejs3": "7.29.0",
7171
"crypto-js": "4.2.0",
7272
"idb-keyval": "6.2.2",
7373
"react-native-crypto-js": "1.0.0",
7474
"ws": "8.19.0"
7575
},
7676
"devDependencies": {
77-
"@babel/core": "7.28.6",
77+
"@babel/core": "7.29.0",
7878
"@babel/plugin-proposal-class-properties": "7.18.6",
7979
"@babel/plugin-transform-runtime": "7.28.5",
8080
"@babel/preset-env": "7.28.6",
@@ -87,7 +87,7 @@
8787
"@semantic-release/changelog": "6.0.3",
8888
"@semantic-release/commit-analyzer": "13.0.1",
8989
"@semantic-release/git": "10.0.1",
90-
"@semantic-release/github": "12.0.2",
90+
"@semantic-release/github": "12.0.3",
9191
"@semantic-release/npm": "13.1.3",
9292
"@semantic-release/release-notes-generator": "14.1.0",
9393
"@types/facebook-js-sdk": "3.3.11",
@@ -99,7 +99,7 @@
9999
"cross-env": "10.1.0",
100100
"eslint": "9.39.2",
101101
"eslint-plugin-expect-type": "0.6.2",
102-
"eslint-plugin-jsdoc": "62.4.1",
102+
"eslint-plugin-jsdoc": "62.5.0",
103103
"express": "5.2.1",
104104
"gulp": "5.0.1",
105105
"gulp-babel": "8.0.0",
@@ -114,12 +114,12 @@
114114
"lint-staged": "16.2.7",
115115
"madge": "8.0.0",
116116
"metro-react-native-babel-preset": "0.77.0",
117-
"mongodb-runner": "6.5.4",
117+
"mongodb-runner": "6.6.0",
118118
"parse-server": "8.6.2",
119-
"puppeteer": "24.36.0",
119+
"puppeteer": "24.36.1",
120120
"regenerator-runtime": "0.14.1",
121-
"semantic-release": "25.0.2",
122-
"typescript-eslint": "8.53.1",
121+
"semantic-release": "25.0.3",
122+
"typescript-eslint": "8.54.0",
123123
"vite": "7.3.1",
124124
"vite-plugin-commonjs": "0.10.4",
125125
"vite-plugin-node-polyfills": "0.25.0"

src/LiveQueryClient.ts

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const OP_TYPES = {
2121
SUBSCRIBE: 'subscribe',
2222
UNSUBSCRIBE: 'unsubscribe',
2323
ERROR: 'error',
24+
QUERY: 'query',
2425
};
2526

2627
// The event we get back from LiveQuery server
@@ -34,6 +35,7 @@ const OP_EVENTS = {
3435
ENTER: 'enter',
3536
LEAVE: 'leave',
3637
DELETE: 'delete',
38+
RESULT: 'result',
3739
};
3840

3941
// The event the LiveQuery client should emit
@@ -53,10 +55,11 @@ const SUBSCRIPTION_EMMITER_TYPES = {
5355
ENTER: 'enter',
5456
LEAVE: 'leave',
5557
DELETE: 'delete',
58+
RESULT: 'result',
5659
};
5760

5861
// Exponentially-growing random delay
59-
const generateInterval = k => {
62+
const generateInterval = (k: number): number => {
6063
return Math.random() * Math.min(30, Math.pow(2, k) - 1) * 1000;
6164
};
6265

@@ -123,13 +126,15 @@ class LiveQueryClient {
123126
emit: any;
124127

125128
/**
126-
* @param {object} options
127-
* @param {string} options.applicationId - applicationId of your Parse app
128-
* @param {string} options.serverURL - <b>the URL of your LiveQuery server</b>
129-
* @param {string} options.javascriptKey (optional)
130-
* @param {string} options.masterKey (optional) Your Parse Master Key. (Node.js only!)
131-
* @param {string} options.sessionToken (optional)
132-
* @param {string} options.installationId (optional)
129+
* Creates a new LiveQueryClient instance.
130+
*
131+
* @param options - Configuration options for the LiveQuery client
132+
* @param options.applicationId - The applicationId of your Parse app
133+
* @param options.serverURL - The URL of your LiveQuery server (must start with 'ws' or 'wss')
134+
* @param options.javascriptKey - (Optional) The JavaScript key for your Parse app
135+
* @param options.masterKey - (Optional) Your Parse Master Key (Node.js only!)
136+
* @param options.sessionToken - (Optional) Session token for authenticated requests
137+
* @param options.installationId - (Optional) Installation ID for the client
133138
*/
134139
constructor({
135140
applicationId,
@@ -138,6 +143,13 @@ class LiveQueryClient {
138143
masterKey,
139144
sessionToken,
140145
installationId,
146+
}: {
147+
applicationId: string;
148+
serverURL: string;
149+
javascriptKey?: string;
150+
masterKey?: string;
151+
sessionToken?: string;
152+
installationId?: string;
141153
}) {
142154
if (!serverURL || serverURL.indexOf('ws') !== 0) {
143155
throw new Error(
@@ -162,8 +174,8 @@ class LiveQueryClient {
162174
const EventEmitter = CoreManager.getEventEmitter();
163175
this.emitter = new EventEmitter();
164176

165-
this.on = (eventName, listener) => this.emitter.on(eventName, listener);
166-
this.emit = (eventName, ...args) => this.emitter.emit(eventName, ...args);
177+
this.on = (eventName: string, listener: (...args: unknown[]) => void) => this.emitter.on(eventName, listener);
178+
this.emit = (eventName: string, ...args: unknown[]) => this.emitter.emit(eventName, ...args);
167179
// adding listener so process does not crash
168180
// best practice is for developer to register their own listener
169181
this.on('error', () => {});
@@ -212,14 +224,14 @@ class LiveQueryClient {
212224
subscribeRequest.sessionToken = sessionToken;
213225
}
214226

215-
const subscription = new LiveQuerySubscription(this.requestId, query, sessionToken);
227+
const subscription = new LiveQuerySubscription(this.requestId, query, sessionToken, this);
216228
this.subscriptions.set(this.requestId, subscription);
217229
this.requestId += 1;
218230
this.connectPromise
219231
.then(() => {
220232
this.socket.send(JSON.stringify(subscribeRequest));
221233
})
222-
.catch(error => {
234+
.catch((error: Error) => {
223235
subscription.subscribePromise.reject(error);
224236
});
225237

@@ -425,6 +437,18 @@ class LiveQueryClient {
425437
}
426438
break;
427439
}
440+
case OP_EVENTS.RESULT: {
441+
if (subscription) {
442+
const objects = data.results.map((json: Record<string, unknown>) => {
443+
if (!json.className && subscription.query) {
444+
json.className = subscription.query.className;
445+
}
446+
return ParseObject.fromJSON(json, false);
447+
});
448+
subscription.emit(SUBSCRIPTION_EMMITER_TYPES.RESULT, objects);
449+
}
450+
break;
451+
}
428452
default: {
429453
// create, update, enter, leave, delete cases
430454
if (!subscription) {

src/LiveQuerySubscription.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,21 @@ class LiveQuerySubscription {
9292
subscribePromise: any;
9393
unsubscribePromise: any;
9494
subscribed: boolean;
95+
client: any;
9596
emitter: EventEmitter;
9697
on: EventEmitter['on'];
9798
emit: EventEmitter['emit'];
9899
/*
99100
* @param {string | number} id - subscription id
100101
* @param {string} query - query to subscribe to
101102
* @param {string} sessionToken - optional session token
103+
* @param {object} client - LiveQueryClient instance
102104
*/
103-
constructor(id: string | number, query: ParseQuery, sessionToken?: string) {
105+
constructor(id: string | number, query: ParseQuery, sessionToken?: string, client?: any) {
104106
this.id = id;
105107
this.query = query;
106108
this.sessionToken = sessionToken;
109+
this.client = client;
107110
this.subscribePromise = resolvingPromise();
108111
this.unsubscribePromise = resolvingPromise();
109112
this.subscribed = false;
@@ -130,6 +133,21 @@ class LiveQuerySubscription {
130133
return liveQueryClient.unsubscribe(this);
131134
});
132135
}
136+
137+
/**
138+
* Execute a query on this subscription.
139+
* The results will be delivered via the 'result' event.
140+
*/
141+
find() {
142+
if (this.client) {
143+
this.client.connectPromise.then(() => {
144+
this.client.socket.send(JSON.stringify({
145+
op: 'query',
146+
requestId: this.id,
147+
}));
148+
});
149+
}
150+
}
133151
}
134152

135153
export default LiveQuerySubscription;

src/WebSocketController.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
/* global WebSocket */
2-
import ws from 'ws';
3-
import SocketWeapp from './Socket.weapp';
4-
52
let WebSocketController;
63

74
try {
85
if (process.env.PARSE_BUILD === 'browser') {
96
WebSocketController =
107
typeof WebSocket === 'function' || typeof WebSocket === 'object' ? WebSocket : null;
118
} else if (process.env.PARSE_BUILD === 'node') {
12-
WebSocketController = ws;
9+
WebSocketController = require('ws');
1310
} else if (process.env.PARSE_BUILD === 'weapp') {
14-
WebSocketController = SocketWeapp;
11+
WebSocketController = require('./Socket.weapp');
1512
} else if (process.env.PARSE_BUILD === 'react-native') {
1613
WebSocketController = WebSocket;
1714
}

0 commit comments

Comments
 (0)