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