parse 5.2.0-alpha.1 → 5.2.0-alpha.3
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 +10519 -15246
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +10499 -15371
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/Analytics.js +7 -11
- package/lib/browser/AnonymousUtils.js +17 -22
- package/lib/browser/Cloud.js +23 -41
- package/lib/browser/CoreManager.js +71 -79
- package/lib/browser/CryptoController.js +14 -9
- package/lib/browser/EventEmitter.js +9 -2
- package/lib/browser/EventuallyQueue.js +156 -357
- package/lib/browser/FacebookUtils.js +23 -28
- package/lib/browser/IndexedDBStorageController.js +18 -14
- package/lib/browser/InstallationController.js +55 -121
- package/lib/browser/LiveQueryClient.js +312 -485
- package/lib/browser/LiveQuerySubscription.js +25 -28
- package/lib/browser/LocalDatastore.js +258 -624
- package/lib/browser/LocalDatastoreController.default.js +42 -226
- package/lib/browser/LocalDatastoreController.js +11 -1
- package/lib/browser/LocalDatastoreController.react-native.js +66 -160
- package/lib/browser/LocalDatastoreUtils.js +4 -7
- package/lib/browser/ObjectStateMutations.js +54 -96
- package/lib/browser/OfflineQuery.js +106 -198
- package/lib/browser/Parse.js +44 -60
- package/lib/browser/ParseACL.js +242 -288
- package/lib/browser/ParseCLP.js +372 -572
- package/lib/browser/ParseConfig.js +115 -138
- package/lib/browser/ParseError.js +85 -182
- package/lib/browser/ParseFile.js +294 -438
- package/lib/browser/ParseGeoPoint.js +121 -146
- package/lib/browser/ParseHooks.js +23 -25
- package/lib/browser/ParseInstallation.js +225 -367
- package/lib/browser/ParseLiveQuery.js +74 -148
- package/lib/browser/ParseObject.js +2014 -2621
- package/lib/browser/ParseOp.js +343 -484
- package/lib/browser/ParsePolygon.js +101 -120
- package/lib/browser/ParseQuery.js +1708 -2052
- package/lib/browser/ParseRelation.js +99 -118
- package/lib/browser/ParseRole.js +88 -140
- package/lib/browser/ParseSchema.js +372 -434
- package/lib/browser/ParseSession.js +62 -110
- package/lib/browser/ParseUser.js +941 -1284
- package/lib/browser/Push.js +15 -38
- package/lib/browser/RESTController.js +85 -124
- package/lib/browser/SingleInstanceStateController.js +57 -86
- package/lib/browser/Socket.weapp.js +50 -33
- package/lib/browser/Storage.js +23 -28
- package/lib/browser/StorageController.browser.js +16 -13
- package/lib/browser/StorageController.default.js +15 -14
- package/lib/browser/StorageController.js +14 -1
- package/lib/browser/StorageController.react-native.js +31 -30
- package/lib/browser/StorageController.weapp.js +19 -13
- package/lib/browser/TaskQueue.js +31 -43
- package/lib/browser/UniqueInstanceStateController.js +65 -86
- package/lib/browser/WebSocketController.js +11 -4
- package/lib/browser/Xhr.weapp.js +90 -78
- package/lib/browser/arrayContainsObject.js +3 -3
- package/lib/browser/canBeSerialized.js +10 -11
- package/lib/browser/decode.js +11 -11
- package/lib/browser/encode.js +11 -11
- package/lib/browser/equals.js +9 -10
- package/lib/browser/escape.js +2 -2
- package/lib/browser/isRevocableSession.js +1 -1
- package/lib/browser/parseDate.js +10 -10
- package/lib/browser/promiseUtils.js +19 -19
- package/lib/browser/unique.js +4 -4
- package/lib/browser/unsavedChildren.js +20 -21
- package/lib/browser/uuid.js +2 -4
- package/lib/node/Analytics.js +5 -9
- package/lib/node/AnonymousUtils.js +10 -15
- package/lib/node/Cloud.js +11 -11
- package/lib/node/CoreManager.js +59 -67
- package/lib/node/CryptoController.js +8 -3
- package/lib/node/EventEmitter.js +7 -1
- package/lib/node/EventuallyQueue.js +20 -39
- package/lib/node/FacebookUtils.js +4 -8
- package/lib/node/IndexedDBStorageController.js +14 -10
- package/lib/node/InstallationController.js +12 -13
- package/lib/node/LiveQueryClient.js +23 -21
- package/lib/node/LiveQuerySubscription.js +6 -7
- package/lib/node/LocalDatastore.js +23 -23
- package/lib/node/LocalDatastoreController.default.js +11 -12
- package/lib/node/LocalDatastoreController.js +14 -1
- package/lib/node/LocalDatastoreController.react-native.js +25 -21
- package/lib/node/LocalDatastoreUtils.js +4 -7
- package/lib/node/ObjectStateMutations.js +12 -22
- package/lib/node/OfflineQuery.js +37 -23
- package/lib/node/Parse.js +36 -50
- package/lib/node/ParseACL.js +21 -30
- package/lib/node/ParseCLP.js +38 -40
- package/lib/node/ParseConfig.js +10 -17
- package/lib/node/ParseError.js +460 -461
- package/lib/node/ParseFile.js +27 -47
- package/lib/node/ParseGeoPoint.js +16 -17
- package/lib/node/ParseHooks.js +16 -18
- package/lib/node/ParseInstallation.js +10 -11
- package/lib/node/ParseLiveQuery.js +9 -14
- package/lib/node/ParseObject.js +142 -173
- package/lib/node/ParseOp.js +35 -47
- package/lib/node/ParsePolygon.js +14 -20
- package/lib/node/ParseQuery.js +100 -123
- package/lib/node/ParseRelation.js +10 -19
- package/lib/node/ParseRole.js +10 -11
- package/lib/node/ParseSchema.js +29 -42
- package/lib/node/ParseSession.js +10 -11
- package/lib/node/ParseUser.js +76 -87
- package/lib/node/Push.js +7 -12
- package/lib/node/RESTController.js +24 -36
- package/lib/node/SingleInstanceStateController.js +41 -69
- package/lib/node/Socket.weapp.js +23 -2
- package/lib/node/Storage.js +14 -19
- package/lib/node/StorageController.browser.js +10 -8
- package/lib/node/StorageController.default.js +9 -9
- package/lib/node/StorageController.js +16 -1
- package/lib/node/StorageController.react-native.js +20 -20
- package/lib/node/StorageController.weapp.js +14 -8
- package/lib/node/TaskQueue.js +2 -3
- package/lib/node/UniqueInstanceStateController.js +43 -63
- package/lib/node/WebSocketController.js +15 -2
- package/lib/node/Xhr.weapp.js +11 -2
- package/lib/node/arrayContainsObject.js +4 -4
- package/lib/node/canBeSerialized.js +5 -5
- package/lib/node/decode.js +4 -4
- package/lib/node/encode.js +5 -5
- package/lib/node/equals.js +4 -4
- package/lib/node/escape.js +1 -1
- package/lib/node/isRevocableSession.js +1 -1
- package/lib/node/parseDate.js +1 -1
- package/lib/node/promiseUtils.js +7 -7
- package/lib/node/unique.js +5 -5
- package/lib/node/unsavedChildren.js +5 -5
- package/lib/node/uuid.js +2 -4
- package/lib/react-native/Analytics.js +2 -2
- package/lib/react-native/AnonymousUtils.js +3 -4
- package/lib/react-native/CoreManager.js +2 -3
- package/lib/react-native/CryptoController.js +6 -1
- package/lib/react-native/EventEmitter.js +6 -1
- package/lib/react-native/EventuallyQueue.js +1 -2
- package/lib/react-native/FacebookUtils.js +1 -2
- package/lib/react-native/IndexedDBStorageController.js +11 -5
- package/lib/react-native/InstallationController.js +1 -2
- package/lib/react-native/LiveQueryClient.js +8 -7
- package/lib/react-native/LiveQuerySubscription.js +2 -4
- package/lib/react-native/LocalDatastore.js +3 -3
- package/lib/react-native/LocalDatastoreController.default.js +1 -2
- package/lib/react-native/LocalDatastoreController.js +11 -1
- package/lib/react-native/LocalDatastoreController.react-native.js +11 -12
- package/lib/react-native/LocalDatastoreUtils.js +3 -6
- package/lib/react-native/OfflineQuery.js +25 -20
- package/lib/react-native/Parse.js +24 -38
- package/lib/react-native/ParseACL.js +4 -6
- package/lib/react-native/ParseCLP.js +2 -4
- package/lib/react-native/ParseConfig.js +4 -6
- package/lib/react-native/ParseError.js +13 -31
- package/lib/react-native/ParseFile.js +3 -4
- package/lib/react-native/ParseGeoPoint.js +2 -4
- package/lib/react-native/ParseInstallation.js +13 -30
- package/lib/react-native/ParseLiveQuery.js +2 -4
- package/lib/react-native/ParseObject.js +77 -87
- package/lib/react-native/ParseOp.js +41 -79
- package/lib/react-native/ParsePolygon.js +2 -4
- package/lib/react-native/ParseQuery.js +43 -45
- package/lib/react-native/ParseRelation.js +2 -4
- package/lib/react-native/ParseRole.js +13 -30
- package/lib/react-native/ParseSchema.js +3 -5
- package/lib/react-native/ParseSession.js +12 -29
- package/lib/react-native/ParseUser.js +24 -49
- package/lib/react-native/RESTController.js +10 -4
- package/lib/react-native/SingleInstanceStateController.js +23 -37
- package/lib/react-native/Socket.weapp.js +9 -4
- package/lib/react-native/Storage.js +1 -2
- package/lib/react-native/StorageController.browser.js +6 -1
- package/lib/react-native/StorageController.default.js +6 -1
- package/lib/react-native/StorageController.js +13 -1
- package/lib/react-native/StorageController.react-native.js +11 -6
- package/lib/react-native/StorageController.weapp.js +6 -1
- package/lib/react-native/TaskQueue.js +2 -4
- package/lib/react-native/UniqueInstanceStateController.js +23 -37
- package/lib/react-native/WebSocketController.js +9 -1
- package/lib/react-native/Xhr.weapp.js +9 -4
- package/lib/react-native/unsavedChildren.js +3 -3
- package/lib/react-native/uuid.js +1 -2
- package/lib/weapp/Analytics.js +7 -11
- package/lib/weapp/AnonymousUtils.js +17 -22
- package/lib/weapp/Cloud.js +23 -41
- package/lib/weapp/CoreManager.js +71 -79
- package/lib/weapp/CryptoController.js +14 -9
- package/lib/weapp/EventEmitter.js +9 -2
- package/lib/weapp/EventuallyQueue.js +156 -357
- package/lib/weapp/FacebookUtils.js +23 -28
- package/lib/weapp/IndexedDBStorageController.js +18 -14
- package/lib/weapp/InstallationController.js +55 -121
- package/lib/weapp/LiveQueryClient.js +312 -485
- package/lib/weapp/LiveQuerySubscription.js +25 -28
- package/lib/weapp/LocalDatastore.js +258 -624
- package/lib/weapp/LocalDatastoreController.default.js +42 -226
- package/lib/weapp/LocalDatastoreController.js +11 -1
- package/lib/weapp/LocalDatastoreController.react-native.js +66 -160
- package/lib/weapp/LocalDatastoreUtils.js +4 -7
- package/lib/weapp/ObjectStateMutations.js +54 -96
- package/lib/weapp/OfflineQuery.js +106 -198
- package/lib/weapp/Parse.js +44 -59
- package/lib/weapp/ParseACL.js +242 -288
- package/lib/weapp/ParseCLP.js +372 -572
- package/lib/weapp/ParseConfig.js +115 -138
- package/lib/weapp/ParseError.js +85 -182
- package/lib/weapp/ParseFile.js +295 -440
- package/lib/weapp/ParseGeoPoint.js +121 -146
- package/lib/weapp/ParseHooks.js +23 -25
- package/lib/weapp/ParseInstallation.js +225 -367
- package/lib/weapp/ParseLiveQuery.js +74 -148
- package/lib/weapp/ParseObject.js +2014 -2621
- package/lib/weapp/ParseOp.js +343 -484
- package/lib/weapp/ParsePolygon.js +101 -120
- package/lib/weapp/ParseQuery.js +1708 -2052
- package/lib/weapp/ParseRelation.js +99 -118
- package/lib/weapp/ParseRole.js +88 -140
- package/lib/weapp/ParseSchema.js +372 -434
- package/lib/weapp/ParseSession.js +62 -110
- package/lib/weapp/ParseUser.js +941 -1284
- package/lib/weapp/Push.js +15 -38
- package/lib/weapp/RESTController.js +86 -125
- package/lib/weapp/SingleInstanceStateController.js +57 -86
- package/lib/weapp/Socket.weapp.js +50 -33
- package/lib/weapp/Storage.js +23 -28
- package/lib/weapp/StorageController.browser.js +16 -13
- package/lib/weapp/StorageController.default.js +15 -14
- package/lib/weapp/StorageController.js +14 -1
- package/lib/weapp/StorageController.react-native.js +31 -30
- package/lib/weapp/StorageController.weapp.js +19 -13
- package/lib/weapp/TaskQueue.js +31 -43
- package/lib/weapp/UniqueInstanceStateController.js +65 -86
- package/lib/weapp/WebSocketController.js +11 -4
- package/lib/weapp/Xhr.weapp.js +90 -78
- package/lib/weapp/arrayContainsObject.js +3 -3
- package/lib/weapp/canBeSerialized.js +10 -11
- package/lib/weapp/decode.js +11 -11
- package/lib/weapp/encode.js +11 -11
- package/lib/weapp/equals.js +9 -10
- package/lib/weapp/escape.js +2 -2
- package/lib/weapp/isRevocableSession.js +1 -1
- package/lib/weapp/parseDate.js +10 -10
- package/lib/weapp/promiseUtils.js +19 -19
- package/lib/weapp/unique.js +4 -4
- package/lib/weapp/unsavedChildren.js +20 -21
- package/lib/weapp/uuid.js +6 -8
- package/package.json +24 -30
package/lib/node/OfflineQuery.js
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _equals = _interopRequireDefault(require("./equals"));
|
|
8
|
+
var _decode = _interopRequireDefault(require("./decode"));
|
|
9
|
+
var _ParseError = _interopRequireDefault(require("./ParseError"));
|
|
10
|
+
var _ParsePolygon = _interopRequireDefault(require("./ParsePolygon"));
|
|
11
|
+
var _ParseGeoPoint = _interopRequireDefault(require("./ParseGeoPoint"));
|
|
12
|
+
function _interopRequireDefault(e) {
|
|
13
|
+
return e && e.__esModule ? e : {
|
|
14
|
+
default: e
|
|
15
|
+
};
|
|
16
|
+
}
|
|
8
17
|
/**
|
|
9
18
|
* contains -- Determines if an object is contained in a list with special handling for Parse pointers.
|
|
10
19
|
*
|
|
@@ -101,7 +110,7 @@ function equalObjectsGeneric(obj, compareTo, eqlFn) {
|
|
|
101
110
|
* relative to now.
|
|
102
111
|
*
|
|
103
112
|
* @param {string} text The text to convert.
|
|
104
|
-
* @param {Date} [now
|
|
113
|
+
* @param {Date} [now] The date from which add or subtract. Default is now.
|
|
105
114
|
* @returns {RelativeTimeToDateResult}
|
|
106
115
|
*/
|
|
107
116
|
function relativeTimeToDate(text, now = new Date()) {
|
|
@@ -268,7 +277,7 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
|
|
|
268
277
|
return false;
|
|
269
278
|
}
|
|
270
279
|
if (!/^[A-Za-z][0-9A-Za-z_]*$/.test(key)) {
|
|
271
|
-
throw new
|
|
280
|
+
throw new _ParseError.default(_ParseError.default.INVALID_KEY_NAME, `Invalid Key: ${key}`);
|
|
272
281
|
}
|
|
273
282
|
// Equality (or Array contains) cases
|
|
274
283
|
if (typeof constraints !== 'object') {
|
|
@@ -284,25 +293,29 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
|
|
|
284
293
|
return typeof obj !== 'undefined' && ptr.className === obj.className && ptr.objectId === obj.objectId;
|
|
285
294
|
});
|
|
286
295
|
}
|
|
287
|
-
return equalObjectsGeneric(
|
|
296
|
+
return equalObjectsGeneric((0, _decode.default)(object[key]), (0, _decode.default)(constraints), _equals.default);
|
|
288
297
|
}
|
|
289
298
|
// More complex cases
|
|
290
299
|
for (const condition in constraints) {
|
|
291
300
|
var _compareTo, _compareTo2;
|
|
292
301
|
compareTo = constraints[condition];
|
|
293
302
|
if ((_compareTo = compareTo) !== null && _compareTo !== void 0 && _compareTo.__type) {
|
|
294
|
-
compareTo =
|
|
303
|
+
compareTo = (0, _decode.default)(compareTo);
|
|
295
304
|
}
|
|
296
305
|
// is it a $relativeTime? convert to date
|
|
297
306
|
if ((_compareTo2 = compareTo) !== null && _compareTo2 !== void 0 && _compareTo2['$relativeTime']) {
|
|
298
307
|
const parserResult = relativeTimeToDate(compareTo['$relativeTime']);
|
|
299
308
|
if (parserResult.status !== 'success') {
|
|
300
|
-
throw new
|
|
309
|
+
throw new _ParseError.default(_ParseError.default.INVALID_JSON, `bad $relativeTime (${key}) value. ${parserResult.info}`);
|
|
301
310
|
}
|
|
302
311
|
compareTo = parserResult.result;
|
|
303
312
|
}
|
|
304
313
|
// Compare Date Object or Date String
|
|
305
|
-
if (toString.call(compareTo) === '[object Date]' || typeof compareTo === 'string' &&
|
|
314
|
+
if (toString.call(compareTo) === '[object Date]' || typeof compareTo === 'string' &&
|
|
315
|
+
// @ts-ignore
|
|
316
|
+
new Date(compareTo) !== 'Invalid Date' &&
|
|
317
|
+
// @ts-ignore
|
|
318
|
+
!isNaN(new Date(compareTo))) {
|
|
306
319
|
object[key] = new Date(object[key].iso ? object[key].iso : object[key]);
|
|
307
320
|
}
|
|
308
321
|
switch (condition) {
|
|
@@ -327,7 +340,7 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
|
|
|
327
340
|
}
|
|
328
341
|
break;
|
|
329
342
|
case '$ne':
|
|
330
|
-
if (
|
|
343
|
+
if ((0, _equals.default)(object[key], compareTo)) {
|
|
331
344
|
return false;
|
|
332
345
|
}
|
|
333
346
|
break;
|
|
@@ -427,7 +440,7 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
|
|
|
427
440
|
});
|
|
428
441
|
for (let i = 0; i < subQueryObjects.length; i += 1) {
|
|
429
442
|
const subObject = transformObject(subQueryObjects[i]);
|
|
430
|
-
return
|
|
443
|
+
return (0, _equals.default)(object[key], subObject[compareTo.key]);
|
|
431
444
|
}
|
|
432
445
|
return false;
|
|
433
446
|
}
|
|
@@ -438,7 +451,7 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
|
|
|
438
451
|
});
|
|
439
452
|
for (let i = 0; i < subQueryObjects.length; i += 1) {
|
|
440
453
|
const subObject = transformObject(subQueryObjects[i]);
|
|
441
|
-
return !
|
|
454
|
+
return !(0, _equals.default)(object[key], subObject[compareTo.key]);
|
|
442
455
|
}
|
|
443
456
|
return false;
|
|
444
457
|
}
|
|
@@ -481,16 +494,16 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
|
|
|
481
494
|
{
|
|
482
495
|
if (compareTo.$polygon) {
|
|
483
496
|
const points = compareTo.$polygon.map(geoPoint => [geoPoint.latitude, geoPoint.longitude]);
|
|
484
|
-
const polygon = new
|
|
497
|
+
const polygon = new _ParsePolygon.default(points);
|
|
485
498
|
return polygon.containsPoint(object[key]);
|
|
486
499
|
}
|
|
487
500
|
if (compareTo.$centerSphere) {
|
|
488
501
|
const [WGS84Point, maxDistance] = compareTo.$centerSphere;
|
|
489
|
-
const centerPoint = new
|
|
502
|
+
const centerPoint = new _ParseGeoPoint.default({
|
|
490
503
|
latitude: WGS84Point[1],
|
|
491
504
|
longitude: WGS84Point[0]
|
|
492
505
|
});
|
|
493
|
-
const point = new
|
|
506
|
+
const point = new _ParseGeoPoint.default(object[key]);
|
|
494
507
|
const distance = point.radiansTo(centerPoint);
|
|
495
508
|
return distance <= maxDistance;
|
|
496
509
|
}
|
|
@@ -498,8 +511,8 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
|
|
|
498
511
|
}
|
|
499
512
|
case '$geoIntersects':
|
|
500
513
|
{
|
|
501
|
-
const polygon = new
|
|
502
|
-
const point = new
|
|
514
|
+
const polygon = new _ParsePolygon.default(object[key].coordinates);
|
|
515
|
+
const point = new _ParseGeoPoint.default(compareTo.$point);
|
|
503
516
|
return polygon.containsPoint(point);
|
|
504
517
|
}
|
|
505
518
|
default:
|
|
@@ -508,7 +521,7 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
|
|
|
508
521
|
}
|
|
509
522
|
return true;
|
|
510
523
|
}
|
|
511
|
-
function validateQuery(query
|
|
524
|
+
function validateQuery(query) {
|
|
512
525
|
let q = query;
|
|
513
526
|
if (query.toJSON) {
|
|
514
527
|
q = query.toJSON().where;
|
|
@@ -518,12 +531,12 @@ function validateQuery(query /*: any*/) {
|
|
|
518
531
|
if (q && q[key] && q[key].$regex) {
|
|
519
532
|
if (typeof q[key].$options === 'string') {
|
|
520
533
|
if (!q[key].$options.match(/^[imxs]+$/)) {
|
|
521
|
-
throw new
|
|
534
|
+
throw new _ParseError.default(_ParseError.default.INVALID_QUERY, `Bad $options value for query: ${q[key].$options}`);
|
|
522
535
|
}
|
|
523
536
|
}
|
|
524
537
|
}
|
|
525
538
|
if (specialQuerykeys.indexOf(key) < 0 && !key.match(/^[a-zA-Z][a-zA-Z0-9_\.]*$/)) {
|
|
526
|
-
throw new
|
|
539
|
+
throw new _ParseError.default(_ParseError.default.INVALID_KEY_NAME, `Invalid key name: ${key}`);
|
|
527
540
|
}
|
|
528
541
|
});
|
|
529
542
|
}
|
|
@@ -531,4 +544,5 @@ const OfflineQuery = {
|
|
|
531
544
|
matchesQuery: matchesQuery,
|
|
532
545
|
validateQuery: validateQuery
|
|
533
546
|
};
|
|
534
|
-
module.exports = OfflineQuery;
|
|
547
|
+
module.exports = OfflineQuery;
|
|
548
|
+
var _default = exports.default = OfflineQuery;
|
package/lib/node/Parse.js
CHANGED
|
@@ -23,6 +23,7 @@ var _ParseConfig = _interopRequireDefault(require("./ParseConfig"));
|
|
|
23
23
|
var _ParseError = _interopRequireDefault(require("./ParseError"));
|
|
24
24
|
var _FacebookUtils = _interopRequireDefault(require("./FacebookUtils"));
|
|
25
25
|
var _ParseFile = _interopRequireDefault(require("./ParseFile"));
|
|
26
|
+
var Hooks = _interopRequireWildcard(require("./ParseHooks"));
|
|
26
27
|
var _ParseGeoPoint = _interopRequireDefault(require("./ParseGeoPoint"));
|
|
27
28
|
var _ParsePolygon = _interopRequireDefault(require("./ParsePolygon"));
|
|
28
29
|
var _ParseInstallation = _interopRequireDefault(require("./ParseInstallation"));
|
|
@@ -41,48 +42,34 @@ var _LiveQueryClient = _interopRequireDefault(require("./LiveQueryClient"));
|
|
|
41
42
|
var _LocalDatastoreController = _interopRequireDefault(require("./LocalDatastoreController"));
|
|
42
43
|
var _StorageController = _interopRequireDefault(require("./StorageController"));
|
|
43
44
|
var _WebSocketController = _interopRequireDefault(require("./WebSocketController"));
|
|
44
|
-
function _getRequireWildcardCache(
|
|
45
|
-
if (typeof WeakMap
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
return (_getRequireWildcardCache = function (
|
|
49
|
-
return
|
|
50
|
-
})(
|
|
45
|
+
function _getRequireWildcardCache(e) {
|
|
46
|
+
if ("function" != typeof WeakMap) return null;
|
|
47
|
+
var r = new WeakMap(),
|
|
48
|
+
t = new WeakMap();
|
|
49
|
+
return (_getRequireWildcardCache = function (e) {
|
|
50
|
+
return e ? t : r;
|
|
51
|
+
})(e);
|
|
51
52
|
}
|
|
52
|
-
function _interopRequireWildcard(
|
|
53
|
-
if (!
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
67
|
-
for (var key in obj) {
|
|
68
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
69
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
70
|
-
if (desc && (desc.get || desc.set)) {
|
|
71
|
-
Object.defineProperty(newObj, key, desc);
|
|
72
|
-
} else {
|
|
73
|
-
newObj[key] = obj[key];
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
newObj.default = obj;
|
|
78
|
-
if (cache) {
|
|
79
|
-
cache.set(obj, newObj);
|
|
53
|
+
function _interopRequireWildcard(e, r) {
|
|
54
|
+
if (!r && e && e.__esModule) return e;
|
|
55
|
+
if (null === e || "object" != typeof e && "function" != typeof e) return {
|
|
56
|
+
default: e
|
|
57
|
+
};
|
|
58
|
+
var t = _getRequireWildcardCache(r);
|
|
59
|
+
if (t && t.has(e)) return t.get(e);
|
|
60
|
+
var n = {
|
|
61
|
+
__proto__: null
|
|
62
|
+
},
|
|
63
|
+
a = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
64
|
+
for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
|
|
65
|
+
var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
|
|
66
|
+
i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
|
|
80
67
|
}
|
|
81
|
-
return
|
|
68
|
+
return n.default = e, t && t.set(e, n), n;
|
|
82
69
|
}
|
|
83
|
-
function _interopRequireDefault(
|
|
84
|
-
return
|
|
85
|
-
default:
|
|
70
|
+
function _interopRequireDefault(e) {
|
|
71
|
+
return e && e.__esModule ? e : {
|
|
72
|
+
default: e
|
|
86
73
|
};
|
|
87
74
|
}
|
|
88
75
|
/**
|
|
@@ -94,7 +81,7 @@ function _interopRequireDefault(obj) {
|
|
|
94
81
|
* @hideconstructor
|
|
95
82
|
*/
|
|
96
83
|
|
|
97
|
-
const Parse
|
|
84
|
+
const Parse = {
|
|
98
85
|
ACL: _ParseACL.default,
|
|
99
86
|
Analytics: Analytics,
|
|
100
87
|
AnonymousUtils: _AnonymousUtils.default,
|
|
@@ -135,7 +122,7 @@ const Parse /*: ParseType*/ = {
|
|
|
135
122
|
* @member {EventuallyQueue} Parse.EventuallyQueue
|
|
136
123
|
* @static
|
|
137
124
|
*/
|
|
138
|
-
set EventuallyQueue(queue
|
|
125
|
+
set EventuallyQueue(queue) {
|
|
139
126
|
_CoreManager.default.setEventuallyQueue(queue);
|
|
140
127
|
},
|
|
141
128
|
get EventuallyQueue() {
|
|
@@ -149,10 +136,10 @@ const Parse /*: ParseType*/ = {
|
|
|
149
136
|
* @param {string} [masterKey] Your Parse Master Key. (Node.js only!)
|
|
150
137
|
* @static
|
|
151
138
|
*/
|
|
152
|
-
initialize(applicationId
|
|
139
|
+
initialize(applicationId, javaScriptKey) {
|
|
153
140
|
Parse._initialize(applicationId, javaScriptKey);
|
|
154
141
|
},
|
|
155
|
-
_initialize(applicationId
|
|
142
|
+
_initialize(applicationId, javaScriptKey, masterKey) {
|
|
156
143
|
_CoreManager.default.set('APPLICATION_ID', applicationId);
|
|
157
144
|
_CoreManager.default.set('JAVASCRIPT_KEY', javaScriptKey);
|
|
158
145
|
_CoreManager.default.set('MASTER_KEY', masterKey);
|
|
@@ -174,7 +161,7 @@ const Parse /*: ParseType*/ = {
|
|
|
174
161
|
* @param {AsyncStorage} storage a react native async storage.
|
|
175
162
|
* @static
|
|
176
163
|
*/
|
|
177
|
-
setAsyncStorage(storage
|
|
164
|
+
setAsyncStorage(storage) {
|
|
178
165
|
_CoreManager.default.setAsyncStorage(storage);
|
|
179
166
|
},
|
|
180
167
|
/**
|
|
@@ -184,7 +171,7 @@ const Parse /*: ParseType*/ = {
|
|
|
184
171
|
* @param {LocalDatastoreController} controller a data storage.
|
|
185
172
|
* @static
|
|
186
173
|
*/
|
|
187
|
-
setLocalDatastoreController(controller
|
|
174
|
+
setLocalDatastoreController(controller) {
|
|
188
175
|
_CoreManager.default.setLocalDatastoreController(controller);
|
|
189
176
|
},
|
|
190
177
|
/**
|
|
@@ -260,7 +247,7 @@ const Parse /*: ParseType*/ = {
|
|
|
260
247
|
* @member {ParseLiveQuery} Parse.LiveQuery
|
|
261
248
|
* @static
|
|
262
249
|
*/
|
|
263
|
-
set LiveQuery(liveQuery
|
|
250
|
+
set LiveQuery(liveQuery) {
|
|
264
251
|
_CoreManager.default.setLiveQuery(liveQuery);
|
|
265
252
|
},
|
|
266
253
|
get LiveQuery() {
|
|
@@ -280,7 +267,7 @@ const Parse /*: ParseType*/ = {
|
|
|
280
267
|
* @member {boolean} Parse.encryptedUser
|
|
281
268
|
* @static
|
|
282
269
|
*/
|
|
283
|
-
set encryptedUser(value
|
|
270
|
+
set encryptedUser(value) {
|
|
284
271
|
_CoreManager.default.set('ENCRYPTED_USER', value);
|
|
285
272
|
},
|
|
286
273
|
get encryptedUser() {
|
|
@@ -404,10 +391,9 @@ Parse.Cloud = Parse.Cloud || {};
|
|
|
404
391
|
Parse.Cloud.useMasterKey = function () {
|
|
405
392
|
_CoreManager.default.set('USE_MASTER_KEY', true);
|
|
406
393
|
};
|
|
407
|
-
Parse.Hooks =
|
|
394
|
+
Parse.Hooks = Hooks;
|
|
408
395
|
|
|
409
396
|
// For legacy requires, of the form `var Parse = require('parse').Parse`
|
|
410
397
|
Parse.Parse = Parse;
|
|
411
398
|
module.exports = Parse;
|
|
412
|
-
var _default = Parse;
|
|
413
|
-
exports.default = _default;
|
|
399
|
+
var _default = exports.default = Parse;
|
package/lib/node/ParseACL.js
CHANGED
|
@@ -5,18 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
8
|
-
function _interopRequireDefault(
|
|
9
|
-
return
|
|
10
|
-
default:
|
|
8
|
+
function _interopRequireDefault(e) {
|
|
9
|
+
return e && e.__esModule ? e : {
|
|
10
|
+
default: e
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
/**
|
|
14
|
-
* @flow
|
|
15
|
-
*/
|
|
16
|
-
/*:: import type ParseRole from './ParseRole';*/
|
|
17
|
-
/*:: import type ParseUser from './ParseUser';*/
|
|
18
|
-
/*:: type PermissionsMap = { [permission: string]: boolean };*/
|
|
19
|
-
/*:: type ByIdMap = { [userId: string]: PermissionsMap };*/
|
|
20
13
|
const PUBLIC_KEY = '*';
|
|
21
14
|
|
|
22
15
|
/**
|
|
@@ -34,11 +27,10 @@ const PUBLIC_KEY = '*';
|
|
|
34
27
|
* @alias Parse.ACL
|
|
35
28
|
*/
|
|
36
29
|
class ParseACL {
|
|
37
|
-
/*:: permissionsById: ByIdMap;*/
|
|
38
30
|
/**
|
|
39
31
|
* @param {(Parse.User | object)} arg1 The user to initialize the ACL for
|
|
40
32
|
*/
|
|
41
|
-
constructor(arg1
|
|
33
|
+
constructor(arg1) {
|
|
42
34
|
this.permissionsById = {};
|
|
43
35
|
if (arg1 && typeof arg1 === 'object') {
|
|
44
36
|
const ParseUser = _CoreManager.default.getParseUser();
|
|
@@ -71,7 +63,7 @@ class ParseACL {
|
|
|
71
63
|
*
|
|
72
64
|
* @returns {object}
|
|
73
65
|
*/
|
|
74
|
-
toJSON()
|
|
66
|
+
toJSON() {
|
|
75
67
|
const permissions = {};
|
|
76
68
|
for (const p in this.permissionsById) {
|
|
77
69
|
permissions[p] = this.permissionsById[p];
|
|
@@ -85,7 +77,7 @@ class ParseACL {
|
|
|
85
77
|
* @param {ParseACL} other The other object's ACL to compare to
|
|
86
78
|
* @returns {boolean}
|
|
87
79
|
*/
|
|
88
|
-
equals(other
|
|
80
|
+
equals(other) {
|
|
89
81
|
if (!(other instanceof ParseACL)) {
|
|
90
82
|
return false;
|
|
91
83
|
}
|
|
@@ -107,7 +99,7 @@ class ParseACL {
|
|
|
107
99
|
}
|
|
108
100
|
return true;
|
|
109
101
|
}
|
|
110
|
-
_setAccess(accessType
|
|
102
|
+
_setAccess(accessType, userId, allowed) {
|
|
111
103
|
const ParseRole = _CoreManager.default.getParseRole();
|
|
112
104
|
const ParseUser = _CoreManager.default.getParseUser();
|
|
113
105
|
if (userId instanceof ParseUser) {
|
|
@@ -144,7 +136,7 @@ class ParseACL {
|
|
|
144
136
|
}
|
|
145
137
|
}
|
|
146
138
|
}
|
|
147
|
-
_getAccess(accessType
|
|
139
|
+
_getAccess(accessType, userId) {
|
|
148
140
|
const ParseRole = _CoreManager.default.getParseRole();
|
|
149
141
|
const ParseUser = _CoreManager.default.getParseUser();
|
|
150
142
|
if (userId instanceof ParseUser) {
|
|
@@ -172,7 +164,7 @@ class ParseACL {
|
|
|
172
164
|
* @param userId An instance of Parse.User or its objectId.
|
|
173
165
|
* @param {boolean} allowed Whether that user should have read access.
|
|
174
166
|
*/
|
|
175
|
-
setReadAccess(userId
|
|
167
|
+
setReadAccess(userId, allowed) {
|
|
176
168
|
this._setAccess('read', userId, allowed);
|
|
177
169
|
}
|
|
178
170
|
|
|
@@ -185,7 +177,7 @@ class ParseACL {
|
|
|
185
177
|
* @param userId An instance of Parse.User or its objectId, or a Parse.Role.
|
|
186
178
|
* @returns {boolean}
|
|
187
179
|
*/
|
|
188
|
-
getReadAccess(userId
|
|
180
|
+
getReadAccess(userId) {
|
|
189
181
|
return this._getAccess('read', userId);
|
|
190
182
|
}
|
|
191
183
|
|
|
@@ -195,7 +187,7 @@ class ParseACL {
|
|
|
195
187
|
* @param userId An instance of Parse.User or its objectId, or a Parse.Role..
|
|
196
188
|
* @param {boolean} allowed Whether that user should have write access.
|
|
197
189
|
*/
|
|
198
|
-
setWriteAccess(userId
|
|
190
|
+
setWriteAccess(userId, allowed) {
|
|
199
191
|
this._setAccess('write', userId, allowed);
|
|
200
192
|
}
|
|
201
193
|
|
|
@@ -208,7 +200,7 @@ class ParseACL {
|
|
|
208
200
|
* @param userId An instance of Parse.User or its objectId, or a Parse.Role.
|
|
209
201
|
* @returns {boolean}
|
|
210
202
|
*/
|
|
211
|
-
getWriteAccess(userId
|
|
203
|
+
getWriteAccess(userId) {
|
|
212
204
|
return this._getAccess('write', userId);
|
|
213
205
|
}
|
|
214
206
|
|
|
@@ -217,7 +209,7 @@ class ParseACL {
|
|
|
217
209
|
*
|
|
218
210
|
* @param {boolean} allowed
|
|
219
211
|
*/
|
|
220
|
-
setPublicReadAccess(allowed
|
|
212
|
+
setPublicReadAccess(allowed) {
|
|
221
213
|
this.setReadAccess(PUBLIC_KEY, allowed);
|
|
222
214
|
}
|
|
223
215
|
|
|
@@ -226,7 +218,7 @@ class ParseACL {
|
|
|
226
218
|
*
|
|
227
219
|
* @returns {boolean}
|
|
228
220
|
*/
|
|
229
|
-
getPublicReadAccess()
|
|
221
|
+
getPublicReadAccess() {
|
|
230
222
|
return this.getReadAccess(PUBLIC_KEY);
|
|
231
223
|
}
|
|
232
224
|
|
|
@@ -235,7 +227,7 @@ class ParseACL {
|
|
|
235
227
|
*
|
|
236
228
|
* @param {boolean} allowed
|
|
237
229
|
*/
|
|
238
|
-
setPublicWriteAccess(allowed
|
|
230
|
+
setPublicWriteAccess(allowed) {
|
|
239
231
|
this.setWriteAccess(PUBLIC_KEY, allowed);
|
|
240
232
|
}
|
|
241
233
|
|
|
@@ -244,7 +236,7 @@ class ParseACL {
|
|
|
244
236
|
*
|
|
245
237
|
* @returns {boolean}
|
|
246
238
|
*/
|
|
247
|
-
getPublicWriteAccess()
|
|
239
|
+
getPublicWriteAccess() {
|
|
248
240
|
return this.getWriteAccess(PUBLIC_KEY);
|
|
249
241
|
}
|
|
250
242
|
|
|
@@ -257,7 +249,7 @@ class ParseACL {
|
|
|
257
249
|
* @returns {boolean} true if the role has read access. false otherwise.
|
|
258
250
|
* @throws {TypeError} If role is neither a Parse.Role nor a String.
|
|
259
251
|
*/
|
|
260
|
-
getRoleReadAccess(role
|
|
252
|
+
getRoleReadAccess(role) {
|
|
261
253
|
const ParseRole = _CoreManager.default.getParseRole();
|
|
262
254
|
if (role instanceof ParseRole) {
|
|
263
255
|
// Normalize to the String name
|
|
@@ -278,7 +270,7 @@ class ParseACL {
|
|
|
278
270
|
* @returns {boolean} true if the role has write access. false otherwise.
|
|
279
271
|
* @throws {TypeError} If role is neither a Parse.Role nor a String.
|
|
280
272
|
*/
|
|
281
|
-
getRoleWriteAccess(role
|
|
273
|
+
getRoleWriteAccess(role) {
|
|
282
274
|
const ParseRole = _CoreManager.default.getParseRole();
|
|
283
275
|
if (role instanceof ParseRole) {
|
|
284
276
|
// Normalize to the String name
|
|
@@ -298,7 +290,7 @@ class ParseACL {
|
|
|
298
290
|
* @param {boolean} allowed Whether the given role can read this object.
|
|
299
291
|
* @throws {TypeError} If role is neither a Parse.Role nor a String.
|
|
300
292
|
*/
|
|
301
|
-
setRoleReadAccess(role
|
|
293
|
+
setRoleReadAccess(role, allowed) {
|
|
302
294
|
const ParseRole = _CoreManager.default.getParseRole();
|
|
303
295
|
if (role instanceof ParseRole) {
|
|
304
296
|
// Normalize to the String name
|
|
@@ -318,7 +310,7 @@ class ParseACL {
|
|
|
318
310
|
* @param {boolean} allowed Whether the given role can write this object.
|
|
319
311
|
* @throws {TypeError} If role is neither a Parse.Role nor a String.
|
|
320
312
|
*/
|
|
321
|
-
setRoleWriteAccess(role
|
|
313
|
+
setRoleWriteAccess(role, allowed) {
|
|
322
314
|
const ParseRole = _CoreManager.default.getParseRole();
|
|
323
315
|
if (role instanceof ParseRole) {
|
|
324
316
|
// Normalize to the String name
|
|
@@ -330,5 +322,4 @@ class ParseACL {
|
|
|
330
322
|
this.setWriteAccess('role:' + role, allowed);
|
|
331
323
|
}
|
|
332
324
|
}
|
|
333
|
-
var _default = ParseACL;
|
|
334
|
-
exports.default = _default;
|
|
325
|
+
var _default = exports.default = ParseACL;
|