parse 6.1.1 → 7.1.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 (79) hide show
  1. package/README.md +2 -1
  2. package/dist/parse.js +58626 -26564
  3. package/dist/parse.min.js +1 -14
  4. package/dist/parse.weapp.js +58737 -26628
  5. package/dist/parse.weapp.min.js +1 -14
  6. package/index.js +1 -1
  7. package/lib/browser/CoreManager.js +3 -4
  8. package/lib/browser/ObjectStateMutations.js +51 -9
  9. package/lib/browser/Parse.js +42 -44
  10. package/lib/browser/ParseFile.js +74 -54
  11. package/lib/browser/ParseObject.js +32 -29
  12. package/lib/browser/ParseOp.js +2 -2
  13. package/lib/browser/ParseQuery.js +14 -14
  14. package/lib/browser/RESTController.js +154 -129
  15. package/lib/browser/SingleInstanceStateController.js +28 -27
  16. package/lib/browser/UniqueInstanceStateController.js +19 -23
  17. package/lib/browser/Xhr.weapp.js +62 -102
  18. package/lib/browser/decode.js +8 -1
  19. package/lib/browser/encode.js +9 -1
  20. package/lib/browser/equals.js +1 -1
  21. package/lib/browser/isDangerousKey.js +29 -0
  22. package/lib/browser/uuid.js +6 -2
  23. package/lib/node/CoreManager.js +3 -4
  24. package/lib/node/ObjectStateMutations.js +50 -9
  25. package/lib/node/Parse.js +43 -47
  26. package/lib/node/ParseFile.js +75 -70
  27. package/lib/node/ParseObject.js +29 -28
  28. package/lib/node/RESTController.js +152 -128
  29. package/lib/node/SingleInstanceStateController.js +26 -28
  30. package/lib/node/UniqueInstanceStateController.js +19 -24
  31. package/lib/node/Xhr.weapp.js +58 -81
  32. package/lib/node/decode.js +8 -1
  33. package/lib/node/encode.js +9 -1
  34. package/lib/node/equals.js +1 -1
  35. package/lib/node/isDangerousKey.js +25 -0
  36. package/lib/node/uuid.js +4 -2
  37. package/lib/react-native/CoreManager.js +3 -4
  38. package/lib/react-native/ObjectStateMutations.js +40 -9
  39. package/lib/react-native/Parse.js +25 -37
  40. package/lib/react-native/ParseFile.js +62 -50
  41. package/lib/react-native/ParseObject.js +29 -28
  42. package/lib/react-native/ParseQuery.js +25 -25
  43. package/lib/react-native/RESTController.js +186 -150
  44. package/lib/react-native/SingleInstanceStateController.js +23 -28
  45. package/lib/react-native/UniqueInstanceStateController.js +19 -24
  46. package/lib/react-native/Xhr.weapp.js +63 -95
  47. package/lib/react-native/decode.js +7 -1
  48. package/lib/react-native/encode.js +7 -1
  49. package/lib/react-native/equals.js +1 -1
  50. package/lib/react-native/isDangerousKey.js +17 -0
  51. package/lib/react-native/uuid.js +1 -2
  52. package/lib/weapp/CoreManager.js +3 -4
  53. package/lib/weapp/ObjectStateMutations.js +51 -9
  54. package/lib/weapp/Parse.js +40 -44
  55. package/lib/weapp/ParseFile.js +74 -55
  56. package/lib/weapp/ParseObject.js +32 -29
  57. package/lib/weapp/ParseOp.js +2 -2
  58. package/lib/weapp/ParseQuery.js +14 -14
  59. package/lib/weapp/RESTController.js +155 -130
  60. package/lib/weapp/SingleInstanceStateController.js +28 -27
  61. package/lib/weapp/UniqueInstanceStateController.js +19 -23
  62. package/lib/weapp/Xhr.weapp.js +62 -102
  63. package/lib/weapp/decode.js +8 -1
  64. package/lib/weapp/encode.js +9 -1
  65. package/lib/weapp/equals.js +1 -1
  66. package/lib/weapp/isDangerousKey.js +29 -0
  67. package/lib/weapp/uuid.js +2 -1
  68. package/node.js +1 -1
  69. package/package.json +38 -55
  70. package/react-native.js +1 -1
  71. package/types/Parse.d.ts +16 -10
  72. package/types/ParseFile.d.ts +20 -5
  73. package/types/ParseObject.d.ts +1 -1
  74. package/types/RESTController.d.ts +2 -7
  75. package/types/SingleInstanceStateController.d.ts +3 -3
  76. package/types/Xhr.weapp.d.ts +1 -29
  77. package/types/isDangerousKey.d.ts +7 -0
  78. package/types/tests.ts +2 -0
  79. package/weapp.js +1 -1
