parse 5.1.0-alpha.8 → 5.1.0-alpha.9
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 +435 -224
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +435 -224
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/CoreManager.js +18 -183
- package/lib/browser/InstallationController.js +134 -23
- package/lib/browser/Parse.js +2 -2
- package/lib/browser/ParseFile.js +4 -0
- package/lib/browser/ParseHooks.js +2 -0
- package/lib/browser/ParseInstallation.js +274 -13
- package/lib/browser/ParseSession.js +1 -1
- package/lib/node/CoreManager.js +18 -183
- package/lib/node/InstallationController.js +65 -21
- package/lib/node/Parse.js +2 -2
- package/lib/node/ParseFile.js +4 -0
- package/lib/node/ParseHooks.js +2 -0
- package/lib/node/ParseInstallation.js +207 -7
- package/lib/node/ParseSession.js +1 -1
- package/lib/react-native/CoreManager.js +9 -9
- package/lib/react-native/InstallationController.js +77 -9
- package/lib/react-native/Parse.js +2 -2
- package/lib/react-native/ParseInstallation.js +115 -10
- package/lib/weapp/CoreManager.js +18 -183
- package/lib/weapp/InstallationController.js +134 -23
- package/lib/weapp/Parse.js +2 -2
- package/lib/weapp/ParseFile.js +4 -0
- package/lib/weapp/ParseHooks.js +2 -0
- package/lib/weapp/ParseInstallation.js +274 -13
- package/lib/weapp/ParseSession.js +1 -1
- package/package.json +1 -1
package/lib/weapp/CoreManager.js
CHANGED
|
@@ -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-alpha.
|
|
30
|
+
VERSION: 'js' + "5.1.0-alpha.9",
|
|
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*/) {
|
|
@@ -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;
|
package/lib/weapp/Parse.js
CHANGED
|
@@ -160,10 +160,11 @@ var Parse /*: ParseType*/ = {
|
|
|
160
160
|
_CoreManager.default.setIfNeeded('EventEmitter', _EventEmitter.default);
|
|
161
161
|
_CoreManager.default.setIfNeeded('LiveQuery', new _ParseLiveQuery.default());
|
|
162
162
|
_CoreManager.default.setIfNeeded('CryptoController', _CryptoController.default);
|
|
163
|
+
_CoreManager.default.setIfNeeded('EventuallyQueue', _EventuallyQueue.default);
|
|
164
|
+
_CoreManager.default.setIfNeeded('InstallationController', _InstallationController.default);
|
|
163
165
|
_CoreManager.default.setIfNeeded('LocalDatastoreController', _LocalDatastoreController.default);
|
|
164
166
|
_CoreManager.default.setIfNeeded('StorageController', _StorageController.default);
|
|
165
167
|
_CoreManager.default.setIfNeeded('WebSocketController', _WebSocketController.default);
|
|
166
|
-
_CoreManager.default.setIfNeeded('EventuallyQueue', _EventuallyQueue.default);
|
|
167
168
|
},
|
|
168
169
|
/**
|
|
169
170
|
* Call this method to set your AsyncStorage engine
|
|
@@ -405,7 +406,6 @@ var Parse /*: ParseType*/ = {
|
|
|
405
406
|
return this.encryptedUser;
|
|
406
407
|
}
|
|
407
408
|
};
|
|
408
|
-
_CoreManager.default.setInstallationController(_InstallationController.default);
|
|
409
409
|
_CoreManager.default.setRESTController(_RESTController.default);
|
|
410
410
|
// For legacy requires, of the form `var Parse = require('parse').Parse`
|
|
411
411
|
Parse.Parse = Parse;
|
package/lib/weapp/ParseFile.js
CHANGED
|
@@ -62,6 +62,10 @@ XHR = require('./Xhr.weapp');
|
|
|
62
62
|
/*:: type Base64 = { base64: string };*/
|
|
63
63
|
/*:: type Uri = { uri: string };*/
|
|
64
64
|
/*:: type FileData = Array<number> | Base64 | Blob | Uri;*/
|
|
65
|
+
/*:: export type FileSaveOptions = FullOptions & {
|
|
66
|
+
metadata?: { [key: string]: any },
|
|
67
|
+
tags?: { [key: string]: any },
|
|
68
|
+
};*/
|
|
65
69
|
/*:: export type FileSource =
|
|
66
70
|
| {
|
|
67
71
|
format: 'file',
|
package/lib/weapp/ParseHooks.js
CHANGED
|
@@ -22,6 +22,8 @@ var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-st
|
|
|
22
22
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
23
23
|
var _decode = _interopRequireDefault(require("./decode"));
|
|
24
24
|
var _ParseError = _interopRequireDefault(require("./ParseError"));
|
|
25
|
+
/*:: export type HookDeclaration = { functionName: string, url: string } | { className: string, triggerName: string, url: string };*/
|
|
26
|
+
/*:: export type HookDeleteArg = { functionName: string } | { className: string, triggerName: string };*/
|
|
25
27
|
function getFunctions() {
|
|
26
28
|
return _CoreManager.default.getHooksController().get('functions');
|
|
27
29
|
}
|