parse 6.1.0-alpha.2 → 6.1.0-alpha.3
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/README.md +0 -8
- package/dist/parse.js +27 -47
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +27 -47
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/CoreManager.js +1 -2
- package/lib/browser/CryptoController.js +0 -1
- package/lib/browser/EventEmitter.js +0 -1
- package/lib/browser/EventuallyQueue.js +0 -1
- package/lib/browser/IndexedDBStorageController.js +0 -1
- package/lib/browser/InstallationController.js +0 -1
- package/lib/browser/LocalDatastore.js +0 -1
- package/lib/browser/LocalDatastoreController.default.js +0 -1
- package/lib/browser/LocalDatastoreController.js +0 -1
- package/lib/browser/LocalDatastoreController.react-native.js +0 -1
- package/lib/browser/OfflineQuery.js +0 -1
- package/lib/browser/ParseInstallation.js +0 -1
- package/lib/browser/ParseQuery.js +19 -17
- package/lib/browser/RESTController.js +4 -3
- package/lib/browser/Socket.weapp.js +0 -1
- package/lib/browser/Storage.js +0 -1
- package/lib/browser/StorageController.browser.js +0 -1
- package/lib/browser/StorageController.default.js +0 -1
- package/lib/browser/StorageController.js +0 -1
- package/lib/browser/StorageController.react-native.js +0 -1
- package/lib/browser/StorageController.weapp.js +0 -1
- package/lib/browser/TaskQueue.js +0 -1
- package/lib/browser/WebSocketController.js +0 -1
- package/lib/browser/Xhr.weapp.js +0 -1
- package/lib/browser/uuid.js +0 -1
- package/lib/node/CoreManager.js +1 -2
- package/lib/node/CryptoController.js +0 -1
- package/lib/node/EventEmitter.js +0 -1
- package/lib/node/EventuallyQueue.js +0 -1
- package/lib/node/IndexedDBStorageController.js +0 -1
- package/lib/node/InstallationController.js +0 -1
- package/lib/node/LocalDatastore.js +0 -1
- package/lib/node/LocalDatastoreController.default.js +0 -1
- package/lib/node/LocalDatastoreController.js +0 -1
- package/lib/node/LocalDatastoreController.react-native.js +0 -1
- package/lib/node/OfflineQuery.js +0 -1
- package/lib/node/ParseInstallation.js +0 -1
- package/lib/node/RESTController.js +0 -1
- package/lib/node/Socket.weapp.js +0 -1
- package/lib/node/Storage.js +0 -1
- package/lib/node/StorageController.browser.js +0 -1
- package/lib/node/StorageController.default.js +0 -1
- package/lib/node/StorageController.js +0 -1
- package/lib/node/StorageController.react-native.js +0 -1
- package/lib/node/StorageController.weapp.js +0 -1
- package/lib/node/TaskQueue.js +0 -1
- package/lib/node/WebSocketController.js +0 -1
- package/lib/node/Xhr.weapp.js +0 -1
- package/lib/node/uuid.js +0 -1
- package/lib/react-native/CoreManager.js +1 -2
- package/lib/react-native/CryptoController.js +0 -1
- package/lib/react-native/EventEmitter.js +0 -1
- package/lib/react-native/EventuallyQueue.js +0 -1
- package/lib/react-native/IndexedDBStorageController.js +0 -1
- package/lib/react-native/InstallationController.js +0 -1
- package/lib/react-native/LocalDatastore.js +0 -1
- package/lib/react-native/LocalDatastoreController.default.js +0 -1
- package/lib/react-native/LocalDatastoreController.js +0 -1
- package/lib/react-native/LocalDatastoreController.react-native.js +0 -1
- package/lib/react-native/OfflineQuery.js +0 -1
- package/lib/react-native/ParseInstallation.js +0 -1
- package/lib/react-native/RESTController.js +0 -1
- package/lib/react-native/Socket.weapp.js +0 -1
- package/lib/react-native/Storage.js +0 -1
- package/lib/react-native/StorageController.browser.js +0 -1
- package/lib/react-native/StorageController.default.js +0 -1
- package/lib/react-native/StorageController.js +0 -1
- package/lib/react-native/StorageController.react-native.js +0 -1
- package/lib/react-native/StorageController.weapp.js +0 -1
- package/lib/react-native/TaskQueue.js +0 -1
- package/lib/react-native/WebSocketController.js +0 -1
- package/lib/react-native/Xhr.weapp.js +0 -1
- package/lib/react-native/uuid.js +0 -1
- package/lib/weapp/CoreManager.js +1 -2
- package/lib/weapp/CryptoController.js +0 -1
- package/lib/weapp/EventEmitter.js +0 -1
- package/lib/weapp/EventuallyQueue.js +0 -1
- package/lib/weapp/IndexedDBStorageController.js +0 -1
- package/lib/weapp/InstallationController.js +0 -1
- package/lib/weapp/LocalDatastore.js +0 -1
- package/lib/weapp/LocalDatastoreController.default.js +0 -1
- package/lib/weapp/LocalDatastoreController.js +0 -1
- package/lib/weapp/LocalDatastoreController.react-native.js +0 -1
- package/lib/weapp/OfflineQuery.js +0 -1
- package/lib/weapp/ParseInstallation.js +0 -1
- package/lib/weapp/ParseQuery.js +19 -17
- package/lib/weapp/RESTController.js +4 -3
- package/lib/weapp/Socket.weapp.js +0 -1
- package/lib/weapp/Storage.js +0 -1
- package/lib/weapp/StorageController.browser.js +0 -1
- package/lib/weapp/StorageController.default.js +0 -1
- package/lib/weapp/StorageController.js +0 -1
- package/lib/weapp/StorageController.react-native.js +0 -1
- package/lib/weapp/StorageController.weapp.js +0 -1
- package/lib/weapp/TaskQueue.js +0 -1
- package/lib/weapp/WebSocketController.js +0 -1
- package/lib/weapp/Xhr.weapp.js +0 -1
- package/lib/weapp/uuid.js +0 -1
- package/package.json +11 -9
- package/types/Analytics.d.ts +42 -0
- package/types/AnonymousUtils.d.ts +84 -0
- package/types/Cloud.d.ts +65 -0
- package/types/CloudCode.d.ts +307 -0
- package/types/CoreManager.d.ts +325 -0
- package/types/CryptoController.d.ts +5 -0
- package/types/EventEmitter.d.ts +5 -0
- package/types/EventuallyQueue.d.ts +168 -0
- package/types/FacebookUtils.d.ts +107 -0
- package/types/IndexedDBStorageController.d.ts +2 -0
- package/types/InstallationController.d.ts +10 -0
- package/types/LiveQueryClient.d.ts +128 -0
- package/types/LiveQuerySubscription.d.ts +103 -0
- package/types/LocalDatastore.d.ts +56 -0
- package/types/LocalDatastoreController.d.ts +2 -0
- package/types/LocalDatastoreController.default.d.ts +9 -0
- package/types/LocalDatastoreController.react-native.d.ts +9 -0
- package/types/LocalDatastoreUtils.d.ts +5 -0
- package/types/ObjectStateMutations.d.ts +28 -0
- package/types/OfflineQuery.d.ts +20 -0
- package/types/Parse.d.ts +633 -0
- package/types/ParseACL.d.ts +141 -0
- package/types/ParseCLP.d.ts +293 -0
- package/types/ParseConfig.d.ts +77 -0
- package/types/ParseError.d.ts +476 -0
- package/types/ParseFile.d.ts +192 -0
- package/types/ParseGeoPoint.d.ts +104 -0
- package/types/ParseHooks.d.ts +27 -0
- package/types/ParseInstallation.d.ts +179 -0
- package/types/ParseLiveQuery.d.ts +48 -0
- package/types/ParseObject.d.ts +1072 -0
- package/types/ParseOp.d.ts +78 -0
- package/types/ParsePolygon.d.ts +69 -0
- package/types/ParseQuery.d.ts +961 -0
- package/types/ParseRelation.d.ts +56 -0
- package/types/ParseRole.d.ts +79 -0
- package/types/ParseSchema.d.ts +286 -0
- package/types/ParseSession.d.ts +45 -0
- package/types/ParseUser.d.ts +517 -0
- package/types/Push.d.ts +62 -0
- package/types/RESTController.d.ts +35 -0
- package/types/SingleInstanceStateController.d.ts +24 -0
- package/types/Socket.weapp.d.ts +10 -0
- package/types/Storage.d.ts +14 -0
- package/types/StorageController.browser.d.ts +9 -0
- package/types/StorageController.d.ts +2 -0
- package/types/StorageController.default.d.ts +9 -0
- package/types/StorageController.react-native.d.ts +11 -0
- package/types/StorageController.weapp.d.ts +9 -0
- package/types/TaskQueue.d.ts +11 -0
- package/types/UniqueInstanceStateController.d.ts +20 -0
- package/types/WebSocketController.d.ts +2 -0
- package/types/Xhr.weapp.d.ts +29 -0
- package/types/arrayContainsObject.d.ts +2 -0
- package/types/canBeSerialized.d.ts +2 -0
- package/types/decode.d.ts +1 -0
- package/types/encode.d.ts +1 -0
- package/types/equals.d.ts +1 -0
- package/types/escape.d.ts +1 -0
- package/types/index.d.ts +66 -0
- package/types/isRevocableSession.d.ts +1 -0
- package/types/node.d.ts +3 -0
- package/types/parseDate.d.ts +1 -0
- package/types/promiseUtils.d.ts +9 -0
- package/types/react-native.d.ts +3 -0
- package/types/tests.ts +2256 -0
- package/types/tsconfig.json +25 -0
- package/types/unique.d.ts +1 -0
- package/types/unsavedChildren.d.ts +11 -0
- package/types/uuid.d.ts +2 -0
|
@@ -0,0 +1,961 @@
|
|
|
1
|
+
import ParseGeoPoint from './ParseGeoPoint';
|
|
2
|
+
import ParseObject from './ParseObject';
|
|
3
|
+
import type LiveQuerySubscription from './LiveQuerySubscription';
|
|
4
|
+
import type { FullOptions } from './RESTController';
|
|
5
|
+
import type { Pointer } from './ParseObject';
|
|
6
|
+
type BatchOptions = FullOptions & {
|
|
7
|
+
batchSize?: number;
|
|
8
|
+
useMasterKey?: boolean;
|
|
9
|
+
useMaintenanceKey?: boolean;
|
|
10
|
+
sessionToken?: string;
|
|
11
|
+
context?: {
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
};
|
|
14
|
+
json?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type WhereClause = {
|
|
17
|
+
[attr: string]: any;
|
|
18
|
+
};
|
|
19
|
+
type QueryOptions = {
|
|
20
|
+
useMasterKey?: boolean;
|
|
21
|
+
sessionToken?: string;
|
|
22
|
+
context?: {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
};
|
|
25
|
+
json?: boolean;
|
|
26
|
+
};
|
|
27
|
+
type FullTextQueryOptions = {
|
|
28
|
+
language?: string;
|
|
29
|
+
caseSensitive?: boolean;
|
|
30
|
+
diacriticSensitive?: boolean;
|
|
31
|
+
};
|
|
32
|
+
export type QueryJSON = {
|
|
33
|
+
where: WhereClause;
|
|
34
|
+
watch?: string;
|
|
35
|
+
include?: string;
|
|
36
|
+
excludeKeys?: string;
|
|
37
|
+
keys?: string;
|
|
38
|
+
limit?: number;
|
|
39
|
+
skip?: number;
|
|
40
|
+
order?: string;
|
|
41
|
+
className?: string;
|
|
42
|
+
count?: number;
|
|
43
|
+
hint?: any;
|
|
44
|
+
explain?: boolean;
|
|
45
|
+
readPreference?: string;
|
|
46
|
+
includeReadPreference?: string;
|
|
47
|
+
subqueryReadPreference?: string;
|
|
48
|
+
comment?: string;
|
|
49
|
+
};
|
|
50
|
+
interface BaseAttributes {
|
|
51
|
+
createdAt: Date;
|
|
52
|
+
objectId: string;
|
|
53
|
+
updatedAt: Date;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Creates a new parse Parse.Query for the given Parse.Object subclass.
|
|
57
|
+
*
|
|
58
|
+
* <p>Parse.Query defines a query that is used to fetch Parse.Objects. The
|
|
59
|
+
* most common use case is finding all objects that match a query through the
|
|
60
|
+
* <code>find</code> method. for example, this sample code fetches all objects
|
|
61
|
+
* of class <code>myclass</code>. it calls a different function depending on
|
|
62
|
+
* whether the fetch succeeded or not.
|
|
63
|
+
*
|
|
64
|
+
* <pre>
|
|
65
|
+
* var query = new Parse.Query(myclass);
|
|
66
|
+
* query.find().then((results) => {
|
|
67
|
+
* // results is an array of parse.object.
|
|
68
|
+
* }).catch((error) => {
|
|
69
|
+
* // error is an instance of parse.error.
|
|
70
|
+
* });</pre></p>
|
|
71
|
+
*
|
|
72
|
+
* <p>a Parse.Query can also be used to retrieve a single object whose id is
|
|
73
|
+
* known, through the get method. for example, this sample code fetches an
|
|
74
|
+
* object of class <code>myclass</code> and id <code>myid</code>. it calls a
|
|
75
|
+
* different function depending on whether the fetch succeeded or not.
|
|
76
|
+
*
|
|
77
|
+
* <pre>
|
|
78
|
+
* var query = new Parse.Query(myclass);
|
|
79
|
+
* query.get(myid).then((object) => {
|
|
80
|
+
* // object is an instance of parse.object.
|
|
81
|
+
* }).catch((error) => {
|
|
82
|
+
* // error is an instance of parse.error.
|
|
83
|
+
* });</pre></p>
|
|
84
|
+
*
|
|
85
|
+
* <p>a Parse.Query can also be used to count the number of objects that match
|
|
86
|
+
* the query without retrieving all of those objects. for example, this
|
|
87
|
+
* sample code counts the number of objects of the class <code>myclass</code>
|
|
88
|
+
* <pre>
|
|
89
|
+
* var query = new Parse.Query(myclass);
|
|
90
|
+
* query.count().then((number) => {
|
|
91
|
+
* // there are number instances of myclass.
|
|
92
|
+
* }).catch((error) => {
|
|
93
|
+
* // error is an instance of Parse.Error.
|
|
94
|
+
* });</pre></p>
|
|
95
|
+
*
|
|
96
|
+
* @alias Parse.Query
|
|
97
|
+
*/
|
|
98
|
+
declare class ParseQuery<T extends ParseObject = ParseObject> {
|
|
99
|
+
/**
|
|
100
|
+
* @property {string} className
|
|
101
|
+
*/
|
|
102
|
+
className: string;
|
|
103
|
+
_where: any;
|
|
104
|
+
_watch: Array<string>;
|
|
105
|
+
_include: Array<string>;
|
|
106
|
+
_exclude: Array<string>;
|
|
107
|
+
_select: Array<string>;
|
|
108
|
+
_limit: number;
|
|
109
|
+
_skip: number;
|
|
110
|
+
_count: boolean;
|
|
111
|
+
_order: Array<string>;
|
|
112
|
+
_readPreference: string | null;
|
|
113
|
+
_includeReadPreference: string | null;
|
|
114
|
+
_subqueryReadPreference: string | null;
|
|
115
|
+
_queriesLocalDatastore: boolean;
|
|
116
|
+
_localDatastorePinName: any;
|
|
117
|
+
_extraOptions: {
|
|
118
|
+
[key: string]: any;
|
|
119
|
+
};
|
|
120
|
+
_hint: any;
|
|
121
|
+
_explain: boolean;
|
|
122
|
+
_xhrRequest: any;
|
|
123
|
+
_comment: string;
|
|
124
|
+
/**
|
|
125
|
+
* @param {(string | Parse.Object)} objectClass An instance of a subclass of Parse.Object, or a Parse className string.
|
|
126
|
+
*/
|
|
127
|
+
constructor(objectClass: string | (new (...args: any[]) => T | ParseObject));
|
|
128
|
+
/**
|
|
129
|
+
* Adds constraint that at least one of the passed in queries matches.
|
|
130
|
+
*
|
|
131
|
+
* @param {Array} queries
|
|
132
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
133
|
+
*/
|
|
134
|
+
_orQuery(queries: Array<ParseQuery>): this;
|
|
135
|
+
/**
|
|
136
|
+
* Adds constraint that all of the passed in queries match.
|
|
137
|
+
*
|
|
138
|
+
* @param {Array} queries
|
|
139
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
140
|
+
*/
|
|
141
|
+
_andQuery(queries: Array<ParseQuery>): this;
|
|
142
|
+
/**
|
|
143
|
+
* Adds constraint that none of the passed in queries match.
|
|
144
|
+
*
|
|
145
|
+
* @param {Array} queries
|
|
146
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
147
|
+
*/
|
|
148
|
+
_norQuery(queries: Array<ParseQuery>): this;
|
|
149
|
+
/**
|
|
150
|
+
* Helper for condition queries
|
|
151
|
+
*
|
|
152
|
+
* @param key
|
|
153
|
+
* @param condition
|
|
154
|
+
* @param value
|
|
155
|
+
* @returns {Parse.Query}
|
|
156
|
+
*/
|
|
157
|
+
_addCondition<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K, condition: string, value: any): this;
|
|
158
|
+
/**
|
|
159
|
+
* Converts string for regular expression at the beginning
|
|
160
|
+
*
|
|
161
|
+
* @param string
|
|
162
|
+
* @returns {string}
|
|
163
|
+
*/
|
|
164
|
+
_regexStartWith(string: string): string;
|
|
165
|
+
_handleOfflineQuery(params: QueryJSON): Promise<any>;
|
|
166
|
+
/**
|
|
167
|
+
* Returns a JSON representation of this query.
|
|
168
|
+
*
|
|
169
|
+
* @returns {object} The JSON representation of the query.
|
|
170
|
+
*/
|
|
171
|
+
toJSON(): QueryJSON;
|
|
172
|
+
/**
|
|
173
|
+
* Return a query with conditions from json, can be useful to send query from server side to client
|
|
174
|
+
* Not static, all query conditions was set before calling this method will be deleted.
|
|
175
|
+
* For example on the server side we have
|
|
176
|
+
* var query = new Parse.Query("className");
|
|
177
|
+
* query.equalTo(key: value);
|
|
178
|
+
* query.limit(100);
|
|
179
|
+
* ... (others queries)
|
|
180
|
+
* Create JSON representation of Query Object
|
|
181
|
+
* var jsonFromServer = query.fromJSON();
|
|
182
|
+
*
|
|
183
|
+
* On client side getting query:
|
|
184
|
+
* var query = new Parse.Query("className");
|
|
185
|
+
* query.fromJSON(jsonFromServer);
|
|
186
|
+
*
|
|
187
|
+
* and continue to query...
|
|
188
|
+
* query.skip(100).find().then(...);
|
|
189
|
+
*
|
|
190
|
+
* @param {QueryJSON} json from Parse.Query.toJSON() method
|
|
191
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
192
|
+
*/
|
|
193
|
+
withJSON(json: QueryJSON): this;
|
|
194
|
+
/**
|
|
195
|
+
* Static method to restore Parse.Query by json representation
|
|
196
|
+
* Internally calling Parse.Query.withJSON
|
|
197
|
+
*
|
|
198
|
+
* @param {string} className
|
|
199
|
+
* @param {QueryJSON} json from Parse.Query.toJSON() method
|
|
200
|
+
* @returns {Parse.Query} new created query
|
|
201
|
+
*/
|
|
202
|
+
static fromJSON(className: string, json: QueryJSON): ParseQuery;
|
|
203
|
+
/**
|
|
204
|
+
* Constructs a Parse.Object whose id is already known by fetching data from
|
|
205
|
+
* the server. Unlike the <code>first</code> method, it never returns undefined.
|
|
206
|
+
*
|
|
207
|
+
* @param {string} objectId The id of the object to be fetched.
|
|
208
|
+
* @param {object} options
|
|
209
|
+
* Valid options are:<ul>
|
|
210
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
211
|
+
* be used for this request.
|
|
212
|
+
* <li>sessionToken: A valid session token, used for making a request on
|
|
213
|
+
* behalf of a specific user.
|
|
214
|
+
* <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
|
|
215
|
+
* <li>json: Return raw json without converting to Parse.Object
|
|
216
|
+
* </ul>
|
|
217
|
+
* @returns {Promise} A promise that is resolved with the result when
|
|
218
|
+
* the query completes.
|
|
219
|
+
*/
|
|
220
|
+
get(objectId: string, options?: QueryOptions): Promise<T>;
|
|
221
|
+
/**
|
|
222
|
+
* Retrieves a list of ParseObjects that satisfy this query.
|
|
223
|
+
*
|
|
224
|
+
* @param {object} options Valid options
|
|
225
|
+
* are:<ul>
|
|
226
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
227
|
+
* be used for this request.
|
|
228
|
+
* <li>sessionToken: A valid session token, used for making a request on
|
|
229
|
+
* behalf of a specific user.
|
|
230
|
+
* <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
|
|
231
|
+
* <li>json: Return raw json without converting to Parse.Object
|
|
232
|
+
* </ul>
|
|
233
|
+
* @returns {Promise} A promise that is resolved with the results when
|
|
234
|
+
* the query completes.
|
|
235
|
+
*/
|
|
236
|
+
find(options?: QueryOptions): Promise<T[]>;
|
|
237
|
+
/**
|
|
238
|
+
* Retrieves a complete list of ParseObjects that satisfy this query.
|
|
239
|
+
* Using `eachBatch` under the hood to fetch all the valid objects.
|
|
240
|
+
*
|
|
241
|
+
* @param {object} options Valid options are:<ul>
|
|
242
|
+
* <li>batchSize: How many objects to yield in each batch (default: 100)
|
|
243
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
244
|
+
* be used for this request.
|
|
245
|
+
* <li>sessionToken: A valid session token, used for making a request on
|
|
246
|
+
* behalf of a specific user.
|
|
247
|
+
* <li>json: Return raw JSON without converting to Parse.Object.
|
|
248
|
+
* </ul>
|
|
249
|
+
* @returns {Promise} A promise that is resolved with the results when
|
|
250
|
+
* the query completes.
|
|
251
|
+
*/
|
|
252
|
+
findAll(options?: BatchOptions): Promise<T[]>;
|
|
253
|
+
/**
|
|
254
|
+
* Counts the number of objects that match this query.
|
|
255
|
+
*
|
|
256
|
+
* @param {object} options
|
|
257
|
+
* @param {boolean} [options.useMasterKey]
|
|
258
|
+
* @param {string} [options.sessionToken]
|
|
259
|
+
* Valid options are:<ul>
|
|
260
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
261
|
+
* be used for this request.
|
|
262
|
+
* <li>sessionToken: A valid session token, used for making a request on
|
|
263
|
+
* behalf of a specific user.
|
|
264
|
+
* </ul>
|
|
265
|
+
* @returns {Promise} A promise that is resolved with the count when
|
|
266
|
+
* the query completes.
|
|
267
|
+
*/
|
|
268
|
+
count(options?: {
|
|
269
|
+
useMasterKey?: boolean;
|
|
270
|
+
sessionToken?: string;
|
|
271
|
+
}): Promise<number>;
|
|
272
|
+
/**
|
|
273
|
+
* Executes a distinct query and returns unique values
|
|
274
|
+
*
|
|
275
|
+
* @param {string} key A field to find distinct values
|
|
276
|
+
* @param {object} options
|
|
277
|
+
* @param {string} [options.sessionToken] A valid session token, used for making a request on behalf of a specific user.
|
|
278
|
+
* @returns {Promise} A promise that is resolved with the query completes.
|
|
279
|
+
*/
|
|
280
|
+
distinct<K extends keyof T['attributes'], V = T['attributes'][K]>(key: K, options?: {
|
|
281
|
+
sessionToken?: string;
|
|
282
|
+
}): Promise<V[]>;
|
|
283
|
+
/**
|
|
284
|
+
* Executes an aggregate query and returns aggregate results
|
|
285
|
+
*
|
|
286
|
+
* @param {(Array|object)} pipeline Array or Object of stages to process query
|
|
287
|
+
* @param {object} options
|
|
288
|
+
* @param {string} [options.sessionToken] A valid session token, used for making a request on behalf of a specific user.
|
|
289
|
+
* @returns {Promise} A promise that is resolved with the query completes.
|
|
290
|
+
*/
|
|
291
|
+
aggregate(pipeline: any, options?: {
|
|
292
|
+
sessionToken?: string;
|
|
293
|
+
}): Promise<Array<any>>;
|
|
294
|
+
/**
|
|
295
|
+
* Retrieves at most one Parse.Object that satisfies this query.
|
|
296
|
+
*
|
|
297
|
+
* Returns the object if there is one, otherwise undefined.
|
|
298
|
+
*
|
|
299
|
+
* @param {object} options Valid options are:<ul>
|
|
300
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
301
|
+
* be used for this request.
|
|
302
|
+
* <li>sessionToken: A valid session token, used for making a request on
|
|
303
|
+
* behalf of a specific user.
|
|
304
|
+
* <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
|
|
305
|
+
* <li>json: Return raw json without converting to Parse.Object
|
|
306
|
+
* </ul>
|
|
307
|
+
* @returns {Promise} A promise that is resolved with the object when
|
|
308
|
+
* the query completes.
|
|
309
|
+
*/
|
|
310
|
+
first(options?: QueryOptions): Promise<T | undefined>;
|
|
311
|
+
/**
|
|
312
|
+
* Iterates over objects matching a query, calling a callback for each batch.
|
|
313
|
+
* If the callback returns a promise, the iteration will not continue until
|
|
314
|
+
* that promise has been fulfilled. If the callback returns a rejected
|
|
315
|
+
* promise, then iteration will stop with that error. The items are processed
|
|
316
|
+
* in an unspecified order. The query may not have any sort order, and may
|
|
317
|
+
* not use limit or skip.
|
|
318
|
+
*
|
|
319
|
+
* @param {Function} callback Callback that will be called with each result
|
|
320
|
+
* of the query.
|
|
321
|
+
* @param {object} options Valid options are:<ul>
|
|
322
|
+
* <li>batchSize: How many objects to yield in each batch (default: 100)
|
|
323
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
324
|
+
* be used for this request.
|
|
325
|
+
* <li>sessionToken: A valid session token, used for making a request on
|
|
326
|
+
* behalf of a specific user.
|
|
327
|
+
* <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
|
|
328
|
+
* </ul>
|
|
329
|
+
* @returns {Promise} A promise that will be fulfilled once the
|
|
330
|
+
* iteration has completed.
|
|
331
|
+
*/
|
|
332
|
+
eachBatch(callback: (objs: T[]) => PromiseLike<void> | void, options?: BatchOptions): Promise<void>;
|
|
333
|
+
/**
|
|
334
|
+
* Iterates over each result of a query, calling a callback for each one. If
|
|
335
|
+
* the callback returns a promise, the iteration will not continue until
|
|
336
|
+
* that promise has been fulfilled. If the callback returns a rejected
|
|
337
|
+
* promise, then iteration will stop with that error. The items are
|
|
338
|
+
* processed in an unspecified order. The query may not have any sort order,
|
|
339
|
+
* and may not use limit or skip.
|
|
340
|
+
*
|
|
341
|
+
* @param {Function} callback Callback that will be called with each result
|
|
342
|
+
* of the query.
|
|
343
|
+
* @param {object} options Valid options are:<ul>
|
|
344
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
345
|
+
* be used for this request.
|
|
346
|
+
* <li>sessionToken: A valid session token, used for making a request on
|
|
347
|
+
* behalf of a specific user.
|
|
348
|
+
* <li>json: Return raw json without converting to Parse.Object
|
|
349
|
+
* </ul>
|
|
350
|
+
* @returns {Promise} A promise that will be fulfilled once the
|
|
351
|
+
* iteration has completed.
|
|
352
|
+
*/
|
|
353
|
+
each(callback: (obj: T) => PromiseLike<void> | void, options?: BatchOptions): Promise<void>;
|
|
354
|
+
/**
|
|
355
|
+
* Adds a hint to force index selection. (https://docs.mongodb.com/manual/reference/operator/meta/hint/)
|
|
356
|
+
*
|
|
357
|
+
* @param {(string|object)} value String or Object of index that should be used when executing query
|
|
358
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
359
|
+
*/
|
|
360
|
+
hint(value: any): this;
|
|
361
|
+
/**
|
|
362
|
+
* Investigates the query execution plan. Useful for optimizing queries. (https://docs.mongodb.com/manual/reference/operator/meta/explain/)
|
|
363
|
+
*
|
|
364
|
+
* @param {boolean} explain Used to toggle the information on the query plan.
|
|
365
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
366
|
+
*/
|
|
367
|
+
explain(explain?: boolean): this;
|
|
368
|
+
/**
|
|
369
|
+
* Iterates over each result of a query, calling a callback for each one. If
|
|
370
|
+
* the callback returns a promise, the iteration will not continue until
|
|
371
|
+
* that promise has been fulfilled. If the callback returns a rejected
|
|
372
|
+
* promise, then iteration will stop with that error. The items are
|
|
373
|
+
* processed in an unspecified order. The query may not have any sort order,
|
|
374
|
+
* and may not use limit or skip.
|
|
375
|
+
*
|
|
376
|
+
* @param {Function} callback Callback <ul>
|
|
377
|
+
* <li>currentObject: The current Parse.Object being processed in the array.</li>
|
|
378
|
+
* <li>index: The index of the current Parse.Object being processed in the array.</li>
|
|
379
|
+
* <li>query: The query map was called upon.</li>
|
|
380
|
+
* </ul>
|
|
381
|
+
* @param {object} options Valid options are:<ul>
|
|
382
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
383
|
+
* be used for this request.
|
|
384
|
+
* <li>sessionToken: A valid session token, used for making a request on
|
|
385
|
+
* behalf of a specific user.
|
|
386
|
+
* </ul>
|
|
387
|
+
* @returns {Promise} A promise that will be fulfilled once the
|
|
388
|
+
* iteration has completed.
|
|
389
|
+
*/
|
|
390
|
+
map(callback: (currentObject: ParseObject, index: number, query: ParseQuery) => any, options?: BatchOptions): Promise<Array<any>>;
|
|
391
|
+
/**
|
|
392
|
+
* Iterates over each result of a query, calling a callback for each one. If
|
|
393
|
+
* the callback returns a promise, the iteration will not continue until
|
|
394
|
+
* that promise has been fulfilled. If the callback returns a rejected
|
|
395
|
+
* promise, then iteration will stop with that error. The items are
|
|
396
|
+
* processed in an unspecified order. The query may not have any sort order,
|
|
397
|
+
* and may not use limit or skip.
|
|
398
|
+
*
|
|
399
|
+
* @param {Function} callback Callback <ul>
|
|
400
|
+
* <li>accumulator: The accumulator accumulates the callback's return values. It is the accumulated value previously returned in the last invocation of the callback.</li>
|
|
401
|
+
* <li>currentObject: The current Parse.Object being processed in the array.</li>
|
|
402
|
+
* <li>index: The index of the current Parse.Object being processed in the array.</li>
|
|
403
|
+
* </ul>
|
|
404
|
+
* @param {*} initialValue A value to use as the first argument to the first call of the callback. If no initialValue is supplied, the first object in the query will be used and skipped.
|
|
405
|
+
* @param {object} options Valid options are:<ul>
|
|
406
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
407
|
+
* be used for this request.
|
|
408
|
+
* <li>sessionToken: A valid session token, used for making a request on
|
|
409
|
+
* behalf of a specific user.
|
|
410
|
+
* </ul>
|
|
411
|
+
* @returns {Promise} A promise that will be fulfilled once the
|
|
412
|
+
* iteration has completed.
|
|
413
|
+
*/
|
|
414
|
+
reduce(callback: (accumulator: any, currentObject: ParseObject, index: number) => any, initialValue: any, options?: BatchOptions): Promise<Array<any>>;
|
|
415
|
+
/**
|
|
416
|
+
* Iterates over each result of a query, calling a callback for each one. If
|
|
417
|
+
* the callback returns a promise, the iteration will not continue until
|
|
418
|
+
* that promise has been fulfilled. If the callback returns a rejected
|
|
419
|
+
* promise, then iteration will stop with that error. The items are
|
|
420
|
+
* processed in an unspecified order. The query may not have any sort order,
|
|
421
|
+
* and may not use limit or skip.
|
|
422
|
+
*
|
|
423
|
+
* @param {Function} callback Callback <ul>
|
|
424
|
+
* <li>currentObject: The current Parse.Object being processed in the array.</li>
|
|
425
|
+
* <li>index: The index of the current Parse.Object being processed in the array.</li>
|
|
426
|
+
* <li>query: The query filter was called upon.</li>
|
|
427
|
+
* </ul>
|
|
428
|
+
* @param {object} options Valid options are:<ul>
|
|
429
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
430
|
+
* be used for this request.
|
|
431
|
+
* <li>sessionToken: A valid session token, used for making a request on
|
|
432
|
+
* behalf of a specific user.
|
|
433
|
+
* </ul>
|
|
434
|
+
* @returns {Promise} A promise that will be fulfilled once the
|
|
435
|
+
* iteration has completed.
|
|
436
|
+
*/
|
|
437
|
+
filter(callback: (currentObject: ParseObject, index: number, query: ParseQuery) => boolean, options?: BatchOptions): Promise<Array<ParseObject>>;
|
|
438
|
+
/**
|
|
439
|
+
* Adds a constraint to the query that requires a particular key's value to
|
|
440
|
+
* be equal to the provided value.
|
|
441
|
+
*
|
|
442
|
+
* @param {string} key The key to check.
|
|
443
|
+
* @param value The value that the Parse.Object must contain.
|
|
444
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
445
|
+
*/
|
|
446
|
+
equalTo<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K, value: T['attributes'][K] | (T['attributes'][K] extends ParseObject ? Pointer : T['attributes'][K] extends Array<infer E> ? E : never)): this;
|
|
447
|
+
/**
|
|
448
|
+
* Adds a constraint to the query that requires a particular key's value to
|
|
449
|
+
* be not equal to the provided value.
|
|
450
|
+
*
|
|
451
|
+
* @param {string} key The key to check.
|
|
452
|
+
* @param value The value that must not be equalled.
|
|
453
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
454
|
+
*/
|
|
455
|
+
notEqualTo<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K, value: T['attributes'][K] | (T['attributes'][K] extends ParseObject ? Pointer : T['attributes'][K] extends Array<infer E> ? E : never)): this;
|
|
456
|
+
/**
|
|
457
|
+
* Adds a constraint to the query that requires a particular key's value to
|
|
458
|
+
* be less than the provided value.
|
|
459
|
+
*
|
|
460
|
+
* @param {string} key The key to check.
|
|
461
|
+
* @param value The value that provides an upper bound.
|
|
462
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
463
|
+
*/
|
|
464
|
+
lessThan<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K, value: T['attributes'][K]): this;
|
|
465
|
+
/**
|
|
466
|
+
* Adds a constraint to the query that requires a particular key's value to
|
|
467
|
+
* be greater than the provided value.
|
|
468
|
+
*
|
|
469
|
+
* @param {string} key The key to check.
|
|
470
|
+
* @param value The value that provides an lower bound.
|
|
471
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
472
|
+
*/
|
|
473
|
+
greaterThan<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K, value: T['attributes'][K]): this;
|
|
474
|
+
/**
|
|
475
|
+
* Adds a constraint to the query that requires a particular key's value to
|
|
476
|
+
* be less than or equal to the provided value.
|
|
477
|
+
*
|
|
478
|
+
* @param {string} key The key to check.
|
|
479
|
+
* @param value The value that provides an upper bound.
|
|
480
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
481
|
+
*/
|
|
482
|
+
lessThanOrEqualTo<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K, value: T['attributes'][K]): this;
|
|
483
|
+
/**
|
|
484
|
+
* Adds a constraint to the query that requires a particular key's value to
|
|
485
|
+
* be greater than or equal to the provided value.
|
|
486
|
+
*
|
|
487
|
+
* @param {string} key The key to check.
|
|
488
|
+
* @param {*} value The value that provides an lower bound.
|
|
489
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
490
|
+
*/
|
|
491
|
+
greaterThanOrEqualTo<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K, value: T['attributes'][K]): this;
|
|
492
|
+
/**
|
|
493
|
+
* Adds a constraint to the query that requires a particular key's value to
|
|
494
|
+
* be contained in the provided list of values.
|
|
495
|
+
*
|
|
496
|
+
* @param {string} key The key to check.
|
|
497
|
+
* @param {Array<*>} values The values that will match.
|
|
498
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
499
|
+
*/
|
|
500
|
+
containedIn<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K, values: Array<T['attributes'][K] | (T['attributes'][K] extends ParseObject ? string : never)>): this;
|
|
501
|
+
/**
|
|
502
|
+
* Adds a constraint to the query that requires a particular key's value to
|
|
503
|
+
* not be contained in the provided list of values.
|
|
504
|
+
*
|
|
505
|
+
* @param {string} key The key to check.
|
|
506
|
+
* @param {Array<*>} values The values that will not match.
|
|
507
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
508
|
+
*/
|
|
509
|
+
notContainedIn<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K, values: Array<T['attributes'][K]>): this;
|
|
510
|
+
/**
|
|
511
|
+
* Adds a constraint to the query that requires a particular key's value to
|
|
512
|
+
* be contained by the provided list of values. Get objects where all array elements match.
|
|
513
|
+
*
|
|
514
|
+
* @param {string} key The key to check.
|
|
515
|
+
* @param {Array} values The values that will match.
|
|
516
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
517
|
+
*/
|
|
518
|
+
containedBy<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K, values: Array<T['attributes'][K] | (T['attributes'][K] extends ParseObject ? string : never)>): this;
|
|
519
|
+
/**
|
|
520
|
+
* Adds a constraint to the query that requires a particular key's value to
|
|
521
|
+
* contain each one of the provided list of values.
|
|
522
|
+
*
|
|
523
|
+
* @param {string} key The key to check. This key's value must be an array.
|
|
524
|
+
* @param {Array} values The values that will match.
|
|
525
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
526
|
+
*/
|
|
527
|
+
containsAll<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K, values: any[]): this;
|
|
528
|
+
/**
|
|
529
|
+
* Adds a constraint to the query that requires a particular key's value to
|
|
530
|
+
* contain each one of the provided list of values starting with given strings.
|
|
531
|
+
*
|
|
532
|
+
* @param {string} key The key to check. This key's value must be an array.
|
|
533
|
+
* @param {Array<string>} values The string values that will match as starting string.
|
|
534
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
535
|
+
*/
|
|
536
|
+
containsAllStartingWith<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K, values: any[]): this;
|
|
537
|
+
/**
|
|
538
|
+
* Adds a constraint for finding objects that contain the given key.
|
|
539
|
+
*
|
|
540
|
+
* @param {string} key The key that should exist.
|
|
541
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
542
|
+
*/
|
|
543
|
+
exists<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K): this;
|
|
544
|
+
/**
|
|
545
|
+
* Adds a constraint for finding objects that do not contain a given key.
|
|
546
|
+
*
|
|
547
|
+
* @param {string} key The key that should not exist
|
|
548
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
549
|
+
*/
|
|
550
|
+
doesNotExist<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K): this;
|
|
551
|
+
/**
|
|
552
|
+
* Adds a regular expression constraint for finding string values that match
|
|
553
|
+
* the provided regular expression.
|
|
554
|
+
* This may be slow for large datasets.
|
|
555
|
+
*
|
|
556
|
+
* @param {string} key The key that the string to match is stored in.
|
|
557
|
+
* @param {RegExp | string} regex The regular expression pattern to match.
|
|
558
|
+
* @param {string} modifiers The regular expression mode.
|
|
559
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
560
|
+
*/
|
|
561
|
+
matches<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K, regex: RegExp | string, modifiers?: string): this;
|
|
562
|
+
/**
|
|
563
|
+
* Adds a constraint that requires that a key's value matches a Parse.Query
|
|
564
|
+
* constraint.
|
|
565
|
+
*
|
|
566
|
+
* @param {string} key The key that the contains the object to match the
|
|
567
|
+
* query.
|
|
568
|
+
* @param {Parse.Query} query The query that should match.
|
|
569
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
570
|
+
*/
|
|
571
|
+
matchesQuery<U extends ParseObject, K extends keyof T['attributes']>(key: K, query: ParseQuery<U>): this;
|
|
572
|
+
/**
|
|
573
|
+
* Adds a constraint that requires that a key's value not matches a
|
|
574
|
+
* Parse.Query constraint.
|
|
575
|
+
*
|
|
576
|
+
* @param {string} key The key that the contains the object to match the
|
|
577
|
+
* query.
|
|
578
|
+
* @param {Parse.Query} query The query that should not match.
|
|
579
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
580
|
+
*/
|
|
581
|
+
doesNotMatchQuery<U extends ParseObject, K extends keyof T['attributes']>(key: K, query: ParseQuery<U>): this;
|
|
582
|
+
/**
|
|
583
|
+
* Adds a constraint that requires that a key's value matches a value in
|
|
584
|
+
* an object returned by a different Parse.Query.
|
|
585
|
+
*
|
|
586
|
+
* @param {string} key The key that contains the value that is being
|
|
587
|
+
* matched.
|
|
588
|
+
* @param {string} queryKey The key in the objects returned by the query to
|
|
589
|
+
* match against.
|
|
590
|
+
* @param {Parse.Query} query The query to run.
|
|
591
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
592
|
+
*/
|
|
593
|
+
matchesKeyInQuery<U extends ParseObject, K extends keyof T['attributes'], X extends Extract<keyof U['attributes'], string>>(key: K, queryKey: X, query: ParseQuery<U>): this;
|
|
594
|
+
/**
|
|
595
|
+
* Adds a constraint that requires that a key's value not match a value in
|
|
596
|
+
* an object returned by a different Parse.Query.
|
|
597
|
+
*
|
|
598
|
+
* @param {string} key The key that contains the value that is being
|
|
599
|
+
* excluded.
|
|
600
|
+
* @param {string} queryKey The key in the objects returned by the query to
|
|
601
|
+
* match against.
|
|
602
|
+
* @param {Parse.Query} query The query to run.
|
|
603
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
604
|
+
*/
|
|
605
|
+
doesNotMatchKeyInQuery<U extends ParseObject, K extends keyof T['attributes'] | keyof BaseAttributes, X extends Extract<keyof U['attributes'], string>>(key: K, queryKey: X, query: ParseQuery<U>): this;
|
|
606
|
+
/**
|
|
607
|
+
* Adds a constraint for finding string values that contain a provided
|
|
608
|
+
* string. This may be slow for large datasets.
|
|
609
|
+
*
|
|
610
|
+
* @param {string} key The key that the string to match is stored in.
|
|
611
|
+
* @param {string} substring The substring that the value must contain.
|
|
612
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
613
|
+
*/
|
|
614
|
+
contains<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K, substring: string): this;
|
|
615
|
+
/**
|
|
616
|
+
* Adds a constraint for finding string values that contain a provided
|
|
617
|
+
* string. This may be slow for large datasets. Requires Parse-Server > 2.5.0
|
|
618
|
+
*
|
|
619
|
+
* In order to sort you must use select and ascending ($score is required)
|
|
620
|
+
* <pre>
|
|
621
|
+
* query.fullText('field', 'term');
|
|
622
|
+
* query.ascending('$score');
|
|
623
|
+
* query.select('$score');
|
|
624
|
+
* </pre>
|
|
625
|
+
*
|
|
626
|
+
* To retrieve the weight / rank
|
|
627
|
+
* <pre>
|
|
628
|
+
* object->get('score');
|
|
629
|
+
* </pre>
|
|
630
|
+
*
|
|
631
|
+
* You can define optionals by providing an object as a third parameter
|
|
632
|
+
* <pre>
|
|
633
|
+
* query.fullText('field', 'term', { language: 'es', diacriticSensitive: true });
|
|
634
|
+
* </pre>
|
|
635
|
+
*
|
|
636
|
+
* @param {string} key The key that the string to match is stored in.
|
|
637
|
+
* @param {string} value The string to search
|
|
638
|
+
* @param {object} options (Optional)
|
|
639
|
+
* @param {string} options.language The language that determines the list of stop words for the search and the rules for the stemmer and tokenizer.
|
|
640
|
+
* @param {boolean} options.caseSensitive A boolean flag to enable or disable case sensitive search.
|
|
641
|
+
* @param {boolean} options.diacriticSensitive A boolean flag to enable or disable diacritic sensitive search.
|
|
642
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
643
|
+
*/
|
|
644
|
+
fullText<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K, value: string, options?: FullTextQueryOptions): this;
|
|
645
|
+
/**
|
|
646
|
+
* Method to sort the full text search by text score
|
|
647
|
+
*
|
|
648
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
649
|
+
*/
|
|
650
|
+
sortByTextScore(): this;
|
|
651
|
+
/**
|
|
652
|
+
* Adds a constraint for finding string values that start with a provided
|
|
653
|
+
* string. This query will use the backend index, so it will be fast even
|
|
654
|
+
* for large datasets.
|
|
655
|
+
*
|
|
656
|
+
* @param {string} key The key that the string to match is stored in.
|
|
657
|
+
* @param {string} prefix The substring that the value must start with.
|
|
658
|
+
* @param {string} modifiers The regular expression mode.
|
|
659
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
660
|
+
*/
|
|
661
|
+
startsWith<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K, prefix: string, modifiers?: string): this;
|
|
662
|
+
/**
|
|
663
|
+
* Adds a constraint for finding string values that end with a provided
|
|
664
|
+
* string. This will be slow for large datasets.
|
|
665
|
+
*
|
|
666
|
+
* @param {string} key The key that the string to match is stored in.
|
|
667
|
+
* @param {string} suffix The substring that the value must end with.
|
|
668
|
+
* @param {string} modifiers The regular expression mode.
|
|
669
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
670
|
+
*/
|
|
671
|
+
endsWith<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K, suffix: string, modifiers?: string): this;
|
|
672
|
+
/**
|
|
673
|
+
* Adds a proximity based constraint for finding objects with key point
|
|
674
|
+
* values near the point given.
|
|
675
|
+
*
|
|
676
|
+
* @param {string} key The key that the Parse.GeoPoint is stored in.
|
|
677
|
+
* @param {Parse.GeoPoint} point The reference Parse.GeoPoint that is used.
|
|
678
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
679
|
+
*/
|
|
680
|
+
near<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K, point: ParseGeoPoint): this;
|
|
681
|
+
/**
|
|
682
|
+
* Adds a proximity based constraint for finding objects with key point
|
|
683
|
+
* values near the point given and within the maximum distance given.
|
|
684
|
+
*
|
|
685
|
+
* @param {string} key The key that the Parse.GeoPoint is stored in.
|
|
686
|
+
* @param {Parse.GeoPoint} point The reference Parse.GeoPoint that is used.
|
|
687
|
+
* @param {number} maxDistance Maximum distance (in radians) of results to return.
|
|
688
|
+
* @param {boolean} sorted A Bool value that is true if results should be
|
|
689
|
+
* sorted by distance ascending, false is no sorting is required,
|
|
690
|
+
* defaults to true.
|
|
691
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
692
|
+
*/
|
|
693
|
+
withinRadians<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K, point: ParseGeoPoint, maxDistance: number, sorted?: boolean): this;
|
|
694
|
+
/**
|
|
695
|
+
* Adds a proximity based constraint for finding objects with key point
|
|
696
|
+
* values near the point given and within the maximum distance given.
|
|
697
|
+
* Radius of earth used is 3958.8 miles.
|
|
698
|
+
*
|
|
699
|
+
* @param {string} key The key that the Parse.GeoPoint is stored in.
|
|
700
|
+
* @param {Parse.GeoPoint} point The reference Parse.GeoPoint that is used.
|
|
701
|
+
* @param {number} maxDistance Maximum distance (in miles) of results to return.
|
|
702
|
+
* @param {boolean} sorted A Bool value that is true if results should be
|
|
703
|
+
* sorted by distance ascending, false is no sorting is required,
|
|
704
|
+
* defaults to true.
|
|
705
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
706
|
+
*/
|
|
707
|
+
withinMiles<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K, point: ParseGeoPoint, maxDistance: number, sorted?: boolean): this;
|
|
708
|
+
/**
|
|
709
|
+
* Adds a proximity based constraint for finding objects with key point
|
|
710
|
+
* values near the point given and within the maximum distance given.
|
|
711
|
+
* Radius of earth used is 6371.0 kilometers.
|
|
712
|
+
*
|
|
713
|
+
* @param {string} key The key that the Parse.GeoPoint is stored in.
|
|
714
|
+
* @param {Parse.GeoPoint} point The reference Parse.GeoPoint that is used.
|
|
715
|
+
* @param {number} maxDistance Maximum distance (in kilometers) of results to return.
|
|
716
|
+
* @param {boolean} sorted A Bool value that is true if results should be
|
|
717
|
+
* sorted by distance ascending, false is no sorting is required,
|
|
718
|
+
* defaults to true.
|
|
719
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
720
|
+
*/
|
|
721
|
+
withinKilometers<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K, point: ParseGeoPoint, maxDistance: number, sorted?: boolean): this;
|
|
722
|
+
/**
|
|
723
|
+
* Adds a constraint to the query that requires a particular key's
|
|
724
|
+
* coordinates be contained within a given rectangular geographic bounding
|
|
725
|
+
* box.
|
|
726
|
+
*
|
|
727
|
+
* @param {string} key The key to be constrained.
|
|
728
|
+
* @param {Parse.GeoPoint} southwest
|
|
729
|
+
* The lower-left inclusive corner of the box.
|
|
730
|
+
* @param {Parse.GeoPoint} northeast
|
|
731
|
+
* The upper-right inclusive corner of the box.
|
|
732
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
733
|
+
*/
|
|
734
|
+
withinGeoBox<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K, southwest: ParseGeoPoint, northeast: ParseGeoPoint): this;
|
|
735
|
+
/**
|
|
736
|
+
* Adds a constraint to the query that requires a particular key's
|
|
737
|
+
* coordinates be contained within and on the bounds of a given polygon.
|
|
738
|
+
* Supports closed and open (last point is connected to first) paths
|
|
739
|
+
*
|
|
740
|
+
* Polygon must have at least 3 points
|
|
741
|
+
*
|
|
742
|
+
* @param {string} key The key to be constrained.
|
|
743
|
+
* @param {Array} points Array of Coordinates / GeoPoints
|
|
744
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
745
|
+
*/
|
|
746
|
+
withinPolygon<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K, points: number[][]): this;
|
|
747
|
+
/**
|
|
748
|
+
* Add a constraint to the query that requires a particular key's
|
|
749
|
+
* coordinates that contains a ParseGeoPoint
|
|
750
|
+
*
|
|
751
|
+
* @param {string} key The key to be constrained.
|
|
752
|
+
* @param {Parse.GeoPoint} point
|
|
753
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
754
|
+
*/
|
|
755
|
+
polygonContains<K extends keyof T['attributes'] | keyof BaseAttributes>(key: K, point: ParseGeoPoint): this;
|
|
756
|
+
/**
|
|
757
|
+
* Sorts the results in ascending order by the given key.
|
|
758
|
+
*
|
|
759
|
+
* @param {(string|string[])} keys The key to order by, which is a
|
|
760
|
+
* string of comma separated values, or an Array of keys, or multiple keys.
|
|
761
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
762
|
+
*/
|
|
763
|
+
ascending(...keys: Array<string>): this;
|
|
764
|
+
/**
|
|
765
|
+
* Sorts the results in ascending order by the given key,
|
|
766
|
+
* but can also add secondary sort descriptors without overwriting _order.
|
|
767
|
+
*
|
|
768
|
+
* @param {(string|string[])} keys The key to order by, which is a
|
|
769
|
+
* string of comma separated values, or an Array of keys, or multiple keys.
|
|
770
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
771
|
+
*/
|
|
772
|
+
addAscending(...keys: Array<string>): this;
|
|
773
|
+
/**
|
|
774
|
+
* Sorts the results in descending order by the given key.
|
|
775
|
+
*
|
|
776
|
+
* @param {(string|string[])} keys The key to order by, which is a
|
|
777
|
+
* string of comma separated values, or an Array of keys, or multiple keys.
|
|
778
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
779
|
+
*/
|
|
780
|
+
descending(...keys: Array<string>): this;
|
|
781
|
+
/**
|
|
782
|
+
* Sorts the results in descending order by the given key,
|
|
783
|
+
* but can also add secondary sort descriptors without overwriting _order.
|
|
784
|
+
*
|
|
785
|
+
* @param {(string|string[])} keys The key to order by, which is a
|
|
786
|
+
* string of comma separated values, or an Array of keys, or multiple keys.
|
|
787
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
788
|
+
*/
|
|
789
|
+
addDescending(...keys: Array<string>): this;
|
|
790
|
+
/**
|
|
791
|
+
* Sets the number of results to skip before returning any results.
|
|
792
|
+
* This is useful for pagination.
|
|
793
|
+
* Default is to skip zero results.
|
|
794
|
+
*
|
|
795
|
+
* @param {number} n the number of results to skip.
|
|
796
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
797
|
+
*/
|
|
798
|
+
skip(n: number): this;
|
|
799
|
+
/**
|
|
800
|
+
* Sets the limit of the number of results to return. The default limit is 100.
|
|
801
|
+
*
|
|
802
|
+
* @param {number} n the number of results to limit to.
|
|
803
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
804
|
+
*/
|
|
805
|
+
limit(n: number): this;
|
|
806
|
+
/**
|
|
807
|
+
* Sets the flag to include with response the total number of objects satisfying this query,
|
|
808
|
+
* despite limits/skip. Might be useful for pagination.
|
|
809
|
+
* Note that result of this query will be wrapped as an object with
|
|
810
|
+
* `results`: holding {ParseObject} array and `count`: integer holding total number
|
|
811
|
+
*
|
|
812
|
+
* @param {boolean} includeCount false - disable, true - enable.
|
|
813
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
814
|
+
*/
|
|
815
|
+
withCount(includeCount?: boolean): this;
|
|
816
|
+
/**
|
|
817
|
+
* Includes nested Parse.Objects for the provided key. You can use dot
|
|
818
|
+
* notation to specify which fields in the included object are also fetched.
|
|
819
|
+
*
|
|
820
|
+
* You can include all nested Parse.Objects by passing in '*'.
|
|
821
|
+
* Requires Parse Server 3.0.0+
|
|
822
|
+
* <pre>query.include('*');</pre>
|
|
823
|
+
*
|
|
824
|
+
* @param {...string|Array<string>} keys The name(s) of the key(s) to include.
|
|
825
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
826
|
+
*/
|
|
827
|
+
include<K extends keyof T['attributes'] | keyof BaseAttributes>(...keys: Array<K | Array<K>>): this;
|
|
828
|
+
/**
|
|
829
|
+
* Includes all nested Parse.Objects one level deep.
|
|
830
|
+
*
|
|
831
|
+
* Requires Parse Server 3.0.0+
|
|
832
|
+
*
|
|
833
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
834
|
+
*/
|
|
835
|
+
includeAll(): this;
|
|
836
|
+
/**
|
|
837
|
+
* Restricts the fields of the returned Parse.Objects to include only the
|
|
838
|
+
* provided keys. If this is called multiple times, then all of the keys
|
|
839
|
+
* specified in each of the calls will be included.
|
|
840
|
+
*
|
|
841
|
+
* @param {...string|Array<string>} keys The name(s) of the key(s) to include.
|
|
842
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
843
|
+
*/
|
|
844
|
+
select<K extends keyof T['attributes'] | keyof BaseAttributes>(...keys: Array<K | Array<K>>): this;
|
|
845
|
+
/**
|
|
846
|
+
* Restricts the fields of the returned Parse.Objects to all keys except the
|
|
847
|
+
* provided keys. Exclude takes precedence over select and include.
|
|
848
|
+
*
|
|
849
|
+
* Requires Parse Server 3.6.0+
|
|
850
|
+
*
|
|
851
|
+
* @param {...string|Array<string>} keys The name(s) of the key(s) to exclude.
|
|
852
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
853
|
+
*/
|
|
854
|
+
exclude<K extends keyof T['attributes'] | keyof BaseAttributes>(...keys: Array<K | Array<K>>): this;
|
|
855
|
+
/**
|
|
856
|
+
* Restricts live query to trigger only for watched fields.
|
|
857
|
+
*
|
|
858
|
+
* Requires Parse Server 6.0.0+
|
|
859
|
+
*
|
|
860
|
+
* @param {...string|Array<string>} keys The name(s) of the key(s) to watch.
|
|
861
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
862
|
+
*/
|
|
863
|
+
watch<K extends keyof T['attributes'] | keyof BaseAttributes>(...keys: Array<K | Array<K>>): this;
|
|
864
|
+
/**
|
|
865
|
+
* Changes the read preference that the backend will use when performing the query to the database.
|
|
866
|
+
*
|
|
867
|
+
* @param {string} readPreference The read preference for the main query.
|
|
868
|
+
* @param {string} includeReadPreference The read preference for the queries to include pointers.
|
|
869
|
+
* @param {string} subqueryReadPreference The read preference for the sub queries.
|
|
870
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
871
|
+
*/
|
|
872
|
+
readPreference(readPreference: string, includeReadPreference?: string, subqueryReadPreference?: string): this;
|
|
873
|
+
/**
|
|
874
|
+
* Subscribe this query to get liveQuery updates
|
|
875
|
+
*
|
|
876
|
+
* @param {string} sessionToken (optional) Defaults to the currentUser
|
|
877
|
+
* @returns {Promise<LiveQuerySubscription>} Returns the liveQuerySubscription, it's an event emitter
|
|
878
|
+
* which can be used to get liveQuery updates.
|
|
879
|
+
*/
|
|
880
|
+
subscribe(sessionToken?: string | null): Promise<LiveQuerySubscription>;
|
|
881
|
+
/**
|
|
882
|
+
* Constructs a Parse.Query that is the OR of the passed in queries. For
|
|
883
|
+
* example:
|
|
884
|
+
* <pre>var compoundQuery = Parse.Query.or(query1, query2, query3);</pre>
|
|
885
|
+
*
|
|
886
|
+
* will create a compoundQuery that is an or of the query1, query2, and
|
|
887
|
+
* query3.
|
|
888
|
+
*
|
|
889
|
+
* @param {...Parse.Query} queries The list of queries to OR.
|
|
890
|
+
* @static
|
|
891
|
+
* @returns {Parse.Query} The query that is the OR of the passed in queries.
|
|
892
|
+
*/
|
|
893
|
+
static or(...queries: Array<ParseQuery>): ParseQuery;
|
|
894
|
+
/**
|
|
895
|
+
* Constructs a Parse.Query that is the AND of the passed in queries. For
|
|
896
|
+
* example:
|
|
897
|
+
* <pre>var compoundQuery = Parse.Query.and(query1, query2, query3);</pre>
|
|
898
|
+
*
|
|
899
|
+
* will create a compoundQuery that is an and of the query1, query2, and
|
|
900
|
+
* query3.
|
|
901
|
+
*
|
|
902
|
+
* @param {...Parse.Query} queries The list of queries to AND.
|
|
903
|
+
* @static
|
|
904
|
+
* @returns {Parse.Query} The query that is the AND of the passed in queries.
|
|
905
|
+
*/
|
|
906
|
+
static and(...queries: Array<ParseQuery>): ParseQuery;
|
|
907
|
+
/**
|
|
908
|
+
* Constructs a Parse.Query that is the NOR of the passed in queries. For
|
|
909
|
+
* example:
|
|
910
|
+
* <pre>const compoundQuery = Parse.Query.nor(query1, query2, query3);</pre>
|
|
911
|
+
*
|
|
912
|
+
* will create a compoundQuery that is a nor of the query1, query2, and
|
|
913
|
+
* query3.
|
|
914
|
+
*
|
|
915
|
+
* @param {...Parse.Query} queries The list of queries to NOR.
|
|
916
|
+
* @static
|
|
917
|
+
* @returns {Parse.Query} The query that is the NOR of the passed in queries.
|
|
918
|
+
*/
|
|
919
|
+
static nor(...queries: Array<ParseQuery>): ParseQuery;
|
|
920
|
+
/**
|
|
921
|
+
* Change the source of this query to the server.
|
|
922
|
+
*
|
|
923
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
924
|
+
*/
|
|
925
|
+
fromNetwork(): this;
|
|
926
|
+
/**
|
|
927
|
+
* Changes the source of this query to all pinned objects.
|
|
928
|
+
*
|
|
929
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
930
|
+
*/
|
|
931
|
+
fromLocalDatastore(): this;
|
|
932
|
+
/**
|
|
933
|
+
* Changes the source of this query to the default group of pinned objects.
|
|
934
|
+
*
|
|
935
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
936
|
+
*/
|
|
937
|
+
fromPin(): this;
|
|
938
|
+
/**
|
|
939
|
+
* Changes the source of this query to a specific group of pinned objects.
|
|
940
|
+
*
|
|
941
|
+
* @param {string} name The name of query source.
|
|
942
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
943
|
+
*/
|
|
944
|
+
fromPinWithName(name?: string | null): this;
|
|
945
|
+
/**
|
|
946
|
+
* Cancels the current network request (if any is running).
|
|
947
|
+
*
|
|
948
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
949
|
+
*/
|
|
950
|
+
cancel(): this;
|
|
951
|
+
_setRequestTask(options: any): void;
|
|
952
|
+
/**
|
|
953
|
+
* Sets a comment to the query so that the query
|
|
954
|
+
* can be identified when using a the profiler for MongoDB.
|
|
955
|
+
*
|
|
956
|
+
* @param {string} value a comment can make your profile data easier to interpret and trace.
|
|
957
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
958
|
+
*/
|
|
959
|
+
comment(value: string): this;
|
|
960
|
+
}
|
|
961
|
+
export default ParseQuery;
|