parse 4.2.0-alpha.6 → 4.2.0-alpha.7

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.
@@ -187,7 +187,7 @@ var config /*: Config & { [key: string]: mixed }*/ = {
187
187
  SERVER_AUTH_TOKEN: null,
188
188
  LIVEQUERY_SERVER_URL: null,
189
189
  ENCRYPTED_KEY: null,
190
- VERSION: 'js' + "4.2.0-alpha.6",
190
+ VERSION: 'js' + "4.2.0-alpha.7",
191
191
  APPLICATION_ID: null,
192
192
  JAVASCRIPT_KEY: null,
193
193
  MASTER_KEY: null,
@@ -175,7 +175,9 @@ function estimateAttributes(serverData /*: AttributeMap*/, pendingOps /*: Array<
175
175
  function nestedSet(obj, key, value) {
176
176
  var path = key.split('.');
177
177
  for (var i = 0; i < path.length - 1; i++) {
178
- if (!(path[i] in obj)) obj[path[i]] = {};
178
+ if (!(path[i] in obj)) {
179
+ obj[path[i]] = {};
180
+ }
179
181
  obj = obj[path[i]];
180
182
  }
181
183
  if (typeof value === 'undefined') {
@@ -607,7 +607,7 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
607
607
  var _distance = point.radiansTo(centerPoint);
608
608
  return _distance <= maxDistance;
609
609
  }
610
- break;
610
+ return false;
611
611
  }
612
612
  case '$geoIntersects':
613
613
  {
@@ -1271,7 +1271,7 @@ var ParseObject = /*#__PURE__*/function () {
1271
1271
  /**
1272
1272
  * Returns the ACL for this object.
1273
1273
  *
1274
- * @returns {Parse.ACL} An instance of Parse.ACL.
1274
+ * @returns {Parse.ACL|null} An instance of Parse.ACL.
1275
1275
  * @see Parse.Object#get
1276
1276
  */
1277
1277
  }, {
@@ -155,8 +155,14 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
155
155
  throw new Error('Invalid type: authData field should be an object');
156
156
  }
157
157
  authData[authType] = options.authData;
158
+ var oldAnonymousData = authData.anonymous;
159
+ this.stripAnonymity();
158
160
  var controller = _CoreManager.default.getUserController();
159
- return controller.linkWith(this, authData, saveOpts);
161
+ return controller.linkWith(this, authData, saveOpts).catch(function (e) {
162
+ delete authData[authType];
163
+ _this2.restoreAnonimity(oldAnonymousData);
164
+ throw e;
165
+ });
160
166
  } else {
161
167
  return new _promise.default(function (resolve, reject) {
162
168
  provider.authenticate({
@@ -387,6 +393,24 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
387
393
  }
388
394
  return isCurrentAsync;
389
395
  }()
396
+ }, {
397
+ key: "stripAnonymity",
398
+ value: function () {
399
+ var authData = this.get('authData');
400
+ if (authData && (0, _typeof2.default)(authData) === 'object' && authData.hasOwnProperty('anonymous')) {
401
+ // We need to set anonymous to null instead of deleting it in order to remove it from Parse.
402
+ authData.anonymous = null;
403
+ }
404
+ }
405
+ }, {
406
+ key: "restoreAnonimity",
407
+ value: function (anonymousData /*: any*/) {
408
+ if (anonymousData) {
409
+ var authData = this.get('authData');
410
+ authData.anonymous = anonymousData;
411
+ }
412
+ }
413
+
390
414
  /**
391
415
  * Returns get("username").
392
416
  *
@@ -410,12 +434,7 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
410
434
  }, {
411
435
  key: "setUsername",
412
436
  value: function (username /*: string*/) {
413
- // Strip anonymity
414
- var authData = this.get('authData');
415
- if (authData && (0, _typeof2.default)(authData) === 'object' && authData.hasOwnProperty('anonymous')) {
416
- // We need to set anonymous to null instead of deleting it in order to remove it from Parse.
417
- authData.anonymous = null;
418
- }
437
+ this.stripAnonymity();
419
438
  this.set('username', username);
420
439
  }
421
440
 
@@ -183,7 +183,7 @@ const config /*: Config & { [key: string]: mixed }*/ = {
183
183
  SERVER_AUTH_TOKEN: null,
184
184
  LIVEQUERY_SERVER_URL: null,
185
185
  ENCRYPTED_KEY: null,
186
- VERSION: 'js' + "4.2.0-alpha.6",
186
+ VERSION: 'js' + "4.2.0-alpha.7",
187
187
  APPLICATION_ID: null,
188
188
  JAVASCRIPT_KEY: null,
189
189
  MASTER_KEY: null,
@@ -150,7 +150,9 @@ function estimateAttributes(serverData /*: AttributeMap*/, pendingOps /*: Array<
150
150
  function nestedSet(obj, key, value) {
151
151
  const path = key.split('.');
152
152
  for (let i = 0; i < path.length - 1; i++) {
153
- if (!(path[i] in obj)) obj[path[i]] = {};
153
+ if (!(path[i] in obj)) {
154
+ obj[path[i]] = {};
155
+ }
154
156
  obj = obj[path[i]];
155
157
  }
156
158
  if (typeof value === 'undefined') {
@@ -493,7 +493,7 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
493
493
  const distance = point.radiansTo(centerPoint);
494
494
  return distance <= maxDistance;
495
495
  }
496
- break;
496
+ return false;
497
497
  }
498
498
  case '$geoIntersects':
499
499
  {
@@ -1042,7 +1042,7 @@ class ParseObject {
1042
1042
  /**
1043
1043
  * Returns the ACL for this object.
1044
1044
  *
1045
- * @returns {Parse.ACL} An instance of Parse.ACL.
1045
+ * @returns {Parse.ACL|null} An instance of Parse.ACL.
1046
1046
  * @see Parse.Object#get
1047
1047
  */
1048
1048
  getACL() /*: ?ParseACL*/{
@@ -110,8 +110,14 @@ 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();
113
115
  const controller = _CoreManager.default.getUserController();
114
- return controller.linkWith(this, authData, saveOpts);
116
+ return controller.linkWith(this, authData, saveOpts).catch(e => {
117
+ delete authData[authType];
118
+ this.restoreAnonimity(oldAnonymousData);
119
+ throw e;
120
+ });
115
121
  } else {
116
122
  return new Promise((resolve, reject) => {
117
123
  provider.authenticate({
@@ -300,6 +306,19 @@ class ParseUser extends _ParseObject.default {
300
306
  const current = await ParseUser.currentAsync();
301
307
  return !!current && current.id === this.id;
302
308
  }
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
+ }
303
322
 
304
323
  /**
305
324
  * Returns get("username").
@@ -320,12 +339,7 @@ class ParseUser extends _ParseObject.default {
320
339
  * @param {string} username
321
340
  */
322
341
  setUsername(username /*: string*/) {
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
- }
342
+ this.stripAnonymity();
329
343
  this.set('username', username);
330
344
  }
331
345
 
@@ -12,7 +12,7 @@ var config = {
12
12
  SERVER_AUTH_TOKEN: null,
13
13
  LIVEQUERY_SERVER_URL: null,
14
14
  ENCRYPTED_KEY: null,
15
- VERSION: 'js' + "4.2.0-alpha.6",
15
+ VERSION: 'js' + "4.2.0-alpha.7",
16
16
  APPLICATION_ID: null,
17
17
  JAVASCRIPT_KEY: null,
18
18
  MASTER_KEY: null,
@@ -125,7 +125,9 @@ function estimateAttributes(serverData, pendingOps, className, id) {
125
125
  function nestedSet(obj, key, value) {
126
126
  var path = key.split('.');
127
127
  for (var i = 0; i < path.length - 1; i++) {
128
- if (!(path[i] in obj)) obj[path[i]] = {};
128
+ if (!(path[i] in obj)) {
129
+ obj[path[i]] = {};
130
+ }
129
131
  obj = obj[path[i]];
130
132
  }
131
133
  if (typeof value === 'undefined') {
@@ -430,7 +430,7 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
430
430
  var _distance = point.radiansTo(centerPoint);
431
431
  return _distance <= maxDistance;
432
432
  }
433
- break;
433
+ return false;
434
434
  }
435
435
  case '$geoIntersects':
436
436
  {
@@ -103,8 +103,14 @@ var ParseUser = function (_ParseObject) {
103
103
  throw new Error('Invalid type: authData field should be an object');
104
104
  }
105
105
  authData[authType] = options.authData;
106
+ var oldAnonymousData = authData.anonymous;
107
+ this.stripAnonymity();
106
108
  var controller = _CoreManager.default.getUserController();
107
- return controller.linkWith(this, authData, saveOpts);
109
+ return controller.linkWith(this, authData, saveOpts).catch(function (e) {
110
+ delete authData[authType];
111
+ _this2.restoreAnonimity(oldAnonymousData);
112
+ throw e;
113
+ });
108
114
  } else {
109
115
  return new Promise(function (resolve, reject) {
110
116
  provider.authenticate({
@@ -254,6 +260,22 @@ var ParseUser = function (_ParseObject) {
254
260
  }
255
261
  return isCurrentAsync;
256
262
  }()
263
+ }, {
264
+ key: "stripAnonymity",
265
+ value: function () {
266
+ var authData = this.get('authData');
267
+ if (authData && typeof authData === 'object' && authData.hasOwnProperty('anonymous')) {
268
+ authData.anonymous = null;
269
+ }
270
+ }
271
+ }, {
272
+ key: "restoreAnonimity",
273
+ value: function (anonymousData) {
274
+ if (anonymousData) {
275
+ var authData = this.get('authData');
276
+ authData.anonymous = anonymousData;
277
+ }
278
+ }
257
279
  }, {
258
280
  key: "getUsername",
259
281
  value: function () {
@@ -266,10 +288,7 @@ var ParseUser = function (_ParseObject) {
266
288
  }, {
267
289
  key: "setUsername",
268
290
  value: function (username) {
269
- var authData = this.get('authData');
270
- if (authData && typeof authData === 'object' && authData.hasOwnProperty('anonymous')) {
271
- authData.anonymous = null;
272
- }
291
+ this.stripAnonymity();
273
292
  this.set('username', username);
274
293
  }
275
294
  }, {
@@ -187,7 +187,7 @@ var config /*: Config & { [key: string]: mixed }*/ = {
187
187
  SERVER_AUTH_TOKEN: null,
188
188
  LIVEQUERY_SERVER_URL: null,
189
189
  ENCRYPTED_KEY: null,
190
- VERSION: 'js' + "4.2.0-alpha.6",
190
+ VERSION: 'js' + "4.2.0-alpha.7",
191
191
  APPLICATION_ID: null,
192
192
  JAVASCRIPT_KEY: null,
193
193
  MASTER_KEY: null,
@@ -175,7 +175,9 @@ function estimateAttributes(serverData /*: AttributeMap*/, pendingOps /*: Array<
175
175
  function nestedSet(obj, key, value) {
176
176
  var path = key.split('.');
177
177
  for (var i = 0; i < path.length - 1; i++) {
178
- if (!(path[i] in obj)) obj[path[i]] = {};
178
+ if (!(path[i] in obj)) {
179
+ obj[path[i]] = {};
180
+ }
179
181
  obj = obj[path[i]];
180
182
  }
181
183
  if (typeof value === 'undefined') {
@@ -607,7 +607,7 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
607
607
  var _distance = point.radiansTo(centerPoint);
608
608
  return _distance <= maxDistance;
609
609
  }
610
- break;
610
+ return false;
611
611
  }
612
612
  case '$geoIntersects':
613
613
  {
@@ -1271,7 +1271,7 @@ var ParseObject = /*#__PURE__*/function () {
1271
1271
  /**
1272
1272
  * Returns the ACL for this object.
1273
1273
  *
1274
- * @returns {Parse.ACL} An instance of Parse.ACL.
1274
+ * @returns {Parse.ACL|null} An instance of Parse.ACL.
1275
1275
  * @see Parse.Object#get
1276
1276
  */
1277
1277
  }, {
@@ -155,8 +155,14 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
155
155
  throw new Error('Invalid type: authData field should be an object');
156
156
  }
157
157
  authData[authType] = options.authData;
158
+ var oldAnonymousData = authData.anonymous;
159
+ this.stripAnonymity();
158
160
  var controller = _CoreManager.default.getUserController();
159
- return controller.linkWith(this, authData, saveOpts);
161
+ return controller.linkWith(this, authData, saveOpts).catch(function (e) {
162
+ delete authData[authType];
163
+ _this2.restoreAnonimity(oldAnonymousData);
164
+ throw e;
165
+ });
160
166
  } else {
161
167
  return new _promise.default(function (resolve, reject) {
162
168
  provider.authenticate({
@@ -387,6 +393,24 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
387
393
  }
388
394
  return isCurrentAsync;
389
395
  }()
396
+ }, {
397
+ key: "stripAnonymity",
398
+ value: function () {
399
+ var authData = this.get('authData');
400
+ if (authData && (0, _typeof2.default)(authData) === 'object' && authData.hasOwnProperty('anonymous')) {
401
+ // We need to set anonymous to null instead of deleting it in order to remove it from Parse.
402
+ authData.anonymous = null;
403
+ }
404
+ }
405
+ }, {
406
+ key: "restoreAnonimity",
407
+ value: function (anonymousData /*: any*/) {
408
+ if (anonymousData) {
409
+ var authData = this.get('authData');
410
+ authData.anonymous = anonymousData;
411
+ }
412
+ }
413
+
390
414
  /**
391
415
  * Returns get("username").
392
416
  *
@@ -410,12 +434,7 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
410
434
  }, {
411
435
  key: "setUsername",
412
436
  value: function (username /*: string*/) {
413
- // Strip anonymity
414
- var authData = this.get('authData');
415
- if (authData && (0, _typeof2.default)(authData) === 'object' && authData.hasOwnProperty('anonymous')) {
416
- // We need to set anonymous to null instead of deleting it in order to remove it from Parse.
417
- authData.anonymous = null;
418
- }
437
+ this.stripAnonymity();
419
438
  this.set('username', username);
420
439
  }
421
440
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "parse",
3
- "version": "4.2.0-alpha.6",
3
+ "version": "4.2.0-alpha.7",
4
4
  "description": "Parse JavaScript SDK",
5
5
  "homepage": "https://parseplatform.org",
6
6
  "keywords": [
@@ -29,7 +29,7 @@
29
29
  "react-native": false
30
30
  },
31
31
  "dependencies": {
32
- "@babel/runtime-corejs3": "7.22.6",
32
+ "@babel/runtime-corejs3": "7.22.10",
33
33
  "idb-keyval": "6.2.1",
34
34
  "react-native-crypto-js": "1.0.0",
35
35
  "uuid": "9.0.0",
@@ -86,7 +86,7 @@
86
86
  "metro-react-native-babel-preset": "0.76.4",
87
87
  "mongodb-runner": "5.4.3",
88
88
  "parse-server": "git+https://github.com/parse-community/parse-server#alpha",
89
- "prettier": "2.8.8",
89
+ "prettier": "3.0.2",
90
90
  "puppeteer": "20.4.0",
91
91
  "regenerator-runtime": "0.13.11",
92
92
  "semantic-release": "19.0.5",