parse 5.3.0 → 6.0.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 (81) hide show
  1. package/README.md +6 -5
  2. package/dist/parse.js +829 -884
  3. package/dist/parse.min.js +2 -2
  4. package/dist/parse.weapp.js +829 -882
  5. package/dist/parse.weapp.min.js +2 -2
  6. package/lib/browser/Cloud.js +12 -16
  7. package/lib/browser/CoreManager.js +3 -3
  8. package/lib/browser/FacebookUtils.js +1 -1
  9. package/lib/browser/LocalDatastoreController.react-native.js +1 -1
  10. package/lib/browser/OfflineQuery.js +5 -9
  11. package/lib/browser/Parse.js +1 -3
  12. package/lib/browser/ParseConfig.js +1 -1
  13. package/lib/browser/ParseFile.js +1 -2
  14. package/lib/browser/ParseHooks.js +7 -7
  15. package/lib/browser/ParseInstallation.js +3 -1
  16. package/lib/browser/ParseObject.js +160 -163
  17. package/lib/browser/ParseQuery.js +22 -89
  18. package/lib/browser/ParseSession.js +4 -6
  19. package/lib/browser/ParseUser.js +44 -58
  20. package/lib/browser/Push.js +2 -2
  21. package/lib/browser/RESTController.js +2 -2
  22. package/lib/browser/Storage.js +1 -1
  23. package/lib/browser/StorageController.default.js +2 -2
  24. package/lib/browser/StorageController.weapp.js +1 -1
  25. package/lib/node/Cloud.js +12 -16
  26. package/lib/node/CoreManager.js +3 -3
  27. package/lib/node/FacebookUtils.js +1 -1
  28. package/lib/node/LocalDatastoreController.react-native.js +1 -1
  29. package/lib/node/OfflineQuery.js +5 -9
  30. package/lib/node/Parse.js +1 -1
  31. package/lib/node/ParseConfig.js +1 -1
  32. package/lib/node/ParseFile.js +1 -2
  33. package/lib/node/ParseHooks.js +7 -7
  34. package/lib/node/ParseInstallation.js +3 -1
  35. package/lib/node/ParseObject.js +155 -158
  36. package/lib/node/ParseQuery.js +22 -89
  37. package/lib/node/ParseSession.js +4 -6
  38. package/lib/node/ParseUser.js +44 -58
  39. package/lib/node/Push.js +2 -2
  40. package/lib/node/RESTController.js +2 -2
  41. package/lib/node/Storage.js +1 -1
  42. package/lib/node/StorageController.default.js +2 -2
  43. package/lib/node/StorageController.weapp.js +1 -1
  44. package/lib/react-native/Cloud.js +4 -16
  45. package/lib/react-native/CoreManager.js +3 -3
  46. package/lib/react-native/LocalDatastoreController.react-native.js +1 -1
  47. package/lib/react-native/OfflineQuery.js +5 -5
  48. package/lib/react-native/ParseConfig.js +1 -1
  49. package/lib/react-native/ParseFile.js +1 -1
  50. package/lib/react-native/ParseHooks.js +7 -7
  51. package/lib/react-native/ParseInstallation.js +14 -6
  52. package/lib/react-native/ParseObject.js +147 -163
  53. package/lib/react-native/ParseQuery.js +21 -89
  54. package/lib/react-native/ParseRole.js +8 -2
  55. package/lib/react-native/ParseSession.js +4 -6
  56. package/lib/react-native/ParseUser.js +28 -63
  57. package/lib/react-native/Push.js +2 -2
  58. package/lib/react-native/RESTController.js +11 -10
  59. package/lib/react-native/Storage.js +1 -1
  60. package/lib/react-native/StorageController.default.js +2 -2
  61. package/lib/react-native/StorageController.weapp.js +1 -1
  62. package/lib/weapp/Cloud.js +12 -16
  63. package/lib/weapp/CoreManager.js +3 -3
  64. package/lib/weapp/FacebookUtils.js +1 -1
  65. package/lib/weapp/LocalDatastoreController.react-native.js +1 -1
  66. package/lib/weapp/OfflineQuery.js +5 -9
  67. package/lib/weapp/Parse.js +1 -1
  68. package/lib/weapp/ParseConfig.js +1 -1
  69. package/lib/weapp/ParseFile.js +1 -2
  70. package/lib/weapp/ParseHooks.js +7 -7
  71. package/lib/weapp/ParseInstallation.js +3 -1
  72. package/lib/weapp/ParseObject.js +160 -163
  73. package/lib/weapp/ParseQuery.js +22 -89
  74. package/lib/weapp/ParseSession.js +4 -6
  75. package/lib/weapp/ParseUser.js +44 -58
  76. package/lib/weapp/Push.js +2 -2
  77. package/lib/weapp/RESTController.js +2 -2
  78. package/lib/weapp/Storage.js +1 -1
  79. package/lib/weapp/StorageController.default.js +2 -2
  80. package/lib/weapp/StorageController.weapp.js +1 -1
  81. package/package.json +30 -28
