parse 5.1.0-alpha.8 → 5.1.0-alpha.9
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 +435 -224
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +435 -224
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/CoreManager.js +18 -183
- package/lib/browser/InstallationController.js +134 -23
- package/lib/browser/Parse.js +2 -2
- package/lib/browser/ParseFile.js +4 -0
- package/lib/browser/ParseHooks.js +2 -0
- package/lib/browser/ParseInstallation.js +274 -13
- package/lib/browser/ParseSession.js +1 -1
- package/lib/node/CoreManager.js +18 -183
- package/lib/node/InstallationController.js +65 -21
- package/lib/node/Parse.js +2 -2
- package/lib/node/ParseFile.js +4 -0
- package/lib/node/ParseHooks.js +2 -0
- package/lib/node/ParseInstallation.js +207 -7
- package/lib/node/ParseSession.js +1 -1
- package/lib/react-native/CoreManager.js +9 -9
- package/lib/react-native/InstallationController.js +77 -9
- package/lib/react-native/Parse.js +2 -2
- package/lib/react-native/ParseInstallation.js +115 -10
- package/lib/weapp/CoreManager.js +18 -183
- package/lib/weapp/InstallationController.js +134 -23
- package/lib/weapp/Parse.js +2 -2
- package/lib/weapp/ParseFile.js +4 -0
- package/lib/weapp/ParseHooks.js +2 -0
- package/lib/weapp/ParseInstallation.js +274 -13
- package/lib/weapp/ParseSession.js +1 -1
- package/package.json +1 -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/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',
|
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<ParseInstallation>*/{
|
|
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;
|
package/lib/node/ParseSession.js
CHANGED
|
@@ -62,7 +62,7 @@ class ParseSession extends _ParseObject.default {
|
|
|
62
62
|
static current(options /*: FullOptions*/) {
|
|
63
63
|
options = options || {};
|
|
64
64
|
const controller = _CoreManager.default.getSessionController();
|
|
65
|
-
const sessionOptions = {};
|
|
65
|
+
const sessionOptions /*: FullOptions*/ = {};
|
|
66
66
|
if (options.hasOwnProperty('useMasterKey')) {
|
|
67
67
|
sessionOptions.useMasterKey = options.useMasterKey;
|
|
68
68
|
}
|
|
@@ -12,7 +12,7 @@ var config = {
|
|
|
12
12
|
SERVER_AUTH_TOKEN: null,
|
|
13
13
|
LIVEQUERY_SERVER_URL: null,
|
|
14
14
|
ENCRYPTED_KEY: null,
|
|
15
|
-
VERSION: 'js' + "5.1.0-alpha.
|
|
15
|
+
VERSION: 'js' + "5.1.0-alpha.9",
|
|
16
16
|
APPLICATION_ID: null,
|
|
17
17
|
JAVASCRIPT_KEY: null,
|
|
18
18
|
MASTER_KEY: null,
|
|
@@ -85,11 +85,18 @@ var CoreManager = {
|
|
|
85
85
|
requireMethods('FileController', ['saveFile', 'saveBase64'], controller);
|
|
86
86
|
config['FileController'] = controller;
|
|
87
87
|
},
|
|
88
|
+
setEventuallyQueue: function (controller) {
|
|
89
|
+
requireMethods('EventuallyQueue', ['poll', 'save', 'destroy'], controller);
|
|
90
|
+
config['EventuallyQueue'] = controller;
|
|
91
|
+
},
|
|
92
|
+
getEventuallyQueue: function () {
|
|
93
|
+
return config['EventuallyQueue'];
|
|
94
|
+
},
|
|
88
95
|
getFileController: function () {
|
|
89
96
|
return config['FileController'];
|
|
90
97
|
},
|
|
91
98
|
setInstallationController: function (controller) {
|
|
92
|
-
requireMethods('InstallationController', ['currentInstallationId'], controller);
|
|
99
|
+
requireMethods('InstallationController', ['currentInstallationId', 'currentInstallation', 'updateInstallationOnDisk'], controller);
|
|
93
100
|
config['InstallationController'] = controller;
|
|
94
101
|
},
|
|
95
102
|
getInstallationController: function () {
|
|
@@ -136,13 +143,6 @@ var CoreManager = {
|
|
|
136
143
|
getRESTController: function () {
|
|
137
144
|
return config['RESTController'];
|
|
138
145
|
},
|
|
139
|
-
setEventuallyQueue: function (controller) {
|
|
140
|
-
requireMethods('EventuallyQueue', ['poll', 'save', 'destroy'], controller);
|
|
141
|
-
config['EventuallyQueue'] = controller;
|
|
142
|
-
},
|
|
143
|
-
getEventuallyQueue: function () {
|
|
144
|
-
return config['EventuallyQueue'];
|
|
145
|
-
},
|
|
146
146
|
setSchemaController: function (controller) {
|
|
147
147
|
requireMethods('SchemaController', ['get', 'create', 'update', 'delete', 'send', 'purge'], controller);
|
|
148
148
|
config['SchemaController'] = controller;
|
|
@@ -1,16 +1,39 @@
|
|
|
1
1
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports.default = void 0;
|
|
6
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
7
|
+
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
2
8
|
var _Storage = _interopRequireDefault(require("./Storage"));
|
|
3
|
-
var
|
|
9
|
+
var _ParseInstallation = _interopRequireDefault(require("./ParseInstallation"));
|
|
10
|
+
var _uuid = _interopRequireDefault(require("./uuid"));
|
|
11
|
+
var CURRENT_INSTALLATION_KEY = 'currentInstallation';
|
|
12
|
+
var CURRENT_INSTALLATION_ID_KEY = 'currentInstallationId';
|
|
4
13
|
var iidCache = null;
|
|
14
|
+
var currentInstallationCache = null;
|
|
15
|
+
var currentInstallationCacheMatchesDisk = false;
|
|
5
16
|
var InstallationController = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
17
|
+
updateInstallationOnDisk: function () {
|
|
18
|
+
var _updateInstallationOnDisk = (0, _asyncToGenerator2.default)(function* (installation) {
|
|
19
|
+
var path = _Storage.default.generatePath(CURRENT_INSTALLATION_KEY);
|
|
20
|
+
yield _Storage.default.setItemAsync(path, JSON.stringify(installation.toJSON()));
|
|
21
|
+
this._setCurrentInstallationCache(installation);
|
|
22
|
+
});
|
|
23
|
+
function updateInstallationOnDisk() {
|
|
24
|
+
return _updateInstallationOnDisk.apply(this, arguments);
|
|
9
25
|
}
|
|
10
|
-
|
|
11
|
-
|
|
26
|
+
return updateInstallationOnDisk;
|
|
27
|
+
}(),
|
|
28
|
+
currentInstallationId: function () {
|
|
29
|
+
var _currentInstallationId = (0, _asyncToGenerator2.default)(function* () {
|
|
30
|
+
if (typeof iidCache === 'string') {
|
|
31
|
+
return iidCache;
|
|
32
|
+
}
|
|
33
|
+
var path = _Storage.default.generatePath(CURRENT_INSTALLATION_ID_KEY);
|
|
34
|
+
var iid = yield _Storage.default.getItemAsync(path);
|
|
12
35
|
if (!iid) {
|
|
13
|
-
iid =
|
|
36
|
+
iid = (0, _uuid.default)();
|
|
14
37
|
return _Storage.default.setItemAsync(path, iid).then(function () {
|
|
15
38
|
iidCache = iid;
|
|
16
39
|
return iid;
|
|
@@ -19,12 +42,57 @@ var InstallationController = {
|
|
|
19
42
|
iidCache = iid;
|
|
20
43
|
return iid;
|
|
21
44
|
});
|
|
22
|
-
|
|
45
|
+
function currentInstallationId() {
|
|
46
|
+
return _currentInstallationId.apply(this, arguments);
|
|
47
|
+
}
|
|
48
|
+
return currentInstallationId;
|
|
49
|
+
}(),
|
|
50
|
+
currentInstallation: function () {
|
|
51
|
+
var _currentInstallation = (0, _asyncToGenerator2.default)(function* () {
|
|
52
|
+
if (currentInstallationCache) {
|
|
53
|
+
return currentInstallationCache;
|
|
54
|
+
}
|
|
55
|
+
if (currentInstallationCacheMatchesDisk) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
var path = _Storage.default.generatePath(CURRENT_INSTALLATION_KEY);
|
|
59
|
+
var installationData = yield _Storage.default.getItemAsync(path);
|
|
60
|
+
currentInstallationCacheMatchesDisk = true;
|
|
61
|
+
if (installationData) {
|
|
62
|
+
installationData = JSON.parse(installationData);
|
|
63
|
+
installationData.className = '_Installation';
|
|
64
|
+
var current = _ParseInstallation.default.fromJSON(installationData);
|
|
65
|
+
currentInstallationCache = current;
|
|
66
|
+
return current;
|
|
67
|
+
}
|
|
68
|
+
var installationId = yield this.currentInstallationId();
|
|
69
|
+
var installation = new _ParseInstallation.default();
|
|
70
|
+
installation.set('deviceType', _ParseInstallation.default.DEVICE_TYPES.WEB);
|
|
71
|
+
installation.set('installationId', installationId);
|
|
72
|
+
installation.set('parseVersion', _CoreManager.default.get('VERSION'));
|
|
73
|
+
currentInstallationCache = installation;
|
|
74
|
+
yield _Storage.default.setItemAsync(path, JSON.stringify(installation.toJSON()));
|
|
75
|
+
return installation;
|
|
76
|
+
});
|
|
77
|
+
function currentInstallation() {
|
|
78
|
+
return _currentInstallation.apply(this, arguments);
|
|
79
|
+
}
|
|
80
|
+
return currentInstallation;
|
|
81
|
+
}(),
|
|
23
82
|
_clearCache: function () {
|
|
24
83
|
iidCache = null;
|
|
84
|
+
currentInstallationCache = null;
|
|
85
|
+
currentInstallationCacheMatchesDisk = false;
|
|
25
86
|
},
|
|
26
87
|
_setInstallationIdCache: function (iid) {
|
|
27
88
|
iidCache = iid;
|
|
89
|
+
},
|
|
90
|
+
_setCurrentInstallationCache: function (installation) {
|
|
91
|
+
var matchesDisk = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
92
|
+
currentInstallationCache = installation;
|
|
93
|
+
currentInstallationCacheMatchesDisk = matchesDisk;
|
|
28
94
|
}
|
|
29
95
|
};
|
|
30
|
-
module.exports = InstallationController;
|
|
96
|
+
module.exports = InstallationController;
|
|
97
|
+
var _default = InstallationController;
|
|
98
|
+
exports.default = _default;
|
|
@@ -133,10 +133,11 @@ var Parse = {
|
|
|
133
133
|
_CoreManager.default.setIfNeeded('EventEmitter', _EventEmitter.default);
|
|
134
134
|
_CoreManager.default.setIfNeeded('LiveQuery', new _ParseLiveQuery.default());
|
|
135
135
|
_CoreManager.default.setIfNeeded('CryptoController', _CryptoController.default);
|
|
136
|
+
_CoreManager.default.setIfNeeded('EventuallyQueue', _EventuallyQueue.default);
|
|
137
|
+
_CoreManager.default.setIfNeeded('InstallationController', _InstallationController.default);
|
|
136
138
|
_CoreManager.default.setIfNeeded('LocalDatastoreController', _LocalDatastoreController.default);
|
|
137
139
|
_CoreManager.default.setIfNeeded('StorageController', _StorageController.default);
|
|
138
140
|
_CoreManager.default.setIfNeeded('WebSocketController', _WebSocketController.default);
|
|
139
|
-
_CoreManager.default.setIfNeeded('EventuallyQueue', _EventuallyQueue.default);
|
|
140
141
|
},
|
|
141
142
|
setAsyncStorage: function (storage) {
|
|
142
143
|
_CoreManager.default.setAsyncStorage(storage);
|
|
@@ -272,7 +273,6 @@ var Parse = {
|
|
|
272
273
|
return this.encryptedUser;
|
|
273
274
|
}
|
|
274
275
|
};
|
|
275
|
-
_CoreManager.default.setInstallationController(_InstallationController.default);
|
|
276
276
|
_CoreManager.default.setRESTController(_RESTController.default);
|
|
277
277
|
Parse.Parse = Parse;
|
|
278
278
|
module.exports = Parse;
|
|
@@ -3,11 +3,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
exports.default = void 0;
|
|
6
|
-
var
|
|
6
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
7
7
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
8
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
9
|
+
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
8
10
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
9
11
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
10
12
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
13
|
+
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
11
14
|
var _ParseObject2 = _interopRequireDefault(require("./ParseObject"));
|
|
12
15
|
function _createSuper(Derived) {
|
|
13
16
|
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
@@ -34,21 +37,123 @@ function _isNativeReflectConstruct() {
|
|
|
34
37
|
return false;
|
|
35
38
|
}
|
|
36
39
|
}
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
var DEVICE_TYPES = {
|
|
41
|
+
IOS: 'ios',
|
|
42
|
+
MACOS: 'macos',
|
|
43
|
+
TVOS: 'tvos',
|
|
44
|
+
FCM: 'fcm',
|
|
45
|
+
ANDROID: 'android',
|
|
46
|
+
WEB: 'web'
|
|
47
|
+
};
|
|
48
|
+
var ParseInstallation = function (_ParseObject) {
|
|
49
|
+
(0, _inherits2.default)(ParseInstallation, _ParseObject);
|
|
50
|
+
var _super = _createSuper(ParseInstallation);
|
|
51
|
+
function ParseInstallation(attributes) {
|
|
41
52
|
var _this;
|
|
42
|
-
(0, _classCallCheck2.default)(this,
|
|
53
|
+
(0, _classCallCheck2.default)(this, ParseInstallation);
|
|
43
54
|
_this = _super.call(this, '_Installation');
|
|
44
55
|
if (attributes && typeof attributes === 'object') {
|
|
45
|
-
if (!_this.set(attributes
|
|
56
|
+
if (!_this.set(attributes)) {
|
|
46
57
|
throw new Error("Can't create an invalid Installation");
|
|
47
58
|
}
|
|
48
59
|
}
|
|
49
60
|
return _this;
|
|
50
61
|
}
|
|
51
|
-
|
|
62
|
+
(0, _createClass2.default)(ParseInstallation, [{
|
|
63
|
+
key: "appIdentifier",
|
|
64
|
+
get: function () {
|
|
65
|
+
return this.get('appIdentifier');
|
|
66
|
+
}
|
|
67
|
+
}, {
|
|
68
|
+
key: "appVersion",
|
|
69
|
+
get: function () {
|
|
70
|
+
return this.get('appVersion');
|
|
71
|
+
}
|
|
72
|
+
}, {
|
|
73
|
+
key: "appName",
|
|
74
|
+
get: function () {
|
|
75
|
+
return this.get('appName');
|
|
76
|
+
}
|
|
77
|
+
}, {
|
|
78
|
+
key: "badge",
|
|
79
|
+
get: function () {
|
|
80
|
+
return this.get('badge');
|
|
81
|
+
}
|
|
82
|
+
}, {
|
|
83
|
+
key: "channels",
|
|
84
|
+
get: function () {
|
|
85
|
+
return this.get('channels');
|
|
86
|
+
}
|
|
87
|
+
}, {
|
|
88
|
+
key: "deviceToken",
|
|
89
|
+
get: function () {
|
|
90
|
+
return this.get('deviceToken');
|
|
91
|
+
}
|
|
92
|
+
}, {
|
|
93
|
+
key: "deviceType",
|
|
94
|
+
get: function () {
|
|
95
|
+
return this.get('deviceType');
|
|
96
|
+
}
|
|
97
|
+
}, {
|
|
98
|
+
key: "GCMSenderId",
|
|
99
|
+
get: function () {
|
|
100
|
+
return this.get('GCMSenderId');
|
|
101
|
+
}
|
|
102
|
+
}, {
|
|
103
|
+
key: "installationId",
|
|
104
|
+
get: function () {
|
|
105
|
+
return this.get('installationId');
|
|
106
|
+
}
|
|
107
|
+
}, {
|
|
108
|
+
key: "localeIdentifier",
|
|
109
|
+
get: function () {
|
|
110
|
+
return this.get('localeIdentifier');
|
|
111
|
+
}
|
|
112
|
+
}, {
|
|
113
|
+
key: "parseVersion",
|
|
114
|
+
get: function () {
|
|
115
|
+
return this.get('parseVersion');
|
|
116
|
+
}
|
|
117
|
+
}, {
|
|
118
|
+
key: "pushType",
|
|
119
|
+
get: function () {
|
|
120
|
+
return this.get('pushType');
|
|
121
|
+
}
|
|
122
|
+
}, {
|
|
123
|
+
key: "timeZone",
|
|
124
|
+
get: function () {
|
|
125
|
+
return this.get('timeZone');
|
|
126
|
+
}
|
|
127
|
+
}, {
|
|
128
|
+
key: "save",
|
|
129
|
+
value: function () {
|
|
130
|
+
var _save = (0, _asyncToGenerator2.default)(function* () {
|
|
131
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
132
|
+
args[_key] = arguments[_key];
|
|
133
|
+
}
|
|
134
|
+
yield (0, _get2.default)((0, _getPrototypeOf2.default)(ParseInstallation.prototype), "save", this).apply(this, args);
|
|
135
|
+
yield _CoreManager.default.getInstallationController().updateInstallationOnDisk(this);
|
|
136
|
+
return this;
|
|
137
|
+
});
|
|
138
|
+
function save() {
|
|
139
|
+
return _save.apply(this, arguments);
|
|
140
|
+
}
|
|
141
|
+
return save;
|
|
142
|
+
}()
|
|
143
|
+
}], [{
|
|
144
|
+
key: "DEVICE_TYPES",
|
|
145
|
+
get: function () {
|
|
146
|
+
return DEVICE_TYPES;
|
|
147
|
+
}
|
|
148
|
+
}, {
|
|
149
|
+
key: "currentInstallation",
|
|
150
|
+
value: function () {
|
|
151
|
+
return _CoreManager.default.getInstallationController().currentInstallation();
|
|
152
|
+
}
|
|
153
|
+
}]);
|
|
154
|
+
return ParseInstallation;
|
|
52
155
|
}(_ParseObject2.default);
|
|
53
|
-
|
|
54
|
-
|
|
156
|
+
_ParseObject2.default.registerSubclass('_Installation', ParseInstallation);
|
|
157
|
+
module.exports = ParseInstallation;
|
|
158
|
+
var _default = ParseInstallation;
|
|
159
|
+
exports.default = _default;
|