parse 8.1.1-alpha.2 → 8.1.1-alpha.4
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.
- package/dist/parse.js +1 -1
- package/dist/parse.min.js +1 -1
- package/dist/parse.weapp.js +1 -1
- package/dist/parse.weapp.min.js +1 -1
- package/lib/browser/CloudCode.js +1 -0
- package/lib/browser/CoreManager.js +1 -1
- package/lib/browser/ParseObject.js +6 -0
- package/lib/browser/ParseQuery.js +2 -0
- package/lib/browser/Push.js +2 -0
- package/lib/browser/RESTController.js +1 -0
- package/lib/node/CloudCode.js +1 -0
- package/lib/node/CoreManager.js +1 -1
- package/lib/node/ParseObject.js +6 -0
- package/lib/node/ParseQuery.js +2 -0
- package/lib/node/Push.js +2 -0
- package/lib/node/RESTController.js +2 -0
- package/lib/react-native/CoreManager.js +1 -1
- package/lib/react-native/ParseObject.js +14 -14
- package/lib/weapp/CloudCode.js +1 -0
- package/lib/weapp/CoreManager.js +1 -1
- package/lib/weapp/ParseObject.js +6 -0
- package/lib/weapp/ParseQuery.js +2 -0
- package/lib/weapp/Push.js +2 -0
- package/lib/weapp/RESTController.js +1 -0
- package/package.json +3 -3
- package/types/Cloud.d.ts +4 -3
- package/types/CloudCode.d.ts +19 -17
- package/types/ParseObject.d.ts +67 -16
- package/types/ParseQuery.d.ts +16 -26
- package/types/ParseSchema.d.ts +9 -7
- package/types/ParseUser.d.ts +5 -1
- package/types/Push.d.ts +2 -0
- package/types/RESTController.d.ts +8 -0
- package/types/index.d.ts +47 -2
- package/types/tests.ts +102 -0
package/lib/browser/CloudCode.js
CHANGED
|
@@ -5,6 +5,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.ReadPreferenceOption = void 0;
|
|
8
|
+
/* eslint-disable @typescript-eslint/no-invalid-void-type -- Cloud trigger handlers legitimately return void | T */
|
|
8
9
|
/**
|
|
9
10
|
* @typedef Parse.Cloud.FunctionRequest
|
|
10
11
|
* @property {string} installationId If set, the installationId triggering the request.
|
|
@@ -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.
|
|
21
|
+
VERSION: 'js' + "8.1.1-alpha.4",
|
|
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/browser/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
|
*
|
package/lib/node/CloudCode.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ReadPreferenceOption = void 0;
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-invalid-void-type -- Cloud trigger handlers legitimately return void | T */
|
|
7
8
|
/**
|
|
8
9
|
* @typedef Parse.Cloud.FunctionRequest
|
|
9
10
|
* @property {string} installationId If set, the installationId triggering the request.
|
package/lib/node/CoreManager.js
CHANGED
|
@@ -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.
|
|
17
|
+
VERSION: 'js' + "8.1.1-alpha.4",
|
|
18
18
|
APPLICATION_ID: null,
|
|
19
19
|
JAVASCRIPT_KEY: null,
|
|
20
20
|
MAINTENANCE_KEY: null,
|
package/lib/node/ParseObject.js
CHANGED
|
@@ -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);
|
package/lib/node/ParseQuery.js
CHANGED
|
@@ -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
|
@@ -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())) {
|
|
@@ -133,12 +133,12 @@ var ParseObject = function () {
|
|
|
133
133
|
key: "_getStateIdentifier",
|
|
134
134
|
value: function () {
|
|
135
135
|
if (singleInstance) {
|
|
136
|
-
var
|
|
137
|
-
if (!
|
|
138
|
-
|
|
136
|
+
var _id = this.id;
|
|
137
|
+
if (!_id) {
|
|
138
|
+
_id = this._getId();
|
|
139
139
|
}
|
|
140
140
|
return {
|
|
141
|
-
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
|
|
193
|
-
var stringified = JSON.stringify(
|
|
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
|
|
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 (!
|
|
1322
|
-
|
|
1321
|
+
if (!_className) {
|
|
1322
|
+
_className = el.className;
|
|
1323
1323
|
}
|
|
1324
|
-
if (
|
|
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(
|
|
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
|
|
1365
|
-
_obj._finishFetch(idMap[
|
|
1366
|
-
results[_i] = idMap[
|
|
1364
|
+
var _id2 = _obj.id;
|
|
1365
|
+
_obj._finishFetch(idMap[_id2].toJSON());
|
|
1366
|
+
results[_i] = idMap[_id2];
|
|
1367
1367
|
}
|
|
1368
1368
|
}
|
|
1369
1369
|
}
|
package/lib/weapp/CloudCode.js
CHANGED
|
@@ -5,6 +5,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.ReadPreferenceOption = void 0;
|
|
8
|
+
/* eslint-disable @typescript-eslint/no-invalid-void-type -- Cloud trigger handlers legitimately return void | T */
|
|
8
9
|
/**
|
|
9
10
|
* @typedef Parse.Cloud.FunctionRequest
|
|
10
11
|
* @property {string} installationId If set, the installationId triggering the request.
|
package/lib/weapp/CoreManager.js
CHANGED
|
@@ -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.
|
|
21
|
+
VERSION: 'js' + "8.1.1-alpha.4",
|
|
22
22
|
APPLICATION_ID: null,
|
|
23
23
|
JAVASCRIPT_KEY: null,
|
|
24
24
|
MAINTENANCE_KEY: null,
|
package/lib/weapp/ParseObject.js
CHANGED
|
@@ -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);
|
package/lib/weapp/ParseQuery.js
CHANGED
|
@@ -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
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "parse",
|
|
3
|
-
"version": "8.1.1-alpha.
|
|
3
|
+
"version": "8.1.1-alpha.4",
|
|
4
4
|
"description": "Parse JavaScript SDK",
|
|
5
5
|
"homepage": "https://parseplatform.org",
|
|
6
6
|
"keywords": [
|
|
@@ -87,7 +87,7 @@
|
|
|
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.
|
|
90
|
+
"@semantic-release/github": "12.0.5",
|
|
91
91
|
"@semantic-release/npm": "13.1.3",
|
|
92
92
|
"@semantic-release/release-notes-generator": "14.1.0",
|
|
93
93
|
"@types/facebook-js-sdk": "3.3.11",
|
|
@@ -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.
|
|
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",
|
package/types/Cloud.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import ParseObject from './ParseObject';
|
|
2
|
-
import type {
|
|
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?:
|
|
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?:
|
|
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
|
*
|
package/types/CloudCode.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type ParseObject from './ParseObject';
|
|
|
2
2
|
import type ParseUser from './ParseUser';
|
|
3
3
|
import type ParseFile from './ParseFile';
|
|
4
4
|
import type ParseQuery from './ParseQuery';
|
|
5
|
+
type ParseObjectConstructor<T extends ParseObject = ParseObject> = new (...args: any[]) => T;
|
|
5
6
|
/**
|
|
6
7
|
* @typedef Parse.Cloud.FunctionRequest
|
|
7
8
|
* @property {string} installationId If set, the installationId triggering the request.
|
|
@@ -259,7 +260,7 @@ export declare function job(name: string, handler: (request: JobRequest) => any)
|
|
|
259
260
|
* @param handler The function to run before a save.
|
|
260
261
|
* @param validator An optional function to validate the request
|
|
261
262
|
*/
|
|
262
|
-
export declare function beforeSave<T extends ParseObject = ParseObject>(className: string |
|
|
263
|
+
export declare function beforeSave<T extends ParseObject = ParseObject>(className: string | ParseObjectConstructor<T>, handler: (request: BeforeSaveRequest<T>) => void | T | undefined | Promise<void | T | undefined>, validator?: ValidatorObject | ((request: BeforeSaveRequest<T>) => any)): void;
|
|
263
264
|
/**
|
|
264
265
|
* Registers an after save function.
|
|
265
266
|
*
|
|
@@ -282,7 +283,7 @@ export declare function beforeSave<T extends ParseObject = ParseObject>(classNam
|
|
|
282
283
|
* @param handler The function to run after a save.
|
|
283
284
|
* @param validator An optional function to validate the request
|
|
284
285
|
*/
|
|
285
|
-
export declare function afterSave<T extends ParseObject = ParseObject>(className: string |
|
|
286
|
+
export declare function afterSave<T extends ParseObject = ParseObject>(className: string | ParseObjectConstructor<T>, handler: (request: AfterSaveRequest<T>) => void | Promise<void> | undefined, validator?: ValidatorObject | ((request: AfterSaveRequest<T>) => any)): void;
|
|
286
287
|
/**
|
|
287
288
|
* Registers a before delete function.
|
|
288
289
|
*
|
|
@@ -305,7 +306,7 @@ export declare function afterSave<T extends ParseObject = ParseObject>(className
|
|
|
305
306
|
* @param handler The function to run before a delete.
|
|
306
307
|
* @param validator An optional function to validate the request
|
|
307
308
|
*/
|
|
308
|
-
export declare function beforeDelete<T extends ParseObject = ParseObject>(className: string |
|
|
309
|
+
export declare function beforeDelete<T extends ParseObject = ParseObject>(className: string | ParseObjectConstructor<T>, handler: (request: BeforeDeleteRequest<T>) => void | Promise<void> | undefined, validator?: ValidatorObject | ((request: BeforeDeleteRequest<T>) => any)): void;
|
|
309
310
|
/**
|
|
310
311
|
* Registers an after delete function.
|
|
311
312
|
*
|
|
@@ -328,7 +329,7 @@ export declare function beforeDelete<T extends ParseObject = ParseObject>(classN
|
|
|
328
329
|
* @param handler The function to run after a delete.
|
|
329
330
|
* @param validator An optional function to validate the request
|
|
330
331
|
*/
|
|
331
|
-
export declare function afterDelete<T extends ParseObject = ParseObject>(className: string |
|
|
332
|
+
export declare function afterDelete<T extends ParseObject = ParseObject>(className: string | ParseObjectConstructor<T>, handler: (request: AfterDeleteRequest<T>) => void | Promise<void> | undefined, validator?: ValidatorObject | ((request: AfterDeleteRequest<T>) => any)): void;
|
|
332
333
|
/**
|
|
333
334
|
* Registers a before find function.
|
|
334
335
|
*
|
|
@@ -338,7 +339,7 @@ export declare function afterDelete<T extends ParseObject = ParseObject>(classNa
|
|
|
338
339
|
* @param handler The function to run before a find.
|
|
339
340
|
* @param validator An optional function to validate the request
|
|
340
341
|
*/
|
|
341
|
-
export declare function beforeFind<T extends ParseObject = ParseObject>(className: string |
|
|
342
|
+
export declare function beforeFind<T extends ParseObject = ParseObject>(className: string | ParseObjectConstructor<T>, handler: (request: BeforeFindRequest<T>) => void | ParseQuery<T> | undefined | Promise<void | ParseQuery<T> | undefined>, validator?: ValidatorObject | ((request: BeforeFindRequest<T>) => any)): void;
|
|
342
343
|
/**
|
|
343
344
|
* Registers an after find function.
|
|
344
345
|
*
|
|
@@ -348,7 +349,7 @@ export declare function beforeFind<T extends ParseObject = ParseObject>(classNam
|
|
|
348
349
|
* @param handler The function to run after a find.
|
|
349
350
|
* @param validator An optional function to validate the request
|
|
350
351
|
*/
|
|
351
|
-
export declare function afterFind<T extends ParseObject = ParseObject>(className: string |
|
|
352
|
+
export declare function afterFind<T extends ParseObject = ParseObject>(className: string | ParseObjectConstructor<T>, handler: (request: AfterFindRequest<T>) => void | T[] | undefined | Promise<void | T[] | undefined>, validator?: ValidatorObject | ((request: AfterFindRequest<T>) => any)): void;
|
|
352
353
|
/**
|
|
353
354
|
* Registers a before login function.
|
|
354
355
|
*
|
|
@@ -357,7 +358,7 @@ export declare function afterFind<T extends ParseObject = ParseObject>(className
|
|
|
357
358
|
* @param handler The function to run before a login.
|
|
358
359
|
* @param validator An optional function to validate the request
|
|
359
360
|
*/
|
|
360
|
-
export declare function beforeLogin(handler: (request: TriggerRequest<ParseUser>) => Promise<void> | undefined, validator?: ValidatorObject | ((request: TriggerRequest<ParseUser>) => any)): void;
|
|
361
|
+
export declare function beforeLogin(handler: (request: TriggerRequest<ParseUser>) => void | Promise<void> | undefined, validator?: ValidatorObject | ((request: TriggerRequest<ParseUser>) => any)): void;
|
|
361
362
|
/**
|
|
362
363
|
* Registers an after login function.
|
|
363
364
|
*
|
|
@@ -365,7 +366,7 @@ export declare function beforeLogin(handler: (request: TriggerRequest<ParseUser>
|
|
|
365
366
|
*
|
|
366
367
|
* @param handler The function to run after a login.
|
|
367
368
|
*/
|
|
368
|
-
export declare function afterLogin(handler: (request: TriggerRequest<ParseUser>) => Promise<void> | undefined): void;
|
|
369
|
+
export declare function afterLogin(handler: (request: TriggerRequest<ParseUser>) => void | Promise<void> | undefined): void;
|
|
369
370
|
/**
|
|
370
371
|
* Registers an after logout function.
|
|
371
372
|
*
|
|
@@ -373,7 +374,7 @@ export declare function afterLogin(handler: (request: TriggerRequest<ParseUser>)
|
|
|
373
374
|
*
|
|
374
375
|
* @param handler The function to run after a logout.
|
|
375
376
|
*/
|
|
376
|
-
export declare function afterLogout(handler: (request: TriggerRequest) => Promise<void> | undefined): void;
|
|
377
|
+
export declare function afterLogout(handler: (request: TriggerRequest) => void | Promise<void> | undefined): void;
|
|
377
378
|
/**
|
|
378
379
|
* Registers a before password reset request function.
|
|
379
380
|
*
|
|
@@ -382,7 +383,7 @@ export declare function afterLogout(handler: (request: TriggerRequest) => Promis
|
|
|
382
383
|
* @param handler The function to run before a password reset request.
|
|
383
384
|
* @param validator An optional function to validate the request
|
|
384
385
|
*/
|
|
385
|
-
export declare function beforePasswordResetRequest(handler: (request: TriggerRequest<ParseUser>) => Promise<void> | undefined, validator?: ValidatorObject | ((request: TriggerRequest<ParseUser>) => any)): void;
|
|
386
|
+
export declare function beforePasswordResetRequest(handler: (request: TriggerRequest<ParseUser>) => void | Promise<void> | undefined, validator?: ValidatorObject | ((request: TriggerRequest<ParseUser>) => any)): void;
|
|
386
387
|
/**
|
|
387
388
|
* Registers a before save file function.
|
|
388
389
|
*
|
|
@@ -399,7 +400,7 @@ export declare function beforePasswordResetRequest(handler: (request: TriggerReq
|
|
|
399
400
|
*
|
|
400
401
|
* @param handler The function to run before a file saves.
|
|
401
402
|
*/
|
|
402
|
-
export declare function beforeSaveFile(handler: (request: FileTriggerRequest) => ParseFile | undefined | Promise<ParseFile | undefined>): void;
|
|
403
|
+
export declare function beforeSaveFile(handler: (request: FileTriggerRequest) => void | ParseFile | undefined | Promise<void | ParseFile | undefined>): void;
|
|
403
404
|
/**
|
|
404
405
|
* Registers an after save file function.
|
|
405
406
|
*
|
|
@@ -416,7 +417,7 @@ export declare function beforeSaveFile(handler: (request: FileTriggerRequest) =>
|
|
|
416
417
|
*
|
|
417
418
|
* @param handler The function to run after a file saves.
|
|
418
419
|
*/
|
|
419
|
-
export declare function afterSaveFile(handler: (request: FileTriggerRequest) => Promise<void> | undefined): void;
|
|
420
|
+
export declare function afterSaveFile(handler: (request: FileTriggerRequest) => void | Promise<void> | undefined): void;
|
|
420
421
|
/**
|
|
421
422
|
* Registers a before delete file function.
|
|
422
423
|
*
|
|
@@ -424,7 +425,7 @@ export declare function afterSaveFile(handler: (request: FileTriggerRequest) =>
|
|
|
424
425
|
*
|
|
425
426
|
* @param handler The function to run before a file is deleted.
|
|
426
427
|
*/
|
|
427
|
-
export declare function beforeDeleteFile(handler: (request: FileTriggerRequest) => Promise<void> | undefined): void;
|
|
428
|
+
export declare function beforeDeleteFile(handler: (request: FileTriggerRequest) => void | Promise<void> | undefined): void;
|
|
428
429
|
/**
|
|
429
430
|
* Registers an after delete file function.
|
|
430
431
|
*
|
|
@@ -432,7 +433,7 @@ export declare function beforeDeleteFile(handler: (request: FileTriggerRequest)
|
|
|
432
433
|
*
|
|
433
434
|
* @param handler The function to run after a file is deleted.
|
|
434
435
|
*/
|
|
435
|
-
export declare function afterDeleteFile(handler: (request: FileTriggerRequest) => Promise<void> | undefined): void;
|
|
436
|
+
export declare function afterDeleteFile(handler: (request: FileTriggerRequest) => void | Promise<void> | undefined): void;
|
|
436
437
|
/**
|
|
437
438
|
* Registers a before connect function for LiveQuery.
|
|
438
439
|
*
|
|
@@ -449,7 +450,7 @@ export declare function afterDeleteFile(handler: (request: FileTriggerRequest) =
|
|
|
449
450
|
* @param handler The function to run before a LiveQuery connection is made.
|
|
450
451
|
* @param validator An optional function to validate the request
|
|
451
452
|
*/
|
|
452
|
-
export declare function beforeConnect(handler: (request: ConnectTriggerRequest) => Promise<void> | undefined, validator?: ValidatorObject | ((request: ConnectTriggerRequest) => any)): void;
|
|
453
|
+
export declare function beforeConnect(handler: (request: ConnectTriggerRequest) => void | Promise<void> | undefined, validator?: ValidatorObject | ((request: ConnectTriggerRequest) => any)): void;
|
|
453
454
|
/**
|
|
454
455
|
* Registers a before subscribe function for LiveQuery.
|
|
455
456
|
*
|
|
@@ -469,7 +470,7 @@ export declare function beforeConnect(handler: (request: ConnectTriggerRequest)
|
|
|
469
470
|
* @param handler The function to run before a subscription.
|
|
470
471
|
* @param validator An optional function to validate the request
|
|
471
472
|
*/
|
|
472
|
-
export declare function beforeSubscribe<T extends ParseObject = ParseObject>(className: string |
|
|
473
|
+
export declare function beforeSubscribe<T extends ParseObject = ParseObject>(className: string | ParseObjectConstructor<T>, handler: (request: TriggerRequest<T>) => void | Promise<void> | undefined, validator?: ValidatorObject | ((request: TriggerRequest<T>) => any)): void;
|
|
473
474
|
/**
|
|
474
475
|
* Registers an after live query event function.
|
|
475
476
|
*
|
|
@@ -479,7 +480,7 @@ export declare function beforeSubscribe<T extends ParseObject = ParseObject>(cla
|
|
|
479
480
|
* @param handler The function to run after a live query event.
|
|
480
481
|
* @param validator An optional function to validate the request
|
|
481
482
|
*/
|
|
482
|
-
export declare function afterLiveQueryEvent<T extends ParseObject = ParseObject>(className: string |
|
|
483
|
+
export declare function afterLiveQueryEvent<T extends ParseObject = ParseObject>(className: string | ParseObjectConstructor<T>, handler: (request: LiveQueryEventTrigger<T>) => void | Promise<void> | undefined, validator?: ValidatorObject | ((request: LiveQueryEventTrigger<T>) => any)): void;
|
|
483
484
|
/**
|
|
484
485
|
* Sends an email.
|
|
485
486
|
*
|
|
@@ -521,3 +522,4 @@ export declare function sendEmail(data: {
|
|
|
521
522
|
* @returns A promise that will be resolved with a {@link HTTPResponse} object when the request completes.
|
|
522
523
|
*/
|
|
523
524
|
export declare function httpRequest(options: HTTPOptions): Promise<HTTPResponse>;
|
|
525
|
+
export {};
|
package/types/ParseObject.d.ts
CHANGED
|
@@ -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
|
|
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?:
|
|
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?:
|
|
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?:
|
|
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:
|
|
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?:
|
|
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;
|