parse 8.1.1-alpha.3 → 8.1.1-alpha.5

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.
@@ -18,7 +18,7 @@ const config = {
18
18
  SERVER_URL: 'https://api.parse.com/1',
19
19
  LIVEQUERY_SERVER_URL: null,
20
20
  ENCRYPTED_KEY: null,
21
- VERSION: 'js' + "8.1.1-alpha.3",
21
+ VERSION: 'js' + "8.1.1-alpha.5",
22
22
  APPLICATION_ID: null,
23
23
  JAVASCRIPT_KEY: null,
24
24
  MAINTENANCE_KEY: null,
@@ -91,6 +91,12 @@ function _objectSpread(e) {
91
91
  }
92
92
  return e;
93
93
  }
94
+ /** Options for destroyAll batch operation */
95
+
96
+ /** Options for saveAll batch operation */
97
+
98
+ /** Options for fetchAll batch operation */
99
+
94
100
  // Mapping of class names to constructors, so we can populate objects from the
95
101
  // server with appropriate subclasses of ParseObject
96
102
  const classMap = (0, _create.default)(null);
@@ -30,6 +30,8 @@ var _ParseGeoPoint = _interopRequireDefault(require("./ParseGeoPoint"));
30
30
  var _ParseObject = _interopRequireDefault(require("./ParseObject"));
31
31
  var _OfflineQuery = _interopRequireDefault(require("./OfflineQuery"));
32
32
  var _LocalDatastoreUtils = require("./LocalDatastoreUtils");
33
+ /** CountOptions - no json since count() returns a number, not objects */
34
+
33
35
  /**
34
36
  * Converts a string into a regex that matches it.
35
37
  * Surrounding with \Q .. \E does this, we just need to escape any \E's in
@@ -9,6 +9,8 @@ exports.getPushStatus = getPushStatus;
9
9
  exports.send = send;
10
10
  var _CoreManager = _interopRequireDefault(require("./CoreManager"));
11
11
  var _ParseQuery = _interopRequireDefault(require("./ParseQuery"));
12
+ /** Options for Push.send operation */
13
+
12
14
  /**
13
15
  * Contains functions to deal with Push in Parse.
14
16
  *
@@ -49,6 +49,7 @@ function _objectSpread(e) {
49
49
  }
50
50
  return e;
51
51
  } /* global XMLHttpRequest, XDomainRequest */
52
+ /** Base options for all Parse requests that go through _getRequestOptions */
52
53
 
53
54
  let useXDomainRequest = false;
54
55
  // @ts-ignore
@@ -14,7 +14,7 @@ const config = {
14
14
  SERVER_URL: 'https://api.parse.com/1',
15
15
  LIVEQUERY_SERVER_URL: null,
16
16
  ENCRYPTED_KEY: null,
17
- VERSION: 'js' + "8.1.1-alpha.3",
17
+ VERSION: 'js' + "8.1.1-alpha.5",
18
18
  APPLICATION_ID: null,
19
19
  JAVASCRIPT_KEY: null,
20
20
  MAINTENANCE_KEY: null,
@@ -47,6 +47,12 @@ function _interopRequireDefault(e) {
47
47
  default: e
48
48
  };
49
49
  }
50
+ /** Options for destroyAll batch operation */
51
+
52
+ /** Options for saveAll batch operation */
53
+
54
+ /** Options for fetchAll batch operation */
55
+
50
56
  // Mapping of class names to constructors, so we can populate objects from the
51
57
  // server with appropriate subclasses of ParseObject
52
58
  const classMap = Object.create(null);
@@ -17,6 +17,8 @@ function _interopRequireDefault(e) {
17
17
  default: e
18
18
  };
19
19
  }
20
+ /** CountOptions - no json since count() returns a number, not objects */
21
+
20
22
  /**
21
23
  * Converts a string into a regex that matches it.
22
24
  * Surrounding with \Q .. \E does this, we just need to escape any \E's in
package/lib/node/Push.js CHANGED
@@ -12,6 +12,8 @@ function _interopRequireDefault(e) {
12
12
  default: e
13
13
  };
14
14
  }
15
+ /** Options for Push.send operation */
16
+
15
17
  /**
16
18
  * Contains functions to deal with Push in Parse.
17
19
  *
@@ -16,6 +16,8 @@ function _interopRequireDefault(e) {
16
16
  }
17
17
  /* global XMLHttpRequest, XDomainRequest */
