parse 8.0.2 → 8.0.3-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.
@@ -9,8 +9,8 @@ _Object$defineProperty(exports, "__esModule", {
9
9
  });
10
10
  exports.default = void 0;
11
11
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
12
- var _decode = _interopRequireDefault(require("./decode"));
13
- var _encode = _interopRequireDefault(require("./encode"));
12
+ var _decode2 = _interopRequireDefault(require("./decode"));
13
+ var _encode2 = _interopRequireDefault(require("./encode"));
14
14
  var _CryptoController = _interopRequireDefault(require("./CryptoController"));
15
15
  var _EventuallyQueue = _interopRequireDefault(require("./EventuallyQueue"));
16
16
  var _IndexedDBStorageController = _interopRequireDefault(require("./IndexedDBStorageController"));
@@ -67,6 +67,12 @@ function _interopRequireWildcard(e, t) {
67
67
  return f;
68
68
  })(e, t);
69
69
  }
70
+ /**
71
+ * The interface for the Parse SDK.
72
+ * This interface can be augmented in build-specific type definitions (e.g., node.d.ts)
73
+ * to provide environment-specific type signatures.
74
+ */
75
+
70
76
  const Parse = {
71
77
  ACL: _ParseACL.default,
72
78
  Analytics,
@@ -104,24 +110,12 @@ const Parse = {
104
110
  IndexedDB: undefined,
105
111
  Hooks: undefined,
106
112
  Parse: undefined,
107
- /**
108
- * @property {EventuallyQueue} Parse.EventuallyQueue
109
- * @static
110
- */
111
113
  set EventuallyQueue(queue) {
112
114
  _CoreManager.default.setEventuallyQueue(queue);
113
115
  },
114
116
  get EventuallyQueue() {
115
117
  return _CoreManager.default.getEventuallyQueue();
116
118
  },
117
- /**
118
- * Call this method first to set up your authentication tokens for Parse.
119
- *
120
- * @param {string} applicationId Your Parse Application ID.
121
- * @param {string} [javaScriptKey] Your Parse JavaScript Key (Not needed for parse-server)
122
- * @param {string} [masterKey] Your Parse Master Key. (Node.js only!)
123
- * @static
124
- */
125
119
  initialize(applicationId, javaScriptKey) {
126
120
  Parse._initialize(applicationId, javaScriptKey);
127
121
  },
@@ -140,161 +134,81 @@ const Parse = {
140
134
  _CoreManager.default.setIfNeeded('StorageController', _StorageController.default);
141
135
  _CoreManager.default.setIfNeeded('WebSocketController', _WebSocketController.default);
142
136
  },
143
- /**
144
- * Call this method to set your AsyncStorage engine
145
- * Starting Parse@1.11, the ParseSDK do not provide a React AsyncStorage as the ReactNative module
146
- * is not provided at a stable path and changes over versions.
147
- *
148
- * @param {AsyncStorage} storage a react native async storage.
149
- * @static
150
- */
151
137
  setAsyncStorage(storage) {
152
138
  _CoreManager.default.setAsyncStorage(storage);
153
139
  },
154
- /**
155
- * Call this method to set your LocalDatastoreStorage engine
156
- * If using React-Native use {@link Parse.setAsyncStorage Parse.setAsyncStorage()}
157
- *
158
- * @param {LocalDatastoreController} controller a data storage.
159
- * @static
160
- */
161
140
  setLocalDatastoreController(controller) {
162
141
  _CoreManager.default.setLocalDatastoreController(controller);
163
142
  },
164
- /**
165
- * Returns information regarding the current server's health
166
- *
167
- * @returns {Promise}
168
- * @static
169
- */
170
143
  getServerHealth() {
171
144
  return _CoreManager.default.getRESTController().request('GET', 'health');
172
145
  },
173
- /**
174
- * @property {string} Parse.applicationId
175
- * @static
176
- */
177
146
  set applicationId(value) {
178
147
  _CoreManager.default.set('APPLICATION_ID', value);
179
148
  },
180
149
  get applicationId() {
181
150
  return _CoreManager.default.get('APPLICATION_ID');
182
151
  },
183
- /**
184
- * @property {string} Parse.javaScriptKey
185
- * @static
186
- */
187
152
  set javaScriptKey(value) {
188
153
  _CoreManager.default.set('JAVASCRIPT_KEY', value);
189
154
  },
190
155
  get javaScriptKey() {
191
156
  return _CoreManager.default.get('JAVASCRIPT_KEY');
192
157
  },
193
- /**
194
- * @property {string} Parse.masterKey
195
- * @static
196
- */
197
158
  set masterKey(value) {
198
159
  _CoreManager.default.set('MASTER_KEY', value);
199
160
  },
200
161
  get masterKey() {
201
162
  return _CoreManager.default.get('MASTER_KEY');
202
163
  },
203
- /**
204
- * @property {string} Parse.maintenanceKey
205
- * @static
206
- */
207
164
  set maintenanceKey(value) {
208
165
  _CoreManager.default.set('MAINTENANCE_KEY', value);
209
166
  },
210
167
  get maintenanceKey() {
211
168
  return _CoreManager.default.get('MAINTENANCE_KEY');
212
169
  },
213
- /**
214
- * @property {string} Parse.serverURL
215
- * @static
216
- */
217
170
  set serverURL(value) {
218
171
  _CoreManager.default.set('SERVER_URL', value);
219
172
  },
220
173
  get serverURL() {
221
174
  return _CoreManager.default.get('SERVER_URL');
222
175
  },
223
- /**
224
- * @property {ParseLiveQuery} Parse.LiveQuery
225
- * @static
226
- */
227
176
  set LiveQuery(liveQuery) {
228
177
  _CoreManager.default.setLiveQuery(liveQuery);
229
178
  },
230
179
  get LiveQuery() {
231
180
  return _CoreManager.default.getLiveQuery();
232
181
  },
233
- /**
234
- * @property {string} Parse.liveQueryServerURL
235
- * @static
236
- */
237
182
  set liveQueryServerURL(value) {
238
183
  _CoreManager.default.set('LIVEQUERY_SERVER_URL', value);
239
184
  },
240
185
  get liveQueryServerURL() {
241
186
  return _CoreManager.default.get('LIVEQUERY_SERVER_URL');
242
187
  },
243
- /**
244
- * @property {boolean} Parse.encryptedUser
245
- * @static
246
- */
247
188
  set encryptedUser(value) {
248
189
  _CoreManager.default.set('ENCRYPTED_USER', value);
249
190
  },
250
191
  get encryptedUser() {
251
192
  return _CoreManager.default.get('ENCRYPTED_USER');
252
193
  },
253
- /**
254
- * @property {string} Parse.secret
255
- * @static
256
- */
257
194
  set secret(value) {
258
195
  _CoreManager.default.set('ENCRYPTED_KEY', value);
259
196
  },
260
197
  get secret() {
261
198
  return _CoreManager.default.get('ENCRYPTED_KEY');
262
199
  },
263
- /**
264
- * @property {boolean} Parse.idempotency
265
- * @static
266
- */
267
200
  set idempotency(value) {
268
201
  _CoreManager.default.set('IDEMPOTENCY', value);
269
202
  },
270
203
  get idempotency() {
271
204
  return _CoreManager.default.get('IDEMPOTENCY');
272
205
  },
273
- /**
274
- * @property {boolean} Parse.allowCustomObjectId
275
- * @static
276
- */
277
206
  set allowCustomObjectId(value) {
278
207
  _CoreManager.default.set('ALLOW_CUSTOM_OBJECT_ID', value);
279
208
  },
280
209
  get allowCustomObjectId() {
281
210
  return _CoreManager.default.get('ALLOW_CUSTOM_OBJECT_ID');
282
211
  },
283
- /**
284
- * Setting this property to `true` enables enhanced logging for `Parse.Object`
285
- * in Node.js environments. Specifically, it will log:
286
- *
287
- * ```
288
- * ParseObject: className: <CLASS_NAME>, id: <OBJECT_ID>
289
- * Attributes: <OBJECT_ATTRIBUTES>
290
- * ```
291
- *
292
- * @warning This should not be enabled in production environments as this may
293
- * expose sensitive information in server logs.
294
- *
295
- * @property {boolean} Parse.nodeLogging
296
- * @static
297
- */
298
212
  set nodeLogging(value) {
299
213
  _CoreManager.default.set('NODE_LOGGING', value);
300
214
  },
@@ -315,25 +229,17 @@ const Parse = {
315
229
  },
316
230
  // We attempt to match the signatures of the legacy versions of these methods
317
231
  _decode(_, value) {
318
- return (0, _decode.default)(value);
232
+ return (0, _decode2.default)(value);
319
233
  },
320
234
  _encode(value, _, disallowObjects) {
321
- return (0, _encode.default)(value, disallowObjects);
235
+ return (0, _encode2.default)(value, disallowObjects);
322
236
  },
323
237
  _getInstallationId() {
324
238
  return _CoreManager.default.getInstallationController().currentInstallationId();
325
239
  },
326
- /**
327
- * Enable pinning in your application.
328
- * This must be called after `Parse.initialize` in your application.
329
- *
330
- * @param [polling] Allow pinging the server /health endpoint. Default true
331
- * @param [ms] Milliseconds to ping the server. Default 2000ms
332
- * @static
333
- */
334
240
  enableLocalDatastore(polling, ms) {
335
241
  if (!this.applicationId) {
336
- console.log("'enableLocalDataStore' must be called after 'initialize'");
242
+ console.log("'enableLocalDatastore' must be called after 'initialize'");
337
243
  return;
338
244
  }
339
245
  if (!this.LocalDatastore.isEnabled) {
@@ -343,25 +249,9 @@ const Parse = {
343
249
  }
344
250
  }
345
251
  },
346
- /**
347
- * Flag that indicates whether Local Datastore is enabled.
348
- *
349
- * @static
350
- * @returns {boolean}
351
- */
352
252
  isLocalDatastoreEnabled() {
353
253
  return this.LocalDatastore.isEnabled;
354
254
  },
355
- /**
356
- * Gets all contents from Local Datastore
357
- *
358
- * <pre>
359
- * await Parse.dumpLocalDatastore();
360
- * </pre>
361
- *
362
- * @static
363
- * @returns {object}
364
- */
365
255
  dumpLocalDatastore() {
366
256
  if (!this.LocalDatastore.isEnabled) {
367
257
  console.log('Parse.enableLocalDatastore() must be called first');
@@ -370,21 +260,9 @@ const Parse = {
370
260
  return Parse.LocalDatastore._getAllContents();
371
261
  }
372
262
  },
373
- /**
374
- * Enable the current user encryption.
375
- * This must be called before login any user.
376
- *
377
- * @static
378
- */
379
263
  enableEncryptedUser() {
380
264
  this.encryptedUser = true;
381
265
  },
382
- /**
383
- * Flag that indicates whether Encrypted User is enabled.
384
- *
385
- * @static
386
- * @returns {boolean}
387
- */
388
266
  isEncryptedUserEnabled() {
389
267
  return this.encryptedUser;
390
268
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "parse",
3
- "version": "8.0.2",
3
+ "version": "8.0.3-alpha.1",
4
4
  "description": "Parse JavaScript SDK",
5
5
  "homepage": "https://parseplatform.org",
6
6
  "keywords": [
package/types/Parse.d.ts CHANGED
@@ -1,14 +1,18 @@
1
1
  import * as ParseOp from './ParseOp';
2
2
  import ACL from './ParseACL';
3
3
  import * as Analytics from './Analytics';
4
+ import AnonymousUtils from './AnonymousUtils';
4
5
  import * as Cloud from './Cloud';
5
6
  import CLP from './ParseCLP';
7
+ import CoreManager from './CoreManager';
6
8
  import Config from './ParseConfig';
7
9
  import ParseError from './ParseError';
10
+ import FacebookUtils from './FacebookUtils';
8
11
  import File from './ParseFile';
9
12
  import GeoPoint from './ParseGeoPoint';
10
13
  import Polygon from './ParsePolygon';
11
14
  import Installation from './ParseInstallation';
15
+ import LocalDatastore from './LocalDatastore';
12
16
  import ParseObject from './ParseObject';
13
17
  import * as Push from './Push';
14
18
  import Query from './ParseQuery';
@@ -16,174 +20,31 @@ import Relation from './ParseRelation';
16
20
  import Role from './ParseRole';
17
21
  import Schema from './ParseSchema';
18
22
  import Session from './ParseSession';
23
+ import Storage from './Storage';
19
24
  import User from './ParseUser';
20
25
  import ParseLiveQuery from './ParseLiveQuery';
21
26
  import LiveQueryClient from './LiveQueryClient';
22
27
  import type { EventuallyQueue } from './CoreManager';
23
- declare const Parse: {
28
+ /**
29
+ * The interface for the Parse SDK.
30
+ * This interface can be augmented in build-specific type definitions (e.g., node.d.ts)
31
+ * to provide environment-specific type signatures.
32
+ */
33
+ export interface Parse {
24
34
  ACL: typeof ACL;
25
35
  Analytics: typeof Analytics;
26
- AnonymousUtils: {
27
- isLinked(user: User): boolean;
28
- logIn(options?: import("./RESTController").RequestOptions): Promise<User>;
29
- link(user: User, options?: import("./RESTController").RequestOptions): Promise<User>;
30
- isRegistered(): boolean;
31
- _getAuthProvider(): {
32
- restoreAuthentication(): boolean;
33
- getAuthType(): string;
34
- getAuthData(): {
35
- authData: {
36
- id: string;
37
- };
38
- };
39
- };
40
- };
36
+ AnonymousUtils: typeof AnonymousUtils;
41
37
  Cloud: typeof Cloud;
42
38
  CLP: typeof CLP;
43
- CoreManager: {
44
- get: (key: string) => any;
45
- set: (key: string, value: any) => void;
46
- setIfNeeded: (key: string, value: any) => any;
47
- setAnalyticsController(controller: import("./CoreManager").AnalyticsController): void;
48
- getAnalyticsController(): import("./CoreManager").AnalyticsController;
49
- setCloudController(controller: import("./CoreManager").CloudController): void;
50
- getCloudController(): import("./CoreManager").CloudController;
51
- setConfigController(controller: import("./CoreManager").ConfigController): void;
52
- getConfigController(): import("./CoreManager").ConfigController;
53
- setCryptoController(controller: import("./CoreManager").CryptoController): void;
54
- getCryptoController(): import("./CoreManager").CryptoController;
55
- setEventEmitter(eventEmitter: any): void;
56
- getEventEmitter(): any;
57
- setFileController(controller: import("./CoreManager").FileController): void;
58
- setEventuallyQueue(controller: EventuallyQueue): void;
59
- getEventuallyQueue(): EventuallyQueue;
60
- getFileController(): import("./CoreManager").FileController;
61
- setInstallationController(controller: import("./CoreManager").InstallationController): void;
62
- getInstallationController(): import("./CoreManager").InstallationController;
63
- setLiveQuery(liveQuery: any): void;
64
- getLiveQuery(): any;
65
- setObjectController(controller: import("./CoreManager").ObjectController): void;
66
- getObjectController(): import("./CoreManager").ObjectController;
67
- setObjectStateController(controller: import("./CoreManager").ObjectStateController): void;
68
- getObjectStateController(): import("./CoreManager").ObjectStateController;
69
- setPushController(controller: import("./CoreManager").PushController): void;
70
- getPushController(): import("./CoreManager").PushController;
71
- setQueryController(controller: import("./CoreManager").QueryController): void;
72
- getQueryController(): import("./CoreManager").QueryController;
73
- setRESTController(controller: import("./CoreManager").RESTController): void;
74
- getRESTController(): import("./CoreManager").RESTController;
75
- setSchemaController(controller: import("./CoreManager").SchemaController): void;
76
- getSchemaController(): import("./CoreManager").SchemaController;
77
- setSessionController(controller: import("./CoreManager").SessionController): void;
78
- getSessionController(): import("./CoreManager").SessionController;
79
- setStorageController(controller: {
80
- async: 0;
81
- getItem: (path: string) => string | null;
82
- setItem: (path: string, value: string) => void;
83
- removeItem: (path: string) => void;
84
- getItemAsync?: (path: string) => Promise<string | null>;
85
- setItemAsync?: (path: string, value: string) => Promise<void>;
86
- removeItemAsync?: (path: string) => Promise<void>;
87
- clear: () => void;
88
- getAllKeys?: () => string[];
89
- getAllKeysAsync?: () => Promise<string[]>;
90
- } | {
91
- async: 1;
92
- getItem?: (path: string) => string | null;
93
- setItem?: (path: string, value: string) => void;
94
- removeItem?: (path: string) => void;
95
- getItemAsync: (path: string) => Promise<string | null>;
96
- setItemAsync: (path: string, value: string) => Promise<void>;
97
- removeItemAsync: (path: string) => Promise<void>;
98
- clear: () => void;
99
- getAllKeys?: () => string[];
100
- getAllKeysAsync?: () => Promise<string[]>;
101
- }): void;
102
- setLocalDatastoreController(controller: import("./CoreManager").LocalDatastoreController): void;
103
- getLocalDatastoreController(): import("./CoreManager").LocalDatastoreController;
104
- setLocalDatastore(store: any): void;
105
- getLocalDatastore(): any;
106
- getStorageController(): {
107
- async: 0;
108
- getItem: (path: string) => string | null;
109
- setItem: (path: string, value: string) => void;
110
- removeItem: (path: string) => void;
111
- getItemAsync?: (path: string) => Promise<string | null>;
112
- setItemAsync?: (path: string, value: string) => Promise<void>;
113
- removeItemAsync?: (path: string) => Promise<void>;
114
- clear: () => void;
115
- getAllKeys?: () => string[];
116
- getAllKeysAsync?: () => Promise<string[]>;
117
- } | {
118
- async: 1;
119
- getItem?: (path: string) => string | null;
120
- setItem?: (path: string, value: string) => void;
121
- removeItem?: (path: string) => void;
122
- getItemAsync: (path: string) => Promise<string | null>;
123
- setItemAsync: (path: string, value: string) => Promise<void>;
124
- removeItemAsync: (path: string) => Promise<void>;
125
- clear: () => void;
126
- getAllKeys?: () => string[];
127
- getAllKeysAsync?: () => Promise<string[]>;
128
- };
129
- setAsyncStorage(storage: import("./CoreManager").AsyncStorageType): void;
130
- getAsyncStorage(): import("./CoreManager").AsyncStorageType;
131
- setWebSocketController(controller: new (url: string | URL, protocols?: string | string[] | undefined) => import("./CoreManager").WebSocketController): void;
132
- getWebSocketController(): new (url: string | URL, protocols?: string | string[] | undefined) => import("./CoreManager").WebSocketController;
133
- setUserController(controller: import("./CoreManager").UserController): void;
134
- getUserController(): import("./CoreManager").UserController;
135
- setLiveQueryController(controller: import("./CoreManager").LiveQueryControllerType): void;
136
- getLiveQueryController(): import("./CoreManager").LiveQueryControllerType;
137
- setHooksController(controller: import("./CoreManager").HooksController): void;
138
- getHooksController(): import("./CoreManager").HooksController;
139
- setParseOp(op: any): void;
140
- getParseOp(): any;
141
- setParseObject(object: any): void;
142
- getParseObject(): any;
143
- setParseQuery(query: any): void;
144
- getParseQuery(): any;
145
- setParseRole(role: any): void;
146
- getParseRole(): any;
147
- setParseUser(user: any): void;
148
- getParseUser(): any;
149
- };
39
+ CoreManager: typeof CoreManager;
150
40
  Config: typeof Config;
151
41
  Error: typeof ParseError;
152
- FacebookUtils: {
153
- init(options: any): void;
154
- isLinked(user: any): any;
155
- logIn(permissions: any, options: any): Promise<User<import("./ParseObject").Attributes>>;
156
- link(user: any, permissions: any, options: any): any;
157
- unlink: (user: any, options: any) => any;
158
- _getAuthProvider(): import("./ParseUser").AuthProvider;
159
- };
42
+ FacebookUtils: typeof FacebookUtils;
160
43
  File: typeof File;
161
44
  GeoPoint: typeof GeoPoint;
162
45
  Polygon: typeof Polygon;
163
46
  Installation: typeof Installation;
164
- LocalDatastore: {
165
- isEnabled: boolean;
166
- isSyncing: boolean;
167
- fromPinWithName(name: string): Promise<any[]>;
168
- pinWithName(name: string, value: any): Promise<void>;
169
- unPinWithName(name: string): Promise<void>;
170
- _getAllContents(): Promise<any>;
171
- _getRawStorage(): Promise<any>;
172
- _clear(): Promise<void>;
173
- _handlePinAllWithName(name: string, objects: ParseObject[]): Promise<void>;
174
- _handleUnPinAllWithName(name: string, objects: ParseObject[]): Promise<any[]>;
175
- _getChildren(object: ParseObject): any;
176
- _traverse(object: any, encountered: any): void;
177
- _serializeObjectsFromPinName(name: string): Promise<any[]>;
178
- _serializeObject(objectKey: string, localDatastore: any): Promise<any>;
179
- _updateObjectIfPinned(object: ParseObject): Promise<void>;
180
- _destroyObjectIfPinned(object: ParseObject): Promise<any[]>;
181
- _updateLocalIdForObject(localId: string, object: ParseObject): Promise<any[]>;
182
- updateFromServer(): Promise<void>;
183
- getKeyForObject(object: any): string;
184
- getPinName(pinName?: string): string;
185
- checkIfEnabled(): any;
186
- };
47
+ LocalDatastore: typeof LocalDatastore;
187
48
  Object: typeof ParseObject;
188
49
  Op: {
189
50
  Set: typeof ParseOp.SetOp;
@@ -200,19 +61,7 @@ declare const Parse: {
200
61
  Role: typeof Role;
201
62
  Schema: typeof Schema;
202
63
  Session: typeof Session;
203
- Storage: {
204
- async(): boolean;
205
- getItem(path: string): string | null;
206
- getItemAsync(path: string): Promise<string | null>;
207
- setItem(path: string, value: string): void;
208
- setItemAsync(path: string, value: string): Promise<void>;
209
- removeItem(path: string): void;
210
- removeItemAsync(path: string): Promise<void>;
211
- getAllKeys(): string[];
212
- getAllKeysAsync(): Promise<string[]>;
213
- generatePath(path: string): string;
214
- _clear(): void;
215
- };
64
+ Storage: typeof Storage;
216
65
  User: typeof User;
217
66
  LiveQueryClient: typeof LiveQueryClient;
218
67
  IndexedDB: any;
@@ -227,8 +76,8 @@ declare const Parse: {
227
76
  * Call this method first to set up your authentication tokens for Parse.
228
77
  *
229
78
  * @param {string} applicationId Your Parse Application ID.
230
- * @param {string} [javaScriptKey] Your Parse JavaScript Key (Not needed for parse-server)
231
- * @param {string} [masterKey] Your Parse Master Key. (Node.js only!)
79
+ * @param {string} javaScriptKey Your Parse JavaScript Key (Not needed for parse-server)
80
+ * @note Node.js builds (parse/node) support additional parameters: masterKey and maintenanceKey.
232
81
  * @static
233
82
  */
234
83
  initialize(applicationId: string, javaScriptKey: string): void;
@@ -261,27 +110,27 @@ declare const Parse: {
261
110
  * @property {string} Parse.applicationId
262
111
  * @static
263
112
  */
264
- applicationId: any;
113
+ applicationId: string | undefined;
265
114
  /**
266
115
  * @property {string} Parse.javaScriptKey
267
116
  * @static
268
117
  */
269
- javaScriptKey: any;
118
+ javaScriptKey: string | undefined;
270
119
  /**
271
120
  * @property {string} Parse.masterKey
272
121
  * @static
273
122
  */
274
- masterKey: any;
123
+ masterKey: string | undefined;
275
124
  /**
276
125
  * @property {string} Parse.maintenanceKey
277
126
  * @static
278
127
  */
279
- maintenanceKey: any;
128
+ maintenanceKey: string | undefined;
280
129
  /**
281
130
  * @property {string} Parse.serverURL
282
131
  * @static
283
132
  */
284
- serverURL: any;
133
+ serverURL: string | undefined;
285
134
  /**
286
135
  * @property {ParseLiveQuery} Parse.LiveQuery
287
136
  * @static
@@ -291,7 +140,7 @@ declare const Parse: {
291
140
  * @property {string} Parse.liveQueryServerURL
292
141
  * @static
293
142
  */
294
- liveQueryServerURL: any;
143
+ liveQueryServerURL: string | undefined;
295
144
  /**
296
145
  * @property {boolean} Parse.encryptedUser
297
146
  * @static
@@ -301,17 +150,17 @@ declare const Parse: {
301
150
  * @property {string} Parse.secret
302
151
  * @static
303
152
  */
304
- secret: any;
153
+ secret: string | undefined;
305
154
  /**
306
155
  * @property {boolean} Parse.idempotency
307
156
  * @static
308
157
  */
309
- idempotency: any;
158
+ idempotency: boolean | undefined;
310
159
  /**
311
160
  * @property {boolean} Parse.allowCustomObjectId
312
161
  * @static
313
162
  */
314
- allowCustomObjectId: any;
163
+ allowCustomObjectId: boolean | undefined;
315
164
  /**
316
165
  * Setting this property to `true` enables enhanced logging for `Parse.Object`
317
166
  * in Node.js environments. Specifically, it will log:
@@ -327,11 +176,11 @@ declare const Parse: {
327
176
  * @property {boolean} Parse.nodeLogging
328
177
  * @static
329
178
  */
330
- nodeLogging: any;
331
- _request(...args: any[]): any;
332
- _ajax(...args: any[]): any;
179
+ nodeLogging: boolean | undefined;
180
+ _request(...args: any[]): Promise<any>;
181
+ _ajax(...args: any[]): Promise<any>;
333
182
  _decode(_: any, value: any): any;
334
- _encode(value: any, _: any, disallowObjects: any): any;
183
+ _encode(value: any, _: any, disallowObjects?: boolean): any;
335
184
  _getInstallationId(): Promise<string>;
336
185
  /**
337
186
  * Enable pinning in your application.
@@ -373,6 +222,7 @@ declare const Parse: {
373
222
  * @static
374
223
  * @returns {boolean}
375
224
  */
376
- isEncryptedUserEnabled(): any;
377
- };
225
+ isEncryptedUserEnabled(): boolean;
226
+ }
227
+ declare const Parse: Parse;
378
228
  export default Parse;
package/types/node.d.ts CHANGED
@@ -1,5 +1,28 @@
1
1
  import * as parse from './index';
2
2
 
3
+ // Augment Parse interface for Node.js builds
4
+ // In Node.js, Parse.initialize is reassigned to Parse._initialize at runtime,
5
+ // which accepts masterKey and maintenanceKey parameters
6
+ declare module './Parse' {
7
+ interface Parse {
8
+ /**
9
+ * Call this method first to set up your authentication tokens for Parse.
10
+ *
11
+ * @param {string} applicationId Your Parse Application ID.
12
+ * @param {string} [javaScriptKey] Your Parse JavaScript Key (Not needed for parse-server)
13
+ * @param {string} [masterKey] Your Parse Master Key.
14
+ * @param {string} [maintenanceKey] Your Parse Maintenance Key.
15
+ * @static
16
+ */
17
+ initialize(
18
+ applicationId: string,
19
+ javaScriptKey?: string,
20
+ masterKey?: string,
21
+ maintenanceKey?: string
22
+ ): void;
23
+ }
24
+ }
25
+
3
26
  // Augment Cloud module to include server-side types for parse/node
4
27
  declare module './Cloud' {
5
28
  // Request types - alias to CloudCode definitions
package/types/tests.ts CHANGED
@@ -2343,3 +2343,24 @@ function LiveQueryEvents() {
2343
2343
  }
2344
2344
  }
2345
2345
 
2346
+ function testInitialize() {
2347
+ // Browser - 2 params (strict)
2348
+ Parse.initialize('appId', 'jsKey');
2349
+
2350
+ // Browser - should error when trying to pass masterKey
2351
+ // @ts-expect-error - Browser build should not accept masterKey
2352
+ Parse.initialize('appId', 'jsKey', 'masterKey');
2353
+
2354
+ // Node - permissive 4 params (should work)
2355
+ ParseNode.initialize('appId', 'jsKey', 'masterKey', 'maintenanceKey');
2356
+
2357
+ // Node - 3 params (should also work)
2358
+ ParseNode.initialize('appId', 'jsKey', 'masterKey');
2359
+
2360
+ // Node - 2 params (should also work)
2361
+ ParseNode.initialize('appId', 'jsKey');
2362
+
2363
+ // Node - 1 param (should also work since javaScriptKey is optional in node)
2364
+ ParseNode.initialize('appId');
2365
+ }
2366
+