parse 5.1.0-alpha.8 → 5.1.0-beta.1
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/README.md +1 -1
- package/dist/parse.js +675 -374
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +1603 -438
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/CoreManager.js +48 -183
- package/lib/browser/EventuallyQueue.js +1 -1
- package/lib/browser/InstallationController.js +134 -23
- package/lib/browser/ObjectStateMutations.js +3 -2
- package/lib/browser/Parse.js +2 -2
- package/lib/browser/ParseACL.js +21 -11
- package/lib/browser/ParseFile.js +4 -0
- package/lib/browser/ParseGeoPoint.js +12 -8
- package/lib/browser/ParseHooks.js +2 -0
- package/lib/browser/ParseInstallation.js +274 -13
- package/lib/browser/ParseObject.js +74 -68
- package/lib/browser/ParseOp.js +21 -7
- package/lib/browser/ParseQuery.js +1 -0
- package/lib/browser/ParseRelation.js +12 -7
- package/lib/browser/ParseRole.js +2 -0
- package/lib/browser/ParseSession.js +1 -1
- package/lib/browser/ParseUser.js +1 -0
- package/lib/browser/SingleInstanceStateController.js +2 -4
- package/lib/browser/arrayContainsObject.js +4 -3
- package/lib/browser/canBeSerialized.js +6 -4
- package/lib/browser/decode.js +8 -5
- package/lib/browser/encode.js +6 -4
- package/lib/browser/equals.js +4 -3
- package/lib/browser/unique.js +3 -2
- package/lib/browser/unsavedChildren.js +4 -2
- package/lib/browser/uuid.js +11 -5
- package/lib/node/CoreManager.js +48 -183
- package/lib/node/EventuallyQueue.js +1 -1
- package/lib/node/InstallationController.js +65 -21
- package/lib/node/ObjectStateMutations.js +3 -2
- package/lib/node/Parse.js +2 -2
- package/lib/node/ParseACL.js +21 -11
- package/lib/node/ParseFile.js +4 -0
- package/lib/node/ParseGeoPoint.js +11 -11
- package/lib/node/ParseHooks.js +2 -0
- package/lib/node/ParseInstallation.js +207 -7
- package/lib/node/ParseObject.js +68 -66
- package/lib/node/ParseOp.js +21 -7
- package/lib/node/ParseQuery.js +1 -0
- package/lib/node/ParseRelation.js +14 -8
- package/lib/node/ParseRole.js +2 -0
- package/lib/node/ParseSession.js +1 -1
- package/lib/node/ParseUser.js +1 -0
- package/lib/node/SingleInstanceStateController.js +2 -8
- package/lib/node/arrayContainsObject.js +4 -3
- package/lib/node/canBeSerialized.js +6 -4
- package/lib/node/decode.js +9 -5
- package/lib/node/encode.js +7 -4
- package/lib/node/equals.js +4 -3
- package/lib/node/unique.js +3 -2
- package/lib/node/unsavedChildren.js +4 -2
- package/lib/node/uuid.js +10 -8
- package/lib/react-native/CoreManager.js +39 -9
- package/lib/react-native/InstallationController.js +77 -9
- package/lib/react-native/ObjectStateMutations.js +3 -2
- package/lib/react-native/Parse.js +2 -2
- package/lib/react-native/ParseACL.js +19 -11
- package/lib/react-native/ParseGeoPoint.js +5 -3
- package/lib/react-native/ParseInstallation.js +115 -10
- package/lib/react-native/ParseObject.js +8 -6
- package/lib/react-native/ParseOp.js +20 -6
- package/lib/react-native/ParseQuery.js +1 -0
- package/lib/react-native/ParseRelation.js +10 -7
- package/lib/react-native/ParseRole.js +2 -0
- package/lib/react-native/ParseUser.js +1 -0
- package/lib/react-native/SingleInstanceStateController.js +0 -2
- package/lib/react-native/arrayContainsObject.js +3 -2
- package/lib/react-native/canBeSerialized.js +5 -3
- package/lib/react-native/decode.js +7 -5
- package/lib/react-native/encode.js +6 -4
- package/lib/react-native/equals.js +4 -3
- package/lib/react-native/unique.js +3 -2
- package/lib/react-native/unsavedChildren.js +3 -2
- package/lib/react-native/uuid.js +9 -4
- package/lib/weapp/CoreManager.js +48 -183
- package/lib/weapp/EventuallyQueue.js +1 -1
- package/lib/weapp/InstallationController.js +134 -23
- package/lib/weapp/ObjectStateMutations.js +3 -2
- package/lib/weapp/Parse.js +2 -2
- package/lib/weapp/ParseACL.js +21 -11
- package/lib/weapp/ParseFile.js +4 -0
- package/lib/weapp/ParseGeoPoint.js +12 -8
- package/lib/weapp/ParseHooks.js +2 -0
- package/lib/weapp/ParseInstallation.js +274 -13
- package/lib/weapp/ParseObject.js +74 -68
- package/lib/weapp/ParseOp.js +21 -7
- package/lib/weapp/ParseQuery.js +1 -0
- package/lib/weapp/ParseRelation.js +12 -7
- package/lib/weapp/ParseRole.js +2 -0
- package/lib/weapp/ParseSession.js +1 -1
- package/lib/weapp/ParseUser.js +1 -0
- package/lib/weapp/SingleInstanceStateController.js +2 -4
- package/lib/weapp/arrayContainsObject.js +4 -3
- package/lib/weapp/canBeSerialized.js +6 -4
- package/lib/weapp/decode.js +8 -5
- package/lib/weapp/encode.js +6 -4
- package/lib/weapp/equals.js +4 -3
- package/lib/weapp/unique.js +3 -2
- package/lib/weapp/unsavedChildren.js +4 -2
- package/lib/weapp/uuid.js +12 -5
- package/package.json +4 -1
|
@@ -8,181 +8,16 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
10
10
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
*/
|
|
14
|
-
/*:: import type { AttributeMap, ObjectCache, OpsMap, State } from './ObjectStateMutations';*/
|
|
15
|
-
/*:: import type ParseFile from './ParseFile';*/
|
|
16
|
-
/*:: import type { FileSource } from './ParseFile';*/
|
|
17
|
-
/*:: import type { Op } from './ParseOp';*/
|
|
18
|
-
/*:: import type ParseObject, {SaveOptions} from './ParseObject';*/
|
|
19
|
-
/*:: import type { QueryJSON } from './ParseQuery';*/
|
|
20
|
-
/*:: import type ParseUser from './ParseUser';*/
|
|
21
|
-
/*:: import type { AuthData } from './ParseUser';*/
|
|
22
|
-
/*:: import type { PushData } from './Push';*/
|
|
23
|
-
/*:: import type { RequestOptions, FullOptions } from './RESTController';*/
|
|
24
|
-
/*:: type AnalyticsController = {
|
|
25
|
-
track: (name: string, dimensions: { [key: string]: string }) => Promise,
|
|
26
|
-
};*/
|
|
27
|
-
/*:: type CloudController = {
|
|
28
|
-
run: (name: string, data: mixed, options: RequestOptions) => Promise,
|
|
29
|
-
getJobsData: (options: RequestOptions) => Promise,
|
|
30
|
-
startJob: (name: string, data: mixed, options: RequestOptions) => Promise,
|
|
31
|
-
};*/
|
|
32
|
-
/*:: type ConfigController = {
|
|
33
|
-
current: () => Promise,
|
|
34
|
-
get: () => Promise,
|
|
35
|
-
save: (attrs: { [key: string]: any }) => Promise,
|
|
36
|
-
};*/
|
|
37
|
-
/*:: type CryptoController = {
|
|
38
|
-
encrypt: (obj: any, secretKey: string) => string,
|
|
39
|
-
decrypt: (encryptedText: string, secretKey: any) => string,
|
|
40
|
-
};*/
|
|
41
|
-
/*:: type FileController = {
|
|
42
|
-
saveFile: (name: string, source: FileSource, options: FullOptions) => Promise,
|
|
43
|
-
saveBase64: (name: string, source: FileSource, options: FullOptions) => Promise,
|
|
44
|
-
download: (uri: string) => Promise,
|
|
45
|
-
};*/
|
|
46
|
-
/*:: type InstallationController = {
|
|
47
|
-
currentInstallationId: () => Promise,
|
|
48
|
-
};*/
|
|
49
|
-
/*:: type ObjectController = {
|
|
50
|
-
fetch: (
|
|
51
|
-
object: ParseObject | Array<ParseObject>,
|
|
52
|
-
forceFetch: boolean,
|
|
53
|
-
options: RequestOptions
|
|
54
|
-
) => Promise,
|
|
55
|
-
save: (object: ParseObject | Array<ParseObject | ParseFile>, options: RequestOptions) => Promise,
|
|
56
|
-
destroy: (object: ParseObject | Array<ParseObject>, options: RequestOptions) => Promise,
|
|
57
|
-
};*/
|
|
58
|
-
/*:: type ObjectStateController = {
|
|
59
|
-
getState: (obj: any) => ?State,
|
|
60
|
-
initializeState: (obj: any, initial?: State) => State,
|
|
61
|
-
removeState: (obj: any) => ?State,
|
|
62
|
-
getServerData: (obj: any) => AttributeMap,
|
|
63
|
-
setServerData: (obj: any, attributes: AttributeMap) => void,
|
|
64
|
-
getPendingOps: (obj: any) => Array<OpsMap>,
|
|
65
|
-
setPendingOp: (obj: any, attr: string, op: ?Op) => void,
|
|
66
|
-
pushPendingState: (obj: any) => void,
|
|
67
|
-
popPendingState: (obj: any) => OpsMap,
|
|
68
|
-
mergeFirstPendingState: (obj: any) => void,
|
|
69
|
-
getObjectCache: (obj: any) => ObjectCache,
|
|
70
|
-
estimateAttribute: (obj: any, attr: string) => mixed,
|
|
71
|
-
estimateAttributes: (obj: any) => AttributeMap,
|
|
72
|
-
commitServerChanges: (obj: any, changes: AttributeMap) => void,
|
|
73
|
-
enqueueTask: (obj: any, task: () => Promise) => Promise,
|
|
74
|
-
clearAllState: () => void,
|
|
75
|
-
duplicateState: (source: any, dest: any) => void,
|
|
76
|
-
};*/
|
|
77
|
-
/*:: type PushController = {
|
|
78
|
-
send: (data: PushData) => Promise,
|
|
79
|
-
};*/
|
|
80
|
-
/*:: type QueryController = {
|
|
81
|
-
find: (className: string, params: QueryJSON, options: RequestOptions) => Promise,
|
|
82
|
-
aggregate: (className: string, params: any, options: RequestOptions) => Promise,
|
|
83
|
-
};*/
|
|
84
|
-
/*:: type EventuallyQueue = {
|
|
85
|
-
save: (object: ParseObject, serverOptions: SaveOptions) => Promise,
|
|
86
|
-
destroy: (object: ParseObject, serverOptions: RequestOptions) => Promise,
|
|
87
|
-
poll: (ms: number) => void
|
|
88
|
-
};*/
|
|
89
|
-
/*:: type RESTController = {
|
|
90
|
-
request: (method: string, path: string, data: mixed, options: RequestOptions) => Promise,
|
|
91
|
-
ajax: (method: string, url: string, data: any, headers?: any, options: FullOptions) => Promise,
|
|
92
|
-
};*/
|
|
93
|
-
/*:: type SchemaController = {
|
|
94
|
-
purge: (className: string) => Promise,
|
|
95
|
-
get: (className: string, options: RequestOptions) => Promise,
|
|
96
|
-
delete: (className: string, options: RequestOptions) => Promise,
|
|
97
|
-
create: (className: string, params: any, options: RequestOptions) => Promise,
|
|
98
|
-
update: (className: string, params: any, options: RequestOptions) => Promise,
|
|
99
|
-
send(className: string, method: string, params: any, options: RequestOptions): Promise,
|
|
100
|
-
};*/
|
|
101
|
-
/*:: type SessionController = {
|
|
102
|
-
getSession: (token: RequestOptions) => Promise,
|
|
103
|
-
};*/
|
|
104
|
-
/*:: type StorageController =
|
|
105
|
-
| {
|
|
106
|
-
async: 0,
|
|
107
|
-
getItem: (path: string) => ?string,
|
|
108
|
-
setItem: (path: string, value: string) => void,
|
|
109
|
-
removeItem: (path: string) => void,
|
|
110
|
-
getItemAsync?: (path: string) => Promise,
|
|
111
|
-
setItemAsync?: (path: string, value: string) => Promise,
|
|
112
|
-
removeItemAsync?: (path: string) => Promise,
|
|
113
|
-
clear: () => void,
|
|
114
|
-
}
|
|
115
|
-
| {
|
|
116
|
-
async: 1,
|
|
117
|
-
getItem?: (path: string) => ?string,
|
|
118
|
-
setItem?: (path: string, value: string) => void,
|
|
119
|
-
removeItem?: (path: string) => void,
|
|
120
|
-
getItemAsync: (path: string) => Promise,
|
|
121
|
-
setItemAsync: (path: string, value: string) => Promise,
|
|
122
|
-
removeItemAsync: (path: string) => Promise,
|
|
123
|
-
clear: () => void,
|
|
124
|
-
};*/
|
|
125
|
-
/*:: type LocalDatastoreController = {
|
|
126
|
-
fromPinWithName: (name: string) => ?any,
|
|
127
|
-
pinWithName: (name: string, objects: any) => void,
|
|
128
|
-
unPinWithName: (name: string) => void,
|
|
129
|
-
getAllContents: () => ?any,
|
|
130
|
-
clear: () => void,
|
|
131
|
-
};*/
|
|
132
|
-
/*:: type UserController = {
|
|
133
|
-
setCurrentUser: (user: ParseUser) => Promise,
|
|
134
|
-
currentUser: () => ?ParseUser,
|
|
135
|
-
currentUserAsync: () => Promise,
|
|
136
|
-
signUp: (user: ParseUser, attrs: AttributeMap, options: RequestOptions) => Promise,
|
|
137
|
-
logIn: (user: ParseUser, options: RequestOptions) => Promise,
|
|
138
|
-
become: (options: RequestOptions) => Promise,
|
|
139
|
-
hydrate: (userJSON: AttributeMap) => Promise,
|
|
140
|
-
logOut: (options: RequestOptions) => Promise,
|
|
141
|
-
me: (options: RequestOptions) => Promise,
|
|
142
|
-
requestPasswordReset: (email: string, options: RequestOptions) => Promise,
|
|
143
|
-
updateUserOnDisk: (user: ParseUser) => Promise,
|
|
144
|
-
upgradeToRevocableSession: (user: ParseUser, options: RequestOptions) => Promise,
|
|
145
|
-
linkWith: (user: ParseUser, authData: AuthData) => Promise,
|
|
146
|
-
removeUserFromDisk: () => Promise,
|
|
147
|
-
verifyPassword: (username: string, password: string, options: RequestOptions) => Promise,
|
|
148
|
-
requestEmailVerification: (email: string, options: RequestOptions) => Promise,
|
|
149
|
-
};*/
|
|
150
|
-
/*:: type HooksController = {
|
|
151
|
-
get: (type: string, functionName?: string, triggerName?: string) => Promise,
|
|
152
|
-
create: (hook: mixed) => Promise,
|
|
153
|
-
delete: (hook: mixed) => Promise,
|
|
154
|
-
update: (hook: mixed) => Promise,
|
|
155
|
-
send: (method: string, path: string, body?: mixed) => Promise,
|
|
156
|
-
};*/
|
|
157
|
-
/*:: type WebSocketController = {
|
|
11
|
+
/** Based on https://github.com/react-native-async-storage/async-storage/blob/main/packages/default-storage-backend/src/types.ts */
|
|
12
|
+
/*:: export type WebSocketController = {
|
|
158
13
|
onopen: () => void,
|
|
159
14
|
onmessage: (message: any) => void,
|
|
160
|
-
onclose: () => void,
|
|
15
|
+
onclose: (arg?: any) => void,
|
|
161
16
|
onerror: (error: any) => void,
|
|
162
17
|
send: (data: any) => void,
|
|
163
18
|
close: () => void,
|
|
164
19
|
};*/
|
|
165
|
-
|
|
166
|
-
AnalyticsController?: AnalyticsController,
|
|
167
|
-
CloudController?: CloudController,
|
|
168
|
-
ConfigController?: ConfigController,
|
|
169
|
-
FileController?: FileController,
|
|
170
|
-
InstallationController?: InstallationController,
|
|
171
|
-
ObjectController?: ObjectController,
|
|
172
|
-
ObjectStateController?: ObjectStateController,
|
|
173
|
-
PushController?: PushController,
|
|
174
|
-
QueryController?: QueryController,
|
|
175
|
-
RESTController?: RESTController,
|
|
176
|
-
SchemaController?: SchemaController,
|
|
177
|
-
SessionController?: SessionController,
|
|
178
|
-
StorageController?: StorageController,
|
|
179
|
-
LocalDatastoreController?: LocalDatastoreController,
|
|
180
|
-
UserController?: UserController,
|
|
181
|
-
HooksController?: HooksController,
|
|
182
|
-
WebSocketController?: WebSocketController,
|
|
183
|
-
};*/
|
|
184
|
-
var config /*: Config & { [key: string]: mixed }*/ = {
|
|
185
|
-
// Defaults
|
|
20
|
+
var config /*: Config & { [key: string]: any }*/ = {
|
|
186
21
|
IS_NODE: typeof process !== 'undefined' && !!process.versions && !!process.versions.node && !process.versions.electron,
|
|
187
22
|
REQUEST_ATTEMPT_LIMIT: 5,
|
|
188
23
|
REQUEST_BATCH_SIZE: 20,
|
|
@@ -192,7 +27,7 @@ var config /*: Config & { [key: string]: mixed }*/ = {
|
|
|
192
27
|
SERVER_AUTH_TOKEN: null,
|
|
193
28
|
LIVEQUERY_SERVER_URL: null,
|
|
194
29
|
ENCRYPTED_KEY: null,
|
|
195
|
-
VERSION: 'js' + "5.1.0-
|
|
30
|
+
VERSION: 'js' + "5.1.0-beta.1",
|
|
196
31
|
APPLICATION_ID: null,
|
|
197
32
|
JAVASCRIPT_KEY: null,
|
|
198
33
|
MASTER_KEY: null,
|
|
@@ -266,11 +101,18 @@ var CoreManager = {
|
|
|
266
101
|
requireMethods('FileController', ['saveFile', 'saveBase64'], controller);
|
|
267
102
|
config['FileController'] = controller;
|
|
268
103
|
},
|
|
104
|
+
setEventuallyQueue: function (controller /*: EventuallyQueue*/) {
|
|
105
|
+
requireMethods('EventuallyQueue', ['poll', 'save', 'destroy'], controller);
|
|
106
|
+
config['EventuallyQueue'] = controller;
|
|
107
|
+
},
|
|
108
|
+
getEventuallyQueue: function () /*: EventuallyQueue*/{
|
|
109
|
+
return config['EventuallyQueue'];
|
|
110
|
+
},
|
|
269
111
|
getFileController: function () /*: FileController*/{
|
|
270
112
|
return config['FileController'];
|
|
271
113
|
},
|
|
272
114
|
setInstallationController: function (controller /*: InstallationController*/) {
|
|
273
|
-
requireMethods('InstallationController', ['currentInstallationId'], controller);
|
|
115
|
+
requireMethods('InstallationController', ['currentInstallationId', 'currentInstallation', 'updateInstallationOnDisk'], controller);
|
|
274
116
|
config['InstallationController'] = controller;
|
|
275
117
|
},
|
|
276
118
|
getInstallationController: function () /*: InstallationController*/{
|
|
@@ -317,13 +159,6 @@ var CoreManager = {
|
|
|
317
159
|
getRESTController: function () /*: RESTController*/{
|
|
318
160
|
return config['RESTController'];
|
|
319
161
|
},
|
|
320
|
-
setEventuallyQueue: function (controller /*: EventuallyQueue*/) {
|
|
321
|
-
requireMethods('EventuallyQueue', ['poll', 'save', 'destroy'], controller);
|
|
322
|
-
config['EventuallyQueue'] = controller;
|
|
323
|
-
},
|
|
324
|
-
getEventuallyQueue: function () /*: EventuallyQueue*/{
|
|
325
|
-
return config['EventuallyQueue'];
|
|
326
|
-
},
|
|
327
162
|
setSchemaController: function (controller /*: SchemaController*/) {
|
|
328
163
|
requireMethods('SchemaController', ['get', 'create', 'update', 'delete', 'send', 'purge'], controller);
|
|
329
164
|
config['SchemaController'] = controller;
|
|
@@ -362,16 +197,16 @@ var CoreManager = {
|
|
|
362
197
|
getStorageController: function () /*: StorageController*/{
|
|
363
198
|
return config['StorageController'];
|
|
364
199
|
},
|
|
365
|
-
setAsyncStorage: function (storage /*:
|
|
200
|
+
setAsyncStorage: function (storage /*: AsyncStorageType*/) {
|
|
366
201
|
config['AsyncStorage'] = storage;
|
|
367
202
|
},
|
|
368
203
|
getAsyncStorage: function () {
|
|
369
204
|
return config['AsyncStorage'];
|
|
370
205
|
},
|
|
371
|
-
setWebSocketController: function (controller /*: WebSocketController*/) {
|
|
206
|
+
setWebSocketController: function (controller /*: new (url: string | URL, protocols?: string | string[] | undefined) => WebSocketController*/) {
|
|
372
207
|
config['WebSocketController'] = controller;
|
|
373
208
|
},
|
|
374
|
-
getWebSocketController: function () /*: WebSocketController*/{
|
|
209
|
+
getWebSocketController: function () /*: new (url: string | URL, protocols?: string | string[] | undefined) => WebSocketController*/{
|
|
375
210
|
return config['WebSocketController'];
|
|
376
211
|
},
|
|
377
212
|
setUserController: function (controller /*: UserController*/) {
|
|
@@ -381,11 +216,11 @@ var CoreManager = {
|
|
|
381
216
|
getUserController: function () /*: UserController*/{
|
|
382
217
|
return config['UserController'];
|
|
383
218
|
},
|
|
384
|
-
setLiveQueryController: function (controller /*:
|
|
219
|
+
setLiveQueryController: function (controller /*: LiveQueryControllerType*/) {
|
|
385
220
|
requireMethods('LiveQueryController', ['setDefaultLiveQueryClient', 'getDefaultLiveQueryClient', '_clearCachedDefaultClient'], controller);
|
|
386
221
|
config['LiveQueryController'] = controller;
|
|
387
222
|
},
|
|
388
|
-
getLiveQueryController: function () /*:
|
|
223
|
+
getLiveQueryController: function () /*: LiveQueryControllerType*/{
|
|
389
224
|
return config['LiveQueryController'];
|
|
390
225
|
},
|
|
391
226
|
setHooksController: function (controller /*: HooksController*/) {
|
|
@@ -394,6 +229,36 @@ var CoreManager = {
|
|
|
394
229
|
},
|
|
395
230
|
getHooksController: function () /*: HooksController*/{
|
|
396
231
|
return config['HooksController'];
|
|
232
|
+
},
|
|
233
|
+
setParseOp: function (op /*: typeof ParseOp*/) {
|
|
234
|
+
config['ParseOp'] = op;
|
|
235
|
+
},
|
|
236
|
+
getParseOp: function () {
|
|
237
|
+
return config['ParseOp'];
|
|
238
|
+
},
|
|
239
|
+
setParseObject: function (object /*: typeof ParseObject*/) {
|
|
240
|
+
config['ParseObject'] = object;
|
|
241
|
+
},
|
|
242
|
+
getParseObject: function () /*: ParseObject*/{
|
|
243
|
+
return config['ParseObject'];
|
|
244
|
+
},
|
|
245
|
+
setParseQuery: function (query /*: typeof ParseQuery*/) {
|
|
246
|
+
config['ParseQuery'] = query;
|
|
247
|
+
},
|
|
248
|
+
getParseQuery: function () /*: ParseQuery*/{
|
|
249
|
+
return config['ParseQuery'];
|
|
250
|
+
},
|
|
251
|
+
setParseRole: function (role /*: typeof ParseRole*/) {
|
|
252
|
+
config['ParseRole'] = role;
|
|
253
|
+
},
|
|
254
|
+
getParseRole: function () /*: ParseRole*/{
|
|
255
|
+
return config['ParseRole'];
|
|
256
|
+
},
|
|
257
|
+
setParseUser: function (user /*: typeof ParseUser*/) {
|
|
258
|
+
config['ParseUser'] = user;
|
|
259
|
+
},
|
|
260
|
+
getParseUser: function () /*: ParseUser*/{
|
|
261
|
+
return config['ParseUser'];
|
|
397
262
|
}
|
|
398
263
|
};
|
|
399
264
|
module.exports = CoreManager;
|
|
@@ -454,7 +454,7 @@ var EventuallyQueue = {
|
|
|
454
454
|
*/
|
|
455
455
|
poll: function () {
|
|
456
456
|
var _this7 = this;
|
|
457
|
-
var ms
|
|
457
|
+
var ms /*:: ?: number*/ = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 2000;
|
|
458
458
|
if (polling) {
|
|
459
459
|
return;
|
|
460
460
|
}
|
|
@@ -1,37 +1,148 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
3
4
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
+
_Object$defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs3/regenerator"));
|
|
10
|
+
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/json/stringify"));
|
|
11
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
|
|
12
|
+
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
5
13
|
var _Storage = _interopRequireDefault(require("./Storage"));
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
var
|
|
14
|
+
var _ParseInstallation = _interopRequireDefault(require("./ParseInstallation"));
|
|
15
|
+
var _uuid = _interopRequireDefault(require("./uuid"));
|
|
16
|
+
var CURRENT_INSTALLATION_KEY = 'currentInstallation';
|
|
17
|
+
var CURRENT_INSTALLATION_ID_KEY = 'currentInstallationId';
|
|
18
|
+
var iidCache /*: string | null*/ = null;
|
|
19
|
+
var currentInstallationCache = null;
|
|
20
|
+
var currentInstallationCacheMatchesDisk = false;
|
|
12
21
|
var InstallationController = {
|
|
22
|
+
updateInstallationOnDisk: function (installation /*: ParseInstallation*/) /*: Promise<void>*/{
|
|
23
|
+
var _this = this;
|
|
24
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
25
|
+
var path;
|
|
26
|
+
return _regenerator.default.wrap(function (_context) {
|
|
27
|
+
while (1) switch (_context.prev = _context.next) {
|
|
28
|
+
case 0:
|
|
29
|
+
path = _Storage.default.generatePath(CURRENT_INSTALLATION_KEY);
|
|
30
|
+
_context.next = 3;
|
|
31
|
+
return _Storage.default.setItemAsync(path, (0, _stringify.default)(installation.toJSON()));
|
|
32
|
+
case 3:
|
|
33
|
+
_this._setCurrentInstallationCache(installation);
|
|
34
|
+
case 4:
|
|
35
|
+
case "end":
|
|
36
|
+
return _context.stop();
|
|
37
|
+
}
|
|
38
|
+
}, _callee);
|
|
39
|
+
}))();
|
|
40
|
+
},
|
|
13
41
|
currentInstallationId: function () /*: Promise<string>*/{
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
42
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
43
|
+
var path, iid;
|
|
44
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
45
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
46
|
+
case 0:
|
|
47
|
+
if (!(typeof iidCache === 'string')) {
|
|
48
|
+
_context2.next = 2;
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
return _context2.abrupt("return", iidCache);
|
|
52
|
+
case 2:
|
|
53
|
+
path = _Storage.default.generatePath(CURRENT_INSTALLATION_ID_KEY);
|
|
54
|
+
_context2.next = 5;
|
|
55
|
+
return _Storage.default.getItemAsync(path);
|
|
56
|
+
case 5:
|
|
57
|
+
iid = _context2.sent;
|
|
58
|
+
if (iid) {
|
|
59
|
+
_context2.next = 9;
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
iid = (0, _uuid.default)();
|
|
63
|
+
return _context2.abrupt("return", _Storage.default.setItemAsync(path, iid).then(function () {
|
|
64
|
+
iidCache = iid;
|
|
65
|
+
return iid;
|
|
66
|
+
}));
|
|
67
|
+
case 9:
|
|
68
|
+
iidCache = iid;
|
|
69
|
+
return _context2.abrupt("return", iid);
|
|
70
|
+
case 11:
|
|
71
|
+
case "end":
|
|
72
|
+
return _context2.stop();
|
|
73
|
+
}
|
|
74
|
+
}, _callee2);
|
|
75
|
+
}))();
|
|
76
|
+
},
|
|
77
|
+
currentInstallation: function () /*: Promise<ParseInstallation | null>*/{
|
|
78
|
+
var _this2 = this;
|
|
79
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
80
|
+
var path, installationData, current, installationId, installation;
|
|
81
|
+
return _regenerator.default.wrap(function (_context3) {
|
|
82
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
83
|
+
case 0:
|
|
84
|
+
if (!currentInstallationCache) {
|
|
85
|
+
_context3.next = 2;
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
return _context3.abrupt("return", currentInstallationCache);
|
|
89
|
+
case 2:
|
|
90
|
+
if (!currentInstallationCacheMatchesDisk) {
|
|
91
|
+
_context3.next = 4;
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
return _context3.abrupt("return", null);
|
|
95
|
+
case 4:
|
|
96
|
+
path = _Storage.default.generatePath(CURRENT_INSTALLATION_KEY);
|
|
97
|
+
_context3.next = 7;
|
|
98
|
+
return _Storage.default.getItemAsync(path);
|
|
99
|
+
case 7:
|
|
100
|
+
installationData = _context3.sent;
|
|
101
|
+
currentInstallationCacheMatchesDisk = true;
|
|
102
|
+
if (!installationData) {
|
|
103
|
+
_context3.next = 15;
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
installationData = JSON.parse(installationData);
|
|
107
|
+
installationData.className = '_Installation';
|
|
108
|
+
current = _ParseInstallation.default.fromJSON(installationData);
|
|
109
|
+
currentInstallationCache = current;
|
|
110
|
+
return _context3.abrupt("return", current);
|
|
111
|
+
case 15:
|
|
112
|
+
_context3.next = 17;
|
|
113
|
+
return _this2.currentInstallationId();
|
|
114
|
+
case 17:
|
|
115
|
+
installationId = _context3.sent;
|
|
116
|
+
installation = new _ParseInstallation.default();
|
|
117
|
+
installation.set('deviceType', _ParseInstallation.default.DEVICE_TYPES.WEB);
|
|
118
|
+
installation.set('installationId', installationId);
|
|
119
|
+
installation.set('parseVersion', _CoreManager.default.get('VERSION'));
|
|
120
|
+
currentInstallationCache = installation;
|
|
121
|
+
_context3.next = 25;
|
|
122
|
+
return _Storage.default.setItemAsync(path, (0, _stringify.default)(installation.toJSON()));
|
|
123
|
+
case 25:
|
|
124
|
+
return _context3.abrupt("return", installation);
|
|
125
|
+
case 26:
|
|
126
|
+
case "end":
|
|
127
|
+
return _context3.stop();
|
|
128
|
+
}
|
|
129
|
+
}, _callee3);
|
|
130
|
+
}))();
|
|
29
131
|
},
|
|
30
132
|
_clearCache: function () {
|
|
31
133
|
iidCache = null;
|
|
134
|
+
currentInstallationCache = null;
|
|
135
|
+
currentInstallationCacheMatchesDisk = false;
|
|
32
136
|
},
|
|
33
137
|
_setInstallationIdCache: function (iid /*: string*/) {
|
|
34
138
|
iidCache = iid;
|
|
139
|
+
},
|
|
140
|
+
_setCurrentInstallationCache: function (installation /*: ParseInstallation*/) {
|
|
141
|
+
var matchesDisk /*: boolean*/ = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
142
|
+
currentInstallationCache = installation;
|
|
143
|
+
currentInstallationCacheMatchesDisk = matchesDisk;
|
|
35
144
|
}
|
|
36
145
|
};
|
|
37
|
-
module.exports = InstallationController;
|
|
146
|
+
module.exports = InstallationController;
|
|
147
|
+
var _default = InstallationController;
|
|
148
|
+
exports.default = _default;
|
|
@@ -26,8 +26,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/he
|
|
|
26
26
|
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
27
27
|
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/json/stringify"));
|
|
28
28
|
var _encode = _interopRequireDefault(require("./encode"));
|
|
29
|
+
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
29
30
|
var _ParseFile = _interopRequireDefault(require("./ParseFile"));
|
|
30
|
-
var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
31
31
|
var _ParseRelation = _interopRequireDefault(require("./ParseRelation"));
|
|
32
32
|
var _TaskQueue = _interopRequireDefault(require("./TaskQueue"));
|
|
33
33
|
var _ParseOp = require("./ParseOp");
|
|
@@ -181,10 +181,11 @@ function nestedSet(obj, key, value) {
|
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
function commitServerChanges(serverData /*: AttributeMap*/, objectCache /*: ObjectCache*/, changes /*: AttributeMap*/) {
|
|
184
|
+
var ParseObject = _CoreManager.default.getParseObject();
|
|
184
185
|
for (var _attr3 in changes) {
|
|
185
186
|
var val = changes[_attr3];
|
|
186
187
|
nestedSet(serverData, _attr3, val);
|
|
187
|
-
if (val && (0, _typeof2.default)(val) === 'object' && !(val instanceof
|
|
188
|
+
if (val && (0, _typeof2.default)(val) === 'object' && !(val instanceof ParseObject) && !(val instanceof _ParseFile.default) && !(val instanceof _ParseRelation.default)) {
|
|
188
189
|
var json = (0, _encode.default)(val, false, true);
|
|
189
190
|
objectCache[_attr3] = (0, _stringify.default)(json);
|
|
190
191
|
}
|
package/lib/browser/Parse.js
CHANGED
|
@@ -166,10 +166,11 @@ var Parse /*: ParseType*/ = {
|
|
|
166
166
|
_CoreManager.default.setIfNeeded('EventEmitter', _EventEmitter.default);
|
|
167
167
|
_CoreManager.default.setIfNeeded('LiveQuery', new _ParseLiveQuery.default());
|
|
168
168
|
_CoreManager.default.setIfNeeded('CryptoController', _CryptoController.default);
|
|
169
|
+
_CoreManager.default.setIfNeeded('EventuallyQueue', _EventuallyQueue.default);
|
|
170
|
+
_CoreManager.default.setIfNeeded('InstallationController', _InstallationController.default);
|
|
169
171
|
_CoreManager.default.setIfNeeded('LocalDatastoreController', _LocalDatastoreController.default);
|
|
170
172
|
_CoreManager.default.setIfNeeded('StorageController', _StorageController.default);
|
|
171
173
|
_CoreManager.default.setIfNeeded('WebSocketController', _WebSocketController.default);
|
|
172
|
-
_CoreManager.default.setIfNeeded('EventuallyQueue', _EventuallyQueue.default);
|
|
173
174
|
Parse.IndexedDB = _CoreManager.default.setIfNeeded('IndexedDBStorageController', _IndexedDBStorageController.default);
|
|
174
175
|
},
|
|
175
176
|
/**
|
|
@@ -412,7 +413,6 @@ var Parse /*: ParseType*/ = {
|
|
|
412
413
|
return this.encryptedUser;
|
|
413
414
|
}
|
|
414
415
|
};
|
|
415
|
-
_CoreManager.default.setInstallationController(_InstallationController.default);
|
|
416
416
|
_CoreManager.default.setRESTController(_RESTController.default);
|
|
417
417
|
// For legacy requires, of the form `var Parse = require('parse').Parse`
|
|
418
418
|
Parse.Parse = Parse;
|
package/lib/browser/ParseACL.js
CHANGED
|
@@ -11,11 +11,12 @@ var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/ty
|
|
|
11
11
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
12
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
13
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
14
|
-
var
|
|
15
|
-
var _ParseUser = _interopRequireDefault(require("./ParseUser"));
|
|
14
|
+
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
16
15
|
/**
|
|
17
16
|
* @flow
|
|
18
17
|
*/
|
|
18
|
+
/*:: import type ParseRole from './ParseRole';*/
|
|
19
|
+
/*:: import type ParseUser from './ParseUser';*/
|
|
19
20
|
/*:: type PermissionsMap = { [permission: string]: boolean };*/
|
|
20
21
|
/*:: type ByIdMap = { [userId: string]: PermissionsMap };*/
|
|
21
22
|
var PUBLIC_KEY = '*';
|
|
@@ -43,7 +44,8 @@ var ParseACL = /*#__PURE__*/function () {
|
|
|
43
44
|
(0, _defineProperty2.default)(this, "permissionsById", void 0);
|
|
44
45
|
this.permissionsById = {};
|
|
45
46
|
if (arg1 && (0, _typeof2.default)(arg1) === 'object') {
|
|
46
|
-
|
|
47
|
+
var _ParseUser = _CoreManager.default.getParseUser();
|
|
48
|
+
if (arg1 instanceof _ParseUser) {
|
|
47
49
|
this.setReadAccess(arg1, true);
|
|
48
50
|
this.setWriteAccess(arg1, true);
|
|
49
51
|
} else {
|
|
@@ -115,9 +117,11 @@ var ParseACL = /*#__PURE__*/function () {
|
|
|
115
117
|
}, {
|
|
116
118
|
key: "_setAccess",
|
|
117
119
|
value: function (accessType /*: string*/, userId /*: ParseUser | ParseRole | string*/, allowed /*: boolean*/) {
|
|
118
|
-
|
|
120
|
+
var ParseRole = _CoreManager.default.getParseRole();
|
|
121
|
+
var ParseUser = _CoreManager.default.getParseUser();
|
|
122
|
+
if (userId instanceof ParseUser) {
|
|
119
123
|
userId = userId.id;
|
|
120
|
-
} else if (userId instanceof
|
|
124
|
+
} else if (userId instanceof ParseRole) {
|
|
121
125
|
var name = userId.getName();
|
|
122
126
|
if (!name) {
|
|
123
127
|
throw new TypeError('Role must have a name');
|
|
@@ -152,12 +156,14 @@ var ParseACL = /*#__PURE__*/function () {
|
|
|
152
156
|
}, {
|
|
153
157
|
key: "_getAccess",
|
|
154
158
|
value: function (accessType /*: string*/, userId /*: ParseUser | ParseRole | string*/) /*: boolean*/{
|
|
155
|
-
|
|
159
|
+
var ParseRole = _CoreManager.default.getParseRole();
|
|
160
|
+
var ParseUser = _CoreManager.default.getParseUser();
|
|
161
|
+
if (userId instanceof ParseUser) {
|
|
156
162
|
userId = userId.id;
|
|
157
163
|
if (!userId) {
|
|
158
164
|
throw new Error('Cannot get access for a ParseUser without an ID');
|
|
159
165
|
}
|
|
160
|
-
} else if (userId instanceof
|
|
166
|
+
} else if (userId instanceof ParseRole) {
|
|
161
167
|
var name = userId.getName();
|
|
162
168
|
if (!name) {
|
|
163
169
|
throw new TypeError('Role must have a name');
|
|
@@ -281,7 +287,8 @@ var ParseACL = /*#__PURE__*/function () {
|
|
|
281
287
|
}, {
|
|
282
288
|
key: "getRoleReadAccess",
|
|
283
289
|
value: function (role /*: ParseRole | string*/) /*: boolean*/{
|
|
284
|
-
|
|
290
|
+
var ParseRole = _CoreManager.default.getParseRole();
|
|
291
|
+
if (role instanceof ParseRole) {
|
|
285
292
|
// Normalize to the String name
|
|
286
293
|
role = role.getName();
|
|
287
294
|
}
|
|
@@ -303,7 +310,8 @@ var ParseACL = /*#__PURE__*/function () {
|
|
|
303
310
|
}, {
|
|
304
311
|
key: "getRoleWriteAccess",
|
|
305
312
|
value: function (role /*: ParseRole | string*/) /*: boolean*/{
|
|
306
|
-
|
|
313
|
+
var ParseRole = _CoreManager.default.getParseRole();
|
|
314
|
+
if (role instanceof ParseRole) {
|
|
307
315
|
// Normalize to the String name
|
|
308
316
|
role = role.getName();
|
|
309
317
|
}
|
|
@@ -324,7 +332,8 @@ var ParseACL = /*#__PURE__*/function () {
|
|
|
324
332
|
}, {
|
|
325
333
|
key: "setRoleReadAccess",
|
|
326
334
|
value: function (role /*: ParseRole | string*/, allowed /*: boolean*/) {
|
|
327
|
-
|
|
335
|
+
var ParseRole = _CoreManager.default.getParseRole();
|
|
336
|
+
if (role instanceof ParseRole) {
|
|
328
337
|
// Normalize to the String name
|
|
329
338
|
role = role.getName();
|
|
330
339
|
}
|
|
@@ -345,7 +354,8 @@ var ParseACL = /*#__PURE__*/function () {
|
|
|
345
354
|
}, {
|
|
346
355
|
key: "setRoleWriteAccess",
|
|
347
356
|
value: function (role /*: ParseRole | string*/, allowed /*: boolean*/) {
|
|
348
|
-
|
|
357
|
+
var ParseRole = _CoreManager.default.getParseRole();
|
|
358
|
+
if (role instanceof ParseRole) {
|
|
349
359
|
// Normalize to the String name
|
|
350
360
|
role = role.getName();
|
|
351
361
|
}
|
package/lib/browser/ParseFile.js
CHANGED
|
@@ -60,6 +60,10 @@ if (typeof XMLHttpRequest !== 'undefined') {
|
|
|
60
60
|
/*:: type Base64 = { base64: string };*/
|
|
61
61
|
/*:: type Uri = { uri: string };*/
|
|
62
62
|
/*:: type FileData = Array<number> | Base64 | Blob | Uri;*/
|
|
63
|
+
/*:: export type FileSaveOptions = FullOptions & {
|
|
64
|
+
metadata?: { [key: string]: any },
|
|
65
|
+
tags?: { [key: string]: any },
|
|
66
|
+
};*/
|
|
63
67
|
/*:: export type FileSource =
|
|
64
68
|
| {
|
|
65
69
|
format: 'file',
|