parse 4.0.1 → 4.1.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 +17995 -26193
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +8739 -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 +129 -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 +50 -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 +4 -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 +130 -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 +45 -43
|
@@ -1,52 +1,36 @@
|
|
|
1
1
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
3
|
value: true
|
|
5
4
|
});
|
|
6
5
|
exports.default = void 0;
|
|
7
|
-
|
|
8
6
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
-
|
|
10
7
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
-
|
|
12
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
-
|
|
14
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
-
|
|
16
10
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
17
|
-
|
|
18
11
|
var ParseError = require('./ParseError').default;
|
|
19
|
-
|
|
20
12
|
var XHR = null;
|
|
21
|
-
|
|
22
13
|
if (typeof XMLHttpRequest !== 'undefined') {
|
|
23
14
|
XHR = XMLHttpRequest;
|
|
24
15
|
}
|
|
25
|
-
|
|
26
16
|
function b64Digit(number) {
|
|
27
17
|
if (number < 26) {
|
|
28
18
|
return String.fromCharCode(65 + number);
|
|
29
19
|
}
|
|
30
|
-
|
|
31
20
|
if (number < 52) {
|
|
32
21
|
return String.fromCharCode(97 + (number - 26));
|
|
33
22
|
}
|
|
34
|
-
|
|
35
23
|
if (number < 62) {
|
|
36
24
|
return String.fromCharCode(48 + (number - 52));
|
|
37
25
|
}
|
|
38
|
-
|
|
39
26
|
if (number === 62) {
|
|
40
27
|
return '+';
|
|
41
28
|
}
|
|
42
|
-
|
|
43
29
|
if (number === 63) {
|
|
44
30
|
return '/';
|
|
45
31
|
}
|
|
46
|
-
|
|
47
32
|
throw new TypeError('Tried to encode large digit ' + number + ' in base64.');
|
|
48
33
|
}
|
|
49
|
-
|
|
50
34
|
var ParseFile = function () {
|
|
51
35
|
function ParseFile(name, data, type, metadata, tags) {
|
|
52
36
|
(0, _classCallCheck2.default)(this, ParseFile);
|
|
@@ -54,7 +38,6 @@ var ParseFile = function () {
|
|
|
54
38
|
this._name = name;
|
|
55
39
|
this._metadata = metadata || {};
|
|
56
40
|
this._tags = tags || {};
|
|
57
|
-
|
|
58
41
|
if (data !== undefined) {
|
|
59
42
|
if (Array.isArray(data)) {
|
|
60
43
|
this._data = ParseFile.encodeBase64(data);
|
|
@@ -89,23 +72,18 @@ var ParseFile = function () {
|
|
|
89
72
|
}
|
|
90
73
|
}
|
|
91
74
|
}
|
|
92
|
-
|
|
93
75
|
(0, _createClass2.default)(ParseFile, [{
|
|
94
76
|
key: "getData",
|
|
95
77
|
value: function () {
|
|
96
78
|
var _getData = (0, _asyncToGenerator2.default)(function* () {
|
|
97
79
|
var _this = this;
|
|
98
|
-
|
|
99
80
|
if (this._data) {
|
|
100
81
|
return this._data;
|
|
101
82
|
}
|
|
102
|
-
|
|
103
83
|
if (!this._url) {
|
|
104
84
|
throw new Error('Cannot retrieve data for unsaved ParseFile.');
|
|
105
85
|
}
|
|
106
|
-
|
|
107
86
|
var controller = _CoreManager.default.getFileController();
|
|
108
|
-
|
|
109
87
|
var result = yield controller.download(this._url, {
|
|
110
88
|
requestTask: function (task) {
|
|
111
89
|
return _this._requestTask = task;
|
|
@@ -114,11 +92,9 @@ var ParseFile = function () {
|
|
|
114
92
|
this._data = result.base64;
|
|
115
93
|
return this._data;
|
|
116
94
|
});
|
|
117
|
-
|
|
118
95
|
function getData() {
|
|
119
96
|
return _getData.apply(this, arguments);
|
|
120
97
|
}
|
|
121
|
-
|
|
122
98
|
return getData;
|
|
123
99
|
}()
|
|
124
100
|
}, {
|
|
@@ -130,11 +106,9 @@ var ParseFile = function () {
|
|
|
130
106
|
key: "url",
|
|
131
107
|
value: function (options) {
|
|
132
108
|
options = options || {};
|
|
133
|
-
|
|
134
109
|
if (!this._url) {
|
|
135
110
|
return;
|
|
136
111
|
}
|
|
137
|
-
|
|
138
112
|
if (options.forceSecure) {
|
|
139
113
|
return this._url.replace(/^http:\/\//i, 'https://');
|
|
140
114
|
} else {
|
|
@@ -155,18 +129,13 @@ var ParseFile = function () {
|
|
|
155
129
|
key: "save",
|
|
156
130
|
value: function (options) {
|
|
157
131
|
var _this2 = this;
|
|
158
|
-
|
|
159
132
|
options = options || {};
|
|
160
|
-
|
|
161
133
|
options.requestTask = function (task) {
|
|
162
134
|
return _this2._requestTask = task;
|
|
163
135
|
};
|
|
164
|
-
|
|
165
136
|
options.metadata = this._metadata;
|
|
166
137
|
options.tags = this._tags;
|
|
167
|
-
|
|
168
138
|
var controller = _CoreManager.default.getFileController();
|
|
169
|
-
|
|
170
139
|
if (!this._previousSave) {
|
|
171
140
|
if (this._source.format === 'file') {
|
|
172
141
|
this._previousSave = controller.saveFile(this._name, this._source, options).then(function (res) {
|
|
@@ -181,7 +150,6 @@ var ParseFile = function () {
|
|
|
181
150
|
if (!(result && result.base64)) {
|
|
182
151
|
return {};
|
|
183
152
|
}
|
|
184
|
-
|
|
185
153
|
var newSource = {
|
|
186
154
|
format: 'base64',
|
|
187
155
|
base64: result.base64,
|
|
@@ -205,7 +173,6 @@ var ParseFile = function () {
|
|
|
205
173
|
});
|
|
206
174
|
}
|
|
207
175
|
}
|
|
208
|
-
|
|
209
176
|
if (this._previousSave) {
|
|
210
177
|
return this._previousSave;
|
|
211
178
|
}
|
|
@@ -214,32 +181,26 @@ var ParseFile = function () {
|
|
|
214
181
|
key: "cancel",
|
|
215
182
|
value: function () {
|
|
216
183
|
if (this._requestTask && typeof this._requestTask.abort === 'function') {
|
|
184
|
+
this._requestTask._aborted = true;
|
|
217
185
|
this._requestTask.abort();
|
|
218
186
|
}
|
|
219
|
-
|
|
220
187
|
this._requestTask = null;
|
|
221
188
|
}
|
|
222
189
|
}, {
|
|
223
190
|
key: "destroy",
|
|
224
191
|
value: function () {
|
|
225
192
|
var _this3 = this;
|
|
226
|
-
|
|
227
193
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
228
|
-
|
|
229
194
|
if (!this._name) {
|
|
230
195
|
throw new ParseError(ParseError.FILE_DELETE_UNNAMED_ERROR, 'Cannot delete an unnamed file.');
|
|
231
196
|
}
|
|
232
|
-
|
|
233
197
|
var destroyOptions = {
|
|
234
198
|
useMasterKey: true
|
|
235
199
|
};
|
|
236
|
-
|
|
237
200
|
if (options.hasOwnProperty('useMasterKey')) {
|
|
238
201
|
destroyOptions.useMasterKey = options.useMasterKey;
|
|
239
202
|
}
|
|
240
|
-
|
|
241
203
|
var controller = _CoreManager.default.getFileController();
|
|
242
|
-
|
|
243
204
|
return controller.deleteFile(this._name, destroyOptions).then(function () {
|
|
244
205
|
_this3._data = null;
|
|
245
206
|
_this3._requestTask = null;
|
|
@@ -261,14 +222,12 @@ var ParseFile = function () {
|
|
|
261
222
|
if (this === other) {
|
|
262
223
|
return true;
|
|
263
224
|
}
|
|
264
|
-
|
|
265
225
|
return other instanceof ParseFile && this.name() === other.name() && this.url() === other.url() && typeof this.url() !== 'undefined';
|
|
266
226
|
}
|
|
267
227
|
}, {
|
|
268
228
|
key: "setMetadata",
|
|
269
229
|
value: function (metadata) {
|
|
270
230
|
var _this4 = this;
|
|
271
|
-
|
|
272
231
|
if (metadata && typeof metadata === 'object') {
|
|
273
232
|
Object.keys(metadata).forEach(function (key) {
|
|
274
233
|
_this4.addMetadata(key, metadata[key]);
|
|
@@ -286,7 +245,6 @@ var ParseFile = function () {
|
|
|
286
245
|
key: "setTags",
|
|
287
246
|
value: function (tags) {
|
|
288
247
|
var _this5 = this;
|
|
289
|
-
|
|
290
248
|
if (tags && typeof tags === 'object') {
|
|
291
249
|
Object.keys(tags).forEach(function (key) {
|
|
292
250
|
_this5.addTag(key, tags[key]);
|
|
@@ -306,7 +264,6 @@ var ParseFile = function () {
|
|
|
306
264
|
if (obj.__type !== 'File') {
|
|
307
265
|
throw new TypeError('JSON object does not represent a ParseFile');
|
|
308
266
|
}
|
|
309
|
-
|
|
310
267
|
var file = new ParseFile(obj.name);
|
|
311
268
|
file._url = obj.url;
|
|
312
269
|
return file;
|
|
@@ -316,7 +273,6 @@ var ParseFile = function () {
|
|
|
316
273
|
value: function (bytes) {
|
|
317
274
|
var chunks = [];
|
|
318
275
|
chunks.length = Math.ceil(bytes.length / 3);
|
|
319
|
-
|
|
320
276
|
for (var i = 0; i < chunks.length; i++) {
|
|
321
277
|
var b1 = bytes[i * 3];
|
|
322
278
|
var b2 = bytes[i * 3 + 1] || 0;
|
|
@@ -325,39 +281,31 @@ var ParseFile = function () {
|
|
|
325
281
|
var has3 = i * 3 + 2 < bytes.length;
|
|
326
282
|
chunks[i] = [b64Digit(b1 >> 2 & 0x3f), b64Digit(b1 << 4 & 0x30 | b2 >> 4 & 0x0f), has2 ? b64Digit(b2 << 2 & 0x3c | b3 >> 6 & 0x03) : '=', has3 ? b64Digit(b3 & 0x3f) : '='].join('');
|
|
327
283
|
}
|
|
328
|
-
|
|
329
284
|
return chunks.join('');
|
|
330
285
|
}
|
|
331
286
|
}]);
|
|
332
287
|
return ParseFile;
|
|
333
288
|
}();
|
|
334
|
-
|
|
335
289
|
var DefaultController = {
|
|
336
290
|
saveFile: function () {
|
|
337
291
|
var _saveFile = (0, _asyncToGenerator2.default)(function* (name, source, options) {
|
|
338
292
|
if (source.format !== 'file') {
|
|
339
293
|
throw new Error('saveFile can only be used with File-type sources.');
|
|
340
294
|
}
|
|
341
|
-
|
|
342
295
|
var base64Data = yield new Promise(function (res, rej) {
|
|
343
296
|
var reader = new FileReader();
|
|
344
|
-
|
|
345
297
|
reader.onload = function () {
|
|
346
298
|
return res(reader.result);
|
|
347
299
|
};
|
|
348
|
-
|
|
349
300
|
reader.onerror = function (error) {
|
|
350
301
|
return rej(error);
|
|
351
302
|
};
|
|
352
|
-
|
|
353
303
|
reader.readAsDataURL(source.file);
|
|
354
304
|
});
|
|
355
|
-
|
|
356
305
|
var _base64Data$split = base64Data.split(','),
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
306
|
+
_base64Data$split2 = (0, _slicedToArray2.default)(_base64Data$split, 2),
|
|
307
|
+
first = _base64Data$split2[0],
|
|
308
|
+
second = _base64Data$split2[1];
|
|
361
309
|
var data = second ? second : first;
|
|
362
310
|
var newSource = {
|
|
363
311
|
format: 'base64',
|
|
@@ -366,18 +314,15 @@ var DefaultController = {
|
|
|
366
314
|
};
|
|
367
315
|
return yield DefaultController.saveBase64(name, newSource, options);
|
|
368
316
|
});
|
|
369
|
-
|
|
370
317
|
function saveFile() {
|
|
371
318
|
return _saveFile.apply(this, arguments);
|
|
372
319
|
}
|
|
373
|
-
|
|
374
320
|
return saveFile;
|
|
375
321
|
}(),
|
|
376
322
|
saveBase64: function (name, source, options) {
|
|
377
323
|
if (source.format !== 'base64') {
|
|
378
324
|
throw new Error('saveBase64 can only be used with Base64-type sources.');
|
|
379
325
|
}
|
|
380
|
-
|
|
381
326
|
var data = {
|
|
382
327
|
base64: source.base64,
|
|
383
328
|
fileData: {
|
|
@@ -387,11 +332,9 @@ var DefaultController = {
|
|
|
387
332
|
};
|
|
388
333
|
delete options.metadata;
|
|
389
334
|
delete options.tags;
|
|
390
|
-
|
|
391
335
|
if (source.type) {
|
|
392
336
|
data._ContentType = source.type;
|
|
393
337
|
}
|
|
394
|
-
|
|
395
338
|
return _CoreManager.default.getRESTController().request('POST', 'files/' + name, data, options);
|
|
396
339
|
},
|
|
397
340
|
download: function (uri, options) {
|
|
@@ -406,27 +349,22 @@ var DefaultController = {
|
|
|
406
349
|
var xhr = new XHR();
|
|
407
350
|
xhr.open('GET', uri, true);
|
|
408
351
|
xhr.responseType = 'arraybuffer';
|
|
409
|
-
|
|
410
352
|
xhr.onerror = function (e) {
|
|
411
353
|
reject(e);
|
|
412
354
|
};
|
|
413
|
-
|
|
414
355
|
xhr.onreadystatechange = function () {
|
|
415
356
|
if (xhr.readyState !== xhr.DONE) {
|
|
416
357
|
return;
|
|
417
358
|
}
|
|
418
|
-
|
|
419
359
|
if (!this.response) {
|
|
420
360
|
return resolve({});
|
|
421
361
|
}
|
|
422
|
-
|
|
423
362
|
var bytes = new Uint8Array(this.response);
|
|
424
363
|
resolve({
|
|
425
364
|
base64: ParseFile.encodeBase64(bytes),
|
|
426
365
|
contentType: xhr.getResponseHeader('content-type')
|
|
427
366
|
});
|
|
428
367
|
};
|
|
429
|
-
|
|
430
368
|
options.requestTask(xhr);
|
|
431
369
|
xhr.send();
|
|
432
370
|
});
|
|
@@ -435,17 +373,13 @@ var DefaultController = {
|
|
|
435
373
|
var headers = {
|
|
436
374
|
'X-Parse-Application-ID': _CoreManager.default.get('APPLICATION_ID')
|
|
437
375
|
};
|
|
438
|
-
|
|
439
376
|
if (options.useMasterKey) {
|
|
440
377
|
headers['X-Parse-Master-Key'] = _CoreManager.default.get('MASTER_KEY');
|
|
441
378
|
}
|
|
442
|
-
|
|
443
379
|
var url = _CoreManager.default.get('SERVER_URL');
|
|
444
|
-
|
|
445
380
|
if (url[url.length - 1] !== '/') {
|
|
446
381
|
url += '/';
|
|
447
382
|
}
|
|
448
|
-
|
|
449
383
|
url += 'files/' + name;
|
|
450
384
|
return _CoreManager.default.getRESTController().ajax('DELETE', url, '', headers).catch(function (response) {
|
|
451
385
|
if (!response || response === 'SyntaxError: Unexpected end of JSON input') {
|
|
@@ -462,9 +396,7 @@ var DefaultController = {
|
|
|
462
396
|
return XHR;
|
|
463
397
|
}
|
|
464
398
|
};
|
|
465
|
-
|
|
466
399
|
_CoreManager.default.setFileController(DefaultController);
|
|
467
|
-
|
|
468
400
|
var _default = ParseFile;
|
|
469
401
|
exports.default = _default;
|
|
470
402
|
exports.b64Digit = b64Digit;
|
|
@@ -1,31 +1,23 @@
|
|
|
1
1
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
3
|
value: true
|
|
5
4
|
});
|
|
6
5
|
exports.default = void 0;
|
|
7
|
-
|
|
8
6
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
|
|
10
7
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
-
|
|
12
8
|
var ParseGeoPoint = function () {
|
|
13
9
|
function ParseGeoPoint(arg1, arg2) {
|
|
14
10
|
(0, _classCallCheck2.default)(this, ParseGeoPoint);
|
|
15
|
-
|
|
16
11
|
if (Array.isArray(arg1)) {
|
|
17
12
|
ParseGeoPoint._validate(arg1[0], arg1[1]);
|
|
18
|
-
|
|
19
13
|
this._latitude = arg1[0];
|
|
20
14
|
this._longitude = arg1[1];
|
|
21
15
|
} else if (typeof arg1 === 'object') {
|
|
22
16
|
ParseGeoPoint._validate(arg1.latitude, arg1.longitude);
|
|
23
|
-
|
|
24
17
|
this._latitude = arg1.latitude;
|
|
25
18
|
this._longitude = arg1.longitude;
|
|
26
19
|
} else if (arg1 !== undefined && arg2 !== undefined) {
|
|
27
20
|
ParseGeoPoint._validate(arg1, arg2);
|
|
28
|
-
|
|
29
21
|
this._latitude = arg1;
|
|
30
22
|
this._longitude = arg2;
|
|
31
23
|
} else {
|
|
@@ -33,7 +25,6 @@ var ParseGeoPoint = function () {
|
|
|
33
25
|
this._longitude = 0;
|
|
34
26
|
}
|
|
35
27
|
}
|
|
36
|
-
|
|
37
28
|
(0, _createClass2.default)(ParseGeoPoint, [{
|
|
38
29
|
key: "latitude",
|
|
39
30
|
get: function () {
|
|
@@ -41,7 +32,6 @@ var ParseGeoPoint = function () {
|
|
|
41
32
|
},
|
|
42
33
|
set: function (val) {
|
|
43
34
|
ParseGeoPoint._validate(val, this.longitude);
|
|
44
|
-
|
|
45
35
|
this._latitude = val;
|
|
46
36
|
}
|
|
47
37
|
}, {
|
|
@@ -51,14 +41,12 @@ var ParseGeoPoint = function () {
|
|
|
51
41
|
},
|
|
52
42
|
set: function (val) {
|
|
53
43
|
ParseGeoPoint._validate(this.latitude, val);
|
|
54
|
-
|
|
55
44
|
this._longitude = val;
|
|
56
45
|
}
|
|
57
46
|
}, {
|
|
58
47
|
key: "toJSON",
|
|
59
48
|
value: function () {
|
|
60
49
|
ParseGeoPoint._validate(this._latitude, this._longitude);
|
|
61
|
-
|
|
62
50
|
return {
|
|
63
51
|
__type: 'GeoPoint',
|
|
64
52
|
latitude: this._latitude,
|
|
@@ -100,19 +88,15 @@ var ParseGeoPoint = function () {
|
|
|
100
88
|
if (isNaN(latitude) || isNaN(longitude) || typeof latitude !== 'number' || typeof longitude !== 'number') {
|
|
101
89
|
throw new TypeError('GeoPoint latitude and longitude must be valid numbers');
|
|
102
90
|
}
|
|
103
|
-
|
|
104
91
|
if (latitude < -90.0) {
|
|
105
92
|
throw new TypeError('GeoPoint latitude out of bounds: ' + latitude + ' < -90.0.');
|
|
106
93
|
}
|
|
107
|
-
|
|
108
94
|
if (latitude > 90.0) {
|
|
109
95
|
throw new TypeError('GeoPoint latitude out of bounds: ' + latitude + ' > 90.0.');
|
|
110
96
|
}
|
|
111
|
-
|
|
112
97
|
if (longitude < -180.0) {
|
|
113
98
|
throw new TypeError('GeoPoint longitude out of bounds: ' + longitude + ' < -180.0.');
|
|
114
99
|
}
|
|
115
|
-
|
|
116
100
|
if (longitude > 180.0) {
|
|
117
101
|
throw new TypeError('GeoPoint longitude out of bounds: ' + longitude + ' > 180.0.');
|
|
118
102
|
}
|
|
@@ -127,6 +111,5 @@ var ParseGeoPoint = function () {
|
|
|
127
111
|
}]);
|
|
128
112
|
return ParseGeoPoint;
|
|
129
113
|
}();
|
|
130
|
-
|
|
131
114
|
var _default = ParseGeoPoint;
|
|
132
115
|
exports.default = _default;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
3
|
value: true
|
|
5
4
|
});
|
|
@@ -16,36 +15,27 @@ exports.removeTrigger = removeTrigger;
|
|
|
16
15
|
exports.update = update;
|
|
17
16
|
exports.updateFunction = updateFunction;
|
|
18
17
|
exports.updateTrigger = updateTrigger;
|
|
19
|
-
|
|
20
18
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
21
|
-
|
|
22
19
|
var _decode = _interopRequireDefault(require("./decode"));
|
|
23
|
-
|
|
24
20
|
var _ParseError = _interopRequireDefault(require("./ParseError"));
|
|
25
|
-
|
|
26
21
|
function getFunctions() {
|
|
27
22
|
return _CoreManager.default.getHooksController().get('functions');
|
|
28
23
|
}
|
|
29
|
-
|
|
30
24
|
function getTriggers() {
|
|
31
25
|
return _CoreManager.default.getHooksController().get('triggers');
|
|
32
26
|
}
|
|
33
|
-
|
|
34
27
|
function getFunction(name) {
|
|
35
28
|
return _CoreManager.default.getHooksController().get('functions', name);
|
|
36
29
|
}
|
|
37
|
-
|
|
38
30
|
function getTrigger(className, triggerName) {
|
|
39
31
|
return _CoreManager.default.getHooksController().get('triggers', className, triggerName);
|
|
40
32
|
}
|
|
41
|
-
|
|
42
33
|
function createFunction(functionName, url) {
|
|
43
34
|
return create({
|
|
44
35
|
functionName: functionName,
|
|
45
36
|
url: url
|
|
46
37
|
});
|
|
47
38
|
}
|
|
48
|
-
|
|
49
39
|
function createTrigger(className, triggerName, url) {
|
|
50
40
|
return create({
|
|
51
41
|
className: className,
|
|
@@ -53,18 +43,15 @@ function createTrigger(className, triggerName, url) {
|
|
|
53
43
|
url: url
|
|
54
44
|
});
|
|
55
45
|
}
|
|
56
|
-
|
|
57
46
|
function create(hook) {
|
|
58
47
|
return _CoreManager.default.getHooksController().create(hook);
|
|
59
48
|
}
|
|
60
|
-
|
|
61
49
|
function updateFunction(functionName, url) {
|
|
62
50
|
return update({
|
|
63
51
|
functionName: functionName,
|
|
64
52
|
url: url
|
|
65
53
|
});
|
|
66
54
|
}
|
|
67
|
-
|
|
68
55
|
function updateTrigger(className, triggerName, url) {
|
|
69
56
|
return update({
|
|
70
57
|
className: className,
|
|
@@ -72,45 +59,36 @@ function updateTrigger(className, triggerName, url) {
|
|
|
72
59
|
url: url
|
|
73
60
|
});
|
|
74
61
|
}
|
|
75
|
-
|
|
76
62
|
function update(hook) {
|
|
77
63
|
return _CoreManager.default.getHooksController().update(hook);
|
|
78
64
|
}
|
|
79
|
-
|
|
80
65
|
function removeFunction(functionName) {
|
|
81
66
|
return remove({
|
|
82
67
|
functionName: functionName
|
|
83
68
|
});
|
|
84
69
|
}
|
|
85
|
-
|
|
86
70
|
function removeTrigger(className, triggerName) {
|
|
87
71
|
return remove({
|
|
88
72
|
className: className,
|
|
89
73
|
triggerName: triggerName
|
|
90
74
|
});
|
|
91
75
|
}
|
|
92
|
-
|
|
93
76
|
function remove(hook) {
|
|
94
77
|
return _CoreManager.default.getHooksController().remove(hook);
|
|
95
78
|
}
|
|
96
|
-
|
|
97
79
|
var DefaultController = {
|
|
98
80
|
get: function (type, functionName, triggerName) {
|
|
99
81
|
var url = '/hooks/' + type;
|
|
100
|
-
|
|
101
82
|
if (functionName) {
|
|
102
83
|
url += '/' + functionName;
|
|
103
|
-
|
|
104
84
|
if (triggerName) {
|
|
105
85
|
url += '/' + triggerName;
|
|
106
86
|
}
|
|
107
87
|
}
|
|
108
|
-
|
|
109
88
|
return this.sendRequest('GET', url);
|
|
110
89
|
},
|
|
111
90
|
create: function (hook) {
|
|
112
91
|
var url;
|
|
113
|
-
|
|
114
92
|
if (hook.functionName && hook.url) {
|
|
115
93
|
url = '/hooks/functions';
|
|
116
94
|
} else if (hook.className && hook.triggerName && hook.url) {
|
|
@@ -121,12 +99,10 @@ var DefaultController = {
|
|
|
121
99
|
code: 143
|
|
122
100
|
});
|
|
123
101
|
}
|
|
124
|
-
|
|
125
102
|
return this.sendRequest('POST', url, hook);
|
|
126
103
|
},
|
|
127
104
|
remove: function (hook) {
|
|
128
105
|
var url;
|
|
129
|
-
|
|
130
106
|
if (hook.functionName) {
|
|
131
107
|
url = '/hooks/functions/' + hook.functionName;
|
|
132
108
|
delete hook.functionName;
|
|
@@ -140,14 +116,12 @@ var DefaultController = {
|
|
|
140
116
|
code: 143
|
|
141
117
|
});
|
|
142
118
|
}
|
|
143
|
-
|
|
144
119
|
return this.sendRequest('PUT', url, {
|
|
145
120
|
__op: 'Delete'
|
|
146
121
|
});
|
|
147
122
|
},
|
|
148
123
|
update: function (hook) {
|
|
149
124
|
var url;
|
|
150
|
-
|
|
151
125
|
if (hook.functionName && hook.url) {
|
|
152
126
|
url = '/hooks/functions/' + hook.functionName;
|
|
153
127
|
delete hook.functionName;
|
|
@@ -161,7 +135,6 @@ var DefaultController = {
|
|
|
161
135
|
code: 143
|
|
162
136
|
});
|
|
163
137
|
}
|
|
164
|
-
|
|
165
138
|
return this.sendRequest('PUT', url, hook);
|
|
166
139
|
},
|
|
167
140
|
sendRequest: function (method, url, body) {
|
|
@@ -169,14 +142,11 @@ var DefaultController = {
|
|
|
169
142
|
useMasterKey: true
|
|
170
143
|
}).then(function (res) {
|
|
171
144
|
var decoded = (0, _decode.default)(res);
|
|
172
|
-
|
|
173
145
|
if (decoded) {
|
|
174
146
|
return Promise.resolve(decoded);
|
|
175
147
|
}
|
|
176
|
-
|
|
177
148
|
return Promise.reject(new _ParseError.default(_ParseError.default.INVALID_JSON, 'The server returned an invalid response.'));
|
|
178
149
|
});
|
|
179
150
|
}
|
|
180
151
|
};
|
|
181
|
-
|
|
182
152
|
_CoreManager.default.setHooksController(DefaultController);
|
|
@@ -1,45 +1,32 @@
|
|
|
1
1
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
3
|
value: true
|
|
5
4
|
});
|
|
6
5
|
exports.default = void 0;
|
|
7
|
-
|
|
8
6
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
9
|
-
|
|
10
7
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
8
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
|
-
|
|
14
9
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
15
|
-
|
|
16
10
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
17
|
-
|
|
18
11
|
var _ParseObject2 = _interopRequireDefault(require("./ParseObject"));
|
|
19
|
-
|
|
20
12
|
function _createSuper(Derived) {
|
|
21
13
|
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
22
|
-
|
|
23
14
|
return function () {
|
|
24
15
|
var Super = (0, _getPrototypeOf2.default)(Derived),
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
result;
|
|
27
17
|
if (hasNativeReflectConstruct) {
|
|
28
18
|
var NewTarget = (0, _getPrototypeOf2.default)(this).constructor;
|
|
29
19
|
result = Reflect.construct(Super, arguments, NewTarget);
|
|
30
20
|
} else {
|
|
31
21
|
result = Super.apply(this, arguments);
|
|
32
22
|
}
|
|
33
|
-
|
|
34
23
|
return (0, _possibleConstructorReturn2.default)(this, result);
|
|
35
24
|
};
|
|
36
25
|
}
|
|
37
|
-
|
|
38
26
|
function _isNativeReflectConstruct() {
|
|
39
27
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
40
28
|
if (Reflect.construct.sham) return false;
|
|
41
29
|
if (typeof Proxy === "function") return true;
|
|
42
|
-
|
|
43
30
|
try {
|
|
44
31
|
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
45
32
|
return true;
|
|
@@ -47,30 +34,21 @@ function _isNativeReflectConstruct() {
|
|
|
47
34
|
return false;
|
|
48
35
|
}
|
|
49
36
|
}
|
|
50
|
-
|
|
51
37
|
var Installation = function (_ParseObject) {
|
|
52
38
|
(0, _inherits2.default)(Installation, _ParseObject);
|
|
53
|
-
|
|
54
39
|
var _super = _createSuper(Installation);
|
|
55
|
-
|
|
56
40
|
function Installation(attributes) {
|
|
57
41
|
var _this;
|
|
58
|
-
|
|
59
42
|
(0, _classCallCheck2.default)(this, Installation);
|
|
60
43
|
_this = _super.call(this, '_Installation');
|
|
61
|
-
|
|
62
44
|
if (attributes && typeof attributes === 'object') {
|
|
63
45
|
if (!_this.set(attributes || {})) {
|
|
64
46
|
throw new Error("Can't create an invalid Installation");
|
|
65
47
|
}
|
|
66
48
|
}
|
|
67
|
-
|
|
68
49
|
return _this;
|
|
69
50
|
}
|
|
70
|
-
|
|
71
51
|
return (0, _createClass2.default)(Installation);
|
|
72
52
|
}(_ParseObject2.default);
|
|
73
|
-
|
|
74
53
|
exports.default = Installation;
|
|
75
|
-
|
|
76
54
|
_ParseObject2.default.registerSubclass('_Installation', Installation);
|