parse 6.1.0-alpha.1 → 6.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.
Files changed (58) hide show
  1. package/dist/parse.js +68 -60
  2. package/dist/parse.min.js +2 -2
  3. package/dist/parse.weapp.js +68 -60
  4. package/dist/parse.weapp.min.js +2 -2
  5. package/lib/browser/Cloud.js +1 -0
  6. package/lib/browser/CoreManager.js +2 -1
  7. package/lib/browser/EventuallyQueue.js +6 -9
  8. package/lib/browser/LiveQuerySubscription.js +4 -4
  9. package/lib/browser/Parse.js +12 -1
  10. package/lib/browser/ParseACL.js +1 -1
  11. package/lib/browser/ParseConfig.js +2 -4
  12. package/lib/browser/ParseLiveQuery.js +2 -2
  13. package/lib/browser/ParseObject.js +10 -10
  14. package/lib/browser/ParseQuery.js +7 -8
  15. package/lib/browser/ParseRole.js +1 -1
  16. package/lib/browser/ParseSchema.js +6 -6
  17. package/lib/browser/ParseUser.js +10 -12
  18. package/lib/browser/RESTController.js +3 -0
  19. package/lib/node/Cloud.js +1 -0
  20. package/lib/node/CoreManager.js +2 -1
  21. package/lib/node/EventuallyQueue.js +6 -6
  22. package/lib/node/LiveQuerySubscription.js +4 -4
  23. package/lib/node/Parse.js +12 -1
  24. package/lib/node/ParseACL.js +1 -1
  25. package/lib/node/ParseConfig.js +2 -2
  26. package/lib/node/ParseLiveQuery.js +2 -2
  27. package/lib/node/ParseObject.js +10 -7
  28. package/lib/node/ParseQuery.js +7 -7
  29. package/lib/node/ParseRole.js +1 -1
  30. package/lib/node/ParseSchema.js +6 -4
  31. package/lib/node/ParseUser.js +10 -10
  32. package/lib/node/RESTController.js +3 -0
  33. package/lib/react-native/CoreManager.js +2 -1
  34. package/lib/react-native/EventuallyQueue.js +5 -8
  35. package/lib/react-native/LiveQuerySubscription.js +7 -7
  36. package/lib/react-native/Parse.js +8 -1
  37. package/lib/react-native/ParseConfig.js +2 -4
  38. package/lib/react-native/ParseLiveQuery.js +2 -2
  39. package/lib/react-native/ParseObject.js +16 -18
  40. package/lib/react-native/ParseQuery.js +5 -6
  41. package/lib/react-native/ParseSchema.js +5 -6
  42. package/lib/react-native/ParseUser.js +3 -5
  43. package/lib/react-native/RESTController.js +3 -0
  44. package/lib/weapp/Cloud.js +1 -0
  45. package/lib/weapp/CoreManager.js +2 -1
  46. package/lib/weapp/EventuallyQueue.js +6 -9
  47. package/lib/weapp/LiveQuerySubscription.js +4 -4
  48. package/lib/weapp/Parse.js +12 -1
  49. package/lib/weapp/ParseACL.js +1 -1
  50. package/lib/weapp/ParseConfig.js +2 -4
  51. package/lib/weapp/ParseLiveQuery.js +2 -2
  52. package/lib/weapp/ParseObject.js +10 -10
  53. package/lib/weapp/ParseQuery.js +7 -8
  54. package/lib/weapp/ParseRole.js +1 -1
  55. package/lib/weapp/ParseSchema.js +6 -6
  56. package/lib/weapp/ParseUser.js +10 -12
  57. package/lib/weapp/RESTController.js +3 -0
  58. package/package.json +6 -5
@@ -48,6 +48,7 @@ var _ParseObject = _interopRequireDefault(require("./ParseObject"));
48
48
  * @returns {Promise} A promise that will be resolved with the result
49
49
  * of the function.
50
50
  */