@@ -27,29 +27,25 @@ exports.setServerData = setServerData;
27
27
  var _weakMap = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/weak-map"));
28
28
  var ObjectStateMutations = _interopRequireWildcard(require("./ObjectStateMutations"));
29
29
  var _TaskQueue = _interopRequireDefault(require("./TaskQueue"));
30
- function _getRequireWildcardCache(e) {
31
- if ("function" != typeof _WeakMap2) return null;
32
- var r = new _WeakMap2(),
33
- t = new _WeakMap2();
34
- return (_getRequireWildcardCache = function (e) {
35
- return e ? t : r;
36
- })(e);
37
- }
38
- function _interopRequireWildcard(e, r) {
39
- if (!r && e && e.__esModule) return e;
40
- if (null === e || "object" != typeof e && "function" != typeof e) return {
41
- default: e
42
- };
43
- var t = _getRequireWildcardCache(r);
44
- if (t && t.has(e)) return t.get(e);
45
- var n = {
46
- __proto__: null
47
- };
48
- for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
49
- var i = _Object$defineProperty && _Object$getOwnPropertyDescriptor ? _Object$getOwnPropertyDescriptor(e, u) : null;
50
- i && (i.get || i.set) ? _Object$defineProperty(n, u, i) : n[u] = e[u];
51
- }
52
- return n.default = e, t && t.set(e, n), n;
30
+ function _interopRequireWildcard(e, t) {
31
+ if ("function" == typeof _WeakMap2) var r = new _WeakMap2(),
32
+ n = new _WeakMap2();
33
+ return (_interopRequireWildcard = function (e, t) {
34
+ if (!t && e && e.__esModule) return e;
35
+ var o,
36
+ i,
37
+ f = {
38
+ __proto__: null,
39
+ default: e
40
+ };
41
+ if (null === e || "object" != typeof e && "function" != typeof e) return f;
42
+ if (o = t ? n : r) {
43
+ if (o.has(e)) return o.get(e);
44
+ o.set(e, f);
45
+ }
46
+ for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]);
47
+ return f;
48
+ })(e, t);
53
49
  }
54
50
  let objectState = new _weakMap.default();
