parse 6.1.0-alpha.3 → 6.1.0-alpha.5
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 +28 -38
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +28 -38
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/CoreManager.js +1 -1
- package/lib/browser/Parse.js +14 -14
- package/lib/browser/ParseObject.js +2 -1
- package/lib/browser/ParseOp.js +1 -1
- package/lib/browser/ParseQuery.js +8 -20
- package/lib/browser/TaskQueue.js +1 -0
- package/lib/node/CoreManager.js +1 -1
- package/lib/node/Parse.js +14 -14
- package/lib/node/ParseObject.js +2 -1
- package/lib/node/ParseOp.js +1 -1
- package/lib/node/ParseQuery.js +8 -20
- package/lib/node/TaskQueue.js +1 -0
- package/lib/react-native/CoreManager.js +1 -1
- package/lib/react-native/ObjectStateMutations.js +13 -13
- package/lib/react-native/ParseACL.js +7 -7
- package/lib/react-native/ParseCLP.js +15 -15
- package/lib/react-native/ParseObject.js +9 -9
- package/lib/react-native/ParseQuery.js +8 -16
- package/lib/react-native/ParseUser.js +15 -15
- package/lib/weapp/CoreManager.js +1 -1
- package/lib/weapp/Parse.js +14 -14
- package/lib/weapp/ParseObject.js +2 -1
- package/lib/weapp/ParseOp.js +1 -1
- package/lib/weapp/ParseQuery.js +8 -20
- package/lib/weapp/TaskQueue.js +1 -0
- package/package.json +8 -8
- package/types/Analytics.d.ts +1 -3
- package/types/CoreManager.d.ts +56 -62
- package/types/LocalDatastore.d.ts +3 -3
- package/types/LocalDatastoreController.default.d.ts +1 -1
- package/types/LocalDatastoreController.react-native.d.ts +1 -1
- package/types/ObjectStateMutations.d.ts +12 -18
- package/types/Parse.d.ts +63 -324
- package/types/ParseACL.d.ts +2 -6
- package/types/ParseCLP.d.ts +2 -6
- package/types/ParseConfig.d.ts +3 -11
- package/types/ParseFile.d.ts +8 -12
- package/types/ParseInstallation.d.ts +4 -4
- package/types/ParseObject.d.ts +24 -26
- package/types/ParseOp.d.ts +13 -15
- package/types/ParsePolygon.d.ts +3 -3
- package/types/ParseQuery.d.ts +39 -55
- package/types/ParseSchema.d.ts +12 -28
- package/types/ParseUser.d.ts +8 -14
- package/types/Push.d.ts +2 -2
- package/types/RESTController.d.ts +4 -4
- package/types/SingleInstanceStateController.d.ts +1 -1
- package/types/Storage.d.ts +2 -2
- package/types/StorageController.react-native.d.ts +2 -2
- package/types/TaskQueue.d.ts +3 -3
- package/types/UniqueInstanceStateController.d.ts +1 -1
- package/types/arrayContainsObject.d.ts +1 -1
- package/types/encode.d.ts +1 -1
- package/types/eslint.config.mjs +30 -0
- package/types/unique.d.ts +1 -1
- package/types/unsavedChildren.d.ts +1 -1
package/lib/browser/Parse.js
CHANGED
|
@@ -109,7 +109,7 @@ const Parse = {
|
|
|
109
109
|
Hooks: undefined,
|
|
110
110
|
Parse: undefined,
|
|
111
111
|
/**
|
|
112
|
-
* @
|
|
112
|
+
* @property {EventuallyQueue} Parse.EventuallyQueue
|
|
113
113
|
* @static
|
|
114
114
|
*/
|
|
115
115
|
set EventuallyQueue(queue) {
|
|
@@ -179,7 +179,7 @@ const Parse = {
|
|
|
179
179
|
return _CoreManager.default.getRESTController().request('GET', 'health');
|
|
180
180
|
},
|
|
181
181
|
/**
|
|
182
|
-
* @
|
|
182
|
+
* @property {string} Parse.applicationId
|
|
183
183
|
* @static
|
|
184
184
|
*/
|
|
185
185
|
set applicationId(value) {
|
|
@@ -189,7 +189,7 @@ const Parse = {
|
|
|
189
189
|
return _CoreManager.default.get('APPLICATION_ID');
|
|
190
190
|
},
|
|
191
191
|
/**
|
|
192
|
-
* @
|
|
192
|
+
* @property {string} Parse.javaScriptKey
|
|
193
193
|
* @static
|
|
194
194
|
*/
|
|
195
195
|
set javaScriptKey(value) {
|
|
@@ -199,7 +199,7 @@ const Parse = {
|
|
|
199
199
|
return _CoreManager.default.get('JAVASCRIPT_KEY');
|
|
200
200
|
},
|
|
201
201
|
/**
|
|
202
|
-
* @
|
|
202
|
+
* @property {string} Parse.masterKey
|
|
203
203
|
* @static
|
|
204
204
|
*/
|
|
205
205
|
set masterKey(value) {
|
|
@@ -209,7 +209,7 @@ const Parse = {
|
|
|
209
209
|
return _CoreManager.default.get('MASTER_KEY');
|
|
210
210
|
},
|
|
211
211
|
/**
|
|
212
|
-
* @
|
|
212
|
+
* @property {string} Parse.maintenanceKey
|
|
213
213
|
* @static
|
|
214
214
|
*/
|
|
215
215
|
set maintenanceKey(value) {
|
|
@@ -219,7 +219,7 @@ const Parse = {
|
|
|
219
219
|
return _CoreManager.default.get('MAINTENANCE_KEY');
|
|
220
220
|
},
|
|
221
221
|
/**
|
|
222
|
-
* @
|
|
222
|
+
* @property {string} Parse.serverURL
|
|
223
223
|
* @static
|
|
224
224
|
*/
|
|
225
225
|
set serverURL(value) {
|
|
@@ -229,7 +229,7 @@ const Parse = {
|
|
|
229
229
|
return _CoreManager.default.get('SERVER_URL');
|
|
230
230
|
},
|
|
231
231
|
/**
|
|
232
|
-
* @
|
|
232
|
+
* @property {string} Parse.serverAuthToken
|
|
233
233
|
* @static
|
|
234
234
|
*/
|
|
235
235
|
set serverAuthToken(value) {
|
|
@@ -239,7 +239,7 @@ const Parse = {
|
|
|
239
239
|
return _CoreManager.default.get('SERVER_AUTH_TOKEN');
|
|
240
240
|
},
|
|
241
241
|
/**
|
|
242
|
-
* @
|
|
242
|
+
* @property {string} Parse.serverAuthType
|
|
243
243
|
* @static
|
|
244
244
|
*/
|
|
245
245
|
set serverAuthType(value) {
|
|
@@ -249,7 +249,7 @@ const Parse = {
|
|
|
249
249
|
return _CoreManager.default.get('SERVER_AUTH_TYPE');
|
|
250
250
|
},
|
|
251
251
|
/**
|
|
252
|
-
* @
|
|
252
|
+
* @property {ParseLiveQuery} Parse.LiveQuery
|
|
253
253
|
* @static
|
|
254
254
|
*/
|
|
255
255
|
set LiveQuery(liveQuery) {
|
|
@@ -259,7 +259,7 @@ const Parse = {
|
|
|
259
259
|
return _CoreManager.default.getLiveQuery();
|
|
260
260
|
},
|
|
261
261
|
/**
|
|
262
|
-
* @
|
|
262
|
+
* @property {string} Parse.liveQueryServerURL
|
|
263
263
|
* @static
|
|
264
264
|
*/
|
|
265
265
|
set liveQueryServerURL(value) {
|
|
@@ -269,7 +269,7 @@ const Parse = {
|
|
|
269
269
|
return _CoreManager.default.get('LIVEQUERY_SERVER_URL');
|
|
270
270
|
},
|
|
271
271
|
/**
|
|
272
|
-
* @
|
|
272
|
+
* @property {boolean} Parse.encryptedUser
|
|
273
273
|
* @static
|
|
274
274
|
*/
|
|
275
275
|
set encryptedUser(value) {
|
|
@@ -279,7 +279,7 @@ const Parse = {
|
|
|
279
279
|
return _CoreManager.default.get('ENCRYPTED_USER');
|
|
280
280
|
},
|
|
281
281
|
/**
|
|
282
|
-
* @
|
|
282
|
+
* @property {string} Parse.secret
|
|
283
283
|
* @static
|
|
284
284
|
*/
|
|
285
285
|
set secret(value) {
|
|
@@ -289,7 +289,7 @@ const Parse = {
|
|
|
289
289
|
return _CoreManager.default.get('ENCRYPTED_KEY');
|
|
290
290
|
},
|
|
291
291
|
/**
|
|
292
|
-
* @
|
|
292
|
+
* @property {boolean} Parse.idempotency
|
|
293
293
|
* @static
|
|
294
294
|
*/
|
|
295
295
|
set idempotency(value) {
|
|
@@ -299,7 +299,7 @@ const Parse = {
|
|
|
299
299
|
return _CoreManager.default.get('IDEMPOTENCY');
|
|
300
300
|
},
|
|
301
301
|
/**
|
|
302
|
-
* @
|
|
302
|
+
* @property {boolean} Parse.allowCustomObjectId
|
|
303
303
|
* @static
|
|
304
304
|
*/
|
|
305
305
|
set allowCustomObjectId(value) {
|
|
@@ -1362,7 +1362,7 @@ class ParseObject {
|
|
|
1362
1362
|
*/
|
|
1363
1363
|
destroy(options) {
|
|
1364
1364
|
if (!this.id) {
|
|
1365
|
-
return _promise.default.resolve();
|
|
1365
|
+
return _promise.default.resolve(undefined);
|
|
1366
1366
|
}
|
|
1367
1367
|
const destroyOptions = ParseObject._getRequestOptions(options);
|
|
1368
1368
|
return _CoreManager.default.getObjectController().destroy(this, destroyOptions);
|
|
@@ -2346,6 +2346,7 @@ const DefaultController = {
|
|
|
2346
2346
|
const batchReady = [];
|
|
2347
2347
|
const batchTasks = [];
|
|
2348
2348
|
(0, _forEach.default)(batch).call(batch, (obj, index) => {
|
|
2349
|
+
// eslint-disable-next-line
|
|
2349
2350
|
const ready = (0, _promiseUtils.resolvingPromise)();
|
|
2350
2351
|
batchReady.push(ready);
|
|
2351
2352
|
stateController.pushPendingState(obj._getStateIdentifier());
|
package/lib/browser/ParseOp.js
CHANGED
|
@@ -70,7 +70,7 @@ function opFromJSON(json) {
|
|
|
70
70
|
class Op {
|
|
71
71
|
// Empty parent class
|
|
72
72
|
applyTo() {} /* eslint-disable-line @typescript-eslint/no-unused-vars */
|
|
73
|
-
mergeWith() {} /* eslint-disable-line
|
|
73
|
+
mergeWith() {} /* eslint-disable-line */
|
|
74
74
|
toJSON() {} /* eslint-disable-line @typescript-eslint/no-unused-vars */
|
|
75
75
|
}
|
|
76
76
|
exports.Op = Op;
|
|
@@ -691,25 +691,19 @@ class ParseQuery {
|
|
|
691
691
|
* Executes a distinct query and returns unique values
|
|
692
692
|
*
|
|
693
693
|
* @param {string} key A field to find distinct values
|
|
694
|
-
* @param {object} options
|
|
695
|
-
* @param {string} [options.sessionToken] A valid session token, used for making a request on behalf of a specific user.
|
|
696
694
|
* @returns {Promise} A promise that is resolved with the query completes.
|
|
697
695
|
*/
|
|
698
|
-
distinct(key
|
|
699
|
-
options = options || {};
|
|
696
|
+
distinct(key) {
|
|
700
697
|
const distinctOptions = {
|
|
701
698
|
useMasterKey: true
|
|
702
699
|
};
|
|
703
|
-
if (Object.hasOwn(options, 'sessionToken')) {
|
|
704
|
-
distinctOptions.sessionToken = options.sessionToken;
|
|
705
|
-
}
|
|
706
700
|
this._setRequestTask(distinctOptions);
|
|
707
|
-
const controller = _CoreManager.default.getQueryController();
|
|
708
701
|
const params = {
|
|
709
702
|
distinct: key,
|
|
710
703
|
where: this._where,
|
|
711
704
|
hint: this._hint
|
|
712
705
|
};
|
|
706
|
+
const controller = _CoreManager.default.getQueryController();
|
|
713
707
|
return controller.aggregate(this.className, params, distinctOptions).then(results => {
|
|
714
708
|
return results.results;
|
|
715
709
|
});
|
|
@@ -719,20 +713,9 @@ class ParseQuery {
|
|
|
719
713
|
* Executes an aggregate query and returns aggregate results
|
|
720
714
|
*
|
|
721
715
|
* @param {(Array|object)} pipeline Array or Object of stages to process query
|
|
722
|
-
* @param {object} options
|
|
723
|
-
* @param {string} [options.sessionToken] A valid session token, used for making a request on behalf of a specific user.
|
|
724
716
|
* @returns {Promise} A promise that is resolved with the query completes.
|
|
725
717
|
*/
|
|
726
|
-
aggregate(pipeline
|
|
727
|
-
options = options || {};
|
|
728
|
-
const aggregateOptions = {
|
|
729
|
-
useMasterKey: true
|
|
730
|
-
};
|
|
731
|
-
if (Object.hasOwn(options, 'sessionToken')) {
|
|
732
|
-
aggregateOptions.sessionToken = options.sessionToken;
|
|
733
|
-
}
|
|
734
|
-
this._setRequestTask(aggregateOptions);
|
|
735
|
-
const controller = _CoreManager.default.getQueryController();
|
|
718
|
+
aggregate(pipeline) {
|
|
736
719
|
if (!(0, _isArray.default)(pipeline) && typeof pipeline !== 'object') {
|
|
737
720
|
throw new Error('Invalid pipeline must be Array or Object');
|
|
738
721
|
}
|
|
@@ -750,6 +733,11 @@ class ParseQuery {
|
|
|
750
733
|
explain: this._explain,
|
|
751
734
|
readPreference: this._readPreference
|
|
752
735
|
};
|
|
736
|
+
const aggregateOptions = {
|
|
737
|
+
useMasterKey: true
|
|
738
|
+
};
|
|
739
|
+
this._setRequestTask(aggregateOptions);
|
|
740
|
+
const controller = _CoreManager.default.getQueryController();
|
|
753
741
|
return controller.aggregate(this.className, params, aggregateOptions).then(results => {
|
|
754
742
|
return results.results;
|
|
755
743
|
});
|
package/lib/browser/TaskQueue.js
CHANGED
package/lib/node/CoreManager.js
CHANGED
package/lib/node/Parse.js
CHANGED
|
@@ -110,7 +110,7 @@ const Parse = {
|
|
|
110
110
|
Hooks: undefined,
|
|
111
111
|
Parse: undefined,
|
|
112
112
|
/**
|
|
113
|
-
* @
|
|
113
|
+
* @property {EventuallyQueue} Parse.EventuallyQueue
|
|
114
114
|
* @static
|
|
115
115
|
*/
|
|
116
116
|
set EventuallyQueue(queue) {
|
|
@@ -176,7 +176,7 @@ const Parse = {
|
|
|
176
176
|
return _CoreManager.default.getRESTController().request('GET', 'health');
|
|
177
177
|
},
|
|
178
178
|
/**
|
|
179
|
-
* @
|
|
179
|
+
* @property {string} Parse.applicationId
|
|
180
180
|
* @static
|
|
181
181
|
*/
|
|
182
182
|
set applicationId(value) {
|
|
@@ -186,7 +186,7 @@ const Parse = {
|
|
|
186
186
|
return _CoreManager.default.get('APPLICATION_ID');
|
|
187
187
|
},
|
|
188
188
|
/**
|
|
189
|
-
* @
|
|
189
|
+
* @property {string} Parse.javaScriptKey
|
|
190
190
|
* @static
|
|
191
191
|
*/
|
|
192
192
|
set javaScriptKey(value) {
|
|
@@ -196,7 +196,7 @@ const Parse = {
|
|
|
196
196
|
return _CoreManager.default.get('JAVASCRIPT_KEY');
|
|
197
197
|
},
|
|
198
198
|
/**
|
|
199
|
-
* @
|
|
199
|
+
* @property {string} Parse.masterKey
|
|
200
200
|
* @static
|
|
201
201
|
*/
|
|
202
202
|
set masterKey(value) {
|
|
@@ -206,7 +206,7 @@ const Parse = {
|
|
|
206
206
|
return _CoreManager.default.get('MASTER_KEY');
|
|
207
207
|
},
|
|
208
208
|
/**
|
|
209
|
-
* @
|
|
209
|
+
* @property {string} Parse.maintenanceKey
|
|
210
210
|
* @static
|
|
211
211
|
*/
|
|
212
212
|
set maintenanceKey(value) {
|
|
@@ -216,7 +216,7 @@ const Parse = {
|
|
|
216
216
|
return _CoreManager.default.get('MAINTENANCE_KEY');
|
|
217
217
|
},
|
|
218
218
|
/**
|
|
219
|
-
* @
|
|
219
|
+
* @property {string} Parse.serverURL
|
|
220
220
|
* @static
|
|
221
221
|
*/
|
|
222
222
|
set serverURL(value) {
|
|
@@ -226,7 +226,7 @@ const Parse = {
|
|
|
226
226
|
return _CoreManager.default.get('SERVER_URL');
|
|
227
227
|
},
|
|
228
228
|
/**
|
|
229
|
-
* @
|
|
229
|
+
* @property {string} Parse.serverAuthToken
|
|
230
230
|
* @static
|
|
231
231
|
*/
|
|
232
232
|
set serverAuthToken(value) {
|
|
@@ -236,7 +236,7 @@ const Parse = {
|
|
|
236
236
|
return _CoreManager.default.get('SERVER_AUTH_TOKEN');
|
|
237
237
|
},
|
|
238
238
|
/**
|
|
239
|
-
* @
|
|
239
|
+
* @property {string} Parse.serverAuthType
|
|
240
240
|
* @static
|
|
241
241
|
*/
|
|
242
242
|
set serverAuthType(value) {
|
|
@@ -246,7 +246,7 @@ const Parse = {
|
|
|
246
246
|
return _CoreManager.default.get('SERVER_AUTH_TYPE');
|
|
247
247
|
},
|
|
248
248
|
/**
|
|
249
|
-
* @
|
|
249
|
+
* @property {ParseLiveQuery} Parse.LiveQuery
|
|
250
250
|
* @static
|
|
251
251
|
*/
|
|
252
252
|
set LiveQuery(liveQuery) {
|
|
@@ -256,7 +256,7 @@ const Parse = {
|
|
|
256
256
|
return _CoreManager.default.getLiveQuery();
|
|
257
257
|
},
|
|
258
258
|
/**
|
|
259
|
-
* @
|
|
259
|
+
* @property {string} Parse.liveQueryServerURL
|
|
260
260
|
* @static
|
|
261
261
|
*/
|
|
262
262
|
set liveQueryServerURL(value) {
|
|
@@ -266,7 +266,7 @@ const Parse = {
|
|
|
266
266
|
return _CoreManager.default.get('LIVEQUERY_SERVER_URL');
|
|
267
267
|
},
|
|
268
268
|
/**
|
|
269
|
-
* @
|
|
269
|
+
* @property {boolean} Parse.encryptedUser
|
|
270
270
|
* @static
|
|
271
271
|
*/
|
|
272
272
|
set encryptedUser(value) {
|
|
@@ -276,7 +276,7 @@ const Parse = {
|
|
|
276
276
|
return _CoreManager.default.get('ENCRYPTED_USER');
|
|
277
277
|
},
|
|
278
278
|
/**
|
|
279
|
-
* @
|
|
279
|
+
* @property {string} Parse.secret
|
|
280
280
|
* @static
|
|
281
281
|
*/
|
|
282
282
|
set secret(value) {
|
|
@@ -286,7 +286,7 @@ const Parse = {
|
|
|
286
286
|
return _CoreManager.default.get('ENCRYPTED_KEY');
|
|
287
287
|
},
|
|
288
288
|
/**
|
|
289
|
-
* @
|
|
289
|
+
* @property {boolean} Parse.idempotency
|
|
290
290
|
* @static
|
|
291
291
|
*/
|
|
292
292
|
set idempotency(value) {
|
|
@@ -296,7 +296,7 @@ const Parse = {
|
|
|
296
296
|
return _CoreManager.default.get('IDEMPOTENCY');
|
|
297
297
|
},
|
|
298
298
|
/**
|
|
299
|
-
* @
|
|
299
|
+
* @property {boolean} Parse.allowCustomObjectId
|
|
300
300
|
* @static
|
|
301
301
|
*/
|
|
302
302
|
set allowCustomObjectId(value) {
|
package/lib/node/ParseObject.js
CHANGED
|
@@ -1342,7 +1342,7 @@ class ParseObject {
|
|
|
1342
1342
|
*/
|
|
1343
1343
|
destroy(options) {
|
|
1344
1344
|
if (!this.id) {
|
|
1345
|
-
return Promise.resolve();
|
|
1345
|
+
return Promise.resolve(undefined);
|
|
1346
1346
|
}
|
|
1347
1347
|
const destroyOptions = ParseObject._getRequestOptions(options);
|
|
1348
1348
|
return _CoreManager.default.getObjectController().destroy(this, destroyOptions);
|
|
@@ -2325,6 +2325,7 @@ const DefaultController = {
|
|
|
2325
2325
|
const batchReady = [];
|
|
2326
2326
|
const batchTasks = [];
|
|
2327
2327
|
batch.forEach((obj, index) => {
|
|
2328
|
+
// eslint-disable-next-line
|
|
2328
2329
|
const ready = (0, _promiseUtils.resolvingPromise)();
|
|
2329
2330
|
batchReady.push(ready);
|
|
2330
2331
|
stateController.pushPendingState(obj._getStateIdentifier());
|
package/lib/node/ParseOp.js
CHANGED
|
@@ -66,7 +66,7 @@ function opFromJSON(json) {
|
|
|
66
66
|
class Op {
|
|
67
67
|
// Empty parent class
|
|
68
68
|
applyTo() {} /* eslint-disable-line @typescript-eslint/no-unused-vars */
|
|
69
|
-
mergeWith() {} /* eslint-disable-line
|
|
69
|
+
mergeWith() {} /* eslint-disable-line */
|
|
70
70
|
toJSON() {} /* eslint-disable-line @typescript-eslint/no-unused-vars */
|
|
71
71
|
}
|
|
72
72
|
exports.Op = Op;
|
package/lib/node/ParseQuery.js
CHANGED
|
@@ -655,25 +655,19 @@ class ParseQuery {
|
|
|
655
655
|
* Executes a distinct query and returns unique values
|
|
656
656
|
*
|
|
657
657
|
* @param {string} key A field to find distinct values
|
|
658
|
-
* @param {object} options
|
|
659
|
-
* @param {string} [options.sessionToken] A valid session token, used for making a request on behalf of a specific user.
|
|
660
658
|
* @returns {Promise} A promise that is resolved with the query completes.
|
|
661
659
|
*/
|
|
662
|
-
distinct(key
|
|
663
|
-
options = options || {};
|
|
660
|
+
distinct(key) {
|
|
664
661
|
const distinctOptions = {
|
|
665
662
|
useMasterKey: true
|
|
666
663
|
};
|
|
667
|
-
if (Object.hasOwn(options, 'sessionToken')) {
|
|
668
|
-
distinctOptions.sessionToken = options.sessionToken;
|
|
669
|
-
}
|
|
670
664
|
this._setRequestTask(distinctOptions);
|
|
671
|
-
const controller = _CoreManager.default.getQueryController();
|
|
672
665
|
const params = {
|
|
673
666
|
distinct: key,
|
|
674
667
|
where: this._where,
|
|
675
668
|
hint: this._hint
|
|
676
669
|
};
|
|
670
|
+
const controller = _CoreManager.default.getQueryController();
|
|
677
671
|
return controller.aggregate(this.className, params, distinctOptions).then(results => {
|
|
678
672
|
return results.results;
|
|
679
673
|
});
|
|
@@ -683,20 +677,9 @@ class ParseQuery {
|
|
|
683
677
|
* Executes an aggregate query and returns aggregate results
|
|
684
678
|
*
|
|
685
679
|
* @param {(Array|object)} pipeline Array or Object of stages to process query
|
|
686
|
-
* @param {object} options
|
|
687
|
-
* @param {string} [options.sessionToken] A valid session token, used for making a request on behalf of a specific user.
|
|
688
680
|
* @returns {Promise} A promise that is resolved with the query completes.
|
|
689
681
|
*/
|
|
690
|
-
aggregate(pipeline
|
|
691
|
-
options = options || {};
|
|
692
|
-
const aggregateOptions = {
|
|
693
|
-
useMasterKey: true
|
|
694
|
-
};
|
|
695
|
-
if (Object.hasOwn(options, 'sessionToken')) {
|
|
696
|
-
aggregateOptions.sessionToken = options.sessionToken;
|
|
697
|
-
}
|
|
698
|
-
this._setRequestTask(aggregateOptions);
|
|
699
|
-
const controller = _CoreManager.default.getQueryController();
|
|
682
|
+
aggregate(pipeline) {
|
|
700
683
|
if (!Array.isArray(pipeline) && typeof pipeline !== 'object') {
|
|
701
684
|
throw new Error('Invalid pipeline must be Array or Object');
|
|
702
685
|
}
|
|
@@ -714,6 +697,11 @@ class ParseQuery {
|
|
|
714
697
|
explain: this._explain,
|
|
715
698
|
readPreference: this._readPreference
|
|
716
699
|
};
|
|
700
|
+
const aggregateOptions = {
|
|
701
|
+
useMasterKey: true
|
|
702
|
+
};
|
|
703
|
+
this._setRequestTask(aggregateOptions);
|
|
704
|
+
const controller = _CoreManager.default.getQueryController();
|
|
717
705
|
return controller.aggregate(this.className, params, aggregateOptions).then(results => {
|
|
718
706
|
return results.results;
|
|
719
707
|
});
|
package/lib/node/TaskQueue.js
CHANGED
|
@@ -28,11 +28,11 @@ function defaultState() {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
function setServerData(serverData, attributes) {
|
|
31
|
-
for (var
|
|
32
|
-
if (typeof attributes[
|
|
33
|
-
serverData[
|
|
31
|
+
for (var attr in attributes) {
|
|
32
|
+
if (typeof attributes[attr] !== 'undefined') {
|
|
33
|
+
serverData[attr] = attributes[attr];
|
|
34
34
|
} else {
|
|
35
|
-
delete serverData[
|
|
35
|
+
delete serverData[attr];
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -57,14 +57,14 @@ function popPendingState(pendingOps) {
|
|
|
57
57
|
function mergeFirstPendingState(pendingOps) {
|
|
58
58
|
var first = popPendingState(pendingOps);
|
|
59
59
|
var next = pendingOps[0];
|
|
60
|
-
for (var
|
|
61
|
-
if (next[
|
|
62
|
-
var merged = next[
|
|
60
|
+
for (var attr in first) {
|
|
61
|
+
if (next[attr] && first[attr]) {
|
|
62
|
+
var merged = next[attr].mergeWith(first[attr]);
|
|
63
63
|
if (merged) {
|
|
64
|
-
next[
|
|
64
|
+
next[attr] = merged;
|
|
65
65
|
}
|
|
66
66
|
} else {
|
|
67
|
-
next[
|
|
67
|
+
next[attr] = first[attr];
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
}
|
|
@@ -148,12 +148,12 @@ function nestedSet(obj, key, value) {
|
|
|
148
148
|
}
|
|
149
149
|
function commitServerChanges(serverData, objectCache, changes) {
|
|
150
150
|
var ParseObject = _CoreManager.default.getParseObject();
|
|
151
|
-
for (var
|
|
152
|
-
var val = changes[
|
|
153
|
-
nestedSet(serverData,
|
|
151
|
+
for (var attr in changes) {
|
|
152
|
+
var val = changes[attr];
|
|
153
|
+
nestedSet(serverData, attr, val);
|
|
154
154
|
if (val && typeof val === 'object' && !(val instanceof ParseObject) && !(val instanceof _ParseFile.default) && !(val instanceof _ParseRelation.default)) {
|
|
155
155
|
var json = (0, _encode.default)(val, false, true);
|
|
156
|
-
objectCache[
|
|
156
|
+
objectCache[attr] = JSON.stringify(json);
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
}
|
|
@@ -17,18 +17,18 @@ var ParseACL = function () {
|
|
|
17
17
|
this.setReadAccess(arg1, true);
|
|
18
18
|
this.setWriteAccess(arg1, true);
|
|
19
19
|
} else {
|
|
20
|
-
for (var
|
|
21
|
-
var accessList = arg1[
|
|
22
|
-
this.permissionsById[
|
|
23
|
-
for (var
|
|
24
|
-
var allowed = accessList[
|
|
25
|
-
if (
|
|
20
|
+
for (var userId in arg1) {
|
|
21
|
+
var accessList = arg1[userId];
|
|
22
|
+
this.permissionsById[userId] = {};
|
|
23
|
+
for (var permission in accessList) {
|
|
24
|
+
var allowed = accessList[permission];
|
|
25
|
+
if (permission !== 'read' && permission !== 'write') {
|
|
26
26
|
throw new TypeError('Tried to create an ACL with an invalid permission type.');
|
|
27
27
|
}
|
|
28
28
|
if (typeof allowed !== 'boolean') {
|
|
29
29
|
throw new TypeError('Tried to create an ACL with an invalid permission value.');
|
|
30
30
|
}
|
|
31
|
-
this.permissionsById[
|
|
31
|
+
this.permissionsById[userId][permission] = allowed;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -78,19 +78,19 @@ var ParseCLP = function () {
|
|
|
78
78
|
this.setRoleReadAccess(userId, true);
|
|
79
79
|
this.setRoleWriteAccess(userId, true);
|
|
80
80
|
} else {
|
|
81
|
-
for (var
|
|
82
|
-
var users = userId[
|
|
83
|
-
var isValidPermission = !!VALID_PERMISSIONS.get(
|
|
84
|
-
var isValidPermissionExtended = !!VALID_PERMISSIONS_EXTENDED.get(
|
|
85
|
-
var isValidGroupPermission = ['readUserFields', 'writeUserFields'].includes(
|
|
86
|
-
if (typeof
|
|
81
|
+
for (var permission in userId) {
|
|
82
|
+
var users = userId[permission];
|
|
83
|
+
var isValidPermission = !!VALID_PERMISSIONS.get(permission);
|
|
84
|
+
var isValidPermissionExtended = !!VALID_PERMISSIONS_EXTENDED.get(permission);
|
|
85
|
+
var isValidGroupPermission = ['readUserFields', 'writeUserFields'].includes(permission);
|
|
86
|
+
if (typeof permission !== 'string' || !(isValidPermission || isValidPermissionExtended || isValidGroupPermission)) {
|
|
87
87
|
throw new TypeError('Tried to create an CLP with an invalid permission type.');
|
|
88
88
|
}
|
|
89
89
|
if (isValidGroupPermission) {
|
|
90
90
|
if (users.every(function (pointer) {
|
|
91
91
|
return typeof pointer === 'string';
|
|
92
92
|
})) {
|
|
93
|
-
this.permissionsMap[
|
|
93
|
+
this.permissionsMap[permission] = users;
|
|
94
94
|
continue;
|
|
95
95
|
} else {
|
|
96
96
|
throw new TypeError('Tried to create an CLP with an invalid permission value.');
|
|
@@ -101,7 +101,7 @@ var ParseCLP = function () {
|
|
|
101
101
|
if (typeof allowed !== 'boolean' && !isValidPermissionExtended && user !== 'pointerFields') {
|
|
102
102
|
throw new TypeError('Tried to create an CLP with an invalid permission value.');
|
|
103
103
|
}
|
|
104
|
-
this.permissionsMap[
|
|
104
|
+
this.permissionsMap[permission][user] = allowed;
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
}
|
|
@@ -125,20 +125,20 @@ var ParseCLP = function () {
|
|
|
125
125
|
if (permissions.length !== otherPermissions.length) {
|
|
126
126
|
return false;
|
|
127
127
|
}
|
|
128
|
-
for (var
|
|
129
|
-
if (!other.permissionsMap[
|
|
128
|
+
for (var permission in this.permissionsMap) {
|
|
129
|
+
if (!other.permissionsMap[permission]) {
|
|
130
130
|
return false;
|
|
131
131
|
}
|
|
132
|
-
var users = Object.keys(this.permissionsMap[
|
|
133
|
-
var otherUsers = Object.keys(other.permissionsMap[
|
|
132
|
+
var users = Object.keys(this.permissionsMap[permission]);
|
|
133
|
+
var otherUsers = Object.keys(other.permissionsMap[permission]);
|
|
134
134
|
if (users.length !== otherUsers.length) {
|
|
135
135
|
return false;
|
|
136
136
|
}
|
|
137
|
-
for (var user in this.permissionsMap[
|
|
138
|
-
if (!other.permissionsMap[
|
|
137
|
+
for (var user in this.permissionsMap[permission]) {
|
|
138
|
+
if (!other.permissionsMap[permission][user]) {
|
|
139
139
|
return false;
|
|
140
140
|
}
|
|
141
|
-
if (this.permissionsMap[
|
|
141
|
+
if (this.permissionsMap[permission][user] !== other.permissionsMap[permission][user]) {
|
|
142
142
|
return false;
|
|
143
143
|
}
|
|
144
144
|
}
|
|
@@ -740,9 +740,9 @@ var ParseObject = function () {
|
|
|
740
740
|
if (Object.hasOwn(attrs, 'ACL') && !(attrs.ACL instanceof _ParseACL.default)) {
|
|
741
741
|
return new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'ACL must be a Parse ACL.');
|
|
742
742
|
}
|
|
743
|
-
for (var
|
|
744
|
-
if (!/^[A-Za-z_][0-9A-Za-z_.]*$/.test(
|
|
745
|
-
return new _ParseError.default(_ParseError.default.INVALID_KEY_NAME, `Invalid key name: ${
|
|
743
|
+
for (var key in attrs) {
|
|
744
|
+
if (!/^[A-Za-z_][0-9A-Za-z_.]*$/.test(key)) {
|
|
745
|
+
return new _ParseError.default(_ParseError.default.INVALID_KEY_NAME, `Invalid key name: ${key}`);
|
|
746
746
|
}
|
|
747
747
|
}
|
|
748
748
|
return false;
|
|
@@ -765,14 +765,14 @@ var ParseObject = function () {
|
|
|
765
765
|
key: "revert",
|
|
766
766
|
value: function () {
|
|
767
767
|
var keysToRevert;
|
|
768
|
-
for (var _len = arguments.length, keys = new Array(_len),
|
|
769
|
-
keys[
|
|
768
|
+
for (var _len = arguments.length, keys = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
769
|
+
keys[_key] = arguments[_key];
|
|
770
770
|
}
|
|
771
771
|
if (keys.length) {
|
|
772
772
|
keysToRevert = [];
|
|
773
|
-
for (var
|
|
774
|
-
if (typeof
|
|
775
|
-
keysToRevert.push(
|
|
773
|
+
for (var key of keys) {
|
|
774
|
+
if (typeof key === 'string') {
|
|
775
|
+
keysToRevert.push(key);
|
|
776
776
|
} else {
|
|
777
777
|
throw new Error('Parse.Object#revert expects either no, or a list of string, arguments.');
|
|
778
778
|
}
|
|
@@ -901,7 +901,7 @@ var ParseObject = function () {
|
|
|
901
901
|
key: "destroy",
|
|
902
902
|
value: function (options) {
|
|
903
903
|
if (!this.id) {
|
|
904
|
-
return Promise.resolve();
|
|
904
|
+
return Promise.resolve(undefined);
|
|
905
905
|
}
|
|
906
906
|
var destroyOptions = ParseObject._getRequestOptions(options);
|
|
907
907
|
return _CoreManager.default.getObjectController().destroy(this, destroyOptions);
|