parse 5.1.0-alpha.1 → 5.1.0-alpha.11
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 +13 -0
- package/dist/parse.js +1464 -1051
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +2367 -1090
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/CoreManager.js +48 -171
- package/lib/browser/InstallationController.js +134 -23
- package/lib/browser/LiveQueryClient.js +43 -35
- package/lib/browser/LiveQuerySubscription.js +15 -5
- package/lib/browser/LocalDatastoreController.default.js +248 -0
- package/lib/browser/LocalDatastoreController.js +1 -246
- package/lib/browser/ObjectStateMutations.js +6 -5
- package/lib/browser/OfflineQuery.js +3 -2
- package/lib/browser/Parse.js +31 -7
- 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/ParseLiveQuery.js +32 -23
- package/lib/browser/ParseObject.js +37 -40
- 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 +51 -15
- package/lib/browser/RESTController.js +6 -5
- package/lib/browser/SingleInstanceStateController.js +2 -4
- package/lib/browser/Storage.js +1 -2
- package/lib/browser/StorageController.js +3 -0
- package/lib/browser/WebSocketController.js +13 -0
- 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 -171
- package/lib/node/InstallationController.js +65 -21
- package/lib/node/LiveQueryClient.js +2 -5
- package/lib/node/LiveQuerySubscription.js +2 -2
- package/lib/node/LocalDatastoreController.default.js +67 -0
- package/lib/node/LocalDatastoreController.js +1 -65
- package/lib/node/ObjectStateMutations.js +8 -9
- package/lib/node/OfflineQuery.js +3 -2
- package/lib/node/Parse.js +31 -7
- 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/ParseLiveQuery.js +2 -3
- package/lib/node/ParseObject.js +9 -12
- 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 +20 -13
- package/lib/node/RESTController.js +5 -5
- package/lib/node/SingleInstanceStateController.js +2 -8
- package/lib/node/Storage.js +1 -2
- package/lib/node/StorageController.js +3 -0
- package/lib/node/WebSocketController.js +10 -0
- 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 -2
- package/lib/react-native/InstallationController.js +77 -9
- package/lib/react-native/LiveQueryClient.js +28 -20
- package/lib/react-native/LiveQuerySubscription.js +14 -5
- package/lib/react-native/LocalDatastoreController.default.js +91 -0
- package/lib/react-native/LocalDatastoreController.js +1 -91
- package/lib/react-native/ObjectStateMutations.js +6 -5
- package/lib/react-native/OfflineQuery.js +3 -2
- package/lib/react-native/Parse.js +23 -7
- 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/ParseLiveQuery.js +11 -2
- package/lib/react-native/ParseObject.js +28 -31
- 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 +6 -2
- package/lib/react-native/RESTController.js +5 -5
- package/lib/react-native/SingleInstanceStateController.js +0 -2
- package/lib/react-native/Storage.js +1 -2
- package/lib/react-native/StorageController.js +1 -0
- package/lib/react-native/WebSocketController.js +5 -0
- 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 -171
- package/lib/weapp/InstallationController.js +134 -23
- package/lib/weapp/LiveQueryClient.js +43 -35
- package/lib/weapp/LiveQuerySubscription.js +15 -5
- package/lib/weapp/LocalDatastoreController.default.js +248 -0
- package/lib/weapp/LocalDatastoreController.js +1 -246
- package/lib/weapp/ObjectStateMutations.js +6 -5
- package/lib/weapp/OfflineQuery.js +3 -2
- package/lib/weapp/Parse.js +31 -7
- 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/ParseLiveQuery.js +32 -23
- package/lib/weapp/ParseObject.js +37 -40
- 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 +51 -15
- package/lib/weapp/RESTController.js +6 -5
- package/lib/weapp/SingleInstanceStateController.js +2 -4
- package/lib/weapp/Storage.js +1 -2
- package/lib/weapp/StorageController.js +3 -0
- package/lib/weapp/WebSocketController.js +13 -0
- 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 +3 -1
package/lib/weapp/Parse.js
CHANGED
|
@@ -44,6 +44,9 @@ var _Storage = _interopRequireDefault(require("./Storage"));
|
|
|
44
44
|
var _ParseUser = _interopRequireDefault(require("./ParseUser"));
|
|
45
45
|
var _ParseLiveQuery = _interopRequireDefault(require("./ParseLiveQuery"));
|
|
46
46
|
var _LiveQueryClient = _interopRequireDefault(require("./LiveQueryClient"));
|
|
47
|
+
var _LocalDatastoreController = _interopRequireDefault(require("./LocalDatastoreController"));
|
|
48
|
+
var _StorageController = _interopRequireDefault(require("./StorageController"));
|
|
49
|
+
var _WebSocketController = _interopRequireDefault(require("./WebSocketController"));
|
|
47
50
|
function _getRequireWildcardCache(nodeInterop) {
|
|
48
51
|
if (typeof _WeakMap !== "function") return null;
|
|
49
52
|
var cacheBabelInterop = new _WeakMap();
|
|
@@ -100,7 +103,6 @@ var Parse /*: ParseType*/ = {
|
|
|
100
103
|
CoreManager: _CoreManager.default,
|
|
101
104
|
Config: _ParseConfig.default,
|
|
102
105
|
Error: _ParseError.default,
|
|
103
|
-
EventuallyQueue: _EventuallyQueue.default,
|
|
104
106
|
FacebookUtils: _FacebookUtils.default,
|
|
105
107
|
File: _ParseFile.default,
|
|
106
108
|
GeoPoint: _ParseGeoPoint.default,
|
|
@@ -126,10 +128,19 @@ var Parse /*: ParseType*/ = {
|
|
|
126
128
|
Storage: _Storage.default,
|
|
127
129
|
User: _ParseUser.default,
|
|
128
130
|
LiveQueryClient: _LiveQueryClient.default,
|
|
129
|
-
LiveQuery: undefined,
|
|
130
131
|
IndexedDB: undefined,
|
|
131
132
|
Hooks: undefined,
|
|
132
133
|
Parse: undefined,
|
|
134
|
+
/**
|
|
135
|
+
* @member {EventuallyQueue} Parse.EventuallyQueue
|
|
136
|
+
* @static
|
|
137
|
+
*/
|
|
138
|
+
set EventuallyQueue(queue /*: EventuallyQueue*/) {
|
|
139
|
+
_CoreManager.default.setEventuallyQueue(queue);
|
|
140
|
+
},
|
|
141
|
+
get EventuallyQueue() {
|
|
142
|
+
return _CoreManager.default.getEventuallyQueue();
|
|
143
|
+
},
|
|
133
144
|
/**
|
|
134
145
|
* Call this method first to set up your authentication tokens for Parse.
|
|
135
146
|
*
|
|
@@ -147,8 +158,13 @@ var Parse /*: ParseType*/ = {
|
|
|
147
158
|
_CoreManager.default.set('MASTER_KEY', masterKey);
|
|
148
159
|
_CoreManager.default.set('USE_MASTER_KEY', false);
|
|
149
160
|
_CoreManager.default.setIfNeeded('EventEmitter', _EventEmitter.default);
|
|
150
|
-
|
|
151
|
-
_CoreManager.default.setIfNeeded('
|
|
161
|
+
_CoreManager.default.setIfNeeded('LiveQuery', new _ParseLiveQuery.default());
|
|
162
|
+
_CoreManager.default.setIfNeeded('CryptoController', _CryptoController.default);
|
|
163
|
+
_CoreManager.default.setIfNeeded('EventuallyQueue', _EventuallyQueue.default);
|
|
164
|
+
_CoreManager.default.setIfNeeded('InstallationController', _InstallationController.default);
|
|
165
|
+
_CoreManager.default.setIfNeeded('LocalDatastoreController', _LocalDatastoreController.default);
|
|
166
|
+
_CoreManager.default.setIfNeeded('StorageController', _StorageController.default);
|
|
167
|
+
_CoreManager.default.setIfNeeded('WebSocketController', _WebSocketController.default);
|
|
152
168
|
},
|
|
153
169
|
/**
|
|
154
170
|
* Call this method to set your AsyncStorage engine
|
|
@@ -240,6 +256,16 @@ var Parse /*: ParseType*/ = {
|
|
|
240
256
|
get serverAuthType() {
|
|
241
257
|
return _CoreManager.default.get('SERVER_AUTH_TYPE');
|
|
242
258
|
},
|
|
259
|
+
/**
|
|
260
|
+
* @member {ParseLiveQuery} Parse.LiveQuery
|
|
261
|
+
* @static
|
|
262
|
+
*/
|
|
263
|
+
set LiveQuery(liveQuery /*: ParseLiveQuery*/) {
|
|
264
|
+
_CoreManager.default.setLiveQuery(liveQuery);
|
|
265
|
+
},
|
|
266
|
+
get LiveQuery() {
|
|
267
|
+
return _CoreManager.default.getLiveQuery();
|
|
268
|
+
},
|
|
243
269
|
/**
|
|
244
270
|
* @member {string} Parse.liveQueryServerURL
|
|
245
271
|
* @static
|
|
@@ -330,7 +356,7 @@ var Parse /*: ParseType*/ = {
|
|
|
330
356
|
if (!this.LocalDatastore.isEnabled) {
|
|
331
357
|
this.LocalDatastore.isEnabled = true;
|
|
332
358
|
if (polling) {
|
|
333
|
-
|
|
359
|
+
_CoreManager.default.getEventuallyQueue().poll(ms);
|
|
334
360
|
}
|
|
335
361
|
}
|
|
336
362
|
},
|
|
@@ -380,8 +406,6 @@ var Parse /*: ParseType*/ = {
|
|
|
380
406
|
return this.encryptedUser;
|
|
381
407
|
}
|
|
382
408
|
};
|
|
383
|
-
_CoreManager.default.setCryptoController(_CryptoController.default);
|
|
384
|
-
_CoreManager.default.setInstallationController(_InstallationController.default);
|
|
385
409
|
_CoreManager.default.setRESTController(_RESTController.default);
|
|
386
410
|
// For legacy requires, of the form `var Parse = require('parse').Parse`
|
|
387
411
|
Parse.Parse = Parse;
|
package/lib/weapp/ParseACL.js
CHANGED
|
@@ -11,11 +11,12 @@ var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/ty
|
|
|
11
11
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
12
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
13
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
14
|
-
var
|
|
15
|
-
var _ParseUser = _interopRequireDefault(require("./ParseUser"));
|
|
14
|
+
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
16
15
|
/**
|
|
17
16
|
* @flow
|
|
18
17
|
*/
|
|
18
|
+
/*:: import type ParseRole from './ParseRole';*/
|
|
19
|
+
/*:: import type ParseUser from './ParseUser';*/
|
|
19
20
|
/*:: type PermissionsMap = { [permission: string]: boolean };*/
|
|
20
21
|
/*:: type ByIdMap = { [userId: string]: PermissionsMap };*/
|
|
21
22
|
var PUBLIC_KEY = '*';
|
|
@@ -43,7 +44,8 @@ var ParseACL = /*#__PURE__*/function () {
|
|
|
43
44
|
(0, _defineProperty2.default)(this, "permissionsById", void 0);
|
|
44
45
|
this.permissionsById = {};
|
|
45
46
|
if (arg1 && (0, _typeof2.default)(arg1) === 'object') {
|
|
46
|
-
|
|
47
|
+
var _ParseUser = _CoreManager.default.getParseUser();
|
|
48
|
+
if (arg1 instanceof _ParseUser) {
|
|
47
49
|
this.setReadAccess(arg1, true);
|
|
48
50
|
this.setWriteAccess(arg1, true);
|
|
49
51
|
} else {
|
|
@@ -115,9 +117,11 @@ var ParseACL = /*#__PURE__*/function () {
|
|
|
115
117
|
}, {
|
|
116
118
|
key: "_setAccess",
|
|
117
119
|
value: function (accessType /*: string*/, userId /*: ParseUser | ParseRole | string*/, allowed /*: boolean*/) {
|
|
118
|
-
|
|
120
|
+
var ParseRole = _CoreManager.default.getParseRole();
|
|
121
|
+
var ParseUser = _CoreManager.default.getParseUser();
|
|
122
|
+
if (userId instanceof ParseUser) {
|
|
119
123
|
userId = userId.id;
|
|
120
|
-
} else if (userId instanceof
|
|
124
|
+
} else if (userId instanceof ParseRole) {
|
|
121
125
|
var name = userId.getName();
|
|
122
126
|
if (!name) {
|
|
123
127
|
throw new TypeError('Role must have a name');
|
|
@@ -152,12 +156,14 @@ var ParseACL = /*#__PURE__*/function () {
|
|
|
152
156
|
}, {
|
|
153
157
|
key: "_getAccess",
|
|
154
158
|
value: function (accessType /*: string*/, userId /*: ParseUser | ParseRole | string*/) /*: boolean*/{
|
|
155
|
-
|
|
159
|
+
var ParseRole = _CoreManager.default.getParseRole();
|
|
160
|
+
var ParseUser = _CoreManager.default.getParseUser();
|
|
161
|
+
if (userId instanceof ParseUser) {
|
|
156
162
|
userId = userId.id;
|
|
157
163
|
if (!userId) {
|
|
158
164
|
throw new Error('Cannot get access for a ParseUser without an ID');
|
|
159
165
|
}
|
|
160
|
-
} else if (userId instanceof
|
|
166
|
+
} else if (userId instanceof ParseRole) {
|
|
161
167
|
var name = userId.getName();
|
|
162
168
|
if (!name) {
|
|
163
169
|
throw new TypeError('Role must have a name');
|
|
@@ -281,7 +287,8 @@ var ParseACL = /*#__PURE__*/function () {
|
|
|
281
287
|
}, {
|
|
282
288
|
key: "getRoleReadAccess",
|
|
283
289
|
value: function (role /*: ParseRole | string*/) /*: boolean*/{
|
|
284
|
-
|
|
290
|
+
var ParseRole = _CoreManager.default.getParseRole();
|
|
291
|
+
if (role instanceof ParseRole) {
|
|
285
292
|
// Normalize to the String name
|
|
286
293
|
role = role.getName();
|
|
287
294
|
}
|
|
@@ -303,7 +310,8 @@ var ParseACL = /*#__PURE__*/function () {
|
|
|
303
310
|
}, {
|
|
304
311
|
key: "getRoleWriteAccess",
|
|
305
312
|
value: function (role /*: ParseRole | string*/) /*: boolean*/{
|
|
306
|
-
|
|
313
|
+
var ParseRole = _CoreManager.default.getParseRole();
|
|
314
|
+
if (role instanceof ParseRole) {
|
|
307
315
|
// Normalize to the String name
|
|
308
316
|
role = role.getName();
|
|
309
317
|
}
|
|
@@ -324,7 +332,8 @@ var ParseACL = /*#__PURE__*/function () {
|
|
|
324
332
|
}, {
|
|
325
333
|
key: "setRoleReadAccess",
|
|
326
334
|
value: function (role /*: ParseRole | string*/, allowed /*: boolean*/) {
|
|
327
|
-
|
|
335
|
+
var ParseRole = _CoreManager.default.getParseRole();
|
|
336
|
+
if (role instanceof ParseRole) {
|
|
328
337
|
// Normalize to the String name
|
|
329
338
|
role = role.getName();
|
|
330
339
|
}
|
|
@@ -345,7 +354,8 @@ var ParseACL = /*#__PURE__*/function () {
|
|
|
345
354
|
}, {
|
|
346
355
|
key: "setRoleWriteAccess",
|
|
347
356
|
value: function (role /*: ParseRole | string*/, allowed /*: boolean*/) {
|
|
348
|
-
|
|
357
|
+
var ParseRole = _CoreManager.default.getParseRole();
|
|
358
|
+
if (role instanceof ParseRole) {
|
|
349
359
|
// Normalize to the String name
|
|
350
360
|
role = role.getName();
|
|
351
361
|
}
|
package/lib/weapp/ParseFile.js
CHANGED
|
@@ -62,6 +62,10 @@ XHR = require('./Xhr.weapp');
|
|
|
62
62
|
/*:: type Base64 = { base64: string };*/
|
|
63
63
|
/*:: type Uri = { uri: string };*/
|
|
64
64
|
/*:: type FileData = Array<number> | Base64 | Blob | Uri;*/
|
|
65
|
+
/*:: export type FileSaveOptions = FullOptions & {
|
|
66
|
+
metadata?: { [key: string]: any },
|
|
67
|
+
tags?: { [key: string]: any },
|
|
68
|
+
};*/
|
|
65
69
|
/*:: export type FileSource =
|
|
66
70
|
| {
|
|
67
71
|
format: 'file',
|
|
@@ -7,13 +7,11 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
10
|
+
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
10
11
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
|
|
11
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
12
13
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
13
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
14
|
-
/**
|
|
15
|
-
* @flow
|
|
16
|
-
*/
|
|
17
15
|
/**
|
|
18
16
|
* Creates a new GeoPoint with any of the following forms:<br>
|
|
19
17
|
* <pre>
|
|
@@ -116,7 +114,7 @@ var ParseGeoPoint = /*#__PURE__*/function () {
|
|
|
116
114
|
}
|
|
117
115
|
}, {
|
|
118
116
|
key: "equals",
|
|
119
|
-
value: function (other /*:
|
|
117
|
+
value: function (other /*: any*/) /*: boolean*/{
|
|
120
118
|
return other instanceof ParseGeoPoint && this.latitude === other.latitude && this.longitude === other.longitude;
|
|
121
119
|
}
|
|
122
120
|
|
|
@@ -192,14 +190,20 @@ var ParseGeoPoint = /*#__PURE__*/function () {
|
|
|
192
190
|
/**
|
|
193
191
|
* Creates a GeoPoint with the user's current location, if available.
|
|
194
192
|
*
|
|
193
|
+
* @param {object} options The options.
|
|
194
|
+
* @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.
|
|
195
|
+
* @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.
|
|
196
|
+
* @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.
|
|
195
197
|
* @static
|
|
196
|
-
* @returns {Parse.GeoPoint} User's current location
|
|
198
|
+
* @returns {Promise<Parse.GeoPoint>} User's current location
|
|
197
199
|
*/
|
|
198
200
|
}, {
|
|
199
201
|
key: "current",
|
|
200
|
-
value: function () {
|
|
201
|
-
return
|
|
202
|
-
|
|
202
|
+
value: function (options) /*: Promise<ParseGeoPoint>*/{
|
|
203
|
+
return new _promise.default(function (resolve, reject) {
|
|
204
|
+
navigator.geolocation.getCurrentPosition(function (location) {
|
|
205
|
+
resolve(new ParseGeoPoint(location.coords.latitude, location.coords.longitude));
|
|
206
|
+
}, reject, options);
|
|
203
207
|
});
|
|
204
208
|
}
|
|
205
209
|
}]);
|
package/lib/weapp/ParseHooks.js
CHANGED
|
@@ -22,6 +22,8 @@ var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-st
|
|
|
22
22
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
23
23
|
var _decode = _interopRequireDefault(require("./decode"));
|
|
24
24
|
var _ParseError = _interopRequireDefault(require("./ParseError"));
|
|
25
|
+
/*:: export type HookDeclaration = { functionName: string, url: string } | { className: string, triggerName: string, url: string };*/
|
|
26
|
+
/*:: export type HookDeleteArg = { functionName: string } | { className: string, triggerName: string };*/
|
|
25
27
|
function getFunctions() {
|
|
26
28
|
return _CoreManager.default.getHooksController().get('functions');
|
|
27
29
|
}
|
|
@@ -7,12 +7,16 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
9
|
exports.default = void 0;
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs3/regenerator"));
|
|
11
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
|
|
10
12
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
|
|
11
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
12
13
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
14
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
15
|
+
var _get2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/get"));
|
|
13
16
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
|
|
14
17
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
|
|
15
18
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
|
|
19
|
+
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
16
20
|
var _ParseObject2 = _interopRequireDefault(require("./ParseObject"));
|
|
17
21
|
function _createSuper(Derived) {
|
|
18
22
|
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
@@ -38,25 +42,282 @@ function _isNativeReflectConstruct() {
|
|
|
38
42
|
} catch (e) {
|
|
39
43
|
return false;
|
|
40
44
|
}
|
|
41
|
-
}
|
|
42
|
-
|
|
45
|
+
}
|
|
46
|
+
var DEVICE_TYPES /*: DeviceInterface*/ = {
|
|
47
|
+
IOS: 'ios',
|
|
48
|
+
MACOS: 'macos',
|
|
49
|
+
TVOS: 'tvos',
|
|
50
|
+
FCM: 'fcm',
|
|
51
|
+
ANDROID: 'android',
|
|
52
|
+
WEB: 'web'
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Parse.Installation is a local representation of installation data that can be saved and retrieved from the Parse cloud.
|
|
57
|
+
* 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.
|
|
58
|
+
*
|
|
59
|
+
* <p>A valid Parse.Installation can only be instantiated via <code>Parse.Installation.currentInstallation()</code>
|
|
60
|
+
*
|
|
61
|
+
* Parse.Installation objects which have a valid <code>deviceToken</code> and are saved to the Parse cloud can be used to target push notifications.
|
|
62
|
+
* </p>
|
|
63
|
+
*
|
|
64
|
+
* @alias Parse.Installation
|
|
65
|
+
*/
|
|
66
|
+
var ParseInstallation = /*#__PURE__*/function (_ParseObject) {
|
|
67
|
+
(0, _inherits2.default)(ParseInstallation, _ParseObject);
|
|
68
|
+
var _super = _createSuper(ParseInstallation);
|
|
69
|
+
/**
|
|
70
|
+
* @param {object} attributes The initial set of data to store in the object.
|
|
43
71
|
*/
|
|
44
|
-
|
|
45
|
-
var Installation = /*#__PURE__*/function (_ParseObject) {
|
|
46
|
-
(0, _inherits2.default)(Installation, _ParseObject);
|
|
47
|
-
var _super = _createSuper(Installation);
|
|
48
|
-
function Installation(attributes /*: ?AttributeMap*/) {
|
|
72
|
+
function ParseInstallation(attributes /*:: ?: AttributeMap*/) {
|
|
49
73
|
var _this;
|
|
50
|
-
(0, _classCallCheck2.default)(this,
|
|
74
|
+
(0, _classCallCheck2.default)(this, ParseInstallation);
|
|
51
75
|
_this = _super.call(this, '_Installation');
|
|
52
76
|
if (attributes && (0, _typeof2.default)(attributes) === 'object') {
|
|
53
|
-
if (!_this.set(attributes
|
|
77
|
+
if (!_this.set(attributes)) {
|
|
54
78
|
throw new Error("Can't create an invalid Installation");
|
|
55
79
|
}
|
|
56
80
|
}
|
|
57
81
|
return _this;
|
|
58
82
|
}
|
|
59
|
-
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* A unique identifier for this installation’s client application. In iOS, this is the Bundle Identifier.
|
|
86
|
+
*
|
|
87
|
+
* @property {string} appIdentifier
|
|
88
|
+
* @static
|
|
89
|
+
*/
|
|
90
|
+
(0, _createClass2.default)(ParseInstallation, [{
|
|
91
|
+
key: "appIdentifier",
|
|
92
|
+
get: function () {
|
|
93
|
+
return this.get('appIdentifier');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The version string of the client application to which this installation belongs.
|
|
98
|
+
*
|
|
99
|
+
* @property {string} appVersion
|
|
100
|
+
* @static
|
|
101
|
+
*/
|
|
102
|
+
}, {
|
|
103
|
+
key: "appVersion",
|
|
104
|
+
get: function () {
|
|
105
|
+
return this.get('appVersion');
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* The display name of the client application to which this installation belongs.
|
|
110
|
+
*
|
|
111
|
+
* @property {string} appName
|
|
112
|
+
* @static
|
|
113
|
+
*/
|
|
114
|
+
}, {
|
|
115
|
+
key: "appName",
|
|
116
|
+
get: function () {
|
|
117
|
+
return this.get('appName');
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* The current value of the icon badge for iOS apps.
|
|
122
|
+
* Changes to this value on the server will be used
|
|
123
|
+
* for future badge-increment push notifications.
|
|
124
|
+
*
|
|
125
|
+
* @property {number} badge
|
|
126
|
+
* @static
|
|
127
|
+
*/
|
|
128
|
+
}, {
|
|
129
|
+
key: "badge",
|
|
130
|
+
get: function () {
|
|
131
|
+
return this.get('badge');
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* An array of the channels to which a device is currently subscribed.
|
|
136
|
+
*
|
|
137
|
+
* @property {string[]} channels
|
|
138
|
+
* @static
|
|
139
|
+
*/
|
|
140
|
+
}, {
|
|
141
|
+
key: "channels",
|
|
142
|
+
get: function () {
|
|
143
|
+
return this.get('channels');
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Token used to deliver push notifications to the device.
|
|
148
|
+
*
|
|
149
|
+
* @property {string} deviceToken
|
|
150
|
+
* @static
|
|
151
|
+
*/
|
|
152
|
+
}, {
|
|
153
|
+
key: "deviceToken",
|
|
154
|
+
get: function () {
|
|
155
|
+
return this.get('deviceToken');
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* The type of device, “ios”, “android”, “web”, etc.
|
|
160
|
+
*
|
|
161
|
+
* @property {string} deviceType
|
|
162
|
+
* @static
|
|
163
|
+
*/
|
|
164
|
+
}, {
|
|
165
|
+
key: "deviceType",
|
|
166
|
+
get: function () {
|
|
167
|
+
return this.get('deviceType');
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Gets the GCM sender identifier for this installation
|
|
172
|
+
*
|
|
173
|
+
* @property {string} GCMSenderId
|
|
174
|
+
* @static
|
|
175
|
+
*/
|
|
176
|
+
}, {
|
|
177
|
+
key: "GCMSenderId",
|
|
178
|
+
get: function () {
|
|
179
|
+
return this.get('GCMSenderId');
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Universally Unique Identifier (UUID) for the device used by Parse. It must be unique across all of an app’s installations.
|
|
184
|
+
*
|
|
185
|
+
* @property {string} installationId
|
|
186
|
+
* @static
|
|
187
|
+
*/
|
|
188
|
+
}, {
|
|
189
|
+
key: "installationId",
|
|
190
|
+
get: function () {
|
|
191
|
+
return this.get('installationId');
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Gets the local identifier for this installation
|
|
196
|
+
*
|
|
197
|
+
* @property {string} localeIdentifier
|
|
198
|
+
* @static
|
|
199
|
+
*/
|
|
200
|
+
}, {
|
|
201
|
+
key: "localeIdentifier",
|
|
202
|
+
get: function () {
|
|
203
|
+
return this.get('localeIdentifier');
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Gets the parse server version for this installation
|
|
208
|
+
*
|
|
209
|
+
* @property {string} parseVersion
|
|
210
|
+
* @static
|
|
211
|
+
*/
|
|
212
|
+
}, {
|
|
213
|
+
key: "parseVersion",
|
|
214
|
+
get: function () {
|
|
215
|
+
return this.get('parseVersion');
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* This field is reserved for directing Parse to the push delivery network to be used.
|
|
220
|
+
*
|
|
221
|
+
* @property {string} pushType
|
|
222
|
+
* @static
|
|
223
|
+
*/
|
|
224
|
+
}, {
|
|
225
|
+
key: "pushType",
|
|
226
|
+
get: function () {
|
|
227
|
+
return this.get('pushType');
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Gets the time zone for this installation
|
|
232
|
+
*
|
|
233
|
+
* @property {string} timeZone
|
|
234
|
+
* @static
|
|
235
|
+
*/
|
|
236
|
+
}, {
|
|
237
|
+
key: "timeZone",
|
|
238
|
+
get: function () {
|
|
239
|
+
return this.get('timeZone');
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Returns the device types for used for Push Notifications.
|
|
244
|
+
*
|
|
245
|
+
* <pre>
|
|
246
|
+
* Parse.Installation.DEVICE_TYPES.IOS
|
|
247
|
+
* Parse.Installation.DEVICE_TYPES.MACOS
|
|
248
|
+
* Parse.Installation.DEVICE_TYPES.TVOS
|
|
249
|
+
* Parse.Installation.DEVICE_TYPES.FCM
|
|
250
|
+
* Parse.Installation.DEVICE_TYPES.ANDROID
|
|
251
|
+
* Parse.Installation.DEVICE_TYPES.WEB
|
|
252
|
+
* </pre
|
|
253
|
+
*
|
|
254
|
+
* @property {Object} DEVICE_TYPES
|
|
255
|
+
* @static
|
|
256
|
+
*/
|
|
257
|
+
}, {
|
|
258
|
+
key: "save",
|
|
259
|
+
value:
|
|
260
|
+
/**
|
|
261
|
+
* Wrap the default save behavior with functionality to save to local storage.
|
|
262
|
+
*
|
|
263
|
+
* @param {...any} args
|
|
264
|
+
* @returns {Promise}
|
|
265
|
+
*/
|
|
266
|
+
function () {
|
|
267
|
+
var _save = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
268
|
+
var _len,
|
|
269
|
+
args,
|
|
270
|
+
_key,
|
|
271
|
+
_args = arguments;
|
|
272
|
+
return _regenerator.default.wrap(function (_context) {
|
|
273
|
+
while (1) switch (_context.prev = _context.next) {
|
|
274
|
+
case 0:
|
|
275
|
+
for (_len = _args.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
276
|
+
args[_key] = _args[_key];
|
|
277
|
+
}
|
|
278
|
+
_context.next = 3;
|
|
279
|
+
return (0, _get2.default)((0, _getPrototypeOf2.default)(ParseInstallation.prototype), "save", this).apply(this, args);
|
|
280
|
+
case 3:
|
|
281
|
+
_context.next = 5;
|
|
282
|
+
return _CoreManager.default.getInstallationController().updateInstallationOnDisk(this);
|
|
283
|
+
case 5:
|
|
284
|
+
return _context.abrupt("return", this);
|
|
285
|
+
case 6:
|
|
286
|
+
case "end":
|
|
287
|
+
return _context.stop();
|
|
288
|
+
}
|
|
289
|
+
}, _callee, this);
|
|
290
|
+
}));
|
|
291
|
+
function save() {
|
|
292
|
+
return _save.apply(this, arguments);
|
|
293
|
+
}
|
|
294
|
+
return save;
|
|
295
|
+
}()
|
|
296
|
+
/**
|
|
297
|
+
* Get the current Parse.Installation from disk. If doesn't exists, create an new installation.
|
|
298
|
+
*
|
|
299
|
+
* <pre>
|
|
300
|
+
* const installation = await Parse.Installation.currentInstallation();
|
|
301
|
+
* installation.set('deviceToken', '123');
|
|
302
|
+
* await installation.save();
|
|
303
|
+
* </pre>
|
|
304
|
+
*
|
|
305
|
+
* @returns {Promise} A promise that resolves to the local installation object.
|
|
306
|
+
*/
|
|
307
|
+
}], [{
|
|
308
|
+
key: "DEVICE_TYPES",
|
|
309
|
+
get: function () /*: DeviceInterface*/{
|
|
310
|
+
return DEVICE_TYPES;
|
|
311
|
+
}
|
|
312
|
+
}, {
|
|
313
|
+
key: "currentInstallation",
|
|
314
|
+
value: function () /*: Promise<ParseInstallation>*/{
|
|
315
|
+
return _CoreManager.default.getInstallationController().currentInstallation();
|
|
316
|
+
}
|
|
317
|
+
}]);
|
|
318
|
+
return ParseInstallation;
|
|
60
319
|
}(_ParseObject2.default);
|
|
61
|
-
|
|
62
|
-
|
|
320
|
+
_ParseObject2.default.registerSubclass('_Installation', ParseInstallation);
|
|
321
|
+
module.exports = ParseInstallation;
|
|
322
|
+
var _default = ParseInstallation;
|
|
323
|
+
exports.default = _default;
|