parse 6.1.0-alpha.1 → 6.1.0-alpha.3

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 (213) hide show
  1. package/README.md +0 -8
  2. package/dist/parse.js +93 -105
  3. package/dist/parse.min.js +2 -2
  4. package/dist/parse.weapp.js +93 -105
  5. package/dist/parse.weapp.min.js +2 -2
  6. package/lib/browser/Cloud.js +1 -0
  7. package/lib/browser/CoreManager.js +2 -2
  8. package/lib/browser/CryptoController.js +0 -1
  9. package/lib/browser/EventEmitter.js +0 -1
  10. package/lib/browser/EventuallyQueue.js +6 -10
  11. package/lib/browser/IndexedDBStorageController.js +0 -1
  12. package/lib/browser/InstallationController.js +0 -1
  13. package/lib/browser/LiveQuerySubscription.js +4 -4
  14. package/lib/browser/LocalDatastore.js +0 -1
  15. package/lib/browser/LocalDatastoreController.default.js +0 -1
  16. package/lib/browser/LocalDatastoreController.js +0 -1
  17. package/lib/browser/LocalDatastoreController.react-native.js +0 -1
  18. package/lib/browser/OfflineQuery.js +0 -1
  19. package/lib/browser/Parse.js +12 -1
  20. package/lib/browser/ParseACL.js +1 -1
  21. package/lib/browser/ParseConfig.js +2 -4
  22. package/lib/browser/ParseInstallation.js +0 -1
  23. package/lib/browser/ParseLiveQuery.js +2 -2
  24. package/lib/browser/ParseObject.js +10 -10
  25. package/lib/browser/ParseQuery.js +26 -25
  26. package/lib/browser/ParseRole.js +1 -1
  27. package/lib/browser/ParseSchema.js +6 -6
  28. package/lib/browser/ParseUser.js +10 -12
  29. package/lib/browser/RESTController.js +7 -3
  30. package/lib/browser/Socket.weapp.js +0 -1
  31. package/lib/browser/Storage.js +0 -1
  32. package/lib/browser/StorageController.browser.js +0 -1
  33. package/lib/browser/StorageController.default.js +0 -1
  34. package/lib/browser/StorageController.js +0 -1
  35. package/lib/browser/StorageController.react-native.js +0 -1
  36. package/lib/browser/StorageController.weapp.js +0 -1
  37. package/lib/browser/TaskQueue.js +0 -1
  38. package/lib/browser/WebSocketController.js +0 -1
  39. package/lib/browser/Xhr.weapp.js +0 -1
  40. package/lib/browser/uuid.js +0 -1
  41. package/lib/node/Cloud.js +1 -0
  42. package/lib/node/CoreManager.js +2 -2
  43. package/lib/node/CryptoController.js +0 -1
  44. package/lib/node/EventEmitter.js +0 -1
  45. package/lib/node/EventuallyQueue.js +6 -7
  46. package/lib/node/IndexedDBStorageController.js +0 -1
  47. package/lib/node/InstallationController.js +0 -1
  48. package/lib/node/LiveQuerySubscription.js +4 -4
  49. package/lib/node/LocalDatastore.js +0 -1
  50. package/lib/node/LocalDatastoreController.default.js +0 -1
  51. package/lib/node/LocalDatastoreController.js +0 -1
  52. package/lib/node/LocalDatastoreController.react-native.js +0 -1
  53. package/lib/node/OfflineQuery.js +0 -1
  54. package/lib/node/Parse.js +12 -1
  55. package/lib/node/ParseACL.js +1 -1
  56. package/lib/node/ParseConfig.js +2 -2
  57. package/lib/node/ParseInstallation.js +0 -1
  58. package/lib/node/ParseLiveQuery.js +2 -2
  59. package/lib/node/ParseObject.js +10 -7
  60. package/lib/node/ParseQuery.js +7 -7
  61. package/lib/node/ParseRole.js +1 -1
  62. package/lib/node/ParseSchema.js +6 -4
  63. package/lib/node/ParseUser.js +10 -10
  64. package/lib/node/RESTController.js +3 -1
  65. package/lib/node/Socket.weapp.js +0 -1
  66. package/lib/node/Storage.js +0 -1
  67. package/lib/node/StorageController.browser.js +0 -1
  68. package/lib/node/StorageController.default.js +0 -1
  69. package/lib/node/StorageController.js +0 -1
  70. package/lib/node/StorageController.react-native.js +0 -1
  71. package/lib/node/StorageController.weapp.js +0 -1
  72. package/lib/node/TaskQueue.js +0 -1
  73. package/lib/node/WebSocketController.js +0 -1
  74. package/lib/node/Xhr.weapp.js +0 -1
  75. package/lib/node/uuid.js +0 -1
  76. package/lib/react-native/CoreManager.js +2 -2
  77. package/lib/react-native/CryptoController.js +0 -1
  78. package/lib/react-native/EventEmitter.js +0 -1
  79. package/lib/react-native/EventuallyQueue.js +5 -9
  80. package/lib/react-native/IndexedDBStorageController.js +0 -1
  81. package/lib/react-native/InstallationController.js +0 -1
  82. package/lib/react-native/LiveQuerySubscription.js +7 -7
  83. package/lib/react-native/LocalDatastore.js +0 -1
  84. package/lib/react-native/LocalDatastoreController.default.js +0 -1
  85. package/lib/react-native/LocalDatastoreController.js +0 -1
  86. package/lib/react-native/LocalDatastoreController.react-native.js +0 -1
  87. package/lib/react-native/OfflineQuery.js +0 -1
  88. package/lib/react-native/Parse.js +8 -1
  89. package/lib/react-native/ParseConfig.js +2 -4
  90. package/lib/react-native/ParseInstallation.js +0 -1
  91. package/lib/react-native/ParseLiveQuery.js +2 -2
  92. package/lib/react-native/ParseObject.js +16 -18
  93. package/lib/react-native/ParseQuery.js +5 -6
  94. package/lib/react-native/ParseSchema.js +5 -6
  95. package/lib/react-native/ParseUser.js +3 -5
  96. package/lib/react-native/RESTController.js +3 -1
  97. package/lib/react-native/Socket.weapp.js +0 -1
  98. package/lib/react-native/Storage.js +0 -1
  99. package/lib/react-native/StorageController.browser.js +0 -1
  100. package/lib/react-native/StorageController.default.js +0 -1
  101. package/lib/react-native/StorageController.js +0 -1
  102. package/lib/react-native/StorageController.react-native.js +0 -1
  103. package/lib/react-native/StorageController.weapp.js +0 -1
  104. package/lib/react-native/TaskQueue.js +0 -1
  105. package/lib/react-native/WebSocketController.js +0 -1
  106. package/lib/react-native/Xhr.weapp.js +0 -1
  107. package/lib/react-native/uuid.js +0 -1
  108. package/lib/weapp/Cloud.js +1 -0
  109. package/lib/weapp/CoreManager.js +2 -2
  110. package/lib/weapp/CryptoController.js +0 -1
  111. package/lib/weapp/EventEmitter.js +0 -1
  112. package/lib/weapp/EventuallyQueue.js +6 -10
  113. package/lib/weapp/IndexedDBStorageController.js +0 -1
  114. package/lib/weapp/InstallationController.js +0 -1
  115. package/lib/weapp/LiveQuerySubscription.js +4 -4
  116. package/lib/weapp/LocalDatastore.js +0 -1
  117. package/lib/weapp/LocalDatastoreController.default.js +0 -1
  118. package/lib/weapp/LocalDatastoreController.js +0 -1
  119. package/lib/weapp/LocalDatastoreController.react-native.js +0 -1
  120. package/lib/weapp/OfflineQuery.js +0 -1
  121. package/lib/weapp/Parse.js +12 -1
  122. package/lib/weapp/ParseACL.js +1 -1
  123. package/lib/weapp/ParseConfig.js +2 -4
  124. package/lib/weapp/ParseInstallation.js +0 -1
  125. package/lib/weapp/ParseLiveQuery.js +2 -2
  126. package/lib/weapp/ParseObject.js +10 -10
  127. package/lib/weapp/ParseQuery.js +26 -25
  128. package/lib/weapp/ParseRole.js +1 -1
  129. package/lib/weapp/ParseSchema.js +6 -6
  130. package/lib/weapp/ParseUser.js +10 -12
  131. package/lib/weapp/RESTController.js +7 -3
  132. package/lib/weapp/Socket.weapp.js +0 -1
  133. package/lib/weapp/Storage.js +0 -1
  134. package/lib/weapp/StorageController.browser.js +0 -1
  135. package/lib/weapp/StorageController.default.js +0 -1
  136. package/lib/weapp/StorageController.js +0 -1
  137. package/lib/weapp/StorageController.react-native.js +0 -1
  138. package/lib/weapp/StorageController.weapp.js +0 -1
  139. package/lib/weapp/TaskQueue.js +0 -1
  140. package/lib/weapp/WebSocketController.js +0 -1
  141. package/lib/weapp/Xhr.weapp.js +0 -1
  142. package/lib/weapp/uuid.js +0 -1
  143. package/package.json +15 -12
  144. package/types/Analytics.d.ts +42 -0
  145. package/types/AnonymousUtils.d.ts +84 -0
  146. package/types/Cloud.d.ts +65 -0
  147. package/types/CloudCode.d.ts +307 -0
  148. package/types/CoreManager.d.ts +325 -0
  149. package/types/CryptoController.d.ts +5 -0
  150. package/types/EventEmitter.d.ts +5 -0
  151. package/types/EventuallyQueue.d.ts +168 -0
  152. package/types/FacebookUtils.d.ts +107 -0
  153. package/types/IndexedDBStorageController.d.ts +2 -0
  154. package/types/InstallationController.d.ts +10 -0
  155. package/types/LiveQueryClient.d.ts +128 -0
  156. package/types/LiveQuerySubscription.d.ts +103 -0
  157. package/types/LocalDatastore.d.ts +56 -0
  158. package/types/LocalDatastoreController.d.ts +2 -0
  159. package/types/LocalDatastoreController.default.d.ts +9 -0
  160. package/types/LocalDatastoreController.react-native.d.ts +9 -0
  161. package/types/LocalDatastoreUtils.d.ts +5 -0
  162. package/types/ObjectStateMutations.d.ts +28 -0
  163. package/types/OfflineQuery.d.ts +20 -0
  164. package/types/Parse.d.ts +633 -0
  165. package/types/ParseACL.d.ts +141 -0
  166. package/types/ParseCLP.d.ts +293 -0
  167. package/types/ParseConfig.d.ts +77 -0
  168. package/types/ParseError.d.ts +476 -0
  169. package/types/ParseFile.d.ts +192 -0
  170. package/types/ParseGeoPoint.d.ts +104 -0
  171. package/types/ParseHooks.d.ts +27 -0
  172. package/types/ParseInstallation.d.ts +179 -0
  173. package/types/ParseLiveQuery.d.ts +48 -0
  174. package/types/ParseObject.d.ts +1072 -0
  175. package/types/ParseOp.d.ts +78 -0
  176. package/types/ParsePolygon.d.ts +69 -0
  177. package/types/ParseQuery.d.ts +961 -0
  178. package/types/ParseRelation.d.ts +56 -0
  179. package/types/ParseRole.d.ts +79 -0
  180. package/types/ParseSchema.d.ts +286 -0
  181. package/types/ParseSession.d.ts +45 -0
  182. package/types/ParseUser.d.ts +517 -0
  183. package/types/Push.d.ts +62 -0
  184. package/types/RESTController.d.ts +35 -0
  185. package/types/SingleInstanceStateController.d.ts +24 -0
  186. package/types/Socket.weapp.d.ts +10 -0
  187. package/types/Storage.d.ts +14 -0
  188. package/types/StorageController.browser.d.ts +9 -0
  189. package/types/StorageController.d.ts +2 -0
  190. package/types/StorageController.default.d.ts +9 -0
  191. package/types/StorageController.react-native.d.ts +11 -0
  192. package/types/StorageController.weapp.d.ts +9 -0
  193. package/types/TaskQueue.d.ts +11 -0
  194. package/types/UniqueInstanceStateController.d.ts +20 -0
  195. package/types/WebSocketController.d.ts +2 -0
  196. package/types/Xhr.weapp.d.ts +29 -0
  197. package/types/arrayContainsObject.d.ts +2 -0
  198. package/types/canBeSerialized.d.ts +2 -0
  199. package/types/decode.d.ts +1 -0
  200. package/types/encode.d.ts +1 -0
  201. package/types/equals.d.ts +1 -0
  202. package/types/escape.d.ts +1 -0
  203. package/types/index.d.ts +66 -0
  204. package/types/isRevocableSession.d.ts +1 -0
  205. package/types/node.d.ts +3 -0
  206. package/types/parseDate.d.ts +1 -0
  207. package/types/promiseUtils.d.ts +9 -0
  208. package/types/react-native.d.ts +3 -0
  209. package/types/tests.ts +2256 -0
  210. package/types/tsconfig.json +25 -0
  211. package/types/unique.d.ts +1 -0
  212. package/types/unsavedChildren.d.ts +11 -0
  213. package/types/uuid.d.ts +2 -0
