parse 5.1.0 → 5.2.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/parse.js +1556 -1309
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +1560 -1313
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/Cloud.js +7 -11
- package/lib/browser/CoreManager.js +10 -10
- package/lib/browser/EventuallyQueue.js +1 -1
- package/lib/browser/InstallationController.js +3 -3
- package/lib/browser/LiveQueryClient.js +102 -60
- package/lib/browser/LocalDatastore.js +189 -147
- package/lib/browser/LocalDatastoreController.default.js +14 -9
- package/lib/browser/LocalDatastoreController.react-native.js +14 -12
- package/lib/browser/LocalDatastoreUtils.js +0 -5
- package/lib/browser/ObjectStateMutations.js +57 -21
- package/lib/browser/Parse.js +2 -2
- package/lib/browser/ParseCLP.js +9 -17
- package/lib/browser/ParseFile.js +27 -31
- package/lib/browser/ParseGeoPoint.js +9 -3
- package/lib/browser/ParseHooks.js +13 -13
- package/lib/browser/ParseInstallation.js +117 -9
- package/lib/browser/ParseObject.js +19 -17
- package/lib/browser/ParseOp.js +17 -17
- package/lib/browser/ParsePolygon.js +1 -1
- package/lib/browser/ParseQuery.js +147 -149
- package/lib/browser/ParseRole.js +5 -9
- package/lib/browser/ParseSchema.js +1 -1
- package/lib/browser/ParseUser.js +66 -51
- package/lib/browser/Push.js +5 -10
- package/lib/browser/RESTController.js +1 -1
- package/lib/browser/SingleInstanceStateController.js +1 -1
- package/lib/browser/TaskQueue.js +10 -10
- package/lib/browser/UniqueInstanceStateController.js +1 -1
- package/lib/browser/arrayContainsObject.js +0 -4
- package/lib/browser/canBeSerialized.js +0 -4
- package/lib/browser/decode.js +0 -7
- package/lib/browser/encode.js +3 -7
- package/lib/browser/equals.js +1 -1
- package/lib/browser/escape.js +0 -4
- package/lib/browser/isRevocableSession.js +0 -4
- package/lib/browser/parseDate.js +1 -5
- package/lib/browser/promiseUtils.js +11 -10
- package/lib/browser/unique.js +1 -5
- package/lib/browser/unsavedChildren.js +0 -8
- package/lib/browser/uuid.js +2 -2
- package/lib/node/Cloud.js +7 -11
- package/lib/node/CoreManager.js +10 -10
- package/lib/node/EventuallyQueue.js +1 -1
- package/lib/node/InstallationController.js +3 -3
- package/lib/node/LiveQueryClient.js +14 -24
- package/lib/node/LocalDatastore.js +7 -11
- package/lib/node/LocalDatastoreController.default.js +12 -10
- package/lib/node/LocalDatastoreController.react-native.js +13 -12
- package/lib/node/LocalDatastoreUtils.js +0 -5
- package/lib/node/ObjectStateMutations.js +45 -19
- package/lib/node/Parse.js +2 -2
- package/lib/node/ParseCLP.js +8 -18
- package/lib/node/ParseFile.js +27 -40
- package/lib/node/ParseGeoPoint.js +9 -3
- package/lib/node/ParseHooks.js +13 -13
- package/lib/node/ParseInstallation.js +60 -2
- package/lib/node/ParseObject.js +19 -17
- package/lib/node/ParseOp.js +21 -21
- package/lib/node/ParsePolygon.js +1 -1
- package/lib/node/ParseQuery.js +84 -107
- package/lib/node/ParseRole.js +3 -8
- package/lib/node/ParseSchema.js +4 -4
- package/lib/node/ParseUser.js +42 -37
- package/lib/node/Push.js +3 -8
- package/lib/node/RESTController.js +1 -1
- package/lib/node/SingleInstanceStateController.js +1 -1
- package/lib/node/TaskQueue.js +9 -11
- package/lib/node/UniqueInstanceStateController.js +1 -1
- package/lib/node/arrayContainsObject.js +0 -4
- package/lib/node/canBeSerialized.js +0 -4
- package/lib/node/decode.js +0 -7
- package/lib/node/encode.js +3 -7
- package/lib/node/equals.js +1 -1
- package/lib/node/escape.js +0 -4
- package/lib/node/isRevocableSession.js +0 -4
- package/lib/node/parseDate.js +1 -5
- package/lib/node/promiseUtils.js +11 -10
- package/lib/node/unique.js +1 -5
- package/lib/node/unsavedChildren.js +0 -8
- package/lib/node/uuid.js +2 -2
- package/lib/react-native/Cloud.js +0 -1
- package/lib/react-native/CoreManager.js +1 -1
- package/lib/react-native/LiveQueryClient.js +49 -32
- package/lib/react-native/LocalDatastore.js +38 -14
- package/lib/react-native/LocalDatastoreController.default.js +7 -1
- package/lib/react-native/LocalDatastoreController.react-native.js +7 -1
- package/lib/react-native/ObjectStateMutations.js +30 -9
- package/lib/react-native/ParseCLP.js +3 -3
- package/lib/react-native/ParseFile.js +7 -6
- package/lib/react-native/ParseInstallation.js +51 -3
- package/lib/react-native/ParseObject.js +6 -5
- package/lib/react-native/ParseQuery.js +45 -37
- package/lib/react-native/ParseRole.js +1 -1
- package/lib/react-native/ParseUser.js +22 -16
- package/lib/react-native/TaskQueue.js +8 -2
- package/lib/react-native/decode.js +0 -1
- package/lib/react-native/promiseUtils.js +5 -4
- package/lib/react-native/uuid.js +1 -2
- package/lib/weapp/Cloud.js +7 -11
- package/lib/weapp/CoreManager.js +10 -10
- package/lib/weapp/EventuallyQueue.js +1 -1
- package/lib/weapp/InstallationController.js +3 -3
- package/lib/weapp/LiveQueryClient.js +102 -60
- package/lib/weapp/LocalDatastore.js +189 -147
- package/lib/weapp/LocalDatastoreController.default.js +14 -9
- package/lib/weapp/LocalDatastoreController.react-native.js +14 -12
- package/lib/weapp/LocalDatastoreUtils.js +0 -5
- package/lib/weapp/ObjectStateMutations.js +57 -21
- package/lib/weapp/Parse.js +2 -2
- package/lib/weapp/ParseCLP.js +9 -17
- package/lib/weapp/ParseFile.js +27 -31
- package/lib/weapp/ParseGeoPoint.js +9 -3
- package/lib/weapp/ParseHooks.js +13 -13
- package/lib/weapp/ParseInstallation.js +117 -9
- package/lib/weapp/ParseObject.js +19 -17
- package/lib/weapp/ParseOp.js +17 -17
- package/lib/weapp/ParsePolygon.js +1 -1
- package/lib/weapp/ParseQuery.js +147 -149
- package/lib/weapp/ParseRole.js +5 -9
- package/lib/weapp/ParseSchema.js +1 -1
- package/lib/weapp/ParseUser.js +66 -51
- package/lib/weapp/Push.js +5 -10
- package/lib/weapp/RESTController.js +1 -1
- package/lib/weapp/SingleInstanceStateController.js +1 -1
- package/lib/weapp/TaskQueue.js +10 -10
- package/lib/weapp/UniqueInstanceStateController.js +1 -1
- package/lib/weapp/arrayContainsObject.js +0 -4
- package/lib/weapp/canBeSerialized.js +0 -4
- package/lib/weapp/decode.js +0 -7
- package/lib/weapp/encode.js +3 -7
- package/lib/weapp/equals.js +1 -1
- package/lib/weapp/escape.js +0 -4
- package/lib/weapp/isRevocableSession.js +0 -4
- package/lib/weapp/parseDate.js +1 -5
- package/lib/weapp/promiseUtils.js +11 -10
- package/lib/weapp/unique.js +1 -5
- package/lib/weapp/unsavedChildren.js +0 -8
- package/lib/weapp/uuid.js +3 -3
- package/package.json +5 -6
package/lib/weapp/ParseHooks.js
CHANGED
|
@@ -30,60 +30,60 @@ function getFunctions() {
|
|
|
30
30
|
function getTriggers() {
|
|
31
31
|
return _CoreManager.default.getHooksController().get('triggers');
|
|
32
32
|
}
|
|
33
|
-
function getFunction(name) {
|
|
33
|
+
function getFunction(name /*: string*/) {
|
|
34
34
|
return _CoreManager.default.getHooksController().get('functions', name);
|
|
35
35
|
}
|
|
36
|
-
function getTrigger(className
|
|
36
|
+
function getTrigger(className /*: string*/, triggerName /*: string*/) {
|
|
37
37
|
return _CoreManager.default.getHooksController().get('triggers', className, triggerName);
|
|
38
38
|
}
|
|
39
|
-
function createFunction(functionName
|
|
39
|
+
function createFunction(functionName /*: string*/, url /*: string*/) {
|
|
40
40
|
return create({
|
|
41
41
|
functionName: functionName,
|
|
42
42
|
url: url
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
-
function createTrigger(className
|
|
45
|
+
function createTrigger(className /*: string*/, triggerName /*: string*/, url /*: string*/) {
|
|
46
46
|
return create({
|
|
47
47
|
className: className,
|
|
48
48
|
triggerName: triggerName,
|
|
49
49
|
url: url
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
function create(hook) {
|
|
52
|
+
function create(hook /*: HookDeclaration*/) {
|
|
53
53
|
return _CoreManager.default.getHooksController().create(hook);
|
|
54
54
|
}
|
|
55
|
-
function updateFunction(functionName
|
|
55
|
+
function updateFunction(functionName /*: string*/, url /*: string*/) {
|
|
56
56
|
return update({
|
|
57
57
|
functionName: functionName,
|
|
58
58
|
url: url
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
|
-
function updateTrigger(className
|
|
61
|
+
function updateTrigger(className /*: string*/, triggerName /*: string*/, url /*: string*/) {
|
|
62
62
|
return update({
|
|
63
63
|
className: className,
|
|
64
64
|
triggerName: triggerName,
|
|
65
65
|
url: url
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
function update(hook) {
|
|
68
|
+
function update(hook /*: HookDeclaration*/) {
|
|
69
69
|
return _CoreManager.default.getHooksController().update(hook);
|
|
70
70
|
}
|
|
71
|
-
function removeFunction(functionName) {
|
|
71
|
+
function removeFunction(functionName /*: string*/) {
|
|
72
72
|
return remove({
|
|
73
73
|
functionName: functionName
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
-
function removeTrigger(className
|
|
76
|
+
function removeTrigger(className /*: string*/, triggerName /*: string*/) {
|
|
77
77
|
return remove({
|
|
78
78
|
className: className,
|
|
79
79
|
triggerName: triggerName
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
|
-
function remove(hook) {
|
|
82
|
+
function remove(hook /*: HookDeleteArg*/) {
|
|
83
83
|
return _CoreManager.default.getHooksController().remove(hook);
|
|
84
84
|
}
|
|
85
85
|
var DefaultController = {
|
|
86
|
-
get: function (type
|
|
86
|
+
get: function (type /*: string*/, functionName /*:: ?: string*/, triggerName /*:: ?: string*/) {
|
|
87
87
|
var url = '/hooks/' + type;
|
|
88
88
|
if (functionName) {
|
|
89
89
|
url += '/' + functionName;
|
|
@@ -143,7 +143,7 @@ var DefaultController = {
|
|
|
143
143
|
}
|
|
144
144
|
return this.sendRequest('PUT', url, hook);
|
|
145
145
|
},
|
|
146
|
-
sendRequest: function (method
|
|
146
|
+
sendRequest: function (method /*: string*/, url /*: string*/, body /*:: ?: any*/) {
|
|
147
147
|
return _CoreManager.default.getRESTController().request(method, url, body, {
|
|
148
148
|
useMasterKey: true
|
|
149
149
|
}).then(function (res) {
|
|
@@ -7,7 +7,9 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
9
|
exports.default = void 0;
|
|
10
|
+
var _entries = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/entries"));
|
|
10
11
|
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs3/regenerator"));
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
|
11
13
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
|
|
12
14
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
|
|
13
15
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
@@ -17,6 +19,7 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/
|
|
|
17
19
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
|
|
18
20
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
|
|
19
21
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
22
|
+
var _ParseError = _interopRequireDefault(require("./ParseError"));
|
|
20
23
|
var _ParseObject2 = _interopRequireDefault(require("./ParseObject"));
|
|
21
24
|
function _createSuper(Derived) {
|
|
22
25
|
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
@@ -86,6 +89,7 @@ var ParseInstallation = /*#__PURE__*/function (_ParseObject) {
|
|
|
86
89
|
*
|
|
87
90
|
* @property {string} appIdentifier
|
|
88
91
|
* @static
|
|
92
|
+
* @returns {string}
|
|
89
93
|
*/
|
|
90
94
|
(0, _createClass2.default)(ParseInstallation, [{
|
|
91
95
|
key: "appIdentifier",
|
|
@@ -98,6 +102,7 @@ var ParseInstallation = /*#__PURE__*/function (_ParseObject) {
|
|
|
98
102
|
*
|
|
99
103
|
* @property {string} appVersion
|
|
100
104
|
* @static
|
|
105
|
+
* @returns {string}
|
|
101
106
|
*/
|
|
102
107
|
}, {
|
|
103
108
|
key: "appVersion",
|
|
@@ -110,6 +115,7 @@ var ParseInstallation = /*#__PURE__*/function (_ParseObject) {
|
|
|
110
115
|
*
|
|
111
116
|
* @property {string} appName
|
|
112
117
|
* @static
|
|
118
|
+
* @returns {string}
|
|
113
119
|
*/
|
|
114
120
|
}, {
|
|
115
121
|
key: "appName",
|
|
@@ -124,6 +130,7 @@ var ParseInstallation = /*#__PURE__*/function (_ParseObject) {
|
|
|
124
130
|
*
|
|
125
131
|
* @property {number} badge
|
|
126
132
|
* @static
|
|
133
|
+
* @returns {number}
|
|
127
134
|
*/
|
|
128
135
|
}, {
|
|
129
136
|
key: "badge",
|
|
@@ -136,6 +143,7 @@ var ParseInstallation = /*#__PURE__*/function (_ParseObject) {
|
|
|
136
143
|
*
|
|
137
144
|
* @property {string[]} channels
|
|
138
145
|
* @static
|
|
146
|
+
* @returns {string[]}
|
|
139
147
|
*/
|
|
140
148
|
}, {
|
|
141
149
|
key: "channels",
|
|
@@ -148,6 +156,7 @@ var ParseInstallation = /*#__PURE__*/function (_ParseObject) {
|
|
|
148
156
|
*
|
|
149
157
|
* @property {string} deviceToken
|
|
150
158
|
* @static
|
|
159
|
+
* @returns {string}
|
|
151
160
|
*/
|
|
152
161
|
}, {
|
|
153
162
|
key: "deviceToken",
|
|
@@ -160,6 +169,7 @@ var ParseInstallation = /*#__PURE__*/function (_ParseObject) {
|
|
|
160
169
|
*
|
|
161
170
|
* @property {string} deviceType
|
|
162
171
|
* @static
|
|
172
|
+
* @returns {string}
|
|
163
173
|
*/
|
|
164
174
|
}, {
|
|
165
175
|
key: "deviceType",
|
|
@@ -172,6 +182,7 @@ var ParseInstallation = /*#__PURE__*/function (_ParseObject) {
|
|
|
172
182
|
*
|
|
173
183
|
* @property {string} GCMSenderId
|
|
174
184
|
* @static
|
|
185
|
+
* @returns {string}
|
|
175
186
|
*/
|
|
176
187
|
}, {
|
|
177
188
|
key: "GCMSenderId",
|
|
@@ -184,6 +195,7 @@ var ParseInstallation = /*#__PURE__*/function (_ParseObject) {
|
|
|
184
195
|
*
|
|
185
196
|
* @property {string} installationId
|
|
186
197
|
* @static
|
|
198
|
+
* @returns {string}
|
|
187
199
|
*/
|
|
188
200
|
}, {
|
|
189
201
|
key: "installationId",
|
|
@@ -196,6 +208,7 @@ var ParseInstallation = /*#__PURE__*/function (_ParseObject) {
|
|
|
196
208
|
*
|
|
197
209
|
* @property {string} localeIdentifier
|
|
198
210
|
* @static
|
|
211
|
+
* @returns {string}
|
|
199
212
|
*/
|
|
200
213
|
}, {
|
|
201
214
|
key: "localeIdentifier",
|
|
@@ -208,6 +221,7 @@ var ParseInstallation = /*#__PURE__*/function (_ParseObject) {
|
|
|
208
221
|
*
|
|
209
222
|
* @property {string} parseVersion
|
|
210
223
|
* @static
|
|
224
|
+
* @returns {string}
|
|
211
225
|
*/
|
|
212
226
|
}, {
|
|
213
227
|
key: "parseVersion",
|
|
@@ -220,6 +234,7 @@ var ParseInstallation = /*#__PURE__*/function (_ParseObject) {
|
|
|
220
234
|
*
|
|
221
235
|
* @property {string} pushType
|
|
222
236
|
* @static
|
|
237
|
+
* @returns {string}
|
|
223
238
|
*/
|
|
224
239
|
}, {
|
|
225
240
|
key: "pushType",
|
|
@@ -232,6 +247,7 @@ var ParseInstallation = /*#__PURE__*/function (_ParseObject) {
|
|
|
232
247
|
*
|
|
233
248
|
* @property {string} timeZone
|
|
234
249
|
* @static
|
|
250
|
+
* @returns {string}
|
|
235
251
|
*/
|
|
236
252
|
}, {
|
|
237
253
|
key: "timeZone",
|
|
@@ -253,18 +269,20 @@ var ParseInstallation = /*#__PURE__*/function (_ParseObject) {
|
|
|
253
269
|
*
|
|
254
270
|
* @property {object} DEVICE_TYPES
|
|
255
271
|
* @static
|
|
272
|
+
* @returns {object}
|
|
256
273
|
*/
|
|
257
274
|
}, {
|
|
258
|
-
key: "
|
|
275
|
+
key: "fetch",
|
|
259
276
|
value:
|
|
260
277
|
/**
|
|
261
|
-
* Wrap the default
|
|
278
|
+
* Wrap the default fetch behavior with functionality to update local storage.
|
|
279
|
+
* If the installation is deleted on the server, retry the fetch as a save operation.
|
|
262
280
|
*
|
|
263
281
|
* @param {...any} args
|
|
264
282
|
* @returns {Promise}
|
|
265
283
|
*/
|
|
266
284
|
function () {
|
|
267
|
-
var
|
|
285
|
+
var _fetch = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
268
286
|
var _len,
|
|
269
287
|
args,
|
|
270
288
|
_key,
|
|
@@ -275,24 +293,114 @@ var ParseInstallation = /*#__PURE__*/function (_ParseObject) {
|
|
|
275
293
|
for (_len = _args.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
276
294
|
args[_key] = _args[_key];
|
|
277
295
|
}
|
|
278
|
-
_context.
|
|
296
|
+
_context.prev = 1;
|
|
297
|
+
_context.next = 4;
|
|
298
|
+
return (0, _get2.default)((0, _getPrototypeOf2.default)(ParseInstallation.prototype), "fetch", this).apply(this, args);
|
|
299
|
+
case 4:
|
|
300
|
+
_context.next = 15;
|
|
301
|
+
break;
|
|
302
|
+
case 6:
|
|
303
|
+
_context.prev = 6;
|
|
304
|
+
_context.t0 = _context["catch"](1);
|
|
305
|
+
if (!(_context.t0.code !== _ParseError.default.OBJECT_NOT_FOUND)) {
|
|
306
|
+
_context.next = 10;
|
|
307
|
+
break;
|
|
308
|
+
}
|
|
309
|
+
throw _context.t0;
|
|
310
|
+
case 10:
|
|
311
|
+
// The installation was deleted from the server.
|
|
312
|
+
// We always want fetch to succeed.
|
|
313
|
+
delete this.id;
|
|
314
|
+
this._getId(); // Generate localId
|
|
315
|
+
this._markAllFieldsDirty();
|
|
316
|
+
_context.next = 15;
|
|
279
317
|
return (0, _get2.default)((0, _getPrototypeOf2.default)(ParseInstallation.prototype), "save", this).apply(this, args);
|
|
280
|
-
case
|
|
281
|
-
_context.next =
|
|
318
|
+
case 15:
|
|
319
|
+
_context.next = 17;
|
|
282
320
|
return _CoreManager.default.getInstallationController().updateInstallationOnDisk(this);
|
|
283
|
-
case
|
|
321
|
+
case 17:
|
|
284
322
|
return _context.abrupt("return", this);
|
|
285
|
-
case
|
|
323
|
+
case 18:
|
|
286
324
|
case "end":
|
|
287
325
|
return _context.stop();
|
|
288
326
|
}
|
|
289
|
-
}, _callee, this);
|
|
327
|
+
}, _callee, this, [[1, 6]]);
|
|
328
|
+
}));
|
|
329
|
+
function fetch() {
|
|
330
|
+
return _fetch.apply(this, arguments);
|
|
331
|
+
}
|
|
332
|
+
return fetch;
|
|
333
|
+
}()
|
|
334
|
+
/**
|
|
335
|
+
* Wrap the default save behavior with functionality to update the local storage.
|
|
336
|
+
* If the installation is deleted on the server, retry saving a new installation.
|
|
337
|
+
*
|
|
338
|
+
* @param {...any} args
|
|
339
|
+
* @returns {Promise}
|
|
340
|
+
*/
|
|
341
|
+
}, {
|
|
342
|
+
key: "save",
|
|
343
|
+
value: function () {
|
|
344
|
+
var _save = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
345
|
+
var _len2,
|
|
346
|
+
args,
|
|
347
|
+
_key2,
|
|
348
|
+
_args2 = arguments;
|
|
349
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
350
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
351
|
+
case 0:
|
|
352
|
+
for (_len2 = _args2.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
353
|
+
args[_key2] = _args2[_key2];
|
|
354
|
+
}
|
|
355
|
+
_context2.prev = 1;
|
|
356
|
+
_context2.next = 4;
|
|
357
|
+
return (0, _get2.default)((0, _getPrototypeOf2.default)(ParseInstallation.prototype), "save", this).apply(this, args);
|
|
358
|
+
case 4:
|
|
359
|
+
_context2.next = 15;
|
|
360
|
+
break;
|
|
361
|
+
case 6:
|
|
362
|
+
_context2.prev = 6;
|
|
363
|
+
_context2.t0 = _context2["catch"](1);
|
|
364
|
+
if (!(_context2.t0.code !== _ParseError.default.OBJECT_NOT_FOUND)) {
|
|
365
|
+
_context2.next = 10;
|
|
366
|
+
break;
|
|
367
|
+
}
|
|
368
|
+
throw _context2.t0;
|
|
369
|
+
case 10:
|
|
370
|
+
// The installation was deleted from the server.
|
|
371
|
+
// We always want save to succeed.
|
|
372
|
+
delete this.id;
|
|
373
|
+
this._getId(); // Generate localId
|
|
374
|
+
this._markAllFieldsDirty();
|
|
375
|
+
_context2.next = 15;
|
|
376
|
+
return (0, _get2.default)((0, _getPrototypeOf2.default)(ParseInstallation.prototype), "save", this).apply(this, args);
|
|
377
|
+
case 15:
|
|
378
|
+
_context2.next = 17;
|
|
379
|
+
return _CoreManager.default.getInstallationController().updateInstallationOnDisk(this);
|
|
380
|
+
case 17:
|
|
381
|
+
return _context2.abrupt("return", this);
|
|
382
|
+
case 18:
|
|
383
|
+
case "end":
|
|
384
|
+
return _context2.stop();
|
|
385
|
+
}
|
|
386
|
+
}, _callee2, this, [[1, 6]]);
|
|
290
387
|
}));
|
|
291
388
|
function save() {
|
|
292
389
|
return _save.apply(this, arguments);
|
|
293
390
|
}
|
|
294
391
|
return save;
|
|
295
392
|
}()
|
|
393
|
+
}, {
|
|
394
|
+
key: "_markAllFieldsDirty",
|
|
395
|
+
value: function () {
|
|
396
|
+
for (var _i = 0, _Object$entries = (0, _entries.default)(this.attributes); _i < _Object$entries.length; _i++) {
|
|
397
|
+
var _Object$entries$_i = (0, _slicedToArray2.default)(_Object$entries[_i], 2),
|
|
398
|
+
key = _Object$entries$_i[0],
|
|
399
|
+
value = _Object$entries$_i[1];
|
|
400
|
+
this.set(key, value);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
296
404
|
/**
|
|
297
405
|
* Get the current Parse.Installation from disk. If doesn't exists, create an new installation.
|
|
298
406
|
*
|
package/lib/weapp/ParseObject.js
CHANGED
|
@@ -242,6 +242,7 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
242
242
|
* @param {string} className The class name for the object
|
|
243
243
|
* @param {object} attributes The initial set of data to store in the object.
|
|
244
244
|
* @param {object} options The options for this object instance.
|
|
245
|
+
* @param {boolean} [options.ignoreValidation=false] Set to `true` ignore any attribute validation errors.
|
|
245
246
|
*/
|
|
246
247
|
function ParseObject(className /*:: ?: string | { className: string, [attr: string]: any }*/, attributes /*:: ?: { [attr: string]: any }*/, options /*:: ?: { ignoreValidation: boolean }*/) {
|
|
247
248
|
(0, _classCallCheck2.default)(this, ParseObject);
|
|
@@ -1426,7 +1427,7 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
1426
1427
|
*/
|
|
1427
1428
|
}, {
|
|
1428
1429
|
key: "fetchWithInclude",
|
|
1429
|
-
value: function (keys /*:
|
|
1430
|
+
value: function (keys /*: string | Array<string | Array<string>>*/, options /*: RequestOptions*/) /*: Promise<any>*/{
|
|
1430
1431
|
options = options || {};
|
|
1431
1432
|
options.include = keys;
|
|
1432
1433
|
return this.fetch(options);
|
|
@@ -1951,7 +1952,7 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
1951
1952
|
*/
|
|
1952
1953
|
}, {
|
|
1953
1954
|
key: "fetchAllWithInclude",
|
|
1954
|
-
value: function (list /*: Array<ParseObject>*/, keys /*:
|
|
1955
|
+
value: function (list /*: Array<ParseObject>*/, keys /*: string | Array<string | Array<string>>*/, options /*: RequestOptions*/) {
|
|
1955
1956
|
options = options || {};
|
|
1956
1957
|
options.include = keys;
|
|
1957
1958
|
return ParseObject.fetchAll(list, options);
|
|
@@ -1989,7 +1990,7 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
1989
1990
|
*/
|
|
1990
1991
|
}, {
|
|
1991
1992
|
key: "fetchAllIfNeededWithInclude",
|
|
1992
|
-
value: function (list /*: Array<ParseObject>*/, keys /*:
|
|
1993
|
+
value: function (list /*: Array<ParseObject>*/, keys /*: string | Array<string | Array<string>>*/, options /*: RequestOptions*/) {
|
|
1993
1994
|
options = options || {};
|
|
1994
1995
|
options.include = keys;
|
|
1995
1996
|
return ParseObject.fetchAllIfNeeded(list, options);
|
|
@@ -2585,11 +2586,11 @@ var DefaultController = {
|
|
|
2585
2586
|
if (target.length < 1) {
|
|
2586
2587
|
return _promise.default.resolve([]);
|
|
2587
2588
|
}
|
|
2588
|
-
var objs = [];
|
|
2589
|
-
var ids = [];
|
|
2590
|
-
var className = null;
|
|
2591
|
-
var results = [];
|
|
2592
|
-
var error = null;
|
|
2589
|
+
var objs /*: ParseObject[]*/ = [];
|
|
2590
|
+
var ids /*: string[]*/ = [];
|
|
2591
|
+
var className /*: string | null*/ = null;
|
|
2592
|
+
var results /*: ParseObject[]*/ = [];
|
|
2593
|
+
var error /*: ParseError | null*/ = null;
|
|
2593
2594
|
(0, _forEach.default)(target).call(target, function (el) {
|
|
2594
2595
|
if (error) {
|
|
2595
2596
|
return;
|
|
@@ -2850,7 +2851,7 @@ var DefaultController = {
|
|
|
2850
2851
|
}, _callee10);
|
|
2851
2852
|
}))();
|
|
2852
2853
|
},
|
|
2853
|
-
save: function (target /*: ParseObject | Array<ParseObject | ParseFile>*/, options /*: RequestOptions*/) /*: Promise<ParseObject | Array<ParseObject> | ParseFile>*/{
|
|
2854
|
+
save: function (target /*: ParseObject | null | Array<ParseObject | ParseFile>*/, options /*: RequestOptions*/) /*: Promise<ParseObject | Array<ParseObject> | ParseFile | undefined>*/{
|
|
2854
2855
|
var batchSize = options && options.batchSize ? options.batchSize : _CoreManager.default.get('REQUEST_BATCH_SIZE');
|
|
2855
2856
|
var localDatastore = _CoreManager.default.getLocalDatastore();
|
|
2856
2857
|
var mapIdForPin = {};
|
|
@@ -2865,12 +2866,13 @@ var DefaultController = {
|
|
|
2865
2866
|
}
|
|
2866
2867
|
var unsaved = (0, _concat.default)(target).call(target);
|
|
2867
2868
|
for (var i = 0; i < target.length; i++) {
|
|
2868
|
-
|
|
2869
|
-
|
|
2869
|
+
var target_i = target[i];
|
|
2870
|
+
if (target_i instanceof ParseObject) {
|
|
2871
|
+
unsaved = (0, _concat.default)(unsaved).call(unsaved, (0, _unsavedChildren.default)(target_i, true));
|
|
2870
2872
|
}
|
|
2871
2873
|
}
|
|
2872
2874
|
unsaved = (0, _unique.default)(unsaved);
|
|
2873
|
-
var filesSaved /*: Array<ParseFile>*/ = [];
|
|
2875
|
+
var filesSaved /*: Array<Promise<ParseFile> | undefined>*/ = [];
|
|
2874
2876
|
var pending /*: Array<ParseObject>*/ = [];
|
|
2875
2877
|
(0, _forEach.default)(unsaved).call(unsaved, function (el) {
|
|
2876
2878
|
if (el instanceof _ParseFile.default) {
|
|
@@ -2903,11 +2905,11 @@ var DefaultController = {
|
|
|
2903
2905
|
|
|
2904
2906
|
// Queue up tasks for each object in the batch.
|
|
2905
2907
|
// When every task is ready, the API request will execute
|
|
2906
|
-
var batchReturned =
|
|
2907
|
-
var batchReady = [];
|
|
2908
|
-
var batchTasks = [];
|
|
2908
|
+
var batchReturned = (0, _promiseUtils.resolvingPromise)();
|
|
2909
|
+
var batchReady /*: ReturnType<typeof resolvingPromise<void>>[]*/ = [];
|
|
2910
|
+
var batchTasks /*: Promise<void>[]*/ = [];
|
|
2909
2911
|
(0, _forEach.default)(batch).call(batch, function (obj, index) {
|
|
2910
|
-
var ready =
|
|
2912
|
+
var ready = (0, _promiseUtils.resolvingPromise)();
|
|
2911
2913
|
batchReady.push(ready);
|
|
2912
2914
|
var task = function task() {
|
|
2913
2915
|
ready.resolve();
|
|
@@ -3042,7 +3044,7 @@ var DefaultController = {
|
|
|
3042
3044
|
return _promise.default.reject(error);
|
|
3043
3045
|
});
|
|
3044
3046
|
}
|
|
3045
|
-
return _promise.default.resolve();
|
|
3047
|
+
return _promise.default.resolve(undefined);
|
|
3046
3048
|
}
|
|
3047
3049
|
};
|
|
3048
3050
|
_CoreManager.default.setParseObject(ParseObject);
|
package/lib/weapp/ParseOp.js
CHANGED
|
@@ -109,13 +109,13 @@ var Op = /*#__PURE__*/function () {
|
|
|
109
109
|
key: "applyTo",
|
|
110
110
|
value:
|
|
111
111
|
// Empty parent class
|
|
112
|
-
function () /*:
|
|
112
|
+
function () /*: any*/{} /* eslint-disable-line @typescript-eslint/no-unused-vars */
|
|
113
113
|
}, {
|
|
114
114
|
key: "mergeWith",
|
|
115
|
-
value: function () /*: ?Op*/{} /* eslint-disable-line no-unused-vars */
|
|
115
|
+
value: function () /*: ?Op*/{} /* eslint-disable-line @typescript-eslint/no-unused-vars */
|
|
116
116
|
}, {
|
|
117
117
|
key: "toJSON",
|
|
118
|
-
value: function () /*:
|
|
118
|
+
value: function () /*: any*/{}
|
|
119
119
|
}]);
|
|
120
120
|
return Op;
|
|
121
121
|
}();
|
|
@@ -123,7 +123,7 @@ exports.Op = Op;
|
|
|
123
123
|
var SetOp = /*#__PURE__*/function (_Op) {
|
|
124
124
|
(0, _inherits2.default)(SetOp, _Op);
|
|
125
125
|
var _super = _createSuper(SetOp);
|
|
126
|
-
function SetOp(value /*:
|
|
126
|
+
function SetOp(value /*: any*/) {
|
|
127
127
|
var _this;
|
|
128
128
|
(0, _classCallCheck2.default)(this, SetOp);
|
|
129
129
|
_this = _super.call(this);
|
|
@@ -133,7 +133,7 @@ var SetOp = /*#__PURE__*/function (_Op) {
|
|
|
133
133
|
}
|
|
134
134
|
(0, _createClass2.default)(SetOp, [{
|
|
135
135
|
key: "applyTo",
|
|
136
|
-
value: function () /*:
|
|
136
|
+
value: function () /*: any*/{
|
|
137
137
|
return this._value;
|
|
138
138
|
}
|
|
139
139
|
}, {
|
|
@@ -194,7 +194,7 @@ var IncrementOp = /*#__PURE__*/function (_Op3) {
|
|
|
194
194
|
}
|
|
195
195
|
(0, _createClass2.default)(IncrementOp, [{
|
|
196
196
|
key: "applyTo",
|
|
197
|
-
value: function (value /*: ?
|
|
197
|
+
value: function (value /*: ?any*/) /*: number*/{
|
|
198
198
|
if (typeof value === 'undefined') {
|
|
199
199
|
return this._amount;
|
|
200
200
|
}
|
|
@@ -235,7 +235,7 @@ exports.IncrementOp = IncrementOp;
|
|
|
235
235
|
var AddOp = /*#__PURE__*/function (_Op4) {
|
|
236
236
|
(0, _inherits2.default)(AddOp, _Op4);
|
|
237
237
|
var _super4 = _createSuper(AddOp);
|
|
238
|
-
function AddOp(value /*:
|
|
238
|
+
function AddOp(value /*: any | Array<any>*/) {
|
|
239
239
|
var _this3;
|
|
240
240
|
(0, _classCallCheck2.default)(this, AddOp);
|
|
241
241
|
_this3 = _super4.call(this);
|
|
@@ -245,7 +245,7 @@ var AddOp = /*#__PURE__*/function (_Op4) {
|
|
|
245
245
|
}
|
|
246
246
|
(0, _createClass2.default)(AddOp, [{
|
|
247
247
|
key: "applyTo",
|
|
248
|
-
value: function (value /*:
|
|
248
|
+
value: function (value /*: any*/) /*: Array<any>*/{
|
|
249
249
|
if (value == null) {
|
|
250
250
|
return this._value;
|
|
251
251
|
}
|
|
@@ -273,7 +273,7 @@ var AddOp = /*#__PURE__*/function (_Op4) {
|
|
|
273
273
|
}
|
|
274
274
|
}, {
|
|
275
275
|
key: "toJSON",
|
|
276
|
-
value: function () /*: { __op: string, objects:
|
|
276
|
+
value: function () /*: { __op: string, objects: any }*/{
|
|
277
277
|
return {
|
|
278
278
|
__op: 'Add',
|
|
279
279
|
objects: (0, _encode.default)(this._value, false, true)
|
|
@@ -286,7 +286,7 @@ exports.AddOp = AddOp;
|
|
|
286
286
|
var AddUniqueOp = /*#__PURE__*/function (_Op5) {
|
|
287
287
|
(0, _inherits2.default)(AddUniqueOp, _Op5);
|
|
288
288
|
var _super5 = _createSuper(AddUniqueOp);
|
|
289
|
-
function AddUniqueOp(value /*:
|
|
289
|
+
function AddUniqueOp(value /*: any | Array<any>*/) {
|
|
290
290
|
var _this4;
|
|
291
291
|
(0, _classCallCheck2.default)(this, AddUniqueOp);
|
|
292
292
|
_this4 = _super5.call(this);
|
|
@@ -296,7 +296,7 @@ var AddUniqueOp = /*#__PURE__*/function (_Op5) {
|
|
|
296
296
|
}
|
|
297
297
|
(0, _createClass2.default)(AddUniqueOp, [{
|
|
298
298
|
key: "applyTo",
|
|
299
|
-
value: function (value /*:
|
|
299
|
+
value: function (value /*: any | Array<any>*/) /*: Array<any>*/{
|
|
300
300
|
if (value == null) {
|
|
301
301
|
return this._value || [];
|
|
302
302
|
}
|
|
@@ -338,7 +338,7 @@ var AddUniqueOp = /*#__PURE__*/function (_Op5) {
|
|
|
338
338
|
}
|
|
339
339
|
}, {
|
|
340
340
|
key: "toJSON",
|
|
341
|
-
value: function () /*: { __op: string, objects:
|
|
341
|
+
value: function () /*: { __op: string, objects: any }*/{
|
|
342
342
|
return {
|
|
343
343
|
__op: 'AddUnique',
|
|
344
344
|
objects: (0, _encode.default)(this._value, false, true)
|
|
@@ -351,7 +351,7 @@ exports.AddUniqueOp = AddUniqueOp;
|
|
|
351
351
|
var RemoveOp = /*#__PURE__*/function (_Op6) {
|
|
352
352
|
(0, _inherits2.default)(RemoveOp, _Op6);
|
|
353
353
|
var _super6 = _createSuper(RemoveOp);
|
|
354
|
-
function RemoveOp(value /*:
|
|
354
|
+
function RemoveOp(value /*: any | Array<any>*/) {
|
|
355
355
|
var _this5;
|
|
356
356
|
(0, _classCallCheck2.default)(this, RemoveOp);
|
|
357
357
|
_this5 = _super6.call(this);
|
|
@@ -361,7 +361,7 @@ var RemoveOp = /*#__PURE__*/function (_Op6) {
|
|
|
361
361
|
}
|
|
362
362
|
(0, _createClass2.default)(RemoveOp, [{
|
|
363
363
|
key: "applyTo",
|
|
364
|
-
value: function (value /*:
|
|
364
|
+
value: function (value /*: any | Array<any>*/) /*: Array<any>*/{
|
|
365
365
|
if (value == null) {
|
|
366
366
|
return [];
|
|
367
367
|
}
|
|
@@ -421,7 +421,7 @@ var RemoveOp = /*#__PURE__*/function (_Op6) {
|
|
|
421
421
|
}
|
|
422
422
|
}, {
|
|
423
423
|
key: "toJSON",
|
|
424
|
-
value: function () /*: { __op: string, objects:
|
|
424
|
+
value: function () /*: { __op: string, objects: any }*/{
|
|
425
425
|
return {
|
|
426
426
|
__op: 'Remove',
|
|
427
427
|
objects: (0, _encode.default)(this._value, false, true)
|
|
@@ -469,7 +469,7 @@ var RelationOp = /*#__PURE__*/function (_Op7) {
|
|
|
469
469
|
}
|
|
470
470
|
}, {
|
|
471
471
|
key: "applyTo",
|
|
472
|
-
value: function (value /*:
|
|
472
|
+
value: function (value /*: any*/, parent /*: ParseObject*/, key /*:: ?: string*/) /*: ?ParseRelation*/{
|
|
473
473
|
if (!value) {
|
|
474
474
|
if (!parent || !key) {
|
|
475
475
|
throw new Error('Cannot apply a RelationOp without either a previous value, or an object and a key');
|
|
@@ -541,7 +541,7 @@ var RelationOp = /*#__PURE__*/function (_Op7) {
|
|
|
541
541
|
}
|
|
542
542
|
}, {
|
|
543
543
|
key: "toJSON",
|
|
544
|
-
value: function () /*: { __op?: string, objects?:
|
|
544
|
+
value: function () /*: { __op?: string, objects?: any, ops?: any }*/{
|
|
545
545
|
var _this7 = this;
|
|
546
546
|
var idToPointer = function (id) {
|
|
547
547
|
return {
|
|
@@ -82,7 +82,7 @@ var ParsePolygon = /*#__PURE__*/function () {
|
|
|
82
82
|
*/
|
|
83
83
|
}, {
|
|
84
84
|
key: "equals",
|
|
85
|
-
value: function (other /*:
|
|
85
|
+
value: function (other /*: any*/) /*: boolean*/{
|
|
86
86
|
if (!(other instanceof ParsePolygon) || this.coordinates.length !== other.coordinates.length) {
|
|
87
87
|
return false;
|
|
88
88
|
}
|