parse 4.0.1 → 4.1.0-alpha.2
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/dist/parse.js +17995 -26193
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +8739 -17728
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/Analytics.js +2 -20
- package/lib/browser/AnonymousUtils.js +6 -35
- package/lib/browser/Cloud.js +12 -70
- package/lib/browser/CloudCode.js +0 -3
- package/lib/browser/CoreManager.js +46 -184
- package/lib/browser/CryptoController.js +2 -16
- package/lib/browser/EventEmitter.js +1 -1
- package/lib/browser/EventuallyQueue.js +277 -824
- package/lib/browser/FacebookUtils.js +6 -35
- package/lib/browser/IndexedDBStorageController.js +3 -14
- package/lib/browser/InstallationController.js +2 -13
- package/lib/browser/LiveQueryClient.js +87 -204
- package/lib/browser/LiveQuerySubscription.js +10 -39
- package/lib/browser/LocalDatastore.js +451 -1081
- package/lib/browser/LocalDatastoreController.js +145 -602
- package/lib/browser/LocalDatastoreController.react-native.js +137 -573
- package/lib/browser/LocalDatastoreUtils.js +2 -12
- package/lib/browser/ObjectStateMutations.js +18 -121
- package/lib/browser/OfflineQuery.js +42 -222
- package/lib/browser/Parse.js +12 -106
- package/lib/browser/ParseACL.js +33 -141
- package/lib/browser/ParseCLP.js +96 -314
- package/lib/browser/ParseConfig.js +18 -88
- package/lib/browser/ParseError.js +63 -90
- package/lib/browser/ParseFile.js +129 -685
- package/lib/browser/ParseGeoPoint.js +23 -82
- package/lib/browser/ParseHooks.js +1 -34
- package/lib/browser/ParseInstallation.js +4 -32
- package/lib/browser/ParseLiveQuery.js +96 -505
- package/lib/browser/ParseObject.js +628 -1840
- package/lib/browser/ParseOp.js +41 -287
- package/lib/browser/ParsePolygon.js +13 -63
- package/lib/browser/ParseQuery.js +404 -1505
- package/lib/browser/ParseRelation.js +12 -61
- package/lib/browser/ParseRole.js +13 -75
- package/lib/browser/ParseSchema.js +49 -201
- package/lib/browser/ParseSession.js +11 -69
- package/lib/browser/ParseUser.js +274 -1127
- package/lib/browser/Push.js +7 -43
- package/lib/browser/RESTController.js +18 -140
- package/lib/browser/SingleInstanceStateController.js +19 -137
- package/lib/browser/Socket.weapp.js +2 -12
- package/lib/browser/Storage.js +10 -73
- package/lib/browser/StorageController.browser.js +4 -17
- package/lib/browser/StorageController.default.js +4 -17
- package/lib/browser/StorageController.react-native.js +6 -33
- package/lib/browser/StorageController.weapp.js +5 -16
- package/lib/browser/TaskQueue.js +1 -22
- package/lib/browser/UniqueInstanceStateController.js +19 -142
- package/lib/browser/Xhr.weapp.js +0 -17
- package/lib/browser/arrayContainsObject.js +2 -16
- package/lib/browser/canBeSerialized.js +3 -33
- package/lib/browser/decode.js +3 -33
- package/lib/browser/encode.js +9 -70
- package/lib/browser/equals.js +2 -25
- package/lib/browser/escape.js +1 -8
- package/lib/browser/isRevocableSession.js +2 -11
- package/lib/browser/parseDate.js +2 -13
- package/lib/browser/promiseUtils.js +3 -21
- package/lib/browser/unique.js +3 -17
- package/lib/browser/unsavedChildren.js +6 -50
- package/lib/browser/uuid.js +3 -1
- package/lib/node/Analytics.js +1 -18
- package/lib/node/AnonymousUtils.js +5 -37
- package/lib/node/Cloud.js +10 -66
- package/lib/node/CloudCode.js +0 -3
- package/lib/node/CoreManager.js +47 -220
- package/lib/node/CryptoController.js +2 -16
- package/lib/node/EventEmitter.js +1 -1
- package/lib/node/EventuallyQueue.js +16 -123
- package/lib/node/FacebookUtils.js +5 -37
- package/lib/node/IndexedDBStorageController.js +3 -19
- package/lib/node/InstallationController.js +2 -15
- package/lib/node/LiveQueryClient.js +56 -136
- package/lib/node/LiveQuerySubscription.js +7 -16
- package/lib/node/LocalDatastore.js +19 -175
- package/lib/node/LocalDatastoreController.js +6 -38
- package/lib/node/LocalDatastoreController.react-native.js +6 -45
- package/lib/node/LocalDatastoreUtils.js +1 -6
- package/lib/node/ObjectStateMutations.js +13 -93
- package/lib/node/OfflineQuery.js +20 -152
- package/lib/node/Parse.js +11 -99
- package/lib/node/ParseACL.js +32 -150
- package/lib/node/ParseCLP.js +69 -262
- package/lib/node/ParseConfig.js +16 -84
- package/lib/node/ParseError.js +61 -65
- package/lib/node/ParseFile.js +50 -205
- package/lib/node/ParseGeoPoint.js +21 -82
- package/lib/node/ParseHooks.js +0 -35
- package/lib/node/ParseInstallation.js +1 -10
- package/lib/node/ParseLiveQuery.js +10 -36
- package/lib/node/ParseObject.js +193 -939
- package/lib/node/ParseOp.js +31 -255
- package/lib/node/ParsePolygon.js +12 -62
- package/lib/node/ParseQuery.js +170 -882
- package/lib/node/ParseRelation.js +11 -61
- package/lib/node/ParseRole.js +10 -57
- package/lib/node/ParseSchema.js +46 -222
- package/lib/node/ParseSession.js +8 -50
- package/lib/node/ParseUser.js +107 -576
- package/lib/node/Push.js +4 -37
- package/lib/node/RESTController.js +8 -110
- package/lib/node/SingleInstanceStateController.js +17 -130
- package/lib/node/Socket.weapp.js +2 -9
- package/lib/node/Storage.js +10 -83
- package/lib/node/StorageController.browser.js +4 -23
- package/lib/node/StorageController.default.js +5 -21
- package/lib/node/StorageController.react-native.js +6 -40
- package/lib/node/StorageController.weapp.js +6 -21
- package/lib/node/TaskQueue.js +1 -17
- package/lib/node/UniqueInstanceStateController.js +16 -133
- package/lib/node/Xhr.weapp.js +0 -15
- package/lib/node/arrayContainsObject.js +1 -12
- package/lib/node/canBeSerialized.js +2 -28
- package/lib/node/decode.js +1 -26
- package/lib/node/encode.js +3 -54
- package/lib/node/equals.js +0 -18
- package/lib/node/escape.js +1 -6
- package/lib/node/isRevocableSession.js +1 -5
- package/lib/node/parseDate.js +1 -7
- package/lib/node/promiseUtils.js +2 -14
- package/lib/node/unique.js +1 -11
- package/lib/node/unsavedChildren.js +2 -38
- package/lib/node/uuid.js +6 -1
- package/lib/react-native/Analytics.js +0 -9
- package/lib/react-native/AnonymousUtils.js +0 -10
- package/lib/react-native/Cloud.js +0 -26
- package/lib/react-native/CoreManager.js +1 -5
- package/lib/react-native/CryptoController.js +0 -2
- package/lib/react-native/EventEmitter.js +0 -2
- package/lib/react-native/EventuallyQueue.js +4 -52
- package/lib/react-native/FacebookUtils.js +0 -22
- package/lib/react-native/IndexedDBStorageController.js +0 -1
- package/lib/react-native/InstallationController.js +0 -6
- package/lib/react-native/LiveQueryClient.js +24 -101
- package/lib/react-native/LiveQuerySubscription.js +3 -27
- package/lib/react-native/LocalDatastore.js +6 -113
- package/lib/react-native/LocalDatastoreController.js +0 -21
- package/lib/react-native/LocalDatastoreController.react-native.js +4 -31
- package/lib/react-native/LocalDatastoreUtils.js +0 -1
- package/lib/react-native/ObjectStateMutations.js +0 -34
- package/lib/react-native/OfflineQuery.js +2 -137
- package/lib/react-native/Parse.js +0 -65
- package/lib/react-native/ParseACL.js +0 -44
- package/lib/react-native/ParseCLP.js +32 -96
- package/lib/react-native/ParseConfig.js +0 -42
- package/lib/react-native/ParseError.js +1 -21
- package/lib/react-native/ParseFile.js +4 -72
- package/lib/react-native/ParseGeoPoint.js +0 -17
- package/lib/react-native/ParseHooks.js +0 -30
- package/lib/react-native/ParseInstallation.js +1 -23
- package/lib/react-native/ParseLiveQuery.js +3 -25
- package/lib/react-native/ParseObject.js +4 -371
- package/lib/react-native/ParseOp.js +1 -138
- package/lib/react-native/ParsePolygon.js +0 -24
- package/lib/react-native/ParseQuery.js +6 -262
- package/lib/react-native/ParseRelation.js +0 -25
- package/lib/react-native/ParseRole.js +1 -36
- package/lib/react-native/ParseSchema.js +0 -51
- package/lib/react-native/ParseSession.js +1 -40
- package/lib/react-native/ParseUser.js +1 -224
- package/lib/react-native/Push.js +0 -16
- package/lib/react-native/RESTController.js +1 -70
- package/lib/react-native/SingleInstanceStateController.js +0 -44
- package/lib/react-native/Socket.weapp.js +2 -12
- package/lib/react-native/Storage.js +0 -24
- package/lib/react-native/StorageController.browser.js +0 -2
- package/lib/react-native/StorageController.default.js +0 -1
- package/lib/react-native/StorageController.react-native.js +0 -2
- package/lib/react-native/TaskQueue.js +0 -15
- package/lib/react-native/UniqueInstanceStateController.js +0 -47
- package/lib/react-native/Xhr.weapp.js +0 -16
- package/lib/react-native/arrayContainsObject.js +0 -5
- package/lib/react-native/canBeSerialized.js +0 -18
- package/lib/react-native/decode.js +0 -21
- package/lib/react-native/encode.js +0 -25
- package/lib/react-native/equals.js +0 -18
- package/lib/react-native/escape.js +0 -1
- package/lib/react-native/isRevocableSession.js +0 -1
- package/lib/react-native/parseDate.js +0 -3
- package/lib/react-native/promiseUtils.js +0 -13
- package/lib/react-native/unique.js +0 -4
- package/lib/react-native/unsavedChildren.js +0 -21
- package/lib/react-native/uuid.js +3 -1
- package/lib/weapp/Analytics.js +2 -20
- package/lib/weapp/AnonymousUtils.js +6 -35
- package/lib/weapp/Cloud.js +12 -70
- package/lib/weapp/CloudCode.js +0 -3
- package/lib/weapp/CoreManager.js +46 -184
- package/lib/weapp/CryptoController.js +2 -16
- package/lib/weapp/EventEmitter.js +1 -1
- package/lib/weapp/EventuallyQueue.js +277 -824
- package/lib/weapp/FacebookUtils.js +6 -35
- package/lib/weapp/IndexedDBStorageController.js +3 -14
- package/lib/weapp/InstallationController.js +2 -13
- package/lib/weapp/LiveQueryClient.js +87 -204
- package/lib/weapp/LiveQuerySubscription.js +10 -39
- package/lib/weapp/LocalDatastore.js +451 -1081
- package/lib/weapp/LocalDatastoreController.js +145 -602
- package/lib/weapp/LocalDatastoreController.react-native.js +137 -573
- package/lib/weapp/LocalDatastoreUtils.js +2 -12
- package/lib/weapp/ObjectStateMutations.js +18 -121
- package/lib/weapp/OfflineQuery.js +42 -222
- package/lib/weapp/Parse.js +12 -106
- package/lib/weapp/ParseACL.js +33 -141
- package/lib/weapp/ParseCLP.js +96 -314
- package/lib/weapp/ParseConfig.js +18 -88
- package/lib/weapp/ParseError.js +63 -90
- package/lib/weapp/ParseFile.js +130 -686
- package/lib/weapp/ParseGeoPoint.js +23 -82
- package/lib/weapp/ParseHooks.js +1 -34
- package/lib/weapp/ParseInstallation.js +4 -32
- package/lib/weapp/ParseLiveQuery.js +96 -505
- package/lib/weapp/ParseObject.js +628 -1840
- package/lib/weapp/ParseOp.js +41 -287
- package/lib/weapp/ParsePolygon.js +13 -63
- package/lib/weapp/ParseQuery.js +404 -1505
- package/lib/weapp/ParseRelation.js +12 -61
- package/lib/weapp/ParseRole.js +13 -75
- package/lib/weapp/ParseSchema.js +49 -201
- package/lib/weapp/ParseSession.js +11 -69
- package/lib/weapp/ParseUser.js +274 -1127
- package/lib/weapp/Push.js +7 -43
- package/lib/weapp/RESTController.js +18 -140
- package/lib/weapp/SingleInstanceStateController.js +19 -137
- package/lib/weapp/Socket.weapp.js +2 -12
- package/lib/weapp/Storage.js +10 -73
- package/lib/weapp/StorageController.browser.js +4 -17
- package/lib/weapp/StorageController.default.js +4 -17
- package/lib/weapp/StorageController.react-native.js +6 -33
- package/lib/weapp/StorageController.weapp.js +5 -16
- package/lib/weapp/TaskQueue.js +1 -22
- package/lib/weapp/UniqueInstanceStateController.js +19 -142
- package/lib/weapp/Xhr.weapp.js +0 -17
- package/lib/weapp/arrayContainsObject.js +2 -16
- package/lib/weapp/canBeSerialized.js +3 -33
- package/lib/weapp/decode.js +3 -33
- package/lib/weapp/encode.js +9 -70
- package/lib/weapp/equals.js +2 -25
- package/lib/weapp/escape.js +1 -8
- package/lib/weapp/isRevocableSession.js +2 -11
- package/lib/weapp/parseDate.js +2 -13
- package/lib/weapp/promiseUtils.js +3 -21
- package/lib/weapp/unique.js +3 -17
- package/lib/weapp/unsavedChildren.js +6 -50
- package/lib/weapp/uuid.js +1 -6
- package/package.json +45 -43
package/lib/weapp/ParseUser.js
CHANGED
|
@@ -1,450 +1,48 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _sliceInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/slice");
|
|
6
|
-
|
|
7
|
-
var _reverseInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/reverse");
|
|
8
|
-
|
|
9
|
-
var _Promise2 = require("@babel/runtime-corejs3/core-js-stable/promise");
|
|
10
|
-
|
|
11
|
-
var _Object$setPrototypeOf = require("@babel/runtime-corejs3/core-js-stable/object/set-prototype-of");
|
|
12
|
-
|
|
13
|
-
var _typeof3 = require("@babel/runtime-corejs3/helpers/typeof");
|
|
14
|
-
|
|
15
|
-
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
|
16
|
-
|
|
17
|
-
var _Object$getPrototypeOf = require("@babel/runtime-corejs3/core-js-stable/object/get-prototype-of");
|
|
18
|
-
|
|
19
|
-
var _Object$create = require("@babel/runtime-corejs3/core-js-stable/object/create");
|
|
20
|
-
|
|
21
|
-
var _Object$defineProperty2 = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
22
|
-
|
|
23
|
-
var _Symbol = require("@babel/runtime-corejs3/core-js-stable/symbol");
|
|
24
|
-
|
|
25
3
|
var _Reflect$construct = require("@babel/runtime-corejs3/core-js-stable/reflect/construct");
|
|
26
|
-
|
|
4
|
+
var _Object$defineProperty2 = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
27
6
|
_Object$defineProperty2(exports, "__esModule", {
|
|
28
7
|
value: true
|
|
29
8
|
});
|
|
30
|
-
|
|
31
9
|
exports.default = void 0;
|
|
32
|
-
|
|
33
|
-
var
|
|
34
|
-
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs3/regenerator"));
|
|
11
|
+
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
35
12
|
var _defineProperty = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/define-property"));
|
|
36
|
-
|
|
13
|
+
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/json/stringify"));
|
|
37
14
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
|
|
38
|
-
|
|
39
|
-
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
40
|
-
|
|
41
15
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
|
|
42
|
-
|
|
43
16
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
44
|
-
|
|
45
17
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
46
|
-
|
|
47
18
|
var _get2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/get"));
|
|
48
|
-
|
|
49
19
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
|
|
50
|
-
|
|
51
20
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
|
|
52
|
-
|
|
53
21
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
|
|
54
|
-
|
|
55
22
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
56
|
-
|
|
57
23
|
var _isRevocableSession = _interopRequireDefault(require("./isRevocableSession"));
|
|
58
|
-
|
|
59
24
|
var _ParseError = _interopRequireDefault(require("./ParseError"));
|
|
60
|
-
|
|
61
25
|
var _ParseObject2 = _interopRequireDefault(require("./ParseObject"));
|
|
62
|
-
|
|
63
26
|
var _ParseSession = _interopRequireDefault(require("./ParseSession"));
|
|
64
|
-
|
|
65
27
|
var _Storage = _interopRequireDefault(require("./Storage"));
|
|
66
|
-
|
|
67
|
-
function _regeneratorRuntime() {
|
|
68
|
-
"use strict";
|
|
69
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
70
|
-
|
|
71
|
-
_regeneratorRuntime = function () {
|
|
72
|
-
return exports;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
var exports = {},
|
|
76
|
-
Op = Object.prototype,
|
|
77
|
-
hasOwn = Op.hasOwnProperty,
|
|
78
|
-
$Symbol = "function" == typeof _Symbol ? _Symbol : {},
|
|
79
|
-
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
80
|
-
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
81
|
-
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
82
|
-
|
|
83
|
-
function define(obj, key, value) {
|
|
84
|
-
return _Object$defineProperty2(obj, key, {
|
|
85
|
-
value: value,
|
|
86
|
-
enumerable: !0,
|
|
87
|
-
configurable: !0,
|
|
88
|
-
writable: !0
|
|
89
|
-
}), obj[key];
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
try {
|
|
93
|
-
define({}, "");
|
|
94
|
-
} catch (err) {
|
|
95
|
-
define = function (obj, key, value) {
|
|
96
|
-
return obj[key] = value;
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
101
|
-
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
102
|
-
generator = _Object$create(protoGenerator.prototype),
|
|
103
|
-
context = new Context(tryLocsList || []);
|
|
104
|
-
|
|
105
|
-
return generator._invoke = function (innerFn, self, context) {
|
|
106
|
-
var state = "suspendedStart";
|
|
107
|
-
return function (method, arg) {
|
|
108
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
109
|
-
|
|
110
|
-
if ("completed" === state) {
|
|
111
|
-
if ("throw" === method) throw arg;
|
|
112
|
-
return doneResult();
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
for (context.method = method, context.arg = arg;;) {
|
|
116
|
-
var delegate = context.delegate;
|
|
117
|
-
|
|
118
|
-
if (delegate) {
|
|
119
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
120
|
-
|
|
121
|
-
if (delegateResult) {
|
|
122
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
123
|
-
return delegateResult;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
128
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
129
|
-
context.dispatchException(context.arg);
|
|
130
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
131
|
-
state = "executing";
|
|
132
|
-
var record = tryCatch(innerFn, self, context);
|
|
133
|
-
|
|
134
|
-
if ("normal" === record.type) {
|
|
135
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
136
|
-
return {
|
|
137
|
-
value: record.arg,
|
|
138
|
-
done: context.done
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
}(innerFn, self, context), generator;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function tryCatch(fn, obj, arg) {
|
|
149
|
-
try {
|
|
150
|
-
return {
|
|
151
|
-
type: "normal",
|
|
152
|
-
arg: fn.call(obj, arg)
|
|
153
|
-
};
|
|
154
|
-
} catch (err) {
|
|
155
|
-
return {
|
|
156
|
-
type: "throw",
|
|
157
|
-
arg: err
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
exports.wrap = wrap;
|
|
163
|
-
var ContinueSentinel = {};
|
|
164
|
-
|
|
165
|
-
function Generator() {}
|
|
166
|
-
|
|
167
|
-
function GeneratorFunction() {}
|
|
168
|
-
|
|
169
|
-
function GeneratorFunctionPrototype() {}
|
|
170
|
-
|
|
171
|
-
var IteratorPrototype = {};
|
|
172
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
173
|
-
return this;
|
|
174
|
-
});
|
|
175
|
-
var getProto = _Object$getPrototypeOf,
|
|
176
|
-
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
177
|
-
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
178
|
-
|
|
179
|
-
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(IteratorPrototype);
|
|
180
|
-
|
|
181
|
-
function defineIteratorMethods(prototype) {
|
|
182
|
-
var _context7;
|
|
183
|
-
|
|
184
|
-
_forEachInstanceProperty(_context7 = ["next", "throw", "return"]).call(_context7, function (method) {
|
|
185
|
-
define(prototype, method, function (arg) {
|
|
186
|
-
return this._invoke(method, arg);
|
|
187
|
-
});
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
function AsyncIterator(generator, PromiseImpl) {
|
|
192
|
-
function invoke(method, arg, resolve, reject) {
|
|
193
|
-
var record = tryCatch(generator[method], generator, arg);
|
|
194
|
-
|
|
195
|
-
if ("throw" !== record.type) {
|
|
196
|
-
var result = record.arg,
|
|
197
|
-
value = result.value;
|
|
198
|
-
return value && "object" == _typeof3(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
199
|
-
invoke("next", value, resolve, reject);
|
|
200
|
-
}, function (err) {
|
|
201
|
-
invoke("throw", err, resolve, reject);
|
|
202
|
-
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
203
|
-
result.value = unwrapped, resolve(result);
|
|
204
|
-
}, function (error) {
|
|
205
|
-
return invoke("throw", error, resolve, reject);
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
reject(record.arg);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
var previousPromise;
|
|
213
|
-
|
|
214
|
-
this._invoke = function (method, arg) {
|
|
215
|
-
function callInvokeWithMethodAndArg() {
|
|
216
|
-
return new PromiseImpl(function (resolve, reject) {
|
|
217
|
-
invoke(method, arg, resolve, reject);
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
function maybeInvokeDelegate(delegate, context) {
|
|
226
|
-
var method = delegate.iterator[context.method];
|
|
227
|
-
|
|
228
|
-
if (undefined === method) {
|
|
229
|
-
if (context.delegate = null, "throw" === context.method) {
|
|
230
|
-
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
231
|
-
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
return ContinueSentinel;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
238
|
-
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
239
|
-
var info = record.arg;
|
|
240
|
-
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
function pushTryEntry(locs) {
|
|
244
|
-
var entry = {
|
|
245
|
-
tryLoc: locs[0]
|
|
246
|
-
};
|
|
247
|
-
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
function resetTryEntry(entry) {
|
|
251
|
-
var record = entry.completion || {};
|
|
252
|
-
record.type = "normal", delete record.arg, entry.completion = record;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
function Context(tryLocsList) {
|
|
256
|
-
this.tryEntries = [{
|
|
257
|
-
tryLoc: "root"
|
|
258
|
-
}], _forEachInstanceProperty(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0);
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
function values(iterable) {
|
|
262
|
-
if (iterable) {
|
|
263
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
264
|
-
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
265
|
-
if ("function" == typeof iterable.next) return iterable;
|
|
266
|
-
|
|
267
|
-
if (!isNaN(iterable.length)) {
|
|
268
|
-
var i = -1,
|
|
269
|
-
next = function next() {
|
|
270
|
-
for (; ++i < iterable.length;) {
|
|
271
|
-
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
return next.value = undefined, next.done = !0, next;
|
|
275
|
-
};
|
|
276
|
-
|
|
277
|
-
return next.next = next;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
return {
|
|
282
|
-
next: doneResult
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
function doneResult() {
|
|
287
|
-
return {
|
|
288
|
-
value: undefined,
|
|
289
|
-
done: !0
|
|
290
|
-
};
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
294
|
-
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
295
|
-
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
296
|
-
}, exports.mark = function (genFun) {
|
|
297
|
-
return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create(Gp), genFun;
|
|
298
|
-
}, exports.awrap = function (arg) {
|
|
299
|
-
return {
|
|
300
|
-
__await: arg
|
|
301
|
-
};
|
|
302
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
303
|
-
return this;
|
|
304
|
-
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
305
|
-
void 0 === PromiseImpl && (PromiseImpl = _Promise2);
|
|
306
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
307
|
-
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
308
|
-
return result.done ? result.value : iter.next();
|
|
309
|
-
});
|
|
310
|
-
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
311
|
-
return this;
|
|
312
|
-
}), define(Gp, "toString", function () {
|
|
313
|
-
return "[object Generator]";
|
|
314
|
-
}), exports.keys = function (object) {
|
|
315
|
-
var keys = [];
|
|
316
|
-
|
|
317
|
-
for (var key in object) {
|
|
318
|
-
keys.push(key);
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
return _reverseInstanceProperty(keys).call(keys), function next() {
|
|
322
|
-
for (; keys.length;) {
|
|
323
|
-
var key = keys.pop();
|
|
324
|
-
if (key in object) return next.value = key, next.done = !1, next;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
return next.done = !0, next;
|
|
328
|
-
};
|
|
329
|
-
}, exports.values = values, Context.prototype = {
|
|
330
|
-
constructor: Context,
|
|
331
|
-
reset: function (skipTempReset) {
|
|
332
|
-
var _context8;
|
|
333
|
-
|
|
334
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty(_context8 = this.tryEntries).call(_context8, resetTryEntry), !skipTempReset) for (var name in this) {
|
|
335
|
-
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 1)) && (this[name] = undefined);
|
|
336
|
-
}
|
|
337
|
-
},
|
|
338
|
-
stop: function () {
|
|
339
|
-
this.done = !0;
|
|
340
|
-
var rootRecord = this.tryEntries[0].completion;
|
|
341
|
-
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
342
|
-
return this.rval;
|
|
343
|
-
},
|
|
344
|
-
dispatchException: function (exception) {
|
|
345
|
-
if (this.done) throw exception;
|
|
346
|
-
var context = this;
|
|
347
|
-
|
|
348
|
-
function handle(loc, caught) {
|
|
349
|
-
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
353
|
-
var entry = this.tryEntries[i],
|
|
354
|
-
record = entry.completion;
|
|
355
|
-
if ("root" === entry.tryLoc) return handle("end");
|
|
356
|
-
|
|
357
|
-
if (entry.tryLoc <= this.prev) {
|
|
358
|
-
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
359
|
-
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
360
|
-
|
|
361
|
-
if (hasCatch && hasFinally) {
|
|
362
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
363
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
364
|
-
} else if (hasCatch) {
|
|
365
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
366
|
-
} else {
|
|
367
|
-
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
368
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
},
|
|
373
|
-
abrupt: function (type, arg) {
|
|
374
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
375
|
-
var entry = this.tryEntries[i];
|
|
376
|
-
|
|
377
|
-
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
378
|
-
var finallyEntry = entry;
|
|
379
|
-
break;
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
384
|
-
var record = finallyEntry ? finallyEntry.completion : {};
|
|
385
|
-
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
386
|
-
},
|
|
387
|
-
complete: function (record, afterLoc) {
|
|
388
|
-
if ("throw" === record.type) throw record.arg;
|
|
389
|
-
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
|
|
390
|
-
},
|
|
391
|
-
finish: function (finallyLoc) {
|
|
392
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
393
|
-
var entry = this.tryEntries[i];
|
|
394
|
-
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
395
|
-
}
|
|
396
|
-
},
|
|
397
|
-
catch: function (tryLoc) {
|
|
398
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
399
|
-
var entry = this.tryEntries[i];
|
|
400
|
-
|
|
401
|
-
if (entry.tryLoc === tryLoc) {
|
|
402
|
-
var record = entry.completion;
|
|
403
|
-
|
|
404
|
-
if ("throw" === record.type) {
|
|
405
|
-
var thrown = record.arg;
|
|
406
|
-
resetTryEntry(entry);
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
return thrown;
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
throw new Error("illegal catch attempt");
|
|
414
|
-
},
|
|
415
|
-
delegateYield: function (iterable, resultName, nextLoc) {
|
|
416
|
-
return this.delegate = {
|
|
417
|
-
iterator: values(iterable),
|
|
418
|
-
resultName: resultName,
|
|
419
|
-
nextLoc: nextLoc
|
|
420
|
-
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
421
|
-
}
|
|
422
|
-
}, exports;
|
|
423
|
-
}
|
|
424
|
-
|
|
425
28
|
function _createSuper(Derived) {
|
|
426
29
|
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
427
|
-
|
|
428
30
|
return function () {
|
|
429
31
|
var Super = (0, _getPrototypeOf2.default)(Derived),
|
|
430
|
-
|
|
431
|
-
|
|
32
|
+
result;
|
|
432
33
|
if (hasNativeReflectConstruct) {
|
|
433
34
|
var NewTarget = (0, _getPrototypeOf2.default)(this).constructor;
|
|
434
35
|
result = _Reflect$construct(Super, arguments, NewTarget);
|
|
435
36
|
} else {
|
|
436
37
|
result = Super.apply(this, arguments);
|
|
437
38
|
}
|
|
438
|
-
|
|
439
39
|
return (0, _possibleConstructorReturn2.default)(this, result);
|
|
440
40
|
};
|
|
441
41
|
}
|
|
442
|
-
|
|
443
42
|
function _isNativeReflectConstruct() {
|
|
444
43
|
if (typeof Reflect === "undefined" || !_Reflect$construct) return false;
|
|
445
44
|
if (_Reflect$construct.sham) return false;
|
|
446
45
|
if (typeof Proxy === "function") return true;
|
|
447
|
-
|
|
448
46
|
try {
|
|
449
47
|
Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {}));
|
|
450
48
|
return true;
|
|
@@ -452,12 +50,12 @@ function _isNativeReflectConstruct() {
|
|
|
452
50
|
return false;
|
|
453
51
|
}
|
|
454
52
|
}
|
|
455
|
-
|
|
456
53
|
var CURRENT_USER_KEY = 'currentUser';
|
|
457
54
|
var canUseCurrentUser = !_CoreManager.default.get('IS_NODE');
|
|
458
55
|
var currentUserCacheMatchesDisk = false;
|
|
459
56
|
var currentUserCache = null;
|
|
460
57
|
var authProviders = {};
|
|
58
|
+
|
|
461
59
|
/**
|
|
462
60
|
* <p>A Parse.User object is a local representation of a user persisted to the
|
|
463
61
|
* Parse cloud. This class is a subclass of a Parse.Object, and retains the
|
|
@@ -468,32 +66,24 @@ var authProviders = {};
|
|
|
468
66
|
* @alias Parse.User
|
|
469
67
|
* @augments Parse.Object
|
|
470
68
|
*/
|
|
471
|
-
|
|
472
69
|
var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
473
70
|
(0, _inherits2.default)(ParseUser, _ParseObject);
|
|
474
|
-
|
|
475
71
|
var _super = _createSuper(ParseUser);
|
|
476
72
|
/**
|
|
477
73
|
* @param {object} attributes The initial set of data to store in the user.
|
|
478
74
|
*/
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
function ParseUser(attributes
|
|
482
|
-
/*: ?AttributeMap*/
|
|
483
|
-
) {
|
|
75
|
+
function ParseUser(attributes /*: ?AttributeMap*/) {
|
|
484
76
|
var _this;
|
|
485
|
-
|
|
486
77
|
(0, _classCallCheck2.default)(this, ParseUser);
|
|
487
78
|
_this = _super.call(this, '_User');
|
|
488
|
-
|
|
489
79
|
if (attributes && (0, _typeof2.default)(attributes) === 'object') {
|
|
490
80
|
if (!_this.set(attributes || {})) {
|
|
491
81
|
throw new Error("Can't create an invalid Parse User");
|
|
492
82
|
}
|
|
493
83
|
}
|
|
494
|
-
|
|
495
84
|
return _this;
|
|
496
85
|
}
|
|
86
|
+
|
|
497
87
|
/**
|
|
498
88
|
* Request a revocable session token to replace the older style of token.
|
|
499
89
|
*
|
|
@@ -501,26 +91,18 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
501
91
|
* @returns {Promise} A promise that is resolved when the replacement
|
|
502
92
|
* token has been fetched.
|
|
503
93
|
*/
|
|
504
|
-
|
|
505
|
-
|
|
506
94
|
(0, _createClass2.default)(ParseUser, [{
|
|
507
95
|
key: "_upgradeToRevocableSession",
|
|
508
|
-
value: function (options
|
|
509
|
-
/*: RequestOptions*/
|
|
510
|
-
)
|
|
511
|
-
/*: Promise<void>*/
|
|
512
|
-
{
|
|
96
|
+
value: function (options /*: RequestOptions*/) /*: Promise<void>*/{
|
|
513
97
|
options = options || {};
|
|
514
98
|
var upgradeOptions = {};
|
|
515
|
-
|
|
516
99
|
if (options.hasOwnProperty('useMasterKey')) {
|
|
517
100
|
upgradeOptions.useMasterKey = options.useMasterKey;
|
|
518
101
|
}
|
|
519
|
-
|
|
520
102
|
var controller = _CoreManager.default.getUserController();
|
|
521
|
-
|
|
522
103
|
return controller.upgradeToRevocableSession(this, upgradeOptions);
|
|
523
104
|
}
|
|
105
|
+
|
|
524
106
|
/**
|
|
525
107
|
* Parse allows you to link your users with {@link https://docs.parseplatform.org/parse-server/guide/#oauth-and-3rd-party-authentication 3rd party authentication}, enabling
|
|
526
108
|
* your users to sign up or log into your application using their existing identities.
|
|
@@ -536,27 +118,15 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
536
118
|
* @param {object} saveOpts useMasterKey / sessionToken
|
|
537
119
|
* @returns {Promise} A promise that is fulfilled with the user is linked
|
|
538
120
|
*/
|
|
539
|
-
|
|
540
121
|
}, {
|
|
541
122
|
key: "linkWith",
|
|
542
|
-
value: function (provider
|
|
543
|
-
/*: any*/
|
|
544
|
-
, options
|
|
545
|
-
/*: { authData?: AuthData }*/
|
|
546
|
-
)
|
|
547
|
-
/*: Promise<ParseUser>*/
|
|
548
|
-
{
|
|
123
|
+
value: function (provider /*: any*/, options /*: { authData?: AuthData }*/) /*: Promise<ParseUser>*/{
|
|
549
124
|
var _this2 = this;
|
|
550
|
-
|
|
551
|
-
var saveOpts
|
|
552
|
-
/*:: ?: FullOptions*/
|
|
553
|
-
= arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
125
|
+
var saveOpts /*:: ?: FullOptions*/ = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
554
126
|
saveOpts.sessionToken = saveOpts.sessionToken || this.getSessionToken() || '';
|
|
555
127
|
var authType;
|
|
556
|
-
|
|
557
128
|
if (typeof provider === 'string') {
|
|
558
129
|
authType = provider;
|
|
559
|
-
|
|
560
130
|
if (authProviders[provider]) {
|
|
561
131
|
provider = authProviders[provider];
|
|
562
132
|
} else {
|
|
@@ -574,18 +144,13 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
574
144
|
} else {
|
|
575
145
|
authType = provider.getAuthType();
|
|
576
146
|
}
|
|
577
|
-
|
|
578
147
|
if (options && options.hasOwnProperty('authData')) {
|
|
579
148
|
var authData = this.get('authData') || {};
|
|
580
|
-
|
|
581
149
|
if ((0, _typeof2.default)(authData) !== 'object') {
|
|
582
150
|
throw new Error('Invalid type: authData field should be an object');
|
|
583
151
|
}
|
|
584
|
-
|
|
585
152
|
authData[authType] = options.authData;
|
|
586
|
-
|
|
587
153
|
var controller = _CoreManager.default.getUserController();
|
|
588
|
-
|
|
589
154
|
return controller.linkWith(this, authData, saveOpts);
|
|
590
155
|
} else {
|
|
591
156
|
return new _promise.default(function (resolve, reject) {
|
|
@@ -593,7 +158,6 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
593
158
|
success: function (provider, result) {
|
|
594
159
|
var opts = {};
|
|
595
160
|
opts.authData = result;
|
|
596
|
-
|
|
597
161
|
_this2.linkWith(provider, opts, saveOpts).then(function () {
|
|
598
162
|
resolve(_this2);
|
|
599
163
|
}, function (error) {
|
|
@@ -607,6 +171,7 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
607
171
|
});
|
|
608
172
|
}
|
|
609
173
|
}
|
|
174
|
+
|
|
610
175
|
/**
|
|
611
176
|
* @param provider
|
|
612
177
|
* @param options
|
|
@@ -614,98 +179,77 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
614
179
|
* @deprecated since 2.9.0 see {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.User.html#linkWith linkWith}
|
|
615
180
|
* @returns {Promise}
|
|
616
181
|
*/
|
|
617
|
-
|
|
618
182
|
}, {
|
|
619
183
|
key: "_linkWith",
|
|
620
|
-
value: function (provider
|
|
621
|
-
|
|
622
|
-
, options
|
|
623
|
-
/*: { authData?: AuthData }*/
|
|
624
|
-
)
|
|
625
|
-
/*: Promise<ParseUser>*/
|
|
626
|
-
{
|
|
627
|
-
var saveOpts
|
|
628
|
-
/*:: ?: FullOptions*/
|
|
629
|
-
= arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
184
|
+
value: function (provider /*: any*/, options /*: { authData?: AuthData }*/) /*: Promise<ParseUser>*/{
|
|
185
|
+
var saveOpts /*:: ?: FullOptions*/ = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
630
186
|
return this.linkWith(provider, options, saveOpts);
|
|
631
187
|
}
|
|
188
|
+
|
|
632
189
|
/**
|
|
633
190
|
* Synchronizes auth data for a provider (e.g. puts the access token in the
|
|
634
191
|
* right place to be used by the Facebook SDK).
|
|
635
192
|
*
|
|
636
193
|
* @param provider
|
|
637
194
|
*/
|
|
638
|
-
|
|
639
195
|
}, {
|
|
640
196
|
key: "_synchronizeAuthData",
|
|
641
|
-
value: function (provider
|
|
642
|
-
/*: string*/
|
|
643
|
-
) {
|
|
197
|
+
value: function (provider /*: string*/) {
|
|
644
198
|
if (!this.isCurrent() || !provider) {
|
|
645
199
|
return;
|
|
646
200
|
}
|
|
647
|
-
|
|
648
201
|
var authType;
|
|
649
|
-
|
|
650
202
|
if (typeof provider === 'string') {
|
|
651
203
|
authType = provider;
|
|
652
204
|
provider = authProviders[authType];
|
|
653
205
|
} else {
|
|
654
206
|
authType = provider.getAuthType();
|
|
655
207
|
}
|
|
656
|
-
|
|
657
208
|
var authData = this.get('authData');
|
|
658
|
-
|
|
659
209
|
if (!provider || !authData || (0, _typeof2.default)(authData) !== 'object') {
|
|
660
210
|
return;
|
|
661
211
|
}
|
|
662
|
-
|
|
663
212
|
var success = provider.restoreAuthentication(authData[authType]);
|
|
664
|
-
|
|
665
213
|
if (!success) {
|
|
666
214
|
this._unlinkFrom(provider);
|
|
667
215
|
}
|
|
668
216
|
}
|
|
217
|
+
|
|
669
218
|
/**
|
|
670
219
|
* Synchronizes authData for all providers.
|
|
671
220
|
*/
|
|
672
|
-
|
|
673
221
|
}, {
|
|
674
222
|
key: "_synchronizeAllAuthData",
|
|
675
223
|
value: function () {
|
|
676
224
|
var authData = this.get('authData');
|
|
677
|
-
|
|
678
225
|
if ((0, _typeof2.default)(authData) !== 'object') {
|
|
679
226
|
return;
|
|
680
227
|
}
|
|
681
|
-
|
|
682
228
|
for (var _key in authData) {
|
|
683
229
|
this._synchronizeAuthData(_key);
|
|
684
230
|
}
|
|
685
231
|
}
|
|
232
|
+
|
|
686
233
|
/**
|
|
687
234
|
* Removes null values from authData (which exist temporarily for unlinking)
|
|
688
235
|
*/
|
|
689
|
-
|
|
690
236
|
}, {
|
|
691
237
|
key: "_cleanupAuthData",
|
|
692
238
|
value: function () {
|
|
693
239
|
if (!this.isCurrent()) {
|
|
694
240
|
return;
|
|
695
241
|
}
|
|
696
|
-
|
|
697
242
|
var authData = this.get('authData');
|
|
698
|
-
|
|
699
243
|
if ((0, _typeof2.default)(authData) !== 'object') {
|
|
700
244
|
return;
|
|
701
245
|
}
|
|
702
|
-
|
|
703
246
|
for (var _key2 in authData) {
|
|
704
247
|
if (!authData[_key2]) {
|
|
705
248
|
delete authData[_key2];
|
|
706
249
|
}
|
|
707
250
|
}
|
|
708
251
|
}
|
|
252
|
+
|
|
709
253
|
/**
|
|
710
254
|
* Unlinks a user from a service.
|
|
711
255
|
*
|
|
@@ -714,161 +258,128 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
714
258
|
* @returns {Promise} A promise that is fulfilled when the unlinking
|
|
715
259
|
* finishes.
|
|
716
260
|
*/
|
|
717
|
-
|
|
718
261
|
}, {
|
|
719
262
|
key: "_unlinkFrom",
|
|
720
|
-
value: function (provider
|
|
721
|
-
/*: any*/
|
|
722
|
-
, options
|
|
723
|
-
/*:: ?: FullOptions*/
|
|
724
|
-
)
|
|
725
|
-
/*: Promise<ParseUser>*/
|
|
726
|
-
{
|
|
263
|
+
value: function (provider /*: any*/, options /*:: ?: FullOptions*/) /*: Promise<ParseUser>*/{
|
|
727
264
|
var _this3 = this;
|
|
728
|
-
|
|
729
265
|
return this.linkWith(provider, {
|
|
730
266
|
authData: null
|
|
731
267
|
}, options).then(function () {
|
|
732
268
|
_this3._synchronizeAuthData(provider);
|
|
733
|
-
|
|
734
269
|
return _promise.default.resolve(_this3);
|
|
735
270
|
});
|
|
736
271
|
}
|
|
272
|
+
|
|
737
273
|
/**
|
|
738
274
|
* Checks whether a user is linked to a service.
|
|
739
275
|
*
|
|
740
276
|
* @param {object} provider service to link to
|
|
741
277
|
* @returns {boolean} true if link was successful
|
|
742
278
|
*/
|
|
743
|
-
|
|
744
279
|
}, {
|
|
745
280
|
key: "_isLinked",
|
|
746
|
-
value: function (provider
|
|
747
|
-
/*: any*/
|
|
748
|
-
)
|
|
749
|
-
/*: boolean*/
|
|
750
|
-
{
|
|
281
|
+
value: function (provider /*: any*/) /*: boolean*/{
|
|
751
282
|
var authType;
|
|
752
|
-
|
|
753
283
|
if (typeof provider === 'string') {
|
|
754
284
|
authType = provider;
|
|
755
285
|
} else {
|
|
756
286
|
authType = provider.getAuthType();
|
|
757
287
|
}
|
|
758
|
-
|
|
759
288
|
var authData = this.get('authData') || {};
|
|
760
|
-
|
|
761
289
|
if ((0, _typeof2.default)(authData) !== 'object') {
|
|
762
290
|
return false;
|
|
763
291
|
}
|
|
764
|
-
|
|
765
292
|
return !!authData[authType];
|
|
766
293
|
}
|
|
294
|
+
|
|
767
295
|
/**
|
|
768
296
|
* Deauthenticates all providers.
|
|
769
297
|
*/
|
|
770
|
-
|
|
771
298
|
}, {
|
|
772
299
|
key: "_logOutWithAll",
|
|
773
300
|
value: function () {
|
|
774
301
|
var authData = this.get('authData');
|
|
775
|
-
|
|
776
302
|
if ((0, _typeof2.default)(authData) !== 'object') {
|
|
777
303
|
return;
|
|
778
304
|
}
|
|
779
|
-
|
|
780
305
|
for (var _key3 in authData) {
|
|
781
306
|
this._logOutWith(_key3);
|
|
782
307
|
}
|
|
783
308
|
}
|
|
309
|
+
|
|
784
310
|
/**
|
|
785
311
|
* Deauthenticates a single provider (e.g. removing access tokens from the
|
|
786
312
|
* Facebook SDK).
|
|
787
313
|
*
|
|
788
314
|
* @param {object} provider service to logout of
|
|
789
315
|
*/
|
|
790
|
-
|
|
791
316
|
}, {
|
|
792
317
|
key: "_logOutWith",
|
|
793
|
-
value: function (provider
|
|
794
|
-
/*: any*/
|
|
795
|
-
) {
|
|
318
|
+
value: function (provider /*: any*/) {
|
|
796
319
|
if (!this.isCurrent()) {
|
|
797
320
|
return;
|
|
798
321
|
}
|
|
799
|
-
|
|
800
322
|
if (typeof provider === 'string') {
|
|
801
323
|
provider = authProviders[provider];
|
|
802
324
|
}
|
|
803
|
-
|
|
804
325
|
if (provider && provider.deauthenticate) {
|
|
805
326
|
provider.deauthenticate();
|
|
806
327
|
}
|
|
807
328
|
}
|
|
329
|
+
|
|
808
330
|
/**
|
|
809
331
|
* Class instance method used to maintain specific keys when a fetch occurs.
|
|
810
332
|
* Used to ensure that the session token is not lost.
|
|
811
333
|
*
|
|
812
334
|
* @returns {object} sessionToken
|
|
813
335
|
*/
|
|
814
|
-
|
|
815
336
|
}, {
|
|
816
337
|
key: "_preserveFieldsOnFetch",
|
|
817
|
-
value: function ()
|
|
818
|
-
/*: AttributeMap*/
|
|
819
|
-
{
|
|
338
|
+
value: function () /*: AttributeMap*/{
|
|
820
339
|
return {
|
|
821
340
|
sessionToken: this.get('sessionToken')
|
|
822
341
|
};
|
|
823
342
|
}
|
|
343
|
+
|
|
824
344
|
/**
|
|
825
345
|
* Returns true if <code>current</code> would return this user.
|
|
826
346
|
*
|
|
827
347
|
* @returns {boolean} true if user is cached on disk
|
|
828
348
|
*/
|
|
829
|
-
|
|
830
349
|
}, {
|
|
831
350
|
key: "isCurrent",
|
|
832
|
-
value: function ()
|
|
833
|
-
/*: boolean*/
|
|
834
|
-
{
|
|
351
|
+
value: function () /*: boolean*/{
|
|
835
352
|
var current = ParseUser.current();
|
|
836
353
|
return !!current && current.id === this.id;
|
|
837
354
|
}
|
|
355
|
+
|
|
838
356
|
/**
|
|
839
357
|
* Returns true if <code>current</code> would return this user.
|
|
840
358
|
*
|
|
841
359
|
* @returns {Promise<boolean>} true if user is cached on disk
|
|
842
360
|
*/
|
|
843
|
-
|
|
844
361
|
}, {
|
|
845
362
|
key: "isCurrentAsync",
|
|
846
363
|
value: function () {
|
|
847
|
-
var _isCurrentAsync = (0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
364
|
+
var _isCurrentAsync = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
848
365
|
var current;
|
|
849
|
-
return
|
|
850
|
-
while (1) {
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
case 4:
|
|
861
|
-
case "end":
|
|
862
|
-
return _context.stop();
|
|
863
|
-
}
|
|
366
|
+
return _regenerator.default.wrap(function (_context) {
|
|
367
|
+
while (1) switch (_context.prev = _context.next) {
|
|
368
|
+
case 0:
|
|
369
|
+
_context.next = 2;
|
|
370
|
+
return ParseUser.currentAsync();
|
|
371
|
+
case 2:
|
|
372
|
+
current = _context.sent;
|
|
373
|
+
return _context.abrupt("return", !!current && current.id === this.id);
|
|
374
|
+
case 4:
|
|
375
|
+
case "end":
|
|
376
|
+
return _context.stop();
|
|
864
377
|
}
|
|
865
378
|
}, _callee, this);
|
|
866
379
|
}));
|
|
867
|
-
|
|
868
380
|
function isCurrentAsync() {
|
|
869
381
|
return _isCurrentAsync.apply(this, arguments);
|
|
870
382
|
}
|
|
871
|
-
|
|
872
383
|
return isCurrentAsync;
|
|
873
384
|
}()
|
|
874
385
|
/**
|
|
@@ -876,87 +387,71 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
876
387
|
*
|
|
877
388
|
* @returns {string}
|
|
878
389
|
*/
|
|
879
|
-
|
|
880
390
|
}, {
|
|
881
391
|
key: "getUsername",
|
|
882
|
-
value: function
|
|
883
|
-
/*: ?string*/
|
|
884
|
-
{
|
|
392
|
+
value: function () /*: ?string*/{
|
|
885
393
|
var username = this.get('username');
|
|
886
|
-
|
|
887
394
|
if (username == null || typeof username === 'string') {
|
|
888
395
|
return username;
|
|
889
396
|
}
|
|
890
|
-
|
|
891
397
|
return '';
|
|
892
398
|
}
|
|
399
|
+
|
|
893
400
|
/**
|
|
894
401
|
* Calls set("username", username, options) and returns the result.
|
|
895
402
|
*
|
|
896
403
|
* @param {string} username
|
|
897
404
|
*/
|
|
898
|
-
|
|
899
405
|
}, {
|
|
900
406
|
key: "setUsername",
|
|
901
|
-
value: function
|
|
902
|
-
/*: string*/
|
|
903
|
-
) {
|
|
407
|
+
value: function (username /*: string*/) {
|
|
904
408
|
// Strip anonymity
|
|
905
409
|
var authData = this.get('authData');
|
|
906
|
-
|
|
907
410
|
if (authData && (0, _typeof2.default)(authData) === 'object' && authData.hasOwnProperty('anonymous')) {
|
|
908
411
|
// We need to set anonymous to null instead of deleting it in order to remove it from Parse.
|
|
909
412
|
authData.anonymous = null;
|
|
910
413
|
}
|
|
911
|
-
|
|
912
414
|
this.set('username', username);
|
|
913
415
|
}
|
|
416
|
+
|
|
914
417
|
/**
|
|
915
418
|
* Calls set("password", password, options) and returns the result.
|
|
916
419
|
*
|
|
917
420
|
* @param {string} password User's Password
|
|
918
421
|
*/
|
|
919
|
-
|
|
920
422
|
}, {
|
|
921
423
|
key: "setPassword",
|
|
922
|
-
value: function
|
|
923
|
-
/*: string*/
|
|
924
|
-
) {
|
|
424
|
+
value: function (password /*: string*/) {
|
|
925
425
|
this.set('password', password);
|
|
926
426
|
}
|
|
427
|
+
|
|
927
428
|
/**
|
|
928
429
|
* Returns get("email").
|
|
929
430
|
*
|
|
930
431
|
* @returns {string} User's Email
|
|
931
432
|
*/
|
|
932
|
-
|
|
933
433
|
}, {
|
|
934
434
|
key: "getEmail",
|
|
935
|
-
value: function
|
|
936
|
-
/*: ?string*/
|
|
937
|
-
{
|
|
435
|
+
value: function () /*: ?string*/{
|
|
938
436
|
var email = this.get('email');
|
|
939
|
-
|
|
940
437
|
if (email == null || typeof email === 'string') {
|
|
941
438
|
return email;
|
|
942
439
|
}
|
|
943
|
-
|
|
944
440
|
return '';
|
|
945
441
|
}
|
|
442
|
+
|
|
946
443
|
/**
|
|
947
444
|
* Calls set("email", email) and returns the result.
|
|
948
445
|
*
|
|
949
446
|
* @param {string} email
|
|
950
447
|
* @returns {boolean}
|
|
951
448
|
*/
|
|
952
|
-
|
|
953
449
|
}, {
|
|
954
450
|
key: "setEmail",
|
|
955
|
-
value: function
|
|
956
|
-
/*: string*/
|
|
957
|
-
) {
|
|
451
|
+
value: function (email /*: string*/) {
|
|
958
452
|
return this.set('email', email);
|
|
959
453
|
}
|
|
454
|
+
|
|
960
455
|
/**
|
|
961
456
|
* Returns the session token for this user, if the user has been logged in,
|
|
962
457
|
* or if it is the result of a query with the master key. Otherwise, returns
|
|
@@ -964,34 +459,28 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
964
459
|
*
|
|
965
460
|
* @returns {string} the session token, or undefined
|
|
966
461
|
*/
|
|
967
|
-
|
|
968
462
|
}, {
|
|
969
463
|
key: "getSessionToken",
|
|
970
|
-
value: function
|
|
971
|
-
/*: ?string*/
|
|
972
|
-
{
|
|
464
|
+
value: function () /*: ?string*/{
|
|
973
465
|
var token = this.get('sessionToken');
|
|
974
|
-
|
|
975
466
|
if (token == null || typeof token === 'string') {
|
|
976
467
|
return token;
|
|
977
468
|
}
|
|
978
|
-
|
|
979
469
|
return '';
|
|
980
470
|
}
|
|
471
|
+
|
|
981
472
|
/**
|
|
982
473
|
* Checks whether this user is the current user and has been authenticated.
|
|
983
474
|
*
|
|
984
475
|
* @returns {boolean} whether this user is the current user and is logged in.
|
|
985
476
|
*/
|
|
986
|
-
|
|
987
477
|
}, {
|
|
988
478
|
key: "authenticated",
|
|
989
|
-
value: function
|
|
990
|
-
/*: boolean*/
|
|
991
|
-
{
|
|
479
|
+
value: function () /*: boolean*/{
|
|
992
480
|
var current = ParseUser.current();
|
|
993
481
|
return !!this.get('sessionToken') && !!current && current.id === this.id;
|
|
994
482
|
}
|
|
483
|
+
|
|
995
484
|
/**
|
|
996
485
|
* Signs up a new user. You should call this instead of save for
|
|
997
486
|
* new Parse.Users. This will create a new Parse.User on the server, and
|
|
@@ -1005,35 +494,24 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1005
494
|
* @returns {Promise} A promise that is fulfilled when the signup
|
|
1006
495
|
* finishes.
|
|
1007
496
|
*/
|
|
1008
|
-
|
|
1009
497
|
}, {
|
|
1010
498
|
key: "signUp",
|
|
1011
|
-
value: function
|
|
1012
|
-
/*: AttributeMap*/
|
|
1013
|
-
, options
|
|
1014
|
-
/*:: ?: FullOptions*/
|
|
1015
|
-
)
|
|
1016
|
-
/*: Promise<ParseUser>*/
|
|
1017
|
-
{
|
|
499
|
+
value: function (attrs /*: AttributeMap*/, options /*:: ?: FullOptions*/) /*: Promise<ParseUser>*/{
|
|
1018
500
|
options = options || {};
|
|
1019
501
|
var signupOptions = {};
|
|
1020
|
-
|
|
1021
502
|
if (options.hasOwnProperty('useMasterKey')) {
|
|
1022
503
|
signupOptions.useMasterKey = options.useMasterKey;
|
|
1023
504
|
}
|
|
1024
|
-
|
|
1025
505
|
if (options.hasOwnProperty('installationId')) {
|
|
1026
506
|
signupOptions.installationId = options.installationId;
|
|
1027
507
|
}
|
|
1028
|
-
|
|
1029
508
|
if (options.hasOwnProperty('context') && Object.prototype.toString.call(options.context) === '[object Object]') {
|
|
1030
509
|
signupOptions.context = options.context;
|
|
1031
510
|
}
|
|
1032
|
-
|
|
1033
511
|
var controller = _CoreManager.default.getUserController();
|
|
1034
|
-
|
|
1035
512
|
return controller.signUp(this, attrs, signupOptions);
|
|
1036
513
|
}
|
|
514
|
+
|
|
1037
515
|
/**
|
|
1038
516
|
* Logs in a Parse.User. On success, this saves the session to disk,
|
|
1039
517
|
* so you can retrieve the currently logged in user using
|
|
@@ -1045,35 +523,26 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1045
523
|
* @returns {Promise} A promise that is fulfilled with the user when
|
|
1046
524
|
* the login is complete.
|
|
1047
525
|
*/
|
|
1048
|
-
|
|
1049
526
|
}, {
|
|
1050
527
|
key: "logIn",
|
|
1051
|
-
value: function
|
|
1052
|
-
/*:: ?: FullOptions*/
|
|
1053
|
-
)
|
|
1054
|
-
/*: Promise<ParseUser>*/
|
|
1055
|
-
{
|
|
528
|
+
value: function (options /*:: ?: FullOptions*/) /*: Promise<ParseUser>*/{
|
|
1056
529
|
options = options || {};
|
|
1057
530
|
var loginOptions = {
|
|
1058
531
|
usePost: true
|
|
1059
532
|
};
|
|
1060
|
-
|
|
1061
533
|
if (options.hasOwnProperty('useMasterKey')) {
|
|
1062
534
|
loginOptions.useMasterKey = options.useMasterKey;
|
|
1063
535
|
}
|
|
1064
|
-
|
|
1065
536
|
if (options.hasOwnProperty('installationId')) {
|
|
1066
537
|
loginOptions.installationId = options.installationId;
|
|
1067
538
|
}
|
|
1068
|
-
|
|
1069
539
|
if (options.hasOwnProperty('usePost')) {
|
|
1070
540
|
loginOptions.usePost = options.usePost;
|
|
1071
541
|
}
|
|
1072
|
-
|
|
1073
542
|
var controller = _CoreManager.default.getUserController();
|
|
1074
|
-
|
|
1075
543
|
return controller.logIn(this, loginOptions);
|
|
1076
544
|
}
|
|
545
|
+
|
|
1077
546
|
/**
|
|
1078
547
|
* Wrap the default save behavior with functionality to save to local
|
|
1079
548
|
* storage if this is current user.
|
|
@@ -1081,57 +550,44 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1081
550
|
* @param {...any} args
|
|
1082
551
|
* @returns {Promise}
|
|
1083
552
|
*/
|
|
1084
|
-
|
|
1085
553
|
}, {
|
|
1086
554
|
key: "save",
|
|
1087
555
|
value: function () {
|
|
1088
|
-
var _save = (0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
556
|
+
var _save = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
1089
557
|
var _len,
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
return _context2.abrupt("return", _CoreManager.default.getUserController().updateUserOnDisk(this));
|
|
1119
|
-
|
|
1120
|
-
case 8:
|
|
1121
|
-
return _context2.abrupt("return", this);
|
|
1122
|
-
|
|
1123
|
-
case 9:
|
|
1124
|
-
case "end":
|
|
1125
|
-
return _context2.stop();
|
|
1126
|
-
}
|
|
558
|
+
args,
|
|
559
|
+
_key4,
|
|
560
|
+
current,
|
|
561
|
+
_args2 = arguments;
|
|
562
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
563
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
564
|
+
case 0:
|
|
565
|
+
for (_len = _args2.length, args = new Array(_len), _key4 = 0; _key4 < _len; _key4++) {
|
|
566
|
+
args[_key4] = _args2[_key4];
|
|
567
|
+
}
|
|
568
|
+
_context2.next = 3;
|
|
569
|
+
return (0, _get2.default)((0, _getPrototypeOf2.default)(ParseUser.prototype), "save", this).apply(this, args);
|
|
570
|
+
case 3:
|
|
571
|
+
_context2.next = 5;
|
|
572
|
+
return this.isCurrentAsync();
|
|
573
|
+
case 5:
|
|
574
|
+
current = _context2.sent;
|
|
575
|
+
if (!current) {
|
|
576
|
+
_context2.next = 8;
|
|
577
|
+
break;
|
|
578
|
+
}
|
|
579
|
+
return _context2.abrupt("return", _CoreManager.default.getUserController().updateUserOnDisk(this));
|
|
580
|
+
case 8:
|
|
581
|
+
return _context2.abrupt("return", this);
|
|
582
|
+
case 9:
|
|
583
|
+
case "end":
|
|
584
|
+
return _context2.stop();
|
|
1127
585
|
}
|
|
1128
586
|
}, _callee2, this);
|
|
1129
587
|
}));
|
|
1130
|
-
|
|
1131
588
|
function save() {
|
|
1132
589
|
return _save.apply(this, arguments);
|
|
1133
590
|
}
|
|
1134
|
-
|
|
1135
591
|
return save;
|
|
1136
592
|
}()
|
|
1137
593
|
/**
|
|
@@ -1141,57 +597,44 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1141
597
|
* @param {...any} args
|
|
1142
598
|
* @returns {Parse.User}
|
|
1143
599
|
*/
|
|
1144
|
-
|
|
1145
600
|
}, {
|
|
1146
601
|
key: "destroy",
|
|
1147
602
|
value: function () {
|
|
1148
|
-
var _destroy = (0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
603
|
+
var _destroy = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
1149
604
|
var _len2,
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
return _context3.abrupt("return", _CoreManager.default.getUserController().removeUserFromDisk());
|
|
1179
|
-
|
|
1180
|
-
case 8:
|
|
1181
|
-
return _context3.abrupt("return", this);
|
|
1182
|
-
|
|
1183
|
-
case 9:
|
|
1184
|
-
case "end":
|
|
1185
|
-
return _context3.stop();
|
|
1186
|
-
}
|
|
605
|
+
args,
|
|
606
|
+
_key5,
|
|
607
|
+
current,
|
|
608
|
+
_args3 = arguments;
|
|
609
|
+
return _regenerator.default.wrap(function (_context3) {
|
|
610
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
611
|
+
case 0:
|
|
612
|
+
for (_len2 = _args3.length, args = new Array(_len2), _key5 = 0; _key5 < _len2; _key5++) {
|
|
613
|
+
args[_key5] = _args3[_key5];
|
|
614
|
+
}
|
|
615
|
+
_context3.next = 3;
|
|
616
|
+
return (0, _get2.default)((0, _getPrototypeOf2.default)(ParseUser.prototype), "destroy", this).apply(this, args);
|
|
617
|
+
case 3:
|
|
618
|
+
_context3.next = 5;
|
|
619
|
+
return this.isCurrentAsync();
|
|
620
|
+
case 5:
|
|
621
|
+
current = _context3.sent;
|
|
622
|
+
if (!current) {
|
|
623
|
+
_context3.next = 8;
|
|
624
|
+
break;
|
|
625
|
+
}
|
|
626
|
+
return _context3.abrupt("return", _CoreManager.default.getUserController().removeUserFromDisk());
|
|
627
|
+
case 8:
|
|
628
|
+
return _context3.abrupt("return", this);
|
|
629
|
+
case 9:
|
|
630
|
+
case "end":
|
|
631
|
+
return _context3.stop();
|
|
1187
632
|
}
|
|
1188
633
|
}, _callee3, this);
|
|
1189
634
|
}));
|
|
1190
|
-
|
|
1191
635
|
function destroy() {
|
|
1192
636
|
return _destroy.apply(this, arguments);
|
|
1193
637
|
}
|
|
1194
|
-
|
|
1195
638
|
return destroy;
|
|
1196
639
|
}()
|
|
1197
640
|
/**
|
|
@@ -1201,57 +644,44 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1201
644
|
* @param {...any} args
|
|
1202
645
|
* @returns {Parse.User}
|
|
1203
646
|
*/
|
|
1204
|
-
|
|
1205
647
|
}, {
|
|
1206
648
|
key: "fetch",
|
|
1207
649
|
value: function () {
|
|
1208
|
-
var _fetch = (0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
650
|
+
var _fetch = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
1209
651
|
var _len3,
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
return _context4.abrupt("return", _CoreManager.default.getUserController().updateUserOnDisk(this));
|
|
1239
|
-
|
|
1240
|
-
case 8:
|
|
1241
|
-
return _context4.abrupt("return", this);
|
|
1242
|
-
|
|
1243
|
-
case 9:
|
|
1244
|
-
case "end":
|
|
1245
|
-
return _context4.stop();
|
|
1246
|
-
}
|
|
652
|
+
args,
|
|
653
|
+
_key6,
|
|
654
|
+
current,
|
|
655
|
+
_args4 = arguments;
|
|
656
|
+
return _regenerator.default.wrap(function (_context4) {
|
|
657
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
658
|
+
case 0:
|
|
659
|
+
for (_len3 = _args4.length, args = new Array(_len3), _key6 = 0; _key6 < _len3; _key6++) {
|
|
660
|
+
args[_key6] = _args4[_key6];
|
|
661
|
+
}
|
|
662
|
+
_context4.next = 3;
|
|
663
|
+
return (0, _get2.default)((0, _getPrototypeOf2.default)(ParseUser.prototype), "fetch", this).apply(this, args);
|
|
664
|
+
case 3:
|
|
665
|
+
_context4.next = 5;
|
|
666
|
+
return this.isCurrentAsync();
|
|
667
|
+
case 5:
|
|
668
|
+
current = _context4.sent;
|
|
669
|
+
if (!current) {
|
|
670
|
+
_context4.next = 8;
|
|
671
|
+
break;
|
|
672
|
+
}
|
|
673
|
+
return _context4.abrupt("return", _CoreManager.default.getUserController().updateUserOnDisk(this));
|
|
674
|
+
case 8:
|
|
675
|
+
return _context4.abrupt("return", this);
|
|
676
|
+
case 9:
|
|
677
|
+
case "end":
|
|
678
|
+
return _context4.stop();
|
|
1247
679
|
}
|
|
1248
680
|
}, _callee4, this);
|
|
1249
681
|
}));
|
|
1250
|
-
|
|
1251
682
|
function fetch() {
|
|
1252
683
|
return _fetch.apply(this, arguments);
|
|
1253
684
|
}
|
|
1254
|
-
|
|
1255
685
|
return fetch;
|
|
1256
686
|
}()
|
|
1257
687
|
/**
|
|
@@ -1261,57 +691,44 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1261
691
|
* @param {...any} args
|
|
1262
692
|
* @returns {Parse.User}
|
|
1263
693
|
*/
|
|
1264
|
-
|
|
1265
694
|
}, {
|
|
1266
695
|
key: "fetchWithInclude",
|
|
1267
696
|
value: function () {
|
|
1268
|
-
var _fetchWithInclude = (0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
697
|
+
var _fetchWithInclude = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
1269
698
|
var _len4,
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
return _context5.abrupt("return", _CoreManager.default.getUserController().updateUserOnDisk(this));
|
|
1299
|
-
|
|
1300
|
-
case 8:
|
|
1301
|
-
return _context5.abrupt("return", this);
|
|
1302
|
-
|
|
1303
|
-
case 9:
|
|
1304
|
-
case "end":
|
|
1305
|
-
return _context5.stop();
|
|
1306
|
-
}
|
|
699
|
+
args,
|
|
700
|
+
_key7,
|
|
701
|
+
current,
|
|
702
|
+
_args5 = arguments;
|
|
703
|
+
return _regenerator.default.wrap(function (_context5) {
|
|
704
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
705
|
+
case 0:
|
|
706
|
+
for (_len4 = _args5.length, args = new Array(_len4), _key7 = 0; _key7 < _len4; _key7++) {
|
|
707
|
+
args[_key7] = _args5[_key7];
|
|
708
|
+
}
|
|
709
|
+
_context5.next = 3;
|
|
710
|
+
return (0, _get2.default)((0, _getPrototypeOf2.default)(ParseUser.prototype), "fetchWithInclude", this).apply(this, args);
|
|
711
|
+
case 3:
|
|
712
|
+
_context5.next = 5;
|
|
713
|
+
return this.isCurrentAsync();
|
|
714
|
+
case 5:
|
|
715
|
+
current = _context5.sent;
|
|
716
|
+
if (!current) {
|
|
717
|
+
_context5.next = 8;
|
|
718
|
+
break;
|
|
719
|
+
}
|
|
720
|
+
return _context5.abrupt("return", _CoreManager.default.getUserController().updateUserOnDisk(this));
|
|
721
|
+
case 8:
|
|
722
|
+
return _context5.abrupt("return", this);
|
|
723
|
+
case 9:
|
|
724
|
+
case "end":
|
|
725
|
+
return _context5.stop();
|
|
1307
726
|
}
|
|
1308
727
|
}, _callee5, this);
|
|
1309
728
|
}));
|
|
1310
|
-
|
|
1311
729
|
function fetchWithInclude() {
|
|
1312
730
|
return _fetchWithInclude.apply(this, arguments);
|
|
1313
731
|
}
|
|
1314
|
-
|
|
1315
732
|
return fetchWithInclude;
|
|
1316
733
|
}()
|
|
1317
734
|
/**
|
|
@@ -1322,24 +739,18 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1322
739
|
* @returns {Promise} A promise that is fulfilled with a user
|
|
1323
740
|
* when the password is correct.
|
|
1324
741
|
*/
|
|
1325
|
-
|
|
1326
742
|
}, {
|
|
1327
743
|
key: "verifyPassword",
|
|
1328
|
-
value: function
|
|
1329
|
-
/*: string*/
|
|
1330
|
-
, options
|
|
1331
|
-
/*:: ?: RequestOptions*/
|
|
1332
|
-
)
|
|
1333
|
-
/*: Promise<ParseUser>*/
|
|
1334
|
-
{
|
|
744
|
+
value: function (password /*: string*/, options /*:: ?: RequestOptions*/) /*: Promise<ParseUser>*/{
|
|
1335
745
|
var username = this.getUsername() || '';
|
|
1336
746
|
return ParseUser.verifyPassword(username, password, options);
|
|
1337
747
|
}
|
|
1338
748
|
}], [{
|
|
1339
749
|
key: "readOnlyAttributes",
|
|
1340
|
-
value: function
|
|
750
|
+
value: function () {
|
|
1341
751
|
return ['sessionToken'];
|
|
1342
752
|
}
|
|
753
|
+
|
|
1343
754
|
/**
|
|
1344
755
|
* Adds functionality to the existing Parse.User class.
|
|
1345
756
|
*
|
|
@@ -1348,14 +759,9 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1348
759
|
* @static
|
|
1349
760
|
* @returns {Parse.User} The newly extended Parse.User class
|
|
1350
761
|
*/
|
|
1351
|
-
|
|
1352
762
|
}, {
|
|
1353
763
|
key: "extend",
|
|
1354
|
-
value: function
|
|
1355
|
-
/*: { [prop: string]: any }*/
|
|
1356
|
-
, classProps
|
|
1357
|
-
/*: { [prop: string]: any }*/
|
|
1358
|
-
) {
|
|
764
|
+
value: function (protoProps /*: { [prop: string]: any }*/, classProps /*: { [prop: string]: any }*/) {
|
|
1359
765
|
if (protoProps) {
|
|
1360
766
|
for (var _prop in protoProps) {
|
|
1361
767
|
if (_prop !== 'className') {
|
|
@@ -1368,7 +774,6 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1368
774
|
}
|
|
1369
775
|
}
|
|
1370
776
|
}
|
|
1371
|
-
|
|
1372
777
|
if (classProps) {
|
|
1373
778
|
for (var _prop2 in classProps) {
|
|
1374
779
|
if (_prop2 !== 'className') {
|
|
@@ -1381,9 +786,9 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1381
786
|
}
|
|
1382
787
|
}
|
|
1383
788
|
}
|
|
1384
|
-
|
|
1385
789
|
return ParseUser;
|
|
1386
790
|
}
|
|
791
|
+
|
|
1387
792
|
/**
|
|
1388
793
|
* Retrieves the currently logged in ParseUser with a valid session,
|
|
1389
794
|
* either from memory or localStorage, if necessary.
|
|
@@ -1391,20 +796,16 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1391
796
|
* @static
|
|
1392
797
|
* @returns {Parse.Object} The currently logged in Parse.User.
|
|
1393
798
|
*/
|
|
1394
|
-
|
|
1395
799
|
}, {
|
|
1396
800
|
key: "current",
|
|
1397
|
-
value: function
|
|
1398
|
-
/*: ?ParseUser*/
|
|
1399
|
-
{
|
|
801
|
+
value: function () /*: ?ParseUser*/{
|
|
1400
802
|
if (!canUseCurrentUser) {
|
|
1401
803
|
return null;
|
|
1402
804
|
}
|
|
1403
|
-
|
|
1404
805
|
var controller = _CoreManager.default.getUserController();
|
|
1405
|
-
|
|
1406
806
|
return controller.currentUser();
|
|
1407
807
|
}
|
|
808
|
+
|
|
1408
809
|
/**
|
|
1409
810
|
* Retrieves the currently logged in ParseUser from asynchronous Storage.
|
|
1410
811
|
*
|
|
@@ -1412,20 +813,16 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1412
813
|
* @returns {Promise} A Promise that is resolved with the currently
|
|
1413
814
|
* logged in Parse User
|
|
1414
815
|
*/
|
|
1415
|
-
|
|
1416
816
|
}, {
|
|
1417
817
|
key: "currentAsync",
|
|
1418
|
-
value: function
|
|
1419
|
-
/*: Promise<?ParseUser>*/
|
|
1420
|
-
{
|
|
818
|
+
value: function () /*: Promise<?ParseUser>*/{
|
|
1421
819
|
if (!canUseCurrentUser) {
|
|
1422
820
|
return _promise.default.resolve(null);
|
|
1423
821
|
}
|
|
1424
|
-
|
|
1425
822
|
var controller = _CoreManager.default.getUserController();
|
|
1426
|
-
|
|
1427
823
|
return controller.currentUserAsync();
|
|
1428
824
|
}
|
|
825
|
+
|
|
1429
826
|
/**
|
|
1430
827
|
* Signs up a new user with a username (or email) and password.
|
|
1431
828
|
* This will create a new Parse.User on the server, and also persist the
|
|
@@ -1440,24 +837,16 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1440
837
|
* @returns {Promise} A promise that is fulfilled with the user when
|
|
1441
838
|
* the signup completes.
|
|
1442
839
|
*/
|
|
1443
|
-
|
|
1444
840
|
}, {
|
|
1445
841
|
key: "signUp",
|
|
1446
|
-
value: function
|
|
1447
|
-
/*: string*/
|
|
1448
|
-
, password
|
|
1449
|
-
/*: string*/
|
|
1450
|
-
, attrs
|
|
1451
|
-
/*: AttributeMap*/
|
|
1452
|
-
, options
|
|
1453
|
-
/*:: ?: FullOptions*/
|
|
1454
|
-
) {
|
|
842
|
+
value: function (username /*: string*/, password /*: string*/, attrs /*: AttributeMap*/, options /*:: ?: FullOptions*/) {
|
|
1455
843
|
attrs = attrs || {};
|
|
1456
844
|
attrs.username = username;
|
|
1457
845
|
attrs.password = password;
|
|
1458
846
|
var user = new this(attrs);
|
|
1459
847
|
return user.signUp({}, options);
|
|
1460
848
|
}
|
|
849
|
+
|
|
1461
850
|
/**
|
|
1462
851
|
* Logs in a user with a username (or email) and password. On success, this
|
|
1463
852
|
* saves the session to disk, so you can retrieve the currently logged in
|
|
@@ -1470,31 +859,22 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1470
859
|
* @returns {Promise} A promise that is fulfilled with the user when
|
|
1471
860
|
* the login completes.
|
|
1472
861
|
*/
|
|
1473
|
-
|
|
1474
862
|
}, {
|
|
1475
863
|
key: "logIn",
|
|
1476
|
-
value: function
|
|
1477
|
-
/*: string*/
|
|
1478
|
-
, password
|
|
1479
|
-
/*: string*/
|
|
1480
|
-
, options
|
|
1481
|
-
/*:: ?: FullOptions*/
|
|
1482
|
-
) {
|
|
864
|
+
value: function (username /*: string*/, password /*: string*/, options /*:: ?: FullOptions*/) {
|
|
1483
865
|
if (typeof username !== 'string') {
|
|
1484
866
|
return _promise.default.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Username must be a string.'));
|
|
1485
867
|
} else if (typeof password !== 'string') {
|
|
1486
868
|
return _promise.default.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Password must be a string.'));
|
|
1487
869
|
}
|
|
1488
|
-
|
|
1489
870
|
var user = new this();
|
|
1490
|
-
|
|
1491
871
|
user._finishFetch({
|
|
1492
872
|
username: username,
|
|
1493
873
|
password: password
|
|
1494
874
|
});
|
|
1495
|
-
|
|
1496
875
|
return user.logIn(options);
|
|
1497
876
|
}
|
|
877
|
+
|
|
1498
878
|
/**
|
|
1499
879
|
* Logs in a user with a session token. On success, this saves the session
|
|
1500
880
|
* to disk, so you can retrieve the currently logged in user using
|
|
@@ -1506,34 +886,24 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1506
886
|
* @returns {Promise} A promise that is fulfilled with the user when
|
|
1507
887
|
* the login completes.
|
|
1508
888
|
*/
|
|
1509
|
-
|
|
1510
889
|
}, {
|
|
1511
890
|
key: "become",
|
|
1512
|
-
value: function
|
|
1513
|
-
/*: string*/
|
|
1514
|
-
, options
|
|
1515
|
-
/*:: ?: RequestOptions*/
|
|
1516
|
-
) {
|
|
891
|
+
value: function (sessionToken /*: string*/, options /*:: ?: RequestOptions*/) {
|
|
1517
892
|
if (!canUseCurrentUser) {
|
|
1518
893
|
throw new Error('It is not memory-safe to become a user in a server environment');
|
|
1519
894
|
}
|
|
1520
|
-
|
|
1521
895
|
options = options || {};
|
|
1522
|
-
var becomeOptions
|
|
1523
|
-
/*: RequestOptions*/
|
|
1524
|
-
= {
|
|
896
|
+
var becomeOptions /*: RequestOptions*/ = {
|
|
1525
897
|
sessionToken: sessionToken
|
|
1526
898
|
};
|
|
1527
|
-
|
|
1528
899
|
if (options.hasOwnProperty('useMasterKey')) {
|
|
1529
900
|
becomeOptions.useMasterKey = options.useMasterKey;
|
|
1530
901
|
}
|
|
1531
|
-
|
|
1532
902
|
var controller = _CoreManager.default.getUserController();
|
|
1533
|
-
|
|
1534
903
|
var user = new this();
|
|
1535
904
|
return controller.become(user, becomeOptions);
|
|
1536
905
|
}
|
|
906
|
+
|
|
1537
907
|
/**
|
|
1538
908
|
* Retrieves a user with a session token.
|
|
1539
909
|
*
|
|
@@ -1542,31 +912,21 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1542
912
|
* @static
|
|
1543
913
|
* @returns {Promise} A promise that is fulfilled with the user is fetched.
|
|
1544
914
|
*/
|
|
1545
|
-
|
|
1546
915
|
}, {
|
|
1547
916
|
key: "me",
|
|
1548
|
-
value: function
|
|
1549
|
-
|
|
1550
|
-
) {
|
|
1551
|
-
var options
|
|
1552
|
-
/*:: ?: RequestOptions*/
|
|
1553
|
-
= arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1554
|
-
|
|
917
|
+
value: function (sessionToken /*: string*/) {
|
|
918
|
+
var options /*:: ?: RequestOptions*/ = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1555
919
|
var controller = _CoreManager.default.getUserController();
|
|
1556
|
-
|
|
1557
|
-
var meOptions
|
|
1558
|
-
/*: RequestOptions*/
|
|
1559
|
-
= {
|
|
920
|
+
var meOptions /*: RequestOptions*/ = {
|
|
1560
921
|
sessionToken: sessionToken
|
|
1561
922
|
};
|
|
1562
|
-
|
|
1563
923
|
if (options.useMasterKey) {
|
|
1564
924
|
meOptions.useMasterKey = options.useMasterKey;
|
|
1565
925
|
}
|
|
1566
|
-
|
|
1567
926
|
var user = new this();
|
|
1568
927
|
return controller.me(user, meOptions);
|
|
1569
928
|
}
|
|
929
|
+
|
|
1570
930
|
/**
|
|
1571
931
|
* Logs in a user with a session token. On success, this saves the session
|
|
1572
932
|
* to disk, so you can retrieve the currently logged in user using
|
|
@@ -1577,17 +937,14 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1577
937
|
* @returns {Promise} A promise that is fulfilled with the user when
|
|
1578
938
|
* the login completes.
|
|
1579
939
|
*/
|
|
1580
|
-
|
|
1581
940
|
}, {
|
|
1582
941
|
key: "hydrate",
|
|
1583
|
-
value: function
|
|
1584
|
-
/*: AttributeMap*/
|
|
1585
|
-
) {
|
|
942
|
+
value: function (userJSON /*: AttributeMap*/) {
|
|
1586
943
|
var controller = _CoreManager.default.getUserController();
|
|
1587
|
-
|
|
1588
944
|
var user = new this();
|
|
1589
945
|
return controller.hydrate(user, userJSON);
|
|
1590
946
|
}
|
|
947
|
+
|
|
1591
948
|
/**
|
|
1592
949
|
* Static version of {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.User.html#linkWith linkWith}
|
|
1593
950
|
*
|
|
@@ -1597,21 +954,13 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1597
954
|
* @static
|
|
1598
955
|
* @returns {Promise}
|
|
1599
956
|
*/
|
|
1600
|
-
|
|
1601
957
|
}, {
|
|
1602
958
|
key: "logInWith",
|
|
1603
|
-
value: function
|
|
1604
|
-
/*: any*/
|
|
1605
|
-
, options
|
|
1606
|
-
/*: { authData?: AuthData }*/
|
|
1607
|
-
, saveOpts
|
|
1608
|
-
/*:: ?: FullOptions*/
|
|
1609
|
-
)
|
|
1610
|
-
/*: Promise<ParseUser>*/
|
|
1611
|
-
{
|
|
959
|
+
value: function (provider /*: any*/, options /*: { authData?: AuthData }*/, saveOpts /*:: ?: FullOptions*/) /*: Promise<ParseUser>*/{
|
|
1612
960
|
var user = new this();
|
|
1613
961
|
return user.linkWith(provider, options, saveOpts);
|
|
1614
962
|
}
|
|
963
|
+
|
|
1615
964
|
/**
|
|
1616
965
|
* Logs out the currently logged in user session. This will remove the
|
|
1617
966
|
* session from disk, log out of linked services, and future calls to
|
|
@@ -1622,18 +971,14 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1622
971
|
* @returns {Promise} A promise that is resolved when the session is
|
|
1623
972
|
* destroyed on the server.
|
|
1624
973
|
*/
|
|
1625
|
-
|
|
1626
974
|
}, {
|
|
1627
975
|
key: "logOut",
|
|
1628
|
-
value: function
|
|
1629
|
-
var options
|
|
1630
|
-
/*: RequestOptions*/
|
|
1631
|
-
= arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1632
|
-
|
|
976
|
+
value: function () {
|
|
977
|
+
var options /*: RequestOptions*/ = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1633
978
|
var controller = _CoreManager.default.getUserController();
|
|
1634
|
-
|
|
1635
979
|
return controller.logOut(options);
|
|
1636
980
|
}
|
|
981
|
+
|
|
1637
982
|
/**
|
|
1638
983
|
* Requests a password reset email to be sent to the specified email address
|
|
1639
984
|
* associated with the user account. This email allows the user to securely
|
|
@@ -1645,25 +990,18 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1645
990
|
* @static
|
|
1646
991
|
* @returns {Promise}
|
|
1647
992
|
*/
|
|
1648
|
-
|
|
1649
993
|
}, {
|
|
1650
994
|
key: "requestPasswordReset",
|
|
1651
|
-
value: function
|
|
1652
|
-
/*: string*/
|
|
1653
|
-
, options
|
|
1654
|
-
/*:: ?: RequestOptions*/
|
|
1655
|
-
) {
|
|
995
|
+
value: function (email /*: string*/, options /*:: ?: RequestOptions*/) {
|
|
1656
996
|
options = options || {};
|
|
1657
997
|
var requestOptions = {};
|
|
1658
|
-
|
|
1659
998
|
if (options.hasOwnProperty('useMasterKey')) {
|
|
1660
999
|
requestOptions.useMasterKey = options.useMasterKey;
|
|
1661
1000
|
}
|
|
1662
|
-
|
|
1663
1001
|
var controller = _CoreManager.default.getUserController();
|
|
1664
|
-
|
|
1665
1002
|
return controller.requestPasswordReset(email, requestOptions);
|
|
1666
1003
|
}
|
|
1004
|
+
|
|
1667
1005
|
/**
|
|
1668
1006
|
* Request an email verification.
|
|
1669
1007
|
*
|
|
@@ -1673,25 +1011,18 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1673
1011
|
* @static
|
|
1674
1012
|
* @returns {Promise}
|
|
1675
1013
|
*/
|
|
1676
|
-
|
|
1677
1014
|
}, {
|
|
1678
1015
|
key: "requestEmailVerification",
|
|
1679
|
-
value: function
|
|
1680
|
-
/*: string*/
|
|
1681
|
-
, options
|
|
1682
|
-
/*:: ?: RequestOptions*/
|
|
1683
|
-
) {
|
|
1016
|
+
value: function (email /*: string*/, options /*:: ?: RequestOptions*/) {
|
|
1684
1017
|
options = options || {};
|
|
1685
1018
|
var requestOptions = {};
|
|
1686
|
-
|
|
1687
1019
|
if (options.hasOwnProperty('useMasterKey')) {
|
|
1688
1020
|
requestOptions.useMasterKey = options.useMasterKey;
|
|
1689
1021
|
}
|
|
1690
|
-
|
|
1691
1022
|
var controller = _CoreManager.default.getUserController();
|
|
1692
|
-
|
|
1693
1023
|
return controller.requestEmailVerification(email, requestOptions);
|
|
1694
1024
|
}
|
|
1025
|
+
|
|
1695
1026
|
/**
|
|
1696
1027
|
* Verify whether a given password is the password of the current user.
|
|
1697
1028
|
*
|
|
@@ -1702,35 +1033,24 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1702
1033
|
* @returns {Promise} A promise that is fulfilled with a user
|
|
1703
1034
|
* when the password is correct.
|
|
1704
1035
|
*/
|
|
1705
|
-
|
|
1706
1036
|
}, {
|
|
1707
1037
|
key: "verifyPassword",
|
|
1708
|
-
value: function
|
|
1709
|
-
/*: string*/
|
|
1710
|
-
, password
|
|
1711
|
-
/*: string*/
|
|
1712
|
-
, options
|
|
1713
|
-
/*:: ?: RequestOptions*/
|
|
1714
|
-
) {
|
|
1038
|
+
value: function (username /*: string*/, password /*: string*/, options /*:: ?: RequestOptions*/) {
|
|
1715
1039
|
if (typeof username !== 'string') {
|
|
1716
1040
|
return _promise.default.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Username must be a string.'));
|
|
1717
1041
|
}
|
|
1718
|
-
|
|
1719
1042
|
if (typeof password !== 'string') {
|
|
1720
1043
|
return _promise.default.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Password must be a string.'));
|
|
1721
1044
|
}
|
|
1722
|
-
|
|
1723
1045
|
options = options || {};
|
|
1724
1046
|
var verificationOption = {};
|
|
1725
|
-
|
|
1726
1047
|
if (options.hasOwnProperty('useMasterKey')) {
|
|
1727
1048
|
verificationOption.useMasterKey = options.useMasterKey;
|
|
1728
1049
|
}
|
|
1729
|
-
|
|
1730
1050
|
var controller = _CoreManager.default.getUserController();
|
|
1731
|
-
|
|
1732
1051
|
return controller.verifyPassword(username, password, verificationOption);
|
|
1733
1052
|
}
|
|
1053
|
+
|
|
1734
1054
|
/**
|
|
1735
1055
|
* Allow someone to define a custom User class without className
|
|
1736
1056
|
* being rewritten to _User. The default behavior is to rewrite
|
|
@@ -1740,14 +1060,12 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1740
1060
|
* @param {boolean} isAllowed Whether or not to allow custom User class
|
|
1741
1061
|
* @static
|
|
1742
1062
|
*/
|
|
1743
|
-
|
|
1744
1063
|
}, {
|
|
1745
1064
|
key: "allowCustomUserClass",
|
|
1746
|
-
value: function
|
|
1747
|
-
/*: boolean*/
|
|
1748
|
-
) {
|
|
1065
|
+
value: function (isAllowed /*: boolean*/) {
|
|
1749
1066
|
_CoreManager.default.set('PERFORM_USER_REWRITE', !isAllowed);
|
|
1750
1067
|
}
|
|
1068
|
+
|
|
1751
1069
|
/**
|
|
1752
1070
|
* Allows a legacy application to start using revocable sessions. If the
|
|
1753
1071
|
* current session token is not revocable, a request will be made for a new,
|
|
@@ -1762,26 +1080,20 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1762
1080
|
* completed. If a replacement session token is requested, the promise
|
|
1763
1081
|
* will be resolved after a new token has been fetched.
|
|
1764
1082
|
*/
|
|
1765
|
-
|
|
1766
1083
|
}, {
|
|
1767
1084
|
key: "enableRevocableSession",
|
|
1768
|
-
value: function
|
|
1769
|
-
/*:: ?: RequestOptions*/
|
|
1770
|
-
) {
|
|
1085
|
+
value: function (options /*:: ?: RequestOptions*/) {
|
|
1771
1086
|
options = options || {};
|
|
1772
|
-
|
|
1773
1087
|
_CoreManager.default.set('FORCE_REVOCABLE_SESSION', true);
|
|
1774
|
-
|
|
1775
1088
|
if (canUseCurrentUser) {
|
|
1776
1089
|
var current = ParseUser.current();
|
|
1777
|
-
|
|
1778
1090
|
if (current) {
|
|
1779
1091
|
return current._upgradeToRevocableSession(options);
|
|
1780
1092
|
}
|
|
1781
1093
|
}
|
|
1782
|
-
|
|
1783
1094
|
return _promise.default.resolve();
|
|
1784
1095
|
}
|
|
1096
|
+
|
|
1785
1097
|
/**
|
|
1786
1098
|
* Enables the use of become or the current user in a server
|
|
1787
1099
|
* environment. These features are disabled by default, since they depend on
|
|
@@ -1789,12 +1101,12 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1789
1101
|
*
|
|
1790
1102
|
* @static
|
|
1791
1103
|
*/
|
|
1792
|
-
|
|
1793
1104
|
}, {
|
|
1794
1105
|
key: "enableUnsafeCurrentUser",
|
|
1795
|
-
value: function
|
|
1106
|
+
value: function () {
|
|
1796
1107
|
canUseCurrentUser = true;
|
|
1797
1108
|
}
|
|
1109
|
+
|
|
1798
1110
|
/**
|
|
1799
1111
|
* Disables the use of become or the current user in any environment.
|
|
1800
1112
|
* These features are disabled on servers by default, since they depend on
|
|
@@ -1802,12 +1114,12 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1802
1114
|
*
|
|
1803
1115
|
* @static
|
|
1804
1116
|
*/
|
|
1805
|
-
|
|
1806
1117
|
}, {
|
|
1807
1118
|
key: "disableUnsafeCurrentUser",
|
|
1808
|
-
value: function
|
|
1119
|
+
value: function () {
|
|
1809
1120
|
canUseCurrentUser = false;
|
|
1810
1121
|
}
|
|
1122
|
+
|
|
1811
1123
|
/**
|
|
1812
1124
|
* When registering users with {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.User.html#linkWith linkWith} a basic auth provider
|
|
1813
1125
|
* is automatically created for you.
|
|
@@ -1820,20 +1132,18 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1820
1132
|
* @see {@link https://docs.parseplatform.org/js/guide/#custom-authentication-module Custom Authentication Module}
|
|
1821
1133
|
* @static
|
|
1822
1134
|
*/
|
|
1823
|
-
|
|
1824
1135
|
}, {
|
|
1825
1136
|
key: "_registerAuthenticationProvider",
|
|
1826
|
-
value: function
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
authProviders[provider.getAuthType()] = provider; // Synchronize the current user with the auth provider.
|
|
1830
|
-
|
|
1137
|
+
value: function (provider /*: any*/) {
|
|
1138
|
+
authProviders[provider.getAuthType()] = provider;
|
|
1139
|
+
// Synchronize the current user with the auth provider.
|
|
1831
1140
|
ParseUser.currentAsync().then(function (current) {
|
|
1832
1141
|
if (current) {
|
|
1833
1142
|
current._synchronizeAuthData(provider.getAuthType());
|
|
1834
1143
|
}
|
|
1835
1144
|
});
|
|
1836
1145
|
}
|
|
1146
|
+
|
|
1837
1147
|
/**
|
|
1838
1148
|
* @param provider
|
|
1839
1149
|
* @param options
|
|
@@ -1842,324 +1152,208 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1842
1152
|
* @static
|
|
1843
1153
|
* @returns {Promise}
|
|
1844
1154
|
*/
|
|
1845
|
-
|
|
1846
1155
|
}, {
|
|
1847
1156
|
key: "_logInWith",
|
|
1848
|
-
value: function
|
|
1849
|
-
/*: any*/
|
|
1850
|
-
, options
|
|
1851
|
-
/*: { authData?: AuthData }*/
|
|
1852
|
-
, saveOpts
|
|
1853
|
-
/*:: ?: FullOptions*/
|
|
1854
|
-
) {
|
|
1157
|
+
value: function (provider /*: any*/, options /*: { authData?: AuthData }*/, saveOpts /*:: ?: FullOptions*/) {
|
|
1855
1158
|
var user = new this();
|
|
1856
1159
|
return user.linkWith(provider, options, saveOpts);
|
|
1857
1160
|
}
|
|
1858
1161
|
}, {
|
|
1859
1162
|
key: "_clearCache",
|
|
1860
|
-
value: function
|
|
1163
|
+
value: function () {
|
|
1861
1164
|
currentUserCache = null;
|
|
1862
1165
|
currentUserCacheMatchesDisk = false;
|
|
1863
1166
|
}
|
|
1864
1167
|
}, {
|
|
1865
1168
|
key: "_setCurrentUserCache",
|
|
1866
|
-
value: function
|
|
1867
|
-
/*: ParseUser*/
|
|
1868
|
-
) {
|
|
1169
|
+
value: function (user /*: ParseUser*/) {
|
|
1869
1170
|
currentUserCache = user;
|
|
1870
1171
|
}
|
|
1871
1172
|
}]);
|
|
1872
1173
|
return ParseUser;
|
|
1873
1174
|
}(_ParseObject2.default);
|
|
1874
|
-
|
|
1875
1175
|
_ParseObject2.default.registerSubclass('_User', ParseUser);
|
|
1876
|
-
|
|
1877
1176
|
var DefaultController = {
|
|
1878
|
-
updateUserOnDisk: function
|
|
1177
|
+
updateUserOnDisk: function (user) {
|
|
1879
1178
|
var path = _Storage.default.generatePath(CURRENT_USER_KEY);
|
|
1880
|
-
|
|
1881
1179
|
var json = user.toJSON();
|
|
1882
1180
|
delete json.password;
|
|
1883
1181
|
json.className = '_User';
|
|
1884
1182
|
var userData = (0, _stringify.default)(json);
|
|
1885
|
-
|
|
1886
1183
|
if (_CoreManager.default.get('ENCRYPTED_USER')) {
|
|
1887
1184
|
var crypto = _CoreManager.default.getCryptoController();
|
|
1888
|
-
|
|
1889
1185
|
userData = crypto.encrypt(json, _CoreManager.default.get('ENCRYPTED_KEY'));
|
|
1890
1186
|
}
|
|
1891
|
-
|
|
1892
1187
|
return _Storage.default.setItemAsync(path, userData).then(function () {
|
|
1893
1188
|
return user;
|
|
1894
1189
|
});
|
|
1895
1190
|
},
|
|
1896
|
-
removeUserFromDisk: function
|
|
1191
|
+
removeUserFromDisk: function () {
|
|
1897
1192
|
var path = _Storage.default.generatePath(CURRENT_USER_KEY);
|
|
1898
|
-
|
|
1899
1193
|
currentUserCacheMatchesDisk = true;
|
|
1900
1194
|
currentUserCache = null;
|
|
1901
1195
|
return _Storage.default.removeItemAsync(path);
|
|
1902
1196
|
},
|
|
1903
|
-
setCurrentUser: function
|
|
1197
|
+
setCurrentUser: function (user) {
|
|
1904
1198
|
currentUserCache = user;
|
|
1905
|
-
|
|
1906
1199
|
user._cleanupAuthData();
|
|
1907
|
-
|
|
1908
1200
|
user._synchronizeAllAuthData();
|
|
1909
|
-
|
|
1910
1201
|
return DefaultController.updateUserOnDisk(user);
|
|
1911
1202
|
},
|
|
1912
|
-
currentUser: function
|
|
1913
|
-
/*: ?ParseUser*/
|
|
1914
|
-
{
|
|
1203
|
+
currentUser: function () /*: ?ParseUser*/{
|
|
1915
1204
|
if (currentUserCache) {
|
|
1916
1205
|
return currentUserCache;
|
|
1917
1206
|
}
|
|
1918
|
-
|
|
1919
1207
|
if (currentUserCacheMatchesDisk) {
|
|
1920
1208
|
return null;
|
|
1921
1209
|
}
|
|
1922
|
-
|
|
1923
1210
|
if (_Storage.default.async()) {
|
|
1924
1211
|
throw new Error('Cannot call currentUser() when using a platform with an async ' + 'storage system. Call currentUserAsync() instead.');
|
|
1925
1212
|
}
|
|
1926
|
-
|
|
1927
1213
|
var path = _Storage.default.generatePath(CURRENT_USER_KEY);
|
|
1928
|
-
|
|
1929
1214
|
var userData = _Storage.default.getItem(path);
|
|
1930
|
-
|
|
1931
1215
|
currentUserCacheMatchesDisk = true;
|
|
1932
|
-
|
|
1933
1216
|
if (!userData) {
|
|
1934
1217
|
currentUserCache = null;
|
|
1935
1218
|
return null;
|
|
1936
1219
|
}
|
|
1937
|
-
|
|
1938
1220
|
if (_CoreManager.default.get('ENCRYPTED_USER')) {
|
|
1939
1221
|
var crypto = _CoreManager.default.getCryptoController();
|
|
1940
|
-
|
|
1941
1222
|
userData = crypto.decrypt(userData, _CoreManager.default.get('ENCRYPTED_KEY'));
|
|
1942
1223
|
}
|
|
1943
|
-
|
|
1944
1224
|
userData = JSON.parse(userData);
|
|
1945
|
-
|
|
1946
1225
|
if (!userData.className) {
|
|
1947
1226
|
userData.className = '_User';
|
|
1948
1227
|
}
|
|
1949
|
-
|
|
1950
1228
|
if (userData._id) {
|
|
1951
1229
|
if (userData.objectId !== userData._id) {
|
|
1952
1230
|
userData.objectId = userData._id;
|
|
1953
1231
|
}
|
|
1954
|
-
|
|
1955
1232
|
delete userData._id;
|
|
1956
1233
|
}
|
|
1957
|
-
|
|
1958
1234
|
if (userData._sessionToken) {
|
|
1959
1235
|
userData.sessionToken = userData._sessionToken;
|
|
1960
1236
|
delete userData._sessionToken;
|
|
1961
1237
|
}
|
|
1962
|
-
|
|
1963
1238
|
var current = _ParseObject2.default.fromJSON(userData);
|
|
1964
|
-
|
|
1965
1239
|
currentUserCache = current;
|
|
1966
|
-
|
|
1967
1240
|
current._synchronizeAllAuthData();
|
|
1968
|
-
|
|
1969
1241
|
return current;
|
|
1970
1242
|
},
|
|
1971
|
-
currentUserAsync: function
|
|
1972
|
-
/*: Promise<?ParseUser>*/
|
|
1973
|
-
{
|
|
1243
|
+
currentUserAsync: function () /*: Promise<?ParseUser>*/{
|
|
1974
1244
|
if (currentUserCache) {
|
|
1975
1245
|
return _promise.default.resolve(currentUserCache);
|
|
1976
1246
|
}
|
|
1977
|
-
|
|
1978
1247
|
if (currentUserCacheMatchesDisk) {
|
|
1979
1248
|
return _promise.default.resolve(null);
|
|
1980
1249
|
}
|
|
1981
|
-
|
|
1982
1250
|
var path = _Storage.default.generatePath(CURRENT_USER_KEY);
|
|
1983
|
-
|
|
1984
1251
|
return _Storage.default.getItemAsync(path).then(function (userData) {
|
|
1985
1252
|
currentUserCacheMatchesDisk = true;
|
|
1986
|
-
|
|
1987
1253
|
if (!userData) {
|
|
1988
1254
|
currentUserCache = null;
|
|
1989
1255
|
return _promise.default.resolve(null);
|
|
1990
1256
|
}
|
|
1991
|
-
|
|
1992
1257
|
if (_CoreManager.default.get('ENCRYPTED_USER')) {
|
|
1993
1258
|
var crypto = _CoreManager.default.getCryptoController();
|
|
1994
|
-
|
|
1995
1259
|
userData = crypto.decrypt(userData.toString(), _CoreManager.default.get('ENCRYPTED_KEY'));
|
|
1996
1260
|
}
|
|
1997
|
-
|
|
1998
1261
|
userData = JSON.parse(userData);
|
|
1999
|
-
|
|
2000
1262
|
if (!userData.className) {
|
|
2001
1263
|
userData.className = '_User';
|
|
2002
1264
|
}
|
|
2003
|
-
|
|
2004
1265
|
if (userData._id) {
|
|
2005
1266
|
if (userData.objectId !== userData._id) {
|
|
2006
1267
|
userData.objectId = userData._id;
|
|
2007
1268
|
}
|
|
2008
|
-
|
|
2009
1269
|
delete userData._id;
|
|
2010
1270
|
}
|
|
2011
|
-
|
|
2012
1271
|
if (userData._sessionToken) {
|
|
2013
1272
|
userData.sessionToken = userData._sessionToken;
|
|
2014
1273
|
delete userData._sessionToken;
|
|
2015
1274
|
}
|
|
2016
|
-
|
|
2017
1275
|
var current = _ParseObject2.default.fromJSON(userData);
|
|
2018
|
-
|
|
2019
1276
|
currentUserCache = current;
|
|
2020
|
-
|
|
2021
1277
|
current._synchronizeAllAuthData();
|
|
2022
|
-
|
|
2023
1278
|
return _promise.default.resolve(current);
|
|
2024
1279
|
});
|
|
2025
1280
|
},
|
|
2026
|
-
signUp: function
|
|
2027
|
-
/*: ParseUser*/
|
|
2028
|
-
, attrs
|
|
2029
|
-
/*: AttributeMap*/
|
|
2030
|
-
, options
|
|
2031
|
-
/*: RequestOptions*/
|
|
2032
|
-
)
|
|
2033
|
-
/*: Promise<ParseUser>*/
|
|
2034
|
-
{
|
|
1281
|
+
signUp: function (user /*: ParseUser*/, attrs /*: AttributeMap*/, options /*: RequestOptions*/) /*: Promise<ParseUser>*/{
|
|
2035
1282
|
var username = attrs && attrs.username || user.get('username');
|
|
2036
1283
|
var password = attrs && attrs.password || user.get('password');
|
|
2037
|
-
|
|
2038
1284
|
if (!username || !username.length) {
|
|
2039
1285
|
return _promise.default.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Cannot sign up user with an empty username.'));
|
|
2040
1286
|
}
|
|
2041
|
-
|
|
2042
1287
|
if (!password || !password.length) {
|
|
2043
1288
|
return _promise.default.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Cannot sign up user with an empty password.'));
|
|
2044
1289
|
}
|
|
2045
|
-
|
|
2046
1290
|
return user.save(attrs, options).then(function () {
|
|
2047
1291
|
// Clear the password field
|
|
2048
1292
|
user._finishFetch({
|
|
2049
1293
|
password: undefined
|
|
2050
1294
|
});
|
|
2051
|
-
|
|
2052
1295
|
if (canUseCurrentUser) {
|
|
2053
1296
|
return DefaultController.setCurrentUser(user);
|
|
2054
1297
|
}
|
|
2055
|
-
|
|
2056
1298
|
return user;
|
|
2057
1299
|
});
|
|
2058
1300
|
},
|
|
2059
|
-
logIn: function
|
|
2060
|
-
/*: ParseUser*/
|
|
2061
|
-
, options
|
|
2062
|
-
/*: RequestOptions*/
|
|
2063
|
-
)
|
|
2064
|
-
/*: Promise<ParseUser>*/
|
|
2065
|
-
{
|
|
1301
|
+
logIn: function (user /*: ParseUser*/, options /*: RequestOptions*/) /*: Promise<ParseUser>*/{
|
|
2066
1302
|
var RESTController = _CoreManager.default.getRESTController();
|
|
2067
|
-
|
|
2068
1303
|
var stateController = _CoreManager.default.getObjectStateController();
|
|
2069
|
-
|
|
2070
1304
|
var auth = {
|
|
2071
1305
|
username: user.get('username'),
|
|
2072
1306
|
password: user.get('password')
|
|
2073
1307
|
};
|
|
2074
1308
|
return RESTController.request(options.usePost ? 'POST' : 'GET', 'login', auth, options).then(function (response) {
|
|
2075
1309
|
user._migrateId(response.objectId);
|
|
2076
|
-
|
|
2077
1310
|
user._setExisted(true);
|
|
2078
|
-
|
|
2079
1311
|
stateController.setPendingOp(user._getStateIdentifier(), 'username', undefined);
|
|
2080
1312
|
stateController.setPendingOp(user._getStateIdentifier(), 'password', undefined);
|
|
2081
1313
|
response.password = undefined;
|
|
2082
|
-
|
|
2083
1314
|
user._finishFetch(response);
|
|
2084
|
-
|
|
2085
1315
|
if (!canUseCurrentUser) {
|
|
2086
1316
|
// We can't set the current user, so just return the one we logged in
|
|
2087
1317
|
return _promise.default.resolve(user);
|
|
2088
1318
|
}
|
|
2089
|
-
|
|
2090
1319
|
return DefaultController.setCurrentUser(user);
|
|
2091
1320
|
});
|
|
2092
1321
|
},
|
|
2093
|
-
become: function
|
|
2094
|
-
/*: ParseUser*/
|
|
2095
|
-
, options
|
|
2096
|
-
/*: RequestOptions*/
|
|
2097
|
-
)
|
|
2098
|
-
/*: Promise<ParseUser>*/
|
|
2099
|
-
{
|
|
1322
|
+
become: function (user /*: ParseUser*/, options /*: RequestOptions*/) /*: Promise<ParseUser>*/{
|
|
2100
1323
|
var RESTController = _CoreManager.default.getRESTController();
|
|
2101
|
-
|
|
2102
1324
|
return RESTController.request('GET', 'users/me', {}, options).then(function (response) {
|
|
2103
1325
|
user._finishFetch(response);
|
|
2104
|
-
|
|
2105
1326
|
user._setExisted(true);
|
|
2106
|
-
|
|
2107
1327
|
return DefaultController.setCurrentUser(user);
|
|
2108
1328
|
});
|
|
2109
1329
|
},
|
|
2110
|
-
hydrate: function
|
|
2111
|
-
/*: ParseUser*/
|
|
2112
|
-
, userJSON
|
|
2113
|
-
/*: AttributeMap*/
|
|
2114
|
-
)
|
|
2115
|
-
/*: Promise<ParseUser>*/
|
|
2116
|
-
{
|
|
1330
|
+
hydrate: function (user /*: ParseUser*/, userJSON /*: AttributeMap*/) /*: Promise<ParseUser>*/{
|
|
2117
1331
|
user._finishFetch(userJSON);
|
|
2118
|
-
|
|
2119
1332
|
user._setExisted(true);
|
|
2120
|
-
|
|
2121
1333
|
if (userJSON.sessionToken && canUseCurrentUser) {
|
|
2122
1334
|
return DefaultController.setCurrentUser(user);
|
|
2123
1335
|
} else {
|
|
2124
1336
|
return _promise.default.resolve(user);
|
|
2125
1337
|
}
|
|
2126
1338
|
},
|
|
2127
|
-
me: function
|
|
2128
|
-
/*: ParseUser*/
|
|
2129
|
-
, options
|
|
2130
|
-
/*: RequestOptions*/
|
|
2131
|
-
)
|
|
2132
|
-
/*: Promise<ParseUser>*/
|
|
2133
|
-
{
|
|
1339
|
+
me: function (user /*: ParseUser*/, options /*: RequestOptions*/) /*: Promise<ParseUser>*/{
|
|
2134
1340
|
var RESTController = _CoreManager.default.getRESTController();
|
|
2135
|
-
|
|
2136
1341
|
return RESTController.request('GET', 'users/me', {}, options).then(function (response) {
|
|
2137
1342
|
user._finishFetch(response);
|
|
2138
|
-
|
|
2139
1343
|
user._setExisted(true);
|
|
2140
|
-
|
|
2141
1344
|
return user;
|
|
2142
1345
|
});
|
|
2143
1346
|
},
|
|
2144
|
-
logOut: function
|
|
2145
|
-
/*: RequestOptions*/
|
|
2146
|
-
)
|
|
2147
|
-
/*: Promise<ParseUser>*/
|
|
2148
|
-
{
|
|
1347
|
+
logOut: function (options /*: RequestOptions*/) /*: Promise<ParseUser>*/{
|
|
2149
1348
|
var RESTController = _CoreManager.default.getRESTController();
|
|
2150
|
-
|
|
2151
1349
|
if (options.sessionToken) {
|
|
2152
1350
|
return RESTController.request('POST', 'logout', {}, options);
|
|
2153
1351
|
}
|
|
2154
|
-
|
|
2155
1352
|
return DefaultController.currentUserAsync().then(function (currentUser) {
|
|
2156
1353
|
var path = _Storage.default.generatePath(CURRENT_USER_KEY);
|
|
2157
|
-
|
|
2158
1354
|
var promise = _Storage.default.removeItemAsync(path);
|
|
2159
|
-
|
|
2160
1355
|
if (currentUser !== null) {
|
|
2161
1356
|
var currentSession = currentUser.getSessionToken();
|
|
2162
|
-
|
|
2163
1357
|
if (currentSession && (0, _isRevocableSession.default)(currentSession)) {
|
|
2164
1358
|
promise = promise.then(function () {
|
|
2165
1359
|
return RESTController.request('POST', 'logout', {}, {
|
|
@@ -2167,135 +1361,88 @@ var DefaultController = {
|
|
|
2167
1361
|
});
|
|
2168
1362
|
});
|
|
2169
1363
|
}
|
|
2170
|
-
|
|
2171
1364
|
currentUser._logOutWithAll();
|
|
2172
|
-
|
|
2173
1365
|
currentUser._finishFetch({
|
|
2174
1366
|
sessionToken: undefined
|
|
2175
1367
|
});
|
|
2176
1368
|
}
|
|
2177
|
-
|
|
2178
1369
|
currentUserCacheMatchesDisk = true;
|
|
2179
1370
|
currentUserCache = null;
|
|
2180
1371
|
return promise;
|
|
2181
1372
|
});
|
|
2182
1373
|
},
|
|
2183
|
-
requestPasswordReset: function
|
|
2184
|
-
/*: string*/
|
|
2185
|
-
, options
|
|
2186
|
-
/*: RequestOptions*/
|
|
2187
|
-
) {
|
|
1374
|
+
requestPasswordReset: function (email /*: string*/, options /*: RequestOptions*/) {
|
|
2188
1375
|
var RESTController = _CoreManager.default.getRESTController();
|
|
2189
|
-
|
|
2190
1376
|
return RESTController.request('POST', 'requestPasswordReset', {
|
|
2191
1377
|
email: email
|
|
2192
1378
|
}, options);
|
|
2193
1379
|
},
|
|
2194
|
-
upgradeToRevocableSession: function
|
|
2195
|
-
|
|
2196
|
-
, options
|
|
2197
|
-
/*: RequestOptions*/
|
|
2198
|
-
) {
|
|
2199
|
-
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
1380
|
+
upgradeToRevocableSession: function (user /*: ParseUser*/, options /*: RequestOptions*/) {
|
|
1381
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
2200
1382
|
var token, RESTController, result, session, current;
|
|
2201
|
-
return
|
|
2202
|
-
while (1) {
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
if (!current) {
|
|
2237
|
-
_context6.next = 16;
|
|
2238
|
-
break;
|
|
2239
|
-
}
|
|
2240
|
-
|
|
2241
|
-
return _context6.abrupt("return", DefaultController.setCurrentUser(user));
|
|
2242
|
-
|
|
2243
|
-
case 16:
|
|
2244
|
-
return _context6.abrupt("return", _promise.default.resolve(user));
|
|
2245
|
-
|
|
2246
|
-
case 17:
|
|
2247
|
-
case "end":
|
|
2248
|
-
return _context6.stop();
|
|
2249
|
-
}
|
|
1383
|
+
return _regenerator.default.wrap(function (_context6) {
|
|
1384
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
1385
|
+
case 0:
|
|
1386
|
+
token = user.getSessionToken();
|
|
1387
|
+
if (token) {
|
|
1388
|
+
_context6.next = 3;
|
|
1389
|
+
break;
|
|
1390
|
+
}
|
|
1391
|
+
return _context6.abrupt("return", _promise.default.reject(new _ParseError.default(_ParseError.default.SESSION_MISSING, 'Cannot upgrade a user with no session token')));
|
|
1392
|
+
case 3:
|
|
1393
|
+
options.sessionToken = token;
|
|
1394
|
+
RESTController = _CoreManager.default.getRESTController();
|
|
1395
|
+
_context6.next = 7;
|
|
1396
|
+
return RESTController.request('POST', 'upgradeToRevocableSession', {}, options);
|
|
1397
|
+
case 7:
|
|
1398
|
+
result = _context6.sent;
|
|
1399
|
+
session = new _ParseSession.default();
|
|
1400
|
+
session._finishFetch(result);
|
|
1401
|
+
user._finishFetch({
|
|
1402
|
+
sessionToken: session.getSessionToken()
|
|
1403
|
+
});
|
|
1404
|
+
_context6.next = 13;
|
|
1405
|
+
return user.isCurrentAsync();
|
|
1406
|
+
case 13:
|
|
1407
|
+
current = _context6.sent;
|
|
1408
|
+
if (!current) {
|
|
1409
|
+
_context6.next = 16;
|
|
1410
|
+
break;
|
|
1411
|
+
}
|
|
1412
|
+
return _context6.abrupt("return", DefaultController.setCurrentUser(user));
|
|
1413
|
+
case 16:
|
|
1414
|
+
return _context6.abrupt("return", _promise.default.resolve(user));
|
|
1415
|
+
case 17:
|
|
1416
|
+
case "end":
|
|
1417
|
+
return _context6.stop();
|
|
2250
1418
|
}
|
|
2251
1419
|
}, _callee6);
|
|
2252
1420
|
}))();
|
|
2253
1421
|
},
|
|
2254
|
-
linkWith: function
|
|
2255
|
-
/*: ParseUser*/
|
|
2256
|
-
, authData
|
|
2257
|
-
/*: AuthData*/
|
|
2258
|
-
, options
|
|
2259
|
-
/*: FullOptions*/
|
|
2260
|
-
) {
|
|
1422
|
+
linkWith: function (user /*: ParseUser*/, authData /*: AuthData*/, options /*: FullOptions*/) {
|
|
2261
1423
|
return user.save({
|
|
2262
1424
|
authData: authData
|
|
2263
1425
|
}, options).then(function () {
|
|
2264
1426
|
if (canUseCurrentUser) {
|
|
2265
1427
|
return DefaultController.setCurrentUser(user);
|
|
2266
1428
|
}
|
|
2267
|
-
|
|
2268
1429
|
return user;
|
|
2269
1430
|
});
|
|
2270
1431
|
},
|
|
2271
|
-
verifyPassword: function
|
|
2272
|
-
/*: string*/
|
|
2273
|
-
, password
|
|
2274
|
-
/*: string*/
|
|
2275
|
-
, options
|
|
2276
|
-
/*: RequestOptions*/
|
|
2277
|
-
) {
|
|
1432
|
+
verifyPassword: function (username /*: string*/, password /*: string*/, options /*: RequestOptions*/) {
|
|
2278
1433
|
var RESTController = _CoreManager.default.getRESTController();
|
|
2279
|
-
|
|
2280
1434
|
return RESTController.request('GET', 'verifyPassword', {
|
|
2281
1435
|
username: username,
|
|
2282
1436
|
password: password
|
|
2283
1437
|
}, options);
|
|
2284
1438
|
},
|
|
2285
|
-
requestEmailVerification: function
|
|
2286
|
-
/*: string*/
|
|
2287
|
-
, options
|
|
2288
|
-
/*: RequestOptions*/
|
|
2289
|
-
) {
|
|
1439
|
+
requestEmailVerification: function (email /*: string*/, options /*: RequestOptions*/) {
|
|
2290
1440
|
var RESTController = _CoreManager.default.getRESTController();
|
|
2291
|
-
|
|
2292
1441
|
return RESTController.request('POST', 'verificationEmailRequest', {
|
|
2293
1442
|
email: email
|
|
2294
1443
|
}, options);
|
|
2295
1444
|
}
|
|
2296
1445
|
};
|
|
2297
|
-
|
|
2298
1446
|
_CoreManager.default.setUserController(DefaultController);
|
|
2299
|
-
|
|
2300
1447
|
var _default = ParseUser;
|
|
2301
1448
|
exports.default = _default;
|