@@ -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.3",
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,
@@ -254,5 +255,4 @@ const CoreManager = {
254
255
  return config['ParseUser'];
255
256
  }
256
257
  };
257
- module.exports = CoreManager;
258
258
  var _default = exports.default = CoreManager;
@@ -21,5 +21,4 @@ const CryptoController = {
21
21
  return decryptedStr;
22
22
  }
23
23
  };
24
- module.exports = CryptoController;
25
24
  var _default = exports.default = CryptoController;
@@ -15,5 +15,4 @@ try {
15
15
  } catch (_) {
16
16
  // EventEmitter unavailable
17
17
  }
18
- module.exports = EventEmitter;
19
18
  var _default = exports.default = EventEmitter;
@@ -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.
@@ -355,5 +352,4 @@ const EventuallyQueue = {
355
352
  }
356
353
  }
357
354
  };
358
- module.exports = EventuallyQueue;
359
355
  var _default = exports.default = EventuallyQueue;
@@ -39,5 +39,4 @@ if (typeof window !== 'undefined' && window.indexedDB) {
39
39
  // IndexedDB not supported
40
40
  IndexedDBStorageController = undefined;
41
41
  }
42
- module.exports = IndexedDBStorageController;
43
42
  var _default = exports.default = IndexedDBStorageController;
