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,1072 @@
|
|
|
1
|
+
import ParseACL from './ParseACL';
|
|
2
|
+
import ParseError from './ParseError';
|
|
3
|
+
import ParseFile from './ParseFile';
|
|
4
|
+
import { Op } from './ParseOp';
|
|
5
|
+
import ParseRelation from './ParseRelation';
|
|
6
|
+
import type { AttributeMap, OpsMap } from './ObjectStateMutations';
|
|
7
|
+
import type { RequestOptions, FullOptions } from './RESTController';
|
|
8
|
+
import type ParseGeoPoint from './ParseGeoPoint';
|
|
9
|
+
import type ParsePolygon from './ParsePolygon';
|
|
10
|
+
export type Pointer = {
|
|
11
|
+
__type: string;
|
|
12
|
+
className: string;
|
|
13
|
+
objectId?: string;
|
|
14
|
+
_localId?: string;
|
|
15
|
+
};
|
|
16
|
+
type SaveParams = {
|
|
17
|
+
method: string;
|
|
18
|
+
path: string;
|
|
19
|
+
body: AttributeMap;
|
|
20
|
+
};
|
|
21
|
+
export type SaveOptions = FullOptions & {
|
|
22
|
+
cascadeSave?: boolean;
|
|
23
|
+
context?: AttributeMap;
|
|
24
|
+
batchSize?: number;
|
|
25
|
+
transaction?: boolean;
|
|
26
|
+
};
|
|
27
|
+
type FetchOptions = {
|
|
28
|
+
useMasterKey?: boolean;
|
|
29
|
+
sessionToken?: string;
|
|
30
|
+
include?: string | string[];
|
|
31
|
+
context?: AttributeMap;
|
|
32
|
+
};
|
|
33
|
+
export type SetOptions = {
|
|
34
|
+
ignoreValidation?: boolean;
|
|
35
|
+
unset?: boolean;
|
|
36
|
+
};
|
|
37
|
+
export type AttributeKey<T> = Extract<keyof T, string>;
|
|
38
|
+
export interface Attributes {
|
|
39
|
+
[key: string]: any;
|
|
40
|
+
}
|
|
41
|
+
interface JSONBaseAttributes {
|
|
42
|
+
objectId: string;
|
|
43
|
+
createdAt: string;
|
|
44
|
+
updatedAt: string;
|
|
45
|
+
}
|
|
46
|
+
interface CommonAttributes {
|
|
47
|
+
ACL: ParseACL;
|
|
48
|
+
}
|
|
49
|
+
type AtomicKey<T> = {
|
|
50
|
+
[K in keyof T]: NonNullable<T[K]> extends any[] ? K : never;
|
|
51
|
+
};
|
|
52
|
+
type Encode<T> = T extends ParseObject ? ReturnType<T['toJSON']> | Pointer : T extends ParseACL | ParseGeoPoint | ParsePolygon | ParseRelation | ParseFile ? ReturnType<T['toJSON']> : T extends Date ? {
|
|
53
|
+
__type: 'Date';
|
|
54
|
+
iso: string;
|
|
55
|
+
} : T extends RegExp ? string : T extends Array<infer R> ? Array<Encode<R>> : T extends object ? ToJSON<T> : T;
|
|
56
|
+
type ToJSON<T> = {
|
|
57
|
+
[K in keyof T]: Encode<T[K]>;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Creates a new model with defined attributes.
|
|
61
|
+
*
|
|
62
|
+
* <p>You won't normally call this method directly. It is recommended that
|
|
63
|
+
* you use a subclass of <code>Parse.Object</code> instead, created by calling
|
|
64
|
+
* <code>extend</code>.</p>
|
|
65
|
+
*
|
|
66
|
+
* <p>However, if you don't want to use a subclass, or aren't sure which
|
|
67
|
+
* subclass is appropriate, you can use this form:<pre>
|
|
68
|
+
* var object = new Parse.Object("ClassName");
|
|
69
|
+
* </pre>
|
|
70
|
+
* That is basically equivalent to:<pre>
|
|
71
|
+
* var MyClass = Parse.Object.extend("ClassName");
|
|
72
|
+
* var object = new MyClass();
|
|
73
|
+
* </pre></p>
|
|
74
|
+
*
|
|
75
|
+
* @alias Parse.Object
|
|
76
|
+
*/
|
|
77
|
+
declare class ParseObject<T extends Attributes = Attributes> {
|
|
78
|
+
/**
|
|
79
|
+
* @param {string} className The class name for the object
|
|
80
|
+
* @param {object} attributes The initial set of data to store in the object.
|
|
81
|
+
* @param {object} options The options for this object instance.
|
|
82
|
+
* @param {boolean} [options.ignoreValidation] Set to `true` ignore any attribute validation errors.
|
|
83
|
+
*/
|
|
84
|
+
constructor(className?: string | {
|
|
85
|
+
className: string;
|
|
86
|
+
[attr: string]: any;
|
|
87
|
+
}, attributes?: T, options?: SetOptions);
|
|
88
|
+
/**
|
|
89
|
+
* The ID of this object, unique within its class.
|
|
90
|
+
*
|
|
91
|
+
* @property {string} id
|
|
92
|
+
*/
|
|
93
|
+
id?: string;
|
|
94
|
+
_localId?: string;
|
|
95
|
+
_objCount: number;
|
|
96
|
+
className: string;
|
|
97
|
+
get attributes(): T;
|
|
98
|
+
/**
|
|
99
|
+
* The first time this object was saved on the server.
|
|
100
|
+
*
|
|
101
|
+
* @property {Date} createdAt
|
|
102
|
+
* @returns {Date}
|
|
103
|
+
*/
|
|
104
|
+
get createdAt(): Date | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* The last time this object was updated on the server.
|
|
107
|
+
*
|
|
108
|
+
* @property {Date} updatedAt
|
|
109
|
+
* @returns {Date}
|
|
110
|
+
*/
|
|
111
|
+
get updatedAt(): Date | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Returns a local or server Id used uniquely identify this object
|
|
114
|
+
*
|
|
115
|
+
* @returns {string}
|
|
116
|
+
*/
|
|
117
|
+
_getId(): string;
|
|
118
|
+
/**
|
|
119
|
+
* Returns a unique identifier used to pull data from the State Controller.
|
|
120
|
+
*
|
|
121
|
+
* @returns {Parse.Object|object}
|
|
122
|
+
*/
|
|
123
|
+
_getStateIdentifier(): ParseObject | {
|
|
124
|
+
id: string;
|
|
125
|
+
className: string;
|
|
126
|
+
};
|
|
127
|
+
_getServerData(): Attributes;
|
|
128
|
+
_clearServerData(): void;
|
|
129
|
+
_getPendingOps(): Array<OpsMap>;
|
|
130
|
+
/**
|
|
131
|
+
* @param {Array<string>} [keysToClear] - if specified, only ops matching
|
|
132
|
+
* these fields will be cleared
|
|
133
|
+
*/
|
|
134
|
+
_clearPendingOps(keysToClear?: Array<string>): void;
|
|
135
|
+
_getDirtyObjectAttributes(): Attributes;
|
|
136
|
+
_toFullJSON(seen?: Array<any>, offline?: boolean): Attributes;
|
|
137
|
+
_getSaveJSON(): Attributes;
|
|
138
|
+
_getSaveParams(): SaveParams;
|
|
139
|
+
_finishFetch(serverData: Attributes): void;
|
|
140
|
+
_setExisted(existed: boolean): void;
|
|
141
|
+
_migrateId(serverId: string): void;
|
|
142
|
+
_handleSaveResponse(response: Attributes, status: number): void;
|
|
143
|
+
_handleSaveError(): void;
|
|
144
|
+
static _getClassMap(): AttributeMap;
|
|
145
|
+
static _getRequestOptions(options?: RequestOptions & FullOptions & {
|
|
146
|
+
json?: boolean;
|
|
147
|
+
}): RequestOptions & FullOptions & {
|
|
148
|
+
json?: boolean;
|
|
149
|
+
};
|
|
150
|
+
initialize(): void;
|
|
151
|
+
/**
|
|
152
|
+
* Returns a JSON version of the object suitable for saving to Parse.
|
|
153
|
+
*
|
|
154
|
+
* @param seen
|
|
155
|
+
* @param offline
|
|
156
|
+
* @returns {object}
|
|
157
|
+
*/
|
|
158
|
+
toJSON(seen: Array<any> | void, offline?: boolean): ToJSON<T> & JSONBaseAttributes;
|
|
159
|
+
/**
|
|
160
|
+
* Determines whether this ParseObject is equal to another ParseObject
|
|
161
|
+
*
|
|
162
|
+
* @param {object} other - An other object ot compare
|
|
163
|
+
* @returns {boolean}
|
|
164
|
+
*/
|
|
165
|
+
equals<T extends ParseObject>(other: T): boolean;
|
|
166
|
+
/**
|
|
167
|
+
* Returns true if this object has been modified since its last
|
|
168
|
+
* save/refresh. If an attribute is specified, it returns true only if that
|
|
169
|
+
* particular attribute has been modified since the last save/refresh.
|
|
170
|
+
*
|
|
171
|
+
* @param {string} attr An attribute name (optional).
|
|
172
|
+
* @returns {boolean}
|
|
173
|
+
*/
|
|
174
|
+
dirty<K extends AttributeKey<T>>(attr?: K): boolean;
|
|
175
|
+
/**
|
|
176
|
+
* Returns an array of keys that have been modified since last save/refresh
|
|
177
|
+
*
|
|
178
|
+
* @returns {string[]}
|
|
179
|
+
*/
|
|
180
|
+
dirtyKeys(): string[];
|
|
181
|
+
/**
|
|
182
|
+
* Returns true if the object has been fetched.
|
|
183
|
+
*
|
|
184
|
+
* @returns {boolean}
|
|
185
|
+
*/
|
|
186
|
+
isDataAvailable(): boolean;
|
|
187
|
+
/**
|
|
188
|
+
* Gets a Pointer referencing this Object.
|
|
189
|
+
*
|
|
190
|
+
* @returns {Pointer}
|
|
191
|
+
*/
|
|
192
|
+
toPointer(): Pointer;
|
|
193
|
+
/**
|
|
194
|
+
* Gets a Pointer referencing this Object.
|
|
195
|
+
*
|
|
196
|
+
* @returns {Pointer}
|
|
197
|
+
*/
|
|
198
|
+
toOfflinePointer(): Pointer;
|
|
199
|
+
/**
|
|
200
|
+
* Gets the value of an attribute.
|
|
201
|
+
*
|
|
202
|
+
* @param {string} attr The string name of an attribute.
|
|
203
|
+
* @returns {*}
|
|
204
|
+
*/
|
|
205
|
+
get<K extends AttributeKey<T>>(attr: K): T[K];
|
|
206
|
+
/**
|
|
207
|
+
* Gets a relation on the given class for the attribute.
|
|
208
|
+
*
|
|
209
|
+
* @param {string} attr The attribute to get the relation for.
|
|
210
|
+
* @returns {Parse.Relation}
|
|
211
|
+
*/
|
|
212
|
+
relation<R extends ParseObject, K extends AttributeKey<T> = AttributeKey<T>>(attr: T[K] extends ParseRelation ? K : never): ParseRelation<this, R>;
|
|
213
|
+
/**
|
|
214
|
+
* Gets the HTML-escaped value of an attribute.
|
|
215
|
+
*
|
|
216
|
+
* @param {string} attr The string name of an attribute.
|
|
217
|
+
* @returns {string}
|
|
218
|
+
*/
|
|
219
|
+
escape<K extends AttributeKey<T>>(attr: K): string;
|
|
220
|
+
/**
|
|
221
|
+
* Returns <code>true</code> if the attribute contains a value that is not
|
|
222
|
+
* null or undefined.
|
|
223
|
+
*
|
|
224
|
+
* @param {string} attr The string name of the attribute.
|
|
225
|
+
* @returns {boolean}
|
|
226
|
+
*/
|
|
227
|
+
has<K extends AttributeKey<T>>(attr: K): boolean;
|
|
228
|
+
/**
|
|
229
|
+
* Sets a hash of model attributes on the object.
|
|
230
|
+
*
|
|
231
|
+
* <p>You can call it with an object containing keys and values, with one
|
|
232
|
+
* key and value, or dot notation. For example:<pre>
|
|
233
|
+
* gameTurn.set({
|
|
234
|
+
* player: player1,
|
|
235
|
+
* diceRoll: 2
|
|
236
|
+
* }, {
|
|
237
|
+
* error: function(gameTurnAgain, error) {
|
|
238
|
+
* // The set failed validation.
|
|
239
|
+
* }
|
|
240
|
+
* });
|
|
241
|
+
*
|
|
242
|
+
* game.set("currentPlayer", player2, {
|
|
243
|
+
* error: function(gameTurnAgain, error) {
|
|
244
|
+
* // The set failed validation.
|
|
245
|
+
* }
|
|
246
|
+
* });
|
|
247
|
+
*
|
|
248
|
+
* game.set("finished", true);</pre></p>
|
|
249
|
+
*
|
|
250
|
+
* game.set("player.score", 10);</pre></p>
|
|
251
|
+
*
|
|
252
|
+
* @param {(string|object)} key The key to set.
|
|
253
|
+
* @param {(string|object)} value The value to give it.
|
|
254
|
+
* @param {object} options A set of options for the set.
|
|
255
|
+
* The only supported option is <code>error</code>.
|
|
256
|
+
* @returns {Parse.Object} Returns the object, so you can chain this call.
|
|
257
|
+
*/
|
|
258
|
+
set<K extends AttributeKey<T>>(key: K | (Pick<T, K> | T), value?: SetOptions | (T[K] extends undefined ? never : T[K]), options?: SetOptions): this;
|
|
259
|
+
/**
|
|
260
|
+
* Remove an attribute from the model. This is a noop if the attribute doesn't
|
|
261
|
+
* exist.
|
|
262
|
+
*
|
|
263
|
+
* @param {string} attr The string name of an attribute.
|
|
264
|
+
* @param options
|
|
265
|
+
* @returns {Parse.Object} Returns the object, so you can chain this call.
|
|
266
|
+
*/
|
|
267
|
+
unset<K extends AttributeKey<T>>(attr: K, options?: SetOptions): this;
|
|
268
|
+
/**
|
|
269
|
+
* Atomically increments the value of the given attribute the next time the
|
|
270
|
+
* object is saved. If no amount is specified, 1 is used by default.
|
|
271
|
+
*
|
|
272
|
+
* @param attr {String} The key.
|
|
273
|
+
* @param amount {Number} The amount to increment by (optional).
|
|
274
|
+
* @returns {Parse.Object} Returns the object, so you can chain this call.
|
|
275
|
+
*/
|
|
276
|
+
increment<K extends AttributeKey<T>>(attr: K, amount?: number): this;
|
|
277
|
+
/**
|
|
278
|
+
* Atomically decrements the value of the given attribute the next time the
|
|
279
|
+
* object is saved. If no amount is specified, 1 is used by default.
|
|
280
|
+
*
|
|
281
|
+
* @param attr {String} The key.
|
|
282
|
+
* @param amount {Number} The amount to decrement by (optional).
|
|
283
|
+
* @returns {Parse.Object} Returns the object, so you can chain this call.
|
|
284
|
+
*/
|
|
285
|
+
decrement<K extends AttributeKey<T>>(attr: K, amount?: number): this;
|
|
286
|
+
/**
|
|
287
|
+
* Atomically add an object to the end of the array associated with a given
|
|
288
|
+
* key.
|
|
289
|
+
*
|
|
290
|
+
* @param attr {String} The key.
|
|
291
|
+
* @param item {} The item to add.
|
|
292
|
+
* @returns {Parse.Object} Returns the object, so you can chain this call.
|
|
293
|
+
*/
|
|
294
|
+
add<K extends AtomicKey<T>[keyof T]>(attr: K, item: NonNullable<T[K]>[number]): this;
|
|
295
|
+
/**
|
|
296
|
+
* Atomically add the objects to the end of the array associated with a given
|
|
297
|
+
* key.
|
|
298
|
+
*
|
|
299
|
+
* @param attr {String} The key.
|
|
300
|
+
* @param items {Object[]} The items to add.
|
|
301
|
+
* @returns {Parse.Object} Returns the object, so you can chain this call.
|
|
302
|
+
*/
|
|
303
|
+
addAll<K extends AtomicKey<T>[keyof T]>(attr: K, items: NonNullable<T[K]>): this;
|
|
304
|
+
/**
|
|
305
|
+
* Atomically add an object to the array associated with a given key, only
|
|
306
|
+
* if it is not already present in the array. The position of the insert is
|
|
307
|
+
* not guaranteed.
|
|
308
|
+
*
|
|
309
|
+
* @param attr {String} The key.
|
|
310
|
+
* @param item {} The object to add.
|
|
311
|
+
* @returns {Parse.Object} Returns the object, so you can chain this call.
|
|
312
|
+
*/
|
|
313
|
+
addUnique<K extends AtomicKey<T>[keyof T]>(attr: K, item: NonNullable<T[K]>[number]): this;
|
|
314
|
+
/**
|
|
315
|
+
* Atomically add the objects to the array associated with a given key, only
|
|
316
|
+
* if it is not already present in the array. The position of the insert is
|
|
317
|
+
* not guaranteed.
|
|
318
|
+
*
|
|
319
|
+
* @param attr {String} The key.
|
|
320
|
+
* @param items {Object[]} The objects to add.
|
|
321
|
+
* @returns {Parse.Object} Returns the object, so you can chain this call.
|
|
322
|
+
*/
|
|
323
|
+
addAllUnique<K extends AtomicKey<T>[keyof T]>(attr: K, items: NonNullable<T[K]>): this;
|
|
324
|
+
/**
|
|
325
|
+
* Atomically remove all instances of an object from the array associated
|
|
326
|
+
* with a given key.
|
|
327
|
+
*
|
|
328
|
+
* @param attr {String} The key.
|
|
329
|
+
* @param item {} The object to remove.
|
|
330
|
+
* @returns {Parse.Object} Returns the object, so you can chain this call.
|
|
331
|
+
*/
|
|
332
|
+
remove<K extends AtomicKey<T>[keyof T]>(attr: K, item: NonNullable<T[K]>[number]): this;
|
|
333
|
+
/**
|
|
334
|
+
* Atomically remove all instances of the objects from the array associated
|
|
335
|
+
* with a given key.
|
|
336
|
+
*
|
|
337
|
+
* @param attr {String} The key.
|
|
338
|
+
* @param items {Object[]} The object to remove.
|
|
339
|
+
* @returns {Parse.Object} Returns the object, so you can chain this call.
|
|
340
|
+
*/
|
|
341
|
+
removeAll<K extends AtomicKey<T>[keyof T]>(attr: K, items: NonNullable<T[K]>): this;
|
|
342
|
+
/**
|
|
343
|
+
* Returns an instance of a subclass of Parse.Op describing what kind of
|
|
344
|
+
* modification has been performed on this field since the last time it was
|
|
345
|
+
* saved. For example, after calling object.increment("x"), calling
|
|
346
|
+
* object.op("x") would return an instance of Parse.Op.Increment.
|
|
347
|
+
*
|
|
348
|
+
* @param attr {String} The key.
|
|
349
|
+
* @returns {Parse.Op | undefined} The operation, or undefined if none.
|
|
350
|
+
*/
|
|
351
|
+
op<K extends AttributeKey<T>>(attr: K): Op | undefined;
|
|
352
|
+
/**
|
|
353
|
+
* Creates a new model with identical attributes to this one.
|
|
354
|
+
*
|
|
355
|
+
* @returns {Parse.Object}
|
|
356
|
+
*/
|
|
357
|
+
clone(): any;
|
|
358
|
+
/**
|
|
359
|
+
* Creates a new instance of this object. Not to be confused with clone()
|
|
360
|
+
*
|
|
361
|
+
* @returns {Parse.Object}
|
|
362
|
+
*/
|
|
363
|
+
newInstance(): this;
|
|
364
|
+
/**
|
|
365
|
+
* Returns true if this object has never been saved to Parse.
|
|
366
|
+
*
|
|
367
|
+
* @returns {boolean}
|
|
368
|
+
*/
|
|
369
|
+
isNew(): boolean;
|
|
370
|
+
/**
|
|
371
|
+
* Returns true if this object was created by the Parse server when the
|
|
372
|
+
* object might have already been there (e.g. in the case of a Facebook
|
|
373
|
+
* login)
|
|
374
|
+
*
|
|
375
|
+
* @returns {boolean}
|
|
376
|
+
*/
|
|
377
|
+
existed(): boolean;
|
|
378
|
+
/**
|
|
379
|
+
* Returns true if this object exists on the Server
|
|
380
|
+
*
|
|
381
|
+
* @param {object} options
|
|
382
|
+
* Valid options are:<ul>
|
|
383
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
384
|
+
* be used for this request.
|
|
385
|
+
* <li>sessionToken: A valid session token, used for making a request on
|
|
386
|
+
* behalf of a specific user.
|
|
387
|
+
* </ul>
|
|
388
|
+
* @returns {Promise<boolean>} A boolean promise that is fulfilled if object exists.
|
|
389
|
+
*/
|
|
390
|
+
exists(options?: RequestOptions): Promise<boolean>;
|
|
391
|
+
/**
|
|
392
|
+
* Checks if the model is currently in a valid state.
|
|
393
|
+
*
|
|
394
|
+
* @returns {boolean}
|
|
395
|
+
*/
|
|
396
|
+
isValid(): boolean;
|
|
397
|
+
/**
|
|
398
|
+
* You should not call this function directly unless you subclass
|
|
399
|
+
* <code>Parse.Object</code>, in which case you can override this method
|
|
400
|
+
* to provide additional validation on <code>set</code> and
|
|
401
|
+
* <code>save</code>. Your implementation should return
|
|
402
|
+
*
|
|
403
|
+
* @param {object} attrs The current data to validate.
|
|
404
|
+
* @returns {Parse.Error|boolean} False if the data is valid. An error object otherwise.
|
|
405
|
+
* @see Parse.Object#set
|
|
406
|
+
*/
|
|
407
|
+
validate(attrs: Attributes): ParseError | boolean;
|
|
408
|
+
/**
|
|
409
|
+
* Returns the ACL for this object.
|
|
410
|
+
*
|
|
411
|
+
* @returns {Parse.ACL|null} An instance of Parse.ACL.
|
|
412
|
+
* @see Parse.Object#get
|
|
413
|
+
*/
|
|
414
|
+
getACL(): ParseACL | null;
|
|
415
|
+
/**
|
|
416
|
+
* Sets the ACL to be used for this object.
|
|
417
|
+
*
|
|
418
|
+
* @param {Parse.ACL} acl An instance of Parse.ACL.
|
|
419
|
+
* @param {object} options
|
|
420
|
+
* @returns {Parse.Object} Returns the object, so you can chain this call.
|
|
421
|
+
* @see Parse.Object#set
|
|
422
|
+
*/
|
|
423
|
+
setACL(acl: ParseACL, options?: any): this;
|
|
424
|
+
/**
|
|
425
|
+
* Clears any (or specific) changes to this object made since the last call to save()
|
|
426
|
+
*
|
|
427
|
+
* @param {string} [keys] - specify which fields to revert
|
|
428
|
+
*/
|
|
429
|
+
revert(...keys: Array<Extract<keyof (T & CommonAttributes), string>>): void;
|
|
430
|
+
/**
|
|
431
|
+
* Clears all attributes on a model
|
|
432
|
+
*
|
|
433
|
+
* @returns {Parse.Object} Returns the object, so you can chain this call.
|
|
434
|
+
*/
|
|
435
|
+
clear(): this;
|
|
436
|
+
/**
|
|
437
|
+
* Fetch the model from the server. If the server's representation of the
|
|
438
|
+
* model differs from its current attributes, they will be overriden.
|
|
439
|
+
*
|
|
440
|
+
* @param {object} options
|
|
441
|
+
* Valid options are:<ul>
|
|
442
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
443
|
+
* be used for this request.
|
|
444
|
+
* <li>sessionToken: A valid session token, used for making a request on
|
|
445
|
+
* behalf of a specific user.
|
|
446
|
+
* <li>include: The name(s) of the key(s) to include. Can be a string, an array of strings,
|
|
447
|
+
* or an array of array of strings.
|
|
448
|
+
* <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
|
|
449
|
+
* </ul>
|
|
450
|
+
* @returns {Promise} A promise that is fulfilled when the fetch
|
|
451
|
+
* completes.
|
|
452
|
+
*/
|
|
453
|
+
fetch(options: FetchOptions): Promise<this>;
|
|
454
|
+
/**
|
|
455
|
+
* Fetch the model from the server. If the server's representation of the
|
|
456
|
+
* model differs from its current attributes, they will be overriden.
|
|
457
|
+
*
|
|
458
|
+
* Includes nested Parse.Objects for the provided key. You can use dot
|
|
459
|
+
* notation to specify which fields in the included object are also fetched.
|
|
460
|
+
*
|
|
461
|
+
* @param {string | Array<string | Array<string>>} keys The name(s) of the key(s) to include.
|
|
462
|
+
* @param {object} options
|
|
463
|
+
* Valid options are:<ul>
|
|
464
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
465
|
+
* be used for this request.
|
|
466
|
+
* <li>sessionToken: A valid session token, used for making a request on
|
|
467
|
+
* behalf of a specific user.
|
|
468
|
+
* </ul>
|
|
469
|
+
* @returns {Promise} A promise that is fulfilled when the fetch
|
|
470
|
+
* completes.
|
|
471
|
+
*/
|
|
472
|
+
fetchWithInclude(keys: string | Array<string | Array<string>>, options?: RequestOptions): Promise<this>;
|
|
473
|
+
/**
|
|
474
|
+
* Saves this object to the server at some unspecified time in the future,
|
|
475
|
+
* even if Parse is currently inaccessible.
|
|
476
|
+
*
|
|
477
|
+
* Use this when you may not have a solid network connection, and don't need to know when the save completes.
|
|
478
|
+
* If there is some problem with the object such that it can't be saved, it will be silently discarded.
|
|
479
|
+
*
|
|
480
|
+
* Objects saved with this method will be stored locally in an on-disk cache until they can be delivered to Parse.
|
|
481
|
+
* They will be sent immediately if possible. Otherwise, they will be sent the next time a network connection is
|
|
482
|
+
* available. Objects saved this way will persist even after the app is closed, in which case they will be sent the
|
|
483
|
+
* next time the app is opened.
|
|
484
|
+
*
|
|
485
|
+
* @param {object} [options]
|
|
486
|
+
* Used to pass option parameters to method if arg1 and arg2 were both passed as strings.
|
|
487
|
+
* Valid options are:
|
|
488
|
+
* <ul>
|
|
489
|
+
* <li>sessionToken: A valid session token, used for making a request on
|
|
490
|
+
* behalf of a specific user.
|
|
491
|
+
* <li>cascadeSave: If `false`, nested objects will not be saved (default is `true`).
|
|
492
|
+
* <li>context: A dictionary that is accessible in Cloud Code `beforeSave` and `afterSave` triggers.
|
|
493
|
+
* </ul>
|
|
494
|
+
* @returns {Promise} A promise that is fulfilled when the save
|
|
495
|
+
* completes.
|
|
496
|
+
*/
|
|
497
|
+
saveEventually(options?: SaveOptions): Promise<this>;
|
|
498
|
+
/**
|
|
499
|
+
* Set a hash of model attributes, and save the model to the server.
|
|
500
|
+
* updatedAt will be updated when the request returns.
|
|
501
|
+
* You can either call it as:<pre>
|
|
502
|
+
* object.save();</pre>
|
|
503
|
+
* or<pre>
|
|
504
|
+
* object.save(attrs);</pre>
|
|
505
|
+
* or<pre>
|
|
506
|
+
* object.save(null, options);</pre>
|
|
507
|
+
* or<pre>
|
|
508
|
+
* object.save(attrs, options);</pre>
|
|
509
|
+
* or<pre>
|
|
510
|
+
* object.save(key, value);</pre>
|
|
511
|
+
* or<pre>
|
|
512
|
+
* object.save(key, value, options);</pre>
|
|
513
|
+
*
|
|
514
|
+
* Example 1: <pre>
|
|
515
|
+
* gameTurn.save({
|
|
516
|
+
* player: "Jake Cutter",
|
|
517
|
+
* diceRoll: 2
|
|
518
|
+
* }).then(function(gameTurnAgain) {
|
|
519
|
+
* // The save was successful.
|
|
520
|
+
* }, function(error) {
|
|
521
|
+
* // The save failed. Error is an instance of Parse.Error.
|
|
522
|
+
* });</pre>
|
|
523
|
+
*
|
|
524
|
+
* Example 2: <pre>
|
|
525
|
+
* gameTurn.save("player", "Jake Cutter");</pre>
|
|
526
|
+
*
|
|
527
|
+
* @param {string | object | null} [arg1]
|
|
528
|
+
* Valid options are:<ul>
|
|
529
|
+
* <li>`Object` - Key/value pairs to update on the object.</li>
|
|
530
|
+
* <li>`String` Key - Key of attribute to update (requires arg2 to also be string)</li>
|
|
531
|
+
* <li>`null` - Passing null for arg1 allows you to save the object with options passed in arg2.</li>
|
|
532
|
+
* </ul>
|
|
533
|
+
* @param {string | object} [arg2]
|
|
534
|
+
* <ul>
|
|
535
|
+
* <li>`String` Value - If arg1 was passed as a key, arg2 is the value that should be set on that key.</li>
|
|
536
|
+
* <li>`Object` Options - Valid options are:
|
|
537
|
+
* <ul>
|
|
538
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
539
|
+
* be used for this request.
|
|
540
|
+
* <li>sessionToken: A valid session token, used for making a request on
|
|
541
|
+
* behalf of a specific user.
|
|
542
|
+
* <li>cascadeSave: If `false`, nested objects will not be saved (default is `true`).
|
|
543
|
+
* <li>context: A dictionary that is accessible in Cloud Code `beforeSave` and `afterSave` triggers.
|
|
544
|
+
* </ul>
|
|
545
|
+
* </li>
|
|
546
|
+
* </ul>
|
|
547
|
+
* @param {object} [arg3]
|
|
548
|
+
* Used to pass option parameters to method if arg1 and arg2 were both passed as strings.
|
|
549
|
+
* Valid options are:
|
|
550
|
+
* <ul>
|
|
551
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
552
|
+
* be used for this request.
|
|
553
|
+
* <li>sessionToken: A valid session token, used for making a request on
|
|
554
|
+
* behalf of a specific user.
|
|
555
|
+
* <li>cascadeSave: If `false`, nested objects will not be saved (default is `true`).
|
|
556
|
+
* <li>context: A dictionary that is accessible in Cloud Code `beforeSave` and `afterSave` triggers.
|
|
557
|
+
* </ul>
|
|
558
|
+
* @returns {Promise} A promise that is fulfilled when the save
|
|
559
|
+
* completes.
|
|
560
|
+
*/
|
|
561
|
+
save<K extends AttributeKey<T>>(arg1?: Pick<T, K> | T | null, arg2?: SaveOptions): Promise<this>;
|
|
562
|
+
/**
|
|
563
|
+
* Deletes this object from the server at some unspecified time in the future,
|
|
564
|
+
* even if Parse is currently inaccessible.
|
|
565
|
+
*
|
|
566
|
+
* Use this when you may not have a solid network connection,
|
|
567
|
+
* and don't need to know when the delete completes. If there is some problem with the object
|
|
568
|
+
* such that it can't be deleted, the request will be silently discarded.
|
|
569
|
+
*
|
|
570
|
+
* Delete instructions made with this method will be stored locally in an on-disk cache until they can be transmitted
|
|
571
|
+
* to Parse. They will be sent immediately if possible. Otherwise, they will be sent the next time a network connection
|
|
572
|
+
* is available. Delete requests will persist even after the app is closed, in which case they will be sent the
|
|
573
|
+
* next time the app is opened.
|
|
574
|
+
*
|
|
575
|
+
* @param {object} [options]
|
|
576
|
+
* Valid options are:<ul>
|
|
577
|
+
* <li>sessionToken: A valid session token, used for making a request on
|
|
578
|
+
* behalf of a specific user.
|
|
579
|
+
* <li>context: A dictionary that is accessible in Cloud Code `beforeDelete` and `afterDelete` triggers.
|
|
580
|
+
* </ul>
|
|
581
|
+
* @returns {Promise} A promise that is fulfilled when the destroy
|
|
582
|
+
* completes.
|
|
583
|
+
*/
|
|
584
|
+
destroyEventually(options?: RequestOptions): Promise<this>;
|
|
585
|
+
/**
|
|
586
|
+
* Destroy this model on the server if it was already persisted.
|
|
587
|
+
*
|
|
588
|
+
* @param {object} options
|
|
589
|
+
* Valid options are:<ul>
|
|
590
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
591
|
+
* be used for this request.
|
|
592
|
+
* <li>sessionToken: A valid session token, used for making a request on
|
|
593
|
+
* behalf of a specific user.
|
|
594
|
+
* <li>context: A dictionary that is accessible in Cloud Code `beforeDelete` and `afterDelete` triggers.
|
|
595
|
+
* </ul>
|
|
596
|
+
* @returns {Promise} A promise that is fulfilled when the destroy
|
|
597
|
+
* completes.
|
|
598
|
+
*/
|
|
599
|
+
destroy(options?: RequestOptions): Promise<void | ParseObject>;
|
|
600
|
+
/**
|
|
601
|
+
* Asynchronously stores the object and every object it points to in the local datastore,
|
|
602
|
+
* recursively, using a default pin name: _default.
|
|
603
|
+
*
|
|
604
|
+
* If those other objects have not been fetched from Parse, they will not be stored.
|
|
605
|
+
* However, if they have changed data, all the changes will be retained.
|
|
606
|
+
*
|
|
607
|
+
* <pre>
|
|
608
|
+
* await object.pin();
|
|
609
|
+
* </pre>
|
|
610
|
+
*
|
|
611
|
+
* To retrieve object:
|
|
612
|
+
* <code>query.fromLocalDatastore()</code> or <code>query.fromPin()</code>
|
|
613
|
+
*
|
|
614
|
+
* @returns {Promise} A promise that is fulfilled when the pin completes.
|
|
615
|
+
*/
|
|
616
|
+
pin(): Promise<void>;
|
|
617
|
+
/**
|
|
618
|
+
* Asynchronously removes the object and every object it points to in the local datastore,
|
|
619
|
+
* recursively, using a default pin name: _default.
|
|
620
|
+
*
|
|
621
|
+
* <pre>
|
|
622
|
+
* await object.unPin();
|
|
623
|
+
* </pre>
|
|
624
|
+
*
|
|
625
|
+
* @returns {Promise} A promise that is fulfilled when the unPin completes.
|
|
626
|
+
*/
|
|
627
|
+
unPin(): Promise<void>;
|
|
628
|
+
/**
|
|
629
|
+
* Asynchronously returns if the object is pinned
|
|
630
|
+
*
|
|
631
|
+
* <pre>
|
|
632
|
+
* const isPinned = await object.isPinned();
|
|
633
|
+
* </pre>
|
|
634
|
+
*
|
|
635
|
+
* @returns {Promise<boolean>} A boolean promise that is fulfilled if object is pinned.
|
|
636
|
+
*/
|
|
637
|
+
isPinned(): Promise<boolean>;
|
|
638
|
+
/**
|
|
639
|
+
* Asynchronously stores the objects and every object they point to in the local datastore, recursively.
|
|
640
|
+
*
|
|
641
|
+
* If those other objects have not been fetched from Parse, they will not be stored.
|
|
642
|
+
* However, if they have changed data, all the changes will be retained.
|
|
643
|
+
*
|
|
644
|
+
* <pre>
|
|
645
|
+
* await object.pinWithName(name);
|
|
646
|
+
* </pre>
|
|
647
|
+
*
|
|
648
|
+
* To retrieve object:
|
|
649
|
+
* <code>query.fromLocalDatastore()</code> or <code>query.fromPinWithName(name)</code>
|
|
650
|
+
*
|
|
651
|
+
* @param {string} name Name of Pin.
|
|
652
|
+
* @returns {Promise} A promise that is fulfilled when the pin completes.
|
|
653
|
+
*/
|
|
654
|
+
pinWithName(name: string): Promise<void>;
|
|
655
|
+
/**
|
|
656
|
+
* Asynchronously removes the object and every object it points to in the local datastore, recursively.
|
|
657
|
+
*
|
|
658
|
+
* <pre>
|
|
659
|
+
* await object.unPinWithName(name);
|
|
660
|
+
* </pre>
|
|
661
|
+
*
|
|
662
|
+
* @param {string} name Name of Pin.
|
|
663
|
+
* @returns {Promise} A promise that is fulfilled when the unPin completes.
|
|
664
|
+
*/
|
|
665
|
+
unPinWithName(name: string): Promise<void>;
|
|
666
|
+
/**
|
|
667
|
+
* Asynchronously loads data from the local datastore into this object.
|
|
668
|
+
*
|
|
669
|
+
* <pre>
|
|
670
|
+
* await object.fetchFromLocalDatastore();
|
|
671
|
+
* </pre>
|
|
672
|
+
*
|
|
673
|
+
* You can create an unfetched pointer with <code>Parse.Object.createWithoutData()</code>
|
|
674
|
+
* and then call <code>fetchFromLocalDatastore()</code> on it.
|
|
675
|
+
*
|
|
676
|
+
* @returns {Promise} A promise that is fulfilled when the fetch completes.
|
|
677
|
+
*/
|
|
678
|
+
fetchFromLocalDatastore(): Promise<ParseObject>;
|
|
679
|
+
static _clearAllState(): void;
|
|
680
|
+
/**
|
|
681
|
+
* Fetches the given list of Parse.Object.
|
|
682
|
+
* If any error is encountered, stops and calls the error handler.
|
|
683
|
+
*
|
|
684
|
+
* <pre>
|
|
685
|
+
* Parse.Object.fetchAll([object1, object2, ...])
|
|
686
|
+
* .then((list) => {
|
|
687
|
+
* // All the objects were fetched.
|
|
688
|
+
* }, (error) => {
|
|
689
|
+
* // An error occurred while fetching one of the objects.
|
|
690
|
+
* });
|
|
691
|
+
* </pre>
|
|
692
|
+
*
|
|
693
|
+
* @param {Array} list A list of <code>Parse.Object</code>.
|
|
694
|
+
* @param {object} options
|
|
695
|
+
* Valid options are:<ul>
|
|
696
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
697
|
+
* be used for this request.
|
|
698
|
+
* <li>sessionToken: A valid session token, used for making a request on
|
|
699
|
+
* behalf of a specific user.
|
|
700
|
+
* <li>include: The name(s) of the key(s) to include. Can be a string, an array of strings,
|
|
701
|
+
* or an array of array of strings.
|
|
702
|
+
* </ul>
|
|
703
|
+
* @static
|
|
704
|
+
* @returns {Parse.Object[]}
|
|
705
|
+
*/
|
|
706
|
+
static fetchAll<T extends ParseObject>(list: T[], options?: RequestOptions): Promise<T[]>;
|
|
707
|
+
/**
|
|
708
|
+
* Fetches the given list of Parse.Object.
|
|
709
|
+
*
|
|
710
|
+
* Includes nested Parse.Objects for the provided key. You can use dot
|
|
711
|
+
* notation to specify which fields in the included object are also fetched.
|
|
712
|
+
*
|
|
713
|
+
* If any error is encountered, stops and calls the error handler.
|
|
714
|
+
*
|
|
715
|
+
* <pre>
|
|
716
|
+
* Parse.Object.fetchAllWithInclude([object1, object2, ...], [pointer1, pointer2, ...])
|
|
717
|
+
* .then((list) => {
|
|
718
|
+
* // All the objects were fetched.
|
|
719
|
+
* }, (error) => {
|
|
720
|
+
* // An error occurred while fetching one of the objects.
|
|
721
|
+
* });
|
|
722
|
+
* </pre>
|
|
723
|
+
*
|
|
724
|
+
* @param {Array} list A list of <code>Parse.Object</code>.
|
|
725
|
+
* @param {string | Array<string | Array<string>>} keys The name(s) of the key(s) to include.
|
|
726
|
+
* @param {object} options
|
|
727
|
+
* Valid options are:<ul>
|
|
728
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
729
|
+
* be used for this request.
|
|
730
|
+
* <li>sessionToken: A valid session token, used for making a request on
|
|
731
|
+
* behalf of a specific user.
|
|
732
|
+
* </ul>
|
|
733
|
+
* @static
|
|
734
|
+
* @returns {Parse.Object[]}
|
|
735
|
+
*/
|
|
736
|
+
static fetchAllWithInclude<T extends ParseObject>(list: T[], keys: keyof T['attributes'] | Array<keyof T['attributes']>, options?: RequestOptions): Promise<T[]>;
|
|
737
|
+
/**
|
|
738
|
+
* Fetches the given list of Parse.Object if needed.
|
|
739
|
+
* If any error is encountered, stops and calls the error handler.
|
|
740
|
+
*
|
|
741
|
+
* Includes nested Parse.Objects for the provided key. You can use dot
|
|
742
|
+
* notation to specify which fields in the included object are also fetched.
|
|
743
|
+
*
|
|
744
|
+
* If any error is encountered, stops and calls the error handler.
|
|
745
|
+
*
|
|
746
|
+
* <pre>
|
|
747
|
+
* Parse.Object.fetchAllIfNeededWithInclude([object1, object2, ...], [pointer1, pointer2, ...])
|
|
748
|
+
* .then((list) => {
|
|
749
|
+
* // All the objects were fetched.
|
|
750
|
+
* }, (error) => {
|
|
751
|
+
* // An error occurred while fetching one of the objects.
|
|
752
|
+
* });
|
|
753
|
+
* </pre>
|
|
754
|
+
*
|
|
755
|
+
* @param {Array} list A list of <code>Parse.Object</code>.
|
|
756
|
+
* @param {string | Array<string | Array<string>>} keys The name(s) of the key(s) to include.
|
|
757
|
+
* @param {object} options
|
|
758
|
+
* Valid options are:<ul>
|
|
759
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
760
|
+
* be used for this request.
|
|
761
|
+
* <li>sessionToken: A valid session token, used for making a request on
|
|
762
|
+
* behalf of a specific user.
|
|
763
|
+
* </ul>
|
|
764
|
+
* @static
|
|
765
|
+
* @returns {Parse.Object[]}
|
|
766
|
+
*/
|
|
767
|
+
static fetchAllIfNeededWithInclude<T extends ParseObject>(list: T[], keys: keyof T['attributes'] | Array<keyof T['attributes']>, options?: RequestOptions): Promise<T[]>;
|
|
768
|
+
/**
|
|
769
|
+
* Fetches the given list of Parse.Object if needed.
|
|
770
|
+
* If any error is encountered, stops and calls the error handler.
|
|
771
|
+
*
|
|
772
|
+
* <pre>
|
|
773
|
+
* Parse.Object.fetchAllIfNeeded([object1, ...])
|
|
774
|
+
* .then((list) => {
|
|
775
|
+
* // Objects were fetched and updated.
|
|
776
|
+
* }, (error) => {
|
|
777
|
+
* // An error occurred while fetching one of the objects.
|
|
778
|
+
* });
|
|
779
|
+
* </pre>
|
|
780
|
+
*
|
|
781
|
+
* @param {Array} list A list of <code>Parse.Object</code>.
|
|
782
|
+
* @param {object} options
|
|
783
|
+
* Valid options are:<ul>
|
|
784
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
785
|
+
* be used for this request.
|
|
786
|
+
* <li>sessionToken: A valid session token, used for making a request on
|
|
787
|
+
* behalf of a specific user.
|
|
788
|
+
* <li>include: The name(s) of the key(s) to include. Can be a string, an array of strings,
|
|
789
|
+
* or an array of array of strings.
|
|
790
|
+
* <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
|
|
791
|
+
* </ul>
|
|
792
|
+
* @static
|
|
793
|
+
* @returns {Parse.Object[]}
|
|
794
|
+
*/
|
|
795
|
+
static fetchAllIfNeeded<T extends ParseObject>(list: T[], options?: FetchOptions): Promise<T[]>;
|
|
796
|
+
static handleIncludeOptions(options: {
|
|
797
|
+
include?: string | string[];
|
|
798
|
+
}): any[];
|
|
799
|
+
/**
|
|
800
|
+
* Destroy the given list of models on the server if it was already persisted.
|
|
801
|
+
*
|
|
802
|
+
* <p>Unlike saveAll, if an error occurs while deleting an individual model,
|
|
803
|
+
* this method will continue trying to delete the rest of the models if
|
|
804
|
+
* possible, except in the case of a fatal error like a connection error.
|
|
805
|
+
*
|
|
806
|
+
* <p>In particular, the Parse.Error object returned in the case of error may
|
|
807
|
+
* be one of two types:
|
|
808
|
+
*
|
|
809
|
+
* <ul>
|
|
810
|
+
* <li>A Parse.Error.AGGREGATE_ERROR. This object's "errors" property is an
|
|
811
|
+
* array of other Parse.Error objects. Each error object in this array
|
|
812
|
+
* has an "object" property that references the object that could not be
|
|
813
|
+
* deleted (for instance, because that object could not be found).</li>
|
|
814
|
+
* <li>A non-aggregate Parse.Error. This indicates a serious error that
|
|
815
|
+
* caused the delete operation to be aborted partway through (for
|
|
816
|
+
* instance, a connection failure in the middle of the delete).</li>
|
|
817
|
+
* </ul>
|
|
818
|
+
*
|
|
819
|
+
* <pre>
|
|
820
|
+
* Parse.Object.destroyAll([object1, object2, ...])
|
|
821
|
+
* .then((list) => {
|
|
822
|
+
* // All the objects were deleted.
|
|
823
|
+
* }, (error) => {
|
|
824
|
+
* // An error occurred while deleting one or more of the objects.
|
|
825
|
+
* // If this is an aggregate error, then we can inspect each error
|
|
826
|
+
* // object individually to determine the reason why a particular
|
|
827
|
+
* // object was not deleted.
|
|
828
|
+
* if (error.code === Parse.Error.AGGREGATE_ERROR) {
|
|
829
|
+
* for (var i = 0; i < error.errors.length; i++) {
|
|
830
|
+
* console.log("Couldn't delete " + error.errors[i].object.id +
|
|
831
|
+
* "due to " + error.errors[i].message);
|
|
832
|
+
* }
|
|
833
|
+
* } else {
|
|
834
|
+
* console.log("Delete aborted because of " + error.message);
|
|
835
|
+
* }
|
|
836
|
+
* });
|
|
837
|
+
* </pre>
|
|
838
|
+
*
|
|
839
|
+
* @param {Array} list A list of <code>Parse.Object</code>.
|
|
840
|
+
* @param {object} options
|
|
841
|
+
* Valid options are:<ul>
|
|
842
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
843
|
+
* be used for this request.
|
|
844
|
+
* <li>sessionToken: A valid session token, used for making a request on
|
|
845
|
+
* behalf of a specific user.
|
|
846
|
+
* <li>context: A dictionary that is accessible in Cloud Code `beforeDelete` and `afterDelete` triggers.
|
|
847
|
+
* <li>transaction: Set to true to enable transactions
|
|
848
|
+
* <li>batchSize: How many objects to yield in each batch (default: 20)
|
|
849
|
+
* </ul>
|
|
850
|
+
* @static
|
|
851
|
+
* @returns {Promise} A promise that is fulfilled when the destroyAll
|
|
852
|
+
* completes.
|
|
853
|
+
*/
|
|
854
|
+
static destroyAll(list: Array<ParseObject>, options?: SaveOptions): Promise<ParseObject<Attributes> | ParseObject<Attributes>[]>;
|
|
855
|
+
/**
|
|
856
|
+
* Saves the given list of Parse.Object.
|
|
857
|
+
* If any error is encountered, stops and calls the error handler.
|
|
858
|
+
*
|
|
859
|
+
* <pre>
|
|
860
|
+
* Parse.Object.saveAll([object1, object2, ...])
|
|
861
|
+
* .then((list) => {
|
|
862
|
+
* // All the objects were saved.
|
|
863
|
+
* }, (error) => {
|
|
864
|
+
* // An error occurred while saving one of the objects.
|
|
865
|
+
* });
|
|
866
|
+
* </pre>
|
|
867
|
+
*
|
|
868
|
+
* @param {Array} list A list of <code>Parse.Object</code>.
|
|
869
|
+
* @param {object} options
|
|
870
|
+
* Valid options are:
|
|
871
|
+
* <ul>
|
|
872
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
873
|
+
* be used for this request.
|
|
874
|
+
* <li>sessionToken: A valid session token, used for making a request on
|
|
875
|
+
* behalf of a specific user.
|
|
876
|
+
* <li>cascadeSave: If `false`, nested objects will not be saved (default is `true`).
|
|
877
|
+
* <li>context: A dictionary that is accessible in Cloud Code `beforeSave` and `afterSave` triggers.
|
|
878
|
+
* <li>transaction: Set to true to enable transactions
|
|
879
|
+
* <li>batchSize: How many objects to yield in each batch (default: 20)
|
|
880
|
+
* </ul>
|
|
881
|
+
* @static
|
|
882
|
+
* @returns {Parse.Object[]}
|
|
883
|
+
*/
|
|
884
|
+
static saveAll<T extends ParseObject[]>(list: T, options?: SaveOptions): Promise<T>;
|
|
885
|
+
/**
|
|
886
|
+
* Creates a reference to a subclass of Parse.Object with the given id. This
|
|
887
|
+
* does not exist on Parse.Object, only on subclasses.
|
|
888
|
+
*
|
|
889
|
+
* <p>A shortcut for: <pre>
|
|
890
|
+
* var Foo = Parse.Object.extend("Foo");
|
|
891
|
+
* var pointerToFoo = new Foo();
|
|
892
|
+
* pointerToFoo.id = "myObjectId";
|
|
893
|
+
* </pre>
|
|
894
|
+
*
|
|
895
|
+
* @param {string} id The ID of the object to create a reference to.
|
|
896
|
+
* @static
|
|
897
|
+
* @returns {Parse.Object} A Parse.Object reference.
|
|
898
|
+
*/
|
|
899
|
+
static createWithoutData(id: string): ParseObject;
|
|
900
|
+
/**
|
|
901
|
+
* Creates a new instance of a Parse Object from a JSON representation.
|
|
902
|
+
*
|
|
903
|
+
* @param {object} json The JSON map of the Object's data
|
|
904
|
+
* @param {boolean} override In single instance mode, all old server data
|
|
905
|
+
* is overwritten if this is set to true
|
|
906
|
+
* @param {boolean} dirty Whether the Parse.Object should set JSON keys to dirty
|
|
907
|
+
* @static
|
|
908
|
+
* @returns {Parse.Object} A Parse.Object reference
|
|
909
|
+
*/
|
|
910
|
+
static fromJSON<T extends ParseObject>(json: any, override?: boolean, dirty?: boolean): T;
|
|
911
|
+
/**
|
|
912
|
+
* Registers a subclass of Parse.Object with a specific class name.
|
|
913
|
+
* When objects of that class are retrieved from a query, they will be
|
|
914
|
+
* instantiated with this subclass.
|
|
915
|
+
* This is only necessary when using ES6 subclassing.
|
|
916
|
+
*
|
|
917
|
+
* @param {string} className The class name of the subclass
|
|
918
|
+
* @param {Function} constructor The subclass
|
|
919
|
+
*/
|
|
920
|
+
static registerSubclass(className: string, constructor: any): void;
|
|
921
|
+
/**
|
|
922
|
+
* Unegisters a subclass of Parse.Object with a specific class name.
|
|
923
|
+
*
|
|
924
|
+
* @param {string} className The class name of the subclass
|
|
925
|
+
*/
|
|
926
|
+
static unregisterSubclass(className: string): void;
|
|
927
|
+
/**
|
|
928
|
+
* Creates a new subclass of Parse.Object for the given Parse class name.
|
|
929
|
+
*
|
|
930
|
+
* <p>Every extension of a Parse class will inherit from the most recent
|
|
931
|
+
* previous extension of that class. When a Parse.Object is automatically
|
|
932
|
+
* created by parsing JSON, it will use the most recent extension of that
|
|
933
|
+
* class.</p>
|
|
934
|
+
*
|
|
935
|
+
* <p>You should call either:<pre>
|
|
936
|
+
* var MyClass = Parse.Object.extend("MyClass", {
|
|
937
|
+
* <i>Instance methods</i>,
|
|
938
|
+
* initialize: function(attrs, options) {
|
|
939
|
+
* this.someInstanceProperty = [],
|
|
940
|
+
* <i>Other instance properties</i>
|
|
941
|
+
* }
|
|
942
|
+
* }, {
|
|
943
|
+
* <i>Class properties</i>
|
|
944
|
+
* });</pre>
|
|
945
|
+
* or, for Backbone compatibility:<pre>
|
|
946
|
+
* var MyClass = Parse.Object.extend({
|
|
947
|
+
* className: "MyClass",
|
|
948
|
+
* <i>Instance methods</i>,
|
|
949
|
+
* initialize: function(attrs, options) {
|
|
950
|
+
* this.someInstanceProperty = [],
|
|
951
|
+
* <i>Other instance properties</i>
|
|
952
|
+
* }
|
|
953
|
+
* }, {
|
|
954
|
+
* <i>Class properties</i>
|
|
955
|
+
* });</pre></p>
|
|
956
|
+
*
|
|
957
|
+
* @param {string} className The name of the Parse class backing this model.
|
|
958
|
+
* @param {object} [protoProps] Instance properties to add to instances of the
|
|
959
|
+
* class returned from this method.
|
|
960
|
+
* @param {object} [classProps] Class properties to add the class returned from
|
|
961
|
+
* this method.
|
|
962
|
+
* @returns {Parse.Object} A new subclass of Parse.Object.
|
|
963
|
+
*/
|
|
964
|
+
static extend(className: any, protoProps?: any, classProps?: any): any;
|
|
965
|
+
/**
|
|
966
|
+
* Enable single instance objects, where any local objects with the same Id
|
|
967
|
+
* share the same attributes, and stay synchronized with each other.
|
|
968
|
+
* This is disabled by default in server environments, since it can lead to
|
|
969
|
+
* security issues.
|
|
970
|
+
*
|
|
971
|
+
* @static
|
|
972
|
+
*/
|
|
973
|
+
static enableSingleInstance(): void;
|
|
974
|
+
/**
|
|
975
|
+
* Disable single instance objects, where any local objects with the same Id
|
|
976
|
+
* share the same attributes, and stay synchronized with each other.
|
|
977
|
+
* When disabled, you can have two instances of the same object in memory
|
|
978
|
+
* without them sharing attributes.
|
|
979
|
+
*
|
|
980
|
+
* @static
|
|
981
|
+
*/
|
|
982
|
+
static disableSingleInstance(): void;
|
|
983
|
+
/**
|
|
984
|
+
* Asynchronously stores the objects and every object they point to in the local datastore,
|
|
985
|
+
* recursively, using a default pin name: _default.
|
|
986
|
+
*
|
|
987
|
+
* If those other objects have not been fetched from Parse, they will not be stored.
|
|
988
|
+
* However, if they have changed data, all the changes will be retained.
|
|
989
|
+
*
|
|
990
|
+
* <pre>
|
|
991
|
+
* await Parse.Object.pinAll([...]);
|
|
992
|
+
* </pre>
|
|
993
|
+
*
|
|
994
|
+
* To retrieve object:
|
|
995
|
+
* <code>query.fromLocalDatastore()</code> or <code>query.fromPin()</code>
|
|
996
|
+
*
|
|
997
|
+
* @param {Array} objects A list of <code>Parse.Object</code>.
|
|
998
|
+
* @returns {Promise} A promise that is fulfilled when the pin completes.
|
|
999
|
+
* @static
|
|
1000
|
+
*/
|
|
1001
|
+
static pinAll(objects: Array<ParseObject>): Promise<void>;
|
|
1002
|
+
/**
|
|
1003
|
+
* Asynchronously stores the objects and every object they point to in the local datastore, recursively.
|
|
1004
|
+
*
|
|
1005
|
+
* If those other objects have not been fetched from Parse, they will not be stored.
|
|
1006
|
+
* However, if they have changed data, all the changes will be retained.
|
|
1007
|
+
*
|
|
1008
|
+
* <pre>
|
|
1009
|
+
* await Parse.Object.pinAllWithName(name, [obj1, obj2, ...]);
|
|
1010
|
+
* </pre>
|
|
1011
|
+
*
|
|
1012
|
+
* To retrieve object:
|
|
1013
|
+
* <code>query.fromLocalDatastore()</code> or <code>query.fromPinWithName(name)</code>
|
|
1014
|
+
*
|
|
1015
|
+
* @param {string} name Name of Pin.
|
|
1016
|
+
* @param {Array} objects A list of <code>Parse.Object</code>.
|
|
1017
|
+
* @returns {Promise} A promise that is fulfilled when the pin completes.
|
|
1018
|
+
* @static
|
|
1019
|
+
*/
|
|
1020
|
+
static pinAllWithName(name: string, objects: Array<ParseObject>): Promise<void>;
|
|
1021
|
+
/**
|
|
1022
|
+
* Asynchronously removes the objects and every object they point to in the local datastore,
|
|
1023
|
+
* recursively, using a default pin name: _default.
|
|
1024
|
+
*
|
|
1025
|
+
* <pre>
|
|
1026
|
+
* await Parse.Object.unPinAll([...]);
|
|
1027
|
+
* </pre>
|
|
1028
|
+
*
|
|
1029
|
+
* @param {Array} objects A list of <code>Parse.Object</code>.
|
|
1030
|
+
* @returns {Promise} A promise that is fulfilled when the unPin completes.
|
|
1031
|
+
* @static
|
|
1032
|
+
*/
|
|
1033
|
+
static unPinAll(objects: Array<ParseObject>): Promise<void>;
|
|
1034
|
+
/**
|
|
1035
|
+
* Asynchronously removes the objects and every object they point to in the local datastore, recursively.
|
|
1036
|
+
*
|
|
1037
|
+
* <pre>
|
|
1038
|
+
* await Parse.Object.unPinAllWithName(name, [obj1, obj2, ...]);
|
|
1039
|
+
* </pre>
|
|
1040
|
+
*
|
|
1041
|
+
* @param {string} name Name of Pin.
|
|
1042
|
+
* @param {Array} objects A list of <code>Parse.Object</code>.
|
|
1043
|
+
* @returns {Promise} A promise that is fulfilled when the unPin completes.
|
|
1044
|
+
* @static
|
|
1045
|
+
*/
|
|
1046
|
+
static unPinAllWithName(name: string, objects: Array<ParseObject>): Promise<void>;
|
|
1047
|
+
/**
|
|
1048
|
+
* Asynchronously removes all objects in the local datastore using a default pin name: _default.
|
|
1049
|
+
*
|
|
1050
|
+
* <pre>
|
|
1051
|
+
* await Parse.Object.unPinAllObjects();
|
|
1052
|
+
* </pre>
|
|
1053
|
+
*
|
|
1054
|
+
* @returns {Promise} A promise that is fulfilled when the unPin completes.
|
|
1055
|
+
* @static
|
|
1056
|
+
*/
|
|
1057
|
+
static unPinAllObjects(): Promise<void>;
|
|
1058
|
+
/**
|
|
1059
|
+
* Asynchronously removes all objects with the specified pin name.
|
|
1060
|
+
* Deletes the pin name also.
|
|
1061
|
+
*
|
|
1062
|
+
* <pre>
|
|
1063
|
+
* await Parse.Object.unPinAllObjectsWithName(name);
|
|
1064
|
+
* </pre>
|
|
1065
|
+
*
|
|
1066
|
+
* @param {string} name Name of Pin.
|
|
1067
|
+
* @returns {Promise} A promise that is fulfilled when the unPin completes.
|
|
1068
|
+
* @static
|
|
1069
|
+
*/
|
|
1070
|
+
static unPinAllObjectsWithName(name: string): Promise<void>;
|
|
1071
|
+
}
|
|
1072
|
+
export default ParseObject;
|