parse 4.1.0 → 4.2.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/dist/parse.js +2123 -1542
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +2105 -1524
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/AnonymousUtils.js +1 -1
- package/lib/browser/Cloud.js +4 -2
- package/lib/browser/CoreManager.js +31 -4
- package/lib/browser/EventEmitter.js +7 -2
- package/lib/browser/EventuallyQueue.js +24 -4
- package/lib/browser/LiveQueryClient.js +59 -89
- package/lib/browser/LiveQuerySubscription.js +16 -51
- package/lib/browser/LocalDatastore.js +10 -1
- package/lib/browser/LocalDatastoreController.js +3 -1
- package/lib/browser/ObjectStateMutations.js +17 -2
- package/lib/browser/OfflineQuery.js +1 -1
- package/lib/browser/Parse.js +171 -135
- package/lib/browser/ParseACL.js +2 -1
- package/lib/browser/ParseCLP.js +6 -1
- package/lib/browser/ParseConfig.js +1 -0
- package/lib/browser/ParseError.js +12 -1
- package/lib/browser/ParseFile.js +5 -1
- package/lib/browser/ParseInstallation.js +4 -1
- package/lib/browser/ParseLiveQuery.js +79 -51
- package/lib/browser/ParseObject.js +11 -8
- package/lib/browser/ParseOp.js +3 -1
- package/lib/browser/ParseQuery.js +122 -72
- package/lib/browser/ParseRole.js +5 -1
- package/lib/browser/ParseSchema.js +23 -2
- package/lib/browser/ParseSession.js +1 -1
- package/lib/browser/ParseUser.js +107 -9
- package/lib/browser/Push.js +8 -2
- package/lib/browser/RESTController.js +20 -0
- package/lib/browser/SingleInstanceStateController.js +6 -1
- package/lib/browser/Storage.js +7 -0
- package/lib/browser/TaskQueue.js +4 -0
- package/lib/browser/UniqueInstanceStateController.js +3 -1
- package/lib/browser/unsavedChildren.js +4 -1
- package/lib/node/AnonymousUtils.js +1 -1
- package/lib/node/Cloud.js +4 -2
- package/lib/node/CoreManager.js +30 -4
- package/lib/node/EventEmitter.js +7 -1
- package/lib/node/EventuallyQueue.js +23 -4
- package/lib/node/LiveQueryClient.js +10 -7
- package/lib/node/LiveQuerySubscription.js +5 -7
- package/lib/node/LocalDatastore.js +7 -1
- package/lib/node/ObjectStateMutations.js +14 -2
- package/lib/node/OfflineQuery.js +1 -1
- package/lib/node/Parse.js +162 -126
- package/lib/node/ParseACL.js +2 -1
- package/lib/node/ParseCLP.js +3 -1
- package/lib/node/ParseConfig.js +1 -2
- package/lib/node/ParseError.js +15 -1
- package/lib/node/ParseFile.js +2 -1
- package/lib/node/ParseInstallation.js +1 -1
- package/lib/node/ParseLiveQuery.js +32 -24
- package/lib/node/ParseObject.js +3 -2
- package/lib/node/ParseQuery.js +53 -7
- package/lib/node/ParseRole.js +2 -1
- package/lib/node/ParseSchema.js +21 -2
- package/lib/node/ParseSession.js +1 -5
- package/lib/node/ParseUser.js +95 -9
- package/lib/node/Push.js +8 -2
- package/lib/node/RESTController.js +20 -0
- package/lib/node/SingleInstanceStateController.js +6 -1
- package/lib/node/Storage.js +6 -0
- package/lib/node/TaskQueue.js +4 -1
- package/lib/node/UniqueInstanceStateController.js +3 -1
- package/lib/node/unsavedChildren.js +4 -1
- package/lib/react-native/Cloud.js +3 -0
- package/lib/react-native/CoreManager.js +30 -4
- package/lib/react-native/EventEmitter.js +8 -5
- package/lib/react-native/EventuallyQueue.js +10 -3
- package/lib/react-native/LiveQueryClient.js +44 -70
- package/lib/react-native/LiveQuerySubscription.js +16 -46
- package/lib/react-native/LocalDatastore.js +6 -0
- package/lib/react-native/ObjectStateMutations.js +3 -1
- package/lib/react-native/OfflineQuery.js +1 -1
- package/lib/react-native/Parse.js +127 -90
- package/lib/react-native/ParseCLP.js +2 -2
- package/lib/react-native/ParseError.js +8 -1
- package/lib/react-native/ParseFile.js +1 -0
- package/lib/react-native/ParseLiveQuery.js +39 -11
- package/lib/react-native/ParseQuery.js +37 -17
- package/lib/react-native/ParseSchema.js +14 -1
- package/lib/react-native/ParseUser.js +74 -6
- package/lib/react-native/Storage.js +6 -0
- package/lib/weapp/AnonymousUtils.js +1 -1
- package/lib/weapp/Cloud.js +4 -2
- package/lib/weapp/CoreManager.js +31 -4
- package/lib/weapp/EventEmitter.js +7 -2
- package/lib/weapp/EventuallyQueue.js +24 -4
- package/lib/weapp/LiveQueryClient.js +59 -89
- package/lib/weapp/LiveQuerySubscription.js +16 -51
- package/lib/weapp/LocalDatastore.js +10 -1
- package/lib/weapp/LocalDatastoreController.js +3 -1
- package/lib/weapp/ObjectStateMutations.js +17 -2
- package/lib/weapp/OfflineQuery.js +1 -1
- package/lib/weapp/Parse.js +170 -134
- package/lib/weapp/ParseACL.js +2 -1
- package/lib/weapp/ParseCLP.js +6 -1
- package/lib/weapp/ParseConfig.js +1 -0
- package/lib/weapp/ParseError.js +12 -1
- package/lib/weapp/ParseFile.js +5 -1
- package/lib/weapp/ParseInstallation.js +4 -1
- package/lib/weapp/ParseLiveQuery.js +79 -51
- package/lib/weapp/ParseObject.js +11 -8
- package/lib/weapp/ParseOp.js +3 -1
- package/lib/weapp/ParseQuery.js +122 -72
- package/lib/weapp/ParseRole.js +5 -1
- package/lib/weapp/ParseSchema.js +23 -2
- package/lib/weapp/ParseSession.js +1 -1
- package/lib/weapp/ParseUser.js +107 -9
- package/lib/weapp/Push.js +8 -2
- package/lib/weapp/RESTController.js +20 -0
- package/lib/weapp/SingleInstanceStateController.js +6 -1
- package/lib/weapp/Storage.js +7 -0
- package/lib/weapp/TaskQueue.js +4 -0
- package/lib/weapp/UniqueInstanceStateController.js +3 -1
- package/lib/weapp/unsavedChildren.js +4 -1
- package/package.json +29 -25
package/lib/node/Parse.js
CHANGED
|
@@ -1,13 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _decode2 = _interopRequireDefault(require("./decode"));
|
|
8
|
+
var _encode2 = _interopRequireDefault(require("./encode"));
|
|
6
9
|
var _CryptoController = _interopRequireDefault(require("./CryptoController"));
|
|
7
10
|
var _EventuallyQueue = _interopRequireDefault(require("./EventuallyQueue"));
|
|
8
11
|
var _InstallationController = _interopRequireDefault(require("./InstallationController"));
|
|
9
12
|
var ParseOp = _interopRequireWildcard(require("./ParseOp"));
|
|
10
13
|
var _RESTController = _interopRequireDefault(require("./RESTController"));
|
|
14
|
+
var _ParseACL = _interopRequireDefault(require("./ParseACL"));
|
|
15
|
+
var Analytics = _interopRequireWildcard(require("./Analytics"));
|
|
16
|
+
var _AnonymousUtils = _interopRequireDefault(require("./AnonymousUtils"));
|
|
17
|
+
var Cloud = _interopRequireWildcard(require("./Cloud"));
|
|
18
|
+
var _ParseCLP = _interopRequireDefault(require("./ParseCLP"));
|
|
19
|
+
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
20
|
+
var _EventEmitter = _interopRequireDefault(require("./EventEmitter"));
|
|
21
|
+
var _ParseConfig = _interopRequireDefault(require("./ParseConfig"));
|
|
22
|
+
var _ParseError = _interopRequireDefault(require("./ParseError"));
|
|
23
|
+
var _FacebookUtils = _interopRequireDefault(require("./FacebookUtils"));
|
|
24
|
+
var _ParseFile = _interopRequireDefault(require("./ParseFile"));
|
|
25
|
+
var _ParseGeoPoint = _interopRequireDefault(require("./ParseGeoPoint"));
|
|
26
|
+
var _ParsePolygon = _interopRequireDefault(require("./ParsePolygon"));
|
|
27
|
+
var _ParseInstallation = _interopRequireDefault(require("./ParseInstallation"));
|
|
28
|
+
var _LocalDatastore = _interopRequireDefault(require("./LocalDatastore"));
|
|
29
|
+
var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
30
|
+
var Push = _interopRequireWildcard(require("./Push"));
|
|
31
|
+
var _ParseQuery = _interopRequireDefault(require("./ParseQuery"));
|
|
32
|
+
var _ParseRelation = _interopRequireDefault(require("./ParseRelation"));
|
|
33
|
+
var _ParseRole = _interopRequireDefault(require("./ParseRole"));
|
|
34
|
+
var _ParseSchema = _interopRequireDefault(require("./ParseSchema"));
|
|
35
|
+
var _ParseSession = _interopRequireDefault(require("./ParseSession"));
|
|
36
|
+
var _Storage = _interopRequireDefault(require("./Storage"));
|
|
37
|
+
var _ParseUser = _interopRequireDefault(require("./ParseUser"));
|
|
38
|
+
var _ParseLiveQuery = _interopRequireDefault(require("./ParseLiveQuery"));
|
|
39
|
+
var _LiveQueryClient = _interopRequireDefault(require("./LiveQueryClient"));
|
|
11
40
|
function _getRequireWildcardCache(nodeInterop) {
|
|
12
41
|
if (typeof WeakMap !== "function") return null;
|
|
13
42
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -59,8 +88,47 @@ function _interopRequireDefault(obj) {
|
|
|
59
88
|
* @global
|
|
60
89
|
* @class
|
|
61
90
|
* @hideconstructor
|
|
62
|
-
|
|
63
|
-
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
const Parse /*: ParseType*/ = {
|
|
94
|
+
ACL: _ParseACL.default,
|
|
95
|
+
Analytics: Analytics,
|
|
96
|
+
AnonymousUtils: _AnonymousUtils.default,
|
|
97
|
+
Cloud: Cloud,
|
|
98
|
+
CLP: _ParseCLP.default,
|
|
99
|
+
CoreManager: _CoreManager.default,
|
|
100
|
+
Config: _ParseConfig.default,
|
|
101
|
+
Error: _ParseError.default,
|
|
102
|
+
EventuallyQueue: _EventuallyQueue.default,
|
|
103
|
+
FacebookUtils: _FacebookUtils.default,
|
|
104
|
+
File: _ParseFile.default,
|
|
105
|
+
GeoPoint: _ParseGeoPoint.default,
|
|
106
|
+
Polygon: _ParsePolygon.default,
|
|
107
|
+
Installation: _ParseInstallation.default,
|
|
108
|
+
LocalDatastore: _LocalDatastore.default,
|
|
109
|
+
Object: _ParseObject.default,
|
|
110
|
+
Op: {
|
|
111
|
+
Set: ParseOp.SetOp,
|
|
112
|
+
Unset: ParseOp.UnsetOp,
|
|
113
|
+
Increment: ParseOp.IncrementOp,
|
|
114
|
+
Add: ParseOp.AddOp,
|
|
115
|
+
Remove: ParseOp.RemoveOp,
|
|
116
|
+
AddUnique: ParseOp.AddUniqueOp,
|
|
117
|
+
Relation: ParseOp.RelationOp
|
|
118
|
+
},
|
|
119
|
+
Push: Push,
|
|
120
|
+
Query: _ParseQuery.default,
|
|
121
|
+
Relation: _ParseRelation.default,
|
|
122
|
+
Role: _ParseRole.default,
|
|
123
|
+
Schema: _ParseSchema.default,
|
|
124
|
+
Session: _ParseSession.default,
|
|
125
|
+
Storage: _Storage.default,
|
|
126
|
+
User: _ParseUser.default,
|
|
127
|
+
LiveQueryClient: _LiveQueryClient.default,
|
|
128
|
+
LiveQuery: undefined,
|
|
129
|
+
IndexedDB: undefined,
|
|
130
|
+
Hooks: undefined,
|
|
131
|
+
Parse: undefined,
|
|
64
132
|
/**
|
|
65
133
|
* Call this method first to set up your authentication tokens for Parse.
|
|
66
134
|
*
|
|
@@ -72,11 +140,14 @@ const Parse = {
|
|
|
72
140
|
initialize(applicationId /*: string*/, javaScriptKey /*: string*/) {
|
|
73
141
|
Parse._initialize(applicationId, javaScriptKey);
|
|
74
142
|
},
|
|
75
|
-
_initialize(applicationId /*: string*/, javaScriptKey /*: string*/, masterKey
|
|
143
|
+
_initialize(applicationId /*: string*/, javaScriptKey /*: string*/, masterKey /*:: ?: string*/) {
|
|
76
144
|
_CoreManager.default.set('APPLICATION_ID', applicationId);
|
|
77
145
|
_CoreManager.default.set('JAVASCRIPT_KEY', javaScriptKey);
|
|
78
146
|
_CoreManager.default.set('MASTER_KEY', masterKey);
|
|
79
147
|
_CoreManager.default.set('USE_MASTER_KEY', false);
|
|
148
|
+
_CoreManager.default.setIfNeeded('EventEmitter', _EventEmitter.default);
|
|
149
|
+
Parse.LiveQuery = new _ParseLiveQuery.default();
|
|
150
|
+
_CoreManager.default.setIfNeeded('LiveQuery', Parse.LiveQuery);
|
|
80
151
|
},
|
|
81
152
|
/**
|
|
82
153
|
* Call this method to set your AsyncStorage engine
|
|
@@ -179,10 +250,10 @@ const Parse = {
|
|
|
179
250
|
return _CoreManager.default.get('LIVEQUERY_SERVER_URL');
|
|
180
251
|
},
|
|
181
252
|
/**
|
|
182
|
-
* @member {
|
|
253
|
+
* @member {boolean} Parse.encryptedUser
|
|
183
254
|
* @static
|
|
184
255
|
*/
|
|
185
|
-
set encryptedUser(value) {
|
|
256
|
+
set encryptedUser(value /*: boolean*/) {
|
|
186
257
|
_CoreManager.default.set('ENCRYPTED_USER', value);
|
|
187
258
|
},
|
|
188
259
|
get encryptedUser() {
|
|
@@ -217,126 +288,89 @@ const Parse = {
|
|
|
217
288
|
},
|
|
218
289
|
get allowCustomObjectId() {
|
|
219
290
|
return _CoreManager.default.get('ALLOW_CUSTOM_OBJECT_ID');
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
Parse.Relation = require('./ParseRelation').default;
|
|
250
|
-
Parse.Role = require('./ParseRole').default;
|
|
251
|
-
Parse.Schema = require('./ParseSchema').default;
|
|
252
|
-
Parse.Session = require('./ParseSession').default;
|
|
253
|
-
Parse.Storage = require('./Storage');
|
|
254
|
-
Parse.User = require('./ParseUser').default;
|
|
255
|
-
Parse.LiveQuery = require('./ParseLiveQuery').default;
|
|
256
|
-
Parse.LiveQueryClient = require('./LiveQueryClient').default;
|
|
257
|
-
Parse._request = function (...args) {
|
|
258
|
-
return _CoreManager.default.getRESTController().request.apply(null, args);
|
|
259
|
-
};
|
|
260
|
-
Parse._ajax = function (...args) {
|
|
261
|
-
return _CoreManager.default.getRESTController().ajax.apply(null, args);
|
|
262
|
-
};
|
|
263
|
-
// We attempt to match the signatures of the legacy versions of these methods
|
|
264
|
-
Parse._decode = function (_, value) {
|
|
265
|
-
return (0, _decode.default)(value);
|
|
266
|
-
};
|
|
267
|
-
Parse._encode = function (value, _, disallowObjects) {
|
|
268
|
-
return (0, _encode.default)(value, disallowObjects);
|
|
269
|
-
};
|
|
270
|
-
Parse._getInstallationId = function () {
|
|
271
|
-
return _CoreManager.default.getInstallationController().currentInstallationId();
|
|
272
|
-
};
|
|
273
|
-
/**
|
|
274
|
-
* Enable pinning in your application.
|
|
275
|
-
* This must be called after `Parse.initialize` in your application.
|
|
276
|
-
*
|
|
277
|
-
* @param [polling] Allow pinging the server /health endpoint. Default true
|
|
278
|
-
* @param [ms] Milliseconds to ping the server. Default 2000ms
|
|
279
|
-
* @static
|
|
280
|
-
*/
|
|
281
|
-
Parse.enableLocalDatastore = function (polling = true, ms /*: number*/ = 2000) {
|
|
282
|
-
if (!Parse.applicationId) {
|
|
283
|
-
console.log("'enableLocalDataStore' must be called after 'initialize'");
|
|
284
|
-
return;
|
|
285
|
-
}
|
|
286
|
-
if (!Parse.LocalDatastore.isEnabled) {
|
|
287
|
-
Parse.LocalDatastore.isEnabled = true;
|
|
288
|
-
if (polling) {
|
|
289
|
-
_EventuallyQueue.default.poll(ms);
|
|
291
|
+
},
|
|
292
|
+
_request(...args) {
|
|
293
|
+
return _CoreManager.default.getRESTController().request.apply(null, args);
|
|
294
|
+
},
|
|
295
|
+
_ajax(...args) {
|
|
296
|
+
return _CoreManager.default.getRESTController().ajax.apply(null, args);
|
|
297
|
+
},
|
|
298
|
+
// We attempt to match the signatures of the legacy versions of these methods
|
|
299
|
+
_decode(_, value) {
|
|
300
|
+
return (0, _decode2.default)(value);
|
|
301
|
+
},
|
|
302
|
+
_encode(value, _, disallowObjects) {
|
|
303
|
+
return (0, _encode2.default)(value, disallowObjects);
|
|
304
|
+
},
|
|
305
|
+
_getInstallationId() {
|
|
306
|
+
return _CoreManager.default.getInstallationController().currentInstallationId();
|
|
307
|
+
},
|
|
308
|
+
/**
|
|
309
|
+
* Enable pinning in your application.
|
|
310
|
+
* This must be called after `Parse.initialize` in your application.
|
|
311
|
+
*
|
|
312
|
+
* @param [polling] Allow pinging the server /health endpoint. Default true
|
|
313
|
+
* @param [ms] Milliseconds to ping the server. Default 2000ms
|
|
314
|
+
* @static
|
|
315
|
+
*/
|
|
316
|
+
enableLocalDatastore(polling = true, ms /*: number*/ = 2000) {
|
|
317
|
+
if (!this.applicationId) {
|
|
318
|
+
console.log("'enableLocalDataStore' must be called after 'initialize'");
|
|
319
|
+
return;
|
|
290
320
|
}
|
|
321
|
+
if (!this.LocalDatastore.isEnabled) {
|
|
322
|
+
this.LocalDatastore.isEnabled = true;
|
|
323
|
+
if (polling) {
|
|
324
|
+
_EventuallyQueue.default.poll(ms);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
/**
|
|
329
|
+
* Flag that indicates whether Local Datastore is enabled.
|
|
330
|
+
*
|
|
331
|
+
* @static
|
|
332
|
+
* @returns {boolean}
|
|
333
|
+
*/
|
|
334
|
+
isLocalDatastoreEnabled() {
|
|
335
|
+
return this.LocalDatastore.isEnabled;
|
|
336
|
+
},
|
|
337
|
+
/**
|
|
338
|
+
* Gets all contents from Local Datastore
|
|
339
|
+
*
|
|
340
|
+
* <pre>
|
|
341
|
+
* await Parse.dumpLocalDatastore();
|
|
342
|
+
* </pre>
|
|
343
|
+
*
|
|
344
|
+
* @static
|
|
345
|
+
* @returns {object}
|
|
346
|
+
*/
|
|
347
|
+
dumpLocalDatastore() {
|
|
348
|
+
if (!this.LocalDatastore.isEnabled) {
|
|
349
|
+
console.log('Parse.enableLocalDatastore() must be called first'); // eslint-disable-line no-console
|
|
350
|
+
return Promise.resolve({});
|
|
351
|
+
} else {
|
|
352
|
+
return Parse.LocalDatastore._getAllContents();
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
/**
|
|
356
|
+
* Enable the current user encryption.
|
|
357
|
+
* This must be called before login any user.
|
|
358
|
+
*
|
|
359
|
+
* @static
|
|
360
|
+
*/
|
|
361
|
+
enableEncryptedUser() {
|
|
362
|
+
this.encryptedUser = true;
|
|
363
|
+
},
|
|
364
|
+
/**
|
|
365
|
+
* Flag that indicates whether Encrypted User is enabled.
|
|
366
|
+
*
|
|
367
|
+
* @static
|
|
368
|
+
* @returns {boolean}
|
|
369
|
+
*/
|
|
370
|
+
isEncryptedUserEnabled() {
|
|
371
|
+
return this.encryptedUser;
|
|
291
372
|
}
|
|
292
373
|
};
|
|
293
|
-
/**
|
|
294
|
-
* Flag that indicates whether Local Datastore is enabled.
|
|
295
|
-
*
|
|
296
|
-
* @static
|
|
297
|
-
* @returns {boolean}
|
|
298
|
-
*/
|
|
299
|
-
Parse.isLocalDatastoreEnabled = function () {
|
|
300
|
-
return Parse.LocalDatastore.isEnabled;
|
|
301
|
-
};
|
|
302
|
-
/**
|
|
303
|
-
* Gets all contents from Local Datastore
|
|
304
|
-
*
|
|
305
|
-
* <pre>
|
|
306
|
-
* await Parse.dumpLocalDatastore();
|
|
307
|
-
* </pre>
|
|
308
|
-
*
|
|
309
|
-
* @static
|
|
310
|
-
* @returns {object}
|
|
311
|
-
*/
|
|
312
|
-
Parse.dumpLocalDatastore = function () {
|
|
313
|
-
if (!Parse.LocalDatastore.isEnabled) {
|
|
314
|
-
console.log('Parse.enableLocalDatastore() must be called first'); // eslint-disable-line no-console
|
|
315
|
-
return Promise.resolve({});
|
|
316
|
-
} else {
|
|
317
|
-
return Parse.LocalDatastore._getAllContents();
|
|
318
|
-
}
|
|
319
|
-
};
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* Enable the current user encryption.
|
|
323
|
-
* This must be called before login any user.
|
|
324
|
-
*
|
|
325
|
-
* @static
|
|
326
|
-
*/
|
|
327
|
-
Parse.enableEncryptedUser = function () {
|
|
328
|
-
Parse.encryptedUser = true;
|
|
329
|
-
};
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
* Flag that indicates whether Encrypted User is enabled.
|
|
333
|
-
*
|
|
334
|
-
* @static
|
|
335
|
-
* @returns {boolean}
|
|
336
|
-
*/
|
|
337
|
-
Parse.isEncryptedUserEnabled = function () {
|
|
338
|
-
return Parse.encryptedUser;
|
|
339
|
-
};
|
|
340
374
|
_CoreManager.default.setCryptoController(_CryptoController.default);
|
|
341
375
|
_CoreManager.default.setInstallationController(_InstallationController.default);
|
|
342
376
|
_CoreManager.default.setRESTController(_RESTController.default);
|
|
@@ -349,4 +383,6 @@ Parse.Hooks = require('./ParseHooks');
|
|
|
349
383
|
|
|
350
384
|
// For legacy requires, of the form `var Parse = require('parse').Parse`
|
|
351
385
|
Parse.Parse = Parse;
|
|
352
|
-
module.exports = Parse;
|
|
386
|
+
module.exports = Parse;
|
|
387
|
+
var _default = Parse;
|
|
388
|
+
exports.default = _default;
|
package/lib/node/ParseACL.js
CHANGED
package/lib/node/ParseCLP.js
CHANGED
|
@@ -14,7 +14,9 @@ function _interopRequireDefault(obj) {
|
|
|
14
14
|
/**
|
|
15
15
|
* @flow
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
/*:: type Entity = Entity;*/
|
|
18
|
+
/*:: type UsersMap = { [userId: string]: boolean | any };*/
|
|
19
|
+
/*:: export type PermissionsMap = { [permission: string]: UsersMap };*/
|
|
18
20
|
const PUBLIC_KEY = '*';
|
|
19
21
|
const VALID_PERMISSIONS /*: Map<string, UsersMap>*/ = new Map(
|
|
20
22
|
/*:: <string, UsersMap>*/
|
package/lib/node/ParseConfig.js
CHANGED
|
@@ -18,14 +18,13 @@ function _interopRequireDefault(obj) {
|
|
|
18
18
|
/**
|
|
19
19
|
* @flow
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
/*:: import type { RequestOptions } from './RESTController';*/
|
|
22
22
|
/**
|
|
23
23
|
* Parse.Config is a local representation of configuration data that
|
|
24
24
|
* can be set from the Parse dashboard.
|
|
25
25
|
*
|
|
26
26
|
* @alias Parse.Config
|
|
27
27
|
*/
|
|
28
|
-
|
|
29
28
|
class ParseConfig {
|
|
30
29
|
/*:: attributes: { [key: string]: any };*/
|
|
31
30
|
/*:: _escapedAttributes: { [key: string]: any };*/
|
package/lib/node/ParseError.js
CHANGED
|
@@ -4,9 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
8
|
+
function _interopRequireDefault(obj) {
|
|
9
|
+
return obj && obj.__esModule ? obj : {
|
|
10
|
+
default: obj
|
|
11
|
+
};
|
|
12
|
+
}
|
|
7
13
|
/**
|
|
8
14
|
* Constructs a new Parse.Error object with the given code and message.
|
|
9
15
|
*
|
|
16
|
+
* Parse.CoreManager.set('PARSE_ERRORS', [{ code, message }]) can be use to override error messages.
|
|
17
|
+
*
|
|
10
18
|
* @alias Parse.Error
|
|
11
19
|
*/
|
|
12
20
|
class ParseError extends Error {
|
|
@@ -17,9 +25,15 @@ class ParseError extends Error {
|
|
|
17
25
|
constructor(code, message) {
|
|
18
26
|
super(message);
|
|
19
27
|
this.code = code;
|
|
28
|
+
let customMessage = message;
|
|
29
|
+
_CoreManager.default.get('PARSE_ERRORS').forEach(error => {
|
|
30
|
+
if (error.code === code && error.code) {
|
|
31
|
+
customMessage = error.message;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
20
34
|
Object.defineProperty(this, 'message', {
|
|
21
35
|
enumerable: true,
|
|
22
|
-
value:
|
|
36
|
+
value: customMessage
|
|
23
37
|
});
|
|
24
38
|
}
|
|
25
39
|
toString() {
|
package/lib/node/ParseFile.js
CHANGED
|
@@ -14,7 +14,7 @@ function _interopRequireDefault(obj) {
|
|
|
14
14
|
* @flow
|
|
15
15
|
*/
|
|
16
16
|
/* global XMLHttpRequest, Blob */
|
|
17
|
-
|
|
17
|
+
/*:: import type { FullOptions } from './RESTController';*/
|
|
18
18
|
const ParseError = require('./ParseError').default;
|
|
19
19
|
let XHR = null;
|
|
20
20
|
if (typeof XMLHttpRequest !== 'undefined') {
|
|
@@ -289,6 +289,7 @@ class ParseFile {
|
|
|
289
289
|
*/
|
|
290
290
|
cancel() {
|
|
291
291
|
if (this._requestTask && typeof this._requestTask.abort === 'function') {
|
|
292
|
+
this._requestTask._aborted = true;
|
|
292
293
|
this._requestTask.abort();
|
|
293
294
|
}
|
|
294
295
|
this._requestTask = null;
|
|
@@ -13,7 +13,7 @@ function _interopRequireDefault(obj) {
|
|
|
13
13
|
/**
|
|
14
14
|
* @flow
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
/*:: import type { AttributeMap } from './ObjectStateMutations';*/
|
|
17
17
|
class Installation extends _ParseObject.default {
|
|
18
18
|
constructor(attributes /*: ?AttributeMap*/) {
|
|
19
19
|
super('_Installation');
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _EventEmitter = _interopRequireDefault(require("./EventEmitter"));
|
|
8
7
|
var _LiveQueryClient = _interopRequireDefault(require("./LiveQueryClient"));
|
|
9
8
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
10
9
|
function _interopRequireDefault(obj) {
|
|
@@ -16,7 +15,7 @@ function _interopRequireDefault(obj) {
|
|
|
16
15
|
* @flow
|
|
17
16
|
*/
|
|
18
17
|
|
|
19
|
-
function getLiveQueryClient() /*: LiveQueryClient
|
|
18
|
+
function getLiveQueryClient() /*: Promise<LiveQueryClient>*/{
|
|
20
19
|
return _CoreManager.default.getLiveQueryController().getDefaultLiveQueryClient();
|
|
21
20
|
}
|
|
22
21
|
|
|
@@ -47,31 +46,39 @@ function getLiveQueryClient() /*: LiveQueryClient*/{
|
|
|
47
46
|
* @class Parse.LiveQuery
|
|
48
47
|
* @static
|
|
49
48
|
*/
|
|
50
|
-
|
|
49
|
+
class LiveQuery {
|
|
50
|
+
constructor() {
|
|
51
|
+
const EventEmitter = _CoreManager.default.getEventEmitter();
|
|
52
|
+
this.emitter = new EventEmitter();
|
|
53
|
+
this.on = this.emitter.on;
|
|
54
|
+
this.emit = this.emitter.emit;
|
|
51
55
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
LiveQuery.open = async () => {
|
|
57
|
-
const liveQueryClient = await getLiveQueryClient();
|
|
58
|
-
liveQueryClient.open();
|
|
59
|
-
};
|
|
56
|
+
// adding listener so process does not crash
|
|
57
|
+
// best practice is for developer to register their own listener
|
|
58
|
+
this.on('error', () => {});
|
|
59
|
+
}
|
|
60
60
|
|
|
61
|
-
/**
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const liveQueryClient = await getLiveQueryClient();
|
|
70
|
-
liveQueryClient.close();
|
|
71
|
-
};
|
|
61
|
+
/**
|
|
62
|
+
* After open is called, the LiveQuery will try to send a connect request
|
|
63
|
+
* to the LiveQuery server.
|
|
64
|
+
*/
|
|
65
|
+
async open() /*: void*/{
|
|
66
|
+
const liveQueryClient = await getLiveQueryClient();
|
|
67
|
+
liveQueryClient.open();
|
|
68
|
+
}
|
|
72
69
|
|
|
73
|
-
|
|
74
|
-
LiveQuery
|
|
70
|
+
/**
|
|
71
|
+
* When you're done using LiveQuery, you can call Parse.LiveQuery.close().
|
|
72
|
+
* This function will close the WebSocket connection to the LiveQuery server,
|
|
73
|
+
* cancel the auto reconnect, and unsubscribe all subscriptions based on it.
|
|
74
|
+
* If you call query.subscribe() after this, we'll create a new WebSocket
|
|
75
|
+
* connection to the LiveQuery server.
|
|
76
|
+
*/
|
|
77
|
+
async close() /*: void*/{
|
|
78
|
+
const liveQueryClient = await getLiveQueryClient();
|
|
79
|
+
liveQueryClient.close();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
75
82
|
var _default = LiveQuery;
|
|
76
83
|
exports.default = _default;
|
|
77
84
|
let defaultLiveQueryClient;
|
|
@@ -109,6 +116,7 @@ const DefaultLiveQueryController = {
|
|
|
109
116
|
sessionToken,
|
|
110
117
|
installationId
|
|
111
118
|
});
|
|
119
|
+
const LiveQuery = _CoreManager.default.getLiveQuery();
|
|
112
120
|
defaultLiveQueryClient.on('error', error => {
|
|
113
121
|
LiveQuery.emit('error', error);
|
|
114
122
|
});
|
package/lib/node/ParseObject.js
CHANGED
|
@@ -70,7 +70,8 @@ function _interopRequireDefault(obj) {
|
|
|
70
70
|
/**
|
|
71
71
|
* @flow
|
|
72
72
|
*/
|
|
73
|
-
|
|
73
|
+
/*:: import type { AttributeMap, OpsMap } from './ObjectStateMutations';*/
|
|
74
|
+
/*:: import type { RequestOptions, FullOptions } from './RESTController';*/
|
|
74
75
|
const uuidv4 = require('./uuid');
|
|
75
76
|
/*:: export type Pointer = {
|
|
76
77
|
__type: string,
|
|
@@ -1041,7 +1042,7 @@ class ParseObject {
|
|
|
1041
1042
|
/**
|
|
1042
1043
|
* Returns the ACL for this object.
|
|
1043
1044
|
*
|
|
1044
|
-
* @returns {Parse.ACL} An instance of Parse.ACL.
|
|
1045
|
+
* @returns {Parse.ACL|null} An instance of Parse.ACL.
|
|
1045
1046
|
* @see Parse.Object#get
|
|
1046
1047
|
*/
|
|
1047
1048
|
getACL() /*: ?ParseACL*/{
|
package/lib/node/ParseQuery.js
CHANGED
|
@@ -20,7 +20,29 @@ function _interopRequireDefault(obj) {
|
|
|
20
20
|
/*
|
|
21
21
|
* @flow
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
/*:: import type LiveQuerySubscription from './LiveQuerySubscription';*/
|
|
24
|
+
/*:: import type { RequestOptions, FullOptions } from './RESTController';*/
|
|
25
|
+
/*:: type BatchOptions = FullOptions & { batchSize?: number };*/
|
|
26
|
+
/*:: export type WhereClause = {
|
|
27
|
+
[attr: string]: mixed,
|
|
28
|
+
};*/
|
|
29
|
+
/*:: export type QueryJSON = {
|
|
30
|
+
where: WhereClause,
|
|
31
|
+
watch?: string,
|
|
32
|
+
include?: string,
|
|
33
|
+
excludeKeys?: string,
|
|
34
|
+
keys?: string,
|
|
35
|
+
limit?: number,
|
|
36
|
+
skip?: number,
|
|
37
|
+
order?: string,
|
|
38
|
+
className?: string,
|
|
39
|
+
count?: number,
|
|
40
|
+
hint?: mixed,
|
|
41
|
+
explain?: boolean,
|
|
42
|
+
readPreference?: string,
|
|
43
|
+
includeReadPreference?: string,
|
|
44
|
+
subqueryReadPreference?: string,
|
|
45
|
+
};*/
|
|
24
46
|
/**
|
|
25
47
|
* Converts a string into a regex that matches it.
|
|
26
48
|
* Surrounding with \Q .. \E does this, we just need to escape any \E's in
|
|
@@ -200,6 +222,7 @@ class ParseQuery {
|
|
|
200
222
|
*/
|
|
201
223
|
/*:: className: string;*/
|
|
202
224
|
/*:: _where: any;*/
|
|
225
|
+
/*:: _watch: Array<string>;*/
|
|
203
226
|
/*:: _include: Array<string>;*/
|
|
204
227
|
/*:: _exclude: Array<string>;*/
|
|
205
228
|
/*:: _select: Array<string>;*/
|
|
@@ -239,6 +262,7 @@ class ParseQuery {
|
|
|
239
262
|
throw new TypeError('A ParseQuery must be constructed with a ParseObject or class name.');
|
|
240
263
|
}
|
|
241
264
|
this._where = {};
|
|
265
|
+
this._watch = [];
|
|
242
266
|
this._include = [];
|
|
243
267
|
this._exclude = [];
|
|
244
268
|
this._count = false;
|
|
@@ -391,6 +415,9 @@ class ParseQuery {
|
|
|
391
415
|
const params /*: QueryJSON*/ = {
|
|
392
416
|
where: this._where
|
|
393
417
|
};
|
|
418
|
+
if (this._watch.length) {
|
|
419
|
+
params.watch = this._watch.join(',');
|
|
420
|
+
}
|
|
394
421
|
if (this._include.length) {
|
|
395
422
|
params.include = this._include.join(',');
|
|
396
423
|
}
|
|
@@ -458,6 +485,9 @@ class ParseQuery {
|
|
|
458
485
|
if (json.where) {
|
|
459
486
|
this._where = json.where;
|
|
460
487
|
}
|
|
488
|
+
if (json.watch) {
|
|
489
|
+
this._watch = json.watch.split(',');
|
|
490
|
+
}
|
|
461
491
|
if (json.include) {
|
|
462
492
|
this._include = json.include.split(',');
|
|
463
493
|
}
|
|
@@ -845,13 +875,10 @@ class ParseQuery {
|
|
|
845
875
|
}
|
|
846
876
|
const query = new ParseQuery(this.className);
|
|
847
877
|
query._limit = options.batchSize || 100;
|
|
848
|
-
query._include = this._include
|
|
849
|
-
|
|
850
|
-
});
|
|
878
|
+
query._include = [...this._include];
|
|
879
|
+
query._exclude = [...this._exclude];
|
|
851
880
|
if (this._select) {
|
|
852
|
-
query._select = this._select
|
|
853
|
-
return s;
|
|
854
|
-
});
|
|
881
|
+
query._select = [...this._select];
|
|
855
882
|
}
|
|
856
883
|
query._hint = this._hint;
|
|
857
884
|
query._where = {};
|
|
@@ -1795,6 +1822,25 @@ class ParseQuery {
|
|
|
1795
1822
|
return this;
|
|
1796
1823
|
}
|
|
1797
1824
|
|
|
1825
|
+
/**
|
|
1826
|
+
* Restricts live query to trigger only for watched fields.
|
|
1827
|
+
*
|
|
1828
|
+
* Requires Parse Server 6.0.0+
|
|
1829
|
+
*
|
|
1830
|
+
* @param {...string|Array<string>} keys The name(s) of the key(s) to watch.
|
|
1831
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
1832
|
+
*/
|
|
1833
|
+
watch(...keys /*: Array<string | Array<string>>*/) /*: ParseQuery*/{
|
|
1834
|
+
keys.forEach(key => {
|
|
1835
|
+
if (Array.isArray(key)) {
|
|
1836
|
+
this._watch = this._watch.concat(key);
|
|
1837
|
+
} else {
|
|
1838
|
+
this._watch.push(key);
|
|
1839
|
+
}
|
|
1840
|
+
});
|
|
1841
|
+
return this;
|
|
1842
|
+
}
|
|
1843
|
+
|
|
1798
1844
|
/**
|
|
1799
1845
|
* Changes the read preference that the backend will use when performing the query to the database.
|
|
1800
1846
|
*
|
package/lib/node/ParseRole.js
CHANGED
|
@@ -15,7 +15,8 @@ function _interopRequireDefault(obj) {
|
|
|
15
15
|
/**
|
|
16
16
|
* @flow
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
/*:: import type { AttributeMap } from './ObjectStateMutations';*/
|
|
19
|
+
/*:: import type ParseRelation from './ParseRelation';*/
|
|
19
20
|
/**
|
|
20
21
|
* Represents a Role on the Parse server. Roles represent groupings of
|
|
21
22
|
* Users for the purposes of granting permissions (e.g. specifying an ACL
|