@@ -78,5 +78,4 @@ const InstallationController = {
78
78
  currentInstallationCacheMatchesDisk = matchesDisk;
79
79
  }
80
80
  };
81
- module.exports = InstallationController;
82
81
  var _default = exports.default = InstallationController;
@@ -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;
@@ -380,7 +380,6 @@ const LocalDatastore = {
380
380
  return this.isEnabled;
381
381
  }
382
382
  };
383
- module.exports = LocalDatastore;
384
383
  var _default = exports.default = LocalDatastore;
385
384
  _CoreManager.default.setLocalDatastoreController(_LocalDatastoreController.default);
386
385
  _CoreManager.default.setLocalDatastore(LocalDatastore);
@@ -65,5 +65,4 @@ const LocalDatastoreController = {
65
65
  return _promise.default.all(promises);
66
66
  }
67
67
  };
68
- module.exports = LocalDatastoreController;
69
68
  var _default = exports.default = LocalDatastoreController;
@@ -9,5 +9,4 @@ exports.default = void 0;
9
9
  var _LocalDatastoreController = _interopRequireDefault(require("./LocalDatastoreController.react-native"));
10
10
  var _LocalDatastoreController2 = _interopRequireDefault(require("./LocalDatastoreController.default"));
11
11
  let LocalDatastoreController = _LocalDatastoreController2.default;