51
+
51
52
  function run(name, data, options) {
52
53
  if (typeof name !== 'string' || name.length === 0) {
53
54
  throw new TypeError('Cloud function name must be a string.');
@@ -19,9 +19,10 @@ const config = {
19
19
  SERVER_AUTH_TOKEN: null,
20
20
  LIVEQUERY_SERVER_URL: null,
21
21
  ENCRYPTED_KEY: null,
22
- VERSION: 'js' + "6.1.0-alpha.1",
22
+ VERSION: 'js' + "6.1.0-alpha.2",
23
23
  APPLICATION_ID: null,
24
24
  JAVASCRIPT_KEY: null,
25
+ MAINTENANCE_KEY: null,
25
26
  MASTER_KEY: null,
26
27
  USE_MASTER_KEY: false,
27
28
  PERFORM_USER_REWRITE: true,
@@ -40,8 +40,7 @@ const EventuallyQueue = {
40
40
  * @static
41
41
  * @see Parse.Object#saveEventually
42
42
  */
43
- save(object) {
44
- let serverOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
43
+ save(object, serverOptions) {
45
44
  return this.enqueue('save', object, serverOptions);
46
45
  },
47
46
  /**
@@ -55,8 +54,7 @@ const EventuallyQueue = {
55
54
  * @static
56
55
  * @see Parse.Object#destroyEventually
57
56
  */
58
- destroy(object) {
59
- let serverOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
57
+ destroy(object, serverOptions) {
60
58
  return this.enqueue('destroy', object, serverOptions);
61
59
  },
62
60
  /**
@@ -106,7 +104,7 @@ const EventuallyQueue = {
106
104
  queueId,
107
105
  action,
108
106
  object: object.toJSON(),
109
- serverOptions,
107
+ serverOptions: serverOptions || {},
110
108
  id: object.id,
111
109
  className: object.className,
112
110
  hash: object.get('hash'),
@@ -125,7 +123,7 @@ const EventuallyQueue = {
125
123
  *
126
124
  * @function getQueue
127
125
  * @name Parse.EventuallyQueue.getQueue
128
- * @returns {Promise<QueueObject[]>}
126
+ * @returns {Promise<Queue>}
129
127
  * @static
130
128
  */
131
129
  async getQueue() {
@@ -280,8 +278,7 @@ const EventuallyQueue = {
280
278
  * @param [ms] Milliseconds to ping the server. Default 2000ms
281
279
  * @static
282
280
  */
283
- poll() {
284
- let ms = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 2000;
281
+ poll(ms) {
285
282
  if (polling) {
286
283
  return;
287
284
  }
@@ -296,7 +293,7 @@ const EventuallyQueue = {
296
293
  return this.sendQueue();
297
294
  }
298
295
  }).catch(e => e);
299
- }, ms);
296
+ }, ms || 2000);
300
297
  },
301
298
  /**
302
299
  * Turns off polling.
@@ -91,7 +91,7 @@ var _promiseUtils = require("./promiseUtils");
91
91
  *
92
92
  * });</pre></p>
93
93
  */
94
- class Subscription {
94
+ class LiveQuerySubscription {
95
95
  /*
96
96
  * @param {string | number} id - subscription id
97
97
  * @param {string} query - query to subscribe to
@@ -114,8 +114,8 @@ class Subscription {
114
114
  this.subscribePromise = (0, _promiseUtils.resolvingPromise)();
115
115
  this.unsubscribePromise = (0, _promiseUtils.resolvingPromise)();
116
116
  this.subscribed = false;
117
- const EventEmitter = _CoreManager.default.getEventEmitter();
118
- this.emitter = new EventEmitter();
117
+ const Emitter = _CoreManager.default.getEventEmitter();
118
+ this.emitter = new Emitter();
119
119
  this.on = (eventName, listener) => this.emitter.on(eventName, listener);
120
120
  this.emit = function (eventName) {
121
121
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
@@ -140,4 +140,4 @@ class Subscription {
140
140
  });
141
141
  }
142
142
  }
143
- var _default = exports.default = Subscription;
143
+ var _default = exports.default = LiveQuerySubscription;
@@ -132,9 +132,10 @@ const Parse = {
132
132
  }
133
133
  Parse._initialize(applicationId, javaScriptKey);
134
134
  },
135
- _initialize(applicationId, javaScriptKey, masterKey) {
135
+ _initialize(applicationId, javaScriptKey, masterKey, maintenanceKey) {
136
136
  _CoreManager.default.set('APPLICATION_ID', applicationId);
137
137
  _CoreManager.default.set('JAVASCRIPT_KEY', javaScriptKey);
138
+ _CoreManager.default.set('MAINTENANCE_KEY', maintenanceKey);
138
139
  _CoreManager.default.set('MASTER_KEY', masterKey);
139
140
  _CoreManager.default.set('USE_MASTER_KEY', false);
140
141
  _CoreManager.default.setIfNeeded('EventEmitter', _EventEmitter.default);
@@ -207,6 +208,16 @@ const Parse = {
207
208
  get masterKey() {
208
209
  return _CoreManager.default.get('MASTER_KEY');
209
210
  },
211
+ /**
212
+ * @member {string} Parse.maintenanceKey
213
+ * @static
214
+ */
215
+ set maintenanceKey(value) {
216
+ _CoreManager.default.set('MAINTENANCE_KEY', value);
217
+ },
218
+ get maintenanceKey() {
219
+ return _CoreManager.default.get('MAINTENANCE_KEY');
220
+ },
210
221
  /**
211
222
  * @member {string} Parse.serverURL
212
223
  * @static
@@ -27,7 +27,7 @@ const PUBLIC_KEY = '*';
27
27
  */
28
28
  class ParseACL {
29
29
  /**
30
- * @param {(Parse.User | object)} arg1 The user to initialize the ACL for
30
+ * @param {(Parse.User | object | null)} arg1 The user to initialize the ACL for
31
31
  */
32
32
  constructor(arg1) {
33
33
  (0, _defineProperty2.default)(this, "permissionsById", void 0);
@@ -84,8 +84,7 @@ class ParseConfig {
84
84
  * @returns {Promise} A promise that is resolved with a newly-created
85
85
  * configuration object when the get completes.
86
86
  */
87
- static get() {
88
- let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
87
+ static get(options) {
89
88
  const controller = _CoreManager.default.getConfigController();
90
89
  return controller.get(options);
91
90
  }
@@ -166,8 +165,7 @@ const DefaultController = {
166
165
  return config;
167
166
  });
168
167
  },
169
- get() {
170
- let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
168
+ get(options) {
171
169
  const RESTController = _CoreManager.default.getRESTController();
172
170
  return RESTController.request('GET', 'config', {}, options).then(response => {
173
171
  if (!response || !response.params) {
@@ -48,8 +48,8 @@ class LiveQuery {
48
48
  (0, _defineProperty2.default)(this, "emitter", void 0);
49
49
  (0, _defineProperty2.default)(this, "on", void 0);
50
50
  (0, _defineProperty2.default)(this, "emit", void 0);
51
- const EventEmitter = _CoreManager.default.getEventEmitter();
52
- this.emitter = new EventEmitter();
51
+ const Emitter = _CoreManager.default.getEventEmitter();
52
+ this.emitter = new Emitter();
53
53
  this.on = (eventName, listener) => this.emitter.on(eventName, listener);
54
54
  this.emit = function (eventName) {
55
55
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
@@ -214,7 +214,7 @@ class ParseObject {
214
214
  id = this._getId();
215
215
  }
216
216
  return {
217
- id: id,
217
+ id,
218
218
  className: this.className
219
219
  };
220
220
  } else {
@@ -440,6 +440,9 @@ class ParseObject {
440
440
  if (hasOwn(options, 'useMasterKey')) {
441
441
  requestOptions.useMasterKey = !!options.useMasterKey;
442
442
  }
443
+ if (hasOwn(options, 'useMaintenanceKey')) {
444
+ requestOptions.useMaintenanceKey = !!options.useMaintenanceKey;
445
+ }
443
446
  if (hasOwn(options, 'sessionToken') && typeof options.sessionToken === 'string') {
444
447
  requestOptions.sessionToken = options.sessionToken;
445
448
  }
@@ -1274,6 +1277,7 @@ class ParseObject {
1274
1277
  * @returns {Promise} A promise that is fulfilled when the save
1275
1278
  * completes.
1276
1279
  */
1280
+
1277
1281
  async save(arg1, arg2, arg3) {
1278
1282
  let attrs;
1279
1283
  let options;
@@ -1304,9 +1308,8 @@ class ParseObject {
1304
1308
  const filePromise = unsavedFiles.length ? controller.save(unsavedFiles, saveOptions) : _promise.default.resolve();
1305
1309
  return filePromise.then(() => controller.save(unsavedObjects, saveOptions)).then(savedOjbects => savedOjbects.pop());
1306
1310
  }
1307
- return controller.save(unsaved, saveOptions).then(() => {
1308
- return controller.save(this, saveOptions);
1309
- });
1311
+ await controller.save(unsaved, saveOptions);
1312
+ return controller.save(this, saveOptions);
1310
1313
  }
1311
1314
 
1312
1315
  /**
@@ -1512,8 +1515,7 @@ class ParseObject {
1512
1515
  * @static
1513
1516
  * @returns {Parse.Object[]}
1514
1517
  */
1515
- static fetchAll(list) {
1516
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1518
+ static fetchAll(list, options) {
1517
1519
  const fetchOptions = ParseObject._getRequestOptions(options);
1518
1520
  return _CoreManager.default.getObjectController().fetch(list, true, fetchOptions);
1519
1521
  }
@@ -1692,8 +1694,7 @@ class ParseObject {
1692
1694
  * @returns {Promise} A promise that is fulfilled when the destroyAll
1693
1695
  * completes.
1694
1696
  */
1695
- static destroyAll(list) {
1696
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1697
+ static destroyAll(list, options) {
1697
1698
  const destroyOptions = ParseObject._getRequestOptions(options);
1698
1699
  return _CoreManager.default.getObjectController().destroy(list, destroyOptions);
1699
1700
  }
@@ -1727,8 +1728,7 @@ class ParseObject {
1727
1728
  * @static
1728
1729
  * @returns {Parse.Object[]}
1729
1730
  */
1730
- static saveAll(list) {
1731
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1731
+ static saveAll(list, options) {
1732
1732
  const saveOptions = ParseObject._getRequestOptions(options);
1733
1733
  return _CoreManager.default.getObjectController().save(list, saveOptions);
1734
1734
  }
@@ -1137,11 +1137,11 @@ class ParseQuery {
1137
1137
  * be contained in the provided list of values.
1138
1138
  *
1139
1139
  * @param {string} key The key to check.
1140
- * @param {Array<*>} value The values that will match.
1140
+ * @param {Array<*>} values The values that will match.
1141
1141
  * @returns {Parse.Query} Returns the query, so you can chain this call.
1142
1142
  */
1143
- containedIn(key, value) {
1144
- return this._addCondition(key, '$in', value);
1143
+ containedIn(key, values) {
1144
+ return this._addCondition(key, '$in', values);
1145
1145
  }
1146
1146
 
1147
1147
  /**
@@ -1149,11 +1149,11 @@ class ParseQuery {
1149
1149
  * not be contained in the provided list of values.
1150
1150
  *
1151
1151
  * @param {string} key The key to check.
1152
- * @param {Array<*>} value The values that will not match.
1152
+ * @param {Array<*>} values The values that will not match.
1153
1153
  * @returns {Parse.Query} Returns the query, so you can chain this call.
1154
1154
  */
1155
- notContainedIn(key, value) {
1156
- return this._addCondition(key, '$nin', value);
1155
+ notContainedIn(key, values) {
1156
+ return this._addCondition(key, '$nin', values);
1157
1157
  }
1158
1158
 
1159
1159
  /**
@@ -1363,8 +1363,7 @@ class ParseQuery {
1363
1363
  * @param {boolean} options.diacriticSensitive A boolean flag to enable or disable diacritic sensitive search.
1364
1364
  * @returns {Parse.Query} Returns the query, so you can chain this call.
1365
1365
  */
1366
- fullText(key, value) {
1367
- let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1366
+ fullText(key, value, options) {
1368
1367
  options = options || {};
1369
1368
  if (!key) {
1370
1369
  throw new Error('A key is required.');
@@ -66,7 +66,7 @@ class ParseRole extends _ParseObject.default {
66
66
  * @param {string} name The name of the role.
67
67
  * @param {object} options Standard options object with success and error
68
68
  * callbacks.
69
- * @returns {(ParseObject|boolean)} true if the set succeeded.
69
+ * @returns {Parse.Object} Returns the object, so you can chain this call.
70
70
  */
71
71
  setName(name, options) {
72
72
  this._validateName(name);
@@ -12,6 +12,7 @@ var _CoreManager = _interopRequireDefault(require("./CoreManager"));
12
12
  var _ParseObject = _interopRequireDefault(require("./ParseObject"));
13
13
  var _ParseCLP = _interopRequireDefault(require("./ParseCLP"));
14
14
  const FIELD_TYPES = ['String', 'Number', 'Boolean', 'Bytes', 'Date', 'File', 'GeoPoint', 'Polygon', 'Array', 'Object', 'Pointer', 'Relation'];
15
+
15
16
  /**
16
17
  * A Parse.Schema object is for handling schema data from Parse.
17
18
  * <p>All the schemas methods require MasterKey.
@@ -186,9 +187,9 @@ class ParseSchema {
186
187
  * </ul>
187
188
  * @returns {Parse.Schema} Returns the schema, so you can chain this call.
188
189
  */
189
- addField(name, type) {
190
- let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
190
+ addField(name, type, options) {
191
191
  type = type || 'String';
192
+ options = options || {};
192
193
  if (!name) {
193
194
  throw new Error('field name may not be null.');
194
195
  }
@@ -370,8 +371,7 @@ class ParseSchema {
370
371
  * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
371
372
  * @returns {Parse.Schema} Returns the schema, so you can chain this call.
372
373
  */
373
- addPointer(name, targetClass) {
374
- let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
374
+ addPointer(name, targetClass, options) {
375
375
  if (!name) {
376
376
  throw new Error('field name may not be null.');
377
377
  }
@@ -382,10 +382,10 @@ class ParseSchema {
382
382
  type: 'Pointer',
383
383
  targetClass
384
384
  };
385
- if (typeof options.required === 'boolean') {
385
+ if (typeof options?.required === 'boolean') {
386
386
  fieldOptions.required = options.required;
387
387
  }
388
- if (options.defaultValue !== undefined) {
388
+ if (options?.defaultValue !== undefined) {
389
389
  fieldOptions.defaultValue = options.defaultValue;
390
390
  if (options.defaultValue instanceof _ParseObject.default) {
391
391
  fieldOptions.defaultValue = options.defaultValue.toPointer();
@@ -586,7 +586,7 @@ class ParseUser extends _ParseObject.default {
586
586
  * either from memory or localStorage, if necessary.
587
587
  *
588
588
  * @static
589
- * @returns {Parse.Object} The currently logged in Parse.User.
589
+ * @returns {Parse.User} The currently logged in Parse.User.
590
590
  */
591
591
  static current() {
592
592
  if (!canUseCurrentUser) {
@@ -653,8 +653,8 @@ class ParseUser extends _ParseObject.default {
653
653
  }
654
654
  const user = new this();
655
655
  user._finishFetch({
656
- username: username,
657
- password: password
656
+ username,
657
+ password
658
658
  });
659
659
  return user.logIn(options);
660
660
  }
@@ -684,8 +684,8 @@ class ParseUser extends _ParseObject.default {
684
684
  }
685
685
  const user = new this();
686
686
  user._finishFetch({
687
- username: username,
688
- password: password,
687
+ username,
688
+ password,
689
689
  authData
690
690
  });
691
691
  return user.logIn(options);
@@ -742,8 +742,7 @@ class ParseUser extends _ParseObject.default {
742
742
  * @static
743
743
  * @returns {Promise} A promise that is fulfilled with the user is fetched.
744
744
  */
745
- static me(sessionToken) {
746
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
745
+ static me(sessionToken, options) {
747
746
  const controller = _CoreManager.default.getUserController();
748
747
  const meOptions = _ParseObject.default._getRequestOptions(options);
749
748
  meOptions.sessionToken = sessionToken;
@@ -792,8 +791,7 @@ class ParseUser extends _ParseObject.default {
792
791
  * @returns {Promise} A promise that is resolved when the session is
793
792
  * destroyed on the server.
794
793
  */
795
- static logOut() {
796
- let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
794
+ static logOut(options) {
797
795
  const controller = _CoreManager.default.getUserController();
798
796
  return controller.logOut(options);
799
797
  }
@@ -1154,7 +1152,7 @@ const DefaultController = {
1154
1152
  },
1155
1153
  logOut(options) {
1156
1154
  const RESTController = _CoreManager.default.getRESTController();
1157
- if (options.sessionToken) {
1155
+ if (options?.sessionToken) {
1158
1156
  return RESTController.request('POST', 'logout', {}, options);
1159
1157
  }
1160
1158
  return DefaultController.currentUserAsync().then(currentUser => {
@@ -1182,7 +1180,7 @@ const DefaultController = {
1182
1180
  requestPasswordReset(email, options) {
1183
1181
  const RESTController = _CoreManager.default.getRESTController();
1184
1182
  return RESTController.request('POST', 'requestPasswordReset', {
1185
- email: email
1183
+ email
1186
1184
  }, options);
1187
1185
  },
1188
1186
  async upgradeToRevocableSession(user, options) {
@@ -1226,7 +1224,7 @@ const DefaultController = {
1226
1224
  requestEmailVerification(email, options) {
1227
1225
  const RESTController = _CoreManager.default.getRESTController();
1228
1226
  return RESTController.request('POST', 'verificationEmailRequest', {
1229
- email: email
1227
+ email
1230
1228
  }, options);
1231
1229
  }
1232
1230
  };
@@ -233,6 +233,9 @@ const RESTController = {
233
233
  throw new Error('Cannot use the Master Key, it has not been provided.');
234
234
  }
235
235
  }
236
+ if (options.useMaintenanceKey) {
237
+ payload._MaintenanceKey = _CoreManager.default.get('MAINTENANCE_KEY');
238
+ }
236
239
  if (_CoreManager.default.get('FORCE_REVOCABLE_SESSION')) {
237
240
  payload._RevocableSession = '1';
238
241
  }
package/lib/node/Cloud.js CHANGED
@@ -49,6 +49,7 @@ function _interopRequireDefault(e) {
49
49
  * @returns {Promise} A promise that will be resolved with the result
50
50
  * of the function.
51
51
  */
52
+
52
53
  function run(name, data, options) {
53
54
  if (typeof name !== 'string' || name.length === 0) {
54
55
  throw new TypeError('Cloud function name must be a string.');
@@ -16,9 +16,10 @@ const config = {
16
16
  SERVER_AUTH_TOKEN: null,
17
17
  LIVEQUERY_SERVER_URL: null,
18
18
  ENCRYPTED_KEY: null,
19
- VERSION: 'js' + "6.1.0-alpha.1",
19
+ VERSION: 'js' + "6.1.0-alpha.2",
20
20
  APPLICATION_ID: null,
21
21
  JAVASCRIPT_KEY: null,
22
+ MAINTENANCE_KEY: null,
22
23
  MASTER_KEY: null,
23
24
  USE_MASTER_KEY: false,
24
25
  PERFORM_USER_REWRITE: true,
@@ -38,7 +38,7 @@ const EventuallyQueue = {
38
38
  * @static
39
39
  * @see Parse.Object#saveEventually
40
40
  */
41
- save(object, serverOptions = {}) {
41
+ save(object, serverOptions) {
42
42
  return this.enqueue('save', object, serverOptions);
43
43
  },
44
44
  /**
@@ -52,7 +52,7 @@ const EventuallyQueue = {
52
52
  * @static
53
53
  * @see Parse.Object#destroyEventually
54
54
  */
55
- destroy(object, serverOptions = {}) {
55
+ destroy(object, serverOptions) {
56
56
  return this.enqueue('destroy', object, serverOptions);
57
57
  },
58
58
  /**
@@ -102,7 +102,7 @@ const EventuallyQueue = {
102
102
  queueId,
103
103
  action,
104
104
  object: object.toJSON(),
105
- serverOptions,
105
+ serverOptions: serverOptions || {},
106
106
  id: object.id,
107
107
  className: object.className,
108
108
  hash: object.get('hash'),
@@ -121,7 +121,7 @@ const EventuallyQueue = {
121
121
  *
122
122
  * @function getQueue
123
123
  * @name Parse.EventuallyQueue.getQueue
124
- * @returns {Promise<QueueObject[]>}
124
+ * @returns {Promise<Queue>}
125
125
  * @static
126
126
  */
127
127
  async getQueue() {
@@ -276,7 +276,7 @@ const EventuallyQueue = {
276
276
  * @param [ms] Milliseconds to ping the server. Default 2000ms
277
277
  * @static
278
278
  */
279
- poll(ms = 2000) {
279
+ poll(ms) {
280
280
  if (polling) {
281
281
  return;
282
282
  }
@@ -290,7 +290,7 @@ const EventuallyQueue = {
290
290
  return this.sendQueue();
291
291
  }
292
292
  }).catch(e => e);
293
- }, ms);
293
+ }, ms || 2000);
294
294
  },
295
295
  /**
296
296
  * Turns off polling.
@@ -93,7 +93,7 @@ function _interopRequireDefault(e) {
93
93
  *
94
94
  * });</pre></p>
95
95
  */
96
- class Subscription {
96
+ class LiveQuerySubscription {
97
97
  /*
98
98
  * @param {string | number} id - subscription id
99
99
  * @param {string} query - query to subscribe to
@@ -106,8 +106,8 @@ class Subscription {
106
106
  this.subscribePromise = (0, _promiseUtils.resolvingPromise)();
107
107
  this.unsubscribePromise = (0, _promiseUtils.resolvingPromise)();
108
108
  this.subscribed = false;
109
- const EventEmitter = _CoreManager.default.getEventEmitter();
110
- this.emitter = new EventEmitter();
109
+ const Emitter = _CoreManager.default.getEventEmitter();
110
+ this.emitter = new Emitter();
111
111
  this.on = (eventName, listener) => this.emitter.on(eventName, listener);
112
112
  this.emit = (eventName, ...args) => this.emitter.emit(eventName, ...args);
113
113
  // adding listener so process does not crash
@@ -127,4 +127,4 @@ class Subscription {
127
127
  });
128
128
  }
129
129
  }
130
- var _default = exports.default = Subscription;
130
+ var _default = exports.default = LiveQuerySubscription;
package/lib/node/Parse.js CHANGED
@@ -130,9 +130,10 @@ const Parse = {
130
130
  initialize(applicationId, javaScriptKey) {
131
131
  Parse._initialize(applicationId, javaScriptKey);
132
132
  },
133
- _initialize(applicationId, javaScriptKey, masterKey) {
133
+ _initialize(applicationId, javaScriptKey, masterKey, maintenanceKey) {
134
134
  _CoreManager.default.set('APPLICATION_ID', applicationId);
135
135
  _CoreManager.default.set('JAVASCRIPT_KEY', javaScriptKey);
136
+ _CoreManager.default.set('MAINTENANCE_KEY', maintenanceKey);
136
137
  _CoreManager.default.set('MASTER_KEY', masterKey);
137
138
  _CoreManager.default.set('USE_MASTER_KEY', false);
138
139
  _CoreManager.default.setIfNeeded('EventEmitter', _EventEmitter.default);
@@ -204,6 +205,16 @@ const Parse = {
204
205
  get masterKey() {
205
206
  return _CoreManager.default.get('MASTER_KEY');
206
207
  },
208
+ /**
209
+ * @member {string} Parse.maintenanceKey
210
+ * @static
211
+ */
212
+ set maintenanceKey(value) {
213
+ _CoreManager.default.set('MAINTENANCE_KEY', value);
214
+ },
215
+ get maintenanceKey() {
216
+ return _CoreManager.default.get('MAINTENANCE_KEY');
217
+ },
207
218
  /**
208
219
  * @member {string} Parse.serverURL
209
220
  * @static
@@ -28,7 +28,7 @@ const PUBLIC_KEY = '*';
28
28
  */
29
29
  class ParseACL {
30
30
  /**
31
- * @param {(Parse.User | object)} arg1 The user to initialize the ACL for
31
+ * @param {(Parse.User | object | null)} arg1 The user to initialize the ACL for
32
32
  */
33
33
  constructor(arg1) {
34
34
  this.permissionsById = {};
@@ -82,7 +82,7 @@ class ParseConfig {
82
82
  * @returns {Promise} A promise that is resolved with a newly-created
83
83
  * configuration object when the get completes.
84
84
  */
85
- static get(options = {}) {
85
+ static get(options) {
86
86
  const controller = _CoreManager.default.getConfigController();
87
87
  return controller.get(options);
88
88
  }
@@ -163,7 +163,7 @@ const DefaultController = {
163
163
  return config;
164
164
  });
165
165
  },
166
- get(options = {}) {
166
+ get(options) {
167
167
  const RESTController = _CoreManager.default.getRESTController();
168
168
  return RESTController.request('GET', 'config', {}, options).then(response => {
169
169
  if (!response || !response.params) {
@@ -44,8 +44,8 @@ function getLiveQueryClient() {
44
44
  */
45
45
  class LiveQuery {
46
46
  constructor() {
47
- const EventEmitter = _CoreManager.default.getEventEmitter();
48
- this.emitter = new EventEmitter();
47
+ const Emitter = _CoreManager.default.getEventEmitter();
48
+ this.emitter = new Emitter();
49
49
  this.on = (eventName, listener) => this.emitter.on(eventName, listener);
50
50
  this.emit = (eventName, ...args) => this.emitter.emit(eventName, ...args);
51
51
  // adding listener so process does not crash
@@ -198,7 +198,7 @@ class ParseObject {
198
198
  id = this._getId();
199
199
  }
200
200
  return {
201
- id: id,
201
+ id,
202
202
  className: this.className
203
203
  };
204
204
  } else {
@@ -423,6 +423,9 @@ class ParseObject {
423
423
  if (hasOwn(options, 'useMasterKey')) {
424
424
  requestOptions.useMasterKey = !!options.useMasterKey;
425
425
  }
426
+ if (hasOwn(options, 'useMaintenanceKey')) {
427
+ requestOptions.useMaintenanceKey = !!options.useMaintenanceKey;
428
+ }
426
429
  if (hasOwn(options, 'sessionToken') && typeof options.sessionToken === 'string') {
427
430
  requestOptions.sessionToken = options.sessionToken;
428
431
  }
@@ -1254,6 +1257,7 @@ class ParseObject {
1254
1257
  * @returns {Promise} A promise that is fulfilled when the save
1255
1258
  * completes.
1256
1259
  */
1260
+
1257
1261
  async save(arg1, arg2, arg3) {
1258
1262
  let attrs;
1259
1263
  let options;
@@ -1284,9 +1288,8 @@ class ParseObject {
1284
1288
  const filePromise = unsavedFiles.length ? controller.save(unsavedFiles, saveOptions) : Promise.resolve();
1285
1289
  return filePromise.then(() => controller.save(unsavedObjects, saveOptions)).then(savedOjbects => savedOjbects.pop());
1286
1290
  }
1287
- return controller.save(unsaved, saveOptions).then(() => {
1288
- return controller.save(this, saveOptions);
1289
- });
1291
+ await controller.save(unsaved, saveOptions);
1292
+ return controller.save(this, saveOptions);
1290
1293
  }
1291
1294
 
1292
1295
  /**
@@ -1492,7 +1495,7 @@ class ParseObject {
1492
1495
  * @static
1493
1496
  * @returns {Parse.Object[]}
1494
1497
  */
1495
- static fetchAll(list, options = {}) {
1498
+ static fetchAll(list, options) {
1496
1499
  const fetchOptions = ParseObject._getRequestOptions(options);
1497
1500
  return _CoreManager.default.getObjectController().fetch(list, true, fetchOptions);
1498
1501
  }
@@ -1670,7 +1673,7 @@ class ParseObject {
1670
1673
  * @returns {Promise} A promise that is fulfilled when the destroyAll
1671
1674
  * completes.
1672
1675
  */
1673
- static destroyAll(list, options = {}) {
1676
+ static destroyAll(list, options) {
1674
1677
  const destroyOptions = ParseObject._getRequestOptions(options);
1675
1678
  return _CoreManager.default.getObjectController().destroy(list, destroyOptions);
1676
1679
  }
@@ -1704,7 +1707,7 @@ class ParseObject {
1704
1707
  * @static
1705
1708
  * @returns {Parse.Object[]}
1706
1709
  */
1707
- static saveAll(list, options = {}) {
1710
+ static saveAll(list, options) {
1708
1711
  const saveOptions = ParseObject._getRequestOptions(options);
1709
1712
  return _CoreManager.default.getObjectController().save(list, saveOptions);
1710
1713
  }