parse 5.2.0-alpha.1 → 5.2.0-alpha.2
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 +10102 -15029
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +10093 -15165
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/Analytics.js +7 -11
- package/lib/browser/AnonymousUtils.js +17 -22
- package/lib/browser/Cloud.js +23 -41
- package/lib/browser/CoreManager.js +71 -79
- package/lib/browser/CryptoController.js +14 -9
- package/lib/browser/EventEmitter.js +9 -2
- package/lib/browser/EventuallyQueue.js +156 -357
- package/lib/browser/FacebookUtils.js +23 -28
- package/lib/browser/IndexedDBStorageController.js +18 -14
- package/lib/browser/InstallationController.js +55 -121
- package/lib/browser/LiveQueryClient.js +308 -484
- package/lib/browser/LiveQuerySubscription.js +25 -28
- package/lib/browser/LocalDatastore.js +258 -624
- package/lib/browser/LocalDatastoreController.default.js +42 -226
- package/lib/browser/LocalDatastoreController.js +11 -1
- package/lib/browser/LocalDatastoreController.react-native.js +66 -160
- package/lib/browser/LocalDatastoreUtils.js +4 -7
- package/lib/browser/ObjectStateMutations.js +54 -96
- package/lib/browser/OfflineQuery.js +106 -198
- package/lib/browser/Parse.js +44 -60
- package/lib/browser/ParseACL.js +242 -288
- package/lib/browser/ParseCLP.js +372 -572
- package/lib/browser/ParseConfig.js +115 -138
- package/lib/browser/ParseError.js +85 -182
- package/lib/browser/ParseFile.js +294 -438
- package/lib/browser/ParseGeoPoint.js +121 -146
- package/lib/browser/ParseHooks.js +23 -25
- package/lib/browser/ParseInstallation.js +225 -367
- package/lib/browser/ParseLiveQuery.js +74 -148
- package/lib/browser/ParseObject.js +2014 -2621
- package/lib/browser/ParseOp.js +343 -484
- package/lib/browser/ParsePolygon.js +101 -120
- package/lib/browser/ParseQuery.js +1708 -2052
- package/lib/browser/ParseRelation.js +99 -118
- package/lib/browser/ParseRole.js +88 -140
- package/lib/browser/ParseSchema.js +372 -434
- package/lib/browser/ParseSession.js +62 -110
- package/lib/browser/ParseUser.js +941 -1284
- package/lib/browser/Push.js +15 -38
- package/lib/browser/RESTController.js +85 -124
- package/lib/browser/SingleInstanceStateController.js +57 -86
- package/lib/browser/Socket.weapp.js +50 -33
- package/lib/browser/Storage.js +23 -28
- package/lib/browser/StorageController.browser.js +16 -13
- package/lib/browser/StorageController.default.js +15 -14
- package/lib/browser/StorageController.js +14 -1
- package/lib/browser/StorageController.react-native.js +31 -30
- package/lib/browser/StorageController.weapp.js +19 -13
- package/lib/browser/TaskQueue.js +31 -43
- package/lib/browser/UniqueInstanceStateController.js +65 -86
- package/lib/browser/WebSocketController.js +11 -4
- package/lib/browser/Xhr.weapp.js +90 -78
- package/lib/browser/arrayContainsObject.js +3 -3
- package/lib/browser/canBeSerialized.js +10 -11
- package/lib/browser/decode.js +11 -11
- package/lib/browser/encode.js +11 -11
- package/lib/browser/equals.js +9 -10
- package/lib/browser/escape.js +2 -2
- package/lib/browser/isRevocableSession.js +1 -1
- package/lib/browser/parseDate.js +10 -10
- package/lib/browser/promiseUtils.js +19 -19
- package/lib/browser/unique.js +4 -4
- package/lib/browser/unsavedChildren.js +20 -21
- package/lib/browser/uuid.js +2 -4
- package/lib/node/Analytics.js +2 -6
- package/lib/node/AnonymousUtils.js +7 -12
- package/lib/node/Cloud.js +8 -8
- package/lib/node/CoreManager.js +59 -67
- package/lib/node/CryptoController.js +8 -3
- package/lib/node/EventEmitter.js +7 -1
- package/lib/node/EventuallyQueue.js +17 -36
- package/lib/node/FacebookUtils.js +1 -5
- package/lib/node/IndexedDBStorageController.js +14 -10
- package/lib/node/InstallationController.js +9 -10
- package/lib/node/LiveQueryClient.js +12 -14
- package/lib/node/LiveQuerySubscription.js +3 -4
- package/lib/node/LocalDatastore.js +20 -20
- package/lib/node/LocalDatastoreController.default.js +8 -9
- package/lib/node/LocalDatastoreController.js +14 -1
- package/lib/node/LocalDatastoreController.react-native.js +25 -21
- package/lib/node/LocalDatastoreUtils.js +4 -7
- package/lib/node/ObjectStateMutations.js +9 -19
- package/lib/node/OfflineQuery.js +37 -23
- package/lib/node/Parse.js +33 -47
- package/lib/node/ParseACL.js +18 -27
- package/lib/node/ParseCLP.js +35 -37
- package/lib/node/ParseConfig.js +7 -14
- package/lib/node/ParseError.js +457 -458
- package/lib/node/ParseFile.js +24 -44
- package/lib/node/ParseGeoPoint.js +16 -17
- package/lib/node/ParseHooks.js +13 -15
- package/lib/node/ParseInstallation.js +7 -8
- package/lib/node/ParseLiveQuery.js +6 -11
- package/lib/node/ParseObject.js +139 -170
- package/lib/node/ParseOp.js +32 -44
- package/lib/node/ParsePolygon.js +11 -17
- package/lib/node/ParseQuery.js +97 -120
- package/lib/node/ParseRelation.js +7 -16
- package/lib/node/ParseRole.js +7 -8
- package/lib/node/ParseSchema.js +26 -39
- package/lib/node/ParseSession.js +7 -8
- package/lib/node/ParseUser.js +73 -84
- package/lib/node/Push.js +4 -9
- package/lib/node/RESTController.js +21 -33
- package/lib/node/SingleInstanceStateController.js +41 -69
- package/lib/node/Socket.weapp.js +23 -2
- package/lib/node/Storage.js +11 -16
- package/lib/node/StorageController.browser.js +10 -8
- package/lib/node/StorageController.default.js +9 -9
- package/lib/node/StorageController.js +16 -1
- package/lib/node/StorageController.react-native.js +17 -17
- package/lib/node/StorageController.weapp.js +14 -8
- package/lib/node/TaskQueue.js +2 -3
- package/lib/node/UniqueInstanceStateController.js +40 -60
- package/lib/node/WebSocketController.js +15 -2
- package/lib/node/Xhr.weapp.js +11 -2
- package/lib/node/arrayContainsObject.js +1 -1
- package/lib/node/canBeSerialized.js +2 -2
- package/lib/node/decode.js +1 -1
- package/lib/node/encode.js +2 -2
- package/lib/node/equals.js +1 -1
- package/lib/node/escape.js +1 -1
- package/lib/node/isRevocableSession.js +1 -1
- package/lib/node/parseDate.js +1 -1
- package/lib/node/promiseUtils.js +7 -7
- package/lib/node/unique.js +2 -2
- package/lib/node/unsavedChildren.js +2 -2
- package/lib/node/uuid.js +2 -4
- package/lib/react-native/Analytics.js +2 -2
- package/lib/react-native/AnonymousUtils.js +3 -4
- package/lib/react-native/CoreManager.js +2 -3
- package/lib/react-native/CryptoController.js +6 -1
- package/lib/react-native/EventEmitter.js +6 -1
- package/lib/react-native/EventuallyQueue.js +1 -2
- package/lib/react-native/FacebookUtils.js +1 -2
- package/lib/react-native/IndexedDBStorageController.js +11 -5
- package/lib/react-native/InstallationController.js +1 -2
- package/lib/react-native/LiveQueryClient.js +2 -4
- package/lib/react-native/LiveQuerySubscription.js +2 -4
- package/lib/react-native/LocalDatastore.js +3 -3
- package/lib/react-native/LocalDatastoreController.default.js +1 -2
- package/lib/react-native/LocalDatastoreController.js +11 -1
- package/lib/react-native/LocalDatastoreController.react-native.js +11 -12
- package/lib/react-native/LocalDatastoreUtils.js +3 -6
- package/lib/react-native/OfflineQuery.js +25 -20
- package/lib/react-native/Parse.js +24 -38
- package/lib/react-native/ParseACL.js +4 -6
- package/lib/react-native/ParseCLP.js +2 -4
- package/lib/react-native/ParseConfig.js +4 -6
- package/lib/react-native/ParseError.js +13 -31
- package/lib/react-native/ParseFile.js +3 -4
- package/lib/react-native/ParseGeoPoint.js +2 -4
- package/lib/react-native/ParseInstallation.js +13 -30
- package/lib/react-native/ParseLiveQuery.js +2 -4
- package/lib/react-native/ParseObject.js +77 -87
- package/lib/react-native/ParseOp.js +41 -79
- package/lib/react-native/ParsePolygon.js +2 -4
- package/lib/react-native/ParseQuery.js +43 -45
- package/lib/react-native/ParseRelation.js +2 -4
- package/lib/react-native/ParseRole.js +13 -30
- package/lib/react-native/ParseSchema.js +3 -5
- package/lib/react-native/ParseSession.js +12 -29
- package/lib/react-native/ParseUser.js +24 -49
- package/lib/react-native/RESTController.js +10 -4
- package/lib/react-native/SingleInstanceStateController.js +23 -37
- package/lib/react-native/Socket.weapp.js +9 -4
- package/lib/react-native/Storage.js +1 -2
- package/lib/react-native/StorageController.browser.js +6 -1
- package/lib/react-native/StorageController.default.js +6 -1
- package/lib/react-native/StorageController.js +13 -1
- package/lib/react-native/StorageController.react-native.js +11 -6
- package/lib/react-native/StorageController.weapp.js +6 -1
- package/lib/react-native/TaskQueue.js +2 -4
- package/lib/react-native/UniqueInstanceStateController.js +23 -37
- package/lib/react-native/WebSocketController.js +9 -1
- package/lib/react-native/Xhr.weapp.js +9 -4
- package/lib/react-native/unsavedChildren.js +3 -3
- package/lib/react-native/uuid.js +1 -2
- package/lib/weapp/Analytics.js +7 -11
- package/lib/weapp/AnonymousUtils.js +17 -22
- package/lib/weapp/Cloud.js +23 -41
- package/lib/weapp/CoreManager.js +71 -79
- package/lib/weapp/CryptoController.js +14 -9
- package/lib/weapp/EventEmitter.js +9 -2
- package/lib/weapp/EventuallyQueue.js +156 -357
- package/lib/weapp/FacebookUtils.js +23 -28
- package/lib/weapp/IndexedDBStorageController.js +18 -14
- package/lib/weapp/InstallationController.js +55 -121
- package/lib/weapp/LiveQueryClient.js +308 -484
- package/lib/weapp/LiveQuerySubscription.js +25 -28
- package/lib/weapp/LocalDatastore.js +258 -624
- package/lib/weapp/LocalDatastoreController.default.js +42 -226
- package/lib/weapp/LocalDatastoreController.js +11 -1
- package/lib/weapp/LocalDatastoreController.react-native.js +66 -160
- package/lib/weapp/LocalDatastoreUtils.js +4 -7
- package/lib/weapp/ObjectStateMutations.js +54 -96
- package/lib/weapp/OfflineQuery.js +106 -198
- package/lib/weapp/Parse.js +44 -59
- package/lib/weapp/ParseACL.js +242 -288
- package/lib/weapp/ParseCLP.js +372 -572
- package/lib/weapp/ParseConfig.js +115 -138
- package/lib/weapp/ParseError.js +85 -182
- package/lib/weapp/ParseFile.js +295 -440
- package/lib/weapp/ParseGeoPoint.js +121 -146
- package/lib/weapp/ParseHooks.js +23 -25
- package/lib/weapp/ParseInstallation.js +225 -367
- package/lib/weapp/ParseLiveQuery.js +74 -148
- package/lib/weapp/ParseObject.js +2014 -2621
- package/lib/weapp/ParseOp.js +343 -484
- package/lib/weapp/ParsePolygon.js +101 -120
- package/lib/weapp/ParseQuery.js +1708 -2052
- package/lib/weapp/ParseRelation.js +99 -118
- package/lib/weapp/ParseRole.js +88 -140
- package/lib/weapp/ParseSchema.js +372 -434
- package/lib/weapp/ParseSession.js +62 -110
- package/lib/weapp/ParseUser.js +941 -1284
- package/lib/weapp/Push.js +15 -38
- package/lib/weapp/RESTController.js +86 -125
- package/lib/weapp/SingleInstanceStateController.js +57 -86
- package/lib/weapp/Socket.weapp.js +50 -33
- package/lib/weapp/Storage.js +23 -28
- package/lib/weapp/StorageController.browser.js +16 -13
- package/lib/weapp/StorageController.default.js +15 -14
- package/lib/weapp/StorageController.js +14 -1
- package/lib/weapp/StorageController.react-native.js +31 -30
- package/lib/weapp/StorageController.weapp.js +19 -13
- package/lib/weapp/TaskQueue.js +31 -43
- package/lib/weapp/UniqueInstanceStateController.js +65 -86
- package/lib/weapp/WebSocketController.js +11 -4
- package/lib/weapp/Xhr.weapp.js +90 -78
- package/lib/weapp/arrayContainsObject.js +3 -3
- package/lib/weapp/canBeSerialized.js +10 -11
- package/lib/weapp/decode.js +11 -11
- package/lib/weapp/encode.js +11 -11
- package/lib/weapp/equals.js +9 -10
- package/lib/weapp/escape.js +2 -2
- package/lib/weapp/isRevocableSession.js +1 -1
- package/lib/weapp/parseDate.js +10 -10
- package/lib/weapp/promiseUtils.js +19 -19
- package/lib/weapp/unique.js +4 -4
- package/lib/weapp/unsavedChildren.js +20 -21
- package/lib/weapp/uuid.js +6 -8
- package/package.json +19 -25
package/lib/node/ParseFile.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
8
8
|
var _ParseError = _interopRequireDefault(require("./ParseError"));
|
|
9
|
+
var _Xhr = _interopRequireDefault(require("./Xhr.weapp"));
|
|
9
10
|
function _interopRequireDefault(obj) {
|
|
10
11
|
return obj && obj.__esModule ? obj : {
|
|
11
12
|
default: obj
|
|
@@ -17,27 +18,7 @@ let XHR = null;
|
|
|
17
18
|
if (typeof XMLHttpRequest !== 'undefined') {
|
|
18
19
|
XHR = XMLHttpRequest;
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
-
metadata?: { [key: string]: any },
|
|
22
|
-
tags?: { [key: string]: any },
|
|
23
|
-
};*/
|
|
24
|
-
/*:: export type FileSource =
|
|
25
|
-
| {
|
|
26
|
-
format: 'file',
|
|
27
|
-
file: Blob,
|
|
28
|
-
type: string | undefined,
|
|
29
|
-
}
|
|
30
|
-
| {
|
|
31
|
-
format: 'base64',
|
|
32
|
-
base64: string,
|
|
33
|
-
type: string | undefined,
|
|
34
|
-
}
|
|
35
|
-
| {
|
|
36
|
-
format: 'uri',
|
|
37
|
-
uri: string,
|
|
38
|
-
type: string | undefined,
|
|
39
|
-
};*/
|
|
40
|
-
function b64Digit(number /*: number*/) /*: string*/{
|
|
21
|
+
function b64Digit(number) {
|
|
41
22
|
if (number < 26) {
|
|
42
23
|
return String.fromCharCode(65 + number);
|
|
43
24
|
}
|
|
@@ -93,7 +74,7 @@ class ParseFile {
|
|
|
93
74
|
* @param metadata {object} Optional key value pairs to be stored with file object
|
|
94
75
|
* @param tags {object} Optional key value pairs to be stored with file object
|
|
95
76
|
*/
|
|
96
|
-
constructor(name
|
|
77
|
+
constructor(name, data, type, metadata, tags) {
|
|
97
78
|
const specifiedType = type || '';
|
|
98
79
|
this._name = name;
|
|
99
80
|
this._metadata = metadata || {};
|
|
@@ -140,7 +121,7 @@ class ParseFile {
|
|
|
140
121
|
*
|
|
141
122
|
* @returns {Promise} Promise that is resolve with base64 data
|
|
142
123
|
*/
|
|
143
|
-
async getData()
|
|
124
|
+
async getData() {
|
|
144
125
|
if (this._data) {
|
|
145
126
|
return this._data;
|
|
146
127
|
}
|
|
@@ -162,7 +143,7 @@ class ParseFile {
|
|
|
162
143
|
*
|
|
163
144
|
* @returns {string}
|
|
164
145
|
*/
|
|
165
|
-
name()
|
|
146
|
+
name() {
|
|
166
147
|
return this._name;
|
|
167
148
|
}
|
|
168
149
|
|
|
@@ -174,7 +155,7 @@ class ParseFile {
|
|
|
174
155
|
* @param {boolean} [options.forceSecure] force the url to be secure
|
|
175
156
|
* @returns {string | undefined}
|
|
176
157
|
*/
|
|
177
|
-
url(options
|
|
158
|
+
url(options) {
|
|
178
159
|
options = options || {};
|
|
179
160
|
if (!this._url) {
|
|
180
161
|
return;
|
|
@@ -227,7 +208,7 @@ class ParseFile {
|
|
|
227
208
|
* </ul>
|
|
228
209
|
* @returns {Promise | undefined} Promise that is resolved when the save finishes.
|
|
229
210
|
*/
|
|
230
|
-
save(options
|
|
211
|
+
save(options) {
|
|
231
212
|
options = options || {};
|
|
232
213
|
options.requestTask = task => this._requestTask = task;
|
|
233
214
|
options.metadata = this._metadata;
|
|
@@ -255,7 +236,7 @@ class ParseFile {
|
|
|
255
236
|
this._data = result.base64;
|
|
256
237
|
this._requestTask = null;
|
|
257
238
|
return controller.saveBase64(this._name, newSource, options);
|
|
258
|
-
}).then(
|
|
239
|
+
}).then(res => {
|
|
259
240
|
this._name = res.name;
|
|
260
241
|
this._url = res.url;
|
|
261
242
|
this._requestTask = null;
|
|
@@ -297,7 +278,7 @@ class ParseFile {
|
|
|
297
278
|
* <pre>
|
|
298
279
|
* @returns {Promise} Promise that is resolved when the delete finishes.
|
|
299
280
|
*/
|
|
300
|
-
destroy(options
|
|
281
|
+
destroy(options = {}) {
|
|
301
282
|
if (!this._name) {
|
|
302
283
|
throw new _ParseError.default(_ParseError.default.FILE_DELETE_UNNAMED_ERROR, 'Cannot delete an unnamed file.');
|
|
303
284
|
}
|
|
@@ -314,14 +295,14 @@ class ParseFile {
|
|
|
314
295
|
return this;
|
|
315
296
|
});
|
|
316
297
|
}
|
|
317
|
-
toJSON()
|
|
298
|
+
toJSON() {
|
|
318
299
|
return {
|
|
319
300
|
__type: 'File',
|
|
320
301
|
name: this._name,
|
|
321
302
|
url: this._url
|
|
322
303
|
};
|
|
323
304
|
}
|
|
324
|
-
equals(other
|
|
305
|
+
equals(other) {
|
|
325
306
|
if (this === other) {
|
|
326
307
|
return true;
|
|
327
308
|
}
|
|
@@ -334,7 +315,7 @@ class ParseFile {
|
|
|
334
315
|
*
|
|
335
316
|
* @param {object} metadata Key value pairs to be stored with file object
|
|
336
317
|
*/
|
|
337
|
-
setMetadata(metadata
|
|
318
|
+
setMetadata(metadata) {
|
|
338
319
|
if (metadata && typeof metadata === 'object') {
|
|
339
320
|
Object.keys(metadata).forEach(key => {
|
|
340
321
|
this.addMetadata(key, metadata[key]);
|
|
@@ -348,7 +329,7 @@ class ParseFile {
|
|
|
348
329
|
* @param {string} key key to store the metadata
|
|
349
330
|
* @param {*} value metadata
|
|
350
331
|
*/
|
|
351
|
-
addMetadata(key
|
|
332
|
+
addMetadata(key, value) {
|
|
352
333
|
if (typeof key === 'string') {
|
|
353
334
|
this._metadata[key] = value;
|
|
354
335
|
}
|
|
@@ -359,7 +340,7 @@ class ParseFile {
|
|
|
359
340
|
*
|
|
360
341
|
* @param {object} tags Key value pairs to be stored with file object
|
|
361
342
|
*/
|
|
362
|
-
setTags(tags
|
|
343
|
+
setTags(tags) {
|
|
363
344
|
if (tags && typeof tags === 'object') {
|
|
364
345
|
Object.keys(tags).forEach(key => {
|
|
365
346
|
this.addTag(key, tags[key]);
|
|
@@ -373,12 +354,12 @@ class ParseFile {
|
|
|
373
354
|
* @param {string} key key to store tags
|
|
374
355
|
* @param {*} value tag
|
|
375
356
|
*/
|
|
376
|
-
addTag(key
|
|
357
|
+
addTag(key, value) {
|
|
377
358
|
if (typeof key === 'string') {
|
|
378
359
|
this._tags[key] = value;
|
|
379
360
|
}
|
|
380
361
|
}
|
|
381
|
-
static fromJSON(obj)
|
|
362
|
+
static fromJSON(obj) {
|
|
382
363
|
if (obj.__type !== 'File') {
|
|
383
364
|
throw new TypeError('JSON object does not represent a ParseFile');
|
|
384
365
|
}
|
|
@@ -386,7 +367,7 @@ class ParseFile {
|
|
|
386
367
|
file._url = obj.url;
|
|
387
368
|
return file;
|
|
388
369
|
}
|
|
389
|
-
static encodeBase64(bytes
|
|
370
|
+
static encodeBase64(bytes) {
|
|
390
371
|
const chunks = [];
|
|
391
372
|
chunks.length = Math.ceil(bytes.length / 3);
|
|
392
373
|
for (let i = 0; i < chunks.length; i++) {
|
|
@@ -401,7 +382,7 @@ class ParseFile {
|
|
|
401
382
|
}
|
|
402
383
|
}
|
|
403
384
|
const DefaultController = {
|
|
404
|
-
saveFile: async function (name
|
|
385
|
+
saveFile: async function (name, source, options) {
|
|
405
386
|
if (source.format !== 'file') {
|
|
406
387
|
throw new Error('saveFile can only be used with File-type sources.');
|
|
407
388
|
}
|
|
@@ -425,11 +406,11 @@ const DefaultController = {
|
|
|
425
406
|
};
|
|
426
407
|
return await DefaultController.saveBase64(name, newSource, options);
|
|
427
408
|
},
|
|
428
|
-
saveBase64: function (name
|
|
409
|
+
saveBase64: function (name, source, options = {}) {
|
|
429
410
|
if (source.format !== 'base64') {
|
|
430
411
|
throw new Error('saveBase64 can only be used with Base64-type sources.');
|
|
431
412
|
}
|
|
432
|
-
const data
|
|
413
|
+
const data = {
|
|
433
414
|
base64: source.base64,
|
|
434
415
|
fileData: {
|
|
435
416
|
metadata: {
|
|
@@ -472,7 +453,7 @@ const DefaultController = {
|
|
|
472
453
|
});
|
|
473
454
|
}
|
|
474
455
|
},
|
|
475
|
-
downloadAjax: function (uri
|
|
456
|
+
downloadAjax: function (uri, options) {
|
|
476
457
|
return new Promise((resolve, reject) => {
|
|
477
458
|
const xhr = new XHR();
|
|
478
459
|
xhr.open('GET', uri, true);
|
|
@@ -497,7 +478,7 @@ const DefaultController = {
|
|
|
497
478
|
xhr.send();
|
|
498
479
|
});
|
|
499
480
|
},
|
|
500
|
-
deleteFile: function (name
|
|
481
|
+
deleteFile: function (name, options) {
|
|
501
482
|
const headers = {
|
|
502
483
|
'X-Parse-Application-ID': _CoreManager.default.get('APPLICATION_ID')
|
|
503
484
|
};
|
|
@@ -518,7 +499,7 @@ const DefaultController = {
|
|
|
518
499
|
}
|
|
519
500
|
});
|
|
520
501
|
},
|
|
521
|
-
_setXHR(xhr
|
|
502
|
+
_setXHR(xhr) {
|
|
522
503
|
XHR = xhr;
|
|
523
504
|
},
|
|
524
505
|
_getXHR() {
|
|
@@ -526,6 +507,5 @@ const DefaultController = {
|
|
|
526
507
|
}
|
|
527
508
|
};
|
|
528
509
|
_CoreManager.default.setFileController(DefaultController);
|
|
529
|
-
var _default = ParseFile;
|
|
530
|
-
exports.default = _default;
|
|
510
|
+
var _default = exports.default = ParseFile;
|
|
531
511
|
exports.b64Digit = b64Digit;
|
|
@@ -33,7 +33,7 @@ class ParseGeoPoint {
|
|
|
33
33
|
* @param {(number[] | object | number)} arg1 Either a list of coordinate pairs, an object with `latitude`, `longitude`, or the latitude or the point.
|
|
34
34
|
* @param {number} arg2 The longitude of the GeoPoint
|
|
35
35
|
*/
|
|
36
|
-
constructor(arg1
|
|
36
|
+
constructor(arg1, arg2) {
|
|
37
37
|
if (Array.isArray(arg1)) {
|
|
38
38
|
ParseGeoPoint._validate(arg1[0], arg1[1]);
|
|
39
39
|
this._latitude = arg1[0];
|
|
@@ -59,10 +59,10 @@ class ParseGeoPoint {
|
|
|
59
59
|
* @property {number} latitude
|
|
60
60
|
* @returns {number}
|
|
61
61
|
*/
|
|
62
|
-
get latitude()
|
|
62
|
+
get latitude() {
|
|
63
63
|
return this._latitude;
|
|
64
64
|
}
|
|
65
|
-
set latitude(val
|
|
65
|
+
set latitude(val) {
|
|
66
66
|
ParseGeoPoint._validate(val, this.longitude);
|
|
67
67
|
this._latitude = val;
|
|
68
68
|
}
|
|
@@ -74,10 +74,10 @@ class ParseGeoPoint {
|
|
|
74
74
|
* @property {number} longitude
|
|
75
75
|
* @returns {number}
|
|
76
76
|
*/
|
|
77
|
-
get longitude()
|
|
77
|
+
get longitude() {
|
|
78
78
|
return this._longitude;
|
|
79
79
|
}
|
|
80
|
-
set longitude(val
|
|
80
|
+
set longitude(val) {
|
|
81
81
|
ParseGeoPoint._validate(this.latitude, val);
|
|
82
82
|
this._longitude = val;
|
|
83
83
|
}
|
|
@@ -87,7 +87,7 @@ class ParseGeoPoint {
|
|
|
87
87
|
*
|
|
88
88
|
* @returns {object}
|
|
89
89
|
*/
|
|
90
|
-
toJSON()
|
|
90
|
+
toJSON() {
|
|
91
91
|
ParseGeoPoint._validate(this._latitude, this._longitude);
|
|
92
92
|
return {
|
|
93
93
|
__type: 'GeoPoint',
|
|
@@ -95,7 +95,7 @@ class ParseGeoPoint {
|
|
|
95
95
|
longitude: this._longitude
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
|
-
equals(other
|
|
98
|
+
equals(other) {
|
|
99
99
|
return other instanceof ParseGeoPoint && this.latitude === other.latitude && this.longitude === other.longitude;
|
|
100
100
|
}
|
|
101
101
|
|
|
@@ -105,7 +105,7 @@ class ParseGeoPoint {
|
|
|
105
105
|
* @param {Parse.GeoPoint} point the other Parse.GeoPoint.
|
|
106
106
|
* @returns {number}
|
|
107
107
|
*/
|
|
108
|
-
radiansTo(point
|
|
108
|
+
radiansTo(point) {
|
|
109
109
|
const d2r = Math.PI / 180.0;
|
|
110
110
|
const lat1rad = this.latitude * d2r;
|
|
111
111
|
const long1rad = this.longitude * d2r;
|
|
@@ -125,7 +125,7 @@ class ParseGeoPoint {
|
|
|
125
125
|
* @param {Parse.GeoPoint} point the other Parse.GeoPoint.
|
|
126
126
|
* @returns {number}
|
|
127
127
|
*/
|
|
128
|
-
kilometersTo(point
|
|
128
|
+
kilometersTo(point) {
|
|
129
129
|
return this.radiansTo(point) * 6371.0;
|
|
130
130
|
}
|
|
131
131
|
|
|
@@ -135,14 +135,14 @@ class ParseGeoPoint {
|
|
|
135
135
|
* @param {Parse.GeoPoint} point the other Parse.GeoPoint.
|
|
136
136
|
* @returns {number}
|
|
137
137
|
*/
|
|
138
|
-
milesTo(point
|
|
138
|
+
milesTo(point) {
|
|
139
139
|
return this.radiansTo(point) * 3958.8;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
/*
|
|
143
143
|
* Throws an exception if the given lat-long is out of bounds.
|
|
144
144
|
*/
|
|
145
|
-
static _validate(latitude
|
|
145
|
+
static _validate(latitude, longitude) {
|
|
146
146
|
if (isNaN(latitude) || isNaN(longitude) || typeof latitude !== 'number' || typeof longitude !== 'number') {
|
|
147
147
|
throw new TypeError('GeoPoint latitude and longitude must be valid numbers');
|
|
148
148
|
}
|
|
@@ -164,19 +164,19 @@ class ParseGeoPoint {
|
|
|
164
164
|
* Creates a GeoPoint with the user's current location, if available.
|
|
165
165
|
*
|
|
166
166
|
* @param {object} options The options.
|
|
167
|
-
* @param {boolean} [options.enableHighAccuracy
|
|
167
|
+
* @param {boolean} [options.enableHighAccuracy] A boolean value that indicates the application would like to receive the best possible results.
|
|
168
168
|
* If true and if the device is able to provide a more accurate position, it will do so.
|
|
169
169
|
* Note that this can result in slower response times or increased power consumption (with a GPS chip on a mobile device for example).
|
|
170
170
|
* On the other hand, if false, the device can take the liberty to save resources by responding more quickly and/or using less power. Default: false.
|
|
171
|
-
* @param {number} [options.timeout
|
|
171
|
+
* @param {number} [options.timeout] A positive long value representing the maximum length of time (in milliseconds) the device is allowed to take in order to return a position.
|
|
172
172
|
* The default value is Infinity, meaning that getCurrentPosition() won't return until the position is available.
|
|
173
|
-
* @param {number} [options.maximumAge
|
|
173
|
+
* @param {number} [options.maximumAge] A positive long value indicating the maximum age in milliseconds of a possible cached position that is acceptable to return.
|
|
174
174
|
* If set to 0, it means that the device cannot use a cached position and must attempt to retrieve the real current position.
|
|
175
175
|
* If set to Infinity the device must return a cached position regardless of its age. Default: 0.
|
|
176
176
|
* @static
|
|
177
177
|
* @returns {Promise<Parse.GeoPoint>} User's current location
|
|
178
178
|
*/
|
|
179
|
-
static current(options)
|
|
179
|
+
static current(options) {
|
|
180
180
|
return new Promise((resolve, reject) => {
|
|
181
181
|
navigator.geolocation.getCurrentPosition(location => {
|
|
182
182
|
resolve(new ParseGeoPoint(location.coords.latitude, location.coords.longitude));
|
|
@@ -184,5 +184,4 @@ class ParseGeoPoint {
|
|
|
184
184
|
});
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
|
-
var _default = ParseGeoPoint;
|
|
188
|
-
exports.default = _default;
|
|
187
|
+
var _default = exports.default = ParseGeoPoint;
|
package/lib/node/ParseHooks.js
CHANGED
|
@@ -24,68 +24,66 @@ function _interopRequireDefault(obj) {
|
|
|
24
24
|
default: obj
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
/*:: export type HookDeclaration = { functionName: string, url: string } | { className: string, triggerName: string, url: string };*/
|
|
28
|
-
/*:: export type HookDeleteArg = { functionName: string } | { className: string, triggerName: string };*/
|
|
29
27
|
function getFunctions() {
|
|
30
28
|
return _CoreManager.default.getHooksController().get('functions');
|
|
31
29
|
}
|
|
32
30
|
function getTriggers() {
|
|
33
31
|
return _CoreManager.default.getHooksController().get('triggers');
|
|
34
32
|
}
|
|
35
|
-
function getFunction(name
|
|
33
|
+
function getFunction(name) {
|
|
36
34
|
return _CoreManager.default.getHooksController().get('functions', name);
|
|
37
35
|
}
|
|
38
|
-
function getTrigger(className
|
|
36
|
+
function getTrigger(className, triggerName) {
|
|
39
37
|
return _CoreManager.default.getHooksController().get('triggers', className, triggerName);
|
|
40
38
|
}
|
|
41
|
-
function createFunction(functionName
|
|
39
|
+
function createFunction(functionName, url) {
|
|
42
40
|
return create({
|
|
43
41
|
functionName: functionName,
|
|
44
42
|
url: url
|
|
45
43
|
});
|
|
46
44
|
}
|
|
47
|
-
function createTrigger(className
|
|
45
|
+
function createTrigger(className, triggerName, url) {
|
|
48
46
|
return create({
|
|
49
47
|
className: className,
|
|
50
48
|
triggerName: triggerName,
|
|
51
49
|
url: url
|
|
52
50
|
});
|
|
53
51
|
}
|
|
54
|
-
function create(hook
|
|
52
|
+
function create(hook) {
|
|
55
53
|
return _CoreManager.default.getHooksController().create(hook);
|
|
56
54
|
}
|
|
57
|
-
function updateFunction(functionName
|
|
55
|
+
function updateFunction(functionName, url) {
|
|
58
56
|
return update({
|
|
59
57
|
functionName: functionName,
|
|
60
58
|
url: url
|
|
61
59
|
});
|
|
62
60
|
}
|
|
63
|
-
function updateTrigger(className
|
|
61
|
+
function updateTrigger(className, triggerName, url) {
|
|
64
62
|
return update({
|
|
65
63
|
className: className,
|
|
66
64
|
triggerName: triggerName,
|
|
67
65
|
url: url
|
|
68
66
|
});
|
|
69
67
|
}
|
|
70
|
-
function update(hook
|
|
68
|
+
function update(hook) {
|
|
71
69
|
return _CoreManager.default.getHooksController().update(hook);
|
|
72
70
|
}
|
|
73
|
-
function removeFunction(functionName
|
|
71
|
+
function removeFunction(functionName) {
|
|
74
72
|
return remove({
|
|
75
73
|
functionName: functionName
|
|
76
74
|
});
|
|
77
75
|
}
|
|
78
|
-
function removeTrigger(className
|
|
76
|
+
function removeTrigger(className, triggerName) {
|
|
79
77
|
return remove({
|
|
80
78
|
className: className,
|
|
81
79
|
triggerName: triggerName
|
|
82
80
|
});
|
|
83
81
|
}
|
|
84
|
-
function remove(hook
|
|
82
|
+
function remove(hook) {
|
|
85
83
|
return _CoreManager.default.getHooksController().remove(hook);
|
|
86
84
|
}
|
|
87
85
|
const DefaultController = {
|
|
88
|
-
get(type
|
|
86
|
+
get(type, functionName, triggerName) {
|
|
89
87
|
let url = '/hooks/' + type;
|
|
90
88
|
if (functionName) {
|
|
91
89
|
url += '/' + functionName;
|
|
@@ -145,7 +143,7 @@ const DefaultController = {
|
|
|
145
143
|
}
|
|
146
144
|
return this.sendRequest('PUT', url, hook);
|
|
147
145
|
},
|
|
148
|
-
sendRequest(method
|
|
146
|
+
sendRequest(method, url, body) {
|
|
149
147
|
return _CoreManager.default.getRESTController().request(method, url, body, {
|
|
150
148
|
useMasterKey: true
|
|
151
149
|
}).then(res => {
|
|
@@ -12,7 +12,7 @@ function _interopRequireDefault(obj) {
|
|
|
12
12
|
default: obj
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
const DEVICE_TYPES
|
|
15
|
+
const DEVICE_TYPES = {
|
|
16
16
|
IOS: 'ios',
|
|
17
17
|
MACOS: 'macos',
|
|
18
18
|
TVOS: 'tvos',
|
|
@@ -36,7 +36,7 @@ class ParseInstallation extends _ParseObject.default {
|
|
|
36
36
|
/**
|
|
37
37
|
* @param {object} attributes The initial set of data to store in the object.
|
|
38
38
|
*/
|
|
39
|
-
constructor(attributes
|
|
39
|
+
constructor(attributes) {
|
|
40
40
|
super('_Installation');
|
|
41
41
|
if (attributes && typeof attributes === 'object') {
|
|
42
42
|
if (!this.set(attributes)) {
|
|
@@ -206,7 +206,7 @@ class ParseInstallation extends _ParseObject.default {
|
|
|
206
206
|
* @static
|
|
207
207
|
* @returns {object}
|
|
208
208
|
*/
|
|
209
|
-
static get DEVICE_TYPES()
|
|
209
|
+
static get DEVICE_TYPES() {
|
|
210
210
|
return DEVICE_TYPES;
|
|
211
211
|
}
|
|
212
212
|
|
|
@@ -217,7 +217,7 @@ class ParseInstallation extends _ParseObject.default {
|
|
|
217
217
|
* @param {...any} args
|
|
218
218
|
* @returns {Promise}
|
|
219
219
|
*/
|
|
220
|
-
async fetch(...args)
|
|
220
|
+
async fetch(...args) {
|
|
221
221
|
try {
|
|
222
222
|
await super.fetch.apply(this, args);
|
|
223
223
|
} catch (e) {
|
|
@@ -242,7 +242,7 @@ class ParseInstallation extends _ParseObject.default {
|
|
|
242
242
|
* @param {...any} args
|
|
243
243
|
* @returns {Promise}
|
|
244
244
|
*/
|
|
245
|
-
async save(...args)
|
|
245
|
+
async save(...args) {
|
|
246
246
|
try {
|
|
247
247
|
await super.save.apply(this, args);
|
|
248
248
|
} catch (e) {
|
|
@@ -276,11 +276,10 @@ class ParseInstallation extends _ParseObject.default {
|
|
|
276
276
|
*
|
|
277
277
|
* @returns {Promise} A promise that resolves to the local installation object.
|
|
278
278
|
*/
|
|
279
|
-
static currentInstallation()
|
|
279
|
+
static currentInstallation() {
|
|
280
280
|
return _CoreManager.default.getInstallationController().currentInstallation();
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
283
|
_ParseObject.default.registerSubclass('_Installation', ParseInstallation);
|
|
284
284
|
module.exports = ParseInstallation;
|
|
285
|
-
var _default = ParseInstallation;
|
|
286
|
-
exports.default = _default;
|
|
285
|
+
var _default = exports.default = ParseInstallation;
|
|
@@ -11,11 +11,7 @@ function _interopRequireDefault(obj) {
|
|
|
11
11
|
default: obj
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
* @flow
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
function getLiveQueryClient() /*: Promise<LiveQueryClient>*/{
|
|
14
|
+
function getLiveQueryClient() {
|
|
19
15
|
return _CoreManager.default.getLiveQueryController().getDefaultLiveQueryClient();
|
|
20
16
|
}
|
|
21
17
|
|
|
@@ -61,7 +57,7 @@ class LiveQuery {
|
|
|
61
57
|
* After open is called, the LiveQuery will try to send a connect request
|
|
62
58
|
* to the LiveQuery server.
|
|
63
59
|
*/
|
|
64
|
-
async open()
|
|
60
|
+
async open() {
|
|
65
61
|
const liveQueryClient = await getLiveQueryClient();
|
|
66
62
|
liveQueryClient.open();
|
|
67
63
|
}
|
|
@@ -73,19 +69,18 @@ class LiveQuery {
|
|
|
73
69
|
* If you call query.subscribe() after this, we'll create a new WebSocket
|
|
74
70
|
* connection to the LiveQuery server.
|
|
75
71
|
*/
|
|
76
|
-
async close()
|
|
72
|
+
async close() {
|
|
77
73
|
const liveQueryClient = await getLiveQueryClient();
|
|
78
74
|
liveQueryClient.close();
|
|
79
75
|
}
|
|
80
76
|
}
|
|
81
|
-
var _default = LiveQuery;
|
|
82
|
-
exports.default = _default;
|
|
77
|
+
var _default = exports.default = LiveQuery;
|
|
83
78
|
let defaultLiveQueryClient;
|
|
84
79
|
const DefaultLiveQueryController = {
|
|
85
|
-
setDefaultLiveQueryClient(liveQueryClient
|
|
80
|
+
setDefaultLiveQueryClient(liveQueryClient) {
|
|
86
81
|
defaultLiveQueryClient = liveQueryClient;
|
|
87
82
|
},
|
|
88
|
-
async getDefaultLiveQueryClient()
|
|
83
|
+
async getDefaultLiveQueryClient() {
|
|
89
84
|
if (defaultLiveQueryClient) {
|
|
90
85
|
return defaultLiveQueryClient;
|
|
91
86
|
}
|