parse 5.2.0-alpha.1 → 5.2.0-alpha.2
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 +10102 -15029
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +10093 -15165
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/Analytics.js +7 -11
- package/lib/browser/AnonymousUtils.js +17 -22
- package/lib/browser/Cloud.js +23 -41
- package/lib/browser/CoreManager.js +71 -79
- package/lib/browser/CryptoController.js +14 -9
- package/lib/browser/EventEmitter.js +9 -2
- package/lib/browser/EventuallyQueue.js +156 -357
- package/lib/browser/FacebookUtils.js +23 -28
- package/lib/browser/IndexedDBStorageController.js +18 -14
- package/lib/browser/InstallationController.js +55 -121
- package/lib/browser/LiveQueryClient.js +308 -484
- package/lib/browser/LiveQuerySubscription.js +25 -28
- package/lib/browser/LocalDatastore.js +258 -624
- package/lib/browser/LocalDatastoreController.default.js +42 -226
- package/lib/browser/LocalDatastoreController.js +11 -1
- package/lib/browser/LocalDatastoreController.react-native.js +66 -160
- package/lib/browser/LocalDatastoreUtils.js +4 -7
- package/lib/browser/ObjectStateMutations.js +54 -96
- package/lib/browser/OfflineQuery.js +106 -198
- package/lib/browser/Parse.js +44 -60
- package/lib/browser/ParseACL.js +242 -288
- package/lib/browser/ParseCLP.js +372 -572
- package/lib/browser/ParseConfig.js +115 -138
- package/lib/browser/ParseError.js +85 -182
- package/lib/browser/ParseFile.js +294 -438
- package/lib/browser/ParseGeoPoint.js +121 -146
- package/lib/browser/ParseHooks.js +23 -25
- package/lib/browser/ParseInstallation.js +225 -367
- package/lib/browser/ParseLiveQuery.js +74 -148
- package/lib/browser/ParseObject.js +2014 -2621
- package/lib/browser/ParseOp.js +343 -484
- package/lib/browser/ParsePolygon.js +101 -120
- package/lib/browser/ParseQuery.js +1708 -2052
- package/lib/browser/ParseRelation.js +99 -118
- package/lib/browser/ParseRole.js +88 -140
- package/lib/browser/ParseSchema.js +372 -434
- package/lib/browser/ParseSession.js +62 -110
- package/lib/browser/ParseUser.js +941 -1284
- package/lib/browser/Push.js +15 -38
- package/lib/browser/RESTController.js +85 -124
- package/lib/browser/SingleInstanceStateController.js +57 -86
- package/lib/browser/Socket.weapp.js +50 -33
- package/lib/browser/Storage.js +23 -28
- package/lib/browser/StorageController.browser.js +16 -13
- package/lib/browser/StorageController.default.js +15 -14
- package/lib/browser/StorageController.js +14 -1
- package/lib/browser/StorageController.react-native.js +31 -30
- package/lib/browser/StorageController.weapp.js +19 -13
- package/lib/browser/TaskQueue.js +31 -43
- package/lib/browser/UniqueInstanceStateController.js +65 -86
- package/lib/browser/WebSocketController.js +11 -4
- package/lib/browser/Xhr.weapp.js +90 -78
- package/lib/browser/arrayContainsObject.js +3 -3
- package/lib/browser/canBeSerialized.js +10 -11
- package/lib/browser/decode.js +11 -11
- package/lib/browser/encode.js +11 -11
- package/lib/browser/equals.js +9 -10
- package/lib/browser/escape.js +2 -2
- package/lib/browser/isRevocableSession.js +1 -1
- package/lib/browser/parseDate.js +10 -10
- package/lib/browser/promiseUtils.js +19 -19
- package/lib/browser/unique.js +4 -4
- package/lib/browser/unsavedChildren.js +20 -21
- package/lib/browser/uuid.js +2 -4
- package/lib/node/Analytics.js +2 -6
- package/lib/node/AnonymousUtils.js +7 -12
- package/lib/node/Cloud.js +8 -8
- package/lib/node/CoreManager.js +59 -67
- package/lib/node/CryptoController.js +8 -3
- package/lib/node/EventEmitter.js +7 -1
- package/lib/node/EventuallyQueue.js +17 -36
- package/lib/node/FacebookUtils.js +1 -5
- package/lib/node/IndexedDBStorageController.js +14 -10
- package/lib/node/InstallationController.js +9 -10
- package/lib/node/LiveQueryClient.js +12 -14
- package/lib/node/LiveQuerySubscription.js +3 -4
- package/lib/node/LocalDatastore.js +20 -20
- package/lib/node/LocalDatastoreController.default.js +8 -9
- package/lib/node/LocalDatastoreController.js +14 -1
- package/lib/node/LocalDatastoreController.react-native.js +25 -21
- package/lib/node/LocalDatastoreUtils.js +4 -7
- package/lib/node/ObjectStateMutations.js +9 -19
- package/lib/node/OfflineQuery.js +37 -23
- package/lib/node/Parse.js +33 -47
- package/lib/node/ParseACL.js +18 -27
- package/lib/node/ParseCLP.js +35 -37
- package/lib/node/ParseConfig.js +7 -14
- package/lib/node/ParseError.js +457 -458
- package/lib/node/ParseFile.js +24 -44
- package/lib/node/ParseGeoPoint.js +16 -17
- package/lib/node/ParseHooks.js +13 -15
- package/lib/node/ParseInstallation.js +7 -8
- package/lib/node/ParseLiveQuery.js +6 -11
- package/lib/node/ParseObject.js +139 -170
- package/lib/node/ParseOp.js +32 -44
- package/lib/node/ParsePolygon.js +11 -17
- package/lib/node/ParseQuery.js +97 -120
- package/lib/node/ParseRelation.js +7 -16
- package/lib/node/ParseRole.js +7 -8
- package/lib/node/ParseSchema.js +26 -39
- package/lib/node/ParseSession.js +7 -8
- package/lib/node/ParseUser.js +73 -84
- package/lib/node/Push.js +4 -9
- package/lib/node/RESTController.js +21 -33
- package/lib/node/SingleInstanceStateController.js +41 -69
- package/lib/node/Socket.weapp.js +23 -2
- package/lib/node/Storage.js +11 -16
- package/lib/node/StorageController.browser.js +10 -8
- package/lib/node/StorageController.default.js +9 -9
- package/lib/node/StorageController.js +16 -1
- package/lib/node/StorageController.react-native.js +17 -17
- package/lib/node/StorageController.weapp.js +14 -8
- package/lib/node/TaskQueue.js +2 -3
- package/lib/node/UniqueInstanceStateController.js +40 -60
- package/lib/node/WebSocketController.js +15 -2
- package/lib/node/Xhr.weapp.js +11 -2
- package/lib/node/arrayContainsObject.js +1 -1
- package/lib/node/canBeSerialized.js +2 -2
- package/lib/node/decode.js +1 -1
- package/lib/node/encode.js +2 -2
- package/lib/node/equals.js +1 -1
- package/lib/node/escape.js +1 -1
- package/lib/node/isRevocableSession.js +1 -1
- package/lib/node/parseDate.js +1 -1
- package/lib/node/promiseUtils.js +7 -7
- package/lib/node/unique.js +2 -2
- package/lib/node/unsavedChildren.js +2 -2
- package/lib/node/uuid.js +2 -4
- package/lib/react-native/Analytics.js +2 -2
- package/lib/react-native/AnonymousUtils.js +3 -4
- package/lib/react-native/CoreManager.js +2 -3
- package/lib/react-native/CryptoController.js +6 -1
- package/lib/react-native/EventEmitter.js +6 -1
- package/lib/react-native/EventuallyQueue.js +1 -2
- package/lib/react-native/FacebookUtils.js +1 -2
- package/lib/react-native/IndexedDBStorageController.js +11 -5
- package/lib/react-native/InstallationController.js +1 -2
- package/lib/react-native/LiveQueryClient.js +2 -4
- package/lib/react-native/LiveQuerySubscription.js +2 -4
- package/lib/react-native/LocalDatastore.js +3 -3
- package/lib/react-native/LocalDatastoreController.default.js +1 -2
- package/lib/react-native/LocalDatastoreController.js +11 -1
- package/lib/react-native/LocalDatastoreController.react-native.js +11 -12
- package/lib/react-native/LocalDatastoreUtils.js +3 -6
- package/lib/react-native/OfflineQuery.js +25 -20
- package/lib/react-native/Parse.js +24 -38
- package/lib/react-native/ParseACL.js +4 -6
- package/lib/react-native/ParseCLP.js +2 -4
- package/lib/react-native/ParseConfig.js +4 -6
- package/lib/react-native/ParseError.js +13 -31
- package/lib/react-native/ParseFile.js +3 -4
- package/lib/react-native/ParseGeoPoint.js +2 -4
- package/lib/react-native/ParseInstallation.js +13 -30
- package/lib/react-native/ParseLiveQuery.js +2 -4
- package/lib/react-native/ParseObject.js +77 -87
- package/lib/react-native/ParseOp.js +41 -79
- package/lib/react-native/ParsePolygon.js +2 -4
- package/lib/react-native/ParseQuery.js +43 -45
- package/lib/react-native/ParseRelation.js +2 -4
- package/lib/react-native/ParseRole.js +13 -30
- package/lib/react-native/ParseSchema.js +3 -5
- package/lib/react-native/ParseSession.js +12 -29
- package/lib/react-native/ParseUser.js +24 -49
- package/lib/react-native/RESTController.js +10 -4
- package/lib/react-native/SingleInstanceStateController.js +23 -37
- package/lib/react-native/Socket.weapp.js +9 -4
- package/lib/react-native/Storage.js +1 -2
- package/lib/react-native/StorageController.browser.js +6 -1
- package/lib/react-native/StorageController.default.js +6 -1
- package/lib/react-native/StorageController.js +13 -1
- package/lib/react-native/StorageController.react-native.js +11 -6
- package/lib/react-native/StorageController.weapp.js +6 -1
- package/lib/react-native/TaskQueue.js +2 -4
- package/lib/react-native/UniqueInstanceStateController.js +23 -37
- package/lib/react-native/WebSocketController.js +9 -1
- package/lib/react-native/Xhr.weapp.js +9 -4
- package/lib/react-native/unsavedChildren.js +3 -3
- package/lib/react-native/uuid.js +1 -2
- package/lib/weapp/Analytics.js +7 -11
- package/lib/weapp/AnonymousUtils.js +17 -22
- package/lib/weapp/Cloud.js +23 -41
- package/lib/weapp/CoreManager.js +71 -79
- package/lib/weapp/CryptoController.js +14 -9
- package/lib/weapp/EventEmitter.js +9 -2
- package/lib/weapp/EventuallyQueue.js +156 -357
- package/lib/weapp/FacebookUtils.js +23 -28
- package/lib/weapp/IndexedDBStorageController.js +18 -14
- package/lib/weapp/InstallationController.js +55 -121
- package/lib/weapp/LiveQueryClient.js +308 -484
- package/lib/weapp/LiveQuerySubscription.js +25 -28
- package/lib/weapp/LocalDatastore.js +258 -624
- package/lib/weapp/LocalDatastoreController.default.js +42 -226
- package/lib/weapp/LocalDatastoreController.js +11 -1
- package/lib/weapp/LocalDatastoreController.react-native.js +66 -160
- package/lib/weapp/LocalDatastoreUtils.js +4 -7
- package/lib/weapp/ObjectStateMutations.js +54 -96
- package/lib/weapp/OfflineQuery.js +106 -198
- package/lib/weapp/Parse.js +44 -59
- package/lib/weapp/ParseACL.js +242 -288
- package/lib/weapp/ParseCLP.js +372 -572
- package/lib/weapp/ParseConfig.js +115 -138
- package/lib/weapp/ParseError.js +85 -182
- package/lib/weapp/ParseFile.js +295 -440
- package/lib/weapp/ParseGeoPoint.js +121 -146
- package/lib/weapp/ParseHooks.js +23 -25
- package/lib/weapp/ParseInstallation.js +225 -367
- package/lib/weapp/ParseLiveQuery.js +74 -148
- package/lib/weapp/ParseObject.js +2014 -2621
- package/lib/weapp/ParseOp.js +343 -484
- package/lib/weapp/ParsePolygon.js +101 -120
- package/lib/weapp/ParseQuery.js +1708 -2052
- package/lib/weapp/ParseRelation.js +99 -118
- package/lib/weapp/ParseRole.js +88 -140
- package/lib/weapp/ParseSchema.js +372 -434
- package/lib/weapp/ParseSession.js +62 -110
- package/lib/weapp/ParseUser.js +941 -1284
- package/lib/weapp/Push.js +15 -38
- package/lib/weapp/RESTController.js +86 -125
- package/lib/weapp/SingleInstanceStateController.js +57 -86
- package/lib/weapp/Socket.weapp.js +50 -33
- package/lib/weapp/Storage.js +23 -28
- package/lib/weapp/StorageController.browser.js +16 -13
- package/lib/weapp/StorageController.default.js +15 -14
- package/lib/weapp/StorageController.js +14 -1
- package/lib/weapp/StorageController.react-native.js +31 -30
- package/lib/weapp/StorageController.weapp.js +19 -13
- package/lib/weapp/TaskQueue.js +31 -43
- package/lib/weapp/UniqueInstanceStateController.js +65 -86
- package/lib/weapp/WebSocketController.js +11 -4
- package/lib/weapp/Xhr.weapp.js +90 -78
- package/lib/weapp/arrayContainsObject.js +3 -3
- package/lib/weapp/canBeSerialized.js +10 -11
- package/lib/weapp/decode.js +11 -11
- package/lib/weapp/encode.js +11 -11
- package/lib/weapp/equals.js +9 -10
- package/lib/weapp/escape.js +2 -2
- package/lib/weapp/isRevocableSession.js +1 -1
- package/lib/weapp/parseDate.js +10 -10
- package/lib/weapp/promiseUtils.js +19 -19
- package/lib/weapp/unique.js +4 -4
- package/lib/weapp/unsavedChildren.js +20 -21
- package/lib/weapp/uuid.js +6 -8
- package/package.json +19 -25
package/lib/node/CoreManager.js
CHANGED
|
@@ -5,15 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
/** Based on https://github.com/react-native-async-storage/async-storage/blob/main/packages/default-storage-backend/src/types.ts */
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
onmessage: (message: any) => void,
|
|
11
|
-
onclose: (arg?: any) => void,
|
|
12
|
-
onerror: (error: any) => void,
|
|
13
|
-
send: (data: any) => void,
|
|
14
|
-
close: () => void,
|
|
15
|
-
};*/
|
|
16
|
-
const config /*: Config & { [key: string]: any }*/ = {
|
|
8
|
+
|
|
9
|
+
const config = {
|
|
17
10
|
IS_NODE: typeof process !== 'undefined' && !!process.versions && !!process.versions.node && !process.versions.electron,
|
|
18
11
|
REQUEST_ATTEMPT_LIMIT: 5,
|
|
19
12
|
REQUEST_BATCH_SIZE: 20,
|
|
@@ -23,7 +16,7 @@ const config /*: Config & { [key: string]: any }*/ = {
|
|
|
23
16
|
SERVER_AUTH_TOKEN: null,
|
|
24
17
|
LIVEQUERY_SERVER_URL: null,
|
|
25
18
|
ENCRYPTED_KEY: null,
|
|
26
|
-
VERSION: 'js' + "5.2.0-alpha.
|
|
19
|
+
VERSION: 'js' + "5.2.0-alpha.2",
|
|
27
20
|
APPLICATION_ID: null,
|
|
28
21
|
JAVASCRIPT_KEY: null,
|
|
29
22
|
MASTER_KEY: null,
|
|
@@ -35,7 +28,7 @@ const config /*: Config & { [key: string]: any }*/ = {
|
|
|
35
28
|
ALLOW_CUSTOM_OBJECT_ID: false,
|
|
36
29
|
PARSE_ERRORS: []
|
|
37
30
|
};
|
|
38
|
-
function requireMethods(name
|
|
31
|
+
function requireMethods(name, methods, controller) {
|
|
39
32
|
methods.forEach(func => {
|
|
40
33
|
if (typeof controller[func] !== 'function') {
|
|
41
34
|
throw new Error(`${name} must implement ${func}()`);
|
|
@@ -43,16 +36,16 @@ function requireMethods(name /*: string*/, methods /*: Array<string>*/, controll
|
|
|
43
36
|
});
|
|
44
37
|
}
|
|
45
38
|
const CoreManager = {
|
|
46
|
-
get: function (key
|
|
39
|
+
get: function (key) {
|
|
47
40
|
if (config.hasOwnProperty(key)) {
|
|
48
41
|
return config[key];
|
|
49
42
|
}
|
|
50
43
|
throw new Error('Configuration key not found: ' + key);
|
|
51
44
|
},
|
|
52
|
-
set: function (key
|
|
45
|
+
set: function (key, value) {
|
|
53
46
|
config[key] = value;
|
|
54
47
|
},
|
|
55
|
-
setIfNeeded: function (key
|
|
48
|
+
setIfNeeded: function (key, value) {
|
|
56
49
|
if (!config.hasOwnProperty(key)) {
|
|
57
50
|
config[key] = value;
|
|
58
51
|
}
|
|
@@ -60,117 +53,117 @@ const CoreManager = {
|
|
|
60
53
|
},
|
|
61
54
|
/* Specialized Controller Setters/Getters */
|
|
62
55
|
|
|
63
|
-
setAnalyticsController(controller
|
|
56
|
+
setAnalyticsController(controller) {
|
|
64
57
|
requireMethods('AnalyticsController', ['track'], controller);
|
|
65
58
|
config['AnalyticsController'] = controller;
|
|
66
59
|
},
|
|
67
|
-
getAnalyticsController()
|
|
60
|
+
getAnalyticsController() {
|
|
68
61
|
return config['AnalyticsController'];
|
|
69
62
|
},
|
|
70
|
-
setCloudController(controller
|
|
63
|
+
setCloudController(controller) {
|
|
71
64
|
requireMethods('CloudController', ['run', 'getJobsData', 'startJob'], controller);
|
|
72
65
|
config['CloudController'] = controller;
|
|
73
66
|
},
|
|
74
|
-
getCloudController()
|
|
67
|
+
getCloudController() {
|
|
75
68
|
return config['CloudController'];
|
|
76
69
|
},
|
|
77
|
-
setConfigController(controller
|
|
70
|
+
setConfigController(controller) {
|
|
78
71
|
requireMethods('ConfigController', ['current', 'get', 'save'], controller);
|
|
79
72
|
config['ConfigController'] = controller;
|
|
80
73
|
},
|
|
81
|
-
getConfigController()
|
|
74
|
+
getConfigController() {
|
|
82
75
|
return config['ConfigController'];
|
|
83
76
|
},
|
|
84
|
-
setCryptoController(controller
|
|
77
|
+
setCryptoController(controller) {
|
|
85
78
|
requireMethods('CryptoController', ['encrypt', 'decrypt'], controller);
|
|
86
79
|
config['CryptoController'] = controller;
|
|
87
80
|
},
|
|
88
|
-
getCryptoController()
|
|
81
|
+
getCryptoController() {
|
|
89
82
|
return config['CryptoController'];
|
|
90
83
|
},
|
|
91
|
-
setEventEmitter(eventEmitter
|
|
84
|
+
setEventEmitter(eventEmitter) {
|
|
92
85
|
config['EventEmitter'] = eventEmitter;
|
|
93
86
|
},
|
|
94
|
-
getEventEmitter()
|
|
87
|
+
getEventEmitter() {
|
|
95
88
|
return config['EventEmitter'];
|
|
96
89
|
},
|
|
97
|
-
setFileController(controller
|
|
90
|
+
setFileController(controller) {
|
|
98
91
|
requireMethods('FileController', ['saveFile', 'saveBase64'], controller);
|
|
99
92
|
config['FileController'] = controller;
|
|
100
93
|
},
|
|
101
|
-
setEventuallyQueue(controller
|
|
94
|
+
setEventuallyQueue(controller) {
|
|
102
95
|
requireMethods('EventuallyQueue', ['poll', 'save', 'destroy'], controller);
|
|
103
96
|
config['EventuallyQueue'] = controller;
|
|
104
97
|
},
|
|
105
|
-
getEventuallyQueue()
|
|
98
|
+
getEventuallyQueue() {
|
|
106
99
|
return config['EventuallyQueue'];
|
|
107
100
|
},
|
|
108
|
-
getFileController()
|
|
101
|
+
getFileController() {
|
|
109
102
|
return config['FileController'];
|
|
110
103
|
},
|
|
111
|
-
setInstallationController(controller
|
|
104
|
+
setInstallationController(controller) {
|
|
112
105
|
requireMethods('InstallationController', ['currentInstallationId', 'currentInstallation', 'updateInstallationOnDisk'], controller);
|
|
113
106
|
config['InstallationController'] = controller;
|
|
114
107
|
},
|
|
115
|
-
getInstallationController()
|
|
108
|
+
getInstallationController() {
|
|
116
109
|
return config['InstallationController'];
|
|
117
110
|
},
|
|
118
|
-
setLiveQuery(liveQuery
|
|
111
|
+
setLiveQuery(liveQuery) {
|
|
119
112
|
config['LiveQuery'] = liveQuery;
|
|
120
113
|
},
|
|
121
|
-
getLiveQuery()
|
|
114
|
+
getLiveQuery() {
|
|
122
115
|
return config['LiveQuery'];
|
|
123
116
|
},
|
|
124
|
-
setObjectController(controller
|
|
117
|
+
setObjectController(controller) {
|
|
125
118
|
requireMethods('ObjectController', ['save', 'fetch', 'destroy'], controller);
|
|
126
119
|
config['ObjectController'] = controller;
|
|
127
120
|
},
|
|
128
|
-
getObjectController()
|
|
121
|
+
getObjectController() {
|
|
129
122
|
return config['ObjectController'];
|
|
130
123
|
},
|
|
131
|
-
setObjectStateController(controller
|
|
124
|
+
setObjectStateController(controller) {
|
|
132
125
|
requireMethods('ObjectStateController', ['getState', 'initializeState', 'removeState', 'getServerData', 'setServerData', 'getPendingOps', 'setPendingOp', 'pushPendingState', 'popPendingState', 'mergeFirstPendingState', 'getObjectCache', 'estimateAttribute', 'estimateAttributes', 'commitServerChanges', 'enqueueTask', 'clearAllState'], controller);
|
|
133
126
|
config['ObjectStateController'] = controller;
|
|
134
127
|
},
|
|
135
|
-
getObjectStateController()
|
|
128
|
+
getObjectStateController() {
|
|
136
129
|
return config['ObjectStateController'];
|
|
137
130
|
},
|
|
138
|
-
setPushController(controller
|
|
131
|
+
setPushController(controller) {
|
|
139
132
|
requireMethods('PushController', ['send'], controller);
|
|
140
133
|
config['PushController'] = controller;
|
|
141
134
|
},
|
|
142
|
-
getPushController()
|
|
135
|
+
getPushController() {
|
|
143
136
|
return config['PushController'];
|
|
144
137
|
},
|
|
145
|
-
setQueryController(controller
|
|
138
|
+
setQueryController(controller) {
|
|
146
139
|
requireMethods('QueryController', ['find', 'aggregate'], controller);
|
|
147
140
|
config['QueryController'] = controller;
|
|
148
141
|
},
|
|
149
|
-
getQueryController()
|
|
142
|
+
getQueryController() {
|
|
150
143
|
return config['QueryController'];
|
|
151
144
|
},
|
|
152
|
-
setRESTController(controller
|
|
145
|
+
setRESTController(controller) {
|
|
153
146
|
requireMethods('RESTController', ['request', 'ajax'], controller);
|
|
154
147
|
config['RESTController'] = controller;
|
|
155
148
|
},
|
|
156
|
-
getRESTController()
|
|
149
|
+
getRESTController() {
|
|
157
150
|
return config['RESTController'];
|
|
158
151
|
},
|
|
159
|
-
setSchemaController(controller
|
|
152
|
+
setSchemaController(controller) {
|
|
160
153
|
requireMethods('SchemaController', ['get', 'create', 'update', 'delete', 'send', 'purge'], controller);
|
|
161
154
|
config['SchemaController'] = controller;
|
|
162
155
|
},
|
|
163
|
-
getSchemaController()
|
|
156
|
+
getSchemaController() {
|
|
164
157
|
return config['SchemaController'];
|
|
165
158
|
},
|
|
166
|
-
setSessionController(controller
|
|
159
|
+
setSessionController(controller) {
|
|
167
160
|
requireMethods('SessionController', ['getSession'], controller);
|
|
168
161
|
config['SessionController'] = controller;
|
|
169
162
|
},
|
|
170
|
-
getSessionController()
|
|
163
|
+
getSessionController() {
|
|
171
164
|
return config['SessionController'];
|
|
172
165
|
},
|
|
173
|
-
setStorageController(controller
|
|
166
|
+
setStorageController(controller) {
|
|
174
167
|
if (controller.async) {
|
|
175
168
|
requireMethods('An async StorageController', ['getItemAsync', 'setItemAsync', 'removeItemAsync', 'getAllKeysAsync'], controller);
|
|
176
169
|
} else {
|
|
@@ -178,80 +171,80 @@ const CoreManager = {
|
|
|
178
171
|
}
|
|
179
172
|
config['StorageController'] = controller;
|
|
180
173
|
},
|
|
181
|
-
setLocalDatastoreController(controller
|
|
174
|
+
setLocalDatastoreController(controller) {
|
|
182
175
|
requireMethods('LocalDatastoreController', ['pinWithName', 'fromPinWithName', 'unPinWithName', 'getAllContents', 'clear'], controller);
|
|
183
176
|
config['LocalDatastoreController'] = controller;
|
|
184
177
|
},
|
|
185
|
-
getLocalDatastoreController()
|
|
178
|
+
getLocalDatastoreController() {
|
|
186
179
|
return config['LocalDatastoreController'];
|
|
187
180
|
},
|
|
188
|
-
setLocalDatastore(store
|
|
181
|
+
setLocalDatastore(store) {
|
|
189
182
|
config['LocalDatastore'] = store;
|
|
190
183
|
},
|
|
191
184
|
getLocalDatastore() {
|
|
192
185
|
return config['LocalDatastore'];
|
|
193
186
|
},
|
|
194
|
-
getStorageController()
|
|
187
|
+
getStorageController() {
|
|
195
188
|
return config['StorageController'];
|
|
196
189
|
},
|
|
197
|
-
setAsyncStorage(storage
|
|
190
|
+
setAsyncStorage(storage) {
|
|
198
191
|
config['AsyncStorage'] = storage;
|
|
199
192
|
},
|
|
200
193
|
getAsyncStorage() {
|
|
201
194
|
return config['AsyncStorage'];
|
|
202
195
|
},
|
|
203
|
-
setWebSocketController(controller
|
|
196
|
+
setWebSocketController(controller) {
|
|
204
197
|
config['WebSocketController'] = controller;
|
|
205
198
|
},
|
|
206
|
-
getWebSocketController()
|
|
199
|
+
getWebSocketController() {
|
|
207
200
|
return config['WebSocketController'];
|
|
208
201
|
},
|
|
209
|
-
setUserController(controller
|
|
202
|
+
setUserController(controller) {
|
|
210
203
|
requireMethods('UserController', ['setCurrentUser', 'currentUser', 'currentUserAsync', 'signUp', 'logIn', 'become', 'logOut', 'me', 'requestPasswordReset', 'upgradeToRevocableSession', 'requestEmailVerification', 'verifyPassword', 'linkWith'], controller);
|
|
211
204
|
config['UserController'] = controller;
|
|
212
205
|
},
|
|
213
|
-
getUserController()
|
|
206
|
+
getUserController() {
|
|
214
207
|
return config['UserController'];
|
|
215
208
|
},
|
|
216
|
-
setLiveQueryController(controller
|
|
209
|
+
setLiveQueryController(controller) {
|
|
217
210
|
requireMethods('LiveQueryController', ['setDefaultLiveQueryClient', 'getDefaultLiveQueryClient', '_clearCachedDefaultClient'], controller);
|
|
218
211
|
config['LiveQueryController'] = controller;
|
|
219
212
|
},
|
|
220
|
-
getLiveQueryController()
|
|
213
|
+
getLiveQueryController() {
|
|
221
214
|
return config['LiveQueryController'];
|
|
222
215
|
},
|
|
223
|
-
setHooksController(controller
|
|
216
|
+
setHooksController(controller) {
|
|
224
217
|
requireMethods('HooksController', ['create', 'get', 'update', 'remove'], controller);
|
|
225
218
|
config['HooksController'] = controller;
|
|
226
219
|
},
|
|
227
|
-
getHooksController()
|
|
220
|
+
getHooksController() {
|
|
228
221
|
return config['HooksController'];
|
|
229
222
|
},
|
|
230
|
-
setParseOp(op
|
|
223
|
+
setParseOp(op) {
|
|
231
224
|
config['ParseOp'] = op;
|
|
232
225
|
},
|
|
233
226
|
getParseOp() {
|
|
234
227
|
return config['ParseOp'];
|
|
235
228
|
},
|
|
236
|
-
setParseObject(object
|
|
229
|
+
setParseObject(object) {
|
|
237
230
|
config['ParseObject'] = object;
|
|
238
231
|
},
|
|
239
232
|
getParseObject() {
|
|
240
233
|
return config['ParseObject'];
|
|
241
234
|
},
|
|
242
|
-
setParseQuery(query
|
|
235
|
+
setParseQuery(query) {
|
|
243
236
|
config['ParseQuery'] = query;
|
|
244
237
|
},
|
|
245
238
|
getParseQuery() {
|
|
246
239
|
return config['ParseQuery'];
|
|
247
240
|
},
|
|
248
|
-
setParseRole(role
|
|
241
|
+
setParseRole(role) {
|
|
249
242
|
config['ParseRole'] = role;
|
|
250
243
|
},
|
|
251
244
|
getParseRole() {
|
|
252
245
|
return config['ParseRole'];
|
|
253
246
|
},
|
|
254
|
-
setParseUser(user
|
|
247
|
+
setParseUser(user) {
|
|
255
248
|
config['ParseUser'] = user;
|
|
256
249
|
},
|
|
257
250
|
getParseUser() {
|
|
@@ -259,5 +252,4 @@ const CoreManager = {
|
|
|
259
252
|
}
|
|
260
253
|
};
|
|
261
254
|
module.exports = CoreManager;
|
|
262
|
-
var _default = CoreManager;
|
|
263
|
-
exports.default = _default;
|
|
255
|
+
var _default = exports.default = CoreManager;
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
3
7
|
let AES;
|
|
4
8
|
let ENC;
|
|
5
9
|
AES = require('crypto-js/aes');
|
|
6
10
|
ENC = require('crypto-js/enc-utf8');
|
|
7
11
|
const CryptoController = {
|
|
8
|
-
encrypt(obj
|
|
12
|
+
encrypt(obj, secretKey) {
|
|
9
13
|
const encrypted = AES.encrypt(JSON.stringify(obj), secretKey);
|
|
10
14
|
return encrypted.toString();
|
|
11
15
|
},
|
|
12
|
-
decrypt(encryptedText
|
|
16
|
+
decrypt(encryptedText, secretKey) {
|
|
13
17
|
const decryptedStr = AES.decrypt(encryptedText, secretKey).toString(ENC);
|
|
14
18
|
return decryptedStr;
|
|
15
19
|
}
|
|
16
20
|
};
|
|
17
|
-
module.exports = CryptoController;
|
|
21
|
+
module.exports = CryptoController;
|
|
22
|
+
var _default = exports.default = CryptoController;
|
package/lib/node/EventEmitter.js
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
3
7
|
/**
|
|
4
8
|
* This is a simple wrapper to unify EventEmitter implementations across platforms.
|
|
5
9
|
*/
|
|
10
|
+
|
|
6
11
|
let EventEmitter;
|
|
7
12
|
try {
|
|
8
13
|
EventEmitter = require('events').EventEmitter;
|
|
9
14
|
} catch (_) {
|
|
10
15
|
// EventEmitter unavailable
|
|
11
16
|
}
|
|
12
|
-
module.exports = EventEmitter;
|
|
17
|
+
module.exports = EventEmitter;
|
|
18
|
+
var _default = exports.default = EventEmitter;
|
|
@@ -14,24 +14,6 @@ function _interopRequireDefault(obj) {
|
|
|
14
14
|
default: obj
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
/**
|
|
18
|
-
* https://github.com/francimedia/parse-js-local-storage
|
|
19
|
-
*
|
|
20
|
-
* @flow
|
|
21
|
-
*/
|
|
22
|
-
/*:: import type { SaveOptions } from './ParseObject';*/
|
|
23
|
-
/*:: import type { RequestOptions } from './RESTController';*/
|
|
24
|
-
/*:: type QueueObject = {
|
|
25
|
-
queueId: string,
|
|
26
|
-
action: string,
|
|
27
|
-
object: ParseObject,
|
|
28
|
-
serverOptions: SaveOptions | RequestOptions,
|
|
29
|
-
id: string,
|
|
30
|
-
className: string,
|
|
31
|
-
hash: string,
|
|
32
|
-
createdAt: Date,
|
|
33
|
-
};*/
|
|
34
|
-
/*:: type Queue = Array<QueueObject>;*/
|
|
35
17
|
const QUEUE_KEY = 'Parse/Eventually/Queue';
|
|
36
18
|
let queueCache = [];
|
|
37
19
|
let dirtyCache = true;
|
|
@@ -56,7 +38,7 @@ const EventuallyQueue = {
|
|
|
56
38
|
* @static
|
|
57
39
|
* @see Parse.Object#saveEventually
|
|
58
40
|
*/
|
|
59
|
-
save(object
|
|
41
|
+
save(object, serverOptions = {}) {
|
|
60
42
|
return this.enqueue('save', object, serverOptions);
|
|
61
43
|
},
|
|
62
44
|
/**
|
|
@@ -70,7 +52,7 @@ const EventuallyQueue = {
|
|
|
70
52
|
* @static
|
|
71
53
|
* @see Parse.Object#destroyEventually
|
|
72
54
|
*/
|
|
73
|
-
destroy(object
|
|
55
|
+
destroy(object, serverOptions = {}) {
|
|
74
56
|
return this.enqueue('destroy', object, serverOptions);
|
|
75
57
|
},
|
|
76
58
|
/**
|
|
@@ -82,7 +64,7 @@ const EventuallyQueue = {
|
|
|
82
64
|
* @static
|
|
83
65
|
* @ignore
|
|
84
66
|
*/
|
|
85
|
-
generateQueueId(action
|
|
67
|
+
generateQueueId(action, object) {
|
|
86
68
|
object._getId();
|
|
87
69
|
const {
|
|
88
70
|
className,
|
|
@@ -102,7 +84,7 @@ const EventuallyQueue = {
|
|
|
102
84
|
* @static
|
|
103
85
|
* @ignore
|
|
104
86
|
*/
|
|
105
|
-
async enqueue(action
|
|
87
|
+
async enqueue(action, object, serverOptions) {
|
|
106
88
|
const queueData = await this.getQueue();
|
|
107
89
|
const queueId = this.generateQueueId(action, object);
|
|
108
90
|
let index = this.queueItemExists(queueData, queueId);
|
|
@@ -139,10 +121,10 @@ const EventuallyQueue = {
|
|
|
139
121
|
*
|
|
140
122
|
* @function getQueue
|
|
141
123
|
* @name Parse.EventuallyQueue.getQueue
|
|
142
|
-
* @returns {Promise<
|
|
124
|
+
* @returns {Promise<QueueObject[]>}
|
|
143
125
|
* @static
|
|
144
126
|
*/
|
|
145
|
-
async getQueue()
|
|
127
|
+
async getQueue() {
|
|
146
128
|
if (dirtyCache) {
|
|
147
129
|
queueCache = JSON.parse((await this.load()) || '[]');
|
|
148
130
|
dirtyCache = false;
|
|
@@ -157,7 +139,7 @@ const EventuallyQueue = {
|
|
|
157
139
|
* @static
|
|
158
140
|
* @ignore
|
|
159
141
|
*/
|
|
160
|
-
setQueue(queue
|
|
142
|
+
setQueue(queue) {
|
|
161
143
|
queueCache = queue;
|
|
162
144
|
return this.store(queueCache);
|
|
163
145
|
},
|
|
@@ -169,7 +151,7 @@ const EventuallyQueue = {
|
|
|
169
151
|
* @static
|
|
170
152
|
* @ignore
|
|
171
153
|
*/
|
|
172
|
-
async remove(queueId
|
|
154
|
+
async remove(queueId) {
|
|
173
155
|
const queueData = await this.getQueue();
|
|
174
156
|
const index = this.queueItemExists(queueData, queueId);
|
|
175
157
|
if (index > -1) {
|
|
@@ -185,7 +167,7 @@ const EventuallyQueue = {
|
|
|
185
167
|
* @returns {Promise} A promise that is fulfilled when queue is cleared.
|
|
186
168
|
* @static
|
|
187
169
|
*/
|
|
188
|
-
clear()
|
|
170
|
+
clear() {
|
|
189
171
|
queueCache = [];
|
|
190
172
|
return this.store([]);
|
|
191
173
|
},
|
|
@@ -198,7 +180,7 @@ const EventuallyQueue = {
|
|
|
198
180
|
* @static
|
|
199
181
|
* @ignore
|
|
200
182
|
*/
|
|
201
|
-
queueItemExists(queue
|
|
183
|
+
queueItemExists(queue, queueId) {
|
|
202
184
|
return queue.findIndex(data => data.queueId === queueId);
|
|
203
185
|
},
|
|
204
186
|
/**
|
|
@@ -206,10 +188,10 @@ const EventuallyQueue = {
|
|
|
206
188
|
*
|
|
207
189
|
* @function length
|
|
208
190
|
* @name Parse.EventuallyQueue.length
|
|
209
|
-
* @returns {number}
|
|
191
|
+
* @returns {Promise<number>}
|
|
210
192
|
* @static
|
|
211
193
|
*/
|
|
212
|
-
async length()
|
|
194
|
+
async length() {
|
|
213
195
|
const queueData = await this.getQueue();
|
|
214
196
|
return queueData.length;
|
|
215
197
|
},
|
|
@@ -221,7 +203,7 @@ const EventuallyQueue = {
|
|
|
221
203
|
* @returns {Promise<boolean>} Returns true if queue was sent successfully.
|
|
222
204
|
* @static
|
|
223
205
|
*/
|
|
224
|
-
async sendQueue()
|
|
206
|
+
async sendQueue() {
|
|
225
207
|
const queue = await this.getQueue();
|
|
226
208
|
const queueData = [...queue];
|
|
227
209
|
if (queueData.length === 0) {
|
|
@@ -254,7 +236,7 @@ const EventuallyQueue = {
|
|
|
254
236
|
* @static
|
|
255
237
|
* @ignore
|
|
256
238
|
*/
|
|
257
|
-
async sendQueueCallback(object
|
|
239
|
+
async sendQueueCallback(object, queueObject) {
|
|
258
240
|
if (!object) {
|
|
259
241
|
return this.remove(queueObject.queueId);
|
|
260
242
|
}
|
|
@@ -329,10 +311,10 @@ const EventuallyQueue = {
|
|
|
329
311
|
* @returns {boolean}
|
|
330
312
|
* @static
|
|
331
313
|
*/
|
|
332
|
-
isPolling()
|
|
314
|
+
isPolling() {
|
|
333
315
|
return !!polling;
|
|
334
316
|
},
|
|
335
|
-
_setPolling(flag
|
|
317
|
+
_setPolling(flag) {
|
|
336
318
|
polling = flag;
|
|
337
319
|
},
|
|
338
320
|
process: {
|
|
@@ -368,5 +350,4 @@ const EventuallyQueue = {
|
|
|
368
350
|
}
|
|
369
351
|
};
|
|
370
352
|
module.exports = EventuallyQueue;
|
|
371
|
-
var _default = EventuallyQueue;
|
|
372
|
-
exports.default = _default;
|
|
353
|
+
var _default = exports.default = EventuallyQueue;
|
|
@@ -10,9 +10,6 @@ function _interopRequireDefault(obj) {
|
|
|
10
10
|
default: obj
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
/**
|
|
14
|
-
* @flow-weak
|
|
15
|
-
*/
|
|
16
13
|
/* global FB */
|
|
17
14
|
|
|
18
15
|
let initialized = false;
|
|
@@ -226,5 +223,4 @@ const FacebookUtils = {
|
|
|
226
223
|
return provider;
|
|
227
224
|
}
|
|
228
225
|
};
|
|
229
|
-
var _default = FacebookUtils;
|
|
230
|
-
exports.default = _default;
|
|
226
|
+
var _default = exports.default = FacebookUtils;
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
3
7
|
var _idbKeyval = require("idb-keyval");
|
|
4
|
-
/**
|
|
5
|
-
* @flow
|
|
6
|
-
*/
|
|
7
8
|
/* global window */
|
|
8
9
|
|
|
10
|
+
let IndexedDBStorageController;
|
|
9
11
|
if (typeof window !== 'undefined' && window.indexedDB) {
|
|
10
12
|
try {
|
|
11
13
|
const ParseStore = (0, _idbKeyval.createStore)('parseDB', 'parseStore');
|
|
12
|
-
|
|
14
|
+
IndexedDBStorageController = {
|
|
13
15
|
async: 1,
|
|
14
|
-
getItemAsync(path
|
|
16
|
+
getItemAsync(path) {
|
|
15
17
|
return (0, _idbKeyval.get)(path, ParseStore);
|
|
16
18
|
},
|
|
17
|
-
setItemAsync(path
|
|
19
|
+
setItemAsync(path, value) {
|
|
18
20
|
return (0, _idbKeyval.set)(path, value, ParseStore);
|
|
19
21
|
},
|
|
20
|
-
removeItemAsync(path
|
|
22
|
+
removeItemAsync(path) {
|
|
21
23
|
return (0, _idbKeyval.del)(path, ParseStore);
|
|
22
24
|
},
|
|
23
25
|
getAllKeysAsync() {
|
|
@@ -29,9 +31,11 @@ if (typeof window !== 'undefined' && window.indexedDB) {
|
|
|
29
31
|
};
|
|
30
32
|
} catch (_) {
|
|
31
33
|
// IndexedDB not accessible
|
|
32
|
-
|
|
34
|
+
IndexedDBStorageController = undefined;
|
|
33
35
|
}
|
|
34
36
|
} else {
|
|
35
37
|
// IndexedDB not supported
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
+
IndexedDBStorageController = undefined;
|
|
39
|
+
}
|
|
40
|
+
module.exports = IndexedDBStorageController;
|
|
41
|
+
var _default = exports.default = IndexedDBStorageController;
|
|
@@ -15,16 +15,16 @@ function _interopRequireDefault(obj) {
|
|
|
15
15
|
}
|
|
16
16
|
const CURRENT_INSTALLATION_KEY = 'currentInstallation';
|
|
17
17
|
const CURRENT_INSTALLATION_ID_KEY = 'currentInstallationId';
|
|
18
|
-
let iidCache
|
|
19
|
-
let currentInstallationCache
|
|
18
|
+
let iidCache = null;
|
|
19
|
+
let currentInstallationCache = null;
|
|
20
20
|
let currentInstallationCacheMatchesDisk = false;
|
|
21
21
|
const InstallationController = {
|
|
22
|
-
async updateInstallationOnDisk(installation
|
|
22
|
+
async updateInstallationOnDisk(installation) {
|
|
23
23
|
const path = _Storage.default.generatePath(CURRENT_INSTALLATION_KEY);
|
|
24
24
|
await _Storage.default.setItemAsync(path, JSON.stringify(installation.toJSON()));
|
|
25
25
|
this._setCurrentInstallationCache(installation);
|
|
26
26
|
},
|
|
27
|
-
async currentInstallationId()
|
|
27
|
+
async currentInstallationId() {
|
|
28
28
|
if (typeof iidCache === 'string') {
|
|
29
29
|
return iidCache;
|
|
30
30
|
}
|
|
@@ -40,7 +40,7 @@ const InstallationController = {
|
|
|
40
40
|
iidCache = iid;
|
|
41
41
|
return iid;
|
|
42
42
|
},
|
|
43
|
-
async currentInstallation()
|
|
43
|
+
async currentInstallation() {
|
|
44
44
|
if (currentInstallationCache) {
|
|
45
45
|
return currentInstallationCache;
|
|
46
46
|
}
|
|
@@ -48,7 +48,7 @@ const InstallationController = {
|
|
|
48
48
|
return null;
|
|
49
49
|
}
|
|
50
50
|
const path = _Storage.default.generatePath(CURRENT_INSTALLATION_KEY);
|
|
51
|
-
let installationData
|
|
51
|
+
let installationData = await _Storage.default.getItemAsync(path);
|
|
52
52
|
currentInstallationCacheMatchesDisk = true;
|
|
53
53
|
if (installationData) {
|
|
54
54
|
installationData = JSON.parse(installationData);
|
|
@@ -71,14 +71,13 @@ const InstallationController = {
|
|
|
71
71
|
currentInstallationCache = null;
|
|
72
72
|
currentInstallationCacheMatchesDisk = false;
|
|
73
73
|
},
|
|
74
|
-
_setInstallationIdCache(iid
|
|
74
|
+
_setInstallationIdCache(iid) {
|
|
75
75
|
iidCache = iid;
|
|
76
76
|
},
|
|
77
|
-
_setCurrentInstallationCache(installation
|
|
77
|
+
_setCurrentInstallationCache(installation, matchesDisk = true) {
|
|
78
78
|
currentInstallationCache = installation;
|
|
79
79
|
currentInstallationCacheMatchesDisk = matchesDisk;
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
module.exports = InstallationController;
|
|
83
|
-
var _default = InstallationController;
|
|
84
|
-
exports.default = _default;
|
|
83
|
+
var _default = exports.default = InstallationController;
|