parse 4.0.0-alpha.1 → 4.0.0-alpha.10
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/LICENSE +167 -25
- package/NOTICE +10 -0
- package/README.md +6 -5
- package/dist/parse.js +12838 -21190
- package/dist/parse.min.js +7 -6
- package/dist/parse.weapp.js +7921 -17062
- package/dist/parse.weapp.min.js +7 -6
- package/lib/browser/Analytics.js +2 -27
- package/lib/browser/AnonymousUtils.js +6 -42
- package/lib/browser/Cloud.js +12 -77
- package/lib/browser/CloudCode.js +0 -3
- package/lib/browser/CoreManager.js +46 -191
- package/lib/browser/CryptoController.js +2 -16
- package/lib/browser/EventEmitter.js +1 -8
- package/lib/browser/EventuallyQueue.js +277 -824
- package/lib/browser/FacebookUtils.js +6 -42
- package/lib/browser/IndexedDBStorageController.js +3 -14
- package/lib/browser/InstallationController.js +2 -20
- package/lib/browser/LiveQueryClient.js +105 -213
- package/lib/browser/LiveQuerySubscription.js +10 -39
- package/lib/browser/LocalDatastore.js +451 -1081
- package/lib/browser/LocalDatastoreController.js +145 -602
- package/lib/browser/LocalDatastoreController.react-native.js +137 -573
- package/lib/browser/LocalDatastoreUtils.js +2 -19
- package/lib/browser/ObjectStateMutations.js +18 -121
- package/lib/browser/OfflineQuery.js +61 -222
- package/lib/browser/Parse.js +12 -115
- package/lib/browser/ParseACL.js +33 -148
- package/lib/browser/ParseCLP.js +96 -314
- package/lib/browser/ParseConfig.js +18 -95
- package/lib/browser/ParseError.js +63 -99
- package/lib/browser/ParseFile.js +128 -685
- package/lib/browser/ParseGeoPoint.js +23 -89
- package/lib/browser/ParseHooks.js +1 -34
- package/lib/browser/ParseInstallation.js +4 -32
- package/lib/browser/ParseLiveQuery.js +96 -505
- package/lib/browser/ParseObject.js +665 -1845
- package/lib/browser/ParseOp.js +41 -287
- package/lib/browser/ParsePolygon.js +13 -70
- package/lib/browser/ParseQuery.js +403 -1504
- package/lib/browser/ParseRelation.js +12 -68
- package/lib/browser/ParseRole.js +13 -75
- package/lib/browser/ParseSchema.js +49 -208
- package/lib/browser/ParseSession.js +11 -69
- package/lib/browser/ParseUser.js +274 -1127
- package/lib/browser/Push.js +7 -50
- package/lib/browser/RESTController.js +28 -157
- package/lib/browser/SingleInstanceStateController.js +19 -144
- package/lib/browser/Socket.weapp.js +0 -10
- package/lib/browser/Storage.js +10 -80
- package/lib/browser/StorageController.browser.js +4 -24
- package/lib/browser/StorageController.default.js +4 -24
- package/lib/browser/StorageController.react-native.js +6 -40
- package/lib/browser/StorageController.weapp.js +5 -23
- package/lib/browser/TaskQueue.js +1 -29
- package/lib/browser/UniqueInstanceStateController.js +19 -149
- package/lib/browser/Xhr.weapp.js +0 -17
- package/lib/browser/arrayContainsObject.js +2 -23
- package/lib/browser/canBeSerialized.js +3 -40
- package/lib/browser/decode.js +3 -40
- package/lib/browser/encode.js +9 -77
- package/lib/browser/equals.js +2 -34
- package/lib/browser/escape.js +1 -15
- package/lib/browser/isRevocableSession.js +2 -18
- package/lib/browser/parseDate.js +2 -20
- package/lib/browser/promiseUtils.js +3 -21
- package/lib/browser/unique.js +3 -24
- package/lib/browser/unsavedChildren.js +6 -57
- package/lib/browser/uuid.js +3 -1
- package/lib/node/Analytics.js +1 -25
- package/lib/node/AnonymousUtils.js +5 -44
- package/lib/node/Cloud.js +10 -73
- package/lib/node/CloudCode.js +0 -3
- package/lib/node/CoreManager.js +47 -227
- package/lib/node/CryptoController.js +2 -16
- package/lib/node/EventEmitter.js +1 -8
- package/lib/node/EventuallyQueue.js +16 -123
- package/lib/node/FacebookUtils.js +5 -44
- package/lib/node/IndexedDBStorageController.js +3 -19
- package/lib/node/InstallationController.js +2 -22
- package/lib/node/LiveQueryClient.js +72 -154
- package/lib/node/LiveQuerySubscription.js +7 -26
- package/lib/node/LocalDatastore.js +19 -182
- package/lib/node/LocalDatastoreController.js +6 -45
- package/lib/node/LocalDatastoreController.react-native.js +6 -52
- package/lib/node/LocalDatastoreUtils.js +1 -13
- package/lib/node/ObjectStateMutations.js +13 -100
- package/lib/node/OfflineQuery.js +27 -151
- package/lib/node/Parse.js +11 -108
- package/lib/node/ParseACL.js +32 -157
- package/lib/node/ParseCLP.js +69 -269
- package/lib/node/ParseConfig.js +16 -91
- package/lib/node/ParseError.js +61 -74
- package/lib/node/ParseFile.js +49 -212
- package/lib/node/ParseGeoPoint.js +21 -89
- package/lib/node/ParseHooks.js +0 -35
- package/lib/node/ParseInstallation.js +1 -17
- package/lib/node/ParseLiveQuery.js +10 -43
- package/lib/node/ParseObject.js +229 -964
- package/lib/node/ParseOp.js +31 -262
- package/lib/node/ParsePolygon.js +12 -69
- package/lib/node/ParseQuery.js +169 -888
- package/lib/node/ParseRelation.js +11 -68
- package/lib/node/ParseRole.js +10 -64
- package/lib/node/ParseSchema.js +46 -229
- package/lib/node/ParseSession.js +8 -57
- package/lib/node/ParseUser.js +107 -583
- package/lib/node/Push.js +4 -44
- package/lib/node/RESTController.js +18 -127
- package/lib/node/SingleInstanceStateController.js +17 -137
- package/lib/node/Socket.weapp.js +0 -7
- package/lib/node/Storage.js +10 -90
- package/lib/node/StorageController.browser.js +4 -30
- package/lib/node/StorageController.default.js +5 -28
- package/lib/node/StorageController.react-native.js +6 -47
- package/lib/node/StorageController.weapp.js +6 -28
- package/lib/node/TaskQueue.js +1 -24
- package/lib/node/UniqueInstanceStateController.js +16 -140
- package/lib/node/Xhr.weapp.js +0 -15
- package/lib/node/arrayContainsObject.js +1 -19
- package/lib/node/canBeSerialized.js +2 -35
- package/lib/node/decode.js +1 -33
- package/lib/node/encode.js +3 -61
- package/lib/node/equals.js +0 -27
- package/lib/node/escape.js +1 -13
- package/lib/node/isRevocableSession.js +1 -12
- package/lib/node/parseDate.js +1 -14
- package/lib/node/promiseUtils.js +2 -14
- package/lib/node/unique.js +1 -18
- package/lib/node/unsavedChildren.js +2 -45
- package/lib/node/uuid.js +6 -1
- package/lib/react-native/Analytics.js +0 -9
- package/lib/react-native/AnonymousUtils.js +0 -10
- package/lib/react-native/Cloud.js +0 -26
- package/lib/react-native/CoreManager.js +2 -6
- package/lib/react-native/CryptoController.js +0 -2
- package/lib/react-native/EventEmitter.js +0 -2
- package/lib/react-native/EventuallyQueue.js +156 -711
- package/lib/react-native/FacebookUtils.js +0 -22
- package/lib/react-native/IndexedDBStorageController.js +0 -1
- package/lib/react-native/InstallationController.js +0 -6
- package/lib/react-native/LiveQueryClient.js +46 -157
- package/lib/react-native/LiveQuerySubscription.js +3 -27
- package/lib/react-native/LocalDatastore.js +281 -948
- package/lib/react-native/LocalDatastoreController.js +71 -552
- package/lib/react-native/LocalDatastoreController.react-native.js +91 -526
- package/lib/react-native/LocalDatastoreUtils.js +0 -1
- package/lib/react-native/ObjectStateMutations.js +2 -65
- package/lib/react-native/OfflineQuery.js +25 -196
- package/lib/react-native/Parse.js +0 -65
- package/lib/react-native/ParseACL.js +0 -44
- package/lib/react-native/ParseCLP.js +23 -161
- package/lib/react-native/ParseConfig.js +0 -42
- package/lib/react-native/ParseError.js +1 -21
- package/lib/react-native/ParseFile.js +55 -529
- package/lib/react-native/ParseGeoPoint.js +0 -17
- package/lib/react-native/ParseHooks.js +0 -30
- package/lib/react-native/ParseInstallation.js +1 -23
- package/lib/react-native/ParseLiveQuery.js +55 -472
- package/lib/react-native/ParseObject.js +245 -1246
- package/lib/react-native/ParseOp.js +1 -138
- package/lib/react-native/ParsePolygon.js +0 -24
- package/lib/react-native/ParseQuery.js +182 -874
- package/lib/react-native/ParseRelation.js +0 -25
- package/lib/react-native/ParseRole.js +1 -36
- package/lib/react-native/ParseSchema.js +3 -54
- package/lib/react-native/ParseSession.js +1 -40
- package/lib/react-native/ParseUser.js +95 -773
- package/lib/react-native/Push.js +0 -16
- package/lib/react-native/RESTController.js +12 -109
- package/lib/react-native/SingleInstanceStateController.js +0 -44
- package/lib/react-native/Socket.weapp.js +0 -10
- package/lib/react-native/Storage.js +0 -24
- package/lib/react-native/StorageController.browser.js +0 -2
- package/lib/react-native/StorageController.default.js +0 -1
- package/lib/react-native/StorageController.react-native.js +0 -2
- package/lib/react-native/TaskQueue.js +0 -15
- package/lib/react-native/UniqueInstanceStateController.js +0 -47
- package/lib/react-native/Xhr.weapp.js +0 -16
- package/lib/react-native/arrayContainsObject.js +0 -5
- package/lib/react-native/canBeSerialized.js +0 -18
- package/lib/react-native/decode.js +0 -21
- package/lib/react-native/encode.js +0 -25
- package/lib/react-native/equals.js +0 -18
- package/lib/react-native/escape.js +0 -1
- package/lib/react-native/isRevocableSession.js +0 -1
- package/lib/react-native/parseDate.js +0 -3
- package/lib/react-native/promiseUtils.js +0 -13
- package/lib/react-native/unique.js +0 -4
- package/lib/react-native/unsavedChildren.js +0 -21
- package/lib/react-native/uuid.js +3 -1
- package/lib/weapp/Analytics.js +2 -27
- package/lib/weapp/AnonymousUtils.js +6 -42
- package/lib/weapp/Cloud.js +12 -77
- package/lib/weapp/CloudCode.js +0 -3
- package/lib/weapp/CoreManager.js +46 -191
- package/lib/weapp/CryptoController.js +2 -16
- package/lib/weapp/EventEmitter.js +1 -8
- package/lib/weapp/EventuallyQueue.js +277 -824
- package/lib/weapp/FacebookUtils.js +6 -42
- package/lib/weapp/IndexedDBStorageController.js +3 -14
- package/lib/weapp/InstallationController.js +2 -20
- package/lib/weapp/LiveQueryClient.js +105 -213
- package/lib/weapp/LiveQuerySubscription.js +10 -39
- package/lib/weapp/LocalDatastore.js +451 -1081
- package/lib/weapp/LocalDatastoreController.js +145 -602
- package/lib/weapp/LocalDatastoreController.react-native.js +137 -573
- package/lib/weapp/LocalDatastoreUtils.js +2 -19
- package/lib/weapp/ObjectStateMutations.js +18 -121
- package/lib/weapp/OfflineQuery.js +61 -222
- package/lib/weapp/Parse.js +12 -115
- package/lib/weapp/ParseACL.js +33 -148
- package/lib/weapp/ParseCLP.js +96 -314
- package/lib/weapp/ParseConfig.js +18 -95
- package/lib/weapp/ParseError.js +63 -99
- package/lib/weapp/ParseFile.js +129 -686
- package/lib/weapp/ParseGeoPoint.js +23 -89
- package/lib/weapp/ParseHooks.js +1 -34
- package/lib/weapp/ParseInstallation.js +4 -32
- package/lib/weapp/ParseLiveQuery.js +96 -505
- package/lib/weapp/ParseObject.js +665 -1845
- package/lib/weapp/ParseOp.js +41 -287
- package/lib/weapp/ParsePolygon.js +13 -70
- package/lib/weapp/ParseQuery.js +403 -1504
- package/lib/weapp/ParseRelation.js +12 -68
- package/lib/weapp/ParseRole.js +13 -75
- package/lib/weapp/ParseSchema.js +49 -208
- package/lib/weapp/ParseSession.js +11 -69
- package/lib/weapp/ParseUser.js +274 -1127
- package/lib/weapp/Push.js +7 -50
- package/lib/weapp/RESTController.js +28 -157
- package/lib/weapp/SingleInstanceStateController.js +19 -144
- package/lib/weapp/Socket.weapp.js +0 -10
- package/lib/weapp/Storage.js +10 -80
- package/lib/weapp/StorageController.browser.js +4 -24
- package/lib/weapp/StorageController.default.js +4 -24
- package/lib/weapp/StorageController.react-native.js +6 -40
- package/lib/weapp/StorageController.weapp.js +5 -23
- package/lib/weapp/TaskQueue.js +1 -29
- package/lib/weapp/UniqueInstanceStateController.js +19 -149
- package/lib/weapp/Xhr.weapp.js +0 -17
- package/lib/weapp/arrayContainsObject.js +2 -23
- package/lib/weapp/canBeSerialized.js +3 -40
- package/lib/weapp/decode.js +3 -40
- package/lib/weapp/encode.js +9 -77
- package/lib/weapp/equals.js +2 -34
- package/lib/weapp/escape.js +1 -15
- package/lib/weapp/isRevocableSession.js +2 -18
- package/lib/weapp/parseDate.js +2 -20
- package/lib/weapp/promiseUtils.js +3 -21
- package/lib/weapp/unique.js +3 -24
- package/lib/weapp/unsavedChildren.js +6 -57
- package/lib/weapp/uuid.js +1 -6
- package/package.json +34 -30
- package/PATENTS +0 -37
|
@@ -1,38 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
6
|
-
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
7
5
|
_Object$defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
|
-
|
|
11
8
|
exports.default = unsavedChildren;
|
|
12
|
-
|
|
13
|
-
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
14
|
-
|
|
15
|
-
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
16
|
-
|
|
17
|
-
var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
|
|
18
|
-
|
|
19
9
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
20
|
-
|
|
10
|
+
var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
|
|
11
|
+
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
12
|
+
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
21
13
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
|
|
22
|
-
|
|
23
14
|
var _ParseFile = _interopRequireDefault(require("./ParseFile"));
|
|
24
|
-
|
|
25
15
|
var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
26
|
-
|
|
27
16
|
var _ParseRelation = _interopRequireDefault(require("./ParseRelation"));
|
|
28
17
|
/**
|
|
29
|
-
* Copyright (c) 2015-present, Parse, LLC.
|
|
30
|
-
* All rights reserved.
|
|
31
|
-
*
|
|
32
|
-
* This source code is licensed under the BSD-style license found in the
|
|
33
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
34
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
35
|
-
*
|
|
36
18
|
* @flow
|
|
37
19
|
*/
|
|
38
20
|
|
|
@@ -44,86 +26,54 @@ var _ParseRelation = _interopRequireDefault(require("./ParseRelation"));
|
|
|
44
26
|
* @param {boolean} allowDeepUnsaved
|
|
45
27
|
* @returns {Array}
|
|
46
28
|
*/
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
function unsavedChildren(obj
|
|
50
|
-
/*: ParseObject*/
|
|
51
|
-
, allowDeepUnsaved
|
|
52
|
-
/*:: ?: boolean*/
|
|
53
|
-
)
|
|
54
|
-
/*: Array<ParseFile | ParseObject>*/
|
|
55
|
-
{
|
|
29
|
+
function unsavedChildren(obj /*: ParseObject*/, allowDeepUnsaved /*:: ?: boolean*/) /*: Array<ParseFile | ParseObject>*/{
|
|
56
30
|
var encountered = {
|
|
57
31
|
objects: {},
|
|
58
32
|
files: []
|
|
59
33
|
};
|
|
60
|
-
|
|
61
34
|
var identifier = obj.className + ':' + obj._getId();
|
|
62
|
-
|
|
63
35
|
encountered.objects[identifier] = obj.dirty() ? obj : true;
|
|
64
36
|
var attributes = obj.attributes;
|
|
65
|
-
|
|
66
37
|
for (var attr in attributes) {
|
|
67
38
|
if ((0, _typeof2.default)(attributes[attr]) === 'object') {
|
|
68
39
|
traverse(attributes[attr], encountered, false, !!allowDeepUnsaved);
|
|
69
40
|
}
|
|
70
41
|
}
|
|
71
|
-
|
|
72
42
|
var unsaved = [];
|
|
73
|
-
|
|
74
43
|
for (var id in encountered.objects) {
|
|
75
44
|
if (id !== identifier && encountered.objects[id] !== true) {
|
|
76
45
|
unsaved.push(encountered.objects[id]);
|
|
77
46
|
}
|
|
78
47
|
}
|
|
79
|
-
|
|
80
48
|
return (0, _concat.default)(unsaved).call(unsaved, encountered.files);
|
|
81
49
|
}
|
|
82
|
-
|
|
83
|
-
function traverse(obj
|
|
84
|
-
/*: ParseObject*/
|
|
85
|
-
, encountered
|
|
86
|
-
/*: EncounterMap*/
|
|
87
|
-
, shouldThrow
|
|
88
|
-
/*: boolean*/
|
|
89
|
-
, allowDeepUnsaved
|
|
90
|
-
/*: boolean*/
|
|
91
|
-
) {
|
|
50
|
+
function traverse(obj /*: ParseObject*/, encountered /*: EncounterMap*/, shouldThrow /*: boolean*/, allowDeepUnsaved /*: boolean*/) {
|
|
92
51
|
if (obj instanceof _ParseObject.default) {
|
|
93
52
|
if (!obj.id && shouldThrow) {
|
|
94
53
|
throw new Error('Cannot create a pointer to an unsaved Object.');
|
|
95
54
|
}
|
|
96
|
-
|
|
97
55
|
var _identifier = obj.className + ':' + obj._getId();
|
|
98
|
-
|
|
99
56
|
if (!encountered.objects[_identifier]) {
|
|
100
57
|
encountered.objects[_identifier] = obj.dirty() ? obj : true;
|
|
101
58
|
var attributes = obj.attributes;
|
|
102
|
-
|
|
103
59
|
for (var attr in attributes) {
|
|
104
60
|
if ((0, _typeof2.default)(attributes[attr]) === 'object') {
|
|
105
61
|
traverse(attributes[attr], encountered, !allowDeepUnsaved, allowDeepUnsaved);
|
|
106
62
|
}
|
|
107
63
|
}
|
|
108
64
|
}
|
|
109
|
-
|
|
110
65
|
return;
|
|
111
66
|
}
|
|
112
|
-
|
|
113
67
|
if (obj instanceof _ParseFile.default) {
|
|
114
68
|
var _context;
|
|
115
|
-
|
|
116
69
|
if (!obj.url() && (0, _indexOf.default)(_context = encountered.files).call(_context, obj) < 0) {
|
|
117
70
|
encountered.files.push(obj);
|
|
118
71
|
}
|
|
119
|
-
|
|
120
72
|
return;
|
|
121
73
|
}
|
|
122
|
-
|
|
123
74
|
if (obj instanceof _ParseRelation.default) {
|
|
124
75
|
return;
|
|
125
76
|
}
|
|
126
|
-
|
|
127
77
|
if ((0, _isArray.default)(obj)) {
|
|
128
78
|
(0, _forEach.default)(obj).call(obj, function (el) {
|
|
129
79
|
if ((0, _typeof2.default)(el) === 'object') {
|
|
@@ -131,7 +81,6 @@ function traverse(obj
|
|
|
131
81
|
}
|
|
132
82
|
});
|
|
133
83
|
}
|
|
134
|
-
|
|
135
84
|
for (var k in obj) {
|
|
136
85
|
if ((0, _typeof2.default)(obj[k]) === 'object') {
|
|
137
86
|
traverse(obj[k], encountered, shouldThrow, allowDeepUnsaved);
|
package/lib/browser/uuid.js
CHANGED
package/lib/node/Analytics.js
CHANGED
|
@@ -4,22 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.track = track;
|
|
7
|
-
|
|
8
7
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) {
|
|
11
9
|
return obj && obj.__esModule ? obj : {
|
|
12
10
|
default: obj
|
|
13
11
|
};
|
|
14
12
|
}
|
|
15
13
|
/**
|
|
16
|
-
* Copyright (c) 2015-present, Parse, LLC.
|
|
17
|
-
* All rights reserved.
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the BSD-style license found in the
|
|
20
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
21
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
22
|
-
*
|
|
23
14
|
* @flow
|
|
24
15
|
*/
|
|
25
16
|
|
|
@@ -63,41 +54,26 @@ function _interopRequireDefault(obj) {
|
|
|
63
54
|
* @returns {Promise} A promise that is resolved when the round-trip
|
|
64
55
|
* to the server completes.
|
|
65
56
|
*/
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
function track(name
|
|
69
|
-
/*: string*/
|
|
70
|
-
, dimensions
|
|
71
|
-
/*: { [key: string]: string }*/
|
|
72
|
-
)
|
|
73
|
-
/*: Promise*/
|
|
74
|
-
{
|
|
57
|
+
function track(name /*: string*/, dimensions /*: { [key: string]: string }*/) /*: Promise*/{
|
|
75
58
|
name = name || '';
|
|
76
59
|
name = name.replace(/^\s*/, '');
|
|
77
60
|
name = name.replace(/\s*$/, '');
|
|
78
|
-
|
|
79
61
|
if (name.length === 0) {
|
|
80
62
|
throw new TypeError('A name for the custom event must be provided');
|
|
81
63
|
}
|
|
82
|
-
|
|
83
64
|
for (const key in dimensions) {
|
|
84
65
|
if (typeof key !== 'string' || typeof dimensions[key] !== 'string') {
|
|
85
66
|
throw new TypeError('track() dimensions expects keys and values of type "string".');
|
|
86
67
|
}
|
|
87
68
|
}
|
|
88
|
-
|
|
89
69
|
return _CoreManager.default.getAnalyticsController().track(name, dimensions);
|
|
90
70
|
}
|
|
91
|
-
|
|
92
71
|
const DefaultController = {
|
|
93
72
|
track(name, dimensions) {
|
|
94
73
|
const RESTController = _CoreManager.default.getRESTController();
|
|
95
|
-
|
|
96
74
|
return RESTController.request('POST', 'events/' + name, {
|
|
97
75
|
dimensions: dimensions
|
|
98
76
|
});
|
|
99
77
|
}
|
|
100
|
-
|
|
101
78
|
};
|
|
102
|
-
|
|
103
79
|
_CoreManager.default.setAnalyticsController(DefaultController);
|
|
@@ -4,29 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _ParseUser = _interopRequireDefault(require("./ParseUser"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) {
|
|
11
9
|
return obj && obj.__esModule ? obj : {
|
|
12
10
|
default: obj
|
|
13
11
|
};
|
|
14
12
|
}
|
|
15
13
|
/**
|
|
16
|
-
* Copyright (c) 2015-present, Parse, LLC.
|
|
17
|
-
* All rights reserved.
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the BSD-style license found in the
|
|
20
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
21
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
22
|
-
*
|
|
23
14
|
* @flow-weak
|
|
24
15
|
*/
|
|
25
16
|
|
|
26
|
-
|
|
27
17
|
const uuidv4 = require('./uuid');
|
|
28
|
-
|
|
29
18
|
let registered = false;
|
|
19
|
+
|
|
30
20
|
/**
|
|
31
21
|
* Provides utility functions for working with Anonymously logged-in users. <br />
|
|
32
22
|
* Anonymous users have some unique characteristics:
|
|
@@ -55,7 +45,6 @@ let registered = false;
|
|
|
55
45
|
* @class Parse.AnonymousUtils
|
|
56
46
|
* @static
|
|
57
47
|
*/
|
|
58
|
-
|
|
59
48
|
const AnonymousUtils = {
|
|
60
49
|
/**
|
|
61
50
|
* Gets whether the user has their account linked to anonymous user.
|
|
@@ -68,14 +57,10 @@ const AnonymousUtils = {
|
|
|
68
57
|
* linked to an anonymous user.
|
|
69
58
|
* @static
|
|
70
59
|
*/
|
|
71
|
-
isLinked(user
|
|
72
|
-
/*: ParseUser*/
|
|
73
|
-
) {
|
|
60
|
+
isLinked(user /*: ParseUser*/) {
|
|
74
61
|
const provider = this._getAuthProvider();
|
|
75
|
-
|
|
76
62
|
return user._isLinked(provider.getAuthType());
|
|
77
63
|
},
|
|
78
|
-
|
|
79
64
|
/**
|
|
80
65
|
* Logs in a user Anonymously.
|
|
81
66
|
*
|
|
@@ -85,16 +70,10 @@ const AnonymousUtils = {
|
|
|
85
70
|
* @returns {Promise} Logged in user
|
|
86
71
|
* @static
|
|
87
72
|
*/
|
|
88
|
-
logIn(options
|
|
89
|
-
/*:: ?: RequestOptions*/
|
|
90
|
-
)
|
|
91
|
-
/*: Promise<ParseUser>*/
|
|
92
|
-
{
|
|
73
|
+
logIn(options /*:: ?: RequestOptions*/) /*: Promise<ParseUser>*/{
|
|
93
74
|
const provider = this._getAuthProvider();
|
|
94
|
-
|
|
95
75
|
return _ParseUser.default.logInWith(provider.getAuthType(), provider.getAuthData(), options);
|
|
96
76
|
},
|
|
97
|
-
|
|
98
77
|
/**
|
|
99
78
|
* Links Anonymous User to an existing PFUser.
|
|
100
79
|
*
|
|
@@ -105,18 +84,10 @@ const AnonymousUtils = {
|
|
|
105
84
|
* @returns {Promise} Linked with User
|
|
106
85
|
* @static
|
|
107
86
|
*/
|
|
108
|
-
link(user
|
|
109
|
-
/*: ParseUser*/
|
|
110
|
-
, options
|
|
111
|
-
/*:: ?: RequestOptions*/
|
|
112
|
-
)
|
|
113
|
-
/*: Promise<ParseUser>*/
|
|
114
|
-
{
|
|
87
|
+
link(user /*: ParseUser*/, options /*:: ?: RequestOptions*/) /*: Promise<ParseUser>*/{
|
|
115
88
|
const provider = this._getAuthProvider();
|
|
116
|
-
|
|
117
89
|
return user.linkWith(provider.getAuthType(), provider.getAuthData(), options);
|
|
118
90
|
},
|
|
119
|
-
|
|
120
91
|
/**
|
|
121
92
|
* Returns true if Authentication Provider has been registered for use.
|
|
122
93
|
*
|
|
@@ -125,22 +96,17 @@ const AnonymousUtils = {
|
|
|
125
96
|
* @returns {boolean}
|
|
126
97
|
* @static
|
|
127
98
|
*/
|
|
128
|
-
isRegistered()
|
|
129
|
-
/*: boolean*/
|
|
130
|
-
{
|
|
99
|
+
isRegistered() /*: boolean*/{
|
|
131
100
|
return registered;
|
|
132
101
|
},
|
|
133
|
-
|
|
134
102
|
_getAuthProvider() {
|
|
135
103
|
const provider = {
|
|
136
104
|
restoreAuthentication() {
|
|
137
105
|
return true;
|
|
138
106
|
},
|
|
139
|
-
|
|
140
107
|
getAuthType() {
|
|
141
108
|
return 'anonymous';
|
|
142
109
|
},
|
|
143
|
-
|
|
144
110
|
getAuthData() {
|
|
145
111
|
return {
|
|
146
112
|
authData: {
|
|
@@ -148,18 +114,13 @@ const AnonymousUtils = {
|
|
|
148
114
|
}
|
|
149
115
|
};
|
|
150
116
|
}
|
|
151
|
-
|
|
152
117
|
};
|
|
153
|
-
|
|
154
118
|
if (!registered) {
|
|
155
119
|
_ParseUser.default._registerAuthenticationProvider(provider);
|
|
156
|
-
|
|
157
120
|
registered = true;
|
|
158
121
|
}
|
|
159
|
-
|
|
160
122
|
return provider;
|
|
161
123
|
}
|
|
162
|
-
|
|
163
124
|
};
|
|
164
125
|
var _default = AnonymousUtils;
|
|
165
126
|
exports.default = _default;
|
package/lib/node/Cloud.js
CHANGED
|
@@ -7,32 +7,18 @@ exports.getJobStatus = getJobStatus;
|
|
|
7
7
|
exports.getJobsData = getJobsData;
|
|
8
8
|
exports.run = run;
|
|
9
9
|
exports.startJob = startJob;
|
|
10
|
-
|
|
11
10
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
12
|
-
|
|
13
11
|
var _decode = _interopRequireDefault(require("./decode"));
|
|
14
|
-
|
|
15
12
|
var _encode = _interopRequireDefault(require("./encode"));
|
|
16
|
-
|
|
17
13
|
var _ParseError = _interopRequireDefault(require("./ParseError"));
|
|
18
|
-
|
|
19
14
|
var _ParseQuery = _interopRequireDefault(require("./ParseQuery"));
|
|
20
|
-
|
|
21
15
|
var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
22
|
-
|
|
23
16
|
function _interopRequireDefault(obj) {
|
|
24
17
|
return obj && obj.__esModule ? obj : {
|
|
25
18
|
default: obj
|
|
26
19
|
};
|
|
27
20
|
}
|
|
28
21
|
/**
|
|
29
|
-
* Copyright (c) 2015-present, Parse, LLC.
|
|
30
|
-
* All rights reserved.
|
|
31
|
-
*
|
|
32
|
-
* This source code is licensed under the BSD-style license found in the
|
|
33
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
34
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
35
|
-
*
|
|
36
22
|
* @flow
|
|
37
23
|
*/
|
|
38
24
|
|
|
@@ -59,39 +45,24 @@ function _interopRequireDefault(obj) {
|
|
|
59
45
|
* @returns {Promise} A promise that will be resolved with the result
|
|
60
46
|
* of the function.
|
|
61
47
|
*/
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
function run(name
|
|
65
|
-
/*: string*/
|
|
66
|
-
, data
|
|
67
|
-
/*: mixed*/
|
|
68
|
-
, options
|
|
69
|
-
/*: RequestOptions*/
|
|
70
|
-
)
|
|
71
|
-
/*: Promise<mixed>*/
|
|
72
|
-
{
|
|
48
|
+
function run(name /*: string*/, data /*: mixed*/, options /*: RequestOptions*/) /*: Promise<mixed>*/{
|
|
73
49
|
options = options || {};
|
|
74
|
-
|
|
75
50
|
if (typeof name !== 'string' || name.length === 0) {
|
|
76
51
|
throw new TypeError('Cloud function name must be a string.');
|
|
77
52
|
}
|
|
78
|
-
|
|
79
53
|
const requestOptions = {};
|
|
80
|
-
|
|
81
54
|
if (options.useMasterKey) {
|
|
82
55
|
requestOptions.useMasterKey = options.useMasterKey;
|
|
83
56
|
}
|
|
84
|
-
|
|
85
57
|
if (options.sessionToken) {
|
|
86
58
|
requestOptions.sessionToken = options.sessionToken;
|
|
87
59
|
}
|
|
88
|
-
|
|
89
60
|
if (options.context && typeof options.context === 'object') {
|
|
90
61
|
requestOptions.context = options.context;
|
|
91
62
|
}
|
|
92
|
-
|
|
93
63
|
return _CoreManager.default.getCloudController().run(name, data, requestOptions);
|
|
94
64
|
}
|
|
65
|
+
|
|
95
66
|
/**
|
|
96
67
|
* Gets data for the current set of cloud jobs.
|
|
97
68
|
*
|
|
@@ -100,15 +71,12 @@ function run(name
|
|
|
100
71
|
* @returns {Promise} A promise that will be resolved with the result
|
|
101
72
|
* of the function.
|
|
102
73
|
*/
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
function getJobsData()
|
|
106
|
-
/*: Promise<Object>*/
|
|
107
|
-
{
|
|
74
|
+
function getJobsData() /*: Promise<Object>*/{
|
|
108
75
|
return _CoreManager.default.getCloudController().getJobsData({
|
|
109
76
|
useMasterKey: true
|
|
110
77
|
});
|
|
111
78
|
}
|
|
79
|
+
|
|
112
80
|
/**
|
|
113
81
|
* Starts a given cloud job, which will process asynchronously.
|
|
114
82
|
*
|
|
@@ -119,23 +87,15 @@ function getJobsData()
|
|
|
119
87
|
* @returns {Promise} A promise that will be resolved with the jobStatusId
|
|
120
88
|
* of the job.
|
|
121
89
|
*/
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
function startJob(name
|
|
125
|
-
/*: string*/
|
|
126
|
-
, data
|
|
127
|
-
/*: mixed*/
|
|
128
|
-
)
|
|
129
|
-
/*: Promise<string>*/
|
|
130
|
-
{
|
|
90
|
+
function startJob(name /*: string*/, data /*: mixed*/) /*: Promise<string>*/{
|
|
131
91
|
if (typeof name !== 'string' || name.length === 0) {
|
|
132
92
|
throw new TypeError('Cloud job name must be a string.');
|
|
133
93
|
}
|
|
134
|
-
|
|
135
94
|
return _CoreManager.default.getCloudController().startJob(name, data, {
|
|
136
95
|
useMasterKey: true
|
|
137
96
|
});
|
|
138
97
|
}
|
|
98
|
+
|
|
139
99
|
/**
|
|
140
100
|
* Gets job status by Id
|
|
141
101
|
*
|
|
@@ -144,59 +104,36 @@ function startJob(name
|
|
|
144
104
|
* @param {string} jobStatusId The Id of Job Status.
|
|
145
105
|
* @returns {Parse.Object} Status of Job.
|
|
146
106
|
*/
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
function getJobStatus(jobStatusId
|
|
150
|
-
/*: string*/
|
|
151
|
-
)
|
|
152
|
-
/*: Promise<ParseObject>*/
|
|
153
|
-
{
|
|
107
|
+
function getJobStatus(jobStatusId /*: string*/) /*: Promise<ParseObject>*/{
|
|
154
108
|
const query = new _ParseQuery.default('_JobStatus');
|
|
155
109
|
return query.get(jobStatusId, {
|
|
156
110
|
useMasterKey: true
|
|
157
111
|
});
|
|
158
112
|
}
|
|
159
|
-
|
|
160
113
|
const DefaultController = {
|
|
161
|
-
run(name, data, options
|
|
162
|
-
/*: RequestOptions*/
|
|
163
|
-
) {
|
|
114
|
+
run(name, data, options /*: RequestOptions*/) {
|
|
164
115
|
const RESTController = _CoreManager.default.getRESTController();
|
|
165
|
-
|
|
166
116
|
const payload = (0, _encode.default)(data, true);
|
|
167
117
|
const request = RESTController.request('POST', 'functions/' + name, payload, options);
|
|
168
118
|
return request.then(res => {
|
|
169
119
|
if (typeof res === 'object' && Object.keys(res).length > 0 && !res.hasOwnProperty('result')) {
|
|
170
120
|
throw new _ParseError.default(_ParseError.default.INVALID_JSON, 'The server returned an invalid response.');
|
|
171
121
|
}
|
|
172
|
-
|
|
173
122
|
const decoded = (0, _decode.default)(res);
|
|
174
|
-
|
|
175
123
|
if (decoded && decoded.hasOwnProperty('result')) {
|
|
176
124
|
return Promise.resolve(decoded.result);
|
|
177
125
|
}
|
|
178
|
-
|
|
179
126
|
return Promise.resolve(undefined);
|
|
180
127
|
});
|
|
181
128
|
},
|
|
182
|
-
|
|
183
|
-
getJobsData(options
|
|
184
|
-
/*: RequestOptions*/
|
|
185
|
-
) {
|
|
129
|
+
getJobsData(options /*: RequestOptions*/) {
|
|
186
130
|
const RESTController = _CoreManager.default.getRESTController();
|
|
187
|
-
|
|
188
131
|
return RESTController.request('GET', 'cloud_code/jobs/data', null, options);
|
|
189
132
|
},
|
|
190
|
-
|
|
191
|
-
startJob(name, data, options
|
|
192
|
-
/*: RequestOptions*/
|
|
193
|
-
) {
|
|
133
|
+
startJob(name, data, options /*: RequestOptions*/) {
|
|
194
134
|
const RESTController = _CoreManager.default.getRESTController();
|
|
195
|
-
|
|
196
135
|
const payload = (0, _encode.default)(data, true);
|
|
197
136
|
return RESTController.request('POST', 'jobs/' + name, payload, options);
|
|
198
137
|
}
|
|
199
|
-
|
|
200
138
|
};
|
|
201
|
-
|
|
202
139
|
_CoreManager.default.setCloudController(DefaultController);
|
package/lib/node/CloudCode.js
CHANGED
|
@@ -171,7 +171,6 @@
|
|
|
171
171
|
* @name Parse.Cloud.beforeConnect
|
|
172
172
|
* @param {Function} func The function to before connection is made. This function can be async and should take just one parameter, {@link Parse.Cloud.ConnectTriggerRequest}.
|
|
173
173
|
*/
|
|
174
|
-
|
|
175
174
|
/**
|
|
176
175
|
*
|
|
177
176
|
* Registers a before connect function.
|
|
@@ -194,7 +193,6 @@
|
|
|
194
193
|
* @param {(string | Parse.Object)} arg1 The Parse.Object subclass to register the before subscription function for. This can instead be a String that is the className of the subclass.
|
|
195
194
|
* @param {Function} func The function to run before a subscription. This function can be async and should take one parameter, a {@link Parse.Cloud.TriggerRequest}.
|
|
196
195
|
*/
|
|
197
|
-
|
|
198
196
|
/**
|
|
199
197
|
*
|
|
200
198
|
* Registers a before subscribe function.
|
|
@@ -247,7 +245,6 @@
|
|
|
247
245
|
* @name Parse.Cloud.job
|
|
248
246
|
* @param {string} name The name of the Background Job
|
|
249
247
|
* @param {Function} func The Background Job to register. This function should take two parameters a {@link Parse.Cloud.JobRequest} and a {@link Parse.Cloud.JobStatus}
|
|
250
|
-
*
|
|
251
248
|
*/
|
|
252
249
|
|
|
253
250
|
/**
|