parse 6.1.0 → 6.2.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 (68) hide show
  1. package/dist/parse.js +32 -42
  2. package/dist/parse.min.js +2 -2
  3. package/dist/parse.weapp.js +32 -42
  4. package/dist/parse.weapp.min.js +2 -2
  5. package/lib/browser/CoreManager.js +1 -1
  6. package/lib/browser/Parse.js +14 -14
  7. package/lib/browser/ParseFile.js +2 -2
  8. package/lib/browser/ParseObject.js +3 -2
  9. package/lib/browser/ParseOp.js +1 -1
  10. package/lib/browser/ParseQuery.js +8 -20
  11. package/lib/browser/TaskQueue.js +1 -0
  12. package/lib/browser/equals.js +1 -1
  13. package/lib/node/CoreManager.js +1 -1
  14. package/lib/node/Parse.js +14 -14
  15. package/lib/node/ParseFile.js +2 -2
  16. package/lib/node/ParseObject.js +3 -2
  17. package/lib/node/ParseOp.js +1 -1
  18. package/lib/node/ParseQuery.js +8 -20
  19. package/lib/node/TaskQueue.js +1 -0
  20. package/lib/node/equals.js +1 -1
  21. package/lib/react-native/CoreManager.js +1 -1
  22. package/lib/react-native/ObjectStateMutations.js +13 -13
  23. package/lib/react-native/ParseACL.js +7 -7
  24. package/lib/react-native/ParseCLP.js +15 -15
  25. package/lib/react-native/ParseFile.js +1 -1
  26. package/lib/react-native/ParseObject.js +10 -10
  27. package/lib/react-native/ParseQuery.js +8 -16
  28. package/lib/react-native/ParseUser.js +15 -15
  29. package/lib/react-native/equals.js +1 -1
  30. package/lib/weapp/CoreManager.js +1 -1
  31. package/lib/weapp/Parse.js +14 -14
  32. package/lib/weapp/ParseFile.js +2 -2
  33. package/lib/weapp/ParseObject.js +3 -2
  34. package/lib/weapp/ParseOp.js +1 -1
  35. package/lib/weapp/ParseQuery.js +8 -20
  36. package/lib/weapp/TaskQueue.js +1 -0
  37. package/lib/weapp/equals.js +1 -1
  38. package/package.json +13 -24
  39. package/types/Analytics.d.ts +1 -3
  40. package/types/CoreManager.d.ts +56 -62
  41. package/types/LocalDatastore.d.ts +3 -3
  42. package/types/LocalDatastoreController.default.d.ts +1 -1
  43. package/types/LocalDatastoreController.react-native.d.ts +1 -1
  44. package/types/ObjectStateMutations.d.ts +12 -18
  45. package/types/Parse.d.ts +63 -324
  46. package/types/ParseACL.d.ts +2 -6
  47. package/types/ParseCLP.d.ts +2 -6
  48. package/types/ParseConfig.d.ts +3 -11
  49. package/types/ParseFile.d.ts +9 -13
  50. package/types/ParseInstallation.d.ts +4 -4
  51. package/types/ParseObject.d.ts +24 -26
  52. package/types/ParseOp.d.ts +13 -15
  53. package/types/ParsePolygon.d.ts +3 -3
  54. package/types/ParseQuery.d.ts +39 -55
  55. package/types/ParseSchema.d.ts +12 -28
  56. package/types/ParseUser.d.ts +8 -14
  57. package/types/Push.d.ts +2 -2
  58. package/types/RESTController.d.ts +4 -4
  59. package/types/SingleInstanceStateController.d.ts +1 -1
  60. package/types/Storage.d.ts +2 -2
  61. package/types/StorageController.react-native.d.ts +2 -2
  62. package/types/TaskQueue.d.ts +3 -3
  63. package/types/UniqueInstanceStateController.d.ts +1 -1
  64. package/types/arrayContainsObject.d.ts +1 -1
  65. package/types/encode.d.ts +1 -1
  66. package/types/eslint.config.mjs +30 -0
  67. package/types/unique.d.ts +1 -1
  68. package/types/unsavedChildren.d.ts +1 -1
@@ -14,31 +14,25 @@ import type { HookDeclaration, HookDeleteArg } from './ParseHooks';
14
14
  import type ParseConfig from './ParseConfig';
