parse 4.2.0-alpha.9 → 4.2.0
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 +1312 -1712
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +1294 -1694
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/Cloud.js +0 -3
- package/lib/browser/CoreManager.js +4 -13
- package/lib/browser/EventuallyQueue.js +3 -11
- package/lib/browser/LocalDatastore.js +0 -7
- package/lib/browser/ObjectStateMutations.js +1 -3
- package/lib/browser/OfflineQuery.js +1 -1
- package/lib/browser/Parse.js +135 -167
- package/lib/browser/ParseError.js +1 -12
- package/lib/browser/ParseObject.js +1 -1
- package/lib/browser/ParseQuery.js +58 -53
- package/lib/browser/ParseSchema.js +1 -22
- package/lib/browser/ParseSession.js +6 -2
- package/lib/browser/ParseUser.js +8 -65
- package/lib/browser/Storage.js +0 -7
- package/lib/node/Cloud.js +0 -3
- package/lib/node/CoreManager.js +4 -12
- package/lib/node/EventuallyQueue.js +3 -10
- package/lib/node/LocalDatastore.js +0 -6
- package/lib/node/ObjectStateMutations.js +1 -3
- package/lib/node/OfflineQuery.js +1 -1
- package/lib/node/Parse.js +126 -158
- package/lib/node/ParseError.js +1 -15
- package/lib/node/ParseObject.js +1 -1
- package/lib/node/ParseQuery.js +6 -3
- package/lib/node/ParseSchema.js +1 -20
- package/lib/node/ParseSession.js +6 -1
- package/lib/node/ParseUser.js +8 -58
- package/lib/node/Storage.js +0 -6
- package/lib/react-native/Cloud.js +0 -3
- package/lib/react-native/CoreManager.js +4 -12
- package/lib/react-native/EventEmitter.js +1 -1
- package/lib/react-native/EventuallyQueue.js +3 -10
- package/lib/react-native/LocalDatastore.js +0 -6
- package/lib/react-native/ObjectStateMutations.js +1 -3
- package/lib/react-native/OfflineQuery.js +1 -1
- package/lib/react-native/Parse.js +90 -123
- package/lib/react-native/ParseError.js +1 -8
- package/lib/react-native/ParseQuery.js +6 -3
- package/lib/react-native/ParseSchema.js +1 -14
- package/lib/react-native/ParseUser.js +6 -49
- package/lib/react-native/Storage.js +0 -6
- package/lib/weapp/Cloud.js +0 -3
- package/lib/weapp/CoreManager.js +4 -13
- package/lib/weapp/EventuallyQueue.js +3 -11
- package/lib/weapp/LocalDatastore.js +0 -7
- package/lib/weapp/ObjectStateMutations.js +1 -3
- package/lib/weapp/OfflineQuery.js +1 -1
- package/lib/weapp/Parse.js +134 -166
- package/lib/weapp/ParseError.js +1 -12
- package/lib/weapp/ParseObject.js +1 -1
- package/lib/weapp/ParseQuery.js +58 -53
- package/lib/weapp/ParseSchema.js +1 -22
- package/lib/weapp/ParseSession.js +6 -2
- package/lib/weapp/ParseUser.js +8 -65
- package/lib/weapp/Storage.js +0 -7
- package/package.json +17 -21
package/lib/node/Parse.js
CHANGED
|
@@ -1,41 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _decode2 = _interopRequireDefault(require("./decode"));
|
|
8
|
-
var _encode2 = _interopRequireDefault(require("./encode"));
|
|
3
|
+
var _decode = _interopRequireDefault(require("./decode"));
|
|
4
|
+
var _encode = _interopRequireDefault(require("./encode"));
|
|
5
|
+
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
9
6
|
var _CryptoController = _interopRequireDefault(require("./CryptoController"));
|
|
10
7
|
var _EventuallyQueue = _interopRequireDefault(require("./EventuallyQueue"));
|
|
11
8
|
var _InstallationController = _interopRequireDefault(require("./InstallationController"));
|
|
12
9
|
var ParseOp = _interopRequireWildcard(require("./ParseOp"));
|
|
13
10
|
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 _ParseConfig = _interopRequireDefault(require("./ParseConfig"));
|
|
21
|
-
var _ParseError = _interopRequireDefault(require("./ParseError"));
|
|
22
|
-
var _FacebookUtils = _interopRequireDefault(require("./FacebookUtils"));
|
|
23
|
-
var _ParseFile = _interopRequireDefault(require("./ParseFile"));
|
|
24
|
-
var _ParseGeoPoint = _interopRequireDefault(require("./ParseGeoPoint"));
|
|
25
|
-
var _ParsePolygon = _interopRequireDefault(require("./ParsePolygon"));
|
|
26
|
-
var _ParseInstallation = _interopRequireDefault(require("./ParseInstallation"));
|
|
27
|
-
var _LocalDatastore = _interopRequireDefault(require("./LocalDatastore"));
|
|
28
|
-
var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
29
|
-
var Push = _interopRequireWildcard(require("./Push"));
|
|
30
|
-
var _ParseQuery = _interopRequireDefault(require("./ParseQuery"));
|
|
31
|
-
var _ParseRelation = _interopRequireDefault(require("./ParseRelation"));
|
|
32
|
-
var _ParseRole = _interopRequireDefault(require("./ParseRole"));
|
|
33
|
-
var _ParseSchema = _interopRequireDefault(require("./ParseSchema"));
|
|
34
|
-
var _ParseSession = _interopRequireDefault(require("./ParseSession"));
|
|
35
|
-
var _Storage = _interopRequireDefault(require("./Storage"));
|
|
36
|
-
var _ParseUser = _interopRequireDefault(require("./ParseUser"));
|
|
37
|
-
var _ParseLiveQuery = _interopRequireDefault(require("./ParseLiveQuery"));
|
|
38
|
-
var _LiveQueryClient = _interopRequireDefault(require("./LiveQueryClient"));
|
|
39
11
|
function _getRequireWildcardCache(nodeInterop) {
|
|
40
12
|
if (typeof WeakMap !== "function") return null;
|
|
41
13
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -87,47 +59,8 @@ function _interopRequireDefault(obj) {
|
|
|
87
59
|
* @global
|
|
88
60
|
* @class
|
|
89
61
|
* @hideconstructor
|
|
90
|
-
*/
|
|
91
|
-
|
|
92
|
-
const Parse /*: ParseType*/ = {
|
|
93
|
-
ACL: _ParseACL.default,
|
|
94
|
-
Analytics: Analytics,
|
|
95
|
-
AnonymousUtils: _AnonymousUtils.default,
|
|
96
|
-
Cloud: Cloud,
|
|
97
|
-
CLP: _ParseCLP.default,
|
|
98
|
-
CoreManager: _CoreManager.default,
|
|
99
|
-
Config: _ParseConfig.default,
|
|
100
|
-
Error: _ParseError.default,
|
|
101
|
-
EventuallyQueue: _EventuallyQueue.default,
|
|
102
|
-
FacebookUtils: _FacebookUtils.default,
|
|
103
|
-
File: _ParseFile.default,
|
|
104
|
-
GeoPoint: _ParseGeoPoint.default,
|
|
105
|
-
Polygon: _ParsePolygon.default,
|
|
106
|
-
Installation: _ParseInstallation.default,
|
|
107
|
-
LocalDatastore: _LocalDatastore.default,
|
|
108
|
-
Object: _ParseObject.default,
|
|
109
|
-
Op: {
|
|
110
|
-
Set: ParseOp.SetOp,
|
|
111
|
-
Unset: ParseOp.UnsetOp,
|
|
112
|
-
Increment: ParseOp.IncrementOp,
|
|
113
|
-
Add: ParseOp.AddOp,
|
|
114
|
-
Remove: ParseOp.RemoveOp,
|
|
115
|
-
AddUnique: ParseOp.AddUniqueOp,
|
|
116
|
-
Relation: ParseOp.RelationOp
|
|
117
|
-
},
|
|
118
|
-
Push: Push,
|
|
119
|
-
Query: _ParseQuery.default,
|
|
120
|
-
Relation: _ParseRelation.default,
|
|
121
|
-
Role: _ParseRole.default,
|
|
122
|
-
Schema: _ParseSchema.default,
|
|
123
|
-
Session: _ParseSession.default,
|
|
124
|
-
Storage: _Storage.default,
|
|
125
|
-
User: _ParseUser.default,
|
|
126
|
-
LiveQuery: _ParseLiveQuery.default,
|
|
127
|
-
LiveQueryClient: _LiveQueryClient.default,
|
|
128
|
-
IndexedDB: undefined,
|
|
129
|
-
Hooks: undefined,
|
|
130
|
-
Parse: undefined,
|
|
62
|
+
*/
|
|
63
|
+
const Parse = {
|
|
131
64
|
/**
|
|
132
65
|
* Call this method first to set up your authentication tokens for Parse.
|
|
133
66
|
*
|
|
@@ -139,7 +72,7 @@ const Parse /*: ParseType*/ = {
|
|
|
139
72
|
initialize(applicationId /*: string*/, javaScriptKey /*: string*/) {
|
|
140
73
|
Parse._initialize(applicationId, javaScriptKey);
|
|
141
74
|
},
|
|
142
|
-
_initialize(applicationId /*: string*/, javaScriptKey /*: string*/, masterKey
|
|
75
|
+
_initialize(applicationId /*: string*/, javaScriptKey /*: string*/, masterKey /*: string*/) {
|
|
143
76
|
_CoreManager.default.set('APPLICATION_ID', applicationId);
|
|
144
77
|
_CoreManager.default.set('JAVASCRIPT_KEY', javaScriptKey);
|
|
145
78
|
_CoreManager.default.set('MASTER_KEY', masterKey);
|
|
@@ -246,10 +179,10 @@ const Parse /*: ParseType*/ = {
|
|
|
246
179
|
return _CoreManager.default.get('LIVEQUERY_SERVER_URL');
|
|
247
180
|
},
|
|
248
181
|
/**
|
|
249
|
-
* @member {
|
|
182
|
+
* @member {string} Parse.encryptedUser
|
|
250
183
|
* @static
|
|
251
184
|
*/
|
|
252
|
-
set encryptedUser(value
|
|
185
|
+
set encryptedUser(value) {
|
|
253
186
|
_CoreManager.default.set('ENCRYPTED_USER', value);
|
|
254
187
|
},
|
|
255
188
|
get encryptedUser() {
|
|
@@ -284,89 +217,126 @@ const Parse /*: ParseType*/ = {
|
|
|
284
217
|
},
|
|
285
218
|
get allowCustomObjectId() {
|
|
286
219
|
return _CoreManager.default.get('ALLOW_CUSTOM_OBJECT_ID');
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
Parse.ACL = require('./ParseACL').default;
|
|
223
|
+
Parse.Analytics = require('./Analytics');
|
|
224
|
+
Parse.AnonymousUtils = require('./AnonymousUtils').default;
|
|
225
|
+
Parse.Cloud = require('./Cloud');
|
|
226
|
+
Parse.CLP = require('./ParseCLP').default;
|
|
227
|
+
Parse.CoreManager = require('./CoreManager');
|
|
228
|
+
Parse.Config = require('./ParseConfig').default;
|
|
229
|
+
Parse.Error = require('./ParseError').default;
|
|
230
|
+
Parse.EventuallyQueue = _EventuallyQueue.default;
|
|
231
|
+
Parse.FacebookUtils = require('./FacebookUtils').default;
|
|
232
|
+
Parse.File = require('./ParseFile').default;
|
|
233
|
+
Parse.GeoPoint = require('./ParseGeoPoint').default;
|
|
234
|
+
Parse.Polygon = require('./ParsePolygon').default;
|
|
235
|
+
Parse.Installation = require('./ParseInstallation').default;
|
|
236
|
+
Parse.LocalDatastore = require('./LocalDatastore');
|
|
237
|
+
Parse.Object = require('./ParseObject').default;
|
|
238
|
+
Parse.Op = {
|
|
239
|
+
Set: ParseOp.SetOp,
|
|
240
|
+
Unset: ParseOp.UnsetOp,
|
|
241
|
+
Increment: ParseOp.IncrementOp,
|
|
242
|
+
Add: ParseOp.AddOp,
|
|
243
|
+
Remove: ParseOp.RemoveOp,
|
|
244
|
+
AddUnique: ParseOp.AddUniqueOp,
|
|
245
|
+
Relation: ParseOp.RelationOp
|
|
246
|
+
};
|
|
247
|
+
Parse.Push = require('./Push');
|
|
248
|
+
Parse.Query = require('./ParseQuery').default;
|
|
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);
|
|
349
290
|
}
|
|
350
|
-
},
|
|
351
|
-
/**
|
|
352
|
-
* Enable the current user encryption.
|
|
353
|
-
* This must be called before login any user.
|
|
354
|
-
*
|
|
355
|
-
* @static
|
|
356
|
-
*/
|
|
357
|
-
enableEncryptedUser() {
|
|
358
|
-
this.encryptedUser = true;
|
|
359
|
-
},
|
|
360
|
-
/**
|
|
361
|
-
* Flag that indicates whether Encrypted User is enabled.
|
|
362
|
-
*
|
|
363
|
-
* @static
|
|
364
|
-
* @returns {boolean}
|
|
365
|
-
*/
|
|
366
|
-
isEncryptedUserEnabled() {
|
|
367
|
-
return this.encryptedUser;
|
|
368
291
|
}
|
|
369
292
|
};
|
|
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
|
+
};
|
|
370
340
|
_CoreManager.default.setCryptoController(_CryptoController.default);
|
|
371
341
|
_CoreManager.default.setInstallationController(_InstallationController.default);
|
|
372
342
|
_CoreManager.default.setRESTController(_RESTController.default);
|
|
@@ -379,6 +349,4 @@ Parse.Hooks = require('./ParseHooks');
|
|
|
379
349
|
|
|
380
350
|
// For legacy requires, of the form `var Parse = require('parse').Parse`
|
|
381
351
|
Parse.Parse = Parse;
|
|
382
|
-
module.exports = Parse;
|
|
383
|
-
var _default = Parse;
|
|
384
|
-
exports.default = _default;
|
|
352
|
+
module.exports = Parse;
|
package/lib/node/ParseError.js
CHANGED
|
@@ -4,17 +4,9 @@ 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
|
-
}
|
|
13
7
|
/**
|
|
14
8
|
* Constructs a new Parse.Error object with the given code and message.
|
|
15
9
|
*
|
|
16
|
-
* Parse.CoreManager.set('PARSE_ERRORS', [{ code, message }]) can be use to override error messages.
|
|
17
|
-
*
|
|
18
10
|
* @alias Parse.Error
|
|
19
11
|
*/
|
|
20
12
|
class ParseError extends Error {
|
|
@@ -25,15 +17,9 @@ class ParseError extends Error {
|
|
|
25
17
|
constructor(code, message) {
|
|
26
18
|
super(message);
|
|
27
19
|
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
|
-
});
|
|
34
20
|
Object.defineProperty(this, 'message', {
|
|
35
21
|
enumerable: true,
|
|
36
|
-
value:
|
|
22
|
+
value: message
|
|
37
23
|
});
|
|
38
24
|
}
|
|
39
25
|
toString() {
|
package/lib/node/ParseObject.js
CHANGED
|
@@ -1042,7 +1042,7 @@ class ParseObject {
|
|
|
1042
1042
|
/**
|
|
1043
1043
|
* Returns the ACL for this object.
|
|
1044
1044
|
*
|
|
1045
|
-
* @returns {Parse.ACL
|
|
1045
|
+
* @returns {Parse.ACL} An instance of Parse.ACL.
|
|
1046
1046
|
* @see Parse.Object#get
|
|
1047
1047
|
*/
|
|
1048
1048
|
getACL() /*: ?ParseACL*/{
|
package/lib/node/ParseQuery.js
CHANGED
|
@@ -875,10 +875,13 @@ class ParseQuery {
|
|
|
875
875
|
}
|
|
876
876
|
const query = new ParseQuery(this.className);
|
|
877
877
|
query._limit = options.batchSize || 100;
|
|
878
|
-
query._include =
|
|
879
|
-
|
|
878
|
+
query._include = this._include.map(i => {
|
|
879
|
+
return i;
|
|
880
|
+
});
|
|
880
881
|
if (this._select) {
|
|
881
|
-
query._select =
|
|
882
|
+
query._select = this._select.map(s => {
|
|
883
|
+
return s;
|
|
884
|
+
});
|
|
882
885
|
}
|
|
883
886
|
query._hint = this._hint;
|
|
884
887
|
query._where = {};
|
package/lib/node/ParseSchema.js
CHANGED
|
@@ -16,7 +16,7 @@ function _interopRequireDefault(obj) {
|
|
|
16
16
|
* @flow
|
|
17
17
|
*/
|
|
18
18
|
/*:: import type { PermissionsMap } from './ParseCLP';*/
|
|
19
|
-
const FIELD_TYPES = ['String', 'Number', 'Boolean', '
|
|
19
|
+
const FIELD_TYPES = ['String', 'Number', 'Boolean', 'Date', 'File', 'GeoPoint', 'Polygon', 'Array', 'Object', 'Pointer', 'Relation'];
|
|
20
20
|
/*:: type FieldOptions = {
|
|
21
21
|
required: boolean,
|
|
22
22
|
defaultValue: mixed,
|
|
@@ -226,14 +226,6 @@ class ParseSchema {
|
|
|
226
226
|
};
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
|
-
if (type === 'Bytes') {
|
|
230
|
-
if (options && options.defaultValue) {
|
|
231
|
-
fieldOptions.defaultValue = {
|
|
232
|
-
__type: 'Bytes',
|
|
233
|
-
base64: options.defaultValue
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
229
|
this._fields[name] = fieldOptions;
|
|
238
230
|
return this;
|
|
239
231
|
}
|
|
@@ -293,17 +285,6 @@ class ParseSchema {
|
|
|
293
285
|
return this.addField(name, 'Boolean', options);
|
|
294
286
|
}
|
|
295
287
|
|
|
296
|
-
/**
|
|
297
|
-
* Adding Bytes Field
|
|
298
|
-
*
|
|
299
|
-
* @param {string} name Name of the field that will be created on Parse
|
|
300
|
-
* @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
|
|
301
|
-
* @returns {Parse.Schema} Returns the schema, so you can chain this call.
|
|
302
|
-
*/
|
|
303
|
-
addBytes(name /*: string*/, options /*: FieldOptions*/) {
|
|
304
|
-
return this.addField(name, 'Bytes', options);
|
|
305
|
-
}
|
|
306
|
-
|
|
307
288
|
/**
|
|
308
289
|
* Adding Date Field
|
|
309
290
|
*
|
package/lib/node/ParseSession.js
CHANGED
|
@@ -13,6 +13,11 @@ function _interopRequireDefault(obj) {
|
|
|
13
13
|
default: obj
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* @flow
|
|
18
|
+
*/
|
|
19
|
+
/*:: import type { AttributeMap } from './ObjectStateMutations';*/
|
|
20
|
+
/*:: import type { RequestOptions, FullOptions } from './RESTController';*/
|
|
16
21
|
/**
|
|
17
22
|
* <p>A Parse.Session object is a local representation of a revocable session.
|
|
18
23
|
* This class is a subclass of a Parse.Object, and retains the same
|
|
@@ -25,7 +30,7 @@ class ParseSession extends _ParseObject.default {
|
|
|
25
30
|
/**
|
|
26
31
|
* @param {object} attributes The initial set of data to store in the user.
|
|
27
32
|
*/
|
|
28
|
-
constructor(attributes
|
|
33
|
+
constructor(attributes /*: ?AttributeMap*/) {
|
|
29
34
|
super('_Session');
|
|
30
35
|
if (attributes && typeof attributes === 'object') {
|
|
31
36
|
if (!this.set(attributes || {})) {
|
package/lib/node/ParseUser.js
CHANGED
|
@@ -110,14 +110,8 @@ class ParseUser extends _ParseObject.default {
|
|
|
110
110
|
throw new Error('Invalid type: authData field should be an object');
|
|
111
111
|
}
|
|
112
112
|
authData[authType] = options.authData;
|
|
113
|
-
const oldAnonymousData = authData.anonymous;
|
|
114
|
-
this.stripAnonymity();
|
|
115
113
|
const controller = _CoreManager.default.getUserController();
|
|
116
|
-
return controller.linkWith(this, authData, saveOpts)
|
|
117
|
-
delete authData[authType];
|
|
118
|
-
this.restoreAnonimity(oldAnonymousData);
|
|
119
|
-
throw e;
|
|
120
|
-
});
|
|
114
|
+
return controller.linkWith(this, authData, saveOpts);
|
|
121
115
|
} else {
|
|
122
116
|
return new Promise((resolve, reject) => {
|
|
123
117
|
provider.authenticate({
|
|
@@ -306,19 +300,6 @@ class ParseUser extends _ParseObject.default {
|
|
|
306
300
|
const current = await ParseUser.currentAsync();
|
|
307
301
|
return !!current && current.id === this.id;
|
|
308
302
|
}
|
|
309
|
-
stripAnonymity() {
|
|
310
|
-
const authData = this.get('authData');
|
|
311
|
-
if (authData && typeof authData === 'object' && authData.hasOwnProperty('anonymous')) {
|
|
312
|
-
// We need to set anonymous to null instead of deleting it in order to remove it from Parse.
|
|
313
|
-
authData.anonymous = null;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
restoreAnonimity(anonymousData /*: any*/) {
|
|
317
|
-
if (anonymousData) {
|
|
318
|
-
const authData = this.get('authData');
|
|
319
|
-
authData.anonymous = anonymousData;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
303
|
|
|
323
304
|
/**
|
|
324
305
|
* Returns get("username").
|
|
@@ -339,7 +320,12 @@ class ParseUser extends _ParseObject.default {
|
|
|
339
320
|
* @param {string} username
|
|
340
321
|
*/
|
|
341
322
|
setUsername(username /*: string*/) {
|
|
342
|
-
|
|
323
|
+
// Strip anonymity
|
|
324
|
+
const authData = this.get('authData');
|
|
325
|
+
if (authData && typeof authData === 'object' && authData.hasOwnProperty('anonymous')) {
|
|
326
|
+
// We need to set anonymous to null instead of deleting it in order to remove it from Parse.
|
|
327
|
+
authData.anonymous = null;
|
|
328
|
+
}
|
|
343
329
|
this.set('username', username);
|
|
344
330
|
}
|
|
345
331
|
|
|
@@ -454,9 +440,6 @@ class ParseUser extends _ParseObject.default {
|
|
|
454
440
|
if (options.hasOwnProperty('usePost')) {
|
|
455
441
|
loginOptions.usePost = options.usePost;
|
|
456
442
|
}
|
|
457
|
-
if (options.hasOwnProperty('context') && Object.prototype.toString.call(options.context) === '[object Object]') {
|
|
458
|
-
loginOptions.context = options.context;
|
|
459
|
-
}
|
|
460
443
|
const controller = _CoreManager.default.getUserController();
|
|
461
444
|
return controller.logIn(this, loginOptions);
|
|
462
445
|
}
|
|
@@ -655,38 +638,6 @@ class ParseUser extends _ParseObject.default {
|
|
|
655
638
|
return user.logIn(options);
|
|
656
639
|
}
|
|
657
640
|
|
|
658
|
-
/**
|
|
659
|
-
* Logs in a user with a username (or email) and password, and authData. On success, this
|
|
660
|
-
* saves the session to disk, so you can retrieve the currently logged in
|
|
661
|
-
* user using <code>current</code>.
|
|
662
|
-
*
|
|
663
|
-
* @param {string} username The username (or email) to log in with.
|
|
664
|
-
* @param {string} password The password to log in with.
|
|
665
|
-
* @param {object} authData The authData to log in with.
|
|
666
|
-
* @param {object} options
|
|
667
|
-
* @static
|
|
668
|
-
* @returns {Promise} A promise that is fulfilled with the user when
|
|
669
|
-
* the login completes.
|
|
670
|
-
*/
|
|
671
|
-
static logInWithAdditionalAuth(username /*: string*/, password /*: string*/, authData /*: AuthData*/, options /*:: ?: FullOptions*/) {
|
|
672
|
-
if (typeof username !== 'string') {
|
|
673
|
-
return Promise.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Username must be a string.'));
|
|
674
|
-
}
|
|
675
|
-
if (typeof password !== 'string') {
|
|
676
|
-
return Promise.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Password must be a string.'));
|
|
677
|
-
}
|
|
678
|
-
if (Object.prototype.toString.call(authData) !== '[object Object]') {
|
|
679
|
-
return Promise.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Auth must be an object.'));
|
|
680
|
-
}
|
|
681
|
-
const user = new this();
|
|
682
|
-
user._finishFetch({
|
|
683
|
-
username: username,
|
|
684
|
-
password: password,
|
|
685
|
-
authData
|
|
686
|
-
});
|
|
687
|
-
return user.logIn(options);
|
|
688
|
-
}
|
|
689
|
-
|
|
690
641
|
/**
|
|
691
642
|
* Logs in a user with an objectId. On success, this saves the session
|
|
692
643
|
* to disk, so you can retrieve the currently logged in user using
|
|
@@ -1098,8 +1049,7 @@ const DefaultController = {
|
|
|
1098
1049
|
const stateController = _CoreManager.default.getObjectStateController();
|
|
1099
1050
|
const auth = {
|
|
1100
1051
|
username: user.get('username'),
|
|
1101
|
-
password: user.get('password')
|
|
1102
|
-
authData: user.get('authData')
|
|
1052
|
+
password: user.get('password')
|
|
1103
1053
|
};
|
|
1104
1054
|
return RESTController.request(options.usePost ? 'POST' : 'GET', 'login', auth, options).then(response => {
|
|
1105
1055
|
user._migrateId(response.objectId);
|
package/lib/node/Storage.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
3
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
8
4
|
function _interopRequireDefault(obj) {
|
|
9
5
|
return obj && obj.__esModule ? obj : {
|
|
@@ -95,6 +91,4 @@ const Storage = {
|
|
|
95
91
|
}
|
|
96
92
|
};
|
|
97
93
|
module.exports = Storage;
|
|
98
|
-
var _default = Storage;
|
|
99
|
-
exports.default = _default;
|
|
100
94
|
_CoreManager.default.setStorageController(require('./StorageController.default'));
|
|
@@ -24,9 +24,6 @@ function run(name, data, options) {
|
|
|
24
24
|
if (options.sessionToken) {
|
|
25
25
|
requestOptions.sessionToken = options.sessionToken;
|
|
26
26
|
}
|
|
27
|
-
if (options.installationId) {
|
|
28
|
-
requestOptions.installationId = options.installationId;
|
|
29
|
-
}
|
|
30
27
|
if (options.context && typeof options.context === 'object') {
|
|
31
28
|
requestOptions.context = options.context;
|
|
32
29
|
}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
Object.defineProperty(exports, "__esModule", {
|
|
2
|
-
value: true
|
|
3
|
-
});
|
|
4
|
-
exports.default = void 0;
|
|
5
1
|
var config = {
|
|
6
2
|
IS_NODE: typeof process !== 'undefined' && !!process.versions && !!process.versions.node && !process.versions.electron,
|
|
7
3
|
REQUEST_ATTEMPT_LIMIT: 5,
|
|
@@ -12,7 +8,7 @@ var config = {
|
|
|
12
8
|
SERVER_AUTH_TOKEN: null,
|
|
13
9
|
LIVEQUERY_SERVER_URL: null,
|
|
14
10
|
ENCRYPTED_KEY: null,
|
|
15
|
-
VERSION: 'js' + "4.2.0
|
|
11
|
+
VERSION: 'js' + "4.2.0",
|
|
16
12
|
APPLICATION_ID: null,
|
|
17
13
|
JAVASCRIPT_KEY: null,
|
|
18
14
|
MASTER_KEY: null,
|
|
@@ -21,8 +17,7 @@ var config = {
|
|
|
21
17
|
FORCE_REVOCABLE_SESSION: false,
|
|
22
18
|
ENCRYPTED_USER: false,
|
|
23
19
|
IDEMPOTENCY: false,
|
|
24
|
-
ALLOW_CUSTOM_OBJECT_ID: false
|
|
25
|
-
PARSE_ERRORS: []
|
|
20
|
+
ALLOW_CUSTOM_OBJECT_ID: false
|
|
26
21
|
};
|
|
27
22
|
function requireMethods(name, methods, controller) {
|
|
28
23
|
methods.forEach(function (func) {
|
|
@@ -31,7 +26,7 @@ function requireMethods(name, methods, controller) {
|
|
|
31
26
|
}
|
|
32
27
|
});
|
|
33
28
|
}
|
|
34
|
-
|
|
29
|
+
module.exports = {
|
|
35
30
|
get: function (key) {
|
|
36
31
|
if (config.hasOwnProperty(key)) {
|
|
37
32
|
return config[key];
|
|
@@ -189,7 +184,4 @@ var CoreManager = {
|
|
|
189
184
|
getHooksController: function () {
|
|
190
185
|
return config['HooksController'];
|
|
191
186
|
}
|
|
192
|
-
};
|
|
193
|
-
module.exports = CoreManager;
|
|
194
|
-
var _default = CoreManager;
|
|
195
|
-
exports.default = _default;
|
|
187
|
+
};
|