parse 5.1.0-alpha.1 → 5.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 +13 -0
- package/dist/parse.js +738 -672
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +724 -658
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/CoreManager.js +1 -1
- package/lib/browser/LiveQueryClient.js +1 -3
- package/lib/browser/LocalDatastoreController.default.js +248 -0
- package/lib/browser/LocalDatastoreController.js +1 -246
- package/lib/browser/OfflineQuery.js +3 -2
- package/lib/browser/Parse.js +18 -4
- package/lib/browser/ParseUser.js +50 -15
- package/lib/browser/RESTController.js +0 -3
- package/lib/browser/Storage.js +1 -2
- package/lib/browser/StorageController.js +3 -0
- package/lib/browser/WebSocketController.js +13 -0
- package/lib/node/CoreManager.js +1 -1
- package/lib/node/LiveQueryClient.js +0 -3
- package/lib/node/LocalDatastoreController.default.js +67 -0
- package/lib/node/LocalDatastoreController.js +1 -65
- package/lib/node/OfflineQuery.js +3 -2
- package/lib/node/Parse.js +18 -4
- package/lib/node/ParseUser.js +19 -13
- package/lib/node/RESTController.js +0 -3
- package/lib/node/Storage.js +1 -2
- package/lib/node/StorageController.js +3 -0
- package/lib/node/WebSocketController.js +10 -0
- package/lib/react-native/CoreManager.js +1 -1
- package/lib/react-native/LiveQueryClient.js +0 -1
- package/lib/react-native/LocalDatastoreController.default.js +91 -0
- package/lib/react-native/LocalDatastoreController.js +1 -91
- package/lib/react-native/OfflineQuery.js +3 -2
- package/lib/react-native/Parse.js +14 -4
- package/lib/react-native/ParseUser.js +5 -2
- package/lib/react-native/RESTController.js +0 -3
- 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/weapp/CoreManager.js +1 -1
- package/lib/weapp/LiveQueryClient.js +1 -3
- package/lib/weapp/LocalDatastoreController.default.js +248 -0
- package/lib/weapp/LocalDatastoreController.js +1 -246
- package/lib/weapp/OfflineQuery.js +3 -2
- package/lib/weapp/Parse.js +18 -4
- package/lib/weapp/ParseUser.js +50 -15
- package/lib/weapp/RESTController.js +0 -3
- package/lib/weapp/Storage.js +1 -2
- package/lib/weapp/StorageController.js +3 -0
- package/lib/weapp/WebSocketController.js +13 -0
- package/package.json +1 -1
package/lib/browser/ParseUser.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Reflect$construct = require("@babel/runtime-corejs3/core-js-stable/reflect/construct");
|
|
4
|
+
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
|
5
|
+
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
|
|
6
|
+
var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
|
|
7
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
8
|
+
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
|
9
|
+
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
|
|
10
|
+
var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
|
|
4
11
|
var _Object$defineProperty2 = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
5
12
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
13
|
_Object$defineProperty2(exports, "__esModule", {
|
|
@@ -9,8 +16,9 @@ _Object$defineProperty2(exports, "__esModule", {
|
|
|
9
16
|
exports.default = void 0;
|
|
10
17
|
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs3/regenerator"));
|
|
11
18
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
12
|
-
var
|
|
19
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/define-property"));
|
|
13
20
|
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/json/stringify"));
|
|
21
|
+
var _defineProperty3 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
14
22
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
|
|
15
23
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
|
|
16
24
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
@@ -25,6 +33,28 @@ var _ParseError = _interopRequireDefault(require("./ParseError"));
|
|
|
25
33
|
var _ParseObject2 = _interopRequireDefault(require("./ParseObject"));
|
|
26
34
|
var _ParseSession = _interopRequireDefault(require("./ParseSession"));
|
|
27
35
|
var _Storage = _interopRequireDefault(require("./Storage"));
|
|
36
|
+
function ownKeys(object, enumerableOnly) {
|
|
37
|
+
var keys = _Object$keys(object);
|
|
38
|
+
if (_Object$getOwnPropertySymbols) {
|
|
39
|
+
var symbols = _Object$getOwnPropertySymbols(object);
|
|
40
|
+
enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) {
|
|
41
|
+
return _Object$getOwnPropertyDescriptor(object, sym).enumerable;
|
|
42
|
+
})), keys.push.apply(keys, symbols);
|
|
43
|
+
}
|
|
44
|
+
return keys;
|
|
45
|
+
}
|
|
46
|
+
function _objectSpread(target) {
|
|
47
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
48
|
+
var _context7, _context8;
|
|
49
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
50
|
+
i % 2 ? _forEachInstanceProperty(_context7 = ownKeys(Object(source), !0)).call(_context7, function (key) {
|
|
51
|
+
(0, _defineProperty3.default)(target, key, source[key]);
|
|
52
|
+
}) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context8 = ownKeys(Object(source))).call(_context8, function (key) {
|
|
53
|
+
_Object$defineProperty2(target, key, _Object$getOwnPropertyDescriptor(source, key));
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return target;
|
|
57
|
+
}
|
|
28
58
|
function _createSuper(Derived) {
|
|
29
59
|
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
30
60
|
return function () {
|
|
@@ -761,10 +791,11 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
761
791
|
/**
|
|
762
792
|
* Verify whether a given password is the password of the current user.
|
|
763
793
|
*
|
|
764
|
-
* @param {string} password
|
|
765
|
-
* @param {object} options
|
|
766
|
-
* @
|
|
767
|
-
*
|
|
794
|
+
* @param {string} password The password to be verified.
|
|
795
|
+
* @param {object} options The options.
|
|
796
|
+
* @param {boolean} [options.ignoreEmailVerification=false] Set to `true` to bypass email verification and verify
|
|
797
|
+
* the password regardless of whether the email has been verified. This requires the master key.
|
|
798
|
+
* @returns {Promise} A promise that is fulfilled with a user when the password is correct.
|
|
768
799
|
*/
|
|
769
800
|
}, {
|
|
770
801
|
key: "verifyPassword",
|
|
@@ -792,7 +823,7 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
792
823
|
if (protoProps) {
|
|
793
824
|
for (var _prop in protoProps) {
|
|
794
825
|
if (_prop !== 'className') {
|
|
795
|
-
(0,
|
|
826
|
+
(0, _defineProperty2.default)(ParseUser.prototype, _prop, {
|
|
796
827
|
value: protoProps[_prop],
|
|
797
828
|
enumerable: false,
|
|
798
829
|
writable: true,
|
|
@@ -804,7 +835,7 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
804
835
|
if (classProps) {
|
|
805
836
|
for (var _prop2 in classProps) {
|
|
806
837
|
if (_prop2 !== 'className') {
|
|
807
|
-
(0,
|
|
838
|
+
(0, _defineProperty2.default)(ParseUser, _prop2, {
|
|
808
839
|
value: classProps[_prop2],
|
|
809
840
|
enumerable: false,
|
|
810
841
|
writable: true,
|
|
@@ -1107,13 +1138,14 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1107
1138
|
|
|
1108
1139
|
/**
|
|
1109
1140
|
* Verify whether a given password is the password of the current user.
|
|
1110
|
-
*
|
|
1111
|
-
* @param {string} username A username to be used for identificaiton
|
|
1112
|
-
* @param {string} password A password to be verified
|
|
1113
|
-
* @param {object} options
|
|
1114
1141
|
* @static
|
|
1115
|
-
*
|
|
1116
|
-
*
|
|
1142
|
+
*
|
|
1143
|
+
* @param {string} username The username of the user whose password should be verified.
|
|
1144
|
+
* @param {string} password The password to be verified.
|
|
1145
|
+
* @param {object} options The options.
|
|
1146
|
+
* @param {boolean} [options.ignoreEmailVerification=false] Set to `true` to bypass email verification and verify
|
|
1147
|
+
* the password regardless of whether the email has been verified. This requires the master key.
|
|
1148
|
+
* @returns {Promise} A promise that is fulfilled with a user when the password is correct.
|
|
1117
1149
|
*/
|
|
1118
1150
|
}, {
|
|
1119
1151
|
key: "verifyPassword",
|
|
@@ -1524,10 +1556,13 @@ var DefaultController = {
|
|
|
1524
1556
|
},
|
|
1525
1557
|
verifyPassword: function (username /*: string*/, password /*: string*/, options /*: RequestOptions*/) {
|
|
1526
1558
|
var RESTController = _CoreManager.default.getRESTController();
|
|
1527
|
-
|
|
1559
|
+
var data = _objectSpread({
|
|
1528
1560
|
username: username,
|
|
1529
1561
|
password: password
|
|
1530
|
-
}, options
|
|
1562
|
+
}, options.ignoreEmailVerification !== undefined && {
|
|
1563
|
+
ignoreEmailVerification: options.ignoreEmailVerification
|
|
1564
|
+
});
|
|
1565
|
+
return RESTController.request('GET', 'verifyPassword', data, options);
|
|
1531
1566
|
},
|
|
1532
1567
|
requestEmailVerification: function (email /*: string*/, options /*: RequestOptions*/) {
|
|
1533
1568
|
var RESTController = _CoreManager.default.getRESTController();
|
|
@@ -272,9 +272,6 @@ var RESTController = {
|
|
|
272
272
|
throw new Error('Cannot use the Master Key, it has not been provided.');
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
|
-
if (options.ignoreEmailVerification !== undefined) {
|
|
276
|
-
payload.ignoreEmailVerification = options.ignoreEmailVerification;
|
|
277
|
-
}
|
|
278
275
|
if (_CoreManager.default.get('FORCE_REVOCABLE_SESSION')) {
|
|
279
276
|
payload._RevocableSession = '1';
|
|
280
277
|
}
|
package/lib/browser/Storage.js
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
|
|
5
|
+
/* global WebSocket */
|
|
6
|
+
|
|
7
|
+
var WebSocketController;
|
|
8
|
+
try {
|
|
9
|
+
WebSocketController = typeof WebSocket === 'function' || (typeof WebSocket === "undefined" ? "undefined" : (0, _typeof2.default)(WebSocket)) === 'object' ? WebSocket : null;
|
|
10
|
+
} catch (_) {
|
|
11
|
+
// WebSocket unavailable
|
|
12
|
+
}
|
|
13
|
+
module.exports = WebSocketController;
|
package/lib/node/CoreManager.js
CHANGED
|
@@ -183,7 +183,7 @@ const config /*: Config & { [key: string]: mixed }*/ = {
|
|
|
183
183
|
SERVER_AUTH_TOKEN: null,
|
|
184
184
|
LIVEQUERY_SERVER_URL: null,
|
|
185
185
|
ENCRYPTED_KEY: null,
|
|
186
|
-
VERSION: 'js' + "5.1.0-alpha.
|
|
186
|
+
VERSION: 'js' + "5.1.0-alpha.3",
|
|
187
187
|
APPLICATION_ID: null,
|
|
188
188
|
JAVASCRIPT_KEY: null,
|
|
189
189
|
MASTER_KEY: null,
|
|
@@ -14,8 +14,6 @@ function _interopRequireDefault(obj) {
|
|
|
14
14
|
default: obj
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
/* global WebSocket */
|
|
18
|
-
|
|
19
17
|
// The LiveQuery client inner state
|
|
20
18
|
const CLIENT_STATE = {
|
|
21
19
|
INITIALIZED: 'initialized',
|
|
@@ -481,6 +479,5 @@ class LiveQueryClient {
|
|
|
481
479
|
}).bind(this), time);
|
|
482
480
|
}
|
|
483
481
|
}
|
|
484
|
-
_CoreManager.default.setWebSocketController(require('ws'));
|
|
485
482
|
var _default = LiveQueryClient;
|
|
486
483
|
exports.default = _default;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _LocalDatastoreUtils = require("./LocalDatastoreUtils");
|
|
4
|
+
var _Storage = _interopRequireDefault(require("./Storage"));
|
|
5
|
+
function _interopRequireDefault(obj) {
|
|
6
|
+
return obj && obj.__esModule ? obj : {
|
|
7
|
+
default: obj
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @flow
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const LocalDatastoreController = {
|
|
15
|
+
async fromPinWithName(name /*: string*/) /*: Array<Object>*/{
|
|
16
|
+
const values = await _Storage.default.getItemAsync(name);
|
|
17
|
+
if (!values) {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
const objects = JSON.parse(values);
|
|
21
|
+
return objects;
|
|
22
|
+
},
|
|
23
|
+
pinWithName(name /*: string*/, value /*: any*/) {
|
|
24
|
+
const values = JSON.stringify(value);
|
|
25
|
+
return _Storage.default.setItemAsync(name, values);
|
|
26
|
+
},
|
|
27
|
+
unPinWithName(name /*: string*/) {
|
|
28
|
+
return _Storage.default.removeItemAsync(name);
|
|
29
|
+
},
|
|
30
|
+
async getAllContents() /*: Object*/{
|
|
31
|
+
const keys = await _Storage.default.getAllKeysAsync();
|
|
32
|
+
return keys.reduce(async (previousPromise, key) => {
|
|
33
|
+
const LDS = await previousPromise;
|
|
34
|
+
if ((0, _LocalDatastoreUtils.isLocalDatastoreKey)(key)) {
|
|
35
|
+
const value = await _Storage.default.getItemAsync(key);
|
|
36
|
+
try {
|
|
37
|
+
LDS[key] = JSON.parse(value);
|
|
38
|
+
} catch (error) {
|
|
39
|
+
console.error('Error getAllContents: ', error);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return LDS;
|
|
43
|
+
}, Promise.resolve({}));
|
|
44
|
+
},
|
|
45
|
+
// Used for testing
|
|
46
|
+
async getRawStorage() /*: Object*/{
|
|
47
|
+
const keys = await _Storage.default.getAllKeysAsync();
|
|
48
|
+
return keys.reduce(async (previousPromise, key) => {
|
|
49
|
+
const LDS = await previousPromise;
|
|
50
|
+
const value = await _Storage.default.getItemAsync(key);
|
|
51
|
+
LDS[key] = value;
|
|
52
|
+
return LDS;
|
|
53
|
+
}, Promise.resolve({}));
|
|
54
|
+
},
|
|
55
|
+
async clear() /*: Promise*/{
|
|
56
|
+
const keys = await _Storage.default.getAllKeysAsync();
|
|
57
|
+
const toRemove = [];
|
|
58
|
+
for (const key of keys) {
|
|
59
|
+
if ((0, _LocalDatastoreUtils.isLocalDatastoreKey)(key)) {
|
|
60
|
+
toRemove.push(key);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const promises = toRemove.map(this.unPinWithName);
|
|
64
|
+
return Promise.all(promises);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
module.exports = LocalDatastoreController;
|
|
@@ -1,67 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
var _Storage = _interopRequireDefault(require("./Storage"));
|
|
5
|
-
function _interopRequireDefault(obj) {
|
|
6
|
-
return obj && obj.__esModule ? obj : {
|
|
7
|
-
default: obj
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* @flow
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
const LocalDatastoreController = {
|
|
15
|
-
async fromPinWithName(name /*: string*/) /*: Array<Object>*/{
|
|
16
|
-
const values = await _Storage.default.getItemAsync(name);
|
|
17
|
-
if (!values) {
|
|
18
|
-
return [];
|
|
19
|
-
}
|
|
20
|
-
const objects = JSON.parse(values);
|
|
21
|
-
return objects;
|
|
22
|
-
},
|
|
23
|
-
pinWithName(name /*: string*/, value /*: any*/) {
|
|
24
|
-
const values = JSON.stringify(value);
|
|
25
|
-
return _Storage.default.setItemAsync(name, values);
|
|
26
|
-
},
|
|
27
|
-
unPinWithName(name /*: string*/) {
|
|
28
|
-
return _Storage.default.removeItemAsync(name);
|
|
29
|
-
},
|
|
30
|
-
async getAllContents() /*: Object*/{
|
|
31
|
-
const keys = await _Storage.default.getAllKeysAsync();
|
|
32
|
-
return keys.reduce(async (previousPromise, key) => {
|
|
33
|
-
const LDS = await previousPromise;
|
|
34
|
-
if ((0, _LocalDatastoreUtils.isLocalDatastoreKey)(key)) {
|
|
35
|
-
const value = await _Storage.default.getItemAsync(key);
|
|
36
|
-
try {
|
|
37
|
-
LDS[key] = JSON.parse(value);
|
|
38
|
-
} catch (error) {
|
|
39
|
-
console.error('Error getAllContents: ', error);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return LDS;
|
|
43
|
-
}, Promise.resolve({}));
|
|
44
|
-
},
|
|
45
|
-
// Used for testing
|
|
46
|
-
async getRawStorage() /*: Object*/{
|
|
47
|
-
const keys = await _Storage.default.getAllKeysAsync();
|
|
48
|
-
return keys.reduce(async (previousPromise, key) => {
|
|
49
|
-
const LDS = await previousPromise;
|
|
50
|
-
const value = await _Storage.default.getItemAsync(key);
|
|
51
|
-
LDS[key] = value;
|
|
52
|
-
return LDS;
|
|
53
|
-
}, Promise.resolve({}));
|
|
54
|
-
},
|
|
55
|
-
async clear() /*: Promise*/{
|
|
56
|
-
const keys = await _Storage.default.getAllKeysAsync();
|
|
57
|
-
const toRemove = [];
|
|
58
|
-
for (const key of keys) {
|
|
59
|
-
if ((0, _LocalDatastoreUtils.isLocalDatastoreKey)(key)) {
|
|
60
|
-
toRemove.push(key);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
const promises = toRemove.map(this.unPinWithName);
|
|
64
|
-
return Promise.all(promises);
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
module.exports = LocalDatastoreController;
|
|
3
|
+
module.exports = require('./LocalDatastoreController.default');
|
package/lib/node/OfflineQuery.js
CHANGED
|
@@ -288,12 +288,13 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
|
|
|
288
288
|
}
|
|
289
289
|
// More complex cases
|
|
290
290
|
for (const condition in constraints) {
|
|
291
|
+
var _compareTo, _compareTo2;
|
|
291
292
|
compareTo = constraints[condition];
|
|
292
|
-
if (compareTo.__type) {
|
|
293
|
+
if ((_compareTo = compareTo) !== null && _compareTo !== void 0 && _compareTo.__type) {
|
|
293
294
|
compareTo = decode(compareTo);
|
|
294
295
|
}
|
|
295
296
|
// is it a $relativeTime? convert to date
|
|
296
|
-
if (compareTo['$relativeTime']) {
|
|
297
|
+
if ((_compareTo2 = compareTo) !== null && _compareTo2 !== void 0 && _compareTo2['$relativeTime']) {
|
|
297
298
|
const parserResult = relativeTimeToDate(compareTo['$relativeTime']);
|
|
298
299
|
if (parserResult.status !== 'success') {
|
|
299
300
|
throw new ParseError(ParseError.INVALID_JSON, `bad $relativeTime (${key}) value. ${parserResult.info}`);
|
package/lib/node/Parse.js
CHANGED
|
@@ -38,6 +38,9 @@ var _Storage = _interopRequireDefault(require("./Storage"));
|
|
|
38
38
|
var _ParseUser = _interopRequireDefault(require("./ParseUser"));
|
|
39
39
|
var _ParseLiveQuery = _interopRequireDefault(require("./ParseLiveQuery"));
|
|
40
40
|
var _LiveQueryClient = _interopRequireDefault(require("./LiveQueryClient"));
|
|
41
|
+
var _LocalDatastoreController = _interopRequireDefault(require("./LocalDatastoreController"));
|
|
42
|
+
var _StorageController = _interopRequireDefault(require("./StorageController"));
|
|
43
|
+
var _WebSocketController = _interopRequireDefault(require("./WebSocketController"));
|
|
41
44
|
function _getRequireWildcardCache(nodeInterop) {
|
|
42
45
|
if (typeof WeakMap !== "function") return null;
|
|
43
46
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -126,7 +129,6 @@ const Parse /*: ParseType*/ = {
|
|
|
126
129
|
Storage: _Storage.default,
|
|
127
130
|
User: _ParseUser.default,
|
|
128
131
|
LiveQueryClient: _LiveQueryClient.default,
|
|
129
|
-
LiveQuery: undefined,
|
|
130
132
|
IndexedDB: undefined,
|
|
131
133
|
Hooks: undefined,
|
|
132
134
|
Parse: undefined,
|
|
@@ -147,8 +149,11 @@ const Parse /*: ParseType*/ = {
|
|
|
147
149
|
_CoreManager.default.set('MASTER_KEY', masterKey);
|
|
148
150
|
_CoreManager.default.set('USE_MASTER_KEY', false);
|
|
149
151
|
_CoreManager.default.setIfNeeded('EventEmitter', _EventEmitter.default);
|
|
150
|
-
|
|
151
|
-
_CoreManager.default.setIfNeeded('
|
|
152
|
+
_CoreManager.default.setIfNeeded('LiveQuery', new _ParseLiveQuery.default());
|
|
153
|
+
_CoreManager.default.setIfNeeded('CryptoController', _CryptoController.default);
|
|
154
|
+
_CoreManager.default.setIfNeeded('LocalDatastoreController', _LocalDatastoreController.default);
|
|
155
|
+
_CoreManager.default.setIfNeeded('StorageController', _StorageController.default);
|
|
156
|
+
_CoreManager.default.setIfNeeded('WebSocketController', _WebSocketController.default);
|
|
152
157
|
},
|
|
153
158
|
/**
|
|
154
159
|
* Call this method to set your AsyncStorage engine
|
|
@@ -240,6 +245,16 @@ const Parse /*: ParseType*/ = {
|
|
|
240
245
|
get serverAuthType() {
|
|
241
246
|
return _CoreManager.default.get('SERVER_AUTH_TYPE');
|
|
242
247
|
},
|
|
248
|
+
/**
|
|
249
|
+
* @member {ParseLiveQuery} Parse.LiveQuery
|
|
250
|
+
* @static
|
|
251
|
+
*/
|
|
252
|
+
set LiveQuery(liveQuery /*: ParseLiveQuery*/) {
|
|
253
|
+
_CoreManager.default.setLiveQuery(liveQuery);
|
|
254
|
+
},
|
|
255
|
+
get LiveQuery() {
|
|
256
|
+
return _CoreManager.default.getLiveQuery();
|
|
257
|
+
},
|
|
243
258
|
/**
|
|
244
259
|
* @member {string} Parse.liveQueryServerURL
|
|
245
260
|
* @static
|
|
@@ -372,7 +387,6 @@ const Parse /*: ParseType*/ = {
|
|
|
372
387
|
return this.encryptedUser;
|
|
373
388
|
}
|
|
374
389
|
};
|
|
375
|
-
_CoreManager.default.setCryptoController(_CryptoController.default);
|
|
376
390
|
_CoreManager.default.setInstallationController(_InstallationController.default);
|
|
377
391
|
_CoreManager.default.setRESTController(_RESTController.default);
|
|
378
392
|
Parse.initialize = Parse._initialize;
|
package/lib/node/ParseUser.js
CHANGED
|
@@ -528,10 +528,11 @@ class ParseUser extends _ParseObject.default {
|
|
|
528
528
|
/**
|
|
529
529
|
* Verify whether a given password is the password of the current user.
|
|
530
530
|
*
|
|
531
|
-
* @param {string} password
|
|
532
|
-
* @param {object} options
|
|
533
|
-
* @
|
|
534
|
-
*
|
|
531
|
+
* @param {string} password The password to be verified.
|
|
532
|
+
* @param {object} options The options.
|
|
533
|
+
* @param {boolean} [options.ignoreEmailVerification=false] Set to `true` to bypass email verification and verify
|
|
534
|
+
* the password regardless of whether the email has been verified. This requires the master key.
|
|
535
|
+
* @returns {Promise} A promise that is fulfilled with a user when the password is correct.
|
|
535
536
|
*/
|
|
536
537
|
verifyPassword(password /*: string*/, options /*:: ?: RequestOptions*/) /*: Promise<ParseUser>*/{
|
|
537
538
|
const username = this.getUsername() || '';
|
|
@@ -840,13 +841,14 @@ class ParseUser extends _ParseObject.default {
|
|
|
840
841
|
|
|
841
842
|
/**
|
|
842
843
|
* Verify whether a given password is the password of the current user.
|
|
843
|
-
*
|
|
844
|
-
* @param {string} username A username to be used for identificaiton
|
|
845
|
-
* @param {string} password A password to be verified
|
|
846
|
-
* @param {object} options
|
|
847
844
|
* @static
|
|
848
|
-
*
|
|
849
|
-
*
|
|
845
|
+
*
|
|
846
|
+
* @param {string} username The username of the user whose password should be verified.
|
|
847
|
+
* @param {string} password The password to be verified.
|
|
848
|
+
* @param {object} options The options.
|
|
849
|
+
* @param {boolean} [options.ignoreEmailVerification=false] Set to `true` to bypass email verification and verify
|
|
850
|
+
* the password regardless of whether the email has been verified. This requires the master key.
|
|
851
|
+
* @returns {Promise} A promise that is fulfilled with a user when the password is correct.
|
|
850
852
|
*/
|
|
851
853
|
static verifyPassword(username /*: string*/, password /*: string*/, options /*:: ?: RequestOptions*/) {
|
|
852
854
|
if (typeof username !== 'string') {
|
|
@@ -1214,10 +1216,14 @@ const DefaultController = {
|
|
|
1214
1216
|
},
|
|
1215
1217
|
verifyPassword(username /*: string*/, password /*: string*/, options /*: RequestOptions*/) {
|
|
1216
1218
|
const RESTController = _CoreManager.default.getRESTController();
|
|
1217
|
-
|
|
1219
|
+
const data = {
|
|
1218
1220
|
username,
|
|
1219
|
-
password
|
|
1220
|
-
|
|
1221
|
+
password,
|
|
1222
|
+
...(options.ignoreEmailVerification !== undefined && {
|
|
1223
|
+
ignoreEmailVerification: options.ignoreEmailVerification
|
|
1224
|
+
})
|
|
1225
|
+
};
|
|
1226
|
+
return RESTController.request('GET', 'verifyPassword', data, options);
|
|
1221
1227
|
},
|
|
1222
1228
|
requestEmailVerification(email /*: string*/, options /*: RequestOptions*/) {
|
|
1223
1229
|
const RESTController = _CoreManager.default.getRESTController();
|
|
@@ -240,9 +240,6 @@ const RESTController = {
|
|
|
240
240
|
throw new Error('Cannot use the Master Key, it has not been provided.');
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
|
-
if (options.ignoreEmailVerification !== undefined) {
|
|
244
|
-
payload.ignoreEmailVerification = options.ignoreEmailVerification;
|
|
245
|
-
}
|
|
246
243
|
if (_CoreManager.default.get('FORCE_REVOCABLE_SESSION')) {
|
|
247
244
|
payload._RevocableSession = '1';
|
|
248
245
|
}
|
package/lib/node/Storage.js
CHANGED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
3
|
+
var _LocalDatastoreUtils = require("./LocalDatastoreUtils");
|
|
4
|
+
var _Storage = _interopRequireDefault(require("./Storage"));
|
|
5
|
+
var LocalDatastoreController = {
|
|
6
|
+
fromPinWithName: function () {
|
|
7
|
+
var _fromPinWithName = (0, _asyncToGenerator2.default)(function* (name) {
|
|
8
|
+
var values = yield _Storage.default.getItemAsync(name);
|
|
9
|
+
if (!values) {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
var objects = JSON.parse(values);
|
|
13
|
+
return objects;
|
|
14
|
+
});
|
|
15
|
+
function fromPinWithName() {
|
|
16
|
+
return _fromPinWithName.apply(this, arguments);
|
|
17
|
+
}
|
|
18
|
+
return fromPinWithName;
|
|
19
|
+
}(),
|
|
20
|
+
pinWithName: function (name, value) {
|
|
21
|
+
var values = JSON.stringify(value);
|
|
22
|
+
return _Storage.default.setItemAsync(name, values);
|
|
23
|
+
},
|
|
24
|
+
unPinWithName: function (name) {
|
|
25
|
+
return _Storage.default.removeItemAsync(name);
|
|
26
|
+
},
|
|
27
|
+
getAllContents: function () {
|
|
28
|
+
var _getAllContents = (0, _asyncToGenerator2.default)(function* () {
|
|
29
|
+
var keys = yield _Storage.default.getAllKeysAsync();
|
|
30
|
+
return keys.reduce(function () {
|
|
31
|
+
var _ref = (0, _asyncToGenerator2.default)(function* (previousPromise, key) {
|
|
32
|
+
var LDS = yield previousPromise;
|
|
33
|
+
if ((0, _LocalDatastoreUtils.isLocalDatastoreKey)(key)) {
|
|
34
|
+
var value = yield _Storage.default.getItemAsync(key);
|
|
35
|
+
try {
|
|
36
|
+
LDS[key] = JSON.parse(value);
|
|
37
|
+
} catch (error) {
|
|
38
|
+
console.error('Error getAllContents: ', error);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return LDS;
|
|
42
|
+
});
|
|
43
|
+
return function () {
|
|
44
|
+
return _ref.apply(this, arguments);
|
|
45
|
+
};
|
|
46
|
+
}(), Promise.resolve({}));
|
|
47
|
+
});
|
|
48
|
+
function getAllContents() {
|
|
49
|
+
return _getAllContents.apply(this, arguments);
|
|
50
|
+
}
|
|
51
|
+
return getAllContents;
|
|
52
|
+
}(),
|
|
53
|
+
getRawStorage: function () {
|
|
54
|
+
var _getRawStorage = (0, _asyncToGenerator2.default)(function* () {
|
|
55
|
+
var keys = yield _Storage.default.getAllKeysAsync();
|
|
56
|
+
return keys.reduce(function () {
|
|
57
|
+
var _ref2 = (0, _asyncToGenerator2.default)(function* (previousPromise, key) {
|
|
58
|
+
var LDS = yield previousPromise;
|
|
59
|
+
var value = yield _Storage.default.getItemAsync(key);
|
|
60
|
+
LDS[key] = value;
|
|
61
|
+
return LDS;
|
|
62
|
+
});
|
|
63
|
+
return function () {
|
|
64
|
+
return _ref2.apply(this, arguments);
|
|
65
|
+
};
|
|
66
|
+
}(), Promise.resolve({}));
|
|
67
|
+
});
|
|
68
|
+
function getRawStorage() {
|
|
69
|
+
return _getRawStorage.apply(this, arguments);
|
|
70
|
+
}
|
|
71
|
+
return getRawStorage;
|
|
72
|
+
}(),
|
|
73
|
+
clear: function () {
|
|
74
|
+
var _clear = (0, _asyncToGenerator2.default)(function* () {
|
|
75
|
+
var keys = yield _Storage.default.getAllKeysAsync();
|
|
76
|
+
var toRemove = [];
|
|
77
|
+
for (var key of keys) {
|
|
78
|
+
if ((0, _LocalDatastoreUtils.isLocalDatastoreKey)(key)) {
|
|
79
|
+
toRemove.push(key);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
var promises = toRemove.map(this.unPinWithName);
|
|
83
|
+
return Promise.all(promises);
|
|
84
|
+
});
|
|
85
|
+
function clear() {
|
|
86
|
+
return _clear.apply(this, arguments);
|
|
87
|
+
}
|
|
88
|
+
return clear;
|
|
89
|
+
}()
|
|
90
|
+
};
|
|
91
|
+
module.exports = LocalDatastoreController;
|