parse 6.2.0-alpha.2 → 7.0.0-alpha.1

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 (69) hide show
  1. package/dist/parse.js +58692 -26593
  2. package/dist/parse.min.js +1 -14
  3. package/dist/parse.weapp.js +58735 -26628
  4. package/dist/parse.weapp.min.js +1 -14
  5. package/index.js +1 -1
  6. package/lib/browser/CoreManager.js +3 -4
  7. package/lib/browser/ObjectStateMutations.js +51 -9
  8. package/lib/browser/Parse.js +42 -44
  9. package/lib/browser/ParseFile.js +72 -52
  10. package/lib/browser/ParseObject.js +31 -28
  11. package/lib/browser/ParseOp.js +2 -2
  12. package/lib/browser/ParseQuery.js +14 -14
  13. package/lib/browser/RESTController.js +153 -129
  14. package/lib/browser/SingleInstanceStateController.js +28 -27
  15. package/lib/browser/UniqueInstanceStateController.js +19 -23
  16. package/lib/browser/Xhr.weapp.js +62 -102
  17. package/lib/browser/decode.js +8 -1
  18. package/lib/browser/encode.js +9 -1
  19. package/lib/browser/isDangerousKey.js +29 -0
  20. package/lib/node/CoreManager.js +3 -4
  21. package/lib/node/ObjectStateMutations.js +50 -9
  22. package/lib/node/Parse.js +43 -47
  23. package/lib/node/ParseFile.js +73 -68
  24. package/lib/node/ParseObject.js +28 -27
  25. package/lib/node/RESTController.js +151 -128
  26. package/lib/node/SingleInstanceStateController.js +26 -28
  27. package/lib/node/UniqueInstanceStateController.js +19 -24
  28. package/lib/node/Xhr.weapp.js +58 -81
  29. package/lib/node/decode.js +8 -1
  30. package/lib/node/encode.js +9 -1
  31. package/lib/node/isDangerousKey.js +25 -0
  32. package/lib/react-native/CoreManager.js +3 -4
  33. package/lib/react-native/ObjectStateMutations.js +40 -9
  34. package/lib/react-native/Parse.js +25 -37
  35. package/lib/react-native/ParseFile.js +61 -49
  36. package/lib/react-native/ParseObject.js +28 -27
  37. package/lib/react-native/ParseQuery.js +25 -25
  38. package/lib/react-native/RESTController.js +185 -150
  39. package/lib/react-native/SingleInstanceStateController.js +23 -28
  40. package/lib/react-native/UniqueInstanceStateController.js +19 -24
  41. package/lib/react-native/Xhr.weapp.js +63 -95
  42. package/lib/react-native/decode.js +7 -1
  43. package/lib/react-native/encode.js +7 -1
  44. package/lib/react-native/isDangerousKey.js +17 -0
  45. package/lib/weapp/CoreManager.js +3 -4
  46. package/lib/weapp/ObjectStateMutations.js +51 -9
  47. package/lib/weapp/Parse.js +40 -44
  48. package/lib/weapp/ParseFile.js +72 -53
  49. package/lib/weapp/ParseObject.js +31 -28
  50. package/lib/weapp/ParseOp.js +2 -2
  51. package/lib/weapp/ParseQuery.js +14 -14
  52. package/lib/weapp/RESTController.js +154 -130
  53. package/lib/weapp/SingleInstanceStateController.js +28 -27
  54. package/lib/weapp/UniqueInstanceStateController.js +19 -23
  55. package/lib/weapp/Xhr.weapp.js +62 -102
  56. package/lib/weapp/decode.js +8 -1
  57. package/lib/weapp/encode.js +9 -1
  58. package/lib/weapp/isDangerousKey.js +29 -0
  59. package/node.js +1 -1
  60. package/package.json +33 -35
  61. package/react-native.js +1 -1
  62. package/types/Parse.d.ts +16 -10
  63. package/types/ParseFile.d.ts +19 -4
  64. package/types/ParseObject.d.ts +1 -1
  65. package/types/RESTController.d.ts +2 -7
  66. package/types/SingleInstanceStateController.d.ts +3 -3
  67. package/types/Xhr.weapp.d.ts +1 -29
  68. package/types/isDangerousKey.d.ts +7 -0
  69. package/weapp.js +1 -1
@@ -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
  }
@@ -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/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.2.0-alpha.2",
3
+ "version": "7.0.0-alpha.1",
4
4
  "description": "Parse JavaScript SDK",
5
5
  "homepage": "https://parseplatform.org",
