parse 4.1.0 → 4.2.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/dist/parse.js +2123 -1542
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +2105 -1524
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/AnonymousUtils.js +1 -1
- package/lib/browser/Cloud.js +4 -2
- package/lib/browser/CoreManager.js +31 -4
- package/lib/browser/EventEmitter.js +7 -2
- package/lib/browser/EventuallyQueue.js +24 -4
- package/lib/browser/LiveQueryClient.js +59 -89
- package/lib/browser/LiveQuerySubscription.js +16 -51
- package/lib/browser/LocalDatastore.js +10 -1
- package/lib/browser/LocalDatastoreController.js +3 -1
- package/lib/browser/ObjectStateMutations.js +17 -2
- package/lib/browser/OfflineQuery.js +1 -1
- package/lib/browser/Parse.js +171 -135
- package/lib/browser/ParseACL.js +2 -1
- package/lib/browser/ParseCLP.js +6 -1
- package/lib/browser/ParseConfig.js +1 -0
- package/lib/browser/ParseError.js +12 -1
- package/lib/browser/ParseFile.js +5 -1
- package/lib/browser/ParseInstallation.js +4 -1
- package/lib/browser/ParseLiveQuery.js +79 -51
- package/lib/browser/ParseObject.js +11 -8
- package/lib/browser/ParseOp.js +3 -1
- package/lib/browser/ParseQuery.js +122 -72
- package/lib/browser/ParseRole.js +5 -1
- package/lib/browser/ParseSchema.js +23 -2
- package/lib/browser/ParseSession.js +1 -1
- package/lib/browser/ParseUser.js +107 -9
- package/lib/browser/Push.js +8 -2
- package/lib/browser/RESTController.js +20 -0
- package/lib/browser/SingleInstanceStateController.js +6 -1
- package/lib/browser/Storage.js +7 -0
- package/lib/browser/TaskQueue.js +4 -0
- package/lib/browser/UniqueInstanceStateController.js +3 -1
- package/lib/browser/unsavedChildren.js +4 -1
- package/lib/node/AnonymousUtils.js +1 -1
- package/lib/node/Cloud.js +4 -2
- package/lib/node/CoreManager.js +30 -4
- package/lib/node/EventEmitter.js +7 -1
- package/lib/node/EventuallyQueue.js +23 -4
- package/lib/node/LiveQueryClient.js +10 -7
- package/lib/node/LiveQuerySubscription.js +5 -7
- package/lib/node/LocalDatastore.js +7 -1
- package/lib/node/ObjectStateMutations.js +14 -2
- package/lib/node/OfflineQuery.js +1 -1
- package/lib/node/Parse.js +162 -126
- package/lib/node/ParseACL.js +2 -1
- package/lib/node/ParseCLP.js +3 -1
- package/lib/node/ParseConfig.js +1 -2
- package/lib/node/ParseError.js +15 -1
- package/lib/node/ParseFile.js +2 -1
- package/lib/node/ParseInstallation.js +1 -1
- package/lib/node/ParseLiveQuery.js +32 -24
- package/lib/node/ParseObject.js +3 -2
- package/lib/node/ParseQuery.js +53 -7
- package/lib/node/ParseRole.js +2 -1
- package/lib/node/ParseSchema.js +21 -2
- package/lib/node/ParseSession.js +1 -5
- package/lib/node/ParseUser.js +95 -9
- package/lib/node/Push.js +8 -2
- package/lib/node/RESTController.js +20 -0
- package/lib/node/SingleInstanceStateController.js +6 -1
- package/lib/node/Storage.js +6 -0
- package/lib/node/TaskQueue.js +4 -1
- package/lib/node/UniqueInstanceStateController.js +3 -1
- package/lib/node/unsavedChildren.js +4 -1
- package/lib/react-native/Cloud.js +3 -0
- package/lib/react-native/CoreManager.js +30 -4
- package/lib/react-native/EventEmitter.js +8 -5
- package/lib/react-native/EventuallyQueue.js +10 -3
- package/lib/react-native/LiveQueryClient.js +44 -70
- package/lib/react-native/LiveQuerySubscription.js +16 -46
- package/lib/react-native/LocalDatastore.js +6 -0
- package/lib/react-native/ObjectStateMutations.js +3 -1
- package/lib/react-native/OfflineQuery.js +1 -1
- package/lib/react-native/Parse.js +127 -90
- package/lib/react-native/ParseCLP.js +2 -2
- package/lib/react-native/ParseError.js +8 -1
- package/lib/react-native/ParseFile.js +1 -0
- package/lib/react-native/ParseLiveQuery.js +39 -11
- package/lib/react-native/ParseQuery.js +37 -17
- package/lib/react-native/ParseSchema.js +14 -1
- package/lib/react-native/ParseUser.js +74 -6
- package/lib/react-native/Storage.js +6 -0
- package/lib/weapp/AnonymousUtils.js +1 -1
- package/lib/weapp/Cloud.js +4 -2
- package/lib/weapp/CoreManager.js +31 -4
- package/lib/weapp/EventEmitter.js +7 -2
- package/lib/weapp/EventuallyQueue.js +24 -4
- package/lib/weapp/LiveQueryClient.js +59 -89
- package/lib/weapp/LiveQuerySubscription.js +16 -51
- package/lib/weapp/LocalDatastore.js +10 -1
- package/lib/weapp/LocalDatastoreController.js +3 -1
- package/lib/weapp/ObjectStateMutations.js +17 -2
- package/lib/weapp/OfflineQuery.js +1 -1
- package/lib/weapp/Parse.js +170 -134
- package/lib/weapp/ParseACL.js +2 -1
- package/lib/weapp/ParseCLP.js +6 -1
- package/lib/weapp/ParseConfig.js +1 -0
- package/lib/weapp/ParseError.js +12 -1
- package/lib/weapp/ParseFile.js +5 -1
- package/lib/weapp/ParseInstallation.js +4 -1
- package/lib/weapp/ParseLiveQuery.js +79 -51
- package/lib/weapp/ParseObject.js +11 -8
- package/lib/weapp/ParseOp.js +3 -1
- package/lib/weapp/ParseQuery.js +122 -72
- package/lib/weapp/ParseRole.js +5 -1
- package/lib/weapp/ParseSchema.js +23 -2
- package/lib/weapp/ParseSession.js +1 -1
- package/lib/weapp/ParseUser.js +107 -9
- package/lib/weapp/Push.js +8 -2
- package/lib/weapp/RESTController.js +20 -0
- package/lib/weapp/SingleInstanceStateController.js +6 -1
- package/lib/weapp/Storage.js +7 -0
- package/lib/weapp/TaskQueue.js +4 -0
- package/lib/weapp/UniqueInstanceStateController.js +3 -1
- package/lib/weapp/unsavedChildren.js +4 -1
- package/package.json +29 -25
package/lib/node/ParseSchema.js
CHANGED
|
@@ -15,8 +15,8 @@ function _interopRequireDefault(obj) {
|
|
|
15
15
|
/**
|
|
16
16
|
* @flow
|
|
17
17
|
*/
|
|
18
|
-
|
|
19
|
-
const FIELD_TYPES = ['String', 'Number', 'Boolean', 'Date', 'File', 'GeoPoint', 'Polygon', 'Array', 'Object', 'Pointer', 'Relation'];
|
|
18
|
+
/*:: import type { PermissionsMap } from './ParseCLP';*/
|
|
19
|
+
const FIELD_TYPES = ['String', 'Number', 'Boolean', 'Bytes', 'Date', 'File', 'GeoPoint', 'Polygon', 'Array', 'Object', 'Pointer', 'Relation'];
|
|
20
20
|
/*:: type FieldOptions = {
|
|
21
21
|
required: boolean,
|
|
22
22
|
defaultValue: mixed,
|
|
@@ -226,6 +226,14 @@ class ParseSchema {
|
|
|
226
226
|
};
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
|
+
if (type === 'Bytes') {
|
|
230
|
+
if (options && options.defaultValue) {
|
|
231
|
+
fieldOptions.defaultValue = {
|
|
232
|
+
__type: 'Bytes',
|
|
233
|
+
base64: options.defaultValue
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
}
|
|
229
237
|
this._fields[name] = fieldOptions;
|
|
230
238
|
return this;
|
|
231
239
|
}
|
|
@@ -285,6 +293,17 @@ class ParseSchema {
|
|
|
285
293
|
return this.addField(name, 'Boolean', options);
|
|
286
294
|
}
|
|
287
295
|
|
|
296
|
+
/**
|
|
297
|
+
* Adding Bytes Field
|
|
298
|
+
*
|
|
299
|
+
* @param {string} name Name of the field that will be created on Parse
|
|
300
|
+
* @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
|
|
301
|
+
* @returns {Parse.Schema} Returns the schema, so you can chain this call.
|
|
302
|
+
*/
|
|
303
|
+
addBytes(name /*: string*/, options /*: FieldOptions*/) {
|
|
304
|
+
return this.addField(name, 'Bytes', options);
|
|
305
|
+
}
|
|
306
|
+
|
|
288
307
|
/**
|
|
289
308
|
* Adding Date Field
|
|
290
309
|
*
|
package/lib/node/ParseSession.js
CHANGED
|
@@ -13,10 +13,6 @@ function _interopRequireDefault(obj) {
|
|
|
13
13
|
default: obj
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
/**
|
|
17
|
-
* @flow
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
16
|
/**
|
|
21
17
|
* <p>A Parse.Session object is a local representation of a revocable session.
|
|
22
18
|
* This class is a subclass of a Parse.Object, and retains the same
|
|
@@ -29,7 +25,7 @@ class ParseSession extends _ParseObject.default {
|
|
|
29
25
|
/**
|
|
30
26
|
* @param {object} attributes The initial set of data to store in the user.
|
|
31
27
|
*/
|
|
32
|
-
constructor(attributes
|
|
28
|
+
constructor(attributes /*:: ?: any*/) {
|
|
33
29
|
super('_Session');
|
|
34
30
|
if (attributes && typeof attributes === 'object') {
|
|
35
31
|
if (!this.set(attributes || {})) {
|
package/lib/node/ParseUser.js
CHANGED
|
@@ -18,7 +18,9 @@ function _interopRequireDefault(obj) {
|
|
|
18
18
|
/**
|
|
19
19
|
* @flow
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
/*:: import type { AttributeMap } from './ObjectStateMutations';*/
|
|
22
|
+
/*:: import type { RequestOptions, FullOptions } from './RESTController';*/
|
|
23
|
+
/*:: export type AuthData = ?{ [key: string]: mixed };*/
|
|
22
24
|
const CURRENT_USER_KEY = 'currentUser';
|
|
23
25
|
let canUseCurrentUser = !_CoreManager.default.get('IS_NODE');
|
|
24
26
|
let currentUserCacheMatchesDisk = false;
|
|
@@ -108,8 +110,14 @@ class ParseUser extends _ParseObject.default {
|
|
|
108
110
|
throw new Error('Invalid type: authData field should be an object');
|
|
109
111
|
}
|
|
110
112
|
authData[authType] = options.authData;
|
|
113
|
+
const oldAnonymousData = authData.anonymous;
|
|
114
|
+
this.stripAnonymity();
|
|
111
115
|
const controller = _CoreManager.default.getUserController();
|
|
112
|
-
return controller.linkWith(this, authData, saveOpts)
|
|
116
|
+
return controller.linkWith(this, authData, saveOpts).catch(e => {
|
|
117
|
+
delete authData[authType];
|
|
118
|
+
this.restoreAnonimity(oldAnonymousData);
|
|
119
|
+
throw e;
|
|
120
|
+
});
|
|
113
121
|
} else {
|
|
114
122
|
return new Promise((resolve, reject) => {
|
|
115
123
|
provider.authenticate({
|
|
@@ -298,6 +306,19 @@ class ParseUser extends _ParseObject.default {
|
|
|
298
306
|
const current = await ParseUser.currentAsync();
|
|
299
307
|
return !!current && current.id === this.id;
|
|
300
308
|
}
|
|
309
|
+
stripAnonymity() {
|
|
310
|
+
const authData = this.get('authData');
|
|
311
|
+
if (authData && typeof authData === 'object' && authData.hasOwnProperty('anonymous')) {
|
|
312
|
+
// We need to set anonymous to null instead of deleting it in order to remove it from Parse.
|
|
313
|
+
authData.anonymous = null;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
restoreAnonimity(anonymousData /*: any*/) {
|
|
317
|
+
if (anonymousData) {
|
|
318
|
+
const authData = this.get('authData');
|
|
319
|
+
authData.anonymous = anonymousData;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
301
322
|
|
|
302
323
|
/**
|
|
303
324
|
* Returns get("username").
|
|
@@ -318,12 +339,7 @@ class ParseUser extends _ParseObject.default {
|
|
|
318
339
|
* @param {string} username
|
|
319
340
|
*/
|
|
320
341
|
setUsername(username /*: string*/) {
|
|
321
|
-
|
|
322
|
-
const authData = this.get('authData');
|
|
323
|
-
if (authData && typeof authData === 'object' && authData.hasOwnProperty('anonymous')) {
|
|
324
|
-
// We need to set anonymous to null instead of deleting it in order to remove it from Parse.
|
|
325
|
-
authData.anonymous = null;
|
|
326
|
-
}
|
|
342
|
+
this.stripAnonymity();
|
|
327
343
|
this.set('username', username);
|
|
328
344
|
}
|
|
329
345
|
|
|
@@ -438,6 +454,9 @@ class ParseUser extends _ParseObject.default {
|
|
|
438
454
|
if (options.hasOwnProperty('usePost')) {
|
|
439
455
|
loginOptions.usePost = options.usePost;
|
|
440
456
|
}
|
|
457
|
+
if (options.hasOwnProperty('context') && Object.prototype.toString.call(options.context) === '[object Object]') {
|
|
458
|
+
loginOptions.context = options.context;
|
|
459
|
+
}
|
|
441
460
|
const controller = _CoreManager.default.getUserController();
|
|
442
461
|
return controller.logIn(this, loginOptions);
|
|
443
462
|
}
|
|
@@ -636,6 +655,57 @@ class ParseUser extends _ParseObject.default {
|
|
|
636
655
|
return user.logIn(options);
|
|
637
656
|
}
|
|
638
657
|
|
|
658
|
+
/**
|
|
659
|
+
* Logs in a user with a username (or email) and password, and authData. On success, this
|
|
660
|
+
* saves the session to disk, so you can retrieve the currently logged in
|
|
661
|
+
* user using <code>current</code>.
|
|
662
|
+
*
|
|
663
|
+
* @param {string} username The username (or email) to log in with.
|
|
664
|
+
* @param {string} password The password to log in with.
|
|
665
|
+
* @param {object} authData The authData to log in with.
|
|
666
|
+
* @param {object} options
|
|
667
|
+
* @static
|
|
668
|
+
* @returns {Promise} A promise that is fulfilled with the user when
|
|
669
|
+
* the login completes.
|
|
670
|
+
*/
|
|
671
|
+
static logInWithAdditionalAuth(username /*: string*/, password /*: string*/, authData /*: AuthData*/, options /*:: ?: FullOptions*/) {
|
|
672
|
+
if (typeof username !== 'string') {
|
|
673
|
+
return Promise.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Username must be a string.'));
|
|
674
|
+
}
|
|
675
|
+
if (typeof password !== 'string') {
|
|
676
|
+
return Promise.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Password must be a string.'));
|
|
677
|
+
}
|
|
678
|
+
if (Object.prototype.toString.call(authData) !== '[object Object]') {
|
|
679
|
+
return Promise.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Auth must be an object.'));
|
|
680
|
+
}
|
|
681
|
+
const user = new this();
|
|
682
|
+
user._finishFetch({
|
|
683
|
+
username: username,
|
|
684
|
+
password: password,
|
|
685
|
+
authData
|
|
686
|
+
});
|
|
687
|
+
return user.logIn(options);
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* Logs in a user with an objectId. On success, this saves the session
|
|
692
|
+
* to disk, so you can retrieve the currently logged in user using
|
|
693
|
+
* <code>current</code>.
|
|
694
|
+
*
|
|
695
|
+
* @param {string} userId The objectId for the user.
|
|
696
|
+
* @static
|
|
697
|
+
* @returns {Promise} A promise that is fulfilled with the user when
|
|
698
|
+
* the login completes.
|
|
699
|
+
*/
|
|
700
|
+
static loginAs(userId /*: string*/) {
|
|
701
|
+
if (!userId) {
|
|
702
|
+
throw new _ParseError.default(_ParseError.default.USERNAME_MISSING, 'Cannot log in as user with an empty user id');
|
|
703
|
+
}
|
|
704
|
+
const controller = _CoreManager.default.getUserController();
|
|
705
|
+
const user = new this();
|
|
706
|
+
return controller.loginAs(user, userId);
|
|
707
|
+
}
|
|
708
|
+
|
|
639
709
|
/**
|
|
640
710
|
* Logs in a user with a session token. On success, this saves the session
|
|
641
711
|
* to disk, so you can retrieve the currently logged in user using
|
|
@@ -1028,7 +1098,8 @@ const DefaultController = {
|
|
|
1028
1098
|
const stateController = _CoreManager.default.getObjectStateController();
|
|
1029
1099
|
const auth = {
|
|
1030
1100
|
username: user.get('username'),
|
|
1031
|
-
password: user.get('password')
|
|
1101
|
+
password: user.get('password'),
|
|
1102
|
+
authData: user.get('authData')
|
|
1032
1103
|
};
|
|
1033
1104
|
return RESTController.request(options.usePost ? 'POST' : 'GET', 'login', auth, options).then(response => {
|
|
1034
1105
|
user._migrateId(response.objectId);
|
|
@@ -1044,6 +1115,21 @@ const DefaultController = {
|
|
|
1044
1115
|
return DefaultController.setCurrentUser(user);
|
|
1045
1116
|
});
|
|
1046
1117
|
},
|
|
1118
|
+
loginAs(user /*: ParseUser*/, userId /*: string*/) /*: Promise<ParseUser>*/{
|
|
1119
|
+
const RESTController = _CoreManager.default.getRESTController();
|
|
1120
|
+
return RESTController.request('POST', 'loginAs', {
|
|
1121
|
+
userId
|
|
1122
|
+
}, {
|
|
1123
|
+
useMasterKey: true
|
|
1124
|
+
}).then(response => {
|
|
1125
|
+
user._finishFetch(response);
|
|
1126
|
+
user._setExisted(true);
|
|
1127
|
+
if (!canUseCurrentUser) {
|
|
1128
|
+
return Promise.resolve(user);
|
|
1129
|
+
}
|
|
1130
|
+
return DefaultController.setCurrentUser(user);
|
|
1131
|
+
});
|
|
1132
|
+
},
|
|
1047
1133
|
become(user /*: ParseUser*/, options /*: RequestOptions*/) /*: Promise<ParseUser>*/{
|
|
1048
1134
|
const RESTController = _CoreManager.default.getRESTController();
|
|
1049
1135
|
return RESTController.request('GET', 'users/me', {}, options).then(response => {
|
package/lib/node/Push.js
CHANGED
|
@@ -15,7 +15,14 @@ function _interopRequireDefault(obj) {
|
|
|
15
15
|
/**
|
|
16
16
|
* @flow
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
/*:: import type { WhereClause } from './ParseQuery';*/
|
|
19
|
+
/*:: import type { FullOptions } from './RESTController';*/
|
|
20
|
+
/*:: export type PushData = {
|
|
21
|
+
where?: WhereClause | ParseQuery,
|
|
22
|
+
push_time?: Date | string,
|
|
23
|
+
expiration_time?: Date | string,
|
|
24
|
+
expiration_interval?: number,
|
|
25
|
+
};*/
|
|
19
26
|
/**
|
|
20
27
|
* Contains functions to deal with Push in Parse.
|
|
21
28
|
*
|
|
@@ -23,7 +30,6 @@ function _interopRequireDefault(obj) {
|
|
|
23
30
|
* @static
|
|
24
31
|
* @hideconstructor
|
|
25
32
|
*/
|
|
26
|
-
|
|
27
33
|
/**
|
|
28
34
|
* Sends a push notification.
|
|
29
35
|
* **Available in Cloud Code only.**
|
|
@@ -13,6 +13,26 @@ function _interopRequireDefault(obj) {
|
|
|
13
13
|
*/
|
|
14
14
|
/* global XMLHttpRequest, XDomainRequest */
|
|
15
15
|
const uuidv4 = require('./uuid');
|
|
16
|
+
/*:: export type RequestOptions = {
|
|
17
|
+
useMasterKey?: boolean,
|
|
18
|
+
sessionToken?: string,
|
|
19
|
+
installationId?: string,
|
|
20
|
+
returnStatus?: boolean,
|
|
21
|
+
batchSize?: number,
|
|
22
|
+
include?: any,
|
|
23
|
+
progress?: any,
|
|
24
|
+
context?: any,
|
|
25
|
+
usePost?: boolean,
|
|
26
|
+
};*/
|
|
27
|
+
/*:: export type FullOptions = {
|
|
28
|
+
success?: any,
|
|
29
|
+
error?: any,
|
|
30
|
+
useMasterKey?: boolean,
|
|
31
|
+
sessionToken?: string,
|
|
32
|
+
installationId?: string,
|
|
33
|
+
progress?: any,
|
|
34
|
+
usePost?: boolean,
|
|
35
|
+
};*/
|
|
16
36
|
let XHR = null;
|
|
17
37
|
if (typeof XMLHttpRequest !== 'undefined') {
|
|
18
38
|
XHR = XMLHttpRequest;
|
|
@@ -63,7 +63,12 @@ function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
63
63
|
/**
|
|
64
64
|
* @flow
|
|
65
65
|
*/
|
|
66
|
-
|
|
66
|
+
/*:: import type { Op } from './ParseOp';*/
|
|
67
|
+
/*:: import type { AttributeMap, ObjectCache, OpsMap, State } from './ObjectStateMutations';*/
|
|
68
|
+
/*:: type ObjectIdentifier = {
|
|
69
|
+
className: string,
|
|
70
|
+
id: string,
|
|
71
|
+
};*/
|
|
67
72
|
let objectState
|
|
68
73
|
/*: {
|
|
69
74
|
[className: string]: {
|
package/lib/node/Storage.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
3
7
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
4
8
|
function _interopRequireDefault(obj) {
|
|
5
9
|
return obj && obj.__esModule ? obj : {
|
|
@@ -91,4 +95,6 @@ const Storage = {
|
|
|
91
95
|
}
|
|
92
96
|
};
|
|
93
97
|
module.exports = Storage;
|
|
98
|
+
var _default = Storage;
|
|
99
|
+
exports.default = _default;
|
|
94
100
|
_CoreManager.default.setStorageController(require('./StorageController.default'));
|
package/lib/node/TaskQueue.js
CHANGED
|
@@ -69,7 +69,9 @@ function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
69
69
|
/**
|
|
70
70
|
* @flow
|
|
71
71
|
*/
|
|
72
|
-
|
|
72
|
+
/*:: import type { Op } from './ParseOp';*/
|
|
73
|
+
/*:: import type ParseObject from './ParseObject';*/
|
|
74
|
+
/*:: import type { AttributeMap, ObjectCache, OpsMap, State } from './ObjectStateMutations';*/
|
|
73
75
|
let objectState = new WeakMap();
|
|
74
76
|
function getState(obj /*: ParseObject*/) /*: ?State*/{
|
|
75
77
|
const classData = objectState.get(obj);
|
|
@@ -15,7 +15,10 @@ function _interopRequireDefault(obj) {
|
|
|
15
15
|
/**
|
|
16
16
|
* @flow
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
/*:: type EncounterMap = {
|
|
19
|
+
objects: { [identifier: string]: ParseObject | boolean },
|
|
20
|
+
files: Array<ParseFile>,
|
|
21
|
+
};*/
|
|
19
22
|
/**
|
|
20
23
|
* Return an array of unsaved children, which are either Parse Objects or Files.
|
|
21
24
|
* If it encounters any dirty Objects without Ids, it will throw an exception.
|
|
@@ -24,6 +24,9 @@ function run(name, data, options) {
|
|
|
24
24
|
if (options.sessionToken) {
|
|
25
25
|
requestOptions.sessionToken = options.sessionToken;
|
|
26
26
|
}
|
|
27
|
+
if (options.installationId) {
|
|
28
|
+
requestOptions.installationId = options.installationId;
|
|
29
|
+
}
|
|
27
30
|
if (options.context && typeof options.context === 'object') {
|
|
28
31
|
requestOptions.context = options.context;
|
|
29
32
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
exports.default = void 0;
|
|
1
5
|
var config = {
|
|
2
6
|
IS_NODE: typeof process !== 'undefined' && !!process.versions && !!process.versions.node && !process.versions.electron,
|
|
3
7
|
REQUEST_ATTEMPT_LIMIT: 5,
|
|
@@ -8,7 +12,7 @@ var config = {
|
|
|
8
12
|
SERVER_AUTH_TOKEN: null,
|
|
9
13
|
LIVEQUERY_SERVER_URL: null,
|
|
10
14
|
ENCRYPTED_KEY: null,
|
|
11
|
-
VERSION: 'js' + "4.
|
|
15
|
+
VERSION: 'js' + "4.2.0-alpha.10",
|
|
12
16
|
APPLICATION_ID: null,
|
|
13
17
|
JAVASCRIPT_KEY: null,
|
|
14
18
|
MASTER_KEY: null,
|
|
@@ -17,7 +21,8 @@ var config = {
|
|
|
17
21
|
FORCE_REVOCABLE_SESSION: false,
|
|
18
22
|
ENCRYPTED_USER: false,
|
|
19
23
|
IDEMPOTENCY: false,
|
|
20
|
-
ALLOW_CUSTOM_OBJECT_ID: false
|
|
24
|
+
ALLOW_CUSTOM_OBJECT_ID: false,
|
|
25
|
+
PARSE_ERRORS: []
|
|
21
26
|
};
|
|
22
27
|
function requireMethods(name, methods, controller) {
|
|
23
28
|
methods.forEach(function (func) {
|
|
@@ -26,7 +31,7 @@ function requireMethods(name, methods, controller) {
|
|
|
26
31
|
}
|
|
27
32
|
});
|
|
28
33
|
}
|
|
29
|
-
|
|
34
|
+
var CoreManager = {
|
|
30
35
|
get: function (key) {
|
|
31
36
|
if (config.hasOwnProperty(key)) {
|
|
32
37
|
return config[key];
|
|
@@ -36,6 +41,12 @@ module.exports = {
|
|
|
36
41
|
set: function (key, value) {
|
|
37
42
|
config[key] = value;
|
|
38
43
|
},
|
|
44
|
+
setIfNeeded: function (key, value) {
|
|
45
|
+
if (!config.hasOwnProperty(key)) {
|
|
46
|
+
config[key] = value;
|
|
47
|
+
}
|
|
48
|
+
return config[key];
|
|
49
|
+
},
|
|
39
50
|
setAnalyticsController: function (controller) {
|
|
40
51
|
requireMethods('AnalyticsController', ['track'], controller);
|
|
41
52
|
config['AnalyticsController'] = controller;
|
|
@@ -64,6 +75,12 @@ module.exports = {
|
|
|
64
75
|
getCryptoController: function () {
|
|
65
76
|
return config['CryptoController'];
|
|
66
77
|
},
|
|
78
|
+
setEventEmitter: function (eventEmitter) {
|
|
79
|
+
config['EventEmitter'] = eventEmitter;
|
|
80
|
+
},
|
|
81
|
+
getEventEmitter: function () {
|
|
82
|
+
return config['EventEmitter'];
|
|
83
|
+
},
|
|
67
84
|
setFileController: function (controller) {
|
|
68
85
|
requireMethods('FileController', ['saveFile', 'saveBase64'], controller);
|
|
69
86
|
config['FileController'] = controller;
|
|
@@ -78,6 +95,12 @@ module.exports = {
|
|
|
78
95
|
getInstallationController: function () {
|
|
79
96
|
return config['InstallationController'];
|
|
80
97
|
},
|
|
98
|
+
setLiveQuery: function (liveQuery) {
|
|
99
|
+
config['LiveQuery'] = liveQuery;
|
|
100
|
+
},
|
|
101
|
+
getLiveQuery: function () {
|
|
102
|
+
return config['LiveQuery'];
|
|
103
|
+
},
|
|
81
104
|
setObjectController: function (controller) {
|
|
82
105
|
requireMethods('ObjectController', ['save', 'fetch', 'destroy'], controller);
|
|
83
106
|
config['ObjectController'] = controller;
|
|
@@ -184,4 +207,7 @@ module.exports = {
|
|
|
184
207
|
getHooksController: function () {
|
|
185
208
|
return config['HooksController'];
|
|
186
209
|
}
|
|
187
|
-
};
|
|
210
|
+
};
|
|
211
|
+
module.exports = CoreManager;
|
|
212
|
+
var _default = CoreManager;
|
|
213
|
+
exports.default = _default;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
var EventEmitter
|
|
2
|
-
|
|
3
|
-
EventEmitter = EventEmitter
|
|
4
|
-
|
|
5
|
-
EventEmitter
|
|
1
|
+
var EventEmitter;
|
|
2
|
+
try {
|
|
3
|
+
EventEmitter = require('react-native/Libraries/vendor/emitter/EventEmitter');
|
|
4
|
+
if (EventEmitter.default) {
|
|
5
|
+
EventEmitter = EventEmitter.default;
|
|
6
|
+
}
|
|
7
|
+
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
|
|
8
|
+
} catch (_) {}
|
|
6
9
|
module.exports = EventEmitter;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports.default = void 0;
|
|
2
6
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
3
7
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
4
8
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
9
|
+
var _ParseError = _interopRequireDefault(require("./ParseError"));
|
|
5
10
|
var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
6
11
|
var _ParseQuery = _interopRequireDefault(require("./ParseQuery"));
|
|
7
12
|
var _Storage = _interopRequireDefault(require("./Storage"));
|
|
@@ -155,7 +160,7 @@ var EventuallyQueue = {
|
|
|
155
160
|
yield object.save(queueObject.object, queueObject.serverOptions);
|
|
156
161
|
yield this.remove(queueObject.queueId);
|
|
157
162
|
} catch (e) {
|
|
158
|
-
if (e.
|
|
163
|
+
if (e.code !== _ParseError.default.CONNECTION_FAILED) {
|
|
159
164
|
yield this.remove(queueObject.queueId);
|
|
160
165
|
}
|
|
161
166
|
}
|
|
@@ -165,7 +170,7 @@ var EventuallyQueue = {
|
|
|
165
170
|
yield object.destroy(queueObject.serverOptions);
|
|
166
171
|
yield this.remove(queueObject.queueId);
|
|
167
172
|
} catch (e) {
|
|
168
|
-
if (e.
|
|
173
|
+
if (e.code !== _ParseError.default.CONNECTION_FAILED) {
|
|
169
174
|
yield this.remove(queueObject.queueId);
|
|
170
175
|
}
|
|
171
176
|
}
|
|
@@ -246,4 +251,6 @@ var EventuallyQueue = {
|
|
|
246
251
|
}()
|
|
247
252
|
}
|
|
248
253
|
};
|
|
249
|
-
module.exports = EventuallyQueue;
|
|
254
|
+
module.exports = EventuallyQueue;
|
|
255
|
+
var _default = EventuallyQueue;
|
|
256
|
+
exports.default = _default;
|