12
- module.exports = LocalDatastoreController;
13
12
  var _default = exports.default = LocalDatastoreController;
@@ -83,5 +83,4 @@ const LocalDatastoreController = {
83
83
  await _StorageController.default.multiRemove(batch).catch(error => console.error('Error clearing local datastore: ', error));
84
84
  }
85
85
  };
86
- module.exports = LocalDatastoreController;
87
86
  var _default = exports.default = LocalDatastoreController;
@@ -549,5 +549,4 @@ const OfflineQuery = {
549
549
  matchesQuery: matchesQuery,
550
550
  validateQuery: validateQuery
551
551
  };
552
- module.exports = OfflineQuery;
553
552
  var _default = exports.default = OfflineQuery;
@@ -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) {
@@ -287,5 +287,4 @@ class ParseInstallation extends _ParseObject.default {
287
287
  }
288
288
  }
289
289
  _ParseObject.default.registerSubclass('_Installation', ParseInstallation);
290
- module.exports = ParseInstallation;
291
290
  var _default = exports.default = ParseInstallation;
@@ -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
  }
@@ -20,6 +20,7 @@ var _sort = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stabl
20
20
  var _splice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/splice"));
21
21
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
22
22
  var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find"));
23
+ var _bind = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/bind"));
23
24
  var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