6
6
  "keywords": [
@@ -31,66 +31,62 @@
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
+ "idb-keyval": "6.2.2",
36
36
  "react-native-crypto-js": "1.0.0",
37
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.0",
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.0",
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.24.0",
45
+ "@babel/preset-react": "7.27.1",
46
+ "@babel/preset-typescript": "7.27.1",
47
+ "@eslint/js": "9.31.0",
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": "11.0.6",
55
+ "@semantic-release/npm": "12.0.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.24.0",
62
+ "core-js": "3.44.0",
63
+ "cross-env": "10.1.0",
64
+ "eslint": "9.37.0",
67
65
  "eslint-plugin-expect-type": "0.6.2",
68
- "eslint-plugin-jsdoc": "50.6.9",
66
+ "eslint-plugin-jsdoc": "51.4.1",
69
67
  "express": "5.1.0",
70
- "gulp": "5.0.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
- "jasmine": "5.6.0",
71
+ "jasmine": "5.12.0",
78
72
  "jasmine-reporters": "2.5.2",
79
73
  "jasmine-spec-reporter": "7.0.0",
80
74
  "jest": "29.7.0",
81
- "jest-environment-jsdom": "29.7.0",
75
+ "jest-environment-jsdom": "30.0.5",
82
76
  "jsdoc": "4.0.4",
83
77
  "jsdoc-babel": "0.5.0",
84
- "lint-staged": "15.5.0",
78
+ "lint-staged": "16.2.3",
85
79
  "madge": "8.0.0",
86
80
  "metro-react-native-babel-preset": "0.77.0",
87
- "mongodb-runner": "5.8.1",
88
- "parse-server": "8.1.0",
89
- "puppeteer": "24.6.0",
81
+ "mongodb-runner": "5.10.0",
82
+ "parse-server": "8.2.2",
83
+ "puppeteer": "24.14.0",
90
84
  "regenerator-runtime": "0.14.1",
91
- "semantic-release": "24.2.3",
92
- "typescript-eslint": "8.29.0",
93
- "vinyl-source-stream": "2.0.0"
85
+ "semantic-release": "24.2.9",
86
+ "typescript-eslint": "8.45.0",
87
+ "vite": "6.3.4",
88
+ "vite-plugin-commonjs": "0.10.4",
89
+ "vite-plugin-node-polyfills": "0.24.0"
94
90
  },
95
91
  "optionalDependencies": {
96
92
  "crypto-js": "4.2.0"
@@ -98,6 +94,8 @@
98
94
  "scripts": {
99
95
  "build": "node build_releases.js",
100
96
  "build:types": "tsc",
97
+ "build:browser": "cross-env PARSE_BUILD=browser vite build --config vite.config.umd.ts",
98
+ "build:weapp": "cross-env PARSE_BUILD=weapp vite build --config vite.config.umd.ts",
101
99
  "ci:typecheck": "node ./ci/typecheck.js",
102
100
  "release": "node build_releases.js && npm publish",
103
101
  "test": "cross-env PARSE_BUILD=node jest",
@@ -108,7 +106,7 @@
108
106
  "lint:fix": "eslint --fix --cache src/ integration/",
109
107
  "test:types": "eslint types/tests.ts -c ./types/eslint.config.mjs",
110
108
  "watch": "cross-env PARSE_BUILD=${PARSE_BUILD} gulp watch",
111
- "watch:browser": "cross-env PARSE_BUILD=browser npm run watch",
109
+ "watch:browser": "cross-env PARSE_BUILD=browser vite build --watch --config vite.config.ts",
112
110
  "watch:node": "cross-env PARSE_BUILD=node npm run watch",
113
111
  "watch:react-native": "cross-env PARSE_BUILD=react-native npm run watch",
114
112
  "watch:ts": "tsc --watch",
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.
@@ -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;
@@ -1,29 +1 @@
1
- declare class XhrWeapp {
2
- UNSENT: number;
3
- OPENED: number;
4
- HEADERS_RECEIVED: number;
5
- LOADING: number;
6
- DONE: number;
7
- header: any;
8
- readyState: any;
9
- status: number;
10
- response: string | undefined;
11
- responseType: string;
12
- responseText: string;
13
- responseHeader: any;
14
- method: string;
15
- url: string;
16
- onabort: () => void;
17
- onprogress: () => void;
18
- onerror: () => void;
19
- onreadystatechange: () => void;
20
- requestTask: any;
21
- constructor();
22
- getAllResponseHeaders(): string;
23
- getResponseHeader(key: any): any;
24
- setRequestHeader(key: any, value: any): void;
25
- open(method: any, url: any): void;
26
- abort(): void;
27
- send(data: any): void;
28
- }
29
- export default XhrWeapp;
1
+ export declare function polyfillFetch(): void;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Check if a property name or path is potentially dangerous for prototype pollution
3
+ * Dangerous keys include: __proto__, constructor, prototype
4
+ * @param key - The property name or dotted path to check
5
+ * @returns true if the key is dangerous, false otherwise
6
+ */
7
+ export declare function isDangerousKey(key: string): boolean;
package/weapp.js CHANGED
@@ -1 +1 @@
1
- module.exports = require('./lib/weapp/Parse.js');
1
+ module.exports = require('./lib/weapp/Parse.js').default;