@@ -19,7 +19,7 @@ const config = {
19
19
  SERVER_AUTH_TOKEN: null,
20
20
  LIVEQUERY_SERVER_URL: null,
21
21
  ENCRYPTED_KEY: null,
22
- VERSION: 'js' + "5.3.0",
22
+ VERSION: 'js' + "6.0.0-alpha.2",
23
23
  APPLICATION_ID: null,
24
24
  JAVASCRIPT_KEY: null,
25
25
  MASTER_KEY: null,
@@ -40,7 +40,7 @@ function requireMethods(name, methods, controller) {
40
40
  }
41
41
  const CoreManager = {
42
42
  get: function (key) {
43
- if (config.hasOwnProperty(key)) {
43
+ if (Object.hasOwn(config, key)) {
44
44
  return config[key];
45
45
  }
46
46
  throw new Error('Configuration key not found: ' + key);
@@ -49,7 +49,7 @@ const CoreManager = {
49
49
  config[key] = value;
50
50
  },
51
51
  setIfNeeded: function (key, value) {
52
- if (!config.hasOwnProperty(key)) {
52
+ if (!Object.hasOwn(config, key)) {
53
53
  config[key] = value;
54
54
  }
55
55
  return config[key];
@@ -103,7 +103,7 @@ const FacebookUtils = {
103
103
  }
104
104
  }
105
105
  if (initOptions.status && typeof console !== 'undefined') {
106
- const warn = console.warn || console.log || function () {}; // eslint-disable-line no-console
106
+ const warn = console.warn || console.log || function () {};
107
107
  warn.call(console, 'The "status" flag passed into' + ' FB.init, when set to true, can interfere with Parse Facebook' + ' integration, so it has been suppressed. Please call' + ' FB.getLoginStatus() explicitly if you require this behavior.');
108
108
  }
109
109
  initOptions.status = false;
@@ -53,7 +53,7 @@ const LocalDatastoreController = {
53
53
  const [key, value] = pair;
54
54
  try {
55
55
  LDS[key] = JSON.parse(value);
56
- } catch (error) {
56
+ } catch (_) {
57
57
  LDS[key] = null;
58
58
  }
59
59
  });
@@ -317,11 +317,7 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
317
317
  compareTo = parserResult.result;
318
318
  }
319
319
  // Compare Date Object or Date String
320
- if (toString.call(compareTo) === '[object Date]' || typeof compareTo === 'string' &&
321
- // @ts-ignore
322
- new Date(compareTo) !== 'Invalid Date' &&
323
- // @ts-ignore
324
- !isNaN(new Date(compareTo))) {
320
+ if (toString.call(compareTo) === '[object Date]' || typeof compareTo === 'string' && new Date(compareTo).toString() !== 'Invalid Date') {
325
321
  object[key] = new Date(object[key].iso ? object[key].iso : object[key]);
326
322
  }
327
323
  switch (condition) {
@@ -442,7 +438,7 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
442
438
  break;
443
439
  case '$select':
444
440
  {
445
- const subQueryObjects = (0, _filter.default)(objects).call(objects, (obj, index, arr) => {
441
+ const subQueryObjects = (0, _filter.default)(objects).call(objects, (obj, _index, arr) => {
446
442
  return matchesQuery(compareTo.query.className, obj, arr, compareTo.query.where);
447
443
  });
448
444
  for (let i = 0; i < subQueryObjects.length; i += 1) {
@@ -453,7 +449,7 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
453
449
  }
454
450
  case '$dontSelect':
455
451
  {
456
- const subQueryObjects = (0, _filter.default)(objects).call(objects, (obj, index, arr) => {
452
+ const subQueryObjects = (0, _filter.default)(objects).call(objects, (obj, _index, arr) => {
457
453
  return matchesQuery(compareTo.query.className, obj, arr, compareTo.query.where);
458
454
  });
459
455
  for (let i = 0; i < subQueryObjects.length; i += 1) {
@@ -464,7 +460,7 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
464
460
  }
465
461
  case '$inQuery':
466
462
  {
467
- const subQueryObjects = (0, _filter.default)(objects).call(objects, (obj, index, arr) => {
463
+ const subQueryObjects = (0, _filter.default)(objects).call(objects, (obj, _index, arr) => {
468
464
  return matchesQuery(compareTo.className, obj, arr, compareTo.where);
469
465
  });
470
466
  for (let i = 0; i < subQueryObjects.length; i += 1) {
@@ -477,7 +473,7 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
477
473
  }
478
474
  case '$notInQuery':
479
475
  {
480
- const subQueryObjects = (0, _filter.default)(objects).call(objects, (obj, index, arr) => {
476
+ const subQueryObjects = (0, _filter.default)(objects).call(objects, (obj, _index, arr) => {
481
477
  return matchesQuery(compareTo.className, obj, arr, compareTo.where);
482
478
  });
483
479
  for (let i = 0; i < subQueryObjects.length; i += 1) {
@@ -367,7 +367,7 @@ const Parse = {
367
367
  */
368
368
  dumpLocalDatastore() {
369
369
  if (!this.LocalDatastore.isEnabled) {
370
- console.log('Parse.enableLocalDatastore() must be called first'); // eslint-disable-line no-console
370
+ console.log('Parse.enableLocalDatastore() must be called first');
371
371
  return _promise.default.resolve({});
372
372
  } else {
373
373
  return Parse.LocalDatastore._getAllContents();
@@ -132,7 +132,7 @@ function decodePayload(data) {
132
132
  if (json && typeof json === 'object') {
133
133
  return (0, _decode.default)(json);
134
134
  }
135
- } catch (e) {
135
+ } catch (_) {
136
136
  return null;
137
137
  }
138
138
  }
@@ -300,7 +300,7 @@ class ParseFile {
300
300
  const destroyOptions = {
301
301
  useMasterKey: true
302
302
  };
303
- if (options.hasOwnProperty('useMasterKey')) {
303
+ if (Object.hasOwn(options, 'useMasterKey')) {
304
304
  destroyOptions.useMasterKey = !!options.useMasterKey;
305
305
  }
306
306
  const controller = _CoreManager.default.getFileController();
@@ -404,7 +404,6 @@ const DefaultController = {
404
404
  throw new Error('saveFile can only be used with File-type sources.');
405
405
  }
406
406
  const base64Data = await new _promise.default((res, rej) => {
407
- // eslint-disable-next-line no-undef
408
407
  const reader = new FileReader();
409
408
  reader.onload = () => res(reader.result);
410
409
  reader.onerror = error => rej(error);
@@ -82,7 +82,7 @@ function remove(hook) {
82
82
  }
83
83
  const DefaultController = {
84
84
  get(type, functionName, triggerName) {
85
- let url = '/hooks/' + type;
85
+ let url = 'hooks/' + type;
86
86
  if (functionName) {
87
87
  url += '/' + functionName;
88
88
  if (triggerName) {
@@ -94,9 +94,9 @@ const DefaultController = {
94
94
  create(hook) {
95
95
  let url;
96
96
  if (hook.functionName && hook.url) {
97
- url = '/hooks/functions';
97
+ url = 'hooks/functions';
98
98
  } else if (hook.className && hook.triggerName && hook.url) {
99
- url = '/hooks/triggers';
99
+ url = 'hooks/triggers';
100
100
  } else {
101
101
  return _promise.default.reject({
102
102
  error: 'invalid hook declaration',
@@ -108,10 +108,10 @@ const DefaultController = {
108
108
  remove(hook) {
109
109
  let url;
110
110
  if (hook.functionName) {
111
- url = '/hooks/functions/' + hook.functionName;
111
+ url = 'hooks/functions/' + hook.functionName;
112
112
  delete hook.functionName;
113
113
  } else if (hook.className && hook.triggerName) {
114
- url = '/hooks/triggers/' + hook.className + '/' + hook.triggerName;
114
+ url = 'hooks/triggers/' + hook.className + '/' + hook.triggerName;
115
115
  delete hook.className;
116
116
  delete hook.triggerName;
117
117
  } else {
@@ -127,10 +127,10 @@ const DefaultController = {
127
127
  update(hook) {
128
128
  let url;
129
129
  if (hook.functionName && hook.url) {
130
- url = '/hooks/functions/' + hook.functionName;
130
+ url = 'hooks/functions/' + hook.functionName;
131
131
  delete hook.functionName;
132
132
  } else if (hook.className && hook.triggerName && hook.url) {
133
- url = '/hooks/triggers/' + hook.className + '/' + hook.triggerName;
133
+ url = 'hooks/triggers/' + hook.className + '/' + hook.triggerName;
134
134
  delete hook.className;
135
135
  delete hook.triggerName;
136
136
  } else {
@@ -37,7 +37,9 @@ class ParseInstallation extends _ParseObject.default {
37
37
  constructor(attributes) {
38
38
  super('_Installation');
39
39
  if (attributes && typeof attributes === 'object') {
40
- if (!this.set(attributes)) {
40
+ try {
41
+ this.set(attributes || {});
42
+ } catch (_) {
41
43
  throw new Error("Can't create an invalid Installation");
42
44
  }
43
45
  }