24
25
  var _entries = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/entries"));
25
26
  var _CoreManager = _interopRequireDefault(require("./CoreManager"));
@@ -598,11 +599,12 @@ class ParseQuery {
598
599
  return this._handleOfflineQuery(this.toJSON());
599
600
  }
600
601
  return (0, _find.default)(controller).call(controller, this.className, this.toJSON(), findOptions).then(response => {
602
+ var _context4, _context5;
601
603
  // Return generic object when explain is used
602
604
  if (this._explain) {
603
605
  return response.results;
604
606
  }
605
- const results = response.results?.map(data => {
607
+ const results = ((_context4 = response.results) == null ? void 0 : (0, _bind.default)(_context5 = Function.call).call(_context5, (0, _map.default)(_context4), _context4))?.(data => {
606
608
  // In cases of relations, the server may send back a className
607
609
  // on the top level of the payload
608
610
  const override = response.className || this.className;
@@ -1050,8 +1052,8 @@ class ParseQuery {
1050
1052
  */
1051
1053
  equalTo(key, value) {
1052
1054
  if (key && typeof key === 'object') {
1053
- var _context4;
1054
- (0, _forEach.default)(_context4 = (0, _entries.default)(key)).call(_context4, _ref => {
1055
+ var _context6;
1056
+ (0, _forEach.default)(_context6 = (0, _entries.default)(key)).call(_context6, _ref => {
1055
1057
  let [k, val] = _ref;
1056
1058
  return this.equalTo(k, val);
1057
1059
  });
@@ -1074,8 +1076,8 @@ class ParseQuery {
1074
1076
  */
1075
1077
  notEqualTo(key, value) {
1076
1078
  if (key && typeof key === 'object') {
1077
- var _context5;
1078
- (0, _forEach.default)(_context5 = (0, _entries.default)(key)).call(_context5, _ref2 => {
1079
+ var _context7;
1080
+ (0, _forEach.default)(_context7 = (0, _entries.default)(key)).call(_context7, _ref2 => {
1079
1081
  let [k, val] = _ref2;
1080
1082
  return this.notEqualTo(k, val);
1081
1083
  });
@@ -1137,11 +1139,11 @@ class ParseQuery {
1137
1139
  * be contained in the provided list of values.
1138
1140
  *
1139
1141
  * @param {string} key The key to check.
1140
- * @param {Array<*>} value The values that will match.
1142
+ * @param {Array<*>} values The values that will match.
1141
1143
  * @returns {Parse.Query} Returns the query, so you can chain this call.
1142
1144
  */
1143
- containedIn(key, value) {
1144
- return this._addCondition(key, '$in', value);
1145
+ containedIn(key, values) {
1146
+ return this._addCondition(key, '$in', values);
1145
1147
  }
1146
1148
 
1147
1149
  /**
@@ -1149,11 +1151,11 @@ class ParseQuery {
1149
1151
  * not be contained in the provided list of values.
1150
1152
  *
1151
1153
  * @param {string} key The key to check.
1152
- * @param {Array<*>} value The values that will not match.
1154
+ * @param {Array<*>} values The values that will not match.
1153
1155
  * @returns {Parse.Query} Returns the query, so you can chain this call.
1154
1156
  */
1155
- notContainedIn(key, value) {
1156
- return this._addCondition(key, '$nin', value);
1157
+ notContainedIn(key, values) {
1158
+ return this._addCondition(key, '$nin', values);
1157
1159
  }
1158
1160
 
1159
1161
  /**
@@ -1363,8 +1365,7 @@ class ParseQuery {
1363
1365
  * @param {boolean} options.diacriticSensitive A boolean flag to enable or disable diacritic sensitive search.
1364
1366
  * @returns {Parse.Query} Returns the query, so you can chain this call.
1365
1367
  */
1366
- fullText(key, value) {
1367
- let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1368
+ fullText(key, value, options) {
1368
1369
  options = options || {};
1369
1370
  if (!key) {
1370
1371
  throw new Error('A key is required.');
@@ -1603,11 +1604,11 @@ class ParseQuery {
1603
1604
  keys[_key2] = arguments[_key2];
1604
1605
  }
1605
1606
  (0, _forEach.default)(keys).call(keys, key => {
1606
- var _context6;
1607
+ var _context8;
1607
1608
  if ((0, _isArray.default)(key)) {
1608
1609
  key = key.join();
1609
1610
  }
1610
- this._order = (0, _concat.default)(_context6 = this._order).call(_context6, key.replace(/\s/g, '').split(','));
1611
+ this._order = (0, _concat.default)(_context8 = this._order).call(_context8, key.replace(/\s/g, '').split(','));
1611
1612
  });
1612
1613
  return this;
1613
1614
  }
@@ -1643,11 +1644,11 @@ class ParseQuery {
1643
1644
  keys[_key4] = arguments[_key4];
1644
1645
  }
1645
1646
  (0, _forEach.default)(keys).call(keys, key => {
1646
- var _context7, _context8;
1647
+ var _context9, _context10;
1647
1648
  if ((0, _isArray.default)(key)) {
1648
1649
  key = key.join();
1649
1650
  }
1650
- this._order = (0, _concat.default)(_context7 = this._order).call(_context7, (0, _map.default)(_context8 = key.replace(/\s/g, '').split(',')).call(_context8, k => {
1651
+ this._order = (0, _concat.default)(_context9 = this._order).call(_context9, (0, _map.default)(_context10 = key.replace(/\s/g, '').split(',')).call(_context10, k => {
1651
1652
  return '-' + k;
1652
1653
  }));
1653
1654
  });
@@ -1720,8 +1721,8 @@ class ParseQuery {
1720
1721
  }
1721
1722
  (0, _forEach.default)(keys).call(keys, key => {
1722
1723
  if ((0, _isArray.default)(key)) {
1723
- var _context9;
1724
- this._include = (0, _concat.default)(_context9 = this._include).call(_context9, key);
1724
+ var _context11;
1725
+ this._include = (0, _concat.default)(_context11 = this._include).call(_context11, key);
1725
1726
  } else {
1726
1727
  this._include.push(key);
1727
1728
  }
@@ -1757,8 +1758,8 @@ class ParseQuery {
1757
1758
  }
1758
1759
  (0, _forEach.default)(keys).call(keys, key => {
1759
1760
  if ((0, _isArray.default)(key)) {
1760
- var _context10;
1761
- this._select = (0, _concat.default)(_context10 = this._select).call(_context10, key);
1761
+ var _context12;
1762
+ this._select = (0, _concat.default)(_context12 = this._select).call(_context12, key);
1762
1763
  } else {
1763
1764
  this._select.push(key);
1764
1765
  }
@@ -1781,8 +1782,8 @@ class ParseQuery {
1781
1782
  }
1782
1783
  (0, _forEach.default)(keys).call(keys, key => {
1783
1784
  if ((0, _isArray.default)(key)) {
1784
- var _context11;
1785
- this._exclude = (0, _concat.default)(_context11 = this._exclude).call(_context11, key);
1785
+ var _context13;
1786
+ this._exclude = (0, _concat.default)(_context13 = this._exclude).call(_context13, key);
1786
1787
  } else {
1787
1788
  this._exclude.push(key);
1788
1789
  }
@@ -1804,8 +1805,8 @@ class ParseQuery {
1804
1805
  }
1805
1806
  (0, _forEach.default)(keys).call(keys, key => {
1806
1807
  if ((0, _isArray.default)(key)) {
1807
- var _context12;
1808
- this._watch = (0, _concat.default)(_context12 = this._watch).call(_context12, key);
1808
+ var _context14;
1809
+ this._watch = (0, _concat.default)(_context14 = this._watch).call(_context14, key);
1809
1810
  } else {
1810
1811
  this._watch.push(key);
1811
1812
  }
@@ -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
  };
@@ -9,8 +9,9 @@ exports.default = void 0;
9
9
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
10
10
  var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/json/stringify"));
11
11
  var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
12
- var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
13
12
  var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
13
+ var _bind = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/bind"));
14
+ var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
14
15
  var _setTimeout2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set-timeout"));
15
16
  var _uuid = _interopRequireDefault(require("./uuid"));
16
17
  var _CoreManager = _interopRequireDefault(require("./CoreManager"));
@@ -93,10 +94,11 @@ const RESTController = {
93
94
  if (xhr.status >= 200 && xhr.status < 300) {
94
95
  let response;
95
96
  try {
97
+ var _context2, _context3;
96
98
  response = JSON.parse(xhr.responseText);
97
99
  const availableHeaders = typeof xhr.getAllResponseHeaders === 'function' ? xhr.getAllResponseHeaders() : '';
98
100
  headers = {};
99
- if (typeof xhr.getResponseHeader === 'function' && availableHeaders?.indexOf('access-control-expose-headers') >= 0) {
101
+ if (typeof xhr.getResponseHeader === 'function' && ((_context2 = availableHeaders) == null ? void 0 : (0, _bind.default)(_context3 = Function.call).call(_context3, (0, _indexOf.default)(_context2), _context2))?.('access-control-expose-headers') >= 0) {
100
102
  const responseHeaders = xhr.getResponseHeader('access-control-expose-headers').split(', ');
101
103
  (0, _forEach.default)(responseHeaders).call(responseHeaders, header => {
102
104
  if ((0, _indexOf.default)(availableHeaders).call(availableHeaders, header.toLowerCase()) >= 0) {
@@ -233,6 +235,9 @@ const RESTController = {
233
235
  throw new Error('Cannot use the Master Key, it has not been provided.');
234
236
  }
235
237
  }
238
+ if (options.useMaintenanceKey) {
239
+ payload._MaintenanceKey = _CoreManager.default.get('MAINTENANCE_KEY');
240
+ }
236
241
  if (_CoreManager.default.get('FORCE_REVOCABLE_SESSION')) {
237
242
  payload._RevocableSession = '1';
238
243
  }
@@ -308,5 +313,4 @@ const RESTController = {
308
313
  return XHR;
309
314
  }
310
315
  };
311
- module.exports = RESTController;
312
316
  var _default = exports.default = RESTController;
@@ -57,5 +57,4 @@ class SocketWeapp {
57
57
  wx.closeSocket();
58
58
  }
59
59
  }
60
- module.exports = SocketWeapp;
61
60
  var _default = exports.default = SocketWeapp;