parse 4.1.0-alpha.4 → 4.1.0
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 +58 -253
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +58 -253
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/AnonymousUtils.js +1 -1
- package/lib/browser/Cloud.js +2 -1
- package/lib/browser/CoreManager.js +1 -1
- package/lib/browser/EventuallyQueue.js +1 -13
- package/lib/browser/LiveQueryClient.js +4 -8
- package/lib/browser/LocalDatastore.js +1 -3
- package/lib/browser/LocalDatastoreController.js +1 -3
- package/lib/browser/ObjectStateMutations.js +1 -14
- package/lib/browser/ParseACL.js +1 -2
- package/lib/browser/ParseCLP.js +1 -6
- package/lib/browser/ParseConfig.js +0 -1
- package/lib/browser/ParseFile.js +1 -5
- package/lib/browser/ParseInstallation.js +1 -4
- package/lib/browser/ParseObject.js +7 -10
- package/lib/browser/ParseOp.js +1 -3
- package/lib/browser/ParseQuery.js +24 -79
- package/lib/browser/ParseRole.js +1 -5
- package/lib/browser/ParseSchema.js +1 -1
- package/lib/browser/ParseSession.js +1 -5
- package/lib/browser/ParseUser.js +1 -42
- package/lib/browser/Push.js +2 -8
- package/lib/browser/RESTController.js +0 -20
- package/lib/browser/SingleInstanceStateController.js +1 -6
- package/lib/browser/TaskQueue.js +0 -4
- package/lib/browser/UniqueInstanceStateController.js +1 -3
- package/lib/browser/unsavedChildren.js +1 -4
- package/lib/node/AnonymousUtils.js +1 -1
- package/lib/node/Cloud.js +2 -1
- package/lib/node/CoreManager.js +1 -1
- package/lib/node/EventuallyQueue.js +1 -13
- package/lib/node/LiveQueryClient.js +2 -5
- package/lib/node/LocalDatastore.js +1 -1
- package/lib/node/ObjectStateMutations.js +1 -11
- package/lib/node/ParseACL.js +1 -2
- package/lib/node/ParseCLP.js +1 -3
- package/lib/node/ParseConfig.js +2 -1
- package/lib/node/ParseFile.js +1 -2
- package/lib/node/ParseInstallation.js +1 -1
- package/lib/node/ParseObject.js +1 -2
- package/lib/node/ParseQuery.js +1 -50
- package/lib/node/ParseRole.js +1 -2
- package/lib/node/ParseSchema.js +1 -1
- package/lib/node/ParseSession.js +1 -2
- package/lib/node/ParseUser.js +1 -37
- package/lib/node/Push.js +2 -8
- package/lib/node/RESTController.js +0 -20
- package/lib/node/SingleInstanceStateController.js +1 -6
- package/lib/node/TaskQueue.js +1 -4
- package/lib/node/UniqueInstanceStateController.js +1 -3
- package/lib/node/unsavedChildren.js +1 -4
- package/lib/react-native/CoreManager.js +1 -1
- package/lib/react-native/LiveQueryClient.js +3 -7
- package/lib/react-native/ParseCLP.js +2 -2
- package/lib/react-native/ParseFile.js +0 -1
- package/lib/react-native/ParseQuery.js +11 -34
- package/lib/react-native/ParseUser.js +0 -25
- package/lib/weapp/AnonymousUtils.js +1 -1
- package/lib/weapp/Cloud.js +2 -1
- package/lib/weapp/CoreManager.js +1 -1
- package/lib/weapp/EventuallyQueue.js +1 -13
- package/lib/weapp/LiveQueryClient.js +4 -8
- package/lib/weapp/LocalDatastore.js +1 -3
- package/lib/weapp/LocalDatastoreController.js +1 -3
- package/lib/weapp/ObjectStateMutations.js +1 -14
- package/lib/weapp/ParseACL.js +1 -2
- package/lib/weapp/ParseCLP.js +1 -6
- package/lib/weapp/ParseConfig.js +0 -1
- package/lib/weapp/ParseFile.js +1 -5
- package/lib/weapp/ParseInstallation.js +1 -4
- package/lib/weapp/ParseObject.js +7 -10
- package/lib/weapp/ParseOp.js +1 -3
- package/lib/weapp/ParseQuery.js +24 -79
- package/lib/weapp/ParseRole.js +1 -5
- package/lib/weapp/ParseSchema.js +1 -1
- package/lib/weapp/ParseSession.js +1 -5
- package/lib/weapp/ParseUser.js +1 -42
- package/lib/weapp/Push.js +2 -8
- package/lib/weapp/RESTController.js +0 -20
- package/lib/weapp/SingleInstanceStateController.js +1 -6
- package/lib/weapp/TaskQueue.js +0 -4
- package/lib/weapp/UniqueInstanceStateController.js +1 -3
- package/lib/weapp/unsavedChildren.js +1 -4
- package/package.json +18 -18
package/lib/browser/Cloud.js
CHANGED
|
@@ -21,7 +21,7 @@ var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
|
21
21
|
/**
|
|
22
22
|
* @flow
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
/**
|
|
26
26
|
* Contains functions for calling and declaring
|
|
27
27
|
* <a href="/docs/cloud_code_guide#functions">cloud functions</a>.
|
|
@@ -33,6 +33,7 @@ var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
|
33
33
|
* @static
|
|
34
34
|
* @hideconstructor
|
|
35
35
|
*/
|
|
36
|
+
|
|
36
37
|
/**
|
|
37
38
|
* Makes a call to a cloud function.
|
|
38
39
|
*
|
|
@@ -182,7 +182,7 @@ var config /*: Config & { [key: string]: mixed }*/ = {
|
|
|
182
182
|
SERVER_AUTH_TOKEN: null,
|
|
183
183
|
LIVEQUERY_SERVER_URL: null,
|
|
184
184
|
ENCRYPTED_KEY: null,
|
|
185
|
-
VERSION: 'js' + "4.1.0
|
|
185
|
+
VERSION: 'js' + "4.1.0",
|
|
186
186
|
APPLICATION_ID: null,
|
|
187
187
|
JAVASCRIPT_KEY: null,
|
|
188
188
|
MASTER_KEY: null,
|
|
@@ -18,19 +18,7 @@ var _Storage = _interopRequireDefault(require("./Storage"));
|
|
|
18
18
|
*
|
|
19
19
|
* @flow
|
|
20
20
|
*/
|
|
21
|
-
|
|
22
|
-
/*:: import type { RequestOptions } from './RESTController';*/
|
|
23
|
-
/*:: type QueueObject = {
|
|
24
|
-
queueId: string,
|
|
25
|
-
action: string,
|
|
26
|
-
object: ParseObject,
|
|
27
|
-
serverOptions: SaveOptions | RequestOptions,
|
|
28
|
-
id: string,
|
|
29
|
-
className: string,
|
|
30
|
-
hash: string,
|
|
31
|
-
createdAt: Date,
|
|
32
|
-
};*/
|
|
33
|
-
/*:: type Queue = Array<QueueObject>;*/
|
|
21
|
+
|
|
34
22
|
var QUEUE_KEY = 'Parse/Eventually/Queue';
|
|
35
23
|
var queueCache = [];
|
|
36
24
|
var dirtyCache = true;
|
|
@@ -123,7 +123,7 @@ function _isNativeReflectConstruct() {
|
|
|
123
123
|
} catch (e) {
|
|
124
124
|
return false;
|
|
125
125
|
}
|
|
126
|
-
}
|
|
126
|
+
}
|
|
127
127
|
// The LiveQuery client inner state
|
|
128
128
|
var CLIENT_STATE = {
|
|
129
129
|
INITIALIZED: 'initialized',
|
|
@@ -303,25 +303,21 @@ var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
|
|
|
303
303
|
}, {
|
|
304
304
|
key: "subscribe",
|
|
305
305
|
value: function (query /*: Object*/, sessionToken /*: ?string*/) /*: LiveQuerySubscription*/{
|
|
306
|
-
var
|
|
307
|
-
_queryJSON$watch,
|
|
308
|
-
_this2 = this;
|
|
306
|
+
var _this2 = this;
|
|
309
307
|
if (!query) {
|
|
310
308
|
return;
|
|
311
309
|
}
|
|
312
310
|
var className = query.className;
|
|
313
311
|
var queryJSON = query.toJSON();
|
|
314
312
|
var where = queryJSON.where;
|
|
315
|
-
var fields = (
|
|
316
|
-
var watch = (_queryJSON$watch = queryJSON.watch) === null || _queryJSON$watch === void 0 ? void 0 : _queryJSON$watch.split(',');
|
|
313
|
+
var fields = (0, _keys.default)(queryJSON) ? (0, _keys.default)(queryJSON).split(',') : undefined;
|
|
317
314
|
var subscribeRequest = {
|
|
318
315
|
op: OP_TYPES.SUBSCRIBE,
|
|
319
316
|
requestId: this.requestId,
|
|
320
317
|
query: {
|
|
321
318
|
className: className,
|
|
322
319
|
where: where,
|
|
323
|
-
fields: fields
|
|
324
|
-
watch: watch
|
|
320
|
+
fields: fields
|
|
325
321
|
}
|
|
326
322
|
};
|
|
327
323
|
if (sessionToken) {
|
|
@@ -89,9 +89,7 @@ function _arrayLikeToArray(arr, len) {
|
|
|
89
89
|
if (len == null || len > arr.length) len = arr.length;
|
|
90
90
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
91
91
|
return arr2;
|
|
92
|
-
}
|
|
93
|
-
* @flow
|
|
94
|
-
*/ /*:: import type ParseObject from './ParseObject';*/
|
|
92
|
+
}
|
|
95
93
|
/**
|
|
96
94
|
* Provides a local datastore which can be used to store and retrieve <code>Parse.Object</code>. <br />
|
|
97
95
|
* To enable this functionality, call <code>Parse.enableLocalDatastore()</code>.
|
|
@@ -78,9 +78,7 @@ function _arrayLikeToArray(arr, len) {
|
|
|
78
78
|
if (len == null || len > arr.length) len = arr.length;
|
|
79
79
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
80
80
|
return arr2;
|
|
81
|
-
}
|
|
82
|
-
* @flow
|
|
83
|
-
*/
|
|
81
|
+
}
|
|
84
82
|
var LocalDatastoreController = {
|
|
85
83
|
fromPinWithName: function (name /*: string*/) /*: Array<Object>*/{
|
|
86
84
|
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
@@ -52,20 +52,7 @@ function _objectSpread(target) {
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
return target;
|
|
55
|
-
}
|
|
56
|
-
* @flow
|
|
57
|
-
*/
|
|
58
|
-
/*:: import type { Op } from './ParseOp';*/
|
|
59
|
-
/*:: export type AttributeMap = { [attr: string]: any };*/
|
|
60
|
-
/*:: export type OpsMap = { [attr: string]: Op };*/
|
|
61
|
-
/*:: export type ObjectCache = { [attr: string]: string };*/
|
|
62
|
-
/*:: export type State = {
|
|
63
|
-
serverData: AttributeMap,
|
|
64
|
-
pendingOps: Array<OpsMap>,
|
|
65
|
-
objectCache: ObjectCache,
|
|
66
|
-
tasks: TaskQueue,
|
|
67
|
-
existed: boolean,
|
|
68
|
-
};*/
|
|
55
|
+
}
|
|
69
56
|
function defaultState() /*: State*/{
|
|
70
57
|
return {
|
|
71
58
|
serverData: {},
|
package/lib/browser/ParseACL.js
CHANGED
package/lib/browser/ParseCLP.js
CHANGED
|
@@ -119,12 +119,7 @@ function _arrayLikeToArray(arr, len) {
|
|
|
119
119
|
if (len == null || len > arr.length) len = arr.length;
|
|
120
120
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
121
121
|
return arr2;
|
|
122
|
-
}
|
|
123
|
-
* @flow
|
|
124
|
-
*/
|
|
125
|
-
/*:: type Entity = Entity;*/
|
|
126
|
-
/*:: type UsersMap = { [userId: string]: boolean | any };*/
|
|
127
|
-
/*:: export type PermissionsMap = { [permission: string]: UsersMap };*/
|
|
122
|
+
}
|
|
128
123
|
var PUBLIC_KEY = '*';
|
|
129
124
|
var VALID_PERMISSIONS /*: Map<string, UsersMap>*/ = new _map.default(
|
|
130
125
|
/*:: <string, UsersMap>*/
|
|
@@ -21,7 +21,6 @@ var _Storage = _interopRequireDefault(require("./Storage"));
|
|
|
21
21
|
/**
|
|
22
22
|
* @flow
|
|
23
23
|
*/
|
|
24
|
-
/*:: import type { RequestOptions } from './RESTController';*/
|
|
25
24
|
/**
|
|
26
25
|
* Parse.Config is a local representation of configuration data that
|
|
27
26
|
* can be set from the Parse dashboard.
|
package/lib/browser/ParseFile.js
CHANGED
|
@@ -48,10 +48,7 @@ function _objectSpread(target) {
|
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
return target;
|
|
51
|
-
}
|
|
52
|
-
* @flow
|
|
53
|
-
*/ /* global XMLHttpRequest, Blob */
|
|
54
|
-
/*:: import type { FullOptions } from './RESTController';*/
|
|
51
|
+
}
|
|
55
52
|
var ParseError = require('./ParseError').default;
|
|
56
53
|
var XHR = null;
|
|
57
54
|
if (typeof XMLHttpRequest !== 'undefined') {
|
|
@@ -372,7 +369,6 @@ var ParseFile = /*#__PURE__*/function () {
|
|
|
372
369
|
key: "cancel",
|
|
373
370
|
value: function () {
|
|
374
371
|
if (this._requestTask && typeof this._requestTask.abort === 'function') {
|
|
375
|
-
this._requestTask._aborted = true;
|
|
376
372
|
this._requestTask.abort();
|
|
377
373
|
}
|
|
378
374
|
this._requestTask = null;
|
|
@@ -38,10 +38,7 @@ function _isNativeReflectConstruct() {
|
|
|
38
38
|
} catch (e) {
|
|
39
39
|
return false;
|
|
40
40
|
}
|
|
41
|
-
}
|
|
42
|
-
* @flow
|
|
43
|
-
*/
|
|
44
|
-
/*:: import type { AttributeMap } from './ObjectStateMutations';*/
|
|
41
|
+
}
|
|
45
42
|
var Installation = /*#__PURE__*/function (_ParseObject) {
|
|
46
43
|
(0, _inherits2.default)(Installation, _ParseObject);
|
|
47
44
|
var _super = _createSuper(Installation);
|
|
@@ -184,11 +184,7 @@ function _objectSpread(target) {
|
|
|
184
184
|
});
|
|
185
185
|
}
|
|
186
186
|
return target;
|
|
187
|
-
}
|
|
188
|
-
* @flow
|
|
189
|
-
*/
|
|
190
|
-
/*:: import type { AttributeMap, OpsMap } from './ObjectStateMutations';*/
|
|
191
|
-
/*:: import type { RequestOptions, FullOptions } from './RESTController';*/
|
|
187
|
+
}
|
|
192
188
|
var uuidv4 = require('./uuid');
|
|
193
189
|
/*:: export type Pointer = {
|
|
194
190
|
__type: string,
|
|
@@ -254,11 +250,6 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
254
250
|
*/
|
|
255
251
|
function ParseObject(className /*: ?string | { className: string, [attr: string]: mixed }*/, attributes /*:: ?: { [attr: string]: mixed }*/, options /*:: ?: { ignoreValidation: boolean }*/) {
|
|
256
252
|
(0, _classCallCheck2.default)(this, ParseObject);
|
|
257
|
-
/**
|
|
258
|
-
* The ID of this object, unique within its class.
|
|
259
|
-
*
|
|
260
|
-
* @property {string} id
|
|
261
|
-
*/
|
|
262
253
|
(0, _defineProperty2.default)(this, "id", void 0);
|
|
263
254
|
(0, _defineProperty2.default)(this, "_localId", void 0);
|
|
264
255
|
(0, _defineProperty2.default)(this, "_objCount", void 0);
|
|
@@ -290,6 +281,12 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
290
281
|
throw new Error("Can't create an invalid Parse Object");
|
|
291
282
|
}
|
|
292
283
|
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* The ID of this object, unique within its class.
|
|
287
|
+
*
|
|
288
|
+
* @property {string} id
|
|
289
|
+
*/
|
|
293
290
|
(0, _createClass2.default)(ParseObject, [{
|
|
294
291
|
key: "attributes",
|
|
295
292
|
get: /* Prototype getters / setters */
|
package/lib/browser/ParseOp.js
CHANGED
|
@@ -40,29 +40,7 @@ var _LocalDatastoreUtils = require("./LocalDatastoreUtils");
|
|
|
40
40
|
/*
|
|
41
41
|
* @flow
|
|
42
42
|
*/
|
|
43
|
-
|
|
44
|
-
/*:: import type { RequestOptions, FullOptions } from './RESTController';*/
|
|
45
|
-
/*:: type BatchOptions = FullOptions & { batchSize?: number };*/
|
|
46
|
-
/*:: export type WhereClause = {
|
|
47
|
-
[attr: string]: mixed,
|
|
48
|
-
};*/
|
|
49
|
-
/*:: export type QueryJSON = {
|
|
50
|
-
where: WhereClause,
|
|
51
|
-
watch?: string,
|
|
52
|
-
include?: string,
|
|
53
|
-
excludeKeys?: string,
|
|
54
|
-
keys?: string,
|
|
55
|
-
limit?: number,
|
|
56
|
-
skip?: number,
|
|
57
|
-
order?: string,
|
|
58
|
-
className?: string,
|
|
59
|
-
count?: number,
|
|
60
|
-
hint?: mixed,
|
|
61
|
-
explain?: boolean,
|
|
62
|
-
readPreference?: string,
|
|
63
|
-
includeReadPreference?: string,
|
|
64
|
-
subqueryReadPreference?: string,
|
|
65
|
-
};*/
|
|
43
|
+
|
|
66
44
|
/**
|
|
67
45
|
* Converts a string into a regex that matches it.
|
|
68
46
|
* Surrounding with \Q .. \E does this, we just need to escape any \E's in
|
|
@@ -237,17 +215,17 @@ function handleOfflineSort(a, b, sorts) {
|
|
|
237
215
|
* @alias Parse.Query
|
|
238
216
|
*/
|
|
239
217
|
var ParseQuery = /*#__PURE__*/function () {
|
|
218
|
+
/**
|
|
219
|
+
* @property {string} className
|
|
220
|
+
*/
|
|
221
|
+
|
|
240
222
|
/**
|
|
241
223
|
* @param {(string | Parse.Object)} objectClass An instance of a subclass of Parse.Object, or a Parse className string.
|
|
242
224
|
*/
|
|
243
225
|
function ParseQuery(objectClass /*: string | ParseObject*/) {
|
|
244
226
|
(0, _classCallCheck2.default)(this, ParseQuery);
|
|
245
|
-
/**
|
|
246
|
-
* @property {string} className
|
|
247
|
-
*/
|
|
248
227
|
(0, _defineProperty2.default)(this, "className", void 0);
|
|
249
228
|
(0, _defineProperty2.default)(this, "_where", void 0);
|
|
250
|
-
(0, _defineProperty2.default)(this, "_watch", void 0);
|
|
251
229
|
(0, _defineProperty2.default)(this, "_include", void 0);
|
|
252
230
|
(0, _defineProperty2.default)(this, "_exclude", void 0);
|
|
253
231
|
(0, _defineProperty2.default)(this, "_select", void 0);
|
|
@@ -283,7 +261,6 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
283
261
|
throw new TypeError('A ParseQuery must be constructed with a ParseObject or class name.');
|
|
284
262
|
}
|
|
285
263
|
this._where = {};
|
|
286
|
-
this._watch = [];
|
|
287
264
|
this._include = [];
|
|
288
265
|
this._exclude = [];
|
|
289
266
|
this._count = false;
|
|
@@ -476,9 +453,6 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
476
453
|
var params /*: QueryJSON*/ = {
|
|
477
454
|
where: this._where
|
|
478
455
|
};
|
|
479
|
-
if (this._watch.length) {
|
|
480
|
-
params.watch = this._watch.join(',');
|
|
481
|
-
}
|
|
482
456
|
if (this._include.length) {
|
|
483
457
|
params.include = this._include.join(',');
|
|
484
458
|
}
|
|
@@ -548,9 +522,6 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
548
522
|
if (json.where) {
|
|
549
523
|
this._where = json.where;
|
|
550
524
|
}
|
|
551
|
-
if (json.watch) {
|
|
552
|
-
this._watch = json.watch.split(',');
|
|
553
|
-
}
|
|
554
525
|
if (json.include) {
|
|
555
526
|
this._include = json.include.split(',');
|
|
556
527
|
}
|
|
@@ -2140,32 +2111,6 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2140
2111
|
return this;
|
|
2141
2112
|
}
|
|
2142
2113
|
|
|
2143
|
-
/**
|
|
2144
|
-
* Restricts live query to trigger only for watched fields.
|
|
2145
|
-
*
|
|
2146
|
-
* Requires Parse Server 6.0.0+
|
|
2147
|
-
*
|
|
2148
|
-
* @param {...string|Array<string>} keys The name(s) of the key(s) to watch.
|
|
2149
|
-
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2150
|
-
*/
|
|
2151
|
-
}, {
|
|
2152
|
-
key: "watch",
|
|
2153
|
-
value: function () /*: ParseQuery*/{
|
|
2154
|
-
var _this14 = this;
|
|
2155
|
-
for (var _len8 = arguments.length, keys = new Array(_len8), _key12 = 0; _key12 < _len8; _key12++) {
|
|
2156
|
-
keys[_key12] = arguments[_key12];
|
|
2157
|
-
}
|
|
2158
|
-
(0, _forEach.default)(keys).call(keys, function (key) {
|
|
2159
|
-
if ((0, _isArray.default)(key)) {
|
|
2160
|
-
var _context22;
|
|
2161
|
-
_this14._watch = (0, _concat.default)(_context22 = _this14._watch).call(_context22, key);
|
|
2162
|
-
} else {
|
|
2163
|
-
_this14._watch.push(key);
|
|
2164
|
-
}
|
|
2165
|
-
});
|
|
2166
|
-
return this;
|
|
2167
|
-
}
|
|
2168
|
-
|
|
2169
2114
|
/**
|
|
2170
2115
|
* Changes the read preference that the backend will use when performing the query to the database.
|
|
2171
2116
|
*
|
|
@@ -2195,30 +2140,30 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2195
2140
|
value: function () {
|
|
2196
2141
|
var _subscribe = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(sessionToken /*:: ?: string*/) {
|
|
2197
2142
|
var currentUser, liveQueryClient, subscription;
|
|
2198
|
-
return _regenerator.default.wrap(function (
|
|
2199
|
-
while (1) switch (
|
|
2143
|
+
return _regenerator.default.wrap(function (_context22) {
|
|
2144
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
2200
2145
|
case 0:
|
|
2201
|
-
|
|
2146
|
+
_context22.next = 2;
|
|
2202
2147
|
return _CoreManager.default.getUserController().currentUserAsync();
|
|
2203
2148
|
case 2:
|
|
2204
|
-
currentUser =
|
|
2149
|
+
currentUser = _context22.sent;
|
|
2205
2150
|
if (!sessionToken) {
|
|
2206
2151
|
sessionToken = currentUser ? currentUser.getSessionToken() : undefined;
|
|
2207
2152
|
}
|
|
2208
|
-
|
|
2153
|
+
_context22.next = 6;
|
|
2209
2154
|
return _CoreManager.default.getLiveQueryController().getDefaultLiveQueryClient();
|
|
2210
2155
|
case 6:
|
|
2211
|
-
liveQueryClient =
|
|
2156
|
+
liveQueryClient = _context22.sent;
|
|
2212
2157
|
if (liveQueryClient.shouldOpen()) {
|
|
2213
2158
|
liveQueryClient.open();
|
|
2214
2159
|
}
|
|
2215
2160
|
subscription = liveQueryClient.subscribe(this, sessionToken);
|
|
2216
|
-
return
|
|
2161
|
+
return _context22.abrupt("return", subscription.subscribePromise.then(function () {
|
|
2217
2162
|
return subscription;
|
|
2218
2163
|
}));
|
|
2219
2164
|
case 10:
|
|
2220
2165
|
case "end":
|
|
2221
|
-
return
|
|
2166
|
+
return _context22.stop();
|
|
2222
2167
|
}
|
|
2223
2168
|
}, _callee7, this);
|
|
2224
2169
|
}));
|
|
@@ -2300,7 +2245,7 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2300
2245
|
}, {
|
|
2301
2246
|
key: "cancel",
|
|
2302
2247
|
value: function () /*: ParseQuery*/{
|
|
2303
|
-
var
|
|
2248
|
+
var _this14 = this;
|
|
2304
2249
|
if (this._xhrRequest.task && typeof this._xhrRequest.task.abort === 'function') {
|
|
2305
2250
|
this._xhrRequest.task._aborted = true;
|
|
2306
2251
|
this._xhrRequest.task.abort();
|
|
@@ -2309,16 +2254,16 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2309
2254
|
return this;
|
|
2310
2255
|
}
|
|
2311
2256
|
return this._xhrRequest.onchange = function () {
|
|
2312
|
-
return
|
|
2257
|
+
return _this14.cancel();
|
|
2313
2258
|
};
|
|
2314
2259
|
}
|
|
2315
2260
|
}, {
|
|
2316
2261
|
key: "_setRequestTask",
|
|
2317
2262
|
value: function (options) {
|
|
2318
|
-
var
|
|
2263
|
+
var _this15 = this;
|
|
2319
2264
|
options.requestTask = function (task) {
|
|
2320
|
-
|
|
2321
|
-
|
|
2265
|
+
_this15._xhrRequest.task = task;
|
|
2266
|
+
_this15._xhrRequest.onchange();
|
|
2322
2267
|
};
|
|
2323
2268
|
}
|
|
2324
2269
|
}], [{
|
|
@@ -2330,8 +2275,8 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2330
2275
|
}, {
|
|
2331
2276
|
key: "or",
|
|
2332
2277
|
value: function () /*: ParseQuery*/{
|
|
2333
|
-
for (var
|
|
2334
|
-
queries[
|
|
2278
|
+
for (var _len8 = arguments.length, queries = new Array(_len8), _key12 = 0; _key12 < _len8; _key12++) {
|
|
2279
|
+
queries[_key12] = arguments[_key12];
|
|
2335
2280
|
}
|
|
2336
2281
|
var className = _getClassNameFromQueries(queries);
|
|
2337
2282
|
var query = new ParseQuery(className);
|
|
@@ -2354,8 +2299,8 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2354
2299
|
}, {
|
|
2355
2300
|
key: "and",
|
|
2356
2301
|
value: function () /*: ParseQuery*/{
|
|
2357
|
-
for (var
|
|
2358
|
-
queries[
|
|
2302
|
+
for (var _len9 = arguments.length, queries = new Array(_len9), _key13 = 0; _key13 < _len9; _key13++) {
|
|
2303
|
+
queries[_key13] = arguments[_key13];
|
|
2359
2304
|
}
|
|
2360
2305
|
var className = _getClassNameFromQueries(queries);
|
|
2361
2306
|
var query = new ParseQuery(className);
|
|
@@ -2378,8 +2323,8 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2378
2323
|
}, {
|
|
2379
2324
|
key: "nor",
|
|
2380
2325
|
value: function () /*: ParseQuery*/{
|
|
2381
|
-
for (var
|
|
2382
|
-
queries[
|
|
2326
|
+
for (var _len10 = arguments.length, queries = new Array(_len10), _key14 = 0; _key14 < _len10; _key14++) {
|
|
2327
|
+
queries[_key14] = arguments[_key14];
|
|
2383
2328
|
}
|
|
2384
2329
|
var className = _getClassNameFromQueries(queries);
|
|
2385
2330
|
var query = new ParseQuery(className);
|
package/lib/browser/ParseRole.js
CHANGED
|
@@ -40,11 +40,7 @@ function _isNativeReflectConstruct() {
|
|
|
40
40
|
} catch (e) {
|
|
41
41
|
return false;
|
|
42
42
|
}
|
|
43
|
-
}
|
|
44
|
-
* @flow
|
|
45
|
-
*/
|
|
46
|
-
/*:: import type { AttributeMap } from './ObjectStateMutations';*/
|
|
47
|
-
/*:: import type ParseRelation from './ParseRelation';*/
|
|
43
|
+
}
|
|
48
44
|
/**
|
|
49
45
|
* Represents a Role on the Parse server. Roles represent groupings of
|
|
50
46
|
* Users for the purposes of granting permissions (e.g. specifying an ACL
|
|
@@ -16,7 +16,7 @@ var _ParseCLP = _interopRequireDefault(require("./ParseCLP"));
|
|
|
16
16
|
/**
|
|
17
17
|
* @flow
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
var FIELD_TYPES = ['String', 'Number', 'Boolean', 'Date', 'File', 'GeoPoint', 'Polygon', 'Array', 'Object', 'Pointer', 'Relation'];
|
|
21
21
|
/*:: type FieldOptions = {
|
|
22
22
|
required: boolean,
|
|
@@ -42,11 +42,7 @@ function _isNativeReflectConstruct() {
|
|
|
42
42
|
} catch (e) {
|
|
43
43
|
return false;
|
|
44
44
|
}
|
|
45
|
-
}
|
|
46
|
-
* @flow
|
|
47
|
-
*/
|
|
48
|
-
/*:: import type { AttributeMap } from './ObjectStateMutations';*/
|
|
49
|
-
/*:: import type { RequestOptions, FullOptions } from './RESTController';*/
|
|
45
|
+
}
|
|
50
46
|
/**
|
|
51
47
|
* <p>A Parse.Session object is a local representation of a revocable session.
|
|
52
48
|
* This class is a subclass of a Parse.Object, and retains the same
|
package/lib/browser/ParseUser.js
CHANGED
|
@@ -49,12 +49,7 @@ function _isNativeReflectConstruct() {
|
|
|
49
49
|
} catch (e) {
|
|
50
50
|
return false;
|
|
51
51
|
}
|
|
52
|
-
}
|
|
53
|
-
* @flow
|
|
54
|
-
*/
|
|
55
|
-
/*:: import type { AttributeMap } from './ObjectStateMutations';*/
|
|
56
|
-
/*:: import type { RequestOptions, FullOptions } from './RESTController';*/
|
|
57
|
-
/*:: export type AuthData = ?{ [key: string]: mixed };*/
|
|
52
|
+
}
|
|
58
53
|
var CURRENT_USER_KEY = 'currentUser';
|
|
59
54
|
var canUseCurrentUser = !_CoreManager.default.get('IS_NODE');
|
|
60
55
|
var currentUserCacheMatchesDisk = false;
|
|
@@ -880,27 +875,6 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
880
875
|
return user.logIn(options);
|
|
881
876
|
}
|
|
882
877
|
|
|
883
|
-
/**
|
|
884
|
-
* Logs in a user with an objectId. On success, this saves the session
|
|
885
|
-
* to disk, so you can retrieve the currently logged in user using
|
|
886
|
-
* <code>current</code>.
|
|
887
|
-
*
|
|
888
|
-
* @param {string} userId The objectId for the user.
|
|
889
|
-
* @static
|
|
890
|
-
* @returns {Promise} A promise that is fulfilled with the user when
|
|
891
|
-
* the login completes.
|
|
892
|
-
*/
|
|
893
|
-
}, {
|
|
894
|
-
key: "loginAs",
|
|
895
|
-
value: function (userId /*: string*/) {
|
|
896
|
-
if (!userId) {
|
|
897
|
-
throw new _ParseError.default(_ParseError.default.USERNAME_MISSING, 'Cannot log in as user with an empty user id');
|
|
898
|
-
}
|
|
899
|
-
var controller = _CoreManager.default.getUserController();
|
|
900
|
-
var user = new this();
|
|
901
|
-
return controller.loginAs(user, userId);
|
|
902
|
-
}
|
|
903
|
-
|
|
904
878
|
/**
|
|
905
879
|
* Logs in a user with a session token. On success, this saves the session
|
|
906
880
|
* to disk, so you can retrieve the currently logged in user using
|
|
@@ -1345,21 +1319,6 @@ var DefaultController = {
|
|
|
1345
1319
|
return DefaultController.setCurrentUser(user);
|
|
1346
1320
|
});
|
|
1347
1321
|
},
|
|
1348
|
-
loginAs: function (user /*: ParseUser*/, userId /*: string*/) /*: Promise<ParseUser>*/{
|
|
1349
|
-
var RESTController = _CoreManager.default.getRESTController();
|
|
1350
|
-
return RESTController.request('POST', 'loginAs', {
|
|
1351
|
-
userId: userId
|
|
1352
|
-
}, {
|
|
1353
|
-
useMasterKey: true
|
|
1354
|
-
}).then(function (response) {
|
|
1355
|
-
user._finishFetch(response);
|
|
1356
|
-
user._setExisted(true);
|
|
1357
|
-
if (!canUseCurrentUser) {
|
|
1358
|
-
return _promise.default.resolve(user);
|
|
1359
|
-
}
|
|
1360
|
-
return DefaultController.setCurrentUser(user);
|
|
1361
|
-
});
|
|
1362
|
-
},
|
|
1363
1322
|
become: function (user /*: ParseUser*/, options /*: RequestOptions*/) /*: Promise<ParseUser>*/{
|
|
1364
1323
|
var RESTController = _CoreManager.default.getRESTController();
|
|
1365
1324
|
return RESTController.request('GET', 'users/me', {}, options).then(function (response) {
|
package/lib/browser/Push.js
CHANGED
|
@@ -13,14 +13,7 @@ var _ParseQuery = _interopRequireDefault(require("./ParseQuery"));
|
|
|
13
13
|
/**
|
|
14
14
|
* @flow
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
|
-
/*:: import type { FullOptions } from './RESTController';*/
|
|
18
|
-
/*:: export type PushData = {
|
|
19
|
-
where?: WhereClause | ParseQuery,
|
|
20
|
-
push_time?: Date | string,
|
|
21
|
-
expiration_time?: Date | string,
|
|
22
|
-
expiration_interval?: number,
|
|
23
|
-
};*/
|
|
16
|
+
|
|
24
17
|
/**
|
|
25
18
|
* Contains functions to deal with Push in Parse.
|
|
26
19
|
*
|
|
@@ -28,6 +21,7 @@ var _ParseQuery = _interopRequireDefault(require("./ParseQuery"));
|
|
|
28
21
|
* @static
|
|
29
22
|
* @hideconstructor
|
|
30
23
|
*/
|
|
24
|
+
|
|
31
25
|
/**
|
|
32
26
|
* Sends a push notification.
|
|
33
27
|
* **Available in Cloud Code only.**
|
|
@@ -45,26 +45,6 @@ function _objectSpread(target) {
|
|
|
45
45
|
*/
|
|
46
46
|
/* global XMLHttpRequest, XDomainRequest */
|
|
47
47
|
var uuidv4 = require('./uuid');
|
|
48
|
-
/*:: export type RequestOptions = {
|
|
49
|
-
useMasterKey?: boolean,
|
|
50
|
-
sessionToken?: string,
|
|
51
|
-
installationId?: string,
|
|
52
|
-
returnStatus?: boolean,
|
|
53
|
-
batchSize?: number,
|
|
54
|
-
include?: any,
|
|
55
|
-
progress?: any,
|
|
56
|
-
context?: any,
|
|
57
|
-
usePost?: boolean,
|
|
58
|
-
};*/
|
|
59
|
-
/*:: export type FullOptions = {
|
|
60
|
-
success?: any,
|
|
61
|
-
error?: any,
|
|
62
|
-
useMasterKey?: boolean,
|
|
63
|
-
sessionToken?: string,
|
|
64
|
-
installationId?: string,
|
|
65
|
-
progress?: any,
|
|
66
|
-
usePost?: boolean,
|
|
67
|
-
};*/
|
|
68
48
|
var XHR = null;
|
|
69
49
|
if (typeof XMLHttpRequest !== 'undefined') {
|
|
70
50
|
XHR = XMLHttpRequest;
|
|
@@ -66,12 +66,7 @@ function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
66
66
|
/**
|
|
67
67
|
* @flow
|
|
68
68
|
*/
|
|
69
|
-
|
|
70
|
-
/*:: import type { AttributeMap, ObjectCache, OpsMap, State } from './ObjectStateMutations';*/
|
|
71
|
-
/*:: type ObjectIdentifier = {
|
|
72
|
-
className: string,
|
|
73
|
-
id: string,
|
|
74
|
-
};*/
|
|
69
|
+
|
|
75
70
|
var objectState
|
|
76
71
|
/*: {
|
|
77
72
|
[className: string]: {
|
package/lib/browser/TaskQueue.js
CHANGED
|
@@ -8,10 +8,6 @@ var _promiseUtils = require("./promiseUtils");
|
|
|
8
8
|
/**
|
|
9
9
|
* @flow
|
|
10
10
|
*/
|
|
11
|
-
/*:: type Task = {
|
|
12
|
-
task: () => Promise,
|
|
13
|
-
_completion: Promise,
|
|
14
|
-
};*/
|
|
15
11
|
var TaskQueue = /*#__PURE__*/function () {
|
|
16
12
|
function TaskQueue() {
|
|
17
13
|
(0, _classCallCheck2.default)(this, TaskQueue);
|
|
@@ -69,9 +69,7 @@ function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
69
69
|
/**
|
|
70
70
|
* @flow
|
|
71
71
|
*/
|
|
72
|
-
|
|
73
|
-
/*:: import type ParseObject from './ParseObject';*/
|
|
74
|
-
/*:: import type { AttributeMap, ObjectCache, OpsMap, State } from './ObjectStateMutations';*/
|
|
72
|
+
|
|
75
73
|
var objectState = new _weakMap.default();
|
|
76
74
|
function getState(obj /*: ParseObject*/) /*: ?State*/{
|
|
77
75
|
var classData = objectState.get(obj);
|