parse 4.1.0-alpha.3 → 4.1.0-alpha.4
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 +192 -36
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +192 -36
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/AnonymousUtils.js +1 -1
- package/lib/browser/Cloud.js +1 -2
- package/lib/browser/CoreManager.js +1 -1
- package/lib/browser/EventuallyQueue.js +13 -1
- package/lib/browser/LiveQueryClient.js +1 -1
- package/lib/browser/LocalDatastore.js +3 -1
- package/lib/browser/LocalDatastoreController.js +3 -1
- package/lib/browser/ObjectStateMutations.js +14 -1
- package/lib/browser/ParseACL.js +2 -1
- package/lib/browser/ParseCLP.js +6 -1
- package/lib/browser/ParseConfig.js +1 -0
- package/lib/browser/ParseFile.js +4 -1
- package/lib/browser/ParseInstallation.js +4 -1
- package/lib/browser/ParseObject.js +10 -7
- package/lib/browser/ParseOp.js +3 -1
- package/lib/browser/ParseQuery.js +26 -5
- package/lib/browser/ParseRole.js +5 -1
- package/lib/browser/ParseSchema.js +1 -1
- package/lib/browser/ParseSession.js +5 -1
- package/lib/browser/ParseUser.js +42 -1
- package/lib/browser/Push.js +8 -2
- package/lib/browser/RESTController.js +20 -0
- package/lib/browser/SingleInstanceStateController.js +6 -1
- 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 +1 -2
- package/lib/node/CoreManager.js +1 -1
- package/lib/node/EventuallyQueue.js +13 -1
- package/lib/node/LocalDatastore.js +1 -1
- package/lib/node/ObjectStateMutations.js +11 -1
- package/lib/node/ParseACL.js +2 -1
- package/lib/node/ParseCLP.js +3 -1
- package/lib/node/ParseConfig.js +1 -2
- package/lib/node/ParseFile.js +1 -1
- package/lib/node/ParseInstallation.js +1 -1
- package/lib/node/ParseObject.js +2 -1
- package/lib/node/ParseQuery.js +23 -1
- package/lib/node/ParseRole.js +2 -1
- package/lib/node/ParseSchema.js +1 -1
- package/lib/node/ParseSession.js +2 -1
- package/lib/node/ParseUser.js +37 -1
- package/lib/node/Push.js +8 -2
- package/lib/node/RESTController.js +20 -0
- package/lib/node/SingleInstanceStateController.js +6 -1
- 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/CoreManager.js +1 -1
- package/lib/react-native/ParseCLP.js +2 -2
- package/lib/react-native/ParseUser.js +25 -0
- package/lib/weapp/AnonymousUtils.js +1 -1
- package/lib/weapp/Cloud.js +1 -2
- package/lib/weapp/CoreManager.js +1 -1
- package/lib/weapp/EventuallyQueue.js +13 -1
- package/lib/weapp/LiveQueryClient.js +1 -1
- package/lib/weapp/LocalDatastore.js +3 -1
- package/lib/weapp/LocalDatastoreController.js +3 -1
- package/lib/weapp/ObjectStateMutations.js +14 -1
- package/lib/weapp/ParseACL.js +2 -1
- package/lib/weapp/ParseCLP.js +6 -1
- package/lib/weapp/ParseConfig.js +1 -0
- package/lib/weapp/ParseFile.js +4 -1
- package/lib/weapp/ParseInstallation.js +4 -1
- package/lib/weapp/ParseObject.js +10 -7
- package/lib/weapp/ParseOp.js +3 -1
- package/lib/weapp/ParseQuery.js +26 -5
- package/lib/weapp/ParseRole.js +5 -1
- package/lib/weapp/ParseSchema.js +1 -1
- package/lib/weapp/ParseSession.js +5 -1
- package/lib/weapp/ParseUser.js +42 -1
- package/lib/weapp/Push.js +8 -2
- package/lib/weapp/RESTController.js +20 -0
- package/lib/weapp/SingleInstanceStateController.js +6 -1
- package/lib/weapp/TaskQueue.js +4 -0
- package/lib/weapp/UniqueInstanceStateController.js +3 -1
- package/lib/weapp/unsavedChildren.js +4 -1
- package/package.json +12 -12
package/lib/node/ParseQuery.js
CHANGED
|
@@ -20,7 +20,29 @@ function _interopRequireDefault(obj) {
|
|
|
20
20
|
/*
|
|
21
21
|
* @flow
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
/*:: import type LiveQuerySubscription from './LiveQuerySubscription';*/
|
|
24
|
+
/*:: import type { RequestOptions, FullOptions } from './RESTController';*/
|
|
25
|
+
/*:: type BatchOptions = FullOptions & { batchSize?: number };*/
|
|
26
|
+
/*:: export type WhereClause = {
|
|
27
|
+
[attr: string]: mixed,
|
|
28
|
+
};*/
|
|
29
|
+
/*:: export type QueryJSON = {
|
|
30
|
+
where: WhereClause,
|
|
31
|
+
watch?: string,
|
|
32
|
+
include?: string,
|
|
33
|
+
excludeKeys?: string,
|
|
34
|
+
keys?: string,
|
|
35
|
+
limit?: number,
|
|
36
|
+
skip?: number,
|
|
37
|
+
order?: string,
|
|
38
|
+
className?: string,
|
|
39
|
+
count?: number,
|
|
40
|
+
hint?: mixed,
|
|
41
|
+
explain?: boolean,
|
|
42
|
+
readPreference?: string,
|
|
43
|
+
includeReadPreference?: string,
|
|
44
|
+
subqueryReadPreference?: string,
|
|
45
|
+
};*/
|
|
24
46
|
/**
|
|
25
47
|
* Converts a string into a regex that matches it.
|
|
26
48
|
* Surrounding with \Q .. \E does this, we just need to escape any \E's in
|
package/lib/node/ParseRole.js
CHANGED
|
@@ -15,7 +15,8 @@ function _interopRequireDefault(obj) {
|
|
|
15
15
|
/**
|
|
16
16
|
* @flow
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
/*:: import type { AttributeMap } from './ObjectStateMutations';*/
|
|
19
|
+
/*:: import type ParseRelation from './ParseRelation';*/
|
|
19
20
|
/**
|
|
20
21
|
* Represents a Role on the Parse server. Roles represent groupings of
|
|
21
22
|
* Users for the purposes of granting permissions (e.g. specifying an ACL
|
package/lib/node/ParseSchema.js
CHANGED
|
@@ -15,7 +15,7 @@ function _interopRequireDefault(obj) {
|
|
|
15
15
|
/**
|
|
16
16
|
* @flow
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
/*:: import type { PermissionsMap } from './ParseCLP';*/
|
|
19
19
|
const FIELD_TYPES = ['String', 'Number', 'Boolean', 'Date', 'File', 'GeoPoint', 'Polygon', 'Array', 'Object', 'Pointer', 'Relation'];
|
|
20
20
|
/*:: type FieldOptions = {
|
|
21
21
|
required: boolean,
|
package/lib/node/ParseSession.js
CHANGED
|
@@ -16,7 +16,8 @@ function _interopRequireDefault(obj) {
|
|
|
16
16
|
/**
|
|
17
17
|
* @flow
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
/*:: import type { AttributeMap } from './ObjectStateMutations';*/
|
|
20
|
+
/*:: import type { RequestOptions, FullOptions } from './RESTController';*/
|
|
20
21
|
/**
|
|
21
22
|
* <p>A Parse.Session object is a local representation of a revocable session.
|
|
22
23
|
* This class is a subclass of a Parse.Object, and retains the same
|
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;
|
|
@@ -636,6 +638,25 @@ class ParseUser extends _ParseObject.default {
|
|
|
636
638
|
return user.logIn(options);
|
|
637
639
|
}
|
|
638
640
|
|
|
641
|
+
/**
|
|
642
|
+
* Logs in a user with an objectId. On success, this saves the session
|
|
643
|
+
* to disk, so you can retrieve the currently logged in user using
|
|
644
|
+
* <code>current</code>.
|
|
645
|
+
*
|
|
646
|
+
* @param {string} userId The objectId for the user.
|
|
647
|
+
* @static
|
|
648
|
+
* @returns {Promise} A promise that is fulfilled with the user when
|
|
649
|
+
* the login completes.
|
|
650
|
+
*/
|
|
651
|
+
static loginAs(userId /*: string*/) {
|
|
652
|
+
if (!userId) {
|
|
653
|
+
throw new _ParseError.default(_ParseError.default.USERNAME_MISSING, 'Cannot log in as user with an empty user id');
|
|
654
|
+
}
|
|
655
|
+
const controller = _CoreManager.default.getUserController();
|
|
656
|
+
const user = new this();
|
|
657
|
+
return controller.loginAs(user, userId);
|
|
658
|
+
}
|
|
659
|
+
|
|
639
660
|
/**
|
|
640
661
|
* Logs in a user with a session token. On success, this saves the session
|
|
641
662
|
* to disk, so you can retrieve the currently logged in user using
|
|
@@ -1044,6 +1065,21 @@ const DefaultController = {
|
|
|
1044
1065
|
return DefaultController.setCurrentUser(user);
|
|
1045
1066
|
});
|
|
1046
1067
|
},
|
|
1068
|
+
loginAs(user /*: ParseUser*/, userId /*: string*/) /*: Promise<ParseUser>*/{
|
|
1069
|
+
const RESTController = _CoreManager.default.getRESTController();
|
|
1070
|
+
return RESTController.request('POST', 'loginAs', {
|
|
1071
|
+
userId
|
|
1072
|
+
}, {
|
|
1073
|
+
useMasterKey: true
|
|
1074
|
+
}).then(response => {
|
|
1075
|
+
user._finishFetch(response);
|
|
1076
|
+
user._setExisted(true);
|
|
1077
|
+
if (!canUseCurrentUser) {
|
|
1078
|
+
return Promise.resolve(user);
|
|
1079
|
+
}
|
|
1080
|
+
return DefaultController.setCurrentUser(user);
|
|
1081
|
+
});
|
|
1082
|
+
},
|
|
1047
1083
|
become(user /*: ParseUser*/, options /*: RequestOptions*/) /*: Promise<ParseUser>*/{
|
|
1048
1084
|
const RESTController = _CoreManager.default.getRESTController();
|
|
1049
1085
|
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/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,7 +24,7 @@ var ParseCLP = function () {
|
|
|
24
24
|
var _this = this;
|
|
25
25
|
(0, _classCallCheck2.default)(this, ParseCLP);
|
|
26
26
|
this.permissionsMap = {};
|
|
27
|
-
var _loop = function _loop(operation
|
|
27
|
+
var _loop = function _loop(operation) {
|
|
28
28
|
_this.permissionsMap[operation] = Object.assign({}, group);
|
|
29
29
|
var action = operation.charAt(0).toUpperCase() + operation.slice(1);
|
|
30
30
|
_this[`get${action}RequiresAuthentication`] = function () {
|
|
@@ -62,7 +62,7 @@ var ParseCLP = function () {
|
|
|
62
62
|
var _ref2 = (0, _slicedToArray2.default)(_ref, 2);
|
|
63
63
|
var operation = _ref2[0];
|
|
64
64
|
var group = _ref2[1];
|
|
65
|
-
_loop(operation
|
|
65
|
+
_loop(operation);
|
|
66
66
|
}
|
|
67
67
|
for (var _ref3 of VALID_PERMISSIONS_EXTENDED.entries()) {
|
|
68
68
|
var _ref4 = (0, _slicedToArray2.default)(_ref3, 2);
|
|
@@ -500,6 +500,16 @@ var ParseUser = function (_ParseObject) {
|
|
|
500
500
|
});
|
|
501
501
|
return user.logIn(options);
|
|
502
502
|
}
|
|
503
|
+
}, {
|
|
504
|
+
key: "loginAs",
|
|
505
|
+
value: function (userId) {
|
|
506
|
+
if (!userId) {
|
|
507
|
+
throw new _ParseError.default(_ParseError.default.USERNAME_MISSING, 'Cannot log in as user with an empty user id');
|
|
508
|
+
}
|
|
509
|
+
var controller = _CoreManager.default.getUserController();
|
|
510
|
+
var user = new this();
|
|
511
|
+
return controller.loginAs(user, userId);
|
|
512
|
+
}
|
|
503
513
|
}, {
|
|
504
514
|
key: "become",
|
|
505
515
|
value: function (sessionToken, options) {
|
|
@@ -793,6 +803,21 @@ var DefaultController = {
|
|
|
793
803
|
return DefaultController.setCurrentUser(user);
|
|
794
804
|
});
|
|
795
805
|
},
|
|
806
|
+
loginAs: function (user, userId) {
|
|
807
|
+
var RESTController = _CoreManager.default.getRESTController();
|
|
808
|
+
return RESTController.request('POST', 'loginAs', {
|
|
809
|
+
userId: userId
|
|
810
|
+
}, {
|
|
811
|
+
useMasterKey: true
|
|
812
|
+
}).then(function (response) {
|
|
813
|
+
user._finishFetch(response);
|
|
814
|
+
user._setExisted(true);
|
|
815
|
+
if (!canUseCurrentUser) {
|
|
816
|
+
return Promise.resolve(user);
|
|
817
|
+
}
|
|
818
|
+
return DefaultController.setCurrentUser(user);
|
|
819
|
+
});
|
|
820
|
+
},
|
|
796
821
|
become: function (user, options) {
|
|
797
822
|
var RESTController = _CoreManager.default.getRESTController();
|
|
798
823
|
return RESTController.request('GET', 'users/me', {}, options).then(function (response) {
|
package/lib/weapp/Cloud.js
CHANGED
|
@@ -21,7 +21,7 @@ var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
|
21
21
|
/**
|
|
22
22
|
* @flow
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
/*:: import type { RequestOptions } from './RESTController';*/
|
|
25
25
|
/**
|
|
26
26
|
* Contains functions for calling and declaring
|
|
27
27
|
* <a href="/docs/cloud_code_guide#functions">cloud functions</a>.
|
|
@@ -33,7 +33,6 @@ var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
|
33
33
|
* @static
|
|
34
34
|
* @hideconstructor
|
|
35
35
|
*/
|
|
36
|
-
|
|
37
36
|
/**
|
|
38
37
|
* Makes a call to a cloud function.
|
|
39
38
|
*
|
package/lib/weapp/CoreManager.js
CHANGED
|
@@ -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-alpha.
|
|
185
|
+
VERSION: 'js' + "4.1.0-alpha.4",
|
|
186
186
|
APPLICATION_ID: null,
|
|
187
187
|
JAVASCRIPT_KEY: null,
|
|
188
188
|
MASTER_KEY: null,
|
|
@@ -18,7 +18,19 @@ var _Storage = _interopRequireDefault(require("./Storage"));
|
|
|
18
18
|
*
|
|
19
19
|
* @flow
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
/*:: import type { SaveOptions } from './ParseObject';*/
|
|
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>;*/
|
|
22
34
|
var QUEUE_KEY = 'Parse/Eventually/Queue';
|
|
23
35
|
var queueCache = [];
|
|
24
36
|
var dirtyCache = true;
|
|
@@ -89,7 +89,9 @@ 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
|
-
}
|
|
92
|
+
} /**
|
|
93
|
+
* @flow
|
|
94
|
+
*/ /*:: import type ParseObject from './ParseObject';*/
|
|
93
95
|
/**
|
|
94
96
|
* Provides a local datastore which can be used to store and retrieve <code>Parse.Object</code>. <br />
|
|
95
97
|
* To enable this functionality, call <code>Parse.enableLocalDatastore()</code>.
|
|
@@ -78,7 +78,9 @@ 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
|
-
}
|
|
81
|
+
} /**
|
|
82
|
+
* @flow
|
|
83
|
+
*/
|
|
82
84
|
var LocalDatastoreController = {
|
|
83
85
|
fromPinWithName: function (name /*: string*/) /*: Array<Object>*/{
|
|
84
86
|
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
@@ -52,7 +52,20 @@ function _objectSpread(target) {
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
return target;
|
|
55
|
-
}
|
|
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
|
+
};*/
|
|
56
69
|
function defaultState() /*: State*/{
|
|
57
70
|
return {
|
|
58
71
|
serverData: {},
|
package/lib/weapp/ParseACL.js
CHANGED
package/lib/weapp/ParseCLP.js
CHANGED
|
@@ -119,7 +119,12 @@ 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
|
-
}
|
|
122
|
+
} /**
|
|
123
|
+
* @flow
|
|
124
|
+
*/
|
|
125
|
+
/*:: type Entity = Entity;*/
|
|
126
|
+
/*:: type UsersMap = { [userId: string]: boolean | any };*/
|
|
127
|
+
/*:: export type PermissionsMap = { [permission: string]: UsersMap };*/
|
|
123
128
|
var PUBLIC_KEY = '*';
|
|
124
129
|
var VALID_PERMISSIONS /*: Map<string, UsersMap>*/ = new _map.default(
|
|
125
130
|
/*:: <string, UsersMap>*/
|
package/lib/weapp/ParseConfig.js
CHANGED
|
@@ -21,6 +21,7 @@ var _Storage = _interopRequireDefault(require("./Storage"));
|
|
|
21
21
|
/**
|
|
22
22
|
* @flow
|
|
23
23
|
*/
|
|
24
|
+
/*:: import type { RequestOptions } from './RESTController';*/
|
|
24
25
|
/**
|
|
25
26
|
* Parse.Config is a local representation of configuration data that
|
|
26
27
|
* can be set from the Parse dashboard.
|
package/lib/weapp/ParseFile.js
CHANGED
|
@@ -48,7 +48,10 @@ function _objectSpread(target) {
|
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
return target;
|
|
51
|
-
}
|
|
51
|
+
} /**
|
|
52
|
+
* @flow
|
|
53
|
+
*/ /* global XMLHttpRequest, Blob */
|
|
54
|
+
/*:: import type { FullOptions } from './RESTController';*/
|
|
52
55
|
var ParseError = require('./ParseError').default;
|
|
53
56
|
var XHR = null;
|
|
54
57
|
if (typeof XMLHttpRequest !== 'undefined') {
|
|
@@ -38,7 +38,10 @@ function _isNativeReflectConstruct() {
|
|
|
38
38
|
} catch (e) {
|
|
39
39
|
return false;
|
|
40
40
|
}
|
|
41
|
-
}
|
|
41
|
+
} /**
|
|
42
|
+
* @flow
|
|
43
|
+
*/
|
|
44
|
+
/*:: import type { AttributeMap } from './ObjectStateMutations';*/
|
|
42
45
|
var Installation = /*#__PURE__*/function (_ParseObject) {
|
|
43
46
|
(0, _inherits2.default)(Installation, _ParseObject);
|
|
44
47
|
var _super = _createSuper(Installation);
|
package/lib/weapp/ParseObject.js
CHANGED
|
@@ -184,7 +184,11 @@ function _objectSpread(target) {
|
|
|
184
184
|
});
|
|
185
185
|
}
|
|
186
186
|
return target;
|
|
187
|
-
}
|
|
187
|
+
} /**
|
|
188
|
+
* @flow
|
|
189
|
+
*/
|
|
190
|
+
/*:: import type { AttributeMap, OpsMap } from './ObjectStateMutations';*/
|
|
191
|
+
/*:: import type { RequestOptions, FullOptions } from './RESTController';*/
|
|
188
192
|
var uuidv4 = require('./uuid');
|
|
189
193
|
/*:: export type Pointer = {
|
|
190
194
|
__type: string,
|
|
@@ -250,6 +254,11 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
250
254
|
*/
|
|
251
255
|
function ParseObject(className /*: ?string | { className: string, [attr: string]: mixed }*/, attributes /*:: ?: { [attr: string]: mixed }*/, options /*:: ?: { ignoreValidation: boolean }*/) {
|
|
252
256
|
(0, _classCallCheck2.default)(this, ParseObject);
|
|
257
|
+
/**
|
|
258
|
+
* The ID of this object, unique within its class.
|
|
259
|
+
*
|
|
260
|
+
* @property {string} id
|
|
261
|
+
*/
|
|
253
262
|
(0, _defineProperty2.default)(this, "id", void 0);
|
|
254
263
|
(0, _defineProperty2.default)(this, "_localId", void 0);
|
|
255
264
|
(0, _defineProperty2.default)(this, "_objCount", void 0);
|
|
@@ -281,12 +290,6 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
281
290
|
throw new Error("Can't create an invalid Parse Object");
|
|
282
291
|
}
|
|
283
292
|
}
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* The ID of this object, unique within its class.
|
|
287
|
-
*
|
|
288
|
-
* @property {string} id
|
|
289
|
-
*/
|
|
290
293
|
(0, _createClass2.default)(ParseObject, [{
|
|
291
294
|
key: "attributes",
|
|
292
295
|
get: /* Prototype getters / setters */
|
package/lib/weapp/ParseOp.js
CHANGED
package/lib/weapp/ParseQuery.js
CHANGED
|
@@ -40,7 +40,29 @@ var _LocalDatastoreUtils = require("./LocalDatastoreUtils");
|
|
|
40
40
|
/*
|
|
41
41
|
* @flow
|
|
42
42
|
*/
|
|
43
|
-
|
|
43
|
+
/*:: import type LiveQuerySubscription from './LiveQuerySubscription';*/
|
|
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
|
+
};*/
|
|
44
66
|
/**
|
|
45
67
|
* Converts a string into a regex that matches it.
|
|
46
68
|
* Surrounding with \Q .. \E does this, we just need to escape any \E's in
|
|
@@ -215,15 +237,14 @@ function handleOfflineSort(a, b, sorts) {
|
|
|
215
237
|
* @alias Parse.Query
|
|
216
238
|
*/
|
|
217
239
|
var ParseQuery = /*#__PURE__*/function () {
|
|
218
|
-
/**
|
|
219
|
-
* @property {string} className
|
|
220
|
-
*/
|
|
221
|
-
|
|
222
240
|
/**
|
|
223
241
|
* @param {(string | Parse.Object)} objectClass An instance of a subclass of Parse.Object, or a Parse className string.
|
|
224
242
|
*/
|
|
225
243
|
function ParseQuery(objectClass /*: string | ParseObject*/) {
|
|
226
244
|
(0, _classCallCheck2.default)(this, ParseQuery);
|
|
245
|
+
/**
|
|
246
|
+
* @property {string} className
|
|
247
|
+
*/
|
|
227
248
|
(0, _defineProperty2.default)(this, "className", void 0);
|
|
228
249
|
(0, _defineProperty2.default)(this, "_where", void 0);
|
|
229
250
|
(0, _defineProperty2.default)(this, "_watch", void 0);
|
package/lib/weapp/ParseRole.js
CHANGED
|
@@ -40,7 +40,11 @@ function _isNativeReflectConstruct() {
|
|
|
40
40
|
} catch (e) {
|
|
41
41
|
return false;
|
|
42
42
|
}
|
|
43
|
-
}
|
|
43
|
+
} /**
|
|
44
|
+
* @flow
|
|
45
|
+
*/
|
|
46
|
+
/*:: import type { AttributeMap } from './ObjectStateMutations';*/
|
|
47
|
+
/*:: import type ParseRelation from './ParseRelation';*/
|
|
44
48
|
/**
|
|
45
49
|
* Represents a Role on the Parse server. Roles represent groupings of
|
|
46
50
|
* Users for the purposes of granting permissions (e.g. specifying an ACL
|
package/lib/weapp/ParseSchema.js
CHANGED
|
@@ -16,7 +16,7 @@ var _ParseCLP = _interopRequireDefault(require("./ParseCLP"));
|
|
|
16
16
|
/**
|
|
17
17
|
* @flow
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
/*:: import type { PermissionsMap } from './ParseCLP';*/
|
|
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,7 +42,11 @@ function _isNativeReflectConstruct() {
|
|
|
42
42
|
} catch (e) {
|
|
43
43
|
return false;
|
|
44
44
|
}
|
|
45
|
-
}
|
|
45
|
+
} /**
|
|
46
|
+
* @flow
|
|
47
|
+
*/
|
|
48
|
+
/*:: import type { AttributeMap } from './ObjectStateMutations';*/
|
|
49
|
+
/*:: import type { RequestOptions, FullOptions } from './RESTController';*/
|
|
46
50
|
/**
|
|
47
51
|
* <p>A Parse.Session object is a local representation of a revocable session.
|
|
48
52
|
* This class is a subclass of a Parse.Object, and retains the same
|