parse 4.0.0-alpha.1 → 4.0.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/LICENSE +167 -25
- package/NOTICE +10 -0
- package/README.md +6 -5
- package/dist/parse.js +12838 -21190
- package/dist/parse.min.js +7 -6
- package/dist/parse.weapp.js +7921 -17062
- package/dist/parse.weapp.min.js +7 -6
- package/lib/browser/Analytics.js +2 -27
- package/lib/browser/AnonymousUtils.js +6 -42
- package/lib/browser/Cloud.js +12 -77
- package/lib/browser/CloudCode.js +0 -3
- package/lib/browser/CoreManager.js +46 -191
- package/lib/browser/CryptoController.js +2 -16
- package/lib/browser/EventEmitter.js +1 -8
- package/lib/browser/EventuallyQueue.js +277 -824
- package/lib/browser/FacebookUtils.js +6 -42
- package/lib/browser/IndexedDBStorageController.js +3 -14
- package/lib/browser/InstallationController.js +2 -20
- package/lib/browser/LiveQueryClient.js +105 -213
- package/lib/browser/LiveQuerySubscription.js +10 -39
- package/lib/browser/LocalDatastore.js +451 -1081
- package/lib/browser/LocalDatastoreController.js +145 -602
- package/lib/browser/LocalDatastoreController.react-native.js +137 -573
- package/lib/browser/LocalDatastoreUtils.js +2 -19
- package/lib/browser/ObjectStateMutations.js +18 -121
- package/lib/browser/OfflineQuery.js +61 -222
- package/lib/browser/Parse.js +12 -115
- package/lib/browser/ParseACL.js +33 -148
- package/lib/browser/ParseCLP.js +96 -314
- package/lib/browser/ParseConfig.js +18 -95
- package/lib/browser/ParseError.js +63 -99
- package/lib/browser/ParseFile.js +128 -685
- package/lib/browser/ParseGeoPoint.js +23 -89
- package/lib/browser/ParseHooks.js +1 -34
- package/lib/browser/ParseInstallation.js +4 -32
- package/lib/browser/ParseLiveQuery.js +96 -505
- package/lib/browser/ParseObject.js +665 -1845
- package/lib/browser/ParseOp.js +41 -287
- package/lib/browser/ParsePolygon.js +13 -70
- package/lib/browser/ParseQuery.js +403 -1504
- package/lib/browser/ParseRelation.js +12 -68
- package/lib/browser/ParseRole.js +13 -75
- package/lib/browser/ParseSchema.js +49 -208
- package/lib/browser/ParseSession.js +11 -69
- package/lib/browser/ParseUser.js +274 -1127
- package/lib/browser/Push.js +7 -50
- package/lib/browser/RESTController.js +28 -157
- package/lib/browser/SingleInstanceStateController.js +19 -144
- package/lib/browser/Socket.weapp.js +0 -10
- package/lib/browser/Storage.js +10 -80
- package/lib/browser/StorageController.browser.js +4 -24
- package/lib/browser/StorageController.default.js +4 -24
- package/lib/browser/StorageController.react-native.js +6 -40
- package/lib/browser/StorageController.weapp.js +5 -23
- package/lib/browser/TaskQueue.js +1 -29
- package/lib/browser/UniqueInstanceStateController.js +19 -149
- package/lib/browser/Xhr.weapp.js +0 -17
- package/lib/browser/arrayContainsObject.js +2 -23
- package/lib/browser/canBeSerialized.js +3 -40
- package/lib/browser/decode.js +3 -40
- package/lib/browser/encode.js +9 -77
- package/lib/browser/equals.js +2 -34
- package/lib/browser/escape.js +1 -15
- package/lib/browser/isRevocableSession.js +2 -18
- package/lib/browser/parseDate.js +2 -20
- package/lib/browser/promiseUtils.js +3 -21
- package/lib/browser/unique.js +3 -24
- package/lib/browser/unsavedChildren.js +6 -57
- package/lib/browser/uuid.js +3 -1
- package/lib/node/Analytics.js +1 -25
- package/lib/node/AnonymousUtils.js +5 -44
- package/lib/node/Cloud.js +10 -73
- package/lib/node/CloudCode.js +0 -3
- package/lib/node/CoreManager.js +47 -227
- package/lib/node/CryptoController.js +2 -16
- package/lib/node/EventEmitter.js +1 -8
- package/lib/node/EventuallyQueue.js +16 -123
- package/lib/node/FacebookUtils.js +5 -44
- package/lib/node/IndexedDBStorageController.js +3 -19
- package/lib/node/InstallationController.js +2 -22
- package/lib/node/LiveQueryClient.js +72 -154
- package/lib/node/LiveQuerySubscription.js +7 -26
- package/lib/node/LocalDatastore.js +19 -182
- package/lib/node/LocalDatastoreController.js +6 -45
- package/lib/node/LocalDatastoreController.react-native.js +6 -52
- package/lib/node/LocalDatastoreUtils.js +1 -13
- package/lib/node/ObjectStateMutations.js +13 -100
- package/lib/node/OfflineQuery.js +27 -151
- package/lib/node/Parse.js +11 -108
- package/lib/node/ParseACL.js +32 -157
- package/lib/node/ParseCLP.js +69 -269
- package/lib/node/ParseConfig.js +16 -91
- package/lib/node/ParseError.js +61 -74
- package/lib/node/ParseFile.js +49 -212
- package/lib/node/ParseGeoPoint.js +21 -89
- package/lib/node/ParseHooks.js +0 -35
- package/lib/node/ParseInstallation.js +1 -17
- package/lib/node/ParseLiveQuery.js +10 -43
- package/lib/node/ParseObject.js +229 -964
- package/lib/node/ParseOp.js +31 -262
- package/lib/node/ParsePolygon.js +12 -69
- package/lib/node/ParseQuery.js +169 -888
- package/lib/node/ParseRelation.js +11 -68
- package/lib/node/ParseRole.js +10 -64
- package/lib/node/ParseSchema.js +46 -229
- package/lib/node/ParseSession.js +8 -57
- package/lib/node/ParseUser.js +107 -583
- package/lib/node/Push.js +4 -44
- package/lib/node/RESTController.js +18 -127
- package/lib/node/SingleInstanceStateController.js +17 -137
- package/lib/node/Socket.weapp.js +0 -7
- package/lib/node/Storage.js +10 -90
- package/lib/node/StorageController.browser.js +4 -30
- package/lib/node/StorageController.default.js +5 -28
- package/lib/node/StorageController.react-native.js +6 -47
- package/lib/node/StorageController.weapp.js +6 -28
- package/lib/node/TaskQueue.js +1 -24
- package/lib/node/UniqueInstanceStateController.js +16 -140
- package/lib/node/Xhr.weapp.js +0 -15
- package/lib/node/arrayContainsObject.js +1 -19
- package/lib/node/canBeSerialized.js +2 -35
- package/lib/node/decode.js +1 -33
- package/lib/node/encode.js +3 -61
- package/lib/node/equals.js +0 -27
- package/lib/node/escape.js +1 -13
- package/lib/node/isRevocableSession.js +1 -12
- package/lib/node/parseDate.js +1 -14
- package/lib/node/promiseUtils.js +2 -14
- package/lib/node/unique.js +1 -18
- package/lib/node/unsavedChildren.js +2 -45
- package/lib/node/uuid.js +6 -1
- package/lib/react-native/Analytics.js +0 -9
- package/lib/react-native/AnonymousUtils.js +0 -10
- package/lib/react-native/Cloud.js +0 -26
- package/lib/react-native/CoreManager.js +2 -6
- package/lib/react-native/CryptoController.js +0 -2
- package/lib/react-native/EventEmitter.js +0 -2
- package/lib/react-native/EventuallyQueue.js +156 -711
- package/lib/react-native/FacebookUtils.js +0 -22
- package/lib/react-native/IndexedDBStorageController.js +0 -1
- package/lib/react-native/InstallationController.js +0 -6
- package/lib/react-native/LiveQueryClient.js +46 -157
- package/lib/react-native/LiveQuerySubscription.js +3 -27
- package/lib/react-native/LocalDatastore.js +281 -948
- package/lib/react-native/LocalDatastoreController.js +71 -552
- package/lib/react-native/LocalDatastoreController.react-native.js +91 -526
- package/lib/react-native/LocalDatastoreUtils.js +0 -1
- package/lib/react-native/ObjectStateMutations.js +2 -65
- package/lib/react-native/OfflineQuery.js +25 -196
- package/lib/react-native/Parse.js +0 -65
- package/lib/react-native/ParseACL.js +0 -44
- package/lib/react-native/ParseCLP.js +23 -161
- package/lib/react-native/ParseConfig.js +0 -42
- package/lib/react-native/ParseError.js +1 -21
- package/lib/react-native/ParseFile.js +55 -529
- package/lib/react-native/ParseGeoPoint.js +0 -17
- package/lib/react-native/ParseHooks.js +0 -30
- package/lib/react-native/ParseInstallation.js +1 -23
- package/lib/react-native/ParseLiveQuery.js +55 -472
- package/lib/react-native/ParseObject.js +245 -1246
- package/lib/react-native/ParseOp.js +1 -138
- package/lib/react-native/ParsePolygon.js +0 -24
- package/lib/react-native/ParseQuery.js +182 -874
- package/lib/react-native/ParseRelation.js +0 -25
- package/lib/react-native/ParseRole.js +1 -36
- package/lib/react-native/ParseSchema.js +3 -54
- package/lib/react-native/ParseSession.js +1 -40
- package/lib/react-native/ParseUser.js +95 -773
- package/lib/react-native/Push.js +0 -16
- package/lib/react-native/RESTController.js +12 -109
- package/lib/react-native/SingleInstanceStateController.js +0 -44
- package/lib/react-native/Socket.weapp.js +0 -10
- package/lib/react-native/Storage.js +0 -24
- package/lib/react-native/StorageController.browser.js +0 -2
- package/lib/react-native/StorageController.default.js +0 -1
- package/lib/react-native/StorageController.react-native.js +0 -2
- package/lib/react-native/TaskQueue.js +0 -15
- package/lib/react-native/UniqueInstanceStateController.js +0 -47
- package/lib/react-native/Xhr.weapp.js +0 -16
- package/lib/react-native/arrayContainsObject.js +0 -5
- package/lib/react-native/canBeSerialized.js +0 -18
- package/lib/react-native/decode.js +0 -21
- package/lib/react-native/encode.js +0 -25
- package/lib/react-native/equals.js +0 -18
- package/lib/react-native/escape.js +0 -1
- package/lib/react-native/isRevocableSession.js +0 -1
- package/lib/react-native/parseDate.js +0 -3
- package/lib/react-native/promiseUtils.js +0 -13
- package/lib/react-native/unique.js +0 -4
- package/lib/react-native/unsavedChildren.js +0 -21
- package/lib/react-native/uuid.js +3 -1
- package/lib/weapp/Analytics.js +2 -27
- package/lib/weapp/AnonymousUtils.js +6 -42
- package/lib/weapp/Cloud.js +12 -77
- package/lib/weapp/CloudCode.js +0 -3
- package/lib/weapp/CoreManager.js +46 -191
- package/lib/weapp/CryptoController.js +2 -16
- package/lib/weapp/EventEmitter.js +1 -8
- package/lib/weapp/EventuallyQueue.js +277 -824
- package/lib/weapp/FacebookUtils.js +6 -42
- package/lib/weapp/IndexedDBStorageController.js +3 -14
- package/lib/weapp/InstallationController.js +2 -20
- package/lib/weapp/LiveQueryClient.js +105 -213
- package/lib/weapp/LiveQuerySubscription.js +10 -39
- package/lib/weapp/LocalDatastore.js +451 -1081
- package/lib/weapp/LocalDatastoreController.js +145 -602
- package/lib/weapp/LocalDatastoreController.react-native.js +137 -573
- package/lib/weapp/LocalDatastoreUtils.js +2 -19
- package/lib/weapp/ObjectStateMutations.js +18 -121
- package/lib/weapp/OfflineQuery.js +61 -222
- package/lib/weapp/Parse.js +12 -115
- package/lib/weapp/ParseACL.js +33 -148
- package/lib/weapp/ParseCLP.js +96 -314
- package/lib/weapp/ParseConfig.js +18 -95
- package/lib/weapp/ParseError.js +63 -99
- package/lib/weapp/ParseFile.js +129 -686
- package/lib/weapp/ParseGeoPoint.js +23 -89
- package/lib/weapp/ParseHooks.js +1 -34
- package/lib/weapp/ParseInstallation.js +4 -32
- package/lib/weapp/ParseLiveQuery.js +96 -505
- package/lib/weapp/ParseObject.js +665 -1845
- package/lib/weapp/ParseOp.js +41 -287
- package/lib/weapp/ParsePolygon.js +13 -70
- package/lib/weapp/ParseQuery.js +403 -1504
- package/lib/weapp/ParseRelation.js +12 -68
- package/lib/weapp/ParseRole.js +13 -75
- package/lib/weapp/ParseSchema.js +49 -208
- package/lib/weapp/ParseSession.js +11 -69
- package/lib/weapp/ParseUser.js +274 -1127
- package/lib/weapp/Push.js +7 -50
- package/lib/weapp/RESTController.js +28 -157
- package/lib/weapp/SingleInstanceStateController.js +19 -144
- package/lib/weapp/Socket.weapp.js +0 -10
- package/lib/weapp/Storage.js +10 -80
- package/lib/weapp/StorageController.browser.js +4 -24
- package/lib/weapp/StorageController.default.js +4 -24
- package/lib/weapp/StorageController.react-native.js +6 -40
- package/lib/weapp/StorageController.weapp.js +5 -23
- package/lib/weapp/TaskQueue.js +1 -29
- package/lib/weapp/UniqueInstanceStateController.js +19 -149
- package/lib/weapp/Xhr.weapp.js +0 -17
- package/lib/weapp/arrayContainsObject.js +2 -23
- package/lib/weapp/canBeSerialized.js +3 -40
- package/lib/weapp/decode.js +3 -40
- package/lib/weapp/encode.js +9 -77
- package/lib/weapp/equals.js +2 -34
- package/lib/weapp/escape.js +1 -15
- package/lib/weapp/isRevocableSession.js +2 -18
- package/lib/weapp/parseDate.js +2 -20
- package/lib/weapp/promiseUtils.js +3 -21
- package/lib/weapp/unique.js +3 -24
- package/lib/weapp/unsavedChildren.js +6 -57
- package/lib/weapp/uuid.js +1 -6
- package/package.json +34 -30
- package/PATENTS +0 -37
package/lib/node/CoreManager.js
CHANGED
|
@@ -1,66 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
|
|
2
3
|
/*
|
|
3
|
-
* Copyright (c) 2015-present, Parse, LLC.
|
|
4
|
-
* All rights reserved.
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the BSD-style license found in the
|
|
7
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
8
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
9
|
-
*
|
|
10
4
|
* @flow
|
|
11
5
|
*/
|
|
12
|
-
|
|
13
6
|
/*:: import type { AttributeMap, ObjectCache, OpsMap, State } from './ObjectStateMutations';*/
|
|
14
|
-
|
|
15
7
|
/*:: import type ParseFile from './ParseFile';*/
|
|
16
|
-
|
|
17
8
|
/*:: import type { FileSource } from './ParseFile';*/
|
|
18
|
-
|
|
19
9
|
/*:: import type { Op } from './ParseOp';*/
|
|
20
|
-
|
|
21
10
|
/*:: import type ParseObject from './ParseObject';*/
|
|
22
|
-
|
|
23
11
|
/*:: import type { QueryJSON } from './ParseQuery';*/
|
|
24
|
-
|
|
25
12
|
/*:: import type ParseUser from './ParseUser';*/
|
|
26
|
-
|
|
27
13
|
/*:: import type { AuthData } from './ParseUser';*/
|
|
28
|
-
|
|
29
14
|
/*:: import type { PushData } from './Push';*/
|
|
30
|
-
|
|
31
15
|
/*:: import type { RequestOptions, FullOptions } from './RESTController';*/
|
|
32
|
-
|
|
33
16
|
/*:: type AnalyticsController = {
|
|
34
17
|
track: (name: string, dimensions: { [key: string]: string }) => Promise,
|
|
35
18
|
};*/
|
|
36
|
-
|
|
37
19
|
/*:: type CloudController = {
|
|
38
20
|
run: (name: string, data: mixed, options: RequestOptions) => Promise,
|
|
39
21
|
getJobsData: (options: RequestOptions) => Promise,
|
|
40
22
|
startJob: (name: string, data: mixed, options: RequestOptions) => Promise,
|
|
41
23
|
};*/
|
|
42
|
-
|
|
43
24
|
/*:: type ConfigController = {
|
|
44
25
|
current: () => Promise,
|
|
45
26
|
get: () => Promise,
|
|
46
27
|
save: (attrs: { [key: string]: any }) => Promise,
|
|
47
28
|
};*/
|
|
48
|
-
|
|
49
29
|
/*:: type CryptoController = {
|
|
50
30
|
encrypt: (obj: any, secretKey: string) => string,
|
|
51
31
|
decrypt: (encryptedText: string, secretKey: any) => string,
|
|
52
32
|
};*/
|
|
53
|
-
|
|
54
33
|
/*:: type FileController = {
|
|
55
34
|
saveFile: (name: string, source: FileSource, options: FullOptions) => Promise,
|
|
56
35
|
saveBase64: (name: string, source: FileSource, options: FullOptions) => Promise,
|
|
57
36
|
download: (uri: string) => Promise,
|
|
58
37
|
};*/
|
|
59
|
-
|
|
60
38
|
/*:: type InstallationController = {
|
|
61
39
|
currentInstallationId: () => Promise,
|
|
62
40
|
};*/
|
|
63
|
-
|
|
64
41
|
/*:: type ObjectController = {
|
|
65
42
|
fetch: (
|
|
66
43
|
object: ParseObject | Array<ParseObject>,
|
|
@@ -70,7 +47,6 @@
|
|
|
70
47
|
save: (object: ParseObject | Array<ParseObject | ParseFile>, options: RequestOptions) => Promise,
|
|
71
48
|
destroy: (object: ParseObject | Array<ParseObject>, options: RequestOptions) => Promise,
|
|
72
49
|
};*/
|
|
73
|
-
|
|
74
50
|
/*:: type ObjectStateController = {
|
|
75
51
|
getState: (obj: any) => ?State,
|
|
76
52
|
initializeState: (obj: any, initial?: State) => State,
|
|
@@ -90,21 +66,17 @@
|
|
|
90
66
|
clearAllState: () => void,
|
|
91
67
|
duplicateState: (source: any, dest: any) => void,
|
|
92
68
|
};*/
|
|
93
|
-
|
|
94
69
|
/*:: type PushController = {
|
|
95
70
|
send: (data: PushData) => Promise,
|
|
96
71
|
};*/
|
|
97
|
-
|
|
98
72
|
/*:: type QueryController = {
|
|
99
73
|
find: (className: string, params: QueryJSON, options: RequestOptions) => Promise,
|
|
100
74
|
aggregate: (className: string, params: any, options: RequestOptions) => Promise,
|
|
101
75
|
};*/
|
|
102
|
-
|
|
103
76
|
/*:: type RESTController = {
|
|
104
77
|
request: (method: string, path: string, data: mixed, options: RequestOptions) => Promise,
|
|
105
78
|
ajax: (method: string, url: string, data: any, headers?: any, options: FullOptions) => Promise,
|
|
106
79
|
};*/
|
|
107
|
-
|
|
108
80
|
/*:: type SchemaController = {
|
|
109
81
|
purge: (className: string) => Promise,
|
|
110
82
|
get: (className: string, options: RequestOptions) => Promise,
|
|
@@ -113,11 +85,9 @@
|
|
|
113
85
|
update: (className: string, params: any, options: RequestOptions) => Promise,
|
|
114
86
|
send(className: string, method: string, params: any, options: RequestOptions): Promise,
|
|
115
87
|
};*/
|
|
116
|
-
|
|
117
88
|
/*:: type SessionController = {
|
|
118
89
|
getSession: (token: RequestOptions) => Promise,
|
|
119
90
|
};*/
|
|
120
|
-
|
|
121
91
|
/*:: type StorageController =
|
|
122
92
|
| {
|
|
123
93
|
async: 0,
|
|
@@ -139,7 +109,6 @@
|
|
|
139
109
|
removeItemAsync: (path: string) => Promise,
|
|
140
110
|
clear: () => void,
|
|
141
111
|
};*/
|
|
142
|
-
|
|
143
112
|
/*:: type LocalDatastoreController = {
|
|
144
113
|
fromPinWithName: (name: string) => ?any,
|
|
145
114
|
pinWithName: (name: string, objects: any) => void,
|
|
@@ -147,7 +116,6 @@
|
|
|
147
116
|
getAllContents: () => ?any,
|
|
148
117
|
clear: () => void,
|
|
149
118
|
};*/
|
|
150
|
-
|
|
151
119
|
/*:: type UserController = {
|
|
152
120
|
setCurrentUser: (user: ParseUser) => Promise,
|
|
153
121
|
currentUser: () => ?ParseUser,
|
|
@@ -166,7 +134,6 @@
|
|
|
166
134
|
verifyPassword: (username: string, password: string, options: RequestOptions) => Promise,
|
|
167
135
|
requestEmailVerification: (email: string, options: RequestOptions) => Promise,
|
|
168
136
|
};*/
|
|
169
|
-
|
|
170
137
|
/*:: type HooksController = {
|
|
171
138
|
get: (type: string, functionName?: string, triggerName?: string) => Promise,
|
|
172
139
|
create: (hook: mixed) => Promise,
|
|
@@ -174,7 +141,6 @@
|
|
|
174
141
|
update: (hook: mixed) => Promise,
|
|
175
142
|
send: (method: string, path: string, body?: mixed) => Promise,
|
|
176
143
|
};*/
|
|
177
|
-
|
|
178
144
|
/*:: type WebSocketController = {
|
|
179
145
|
onopen: () => void,
|
|
180
146
|
onmessage: (message: any) => void,
|
|
@@ -183,7 +149,6 @@
|
|
|
183
149
|
send: (data: any) => void,
|
|
184
150
|
close: () => void,
|
|
185
151
|
};*/
|
|
186
|
-
|
|
187
152
|
/*:: type Config = {
|
|
188
153
|
AnalyticsController?: AnalyticsController,
|
|
189
154
|
CloudController?: CloudController,
|
|
@@ -203,10 +168,7 @@
|
|
|
203
168
|
HooksController?: HooksController,
|
|
204
169
|
WebSocketController?: WebSocketController,
|
|
205
170
|
};*/
|
|
206
|
-
|
|
207
|
-
const config
|
|
208
|
-
/*: Config & { [key: string]: mixed }*/
|
|
209
|
-
= {
|
|
171
|
+
const config /*: Config & { [key: string]: mixed }*/ = {
|
|
210
172
|
// Defaults
|
|
211
173
|
IS_NODE: typeof process !== 'undefined' && !!process.versions && !!process.versions.node && !process.versions.electron,
|
|
212
174
|
REQUEST_ATTEMPT_LIMIT: 5,
|
|
@@ -217,7 +179,7 @@ const config
|
|
|
217
179
|
SERVER_AUTH_TOKEN: null,
|
|
218
180
|
LIVEQUERY_SERVER_URL: null,
|
|
219
181
|
ENCRYPTED_KEY: null,
|
|
220
|
-
VERSION: 'js' + "4.0.0-alpha.
|
|
182
|
+
VERSION: 'js' + "4.0.0-alpha.10",
|
|
221
183
|
APPLICATION_ID: null,
|
|
222
184
|
JAVASCRIPT_KEY: null,
|
|
223
185
|
MASTER_KEY: null,
|
|
@@ -228,313 +190,171 @@ const config
|
|
|
228
190
|
IDEMPOTENCY: false,
|
|
229
191
|
ALLOW_CUSTOM_OBJECT_ID: false
|
|
230
192
|
};
|
|
231
|
-
|
|
232
|
-
function requireMethods(name
|
|
233
|
-
/*: string*/
|
|
234
|
-
, methods
|
|
235
|
-
/*: Array<string>*/
|
|
236
|
-
, controller
|
|
237
|
-
/*: any*/
|
|
238
|
-
) {
|
|
193
|
+
function requireMethods(name /*: string*/, methods /*: Array<string>*/, controller /*: any*/) {
|
|
239
194
|
methods.forEach(func => {
|
|
240
195
|
if (typeof controller[func] !== 'function') {
|
|
241
196
|
throw new Error(`${name} must implement ${func}()`);
|
|
242
197
|
}
|
|
243
198
|
});
|
|
244
199
|
}
|
|
245
|
-
|
|
246
200
|
module.exports = {
|
|
247
|
-
get: function (key
|
|
248
|
-
/*: string*/
|
|
249
|
-
)
|
|
250
|
-
/*: any*/
|
|
251
|
-
{
|
|
201
|
+
get: function (key /*: string*/) /*: any*/{
|
|
252
202
|
if (config.hasOwnProperty(key)) {
|
|
253
203
|
return config[key];
|
|
254
204
|
}
|
|
255
|
-
|
|
256
205
|
throw new Error('Configuration key not found: ' + key);
|
|
257
206
|
},
|
|
258
|
-
set: function (key
|
|
259
|
-
/*: string*/
|
|
260
|
-
, value
|
|
261
|
-
/*: any*/
|
|
262
|
-
)
|
|
263
|
-
/*: void*/
|
|
264
|
-
{
|
|
207
|
+
set: function (key /*: string*/, value /*: any*/) /*: void*/{
|
|
265
208
|
config[key] = value;
|
|
266
209
|
},
|
|
267
|
-
|
|
268
210
|
/* Specialized Controller Setters/Getters */
|
|
269
|
-
|
|
270
|
-
/*: AnalyticsController*/
|
|
271
|
-
) {
|
|
211
|
+
|
|
212
|
+
setAnalyticsController(controller /*: AnalyticsController*/) {
|
|
272
213
|
requireMethods('AnalyticsController', ['track'], controller);
|
|
273
214
|
config['AnalyticsController'] = controller;
|
|
274
215
|
},
|
|
275
|
-
|
|
276
|
-
getAnalyticsController()
|
|
277
|
-
/*: AnalyticsController*/
|
|
278
|
-
{
|
|
216
|
+
getAnalyticsController() /*: AnalyticsController*/{
|
|
279
217
|
return config['AnalyticsController'];
|
|
280
218
|
},
|
|
281
|
-
|
|
282
|
-
setCloudController(controller
|
|
283
|
-
/*: CloudController*/
|
|
284
|
-
) {
|
|
219
|
+
setCloudController(controller /*: CloudController*/) {
|
|
285
220
|
requireMethods('CloudController', ['run', 'getJobsData', 'startJob'], controller);
|
|
286
221
|
config['CloudController'] = controller;
|
|
287
222
|
},
|
|
288
|
-
|
|
289
|
-
getCloudController()
|
|
290
|
-
/*: CloudController*/
|
|
291
|
-
{
|
|
223
|
+
getCloudController() /*: CloudController*/{
|
|
292
224
|
return config['CloudController'];
|
|
293
225
|
},
|
|
294
|
-
|
|
295
|
-
setConfigController(controller
|
|
296
|
-
/*: ConfigController*/
|
|
297
|
-
) {
|
|
226
|
+
setConfigController(controller /*: ConfigController*/) {
|
|
298
227
|
requireMethods('ConfigController', ['current', 'get', 'save'], controller);
|
|
299
228
|
config['ConfigController'] = controller;
|
|
300
229
|
},
|
|
301
|
-
|
|
302
|
-
getConfigController()
|
|
303
|
-
/*: ConfigController*/
|
|
304
|
-
{
|
|
230
|
+
getConfigController() /*: ConfigController*/{
|
|
305
231
|
return config['ConfigController'];
|
|
306
232
|
},
|
|
307
|
-
|
|
308
|
-
setCryptoController(controller
|
|
309
|
-
/*: CryptoController*/
|
|
310
|
-
) {
|
|
233
|
+
setCryptoController(controller /*: CryptoController*/) {
|
|
311
234
|
requireMethods('CryptoController', ['encrypt', 'decrypt'], controller);
|
|
312
235
|
config['CryptoController'] = controller;
|
|
313
236
|
},
|
|
314
|
-
|
|
315
|
-
getCryptoController()
|
|
316
|
-
/*: CryptoController*/
|
|
317
|
-
{
|
|
237
|
+
getCryptoController() /*: CryptoController*/{
|
|
318
238
|
return config['CryptoController'];
|
|
319
239
|
},
|
|
320
|
-
|
|
321
|
-
setFileController(controller
|
|
322
|
-
/*: FileController*/
|
|
323
|
-
) {
|
|
240
|
+
setFileController(controller /*: FileController*/) {
|
|
324
241
|
requireMethods('FileController', ['saveFile', 'saveBase64'], controller);
|
|
325
242
|
config['FileController'] = controller;
|
|
326
243
|
},
|
|
327
|
-
|
|
328
|
-
getFileController()
|
|
329
|
-
/*: FileController*/
|
|
330
|
-
{
|
|
244
|
+
getFileController() /*: FileController*/{
|
|
331
245
|
return config['FileController'];
|
|
332
246
|
},
|
|
333
|
-
|
|
334
|
-
setInstallationController(controller
|
|
335
|
-
/*: InstallationController*/
|
|
336
|
-
) {
|
|
247
|
+
setInstallationController(controller /*: InstallationController*/) {
|
|
337
248
|
requireMethods('InstallationController', ['currentInstallationId'], controller);
|
|
338
249
|
config['InstallationController'] = controller;
|
|
339
250
|
},
|
|
340
|
-
|
|
341
|
-
getInstallationController()
|
|
342
|
-
/*: InstallationController*/
|
|
343
|
-
{
|
|
251
|
+
getInstallationController() /*: InstallationController*/{
|
|
344
252
|
return config['InstallationController'];
|
|
345
253
|
},
|
|
346
|
-
|
|
347
|
-
setObjectController(controller
|
|
348
|
-
/*: ObjectController*/
|
|
349
|
-
) {
|
|
254
|
+
setObjectController(controller /*: ObjectController*/) {
|
|
350
255
|
requireMethods('ObjectController', ['save', 'fetch', 'destroy'], controller);
|
|
351
256
|
config['ObjectController'] = controller;
|
|
352
257
|
},
|
|
353
|
-
|
|
354
|
-
getObjectController()
|
|
355
|
-
/*: ObjectController*/
|
|
356
|
-
{
|
|
258
|
+
getObjectController() /*: ObjectController*/{
|
|
357
259
|
return config['ObjectController'];
|
|
358
260
|
},
|
|
359
|
-
|
|
360
|
-
setObjectStateController(controller
|
|
361
|
-
/*: ObjectStateController*/
|
|
362
|
-
) {
|
|
261
|
+
setObjectStateController(controller /*: ObjectStateController*/) {
|
|
363
262
|
requireMethods('ObjectStateController', ['getState', 'initializeState', 'removeState', 'getServerData', 'setServerData', 'getPendingOps', 'setPendingOp', 'pushPendingState', 'popPendingState', 'mergeFirstPendingState', 'getObjectCache', 'estimateAttribute', 'estimateAttributes', 'commitServerChanges', 'enqueueTask', 'clearAllState'], controller);
|
|
364
263
|
config['ObjectStateController'] = controller;
|
|
365
264
|
},
|
|
366
|
-
|
|
367
|
-
getObjectStateController()
|
|
368
|
-
/*: ObjectStateController*/
|
|
369
|
-
{
|
|
265
|
+
getObjectStateController() /*: ObjectStateController*/{
|
|
370
266
|
return config['ObjectStateController'];
|
|
371
267
|
},
|
|
372
|
-
|
|
373
|
-
setPushController(controller
|
|
374
|
-
/*: PushController*/
|
|
375
|
-
) {
|
|
268
|
+
setPushController(controller /*: PushController*/) {
|
|
376
269
|
requireMethods('PushController', ['send'], controller);
|
|
377
270
|
config['PushController'] = controller;
|
|
378
271
|
},
|
|
379
|
-
|
|
380
|
-
getPushController()
|
|
381
|
-
/*: PushController*/
|
|
382
|
-
{
|
|
272
|
+
getPushController() /*: PushController*/{
|
|
383
273
|
return config['PushController'];
|
|
384
274
|
},
|
|
385
|
-
|
|
386
|
-
setQueryController(controller
|
|
387
|
-
/*: QueryController*/
|
|
388
|
-
) {
|
|
275
|
+
setQueryController(controller /*: QueryController*/) {
|
|
389
276
|
requireMethods('QueryController', ['find', 'aggregate'], controller);
|
|
390
277
|
config['QueryController'] = controller;
|
|
391
278
|
},
|
|
392
|
-
|
|
393
|
-
getQueryController()
|
|
394
|
-
/*: QueryController*/
|
|
395
|
-
{
|
|
279
|
+
getQueryController() /*: QueryController*/{
|
|
396
280
|
return config['QueryController'];
|
|
397
281
|
},
|
|
398
|
-
|
|
399
|
-
setRESTController(controller
|
|
400
|
-
/*: RESTController*/
|
|
401
|
-
) {
|
|
282
|
+
setRESTController(controller /*: RESTController*/) {
|
|
402
283
|
requireMethods('RESTController', ['request', 'ajax'], controller);
|
|
403
284
|
config['RESTController'] = controller;
|
|
404
285
|
},
|
|
405
|
-
|
|
406
|
-
getRESTController()
|
|
407
|
-
/*: RESTController*/
|
|
408
|
-
{
|
|
286
|
+
getRESTController() /*: RESTController*/{
|
|
409
287
|
return config['RESTController'];
|
|
410
288
|
},
|
|
411
|
-
|
|
412
|
-
setSchemaController(controller
|
|
413
|
-
/*: SchemaController*/
|
|
414
|
-
) {
|
|
289
|
+
setSchemaController(controller /*: SchemaController*/) {
|
|
415
290
|
requireMethods('SchemaController', ['get', 'create', 'update', 'delete', 'send', 'purge'], controller);
|
|
416
291
|
config['SchemaController'] = controller;
|
|
417
292
|
},
|
|
418
|
-
|
|
419
|
-
getSchemaController()
|
|
420
|
-
/*: SchemaController*/
|
|
421
|
-
{
|
|
293
|
+
getSchemaController() /*: SchemaController*/{
|
|
422
294
|
return config['SchemaController'];
|
|
423
295
|
},
|
|
424
|
-
|
|
425
|
-
setSessionController(controller
|
|
426
|
-
/*: SessionController*/
|
|
427
|
-
) {
|
|
296
|
+
setSessionController(controller /*: SessionController*/) {
|
|
428
297
|
requireMethods('SessionController', ['getSession'], controller);
|
|
429
298
|
config['SessionController'] = controller;
|
|
430
299
|
},
|
|
431
|
-
|
|
432
|
-
getSessionController()
|
|
433
|
-
/*: SessionController*/
|
|
434
|
-
{
|
|
300
|
+
getSessionController() /*: SessionController*/{
|
|
435
301
|
return config['SessionController'];
|
|
436
302
|
},
|
|
437
|
-
|
|
438
|
-
setStorageController(controller
|
|
439
|
-
/*: StorageController*/
|
|
440
|
-
) {
|
|
303
|
+
setStorageController(controller /*: StorageController*/) {
|
|
441
304
|
if (controller.async) {
|
|
442
305
|
requireMethods('An async StorageController', ['getItemAsync', 'setItemAsync', 'removeItemAsync', 'getAllKeysAsync'], controller);
|
|
443
306
|
} else {
|
|
444
307
|
requireMethods('A synchronous StorageController', ['getItem', 'setItem', 'removeItem', 'getAllKeys'], controller);
|
|
445
308
|
}
|
|
446
|
-
|
|
447
309
|
config['StorageController'] = controller;
|
|
448
310
|
},
|
|
449
|
-
|
|
450
|
-
setLocalDatastoreController(controller
|
|
451
|
-
/*: LocalDatastoreController*/
|
|
452
|
-
) {
|
|
311
|
+
setLocalDatastoreController(controller /*: LocalDatastoreController*/) {
|
|
453
312
|
requireMethods('LocalDatastoreController', ['pinWithName', 'fromPinWithName', 'unPinWithName', 'getAllContents', 'clear'], controller);
|
|
454
313
|
config['LocalDatastoreController'] = controller;
|
|
455
314
|
},
|
|
456
|
-
|
|
457
|
-
getLocalDatastoreController()
|
|
458
|
-
/*: LocalDatastoreController*/
|
|
459
|
-
{
|
|
315
|
+
getLocalDatastoreController() /*: LocalDatastoreController*/{
|
|
460
316
|
return config['LocalDatastoreController'];
|
|
461
317
|
},
|
|
462
|
-
|
|
463
|
-
setLocalDatastore(store
|
|
464
|
-
/*: any*/
|
|
465
|
-
) {
|
|
318
|
+
setLocalDatastore(store /*: any*/) {
|
|
466
319
|
config['LocalDatastore'] = store;
|
|
467
320
|
},
|
|
468
|
-
|
|
469
321
|
getLocalDatastore() {
|
|
470
322
|
return config['LocalDatastore'];
|
|
471
323
|
},
|
|
472
|
-
|
|
473
|
-
getStorageController()
|
|
474
|
-
/*: StorageController*/
|
|
475
|
-
{
|
|
324
|
+
getStorageController() /*: StorageController*/{
|
|
476
325
|
return config['StorageController'];
|
|
477
326
|
},
|
|
478
|
-
|
|
479
|
-
setAsyncStorage(storage
|
|
480
|
-
/*: any*/
|
|
481
|
-
) {
|
|
327
|
+
setAsyncStorage(storage /*: any*/) {
|
|
482
328
|
config['AsyncStorage'] = storage;
|
|
483
329
|
},
|
|
484
|
-
|
|
485
330
|
getAsyncStorage() {
|
|
486
331
|
return config['AsyncStorage'];
|
|
487
332
|
},
|
|
488
|
-
|
|
489
|
-
setWebSocketController(controller
|
|
490
|
-
/*: WebSocketController*/
|
|
491
|
-
) {
|
|
333
|
+
setWebSocketController(controller /*: WebSocketController*/) {
|
|
492
334
|
config['WebSocketController'] = controller;
|
|
493
335
|
},
|
|
494
|
-
|
|
495
|
-
getWebSocketController()
|
|
496
|
-
/*: WebSocketController*/
|
|
497
|
-
{
|
|
336
|
+
getWebSocketController() /*: WebSocketController*/{
|
|
498
337
|
return config['WebSocketController'];
|
|
499
338
|
},
|
|
500
|
-
|
|
501
|
-
setUserController(controller
|
|
502
|
-
/*: UserController*/
|
|
503
|
-
) {
|
|
339
|
+
setUserController(controller /*: UserController*/) {
|
|
504
340
|
requireMethods('UserController', ['setCurrentUser', 'currentUser', 'currentUserAsync', 'signUp', 'logIn', 'become', 'logOut', 'me', 'requestPasswordReset', 'upgradeToRevocableSession', 'requestEmailVerification', 'verifyPassword', 'linkWith'], controller);
|
|
505
341
|
config['UserController'] = controller;
|
|
506
342
|
},
|
|
507
|
-
|
|
508
|
-
getUserController()
|
|
509
|
-
/*: UserController*/
|
|
510
|
-
{
|
|
343
|
+
getUserController() /*: UserController*/{
|
|
511
344
|
return config['UserController'];
|
|
512
345
|
},
|
|
513
|
-
|
|
514
|
-
setLiveQueryController(controller
|
|
515
|
-
/*: any*/
|
|
516
|
-
) {
|
|
346
|
+
setLiveQueryController(controller /*: any*/) {
|
|
517
347
|
requireMethods('LiveQueryController', ['setDefaultLiveQueryClient', 'getDefaultLiveQueryClient', '_clearCachedDefaultClient'], controller);
|
|
518
348
|
config['LiveQueryController'] = controller;
|
|
519
349
|
},
|
|
520
|
-
|
|
521
|
-
getLiveQueryController()
|
|
522
|
-
/*: any*/
|
|
523
|
-
{
|
|
350
|
+
getLiveQueryController() /*: any*/{
|
|
524
351
|
return config['LiveQueryController'];
|
|
525
352
|
},
|
|
526
|
-
|
|
527
|
-
setHooksController(controller
|
|
528
|
-
/*: HooksController*/
|
|
529
|
-
) {
|
|
353
|
+
setHooksController(controller /*: HooksController*/) {
|
|
530
354
|
requireMethods('HooksController', ['create', 'get', 'update', 'remove'], controller);
|
|
531
355
|
config['HooksController'] = controller;
|
|
532
356
|
},
|
|
533
|
-
|
|
534
|
-
getHooksController()
|
|
535
|
-
/*: HooksController*/
|
|
536
|
-
{
|
|
357
|
+
getHooksController() /*: HooksController*/{
|
|
537
358
|
return config['HooksController'];
|
|
538
359
|
}
|
|
539
|
-
|
|
540
360
|
};
|
|
@@ -5,27 +5,13 @@ let ENC;
|
|
|
5
5
|
AES = require('crypto-js/aes');
|
|
6
6
|
ENC = require('crypto-js/enc-utf8');
|
|
7
7
|
const CryptoController = {
|
|
8
|
-
encrypt(obj
|
|
9
|
-
/*: any*/
|
|
10
|
-
, secretKey
|
|
11
|
-
/*: string*/
|
|
12
|
-
)
|
|
13
|
-
/*: ?string*/
|
|
14
|
-
{
|
|
8
|
+
encrypt(obj /*: any*/, secretKey /*: string*/) /*: ?string*/{
|
|
15
9
|
const encrypted = AES.encrypt(JSON.stringify(obj), secretKey);
|
|
16
10
|
return encrypted.toString();
|
|
17
11
|
},
|
|
18
|
-
|
|
19
|
-
decrypt(encryptedText
|
|
20
|
-
/*: string*/
|
|
21
|
-
, secretKey
|
|
22
|
-
/*: string*/
|
|
23
|
-
)
|
|
24
|
-
/*: ?string*/
|
|
25
|
-
{
|
|
12
|
+
decrypt(encryptedText /*: string*/, secretKey /*: string*/) /*: ?string*/{
|
|
26
13
|
const decryptedStr = AES.decrypt(encryptedText, secretKey).toString(ENC);
|
|
27
14
|
return decryptedStr;
|
|
28
15
|
}
|
|
29
|
-
|
|
30
16
|
};
|
|
31
17
|
module.exports = CryptoController;
|
package/lib/node/EventEmitter.js
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
|
|
2
3
|
/**
|
|
3
|
-
* Copyright (c) 2015-present, Parse, LLC.
|
|
4
|
-
* All rights reserved.
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the BSD-style license found in the
|
|
7
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
8
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
9
|
-
*
|
|
10
4
|
* This is a simple wrapper to unify EventEmitter implementations across platforms.
|
|
11
5
|
*/
|
|
12
|
-
|
|
13
6
|
module.exports = require('events').EventEmitter;
|