parse 5.1.0-alpha.8 → 5.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/parse.js +675 -374
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +1603 -438
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/CoreManager.js +48 -183
- package/lib/browser/EventuallyQueue.js +1 -1
- package/lib/browser/InstallationController.js +134 -23
- package/lib/browser/ObjectStateMutations.js +3 -2
- package/lib/browser/Parse.js +2 -2
- package/lib/browser/ParseACL.js +21 -11
- package/lib/browser/ParseFile.js +4 -0
- package/lib/browser/ParseGeoPoint.js +12 -8
- package/lib/browser/ParseHooks.js +2 -0
- package/lib/browser/ParseInstallation.js +274 -13
- package/lib/browser/ParseObject.js +74 -68
- package/lib/browser/ParseOp.js +21 -7
- package/lib/browser/ParseQuery.js +1 -0
- package/lib/browser/ParseRelation.js +12 -7
- package/lib/browser/ParseRole.js +2 -0
- package/lib/browser/ParseSession.js +1 -1
- package/lib/browser/ParseUser.js +1 -0
- package/lib/browser/SingleInstanceStateController.js +2 -4
- package/lib/browser/arrayContainsObject.js +4 -3
- package/lib/browser/canBeSerialized.js +6 -4
- package/lib/browser/decode.js +8 -5
- package/lib/browser/encode.js +6 -4
- package/lib/browser/equals.js +4 -3
- package/lib/browser/unique.js +3 -2
- package/lib/browser/unsavedChildren.js +4 -2
- package/lib/browser/uuid.js +11 -5
- package/lib/node/CoreManager.js +48 -183
- package/lib/node/EventuallyQueue.js +1 -1
- package/lib/node/InstallationController.js +65 -21
- package/lib/node/ObjectStateMutations.js +3 -2
- package/lib/node/Parse.js +2 -2
- package/lib/node/ParseACL.js +21 -11
- package/lib/node/ParseFile.js +4 -0
- package/lib/node/ParseGeoPoint.js +11 -11
- package/lib/node/ParseHooks.js +2 -0
- package/lib/node/ParseInstallation.js +207 -7
- package/lib/node/ParseObject.js +68 -66
- package/lib/node/ParseOp.js +21 -7
- package/lib/node/ParseQuery.js +1 -0
- package/lib/node/ParseRelation.js +14 -8
- package/lib/node/ParseRole.js +2 -0
- package/lib/node/ParseSession.js +1 -1
- package/lib/node/ParseUser.js +1 -0
- package/lib/node/SingleInstanceStateController.js +2 -8
- package/lib/node/arrayContainsObject.js +4 -3
- package/lib/node/canBeSerialized.js +6 -4
- package/lib/node/decode.js +9 -5
- package/lib/node/encode.js +7 -4
- package/lib/node/equals.js +4 -3
- package/lib/node/unique.js +3 -2
- package/lib/node/unsavedChildren.js +4 -2
- package/lib/node/uuid.js +10 -8
- package/lib/react-native/CoreManager.js +39 -9
- package/lib/react-native/InstallationController.js +77 -9
- package/lib/react-native/ObjectStateMutations.js +3 -2
- package/lib/react-native/Parse.js +2 -2
- package/lib/react-native/ParseACL.js +19 -11
- package/lib/react-native/ParseGeoPoint.js +5 -3
- package/lib/react-native/ParseInstallation.js +115 -10
- package/lib/react-native/ParseObject.js +8 -6
- package/lib/react-native/ParseOp.js +20 -6
- package/lib/react-native/ParseQuery.js +1 -0
- package/lib/react-native/ParseRelation.js +10 -7
- package/lib/react-native/ParseRole.js +2 -0
- package/lib/react-native/ParseUser.js +1 -0
- package/lib/react-native/SingleInstanceStateController.js +0 -2
- package/lib/react-native/arrayContainsObject.js +3 -2
- package/lib/react-native/canBeSerialized.js +5 -3
- package/lib/react-native/decode.js +7 -5
- package/lib/react-native/encode.js +6 -4
- package/lib/react-native/equals.js +4 -3
- package/lib/react-native/unique.js +3 -2
- package/lib/react-native/unsavedChildren.js +3 -2
- package/lib/react-native/uuid.js +9 -4
- package/lib/weapp/CoreManager.js +48 -183
- package/lib/weapp/EventuallyQueue.js +1 -1
- package/lib/weapp/InstallationController.js +134 -23
- package/lib/weapp/ObjectStateMutations.js +3 -2
- package/lib/weapp/Parse.js +2 -2
- package/lib/weapp/ParseACL.js +21 -11
- package/lib/weapp/ParseFile.js +4 -0
- package/lib/weapp/ParseGeoPoint.js +12 -8
- package/lib/weapp/ParseHooks.js +2 -0
- package/lib/weapp/ParseInstallation.js +274 -13
- package/lib/weapp/ParseObject.js +74 -68
- package/lib/weapp/ParseOp.js +21 -7
- package/lib/weapp/ParseQuery.js +1 -0
- package/lib/weapp/ParseRelation.js +12 -7
- package/lib/weapp/ParseRole.js +2 -0
- package/lib/weapp/ParseSession.js +1 -1
- package/lib/weapp/ParseUser.js +1 -0
- package/lib/weapp/SingleInstanceStateController.js +2 -4
- package/lib/weapp/arrayContainsObject.js +4 -3
- package/lib/weapp/canBeSerialized.js +6 -4
- package/lib/weapp/decode.js +8 -5
- package/lib/weapp/encode.js +6 -4
- package/lib/weapp/equals.js +4 -3
- package/lib/weapp/unique.js +3 -2
- package/lib/weapp/unsavedChildren.js +4 -2
- package/lib/weapp/uuid.js +12 -5
- package/package.json +4 -1
package/lib/node/Parse.js
CHANGED
|
@@ -160,10 +160,11 @@ const Parse /*: ParseType*/ = {
|
|
|
160
160
|
_CoreManager.default.setIfNeeded('EventEmitter', _EventEmitter.default);
|
|
161
161
|
_CoreManager.default.setIfNeeded('LiveQuery', new _ParseLiveQuery.default());
|
|
162
162
|
_CoreManager.default.setIfNeeded('CryptoController', _CryptoController.default);
|
|
163
|
+
_CoreManager.default.setIfNeeded('EventuallyQueue', _EventuallyQueue.default);
|
|
164
|
+
_CoreManager.default.setIfNeeded('InstallationController', _InstallationController.default);
|
|
163
165
|
_CoreManager.default.setIfNeeded('LocalDatastoreController', _LocalDatastoreController.default);
|
|
164
166
|
_CoreManager.default.setIfNeeded('StorageController', _StorageController.default);
|
|
165
167
|
_CoreManager.default.setIfNeeded('WebSocketController', _WebSocketController.default);
|
|
166
|
-
_CoreManager.default.setIfNeeded('EventuallyQueue', _EventuallyQueue.default);
|
|
167
168
|
},
|
|
168
169
|
/**
|
|
169
170
|
* Call this method to set your AsyncStorage engine
|
|
@@ -397,7 +398,6 @@ const Parse /*: ParseType*/ = {
|
|
|
397
398
|
return this.encryptedUser;
|
|
398
399
|
}
|
|
399
400
|
};
|
|
400
|
-
_CoreManager.default.setInstallationController(_InstallationController.default);
|
|
401
401
|
_CoreManager.default.setRESTController(_RESTController.default);
|
|
402
402
|
Parse.initialize = Parse._initialize;
|
|
403
403
|
Parse.Cloud = Parse.Cloud || {};
|
package/lib/node/ParseACL.js
CHANGED
|
@@ -4,8 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var
|
|
8
|
-
var _ParseUser = _interopRequireDefault(require("./ParseUser"));
|
|
7
|
+
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
9
8
|
function _interopRequireDefault(obj) {
|
|
10
9
|
return obj && obj.__esModule ? obj : {
|
|
11
10
|
default: obj
|
|
@@ -14,6 +13,8 @@ function _interopRequireDefault(obj) {
|
|
|
14
13
|
/**
|
|
15
14
|
* @flow
|
|
16
15
|
*/
|
|
16
|
+
/*:: import type ParseRole from './ParseRole';*/
|
|
17
|
+
/*:: import type ParseUser from './ParseUser';*/
|
|
17
18
|
/*:: type PermissionsMap = { [permission: string]: boolean };*/
|
|
18
19
|
/*:: type ByIdMap = { [userId: string]: PermissionsMap };*/
|
|
19
20
|
const PUBLIC_KEY = '*';
|
|
@@ -40,7 +41,8 @@ class ParseACL {
|
|
|
40
41
|
constructor(arg1 /*: ParseUser | ByIdMap*/) {
|
|
41
42
|
this.permissionsById = {};
|
|
42
43
|
if (arg1 && typeof arg1 === 'object') {
|
|
43
|
-
|
|
44
|
+
const ParseUser = _CoreManager.default.getParseUser();
|
|
45
|
+
if (arg1 instanceof ParseUser) {
|
|
44
46
|
this.setReadAccess(arg1, true);
|
|
45
47
|
this.setWriteAccess(arg1, true);
|
|
46
48
|
} else {
|
|
@@ -106,9 +108,11 @@ class ParseACL {
|
|
|
106
108
|
return true;
|
|
107
109
|
}
|
|
108
110
|
_setAccess(accessType /*: string*/, userId /*: ParseUser | ParseRole | string*/, allowed /*: boolean*/) {
|
|
109
|
-
|
|
111
|
+
const ParseRole = _CoreManager.default.getParseRole();
|
|
112
|
+
const ParseUser = _CoreManager.default.getParseUser();
|
|
113
|
+
if (userId instanceof ParseUser) {
|
|
110
114
|
userId = userId.id;
|
|
111
|
-
} else if (userId instanceof
|
|
115
|
+
} else if (userId instanceof ParseRole) {
|
|
112
116
|
const name = userId.getName();
|
|
113
117
|
if (!name) {
|
|
114
118
|
throw new TypeError('Role must have a name');
|
|
@@ -141,12 +145,14 @@ class ParseACL {
|
|
|
141
145
|
}
|
|
142
146
|
}
|
|
143
147
|
_getAccess(accessType /*: string*/, userId /*: ParseUser | ParseRole | string*/) /*: boolean*/{
|
|
144
|
-
|
|
148
|
+
const ParseRole = _CoreManager.default.getParseRole();
|
|
149
|
+
const ParseUser = _CoreManager.default.getParseUser();
|
|
150
|
+
if (userId instanceof ParseUser) {
|
|
145
151
|
userId = userId.id;
|
|
146
152
|
if (!userId) {
|
|
147
153
|
throw new Error('Cannot get access for a ParseUser without an ID');
|
|
148
154
|
}
|
|
149
|
-
} else if (userId instanceof
|
|
155
|
+
} else if (userId instanceof ParseRole) {
|
|
150
156
|
const name = userId.getName();
|
|
151
157
|
if (!name) {
|
|
152
158
|
throw new TypeError('Role must have a name');
|
|
@@ -252,7 +258,8 @@ class ParseACL {
|
|
|
252
258
|
* @throws {TypeError} If role is neither a Parse.Role nor a String.
|
|
253
259
|
*/
|
|
254
260
|
getRoleReadAccess(role /*: ParseRole | string*/) /*: boolean*/{
|
|
255
|
-
|
|
261
|
+
const ParseRole = _CoreManager.default.getParseRole();
|
|
262
|
+
if (role instanceof ParseRole) {
|
|
256
263
|
// Normalize to the String name
|
|
257
264
|
role = role.getName();
|
|
258
265
|
}
|
|
@@ -272,7 +279,8 @@ class ParseACL {
|
|
|
272
279
|
* @throws {TypeError} If role is neither a Parse.Role nor a String.
|
|
273
280
|
*/
|
|
274
281
|
getRoleWriteAccess(role /*: ParseRole | string*/) /*: boolean*/{
|
|
275
|
-
|
|
282
|
+
const ParseRole = _CoreManager.default.getParseRole();
|
|
283
|
+
if (role instanceof ParseRole) {
|
|
276
284
|
// Normalize to the String name
|
|
277
285
|
role = role.getName();
|
|
278
286
|
}
|
|
@@ -291,7 +299,8 @@ class ParseACL {
|
|
|
291
299
|
* @throws {TypeError} If role is neither a Parse.Role nor a String.
|
|
292
300
|
*/
|
|
293
301
|
setRoleReadAccess(role /*: ParseRole | string*/, allowed /*: boolean*/) {
|
|
294
|
-
|
|
302
|
+
const ParseRole = _CoreManager.default.getParseRole();
|
|
303
|
+
if (role instanceof ParseRole) {
|
|
295
304
|
// Normalize to the String name
|
|
296
305
|
role = role.getName();
|
|
297
306
|
}
|
|
@@ -310,7 +319,8 @@ class ParseACL {
|
|
|
310
319
|
* @throws {TypeError} If role is neither a Parse.Role nor a String.
|
|
311
320
|
*/
|
|
312
321
|
setRoleWriteAccess(role /*: ParseRole | string*/, allowed /*: boolean*/) {
|
|
313
|
-
|
|
322
|
+
const ParseRole = _CoreManager.default.getParseRole();
|
|
323
|
+
if (role instanceof ParseRole) {
|
|
314
324
|
// Normalize to the String name
|
|
315
325
|
role = role.getName();
|
|
316
326
|
}
|
package/lib/node/ParseFile.js
CHANGED
|
@@ -23,6 +23,10 @@ if (typeof XMLHttpRequest !== 'undefined') {
|
|
|
23
23
|
/*:: type Base64 = { base64: string };*/
|
|
24
24
|
/*:: type Uri = { uri: string };*/
|
|
25
25
|
/*:: type FileData = Array<number> | Base64 | Blob | Uri;*/
|
|
26
|
+
/*:: export type FileSaveOptions = FullOptions & {
|
|
27
|
+
metadata?: { [key: string]: any },
|
|
28
|
+
tags?: { [key: string]: any },
|
|
29
|
+
};*/
|
|
26
30
|
/*:: export type FileSource =
|
|
27
31
|
| {
|
|
28
32
|
format: 'file',
|
|
@@ -4,10 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* @flow
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
7
|
/**
|
|
12
8
|
* Creates a new GeoPoint with any of the following forms:<br>
|
|
13
9
|
* <pre>
|
|
@@ -33,8 +29,6 @@ exports.default = void 0;
|
|
|
33
29
|
*/
|
|
34
30
|
/* global navigator */
|
|
35
31
|
class ParseGeoPoint {
|
|
36
|
-
/*:: _latitude: number;*/
|
|
37
|
-
/*:: _longitude: number;*/
|
|
38
32
|
/**
|
|
39
33
|
* @param {(number[] | object | number)} arg1 Either a list of coordinate pairs, an object with `latitude`, `longitude`, or the latitude or the point.
|
|
40
34
|
* @param {number} arg2 The longitude of the GeoPoint
|
|
@@ -101,7 +95,7 @@ class ParseGeoPoint {
|
|
|
101
95
|
longitude: this._longitude
|
|
102
96
|
};
|
|
103
97
|
}
|
|
104
|
-
equals(other /*:
|
|
98
|
+
equals(other /*: any*/) /*: boolean*/{
|
|
105
99
|
return other instanceof ParseGeoPoint && this.latitude === other.latitude && this.longitude === other.longitude;
|
|
106
100
|
}
|
|
107
101
|
|
|
@@ -169,12 +163,18 @@ class ParseGeoPoint {
|
|
|
169
163
|
/**
|
|
170
164
|
* Creates a GeoPoint with the user's current location, if available.
|
|
171
165
|
*
|
|
166
|
+
* @param {object} options The options.
|
|
167
|
+
* @param {boolean} [options.enableHighAccuracy=false] A boolean value that indicates the application would like to receive the best possible results. If true and if the device is able to provide a more accurate position, it will do so. Note that this can result in slower response times or increased power consumption (with a GPS chip on a mobile device for example). On the other hand, if false, the device can take the liberty to save resources by responding more quickly and/or using less power. Default: false.
|
|
168
|
+
* @param {number} [options.timeout=Infinity] A positive long value representing the maximum length of time (in milliseconds) the device is allowed to take in order to return a position. The default value is Infinity, meaning that getCurrentPosition() won't return until the position is available.
|
|
169
|
+
* @param {number} [options.maximumAge=0] A positive long value indicating the maximum age in milliseconds of a possible cached position that is acceptable to return. If set to 0, it means that the device cannot use a cached position and must attempt to retrieve the real current position. If set to Infinity the device must return a cached position regardless of its age. Default: 0.
|
|
172
170
|
* @static
|
|
173
|
-
* @returns {Parse.GeoPoint} User's current location
|
|
171
|
+
* @returns {Promise<Parse.GeoPoint>} User's current location
|
|
174
172
|
*/
|
|
175
|
-
static current() {
|
|
176
|
-
return
|
|
177
|
-
|
|
173
|
+
static current(options) /*: Promise<ParseGeoPoint>*/{
|
|
174
|
+
return new Promise((resolve, reject) => {
|
|
175
|
+
navigator.geolocation.getCurrentPosition(location => {
|
|
176
|
+
resolve(new ParseGeoPoint(location.coords.latitude, location.coords.longitude));
|
|
177
|
+
}, reject, options);
|
|
178
178
|
});
|
|
179
179
|
}
|
|
180
180
|
}
|
package/lib/node/ParseHooks.js
CHANGED
|
@@ -24,6 +24,8 @@ function _interopRequireDefault(obj) {
|
|
|
24
24
|
default: obj
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
+
/*:: export type HookDeclaration = { functionName: string, url: string } | { className: string, triggerName: string, url: string };*/
|
|
28
|
+
/*:: export type HookDeleteArg = { functionName: string } | { className: string, triggerName: string };*/
|
|
27
29
|
function getFunctions() {
|
|
28
30
|
return _CoreManager.default.getHooksController().get('functions');
|
|
29
31
|
}
|
|
@@ -4,25 +4,225 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
7
8
|
var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
8
9
|
function _interopRequireDefault(obj) {
|
|
9
10
|
return obj && obj.__esModule ? obj : {
|
|
10
11
|
default: obj
|
|
11
12
|
};
|
|
12
13
|
}
|
|
14
|
+
const DEVICE_TYPES /*: DeviceInterface*/ = {
|
|
15
|
+
IOS: 'ios',
|
|
16
|
+
MACOS: 'macos',
|
|
17
|
+
TVOS: 'tvos',
|
|
18
|
+
FCM: 'fcm',
|
|
19
|
+
ANDROID: 'android',
|
|
20
|
+
WEB: 'web'
|
|
21
|
+
};
|
|
22
|
+
|
|
13
23
|
/**
|
|
14
|
-
*
|
|
24
|
+
* Parse.Installation is a local representation of installation data that can be saved and retrieved from the Parse cloud.
|
|
25
|
+
* This class is a subclass of a Parse.Object, and retains the same functionality of a Parse.Object, but also extends it with installation-specific features.
|
|
26
|
+
*
|
|
27
|
+
* <p>A valid Parse.Installation can only be instantiated via <code>Parse.Installation.currentInstallation()</code>
|
|
28
|
+
*
|
|
29
|
+
* Parse.Installation objects which have a valid <code>deviceToken</code> and are saved to the Parse cloud can be used to target push notifications.
|
|
30
|
+
* </p>
|
|
31
|
+
*
|
|
32
|
+
* @alias Parse.Installation
|
|
15
33
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
34
|
+
class ParseInstallation extends _ParseObject.default {
|
|
35
|
+
/**
|
|
36
|
+
* @param {object} attributes The initial set of data to store in the object.
|
|
37
|
+
*/
|
|
38
|
+
constructor(attributes /*:: ?: AttributeMap*/) {
|
|
19
39
|
super('_Installation');
|
|
20
40
|
if (attributes && typeof attributes === 'object') {
|
|
21
|
-
if (!this.set(attributes
|
|
41
|
+
if (!this.set(attributes)) {
|
|
22
42
|
throw new Error("Can't create an invalid Installation");
|
|
23
43
|
}
|
|
24
44
|
}
|
|
25
45
|
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* A unique identifier for this installation’s client application. In iOS, this is the Bundle Identifier.
|
|
49
|
+
*
|
|
50
|
+
* @property {string} appIdentifier
|
|
51
|
+
* @static
|
|
52
|
+
*/
|
|
53
|
+
get appIdentifier() {
|
|
54
|
+
return this.get('appIdentifier');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The version string of the client application to which this installation belongs.
|
|
59
|
+
*
|
|
60
|
+
* @property {string} appVersion
|
|
61
|
+
* @static
|
|
62
|
+
*/
|
|
63
|
+
get appVersion() {
|
|
64
|
+
return this.get('appVersion');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The display name of the client application to which this installation belongs.
|
|
69
|
+
*
|
|
70
|
+
* @property {string} appName
|
|
71
|
+
* @static
|
|
72
|
+
*/
|
|
73
|
+
get appName() {
|
|
74
|
+
return this.get('appName');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The current value of the icon badge for iOS apps.
|
|
79
|
+
* Changes to this value on the server will be used
|
|
80
|
+
* for future badge-increment push notifications.
|
|
81
|
+
*
|
|
82
|
+
* @property {number} badge
|
|
83
|
+
* @static
|
|
84
|
+
*/
|
|
85
|
+
get badge() {
|
|
86
|
+
return this.get('badge');
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* An array of the channels to which a device is currently subscribed.
|
|
91
|
+
*
|
|
92
|
+
* @property {string[]} channels
|
|
93
|
+
* @static
|
|
94
|
+
*/
|
|
95
|
+
get channels() {
|
|
96
|
+
return this.get('channels');
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Token used to deliver push notifications to the device.
|
|
101
|
+
*
|
|
102
|
+
* @property {string} deviceToken
|
|
103
|
+
* @static
|
|
104
|
+
*/
|
|
105
|
+
get deviceToken() {
|
|
106
|
+
return this.get('deviceToken');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* The type of device, “ios”, “android”, “web”, etc.
|
|
111
|
+
*
|
|
112
|
+
* @property {string} deviceType
|
|
113
|
+
* @static
|
|
114
|
+
*/
|
|
115
|
+
get deviceType() {
|
|
116
|
+
return this.get('deviceType');
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Gets the GCM sender identifier for this installation
|
|
121
|
+
*
|
|
122
|
+
* @property {string} GCMSenderId
|
|
123
|
+
* @static
|
|
124
|
+
*/
|
|
125
|
+
get GCMSenderId() {
|
|
126
|
+
return this.get('GCMSenderId');
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Universally Unique Identifier (UUID) for the device used by Parse. It must be unique across all of an app’s installations.
|
|
131
|
+
*
|
|
132
|
+
* @property {string} installationId
|
|
133
|
+
* @static
|
|
134
|
+
*/
|
|
135
|
+
get installationId() {
|
|
136
|
+
return this.get('installationId');
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Gets the local identifier for this installation
|
|
141
|
+
*
|
|
142
|
+
* @property {string} localeIdentifier
|
|
143
|
+
* @static
|
|
144
|
+
*/
|
|
145
|
+
get localeIdentifier() {
|
|
146
|
+
return this.get('localeIdentifier');
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Gets the parse server version for this installation
|
|
151
|
+
*
|
|
152
|
+
* @property {string} parseVersion
|
|
153
|
+
* @static
|
|
154
|
+
*/
|
|
155
|
+
get parseVersion() {
|
|
156
|
+
return this.get('parseVersion');
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* This field is reserved for directing Parse to the push delivery network to be used.
|
|
161
|
+
*
|
|
162
|
+
* @property {string} pushType
|
|
163
|
+
* @static
|
|
164
|
+
*/
|
|
165
|
+
get pushType() {
|
|
166
|
+
return this.get('pushType');
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Gets the time zone for this installation
|
|
171
|
+
*
|
|
172
|
+
* @property {string} timeZone
|
|
173
|
+
* @static
|
|
174
|
+
*/
|
|
175
|
+
get timeZone() {
|
|
176
|
+
return this.get('timeZone');
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Returns the device types for used for Push Notifications.
|
|
181
|
+
*
|
|
182
|
+
* <pre>
|
|
183
|
+
* Parse.Installation.DEVICE_TYPES.IOS
|
|
184
|
+
* Parse.Installation.DEVICE_TYPES.MACOS
|
|
185
|
+
* Parse.Installation.DEVICE_TYPES.TVOS
|
|
186
|
+
* Parse.Installation.DEVICE_TYPES.FCM
|
|
187
|
+
* Parse.Installation.DEVICE_TYPES.ANDROID
|
|
188
|
+
* Parse.Installation.DEVICE_TYPES.WEB
|
|
189
|
+
* </pre
|
|
190
|
+
*
|
|
191
|
+
* @property {object} DEVICE_TYPES
|
|
192
|
+
* @static
|
|
193
|
+
*/
|
|
194
|
+
static get DEVICE_TYPES() /*: DeviceInterface*/{
|
|
195
|
+
return DEVICE_TYPES;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Wrap the default save behavior with functionality to save to local storage.
|
|
200
|
+
*
|
|
201
|
+
* @param {...any} args
|
|
202
|
+
* @returns {Promise}
|
|
203
|
+
*/
|
|
204
|
+
async save(...args) /*: Promise<this>*/{
|
|
205
|
+
await super.save.apply(this, args);
|
|
206
|
+
await _CoreManager.default.getInstallationController().updateInstallationOnDisk(this);
|
|
207
|
+
return this;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Get the current Parse.Installation from disk. If doesn't exists, create an new installation.
|
|
212
|
+
*
|
|
213
|
+
* <pre>
|
|
214
|
+
* const installation = await Parse.Installation.currentInstallation();
|
|
215
|
+
* installation.set('deviceToken', '123');
|
|
216
|
+
* await installation.save();
|
|
217
|
+
* </pre>
|
|
218
|
+
*
|
|
219
|
+
* @returns {Promise} A promise that resolves to the local installation object.
|
|
220
|
+
*/
|
|
221
|
+
static currentInstallation() /*: Promise<ParseInstallation>*/{
|
|
222
|
+
return _CoreManager.default.getInstallationController().currentInstallation();
|
|
223
|
+
}
|
|
26
224
|
}
|
|
27
|
-
|
|
28
|
-
|
|
225
|
+
_ParseObject.default.registerSubclass('_Installation', ParseInstallation);
|
|
226
|
+
module.exports = ParseInstallation;
|
|
227
|
+
var _default = ParseInstallation;
|
|
228
|
+
exports.default = _default;
|