55
51
  function getState(obj) {
@@ -5,108 +5,68 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
5
5
  _Object$defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.default = void 0;
9
- var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/json/stringify"));
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
11
- class XhrWeapp {
12
- constructor() {
13
- (0, _defineProperty2.default)(this, "UNSENT", void 0);
14
- (0, _defineProperty2.default)(this, "OPENED", void 0);
15
- (0, _defineProperty2.default)(this, "HEADERS_RECEIVED", void 0);
16
- (0, _defineProperty2.default)(this, "LOADING", void 0);
17
- (0, _defineProperty2.default)(this, "DONE", void 0);
18
- (0, _defineProperty2.default)(this, "header", void 0);
19
- (0, _defineProperty2.default)(this, "readyState", void 0);
20
- (0, _defineProperty2.default)(this, "status", void 0);
21
- (0, _defineProperty2.default)(this, "response", void 0);
22
- (0, _defineProperty2.default)(this, "responseType", void 0);
23
- (0, _defineProperty2.default)(this, "responseText", void 0);
24
- (0, _defineProperty2.default)(this, "responseHeader", void 0);
25
- (0, _defineProperty2.default)(this, "method", void 0);
26
- (0, _defineProperty2.default)(this, "url", void 0);
27
- (0, _defineProperty2.default)(this, "onabort", void 0);
28
- (0, _defineProperty2.default)(this, "onprogress", void 0);
29
- (0, _defineProperty2.default)(this, "onerror", void 0);
30
- (0, _defineProperty2.default)(this, "onreadystatechange", void 0);
31
- (0, _defineProperty2.default)(this, "requestTask", void 0);
32
- this.UNSENT = 0;
33
- this.OPENED = 1;
34
- this.HEADERS_RECEIVED = 2;
35
- this.LOADING = 3;
36
- this.DONE = 4;
37
- this.header = {};
38
- this.readyState = this.DONE;
39
- this.status = 0;
40
- this.response = '';
41
- this.responseType = '';
42
- this.responseText = '';
43
- this.responseHeader = {};
44
- this.method = '';
45
- this.url = '';
46
- this.onabort = () => {};
47
- this.onprogress = () => {};
48
- this.onerror = () => {};
49
- this.onreadystatechange = () => {};
50
- this.requestTask = null;
51
- }
52
- getAllResponseHeaders() {
53
- let header = '';
54
- for (const key in this.responseHeader) {
55
- header += key + ':' + this.getResponseHeader(key) + '\r\n';
56
- }
57
- return header;
58
- }
59
- getResponseHeader(key) {
60
- return this.responseHeader[key];
61
- }
62
- setRequestHeader(key, value) {
63
- this.header[key] = value;
64
- }
65
- open(method, url) {
66
- this.method = method;
67
- this.url = url;
68
- }
69
- abort() {
70
- if (!this.requestTask) {
71
- return;
8
+ exports.polyfillFetch = polyfillFetch;
9
+ var _reduce = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/reduce"));
10
+ var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
11
+ var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
12
+ /* istanbul ignore file */
13
+
14
+ // @ts-ignore
15
+ function parseResponse(res) {
16
+ var _context;
17
+ let headers = res.header || {};
18
+ headers = (0, _reduce.default)(_context = (0, _keys.default)(headers)).call(_context, (map, key) => {
19
+ map[key.toLowerCase()] = headers[key];
20
+ return map;
21
+ }, {});
22
+ return {
23
+ status: res.statusCode,
24
+ json: () => {
25
+ if (typeof res.data === 'object') {
26
+ return _promise.default.resolve(res.data);
27
+ }
28
+ let json = {};
29
+ try {
30
+ json = JSON.parse(res.data);
31
+ } catch (err) {
32
+ console.error(err);
33
+ }
34
+ return _promise.default.resolve(json);
35
+ },
36
+ headers: {
37
+ keys: () => (0, _keys.default)(headers),
38
+ get: n => headers[n.toLowerCase()],
39
+ has: n => n.toLowerCase() in headers,
40
+ entries: () => {
41
+ const all = [];
42
+ for (const key in headers) {
43
+ if (headers[key]) {
44
+ all.push([key, headers[key]]);
45
+ }
46
+ }
47
+ return all;
48
+ }
72
49
  }
73
- this.requestTask.abort();
74
- this.status = 0;
75
- this.response = undefined;
76
- this.onabort();
77
- this.onreadystatechange();
78
- }
79
- send(data) {
80
- // @ts-ignore
81
- this.requestTask = wx.request({
82
- url: this.url,
83
- method: this.method,
84
- data: data,
85
- header: this.header,
86
- responseType: this.responseType,
87
- success: res => {
88
- this.status = res.statusCode;
89
- this.response = res.data;
90
- this.responseHeader = res.header;
91
- this.responseText = (0, _stringify.default)(res.data);
92
- this.requestTask = null;
93
- this.onreadystatechange();
94
- },
95
- fail: err => {
96
- this.requestTask = null;
50
+ };
51
+ }
52
+ function polyfillFetch() {
53
+ const typedGlobal = global;
54
+ if (typeof typedGlobal.fetch !== 'function') {
55
+ typedGlobal.fetch = (url, options) => {
56
+ const dataType = url.match(/\.(txt|json|html|txt|csv)/) ? 'text' : 'arraybuffer';
57
+ return new _promise.default((resolve, reject) => {
97
58
  // @ts-ignore
98
- this.onerror(err);
99
- }
100
- });
101
- this.requestTask.onProgressUpdate(res => {
102
- const event = {
103
- lengthComputable: res.totalBytesExpectedToWrite !== 0,
104
- loaded: res.totalBytesWritten,
105
- total: res.totalBytesExpectedToWrite
106
- };
107
- // @ts-ignore
108
- this.onprogress(event);
109
- });
59
+ wx.request({
60
+ url,
61
+ method: options.method || 'GET',
62
+ data: options.body,
63
+ header: options.headers,
64
+ dataType,
65
+ responseType: dataType,
66
+ success: response => resolve(parseResponse(response)),
67
+ fail: error => reject(error)
68
+ });
69
+ });
70
+ };
110
71
  }
111
- }
112
- var _default = exports.default = XhrWeapp;
72
+ }
@@ -13,6 +13,7 @@ var _ParseFile = _interopRequireDefault(require("./ParseFile"));
13
13
  var _ParseGeoPoint = _interopRequireDefault(require("./ParseGeoPoint"));
14
14
  var _ParsePolygon = _interopRequireDefault(require("./ParsePolygon"));
15
15
  var _ParseRelation = _interopRequireDefault(require("./ParseRelation"));
16
+ var _isDangerousKey = require("./isDangerousKey");
16
17
  function decode(value) {
17
18
  if (value === null || typeof value !== 'object' || value instanceof Date) {
18
19
  return value;
@@ -60,7 +61,13 @@ function decode(value) {
60
61
  }
61
62
  const copy = {};
62
63
  for (const k in value) {
63
- copy[k] = decode(value[k]);
64
+ if (Object.prototype.hasOwnProperty.call(value, k)) {
65
+ // Skip dangerous keys that could pollute prototypes
66
+ if ((0, _isDangerousKey.isDangerousKey)(k)) {
67
+ continue;
68
+ }
69
+ copy[k] = decode(value[k]);
70
+ }
64
71
  }
65
72
  return copy;
66
73
  }
@@ -18,6 +18,7 @@ var _ParseFile = _interopRequireDefault(require("./ParseFile"));
18
18
  var _ParseGeoPoint = _interopRequireDefault(require("./ParseGeoPoint"));
19
19
  var _ParsePolygon = _interopRequireDefault(require("./ParsePolygon"));
20
20
  var _ParseRelation = _interopRequireDefault(require("./ParseRelation"));
21
+ var _isDangerousKey = require("./isDangerousKey");
21
22
  function encode(value, disallowObjects, forcePointers, seen, offline) {
22
23
  const ParseObject = _CoreManager.default.getParseObject();
23
24
  if (value instanceof ParseObject) {
@@ -67,7 +68,14 @@ function encode(value, disallowObjects, forcePointers, seen, offline) {
67
68
  if (value && typeof value === 'object') {
68
69
  const output = {};
69
70
  for (const k in value) {
70
- output[k] = encode(value[k], disallowObjects, forcePointers, seen, offline);
71
+ // Only iterate over own properties
72
+ if (Object.prototype.hasOwnProperty.call(value, k)) {
73
+ // Skip dangerous keys that could pollute prototypes
74
+ if ((0, _isDangerousKey.isDangerousKey)(k)) {
75
+ continue;
76
+ }
77
+ output[k] = encode(value[k], disallowObjects, forcePointers, seen, offline);
78
+ }
71
79
  }
72
80
  return output;
73
81
  }
@@ -33,7 +33,7 @@ function equals(a, b) {
33
33
  if (a.length !== b.length) {
34
34
  return false;
35
35
  }
36
- for (let i = a.length; i--;) {
36
+ for (let i = 0; i < a.length; i += 1) {
37
37
  if (!equals(a[i], b[i])) {
38
38
  return false;
39
39
  }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
5
+ _Object$defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.isDangerousKey = isDangerousKey;
9
+ var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
10
+ var _some = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/some"));
11
+ /**
12
+ * Check if a property name or path is potentially dangerous for prototype pollution
13
+ * Dangerous keys include: __proto__, constructor, prototype
14
+ * @param key - The property name or dotted path to check
15
+ * @returns true if the key is dangerous, false otherwise
16
+ */
17
+ function isDangerousKey(key) {
18
+ const dangerousKeys = ["__proto__", "constructor", "prototype"];
19
+ // Check if the key itself is dangerous
20
+ if ((0, _includes.default)(dangerousKeys).call(dangerousKeys, key)) {
21
+ return true;
22
+ }
23
+ // Check if any part of a dotted path is dangerous
24
+ if ((0, _includes.default)(key).call(key, ".")) {
25
+ const parts = key.split(".");
26
+ return (0, _some.default)(parts).call(parts, part => (0, _includes.default)(dangerousKeys).call(dangerousKeys, part));
27
+ }
28
+ return false;
29
+ }
package/lib/weapp/uuid.js CHANGED
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
5
  _Object$defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = void 0;
8
- var _uuid = require("uuid");
9
+ var _globalThis2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/global-this"));
9
10
  let uuid = function () {
10
11
  const s = [];
11
12
  const hexDigits = '0123456789abcdef';
package/node.js CHANGED
@@ -1 +1 @@
1
- module.exports = require('./lib/node/Parse.js');
1
+ module.exports = require('./lib/node/Parse.js').default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "parse",
3
- "version": "6.1.1",
3
+ "version": "7.1.2",
4
4
  "description": "Parse JavaScript SDK",
5
5
  "homepage": "https://parseplatform.org",
6
6
  "keywords": [
@@ -31,75 +31,68 @@
31
31
  "react-native": false
32
32
  },
33
33
  "dependencies": {
34
- "@babel/runtime-corejs3": "7.27.0",
35
- "idb-keyval": "6.2.1",
34
+ "@babel/runtime-corejs3": "7.28.4",
35
+ "crypto-js": "4.2.0",
36
+ "idb-keyval": "6.2.2",
36
37
  "react-native-crypto-js": "1.0.0",
37
- "uuid": "10.0.0",
38
- "ws": "8.18.1",
39
- "xmlhttprequest": "1.8.0"
38
+ "ws": "8.18.3"
40
39
  },
41
40
  "devDependencies": {
42
- "@babel/core": "7.26.10",
41
+ "@babel/core": "7.28.5",
43
42
  "@babel/plugin-proposal-class-properties": "7.18.6",
44
- "@babel/plugin-transform-runtime": "7.26.10",
43
+ "@babel/plugin-transform-runtime": "7.28.5",
45
44
  "@babel/preset-env": "7.26.9",
46
- "@babel/preset-react": "7.26.3",
47
- "@babel/preset-typescript": "7.27.0",
48
- "@eslint/js": "9.23.0",
45
+ "@babel/preset-react": "7.28.5",
46
+ "@babel/preset-typescript": "7.27.1",
47
+ "@eslint/js": "9.39.1",
49
48
  "@parse/minami": "git+https://github.com/parse-community/minami#main",
49
+ "@rollup/plugin-terser": "0.4.4",
50
50
  "@saithodev/semantic-release-backmerge": "4.0.1",
51
51
  "@semantic-release/changelog": "6.0.3",
52
52
  "@semantic-release/commit-analyzer": "13.0.1",
53
53
  "@semantic-release/git": "10.0.1",
54
- "@semantic-release/github": "11.0.1",
55
- "@semantic-release/npm": "12.0.1",
56
- "@semantic-release/release-notes-generator": "14.0.3",
54
+ "@semantic-release/github": "12.0.2",
55
+ "@semantic-release/npm": "13.1.2",
56
+ "@semantic-release/release-notes-generator": "14.1.0",
57
57
  "@types/facebook-js-sdk": "3.3.11",
58
- "babel-jest": "29.5.0",
59
- "babel-plugin-inline-package-json": "2.0.0",
58
+ "babel-jest": "30.2.0",
60
59
  "babel-plugin-minify-dead-code-elimination": "0.5.2",
61
60
  "babel-plugin-transform-inline-environment-variables": "0.4.4",
62
- "browserify": "17.0.0",
63
61
  "codecov": "3.8.3",
64
- "core-js": "3.41.0",
65
- "cross-env": "7.0.2",
66
- "eslint": "9.23.0",
62
+ "core-js": "3.47.0",
63
+ "cross-env": "10.1.0",
64
+ "eslint": "9.39.1",
67
65
  "eslint-plugin-expect-type": "0.6.2",
68
- "eslint-plugin-jsdoc": "50.6.9",
69
- "express": "4.21.2",
70
- "gulp": "5.0.0",
66
+ "eslint-plugin-jsdoc": "61.4.1",
67
+ "express": "5.1.0",
68
+ "gulp": "5.0.1",
71
69
  "gulp-babel": "8.0.0",
72
- "gulp-derequire": "3.0.0",
73
- "gulp-insert": "0.5.0",
74
- "gulp-rename": "2.0.0",
75
- "gulp-uglify": "3.0.2",
76
70
  "gulp-watch": "5.0.1",
77
- "husky": "9.1.7",
78
- "jasmine": "5.6.0",
71
+ "jasmine": "5.12.0",
79
72
  "jasmine-reporters": "2.5.2",
80
73
  "jasmine-spec-reporter": "7.0.0",
81
74
  "jest": "29.7.0",
82
- "jest-environment-jsdom": "29.7.0",
83
- "jsdoc": "4.0.4",
75
+ "jest-environment-jsdom": "30.2.0",
76
+ "jsdoc": "4.0.5",
84
77
  "jsdoc-babel": "0.5.0",
85
- "lint-staged": "15.5.0",
78
+ "lint-staged": "16.2.7",
86
79
  "madge": "8.0.0",
87
80
  "metro-react-native-babel-preset": "0.77.0",
88
- "mongodb-runner": "5.8.0",
89
- "parse-server": "7.3.0",
90
- "prettier": "3.5.2",
91
- "puppeteer": "24.4.0",
81
+ "mongodb-runner": "6.2.0",
82
+ "parse-server": "8.4.0",
83
+ "puppeteer": "24.31.0",
92
84
  "regenerator-runtime": "0.14.1",
93
- "semantic-release": "24.2.3",
94
- "typescript-eslint": "8.28.0",
95
- "vinyl-source-stream": "2.0.0"
96
- },
97
- "optionalDependencies": {
98
- "crypto-js": "4.2.0"
85
+ "semantic-release": "25.0.2",
86
+ "typescript-eslint": "8.48.0",
87
+ "vite": "6.4.1",
88
+ "vite-plugin-commonjs": "0.10.4",
89
+ "vite-plugin-node-polyfills": "0.24.0"
99
90
  },
100
91
  "scripts": {
101
92
  "build": "node build_releases.js",
102
93
  "build:types": "tsc",
94
+ "build:browser": "cross-env PARSE_BUILD=browser vite build --config vite.config.umd.ts",
95
+ "build:weapp": "cross-env PARSE_BUILD=weapp vite build --config vite.config.umd.ts",
103
96
  "ci:typecheck": "node ./ci/typecheck.js",
104
97
  "release": "node build_releases.js && npm publish",
105
98
  "test": "cross-env PARSE_BUILD=node jest",
@@ -110,29 +103,20 @@
110
103
  "lint:fix": "eslint --fix --cache src/ integration/",
111
104
  "test:types": "eslint types/tests.ts -c ./types/eslint.config.mjs",
112
105
  "watch": "cross-env PARSE_BUILD=${PARSE_BUILD} gulp watch",
113
- "watch:browser": "cross-env PARSE_BUILD=browser npm run watch",
106
+ "watch:browser": "cross-env PARSE_BUILD=browser vite build --watch --config vite.config.ts",
114
107
  "watch:node": "cross-env PARSE_BUILD=node npm run watch",
115
108
  "watch:react-native": "cross-env PARSE_BUILD=react-native npm run watch",
116
109
  "watch:ts": "tsc --watch",
117
110
  "integration": "cross-env TESTING=1 jasmine --config=jasmine.json",
118
111
  "docs": "jsdoc -c ./jsdoc-conf.json ./src",
119
112
  "madge:circular": "madge ./src --extensions js,ts --circular",
120
- "prepare": "husky && npm run build",
121
- "pre-commit": "lint-staged",
113
+ "prepare": "npm run build",
122
114
  "release_docs": "./release_docs.sh",
123
115
  "gulp": "gulp",
124
- "prettier": "prettier --write '{src,integration,types}/{**/*,*}.{js,ts}' && npm run lint:fix",
125
116
  "cross-env": "cross-env"
126
117
  },
127
- "lint-staged": {
128
- "{src,integration}/{**/*,*}.{js,ts}": [
129
- "prettier --write",
130
- "eslint --fix --cache",
131
- "git add"
132
- ]
133
- },
134
118
  "engines": {
135
- "node": "18 || 19 || 20 || 22"
119
+ "node": "18 || 19 || 20 || 22 || 24"
136
120
  },
137
121
  "jest": {
138
122
  "automock": true,
@@ -152,7 +136,6 @@
152
136
  ".*": "./babel-jest.js"
153
137
  },
154
138
  "transformIgnorePatterns": [
155
- "/node_modules/",
156
139
  "package.json"
157
140
  ],
158
141
  "testEnvironment": "jsdom"
package/react-native.js CHANGED
@@ -1 +1 @@
1
- module.exports = require('./lib/react-native/Parse.js');
1
+ module.exports = require('./lib/react-native/Parse.js').default;
package/types/Parse.d.ts CHANGED
@@ -282,16 +282,6 @@ declare const Parse: {
282
282
  * @static
283
283
  */
284
284
  serverURL: any;
285
- /**
286
- * @property {string} Parse.serverAuthToken
287
- * @static
288
- */
289
- serverAuthToken: any;
290
- /**
291
- * @property {string} Parse.serverAuthType
292
- * @static
293
- */
294
- serverAuthType: any;
295
285
  /**
296
286
  * @property {ParseLiveQuery} Parse.LiveQuery
297
287
  * @static
@@ -322,6 +312,22 @@ declare const Parse: {
322
312
  * @static
323
313
  */
324
314
  allowCustomObjectId: any;
315
+ /**
316
+ * Setting this property to `true` enables enhanced logging for `Parse.Object`
317
+ * in Node.js environments. Specifically, it will log:
318
+ *
319
+ * ```
320
+ * ParseObject: className: <CLASS_NAME>, id: <OBJECT_ID>
321
+ * Attributes: <OBJECT_ATTRIBUTES>
322
+ * ```
323
+ *
324
+ * @warning This should not be enabled in production environments as this may
325
+ * expose sensitive information in server logs.
326
+ *
327
+ * @property {boolean} Parse.nodeLogging
328
+ * @static
329
+ */
330
+ nodeLogging: any;
325
331
  _request(...args: any[]): any;
326
332
  _ajax(...args: any[]): any;
327
333
  _decode(_: any, value: any): any;
@@ -23,6 +23,7 @@ export type FileSource = {
23
23
  uri: string;
24
24
  type: string | undefined;
25
25
  };
26
+ export declare function b64Digit(number: number): string;
26
27
  /**
27
28
  * A Parse.File is a local representation of a file that is saved to the Parse
28
29
  * cloud.
@@ -44,7 +45,7 @@ declare class ParseFile {
44
45
  * an alphanumeric character, and consist of alphanumeric characters,
45
46
  * periods, spaces, underscores, or dashes.
46
47
  * @param data {Array} The data for the file, as either:
47
- * 1. an Array of byte value Numbers, or
48
+ * 1. an Array of byte value Numbers or Uint8Array.
48
49
  * 2. an Object like { base64: "..." } with a base64-encoded String.
49
50
  * 3. an Object like { uri: "..." } with a uri String.
50
51
  * 4. a File object selected with a file upload control. (3) only works
@@ -74,9 +75,23 @@ declare class ParseFile {
74
75
  * Data is present if initialized with Byte Array, Base64 or Saved with Uri.
75
76
  * Data is cleared if saved with File object selected with a file upload control
76
77
  *
78
+ * @param {object} options
79
+ * @param {function} [options.progress] callback for download progress
80
+ * <pre>
81
+ * const parseFile = new Parse.File(name, file);
82
+ * parseFile.getData({
83
+ * progress: (progressValue, loaded, total) => {
84
+ * if (progressValue !== null) {
85
+ * // Update the UI using progressValue
86
+ * }
87
+ * }
88
+ * });
89
+ * </pre>
77
90
  * @returns {Promise} Promise that is resolve with base64 data
78
91
  */
79
- getData(): Promise<string>;
92
+ getData(options?: {
93
+ progress?: () => void;
94
+ }): Promise<string>;
80
95
  /**
81
96
  * Gets the name of the file. Before save is called, this is the filename
82
97
  * given by the user. After save is called, that name gets prefixed with a
@@ -117,12 +132,12 @@ declare class ParseFile {
117
132
  * be used for this request.
118
133
  * <li>sessionToken: A valid session token, used for making a request on
119
134
  * behalf of a specific user.
120
- * <li>progress: In Browser only, callback for upload progress. For example:
135
+ * <li>progress: callback for upload progress. For example:
121
136
  * <pre>
122
137
  * let parseFile = new Parse.File(name, file);
123
138
  * parseFile.save({
124
- * progress: (progressValue, loaded, total, { type }) => {
125
- * if (type === "upload" && progressValue !== null) {
139
+ * progress: (progressValue, loaded, total) => {
140
+ * if (progressValue !== null) {
126
141
  * // Update the UI using progressValue
127
142
  * }
128
143
  * }
@@ -448,7 +448,7 @@ declare class ParseObject<T extends Attributes = Attributes> {
448
448
  * @returns {Promise} A promise that is fulfilled when the fetch
449
449
  * completes.
450
450
  */
451
- fetch(options: FetchOptions): Promise<this>;
451
+ fetch(options?: FetchOptions): Promise<this>;
452
452
  /**
453
453
  * Fetch the model from the server. If the server's representation of the
454
454
  * model differs from its current attributes, they will be overriden.
@@ -23,13 +23,8 @@ export interface FullOptions {
23
23
  usePost?: boolean;
24
24
  }
25
25
  declare const RESTController: {
26
- ajax(method: string, url: string, data: any, headers?: any, options?: FullOptions): (Promise<any> & {
27
- resolve: (res: any) => void;
28
- reject: (err: any) => void;
29
- }) | Promise<unknown>;
26
+ ajax(method: string, url: string, data: any, headers?: any, options?: FullOptions): Promise<any>;
30
27
  request(method: string, path: string, data: any, options?: RequestOptions): Promise<any>;
31
- handleError(response: any): Promise<never>;
32
- _setXHR(xhr: any): void;
33
- _getXHR(): any;
28
+ handleError(errorJSON: any): Promise<never>;
34
29
  };
35
30
  export default RESTController;
@@ -1,6 +1,6 @@
1
- import type { Op } from './ParseOp';
2
- import type ParseObject from './ParseObject';
3
- import type { AttributeMap, ObjectCache, OpsMap, State } from './ObjectStateMutations';
1
+ import type { Op } from "./ParseOp";
2
+ import type ParseObject from "./ParseObject";
3
+ import type { AttributeMap, ObjectCache, OpsMap, State } from "./ObjectStateMutations";
4
4
  export declare function getState(obj: ParseObject): State | null;
5
5
  export declare function initializeState(obj: ParseObject, initial?: State): State;
6
6
  export declare function removeState(obj: ParseObject): State | null;