parse 8.0.4-alpha.1 → 8.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/parse.js +44 -12
- package/dist/parse.min.js +1 -1
- package/dist/parse.weapp.js +44 -12
- package/dist/parse.weapp.min.js +1 -1
- package/lib/browser/CoreManager.js +1 -1
- package/lib/browser/LiveQueryClient.js +38 -18
- package/lib/browser/LiveQuerySubscription.js +20 -1
- package/lib/node/CoreManager.js +1 -1
- package/lib/node/LiveQueryClient.js +29 -11
- package/lib/node/LiveQuerySubscription.js +18 -1
- package/lib/react-native/CoreManager.js +1 -1
- package/lib/react-native/LiveQueryClient.js +20 -4
- package/lib/react-native/LiveQuerySubscription.js +15 -1
- package/lib/weapp/CoreManager.js +1 -1
- package/lib/weapp/LiveQueryClient.js +38 -18
- package/lib/weapp/LiveQuerySubscription.js +20 -1
- package/package.json +9 -9
- package/types/LiveQueryClient.d.ts +15 -13
- package/types/LiveQuerySubscription.d.ts +7 -1
package/dist/parse.weapp.js
CHANGED
|
@@ -191,7 +191,7 @@
|
|
|
191
191
|
SERVER_URL: "https://api.parse.com/1",
|
|
192
192
|
LIVEQUERY_SERVER_URL: null,
|
|
193
193
|
ENCRYPTED_KEY: null,
|
|
194
|
-
VERSION: "js8.0
|
|
194
|
+
VERSION: "js8.1.0-alpha.1",
|
|
195
195
|
APPLICATION_ID: null,
|
|
196
196
|
JAVASCRIPT_KEY: null,
|
|
197
197
|
MAINTENANCE_KEY: null,
|
|
@@ -58433,11 +58433,13 @@ Attributes: ${JSON.stringify(this.attributes, null, 2)}`;
|
|
|
58433
58433
|
* @param {string | number} id - subscription id
|
|
58434
58434
|
* @param {string} query - query to subscribe to
|
|
58435
58435
|
* @param {string} sessionToken - optional session token
|
|
58436
|
+
* @param {object} client - LiveQueryClient instance
|
|
58436
58437
|
*/
|
|
58437
|
-
constructor(id, query, sessionToken) {
|
|
58438
|
+
constructor(id, query, sessionToken, client) {
|
|
58438
58439
|
this.id = id;
|
|
58439
58440
|
this.query = query;
|
|
58440
58441
|
this.sessionToken = sessionToken;
|
|
58442
|
+
this.client = client;
|
|
58441
58443
|
this.subscribePromise = resolvingPromise();
|
|
58442
58444
|
this.unsubscribePromise = resolvingPromise();
|
|
58443
58445
|
this.subscribed = false;
|
|
@@ -58459,6 +58461,20 @@ Attributes: ${JSON.stringify(this.attributes, null, 2)}`;
|
|
|
58459
58461
|
return liveQueryClient.unsubscribe(this);
|
|
58460
58462
|
});
|
|
58461
58463
|
}
|
|
58464
|
+
/**
|
|
58465
|
+
* Execute a query on this subscription.
|
|
58466
|
+
* The results will be delivered via the 'result' event.
|
|
58467
|
+
*/
|
|
58468
|
+
find() {
|
|
58469
|
+
if (this.client) {
|
|
58470
|
+
this.client.connectPromise.then(() => {
|
|
58471
|
+
this.client.socket.send(JSON.stringify({
|
|
58472
|
+
op: "query",
|
|
58473
|
+
requestId: this.id
|
|
58474
|
+
}));
|
|
58475
|
+
});
|
|
58476
|
+
}
|
|
58477
|
+
}
|
|
58462
58478
|
}
|
|
58463
58479
|
const CLIENT_STATE = {
|
|
58464
58480
|
INITIALIZED: "initialized",
|
|
@@ -58477,7 +58493,8 @@ Attributes: ${JSON.stringify(this.attributes, null, 2)}`;
|
|
|
58477
58493
|
CONNECTED: "connected",
|
|
58478
58494
|
SUBSCRIBED: "subscribed",
|
|
58479
58495
|
UNSUBSCRIBED: "unsubscribed",
|
|
58480
|
-
ERROR: "error"
|
|
58496
|
+
ERROR: "error",
|
|
58497
|
+
RESULT: "result"
|
|
58481
58498
|
};
|
|
58482
58499
|
const CLIENT_EMMITER_TYPES = {
|
|
58483
58500
|
CLOSE: "close",
|
|
@@ -58487,20 +58504,23 @@ Attributes: ${JSON.stringify(this.attributes, null, 2)}`;
|
|
|
58487
58504
|
const SUBSCRIPTION_EMMITER_TYPES = {
|
|
58488
58505
|
OPEN: "open",
|
|
58489
58506
|
CLOSE: "close",
|
|
58490
|
-
ERROR: "error"
|
|
58507
|
+
ERROR: "error",
|
|
58508
|
+
RESULT: "result"
|
|
58491
58509
|
};
|
|
58492
58510
|
const generateInterval = (k) => {
|
|
58493
58511
|
return Math.random() * Math.min(30, Math.pow(2, k) - 1) * 1e3;
|
|
58494
58512
|
};
|
|
58495
58513
|
class LiveQueryClient {
|
|
58496
58514
|
/**
|
|
58497
|
-
*
|
|
58498
|
-
*
|
|
58499
|
-
* @param
|
|
58500
|
-
* @param
|
|
58501
|
-
* @param
|
|
58502
|
-
* @param
|
|
58503
|
-
* @param
|
|
58515
|
+
* Creates a new LiveQueryClient instance.
|
|
58516
|
+
*
|
|
58517
|
+
* @param options - Configuration options for the LiveQuery client
|
|
58518
|
+
* @param options.applicationId - The applicationId of your Parse app
|
|
58519
|
+
* @param options.serverURL - The URL of your LiveQuery server (must start with 'ws' or 'wss')
|
|
58520
|
+
* @param options.javascriptKey - (Optional) The JavaScript key for your Parse app
|
|
58521
|
+
* @param options.masterKey - (Optional) Your Parse Master Key (Node.js only!)
|
|
58522
|
+
* @param options.sessionToken - (Optional) Session token for authenticated requests
|
|
58523
|
+
* @param options.installationId - (Optional) Installation ID for the client
|
|
58504
58524
|
*/
|
|
58505
58525
|
constructor({
|
|
58506
58526
|
applicationId,
|
|
@@ -58576,7 +58596,7 @@ Attributes: ${JSON.stringify(this.attributes, null, 2)}`;
|
|
|
58576
58596
|
if (sessionToken) {
|
|
58577
58597
|
subscribeRequest.sessionToken = sessionToken;
|
|
58578
58598
|
}
|
|
58579
|
-
const subscription = new LiveQuerySubscription(this.requestId, query, sessionToken);
|
|
58599
|
+
const subscription = new LiveQuerySubscription(this.requestId, query, sessionToken, this);
|
|
58580
58600
|
this.subscriptions.set(this.requestId, subscription);
|
|
58581
58601
|
this.requestId += 1;
|
|
58582
58602
|
this.connectPromise.then(() => {
|
|
@@ -58767,6 +58787,18 @@ Attributes: ${JSON.stringify(this.attributes, null, 2)}`;
|
|
|
58767
58787
|
}
|
|
58768
58788
|
break;
|
|
58769
58789
|
}
|
|
58790
|
+
case OP_EVENTS.RESULT: {
|
|
58791
|
+
if (subscription) {
|
|
58792
|
+
const objects = data.results.map((json) => {
|
|
58793
|
+
if (!json.className && subscription.query) {
|
|
58794
|
+
json.className = subscription.query.className;
|
|
58795
|
+
}
|
|
58796
|
+
return ParseObject.fromJSON(json, false);
|
|
58797
|
+
});
|
|
58798
|
+
subscription.emit(SUBSCRIPTION_EMMITER_TYPES.RESULT, objects);
|
|
58799
|
+
}
|
|
58800
|
+
break;
|
|
58801
|
+
}
|
|
58770
58802
|
default: {
|
|
58771
58803
|
if (!subscription) {
|
|
58772
58804
|
break;
|