parse 4.0.1 → 4.1.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 +17995 -26193
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +8739 -17728
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/Analytics.js +2 -20
- package/lib/browser/AnonymousUtils.js +6 -35
- package/lib/browser/Cloud.js +12 -70
- package/lib/browser/CloudCode.js +0 -3
- package/lib/browser/CoreManager.js +46 -184
- package/lib/browser/CryptoController.js +2 -16
- package/lib/browser/EventEmitter.js +1 -1
- package/lib/browser/EventuallyQueue.js +277 -824
- package/lib/browser/FacebookUtils.js +6 -35
- package/lib/browser/IndexedDBStorageController.js +3 -14
- package/lib/browser/InstallationController.js +2 -13
- package/lib/browser/LiveQueryClient.js +87 -204
- 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 -12
- package/lib/browser/ObjectStateMutations.js +18 -121
- package/lib/browser/OfflineQuery.js +42 -222
- package/lib/browser/Parse.js +12 -106
- package/lib/browser/ParseACL.js +33 -141
- package/lib/browser/ParseCLP.js +96 -314
- package/lib/browser/ParseConfig.js +18 -88
- package/lib/browser/ParseError.js +63 -90
- package/lib/browser/ParseFile.js +129 -685
- package/lib/browser/ParseGeoPoint.js +23 -82
- 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 +628 -1840
- package/lib/browser/ParseOp.js +41 -287
- package/lib/browser/ParsePolygon.js +13 -63
- package/lib/browser/ParseQuery.js +404 -1505
- package/lib/browser/ParseRelation.js +12 -61
- package/lib/browser/ParseRole.js +13 -75
- package/lib/browser/ParseSchema.js +49 -201
- package/lib/browser/ParseSession.js +11 -69
- package/lib/browser/ParseUser.js +274 -1127
- package/lib/browser/Push.js +7 -43
- package/lib/browser/RESTController.js +18 -140
- package/lib/browser/SingleInstanceStateController.js +19 -137
- package/lib/browser/Socket.weapp.js +2 -12
- package/lib/browser/Storage.js +10 -73
- package/lib/browser/StorageController.browser.js +4 -17
- package/lib/browser/StorageController.default.js +4 -17
- package/lib/browser/StorageController.react-native.js +6 -33
- package/lib/browser/StorageController.weapp.js +5 -16
- package/lib/browser/TaskQueue.js +1 -22
- package/lib/browser/UniqueInstanceStateController.js +19 -142
- package/lib/browser/Xhr.weapp.js +0 -17
- package/lib/browser/arrayContainsObject.js +2 -16
- package/lib/browser/canBeSerialized.js +3 -33
- package/lib/browser/decode.js +3 -33
- package/lib/browser/encode.js +9 -70
- package/lib/browser/equals.js +2 -25
- package/lib/browser/escape.js +1 -8
- package/lib/browser/isRevocableSession.js +2 -11
- package/lib/browser/parseDate.js +2 -13
- package/lib/browser/promiseUtils.js +3 -21
- package/lib/browser/unique.js +3 -17
- package/lib/browser/unsavedChildren.js +6 -50
- package/lib/browser/uuid.js +3 -1
- package/lib/node/Analytics.js +1 -18
- package/lib/node/AnonymousUtils.js +5 -37
- package/lib/node/Cloud.js +10 -66
- package/lib/node/CloudCode.js +0 -3
- package/lib/node/CoreManager.js +47 -220
- package/lib/node/CryptoController.js +2 -16
- package/lib/node/EventEmitter.js +1 -1
- package/lib/node/EventuallyQueue.js +16 -123
- package/lib/node/FacebookUtils.js +5 -37
- package/lib/node/IndexedDBStorageController.js +3 -19
- package/lib/node/InstallationController.js +2 -15
- package/lib/node/LiveQueryClient.js +56 -136
- package/lib/node/LiveQuerySubscription.js +7 -16
- package/lib/node/LocalDatastore.js +19 -175
- package/lib/node/LocalDatastoreController.js +6 -38
- package/lib/node/LocalDatastoreController.react-native.js +6 -45
- package/lib/node/LocalDatastoreUtils.js +1 -6
- package/lib/node/ObjectStateMutations.js +13 -93
- package/lib/node/OfflineQuery.js +20 -152
- package/lib/node/Parse.js +11 -99
- package/lib/node/ParseACL.js +32 -150
- package/lib/node/ParseCLP.js +69 -262
- package/lib/node/ParseConfig.js +16 -84
- package/lib/node/ParseError.js +61 -65
- package/lib/node/ParseFile.js +50 -205
- package/lib/node/ParseGeoPoint.js +21 -82
- package/lib/node/ParseHooks.js +0 -35
- package/lib/node/ParseInstallation.js +1 -10
- package/lib/node/ParseLiveQuery.js +10 -36
- package/lib/node/ParseObject.js +193 -939
- package/lib/node/ParseOp.js +31 -255
- package/lib/node/ParsePolygon.js +12 -62
- package/lib/node/ParseQuery.js +170 -882
- package/lib/node/ParseRelation.js +11 -61
- package/lib/node/ParseRole.js +10 -57
- package/lib/node/ParseSchema.js +46 -222
- package/lib/node/ParseSession.js +8 -50
- package/lib/node/ParseUser.js +107 -576
- package/lib/node/Push.js +4 -37
- package/lib/node/RESTController.js +8 -110
- package/lib/node/SingleInstanceStateController.js +17 -130
- package/lib/node/Socket.weapp.js +2 -9
- package/lib/node/Storage.js +10 -83
- package/lib/node/StorageController.browser.js +4 -23
- package/lib/node/StorageController.default.js +5 -21
- package/lib/node/StorageController.react-native.js +6 -40
- package/lib/node/StorageController.weapp.js +6 -21
- package/lib/node/TaskQueue.js +1 -17
- package/lib/node/UniqueInstanceStateController.js +16 -133
- package/lib/node/Xhr.weapp.js +0 -15
- package/lib/node/arrayContainsObject.js +1 -12
- package/lib/node/canBeSerialized.js +2 -28
- package/lib/node/decode.js +1 -26
- package/lib/node/encode.js +3 -54
- package/lib/node/equals.js +0 -18
- package/lib/node/escape.js +1 -6
- package/lib/node/isRevocableSession.js +1 -5
- package/lib/node/parseDate.js +1 -7
- package/lib/node/promiseUtils.js +2 -14
- package/lib/node/unique.js +1 -11
- package/lib/node/unsavedChildren.js +2 -38
- 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 +1 -5
- package/lib/react-native/CryptoController.js +0 -2
- package/lib/react-native/EventEmitter.js +0 -2
- package/lib/react-native/EventuallyQueue.js +4 -52
- 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 +24 -101
- package/lib/react-native/LiveQuerySubscription.js +3 -27
- package/lib/react-native/LocalDatastore.js +6 -113
- package/lib/react-native/LocalDatastoreController.js +0 -21
- package/lib/react-native/LocalDatastoreController.react-native.js +4 -31
- package/lib/react-native/LocalDatastoreUtils.js +0 -1
- package/lib/react-native/ObjectStateMutations.js +0 -34
- package/lib/react-native/OfflineQuery.js +2 -137
- package/lib/react-native/Parse.js +0 -65
- package/lib/react-native/ParseACL.js +0 -44
- package/lib/react-native/ParseCLP.js +32 -96
- package/lib/react-native/ParseConfig.js +0 -42
- package/lib/react-native/ParseError.js +1 -21
- package/lib/react-native/ParseFile.js +4 -72
- 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 +3 -25
- package/lib/react-native/ParseObject.js +4 -371
- package/lib/react-native/ParseOp.js +1 -138
- package/lib/react-native/ParsePolygon.js +0 -24
- package/lib/react-native/ParseQuery.js +6 -262
- package/lib/react-native/ParseRelation.js +0 -25
- package/lib/react-native/ParseRole.js +1 -36
- package/lib/react-native/ParseSchema.js +0 -51
- package/lib/react-native/ParseSession.js +1 -40
- package/lib/react-native/ParseUser.js +1 -224
- package/lib/react-native/Push.js +0 -16
- package/lib/react-native/RESTController.js +1 -70
- package/lib/react-native/SingleInstanceStateController.js +0 -44
- package/lib/react-native/Socket.weapp.js +2 -12
- 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 -20
- package/lib/weapp/AnonymousUtils.js +6 -35
- package/lib/weapp/Cloud.js +12 -70
- package/lib/weapp/CloudCode.js +0 -3
- package/lib/weapp/CoreManager.js +46 -184
- package/lib/weapp/CryptoController.js +2 -16
- package/lib/weapp/EventEmitter.js +1 -1
- package/lib/weapp/EventuallyQueue.js +277 -824
- package/lib/weapp/FacebookUtils.js +6 -35
- package/lib/weapp/IndexedDBStorageController.js +3 -14
- package/lib/weapp/InstallationController.js +2 -13
- package/lib/weapp/LiveQueryClient.js +87 -204
- 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 -12
- package/lib/weapp/ObjectStateMutations.js +18 -121
- package/lib/weapp/OfflineQuery.js +42 -222
- package/lib/weapp/Parse.js +12 -106
- package/lib/weapp/ParseACL.js +33 -141
- package/lib/weapp/ParseCLP.js +96 -314
- package/lib/weapp/ParseConfig.js +18 -88
- package/lib/weapp/ParseError.js +63 -90
- package/lib/weapp/ParseFile.js +130 -686
- package/lib/weapp/ParseGeoPoint.js +23 -82
- 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 +628 -1840
- package/lib/weapp/ParseOp.js +41 -287
- package/lib/weapp/ParsePolygon.js +13 -63
- package/lib/weapp/ParseQuery.js +404 -1505
- package/lib/weapp/ParseRelation.js +12 -61
- package/lib/weapp/ParseRole.js +13 -75
- package/lib/weapp/ParseSchema.js +49 -201
- package/lib/weapp/ParseSession.js +11 -69
- package/lib/weapp/ParseUser.js +274 -1127
- package/lib/weapp/Push.js +7 -43
- package/lib/weapp/RESTController.js +18 -140
- package/lib/weapp/SingleInstanceStateController.js +19 -137
- package/lib/weapp/Socket.weapp.js +2 -12
- package/lib/weapp/Storage.js +10 -73
- package/lib/weapp/StorageController.browser.js +4 -17
- package/lib/weapp/StorageController.default.js +4 -17
- package/lib/weapp/StorageController.react-native.js +6 -33
- package/lib/weapp/StorageController.weapp.js +5 -16
- package/lib/weapp/TaskQueue.js +1 -22
- package/lib/weapp/UniqueInstanceStateController.js +19 -142
- package/lib/weapp/Xhr.weapp.js +0 -17
- package/lib/weapp/arrayContainsObject.js +2 -16
- package/lib/weapp/canBeSerialized.js +3 -33
- package/lib/weapp/decode.js +3 -33
- package/lib/weapp/encode.js +9 -70
- package/lib/weapp/equals.js +2 -25
- package/lib/weapp/escape.js +1 -8
- package/lib/weapp/isRevocableSession.js +2 -11
- package/lib/weapp/parseDate.js +2 -13
- package/lib/weapp/promiseUtils.js +3 -21
- package/lib/weapp/unique.js +3 -17
- package/lib/weapp/unsavedChildren.js +6 -50
- package/lib/weapp/uuid.js +1 -6
- package/package.json +45 -43
package/lib/browser/Analytics.js
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
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.track = track;
|
|
12
|
-
|
|
13
9
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
14
10
|
/**
|
|
15
11
|
* @flow
|
|
@@ -55,40 +51,26 @@ var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
|
55
51
|
* @returns {Promise} A promise that is resolved when the round-trip
|
|
56
52
|
* to the server completes.
|
|
57
53
|
*/
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
function track(name
|
|
61
|
-
/*: string*/
|
|
62
|
-
, dimensions
|
|
63
|
-
/*: { [key: string]: string }*/
|
|
64
|
-
)
|
|
65
|
-
/*: Promise*/
|
|
66
|
-
{
|
|
54
|
+
function track(name /*: string*/, dimensions /*: { [key: string]: string }*/) /*: Promise*/{
|
|
67
55
|
name = name || '';
|
|
68
56
|
name = name.replace(/^\s*/, '');
|
|
69
57
|
name = name.replace(/\s*$/, '');
|
|
70
|
-
|
|
71
58
|
if (name.length === 0) {
|
|
72
59
|
throw new TypeError('A name for the custom event must be provided');
|
|
73
60
|
}
|
|
74
|
-
|
|
75
61
|
for (var _key in dimensions) {
|
|
76
62
|
if (typeof _key !== 'string' || typeof dimensions[_key] !== 'string') {
|
|
77
63
|
throw new TypeError('track() dimensions expects keys and values of type "string".');
|
|
78
64
|
}
|
|
79
65
|
}
|
|
80
|
-
|
|
81
66
|
return _CoreManager.default.getAnalyticsController().track(name, dimensions);
|
|
82
67
|
}
|
|
83
|
-
|
|
84
68
|
var DefaultController = {
|
|
85
69
|
track: function (name, dimensions) {
|
|
86
70
|
var RESTController = _CoreManager.default.getRESTController();
|
|
87
|
-
|
|
88
71
|
return RESTController.request('POST', 'events/' + name, {
|
|
89
72
|
dimensions: dimensions
|
|
90
73
|
});
|
|
91
74
|
}
|
|
92
75
|
};
|
|
93
|
-
|
|
94
76
|
_CoreManager.default.setAnalyticsController(DefaultController);
|
|
@@ -1,24 +1,19 @@
|
|
|
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 = void 0;
|
|
12
|
-
|
|
13
9
|
var _ParseUser = _interopRequireDefault(require("./ParseUser"));
|
|
14
10
|
/**
|
|
15
11
|
* @flow-weak
|
|
16
12
|
*/
|
|
17
13
|
|
|
18
|
-
|
|
19
14
|
var uuidv4 = require('./uuid');
|
|
20
|
-
|
|
21
15
|
var registered = false;
|
|
16
|
+
|
|
22
17
|
/**
|
|
23
18
|
* Provides utility functions for working with Anonymously logged-in users. <br />
|
|
24
19
|
* Anonymous users have some unique characteristics:
|
|
@@ -47,7 +42,6 @@ var registered = false;
|
|
|
47
42
|
* @class Parse.AnonymousUtils
|
|
48
43
|
* @static
|
|
49
44
|
*/
|
|
50
|
-
|
|
51
45
|
var AnonymousUtils = {
|
|
52
46
|
/**
|
|
53
47
|
* Gets whether the user has their account linked to anonymous user.
|
|
@@ -60,14 +54,10 @@ var AnonymousUtils = {
|
|
|
60
54
|
* linked to an anonymous user.
|
|
61
55
|
* @static
|
|
62
56
|
*/
|
|
63
|
-
isLinked: function (user
|
|
64
|
-
/*: ParseUser*/
|
|
65
|
-
) {
|
|
57
|
+
isLinked: function (user /*: ParseUser*/) {
|
|
66
58
|
var provider = this._getAuthProvider();
|
|
67
|
-
|
|
68
59
|
return user._isLinked(provider.getAuthType());
|
|
69
60
|
},
|
|
70
|
-
|
|
71
61
|
/**
|
|
72
62
|
* Logs in a user Anonymously.
|
|
73
63
|
*
|
|
@@ -77,16 +67,10 @@ var AnonymousUtils = {
|
|
|
77
67
|
* @returns {Promise} Logged in user
|
|
78
68
|
* @static
|
|
79
69
|
*/
|
|
80
|
-
logIn: function (options
|
|
81
|
-
/*:: ?: RequestOptions*/
|
|
82
|
-
)
|
|
83
|
-
/*: Promise<ParseUser>*/
|
|
84
|
-
{
|
|
70
|
+
logIn: function (options /*:: ?: RequestOptions*/) /*: Promise<ParseUser>*/{
|
|
85
71
|
var provider = this._getAuthProvider();
|
|
86
|
-
|
|
87
72
|
return _ParseUser.default.logInWith(provider.getAuthType(), provider.getAuthData(), options);
|
|
88
73
|
},
|
|
89
|
-
|
|
90
74
|
/**
|
|
91
75
|
* Links Anonymous User to an existing PFUser.
|
|
92
76
|
*
|
|
@@ -97,18 +81,10 @@ var AnonymousUtils = {
|
|
|
97
81
|
* @returns {Promise} Linked with User
|
|
98
82
|
* @static
|
|
99
83
|
*/
|
|
100
|
-
link: function (user
|
|
101
|
-
/*: ParseUser*/
|
|
102
|
-
, options
|
|
103
|
-
/*:: ?: RequestOptions*/
|
|
104
|
-
)
|
|
105
|
-
/*: Promise<ParseUser>*/
|
|
106
|
-
{
|
|
84
|
+
link: function (user /*: ParseUser*/, options /*:: ?: RequestOptions*/) /*: Promise<ParseUser>*/{
|
|
107
85
|
var provider = this._getAuthProvider();
|
|
108
|
-
|
|
109
86
|
return user.linkWith(provider.getAuthType(), provider.getAuthData(), options);
|
|
110
87
|
},
|
|
111
|
-
|
|
112
88
|
/**
|
|
113
89
|
* Returns true if Authentication Provider has been registered for use.
|
|
114
90
|
*
|
|
@@ -117,9 +93,7 @@ var AnonymousUtils = {
|
|
|
117
93
|
* @returns {boolean}
|
|
118
94
|
* @static
|
|
119
95
|
*/
|
|
120
|
-
isRegistered: function ()
|
|
121
|
-
/*: boolean*/
|
|
122
|
-
{
|
|
96
|
+
isRegistered: function () /*: boolean*/{
|
|
123
97
|
return registered;
|
|
124
98
|
},
|
|
125
99
|
_getAuthProvider: function () {
|
|
@@ -138,13 +112,10 @@ var AnonymousUtils = {
|
|
|
138
112
|
};
|
|
139
113
|
}
|
|
140
114
|
};
|
|
141
|
-
|
|
142
115
|
if (!registered) {
|
|
143
116
|
_ParseUser.default._registerAuthenticationProvider(provider);
|
|
144
|
-
|
|
145
117
|
registered = true;
|
|
146
118
|
}
|
|
147
|
-
|
|
148
119
|
return provider;
|
|
149
120
|
}
|
|
150
121
|
};
|
package/lib/browser/Cloud.js
CHANGED
|
@@ -1,34 +1,22 @@
|
|
|
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.getJobStatus = getJobStatus;
|
|
12
9
|
exports.getJobsData = getJobsData;
|
|
13
10
|
exports.run = run;
|
|
14
11
|
exports.startJob = startJob;
|
|
15
|
-
|
|
16
|
-
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
17
|
-
|
|
18
12
|
var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
|
|
19
|
-
|
|
13
|
+
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
20
14
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
|
|
21
|
-
|
|
22
15
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
23
|
-
|
|
24
16
|
var _decode = _interopRequireDefault(require("./decode"));
|
|
25
|
-
|
|
26
17
|
var _encode = _interopRequireDefault(require("./encode"));
|
|
27
|
-
|
|
28
18
|
var _ParseError = _interopRequireDefault(require("./ParseError"));
|
|
29
|
-
|
|
30
19
|
var _ParseQuery = _interopRequireDefault(require("./ParseQuery"));
|
|
31
|
-
|
|
32
20
|
var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
33
21
|
/**
|
|
34
22
|
* @flow
|
|
@@ -57,39 +45,24 @@ var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
|
57
45
|
* @returns {Promise} A promise that will be resolved with the result
|
|
58
46
|
* of the function.
|
|
59
47
|
*/
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
function run(name
|
|
63
|
-
/*: string*/
|
|
64
|
-
, data
|
|
65
|
-
/*: mixed*/
|
|
66
|
-
, options
|
|
67
|
-
/*: RequestOptions*/
|
|
68
|
-
)
|
|
69
|
-
/*: Promise<mixed>*/
|
|
70
|
-
{
|
|
48
|
+
function run(name /*: string*/, data /*: mixed*/, options /*: RequestOptions*/) /*: Promise<mixed>*/{
|
|
71
49
|
options = options || {};
|
|
72
|
-
|
|
73
50
|
if (typeof name !== 'string' || name.length === 0) {
|
|
74
51
|
throw new TypeError('Cloud function name must be a string.');
|
|
75
52
|
}
|
|
76
|
-
|
|
77
53
|
var requestOptions = {};
|
|
78
|
-
|
|
79
54
|
if (options.useMasterKey) {
|
|
80
55
|
requestOptions.useMasterKey = options.useMasterKey;
|
|
81
56
|
}
|
|
82
|
-
|
|
83
57
|
if (options.sessionToken) {
|
|
84
58
|
requestOptions.sessionToken = options.sessionToken;
|
|
85
59
|
}
|
|
86
|
-
|
|
87
60
|
if (options.context && (0, _typeof2.default)(options.context) === 'object') {
|
|
88
61
|
requestOptions.context = options.context;
|
|
89
62
|
}
|
|
90
|
-
|
|
91
63
|
return _CoreManager.default.getCloudController().run(name, data, requestOptions);
|
|
92
64
|
}
|
|
65
|
+
|
|
93
66
|
/**
|
|
94
67
|
* Gets data for the current set of cloud jobs.
|
|
95
68
|
*
|
|
@@ -98,15 +71,12 @@ function run(name
|
|
|
98
71
|
* @returns {Promise} A promise that will be resolved with the result
|
|
99
72
|
* of the function.
|
|
100
73
|
*/
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
function getJobsData()
|
|
104
|
-
/*: Promise<Object>*/
|
|
105
|
-
{
|
|
74
|
+
function getJobsData() /*: Promise<Object>*/{
|
|
106
75
|
return _CoreManager.default.getCloudController().getJobsData({
|
|
107
76
|
useMasterKey: true
|
|
108
77
|
});
|
|
109
78
|
}
|
|
79
|
+
|
|
110
80
|
/**
|
|
111
81
|
* Starts a given cloud job, which will process asynchronously.
|
|
112
82
|
*
|
|
@@ -117,23 +87,15 @@ function getJobsData()
|
|
|
117
87
|
* @returns {Promise} A promise that will be resolved with the jobStatusId
|
|
118
88
|
* of the job.
|
|
119
89
|
*/
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
function startJob(name
|
|
123
|
-
/*: string*/
|
|
124
|
-
, data
|
|
125
|
-
/*: mixed*/
|
|
126
|
-
)
|
|
127
|
-
/*: Promise<string>*/
|
|
128
|
-
{
|
|
90
|
+
function startJob(name /*: string*/, data /*: mixed*/) /*: Promise<string>*/{
|
|
129
91
|
if (typeof name !== 'string' || name.length === 0) {
|
|
130
92
|
throw new TypeError('Cloud job name must be a string.');
|
|
131
93
|
}
|
|
132
|
-
|
|
133
94
|
return _CoreManager.default.getCloudController().startJob(name, data, {
|
|
134
95
|
useMasterKey: true
|
|
135
96
|
});
|
|
136
97
|
}
|
|
98
|
+
|
|
137
99
|
/**
|
|
138
100
|
* Gets job status by Id
|
|
139
101
|
*
|
|
@@ -142,56 +104,36 @@ function startJob(name
|
|
|
142
104
|
* @param {string} jobStatusId The Id of Job Status.
|
|
143
105
|
* @returns {Parse.Object} Status of Job.
|
|
144
106
|
*/
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
function getJobStatus(jobStatusId
|
|
148
|
-
/*: string*/
|
|
149
|
-
)
|
|
150
|
-
/*: Promise<ParseObject>*/
|
|
151
|
-
{
|
|
107
|
+
function getJobStatus(jobStatusId /*: string*/) /*: Promise<ParseObject>*/{
|
|
152
108
|
var query = new _ParseQuery.default('_JobStatus');
|
|
153
109
|
return query.get(jobStatusId, {
|
|
154
110
|
useMasterKey: true
|
|
155
111
|
});
|
|
156
112
|
}
|
|
157
|
-
|
|
158
113
|
var DefaultController = {
|
|
159
|
-
run: function (name, data, options
|
|
160
|
-
/*: RequestOptions*/
|
|
161
|
-
) {
|
|
114
|
+
run: function (name, data, options /*: RequestOptions*/) {
|
|
162
115
|
var RESTController = _CoreManager.default.getRESTController();
|
|
163
|
-
|
|
164
116
|
var payload = (0, _encode.default)(data, true);
|
|
165
117
|
var request = RESTController.request('POST', 'functions/' + name, payload, options);
|
|
166
118
|
return request.then(function (res) {
|
|
167
119
|
if ((0, _typeof2.default)(res) === 'object' && (0, _keys.default)(res).length > 0 && !res.hasOwnProperty('result')) {
|
|
168
120
|
throw new _ParseError.default(_ParseError.default.INVALID_JSON, 'The server returned an invalid response.');
|
|
169
121
|
}
|
|
170
|
-
|
|
171
122
|
var decoded = (0, _decode.default)(res);
|
|
172
|
-
|
|
173
123
|
if (decoded && decoded.hasOwnProperty('result')) {
|
|
174
124
|
return _promise.default.resolve(decoded.result);
|
|
175
125
|
}
|
|
176
|
-
|
|
177
126
|
return _promise.default.resolve(undefined);
|
|
178
127
|
});
|
|
179
128
|
},
|
|
180
|
-
getJobsData: function (options
|
|
181
|
-
/*: RequestOptions*/
|
|
182
|
-
) {
|
|
129
|
+
getJobsData: function (options /*: RequestOptions*/) {
|
|
183
130
|
var RESTController = _CoreManager.default.getRESTController();
|
|
184
|
-
|
|
185
131
|
return RESTController.request('GET', 'cloud_code/jobs/data', null, options);
|
|
186
132
|
},
|
|
187
|
-
startJob: function (name, data, options
|
|
188
|
-
/*: RequestOptions*/
|
|
189
|
-
) {
|
|
133
|
+
startJob: function (name, data, options /*: RequestOptions*/) {
|
|
190
134
|
var RESTController = _CoreManager.default.getRESTController();
|
|
191
|
-
|
|
192
135
|
var payload = (0, _encode.default)(data, true);
|
|
193
136
|
return RESTController.request('POST', 'jobs/' + name, payload, options);
|
|
194
137
|
}
|
|
195
138
|
};
|
|
196
|
-
|
|
197
139
|
_CoreManager.default.setCloudController(DefaultController);
|
package/lib/browser/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
|
/**
|