15
15
  import type LiveQueryClient from './LiveQueryClient';
16
16
  import type ParseInstallation from './ParseInstallation';
17
- type AnalyticsController = {
18
- track: (name: string, dimensions: {
19
- [key: string]: string;
20
- }) => Promise<any>;
21
- };
22
- type CloudController = {
17
+ export interface AnalyticsController {
18
+ track: (name: string, dimensions: Record<string, string>) => Promise<any>;
19
+ }
20
+ export interface CloudController {
23
21
  run: (name: string, data: any, options?: RequestOptions) => Promise<any>;
24
22
  getJobsData: (options?: RequestOptions) => Promise<any>;
25
23
  /** Returns promise which resolves with JobStatusId of the job */
26
24
  startJob: (name: string, data: any, options?: RequestOptions) => Promise<string>;
27
- };
28
- type ConfigController = {
25
+ }
26
+ export interface ConfigController {
29
27
  current: () => Promise<ParseConfig> | ParseConfig;
30
28
  get: (opts?: RequestOptions) => Promise<ParseConfig>;
31
- save: (attrs: {
32
- [key: string]: any;
33
- }, masterKeyOnlyFlags?: {
34
- [key: string]: any;
35
- }) => Promise<void>;
36
- };
37
- type CryptoController = {
29
+ save: (attrs: Record<string, any>, masterKeyOnlyFlags?: Record<string, any>) => Promise<void>;
30
+ }
31
+ export interface CryptoController {
38
32
  encrypt: (obj: any, secretKey: string) => string;
39
33
  decrypt: (encryptedText: string, secretKey: any) => string;
40
- };
41
- type FileController = {
34
+ }
35
+ export interface FileController {
42
36
  saveFile: (name: string, source: FileSource, options?: FullOptions) => Promise<any>;
43
37
  saveBase64: (name: string, source: FileSource, options?: FileSaveOptions) => Promise<{
44
38
  name: string;
@@ -51,24 +45,24 @@ type FileController = {
51
45
  deleteFile: (name: string, options?: {
52
46
  useMasterKey?: boolean;
53
47
  }) => Promise<void>;
54
- };
55
- type InstallationController = {
48
+ }
49
+ export interface InstallationController {
56
50
  currentInstallationId: () => Promise<string>;
57
51
  currentInstallation: () => Promise<ParseInstallation | null>;
58
52
  updateInstallationOnDisk: (installation: ParseInstallation) => Promise<void>;
59
- };
60
- type ObjectController = {
61
- fetch: (object: ParseObject | Array<ParseObject>, forceFetch: boolean, options?: RequestOptions) => Promise<Array<ParseObject | undefined> | ParseObject | undefined>;
62
- save: (object: ParseObject | Array<ParseObject | ParseFile> | null, options?: RequestOptions) => Promise<ParseObject | Array<ParseObject> | ParseFile | undefined>;
63
- destroy: (object: ParseObject | Array<ParseObject>, options?: RequestOptions) => Promise<ParseObject | Array<ParseObject>>;
64
- };
65
- type ObjectStateController = {
53
+ }
54
+ export interface ObjectController {
55
+ fetch: (object: ParseObject | ParseObject[], forceFetch: boolean, options?: RequestOptions) => Promise<(ParseObject | undefined)[] | ParseObject | undefined>;
56
+ save: (object: ParseObject | (ParseObject | ParseFile)[] | null, options?: RequestOptions) => Promise<ParseObject | ParseObject[] | ParseFile | undefined>;
57
+ destroy: (object: ParseObject | ParseObject[], options?: RequestOptions) => Promise<ParseObject | ParseObject[]>;
58
+ }
59
+ export interface ObjectStateController {
66
60
  getState: (obj: any) => State | null;
67
61
  initializeState: (obj: any, initial?: State) => State;
68
62
  removeState: (obj: any) => State | null;
69
63
  getServerData: (obj: any) => AttributeMap;
70
64
  setServerData: (obj: any, attributes: AttributeMap) => void;
71
- getPendingOps: (obj: any) => Array<OpsMap>;
65
+ getPendingOps: (obj: any) => OpsMap[];
72
66
  setPendingOp: (obj: any, attr: string, op?: Op) => void;
73
67
  pushPendingState: (obj: any) => void;
74
68
  popPendingState: (obj: any) => OpsMap | undefined;
@@ -80,21 +74,21 @@ type ObjectStateController = {
80
74
  enqueueTask: (obj: any, task: () => Promise<void>) => Promise<void>;
81
75
  clearAllState: () => void;
82
76
  duplicateState: (source: any, dest: any) => void;
83
- };
84
- type PushController = {
77
+ }
78
+ export interface PushController {
85
79
  send: (data: PushData, options?: FullOptions) => Promise<any>;
86
- };
87
- type QueryController = {
80
+ }
81
+ export interface QueryController {
88
82
  find(className: string, params: QueryJSON, options?: RequestOptions): Promise<{
89
- results?: Array<ParseObject>;
83
+ results?: ParseObject[];
90
84
  className?: string;
91
85
  count?: number;
92
86
  }>;
93
87
  aggregate(className: string, params: any, options?: RequestOptions): Promise<{
94
- results?: Array<any>;
88
+ results?: any[];
95
89
  }>;
96
- };
97
- export type QueueObject = {
90
+ }
91
+ export interface QueueObject {
98
92
  queueId: string;
99
93
  action: string;
100
94
  object: ParseObject;
@@ -103,9 +97,9 @@ export type QueueObject = {
103
97
  className: string;
104
98
  hash: string;
105
99
  createdAt: Date;
106
- };
107
- export type Queue = Array<QueueObject>;
108
- export type EventuallyQueue = {
100
+ }
101
+ export type Queue = QueueObject[];
102
+ export interface EventuallyQueue {
109
103
  save: (object: ParseObject, serverOptions?: SaveOptions) => Promise<void>;
110
104
  destroy: (object: ParseObject, serverOptions?: RequestOptions) => Promise<void>;
111
105
  generateQueueId: (action: string, object: ParseObject) => string;
@@ -128,23 +122,23 @@ export type EventuallyQueue = {
128
122
  byId(ObjectType: any, queueObject: any): Promise<void>;
129
123
  byHash(ObjectType: any, queueObject: any): Promise<void>;
130
124
  };
131
- };
132
- type RESTController = {
125
+ }
126
+ export interface RESTController {
133
127
  request: (method: string, path: string, data?: any, options?: RequestOptions) => Promise<any>;
134
128
  ajax: (method: string, url: string, data: any, headers?: any, options?: FullOptions) => Promise<any>;
135
129
  handleError: (err?: any) => void;
136
- };
137
- type SchemaController = {
130
+ }
131
+ export interface SchemaController {
138
132
  purge: (className: string) => Promise<any>;
139
133
  get: (className: string, options?: RequestOptions) => Promise<any>;
140
134
  delete: (className: string, options?: RequestOptions) => Promise<void>;
141
135
  create: (className: string, params: any, options?: RequestOptions) => Promise<any>;
142
136
  update: (className: string, params: any, options?: RequestOptions) => Promise<any>;
143
137
  send(className: string, method: string, params: any, options?: RequestOptions): Promise<any>;
144
- };
145
- type SessionController = {
138
+ }
139
+ export interface SessionController {
146
140
  getSession: (options?: RequestOptions) => Promise<ParseSession>;
147
- };
141
+ }
148
142
  type StorageController = {
149
143
  async: 0;
150
144
  getItem: (path: string) => string | null;
@@ -154,8 +148,8 @@ type StorageController = {
154
148
  setItemAsync?: (path: string, value: string) => Promise<void>;
155
149
  removeItemAsync?: (path: string) => Promise<void>;
156
150
  clear: () => void;
157
- getAllKeys?: () => Array<string>;
158
- getAllKeysAsync?: () => Promise<Array<string>>;
151
+ getAllKeys?: () => string[];
152
+ getAllKeysAsync?: () => Promise<string[]>;
159
153
  } | {
160
154
  async: 1;
161
155
  getItem?: (path: string) => string | null;
@@ -165,17 +159,17 @@ type StorageController = {
165
159
  setItemAsync: (path: string, value: string) => Promise<void>;
166
160
  removeItemAsync: (path: string) => Promise<void>;
167
161
  clear: () => void;
168
- getAllKeys?: () => Array<string>;
169
- getAllKeysAsync?: () => Promise<Array<string>>;
162
+ getAllKeys?: () => string[];
163
+ getAllKeysAsync?: () => Promise<string[]>;
170
164
  };
171
- type LocalDatastoreController = {
165
+ export interface LocalDatastoreController {
172
166
  fromPinWithName: (name: string) => any | undefined;
173
167
  pinWithName: (name: string, objects: any) => void;
174
168
  unPinWithName: (name: string) => void;
175
169
  getAllContents: () => any | undefined;
176
170
  clear: () => void;
177
- };
178
- type UserController = {
171
+ }
172
+ export interface UserController {
179
173
  setCurrentUser: (user: ParseUser) => Promise<void>;
180
174
  currentUser: () => ParseUser | null;
181
175
  currentUserAsync: () => Promise<ParseUser | null>;
@@ -190,24 +184,24 @@ type UserController = {
190
184
  updateUserOnDisk: (user: ParseUser) => Promise<ParseUser>;
191
185
  upgradeToRevocableSession: (user: ParseUser, options?: RequestOptions) => Promise<void>;
192
186
  linkWith: (user: ParseUser, authData: AuthData, options?: FullOptions) => Promise<ParseUser>;
193
- removeUserFromDisk: () => Promise<ParseUser | void>;
187
+ removeUserFromDisk: () => Promise<void>;
194
188
  verifyPassword: (username: string, password: string, options?: RequestOptions) => Promise<ParseUser>;
195
189
  requestEmailVerification: (email: string, options?: RequestOptions) => Promise<void>;
196
- };
197
- type HooksController = {
190
+ }
191
+ export interface HooksController {
198
192
  get: (type: string, functionName?: string, triggerName?: string) => Promise<any>;
199
193
  create: (hook: HookDeclaration) => Promise<any>;
200
194
  remove: (hook: HookDeleteArg) => Promise<any>;
201
195
  update: (hook: HookDeclaration) => Promise<any>;
202
196
  sendRequest?: (method: string, path: string, body?: any) => Promise<any>;
203
- };
204
- type LiveQueryControllerType = {
197
+ }
198
+ export interface LiveQueryControllerType {
205
199
  setDefaultLiveQueryClient(liveQueryClient: LiveQueryClient): void;
206
200
  getDefaultLiveQueryClient(): Promise<LiveQueryClient>;
207
201
  _clearCachedDefaultClient(): void;
208
- };
202
+ }
209
203
  /** Based on https://github.com/react-native-async-storage/async-storage/blob/main/packages/default-storage-backend/src/types.ts */
210
- type AsyncStorageType = {
204
+ export interface AsyncStorageType {
211
205
  /** Fetches an item for a `key` and invokes a callback upon completion. */
212
206
  getItem: (key: string, callback?: (error?: Error | null, result?: string | null) => void) => Promise<string | null>;
213
207
  /** Sets the value for a `key` and invokes a callback upon completion. */
@@ -250,15 +244,15 @@ type AsyncStorageType = {
250
244
  * See https://react-native-async-storage.github.io/async-storage/docs/api#multimerge
251
245
  */
252
246
  multiMerge: (keyValuePairs: [string, string][], callback?: (errors?: readonly (Error | null)[] | null) => void) => Promise<void>;
253
- };
254
- export type WebSocketController = {
247
+ }
248
+ export interface WebSocketController {
255
249
  onopen: () => void;
256
250
  onmessage: (message: any) => void;
257
251
  onclose: (arg?: any) => void;
258
252
  onerror: (error: any) => void;
259
253
  send: (data: any) => void;
260
254
  close: () => void;
261
- };
255
+ }
262
256
  declare const CoreManager: {
263
257
  get: (key: string) => any;
264
258
  set: (key: string, value: any) => void;
@@ -22,14 +22,14 @@ import type ParseObject from './ParseObject';
22
22
  declare const LocalDatastore: {
23
23
  isEnabled: boolean;
24
24
  isSyncing: boolean;
25
- fromPinWithName(name: string): Promise<Array<any>>;
25
+ fromPinWithName(name: string): Promise<any[]>;
26
26
  pinWithName(name: string, value: any): Promise<void>;
27
27
  unPinWithName(name: string): Promise<void>;
28
28
  _getAllContents(): Promise<any>;
29
29
  _getRawStorage(): Promise<any>;
30
30
  _clear(): Promise<void>;
31
- _handlePinAllWithName(name: string, objects: Array<ParseObject>): Promise<void>;
32
- _handleUnPinAllWithName(name: string, objects: Array<ParseObject>): Promise<any[]>;
31
+ _handlePinAllWithName(name: string, objects: ParseObject[]): Promise<void>;
32
+ _handleUnPinAllWithName(name: string, objects: ParseObject[]): Promise<any[]>;
33
33
  _getChildren(object: ParseObject): any;
34
34
  _traverse(object: any, encountered: any): void;
35
35
  _serializeObjectsFromPinName(name: string): Promise<any[]>;
@@ -1,5 +1,5 @@
1
1
  declare const LocalDatastoreController: {
2
- fromPinWithName(name: string): Promise<Array<any>>;
2
+ fromPinWithName(name: string): Promise<any[]>;
3
3
  pinWithName(name: string, value: any): Promise<void>;
4
4
  unPinWithName(name: string): Promise<void>;
5
5
  getAllContents(): Promise<any>;
@@ -1,5 +1,5 @@
1
1
  declare const LocalDatastoreController: {
2
- fromPinWithName(name: string): Promise<Array<any>>;
2
+ fromPinWithName(name: string): Promise<any[]>;
3
3
  pinWithName(name: string, value: any): Promise<void>;
4
4
  unPinWithName(name: string): Promise<void>;
5
5
  getAllContents(): Promise<any>;
@@ -1,28 +1,22 @@
1
1
  import TaskQueue from './TaskQueue';
2
2
  import type { Op } from './ParseOp';
3
3
  import type ParseObject from './ParseObject';
4
- export type AttributeMap = {
5
- [attr: string]: any;
6
- };
7
- export type OpsMap = {
8
- [attr: string]: Op;
9
- };
10
- export type ObjectCache = {
11
- [attr: string]: string;
12
- };
13
- export type State = {
4
+ export type AttributeMap = Record<string, any>;
5
+ export type OpsMap = Record<string, Op>;
6
+ export type ObjectCache = Record<string, string>;
7
+ export interface State {
14
8
  serverData: AttributeMap;
15
- pendingOps: Array<OpsMap>;
9
+ pendingOps: OpsMap[];
16
10
  objectCache: ObjectCache;
17
11
  tasks: TaskQueue;
18
12
  existed: boolean;
19
- };
13
+ }
20
14
  export declare function defaultState(): State;
21
15
  export declare function setServerData(serverData: AttributeMap, attributes: AttributeMap): void;
22
- export declare function setPendingOp(pendingOps: Array<OpsMap>, attr: string, op?: Op): void;
23
- export declare function pushPendingState(pendingOps: Array<OpsMap>): void;
24
- export declare function popPendingState(pendingOps: Array<OpsMap>): OpsMap;
25
- export declare function mergeFirstPendingState(pendingOps: Array<OpsMap>): void;
26
- export declare function estimateAttribute(serverData: AttributeMap, pendingOps: Array<OpsMap>, object: ParseObject, attr: string): any;
27
- export declare function estimateAttributes(serverData: AttributeMap, pendingOps: Array<OpsMap>, object: ParseObject): AttributeMap;
16
+ export declare function setPendingOp(pendingOps: OpsMap[], attr: string, op?: Op): void;
17
+ export declare function pushPendingState(pendingOps: OpsMap[]): void;
18
+ export declare function popPendingState(pendingOps: OpsMap[]): OpsMap;
19
+ export declare function mergeFirstPendingState(pendingOps: OpsMap[]): void;
20
+ export declare function estimateAttribute(serverData: AttributeMap, pendingOps: OpsMap[], object: ParseObject, attr: string): any;
21
+ export declare function estimateAttributes(serverData: AttributeMap, pendingOps: OpsMap[], object: ParseObject): AttributeMap;
28
22
  export declare function commitServerChanges(serverData: AttributeMap, objectCache: ObjectCache, changes: AttributeMap): void;