parse 4.0.1 → 4.1.0-beta.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 +17994 -26193
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +8738 -17728
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/Analytics.js +2 -20
- package/lib/browser/AnonymousUtils.js +6 -35
- package/lib/browser/Cloud.js +12 -70
- package/lib/browser/CloudCode.js +0 -3
- package/lib/browser/CoreManager.js +46 -184
- package/lib/browser/CryptoController.js +2 -16
- package/lib/browser/EventEmitter.js +1 -1
- package/lib/browser/EventuallyQueue.js +277 -824
- package/lib/browser/FacebookUtils.js +6 -35
- package/lib/browser/IndexedDBStorageController.js +3 -14
- package/lib/browser/InstallationController.js +2 -13
- package/lib/browser/LiveQueryClient.js +87 -204
- package/lib/browser/LiveQuerySubscription.js +10 -39
- package/lib/browser/LocalDatastore.js +451 -1081
- package/lib/browser/LocalDatastoreController.js +145 -602
- package/lib/browser/LocalDatastoreController.react-native.js +137 -573
- package/lib/browser/LocalDatastoreUtils.js +2 -12
- package/lib/browser/ObjectStateMutations.js +18 -121
- package/lib/browser/OfflineQuery.js +42 -222
- package/lib/browser/Parse.js +12 -106
- package/lib/browser/ParseACL.js +33 -141
- package/lib/browser/ParseCLP.js +96 -314
- package/lib/browser/ParseConfig.js +18 -88
- package/lib/browser/ParseError.js +63 -90
- package/lib/browser/ParseFile.js +128 -685
- package/lib/browser/ParseGeoPoint.js +23 -82
- package/lib/browser/ParseHooks.js +1 -34
- package/lib/browser/ParseInstallation.js +4 -32
- package/lib/browser/ParseLiveQuery.js +96 -505
- package/lib/browser/ParseObject.js +628 -1840
- package/lib/browser/ParseOp.js +41 -287
- package/lib/browser/ParsePolygon.js +13 -63
- package/lib/browser/ParseQuery.js +404 -1505
- package/lib/browser/ParseRelation.js +12 -61
- package/lib/browser/ParseRole.js +13 -75
- package/lib/browser/ParseSchema.js +49 -201
- package/lib/browser/ParseSession.js +11 -69
- package/lib/browser/ParseUser.js +274 -1127
- package/lib/browser/Push.js +7 -43
- package/lib/browser/RESTController.js +18 -140
- package/lib/browser/SingleInstanceStateController.js +19 -137
- package/lib/browser/Socket.weapp.js +2 -12
- package/lib/browser/Storage.js +10 -73
- package/lib/browser/StorageController.browser.js +4 -17
- package/lib/browser/StorageController.default.js +4 -17
- package/lib/browser/StorageController.react-native.js +6 -33
- package/lib/browser/StorageController.weapp.js +5 -16
- package/lib/browser/TaskQueue.js +1 -22
- package/lib/browser/UniqueInstanceStateController.js +19 -142
- package/lib/browser/Xhr.weapp.js +0 -17
- package/lib/browser/arrayContainsObject.js +2 -16
- package/lib/browser/canBeSerialized.js +3 -33
- package/lib/browser/decode.js +3 -33
- package/lib/browser/encode.js +9 -70
- package/lib/browser/equals.js +2 -25
- package/lib/browser/escape.js +1 -8
- package/lib/browser/isRevocableSession.js +2 -11
- package/lib/browser/parseDate.js +2 -13
- package/lib/browser/promiseUtils.js +3 -21
- package/lib/browser/unique.js +3 -17
- package/lib/browser/unsavedChildren.js +6 -50
- package/lib/browser/uuid.js +3 -1
- package/lib/node/Analytics.js +1 -18
- package/lib/node/AnonymousUtils.js +5 -37
- package/lib/node/Cloud.js +10 -66
- package/lib/node/CloudCode.js +0 -3
- package/lib/node/CoreManager.js +47 -220
- package/lib/node/CryptoController.js +2 -16
- package/lib/node/EventEmitter.js +1 -1
- package/lib/node/EventuallyQueue.js +16 -123
- package/lib/node/FacebookUtils.js +5 -37
- package/lib/node/IndexedDBStorageController.js +3 -19
- package/lib/node/InstallationController.js +2 -15
- package/lib/node/LiveQueryClient.js +56 -136
- package/lib/node/LiveQuerySubscription.js +7 -16
- package/lib/node/LocalDatastore.js +19 -175
- package/lib/node/LocalDatastoreController.js +6 -38
- package/lib/node/LocalDatastoreController.react-native.js +6 -45
- package/lib/node/LocalDatastoreUtils.js +1 -6
- package/lib/node/ObjectStateMutations.js +13 -93
- package/lib/node/OfflineQuery.js +20 -152
- package/lib/node/Parse.js +11 -99
- package/lib/node/ParseACL.js +32 -150
- package/lib/node/ParseCLP.js +69 -262
- package/lib/node/ParseConfig.js +16 -84
- package/lib/node/ParseError.js +61 -65
- package/lib/node/ParseFile.js +49 -205
- package/lib/node/ParseGeoPoint.js +21 -82
- package/lib/node/ParseHooks.js +0 -35
- package/lib/node/ParseInstallation.js +1 -10
- package/lib/node/ParseLiveQuery.js +10 -36
- package/lib/node/ParseObject.js +193 -939
- package/lib/node/ParseOp.js +31 -255
- package/lib/node/ParsePolygon.js +12 -62
- package/lib/node/ParseQuery.js +170 -882
- package/lib/node/ParseRelation.js +11 -61
- package/lib/node/ParseRole.js +10 -57
- package/lib/node/ParseSchema.js +46 -222
- package/lib/node/ParseSession.js +8 -50
- package/lib/node/ParseUser.js +107 -576
- package/lib/node/Push.js +4 -37
- package/lib/node/RESTController.js +8 -110
- package/lib/node/SingleInstanceStateController.js +17 -130
- package/lib/node/Socket.weapp.js +2 -9
- package/lib/node/Storage.js +10 -83
- package/lib/node/StorageController.browser.js +4 -23
- package/lib/node/StorageController.default.js +5 -21
- package/lib/node/StorageController.react-native.js +6 -40
- package/lib/node/StorageController.weapp.js +6 -21
- package/lib/node/TaskQueue.js +1 -17
- package/lib/node/UniqueInstanceStateController.js +16 -133
- package/lib/node/Xhr.weapp.js +0 -15
- package/lib/node/arrayContainsObject.js +1 -12
- package/lib/node/canBeSerialized.js +2 -28
- package/lib/node/decode.js +1 -26
- package/lib/node/encode.js +3 -54
- package/lib/node/equals.js +0 -18
- package/lib/node/escape.js +1 -6
- package/lib/node/isRevocableSession.js +1 -5
- package/lib/node/parseDate.js +1 -7
- package/lib/node/promiseUtils.js +2 -14
- package/lib/node/unique.js +1 -11
- package/lib/node/unsavedChildren.js +2 -38
- package/lib/node/uuid.js +6 -1
- package/lib/react-native/Analytics.js +0 -9
- package/lib/react-native/AnonymousUtils.js +0 -10
- package/lib/react-native/Cloud.js +0 -26
- package/lib/react-native/CoreManager.js +1 -5
- package/lib/react-native/CryptoController.js +0 -2
- package/lib/react-native/EventEmitter.js +0 -2
- package/lib/react-native/EventuallyQueue.js +4 -52
- package/lib/react-native/FacebookUtils.js +0 -22
- package/lib/react-native/IndexedDBStorageController.js +0 -1
- package/lib/react-native/InstallationController.js +0 -6
- package/lib/react-native/LiveQueryClient.js +24 -101
- package/lib/react-native/LiveQuerySubscription.js +3 -27
- package/lib/react-native/LocalDatastore.js +6 -113
- package/lib/react-native/LocalDatastoreController.js +0 -21
- package/lib/react-native/LocalDatastoreController.react-native.js +4 -31
- package/lib/react-native/LocalDatastoreUtils.js +0 -1
- package/lib/react-native/ObjectStateMutations.js +0 -34
- package/lib/react-native/OfflineQuery.js +2 -137
- package/lib/react-native/Parse.js +0 -65
- package/lib/react-native/ParseACL.js +0 -44
- package/lib/react-native/ParseCLP.js +32 -96
- package/lib/react-native/ParseConfig.js +0 -42
- package/lib/react-native/ParseError.js +1 -21
- package/lib/react-native/ParseFile.js +3 -72
- package/lib/react-native/ParseGeoPoint.js +0 -17
- package/lib/react-native/ParseHooks.js +0 -30
- package/lib/react-native/ParseInstallation.js +1 -23
- package/lib/react-native/ParseLiveQuery.js +3 -25
- package/lib/react-native/ParseObject.js +4 -371
- package/lib/react-native/ParseOp.js +1 -138
- package/lib/react-native/ParsePolygon.js +0 -24
- package/lib/react-native/ParseQuery.js +6 -262
- package/lib/react-native/ParseRelation.js +0 -25
- package/lib/react-native/ParseRole.js +1 -36
- package/lib/react-native/ParseSchema.js +0 -51
- package/lib/react-native/ParseSession.js +1 -40
- package/lib/react-native/ParseUser.js +1 -224
- package/lib/react-native/Push.js +0 -16
- package/lib/react-native/RESTController.js +1 -70
- package/lib/react-native/SingleInstanceStateController.js +0 -44
- package/lib/react-native/Socket.weapp.js +2 -12
- package/lib/react-native/Storage.js +0 -24
- package/lib/react-native/StorageController.browser.js +0 -2
- package/lib/react-native/StorageController.default.js +0 -1
- package/lib/react-native/StorageController.react-native.js +0 -2
- package/lib/react-native/TaskQueue.js +0 -15
- package/lib/react-native/UniqueInstanceStateController.js +0 -47
- package/lib/react-native/Xhr.weapp.js +0 -16
- package/lib/react-native/arrayContainsObject.js +0 -5
- package/lib/react-native/canBeSerialized.js +0 -18
- package/lib/react-native/decode.js +0 -21
- package/lib/react-native/encode.js +0 -25
- package/lib/react-native/equals.js +0 -18
- package/lib/react-native/escape.js +0 -1
- package/lib/react-native/isRevocableSession.js +0 -1
- package/lib/react-native/parseDate.js +0 -3
- package/lib/react-native/promiseUtils.js +0 -13
- package/lib/react-native/unique.js +0 -4
- package/lib/react-native/unsavedChildren.js +0 -21
- package/lib/react-native/uuid.js +3 -1
- package/lib/weapp/Analytics.js +2 -20
- package/lib/weapp/AnonymousUtils.js +6 -35
- package/lib/weapp/Cloud.js +12 -70
- package/lib/weapp/CloudCode.js +0 -3
- package/lib/weapp/CoreManager.js +46 -184
- package/lib/weapp/CryptoController.js +2 -16
- package/lib/weapp/EventEmitter.js +1 -1
- package/lib/weapp/EventuallyQueue.js +277 -824
- package/lib/weapp/FacebookUtils.js +6 -35
- package/lib/weapp/IndexedDBStorageController.js +3 -14
- package/lib/weapp/InstallationController.js +2 -13
- package/lib/weapp/LiveQueryClient.js +87 -204
- package/lib/weapp/LiveQuerySubscription.js +10 -39
- package/lib/weapp/LocalDatastore.js +451 -1081
- package/lib/weapp/LocalDatastoreController.js +145 -602
- package/lib/weapp/LocalDatastoreController.react-native.js +137 -573
- package/lib/weapp/LocalDatastoreUtils.js +2 -12
- package/lib/weapp/ObjectStateMutations.js +18 -121
- package/lib/weapp/OfflineQuery.js +42 -222
- package/lib/weapp/Parse.js +12 -106
- package/lib/weapp/ParseACL.js +33 -141
- package/lib/weapp/ParseCLP.js +96 -314
- package/lib/weapp/ParseConfig.js +18 -88
- package/lib/weapp/ParseError.js +63 -90
- package/lib/weapp/ParseFile.js +129 -686
- package/lib/weapp/ParseGeoPoint.js +23 -82
- package/lib/weapp/ParseHooks.js +1 -34
- package/lib/weapp/ParseInstallation.js +4 -32
- package/lib/weapp/ParseLiveQuery.js +96 -505
- package/lib/weapp/ParseObject.js +628 -1840
- package/lib/weapp/ParseOp.js +41 -287
- package/lib/weapp/ParsePolygon.js +13 -63
- package/lib/weapp/ParseQuery.js +404 -1505
- package/lib/weapp/ParseRelation.js +12 -61
- package/lib/weapp/ParseRole.js +13 -75
- package/lib/weapp/ParseSchema.js +49 -201
- package/lib/weapp/ParseSession.js +11 -69
- package/lib/weapp/ParseUser.js +274 -1127
- package/lib/weapp/Push.js +7 -43
- package/lib/weapp/RESTController.js +18 -140
- package/lib/weapp/SingleInstanceStateController.js +19 -137
- package/lib/weapp/Socket.weapp.js +2 -12
- package/lib/weapp/Storage.js +10 -73
- package/lib/weapp/StorageController.browser.js +4 -17
- package/lib/weapp/StorageController.default.js +4 -17
- package/lib/weapp/StorageController.react-native.js +6 -33
- package/lib/weapp/StorageController.weapp.js +5 -16
- package/lib/weapp/TaskQueue.js +1 -22
- package/lib/weapp/UniqueInstanceStateController.js +19 -142
- package/lib/weapp/Xhr.weapp.js +0 -17
- package/lib/weapp/arrayContainsObject.js +2 -16
- package/lib/weapp/canBeSerialized.js +3 -33
- package/lib/weapp/decode.js +3 -33
- package/lib/weapp/encode.js +9 -70
- package/lib/weapp/equals.js +2 -25
- package/lib/weapp/escape.js +1 -8
- package/lib/weapp/isRevocableSession.js +2 -11
- package/lib/weapp/parseDate.js +2 -13
- package/lib/weapp/promiseUtils.js +3 -21
- package/lib/weapp/unique.js +3 -17
- package/lib/weapp/unsavedChildren.js +6 -50
- package/lib/weapp/uuid.js +1 -6
- package/package.json +45 -43
package/lib/weapp/ParseObject.js
CHANGED
|
@@ -1,131 +1,65 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
|
|
6
|
-
|
|
7
|
-
var _Array$isArray2 = require("@babel/runtime-corejs3/core-js-stable/array/is-array");
|
|
8
|
-
|
|
9
|
-
var _getIteratorMethod = require("@babel/runtime-corejs3/core-js/get-iterator-method");
|
|
10
|
-
|
|
11
|
-
var _Array$from = require("@babel/runtime-corejs3/core-js-stable/array/from");
|
|
12
|
-
|
|
13
|
-
var _sliceInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/slice");
|
|
14
|
-
|
|
15
|
-
var _reverseInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/reverse");
|
|
16
|
-
|
|
17
|
-
var _Promise2 = require("@babel/runtime-corejs3/core-js-stable/promise");
|
|
18
|
-
|
|
19
|
-
var _Object$setPrototypeOf = require("@babel/runtime-corejs3/core-js-stable/object/set-prototype-of");
|
|
20
|
-
|
|
21
3
|
var _typeof3 = require("@babel/runtime-corejs3/helpers/typeof");
|
|
22
|
-
|
|
23
|
-
var _Object$getPrototypeOf2 = require("@babel/runtime-corejs3/core-js-stable/object/get-prototype-of");
|
|
24
|
-
|
|
25
|
-
var _Object$create2 = require("@babel/runtime-corejs3/core-js-stable/object/create");
|
|
26
|
-
|
|
27
|
-
var _Symbol = require("@babel/runtime-corejs3/core-js-stable/symbol");
|
|
28
|
-
|
|
29
|
-
var _Object$defineProperty2 = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
30
|
-
|
|
31
|
-
var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
|
|
32
|
-
|
|
33
|
-
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
|
|
34
|
-
|
|
35
|
-
var _forEachInstanceProperty2 = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
|
36
|
-
|
|
37
|
-
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
38
|
-
|
|
39
|
-
var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
|
|
40
|
-
|
|
41
|
-
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
|
|
42
|
-
|
|
43
4
|
var _Object$keys2 = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
|
44
|
-
|
|
5
|
+
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
|
|
6
|
+
var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
|
|
7
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
8
|
+
var _forEachInstanceProperty2 = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
|
9
|
+
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
|
|
10
|
+
var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
|
|
11
|
+
var _Object$defineProperty2 = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
12
|
+
var _sliceInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/slice");
|
|
13
|
+
var _Array$from = require("@babel/runtime-corejs3/core-js-stable/array/from");
|
|
14
|
+
var _Symbol = require("@babel/runtime-corejs3/core-js-stable/symbol");
|
|
15
|
+
var _getIteratorMethod = require("@babel/runtime-corejs3/core-js/get-iterator-method");
|
|
16
|
+
var _Array$isArray2 = require("@babel/runtime-corejs3/core-js-stable/array/is-array");
|
|
17
|
+
var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
|
|
18
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
45
19
|
_Object$defineProperty2(exports, "__esModule", {
|
|
46
20
|
value: true
|
|
47
21
|
});
|
|
48
|
-
|
|
49
22
|
exports.default = void 0;
|
|
50
|
-
|
|
51
|
-
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
52
|
-
|
|
53
|
-
var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find"));
|
|
54
|
-
|
|
23
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs3/regenerator"));
|
|
55
24
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/toConsumableArray"));
|
|
56
|
-
|
|
57
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/define-property"));
|
|
58
|
-
|
|
59
|
-
var _create = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/create"));
|
|
60
|
-
|
|
61
|
-
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
62
|
-
|
|
63
|
-
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
64
|
-
|
|
65
25
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
|
|
66
|
-
|
|
67
|
-
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
68
|
-
|
|
69
|
-
var _getPrototypeOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/get-prototype-of"));
|
|
70
|
-
|
|
71
|
-
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
72
|
-
|
|
73
|
-
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/json/stringify"));
|
|
74
|
-
|
|
75
|
-
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
76
|
-
|
|
77
|
-
var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
|
|
78
|
-
|
|
79
|
-
var _freeze = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/freeze"));
|
|
80
|
-
|
|
81
26
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
|
|
82
|
-
|
|
83
27
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
84
|
-
|
|
85
28
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
86
|
-
|
|
87
|
-
var _defineProperty3 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
88
|
-
|
|
29
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
89
30
|
var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
|
|
90
|
-
|
|
31
|
+
var _freeze = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/freeze"));
|
|
32
|
+
var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
|
|
33
|
+
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
34
|
+
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/json/stringify"));
|
|
35
|
+
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
36
|
+
var _getPrototypeOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/get-prototype-of"));
|
|
37
|
+
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
38
|
+
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
39
|
+
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
40
|
+
var _create = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/create"));
|
|
41
|
+
var _defineProperty3 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/define-property"));
|
|
42
|
+
var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find"));
|
|
43
|
+
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
91
44
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
92
|
-
|
|
93
45
|
var _canBeSerialized = _interopRequireDefault(require("./canBeSerialized"));
|
|
94
|
-
|
|
95
46
|
var _decode = _interopRequireDefault(require("./decode"));
|
|
96
|
-
|
|
97
47
|
var _encode = _interopRequireDefault(require("./encode"));
|
|
98
|
-
|
|
99
48
|
var _escape2 = _interopRequireDefault(require("./escape"));
|
|
100
|
-
|
|
101
49
|
var _EventuallyQueue = _interopRequireDefault(require("./EventuallyQueue"));
|
|
102
|
-
|
|
103
50
|
var _ParseACL = _interopRequireDefault(require("./ParseACL"));
|
|
104
|
-
|
|
105
51
|
var _parseDate = _interopRequireDefault(require("./parseDate"));
|
|
106
|
-
|
|
107
52
|
var _ParseError = _interopRequireDefault(require("./ParseError"));
|
|
108
|
-
|
|
109
53
|
var _ParseFile = _interopRequireDefault(require("./ParseFile"));
|
|
110
|
-
|
|
111
54
|
var _promiseUtils = require("./promiseUtils");
|
|
112
|
-
|
|
113
55
|
var _LocalDatastoreUtils = require("./LocalDatastoreUtils");
|
|
114
|
-
|
|
115
56
|
var _ParseOp = require("./ParseOp");
|
|
116
|
-
|
|
117
57
|
var _ParseQuery = _interopRequireDefault(require("./ParseQuery"));
|
|
118
|
-
|
|
119
58
|
var _ParseRelation = _interopRequireDefault(require("./ParseRelation"));
|
|
120
|
-
|
|
121
59
|
var SingleInstanceStateController = _interopRequireWildcard(require("./SingleInstanceStateController"));
|
|
122
|
-
|
|
123
60
|
var _unique = _interopRequireDefault(require("./unique"));
|
|
124
|
-
|
|
125
61
|
var UniqueInstanceStateController = _interopRequireWildcard(require("./UniqueInstanceStateController"));
|
|
126
|
-
|
|
127
62
|
var _unsavedChildren = _interopRequireDefault(require("./unsavedChildren"));
|
|
128
|
-
|
|
129
63
|
function _getRequireWildcardCache(nodeInterop) {
|
|
130
64
|
if (typeof _WeakMap !== "function") return null;
|
|
131
65
|
var cacheBabelInterop = new _WeakMap();
|
|
@@ -134,30 +68,23 @@ function _getRequireWildcardCache(nodeInterop) {
|
|
|
134
68
|
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
135
69
|
})(nodeInterop);
|
|
136
70
|
}
|
|
137
|
-
|
|
138
71
|
function _interopRequireWildcard(obj, nodeInterop) {
|
|
139
72
|
if (!nodeInterop && obj && obj.__esModule) {
|
|
140
73
|
return obj;
|
|
141
74
|
}
|
|
142
|
-
|
|
143
75
|
if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") {
|
|
144
76
|
return {
|
|
145
77
|
default: obj
|
|
146
78
|
};
|
|
147
79
|
}
|
|
148
|
-
|
|
149
80
|
var cache = _getRequireWildcardCache(nodeInterop);
|
|
150
|
-
|
|
151
81
|
if (cache && cache.has(obj)) {
|
|
152
82
|
return cache.get(obj);
|
|
153
83
|
}
|
|
154
|
-
|
|
155
84
|
var newObj = {};
|
|
156
|
-
|
|
157
85
|
for (var key in obj) {
|
|
158
86
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
159
87
|
var desc = _Object$defineProperty2 && _Object$getOwnPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null;
|
|
160
|
-
|
|
161
88
|
if (desc && (desc.get || desc.set)) {
|
|
162
89
|
_Object$defineProperty2(newObj, key, desc);
|
|
163
90
|
} else {
|
|
@@ -165,26 +92,19 @@ function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
165
92
|
}
|
|
166
93
|
}
|
|
167
94
|
}
|
|
168
|
-
|
|
169
95
|
newObj.default = obj;
|
|
170
|
-
|
|
171
96
|
if (cache) {
|
|
172
97
|
cache.set(obj, newObj);
|
|
173
98
|
}
|
|
174
|
-
|
|
175
99
|
return newObj;
|
|
176
100
|
}
|
|
177
|
-
|
|
178
101
|
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
179
102
|
var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"];
|
|
180
|
-
|
|
181
103
|
if (!it) {
|
|
182
104
|
if (_Array$isArray2(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
183
105
|
if (it) o = it;
|
|
184
106
|
var i = 0;
|
|
185
|
-
|
|
186
107
|
var F = function () {};
|
|
187
|
-
|
|
188
108
|
return {
|
|
189
109
|
s: F,
|
|
190
110
|
n: function () {
|
|
@@ -202,13 +122,11 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
|
202
122
|
f: F
|
|
203
123
|
};
|
|
204
124
|
}
|
|
205
|
-
|
|
206
125
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
207
126
|
}
|
|
208
|
-
|
|
209
127
|
var normalCompletion = true,
|
|
210
|
-
|
|
211
|
-
|
|
128
|
+
didErr = false,
|
|
129
|
+
err;
|
|
212
130
|
return {
|
|
213
131
|
s: function () {
|
|
214
132
|
it = it.call(o);
|
|
@@ -231,462 +149,81 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
|
231
149
|
}
|
|
232
150
|
};
|
|
233
151
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
if (
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
if (
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
function _arrayLikeToArray(arr, len) {
|
|
249
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
250
|
-
|
|
251
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
252
|
-
arr2[i] = arr[i];
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
return arr2;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
function _regeneratorRuntime() {
|
|
259
|
-
"use strict";
|
|
260
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
261
|
-
|
|
262
|
-
_regeneratorRuntime = function () {
|
|
263
|
-
return exports;
|
|
264
|
-
};
|
|
265
|
-
|
|
266
|
-
var exports = {},
|
|
267
|
-
Op = Object.prototype,
|
|
268
|
-
hasOwn = Op.hasOwnProperty,
|
|
269
|
-
$Symbol = "function" == typeof _Symbol ? _Symbol : {},
|
|
270
|
-
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
271
|
-
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
272
|
-
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
273
|
-
|
|
274
|
-
function define(obj, key, value) {
|
|
275
|
-
return _Object$defineProperty2(obj, key, {
|
|
276
|
-
value: value,
|
|
277
|
-
enumerable: !0,
|
|
278
|
-
configurable: !0,
|
|
279
|
-
writable: !0
|
|
280
|
-
}), obj[key];
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
try {
|
|
284
|
-
define({}, "");
|
|
285
|
-
} catch (err) {
|
|
286
|
-
define = function (obj, key, value) {
|
|
287
|
-
return obj[key] = value;
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
292
|
-
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
293
|
-
generator = _Object$create2(protoGenerator.prototype),
|
|
294
|
-
context = new Context(tryLocsList || []);
|
|
295
|
-
|
|
296
|
-
return generator._invoke = function (innerFn, self, context) {
|
|
297
|
-
var state = "suspendedStart";
|
|
298
|
-
return function (method, arg) {
|
|
299
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
300
|
-
|
|
301
|
-
if ("completed" === state) {
|
|
302
|
-
if ("throw" === method) throw arg;
|
|
303
|
-
return doneResult();
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
for (context.method = method, context.arg = arg;;) {
|
|
307
|
-
var delegate = context.delegate;
|
|
308
|
-
|
|
309
|
-
if (delegate) {
|
|
310
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
311
|
-
|
|
312
|
-
if (delegateResult) {
|
|
313
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
314
|
-
return delegateResult;
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
319
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
320
|
-
context.dispatchException(context.arg);
|
|
321
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
322
|
-
state = "executing";
|
|
323
|
-
var record = tryCatch(innerFn, self, context);
|
|
324
|
-
|
|
325
|
-
if ("normal" === record.type) {
|
|
326
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
327
|
-
return {
|
|
328
|
-
value: record.arg,
|
|
329
|
-
done: context.done
|
|
330
|
-
};
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
334
|
-
}
|
|
335
|
-
};
|
|
336
|
-
}(innerFn, self, context), generator;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
function tryCatch(fn, obj, arg) {
|
|
340
|
-
try {
|
|
341
|
-
return {
|
|
342
|
-
type: "normal",
|
|
343
|
-
arg: fn.call(obj, arg)
|
|
344
|
-
};
|
|
345
|
-
} catch (err) {
|
|
346
|
-
return {
|
|
347
|
-
type: "throw",
|
|
348
|
-
arg: err
|
|
349
|
-
};
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
exports.wrap = wrap;
|
|
354
|
-
var ContinueSentinel = {};
|
|
355
|
-
|
|
356
|
-
function Generator() {}
|
|
357
|
-
|
|
358
|
-
function GeneratorFunction() {}
|
|
359
|
-
|
|
360
|
-
function GeneratorFunctionPrototype() {}
|
|
361
|
-
|
|
362
|
-
var IteratorPrototype = {};
|
|
363
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
364
|
-
return this;
|
|
365
|
-
});
|
|
366
|
-
var getProto = _Object$getPrototypeOf2,
|
|
367
|
-
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
368
|
-
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
369
|
-
|
|
370
|
-
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create2(IteratorPrototype);
|
|
371
|
-
|
|
372
|
-
function defineIteratorMethods(prototype) {
|
|
373
|
-
var _context19;
|
|
374
|
-
|
|
375
|
-
_forEachInstanceProperty2(_context19 = ["next", "throw", "return"]).call(_context19, function (method) {
|
|
376
|
-
define(prototype, method, function (arg) {
|
|
377
|
-
return this._invoke(method, arg);
|
|
378
|
-
});
|
|
379
|
-
});
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
function AsyncIterator(generator, PromiseImpl) {
|
|
383
|
-
function invoke(method, arg, resolve, reject) {
|
|
384
|
-
var record = tryCatch(generator[method], generator, arg);
|
|
385
|
-
|
|
386
|
-
if ("throw" !== record.type) {
|
|
387
|
-
var result = record.arg,
|
|
388
|
-
value = result.value;
|
|
389
|
-
return value && "object" == _typeof3(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
390
|
-
invoke("next", value, resolve, reject);
|
|
391
|
-
}, function (err) {
|
|
392
|
-
invoke("throw", err, resolve, reject);
|
|
393
|
-
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
394
|
-
result.value = unwrapped, resolve(result);
|
|
395
|
-
}, function (error) {
|
|
396
|
-
return invoke("throw", error, resolve, reject);
|
|
397
|
-
});
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
reject(record.arg);
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
var previousPromise;
|
|
404
|
-
|
|
405
|
-
this._invoke = function (method, arg) {
|
|
406
|
-
function callInvokeWithMethodAndArg() {
|
|
407
|
-
return new PromiseImpl(function (resolve, reject) {
|
|
408
|
-
invoke(method, arg, resolve, reject);
|
|
409
|
-
});
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
413
|
-
};
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
function maybeInvokeDelegate(delegate, context) {
|
|
417
|
-
var method = delegate.iterator[context.method];
|
|
418
|
-
|
|
419
|
-
if (undefined === method) {
|
|
420
|
-
if (context.delegate = null, "throw" === context.method) {
|
|
421
|
-
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
422
|
-
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
return ContinueSentinel;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
429
|
-
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
430
|
-
var info = record.arg;
|
|
431
|
-
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
function pushTryEntry(locs) {
|
|
435
|
-
var entry = {
|
|
436
|
-
tryLoc: locs[0]
|
|
437
|
-
};
|
|
438
|
-
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
function resetTryEntry(entry) {
|
|
442
|
-
var record = entry.completion || {};
|
|
443
|
-
record.type = "normal", delete record.arg, entry.completion = record;
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
function Context(tryLocsList) {
|
|
447
|
-
this.tryEntries = [{
|
|
448
|
-
tryLoc: "root"
|
|
449
|
-
}], _forEachInstanceProperty2(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0);
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
function values(iterable) {
|
|
453
|
-
if (iterable) {
|
|
454
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
455
|
-
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
456
|
-
if ("function" == typeof iterable.next) return iterable;
|
|
457
|
-
|
|
458
|
-
if (!isNaN(iterable.length)) {
|
|
459
|
-
var i = -1,
|
|
460
|
-
next = function next() {
|
|
461
|
-
for (; ++i < iterable.length;) {
|
|
462
|
-
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
return next.value = undefined, next.done = !0, next;
|
|
466
|
-
};
|
|
467
|
-
|
|
468
|
-
return next.next = next;
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
return {
|
|
473
|
-
next: doneResult
|
|
474
|
-
};
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
function doneResult() {
|
|
478
|
-
return {
|
|
479
|
-
value: undefined,
|
|
480
|
-
done: !0
|
|
481
|
-
};
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
485
|
-
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
486
|
-
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
487
|
-
}, exports.mark = function (genFun) {
|
|
488
|
-
return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create2(Gp), genFun;
|
|
489
|
-
}, exports.awrap = function (arg) {
|
|
490
|
-
return {
|
|
491
|
-
__await: arg
|
|
492
|
-
};
|
|
493
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
494
|
-
return this;
|
|
495
|
-
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
496
|
-
void 0 === PromiseImpl && (PromiseImpl = _Promise2);
|
|
497
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
498
|
-
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
499
|
-
return result.done ? result.value : iter.next();
|
|
500
|
-
});
|
|
501
|
-
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
502
|
-
return this;
|
|
503
|
-
}), define(Gp, "toString", function () {
|
|
504
|
-
return "[object Generator]";
|
|
505
|
-
}), exports.keys = function (object) {
|
|
506
|
-
var keys = [];
|
|
507
|
-
|
|
508
|
-
for (var key in object) {
|
|
509
|
-
keys.push(key);
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
return _reverseInstanceProperty(keys).call(keys), function next() {
|
|
513
|
-
for (; keys.length;) {
|
|
514
|
-
var key = keys.pop();
|
|
515
|
-
if (key in object) return next.value = key, next.done = !1, next;
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
return next.done = !0, next;
|
|
519
|
-
};
|
|
520
|
-
}, exports.values = values, Context.prototype = {
|
|
521
|
-
constructor: Context,
|
|
522
|
-
reset: function (skipTempReset) {
|
|
523
|
-
var _context20;
|
|
524
|
-
|
|
525
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty2(_context20 = this.tryEntries).call(_context20, resetTryEntry), !skipTempReset) for (var name in this) {
|
|
526
|
-
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 1)) && (this[name] = undefined);
|
|
527
|
-
}
|
|
528
|
-
},
|
|
529
|
-
stop: function () {
|
|
530
|
-
this.done = !0;
|
|
531
|
-
var rootRecord = this.tryEntries[0].completion;
|
|
532
|
-
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
533
|
-
return this.rval;
|
|
534
|
-
},
|
|
535
|
-
dispatchException: function (exception) {
|
|
536
|
-
if (this.done) throw exception;
|
|
537
|
-
var context = this;
|
|
538
|
-
|
|
539
|
-
function handle(loc, caught) {
|
|
540
|
-
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
544
|
-
var entry = this.tryEntries[i],
|
|
545
|
-
record = entry.completion;
|
|
546
|
-
if ("root" === entry.tryLoc) return handle("end");
|
|
547
|
-
|
|
548
|
-
if (entry.tryLoc <= this.prev) {
|
|
549
|
-
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
550
|
-
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
551
|
-
|
|
552
|
-
if (hasCatch && hasFinally) {
|
|
553
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
554
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
555
|
-
} else if (hasCatch) {
|
|
556
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
557
|
-
} else {
|
|
558
|
-
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
559
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
},
|
|
564
|
-
abrupt: function (type, arg) {
|
|
565
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
566
|
-
var entry = this.tryEntries[i];
|
|
567
|
-
|
|
568
|
-
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
569
|
-
var finallyEntry = entry;
|
|
570
|
-
break;
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
575
|
-
var record = finallyEntry ? finallyEntry.completion : {};
|
|
576
|
-
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
577
|
-
},
|
|
578
|
-
complete: function (record, afterLoc) {
|
|
579
|
-
if ("throw" === record.type) throw record.arg;
|
|
580
|
-
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
|
|
581
|
-
},
|
|
582
|
-
finish: function (finallyLoc) {
|
|
583
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
584
|
-
var entry = this.tryEntries[i];
|
|
585
|
-
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
586
|
-
}
|
|
587
|
-
},
|
|
588
|
-
catch: function (tryLoc) {
|
|
589
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
590
|
-
var entry = this.tryEntries[i];
|
|
591
|
-
|
|
592
|
-
if (entry.tryLoc === tryLoc) {
|
|
593
|
-
var record = entry.completion;
|
|
594
|
-
|
|
595
|
-
if ("throw" === record.type) {
|
|
596
|
-
var thrown = record.arg;
|
|
597
|
-
resetTryEntry(entry);
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
return thrown;
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
throw new Error("illegal catch attempt");
|
|
605
|
-
},
|
|
606
|
-
delegateYield: function (iterable, resultName, nextLoc) {
|
|
607
|
-
return this.delegate = {
|
|
608
|
-
iterator: values(iterable),
|
|
609
|
-
resultName: resultName,
|
|
610
|
-
nextLoc: nextLoc
|
|
611
|
-
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
612
|
-
}
|
|
613
|
-
}, exports;
|
|
152
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
153
|
+
var _context19;
|
|
154
|
+
if (!o) return;
|
|
155
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
156
|
+
var n = _sliceInstanceProperty(_context19 = Object.prototype.toString.call(o)).call(_context19, 8, -1);
|
|
157
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
158
|
+
if (n === "Map" || n === "Set") return _Array$from(o);
|
|
159
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
160
|
+
}
|
|
161
|
+
function _arrayLikeToArray(arr, len) {
|
|
162
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
163
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
164
|
+
return arr2;
|
|
614
165
|
}
|
|
615
|
-
|
|
616
166
|
function ownKeys(object, enumerableOnly) {
|
|
617
167
|
var keys = _Object$keys2(object);
|
|
618
|
-
|
|
619
168
|
if (_Object$getOwnPropertySymbols) {
|
|
620
169
|
var symbols = _Object$getOwnPropertySymbols(object);
|
|
621
|
-
|
|
622
170
|
enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) {
|
|
623
171
|
return _Object$getOwnPropertyDescriptor(object, sym).enumerable;
|
|
624
172
|
})), keys.push.apply(keys, symbols);
|
|
625
173
|
}
|
|
626
|
-
|
|
627
174
|
return keys;
|
|
628
175
|
}
|
|
629
|
-
|
|
630
176
|
function _objectSpread(target) {
|
|
631
177
|
for (var i = 1; i < arguments.length; i++) {
|
|
632
178
|
var _context17, _context18;
|
|
633
|
-
|
|
634
179
|
var source = null != arguments[i] ? arguments[i] : {};
|
|
635
180
|
i % 2 ? _forEachInstanceProperty2(_context17 = ownKeys(Object(source), !0)).call(_context17, function (key) {
|
|
636
|
-
(0,
|
|
181
|
+
(0, _defineProperty2.default)(target, key, source[key]);
|
|
637
182
|
}) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty2(_context18 = ownKeys(Object(source))).call(_context18, function (key) {
|
|
638
183
|
_Object$defineProperty2(target, key, _Object$getOwnPropertyDescriptor(source, key));
|
|
639
184
|
});
|
|
640
185
|
}
|
|
641
|
-
|
|
642
186
|
return target;
|
|
643
187
|
}
|
|
644
|
-
|
|
645
188
|
var uuidv4 = require('./uuid');
|
|
646
189
|
/*:: export type Pointer = {
|
|
647
190
|
__type: string,
|
|
648
191
|
className: string,
|
|
649
192
|
objectId: string,
|
|
650
193
|
};*/
|
|
651
|
-
|
|
652
194
|
/*:: type SaveParams = {
|
|
653
195
|
method: string,
|
|
654
196
|
path: string,
|
|
655
197
|
body: AttributeMap,
|
|
656
198
|
};*/
|
|
657
|
-
|
|
658
199
|
/*:: export type SaveOptions = FullOptions & {
|
|
659
200
|
cascadeSave?: boolean,
|
|
660
201
|
context?: AttributeMap,
|
|
661
202
|
};*/
|
|
662
203
|
// Mapping of class names to constructors, so we can populate objects from the
|
|
663
204
|
// server with appropriate subclasses of ParseObject
|
|
205
|
+
var classMap = {};
|
|
664
206
|
|
|
665
|
-
|
|
666
|
-
var
|
|
667
|
-
|
|
668
|
-
var objectCount = 0; // On web clients, objects are single-instance: any two objects with the same Id
|
|
207
|
+
// Global counter for generating unique Ids for non-single-instance objects
|
|
208
|
+
var objectCount = 0;
|
|
209
|
+
// On web clients, objects are single-instance: any two objects with the same Id
|
|
669
210
|
// will have the same attributes. However, this may be dangerous default
|
|
670
211
|
// behavior in a server scenario
|
|
671
|
-
|
|
672
212
|
var singleInstance = !_CoreManager.default.get('IS_NODE');
|
|
673
|
-
|
|
674
213
|
if (singleInstance) {
|
|
675
214
|
_CoreManager.default.setObjectStateController(SingleInstanceStateController);
|
|
676
215
|
} else {
|
|
677
216
|
_CoreManager.default.setObjectStateController(UniqueInstanceStateController);
|
|
678
217
|
}
|
|
679
|
-
|
|
680
218
|
function getServerUrlPath() {
|
|
681
219
|
var serverUrl = _CoreManager.default.get('SERVER_URL');
|
|
682
|
-
|
|
683
220
|
if (serverUrl[serverUrl.length - 1] !== '/') {
|
|
684
221
|
serverUrl += '/';
|
|
685
222
|
}
|
|
686
|
-
|
|
687
223
|
var url = serverUrl.replace(/https?:\/\//, '');
|
|
688
224
|
return url.substr((0, _indexOf.default)(url).call(url, '/'));
|
|
689
225
|
}
|
|
226
|
+
|
|
690
227
|
/**
|
|
691
228
|
* Creates a new model with defined attributes.
|
|
692
229
|
*
|
|
@@ -705,148 +242,118 @@ function getServerUrlPath() {
|
|
|
705
242
|
*
|
|
706
243
|
* @alias Parse.Object
|
|
707
244
|
*/
|
|
708
|
-
|
|
709
|
-
|
|
710
245
|
var ParseObject = /*#__PURE__*/function () {
|
|
711
246
|
/**
|
|
712
247
|
* @param {string} className The class name for the object
|
|
713
248
|
* @param {object} attributes The initial set of data to store in the object.
|
|
714
249
|
* @param {object} options The options for this object instance.
|
|
715
250
|
*/
|
|
716
|
-
function ParseObject(className
|
|
717
|
-
/*: ?string | { className: string, [attr: string]: mixed }*/
|
|
718
|
-
, attributes
|
|
719
|
-
/*:: ?: { [attr: string]: mixed }*/
|
|
720
|
-
, options
|
|
721
|
-
/*:: ?: { ignoreValidation: boolean }*/
|
|
722
|
-
) {
|
|
251
|
+
function ParseObject(className /*: ?string | { className: string, [attr: string]: mixed }*/, attributes /*:: ?: { [attr: string]: mixed }*/, options /*:: ?: { ignoreValidation: boolean }*/) {
|
|
723
252
|
(0, _classCallCheck2.default)(this, ParseObject);
|
|
724
|
-
(0,
|
|
725
|
-
(0,
|
|
726
|
-
(0,
|
|
727
|
-
(0,
|
|
728
|
-
|
|
253
|
+
(0, _defineProperty2.default)(this, "id", void 0);
|
|
254
|
+
(0, _defineProperty2.default)(this, "_localId", void 0);
|
|
255
|
+
(0, _defineProperty2.default)(this, "_objCount", void 0);
|
|
256
|
+
(0, _defineProperty2.default)(this, "className", void 0);
|
|
257
|
+
// Enable legacy initializers
|
|
729
258
|
if (typeof this.initialize === 'function') {
|
|
730
259
|
this.initialize.apply(this, arguments);
|
|
731
260
|
}
|
|
732
|
-
|
|
733
261
|
var toSet = null;
|
|
734
262
|
this._objCount = objectCount++;
|
|
735
|
-
|
|
736
263
|
if (typeof className === 'string') {
|
|
737
264
|
this.className = className;
|
|
738
|
-
|
|
739
265
|
if (attributes && (0, _typeof2.default)(attributes) === 'object') {
|
|
740
266
|
toSet = attributes;
|
|
741
267
|
}
|
|
742
268
|
} else if (className && (0, _typeof2.default)(className) === 'object') {
|
|
743
269
|
this.className = className.className;
|
|
744
270
|
toSet = {};
|
|
745
|
-
|
|
746
271
|
for (var _attr in className) {
|
|
747
272
|
if (_attr !== 'className') {
|
|
748
273
|
toSet[_attr] = className[_attr];
|
|
749
274
|
}
|
|
750
275
|
}
|
|
751
|
-
|
|
752
276
|
if (attributes && (0, _typeof2.default)(attributes) === 'object') {
|
|
753
277
|
options = attributes;
|
|
754
278
|
}
|
|
755
279
|
}
|
|
756
|
-
|
|
757
280
|
if (toSet && !this.set(toSet, options)) {
|
|
758
281
|
throw new Error("Can't create an invalid Parse Object");
|
|
759
282
|
}
|
|
760
283
|
}
|
|
284
|
+
|
|
761
285
|
/**
|
|
762
286
|
* The ID of this object, unique within its class.
|
|
763
287
|
*
|
|
764
288
|
* @property {string} id
|
|
765
289
|
*/
|
|
766
|
-
|
|
767
|
-
|
|
768
290
|
(0, _createClass2.default)(ParseObject, [{
|
|
769
291
|
key: "attributes",
|
|
770
|
-
get:
|
|
771
|
-
/** Prototype getters / setters **/
|
|
772
|
-
function ()
|
|
773
|
-
/*: AttributeMap*/
|
|
774
|
-
{
|
|
775
|
-
var stateController = _CoreManager.default.getObjectStateController();
|
|
292
|
+
get: /* Prototype getters / setters */
|
|
776
293
|
|
|
294
|
+
function () /*: AttributeMap*/{
|
|
295
|
+
var stateController = _CoreManager.default.getObjectStateController();
|
|
777
296
|
return (0, _freeze.default)(stateController.estimateAttributes(this._getStateIdentifier()));
|
|
778
297
|
}
|
|
298
|
+
|
|
779
299
|
/**
|
|
780
300
|
* The first time this object was saved on the server.
|
|
781
301
|
*
|
|
782
302
|
* @property {Date} createdAt
|
|
783
303
|
* @returns {Date}
|
|
784
304
|
*/
|
|
785
|
-
|
|
786
305
|
}, {
|
|
787
306
|
key: "createdAt",
|
|
788
|
-
get: function ()
|
|
789
|
-
/*: ?Date*/
|
|
790
|
-
{
|
|
307
|
+
get: function () /*: ?Date*/{
|
|
791
308
|
return this._getServerData().createdAt;
|
|
792
309
|
}
|
|
310
|
+
|
|
793
311
|
/**
|
|
794
312
|
* The last time this object was updated on the server.
|
|
795
313
|
*
|
|
796
314
|
* @property {Date} updatedAt
|
|
797
315
|
* @returns {Date}
|
|
798
316
|
*/
|
|
799
|
-
|
|
800
317
|
}, {
|
|
801
318
|
key: "updatedAt",
|
|
802
|
-
get: function ()
|
|
803
|
-
/*: ?Date*/
|
|
804
|
-
{
|
|
319
|
+
get: function () /*: ?Date*/{
|
|
805
320
|
return this._getServerData().updatedAt;
|
|
806
321
|
}
|
|
807
|
-
|
|
322
|
+
|
|
323
|
+
/* Private methods */
|
|
808
324
|
|
|
809
325
|
/**
|
|
810
326
|
* Returns a local or server Id used uniquely identify this object
|
|
811
327
|
*
|
|
812
328
|
* @returns {string}
|
|
813
329
|
*/
|
|
814
|
-
|
|
815
330
|
}, {
|
|
816
331
|
key: "_getId",
|
|
817
|
-
value: function ()
|
|
818
|
-
/*: string*/
|
|
819
|
-
{
|
|
332
|
+
value: function () /*: string*/{
|
|
820
333
|
if (typeof this.id === 'string') {
|
|
821
334
|
return this.id;
|
|
822
335
|
}
|
|
823
|
-
|
|
824
336
|
if (typeof this._localId === 'string') {
|
|
825
337
|
return this._localId;
|
|
826
338
|
}
|
|
827
|
-
|
|
828
339
|
var localId = 'local' + uuidv4();
|
|
829
340
|
this._localId = localId;
|
|
830
341
|
return localId;
|
|
831
342
|
}
|
|
343
|
+
|
|
832
344
|
/**
|
|
833
345
|
* Returns a unique identifier used to pull data from the State Controller.
|
|
834
346
|
*
|
|
835
347
|
* @returns {Parse.Object|object}
|
|
836
348
|
*/
|
|
837
|
-
|
|
838
349
|
}, {
|
|
839
350
|
key: "_getStateIdentifier",
|
|
840
|
-
value: function ()
|
|
841
|
-
/*: ParseObject | { id: string, className: string }*/
|
|
842
|
-
{
|
|
351
|
+
value: function () /*: ParseObject | { id: string, className: string }*/{
|
|
843
352
|
if (singleInstance) {
|
|
844
353
|
var id = this.id;
|
|
845
|
-
|
|
846
354
|
if (!id) {
|
|
847
355
|
id = this._getId();
|
|
848
356
|
}
|
|
849
|
-
|
|
850
357
|
return {
|
|
851
358
|
id: id,
|
|
852
359
|
className: this.className
|
|
@@ -857,49 +364,36 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
857
364
|
}
|
|
858
365
|
}, {
|
|
859
366
|
key: "_getServerData",
|
|
860
|
-
value: function ()
|
|
861
|
-
/*: AttributeMap*/
|
|
862
|
-
{
|
|
367
|
+
value: function () /*: AttributeMap*/{
|
|
863
368
|
var stateController = _CoreManager.default.getObjectStateController();
|
|
864
|
-
|
|
865
369
|
return stateController.getServerData(this._getStateIdentifier());
|
|
866
370
|
}
|
|
867
371
|
}, {
|
|
868
372
|
key: "_clearServerData",
|
|
869
373
|
value: function () {
|
|
870
374
|
var serverData = this._getServerData();
|
|
871
|
-
|
|
872
375
|
var unset = {};
|
|
873
|
-
|
|
874
376
|
for (var _attr2 in serverData) {
|
|
875
377
|
unset[_attr2] = undefined;
|
|
876
378
|
}
|
|
877
|
-
|
|
878
379
|
var stateController = _CoreManager.default.getObjectStateController();
|
|
879
|
-
|
|
880
380
|
stateController.setServerData(this._getStateIdentifier(), unset);
|
|
881
381
|
}
|
|
882
382
|
}, {
|
|
883
383
|
key: "_getPendingOps",
|
|
884
|
-
value: function ()
|
|
885
|
-
/*: Array<OpsMap>*/
|
|
886
|
-
{
|
|
384
|
+
value: function () /*: Array<OpsMap>*/{
|
|
887
385
|
var stateController = _CoreManager.default.getObjectStateController();
|
|
888
|
-
|
|
889
386
|
return stateController.getPendingOps(this._getStateIdentifier());
|
|
890
387
|
}
|
|
388
|
+
|
|
891
389
|
/**
|
|
892
390
|
* @param {Array<string>} [keysToClear] - if specified, only ops matching
|
|
893
391
|
* these fields will be cleared
|
|
894
392
|
*/
|
|
895
|
-
|
|
896
393
|
}, {
|
|
897
394
|
key: "_clearPendingOps",
|
|
898
|
-
value: function (keysToClear
|
|
899
|
-
/*:: ?: Array<string>*/
|
|
900
|
-
) {
|
|
395
|
+
value: function (keysToClear /*:: ?: Array<string>*/) {
|
|
901
396
|
var pending = this._getPendingOps();
|
|
902
|
-
|
|
903
397
|
var latest = pending[pending.length - 1];
|
|
904
398
|
var keys = keysToClear || (0, _keys.default)(latest);
|
|
905
399
|
(0, _forEach.default)(keys).call(keys, function (key) {
|
|
@@ -908,26 +402,19 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
908
402
|
}
|
|
909
403
|
}, {
|
|
910
404
|
key: "_getDirtyObjectAttributes",
|
|
911
|
-
value: function ()
|
|
912
|
-
/*: AttributeMap*/
|
|
913
|
-
{
|
|
405
|
+
value: function () /*: AttributeMap*/{
|
|
914
406
|
var attributes = this.attributes;
|
|
915
|
-
|
|
916
407
|
var stateController = _CoreManager.default.getObjectStateController();
|
|
917
|
-
|
|
918
408
|
var objectCache = stateController.getObjectCache(this._getStateIdentifier());
|
|
919
409
|
var dirty = {};
|
|
920
|
-
|
|
921
410
|
for (var _attr3 in attributes) {
|
|
922
411
|
var val = attributes[_attr3];
|
|
923
|
-
|
|
924
412
|
if (val && (0, _typeof2.default)(val) === 'object' && !(val instanceof ParseObject) && !(val instanceof _ParseFile.default) && !(val instanceof _ParseRelation.default)) {
|
|
925
413
|
// Due to the way browsers construct maps, the key order will not change
|
|
926
414
|
// unless the object is changed
|
|
927
415
|
try {
|
|
928
416
|
var json = (0, _encode.default)(val, false, true);
|
|
929
417
|
var stringified = (0, _stringify.default)(json);
|
|
930
|
-
|
|
931
418
|
if (objectCache[_attr3] !== stringified) {
|
|
932
419
|
dirty[_attr3] = val;
|
|
933
420
|
}
|
|
@@ -938,45 +425,29 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
938
425
|
}
|
|
939
426
|
}
|
|
940
427
|
}
|
|
941
|
-
|
|
942
428
|
return dirty;
|
|
943
429
|
}
|
|
944
430
|
}, {
|
|
945
431
|
key: "_toFullJSON",
|
|
946
|
-
value: function (seen
|
|
947
|
-
|
|
948
|
-
, offline
|
|
949
|
-
/*:: ?: boolean*/
|
|
950
|
-
)
|
|
951
|
-
/*: AttributeMap*/
|
|
952
|
-
{
|
|
953
|
-
var json
|
|
954
|
-
/*: { [key: string]: mixed }*/
|
|
955
|
-
= this.toJSON(seen, offline);
|
|
432
|
+
value: function (seen /*:: ?: Array<any>*/, offline /*:: ?: boolean*/) /*: AttributeMap*/{
|
|
433
|
+
var json /*: { [key: string]: mixed }*/ = this.toJSON(seen, offline);
|
|
956
434
|
json.__type = 'Object';
|
|
957
435
|
json.className = this.className;
|
|
958
436
|
return json;
|
|
959
437
|
}
|
|
960
438
|
}, {
|
|
961
439
|
key: "_getSaveJSON",
|
|
962
|
-
value: function ()
|
|
963
|
-
/*: AttributeMap*/
|
|
964
|
-
{
|
|
440
|
+
value: function () /*: AttributeMap*/{
|
|
965
441
|
var pending = this._getPendingOps();
|
|
966
|
-
|
|
967
442
|
var dirtyObjects = this._getDirtyObjectAttributes();
|
|
968
|
-
|
|
969
443
|
var json = {};
|
|
970
|
-
|
|
971
444
|
for (var attr in dirtyObjects) {
|
|
972
445
|
var isDotNotation = false;
|
|
973
|
-
|
|
974
446
|
for (var i = 0; i < pending.length; i += 1) {
|
|
975
447
|
for (var field in pending[i]) {
|
|
976
448
|
// Dot notation operations are handled later
|
|
977
449
|
if ((0, _includes.default)(field).call(field, '.')) {
|
|
978
450
|
var fieldName = field.split('.')[0];
|
|
979
|
-
|
|
980
451
|
if (fieldName === attr) {
|
|
981
452
|
isDotNotation = true;
|
|
982
453
|
break;
|
|
@@ -984,29 +455,21 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
984
455
|
}
|
|
985
456
|
}
|
|
986
457
|
}
|
|
987
|
-
|
|
988
458
|
if (!isDotNotation) {
|
|
989
459
|
json[attr] = new _ParseOp.SetOp(dirtyObjects[attr]).toJSON();
|
|
990
460
|
}
|
|
991
461
|
}
|
|
992
|
-
|
|
993
462
|
for (attr in pending[0]) {
|
|
994
463
|
json[attr] = pending[0][attr].toJSON();
|
|
995
464
|
}
|
|
996
|
-
|
|
997
465
|
return json;
|
|
998
466
|
}
|
|
999
467
|
}, {
|
|
1000
468
|
key: "_getSaveParams",
|
|
1001
|
-
value: function ()
|
|
1002
|
-
/*: SaveParams*/
|
|
1003
|
-
{
|
|
469
|
+
value: function () /*: SaveParams*/{
|
|
1004
470
|
var method = this.id ? 'PUT' : 'POST';
|
|
1005
|
-
|
|
1006
471
|
var body = this._getSaveJSON();
|
|
1007
|
-
|
|
1008
472
|
var path = 'classes/' + this.className;
|
|
1009
|
-
|
|
1010
473
|
if (_CoreManager.default.get('ALLOW_CUSTOM_OBJECT_ID')) {
|
|
1011
474
|
if (!this.createdAt) {
|
|
1012
475
|
method = 'POST';
|
|
@@ -1020,7 +483,6 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
1020
483
|
} else if (this.className === '_User') {
|
|
1021
484
|
path = 'users';
|
|
1022
485
|
}
|
|
1023
|
-
|
|
1024
486
|
return {
|
|
1025
487
|
method: method,
|
|
1026
488
|
body: body,
|
|
@@ -1029,70 +491,52 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
1029
491
|
}
|
|
1030
492
|
}, {
|
|
1031
493
|
key: "_finishFetch",
|
|
1032
|
-
value: function (serverData
|
|
1033
|
-
/*: AttributeMap*/
|
|
1034
|
-
) {
|
|
494
|
+
value: function (serverData /*: AttributeMap*/) {
|
|
1035
495
|
if (!this.id && serverData.objectId) {
|
|
1036
496
|
this.id = serverData.objectId;
|
|
1037
497
|
}
|
|
1038
|
-
|
|
1039
498
|
var stateController = _CoreManager.default.getObjectStateController();
|
|
1040
|
-
|
|
1041
499
|
stateController.initializeState(this._getStateIdentifier());
|
|
1042
500
|
var decoded = {};
|
|
1043
|
-
|
|
1044
501
|
for (var _attr4 in serverData) {
|
|
1045
502
|
if (_attr4 === 'ACL') {
|
|
1046
503
|
decoded[_attr4] = new _ParseACL.default(serverData[_attr4]);
|
|
1047
504
|
} else if (_attr4 !== 'objectId') {
|
|
1048
505
|
decoded[_attr4] = (0, _decode.default)(serverData[_attr4]);
|
|
1049
|
-
|
|
1050
506
|
if (decoded[_attr4] instanceof _ParseRelation.default) {
|
|
1051
507
|
decoded[_attr4]._ensureParentAndKey(this, _attr4);
|
|
1052
508
|
}
|
|
1053
509
|
}
|
|
1054
510
|
}
|
|
1055
|
-
|
|
1056
511
|
if (decoded.createdAt && typeof decoded.createdAt === 'string') {
|
|
1057
512
|
decoded.createdAt = (0, _parseDate.default)(decoded.createdAt);
|
|
1058
513
|
}
|
|
1059
|
-
|
|
1060
514
|
if (decoded.updatedAt && typeof decoded.updatedAt === 'string') {
|
|
1061
515
|
decoded.updatedAt = (0, _parseDate.default)(decoded.updatedAt);
|
|
1062
516
|
}
|
|
1063
|
-
|
|
1064
517
|
if (!decoded.updatedAt && decoded.createdAt) {
|
|
1065
518
|
decoded.updatedAt = decoded.createdAt;
|
|
1066
519
|
}
|
|
1067
|
-
|
|
1068
520
|
stateController.commitServerChanges(this._getStateIdentifier(), decoded);
|
|
1069
521
|
}
|
|
1070
522
|
}, {
|
|
1071
523
|
key: "_setExisted",
|
|
1072
|
-
value: function (existed
|
|
1073
|
-
/*: boolean*/
|
|
1074
|
-
) {
|
|
524
|
+
value: function (existed /*: boolean*/) {
|
|
1075
525
|
var stateController = _CoreManager.default.getObjectStateController();
|
|
1076
|
-
|
|
1077
526
|
var state = stateController.getState(this._getStateIdentifier());
|
|
1078
|
-
|
|
1079
527
|
if (state) {
|
|
1080
528
|
state.existed = existed;
|
|
1081
529
|
}
|
|
1082
530
|
}
|
|
1083
531
|
}, {
|
|
1084
532
|
key: "_migrateId",
|
|
1085
|
-
value: function (serverId
|
|
1086
|
-
/*: string*/
|
|
1087
|
-
) {
|
|
533
|
+
value: function (serverId /*: string*/) {
|
|
1088
534
|
if (this._localId && serverId) {
|
|
1089
535
|
if (singleInstance) {
|
|
1090
536
|
var stateController = _CoreManager.default.getObjectStateController();
|
|
1091
|
-
|
|
1092
537
|
var oldState = stateController.removeState(this._getStateIdentifier());
|
|
1093
538
|
this.id = serverId;
|
|
1094
539
|
delete this._localId;
|
|
1095
|
-
|
|
1096
540
|
if (oldState) {
|
|
1097
541
|
stateController.initializeState(this._getStateIdentifier(), oldState);
|
|
1098
542
|
}
|
|
@@ -1104,17 +548,10 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
1104
548
|
}
|
|
1105
549
|
}, {
|
|
1106
550
|
key: "_handleSaveResponse",
|
|
1107
|
-
value: function (response
|
|
1108
|
-
/*: AttributeMap*/
|
|
1109
|
-
, status
|
|
1110
|
-
/*: number*/
|
|
1111
|
-
) {
|
|
551
|
+
value: function (response /*: AttributeMap*/, status /*: number*/) {
|
|
1112
552
|
var changes = {};
|
|
1113
|
-
|
|
1114
553
|
var stateController = _CoreManager.default.getObjectStateController();
|
|
1115
|
-
|
|
1116
554
|
var pending = stateController.popPendingState(this._getStateIdentifier());
|
|
1117
|
-
|
|
1118
555
|
for (var attr in pending) {
|
|
1119
556
|
if (pending[attr] instanceof _ParseOp.RelationOp) {
|
|
1120
557
|
changes[attr] = pending[attr].applyTo(undefined, this, attr);
|
|
@@ -1123,7 +560,6 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
1123
560
|
changes[attr] = pending[attr].applyTo(undefined);
|
|
1124
561
|
}
|
|
1125
562
|
}
|
|
1126
|
-
|
|
1127
563
|
for (attr in response) {
|
|
1128
564
|
if ((attr === 'createdAt' || attr === 'updatedAt') && typeof response[attr] === 'string') {
|
|
1129
565
|
changes[attr] = (0, _parseDate.default)(response[attr]);
|
|
@@ -1131,44 +567,39 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
1131
567
|
changes[attr] = new _ParseACL.default(response[attr]);
|
|
1132
568
|
} else if (attr !== 'objectId') {
|
|
1133
569
|
var val = (0, _decode.default)(response[attr]);
|
|
1134
|
-
|
|
1135
570
|
if (val && (0, _getPrototypeOf.default)(val) === Object.prototype) {
|
|
1136
571
|
changes[attr] = _objectSpread(_objectSpread({}, this.attributes[attr]), val);
|
|
1137
572
|
} else {
|
|
1138
573
|
changes[attr] = val;
|
|
1139
574
|
}
|
|
1140
|
-
|
|
1141
575
|
if (changes[attr] instanceof _ParseOp.UnsetOp) {
|
|
1142
576
|
changes[attr] = undefined;
|
|
1143
577
|
}
|
|
1144
578
|
}
|
|
1145
579
|
}
|
|
1146
|
-
|
|
1147
580
|
if (changes.createdAt && !changes.updatedAt) {
|
|
1148
581
|
changes.updatedAt = changes.createdAt;
|
|
1149
582
|
}
|
|
1150
|
-
|
|
1151
583
|
this._migrateId(response.objectId);
|
|
1152
|
-
|
|
1153
584
|
if (status !== 201) {
|
|
1154
585
|
this._setExisted(true);
|
|
1155
586
|
}
|
|
1156
|
-
|
|
1157
587
|
stateController.commitServerChanges(this._getStateIdentifier(), changes);
|
|
1158
588
|
}
|
|
1159
589
|
}, {
|
|
1160
590
|
key: "_handleSaveError",
|
|
1161
591
|
value: function () {
|
|
1162
592
|
var stateController = _CoreManager.default.getObjectStateController();
|
|
1163
|
-
|
|
1164
593
|
stateController.mergeFirstPendingState(this._getStateIdentifier());
|
|
1165
594
|
}
|
|
1166
595
|
}, {
|
|
1167
596
|
key: "initialize",
|
|
1168
|
-
value:
|
|
1169
|
-
|
|
1170
|
-
function () {
|
|
597
|
+
value: /* Public methods */
|
|
598
|
+
|
|
599
|
+
function () {
|
|
600
|
+
// NOOP
|
|
1171
601
|
}
|
|
602
|
+
|
|
1172
603
|
/**
|
|
1173
604
|
* Returns a JSON version of the object suitable for saving to Parse.
|
|
1174
605
|
*
|
|
@@ -1176,21 +607,13 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
1176
607
|
* @param offline
|
|
1177
608
|
* @returns {object}
|
|
1178
609
|
*/
|
|
1179
|
-
|
|
1180
610
|
}, {
|
|
1181
611
|
key: "toJSON",
|
|
1182
|
-
value: function (seen
|
|
1183
|
-
/*: Array<any> | void*/
|
|
1184
|
-
, offline
|
|
1185
|
-
/*:: ?: boolean*/
|
|
1186
|
-
)
|
|
1187
|
-
/*: AttributeMap*/
|
|
1188
|
-
{
|
|
612
|
+
value: function (seen /*: Array<any> | void*/, offline /*:: ?: boolean*/) /*: AttributeMap*/{
|
|
1189
613
|
var seenEntry = this.id ? this.className + ':' + this.id : this;
|
|
1190
614
|
seen = seen || [seenEntry];
|
|
1191
615
|
var json = {};
|
|
1192
616
|
var attrs = this.attributes;
|
|
1193
|
-
|
|
1194
617
|
for (var _attr5 in attrs) {
|
|
1195
618
|
if ((_attr5 === 'createdAt' || _attr5 === 'updatedAt') && attrs[_attr5].toJSON) {
|
|
1196
619
|
json[_attr5] = attrs[_attr5].toJSON();
|
|
@@ -1198,39 +621,31 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
1198
621
|
json[_attr5] = (0, _encode.default)(attrs[_attr5], false, false, seen, offline);
|
|
1199
622
|
}
|
|
1200
623
|
}
|
|
1201
|
-
|
|
1202
624
|
var pending = this._getPendingOps();
|
|
1203
|
-
|
|
1204
625
|
for (var _attr6 in pending[0]) {
|
|
1205
626
|
json[_attr6] = pending[0][_attr6].toJSON(offline);
|
|
1206
627
|
}
|
|
1207
|
-
|
|
1208
628
|
if (this.id) {
|
|
1209
629
|
json.objectId = this.id;
|
|
1210
630
|
}
|
|
1211
|
-
|
|
1212
631
|
return json;
|
|
1213
632
|
}
|
|
633
|
+
|
|
1214
634
|
/**
|
|
1215
635
|
* Determines whether this ParseObject is equal to another ParseObject
|
|
1216
636
|
*
|
|
1217
637
|
* @param {object} other - An other object ot compare
|
|
1218
638
|
* @returns {boolean}
|
|
1219
639
|
*/
|
|
1220
|
-
|
|
1221
640
|
}, {
|
|
1222
641
|
key: "equals",
|
|
1223
|
-
value: function (other
|
|
1224
|
-
/*: mixed*/
|
|
1225
|
-
)
|
|
1226
|
-
/*: boolean*/
|
|
1227
|
-
{
|
|
642
|
+
value: function (other /*: mixed*/) /*: boolean*/{
|
|
1228
643
|
if (this === other) {
|
|
1229
644
|
return true;
|
|
1230
645
|
}
|
|
1231
|
-
|
|
1232
646
|
return other instanceof ParseObject && this.className === other.className && this.id === other.id && typeof this.id !== 'undefined';
|
|
1233
647
|
}
|
|
648
|
+
|
|
1234
649
|
/**
|
|
1235
650
|
* Returns true if this object has been modified since its last
|
|
1236
651
|
* save/refresh. If an attribute is specified, it returns true only if that
|
|
@@ -1239,206 +654,158 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
1239
654
|
* @param {string} attr An attribute name (optional).
|
|
1240
655
|
* @returns {boolean}
|
|
1241
656
|
*/
|
|
1242
|
-
|
|
1243
657
|
}, {
|
|
1244
658
|
key: "dirty",
|
|
1245
|
-
value: function (attr
|
|
1246
|
-
/*:: ?: string*/
|
|
1247
|
-
)
|
|
1248
|
-
/*: boolean*/
|
|
1249
|
-
{
|
|
659
|
+
value: function (attr /*:: ?: string*/) /*: boolean*/{
|
|
1250
660
|
if (!this.id) {
|
|
1251
661
|
return true;
|
|
1252
662
|
}
|
|
1253
|
-
|
|
1254
663
|
var pendingOps = this._getPendingOps();
|
|
1255
|
-
|
|
1256
664
|
var dirtyObjects = this._getDirtyObjectAttributes();
|
|
1257
|
-
|
|
1258
665
|
if (attr) {
|
|
1259
666
|
if (dirtyObjects.hasOwnProperty(attr)) {
|
|
1260
667
|
return true;
|
|
1261
668
|
}
|
|
1262
|
-
|
|
1263
669
|
for (var i = 0; i < pendingOps.length; i++) {
|
|
1264
670
|
if (pendingOps[i].hasOwnProperty(attr)) {
|
|
1265
671
|
return true;
|
|
1266
672
|
}
|
|
1267
673
|
}
|
|
1268
|
-
|
|
1269
674
|
return false;
|
|
1270
675
|
}
|
|
1271
|
-
|
|
1272
676
|
if ((0, _keys.default)(pendingOps[0]).length !== 0) {
|
|
1273
677
|
return true;
|
|
1274
678
|
}
|
|
1275
|
-
|
|
1276
679
|
if ((0, _keys.default)(dirtyObjects).length !== 0) {
|
|
1277
680
|
return true;
|
|
1278
681
|
}
|
|
1279
|
-
|
|
1280
682
|
return false;
|
|
1281
683
|
}
|
|
684
|
+
|
|
1282
685
|
/**
|
|
1283
686
|
* Returns an array of keys that have been modified since last save/refresh
|
|
1284
687
|
*
|
|
1285
688
|
* @returns {string[]}
|
|
1286
689
|
*/
|
|
1287
|
-
|
|
1288
690
|
}, {
|
|
1289
691
|
key: "dirtyKeys",
|
|
1290
|
-
value: function ()
|
|
1291
|
-
/*: Array<string>*/
|
|
1292
|
-
{
|
|
692
|
+
value: function () /*: Array<string>*/{
|
|
1293
693
|
var pendingOps = this._getPendingOps();
|
|
1294
|
-
|
|
1295
694
|
var keys = {};
|
|
1296
|
-
|
|
1297
695
|
for (var i = 0; i < pendingOps.length; i++) {
|
|
1298
696
|
for (var _attr7 in pendingOps[i]) {
|
|
1299
697
|
keys[_attr7] = true;
|
|
1300
698
|
}
|
|
1301
699
|
}
|
|
1302
|
-
|
|
1303
700
|
var dirtyObjects = this._getDirtyObjectAttributes();
|
|
1304
|
-
|
|
1305
701
|
for (var _attr8 in dirtyObjects) {
|
|
1306
702
|
keys[_attr8] = true;
|
|
1307
703
|
}
|
|
1308
|
-
|
|
1309
704
|
return (0, _keys.default)(keys);
|
|
1310
705
|
}
|
|
706
|
+
|
|
1311
707
|
/**
|
|
1312
708
|
* Returns true if the object has been fetched.
|
|
1313
709
|
*
|
|
1314
710
|
* @returns {boolean}
|
|
1315
711
|
*/
|
|
1316
|
-
|
|
1317
712
|
}, {
|
|
1318
713
|
key: "isDataAvailable",
|
|
1319
|
-
value: function ()
|
|
1320
|
-
/*: boolean*/
|
|
1321
|
-
{
|
|
714
|
+
value: function () /*: boolean*/{
|
|
1322
715
|
var serverData = this._getServerData();
|
|
1323
|
-
|
|
1324
716
|
return !!(0, _keys.default)(serverData).length;
|
|
1325
717
|
}
|
|
718
|
+
|
|
1326
719
|
/**
|
|
1327
720
|
* Gets a Pointer referencing this Object.
|
|
1328
721
|
*
|
|
1329
722
|
* @returns {Pointer}
|
|
1330
723
|
*/
|
|
1331
|
-
|
|
1332
724
|
}, {
|
|
1333
725
|
key: "toPointer",
|
|
1334
|
-
value: function ()
|
|
1335
|
-
/*: Pointer*/
|
|
1336
|
-
{
|
|
726
|
+
value: function () /*: Pointer*/{
|
|
1337
727
|
if (!this.id) {
|
|
1338
728
|
throw new Error('Cannot create a pointer to an unsaved ParseObject');
|
|
1339
729
|
}
|
|
1340
|
-
|
|
1341
730
|
return {
|
|
1342
731
|
__type: 'Pointer',
|
|
1343
732
|
className: this.className,
|
|
1344
733
|
objectId: this.id
|
|
1345
734
|
};
|
|
1346
735
|
}
|
|
736
|
+
|
|
1347
737
|
/**
|
|
1348
738
|
* Gets a Pointer referencing this Object.
|
|
1349
739
|
*
|
|
1350
740
|
* @returns {Pointer}
|
|
1351
741
|
*/
|
|
1352
|
-
|
|
1353
742
|
}, {
|
|
1354
743
|
key: "toOfflinePointer",
|
|
1355
|
-
value: function ()
|
|
1356
|
-
/*: Pointer*/
|
|
1357
|
-
{
|
|
744
|
+
value: function () /*: Pointer*/{
|
|
1358
745
|
if (!this._localId) {
|
|
1359
746
|
throw new Error('Cannot create a offline pointer to a saved ParseObject');
|
|
1360
747
|
}
|
|
1361
|
-
|
|
1362
748
|
return {
|
|
1363
749
|
__type: 'Object',
|
|
1364
750
|
className: this.className,
|
|
1365
751
|
_localId: this._localId
|
|
1366
752
|
};
|
|
1367
753
|
}
|
|
754
|
+
|
|
1368
755
|
/**
|
|
1369
756
|
* Gets the value of an attribute.
|
|
1370
757
|
*
|
|
1371
758
|
* @param {string} attr The string name of an attribute.
|
|
1372
759
|
* @returns {*}
|
|
1373
760
|
*/
|
|
1374
|
-
|
|
1375
761
|
}, {
|
|
1376
762
|
key: "get",
|
|
1377
|
-
value: function (attr
|
|
1378
|
-
/*: string*/
|
|
1379
|
-
)
|
|
1380
|
-
/*: mixed*/
|
|
1381
|
-
{
|
|
763
|
+
value: function (attr /*: string*/) /*: mixed*/{
|
|
1382
764
|
return this.attributes[attr];
|
|
1383
765
|
}
|
|
766
|
+
|
|
1384
767
|
/**
|
|
1385
768
|
* Gets a relation on the given class for the attribute.
|
|
1386
769
|
*
|
|
1387
770
|
* @param {string} attr The attribute to get the relation for.
|
|
1388
771
|
* @returns {Parse.Relation}
|
|
1389
772
|
*/
|
|
1390
|
-
|
|
1391
773
|
}, {
|
|
1392
774
|
key: "relation",
|
|
1393
|
-
value: function (attr
|
|
1394
|
-
/*: string*/
|
|
1395
|
-
)
|
|
1396
|
-
/*: ParseRelation*/
|
|
1397
|
-
{
|
|
775
|
+
value: function (attr /*: string*/) /*: ParseRelation*/{
|
|
1398
776
|
var value = this.get(attr);
|
|
1399
|
-
|
|
1400
777
|
if (value) {
|
|
1401
778
|
if (!(value instanceof _ParseRelation.default)) {
|
|
1402
779
|
throw new Error('Called relation() on non-relation field ' + attr);
|
|
1403
780
|
}
|
|
1404
|
-
|
|
1405
781
|
value._ensureParentAndKey(this, attr);
|
|
1406
|
-
|
|
1407
782
|
return value;
|
|
1408
783
|
}
|
|
1409
|
-
|
|
1410
784
|
return new _ParseRelation.default(this, attr);
|
|
1411
785
|
}
|
|
786
|
+
|
|
1412
787
|
/**
|
|
1413
788
|
* Gets the HTML-escaped value of an attribute.
|
|
1414
789
|
*
|
|
1415
790
|
* @param {string} attr The string name of an attribute.
|
|
1416
791
|
* @returns {string}
|
|
1417
792
|
*/
|
|
1418
|
-
|
|
1419
793
|
}, {
|
|
1420
794
|
key: "escape",
|
|
1421
|
-
value: function (attr
|
|
1422
|
-
/*: string*/
|
|
1423
|
-
)
|
|
1424
|
-
/*: string*/
|
|
1425
|
-
{
|
|
795
|
+
value: function (attr /*: string*/) /*: string*/{
|
|
1426
796
|
var val = this.attributes[attr];
|
|
1427
|
-
|
|
1428
797
|
if (val == null) {
|
|
1429
798
|
return '';
|
|
1430
799
|
}
|
|
1431
|
-
|
|
1432
800
|
if (typeof val !== 'string') {
|
|
1433
801
|
if (typeof val.toString !== 'function') {
|
|
1434
802
|
return '';
|
|
1435
803
|
}
|
|
1436
|
-
|
|
1437
804
|
val = val.toString();
|
|
1438
805
|
}
|
|
1439
|
-
|
|
1440
806
|
return (0, _escape2.default)(val);
|
|
1441
807
|
}
|
|
808
|
+
|
|
1442
809
|
/**
|
|
1443
810
|
* Returns <code>true</code> if the attribute contains a value that is not
|
|
1444
811
|
* null or undefined.
|
|
@@ -1446,22 +813,16 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
1446
813
|
* @param {string} attr The string name of the attribute.
|
|
1447
814
|
* @returns {boolean}
|
|
1448
815
|
*/
|
|
1449
|
-
|
|
1450
816
|
}, {
|
|
1451
817
|
key: "has",
|
|
1452
|
-
value: function (attr
|
|
1453
|
-
/*: string*/
|
|
1454
|
-
)
|
|
1455
|
-
/*: boolean*/
|
|
1456
|
-
{
|
|
818
|
+
value: function (attr /*: string*/) /*: boolean*/{
|
|
1457
819
|
var attributes = this.attributes;
|
|
1458
|
-
|
|
1459
820
|
if (attributes.hasOwnProperty(attr)) {
|
|
1460
821
|
return attributes[attr] != null;
|
|
1461
822
|
}
|
|
1462
|
-
|
|
1463
823
|
return false;
|
|
1464
824
|
}
|
|
825
|
+
|
|
1465
826
|
/**
|
|
1466
827
|
* Sets a hash of model attributes on the object.
|
|
1467
828
|
*
|
|
@@ -1492,21 +853,11 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
1492
853
|
* The only supported option is <code>error</code>.
|
|
1493
854
|
* @returns {(ParseObject|boolean)} true if the set succeeded.
|
|
1494
855
|
*/
|
|
1495
|
-
|
|
1496
856
|
}, {
|
|
1497
857
|
key: "set",
|
|
1498
|
-
value: function (key
|
|
1499
|
-
/*: mixed*/
|
|
1500
|
-
, value
|
|
1501
|
-
/*: mixed*/
|
|
1502
|
-
, options
|
|
1503
|
-
/*:: ?: mixed*/
|
|
1504
|
-
)
|
|
1505
|
-
/*: ParseObject | boolean*/
|
|
1506
|
-
{
|
|
858
|
+
value: function (key /*: mixed*/, value /*: mixed*/, options /*:: ?: mixed*/) /*: ParseObject | boolean*/{
|
|
1507
859
|
var changes = {};
|
|
1508
860
|
var newOps = {};
|
|
1509
|
-
|
|
1510
861
|
if (key && (0, _typeof2.default)(key) === 'object') {
|
|
1511
862
|
changes = key;
|
|
1512
863
|
options = value;
|
|
@@ -1515,25 +866,20 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
1515
866
|
} else {
|
|
1516
867
|
return this;
|
|
1517
868
|
}
|
|
1518
|
-
|
|
1519
869
|
options = options || {};
|
|
1520
870
|
var readonly = [];
|
|
1521
|
-
|
|
1522
871
|
if (typeof this.constructor.readOnlyAttributes === 'function') {
|
|
1523
872
|
readonly = (0, _concat.default)(readonly).call(readonly, this.constructor.readOnlyAttributes());
|
|
1524
873
|
}
|
|
1525
|
-
|
|
1526
874
|
for (var k in changes) {
|
|
1527
875
|
if (k === 'createdAt' || k === 'updatedAt') {
|
|
1528
876
|
// This property is read-only, but for legacy reasons we silently
|
|
1529
877
|
// ignore it
|
|
1530
878
|
continue;
|
|
1531
879
|
}
|
|
1532
|
-
|
|
1533
880
|
if ((0, _indexOf.default)(readonly).call(readonly, k) > -1) {
|
|
1534
881
|
throw new Error('Cannot modify readonly attribute: ' + k);
|
|
1535
882
|
}
|
|
1536
|
-
|
|
1537
883
|
if (options.unset) {
|
|
1538
884
|
newOps[k] = new _ParseOp.UnsetOp();
|
|
1539
885
|
} else if (changes[k] instanceof _ParseOp.Op) {
|
|
@@ -1554,47 +900,40 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
1554
900
|
newOps[k] = new _ParseOp.SetOp(changes[k]);
|
|
1555
901
|
}
|
|
1556
902
|
}
|
|
903
|
+
var currentAttributes = this.attributes;
|
|
1557
904
|
|
|
1558
|
-
|
|
1559
|
-
|
|
905
|
+
// Calculate new values
|
|
1560
906
|
var newValues = {};
|
|
1561
|
-
|
|
1562
907
|
for (var _attr9 in newOps) {
|
|
1563
908
|
if (newOps[_attr9] instanceof _ParseOp.RelationOp) {
|
|
1564
909
|
newValues[_attr9] = newOps[_attr9].applyTo(currentAttributes[_attr9], this, _attr9);
|
|
1565
910
|
} else if (!(newOps[_attr9] instanceof _ParseOp.UnsetOp)) {
|
|
1566
911
|
newValues[_attr9] = newOps[_attr9].applyTo(currentAttributes[_attr9]);
|
|
1567
912
|
}
|
|
1568
|
-
}
|
|
1569
|
-
|
|
913
|
+
}
|
|
1570
914
|
|
|
915
|
+
// Validate changes
|
|
1571
916
|
if (!options.ignoreValidation) {
|
|
1572
917
|
var validation = this.validate(newValues);
|
|
1573
|
-
|
|
1574
918
|
if (validation) {
|
|
1575
919
|
if (typeof options.error === 'function') {
|
|
1576
920
|
options.error(this, validation);
|
|
1577
921
|
}
|
|
1578
|
-
|
|
1579
922
|
return false;
|
|
1580
923
|
}
|
|
1581
|
-
}
|
|
1582
|
-
|
|
924
|
+
}
|
|
1583
925
|
|
|
926
|
+
// Consolidate Ops
|
|
1584
927
|
var pendingOps = this._getPendingOps();
|
|
1585
|
-
|
|
1586
928
|
var last = pendingOps.length - 1;
|
|
1587
|
-
|
|
1588
929
|
var stateController = _CoreManager.default.getObjectStateController();
|
|
1589
|
-
|
|
1590
930
|
for (var _attr10 in newOps) {
|
|
1591
931
|
var nextOp = newOps[_attr10].mergeWith(pendingOps[last][_attr10]);
|
|
1592
|
-
|
|
1593
932
|
stateController.setPendingOp(this._getStateIdentifier(), _attr10, nextOp);
|
|
1594
933
|
}
|
|
1595
|
-
|
|
1596
934
|
return this;
|
|
1597
935
|
}
|
|
936
|
+
|
|
1598
937
|
/**
|
|
1599
938
|
* Remove an attribute from the model. This is a noop if the attribute doesn't
|
|
1600
939
|
* exist.
|
|
@@ -1603,20 +942,14 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
1603
942
|
* @param options
|
|
1604
943
|
* @returns {(ParseObject | boolean)}
|
|
1605
944
|
*/
|
|
1606
|
-
|
|
1607
945
|
}, {
|
|
1608
946
|
key: "unset",
|
|
1609
|
-
value: function (attr
|
|
1610
|
-
/*: string*/
|
|
1611
|
-
, options
|
|
1612
|
-
/*:: ?: { [opt: string]: mixed }*/
|
|
1613
|
-
)
|
|
1614
|
-
/*: ParseObject | boolean*/
|
|
1615
|
-
{
|
|
947
|
+
value: function (attr /*: string*/, options /*:: ?: { [opt: string]: mixed }*/) /*: ParseObject | boolean*/{
|
|
1616
948
|
options = options || {};
|
|
1617
949
|
options.unset = true;
|
|
1618
950
|
return this.set(attr, null, options);
|
|
1619
951
|
}
|
|
952
|
+
|
|
1620
953
|
/**
|
|
1621
954
|
* Atomically increments the value of the given attribute the next time the
|
|
1622
955
|
* object is saved. If no amount is specified, 1 is used by default.
|
|
@@ -1625,26 +958,18 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
1625
958
|
* @param amount {Number} The amount to increment by (optional).
|
|
1626
959
|
* @returns {(ParseObject|boolean)}
|
|
1627
960
|
*/
|
|
1628
|
-
|
|
1629
961
|
}, {
|
|
1630
962
|
key: "increment",
|
|
1631
|
-
value: function (attr
|
|
1632
|
-
/*: string*/
|
|
1633
|
-
, amount
|
|
1634
|
-
/*:: ?: number*/
|
|
1635
|
-
)
|
|
1636
|
-
/*: ParseObject | boolean*/
|
|
1637
|
-
{
|
|
963
|
+
value: function (attr /*: string*/, amount /*:: ?: number*/) /*: ParseObject | boolean*/{
|
|
1638
964
|
if (typeof amount === 'undefined') {
|
|
1639
965
|
amount = 1;
|
|
1640
966
|
}
|
|
1641
|
-
|
|
1642
967
|
if (typeof amount !== 'number') {
|
|
1643
968
|
throw new Error('Cannot increment by a non-numeric amount.');
|
|
1644
969
|
}
|
|
1645
|
-
|
|
1646
970
|
return this.set(attr, new _ParseOp.IncrementOp(amount));
|
|
1647
971
|
}
|
|
972
|
+
|
|
1648
973
|
/**
|
|
1649
974
|
* Atomically decrements the value of the given attribute the next time the
|
|
1650
975
|
* object is saved. If no amount is specified, 1 is used by default.
|
|
@@ -1653,26 +978,18 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
1653
978
|
* @param amount {Number} The amount to decrement by (optional).
|
|
1654
979
|
* @returns {(ParseObject | boolean)}
|
|
1655
980
|
*/
|
|
1656
|
-
|
|
1657
981
|
}, {
|
|
1658
982
|
key: "decrement",
|
|
1659
|
-
value: function (attr
|
|
1660
|
-
/*: string*/
|
|
1661
|
-
, amount
|
|
1662
|
-
/*:: ?: number*/
|
|
1663
|
-
)
|
|
1664
|
-
/*: ParseObject | boolean*/
|
|
1665
|
-
{
|
|
983
|
+
value: function (attr /*: string*/, amount /*:: ?: number*/) /*: ParseObject | boolean*/{
|
|
1666
984
|
if (typeof amount === 'undefined') {
|
|
1667
985
|
amount = 1;
|
|
1668
986
|
}
|
|
1669
|
-
|
|
1670
987
|
if (typeof amount !== 'number') {
|
|
1671
988
|
throw new Error('Cannot decrement by a non-numeric amount.');
|
|
1672
989
|
}
|
|
1673
|
-
|
|
1674
990
|
return this.set(attr, new _ParseOp.IncrementOp(amount * -1));
|
|
1675
991
|
}
|
|
992
|
+
|
|
1676
993
|
/**
|
|
1677
994
|
* Atomically add an object to the end of the array associated with a given
|
|
1678
995
|
* key.
|
|
@@ -1681,18 +998,12 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
1681
998
|
* @param item {} The item to add.
|
|
1682
999
|
* @returns {(ParseObject | boolean)}
|
|
1683
1000
|
*/
|
|
1684
|
-
|
|
1685
1001
|
}, {
|
|
1686
1002
|
key: "add",
|
|
1687
|
-
value: function (attr
|
|
1688
|
-
/*: string*/
|
|
1689
|
-
, item
|
|
1690
|
-
/*: mixed*/
|
|
1691
|
-
)
|
|
1692
|
-
/*: ParseObject | boolean*/
|
|
1693
|
-
{
|
|
1003
|
+
value: function (attr /*: string*/, item /*: mixed*/) /*: ParseObject | boolean*/{
|
|
1694
1004
|
return this.set(attr, new _ParseOp.AddOp([item]));
|
|
1695
1005
|
}
|
|
1006
|
+
|
|
1696
1007
|
/**
|
|
1697
1008
|
* Atomically add the objects to the end of the array associated with a given
|
|
1698
1009
|
* key.
|
|
@@ -1701,18 +1012,12 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
1701
1012
|
* @param items {Object[]} The items to add.
|
|
1702
1013
|
* @returns {(ParseObject | boolean)}
|
|
1703
1014
|
*/
|
|
1704
|
-
|
|
1705
1015
|
}, {
|
|
1706
1016
|
key: "addAll",
|
|
1707
|
-
value: function (attr
|
|
1708
|
-
/*: string*/
|
|
1709
|
-
, items
|
|
1710
|
-
/*: Array<mixed>*/
|
|
1711
|
-
)
|
|
1712
|
-
/*: ParseObject | boolean*/
|
|
1713
|
-
{
|
|
1017
|
+
value: function (attr /*: string*/, items /*: Array<mixed>*/) /*: ParseObject | boolean*/{
|
|
1714
1018
|
return this.set(attr, new _ParseOp.AddOp(items));
|
|
1715
1019
|
}
|
|
1020
|
+
|
|
1716
1021
|
/**
|
|
1717
1022
|
* Atomically add an object to the array associated with a given key, only
|
|
1718
1023
|
* if it is not already present in the array. The position of the insert is
|
|
@@ -1722,18 +1027,12 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
1722
1027
|
* @param item {} The object to add.
|
|
1723
1028
|
* @returns {(ParseObject | boolean)}
|
|
1724
1029
|
*/
|
|
1725
|
-
|
|
1726
1030
|
}, {
|
|
1727
1031
|
key: "addUnique",
|
|
1728
|
-
value: function (attr
|
|
1729
|
-
/*: string*/
|
|
1730
|
-
, item
|
|
1731
|
-
/*: mixed*/
|
|
1732
|
-
)
|
|
1733
|
-
/*: ParseObject | boolean*/
|
|
1734
|
-
{
|
|
1032
|
+
value: function (attr /*: string*/, item /*: mixed*/) /*: ParseObject | boolean*/{
|
|
1735
1033
|
return this.set(attr, new _ParseOp.AddUniqueOp([item]));
|
|
1736
1034
|
}
|
|
1035
|
+
|
|
1737
1036
|
/**
|
|
1738
1037
|
* Atomically add the objects to the array associated with a given key, only
|
|
1739
1038
|
* if it is not already present in the array. The position of the insert is
|
|
@@ -1743,18 +1042,12 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
1743
1042
|
* @param items {Object[]} The objects to add.
|
|
1744
1043
|
* @returns {(ParseObject | boolean)}
|
|
1745
1044
|
*/
|
|
1746
|
-
|
|
1747
1045
|
}, {
|
|
1748
1046
|
key: "addAllUnique",
|
|
1749
|
-
value: function (attr
|
|
1750
|
-
/*: string*/
|
|
1751
|
-
, items
|
|
1752
|
-
/*: Array<mixed>*/
|
|
1753
|
-
)
|
|
1754
|
-
/*: ParseObject | boolean*/
|
|
1755
|
-
{
|
|
1047
|
+
value: function (attr /*: string*/, items /*: Array<mixed>*/) /*: ParseObject | boolean*/{
|
|
1756
1048
|
return this.set(attr, new _ParseOp.AddUniqueOp(items));
|
|
1757
1049
|
}
|
|
1050
|
+
|
|
1758
1051
|
/**
|
|
1759
1052
|
* Atomically remove all instances of an object from the array associated
|
|
1760
1053
|
* with a given key.
|
|
@@ -1763,18 +1056,12 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
1763
1056
|
* @param item {} The object to remove.
|
|
1764
1057
|
* @returns {(ParseObject | boolean)}
|
|
1765
1058
|
*/
|
|
1766
|
-
|
|
1767
1059
|
}, {
|
|
1768
1060
|
key: "remove",
|
|
1769
|
-
value: function (attr
|
|
1770
|
-
/*: string*/
|
|
1771
|
-
, item
|
|
1772
|
-
/*: mixed*/
|
|
1773
|
-
)
|
|
1774
|
-
/*: ParseObject | boolean*/
|
|
1775
|
-
{
|
|
1061
|
+
value: function (attr /*: string*/, item /*: mixed*/) /*: ParseObject | boolean*/{
|
|
1776
1062
|
return this.set(attr, new _ParseOp.RemoveOp([item]));
|
|
1777
1063
|
}
|
|
1064
|
+
|
|
1778
1065
|
/**
|
|
1779
1066
|
* Atomically remove all instances of the objects from the array associated
|
|
1780
1067
|
* with a given key.
|
|
@@ -1783,18 +1070,12 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
1783
1070
|
* @param items {Object[]} The object to remove.
|
|
1784
1071
|
* @returns {(ParseObject | boolean)}
|
|
1785
1072
|
*/
|
|
1786
|
-
|
|
1787
1073
|
}, {
|
|
1788
1074
|
key: "removeAll",
|
|
1789
|
-
value: function (attr
|
|
1790
|
-
/*: string*/
|
|
1791
|
-
, items
|
|
1792
|
-
/*: Array<mixed>*/
|
|
1793
|
-
)
|
|
1794
|
-
/*: ParseObject | boolean*/
|
|
1795
|
-
{
|
|
1075
|
+
value: function (attr /*: string*/, items /*: Array<mixed>*/) /*: ParseObject | boolean*/{
|
|
1796
1076
|
return this.set(attr, new _ParseOp.RemoveOp(items));
|
|
1797
1077
|
}
|
|
1078
|
+
|
|
1798
1079
|
/**
|
|
1799
1080
|
* Returns an instance of a subclass of Parse.Op describing what kind of
|
|
1800
1081
|
* modification has been performed on this field since the last time it was
|
|
@@ -1802,99 +1083,79 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
1802
1083
|
* object.op("x") would return an instance of Parse.Op.Increment.
|
|
1803
1084
|
*
|
|
1804
1085
|
* @param attr {String} The key.
|
|
1805
|
-
* @returns {Parse.Op} The operation, or undefined if none.
|
|
1086
|
+
* @returns {Parse.Op | undefined} The operation, or undefined if none.
|
|
1806
1087
|
*/
|
|
1807
|
-
|
|
1808
1088
|
}, {
|
|
1809
1089
|
key: "op",
|
|
1810
|
-
value: function (attr
|
|
1811
|
-
/*: string*/
|
|
1812
|
-
)
|
|
1813
|
-
/*: ?Op*/
|
|
1814
|
-
{
|
|
1090
|
+
value: function (attr /*: string*/) /*: ?Op*/{
|
|
1815
1091
|
var pending = this._getPendingOps();
|
|
1816
|
-
|
|
1817
1092
|
for (var i = pending.length; i--;) {
|
|
1818
1093
|
if (pending[i][attr]) {
|
|
1819
1094
|
return pending[i][attr];
|
|
1820
1095
|
}
|
|
1821
1096
|
}
|
|
1822
1097
|
}
|
|
1098
|
+
|
|
1823
1099
|
/**
|
|
1824
1100
|
* Creates a new model with identical attributes to this one.
|
|
1825
1101
|
*
|
|
1826
1102
|
* @returns {Parse.Object}
|
|
1827
1103
|
*/
|
|
1828
|
-
|
|
1829
1104
|
}, {
|
|
1830
1105
|
key: "clone",
|
|
1831
|
-
value: function clone()
|
|
1832
|
-
/*: any*/
|
|
1833
|
-
{
|
|
1106
|
+
value: function clone() /*: any*/{
|
|
1834
1107
|
var clone = new this.constructor(this.className);
|
|
1835
1108
|
var attributes = this.attributes;
|
|
1836
|
-
|
|
1837
1109
|
if (typeof this.constructor.readOnlyAttributes === 'function') {
|
|
1838
|
-
var readonly = this.constructor.readOnlyAttributes() || [];
|
|
1110
|
+
var readonly = this.constructor.readOnlyAttributes() || [];
|
|
1111
|
+
// Attributes are frozen, so we have to rebuild an object,
|
|
1839
1112
|
// rather than delete readonly keys
|
|
1840
|
-
|
|
1841
1113
|
var copy = {};
|
|
1842
|
-
|
|
1843
1114
|
for (var a in attributes) {
|
|
1844
1115
|
if ((0, _indexOf.default)(readonly).call(readonly, a) < 0) {
|
|
1845
1116
|
copy[a] = attributes[a];
|
|
1846
1117
|
}
|
|
1847
1118
|
}
|
|
1848
|
-
|
|
1849
1119
|
attributes = copy;
|
|
1850
1120
|
}
|
|
1851
|
-
|
|
1852
1121
|
if (clone.set) {
|
|
1853
1122
|
clone.set(attributes);
|
|
1854
1123
|
}
|
|
1855
|
-
|
|
1856
1124
|
return clone;
|
|
1857
1125
|
}
|
|
1126
|
+
|
|
1858
1127
|
/**
|
|
1859
1128
|
* Creates a new instance of this object. Not to be confused with clone()
|
|
1860
1129
|
*
|
|
1861
1130
|
* @returns {Parse.Object}
|
|
1862
1131
|
*/
|
|
1863
|
-
|
|
1864
1132
|
}, {
|
|
1865
1133
|
key: "newInstance",
|
|
1866
|
-
value: function ()
|
|
1867
|
-
/*: any*/
|
|
1868
|
-
{
|
|
1134
|
+
value: function () /*: any*/{
|
|
1869
1135
|
var clone = new this.constructor(this.className);
|
|
1870
1136
|
clone.id = this.id;
|
|
1871
|
-
|
|
1872
1137
|
if (singleInstance) {
|
|
1873
1138
|
// Just return an object with the right id
|
|
1874
1139
|
return clone;
|
|
1875
1140
|
}
|
|
1876
|
-
|
|
1877
1141
|
var stateController = _CoreManager.default.getObjectStateController();
|
|
1878
|
-
|
|
1879
1142
|
if (stateController) {
|
|
1880
1143
|
stateController.duplicateState(this._getStateIdentifier(), clone._getStateIdentifier());
|
|
1881
1144
|
}
|
|
1882
|
-
|
|
1883
1145
|
return clone;
|
|
1884
1146
|
}
|
|
1147
|
+
|
|
1885
1148
|
/**
|
|
1886
1149
|
* Returns true if this object has never been saved to Parse.
|
|
1887
1150
|
*
|
|
1888
1151
|
* @returns {boolean}
|
|
1889
1152
|
*/
|
|
1890
|
-
|
|
1891
1153
|
}, {
|
|
1892
1154
|
key: "isNew",
|
|
1893
|
-
value: function ()
|
|
1894
|
-
/*: boolean*/
|
|
1895
|
-
{
|
|
1155
|
+
value: function () /*: boolean*/{
|
|
1896
1156
|
return !this.id;
|
|
1897
1157
|
}
|
|
1158
|
+
|
|
1898
1159
|
/**
|
|
1899
1160
|
* Returns true if this object was created by the Parse server when the
|
|
1900
1161
|
* object might have already been there (e.g. in the case of a Facebook
|
|
@@ -1902,26 +1163,20 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
1902
1163
|
*
|
|
1903
1164
|
* @returns {boolean}
|
|
1904
1165
|
*/
|
|
1905
|
-
|
|
1906
1166
|
}, {
|
|
1907
1167
|
key: "existed",
|
|
1908
|
-
value: function ()
|
|
1909
|
-
/*: boolean*/
|
|
1910
|
-
{
|
|
1168
|
+
value: function () /*: boolean*/{
|
|
1911
1169
|
if (!this.id) {
|
|
1912
1170
|
return false;
|
|
1913
1171
|
}
|
|
1914
|
-
|
|
1915
1172
|
var stateController = _CoreManager.default.getObjectStateController();
|
|
1916
|
-
|
|
1917
1173
|
var state = stateController.getState(this._getStateIdentifier());
|
|
1918
|
-
|
|
1919
1174
|
if (state) {
|
|
1920
1175
|
return state.existed;
|
|
1921
1176
|
}
|
|
1922
|
-
|
|
1923
1177
|
return false;
|
|
1924
1178
|
}
|
|
1179
|
+
|
|
1925
1180
|
/**
|
|
1926
1181
|
* Returns true if this object exists on the Server
|
|
1927
1182
|
*
|
|
@@ -1930,64 +1185,49 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
1930
1185
|
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
1931
1186
|
* be used for this request.
|
|
1932
1187
|
* <li>sessionToken: A valid session token, used for making a request on
|
|
1933
|
-
* behalf of a specific user.
|
|
1934
|
-
* </ul>
|
|
1935
|
-
* @returns {Promise<boolean>} A boolean promise that is fulfilled if object exists.
|
|
1936
|
-
*/
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
_context.next = 13;
|
|
1971
|
-
break;
|
|
1972
|
-
}
|
|
1973
|
-
|
|
1974
|
-
return _context.abrupt("return", false);
|
|
1975
|
-
|
|
1976
|
-
case 13:
|
|
1977
|
-
throw _context.t0;
|
|
1978
|
-
|
|
1979
|
-
case 14:
|
|
1980
|
-
case "end":
|
|
1981
|
-
return _context.stop();
|
|
1982
|
-
}
|
|
1188
|
+
* behalf of a specific user.
|
|
1189
|
+
* </ul>
|
|
1190
|
+
* @returns {Promise<boolean>} A boolean promise that is fulfilled if object exists.
|
|
1191
|
+
*/
|
|
1192
|
+
}, {
|
|
1193
|
+
key: "exists",
|
|
1194
|
+
value: function () {
|
|
1195
|
+
var _exists = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(options /*:: ?: RequestOptions*/) {
|
|
1196
|
+
var query;
|
|
1197
|
+
return _regenerator.default.wrap(function (_context) {
|
|
1198
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1199
|
+
case 0:
|
|
1200
|
+
if (this.id) {
|
|
1201
|
+
_context.next = 2;
|
|
1202
|
+
break;
|
|
1203
|
+
}
|
|
1204
|
+
return _context.abrupt("return", false);
|
|
1205
|
+
case 2:
|
|
1206
|
+
_context.prev = 2;
|
|
1207
|
+
query = new _ParseQuery.default(this.className);
|
|
1208
|
+
_context.next = 6;
|
|
1209
|
+
return query.get(this.id, options);
|
|
1210
|
+
case 6:
|
|
1211
|
+
return _context.abrupt("return", true);
|
|
1212
|
+
case 9:
|
|
1213
|
+
_context.prev = 9;
|
|
1214
|
+
_context.t0 = _context["catch"](2);
|
|
1215
|
+
if (!(_context.t0.code === _ParseError.default.OBJECT_NOT_FOUND)) {
|
|
1216
|
+
_context.next = 13;
|
|
1217
|
+
break;
|
|
1218
|
+
}
|
|
1219
|
+
return _context.abrupt("return", false);
|
|
1220
|
+
case 13:
|
|
1221
|
+
throw _context.t0;
|
|
1222
|
+
case 14:
|
|
1223
|
+
case "end":
|
|
1224
|
+
return _context.stop();
|
|
1983
1225
|
}
|
|
1984
1226
|
}, _callee, this, [[2, 9]]);
|
|
1985
1227
|
}));
|
|
1986
|
-
|
|
1987
|
-
function exists(_x) {
|
|
1228
|
+
function exists() {
|
|
1988
1229
|
return _exists.apply(this, arguments);
|
|
1989
1230
|
}
|
|
1990
|
-
|
|
1991
1231
|
return exists;
|
|
1992
1232
|
}()
|
|
1993
1233
|
/**
|
|
@@ -1995,14 +1235,12 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
1995
1235
|
*
|
|
1996
1236
|
* @returns {boolean}
|
|
1997
1237
|
*/
|
|
1998
|
-
|
|
1999
1238
|
}, {
|
|
2000
1239
|
key: "isValid",
|
|
2001
|
-
value: function
|
|
2002
|
-
/*: boolean*/
|
|
2003
|
-
{
|
|
1240
|
+
value: function () /*: boolean*/{
|
|
2004
1241
|
return !this.validate(this.attributes);
|
|
2005
1242
|
}
|
|
1243
|
+
|
|
2006
1244
|
/**
|
|
2007
1245
|
* You should not call this function directly unless you subclass
|
|
2008
1246
|
* <code>Parse.Object</code>, in which case you can override this method
|
|
@@ -2013,46 +1251,36 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
2013
1251
|
* @returns {Parse.Error|boolean} False if the data is valid. An error object otherwise.
|
|
2014
1252
|
* @see Parse.Object#set
|
|
2015
1253
|
*/
|
|
2016
|
-
|
|
2017
1254
|
}, {
|
|
2018
1255
|
key: "validate",
|
|
2019
|
-
value: function
|
|
2020
|
-
/*: AttributeMap*/
|
|
2021
|
-
)
|
|
2022
|
-
/*: ParseError | boolean*/
|
|
2023
|
-
{
|
|
1256
|
+
value: function (attrs /*: AttributeMap*/) /*: ParseError | boolean*/{
|
|
2024
1257
|
if (attrs.hasOwnProperty('ACL') && !(attrs.ACL instanceof _ParseACL.default)) {
|
|
2025
1258
|
return new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'ACL must be a Parse ACL.');
|
|
2026
1259
|
}
|
|
2027
|
-
|
|
2028
1260
|
for (var _key in attrs) {
|
|
2029
1261
|
if (!/^[A-Za-z][0-9A-Za-z_.]*$/.test(_key)) {
|
|
2030
1262
|
return new _ParseError.default(_ParseError.default.INVALID_KEY_NAME);
|
|
2031
1263
|
}
|
|
2032
1264
|
}
|
|
2033
|
-
|
|
2034
1265
|
return false;
|
|
2035
1266
|
}
|
|
1267
|
+
|
|
2036
1268
|
/**
|
|
2037
1269
|
* Returns the ACL for this object.
|
|
2038
1270
|
*
|
|
2039
1271
|
* @returns {Parse.ACL} An instance of Parse.ACL.
|
|
2040
1272
|
* @see Parse.Object#get
|
|
2041
1273
|
*/
|
|
2042
|
-
|
|
2043
1274
|
}, {
|
|
2044
1275
|
key: "getACL",
|
|
2045
|
-
value: function
|
|
2046
|
-
/*: ?ParseACL*/
|
|
2047
|
-
{
|
|
1276
|
+
value: function () /*: ?ParseACL*/{
|
|
2048
1277
|
var acl = this.get('ACL');
|
|
2049
|
-
|
|
2050
1278
|
if (acl instanceof _ParseACL.default) {
|
|
2051
1279
|
return acl;
|
|
2052
1280
|
}
|
|
2053
|
-
|
|
2054
1281
|
return null;
|
|
2055
1282
|
}
|
|
1283
|
+
|
|
2056
1284
|
/**
|
|
2057
1285
|
* Sets the ACL to be used for this object.
|
|
2058
1286
|
*
|
|
@@ -2061,45 +1289,31 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
2061
1289
|
* @returns {(ParseObject | boolean)} Whether the set passed validation.
|
|
2062
1290
|
* @see Parse.Object#set
|
|
2063
1291
|
*/
|
|
2064
|
-
|
|
2065
1292
|
}, {
|
|
2066
1293
|
key: "setACL",
|
|
2067
|
-
value: function
|
|
2068
|
-
/*: ParseACL*/
|
|
2069
|
-
, options
|
|
2070
|
-
/*:: ?: mixed*/
|
|
2071
|
-
)
|
|
2072
|
-
/*: ParseObject | boolean*/
|
|
2073
|
-
{
|
|
1294
|
+
value: function (acl /*: ParseACL*/, options /*:: ?: mixed*/) /*: ParseObject | boolean*/{
|
|
2074
1295
|
return this.set('ACL', acl, options);
|
|
2075
1296
|
}
|
|
1297
|
+
|
|
2076
1298
|
/**
|
|
2077
1299
|
* Clears any (or specific) changes to this object made since the last call to save()
|
|
2078
1300
|
*
|
|
2079
1301
|
* @param {string} [keys] - specify which fields to revert
|
|
2080
1302
|
*/
|
|
2081
|
-
|
|
2082
1303
|
}, {
|
|
2083
1304
|
key: "revert",
|
|
2084
|
-
value: function
|
|
2085
|
-
/*: void*/
|
|
2086
|
-
{
|
|
1305
|
+
value: function () /*: void*/{
|
|
2087
1306
|
var keysToRevert;
|
|
2088
|
-
|
|
2089
1307
|
for (var _len = arguments.length, keys = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {
|
|
2090
1308
|
keys[_key2] = arguments[_key2];
|
|
2091
1309
|
}
|
|
2092
|
-
|
|
2093
1310
|
if (keys.length) {
|
|
2094
1311
|
keysToRevert = [];
|
|
2095
|
-
|
|
2096
1312
|
var _iterator = _createForOfIteratorHelper(keys),
|
|
2097
|
-
|
|
2098
|
-
|
|
1313
|
+
_step;
|
|
2099
1314
|
try {
|
|
2100
1315
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
2101
1316
|
var _key3 = _step.value;
|
|
2102
|
-
|
|
2103
1317
|
if (typeof _key3 === 'string') {
|
|
2104
1318
|
keysToRevert.push(_key3);
|
|
2105
1319
|
} else {
|
|
@@ -2112,38 +1326,33 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
2112
1326
|
_iterator.f();
|
|
2113
1327
|
}
|
|
2114
1328
|
}
|
|
2115
|
-
|
|
2116
1329
|
this._clearPendingOps(keysToRevert);
|
|
2117
1330
|
}
|
|
1331
|
+
|
|
2118
1332
|
/**
|
|
2119
1333
|
* Clears all attributes on a model
|
|
2120
1334
|
*
|
|
2121
1335
|
* @returns {(ParseObject | boolean)}
|
|
2122
1336
|
*/
|
|
2123
|
-
|
|
2124
1337
|
}, {
|
|
2125
1338
|
key: "clear",
|
|
2126
|
-
value: function
|
|
2127
|
-
/*: ParseObject | boolean*/
|
|
2128
|
-
{
|
|
1339
|
+
value: function () /*: ParseObject | boolean*/{
|
|
2129
1340
|
var attributes = this.attributes;
|
|
2130
1341
|
var erasable = {};
|
|
2131
1342
|
var readonly = ['createdAt', 'updatedAt'];
|
|
2132
|
-
|
|
2133
1343
|
if (typeof this.constructor.readOnlyAttributes === 'function') {
|
|
2134
1344
|
readonly = (0, _concat.default)(readonly).call(readonly, this.constructor.readOnlyAttributes());
|
|
2135
1345
|
}
|
|
2136
|
-
|
|
2137
1346
|
for (var _attr11 in attributes) {
|
|
2138
1347
|
if ((0, _indexOf.default)(readonly).call(readonly, _attr11) < 0) {
|
|
2139
1348
|
erasable[_attr11] = true;
|
|
2140
1349
|
}
|
|
2141
1350
|
}
|
|
2142
|
-
|
|
2143
1351
|
return this.set(erasable, {
|
|
2144
1352
|
unset: true
|
|
2145
1353
|
});
|
|
2146
1354
|
}
|
|
1355
|
+
|
|
2147
1356
|
/**
|
|
2148
1357
|
* Fetch the model from the server. If the server's representation of the
|
|
2149
1358
|
* model differs from its current attributes, they will be overriden.
|
|
@@ -2161,39 +1370,27 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
2161
1370
|
* @returns {Promise} A promise that is fulfilled when the fetch
|
|
2162
1371
|
* completes.
|
|
2163
1372
|
*/
|
|
2164
|
-
|
|
2165
1373
|
}, {
|
|
2166
1374
|
key: "fetch",
|
|
2167
|
-
value: function
|
|
2168
|
-
/*: RequestOptions*/
|
|
2169
|
-
)
|
|
2170
|
-
/*: Promise*/
|
|
2171
|
-
{
|
|
1375
|
+
value: function (options /*: RequestOptions*/) /*: Promise*/{
|
|
2172
1376
|
options = options || {};
|
|
2173
1377
|
var fetchOptions = {};
|
|
2174
|
-
|
|
2175
1378
|
if (options.hasOwnProperty('useMasterKey')) {
|
|
2176
1379
|
fetchOptions.useMasterKey = options.useMasterKey;
|
|
2177
1380
|
}
|
|
2178
|
-
|
|
2179
1381
|
if (options.hasOwnProperty('sessionToken')) {
|
|
2180
1382
|
fetchOptions.sessionToken = options.sessionToken;
|
|
2181
1383
|
}
|
|
2182
|
-
|
|
2183
1384
|
if (options.hasOwnProperty('context') && (0, _typeof2.default)(options.context) === 'object') {
|
|
2184
1385
|
fetchOptions.context = options.context;
|
|
2185
1386
|
}
|
|
2186
|
-
|
|
2187
1387
|
if (options.hasOwnProperty('include')) {
|
|
2188
1388
|
fetchOptions.include = [];
|
|
2189
|
-
|
|
2190
1389
|
if ((0, _isArray.default)(options.include)) {
|
|
2191
1390
|
var _context2;
|
|
2192
|
-
|
|
2193
1391
|
(0, _forEach.default)(_context2 = options.include).call(_context2, function (key) {
|
|
2194
1392
|
if ((0, _isArray.default)(key)) {
|
|
2195
1393
|
var _context3;
|
|
2196
|
-
|
|
2197
1394
|
fetchOptions.include = (0, _concat.default)(_context3 = fetchOptions.include).call(_context3, key);
|
|
2198
1395
|
} else {
|
|
2199
1396
|
fetchOptions.include.push(key);
|
|
@@ -2203,11 +1400,10 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
2203
1400
|
fetchOptions.include.push(options.include);
|
|
2204
1401
|
}
|
|
2205
1402
|
}
|
|
2206
|
-
|
|
2207
1403
|
var controller = _CoreManager.default.getObjectController();
|
|
2208
|
-
|
|
2209
1404
|
return controller.fetch(this, true, fetchOptions);
|
|
2210
1405
|
}
|
|
1406
|
+
|
|
2211
1407
|
/**
|
|
2212
1408
|
* Fetch the model from the server. If the server's representation of the
|
|
2213
1409
|
* model differs from its current attributes, they will be overriden.
|
|
@@ -2226,20 +1422,14 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
2226
1422
|
* @returns {Promise} A promise that is fulfilled when the fetch
|
|
2227
1423
|
* completes.
|
|
2228
1424
|
*/
|
|
2229
|
-
|
|
2230
1425
|
}, {
|
|
2231
1426
|
key: "fetchWithInclude",
|
|
2232
|
-
value: function
|
|
2233
|
-
/*: String | Array<string | Array<string>>*/
|
|
2234
|
-
, options
|
|
2235
|
-
/*: RequestOptions*/
|
|
2236
|
-
)
|
|
2237
|
-
/*: Promise*/
|
|
2238
|
-
{
|
|
1427
|
+
value: function (keys /*: String | Array<string | Array<string>>*/, options /*: RequestOptions*/) /*: Promise*/{
|
|
2239
1428
|
options = options || {};
|
|
2240
1429
|
options.include = keys;
|
|
2241
1430
|
return this.fetch(options);
|
|
2242
1431
|
}
|
|
1432
|
+
|
|
2243
1433
|
/**
|
|
2244
1434
|
* Saves this object to the server at some unspecified time in the future,
|
|
2245
1435
|
* even if Parse is currently inaccessible.
|
|
@@ -2264,55 +1454,41 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
2264
1454
|
* @returns {Promise} A promise that is fulfilled when the save
|
|
2265
1455
|
* completes.
|
|
2266
1456
|
*/
|
|
2267
|
-
|
|
2268
1457
|
}, {
|
|
2269
1458
|
key: "saveEventually",
|
|
2270
1459
|
value: function () {
|
|
2271
|
-
var _saveEventually = (0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
1460
|
+
var _saveEventually = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(options /*: SaveOptions*/) {
|
|
1461
|
+
return _regenerator.default.wrap(function (_context4) {
|
|
1462
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
1463
|
+
case 0:
|
|
1464
|
+
_context4.prev = 0;
|
|
1465
|
+
_context4.next = 3;
|
|
1466
|
+
return this.save(null, options);
|
|
1467
|
+
case 3:
|
|
1468
|
+
_context4.next = 11;
|
|
1469
|
+
break;
|
|
1470
|
+
case 5:
|
|
1471
|
+
_context4.prev = 5;
|
|
1472
|
+
_context4.t0 = _context4["catch"](0);
|
|
1473
|
+
if (!(_context4.t0.message === 'XMLHttpRequest failed: "Unable to connect to the Parse API"')) {
|
|
2283
1474
|
_context4.next = 11;
|
|
2284
1475
|
break;
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
_context4.next = 10;
|
|
2296
|
-
return _EventuallyQueue.default.save(this, options);
|
|
2297
|
-
|
|
2298
|
-
case 10:
|
|
2299
|
-
_EventuallyQueue.default.poll();
|
|
2300
|
-
|
|
2301
|
-
case 11:
|
|
2302
|
-
return _context4.abrupt("return", this);
|
|
2303
|
-
|
|
2304
|
-
case 12:
|
|
2305
|
-
case "end":
|
|
2306
|
-
return _context4.stop();
|
|
2307
|
-
}
|
|
1476
|
+
}
|
|
1477
|
+
_context4.next = 10;
|
|
1478
|
+
return _EventuallyQueue.default.save(this, options);
|
|
1479
|
+
case 10:
|
|
1480
|
+
_EventuallyQueue.default.poll();
|
|
1481
|
+
case 11:
|
|
1482
|
+
return _context4.abrupt("return", this);
|
|
1483
|
+
case 12:
|
|
1484
|
+
case "end":
|
|
1485
|
+
return _context4.stop();
|
|
2308
1486
|
}
|
|
2309
1487
|
}, _callee2, this, [[0, 5]]);
|
|
2310
1488
|
}));
|
|
2311
|
-
|
|
2312
|
-
function saveEventually(_x2) {
|
|
1489
|
+
function saveEventually() {
|
|
2313
1490
|
return _saveEventually.apply(this, arguments);
|
|
2314
1491
|
}
|
|
2315
|
-
|
|
2316
1492
|
return saveEventually;
|
|
2317
1493
|
}()
|
|
2318
1494
|
/**
|
|
@@ -2378,26 +1554,14 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
2378
1554
|
* @returns {Promise} A promise that is fulfilled when the save
|
|
2379
1555
|
* completes.
|
|
2380
1556
|
*/
|
|
2381
|
-
|
|
2382
1557
|
}, {
|
|
2383
1558
|
key: "save",
|
|
2384
|
-
value: function
|
|
2385
|
-
/*: ?string | { [attr: string]: mixed }*/
|
|
2386
|
-
, arg2
|
|
2387
|
-
/*: SaveOptions | mixed*/
|
|
2388
|
-
, arg3
|
|
2389
|
-
/*:: ?: SaveOptions*/
|
|
2390
|
-
)
|
|
2391
|
-
/*: Promise*/
|
|
2392
|
-
{
|
|
1559
|
+
value: function (arg1 /*: ?string | { [attr: string]: mixed }*/, arg2 /*: SaveOptions | mixed*/, arg3 /*:: ?: SaveOptions*/) /*: Promise*/{
|
|
2393
1560
|
var _this = this;
|
|
2394
|
-
|
|
2395
1561
|
var attrs;
|
|
2396
1562
|
var options;
|
|
2397
|
-
|
|
2398
1563
|
if ((0, _typeof2.default)(arg1) === 'object' || typeof arg1 === 'undefined') {
|
|
2399
1564
|
attrs = arg1;
|
|
2400
|
-
|
|
2401
1565
|
if ((0, _typeof2.default)(arg2) === 'object') {
|
|
2402
1566
|
options = arg2;
|
|
2403
1567
|
}
|
|
@@ -2406,43 +1570,34 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
2406
1570
|
attrs[arg1] = arg2;
|
|
2407
1571
|
options = arg3;
|
|
2408
1572
|
}
|
|
2409
|
-
|
|
2410
1573
|
if (attrs) {
|
|
2411
1574
|
var validation = this.validate(attrs);
|
|
2412
|
-
|
|
2413
1575
|
if (validation) {
|
|
2414
1576
|
return _promise.default.reject(validation);
|
|
2415
1577
|
}
|
|
2416
|
-
|
|
2417
1578
|
this.set(attrs, options);
|
|
2418
1579
|
}
|
|
2419
|
-
|
|
2420
1580
|
options = options || {};
|
|
2421
1581
|
var saveOptions = {};
|
|
2422
|
-
|
|
2423
1582
|
if (options.hasOwnProperty('useMasterKey')) {
|
|
2424
1583
|
saveOptions.useMasterKey = !!options.useMasterKey;
|
|
2425
1584
|
}
|
|
2426
|
-
|
|
2427
1585
|
if (options.hasOwnProperty('sessionToken') && typeof options.sessionToken === 'string') {
|
|
2428
1586
|
saveOptions.sessionToken = options.sessionToken;
|
|
2429
1587
|
}
|
|
2430
|
-
|
|
2431
1588
|
if (options.hasOwnProperty('installationId') && typeof options.installationId === 'string') {
|
|
2432
1589
|
saveOptions.installationId = options.installationId;
|
|
2433
1590
|
}
|
|
2434
|
-
|
|
2435
1591
|
if (options.hasOwnProperty('context') && (0, _typeof2.default)(options.context) === 'object') {
|
|
2436
1592
|
saveOptions.context = options.context;
|
|
2437
1593
|
}
|
|
2438
|
-
|
|
2439
1594
|
var controller = _CoreManager.default.getObjectController();
|
|
2440
|
-
|
|
2441
1595
|
var unsaved = options.cascadeSave !== false ? (0, _unsavedChildren.default)(this) : null;
|
|
2442
1596
|
return controller.save(unsaved, saveOptions).then(function () {
|
|
2443
1597
|
return controller.save(_this, saveOptions);
|
|
2444
1598
|
});
|
|
2445
1599
|
}
|
|
1600
|
+
|
|
2446
1601
|
/**
|
|
2447
1602
|
* Deletes this object from the server at some unspecified time in the future,
|
|
2448
1603
|
* even if Parse is currently inaccessible.
|
|
@@ -2465,55 +1620,41 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
2465
1620
|
* @returns {Promise} A promise that is fulfilled when the destroy
|
|
2466
1621
|
* completes.
|
|
2467
1622
|
*/
|
|
2468
|
-
|
|
2469
1623
|
}, {
|
|
2470
1624
|
key: "destroyEventually",
|
|
2471
1625
|
value: function () {
|
|
2472
|
-
var _destroyEventually = (0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
1626
|
+
var _destroyEventually = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(options /*: RequestOptions*/) {
|
|
1627
|
+
return _regenerator.default.wrap(function (_context5) {
|
|
1628
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
1629
|
+
case 0:
|
|
1630
|
+
_context5.prev = 0;
|
|
1631
|
+
_context5.next = 3;
|
|
1632
|
+
return this.destroy(options);
|
|
1633
|
+
case 3:
|
|
1634
|
+
_context5.next = 11;
|
|
1635
|
+
break;
|
|
1636
|
+
case 5:
|
|
1637
|
+
_context5.prev = 5;
|
|
1638
|
+
_context5.t0 = _context5["catch"](0);
|
|
1639
|
+
if (!(_context5.t0.message === 'XMLHttpRequest failed: "Unable to connect to the Parse API"')) {
|
|
2484
1640
|
_context5.next = 11;
|
|
2485
1641
|
break;
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
_context5.next = 10;
|
|
2497
|
-
return _EventuallyQueue.default.destroy(this, options);
|
|
2498
|
-
|
|
2499
|
-
case 10:
|
|
2500
|
-
_EventuallyQueue.default.poll();
|
|
2501
|
-
|
|
2502
|
-
case 11:
|
|
2503
|
-
return _context5.abrupt("return", this);
|
|
2504
|
-
|
|
2505
|
-
case 12:
|
|
2506
|
-
case "end":
|
|
2507
|
-
return _context5.stop();
|
|
2508
|
-
}
|
|
1642
|
+
}
|
|
1643
|
+
_context5.next = 10;
|
|
1644
|
+
return _EventuallyQueue.default.destroy(this, options);
|
|
1645
|
+
case 10:
|
|
1646
|
+
_EventuallyQueue.default.poll();
|
|
1647
|
+
case 11:
|
|
1648
|
+
return _context5.abrupt("return", this);
|
|
1649
|
+
case 12:
|
|
1650
|
+
case "end":
|
|
1651
|
+
return _context5.stop();
|
|
2509
1652
|
}
|
|
2510
1653
|
}, _callee3, this, [[0, 5]]);
|
|
2511
1654
|
}));
|
|
2512
|
-
|
|
2513
|
-
function destroyEventually(_x3) {
|
|
1655
|
+
function destroyEventually() {
|
|
2514
1656
|
return _destroyEventually.apply(this, arguments);
|
|
2515
1657
|
}
|
|
2516
|
-
|
|
2517
1658
|
return destroyEventually;
|
|
2518
1659
|
}()
|
|
2519
1660
|
/**
|
|
@@ -2530,35 +1671,26 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
2530
1671
|
* @returns {Promise} A promise that is fulfilled when the destroy
|
|
2531
1672
|
* completes.
|
|
2532
1673
|
*/
|
|
2533
|
-
|
|
2534
1674
|
}, {
|
|
2535
1675
|
key: "destroy",
|
|
2536
|
-
value: function
|
|
2537
|
-
/*: RequestOptions*/
|
|
2538
|
-
)
|
|
2539
|
-
/*: Promise*/
|
|
2540
|
-
{
|
|
1676
|
+
value: function (options /*: RequestOptions*/) /*: Promise*/{
|
|
2541
1677
|
options = options || {};
|
|
2542
1678
|
var destroyOptions = {};
|
|
2543
|
-
|
|
2544
1679
|
if (options.hasOwnProperty('useMasterKey')) {
|
|
2545
1680
|
destroyOptions.useMasterKey = options.useMasterKey;
|
|
2546
1681
|
}
|
|
2547
|
-
|
|
2548
1682
|
if (options.hasOwnProperty('sessionToken')) {
|
|
2549
1683
|
destroyOptions.sessionToken = options.sessionToken;
|
|
2550
1684
|
}
|
|
2551
|
-
|
|
2552
1685
|
if (options.hasOwnProperty('context') && (0, _typeof2.default)(options.context) === 'object') {
|
|
2553
1686
|
destroyOptions.context = options.context;
|
|
2554
1687
|
}
|
|
2555
|
-
|
|
2556
1688
|
if (!this.id) {
|
|
2557
1689
|
return _promise.default.resolve();
|
|
2558
1690
|
}
|
|
2559
|
-
|
|
2560
1691
|
return _CoreManager.default.getObjectController().destroy(this, destroyOptions);
|
|
2561
1692
|
}
|
|
1693
|
+
|
|
2562
1694
|
/**
|
|
2563
1695
|
* Asynchronously stores the object and every object it points to in the local datastore,
|
|
2564
1696
|
* recursively, using a default pin name: _default.
|
|
@@ -2575,14 +1707,12 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
2575
1707
|
*
|
|
2576
1708
|
* @returns {Promise} A promise that is fulfilled when the pin completes.
|
|
2577
1709
|
*/
|
|
2578
|
-
|
|
2579
1710
|
}, {
|
|
2580
1711
|
key: "pin",
|
|
2581
|
-
value: function
|
|
2582
|
-
/*: Promise<void>*/
|
|
2583
|
-
{
|
|
1712
|
+
value: function () /*: Promise<void>*/{
|
|
2584
1713
|
return ParseObject.pinAllWithName(_LocalDatastoreUtils.DEFAULT_PIN, [this]);
|
|
2585
1714
|
}
|
|
1715
|
+
|
|
2586
1716
|
/**
|
|
2587
1717
|
* Asynchronously removes the object and every object it points to in the local datastore,
|
|
2588
1718
|
* recursively, using a default pin name: _default.
|
|
@@ -2593,14 +1723,12 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
2593
1723
|
*
|
|
2594
1724
|
* @returns {Promise} A promise that is fulfilled when the unPin completes.
|
|
2595
1725
|
*/
|
|
2596
|
-
|
|
2597
1726
|
}, {
|
|
2598
1727
|
key: "unPin",
|
|
2599
|
-
value: function
|
|
2600
|
-
/*: Promise<void>*/
|
|
2601
|
-
{
|
|
1728
|
+
value: function () /*: Promise<void>*/{
|
|
2602
1729
|
return ParseObject.unPinAllWithName(_LocalDatastoreUtils.DEFAULT_PIN, [this]);
|
|
2603
1730
|
}
|
|
1731
|
+
|
|
2604
1732
|
/**
|
|
2605
1733
|
* Asynchronously returns if the object is pinned
|
|
2606
1734
|
*
|
|
@@ -2610,46 +1738,36 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
2610
1738
|
*
|
|
2611
1739
|
* @returns {Promise<boolean>} A boolean promise that is fulfilled if object is pinned.
|
|
2612
1740
|
*/
|
|
2613
|
-
|
|
2614
1741
|
}, {
|
|
2615
1742
|
key: "isPinned",
|
|
2616
1743
|
value: function () {
|
|
2617
|
-
var _isPinned = (0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
1744
|
+
var _isPinned = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
2618
1745
|
var localDatastore, objectKey, pin;
|
|
2619
|
-
return
|
|
2620
|
-
while (1) {
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
pin = _context6.sent;
|
|
2639
|
-
return _context6.abrupt("return", pin.length > 0);
|
|
2640
|
-
|
|
2641
|
-
case 8:
|
|
2642
|
-
case "end":
|
|
2643
|
-
return _context6.stop();
|
|
2644
|
-
}
|
|
1746
|
+
return _regenerator.default.wrap(function (_context6) {
|
|
1747
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
1748
|
+
case 0:
|
|
1749
|
+
localDatastore = _CoreManager.default.getLocalDatastore();
|
|
1750
|
+
if (localDatastore.isEnabled) {
|
|
1751
|
+
_context6.next = 3;
|
|
1752
|
+
break;
|
|
1753
|
+
}
|
|
1754
|
+
return _context6.abrupt("return", _promise.default.reject('Parse.enableLocalDatastore() must be called first'));
|
|
1755
|
+
case 3:
|
|
1756
|
+
objectKey = localDatastore.getKeyForObject(this);
|
|
1757
|
+
_context6.next = 6;
|
|
1758
|
+
return localDatastore.fromPinWithName(objectKey);
|
|
1759
|
+
case 6:
|
|
1760
|
+
pin = _context6.sent;
|
|
1761
|
+
return _context6.abrupt("return", pin.length > 0);
|
|
1762
|
+
case 8:
|
|
1763
|
+
case "end":
|
|
1764
|
+
return _context6.stop();
|
|
2645
1765
|
}
|
|
2646
1766
|
}, _callee4, this);
|
|
2647
1767
|
}));
|
|
2648
|
-
|
|
2649
1768
|
function isPinned() {
|
|
2650
1769
|
return _isPinned.apply(this, arguments);
|
|
2651
1770
|
}
|
|
2652
|
-
|
|
2653
1771
|
return isPinned;
|
|
2654
1772
|
}()
|
|
2655
1773
|
/**
|
|
@@ -2668,16 +1786,12 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
2668
1786
|
* @param {string} name Name of Pin.
|
|
2669
1787
|
* @returns {Promise} A promise that is fulfilled when the pin completes.
|
|
2670
1788
|
*/
|
|
2671
|
-
|
|
2672
1789
|
}, {
|
|
2673
1790
|
key: "pinWithName",
|
|
2674
|
-
value: function
|
|
2675
|
-
/*: string*/
|
|
2676
|
-
)
|
|
2677
|
-
/*: Promise<void>*/
|
|
2678
|
-
{
|
|
1791
|
+
value: function (name /*: string*/) /*: Promise<void>*/{
|
|
2679
1792
|
return ParseObject.pinAllWithName(name, [this]);
|
|
2680
1793
|
}
|
|
1794
|
+
|
|
2681
1795
|
/**
|
|
2682
1796
|
* Asynchronously removes the object and every object it points to in the local datastore, recursively.
|
|
2683
1797
|
*
|
|
@@ -2688,16 +1802,12 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
2688
1802
|
* @param {string} name Name of Pin.
|
|
2689
1803
|
* @returns {Promise} A promise that is fulfilled when the unPin completes.
|
|
2690
1804
|
*/
|
|
2691
|
-
|
|
2692
1805
|
}, {
|
|
2693
1806
|
key: "unPinWithName",
|
|
2694
|
-
value: function
|
|
2695
|
-
/*: string*/
|
|
2696
|
-
)
|
|
2697
|
-
/*: Promise<void>*/
|
|
2698
|
-
{
|
|
1807
|
+
value: function (name /*: string*/) /*: Promise<void>*/{
|
|
2699
1808
|
return ParseObject.unPinAllWithName(name, [this]);
|
|
2700
1809
|
}
|
|
1810
|
+
|
|
2701
1811
|
/**
|
|
2702
1812
|
* Asynchronously loads data from the local datastore into this object.
|
|
2703
1813
|
*
|
|
@@ -2710,75 +1820,58 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
2710
1820
|
*
|
|
2711
1821
|
* @returns {Promise} A promise that is fulfilled when the fetch completes.
|
|
2712
1822
|
*/
|
|
2713
|
-
|
|
2714
1823
|
}, {
|
|
2715
1824
|
key: "fetchFromLocalDatastore",
|
|
2716
1825
|
value: function () {
|
|
2717
|
-
var _fetchFromLocalDatastore = (0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
1826
|
+
var _fetchFromLocalDatastore = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
2718
1827
|
var localDatastore, objectKey, pinned, result;
|
|
2719
|
-
return
|
|
2720
|
-
while (1) {
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
case 9:
|
|
2748
|
-
result = ParseObject.fromJSON(pinned);
|
|
2749
|
-
|
|
2750
|
-
this._finishFetch(result.toJSON());
|
|
2751
|
-
|
|
2752
|
-
return _context7.abrupt("return", this);
|
|
2753
|
-
|
|
2754
|
-
case 12:
|
|
2755
|
-
case "end":
|
|
2756
|
-
return _context7.stop();
|
|
2757
|
-
}
|
|
1828
|
+
return _regenerator.default.wrap(function (_context7) {
|
|
1829
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
1830
|
+
case 0:
|
|
1831
|
+
localDatastore = _CoreManager.default.getLocalDatastore();
|
|
1832
|
+
if (localDatastore.isEnabled) {
|
|
1833
|
+
_context7.next = 3;
|
|
1834
|
+
break;
|
|
1835
|
+
}
|
|
1836
|
+
throw new Error('Parse.enableLocalDatastore() must be called first');
|
|
1837
|
+
case 3:
|
|
1838
|
+
objectKey = localDatastore.getKeyForObject(this);
|
|
1839
|
+
_context7.next = 6;
|
|
1840
|
+
return localDatastore._serializeObject(objectKey);
|
|
1841
|
+
case 6:
|
|
1842
|
+
pinned = _context7.sent;
|
|
1843
|
+
if (pinned) {
|
|
1844
|
+
_context7.next = 9;
|
|
1845
|
+
break;
|
|
1846
|
+
}
|
|
1847
|
+
throw new Error('Cannot fetch an unsaved ParseObject');
|
|
1848
|
+
case 9:
|
|
1849
|
+
result = ParseObject.fromJSON(pinned);
|
|
1850
|
+
this._finishFetch(result.toJSON());
|
|
1851
|
+
return _context7.abrupt("return", this);
|
|
1852
|
+
case 12:
|
|
1853
|
+
case "end":
|
|
1854
|
+
return _context7.stop();
|
|
2758
1855
|
}
|
|
2759
1856
|
}, _callee5, this);
|
|
2760
1857
|
}));
|
|
2761
|
-
|
|
2762
1858
|
function fetchFromLocalDatastore() {
|
|
2763
1859
|
return _fetchFromLocalDatastore.apply(this, arguments);
|
|
2764
1860
|
}
|
|
2765
|
-
|
|
2766
1861
|
return fetchFromLocalDatastore;
|
|
2767
|
-
}()
|
|
2768
|
-
/** Static methods **/
|
|
2769
|
-
|
|
1862
|
+
}() /* Static methods */
|
|
2770
1863
|
}], [{
|
|
2771
1864
|
key: "_getClassMap",
|
|
2772
|
-
value: function
|
|
1865
|
+
value: function () {
|
|
2773
1866
|
return classMap;
|
|
2774
1867
|
}
|
|
2775
1868
|
}, {
|
|
2776
1869
|
key: "_clearAllState",
|
|
2777
|
-
value: function
|
|
1870
|
+
value: function () {
|
|
2778
1871
|
var stateController = _CoreManager.default.getObjectStateController();
|
|
2779
|
-
|
|
2780
1872
|
stateController.clearAllState();
|
|
2781
1873
|
}
|
|
1874
|
+
|
|
2782
1875
|
/**
|
|
2783
1876
|
* Fetches the given list of Parse.Object.
|
|
2784
1877
|
* If any error is encountered, stops and calls the error handler.
|
|
@@ -2805,31 +1898,23 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
2805
1898
|
* @static
|
|
2806
1899
|
* @returns {Parse.Object[]}
|
|
2807
1900
|
*/
|
|
2808
|
-
|
|
2809
1901
|
}, {
|
|
2810
1902
|
key: "fetchAll",
|
|
2811
|
-
value: function
|
|
2812
|
-
|
|
2813
|
-
) {
|
|
2814
|
-
var options
|
|
2815
|
-
/*: RequestOptions*/
|
|
2816
|
-
= arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1903
|
+
value: function (list /*: Array<ParseObject>*/) {
|
|
1904
|
+
var options /*: RequestOptions*/ = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2817
1905
|
var queryOptions = {};
|
|
2818
|
-
|
|
2819
1906
|
if (options.hasOwnProperty('useMasterKey')) {
|
|
2820
1907
|
queryOptions.useMasterKey = options.useMasterKey;
|
|
2821
1908
|
}
|
|
2822
|
-
|
|
2823
1909
|
if (options.hasOwnProperty('sessionToken')) {
|
|
2824
1910
|
queryOptions.sessionToken = options.sessionToken;
|
|
2825
1911
|
}
|
|
2826
|
-
|
|
2827
1912
|
if (options.hasOwnProperty('include')) {
|
|
2828
1913
|
queryOptions.include = ParseObject.handleIncludeOptions(options);
|
|
2829
1914
|
}
|
|
2830
|
-
|
|
2831
1915
|
return _CoreManager.default.getObjectController().fetch(list, true, queryOptions);
|
|
2832
1916
|
}
|
|
1917
|
+
|
|
2833
1918
|
/**
|
|
2834
1919
|
* Fetches the given list of Parse.Object.
|
|
2835
1920
|
*
|
|
@@ -2859,20 +1944,14 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
2859
1944
|
* @static
|
|
2860
1945
|
* @returns {Parse.Object[]}
|
|
2861
1946
|
*/
|
|
2862
|
-
|
|
2863
1947
|
}, {
|
|
2864
1948
|
key: "fetchAllWithInclude",
|
|
2865
|
-
value: function
|
|
2866
|
-
/*: Array<ParseObject>*/
|
|
2867
|
-
, keys
|
|
2868
|
-
/*: String | Array<string | Array<string>>*/
|
|
2869
|
-
, options
|
|
2870
|
-
/*: RequestOptions*/
|
|
2871
|
-
) {
|
|
1949
|
+
value: function (list /*: Array<ParseObject>*/, keys /*: String | Array<string | Array<string>>*/, options /*: RequestOptions*/) {
|
|
2872
1950
|
options = options || {};
|
|
2873
1951
|
options.include = keys;
|
|
2874
1952
|
return ParseObject.fetchAll(list, options);
|
|
2875
1953
|
}
|
|
1954
|
+
|
|
2876
1955
|
/**
|
|
2877
1956
|
* Fetches the given list of Parse.Object if needed.
|
|
2878
1957
|
* If any error is encountered, stops and calls the error handler.
|
|
@@ -2903,20 +1982,14 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
2903
1982
|
* @static
|
|
2904
1983
|
* @returns {Parse.Object[]}
|
|
2905
1984
|
*/
|
|
2906
|
-
|
|
2907
1985
|
}, {
|
|
2908
1986
|
key: "fetchAllIfNeededWithInclude",
|
|
2909
|
-
value: function
|
|
2910
|
-
/*: Array<ParseObject>*/
|
|
2911
|
-
, keys
|
|
2912
|
-
/*: String | Array<string | Array<string>>*/
|
|
2913
|
-
, options
|
|
2914
|
-
/*: RequestOptions*/
|
|
2915
|
-
) {
|
|
1987
|
+
value: function (list /*: Array<ParseObject>*/, keys /*: String | Array<string | Array<string>>*/, options /*: RequestOptions*/) {
|
|
2916
1988
|
options = options || {};
|
|
2917
1989
|
options.include = keys;
|
|
2918
1990
|
return ParseObject.fetchAllIfNeeded(list, options);
|
|
2919
1991
|
}
|
|
1992
|
+
|
|
2920
1993
|
/**
|
|
2921
1994
|
* Fetches the given list of Parse.Object if needed.
|
|
2922
1995
|
* If any error is encountered, stops and calls the error handler.
|
|
@@ -2935,37 +2008,28 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
2935
2008
|
* @static
|
|
2936
2009
|
* @returns {Parse.Object[]}
|
|
2937
2010
|
*/
|
|
2938
|
-
|
|
2939
2011
|
}, {
|
|
2940
2012
|
key: "fetchAllIfNeeded",
|
|
2941
|
-
value: function
|
|
2942
|
-
/*: Array<ParseObject>*/
|
|
2943
|
-
, options) {
|
|
2013
|
+
value: function (list /*: Array<ParseObject>*/, options) {
|
|
2944
2014
|
options = options || {};
|
|
2945
2015
|
var queryOptions = {};
|
|
2946
|
-
|
|
2947
2016
|
if (options.hasOwnProperty('useMasterKey')) {
|
|
2948
2017
|
queryOptions.useMasterKey = options.useMasterKey;
|
|
2949
2018
|
}
|
|
2950
|
-
|
|
2951
2019
|
if (options.hasOwnProperty('sessionToken')) {
|
|
2952
2020
|
queryOptions.sessionToken = options.sessionToken;
|
|
2953
2021
|
}
|
|
2954
|
-
|
|
2955
2022
|
if (options.hasOwnProperty('include')) {
|
|
2956
2023
|
queryOptions.include = ParseObject.handleIncludeOptions(options);
|
|
2957
2024
|
}
|
|
2958
|
-
|
|
2959
2025
|
return _CoreManager.default.getObjectController().fetch(list, false, queryOptions);
|
|
2960
2026
|
}
|
|
2961
2027
|
}, {
|
|
2962
2028
|
key: "handleIncludeOptions",
|
|
2963
|
-
value: function
|
|
2029
|
+
value: function (options) {
|
|
2964
2030
|
var include = [];
|
|
2965
|
-
|
|
2966
2031
|
if ((0, _isArray.default)(options.include)) {
|
|
2967
2032
|
var _context8;
|
|
2968
|
-
|
|
2969
2033
|
(0, _forEach.default)(_context8 = options.include).call(_context8, function (key) {
|
|
2970
2034
|
if ((0, _isArray.default)(key)) {
|
|
2971
2035
|
include = (0, _concat.default)(include).call(include, key);
|
|
@@ -2976,9 +2040,9 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
2976
2040
|
} else {
|
|
2977
2041
|
include.push(options.include);
|
|
2978
2042
|
}
|
|
2979
|
-
|
|
2980
2043
|
return include;
|
|
2981
2044
|
}
|
|
2045
|
+
|
|
2982
2046
|
/**
|
|
2983
2047
|
* Destroy the given list of models on the server if it was already persisted.
|
|
2984
2048
|
*
|
|
@@ -3025,33 +2089,26 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
3025
2089
|
* @returns {Promise} A promise that is fulfilled when the destroyAll
|
|
3026
2090
|
* completes.
|
|
3027
2091
|
*/
|
|
3028
|
-
|
|
3029
2092
|
}, {
|
|
3030
2093
|
key: "destroyAll",
|
|
3031
|
-
value: function
|
|
3032
|
-
/*: Array<ParseObject>*/
|
|
3033
|
-
) {
|
|
2094
|
+
value: function (list /*: Array<ParseObject>*/) {
|
|
3034
2095
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
3035
2096
|
var destroyOptions = {};
|
|
3036
|
-
|
|
3037
2097
|
if (options.hasOwnProperty('useMasterKey')) {
|
|
3038
2098
|
destroyOptions.useMasterKey = options.useMasterKey;
|
|
3039
2099
|
}
|
|
3040
|
-
|
|
3041
2100
|
if (options.hasOwnProperty('sessionToken')) {
|
|
3042
2101
|
destroyOptions.sessionToken = options.sessionToken;
|
|
3043
2102
|
}
|
|
3044
|
-
|
|
3045
2103
|
if (options.hasOwnProperty('batchSize') && typeof options.batchSize === 'number') {
|
|
3046
2104
|
destroyOptions.batchSize = options.batchSize;
|
|
3047
2105
|
}
|
|
3048
|
-
|
|
3049
2106
|
if (options.hasOwnProperty('context') && (0, _typeof2.default)(options.context) === 'object') {
|
|
3050
2107
|
destroyOptions.context = options.context;
|
|
3051
2108
|
}
|
|
3052
|
-
|
|
3053
2109
|
return _CoreManager.default.getObjectController().destroy(list, destroyOptions);
|
|
3054
2110
|
}
|
|
2111
|
+
|
|
3055
2112
|
/**
|
|
3056
2113
|
* Saves the given list of Parse.Object.
|
|
3057
2114
|
* If any error is encountered, stops and calls the error handler.
|
|
@@ -3070,35 +2127,26 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
3070
2127
|
* @static
|
|
3071
2128
|
* @returns {Parse.Object[]}
|
|
3072
2129
|
*/
|
|
3073
|
-
|
|
3074
2130
|
}, {
|
|
3075
2131
|
key: "saveAll",
|
|
3076
|
-
value: function
|
|
3077
|
-
|
|
3078
|
-
) {
|
|
3079
|
-
var options
|
|
3080
|
-
/*: RequestOptions*/
|
|
3081
|
-
= arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2132
|
+
value: function (list /*: Array<ParseObject>*/) {
|
|
2133
|
+
var options /*: RequestOptions*/ = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
3082
2134
|
var saveOptions = {};
|
|
3083
|
-
|
|
3084
2135
|
if (options.hasOwnProperty('useMasterKey')) {
|
|
3085
2136
|
saveOptions.useMasterKey = options.useMasterKey;
|
|
3086
2137
|
}
|
|
3087
|
-
|
|
3088
2138
|
if (options.hasOwnProperty('sessionToken')) {
|
|
3089
2139
|
saveOptions.sessionToken = options.sessionToken;
|
|
3090
2140
|
}
|
|
3091
|
-
|
|
3092
2141
|
if (options.hasOwnProperty('batchSize') && typeof options.batchSize === 'number') {
|
|
3093
2142
|
saveOptions.batchSize = options.batchSize;
|
|
3094
2143
|
}
|
|
3095
|
-
|
|
3096
2144
|
if (options.hasOwnProperty('context') && (0, _typeof2.default)(options.context) === 'object') {
|
|
3097
2145
|
saveOptions.context = options.context;
|
|
3098
2146
|
}
|
|
3099
|
-
|
|
3100
2147
|
return _CoreManager.default.getObjectController().save(list, saveOptions);
|
|
3101
2148
|
}
|
|
2149
|
+
|
|
3102
2150
|
/**
|
|
3103
2151
|
* Creates a reference to a subclass of Parse.Object with the given id. This
|
|
3104
2152
|
* does not exist on Parse.Object, only on subclasses.
|
|
@@ -3113,16 +2161,14 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
3113
2161
|
* @static
|
|
3114
2162
|
* @returns {Parse.Object} A Parse.Object reference.
|
|
3115
2163
|
*/
|
|
3116
|
-
|
|
3117
2164
|
}, {
|
|
3118
2165
|
key: "createWithoutData",
|
|
3119
|
-
value: function
|
|
3120
|
-
/*: string*/
|
|
3121
|
-
) {
|
|
2166
|
+
value: function (id /*: string*/) {
|
|
3122
2167
|
var obj = new this();
|
|
3123
2168
|
obj.id = id;
|
|
3124
2169
|
return obj;
|
|
3125
2170
|
}
|
|
2171
|
+
|
|
3126
2172
|
/**
|
|
3127
2173
|
* Creates a new instance of a Parse Object from a JSON representation.
|
|
3128
2174
|
*
|
|
@@ -3133,61 +2179,44 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
3133
2179
|
* @static
|
|
3134
2180
|
* @returns {Parse.Object} A Parse.Object reference
|
|
3135
2181
|
*/
|
|
3136
|
-
|
|
3137
2182
|
}, {
|
|
3138
2183
|
key: "fromJSON",
|
|
3139
|
-
value: function
|
|
3140
|
-
/*: any*/
|
|
3141
|
-
, override
|
|
3142
|
-
/*:: ?: boolean*/
|
|
3143
|
-
, dirty
|
|
3144
|
-
/*:: ?: boolean*/
|
|
3145
|
-
) {
|
|
2184
|
+
value: function (json /*: any*/, override /*:: ?: boolean*/, dirty /*:: ?: boolean*/) {
|
|
3146
2185
|
if (!json.className) {
|
|
3147
2186
|
throw new Error('Cannot create an object without a className');
|
|
3148
2187
|
}
|
|
3149
|
-
|
|
3150
2188
|
var constructor = classMap[json.className];
|
|
3151
2189
|
var o = constructor ? new constructor(json.className) : new ParseObject(json.className);
|
|
3152
2190
|
var otherAttributes = {};
|
|
3153
|
-
|
|
3154
2191
|
for (var _attr12 in json) {
|
|
3155
2192
|
if (_attr12 !== 'className' && _attr12 !== '__type') {
|
|
3156
2193
|
otherAttributes[_attr12] = json[_attr12];
|
|
3157
|
-
|
|
3158
2194
|
if (dirty) {
|
|
3159
2195
|
o.set(_attr12, json[_attr12]);
|
|
3160
2196
|
}
|
|
3161
2197
|
}
|
|
3162
2198
|
}
|
|
3163
|
-
|
|
3164
2199
|
if (override) {
|
|
3165
2200
|
// id needs to be set before clearServerData can work
|
|
3166
2201
|
if (otherAttributes.objectId) {
|
|
3167
2202
|
o.id = otherAttributes.objectId;
|
|
3168
2203
|
}
|
|
3169
|
-
|
|
3170
2204
|
var preserved = null;
|
|
3171
|
-
|
|
3172
2205
|
if (typeof o._preserveFieldsOnFetch === 'function') {
|
|
3173
2206
|
preserved = o._preserveFieldsOnFetch();
|
|
3174
2207
|
}
|
|
3175
|
-
|
|
3176
2208
|
o._clearServerData();
|
|
3177
|
-
|
|
3178
2209
|
if (preserved) {
|
|
3179
2210
|
o._finishFetch(preserved);
|
|
3180
2211
|
}
|
|
3181
2212
|
}
|
|
3182
|
-
|
|
3183
2213
|
o._finishFetch(otherAttributes);
|
|
3184
|
-
|
|
3185
2214
|
if (json.objectId) {
|
|
3186
2215
|
o._setExisted(true);
|
|
3187
2216
|
}
|
|
3188
|
-
|
|
3189
2217
|
return o;
|
|
3190
2218
|
}
|
|
2219
|
+
|
|
3191
2220
|
/**
|
|
3192
2221
|
* Registers a subclass of Parse.Object with a specific class name.
|
|
3193
2222
|
* When objects of that class are retrieved from a query, they will be
|
|
@@ -3197,49 +2226,38 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
3197
2226
|
* @param {string} className The class name of the subclass
|
|
3198
2227
|
* @param {Function} constructor The subclass
|
|
3199
2228
|
*/
|
|
3200
|
-
|
|
3201
2229
|
}, {
|
|
3202
2230
|
key: "registerSubclass",
|
|
3203
|
-
value: function
|
|
3204
|
-
/*: string*/
|
|
3205
|
-
, constructor
|
|
3206
|
-
/*: any*/
|
|
3207
|
-
) {
|
|
2231
|
+
value: function (className /*: string*/, constructor /*: any*/) {
|
|
3208
2232
|
if (typeof className !== 'string') {
|
|
3209
2233
|
throw new TypeError('The first argument must be a valid class name.');
|
|
3210
2234
|
}
|
|
3211
|
-
|
|
3212
2235
|
if (typeof constructor === 'undefined') {
|
|
3213
2236
|
throw new TypeError('You must supply a subclass constructor.');
|
|
3214
2237
|
}
|
|
3215
|
-
|
|
3216
2238
|
if (typeof constructor !== 'function') {
|
|
3217
2239
|
throw new TypeError('You must register the subclass constructor. ' + 'Did you attempt to register an instance of the subclass?');
|
|
3218
2240
|
}
|
|
3219
|
-
|
|
3220
2241
|
classMap[className] = constructor;
|
|
3221
|
-
|
|
3222
2242
|
if (!constructor.className) {
|
|
3223
2243
|
constructor.className = className;
|
|
3224
2244
|
}
|
|
3225
2245
|
}
|
|
2246
|
+
|
|
3226
2247
|
/**
|
|
3227
2248
|
* Unegisters a subclass of Parse.Object with a specific class name.
|
|
3228
2249
|
*
|
|
3229
2250
|
* @param {string} className The class name of the subclass
|
|
3230
2251
|
*/
|
|
3231
|
-
|
|
3232
2252
|
}, {
|
|
3233
2253
|
key: "unregisterSubclass",
|
|
3234
|
-
value: function
|
|
3235
|
-
/*: string*/
|
|
3236
|
-
) {
|
|
2254
|
+
value: function (className /*: string*/) {
|
|
3237
2255
|
if (typeof className !== 'string') {
|
|
3238
2256
|
throw new TypeError('The first argument must be a valid class name.');
|
|
3239
2257
|
}
|
|
3240
|
-
|
|
3241
2258
|
delete classMap[className];
|
|
3242
2259
|
}
|
|
2260
|
+
|
|
3243
2261
|
/**
|
|
3244
2262
|
* Creates a new subclass of Parse.Object for the given Parse class name.
|
|
3245
2263
|
*
|
|
@@ -3277,16 +2295,9 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
3277
2295
|
* this method.
|
|
3278
2296
|
* @returns {Parse.Object} A new subclass of Parse.Object.
|
|
3279
2297
|
*/
|
|
3280
|
-
|
|
3281
2298
|
}, {
|
|
3282
2299
|
key: "extend",
|
|
3283
|
-
value: function
|
|
3284
|
-
/*: any*/
|
|
3285
|
-
, protoProps
|
|
3286
|
-
/*: any*/
|
|
3287
|
-
, classProps
|
|
3288
|
-
/*: any*/
|
|
3289
|
-
) {
|
|
2300
|
+
value: function (className /*: any*/, protoProps /*: any*/, classProps /*: any*/) {
|
|
3290
2301
|
if (typeof className !== 'string') {
|
|
3291
2302
|
if (className && typeof className.className === 'string') {
|
|
3292
2303
|
return ParseObject.extend(className.className, className, protoProps);
|
|
@@ -3294,31 +2305,24 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
3294
2305
|
throw new Error("Parse.Object.extend's first argument should be the className.");
|
|
3295
2306
|
}
|
|
3296
2307
|
}
|
|
3297
|
-
|
|
3298
2308
|
var adjustedClassName = className;
|
|
3299
|
-
|
|
3300
2309
|
if (adjustedClassName === 'User' && _CoreManager.default.get('PERFORM_USER_REWRITE')) {
|
|
3301
2310
|
adjustedClassName = '_User';
|
|
3302
2311
|
}
|
|
3303
|
-
|
|
3304
2312
|
var parentProto = ParseObject.prototype;
|
|
3305
|
-
|
|
3306
2313
|
if (this.hasOwnProperty('__super__') && this.__super__) {
|
|
3307
2314
|
parentProto = this.prototype;
|
|
3308
2315
|
}
|
|
3309
|
-
|
|
3310
|
-
var ParseObjectSubclass = function ParseObjectSubclass(attributes, options) {
|
|
2316
|
+
var ParseObjectSubclass = function (attributes, options) {
|
|
3311
2317
|
this.className = adjustedClassName;
|
|
3312
|
-
this._objCount = objectCount++;
|
|
3313
|
-
|
|
2318
|
+
this._objCount = objectCount++;
|
|
2319
|
+
// Enable legacy initializers
|
|
3314
2320
|
if (typeof this.initialize === 'function') {
|
|
3315
2321
|
this.initialize.apply(this, arguments);
|
|
3316
2322
|
}
|
|
3317
|
-
|
|
3318
2323
|
if (this._initializers) {
|
|
3319
2324
|
var _iterator2 = _createForOfIteratorHelper(this._initializers),
|
|
3320
|
-
|
|
3321
|
-
|
|
2325
|
+
_step2;
|
|
3322
2326
|
try {
|
|
3323
2327
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
3324
2328
|
var initializer = _step2.value;
|
|
@@ -3330,14 +2334,12 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
3330
2334
|
_iterator2.f();
|
|
3331
2335
|
}
|
|
3332
2336
|
}
|
|
3333
|
-
|
|
3334
2337
|
if (attributes && (0, _typeof2.default)(attributes) === 'object') {
|
|
3335
2338
|
if (!this.set(attributes || {}, options)) {
|
|
3336
2339
|
throw new Error("Can't create an invalid Parse Object");
|
|
3337
2340
|
}
|
|
3338
2341
|
}
|
|
3339
2342
|
};
|
|
3340
|
-
|
|
3341
2343
|
if (classMap[adjustedClassName]) {
|
|
3342
2344
|
ParseObjectSubclass = classMap[adjustedClassName];
|
|
3343
2345
|
} else {
|
|
@@ -3345,10 +2347,8 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
3345
2347
|
if (typeof name === 'string') {
|
|
3346
2348
|
return ParseObject.extend.call(ParseObjectSubclass, name, protoProps, classProps);
|
|
3347
2349
|
}
|
|
3348
|
-
|
|
3349
2350
|
return ParseObject.extend.call(ParseObjectSubclass, adjustedClassName, name, protoProps);
|
|
3350
2351
|
};
|
|
3351
|
-
|
|
3352
2352
|
ParseObjectSubclass.createWithoutData = ParseObject.createWithoutData;
|
|
3353
2353
|
ParseObjectSubclass.className = adjustedClassName;
|
|
3354
2354
|
ParseObjectSubclass.__super__ = parentProto;
|
|
@@ -3361,13 +2361,11 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
3361
2361
|
}
|
|
3362
2362
|
});
|
|
3363
2363
|
}
|
|
3364
|
-
|
|
3365
2364
|
if (protoProps) {
|
|
3366
2365
|
for (var prop in protoProps) {
|
|
3367
2366
|
if (prop === 'initialize') {
|
|
3368
2367
|
var _context9;
|
|
3369
|
-
|
|
3370
|
-
(0, _defineProperty2.default)(ParseObjectSubclass.prototype, '_initializers', {
|
|
2368
|
+
(0, _defineProperty3.default)(ParseObjectSubclass.prototype, '_initializers', {
|
|
3371
2369
|
value: (0, _concat.default)(_context9 = []).call(_context9, (0, _toConsumableArray2.default)(ParseObjectSubclass.prototype._initializers || []), [protoProps[prop]]),
|
|
3372
2370
|
enumerable: false,
|
|
3373
2371
|
writable: true,
|
|
@@ -3375,9 +2373,8 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
3375
2373
|
});
|
|
3376
2374
|
continue;
|
|
3377
2375
|
}
|
|
3378
|
-
|
|
3379
2376
|
if (prop !== 'className') {
|
|
3380
|
-
(0,
|
|
2377
|
+
(0, _defineProperty3.default)(ParseObjectSubclass.prototype, prop, {
|
|
3381
2378
|
value: protoProps[prop],
|
|
3382
2379
|
enumerable: false,
|
|
3383
2380
|
writable: true,
|
|
@@ -3386,11 +2383,10 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
3386
2383
|
}
|
|
3387
2384
|
}
|
|
3388
2385
|
}
|
|
3389
|
-
|
|
3390
2386
|
if (classProps) {
|
|
3391
2387
|
for (var _prop in classProps) {
|
|
3392
2388
|
if (_prop !== 'className') {
|
|
3393
|
-
(0,
|
|
2389
|
+
(0, _defineProperty3.default)(ParseObjectSubclass, _prop, {
|
|
3394
2390
|
value: classProps[_prop],
|
|
3395
2391
|
enumerable: false,
|
|
3396
2392
|
writable: true,
|
|
@@ -3399,10 +2395,10 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
3399
2395
|
}
|
|
3400
2396
|
}
|
|
3401
2397
|
}
|
|
3402
|
-
|
|
3403
2398
|
classMap[adjustedClassName] = ParseObjectSubclass;
|
|
3404
2399
|
return ParseObjectSubclass;
|
|
3405
2400
|
}
|
|
2401
|
+
|
|
3406
2402
|
/**
|
|
3407
2403
|
* Enable single instance objects, where any local objects with the same Id
|
|
3408
2404
|
* share the same attributes, and stay synchronized with each other.
|
|
@@ -3411,14 +2407,13 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
3411
2407
|
*
|
|
3412
2408
|
* @static
|
|
3413
2409
|
*/
|
|
3414
|
-
|
|
3415
2410
|
}, {
|
|
3416
2411
|
key: "enableSingleInstance",
|
|
3417
|
-
value: function
|
|
2412
|
+
value: function () {
|
|
3418
2413
|
singleInstance = true;
|
|
3419
|
-
|
|
3420
2414
|
_CoreManager.default.setObjectStateController(SingleInstanceStateController);
|
|
3421
2415
|
}
|
|
2416
|
+
|
|
3422
2417
|
/**
|
|
3423
2418
|
* Disable single instance objects, where any local objects with the same Id
|
|
3424
2419
|
* share the same attributes, and stay synchronized with each other.
|
|
@@ -3427,14 +2422,13 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
3427
2422
|
*
|
|
3428
2423
|
* @static
|
|
3429
2424
|
*/
|
|
3430
|
-
|
|
3431
2425
|
}, {
|
|
3432
2426
|
key: "disableSingleInstance",
|
|
3433
|
-
value: function
|
|
2427
|
+
value: function () {
|
|
3434
2428
|
singleInstance = false;
|
|
3435
|
-
|
|
3436
2429
|
_CoreManager.default.setObjectStateController(UniqueInstanceStateController);
|
|
3437
2430
|
}
|
|
2431
|
+
|
|
3438
2432
|
/**
|
|
3439
2433
|
* Asynchronously stores the objects and every object they point to in the local datastore,
|
|
3440
2434
|
* recursively, using a default pin name: _default.
|
|
@@ -3453,22 +2447,16 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
3453
2447
|
* @returns {Promise} A promise that is fulfilled when the pin completes.
|
|
3454
2448
|
* @static
|
|
3455
2449
|
*/
|
|
3456
|
-
|
|
3457
2450
|
}, {
|
|
3458
2451
|
key: "pinAll",
|
|
3459
|
-
value: function
|
|
3460
|
-
/*: Array<ParseObject>*/
|
|
3461
|
-
)
|
|
3462
|
-
/*: Promise<void>*/
|
|
3463
|
-
{
|
|
2452
|
+
value: function (objects /*: Array<ParseObject>*/) /*: Promise<void>*/{
|
|
3464
2453
|
var localDatastore = _CoreManager.default.getLocalDatastore();
|
|
3465
|
-
|
|
3466
2454
|
if (!localDatastore.isEnabled) {
|
|
3467
2455
|
return _promise.default.reject('Parse.enableLocalDatastore() must be called first');
|
|
3468
2456
|
}
|
|
3469
|
-
|
|
3470
2457
|
return ParseObject.pinAllWithName(_LocalDatastoreUtils.DEFAULT_PIN, objects);
|
|
3471
2458
|
}
|
|
2459
|
+
|
|
3472
2460
|
/**
|
|
3473
2461
|
* Asynchronously stores the objects and every object they point to in the local datastore, recursively.
|
|
3474
2462
|
*
|
|
@@ -3487,24 +2475,16 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
3487
2475
|
* @returns {Promise} A promise that is fulfilled when the pin completes.
|
|
3488
2476
|
* @static
|
|
3489
2477
|
*/
|
|
3490
|
-
|
|
3491
2478
|
}, {
|
|
3492
2479
|
key: "pinAllWithName",
|
|
3493
|
-
value: function
|
|
3494
|
-
/*: string*/
|
|
3495
|
-
, objects
|
|
3496
|
-
/*: Array<ParseObject>*/
|
|
3497
|
-
)
|
|
3498
|
-
/*: Promise<void>*/
|
|
3499
|
-
{
|
|
2480
|
+
value: function (name /*: string*/, objects /*: Array<ParseObject>*/) /*: Promise<void>*/{
|
|
3500
2481
|
var localDatastore = _CoreManager.default.getLocalDatastore();
|
|
3501
|
-
|
|
3502
2482
|
if (!localDatastore.isEnabled) {
|
|
3503
2483
|
return _promise.default.reject('Parse.enableLocalDatastore() must be called first');
|
|
3504
2484
|
}
|
|
3505
|
-
|
|
3506
2485
|
return localDatastore._handlePinAllWithName(name, objects);
|
|
3507
2486
|
}
|
|
2487
|
+
|
|
3508
2488
|
/**
|
|
3509
2489
|
* Asynchronously removes the objects and every object they point to in the local datastore,
|
|
3510
2490
|
* recursively, using a default pin name: _default.
|
|
@@ -3517,22 +2497,16 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
3517
2497
|
* @returns {Promise} A promise that is fulfilled when the unPin completes.
|
|
3518
2498
|
* @static
|
|
3519
2499
|
*/
|
|
3520
|
-
|
|
3521
2500
|
}, {
|
|
3522
2501
|
key: "unPinAll",
|
|
3523
|
-
value: function
|
|
3524
|
-
/*: Array<ParseObject>*/
|
|
3525
|
-
)
|
|
3526
|
-
/*: Promise<void>*/
|
|
3527
|
-
{
|
|
2502
|
+
value: function (objects /*: Array<ParseObject>*/) /*: Promise<void>*/{
|
|
3528
2503
|
var localDatastore = _CoreManager.default.getLocalDatastore();
|
|
3529
|
-
|
|
3530
2504
|
if (!localDatastore.isEnabled) {
|
|
3531
2505
|
return _promise.default.reject('Parse.enableLocalDatastore() must be called first');
|
|
3532
2506
|
}
|
|
3533
|
-
|
|
3534
2507
|
return ParseObject.unPinAllWithName(_LocalDatastoreUtils.DEFAULT_PIN, objects);
|
|
3535
2508
|
}
|
|
2509
|
+
|
|
3536
2510
|
/**
|
|
3537
2511
|
* Asynchronously removes the objects and every object they point to in the local datastore, recursively.
|
|
3538
2512
|
*
|
|
@@ -3545,24 +2519,16 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
3545
2519
|
* @returns {Promise} A promise that is fulfilled when the unPin completes.
|
|
3546
2520
|
* @static
|
|
3547
2521
|
*/
|
|
3548
|
-
|
|
3549
2522
|
}, {
|
|
3550
2523
|
key: "unPinAllWithName",
|
|
3551
|
-
value: function
|
|
3552
|
-
/*: string*/
|
|
3553
|
-
, objects
|
|
3554
|
-
/*: Array<ParseObject>*/
|
|
3555
|
-
)
|
|
3556
|
-
/*: Promise<void>*/
|
|
3557
|
-
{
|
|
2524
|
+
value: function (name /*: string*/, objects /*: Array<ParseObject>*/) /*: Promise<void>*/{
|
|
3558
2525
|
var localDatastore = _CoreManager.default.getLocalDatastore();
|
|
3559
|
-
|
|
3560
2526
|
if (!localDatastore.isEnabled) {
|
|
3561
2527
|
return _promise.default.reject('Parse.enableLocalDatastore() must be called first');
|
|
3562
2528
|
}
|
|
3563
|
-
|
|
3564
2529
|
return localDatastore._handleUnPinAllWithName(name, objects);
|
|
3565
2530
|
}
|
|
2531
|
+
|
|
3566
2532
|
/**
|
|
3567
2533
|
* Asynchronously removes all objects in the local datastore using a default pin name: _default.
|
|
3568
2534
|
*
|
|
@@ -3573,20 +2539,16 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
3573
2539
|
* @returns {Promise} A promise that is fulfilled when the unPin completes.
|
|
3574
2540
|
* @static
|
|
3575
2541
|
*/
|
|
3576
|
-
|
|
3577
2542
|
}, {
|
|
3578
2543
|
key: "unPinAllObjects",
|
|
3579
|
-
value: function
|
|
3580
|
-
/*: Promise<void>*/
|
|
3581
|
-
{
|
|
2544
|
+
value: function () /*: Promise<void>*/{
|
|
3582
2545
|
var localDatastore = _CoreManager.default.getLocalDatastore();
|
|
3583
|
-
|
|
3584
2546
|
if (!localDatastore.isEnabled) {
|
|
3585
2547
|
return _promise.default.reject('Parse.enableLocalDatastore() must be called first');
|
|
3586
2548
|
}
|
|
3587
|
-
|
|
3588
2549
|
return localDatastore.unPinWithName(_LocalDatastoreUtils.DEFAULT_PIN);
|
|
3589
2550
|
}
|
|
2551
|
+
|
|
3590
2552
|
/**
|
|
3591
2553
|
* Asynchronously removes all objects with the specified pin name.
|
|
3592
2554
|
* Deletes the pin name also.
|
|
@@ -3599,43 +2561,25 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
3599
2561
|
* @returns {Promise} A promise that is fulfilled when the unPin completes.
|
|
3600
2562
|
* @static
|
|
3601
2563
|
*/
|
|
3602
|
-
|
|
3603
2564
|
}, {
|
|
3604
2565
|
key: "unPinAllObjectsWithName",
|
|
3605
|
-
value: function
|
|
3606
|
-
/*: string*/
|
|
3607
|
-
)
|
|
3608
|
-
/*: Promise<void>*/
|
|
3609
|
-
{
|
|
2566
|
+
value: function (name /*: string*/) /*: Promise<void>*/{
|
|
3610
2567
|
var localDatastore = _CoreManager.default.getLocalDatastore();
|
|
3611
|
-
|
|
3612
2568
|
if (!localDatastore.isEnabled) {
|
|
3613
2569
|
return _promise.default.reject('Parse.enableLocalDatastore() must be called first');
|
|
3614
2570
|
}
|
|
3615
|
-
|
|
3616
2571
|
return localDatastore.unPinWithName(_LocalDatastoreUtils.PIN_PREFIX + name);
|
|
3617
2572
|
}
|
|
3618
2573
|
}]);
|
|
3619
2574
|
return ParseObject;
|
|
3620
2575
|
}();
|
|
3621
|
-
|
|
3622
2576
|
var DefaultController = {
|
|
3623
|
-
fetch: function
|
|
3624
|
-
/*: ParseObject | Array<ParseObject>*/
|
|
3625
|
-
, forceFetch
|
|
3626
|
-
/*: boolean*/
|
|
3627
|
-
, options
|
|
3628
|
-
/*: RequestOptions*/
|
|
3629
|
-
)
|
|
3630
|
-
/*: Promise<Array<void> | ParseObject>*/
|
|
3631
|
-
{
|
|
2577
|
+
fetch: function (target /*: ParseObject | Array<ParseObject>*/, forceFetch /*: boolean*/, options /*: RequestOptions*/) /*: Promise<Array<void> | ParseObject>*/{
|
|
3632
2578
|
var localDatastore = _CoreManager.default.getLocalDatastore();
|
|
3633
|
-
|
|
3634
2579
|
if ((0, _isArray.default)(target)) {
|
|
3635
2580
|
if (target.length < 1) {
|
|
3636
2581
|
return _promise.default.resolve([]);
|
|
3637
2582
|
}
|
|
3638
|
-
|
|
3639
2583
|
var objs = [];
|
|
3640
2584
|
var ids = [];
|
|
3641
2585
|
var className = null;
|
|
@@ -3645,142 +2589,94 @@ var DefaultController = {
|
|
|
3645
2589
|
if (error) {
|
|
3646
2590
|
return;
|
|
3647
2591
|
}
|
|
3648
|
-
|
|
3649
2592
|
if (!className) {
|
|
3650
2593
|
className = el.className;
|
|
3651
2594
|
}
|
|
3652
|
-
|
|
3653
2595
|
if (className !== el.className) {
|
|
3654
2596
|
error = new _ParseError.default(_ParseError.default.INVALID_CLASS_NAME, 'All objects should be of the same class');
|
|
3655
2597
|
}
|
|
3656
|
-
|
|
3657
2598
|
if (!el.id) {
|
|
3658
2599
|
error = new _ParseError.default(_ParseError.default.MISSING_OBJECT_ID, 'All objects must have an ID');
|
|
3659
2600
|
}
|
|
3660
|
-
|
|
3661
2601
|
if (forceFetch || !el.isDataAvailable()) {
|
|
3662
2602
|
ids.push(el.id);
|
|
3663
2603
|
objs.push(el);
|
|
3664
2604
|
}
|
|
3665
|
-
|
|
3666
2605
|
results.push(el);
|
|
3667
2606
|
});
|
|
3668
|
-
|
|
3669
2607
|
if (error) {
|
|
3670
2608
|
return _promise.default.reject(error);
|
|
3671
2609
|
}
|
|
3672
|
-
|
|
3673
2610
|
var query = new _ParseQuery.default(className);
|
|
3674
2611
|
query.containedIn('objectId', ids);
|
|
3675
|
-
|
|
3676
2612
|
if (options && options.include) {
|
|
3677
2613
|
query.include(options.include);
|
|
3678
2614
|
}
|
|
3679
|
-
|
|
3680
2615
|
query._limit = ids.length;
|
|
3681
2616
|
return (0, _find.default)(query).call(query, options).then( /*#__PURE__*/function () {
|
|
3682
|
-
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
3683
|
-
var idMap, i, obj, _i, _obj, id,
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
idMap =
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
case 3:
|
|
3696
|
-
if (!(i < objs.length)) {
|
|
3697
|
-
_context10.next = 11;
|
|
3698
|
-
break;
|
|
3699
|
-
}
|
|
3700
|
-
|
|
3701
|
-
obj = objs[i];
|
|
3702
|
-
|
|
3703
|
-
if (!(!obj || !obj.id || !idMap[obj.id])) {
|
|
3704
|
-
_context10.next = 8;
|
|
3705
|
-
break;
|
|
3706
|
-
}
|
|
3707
|
-
|
|
3708
|
-
if (!forceFetch) {
|
|
3709
|
-
_context10.next = 8;
|
|
3710
|
-
break;
|
|
3711
|
-
}
|
|
3712
|
-
|
|
3713
|
-
return _context10.abrupt("return", _promise.default.reject(new _ParseError.default(_ParseError.default.OBJECT_NOT_FOUND, 'All objects must exist on the server.')));
|
|
3714
|
-
|
|
3715
|
-
case 8:
|
|
3716
|
-
i++;
|
|
3717
|
-
_context10.next = 3;
|
|
2617
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(objects) {
|
|
2618
|
+
var idMap, i, obj, _i, _obj, id, _i2, _results, object;
|
|
2619
|
+
return _regenerator.default.wrap(function (_context10) {
|
|
2620
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
2621
|
+
case 0:
|
|
2622
|
+
idMap = {};
|
|
2623
|
+
(0, _forEach.default)(objects).call(objects, function (o) {
|
|
2624
|
+
idMap[o.id] = o;
|
|
2625
|
+
});
|
|
2626
|
+
i = 0;
|
|
2627
|
+
case 3:
|
|
2628
|
+
if (!(i < objs.length)) {
|
|
2629
|
+
_context10.next = 11;
|
|
3718
2630
|
break;
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
2631
|
+
}
|
|
2632
|
+
obj = objs[i];
|
|
2633
|
+
if (!(!obj || !obj.id || !idMap[obj.id])) {
|
|
2634
|
+
_context10.next = 8;
|
|
2635
|
+
break;
|
|
2636
|
+
}
|
|
2637
|
+
if (!forceFetch) {
|
|
2638
|
+
_context10.next = 8;
|
|
2639
|
+
break;
|
|
2640
|
+
}
|
|
2641
|
+
return _context10.abrupt("return", _promise.default.reject(new _ParseError.default(_ParseError.default.OBJECT_NOT_FOUND, 'All objects must exist on the server.')));
|
|
2642
|
+
case 8:
|
|
2643
|
+
i++;
|
|
2644
|
+
_context10.next = 3;
|
|
2645
|
+
break;
|
|
2646
|
+
case 11:
|
|
2647
|
+
if (!singleInstance) {
|
|
2648
|
+
// If single instance objects are disabled, we need to replace the
|
|
2649
|
+
for (_i = 0; _i < results.length; _i++) {
|
|
2650
|
+
_obj = results[_i];
|
|
2651
|
+
if (_obj && _obj.id && idMap[_obj.id]) {
|
|
2652
|
+
id = _obj.id;
|
|
2653
|
+
_obj._finishFetch(idMap[id].toJSON());
|
|
2654
|
+
results[_i] = idMap[id];
|
|
3733
2655
|
}
|
|
3734
2656
|
}
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
case 15:
|
|
3742
|
-
if ((_step3 = _iterator3.n()).done) {
|
|
3743
|
-
_context10.next = 21;
|
|
3744
|
-
break;
|
|
3745
|
-
}
|
|
3746
|
-
|
|
3747
|
-
object = _step3.value;
|
|
3748
|
-
_context10.next = 19;
|
|
3749
|
-
return localDatastore._updateObjectIfPinned(object);
|
|
3750
|
-
|
|
3751
|
-
case 19:
|
|
3752
|
-
_context10.next = 15;
|
|
3753
|
-
break;
|
|
3754
|
-
|
|
3755
|
-
case 21:
|
|
3756
|
-
_context10.next = 26;
|
|
2657
|
+
}
|
|
2658
|
+
_i2 = 0, _results = results;
|
|
2659
|
+
case 13:
|
|
2660
|
+
if (!(_i2 < _results.length)) {
|
|
2661
|
+
_context10.next = 20;
|
|
3757
2662
|
break;
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
case 29:
|
|
3773
|
-
return _context10.abrupt("return", _promise.default.resolve(results));
|
|
3774
|
-
|
|
3775
|
-
case 30:
|
|
3776
|
-
case "end":
|
|
3777
|
-
return _context10.stop();
|
|
3778
|
-
}
|
|
2663
|
+
}
|
|
2664
|
+
object = _results[_i2];
|
|
2665
|
+
_context10.next = 17;
|
|
2666
|
+
return localDatastore._updateObjectIfPinned(object);
|
|
2667
|
+
case 17:
|
|
2668
|
+
_i2++;
|
|
2669
|
+
_context10.next = 13;
|
|
2670
|
+
break;
|
|
2671
|
+
case 20:
|
|
2672
|
+
return _context10.abrupt("return", _promise.default.resolve(results));
|
|
2673
|
+
case 21:
|
|
2674
|
+
case "end":
|
|
2675
|
+
return _context10.stop();
|
|
3779
2676
|
}
|
|
3780
|
-
}, _callee6
|
|
2677
|
+
}, _callee6);
|
|
3781
2678
|
}));
|
|
3782
|
-
|
|
3783
|
-
return function (_x4) {
|
|
2679
|
+
return function () {
|
|
3784
2680
|
return _ref.apply(this, arguments);
|
|
3785
2681
|
};
|
|
3786
2682
|
}());
|
|
@@ -3788,260 +2684,188 @@ var DefaultController = {
|
|
|
3788
2684
|
if (!target.id) {
|
|
3789
2685
|
return _promise.default.reject(new _ParseError.default(_ParseError.default.MISSING_OBJECT_ID, 'Object does not have an ID'));
|
|
3790
2686
|
}
|
|
3791
|
-
|
|
3792
2687
|
var RESTController = _CoreManager.default.getRESTController();
|
|
3793
|
-
|
|
3794
2688
|
var params = {};
|
|
3795
|
-
|
|
3796
2689
|
if (options && options.include) {
|
|
3797
2690
|
params.include = options.include.join();
|
|
3798
2691
|
}
|
|
3799
|
-
|
|
3800
2692
|
return RESTController.request('GET', 'classes/' + target.className + '/' + target._getId(), params, options).then( /*#__PURE__*/function () {
|
|
3801
|
-
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
3802
|
-
return
|
|
3803
|
-
while (1) {
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
case 5:
|
|
3816
|
-
return _context11.abrupt("return", target);
|
|
3817
|
-
|
|
3818
|
-
case 6:
|
|
3819
|
-
case "end":
|
|
3820
|
-
return _context11.stop();
|
|
3821
|
-
}
|
|
2693
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(response) {
|
|
2694
|
+
return _regenerator.default.wrap(function (_context11) {
|
|
2695
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
2696
|
+
case 0:
|
|
2697
|
+
target._clearPendingOps();
|
|
2698
|
+
target._clearServerData();
|
|
2699
|
+
target._finishFetch(response);
|
|
2700
|
+
_context11.next = 5;
|
|
2701
|
+
return localDatastore._updateObjectIfPinned(target);
|
|
2702
|
+
case 5:
|
|
2703
|
+
return _context11.abrupt("return", target);
|
|
2704
|
+
case 6:
|
|
2705
|
+
case "end":
|
|
2706
|
+
return _context11.stop();
|
|
3822
2707
|
}
|
|
3823
2708
|
}, _callee7);
|
|
3824
2709
|
}));
|
|
3825
|
-
|
|
3826
|
-
return function (_x5) {
|
|
2710
|
+
return function () {
|
|
3827
2711
|
return _ref2.apply(this, arguments);
|
|
3828
2712
|
};
|
|
3829
2713
|
}());
|
|
3830
2714
|
}
|
|
3831
|
-
|
|
3832
2715
|
return _promise.default.resolve();
|
|
3833
2716
|
},
|
|
3834
|
-
destroy: function
|
|
3835
|
-
|
|
3836
|
-
, options
|
|
3837
|
-
/*: RequestOptions*/
|
|
3838
|
-
)
|
|
3839
|
-
/*: Promise<Array<void> | ParseObject>*/
|
|
3840
|
-
{
|
|
3841
|
-
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
2717
|
+
destroy: function (target /*: ParseObject | Array<ParseObject>*/, options /*: RequestOptions*/) /*: Promise<Array<void> | ParseObject>*/{
|
|
2718
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
3842
2719
|
var batchSize, localDatastore, RESTController, batches, deleteCompleted, errors;
|
|
3843
|
-
return
|
|
3844
|
-
while (1) {
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
2720
|
+
return _regenerator.default.wrap(function (_context14) {
|
|
2721
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
2722
|
+
case 0:
|
|
2723
|
+
batchSize = options && options.batchSize ? options.batchSize : _CoreManager.default.get('REQUEST_BATCH_SIZE');
|
|
2724
|
+
localDatastore = _CoreManager.default.getLocalDatastore();
|
|
2725
|
+
RESTController = _CoreManager.default.getRESTController();
|
|
2726
|
+
if (!(0, _isArray.default)(target)) {
|
|
2727
|
+
_context14.next = 15;
|
|
2728
|
+
break;
|
|
2729
|
+
}
|
|
2730
|
+
if (!(target.length < 1)) {
|
|
2731
|
+
_context14.next = 6;
|
|
2732
|
+
break;
|
|
2733
|
+
}
|
|
2734
|
+
return _context14.abrupt("return", _promise.default.resolve([]));
|
|
2735
|
+
case 6:
|
|
2736
|
+
batches = [[]];
|
|
2737
|
+
(0, _forEach.default)(target).call(target, function (obj) {
|
|
2738
|
+
if (!obj.id) {
|
|
2739
|
+
return;
|
|
3859
2740
|
}
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
case 6:
|
|
3864
|
-
batches = [[]];
|
|
3865
|
-
(0, _forEach.default)(target).call(target, function (obj) {
|
|
3866
|
-
if (!obj.id) {
|
|
3867
|
-
return;
|
|
3868
|
-
}
|
|
3869
|
-
|
|
3870
|
-
batches[batches.length - 1].push(obj);
|
|
3871
|
-
|
|
3872
|
-
if (batches[batches.length - 1].length >= batchSize) {
|
|
3873
|
-
batches.push([]);
|
|
3874
|
-
}
|
|
3875
|
-
});
|
|
3876
|
-
|
|
3877
|
-
if (batches[batches.length - 1].length === 0) {
|
|
3878
|
-
// If the last batch is empty, remove it
|
|
3879
|
-
batches.pop();
|
|
2741
|
+
batches[batches.length - 1].push(obj);
|
|
2742
|
+
if (batches[batches.length - 1].length >= batchSize) {
|
|
2743
|
+
batches.push([]);
|
|
3880
2744
|
}
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
2745
|
+
});
|
|
2746
|
+
if (batches[batches.length - 1].length === 0) {
|
|
2747
|
+
// If the last batch is empty, remove it
|
|
2748
|
+
batches.pop();
|
|
2749
|
+
}
|
|
2750
|
+
deleteCompleted = _promise.default.resolve();
|
|
2751
|
+
errors = [];
|
|
2752
|
+
(0, _forEach.default)(batches).call(batches, function (batch) {
|
|
2753
|
+
deleteCompleted = deleteCompleted.then(function () {
|
|
2754
|
+
return RESTController.request('POST', 'batch', {
|
|
2755
|
+
requests: (0, _map.default)(batch).call(batch, function (obj) {
|
|
2756
|
+
return {
|
|
2757
|
+
method: 'DELETE',
|
|
2758
|
+
path: getServerUrlPath() + 'classes/' + obj.className + '/' + obj._getId(),
|
|
2759
|
+
body: {}
|
|
2760
|
+
};
|
|
2761
|
+
})
|
|
2762
|
+
}, options).then(function (results) {
|
|
2763
|
+
for (var i = 0; i < results.length; i++) {
|
|
2764
|
+
if (results[i] && results[i].hasOwnProperty('error')) {
|
|
2765
|
+
var err = new _ParseError.default(results[i].error.code, results[i].error.error);
|
|
2766
|
+
err.object = batch[i];
|
|
2767
|
+
errors.push(err);
|
|
3901
2768
|
}
|
|
3902
|
-
}
|
|
2769
|
+
}
|
|
3903
2770
|
});
|
|
3904
2771
|
});
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
break;
|
|
3915
|
-
}
|
|
3916
|
-
|
|
3917
|
-
aggregate = new _ParseError.default(_ParseError.default.AGGREGATE_ERROR);
|
|
3918
|
-
aggregate.errors = errors;
|
|
3919
|
-
return _context12.abrupt("return", _promise.default.reject(aggregate));
|
|
3920
|
-
|
|
3921
|
-
case 4:
|
|
3922
|
-
_iterator4 = _createForOfIteratorHelper(target);
|
|
3923
|
-
_context12.prev = 5;
|
|
3924
|
-
|
|
3925
|
-
_iterator4.s();
|
|
3926
|
-
|
|
3927
|
-
case 7:
|
|
3928
|
-
if ((_step4 = _iterator4.n()).done) {
|
|
3929
|
-
_context12.next = 13;
|
|
3930
|
-
break;
|
|
3931
|
-
}
|
|
3932
|
-
|
|
3933
|
-
object = _step4.value;
|
|
3934
|
-
_context12.next = 11;
|
|
3935
|
-
return localDatastore._destroyObjectIfPinned(object);
|
|
3936
|
-
|
|
3937
|
-
case 11:
|
|
3938
|
-
_context12.next = 7;
|
|
3939
|
-
break;
|
|
3940
|
-
|
|
3941
|
-
case 13:
|
|
3942
|
-
_context12.next = 18;
|
|
3943
|
-
break;
|
|
3944
|
-
|
|
3945
|
-
case 15:
|
|
3946
|
-
_context12.prev = 15;
|
|
3947
|
-
_context12.t0 = _context12["catch"](5);
|
|
3948
|
-
|
|
3949
|
-
_iterator4.e(_context12.t0);
|
|
3950
|
-
|
|
3951
|
-
case 18:
|
|
3952
|
-
_context12.prev = 18;
|
|
3953
|
-
|
|
3954
|
-
_iterator4.f();
|
|
3955
|
-
|
|
3956
|
-
return _context12.finish(18);
|
|
3957
|
-
|
|
3958
|
-
case 21:
|
|
3959
|
-
return _context12.abrupt("return", _promise.default.resolve(target));
|
|
3960
|
-
|
|
3961
|
-
case 22:
|
|
3962
|
-
case "end":
|
|
3963
|
-
return _context12.stop();
|
|
2772
|
+
});
|
|
2773
|
+
return _context14.abrupt("return", deleteCompleted.then( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
2774
|
+
var aggregate, _iterator3, _step3, object;
|
|
2775
|
+
return _regenerator.default.wrap(function (_context12) {
|
|
2776
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
2777
|
+
case 0:
|
|
2778
|
+
if (!errors.length) {
|
|
2779
|
+
_context12.next = 4;
|
|
2780
|
+
break;
|
|
3964
2781
|
}
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
return _regeneratorRuntime().wrap(function _callee9$(_context13) {
|
|
3977
|
-
while (1) {
|
|
3978
|
-
switch (_context13.prev = _context13.next) {
|
|
3979
|
-
case 0:
|
|
3980
|
-
_context13.next = 2;
|
|
3981
|
-
return localDatastore._destroyObjectIfPinned(target);
|
|
3982
|
-
|
|
3983
|
-
case 2:
|
|
3984
|
-
return _context13.abrupt("return", _promise.default.resolve(target));
|
|
3985
|
-
|
|
3986
|
-
case 3:
|
|
3987
|
-
case "end":
|
|
3988
|
-
return _context13.stop();
|
|
2782
|
+
aggregate = new _ParseError.default(_ParseError.default.AGGREGATE_ERROR);
|
|
2783
|
+
aggregate.errors = errors;
|
|
2784
|
+
return _context12.abrupt("return", _promise.default.reject(aggregate));
|
|
2785
|
+
case 4:
|
|
2786
|
+
_iterator3 = _createForOfIteratorHelper(target);
|
|
2787
|
+
_context12.prev = 5;
|
|
2788
|
+
_iterator3.s();
|
|
2789
|
+
case 7:
|
|
2790
|
+
if ((_step3 = _iterator3.n()).done) {
|
|
2791
|
+
_context12.next = 13;
|
|
2792
|
+
break;
|
|
3989
2793
|
}
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
2794
|
+
object = _step3.value;
|
|
2795
|
+
_context12.next = 11;
|
|
2796
|
+
return localDatastore._destroyObjectIfPinned(object);
|
|
2797
|
+
case 11:
|
|
2798
|
+
_context12.next = 7;
|
|
2799
|
+
break;
|
|
2800
|
+
case 13:
|
|
2801
|
+
_context12.next = 18;
|
|
2802
|
+
break;
|
|
2803
|
+
case 15:
|
|
2804
|
+
_context12.prev = 15;
|
|
2805
|
+
_context12.t0 = _context12["catch"](5);
|
|
2806
|
+
_iterator3.e(_context12.t0);
|
|
2807
|
+
case 18:
|
|
2808
|
+
_context12.prev = 18;
|
|
2809
|
+
_iterator3.f();
|
|
2810
|
+
return _context12.finish(18);
|
|
2811
|
+
case 21:
|
|
2812
|
+
return _context12.abrupt("return", _promise.default.resolve(target));
|
|
2813
|
+
case 22:
|
|
2814
|
+
case "end":
|
|
2815
|
+
return _context12.stop();
|
|
2816
|
+
}
|
|
2817
|
+
}, _callee8, null, [[5, 15, 18, 21]]);
|
|
2818
|
+
}))));
|
|
2819
|
+
case 15:
|
|
2820
|
+
if (!(target instanceof ParseObject)) {
|
|
2821
|
+
_context14.next = 17;
|
|
2822
|
+
break;
|
|
2823
|
+
}
|
|
2824
|
+
return _context14.abrupt("return", RESTController.request('DELETE', 'classes/' + target.className + '/' + target._getId(), {}, options).then( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
2825
|
+
return _regenerator.default.wrap(function (_context13) {
|
|
2826
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
2827
|
+
case 0:
|
|
2828
|
+
_context13.next = 2;
|
|
2829
|
+
return localDatastore._destroyObjectIfPinned(target);
|
|
2830
|
+
case 2:
|
|
2831
|
+
return _context13.abrupt("return", _promise.default.resolve(target));
|
|
2832
|
+
case 3:
|
|
2833
|
+
case "end":
|
|
2834
|
+
return _context13.stop();
|
|
2835
|
+
}
|
|
2836
|
+
}, _callee9);
|
|
2837
|
+
}))));
|
|
2838
|
+
case 17:
|
|
2839
|
+
return _context14.abrupt("return", _promise.default.resolve(target));
|
|
2840
|
+
case 18:
|
|
2841
|
+
case "end":
|
|
2842
|
+
return _context14.stop();
|
|
4001
2843
|
}
|
|
4002
2844
|
}, _callee10);
|
|
4003
2845
|
}))();
|
|
4004
2846
|
},
|
|
4005
|
-
save: function
|
|
4006
|
-
/*: ParseObject | Array<ParseObject | ParseFile>*/
|
|
4007
|
-
, options
|
|
4008
|
-
/*: RequestOptions*/
|
|
4009
|
-
) {
|
|
2847
|
+
save: function (target /*: ParseObject | Array<ParseObject | ParseFile>*/, options /*: RequestOptions*/) {
|
|
4010
2848
|
var batchSize = options && options.batchSize ? options.batchSize : _CoreManager.default.get('REQUEST_BATCH_SIZE');
|
|
4011
|
-
|
|
4012
2849
|
var localDatastore = _CoreManager.default.getLocalDatastore();
|
|
4013
|
-
|
|
4014
2850
|
var mapIdForPin = {};
|
|
4015
|
-
|
|
4016
2851
|
var RESTController = _CoreManager.default.getRESTController();
|
|
4017
|
-
|
|
4018
2852
|
var stateController = _CoreManager.default.getObjectStateController();
|
|
4019
|
-
|
|
4020
2853
|
var allowCustomObjectId = _CoreManager.default.get('ALLOW_CUSTOM_OBJECT_ID');
|
|
4021
|
-
|
|
4022
2854
|
options = options || {};
|
|
4023
2855
|
options.returnStatus = options.returnStatus || true;
|
|
4024
|
-
|
|
4025
2856
|
if ((0, _isArray.default)(target)) {
|
|
4026
2857
|
if (target.length < 1) {
|
|
4027
2858
|
return _promise.default.resolve([]);
|
|
4028
2859
|
}
|
|
4029
|
-
|
|
4030
2860
|
var unsaved = (0, _concat.default)(target).call(target);
|
|
4031
|
-
|
|
4032
2861
|
for (var i = 0; i < target.length; i++) {
|
|
4033
2862
|
if (target[i] instanceof ParseObject) {
|
|
4034
2863
|
unsaved = (0, _concat.default)(unsaved).call(unsaved, (0, _unsavedChildren.default)(target[i], true));
|
|
4035
2864
|
}
|
|
4036
2865
|
}
|
|
4037
|
-
|
|
4038
2866
|
unsaved = (0, _unique.default)(unsaved);
|
|
4039
|
-
var filesSaved
|
|
4040
|
-
/*: Array<
|
|
4041
|
-
= [];
|
|
4042
|
-
var pending
|
|
4043
|
-
/*: Array<ParseObject>*/
|
|
4044
|
-
= [];
|
|
2867
|
+
var filesSaved /*: Array<ParseFile>*/ = [];
|
|
2868
|
+
var pending /*: Array<ParseObject>*/ = [];
|
|
4045
2869
|
(0, _forEach.default)(unsaved).call(unsaved, function (el) {
|
|
4046
2870
|
if (el instanceof _ParseFile.default) {
|
|
4047
2871
|
filesSaved.push(el.save(options));
|
|
@@ -4060,7 +2884,6 @@ var DefaultController = {
|
|
|
4060
2884
|
if (allowCustomObjectId && Object.prototype.hasOwnProperty.call(el, 'id') && !el.id) {
|
|
4061
2885
|
throw new _ParseError.default(_ParseError.default.MISSING_OBJECT_ID, 'objectId must not be empty or null');
|
|
4062
2886
|
}
|
|
4063
|
-
|
|
4064
2887
|
if (batch.length < batchSize && (0, _canBeSerialized.default)(el)) {
|
|
4065
2888
|
batch.push(el);
|
|
4066
2889
|
} else {
|
|
@@ -4068,20 +2891,18 @@ var DefaultController = {
|
|
|
4068
2891
|
}
|
|
4069
2892
|
});
|
|
4070
2893
|
pending = nextPending;
|
|
4071
|
-
|
|
4072
2894
|
if (batch.length < 1) {
|
|
4073
2895
|
return _promise.default.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Tried to save a batch with a cycle.'));
|
|
4074
|
-
}
|
|
4075
|
-
// When every task is ready, the API request will execute
|
|
4076
|
-
|
|
2896
|
+
}
|
|
4077
2897
|
|
|
2898
|
+
// Queue up tasks for each object in the batch.
|
|
2899
|
+
// When every task is ready, the API request will execute
|
|
4078
2900
|
var batchReturned = new _promiseUtils.resolvingPromise();
|
|
4079
2901
|
var batchReady = [];
|
|
4080
2902
|
var batchTasks = [];
|
|
4081
2903
|
(0, _forEach.default)(batch).call(batch, function (obj, index) {
|
|
4082
2904
|
var ready = new _promiseUtils.resolvingPromise();
|
|
4083
2905
|
batchReady.push(ready);
|
|
4084
|
-
|
|
4085
2906
|
var task = function task() {
|
|
4086
2907
|
ready.resolve();
|
|
4087
2908
|
return batchReturned.then(function (responses) {
|
|
@@ -4090,21 +2911,18 @@ var DefaultController = {
|
|
|
4090
2911
|
var status = responses[index]._status;
|
|
4091
2912
|
delete responses[index]._status;
|
|
4092
2913
|
mapIdForPin[objectId] = obj._localId;
|
|
4093
|
-
|
|
4094
2914
|
obj._handleSaveResponse(responses[index].success, status);
|
|
4095
2915
|
} else {
|
|
4096
2916
|
if (!objectError && responses[index].hasOwnProperty('error')) {
|
|
4097
2917
|
var serverError = responses[index].error;
|
|
4098
|
-
objectError = new _ParseError.default(serverError.code, serverError.error);
|
|
4099
|
-
|
|
2918
|
+
objectError = new _ParseError.default(serverError.code, serverError.error);
|
|
2919
|
+
// Cancel the rest of the save
|
|
4100
2920
|
pending = [];
|
|
4101
2921
|
}
|
|
4102
|
-
|
|
4103
2922
|
obj._handleSaveError();
|
|
4104
2923
|
}
|
|
4105
2924
|
});
|
|
4106
2925
|
};
|
|
4107
|
-
|
|
4108
2926
|
stateController.pushPendingState(obj._getStateIdentifier());
|
|
4109
2927
|
batchTasks.push(stateController.enqueueTask(obj._getStateIdentifier(), task));
|
|
4110
2928
|
});
|
|
@@ -4113,7 +2931,6 @@ var DefaultController = {
|
|
|
4113
2931
|
return RESTController.request('POST', 'batch', {
|
|
4114
2932
|
requests: (0, _map.default)(batch).call(batch, function (obj) {
|
|
4115
2933
|
var params = obj._getSaveParams();
|
|
4116
|
-
|
|
4117
2934
|
params.path = getServerUrlPath() + params.path;
|
|
4118
2935
|
return params;
|
|
4119
2936
|
})
|
|
@@ -4122,131 +2939,102 @@ var DefaultController = {
|
|
|
4122
2939
|
batchReturned.reject(new _ParseError.default(_ParseError.default.INCORRECT_TYPE, error.message));
|
|
4123
2940
|
});
|
|
4124
2941
|
return (0, _promiseUtils.when)(batchTasks);
|
|
4125
|
-
}).then( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
4126
|
-
var
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
if (!objectError) {
|
|
4133
|
-
_context15.next = 2;
|
|
4134
|
-
break;
|
|
4135
|
-
}
|
|
4136
|
-
|
|
4137
|
-
return _context15.abrupt("return", _promise.default.reject(objectError));
|
|
4138
|
-
|
|
4139
|
-
case 2:
|
|
4140
|
-
_iterator5 = _createForOfIteratorHelper(target);
|
|
4141
|
-
_context15.prev = 3;
|
|
4142
|
-
|
|
4143
|
-
_iterator5.s();
|
|
4144
|
-
|
|
4145
|
-
case 5:
|
|
4146
|
-
if ((_step5 = _iterator5.n()).done) {
|
|
4147
|
-
_context15.next = 13;
|
|
4148
|
-
break;
|
|
4149
|
-
}
|
|
4150
|
-
|
|
4151
|
-
object = _step5.value;
|
|
4152
|
-
_context15.next = 9;
|
|
4153
|
-
return localDatastore._updateLocalIdForObject(mapIdForPin[object.id], object);
|
|
4154
|
-
|
|
4155
|
-
case 9:
|
|
4156
|
-
_context15.next = 11;
|
|
4157
|
-
return localDatastore._updateObjectIfPinned(object);
|
|
4158
|
-
|
|
4159
|
-
case 11:
|
|
4160
|
-
_context15.next = 5;
|
|
2942
|
+
}).then( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
2943
|
+
var _iterator4, _step4, object;
|
|
2944
|
+
return _regenerator.default.wrap(function _callee11$(_context15) {
|
|
2945
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
2946
|
+
case 0:
|
|
2947
|
+
if (!objectError) {
|
|
2948
|
+
_context15.next = 2;
|
|
4161
2949
|
break;
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
2950
|
+
}
|
|
2951
|
+
return _context15.abrupt("return", _promise.default.reject(objectError));
|
|
2952
|
+
case 2:
|
|
2953
|
+
_iterator4 = _createForOfIteratorHelper(target);
|
|
2954
|
+
_context15.prev = 3;
|
|
2955
|
+
_iterator4.s();
|
|
2956
|
+
case 5:
|
|
2957
|
+
if ((_step4 = _iterator4.n()).done) {
|
|
2958
|
+
_context15.next = 14;
|
|
4165
2959
|
break;
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
_context15.
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
2960
|
+
}
|
|
2961
|
+
object = _step4.value;
|
|
2962
|
+
if (!(object instanceof ParseObject)) {
|
|
2963
|
+
_context15.next = 12;
|
|
2964
|
+
break;
|
|
2965
|
+
}
|
|
2966
|
+
_context15.next = 10;
|
|
2967
|
+
return localDatastore._updateLocalIdForObject(mapIdForPin[object.id], object);
|
|
2968
|
+
case 10:
|
|
2969
|
+
_context15.next = 12;
|
|
2970
|
+
return localDatastore._updateObjectIfPinned(object);
|
|
2971
|
+
case 12:
|
|
2972
|
+
_context15.next = 5;
|
|
2973
|
+
break;
|
|
2974
|
+
case 14:
|
|
2975
|
+
_context15.next = 19;
|
|
2976
|
+
break;
|
|
2977
|
+
case 16:
|
|
2978
|
+
_context15.prev = 16;
|
|
2979
|
+
_context15.t0 = _context15["catch"](3);
|
|
2980
|
+
_iterator4.e(_context15.t0);
|
|
2981
|
+
case 19:
|
|
2982
|
+
_context15.prev = 19;
|
|
2983
|
+
_iterator4.f();
|
|
2984
|
+
return _context15.finish(19);
|
|
2985
|
+
case 22:
|
|
2986
|
+
return _context15.abrupt("return", _promise.default.resolve(target));
|
|
2987
|
+
case 23:
|
|
2988
|
+
case "end":
|
|
2989
|
+
return _context15.stop();
|
|
4187
2990
|
}
|
|
4188
|
-
}, _callee11, null, [[3,
|
|
2991
|
+
}, _callee11, null, [[3, 16, 19, 22]]);
|
|
4189
2992
|
})));
|
|
4190
2993
|
});
|
|
4191
2994
|
} else if (target instanceof ParseObject) {
|
|
4192
2995
|
if (allowCustomObjectId && Object.prototype.hasOwnProperty.call(target, 'id') && !target.id) {
|
|
4193
2996
|
throw new _ParseError.default(_ParseError.default.MISSING_OBJECT_ID, 'objectId must not be empty or null');
|
|
4194
|
-
}
|
|
4195
|
-
|
|
4196
|
-
|
|
2997
|
+
}
|
|
2998
|
+
// generate _localId in case if cascadeSave=false
|
|
4197
2999
|
target._getId();
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
3000
|
+
var localId = target._localId;
|
|
3001
|
+
// copying target lets Flow guarantee the pointer isn't modified elsewhere
|
|
4201
3002
|
var targetCopy = target;
|
|
4202
|
-
|
|
4203
3003
|
var task = function task() {
|
|
4204
3004
|
var params = targetCopy._getSaveParams();
|
|
4205
|
-
|
|
4206
3005
|
return RESTController.request(params.method, params.path, params.body, options).then(function (response) {
|
|
4207
3006
|
var status = response._status;
|
|
4208
3007
|
delete response._status;
|
|
4209
|
-
|
|
4210
3008
|
targetCopy._handleSaveResponse(response, status);
|
|
4211
3009
|
}, function (error) {
|
|
4212
3010
|
targetCopy._handleSaveError();
|
|
4213
|
-
|
|
4214
3011
|
return _promise.default.reject(error);
|
|
4215
3012
|
});
|
|
4216
3013
|
};
|
|
4217
|
-
|
|
4218
3014
|
stateController.pushPendingState(target._getStateIdentifier());
|
|
4219
|
-
return stateController.enqueueTask(target._getStateIdentifier(), task).then( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
4220
|
-
return
|
|
4221
|
-
while (1) {
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
case 5:
|
|
4235
|
-
case "end":
|
|
4236
|
-
return _context16.stop();
|
|
4237
|
-
}
|
|
3015
|
+
return stateController.enqueueTask(target._getStateIdentifier(), task).then( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
3016
|
+
return _regenerator.default.wrap(function _callee12$(_context16) {
|
|
3017
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
3018
|
+
case 0:
|
|
3019
|
+
_context16.next = 2;
|
|
3020
|
+
return localDatastore._updateLocalIdForObject(localId, target);
|
|
3021
|
+
case 2:
|
|
3022
|
+
_context16.next = 4;
|
|
3023
|
+
return localDatastore._updateObjectIfPinned(target);
|
|
3024
|
+
case 4:
|
|
3025
|
+
return _context16.abrupt("return", target);
|
|
3026
|
+
case 5:
|
|
3027
|
+
case "end":
|
|
3028
|
+
return _context16.stop();
|
|
4238
3029
|
}
|
|
4239
3030
|
}, _callee12);
|
|
4240
3031
|
})), function (error) {
|
|
4241
3032
|
return _promise.default.reject(error);
|
|
4242
3033
|
});
|
|
4243
3034
|
}
|
|
4244
|
-
|
|
4245
3035
|
return _promise.default.resolve();
|
|
4246
3036
|
}
|
|
4247
3037
|
};
|
|
4248
|
-
|
|
4249
3038
|
_CoreManager.default.setObjectController(DefaultController);
|
|
4250
|
-
|
|
4251
3039
|
var _default = ParseObject;
|
|
4252
3040
|
exports.default = _default;
|