parse 8.6.1-alpha.1 → 8.6.2-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 +5 -3
- package/dist/parse.min.js +4 -2
- package/dist/parse.weapp.js +5 -3
- package/dist/parse.weapp.min.js +4 -2
- package/lib/browser/Cloud.js +1 -2
- package/lib/browser/CoreManager.js +2 -4
- package/lib/browser/EventuallyQueue.js +3 -4
- package/lib/browser/InstallationController.js +1 -2
- package/lib/browser/LiveQueryClient.js +16 -27
- package/lib/browser/LiveQuerySubscription.js +1 -7
- package/lib/browser/LocalDatastore.js +4 -6
- package/lib/browser/ObjectStateMutations.js +3 -31
- package/lib/browser/OfflineQuery.js +15 -19
- package/lib/browser/Parse.js +4 -39
- package/lib/browser/ParseCLP.js +20 -48
- package/lib/browser/ParseFile.js +23 -54
- package/lib/browser/ParseInstallation.js +2 -8
- package/lib/browser/ParseLiveQuery.js +1 -7
- package/lib/browser/ParseObject.js +13 -43
- package/lib/browser/ParseQuery.js +37 -78
- package/lib/browser/ParseSchema.js +6 -7
- package/lib/browser/ParseUser.js +18 -62
- package/lib/browser/Push.js +3 -6
- package/lib/browser/RESTController.js +7 -35
- package/lib/node/CoreManager.js +1 -1
- package/lib/react-native/CoreManager.js +1 -1
- package/lib/weapp/Cloud.js +1 -2
- package/lib/weapp/CoreManager.js +2 -4
- package/lib/weapp/EventuallyQueue.js +3 -4
- package/lib/weapp/InstallationController.js +1 -2
- package/lib/weapp/LiveQueryClient.js +16 -27
- package/lib/weapp/LiveQuerySubscription.js +1 -7
- package/lib/weapp/LocalDatastore.js +4 -6
- package/lib/weapp/ObjectStateMutations.js +3 -31
- package/lib/weapp/OfflineQuery.js +15 -19
- package/lib/weapp/Parse.js +4 -39
- package/lib/weapp/ParseCLP.js +20 -48
- package/lib/weapp/ParseFile.js +23 -54
- package/lib/weapp/ParseInstallation.js +2 -8
- package/lib/weapp/ParseLiveQuery.js +1 -7
- package/lib/weapp/ParseObject.js +13 -43
- package/lib/weapp/ParseQuery.js +37 -78
- package/lib/weapp/ParseSchema.js +6 -7
- package/lib/weapp/ParseUser.js +18 -62
- package/lib/weapp/Push.js +3 -6
- package/lib/weapp/RESTController.js +7 -35
- package/package.json +11 -12
package/dist/parse.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Parse JavaScript SDK v8.6.
|
|
2
|
+
* Parse JavaScript SDK v8.6.2-alpha.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright 2015-present Parse Platform
|
|
5
5
|
* All rights reserved.
|
|
@@ -199,7 +199,7 @@
|
|
|
199
199
|
SERVER_URL: "https://api.parse.com/1",
|
|
200
200
|
LIVEQUERY_SERVER_URL: null,
|
|
201
201
|
ENCRYPTED_KEY: null,
|
|
202
|
-
VERSION: "js8.6.
|
|
202
|
+
VERSION: "js8.6.2-alpha.1",
|
|
203
203
|
APPLICATION_ID: null,
|
|
204
204
|
JAVASCRIPT_KEY: null,
|
|
205
205
|
MAINTENANCE_KEY: null,
|
|
@@ -47989,7 +47989,9 @@ execute: function(password, keySize, ivSize, salt, hasher) {
|
|
|
47989
47989
|
dbp = promisifyRequest(request);
|
|
47990
47990
|
dbp.then((db) => {
|
|
47991
47991
|
db.onclose = () => dbp = void 0;
|
|
47992
|
-
}, () => {
|
|
47992
|
+
}, () => {
|
|
47993
|
+
dbp = void 0;
|
|
47994
|
+
});
|
|
47993
47995
|
return dbp;
|
|
47994
47996
|
};
|
|
47995
47997
|
return (txMode, callback) => getDB().then((db) => callback(db.transaction(storeName, txMode).objectStore(storeName)));
|
package/dist/parse.min.js
CHANGED
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
SERVER_URL: "https://api.parse.com/1",
|
|
118
118
|
LIVEQUERY_SERVER_URL: null,
|
|
119
119
|
ENCRYPTED_KEY: null,
|
|
120
|
-
VERSION: "js8.6.
|
|
120
|
+
VERSION: "js8.6.2-alpha.1",
|
|
121
121
|
APPLICATION_ID: null,
|
|
122
122
|
JAVASCRIPT_KEY: null,
|
|
123
123
|
MAINTENANCE_KEY: null,
|
|
@@ -23415,7 +23415,9 @@
|
|
|
23415
23415
|
const i = indexedDB.open(t);
|
|
23416
23416
|
return i.onupgradeneeded = () => i.result.createObjectStore(e), r = promisifyRequest(i), r.then(((t) => {
|
|
23417
23417
|
t.onclose = () => r = void 0;
|
|
23418
|
-
}), (() => {
|
|
23418
|
+
}), (() => {
|
|
23419
|
+
r = void 0;
|
|
23420
|
+
})), r;
|
|
23419
23421
|
})().then(((t) => n(t.transaction(e, i).objectStore(e))));
|
|
23420
23422
|
}
|
|
23421
23423
|
function defaultGetStore() {
|
package/dist/parse.weapp.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Parse JavaScript SDK v8.6.
|
|
2
|
+
* Parse JavaScript SDK v8.6.2-alpha.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright 2015-present Parse Platform
|
|
5
5
|
* All rights reserved.
|
|
@@ -199,7 +199,7 @@
|
|
|
199
199
|
SERVER_URL: "https://api.parse.com/1",
|
|
200
200
|
LIVEQUERY_SERVER_URL: null,
|
|
201
201
|
ENCRYPTED_KEY: null,
|
|
202
|
-
VERSION: "js8.6.
|
|
202
|
+
VERSION: "js8.6.2-alpha.1",
|
|
203
203
|
APPLICATION_ID: null,
|
|
204
204
|
JAVASCRIPT_KEY: null,
|
|
205
205
|
MAINTENANCE_KEY: null,
|
|
@@ -47997,7 +47997,9 @@ execute: function(password, keySize, ivSize, salt, hasher) {
|
|
|
47997
47997
|
dbp = promisifyRequest(request);
|
|
47998
47998
|
dbp.then((db) => {
|
|
47999
47999
|
db.onclose = () => dbp = void 0;
|
|
48000
|
-
}, () => {
|
|
48000
|
+
}, () => {
|
|
48001
|
+
dbp = void 0;
|
|
48002
|
+
});
|
|
48001
48003
|
return dbp;
|
|
48002
48004
|
};
|
|
48003
48005
|
return (txMode, callback) => getDB().then((db) => callback(db.transaction(storeName, txMode).objectStore(storeName)));
|
package/dist/parse.weapp.min.js
CHANGED
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
SERVER_URL: "https://api.parse.com/1",
|
|
118
118
|
LIVEQUERY_SERVER_URL: null,
|
|
119
119
|
ENCRYPTED_KEY: null,
|
|
120
|
-
VERSION: "js8.6.
|
|
120
|
+
VERSION: "js8.6.2-alpha.1",
|
|
121
121
|
APPLICATION_ID: null,
|
|
122
122
|
JAVASCRIPT_KEY: null,
|
|
123
123
|
MAINTENANCE_KEY: null,
|
|
@@ -23419,7 +23419,9 @@
|
|
|
23419
23419
|
const i = indexedDB.open(t);
|
|
23420
23420
|
return i.onupgradeneeded = () => i.result.createObjectStore(e), r = promisifyRequest(i), r.then(((t) => {
|
|
23421
23421
|
t.onclose = () => r = void 0;
|
|
23422
|
-
}), (() => {
|
|
23422
|
+
}), (() => {
|
|
23423
|
+
r = void 0;
|
|
23424
|
+
})), r;
|
|
23423
23425
|
})().then(((t) => n(t.transaction(e, i).objectStore(e))));
|
|
23424
23426
|
}
|
|
23425
23427
|
function defaultGetStore() {
|
package/lib/browser/Cloud.js
CHANGED
|
@@ -125,12 +125,11 @@ const DefaultController = {
|
|
|
125
125
|
return RESTController.request('GET', 'cloud_code/jobs/data', null, options);
|
|
126
126
|
},
|
|
127
127
|
async startJob(name, data, options) {
|
|
128
|
-
var _response$_headers;
|
|
129
128
|
const RESTController = _CoreManager.default.getRESTController();
|
|
130
129
|
const payload = (0, _encode.default)(data, true);
|
|
131
130
|
options.returnStatus = true;
|
|
132
131
|
const response = await RESTController.request('POST', 'jobs/' + name, payload, options);
|
|
133
|
-
return
|
|
132
|
+
return response._headers?.['X-Parse-Job-Status-Id'];
|
|
134
133
|
}
|
|
135
134
|
};
|
|
136
135
|
_CoreManager.default.setCloudController(DefaultController);
|
|
@@ -7,7 +7,6 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
10
|
-
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
11
10
|
/** Based on https://github.com/react-native-async-storage/async-storage/blob/main/packages/default-storage-backend/src/types.ts */
|
|
12
11
|
|
|
13
12
|
const config = {
|
|
@@ -18,7 +17,7 @@ const config = {
|
|
|
18
17
|
SERVER_URL: 'https://api.parse.com/1',
|
|
19
18
|
LIVEQUERY_SERVER_URL: null,
|
|
20
19
|
ENCRYPTED_KEY: null,
|
|
21
|
-
VERSION: 'js' + "8.6.
|
|
20
|
+
VERSION: 'js' + "8.6.2-alpha.1",
|
|
22
21
|
APPLICATION_ID: null,
|
|
23
22
|
JAVASCRIPT_KEY: null,
|
|
24
23
|
MAINTENANCE_KEY: null,
|
|
@@ -35,8 +34,7 @@ const config = {
|
|
|
35
34
|
function requireMethods(name, methods, controller) {
|
|
36
35
|
(0, _forEach.default)(methods).call(methods, func => {
|
|
37
36
|
if (typeof controller[func] !== 'function') {
|
|
38
|
-
|
|
39
|
-
throw new Error((0, _concat.default)(_context = "".concat(name, " must implement ")).call(_context, func, "()"));
|
|
37
|
+
throw new Error(`${name} must implement ${func}()`);
|
|
40
38
|
}
|
|
41
39
|
});
|
|
42
40
|
}
|
|
@@ -284,10 +284,9 @@ const EventuallyQueue = {
|
|
|
284
284
|
}
|
|
285
285
|
polling = (0, _setInterval2.default)(() => {
|
|
286
286
|
const RESTController = _CoreManager.default.getRESTController();
|
|
287
|
-
RESTController.request('GET', 'health').then(
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
} = _ref;
|
|
287
|
+
RESTController.request('GET', 'health').then(({
|
|
288
|
+
status
|
|
289
|
+
}) => {
|
|
291
290
|
if (status === 'ok') {
|
|
292
291
|
this.stopPoll();
|
|
293
292
|
return this.sendQueue();
|
|
@@ -72,8 +72,7 @@ const InstallationController = {
|
|
|
72
72
|
_setInstallationIdCache(iid) {
|
|
73
73
|
iidCache = iid;
|
|
74
74
|
},
|
|
75
|
-
_setCurrentInstallationCache(installation) {
|
|
76
|
-
let matchesDisk = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
75
|
+
_setCurrentInstallationCache(installation, matchesDisk = true) {
|
|
77
76
|
currentInstallationCache = installation;
|
|
78
77
|
currentInstallationCacheMatchesDisk = matchesDisk;
|
|
79
78
|
}
|
|
@@ -133,16 +133,14 @@ class LiveQueryClient {
|
|
|
133
133
|
* @param options.sessionToken - (Optional) Session token for authenticated requests
|
|
134
134
|
* @param options.installationId - (Optional) Installation ID for the client
|
|
135
135
|
*/
|
|
136
|
-
constructor(
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
installationId
|
|
145
|
-
} = _ref;
|
|
136
|
+
constructor({
|
|
137
|
+
applicationId,
|
|
138
|
+
serverURL,
|
|
139
|
+
javascriptKey,
|
|
140
|
+
masterKey,
|
|
141
|
+
sessionToken,
|
|
142
|
+
installationId
|
|
143
|
+
}) {
|
|
146
144
|
(0, _defineProperty2.default)(this, "attempts", void 0);
|
|
147
145
|
(0, _defineProperty2.default)(this, "id", void 0);
|
|
148
146
|
(0, _defineProperty2.default)(this, "requestId", void 0);
|
|
@@ -181,12 +179,7 @@ class LiveQueryClient {
|
|
|
181
179
|
const EventEmitter = _CoreManager.default.getEventEmitter();
|
|
182
180
|
this.emitter = new EventEmitter();
|
|
183
181
|
this.on = (eventName, listener) => this.emitter.on(eventName, listener);
|
|
184
|
-
this.emit =
|
|
185
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
186
|
-
args[_key - 1] = arguments[_key];
|
|
187
|
-
}
|
|
188
|
-
return _this.emitter.emit(eventName, ...args);
|
|
189
|
-
};
|
|
182
|
+
this.emit = (eventName, ...args) => this.emitter.emit(eventName, ...args);
|
|
190
183
|
// adding listener so process does not crash
|
|
191
184
|
// best practice is for developer to register their own listener
|
|
192
185
|
this.on('error', () => {});
|
|
@@ -210,15 +203,14 @@ class LiveQueryClient {
|
|
|
210
203
|
* @returns {LiveQuerySubscription | undefined}
|
|
211
204
|
*/
|
|
212
205
|
subscribe(query, sessionToken) {
|
|
213
|
-
var _queryJSON$keys, _queryJSON$watch;
|
|
214
206
|
if (!query) {
|
|
215
207
|
return;
|
|
216
208
|
}
|
|
217
209
|
const className = query.className;
|
|
218
210
|
const queryJSON = query.toJSON();
|
|
219
211
|
const where = queryJSON.where;
|
|
220
|
-
const keys = (
|
|
221
|
-
const watch =
|
|
212
|
+
const keys = (0, _keys.default)(queryJSON)?.split(',');
|
|
213
|
+
const watch = queryJSON.watch?.split(',');
|
|
222
214
|
const subscribeRequest = {
|
|
223
215
|
op: OP_TYPES.SUBSCRIBE,
|
|
224
216
|
requestId: this.requestId,
|
|
@@ -290,8 +282,7 @@ class LiveQueryClient {
|
|
|
290
282
|
this._handleWebSocketMessage(event);
|
|
291
283
|
};
|
|
292
284
|
this.socket.onclose = event => {
|
|
293
|
-
|
|
294
|
-
(_this$socket$closingP = this.socket.closingPromise) === null || _this$socket$closingP === void 0 || _this$socket$closingP.resolve(event);
|
|
285
|
+
this.socket.closingPromise?.resolve(event);
|
|
295
286
|
this._handleWebSocketClose();
|
|
296
287
|
};
|
|
297
288
|
this.socket.onerror = error => {
|
|
@@ -301,12 +292,11 @@ class LiveQueryClient {
|
|
|
301
292
|
resubscribe() {
|
|
302
293
|
var _context;
|
|
303
294
|
(0, _forEach.default)(_context = this.subscriptions).call(_context, (subscription, requestId) => {
|
|
304
|
-
var _queryJSON$keys2, _queryJSON$watch2;
|
|
305
295
|
const query = subscription.query;
|
|
306
296
|
const queryJSON = query.toJSON();
|
|
307
297
|
const where = queryJSON.where;
|
|
308
|
-
const keys = (
|
|
309
|
-
const watch =
|
|
298
|
+
const keys = (0, _keys.default)(queryJSON)?.split(',');
|
|
299
|
+
const watch = queryJSON.watch?.split(',');
|
|
310
300
|
const className = query.className;
|
|
311
301
|
const sessionToken = subscription.sessionToken;
|
|
312
302
|
const subscribeRequest = {
|
|
@@ -336,12 +326,11 @@ class LiveQueryClient {
|
|
|
336
326
|
* @returns {Promise | undefined} CloseEvent {@link https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/close_event}
|
|
337
327
|
*/
|
|
338
328
|
async close() {
|
|
339
|
-
var _this$socket, _this$socket2;
|
|
340
329
|
if (this.state === CLIENT_STATE.INITIALIZED || this.state === CLIENT_STATE.DISCONNECTED) {
|
|
341
330
|
return;
|
|
342
331
|
}
|
|
343
332
|
this.state = CLIENT_STATE.DISCONNECTED;
|
|
344
|
-
|
|
333
|
+
this.socket?.close();
|
|
345
334
|
// Notify each subscription about the close
|
|
346
335
|
for (const subscription of (0, _values.default)(_context2 = this.subscriptions).call(_context2)) {
|
|
347
336
|
var _context2;
|
|
@@ -350,7 +339,7 @@ class LiveQueryClient {
|
|
|
350
339
|
}
|
|
351
340
|
this._handleReset();
|
|
352
341
|
this.emit(CLIENT_EMMITER_TYPES.CLOSE);
|
|
353
|
-
return
|
|
342
|
+
return this.socket?.closingPromise;
|
|
354
343
|
}
|
|
355
344
|
|
|
356
345
|
// ensure we start with valid state if connect is called again after close
|
|
@@ -100,7 +100,6 @@ class LiveQuerySubscription {
|
|
|
100
100
|
* @param {object} client - LiveQueryClient instance
|
|
101
101
|
*/
|
|
102
102
|
constructor(id, query, sessionToken, client) {
|
|
103
|
-
var _this = this;
|
|
104
103
|
(0, _defineProperty2.default)(this, "id", void 0);
|
|
105
104
|
(0, _defineProperty2.default)(this, "query", void 0);
|
|
106
105
|
(0, _defineProperty2.default)(this, "sessionToken", void 0);
|
|
@@ -121,12 +120,7 @@ class LiveQuerySubscription {
|
|
|
121
120
|
const Emitter = _CoreManager.default.getEventEmitter();
|
|
122
121
|
this.emitter = new Emitter();
|
|
123
122
|
this.on = (eventName, listener) => this.emitter.on(eventName, listener);
|
|
124
|
-
this.emit =
|
|
125
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
126
|
-
args[_key - 1] = arguments[_key];
|
|
127
|
-
}
|
|
128
|
-
return _this.emitter.emit(eventName, ...args);
|
|
129
|
-
};
|
|
123
|
+
this.emit = (eventName, ...args) => this.emitter.emit(eventName, ...args);
|
|
130
124
|
// adding listener so process does not crash
|
|
131
125
|
// best practice is for developer to register their own listener
|
|
132
126
|
this.on('error', () => {});
|
|
@@ -269,11 +269,10 @@ const LocalDatastore = {
|
|
|
269
269
|
},
|
|
270
270
|
// Update pin and references of the unsaved object
|
|
271
271
|
async _updateLocalIdForObject(localId, object) {
|
|
272
|
-
var _context2, _context3;
|
|
273
272
|
if (!this.isEnabled) {
|
|
274
273
|
return;
|
|
275
274
|
}
|
|
276
|
-
const localKey =
|
|
275
|
+
const localKey = `${_LocalDatastoreUtils.OBJECT_PREFIX}${object.className}_${localId}`;
|
|
277
276
|
const objectKey = this.getKeyForObject(object);
|
|
278
277
|
const unsaved = await this.fromPinWithName(localKey);
|
|
279
278
|
if (!unsaved || unsaved.length === 0) {
|
|
@@ -306,7 +305,7 @@ const LocalDatastore = {
|
|
|
306
305
|
* @static
|
|
307
306
|
*/
|
|
308
307
|
async updateFromServer() {
|
|
309
|
-
var
|
|
308
|
+
var _context2;
|
|
310
309
|
if (!this.checkIfEnabled() || this.isSyncing) {
|
|
311
310
|
return;
|
|
312
311
|
}
|
|
@@ -339,7 +338,7 @@ const LocalDatastore = {
|
|
|
339
338
|
}
|
|
340
339
|
pointersHash[className].add(objectId);
|
|
341
340
|
}
|
|
342
|
-
const queryPromises = (0, _map.default)(
|
|
341
|
+
const queryPromises = (0, _map.default)(_context2 = (0, _keys.default)(pointersHash)).call(_context2, className => {
|
|
343
342
|
const objectIds = (0, _from.default)(pointersHash[className]);
|
|
344
343
|
const query = new _ParseQuery.default(className);
|
|
345
344
|
query.limit(objectIds.length);
|
|
@@ -365,9 +364,8 @@ const LocalDatastore = {
|
|
|
365
364
|
}
|
|
366
365
|
},
|
|
367
366
|
getKeyForObject(object) {
|
|
368
|
-
var _context5, _context6;
|
|
369
367
|
const objectId = object.objectId || object._getId();
|
|
370
|
-
return
|
|
368
|
+
return `${_LocalDatastoreUtils.OBJECT_PREFIX}${object.className}_${objectId}`;
|
|
371
369
|
},
|
|
372
370
|
getPinName(pinName) {
|
|
373
371
|
if (!pinName || pinName === _LocalDatastoreUtils.DEFAULT_PIN) {
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
|
4
|
-
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
|
|
5
|
-
var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
|
|
6
|
-
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
7
|
-
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
|
8
|
-
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
|
|
9
|
-
var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
|
|
10
3
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
11
4
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
12
5
|
_Object$defineProperty(exports, "__esModule", {
|
|
@@ -21,7 +14,6 @@ exports.popPendingState = popPendingState;
|
|
|
21
14
|
exports.pushPendingState = pushPendingState;
|
|
22
15
|
exports.setPendingOp = setPendingOp;
|
|
23
16
|
exports.setServerData = setServerData;
|
|
24
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
25
17
|
var _create = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/create"));
|
|
26
18
|
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
27
19
|
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
@@ -33,28 +25,6 @@ var _ParseRelation = _interopRequireDefault(require("./ParseRelation"));
|
|
|
33
25
|
var _TaskQueue = _interopRequireDefault(require("./TaskQueue"));
|
|
34
26
|
var _ParseOp = require("./ParseOp");
|
|
35
27
|
var _isDangerousKey = require("./isDangerousKey");
|
|
36
|
-
function ownKeys(e, r) {
|
|
37
|
-
var t = _Object$keys(e);
|
|
38
|
-
if (_Object$getOwnPropertySymbols) {
|
|
39
|
-
var o = _Object$getOwnPropertySymbols(e);
|
|
40
|
-
r && (o = _filterInstanceProperty(o).call(o, function (r) {
|
|
41
|
-
return _Object$getOwnPropertyDescriptor(e, r).enumerable;
|
|
42
|
-
})), t.push.apply(t, o);
|
|
43
|
-
}
|
|
44
|
-
return t;
|
|
45
|
-
}
|
|
46
|
-
function _objectSpread(e) {
|
|
47
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
48
|
-
var _context, _context2;
|
|
49
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
50
|
-
r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) {
|
|
51
|
-
(0, _defineProperty2.default)(e, r, t[r]);
|
|
52
|
-
}) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) {
|
|
53
|
-
_Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r));
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
return e;
|
|
57
|
-
}
|
|
58
28
|
function defaultState() {
|
|
59
29
|
return {
|
|
60
30
|
serverData: (0, _create.default)(null),
|
|
@@ -182,7 +152,9 @@ function estimateAttributes(serverData, pendingOps, object) {
|
|
|
182
152
|
if ((0, _isArray.default)(object[key])) {
|
|
183
153
|
object[key] = [...object[key]];
|
|
184
154
|
} else {
|
|
185
|
-
object[key] =
|
|
155
|
+
object[key] = {
|
|
156
|
+
...object[key]
|
|
157
|
+
};
|
|
186
158
|
}
|
|
187
159
|
}
|
|
188
160
|
object = object[key];
|
|
@@ -11,7 +11,6 @@ var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-st
|
|
|
11
11
|
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
12
12
|
var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
|
|
13
13
|
var _isInteger = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/number/is-integer"));
|
|
14
|
-
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
15
14
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
16
15
|
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
17
16
|
var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
|
|
@@ -119,8 +118,7 @@ function equalObjectsGeneric(obj, compareTo, eqlFn) {
|
|
|
119
118
|
* @param {Date} [now] The date from which add or subtract. Default is now.
|
|
120
119
|
* @returns {RelativeTimeToDateResult}
|
|
121
120
|
*/
|
|
122
|
-
function relativeTimeToDate(text) {
|
|
123
|
-
let now = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Date();
|
|
121
|
+
function relativeTimeToDate(text, now = new Date()) {
|
|
124
122
|
text = text.toLowerCase();
|
|
125
123
|
let parts = text.split(' ');
|
|
126
124
|
|
|
@@ -164,7 +162,7 @@ function relativeTimeToDate(text) {
|
|
|
164
162
|
if (!(0, _isInteger.default)(val)) {
|
|
165
163
|
return {
|
|
166
164
|
status: 'error',
|
|
167
|
-
info:
|
|
165
|
+
info: `'${num}' is not an integer.`
|
|
168
166
|
};
|
|
169
167
|
}
|
|
170
168
|
switch (interval) {
|
|
@@ -206,7 +204,7 @@ function relativeTimeToDate(text) {
|
|
|
206
204
|
default:
|
|
207
205
|
return {
|
|
208
206
|
status: 'error',
|
|
209
|
-
info:
|
|
207
|
+
info: `Invalid interval: '${interval}'`
|
|
210
208
|
};
|
|
211
209
|
}
|
|
212
210
|
}
|
|
@@ -284,7 +282,7 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
|
|
|
284
282
|
return false;
|
|
285
283
|
}
|
|
286
284
|
if (!/^[A-Za-z][0-9A-Za-z_]*$/.test(key)) {
|
|
287
|
-
throw new _ParseError.default(_ParseError.default.INVALID_KEY_NAME,
|
|
285
|
+
throw new _ParseError.default(_ParseError.default.INVALID_KEY_NAME, `Invalid Key: ${key}`);
|
|
288
286
|
}
|
|
289
287
|
// Equality (or Array contains) cases
|
|
290
288
|
if (typeof constraints !== 'object') {
|
|
@@ -305,17 +303,15 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
|
|
|
305
303
|
}
|
|
306
304
|
// More complex cases
|
|
307
305
|
for (const condition in constraints) {
|
|
308
|
-
var _compareTo, _compareTo2;
|
|
309
306
|
compareTo = constraints[condition];
|
|
310
|
-
if (
|
|
307
|
+
if (compareTo?.__type) {
|
|
311
308
|
compareTo = (0, _decode.default)(compareTo);
|
|
312
309
|
}
|
|
313
310
|
// is it a $relativeTime? convert to date
|
|
314
|
-
if (
|
|
311
|
+
if (compareTo?.['$relativeTime']) {
|
|
315
312
|
const parserResult = relativeTimeToDate(compareTo['$relativeTime']);
|
|
316
313
|
if (parserResult.status !== 'success') {
|
|
317
|
-
|
|
318
|
-
throw new _ParseError.default(_ParseError.default.INVALID_JSON, (0, _concat.default)(_context2 = "bad $relativeTime (".concat(key, ") value. ")).call(_context2, parserResult.info));
|
|
314
|
+
throw new _ParseError.default(_ParseError.default.INVALID_JSON, `bad $relativeTime (${key}) value. ${parserResult.info}`);
|
|
319
315
|
}
|
|
320
316
|
compareTo = parserResult.result;
|
|
321
317
|
}
|
|
@@ -361,8 +357,8 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
|
|
|
361
357
|
break;
|
|
362
358
|
case '$all':
|
|
363
359
|
for (i = 0; i < compareTo.length; i++) {
|
|
364
|
-
var
|
|
365
|
-
if ((0, _indexOf.default)(
|
|
360
|
+
var _context2;
|
|
361
|
+
if ((0, _indexOf.default)(_context2 = object[key]).call(_context2, compareTo[i]) < 0) {
|
|
366
362
|
return false;
|
|
367
363
|
}
|
|
368
364
|
}
|
|
@@ -499,8 +495,8 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
|
|
|
499
495
|
case '$geoWithin':
|
|
500
496
|
{
|
|
501
497
|
if (compareTo.$polygon) {
|
|
502
|
-
var
|
|
503
|
-
const points = (0, _map.default)(
|
|
498
|
+
var _context3;
|
|
499
|
+
const points = (0, _map.default)(_context3 = compareTo.$polygon).call(_context3, geoPoint => [geoPoint.latitude, geoPoint.longitude]);
|
|
504
500
|
const polygon = new _ParsePolygon.default(points);
|
|
505
501
|
return polygon.containsPoint(object[key]);
|
|
506
502
|
}
|
|
@@ -529,22 +525,22 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
|
|
|
529
525
|
return true;
|
|
530
526
|
}
|
|
531
527
|
function validateQuery(query) {
|
|
532
|
-
var
|
|
528
|
+
var _context4;
|
|
533
529
|
let q = query;
|
|
534
530
|
if (query.toJSON) {
|
|
535
531
|
q = query.toJSON().where;
|
|
536
532
|
}
|
|
537
533
|
const specialQuerykeys = ['$and', '$or', '$nor', '_rperm', '_wperm', '_perishable_token', '_email_verify_token', '_email_verify_token_expires_at', '_account_lockout_expires_at', '_failed_login_count'];
|
|
538
|
-
(0, _forEach.default)(
|
|
534
|
+
(0, _forEach.default)(_context4 = (0, _keys.default)(q)).call(_context4, key => {
|
|
539
535
|
if (q && q[key] && q[key].$regex) {
|
|
540
536
|
if (typeof q[key].$options === 'string') {
|
|
541
537
|
if (!q[key].$options.match(/^[imxs]+$/)) {
|
|
542
|
-
throw new _ParseError.default(_ParseError.default.INVALID_QUERY,
|
|
538
|
+
throw new _ParseError.default(_ParseError.default.INVALID_QUERY, `Bad $options value for query: ${q[key].$options}`);
|
|
543
539
|
}
|
|
544
540
|
}
|
|
545
541
|
}
|
|
546
542
|
if ((0, _indexOf.default)(specialQuerykeys).call(specialQuerykeys, key) < 0 && !key.match(/^[a-zA-Z][a-zA-Z0-9_\.]*$/)) {
|
|
547
|
-
throw new _ParseError.default(_ParseError.default.INVALID_KEY_NAME,
|
|
543
|
+
throw new _ParseError.default(_ParseError.default.INVALID_KEY_NAME, `Invalid key name: ${key}`);
|
|
548
544
|
}
|
|
549
545
|
});
|
|
550
546
|
}
|
package/lib/browser/Parse.js
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
|
4
|
-
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
|
|
5
|
-
var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
|
|
6
|
-
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
7
|
-
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
|
8
|
-
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
|
|
9
|
-
var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
|
|
10
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
11
3
|
var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
|
|
4
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
5
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
12
6
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
13
7
|
_Object$defineProperty(exports, "__esModule", {
|
|
14
8
|
value: true
|
|
15
9
|
});
|
|
16
10
|
exports.default = void 0;
|
|
17
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
18
11
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
19
12
|
var _decode2 = _interopRequireDefault(require("./decode"));
|
|
20
13
|
var _encode2 = _interopRequireDefault(require("./encode"));
|
|
@@ -74,28 +67,6 @@ function _interopRequireWildcard(e, t) {
|
|
|
74
67
|
return f;
|
|
75
68
|
})(e, t);
|
|
76
69
|
}
|
|
77
|
-
function ownKeys(e, r) {
|
|
78
|
-
var t = _Object$keys(e);
|
|
79
|
-
if (_Object$getOwnPropertySymbols) {
|
|
80
|
-
var o = _Object$getOwnPropertySymbols(e);
|
|
81
|
-
r && (o = _filterInstanceProperty(o).call(o, function (r) {
|
|
82
|
-
return _Object$getOwnPropertyDescriptor(e, r).enumerable;
|
|
83
|
-
})), t.push.apply(t, o);
|
|
84
|
-
}
|
|
85
|
-
return t;
|
|
86
|
-
}
|
|
87
|
-
function _objectSpread(e) {
|
|
88
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
89
|
-
var _context, _context2;
|
|
90
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
91
|
-
r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) {
|
|
92
|
-
(0, _defineProperty2.default)(e, r, t[r]);
|
|
93
|
-
}) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) {
|
|
94
|
-
_Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r));
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
return e;
|
|
98
|
-
}
|
|
99
70
|
/**
|
|
100
71
|
* The interface for the Parse SDK.
|
|
101
72
|
* This interface can be augmented in build-specific type definitions (e.g., node.d.ts)
|
|
@@ -248,16 +219,10 @@ const Parse = {
|
|
|
248
219
|
get nodeLogging() {
|
|
249
220
|
return _CoreManager.default.get('NODE_LOGGING');
|
|
250
221
|
},
|
|
251
|
-
_request() {
|
|
252
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
253
|
-
args[_key] = arguments[_key];
|
|
254
|
-
}
|
|
222
|
+
_request(...args) {
|
|
255
223
|
return _CoreManager.default.getRESTController().request.apply(null, args);
|
|
256
224
|
},
|
|
257
|
-
_ajax() {
|
|
258
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
259
|
-
args[_key2] = arguments[_key2];
|
|
260
|
-
}
|
|
225
|
+
_ajax(...args) {
|
|
261
226
|
return _CoreManager.default.getRESTController().ajax.apply(null, args);
|
|
262
227
|
},
|
|
263
228
|
// We attempt to match the signatures of the legacy versions of these methods
|