parse 8.1.1-alpha.3 → 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/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/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/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/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 +87 -0
|
@@ -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/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/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/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;
|
package/types/ParseQuery.d.ts
CHANGED
|
@@ -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 {
|
|
5
|
-
import type { Pointer } from './ParseObject';
|
|
6
|
-
|
|
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
|
-
|
|
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?:
|
|
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?:
|
|
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?:
|
|
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
|
|
@@ -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?:
|
|
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
|
*
|
package/types/ParseSchema.d.ts
CHANGED
|
@@ -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
|
|
11
|
-
type
|
|
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
|
-
|
|
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;
|
package/types/ParseUser.d.ts
CHANGED
|
@@ -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?:
|
|
201
|
+
signUp(attrs?: Attributes | null, options?: SignUpOptions & {
|
|
198
202
|
context?: Attributes;
|
|
199
203
|
}): Promise<ParseUser>;
|
|
200
204
|
/**
|
package/types/Push.d.ts
CHANGED
|
@@ -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;
|