parse 3.1.0 → 3.3.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/README.md +32 -41
- package/dist/parse.js +2973 -1735
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +2989 -1830
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/AnonymousUtils.js +15 -1
- package/lib/browser/Cloud.js +2 -2
- package/lib/browser/CoreManager.js +1 -1
- package/lib/browser/InstallationController.js +1 -1
- package/lib/browser/LiveQueryClient.js +4 -6
- package/lib/browser/LiveQuerySubscription.js +1 -1
- package/lib/browser/LocalDatastore.js +3 -5
- package/lib/browser/LocalDatastoreController.js +3 -5
- package/lib/browser/LocalDatastoreUtils.js +1 -1
- package/lib/browser/ObjectStateMutations.js +28 -10
- package/lib/browser/OfflineQuery.js +197 -22
- package/lib/browser/Parse.js +57 -2
- package/lib/browser/ParseCLP.js +9 -8
- package/lib/browser/ParseError.js +9 -1
- package/lib/browser/ParseFile.js +6 -3
- package/lib/browser/ParseHooks.js +9 -9
- package/lib/browser/ParseInstallation.js +1 -1
- package/lib/browser/ParseObject.js +100 -32
- package/lib/browser/ParseOp.js +2 -6
- package/lib/browser/ParseQuery.js +1 -1
- package/lib/browser/ParseRole.js +1 -1
- package/lib/browser/ParseSession.js +1 -1
- package/lib/browser/ParseUser.js +20 -64
- package/lib/browser/Push.js +1 -1
- package/lib/browser/RESTController.js +7 -4
- package/lib/browser/SingleInstanceStateController.js +67 -14
- package/lib/browser/UniqueInstanceStateController.js +68 -15
- package/lib/browser/promiseUtils.js +1 -1
- package/lib/browser/uuid.js +5 -0
- package/lib/node/AnonymousUtils.js +15 -1
- package/lib/node/Cloud.js +2 -2
- package/lib/node/CoreManager.js +1 -1
- package/lib/node/InstallationController.js +1 -1
- package/lib/node/LocalDatastoreUtils.js +1 -1
- package/lib/node/ObjectStateMutations.js +29 -10
- package/lib/node/OfflineQuery.js +162 -0
- package/lib/node/Parse.js +10 -12
- package/lib/node/ParseCLP.js +7 -3
- package/lib/node/ParseError.js +8 -0
- package/lib/node/ParseFile.js +7 -3
- package/lib/node/ParseHooks.js +9 -9
- package/lib/node/ParseObject.js +48 -31
- package/lib/node/ParseOp.js +1 -5
- package/lib/node/ParseQuery.js +1 -1
- package/lib/node/ParseUser.js +2 -21
- package/lib/node/Push.js +1 -1
- package/lib/node/RESTController.js +8 -4
- package/lib/node/SingleInstanceStateController.js +23 -25
- package/lib/node/UniqueInstanceStateController.js +23 -25
- package/lib/node/promiseUtils.js +2 -2
- package/lib/node/uuid.js +5 -0
- package/lib/react-native/AnonymousUtils.js +4 -1
- package/lib/react-native/Cloud.js +2 -2
- package/lib/react-native/CoreManager.js +1 -1
- package/lib/react-native/EventEmitter.js +4 -0
- package/lib/react-native/InstallationController.js +1 -1
- package/lib/react-native/LiveQueryClient.js +16 -20
- package/lib/react-native/LiveQuerySubscription.js +1 -1
- package/lib/react-native/LocalDatastore.js +15 -19
- package/lib/react-native/LocalDatastoreController.js +15 -19
- package/lib/react-native/LocalDatastoreUtils.js +1 -1
- package/lib/react-native/ObjectStateMutations.js +29 -10
- package/lib/react-native/OfflineQuery.js +171 -27
- package/lib/react-native/Parse.js +50 -2
- package/lib/react-native/ParseCLP.js +22 -22
- package/lib/react-native/ParseError.js +2 -1
- package/lib/react-native/ParseFile.js +7 -3
- package/lib/react-native/ParseHooks.js +9 -9
- package/lib/react-native/ParseInstallation.js +1 -1
- package/lib/react-native/ParseObject.js +91 -39
- package/lib/react-native/ParseOp.js +2 -2
- package/lib/react-native/ParseRole.js +1 -1
- package/lib/react-native/ParseSession.js +1 -1
- package/lib/react-native/ParseUser.js +17 -56
- package/lib/react-native/Push.js +1 -1
- package/lib/react-native/RESTController.js +8 -4
- package/lib/react-native/SingleInstanceStateController.js +63 -15
- package/lib/react-native/UniqueInstanceStateController.js +63 -15
- package/lib/react-native/promiseUtils.js +1 -1
- package/lib/react-native/uuid.js +3 -0
- package/lib/weapp/AnonymousUtils.js +15 -1
- package/lib/weapp/Cloud.js +2 -2
- package/lib/weapp/CoreManager.js +1 -1
- package/lib/weapp/InstallationController.js +1 -1
- package/lib/weapp/LiveQueryClient.js +4 -6
- package/lib/weapp/LiveQuerySubscription.js +1 -1
- package/lib/weapp/LocalDatastore.js +3 -5
- package/lib/weapp/LocalDatastoreController.js +3 -5
- package/lib/weapp/LocalDatastoreUtils.js +1 -1
- package/lib/weapp/ObjectStateMutations.js +28 -10
- package/lib/weapp/OfflineQuery.js +197 -22
- package/lib/weapp/Parse.js +57 -2
- package/lib/weapp/ParseCLP.js +9 -8
- package/lib/weapp/ParseError.js +9 -1
- package/lib/weapp/ParseFile.js +6 -3
- package/lib/weapp/ParseHooks.js +9 -9
- package/lib/weapp/ParseInstallation.js +1 -1
- package/lib/weapp/ParseObject.js +100 -32
- package/lib/weapp/ParseOp.js +2 -6
- package/lib/weapp/ParseQuery.js +1 -1
- package/lib/weapp/ParseRole.js +1 -1
- package/lib/weapp/ParseSession.js +1 -1
- package/lib/weapp/ParseUser.js +20 -64
- package/lib/weapp/Push.js +1 -1
- package/lib/weapp/RESTController.js +7 -4
- package/lib/weapp/SingleInstanceStateController.js +67 -14
- package/lib/weapp/UniqueInstanceStateController.js +68 -15
- package/lib/weapp/promiseUtils.js +1 -1
- package/lib/weapp/uuid.js +21 -0
- package/package.json +15 -7
- package/CHANGELOG.md +0 -389
|
@@ -1,32 +1,85 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
4
4
|
|
|
5
5
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
6
6
|
|
|
7
|
+
var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
|
|
8
|
+
|
|
9
|
+
var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
|
|
10
|
+
|
|
7
11
|
_Object$defineProperty(exports, "__esModule", {
|
|
8
12
|
value: true
|
|
9
13
|
});
|
|
10
14
|
|
|
15
|
+
exports.clearAllState = clearAllState;
|
|
16
|
+
exports.commitServerChanges = commitServerChanges;
|
|
17
|
+
exports.duplicateState = duplicateState;
|
|
18
|
+
exports.enqueueTask = enqueueTask;
|
|
19
|
+
exports.estimateAttribute = estimateAttribute;
|
|
20
|
+
exports.estimateAttributes = estimateAttributes;
|
|
21
|
+
exports.getObjectCache = getObjectCache;
|
|
22
|
+
exports.getPendingOps = getPendingOps;
|
|
23
|
+
exports.getServerData = getServerData;
|
|
11
24
|
exports.getState = getState;
|
|
12
25
|
exports.initializeState = initializeState;
|
|
26
|
+
exports.mergeFirstPendingState = mergeFirstPendingState;
|
|
27
|
+
exports.popPendingState = popPendingState;
|
|
28
|
+
exports.pushPendingState = pushPendingState;
|
|
13
29
|
exports.removeState = removeState;
|
|
14
|
-
exports.getServerData = getServerData;
|
|
15
|
-
exports.setServerData = setServerData;
|
|
16
|
-
exports.getPendingOps = getPendingOps;
|
|
17
30
|
exports.setPendingOp = setPendingOp;
|
|
18
|
-
exports.
|
|
19
|
-
exports.popPendingState = popPendingState;
|
|
20
|
-
exports.mergeFirstPendingState = mergeFirstPendingState;
|
|
21
|
-
exports.getObjectCache = getObjectCache;
|
|
22
|
-
exports.estimateAttribute = estimateAttribute;
|
|
23
|
-
exports.estimateAttributes = estimateAttributes;
|
|
24
|
-
exports.commitServerChanges = commitServerChanges;
|
|
25
|
-
exports.enqueueTask = enqueueTask;
|
|
26
|
-
exports.clearAllState = clearAllState;
|
|
27
|
-
exports.duplicateState = duplicateState;
|
|
31
|
+
exports.setServerData = setServerData;
|
|
28
32
|
|
|
29
33
|
var ObjectStateMutations = _interopRequireWildcard(require("./ObjectStateMutations"));
|
|
34
|
+
|
|
35
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
36
|
+
if (typeof _WeakMap !== "function") return null;
|
|
37
|
+
var cacheBabelInterop = new _WeakMap();
|
|
38
|
+
var cacheNodeInterop = new _WeakMap();
|
|
39
|
+
return (_getRequireWildcardCache = function (nodeInterop) {
|
|
40
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
41
|
+
})(nodeInterop);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function _interopRequireWildcard(obj, nodeInterop) {
|
|
45
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
46
|
+
return obj;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
|
|
50
|
+
return {
|
|
51
|
+
default: obj
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
56
|
+
|
|
57
|
+
if (cache && cache.has(obj)) {
|
|
58
|
+
return cache.get(obj);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
var newObj = {};
|
|
62
|
+
|
|
63
|
+
for (var key in obj) {
|
|
64
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
65
|
+
var desc = _Object$defineProperty && _Object$getOwnPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null;
|
|
66
|
+
|
|
67
|
+
if (desc && (desc.get || desc.set)) {
|
|
68
|
+
_Object$defineProperty(newObj, key, desc);
|
|
69
|
+
} else {
|
|
70
|
+
newObj[key] = obj[key];
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
newObj.default = obj;
|
|
76
|
+
|
|
77
|
+
if (cache) {
|
|
78
|
+
cache.set(obj, newObj);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return newObj;
|
|
82
|
+
}
|
|
30
83
|
/**
|
|
31
84
|
* Copyright (c) 2015-present, Parse, LLC.
|
|
32
85
|
* All rights reserved.
|
|
@@ -1,38 +1,91 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime-corejs3/helpers/interopRequireWildcard");
|
|
4
|
-
|
|
5
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
4
|
|
|
5
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
6
|
+
|
|
7
7
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
8
8
|
|
|
9
|
+
var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
|
|
10
|
+
|
|
11
|
+
var _WeakMap2 = require("@babel/runtime-corejs3/core-js-stable/weak-map");
|
|
12
|
+
|
|
9
13
|
_Object$defineProperty(exports, "__esModule", {
|
|
10
14
|
value: true
|
|
11
15
|
});
|
|
12
16
|
|
|
17
|
+
exports.clearAllState = clearAllState;
|
|
18
|
+
exports.commitServerChanges = commitServerChanges;
|
|
19
|
+
exports.duplicateState = duplicateState;
|
|
20
|
+
exports.enqueueTask = enqueueTask;
|
|
21
|
+
exports.estimateAttribute = estimateAttribute;
|
|
22
|
+
exports.estimateAttributes = estimateAttributes;
|
|
23
|
+
exports.getObjectCache = getObjectCache;
|
|
24
|
+
exports.getPendingOps = getPendingOps;
|
|
25
|
+
exports.getServerData = getServerData;
|
|
13
26
|
exports.getState = getState;
|
|
14
27
|
exports.initializeState = initializeState;
|
|
28
|
+
exports.mergeFirstPendingState = mergeFirstPendingState;
|
|
29
|
+
exports.popPendingState = popPendingState;
|
|
30
|
+
exports.pushPendingState = pushPendingState;
|
|
15
31
|
exports.removeState = removeState;
|
|
16
|
-
exports.getServerData = getServerData;
|
|
17
|
-
exports.setServerData = setServerData;
|
|
18
|
-
exports.getPendingOps = getPendingOps;
|
|
19
32
|
exports.setPendingOp = setPendingOp;
|
|
20
|
-
exports.
|
|
21
|
-
exports.popPendingState = popPendingState;
|
|
22
|
-
exports.mergeFirstPendingState = mergeFirstPendingState;
|
|
23
|
-
exports.getObjectCache = getObjectCache;
|
|
24
|
-
exports.estimateAttribute = estimateAttribute;
|
|
25
|
-
exports.estimateAttributes = estimateAttributes;
|
|
26
|
-
exports.commitServerChanges = commitServerChanges;
|
|
27
|
-
exports.enqueueTask = enqueueTask;
|
|
28
|
-
exports.duplicateState = duplicateState;
|
|
29
|
-
exports.clearAllState = clearAllState;
|
|
33
|
+
exports.setServerData = setServerData;
|
|
30
34
|
|
|
31
35
|
var _weakMap = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/weak-map"));
|
|
32
36
|
|
|
33
37
|
var ObjectStateMutations = _interopRequireWildcard(require("./ObjectStateMutations"));
|
|
34
38
|
|
|
35
39
|
var _TaskQueue = _interopRequireDefault(require("./TaskQueue"));
|
|
40
|
+
|
|
41
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
42
|
+
if (typeof _WeakMap2 !== "function") return null;
|
|
43
|
+
var cacheBabelInterop = new _WeakMap2();
|
|
44
|
+
var cacheNodeInterop = new _WeakMap2();
|
|
45
|
+
return (_getRequireWildcardCache = function (nodeInterop) {
|
|
46
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
47
|
+
})(nodeInterop);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function _interopRequireWildcard(obj, nodeInterop) {
|
|
51
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
52
|
+
return obj;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
|
|
56
|
+
return {
|
|
57
|
+
default: obj
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
62
|
+
|
|
63
|
+
if (cache && cache.has(obj)) {
|
|
64
|
+
return cache.get(obj);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
var newObj = {};
|
|
68
|
+
|
|
69
|
+
for (var key in obj) {
|
|
70
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
71
|
+
var desc = _Object$defineProperty && _Object$getOwnPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null;
|
|
72
|
+
|
|
73
|
+
if (desc && (desc.get || desc.set)) {
|
|
74
|
+
_Object$defineProperty(newObj, key, desc);
|
|
75
|
+
} else {
|
|
76
|
+
newObj[key] = obj[key];
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
newObj.default = obj;
|
|
82
|
+
|
|
83
|
+
if (cache) {
|
|
84
|
+
cache.set(obj, newObj);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return newObj;
|
|
88
|
+
}
|
|
36
89
|
/**
|
|
37
90
|
* Copyright (c) 2015-present, Parse, LLC.
|
|
38
91
|
* All rights reserved.
|
|
@@ -8,9 +8,9 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
+
exports.continueWhile = continueWhile;
|
|
11
12
|
exports.resolvingPromise = resolvingPromise;
|
|
12
13
|
exports.when = when;
|
|
13
|
-
exports.continueWhile = continueWhile;
|
|
14
14
|
|
|
15
15
|
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
16
16
|
|
|
@@ -24,7 +24,7 @@ function _interopRequireDefault(obj) {
|
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
const uuidv4 = require('uuid
|
|
27
|
+
const uuidv4 = require('./uuid');
|
|
28
28
|
|
|
29
29
|
let registered = false;
|
|
30
30
|
/**
|
|
@@ -117,6 +117,20 @@ const AnonymousUtils = {
|
|
|
117
117
|
return user.linkWith(provider.getAuthType(), provider.getAuthData(), options);
|
|
118
118
|
},
|
|
119
119
|
|
|
120
|
+
/**
|
|
121
|
+
* Returns true if Authentication Provider has been registered for use.
|
|
122
|
+
*
|
|
123
|
+
* @function isRegistered
|
|
124
|
+
* @name Parse.AnonymousUtils.isRegistered
|
|
125
|
+
* @returns {boolean}
|
|
126
|
+
* @static
|
|
127
|
+
*/
|
|
128
|
+
isRegistered()
|
|
129
|
+
/*: boolean*/
|
|
130
|
+
{
|
|
131
|
+
return registered;
|
|
132
|
+
},
|
|
133
|
+
|
|
120
134
|
_getAuthProvider() {
|
|
121
135
|
const provider = {
|
|
122
136
|
restoreAuthentication() {
|
package/lib/node/Cloud.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.getJobStatus = getJobStatus;
|
|
7
7
|
exports.getJobsData = getJobsData;
|
|
8
|
+
exports.run = run;
|
|
8
9
|
exports.startJob = startJob;
|
|
9
|
-
exports.getJobStatus = getJobStatus;
|
|
10
10
|
|
|
11
11
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
12
12
|
|
package/lib/node/CoreManager.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.PIN_PREFIX = exports.OBJECT_PREFIX = exports.DEFAULT_PIN = void 0;
|
|
6
7
|
exports.isLocalDatastoreKey = isLocalDatastoreKey;
|
|
7
|
-
exports.OBJECT_PREFIX = exports.PIN_PREFIX = exports.DEFAULT_PIN = void 0;
|
|
8
8
|
/**
|
|
9
9
|
* Copyright (c) 2015-present, Parse, LLC.
|
|
10
10
|
* All rights reserved.
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.commitServerChanges = commitServerChanges;
|
|
6
7
|
exports.defaultState = defaultState;
|
|
7
|
-
exports.setServerData = setServerData;
|
|
8
|
-
exports.setPendingOp = setPendingOp;
|
|
9
|
-
exports.pushPendingState = pushPendingState;
|
|
10
|
-
exports.popPendingState = popPendingState;
|
|
11
|
-
exports.mergeFirstPendingState = mergeFirstPendingState;
|
|
12
8
|
exports.estimateAttribute = estimateAttribute;
|
|
13
9
|
exports.estimateAttributes = estimateAttributes;
|
|
14
|
-
exports.
|
|
10
|
+
exports.mergeFirstPendingState = mergeFirstPendingState;
|
|
11
|
+
exports.popPendingState = popPendingState;
|
|
12
|
+
exports.pushPendingState = pushPendingState;
|
|
13
|
+
exports.setPendingOp = setPendingOp;
|
|
14
|
+
exports.setServerData = setServerData;
|
|
15
15
|
|
|
16
16
|
var _encode = _interopRequireDefault(require("./encode"));
|
|
17
17
|
|
|
@@ -36,9 +36,13 @@ function ownKeys(object, enumerableOnly) {
|
|
|
36
36
|
|
|
37
37
|
if (Object.getOwnPropertySymbols) {
|
|
38
38
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
|
|
40
|
+
if (enumerableOnly) {
|
|
41
|
+
symbols = symbols.filter(function (sym) {
|
|
42
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
42
46
|
keys.push.apply(keys, symbols);
|
|
43
47
|
}
|
|
44
48
|
|
|
@@ -251,6 +255,21 @@ function estimateAttributes(serverData
|
|
|
251
255
|
return data;
|
|
252
256
|
}
|
|
253
257
|
|
|
258
|
+
function nestedSet(obj, key, value) {
|
|
259
|
+
const path = key.split('.');
|
|
260
|
+
|
|
261
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
262
|
+
if (!(path[i] in obj)) obj[path[i]] = {};
|
|
263
|
+
obj = obj[path[i]];
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
if (typeof value === 'undefined') {
|
|
267
|
+
delete obj[path[path.length - 1]];
|
|
268
|
+
} else {
|
|
269
|
+
obj[path[path.length - 1]] = value;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
254
273
|
function commitServerChanges(serverData
|
|
255
274
|
/*: AttributeMap*/
|
|
256
275
|
, objectCache
|
|
@@ -260,7 +279,7 @@ function commitServerChanges(serverData
|
|
|
260
279
|
) {
|
|
261
280
|
for (const attr in changes) {
|
|
262
281
|
const val = changes[attr];
|
|
263
|
-
serverData
|
|
282
|
+
nestedSet(serverData, attr, val);
|
|
264
283
|
|
|
265
284
|
if (val && typeof val === 'object' && !(val instanceof _ParseObject.default) && !(val instanceof _ParseFile.default) && !(val instanceof _ParseRelation.default)) {
|
|
266
285
|
const json = (0, _encode.default)(val, false, true);
|
package/lib/node/OfflineQuery.js
CHANGED
|
@@ -101,6 +101,157 @@ function equalObjectsGeneric(obj, compareTo, eqlFn) {
|
|
|
101
101
|
|
|
102
102
|
return eqlFn(obj, compareTo);
|
|
103
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* @typedef RelativeTimeToDateResult
|
|
106
|
+
* @property {string} status The conversion status, `error` if conversion failed or
|
|
107
|
+
* `success` if conversion succeeded.
|
|
108
|
+
* @property {string} info The error message if conversion failed, or the relative
|
|
109
|
+
* time indication (`past`, `present`, `future`) if conversion succeeded.
|
|
110
|
+
* @property {Date|undefined} result The converted date, or `undefined` if conversion
|
|
111
|
+
* failed.
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Converts human readable relative date string, for example, 'in 10 days' to a date
|
|
116
|
+
* relative to now.
|
|
117
|
+
*
|
|
118
|
+
* @param {string} text The text to convert.
|
|
119
|
+
* @param {Date} [now=new Date()] The date from which add or subtract. Default is now.
|
|
120
|
+
* @returns {RelativeTimeToDateResult}
|
|
121
|
+
*/
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
function relativeTimeToDate(text, now = new Date()) {
|
|
125
|
+
text = text.toLowerCase();
|
|
126
|
+
let parts = text.split(' '); // Filter out whitespace
|
|
127
|
+
|
|
128
|
+
parts = parts.filter(part => part !== '');
|
|
129
|
+
const future = parts[0] === 'in';
|
|
130
|
+
const past = parts[parts.length - 1] === 'ago';
|
|
131
|
+
|
|
132
|
+
if (!future && !past && text !== 'now') {
|
|
133
|
+
return {
|
|
134
|
+
status: 'error',
|
|
135
|
+
info: "Time should either start with 'in' or end with 'ago'"
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (future && past) {
|
|
140
|
+
return {
|
|
141
|
+
status: 'error',
|
|
142
|
+
info: "Time cannot have both 'in' and 'ago'"
|
|
143
|
+
};
|
|
144
|
+
} // strip the 'ago' or 'in'
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
if (future) {
|
|
148
|
+
parts = parts.slice(1);
|
|
149
|
+
} else {
|
|
150
|
+
// past
|
|
151
|
+
parts = parts.slice(0, parts.length - 1);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (parts.length % 2 !== 0 && text !== 'now') {
|
|
155
|
+
return {
|
|
156
|
+
status: 'error',
|
|
157
|
+
info: 'Invalid time string. Dangling unit or number.'
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const pairs = [];
|
|
162
|
+
|
|
163
|
+
while (parts.length) {
|
|
164
|
+
pairs.push([parts.shift(), parts.shift()]);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
let seconds = 0;
|
|
168
|
+
|
|
169
|
+
for (const [num, interval] of pairs) {
|
|
170
|
+
const val = Number(num);
|
|
171
|
+
|
|
172
|
+
if (!Number.isInteger(val)) {
|
|
173
|
+
return {
|
|
174
|
+
status: 'error',
|
|
175
|
+
info: `'${num}' is not an integer.`
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
switch (interval) {
|
|
180
|
+
case 'yr':
|
|
181
|
+
case 'yrs':
|
|
182
|
+
case 'year':
|
|
183
|
+
case 'years':
|
|
184
|
+
seconds += val * 31536000; // 365 * 24 * 60 * 60
|
|
185
|
+
|
|
186
|
+
break;
|
|
187
|
+
|
|
188
|
+
case 'wk':
|
|
189
|
+
case 'wks':
|
|
190
|
+
case 'week':
|
|
191
|
+
case 'weeks':
|
|
192
|
+
seconds += val * 604800; // 7 * 24 * 60 * 60
|
|
193
|
+
|
|
194
|
+
break;
|
|
195
|
+
|
|
196
|
+
case 'd':
|
|
197
|
+
case 'day':
|
|
198
|
+
case 'days':
|
|
199
|
+
seconds += val * 86400; // 24 * 60 * 60
|
|
200
|
+
|
|
201
|
+
break;
|
|
202
|
+
|
|
203
|
+
case 'hr':
|
|
204
|
+
case 'hrs':
|
|
205
|
+
case 'hour':
|
|
206
|
+
case 'hours':
|
|
207
|
+
seconds += val * 3600; // 60 * 60
|
|
208
|
+
|
|
209
|
+
break;
|
|
210
|
+
|
|
211
|
+
case 'min':
|
|
212
|
+
case 'mins':
|
|
213
|
+
case 'minute':
|
|
214
|
+
case 'minutes':
|
|
215
|
+
seconds += val * 60;
|
|
216
|
+
break;
|
|
217
|
+
|
|
218
|
+
case 'sec':
|
|
219
|
+
case 'secs':
|
|
220
|
+
case 'second':
|
|
221
|
+
case 'seconds':
|
|
222
|
+
seconds += val;
|
|
223
|
+
break;
|
|
224
|
+
|
|
225
|
+
default:
|
|
226
|
+
return {
|
|
227
|
+
status: 'error',
|
|
228
|
+
info: `Invalid interval: '${interval}'`
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const milliseconds = seconds * 1000;
|
|
234
|
+
|
|
235
|
+
if (future) {
|
|
236
|
+
return {
|
|
237
|
+
status: 'success',
|
|
238
|
+
info: 'future',
|
|
239
|
+
result: new Date(now.valueOf() + milliseconds)
|
|
240
|
+
};
|
|
241
|
+
} else if (past) {
|
|
242
|
+
return {
|
|
243
|
+
status: 'success',
|
|
244
|
+
info: 'past',
|
|
245
|
+
result: new Date(now.valueOf() - milliseconds)
|
|
246
|
+
};
|
|
247
|
+
} else {
|
|
248
|
+
return {
|
|
249
|
+
status: 'success',
|
|
250
|
+
info: 'present',
|
|
251
|
+
result: new Date(now.valueOf())
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
}
|
|
104
255
|
/**
|
|
105
256
|
* Determines whether an object matches a single key's constraints
|
|
106
257
|
*
|
|
@@ -195,6 +346,17 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
|
|
|
195
346
|
|
|
196
347
|
if (compareTo.__type) {
|
|
197
348
|
compareTo = decode(compareTo);
|
|
349
|
+
} // is it a $relativeTime? convert to date
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
if (compareTo['$relativeTime']) {
|
|
353
|
+
const parserResult = relativeTimeToDate(compareTo['$relativeTime']);
|
|
354
|
+
|
|
355
|
+
if (parserResult.status !== 'success') {
|
|
356
|
+
throw new ParseError(ParseError.INVALID_JSON, `bad $relativeTime (${key}) value. ${parserResult.info}`);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
compareTo = parserResult.result;
|
|
198
360
|
} // Compare Date Object or Date String
|
|
199
361
|
|
|
200
362
|
|
package/lib/node/Parse.js
CHANGED
|
@@ -16,19 +16,17 @@ var ParseOp = _interopRequireWildcard(require("./ParseOp"));
|
|
|
16
16
|
|
|
17
17
|
var _RESTController = _interopRequireDefault(require("./RESTController"));
|
|
18
18
|
|
|
19
|
-
function _getRequireWildcardCache() {
|
|
19
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
20
20
|
if (typeof WeakMap !== "function") return null;
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
_getRequireWildcardCache = function () {
|
|
24
|
-
return
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
return cache;
|
|
21
|
+
var cacheBabelInterop = new WeakMap();
|
|
22
|
+
var cacheNodeInterop = new WeakMap();
|
|
23
|
+
return (_getRequireWildcardCache = function (nodeInterop) {
|
|
24
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
25
|
+
})(nodeInterop);
|
|
28
26
|
}
|
|
29
27
|
|
|
30
|
-
function _interopRequireWildcard(obj) {
|
|
31
|
-
if (obj && obj.__esModule) {
|
|
28
|
+
function _interopRequireWildcard(obj, nodeInterop) {
|
|
29
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
32
30
|
return obj;
|
|
33
31
|
}
|
|
34
32
|
|
|
@@ -38,7 +36,7 @@ function _interopRequireWildcard(obj) {
|
|
|
38
36
|
};
|
|
39
37
|
}
|
|
40
38
|
|
|
41
|
-
var cache = _getRequireWildcardCache();
|
|
39
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
42
40
|
|
|
43
41
|
if (cache && cache.has(obj)) {
|
|
44
42
|
return cache.get(obj);
|
|
@@ -48,7 +46,7 @@ function _interopRequireWildcard(obj) {
|
|
|
48
46
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
49
47
|
|
|
50
48
|
for (var key in obj) {
|
|
51
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
49
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
52
50
|
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
53
51
|
|
|
54
52
|
if (desc && (desc.get || desc.set)) {
|
package/lib/node/ParseCLP.js
CHANGED
|
@@ -20,9 +20,13 @@ function ownKeys(object, enumerableOnly) {
|
|
|
20
20
|
|
|
21
21
|
if (Object.getOwnPropertySymbols) {
|
|
22
22
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
|
|
24
|
+
if (enumerableOnly) {
|
|
25
|
+
symbols = symbols.filter(function (sym) {
|
|
26
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
26
30
|
keys.push.apply(keys, symbols);
|
|
27
31
|
}
|
|
28
32
|
|
package/lib/node/ParseError.js
CHANGED
|
@@ -385,6 +385,14 @@ ParseError.DUPLICATE_REQUEST = 159;
|
|
|
385
385
|
*/
|
|
386
386
|
|
|
387
387
|
ParseError.INVALID_EVENT_NAME = 160;
|
|
388
|
+
/**
|
|
389
|
+
* Error code indicating that a field had an invalid value.
|
|
390
|
+
*
|
|
391
|
+
* @property {number} INVALID_VALUE
|
|
392
|
+
* @static
|
|
393
|
+
*/
|
|
394
|
+
|
|
395
|
+
ParseError.INVALID_VALUE = 162;
|
|
388
396
|
/**
|
|
389
397
|
* Error code indicating that the username is missing or empty.
|
|
390
398
|
*
|
package/lib/node/ParseFile.js
CHANGED
|
@@ -18,9 +18,13 @@ function ownKeys(object, enumerableOnly) {
|
|
|
18
18
|
|
|
19
19
|
if (Object.getOwnPropertySymbols) {
|
|
20
20
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
|
|
22
|
+
if (enumerableOnly) {
|
|
23
|
+
symbols = symbols.filter(function (sym) {
|
|
24
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
24
28
|
keys.push.apply(keys, symbols);
|
|
25
29
|
}
|
|
26
30
|
|
package/lib/node/ParseHooks.js
CHANGED
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
exports.getTriggers = getTriggers;
|
|
8
|
-
exports.getFunction = getFunction;
|
|
9
|
-
exports.getTrigger = getTrigger;
|
|
6
|
+
exports.create = create;
|
|
10
7
|
exports.createFunction = createFunction;
|
|
11
8
|
exports.createTrigger = createTrigger;
|
|
12
|
-
exports.
|
|
13
|
-
exports.
|
|
14
|
-
exports.
|
|
15
|
-
exports.
|
|
9
|
+
exports.getFunction = getFunction;
|
|
10
|
+
exports.getFunctions = getFunctions;
|
|
11
|
+
exports.getTrigger = getTrigger;
|
|
12
|
+
exports.getTriggers = getTriggers;
|
|
13
|
+
exports.remove = remove;
|
|
16
14
|
exports.removeFunction = removeFunction;
|
|
17
15
|
exports.removeTrigger = removeTrigger;
|
|
18
|
-
exports.
|
|
16
|
+
exports.update = update;
|
|
17
|
+
exports.updateFunction = updateFunction;
|
|
18
|
+
exports.updateTrigger = updateTrigger;
|
|
19
19
|
|
|
20
20
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
21
21
|
|