parse 3.5.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 +20 -7
- 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 +18 -134
- 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 +73 -302
- package/lib/node/ParseConfig.js +16 -91
- package/lib/node/ParseError.js +61 -74
- package/lib/node/ParseFile.js +55 -244
- 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 +234 -997
- 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 +19 -169
- 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 +37 -30
- package/PATENTS +0 -37
package/lib/node/ParseConfig.js
CHANGED
|
@@ -4,32 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
9
|
-
|
|
10
8
|
var _decode = _interopRequireDefault(require("./decode"));
|
|
11
|
-
|
|
12
9
|
var _encode = _interopRequireDefault(require("./encode"));
|
|
13
|
-
|
|
14
10
|
var _escape = _interopRequireDefault(require("./escape"));
|
|
15
|
-
|
|
16
11
|
var _ParseError = _interopRequireDefault(require("./ParseError"));
|
|
17
|
-
|
|
18
12
|
var _Storage = _interopRequireDefault(require("./Storage"));
|
|
19
|
-
|
|
20
13
|
function _interopRequireDefault(obj) {
|
|
21
14
|
return obj && obj.__esModule ? obj : {
|
|
22
15
|
default: obj
|
|
23
16
|
};
|
|
24
17
|
}
|
|
25
18
|
/**
|
|
26
|
-
* Copyright (c) 2015-present, Parse, LLC.
|
|
27
|
-
* All rights reserved.
|
|
28
|
-
*
|
|
29
|
-
* This source code is licensed under the BSD-style license found in the
|
|
30
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
31
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
32
|
-
*
|
|
33
19
|
* @flow
|
|
34
20
|
*/
|
|
35
21
|
|
|
@@ -40,59 +26,44 @@ function _interopRequireDefault(obj) {
|
|
|
40
26
|
* @alias Parse.Config
|
|
41
27
|
*/
|
|
42
28
|
|
|
43
|
-
|
|
44
29
|
class ParseConfig {
|
|
45
30
|
/*:: attributes: { [key: string]: any };*/
|
|
46
|
-
|
|
47
31
|
/*:: _escapedAttributes: { [key: string]: any };*/
|
|
48
32
|
constructor() {
|
|
49
33
|
this.attributes = {};
|
|
50
34
|
this._escapedAttributes = {};
|
|
51
35
|
}
|
|
36
|
+
|
|
52
37
|
/**
|
|
53
38
|
* Gets the value of an attribute.
|
|
54
39
|
*
|
|
55
40
|
* @param {string} attr The name of an attribute.
|
|
56
41
|
* @returns {*}
|
|
57
42
|
*/
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
get(attr
|
|
61
|
-
/*: string*/
|
|
62
|
-
)
|
|
63
|
-
/*: any*/
|
|
64
|
-
{
|
|
43
|
+
get(attr /*: string*/) /*: any*/{
|
|
65
44
|
return this.attributes[attr];
|
|
66
45
|
}
|
|
46
|
+
|
|
67
47
|
/**
|
|
68
48
|
* Gets the HTML-escaped value of an attribute.
|
|
69
49
|
*
|
|
70
50
|
* @param {string} attr The name of an attribute.
|
|
71
51
|
* @returns {string}
|
|
72
52
|
*/
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
escape(attr
|
|
76
|
-
/*: string*/
|
|
77
|
-
)
|
|
78
|
-
/*: string*/
|
|
79
|
-
{
|
|
53
|
+
escape(attr /*: string*/) /*: string*/{
|
|
80
54
|
const html = this._escapedAttributes[attr];
|
|
81
|
-
|
|
82
55
|
if (html) {
|
|
83
56
|
return html;
|
|
84
57
|
}
|
|
85
|
-
|
|
86
58
|
const val = this.attributes[attr];
|
|
87
59
|
let escaped = '';
|
|
88
|
-
|
|
89
60
|
if (val != null) {
|
|
90
61
|
escaped = (0, _escape.default)(val.toString());
|
|
91
62
|
}
|
|
92
|
-
|
|
93
63
|
this._escapedAttributes[attr] = escaped;
|
|
94
64
|
return escaped;
|
|
95
65
|
}
|
|
66
|
+
|
|
96
67
|
/**
|
|
97
68
|
* Retrieves the most recently-fetched configuration object, either from
|
|
98
69
|
* memory or from local storage if necessary.
|
|
@@ -101,13 +72,11 @@ class ParseConfig {
|
|
|
101
72
|
* @returns {Parse.Config} The most recently-fetched Parse.Config if it
|
|
102
73
|
* exists, else an empty Parse.Config.
|
|
103
74
|
*/
|
|
104
|
-
|
|
105
|
-
|
|
106
75
|
static current() {
|
|
107
76
|
const controller = _CoreManager.default.getConfigController();
|
|
108
|
-
|
|
109
77
|
return controller.current();
|
|
110
78
|
}
|
|
79
|
+
|
|
111
80
|
/**
|
|
112
81
|
* Gets a new configuration object from the server.
|
|
113
82
|
*
|
|
@@ -120,15 +89,11 @@ class ParseConfig {
|
|
|
120
89
|
* @returns {Promise} A promise that is resolved with a newly-created
|
|
121
90
|
* configuration object when the get completes.
|
|
122
91
|
*/
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
static get(options
|
|
126
|
-
/*: RequestOptions*/
|
|
127
|
-
= {}) {
|
|
92
|
+
static get(options /*: RequestOptions*/ = {}) {
|
|
128
93
|
const controller = _CoreManager.default.getConfigController();
|
|
129
|
-
|
|
130
94
|
return controller.get(options);
|
|
131
95
|
}
|
|
96
|
+
|
|
132
97
|
/**
|
|
133
98
|
* Save value keys to the server.
|
|
134
99
|
*
|
|
@@ -142,16 +107,9 @@ class ParseConfig {
|
|
|
142
107
|
* @returns {Promise} A promise that is resolved with a newly-created
|
|
143
108
|
* configuration object or with the current with the update.
|
|
144
109
|
*/
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
/*: { [key: string]: any }*/
|
|
149
|
-
, masterKeyOnlyFlags
|
|
150
|
-
/*: { [key: string]: any }*/
|
|
151
|
-
) {
|
|
152
|
-
const controller = _CoreManager.default.getConfigController(); //To avoid a mismatch with the local and the cloud config we get a new version
|
|
153
|
-
|
|
154
|
-
|
|
110
|
+
static save(attrs /*: { [key: string]: any }*/, masterKeyOnlyFlags /*: { [key: string]: any }*/) {
|
|
111
|
+
const controller = _CoreManager.default.getConfigController();
|
|
112
|
+
//To avoid a mismatch with the local and the cloud config we get a new version
|
|
155
113
|
return controller.save(attrs, masterKeyOnlyFlags).then(() => {
|
|
156
114
|
return controller.get({
|
|
157
115
|
useMasterKey: true
|
|
@@ -160,26 +118,21 @@ class ParseConfig {
|
|
|
160
118
|
return Promise.reject(error);
|
|
161
119
|
});
|
|
162
120
|
}
|
|
121
|
+
|
|
163
122
|
/**
|
|
164
123
|
* Used for testing
|
|
165
124
|
*
|
|
166
125
|
* @private
|
|
167
126
|
*/
|
|
168
|
-
|
|
169
|
-
|
|
170
127
|
static _clearCache() {
|
|
171
128
|
currentConfig = null;
|
|
172
129
|
}
|
|
173
|
-
|
|
174
130
|
}
|
|
175
|
-
|
|
176
131
|
let currentConfig = null;
|
|
177
132
|
const CURRENT_CONFIG_KEY = 'currentConfig';
|
|
178
|
-
|
|
179
133
|
function decodePayload(data) {
|
|
180
134
|
try {
|
|
181
135
|
const json = JSON.parse(data);
|
|
182
|
-
|
|
183
136
|
if (json && typeof json === 'object') {
|
|
184
137
|
return (0, _decode.default)(json);
|
|
185
138
|
}
|
|
@@ -187,85 +140,60 @@ function decodePayload(data) {
|
|
|
187
140
|
return null;
|
|
188
141
|
}
|
|
189
142
|
}
|
|
190
|
-
|
|
191
143
|
const DefaultController = {
|
|
192
144
|
current() {
|
|
193
145
|
if (currentConfig) {
|
|
194
146
|
return currentConfig;
|
|
195
147
|
}
|
|
196
|
-
|
|
197
148
|
const config = new ParseConfig();
|
|
198
|
-
|
|
199
149
|
const storagePath = _Storage.default.generatePath(CURRENT_CONFIG_KEY);
|
|
200
|
-
|
|
201
150
|
if (!_Storage.default.async()) {
|
|
202
151
|
const configData = _Storage.default.getItem(storagePath);
|
|
203
|
-
|
|
204
152
|
if (configData) {
|
|
205
153
|
const attributes = decodePayload(configData);
|
|
206
|
-
|
|
207
154
|
if (attributes) {
|
|
208
155
|
config.attributes = attributes;
|
|
209
156
|
currentConfig = config;
|
|
210
157
|
}
|
|
211
158
|
}
|
|
212
|
-
|
|
213
159
|
return config;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
|
|
160
|
+
}
|
|
161
|
+
// Return a promise for async storage controllers
|
|
217
162
|
return _Storage.default.getItemAsync(storagePath).then(configData => {
|
|
218
163
|
if (configData) {
|
|
219
164
|
const attributes = decodePayload(configData);
|
|
220
|
-
|
|
221
165
|
if (attributes) {
|
|
222
166
|
config.attributes = attributes;
|
|
223
167
|
currentConfig = config;
|
|
224
168
|
}
|
|
225
169
|
}
|
|
226
|
-
|
|
227
170
|
return config;
|
|
228
171
|
});
|
|
229
172
|
},
|
|
230
|
-
|
|
231
|
-
get(options
|
|
232
|
-
/*: RequestOptions*/
|
|
233
|
-
= {}) {
|
|
173
|
+
get(options /*: RequestOptions*/ = {}) {
|
|
234
174
|
const RESTController = _CoreManager.default.getRESTController();
|
|
235
|
-
|
|
236
175
|
return RESTController.request('GET', 'config', {}, options).then(response => {
|
|
237
176
|
if (!response || !response.params) {
|
|
238
177
|
const error = new _ParseError.default(_ParseError.default.INVALID_JSON, 'Config JSON response invalid.');
|
|
239
178
|
return Promise.reject(error);
|
|
240
179
|
}
|
|
241
|
-
|
|
242
180
|
const config = new ParseConfig();
|
|
243
181
|
config.attributes = {};
|
|
244
|
-
|
|
245
182
|
for (const attr in response.params) {
|
|
246
183
|
config.attributes[attr] = (0, _decode.default)(response.params[attr]);
|
|
247
184
|
}
|
|
248
|
-
|
|
249
185
|
currentConfig = config;
|
|
250
186
|
return _Storage.default.setItemAsync(_Storage.default.generatePath(CURRENT_CONFIG_KEY), JSON.stringify(response.params)).then(() => {
|
|
251
187
|
return config;
|
|
252
188
|
});
|
|
253
189
|
});
|
|
254
190
|
},
|
|
255
|
-
|
|
256
|
-
save(attrs
|
|
257
|
-
/*: { [key: string]: any }*/
|
|
258
|
-
, masterKeyOnlyFlags
|
|
259
|
-
/*: { [key: string]: any }*/
|
|
260
|
-
) {
|
|
191
|
+
save(attrs /*: { [key: string]: any }*/, masterKeyOnlyFlags /*: { [key: string]: any }*/) {
|
|
261
192
|
const RESTController = _CoreManager.default.getRESTController();
|
|
262
|
-
|
|
263
193
|
const encodedAttrs = {};
|
|
264
|
-
|
|
265
194
|
for (const key in attrs) {
|
|
266
195
|
encodedAttrs[key] = (0, _encode.default)(attrs[key]);
|
|
267
196
|
}
|
|
268
|
-
|
|
269
197
|
return RESTController.request('PUT', 'config', {
|
|
270
198
|
params: encodedAttrs,
|
|
271
199
|
masterKeyOnly: masterKeyOnlyFlags
|
|
@@ -280,10 +208,7 @@ const DefaultController = {
|
|
|
280
208
|
}
|
|
281
209
|
});
|
|
282
210
|
}
|
|
283
|
-
|
|
284
211
|
};
|
|
285
|
-
|
|
286
212
|
_CoreManager.default.setConfigController(DefaultController);
|
|
287
|
-
|
|
288
213
|
var _default = ParseConfig;
|
|
289
214
|
exports.default = _default;
|