parse 5.3.0 → 6.0.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/README.md +6 -5
- package/dist/parse.js +829 -884
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +829 -882
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/Cloud.js +12 -16
- package/lib/browser/CoreManager.js +3 -3
- package/lib/browser/FacebookUtils.js +1 -1
- package/lib/browser/LocalDatastoreController.react-native.js +1 -1
- package/lib/browser/OfflineQuery.js +5 -9
- package/lib/browser/Parse.js +1 -3
- package/lib/browser/ParseConfig.js +1 -1
- package/lib/browser/ParseFile.js +1 -2
- package/lib/browser/ParseHooks.js +7 -7
- package/lib/browser/ParseInstallation.js +3 -1
- package/lib/browser/ParseObject.js +160 -163
- package/lib/browser/ParseQuery.js +22 -89
- package/lib/browser/ParseSession.js +4 -6
- package/lib/browser/ParseUser.js +44 -58
- package/lib/browser/Push.js +2 -2
- package/lib/browser/RESTController.js +2 -2
- package/lib/browser/Storage.js +1 -1
- package/lib/browser/StorageController.default.js +2 -2
- package/lib/browser/StorageController.weapp.js +1 -1
- package/lib/node/Cloud.js +12 -16
- package/lib/node/CoreManager.js +3 -3
- package/lib/node/FacebookUtils.js +1 -1
- package/lib/node/LocalDatastoreController.react-native.js +1 -1
- package/lib/node/OfflineQuery.js +5 -9
- package/lib/node/Parse.js +1 -1
- package/lib/node/ParseConfig.js +1 -1
- package/lib/node/ParseFile.js +1 -2
- package/lib/node/ParseHooks.js +7 -7
- package/lib/node/ParseInstallation.js +3 -1
- package/lib/node/ParseObject.js +155 -158
- package/lib/node/ParseQuery.js +22 -89
- package/lib/node/ParseSession.js +4 -6
- package/lib/node/ParseUser.js +44 -58
- package/lib/node/Push.js +2 -2
- package/lib/node/RESTController.js +2 -2
- package/lib/node/Storage.js +1 -1
- package/lib/node/StorageController.default.js +2 -2
- package/lib/node/StorageController.weapp.js +1 -1
- package/lib/react-native/Cloud.js +4 -16
- package/lib/react-native/CoreManager.js +3 -3
- package/lib/react-native/LocalDatastoreController.react-native.js +1 -1
- package/lib/react-native/OfflineQuery.js +5 -5
- package/lib/react-native/ParseConfig.js +1 -1
- package/lib/react-native/ParseFile.js +1 -1
- package/lib/react-native/ParseHooks.js +7 -7
- package/lib/react-native/ParseInstallation.js +14 -6
- package/lib/react-native/ParseObject.js +147 -163
- package/lib/react-native/ParseQuery.js +21 -89
- package/lib/react-native/ParseRole.js +8 -2
- package/lib/react-native/ParseSession.js +4 -6
- package/lib/react-native/ParseUser.js +28 -63
- package/lib/react-native/Push.js +2 -2
- package/lib/react-native/RESTController.js +11 -10
- package/lib/react-native/Storage.js +1 -1
- package/lib/react-native/StorageController.default.js +2 -2
- package/lib/react-native/StorageController.weapp.js +1 -1
- package/lib/weapp/Cloud.js +12 -16
- package/lib/weapp/CoreManager.js +3 -3
- package/lib/weapp/FacebookUtils.js +1 -1
- package/lib/weapp/LocalDatastoreController.react-native.js +1 -1
- package/lib/weapp/OfflineQuery.js +5 -9
- package/lib/weapp/Parse.js +1 -1
- package/lib/weapp/ParseConfig.js +1 -1
- package/lib/weapp/ParseFile.js +1 -2
- package/lib/weapp/ParseHooks.js +7 -7
- package/lib/weapp/ParseInstallation.js +3 -1
- package/lib/weapp/ParseObject.js +160 -163
- package/lib/weapp/ParseQuery.js +22 -89
- package/lib/weapp/ParseSession.js +4 -6
- package/lib/weapp/ParseUser.js +44 -58
- package/lib/weapp/Push.js +2 -2
- package/lib/weapp/RESTController.js +2 -2
- package/lib/weapp/Storage.js +1 -1
- package/lib/weapp/StorageController.default.js +2 -2
- package/lib/weapp/StorageController.weapp.js +1 -1
- package/package.json +30 -28
package/lib/weapp/CoreManager.js
CHANGED
|
@@ -19,7 +19,7 @@ const config = {
|
|
|
19
19
|
SERVER_AUTH_TOKEN: null,
|
|
20
20
|
LIVEQUERY_SERVER_URL: null,
|
|
21
21
|
ENCRYPTED_KEY: null,
|
|
22
|
-
VERSION: 'js' + "
|
|
22
|
+
VERSION: 'js' + "6.0.0-alpha.2",
|
|
23
23
|
APPLICATION_ID: null,
|
|
24
24
|
JAVASCRIPT_KEY: null,
|
|
25
25
|
MASTER_KEY: null,
|
|
@@ -40,7 +40,7 @@ function requireMethods(name, methods, controller) {
|
|
|
40
40
|
}
|
|
41
41
|
const CoreManager = {
|
|
42
42
|
get: function (key) {
|
|
43
|
-
if (
|
|
43
|
+
if (Object.hasOwn(config, key)) {
|
|
44
44
|
return config[key];
|
|
45
45
|
}
|
|
46
46
|
throw new Error('Configuration key not found: ' + key);
|
|
@@ -49,7 +49,7 @@ const CoreManager = {
|
|
|
49
49
|
config[key] = value;
|
|
50
50
|
},
|
|
51
51
|
setIfNeeded: function (key, value) {
|
|
52
|
-
if (!
|
|
52
|
+
if (!Object.hasOwn(config, key)) {
|
|
53
53
|
config[key] = value;
|
|
54
54
|
}
|
|
55
55
|
return config[key];
|
|
@@ -103,7 +103,7 @@ const FacebookUtils = {
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
if (initOptions.status && typeof console !== 'undefined') {
|
|
106
|
-
const warn = console.warn || console.log || function () {};
|
|
106
|
+
const warn = console.warn || console.log || function () {};
|
|
107
107
|
warn.call(console, 'The "status" flag passed into' + ' FB.init, when set to true, can interfere with Parse Facebook' + ' integration, so it has been suppressed. Please call' + ' FB.getLoginStatus() explicitly if you require this behavior.');
|
|
108
108
|
}
|
|
109
109
|
initOptions.status = false;
|
|
@@ -317,11 +317,7 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
|
|
|
317
317
|
compareTo = parserResult.result;
|
|
318
318
|
}
|
|
319
319
|
// Compare Date Object or Date String
|
|
320
|
-
if (toString.call(compareTo) === '[object Date]' || typeof compareTo === 'string' &&
|
|
321
|
-
// @ts-ignore
|
|
322
|
-
new Date(compareTo) !== 'Invalid Date' &&
|
|
323
|
-
// @ts-ignore
|
|
324
|
-
!isNaN(new Date(compareTo))) {
|
|
320
|
+
if (toString.call(compareTo) === '[object Date]' || typeof compareTo === 'string' && new Date(compareTo).toString() !== 'Invalid Date') {
|
|
325
321
|
object[key] = new Date(object[key].iso ? object[key].iso : object[key]);
|
|
326
322
|
}
|
|
327
323
|
switch (condition) {
|
|
@@ -442,7 +438,7 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
|
|
|
442
438
|
break;
|
|
443
439
|
case '$select':
|
|
444
440
|
{
|
|
445
|
-
const subQueryObjects = (0, _filter.default)(objects).call(objects, (obj,
|
|
441
|
+
const subQueryObjects = (0, _filter.default)(objects).call(objects, (obj, _index, arr) => {
|
|
446
442
|
return matchesQuery(compareTo.query.className, obj, arr, compareTo.query.where);
|
|
447
443
|
});
|
|
448
444
|
for (let i = 0; i < subQueryObjects.length; i += 1) {
|
|
@@ -453,7 +449,7 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
|
|
|
453
449
|
}
|
|
454
450
|
case '$dontSelect':
|
|
455
451
|
{
|
|
456
|
-
const subQueryObjects = (0, _filter.default)(objects).call(objects, (obj,
|
|
452
|
+
const subQueryObjects = (0, _filter.default)(objects).call(objects, (obj, _index, arr) => {
|
|
457
453
|
return matchesQuery(compareTo.query.className, obj, arr, compareTo.query.where);
|
|
458
454
|
});
|
|
459
455
|
for (let i = 0; i < subQueryObjects.length; i += 1) {
|
|
@@ -464,7 +460,7 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
|
|
|
464
460
|
}
|
|
465
461
|
case '$inQuery':
|
|
466
462
|
{
|
|
467
|
-
const subQueryObjects = (0, _filter.default)(objects).call(objects, (obj,
|
|
463
|
+
const subQueryObjects = (0, _filter.default)(objects).call(objects, (obj, _index, arr) => {
|
|
468
464
|
return matchesQuery(compareTo.className, obj, arr, compareTo.where);
|
|
469
465
|
});
|
|
470
466
|
for (let i = 0; i < subQueryObjects.length; i += 1) {
|
|
@@ -477,7 +473,7 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
|
|
|
477
473
|
}
|
|
478
474
|
case '$notInQuery':
|
|
479
475
|
{
|
|
480
|
-
const subQueryObjects = (0, _filter.default)(objects).call(objects, (obj,
|
|
476
|
+
const subQueryObjects = (0, _filter.default)(objects).call(objects, (obj, _index, arr) => {
|
|
481
477
|
return matchesQuery(compareTo.className, obj, arr, compareTo.where);
|
|
482
478
|
});
|
|
483
479
|
for (let i = 0; i < subQueryObjects.length; i += 1) {
|
package/lib/weapp/Parse.js
CHANGED
|
@@ -367,7 +367,7 @@ const Parse = {
|
|
|
367
367
|
*/
|
|
368
368
|
dumpLocalDatastore() {
|
|
369
369
|
if (!this.LocalDatastore.isEnabled) {
|
|
370
|
-
console.log('Parse.enableLocalDatastore() must be called first');
|
|
370
|
+
console.log('Parse.enableLocalDatastore() must be called first');
|
|
371
371
|
return _promise.default.resolve({});
|
|
372
372
|
} else {
|
|
373
373
|
return Parse.LocalDatastore._getAllContents();
|
package/lib/weapp/ParseConfig.js
CHANGED
package/lib/weapp/ParseFile.js
CHANGED
|
@@ -300,7 +300,7 @@ class ParseFile {
|
|
|
300
300
|
const destroyOptions = {
|
|
301
301
|
useMasterKey: true
|
|
302
302
|
};
|
|
303
|
-
if (
|
|
303
|
+
if (Object.hasOwn(options, 'useMasterKey')) {
|
|
304
304
|
destroyOptions.useMasterKey = !!options.useMasterKey;
|
|
305
305
|
}
|
|
306
306
|
const controller = _CoreManager.default.getFileController();
|
|
@@ -404,7 +404,6 @@ const DefaultController = {
|
|
|
404
404
|
throw new Error('saveFile can only be used with File-type sources.');
|
|
405
405
|
}
|
|
406
406
|
const base64Data = await new _promise.default((res, rej) => {
|
|
407
|
-
// eslint-disable-next-line no-undef
|
|
408
407
|
const reader = new FileReader();
|
|
409
408
|
reader.onload = () => res(reader.result);
|
|
410
409
|
reader.onerror = error => rej(error);
|
package/lib/weapp/ParseHooks.js
CHANGED
|
@@ -82,7 +82,7 @@ function remove(hook) {
|
|
|
82
82
|
}
|
|
83
83
|
const DefaultController = {
|
|
84
84
|
get(type, functionName, triggerName) {
|
|
85
|
-
let url = '
|
|
85
|
+
let url = 'hooks/' + type;
|
|
86
86
|
if (functionName) {
|
|
87
87
|
url += '/' + functionName;
|
|
88
88
|
if (triggerName) {
|
|
@@ -94,9 +94,9 @@ const DefaultController = {
|
|
|
94
94
|
create(hook) {
|
|
95
95
|
let url;
|
|
96
96
|
if (hook.functionName && hook.url) {
|
|
97
|
-
url = '
|
|
97
|
+
url = 'hooks/functions';
|
|
98
98
|
} else if (hook.className && hook.triggerName && hook.url) {
|
|
99
|
-
url = '
|
|
99
|
+
url = 'hooks/triggers';
|
|
100
100
|
} else {
|
|
101
101
|
return _promise.default.reject({
|
|
102
102
|
error: 'invalid hook declaration',
|
|
@@ -108,10 +108,10 @@ const DefaultController = {
|
|
|
108
108
|
remove(hook) {
|
|
109
109
|
let url;
|
|
110
110
|
if (hook.functionName) {
|
|
111
|
-
url = '
|
|
111
|
+
url = 'hooks/functions/' + hook.functionName;
|
|
112
112
|
delete hook.functionName;
|
|
113
113
|
} else if (hook.className && hook.triggerName) {
|
|
114
|
-
url = '
|
|
114
|
+
url = 'hooks/triggers/' + hook.className + '/' + hook.triggerName;
|
|
115
115
|
delete hook.className;
|
|
116
116
|
delete hook.triggerName;
|
|
117
117
|
} else {
|
|
@@ -127,10 +127,10 @@ const DefaultController = {
|
|
|
127
127
|
update(hook) {
|
|
128
128
|
let url;
|
|
129
129
|
if (hook.functionName && hook.url) {
|
|
130
|
-
url = '
|
|
130
|
+
url = 'hooks/functions/' + hook.functionName;
|
|
131
131
|
delete hook.functionName;
|
|
132
132
|
} else if (hook.className && hook.triggerName && hook.url) {
|
|
133
|
-
url = '
|
|
133
|
+
url = 'hooks/triggers/' + hook.className + '/' + hook.triggerName;
|
|
134
134
|
delete hook.className;
|
|
135
135
|
delete hook.triggerName;
|
|
136
136
|
} else {
|
|
@@ -37,7 +37,9 @@ class ParseInstallation extends _ParseObject.default {
|
|
|
37
37
|
constructor(attributes) {
|
|
38
38
|
super('_Installation');
|
|
39
39
|
if (attributes && typeof attributes === 'object') {
|
|
40
|
-
|
|
40
|
+
try {
|
|
41
|
+
this.set(attributes || {});
|
|
42
|
+
} catch (_) {
|
|
41
43
|
throw new Error("Can't create an invalid Installation");
|
|
42
44
|
}
|
|
43
45
|
}
|