18
18
 
19
+ /** Base options for all Parse requests that go through _getRequestOptions */
20
+
19
21
  let useXDomainRequest = false;
20
22
  // @ts-ignore
21
23
  if (typeof XDomainRequest !== 'undefined' && !('withCredentials' in new XMLHttpRequest())) {
@@ -10,7 +10,7 @@ var config = {
10
10
  SERVER_URL: 'https://api.parse.com/1',
11
11
  LIVEQUERY_SERVER_URL: null,
12
12
  ENCRYPTED_KEY: null,
13
- VERSION: 'js' + "8.1.1-alpha.3",
13
+ VERSION: 'js' + "8.1.1-alpha.5",
14
14
  APPLICATION_ID: null,
15
15
  JAVASCRIPT_KEY: null,
16
16
  MAINTENANCE_KEY: null,
@@ -133,12 +133,12 @@ var ParseObject = function () {
133
133
  key: "_getStateIdentifier",
134
134
  value: function () {
135
135
  if (singleInstance) {
136
- var id = this.id;
137
- if (!id) {
138
- id = this._getId();
136
+ var _id = this.id;
137
+ if (!_id) {
138
+ _id = this._getId();
139
139
  }
140
140
  return {
141
- id: id,
141
+ id: _id,
142
142
  className: this.className
143
143
  };
144
144
  } else {
@@ -189,8 +189,8 @@ var ParseObject = function () {
189
189
  var val = attributes[attr];
190
190
  if (val && typeof val === 'object' && !(val instanceof ParseObject) && !(val instanceof _ParseFile.default) && !(val instanceof _ParseRelation.default)) {
191
191
  try {
192
- var json = (0, _encode.default)(val, false, true);
193
- var stringified = JSON.stringify(json);
192
+ var _json = (0, _encode.default)(val, false, true);
193
+ var stringified = JSON.stringify(_json);
194
194
  if (objectCache[attr] !== stringified) {
195
195
  dirty[attr] = val;
196
196
  }
@@ -1311,17 +1311,17 @@ var DefaultController = {
1311
1311
  }
1312
1312
  var objs = [];
1313
1313
  var ids = [];
1314
- var className = null;
1314
+ var _className = null;
1315
1315
  var results = [];
1316
1316
  var error = null;
1317
1317
  target.forEach(function (el) {
1318
1318
  if (error) {
1319
1319
  return;
1320
1320
  }
1321
- if (!className) {
1322
- className = el.className;
1321
+ if (!_className) {
1322
+ _className = el.className;
1323
1323
  }
1324
- if (className !== el.className) {
1324
+ if (_className !== el.className) {
1325
1325
  error = new _ParseError.default(_ParseError.default.INVALID_CLASS_NAME, 'All objects should be of the same class');
1326
1326
  }
1327
1327
  if (!el.id) {
@@ -1337,7 +1337,7 @@ var DefaultController = {
1337
1337
  return Promise.reject(error);
1338
1338
  }
1339
1339
  var ParseQuery = _CoreManager.default.getParseQuery();
1340
- var query = new ParseQuery(className);
1340
+ var query = new ParseQuery(_className);
1341
1341
  query.containedIn('objectId', ids);
1342
1342
  if (options && options.include) {
1343
1343
  query.include(options.include);
@@ -1361,9 +1361,9 @@ var DefaultController = {
1361
1361
  for (var _i = 0; _i < results.length; _i++) {
1362
1362
  var _obj = results[_i];
1363
1363
  if (_obj && _obj.id && idMap[_obj.id]) {
1364
- var id = _obj.id;
1365
- _obj._finishFetch(idMap[id].toJSON());
1366
- results[_i] = idMap[id];
1364
+ var _id2 = _obj.id;
1365
+ _obj._finishFetch(idMap[_id2].toJSON());
1366
+ results[_i] = idMap[_id2];
1367
1367
  }
1368
1368
  }
1369
1369
  }
@@ -18,7 +18,7 @@ const config = {
18
18
  SERVER_URL: 'https://api.parse.com/1',
19
19
  LIVEQUERY_SERVER_URL: null,
20
20
  ENCRYPTED_KEY: null,
21
- VERSION: 'js' + "8.1.1-alpha.3",
21
+ VERSION: 'js' + "8.1.1-alpha.5",
22
22
  APPLICATION_ID: null,
23
23
  JAVASCRIPT_KEY: null,
24
24
  MAINTENANCE_KEY: null,
@@ -91,6 +91,12 @@ function _objectSpread(e) {
91
91
  }
92
92
  return e;
93
93
  }
94
+ /** Options for destroyAll batch operation */
95
+
96
+ /** Options for saveAll batch operation */
97
+
98
+ /** Options for fetchAll batch operation */
99
+
94
100
  // Mapping of class names to constructors, so we can populate objects from the
95
101
  // server with appropriate subclasses of ParseObject
96
102
  const classMap = (0, _create.default)(null);
@@ -30,6 +30,8 @@ var _ParseGeoPoint = _interopRequireDefault(require("./ParseGeoPoint"));
30
30
  var _ParseObject = _interopRequireDefault(require("./ParseObject"));
31
31
  var _OfflineQuery = _interopRequireDefault(require("./OfflineQuery"));
32
32
  var _LocalDatastoreUtils = require("./LocalDatastoreUtils");
33
+ /** CountOptions - no json since count() returns a number, not objects */
34
+
33
35
  /**
34
36
  * Converts a string into a regex that matches it.
35
37
  * Surrounding with \Q .. \E does this, we just need to escape any \E's in
package/lib/weapp/Push.js CHANGED
@@ -9,6 +9,8 @@ exports.getPushStatus = getPushStatus;
9
9
  exports.send = send;
10
10
  var _CoreManager = _interopRequireDefault(require("./CoreManager"));
11
11
  var _ParseQuery = _interopRequireDefault(require("./ParseQuery"));
12
+ /** Options for Push.send operation */
13
+
12
14
  /**
13
15
  * Contains functions to deal with Push in Parse.
14
16
  *
@@ -49,6 +49,7 @@ function _objectSpread(e) {
49
49
  }
50
50
  return e;
51
51
  } /* global XMLHttpRequest, XDomainRequest */
52
+ /** Base options for all Parse requests that go through _getRequestOptions */
52
53
 
53
54
  (0, _Xhr.polyfillFetch)();
54
55
  let useXDomainRequest = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "parse",
3
- "version": "8.1.1-alpha.3",
3
+ "version": "8.1.1-alpha.5",
4
4
  "description": "Parse JavaScript SDK",
5
5
  "homepage": "https://parseplatform.org",
6
6
  "keywords": [
@@ -87,8 +87,8 @@
87
87
  "@semantic-release/changelog": "6.0.3",
88
88
  "@semantic-release/commit-analyzer": "13.0.1",
89
89
  "@semantic-release/git": "10.0.1",
90
- "@semantic-release/github": "12.0.3",
91
- "@semantic-release/npm": "13.1.3",
90
+ "@semantic-release/github": "12.0.5",
91
+ "@semantic-release/npm": "13.1.4",
92
92
  "@semantic-release/release-notes-generator": "14.1.0",
93
93
  "@types/facebook-js-sdk": "3.3.11",
94
94
  "babel-jest": "30.2.0",
@@ -99,7 +99,7 @@
99
99
  "cross-env": "10.1.0",
100
100
  "eslint": "9.39.2",
101
101
  "eslint-plugin-expect-type": "0.6.2",
102
- "eslint-plugin-jsdoc": "62.5.2",
102
+ "eslint-plugin-jsdoc": "62.5.4",
103
103
  "express": "5.2.1",
104
104
  "gulp": "5.0.1",
105
105
  "gulp-babel": "8.0.0",
@@ -119,7 +119,7 @@
119
119
  "puppeteer": "24.37.2",
120
120
  "regenerator-runtime": "0.14.1",
121
121
  "semantic-release": "25.0.3",
122
- "typescript-eslint": "8.54.0",
122
+ "typescript-eslint": "8.55.0",
123
123
  "vite": "7.3.1",
124
124
  "vite-plugin-commonjs": "0.10.4",
125
125
  "vite-plugin-node-polyfills": "0.25.0"
package/types/Cloud.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import ParseObject from './ParseObject';
2
- import type { RequestOptions } from './RESTController';
2
+ import type { BaseRequestOptions } from './RESTController';
3
+ export type RunOptions = BaseRequestOptions;
3
4
  /**
4
5
  * Contains functions for calling and declaring
5
6
  * <a href="/docs/cloud_code_guide#functions">cloud functions</a>.
@@ -30,10 +31,10 @@ import type { RequestOptions } from './RESTController';
30
31
  * @returns {Promise} A promise that will be resolved with the result
31
32
  * of the function.
32
33
  */
33
- export declare function run<T extends () => any>(name: string, data?: null, options?: RequestOptions): Promise<ReturnType<T>>;
34
+ export declare function run<T extends () => any>(name: string, data?: null, options?: RunOptions): Promise<ReturnType<T>>;
34
35
  export declare function run<T extends (param: {
35
36
  [P in keyof Parameters<T>[0]]: Parameters<T>[0][P];
36
- }) => any>(name: string, data: Parameters<T>[0], options?: RequestOptions): Promise<ReturnType<T>>;
37
+ }) => any>(name: string, data: Parameters<T>[0], options?: RunOptions): Promise<ReturnType<T>>;
37
38
  /**
38
39
  * Gets data for the current set of cloud jobs.
39
40
  *
@@ -4,7 +4,7 @@ import ParseFile from './ParseFile';
4
4
  import { Op } from './ParseOp';
5
5
  import ParseRelation from './ParseRelation';
6
6
  import type { AttributeMap, OpsMap } from './ObjectStateMutations';
7
- import type { RequestOptions, FullOptions } from './RESTController';
7
+ import type { RequestOptions, FullOptions, BaseRequestOptions } from './RESTController';
8
8
  import type ParseGeoPoint from './ParseGeoPoint';
9
9
  import type ParsePolygon from './ParsePolygon';
10
10
  export interface Pointer {
@@ -18,40 +18,63 @@ interface SaveParams {
18
18
  path: string;
19
19
  body: AttributeMap;
20
20
  }
21
- export type SaveOptions = FullOptions & {
21
+ export interface SaveOptions extends BaseRequestOptions {
22
+ /** If `false`, nested objects will not be saved (default is `true`). */
22
23
  cascadeSave?: boolean;
23
- context?: AttributeMap;
24
24
  batchSize?: number;
25
25
  transaction?: boolean;
26
- };
27
- interface FetchOptions {
28
- useMasterKey?: boolean;
29
- sessionToken?: string;
26
+ }
27
+ export interface FetchOptions extends BaseRequestOptions {
30
28
  include?: string | string[];
31
- context?: AttributeMap;
32
29
  }
33
30
  export interface SetOptions {
34
31
  ignoreValidation?: boolean;
35
32
  unset?: boolean;
36
33
  }
34
+ export type DestroyOptions = BaseRequestOptions;
35
+ /** Options for destroyAll batch operation */
36
+ export interface DestroyAllOptions extends BaseRequestOptions {
37
+ /** batchSize: How many objects to yield in each batch (default: 20) */
38
+ batchSize?: number;
39
+ /** Set to true to enable transactions */
40
+ transaction?: boolean;
41
+ }
42
+ /** Options for saveAll batch operation */
43
+ export interface SaveAllOptions extends BaseRequestOptions {
44
+ /** batchSize: How many objects to yield in each batch (default: 20) */
45
+ batchSize?: number;
46
+ /** If `false`, nested objects will not be saved (default is `true`). */
47
+ cascadeSave?: boolean;
48
+ /** Set to true to enable transactions */
49
+ transaction?: boolean;
50
+ }
51
+ /** Options for fetchAll batch operation */
52
+ export interface FetchAllOptions extends BaseRequestOptions {
53
+ include?: string | string[];
54
+ }
37
55
  export type AttributeKey<T> = Extract<keyof T, string>;
38
56
  export type Attributes = Record<string, any>;
39
- interface JSONBaseAttributes {
57
+ export interface JSONBaseAttributes {
40
58
  objectId: string;
41
59
  createdAt: string;
42
60
  updatedAt: string;
43
61
  }
62
+ export interface BaseAttributes {
63
+ objectId: string;
64
+ createdAt: Date;
65
+ updatedAt: Date;
66
+ }
44
67
  interface CommonAttributes {
45
68
  ACL: ParseACL;
46
69
  }
47
70
  type AtomicKey<T> = {
48
71
  [K in keyof T]: NonNullable<T[K]> extends any[] ? K : never;
49
72
  };
50
- type Encode<T> = T extends ParseObject ? ReturnType<T['toJSON']> | Pointer : T extends ParseACL | ParseGeoPoint | ParsePolygon | ParseRelation | ParseFile ? ReturnType<T['toJSON']> : T extends Date ? {
73
+ export type Encode<T> = T extends ParseObject ? ReturnType<T['toJSON']> | Pointer : T extends ParseACL | ParseGeoPoint | ParsePolygon | ParseRelation | ParseFile ? ReturnType<T['toJSON']> : T extends Date ? {
51
74
  __type: 'Date';
52
75
  iso: string;
53
76
  } : T extends RegExp ? string : T extends (infer R)[] ? Encode<R>[] : T extends object ? ToJSON<T> : T;
54
- type ToJSON<T> = {
77
+ export type ToJSON<T> = {
55
78
  [K in keyof T]: Encode<T[K]>;
56
79
  };
57
80
  /**
@@ -594,7 +617,7 @@ declare class ParseObject<T extends Attributes = Attributes> {
594
617
  * @returns {Promise} A promise that is fulfilled when the destroy
595
618
  * completes.
596
619
  */
597
- destroy(options?: RequestOptions): Promise<ParseObject | undefined>;
620
+ destroy(options?: DestroyOptions): Promise<ParseObject | undefined>;
598
621
  /**
599
622
  * Asynchronously stores the object and every object it points to in the local datastore,
600
623
  * recursively, using a default pin name: _default.
@@ -701,7 +724,7 @@ declare class ParseObject<T extends Attributes = Attributes> {
701
724
  * @static
702
725
  * @returns {Parse.Object[]}
703
726
  */
704
- static fetchAll<T extends ParseObject>(list: T[], options?: RequestOptions): Promise<T[]>;
727
+ static fetchAll<T extends ParseObject>(list: T[], options?: FetchAllOptions): Promise<T[]>;
705
728
  /**
706
729
  * Fetches the given list of Parse.Object.
707
730
  *
@@ -790,7 +813,7 @@ declare class ParseObject<T extends Attributes = Attributes> {
790
813
  * @static
791
814
  * @returns {Parse.Object[]}
792
815
  */
793
- static fetchAllIfNeeded<T extends ParseObject>(list: T[], options?: FetchOptions): Promise<T[]>;
816
+ static fetchAllIfNeeded<T extends ParseObject>(list: T[], options?: FetchAllOptions): Promise<T[]>;
794
817
  static handleIncludeOptions(options: {
795
818
  include?: string | string[];
796
819
  }): any[];
@@ -849,7 +872,7 @@ declare class ParseObject<T extends Attributes = Attributes> {
849
872
  * @returns {Promise} A promise that is fulfilled when the destroyAll
850
873
  * completes.
851
874
  */
852
- static destroyAll(list: ParseObject[], options?: SaveOptions): Promise<ParseObject<Attributes> | ParseObject<Attributes>[]>;
875
+ static destroyAll<T extends ParseObject>(list: T[], options?: DestroyAllOptions): Promise<T[]>;
853
876
  /**
854
877
  * Saves the given list of Parse.Object.
855
878
  * If any error is encountered, stops and calls the error handler.
@@ -879,7 +902,7 @@ declare class ParseObject<T extends Attributes = Attributes> {
879
902
  * @static
880
903
  * @returns {Parse.Object[]}
881
904
  */
882
- static saveAll<T extends ParseObject[]>(list: T, options?: SaveOptions): Promise<T>;
905
+ static saveAll<T extends ParseObject[]>(list: T, options?: SaveAllOptions): Promise<T>;
883
906
  /**
884
907
  * Creates a reference to a subclass of Parse.Object with the given id. This
885
908
  * does not exist on Parse.Object, only on subclasses.
@@ -1067,4 +1090,32 @@ declare class ParseObject<T extends Attributes = Attributes> {
1067
1090
  */
1068
1091
  static unPinAllObjectsWithName(name: string): Promise<void>;
1069
1092
  }
1093
+ export interface ObjectStatic<T extends ParseObject = ParseObject> {
1094
+ new (...args: any[]): T;
1095
+ createWithoutData(id: string): T;
1096
+ destroyAll<U extends ParseObject>(list: U[], options?: DestroyAllOptions): Promise<U[]>;
1097
+ extend(className: string | {
1098
+ className: string;
1099
+ }, protoProps?: any, classProps?: any): any;
1100
+ fetchAll<U extends ParseObject>(list: U[], options?: FetchAllOptions): Promise<U[]>;
1101
+ fetchAllIfNeeded<U extends ParseObject>(list: U[], options?: FetchAllOptions): Promise<U[]>;
1102
+ fetchAllIfNeededWithInclude<U extends ParseObject>(list: U[], keys: keyof U['attributes'] | (keyof U['attributes'])[], options?: RequestOptions): Promise<U[]>;
1103
+ fetchAllWithInclude<U extends ParseObject>(list: U[], keys: keyof U['attributes'] | (keyof U['attributes'])[], options?: RequestOptions): Promise<U[]>;
1104
+ fromJSON(json: any, override?: boolean, dirty?: boolean): T;
1105
+ pinAll(objects: ParseObject[]): Promise<void>;
1106
+ pinAllWithName(name: string, objects: ParseObject[]): Promise<void>;
1107
+ registerSubclass(className: string, clazz: new (options?: any) => T): void;
1108
+ saveAll<U extends ParseObject[]>(list: U, options?: SaveAllOptions): Promise<U>;
1109
+ unPinAll(objects: ParseObject[]): Promise<void>;
1110
+ unPinAllObjects(): Promise<void>;
1111
+ unPinAllObjectsWithName(name: string): Promise<void>;
1112
+ unPinAllWithName(name: string, objects: ParseObject[]): Promise<void>;
1113
+ }
1114
+ export interface ObjectConstructor extends ObjectStatic {
1115
+ new <T extends Attributes>(className: string, attributes: T, options?: any): ParseObject<T>;
1116
+ new (className?: string | {
1117
+ className: string;
1118
+ [attr: string]: any;
1119
+ }, attributes?: Attributes, options?: any): ParseObject;
1120
+ }
1070
1121
  export default ParseObject;
@@ -1,24 +1,22 @@
1
1
  import ParseGeoPoint from './ParseGeoPoint';
2
2
  import ParseObject from './ParseObject';
3
3
  import type LiveQuerySubscription from './LiveQuerySubscription';
4
- import type { FullOptions } from './RESTController';
5
- import type { Pointer } from './ParseObject';
6
- type BatchOptions = FullOptions & {
4
+ import type { BaseRequestOptions } from './RESTController';
5
+ import type { Pointer, BaseAttributes } from './ParseObject';
6
+ export interface BatchOptions extends BaseRequestOptions {
7
7
  batchSize?: number;
8
- useMasterKey?: boolean;
9
- useMaintenanceKey?: boolean;
10
- sessionToken?: string;
11
- context?: Record<string, any>;
12
8
  json?: boolean;
13
- };
9
+ }
14
10
  export type WhereClause = Record<string, any>;
15
- interface QueryOptions {
16
- useMasterKey?: boolean;
17
- sessionToken?: string;
18
- context?: Record<string, any>;
11
+ export interface QueryOptions extends BaseRequestOptions {
19
12
  json?: boolean;
20
13
  }
21
- interface FullTextQueryOptions {
14
+ export type FindOptions = QueryOptions;
15
+ /** CountOptions - no json since count() returns a number, not objects */
16
+ export type CountOptions = BaseRequestOptions;
17
+ export type GetOptions = QueryOptions;
18
+ export type FirstOptions = QueryOptions;
19
+ export interface FullTextOptions {
22
20
  language?: string;
23
21
  caseSensitive?: boolean;
24
22
  diacriticSensitive?: boolean;
@@ -41,11 +39,6 @@ export interface QueryJSON {
41
39
  subqueryReadPreference?: string;
42
40
  comment?: string;
43
41
  }
44
- interface BaseAttributes {
45
- createdAt: Date;
46
- objectId: string;
47
- updatedAt: Date;
48
- }
49
42
  /**
50
43
  * Creates a new parse Parse.Query for the given Parse.Object subclass.
51
44
  *
@@ -209,7 +202,7 @@ declare class ParseQuery<T extends ParseObject = ParseObject> {
209
202
  * @returns {Promise} A promise that is resolved with the result when
210
203
  * the query completes.
211
204
  */
212
- get(objectId: string, options?: QueryOptions): Promise<T>;
205
+ get(objectId: string, options?: GetOptions): Promise<T>;
213
206
  /**
214
207
  * Retrieves a list of ParseObjects that satisfy this query.
215
208
  *
@@ -225,7 +218,7 @@ declare class ParseQuery<T extends ParseObject = ParseObject> {
225
218
  * @returns {Promise} A promise that is resolved with the results when
226
219
  * the query completes.
227
220
  */
228
- find(options?: QueryOptions): Promise<T[]>;
221
+ find(options?: FindOptions): Promise<T[]>;
229
222
  /**
230
223
  * Retrieves a complete list of ParseObjects that satisfy this query.
231
224
  * Using `eachBatch` under the hood to fetch all the valid objects.
@@ -257,10 +250,7 @@ declare class ParseQuery<T extends ParseObject = ParseObject> {
257
250
  * @returns {Promise} A promise that is resolved with the count when
258
251
  * the query completes.
259
252
  */
260
- count(options?: {
261
- useMasterKey?: boolean;
262
- sessionToken?: string;
263
- }): Promise<number>;
253
+ count(options?: CountOptions): Promise<number>;
264
254
  /**
265
255
  * Executes a distinct query and returns unique values
266
256
  *
@@ -291,7 +281,7 @@ declare class ParseQuery<T extends ParseObject = ParseObject> {
291
281
  * @returns {Promise} A promise that is resolved with the object when
292
282
  * the query completes.
293
283
  */
294
- first(options?: QueryOptions): Promise<T | undefined>;
284
+ first(options?: FirstOptions): Promise<T | undefined>;
295
285
  /**
296
286
  * Iterates over objects matching a query, calling a callback for each batch.
297
287
  * If the callback returns a promise, the iteration will not continue until
@@ -427,7 +417,7 @@ declare class ParseQuery<T extends ParseObject = ParseObject> {
427
417
  * @param value The value that the Parse.Object must contain.
428
418
  * @returns {Parse.Query} Returns the query, so you can chain this call.
429
419
  */
430
- equalTo<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K, value: T['attributes'][K] | (T['attributes'][K] extends ParseObject ? Pointer : T['attributes'][K] extends (infer E)[] ? E : never)): this;
420
+ equalTo<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K, value: T['attributes'][K] | (NonNullable<T['attributes'][K]> extends ParseObject ? Pointer : NonNullable<T['attributes'][K]> extends (infer E)[] ? E : never)): this;
431
421
  /**
432
422
  * Adds a constraint to the query that requires a particular key's value to
433
423
  * be not equal to the provided value.
@@ -436,7 +426,7 @@ declare class ParseQuery<T extends ParseObject = ParseObject> {
436
426
  * @param value The value that must not be equalled.
437
427
  * @returns {Parse.Query} Returns the query, so you can chain this call.
438
428
  */
439
- notEqualTo<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K, value: T['attributes'][K] | (T['attributes'][K] extends ParseObject ? Pointer : T['attributes'][K] extends (infer E)[] ? E : never)): this;
429
+ notEqualTo<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K, value: T['attributes'][K] | (NonNullable<T['attributes'][K]> extends ParseObject ? Pointer : NonNullable<T['attributes'][K]> extends (infer E)[] ? E : never)): this;
440
430
  /**
441
431
  * Adds a constraint to the query that requires a particular key's value to
442
432
  * be less than the provided value.
@@ -625,7 +615,7 @@ declare class ParseQuery<T extends ParseObject = ParseObject> {
625
615
  * @param {boolean} options.diacriticSensitive A boolean flag to enable or disable diacritic sensitive search.
626
616
  * @returns {Parse.Query} Returns the query, so you can chain this call.
627
617
  */
628
- fullText<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K, value: string, options?: FullTextQueryOptions): this;
618
+ fullText<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K, value: string, options?: FullTextOptions): this;
629
619
  /**
630
620
  * Method to sort the full text search by text score
631
621
  *
@@ -7,22 +7,24 @@ import type ParseRelation from './ParseRelation';
7
7
  import type { PermissionsMap } from './ParseCLP';
8
8
  import type { Pointer } from './ParseObject';
9
9
  type Bytes = string;
10
- type TYPE = 'String' | 'Number' | 'Bytes' | 'Boolean' | 'Date' | 'File' | 'GeoPoint' | 'Polygon' | 'Array' | 'Object' | 'Pointer' | 'Relation';
11
- type AttrType<T extends ParseObject, V> = Extract<{
10
+ export type FieldType = TYPE;
11
+ export type TYPE = 'String' | 'Number' | 'Bytes' | 'Boolean' | 'Date' | 'File' | 'GeoPoint' | 'Polygon' | 'Array' | 'Object' | 'Pointer' | 'Relation';
12
+ export type AttrType<T extends ParseObject, V> = Extract<{
12
13
  [K in keyof T['attributes']]: T['attributes'][K] extends V ? K : never;
13
14
  }[keyof T['attributes']], string>;
14
- interface FieldOptions<T extends string | number | boolean | Bytes | Date | ParseFile | ParseGeoPoint | ParsePolygon | any[] | object | Pointer | ParseRelation = any> {
15
+ export type SupportedFieldTypes = string | number | boolean | Bytes | Date | ParseFile | ParseGeoPoint | ParsePolygon | any[] | object | Pointer | ParseRelation;
16
+ export interface FieldOptions<T extends SupportedFieldTypes = any> {
15
17
  required?: boolean | undefined;
16
18
  defaultValue?: T | undefined;
17
19
  targetClass?: string | undefined;
18
20
  }
19
- type Index = Record<string, number | string>;
20
- interface CLPField {
21
+ export type Index = Record<string, number | string>;
22
+ export interface CLPField {
21
23
  '*'?: boolean | undefined;
22
24
  requiresAuthentication?: boolean | undefined;
23
25
  [userIdOrRoleName: string]: boolean | undefined;
24
26
  }
25
- interface CLP {
27
+ export interface CLP {
26
28
  find?: CLPField | undefined;
27
29
  get?: CLPField | undefined;
28
30
  count?: CLPField | undefined;
@@ -34,7 +36,7 @@ interface CLP {
34
36
  writeUserFields?: string[] | undefined;
35
37
  protectedFields?: Record<string, string[]>;
36
38
  }
37
- interface RestSchema {
39
+ export interface RestSchema {
38
40
  className: string;
39
41
  fields: Record<string, {
40
42
  type: string;
@@ -10,6 +10,10 @@ export interface AuthProvider {
10
10
  getAuthType(): string;
11
11
  deauthenticate?(): void;
12
12
  }
13
+ export interface SignUpOptions {
14
+ useMasterKey?: boolean;
15
+ installationId?: string;
16
+ }
13
17
  /**
14
18
  * <p>A Parse.User object is a local representation of a user persisted to the
15
19
  * Parse cloud. This class is a subclass of a Parse.Object, and retains the
@@ -194,7 +198,7 @@ declare class ParseUser<T extends Attributes = Attributes> extends ParseObject<T
194
198
  * @returns {Promise} A promise that is fulfilled when the signup
195
199
  * finishes.
196
200
  */
197
- signUp(attrs?: Attributes | null, options?: FullOptions & {
201
+ signUp(attrs?: Attributes | null, options?: SignUpOptions & {
198
202
  context?: Attributes;
199
203
  }): Promise<ParseUser>;
200
204
  /**
package/types/Push.d.ts CHANGED
@@ -10,6 +10,8 @@ export interface PushData {
10
10
  data?: any;
11
11
  channels?: string[];
12
12
  }
13
+ /** Options for Push.send operation */
14
+ export type SendOptions = FullOptions;
13
15
  /**
14
16
  * Contains functions to deal with Push in Parse.
15
17
  *
@@ -1,3 +1,11 @@
1
+ /** Base options for all Parse requests that go through _getRequestOptions */
2
+ export interface BaseRequestOptions {
3
+ useMasterKey?: boolean;
4
+ useMaintenanceKey?: boolean;
5
+ sessionToken?: string;
6
+ installationId?: string;
7
+ context?: Record<string, unknown>;
8
+ }
1
9
  export interface RequestOptions {
2
10
  useMasterKey?: boolean;
3
11
  useMaintenanceKey?: boolean;