parse 4.0.0-alpha.1 → 4.0.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +167 -25
- package/NOTICE +10 -0
- package/README.md +6 -5
- package/dist/parse.js +12838 -21190
- package/dist/parse.min.js +7 -6
- package/dist/parse.weapp.js +7921 -17062
- package/dist/parse.weapp.min.js +7 -6
- package/lib/browser/Analytics.js +2 -27
- package/lib/browser/AnonymousUtils.js +6 -42
- package/lib/browser/Cloud.js +12 -77
- package/lib/browser/CloudCode.js +0 -3
- package/lib/browser/CoreManager.js +46 -191
- package/lib/browser/CryptoController.js +2 -16
- package/lib/browser/EventEmitter.js +1 -8
- package/lib/browser/EventuallyQueue.js +277 -824
- package/lib/browser/FacebookUtils.js +6 -42
- package/lib/browser/IndexedDBStorageController.js +3 -14
- package/lib/browser/InstallationController.js +2 -20
- package/lib/browser/LiveQueryClient.js +105 -213
- 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 -19
- package/lib/browser/ObjectStateMutations.js +18 -121
- package/lib/browser/OfflineQuery.js +61 -222
- package/lib/browser/Parse.js +12 -115
- package/lib/browser/ParseACL.js +33 -148
- package/lib/browser/ParseCLP.js +96 -314
- package/lib/browser/ParseConfig.js +18 -95
- package/lib/browser/ParseError.js +63 -99
- package/lib/browser/ParseFile.js +128 -685
- package/lib/browser/ParseGeoPoint.js +23 -89
- 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 +665 -1845
- package/lib/browser/ParseOp.js +41 -287
- package/lib/browser/ParsePolygon.js +13 -70
- package/lib/browser/ParseQuery.js +403 -1504
- package/lib/browser/ParseRelation.js +12 -68
- package/lib/browser/ParseRole.js +13 -75
- package/lib/browser/ParseSchema.js +49 -208
- package/lib/browser/ParseSession.js +11 -69
- package/lib/browser/ParseUser.js +274 -1127
- package/lib/browser/Push.js +7 -50
- package/lib/browser/RESTController.js +28 -157
- package/lib/browser/SingleInstanceStateController.js +19 -144
- package/lib/browser/Socket.weapp.js +0 -10
- package/lib/browser/Storage.js +10 -80
- package/lib/browser/StorageController.browser.js +4 -24
- package/lib/browser/StorageController.default.js +4 -24
- package/lib/browser/StorageController.react-native.js +6 -40
- package/lib/browser/StorageController.weapp.js +5 -23
- package/lib/browser/TaskQueue.js +1 -29
- package/lib/browser/UniqueInstanceStateController.js +19 -149
- package/lib/browser/Xhr.weapp.js +0 -17
- package/lib/browser/arrayContainsObject.js +2 -23
- package/lib/browser/canBeSerialized.js +3 -40
- package/lib/browser/decode.js +3 -40
- package/lib/browser/encode.js +9 -77
- package/lib/browser/equals.js +2 -34
- package/lib/browser/escape.js +1 -15
- package/lib/browser/isRevocableSession.js +2 -18
- package/lib/browser/parseDate.js +2 -20
- package/lib/browser/promiseUtils.js +3 -21
- package/lib/browser/unique.js +3 -24
- package/lib/browser/unsavedChildren.js +6 -57
- package/lib/browser/uuid.js +3 -1
- package/lib/node/Analytics.js +1 -25
- package/lib/node/AnonymousUtils.js +5 -44
- package/lib/node/Cloud.js +10 -73
- package/lib/node/CloudCode.js +0 -3
- package/lib/node/CoreManager.js +47 -227
- package/lib/node/CryptoController.js +2 -16
- package/lib/node/EventEmitter.js +1 -8
- package/lib/node/EventuallyQueue.js +16 -123
- package/lib/node/FacebookUtils.js +5 -44
- package/lib/node/IndexedDBStorageController.js +3 -19
- package/lib/node/InstallationController.js +2 -22
- package/lib/node/LiveQueryClient.js +72 -154
- package/lib/node/LiveQuerySubscription.js +7 -26
- package/lib/node/LocalDatastore.js +19 -182
- package/lib/node/LocalDatastoreController.js +6 -45
- package/lib/node/LocalDatastoreController.react-native.js +6 -52
- package/lib/node/LocalDatastoreUtils.js +1 -13
- package/lib/node/ObjectStateMutations.js +13 -100
- package/lib/node/OfflineQuery.js +27 -151
- package/lib/node/Parse.js +11 -108
- package/lib/node/ParseACL.js +32 -157
- package/lib/node/ParseCLP.js +69 -269
- package/lib/node/ParseConfig.js +16 -91
- package/lib/node/ParseError.js +61 -74
- package/lib/node/ParseFile.js +49 -212
- package/lib/node/ParseGeoPoint.js +21 -89
- package/lib/node/ParseHooks.js +0 -35
- package/lib/node/ParseInstallation.js +1 -17
- package/lib/node/ParseLiveQuery.js +10 -43
- package/lib/node/ParseObject.js +229 -964
- package/lib/node/ParseOp.js +31 -262
- package/lib/node/ParsePolygon.js +12 -69
- package/lib/node/ParseQuery.js +169 -888
- package/lib/node/ParseRelation.js +11 -68
- package/lib/node/ParseRole.js +10 -64
- package/lib/node/ParseSchema.js +46 -229
- package/lib/node/ParseSession.js +8 -57
- package/lib/node/ParseUser.js +107 -583
- package/lib/node/Push.js +4 -44
- package/lib/node/RESTController.js +18 -127
- package/lib/node/SingleInstanceStateController.js +17 -137
- package/lib/node/Socket.weapp.js +0 -7
- package/lib/node/Storage.js +10 -90
- package/lib/node/StorageController.browser.js +4 -30
- package/lib/node/StorageController.default.js +5 -28
- package/lib/node/StorageController.react-native.js +6 -47
- package/lib/node/StorageController.weapp.js +6 -28
- package/lib/node/TaskQueue.js +1 -24
- package/lib/node/UniqueInstanceStateController.js +16 -140
- package/lib/node/Xhr.weapp.js +0 -15
- package/lib/node/arrayContainsObject.js +1 -19
- package/lib/node/canBeSerialized.js +2 -35
- package/lib/node/decode.js +1 -33
- package/lib/node/encode.js +3 -61
- package/lib/node/equals.js +0 -27
- package/lib/node/escape.js +1 -13
- package/lib/node/isRevocableSession.js +1 -12
- package/lib/node/parseDate.js +1 -14
- package/lib/node/promiseUtils.js +2 -14
- package/lib/node/unique.js +1 -18
- package/lib/node/unsavedChildren.js +2 -45
- 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 +2 -6
- package/lib/react-native/CryptoController.js +0 -2
- package/lib/react-native/EventEmitter.js +0 -2
- package/lib/react-native/EventuallyQueue.js +156 -711
- 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 +46 -157
- package/lib/react-native/LiveQuerySubscription.js +3 -27
- package/lib/react-native/LocalDatastore.js +281 -948
- package/lib/react-native/LocalDatastoreController.js +71 -552
- package/lib/react-native/LocalDatastoreController.react-native.js +91 -526
- package/lib/react-native/LocalDatastoreUtils.js +0 -1
- package/lib/react-native/ObjectStateMutations.js +2 -65
- package/lib/react-native/OfflineQuery.js +25 -196
- package/lib/react-native/Parse.js +0 -65
- package/lib/react-native/ParseACL.js +0 -44
- package/lib/react-native/ParseCLP.js +23 -161
- package/lib/react-native/ParseConfig.js +0 -42
- package/lib/react-native/ParseError.js +1 -21
- package/lib/react-native/ParseFile.js +55 -529
- 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 +55 -472
- package/lib/react-native/ParseObject.js +245 -1246
- package/lib/react-native/ParseOp.js +1 -138
- package/lib/react-native/ParsePolygon.js +0 -24
- package/lib/react-native/ParseQuery.js +182 -874
- package/lib/react-native/ParseRelation.js +0 -25
- package/lib/react-native/ParseRole.js +1 -36
- package/lib/react-native/ParseSchema.js +3 -54
- package/lib/react-native/ParseSession.js +1 -40
- package/lib/react-native/ParseUser.js +95 -773
- package/lib/react-native/Push.js +0 -16
- package/lib/react-native/RESTController.js +12 -109
- package/lib/react-native/SingleInstanceStateController.js +0 -44
- package/lib/react-native/Socket.weapp.js +0 -10
- 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 -27
- package/lib/weapp/AnonymousUtils.js +6 -42
- package/lib/weapp/Cloud.js +12 -77
- package/lib/weapp/CloudCode.js +0 -3
- package/lib/weapp/CoreManager.js +46 -191
- package/lib/weapp/CryptoController.js +2 -16
- package/lib/weapp/EventEmitter.js +1 -8
- package/lib/weapp/EventuallyQueue.js +277 -824
- package/lib/weapp/FacebookUtils.js +6 -42
- package/lib/weapp/IndexedDBStorageController.js +3 -14
- package/lib/weapp/InstallationController.js +2 -20
- package/lib/weapp/LiveQueryClient.js +105 -213
- 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 -19
- package/lib/weapp/ObjectStateMutations.js +18 -121
- package/lib/weapp/OfflineQuery.js +61 -222
- package/lib/weapp/Parse.js +12 -115
- package/lib/weapp/ParseACL.js +33 -148
- package/lib/weapp/ParseCLP.js +96 -314
- package/lib/weapp/ParseConfig.js +18 -95
- package/lib/weapp/ParseError.js +63 -99
- package/lib/weapp/ParseFile.js +129 -686
- package/lib/weapp/ParseGeoPoint.js +23 -89
- 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 +665 -1845
- package/lib/weapp/ParseOp.js +41 -287
- package/lib/weapp/ParsePolygon.js +13 -70
- package/lib/weapp/ParseQuery.js +403 -1504
- package/lib/weapp/ParseRelation.js +12 -68
- package/lib/weapp/ParseRole.js +13 -75
- package/lib/weapp/ParseSchema.js +49 -208
- package/lib/weapp/ParseSession.js +11 -69
- package/lib/weapp/ParseUser.js +274 -1127
- package/lib/weapp/Push.js +7 -50
- package/lib/weapp/RESTController.js +28 -157
- package/lib/weapp/SingleInstanceStateController.js +19 -144
- package/lib/weapp/Socket.weapp.js +0 -10
- package/lib/weapp/Storage.js +10 -80
- package/lib/weapp/StorageController.browser.js +4 -24
- package/lib/weapp/StorageController.default.js +4 -24
- package/lib/weapp/StorageController.react-native.js +6 -40
- package/lib/weapp/StorageController.weapp.js +5 -23
- package/lib/weapp/TaskQueue.js +1 -29
- package/lib/weapp/UniqueInstanceStateController.js +19 -149
- package/lib/weapp/Xhr.weapp.js +0 -17
- package/lib/weapp/arrayContainsObject.js +2 -23
- package/lib/weapp/canBeSerialized.js +3 -40
- package/lib/weapp/decode.js +3 -40
- package/lib/weapp/encode.js +9 -77
- package/lib/weapp/equals.js +2 -34
- package/lib/weapp/escape.js +1 -15
- package/lib/weapp/isRevocableSession.js +2 -18
- package/lib/weapp/parseDate.js +2 -20
- package/lib/weapp/promiseUtils.js +3 -21
- package/lib/weapp/unique.js +3 -24
- package/lib/weapp/unsavedChildren.js +6 -57
- package/lib/weapp/uuid.js +1 -6
- package/package.json +35 -31
- package/PATENTS +0 -37
|
@@ -1,546 +1,111 @@
|
|
|
1
1
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
|
-
|
|
3
2
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
4
|
-
|
|
3
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
5
4
|
var _LocalDatastoreUtils = require("./LocalDatastoreUtils");
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
hasOwn = Op.hasOwnProperty,
|
|
17
|
-
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
18
|
-
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
19
|
-
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
20
|
-
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
21
|
-
|
|
22
|
-
function define(obj, key, value) {
|
|
23
|
-
return Object.defineProperty(obj, key, {
|
|
24
|
-
value: value,
|
|
25
|
-
enumerable: !0,
|
|
26
|
-
configurable: !0,
|
|
27
|
-
writable: !0
|
|
28
|
-
}), obj[key];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
try {
|
|
32
|
-
define({}, "");
|
|
33
|
-
} catch (err) {
|
|
34
|
-
define = function (obj, key, value) {
|
|
35
|
-
return obj[key] = value;
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
40
|
-
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
41
|
-
generator = Object.create(protoGenerator.prototype),
|
|
42
|
-
context = new Context(tryLocsList || []);
|
|
43
|
-
return generator._invoke = function (innerFn, self, context) {
|
|
44
|
-
var state = "suspendedStart";
|
|
45
|
-
return function (method, arg) {
|
|
46
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
47
|
-
|
|
48
|
-
if ("completed" === state) {
|
|
49
|
-
if ("throw" === method) throw arg;
|
|
50
|
-
return doneResult();
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
for (context.method = method, context.arg = arg;;) {
|
|
54
|
-
var delegate = context.delegate;
|
|
55
|
-
|
|
56
|
-
if (delegate) {
|
|
57
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
58
|
-
|
|
59
|
-
if (delegateResult) {
|
|
60
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
61
|
-
return delegateResult;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
66
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
67
|
-
context.dispatchException(context.arg);
|
|
68
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
69
|
-
state = "executing";
|
|
70
|
-
var record = tryCatch(innerFn, self, context);
|
|
71
|
-
|
|
72
|
-
if ("normal" === record.type) {
|
|
73
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
74
|
-
return {
|
|
75
|
-
value: record.arg,
|
|
76
|
-
done: context.done
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
}(innerFn, self, context), generator;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function tryCatch(fn, obj, arg) {
|
|
87
|
-
try {
|
|
88
|
-
return {
|
|
89
|
-
type: "normal",
|
|
90
|
-
arg: fn.call(obj, arg)
|
|
91
|
-
};
|
|
92
|
-
} catch (err) {
|
|
93
|
-
return {
|
|
94
|
-
type: "throw",
|
|
95
|
-
arg: err
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
exports.wrap = wrap;
|
|
101
|
-
var ContinueSentinel = {};
|
|
102
|
-
|
|
103
|
-
function Generator() {}
|
|
104
|
-
|
|
105
|
-
function GeneratorFunction() {}
|
|
106
|
-
|
|
107
|
-
function GeneratorFunctionPrototype() {}
|
|
108
|
-
|
|
109
|
-
var IteratorPrototype = {};
|
|
110
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
111
|
-
return this;
|
|
112
|
-
});
|
|
113
|
-
var getProto = Object.getPrototypeOf,
|
|
114
|
-
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
115
|
-
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
116
|
-
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
117
|
-
|
|
118
|
-
function defineIteratorMethods(prototype) {
|
|
119
|
-
["next", "throw", "return"].forEach(function (method) {
|
|
120
|
-
define(prototype, method, function (arg) {
|
|
121
|
-
return this._invoke(method, arg);
|
|
122
|
-
});
|
|
5
|
+
var RNStorage = require('./StorageController.react-native');
|
|
6
|
+
var LocalDatastoreController = {
|
|
7
|
+
fromPinWithName: function () {
|
|
8
|
+
var _fromPinWithName = (0, _asyncToGenerator2.default)(function* (name) {
|
|
9
|
+
var values = yield RNStorage.getItemAsync(name);
|
|
10
|
+
if (!values) {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
var objects = JSON.parse(values);
|
|
14
|
+
return objects;
|
|
123
15
|
});
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
function AsyncIterator(generator, PromiseImpl) {
|
|
127
|
-
function invoke(method, arg, resolve, reject) {
|
|
128
|
-
var record = tryCatch(generator[method], generator, arg);
|
|
129
|
-
|
|
130
|
-
if ("throw" !== record.type) {
|
|
131
|
-
var result = record.arg,
|
|
132
|
-
value = result.value;
|
|
133
|
-
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
134
|
-
invoke("next", value, resolve, reject);
|
|
135
|
-
}, function (err) {
|
|
136
|
-
invoke("throw", err, resolve, reject);
|
|
137
|
-
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
138
|
-
result.value = unwrapped, resolve(result);
|
|
139
|
-
}, function (error) {
|
|
140
|
-
return invoke("throw", error, resolve, reject);
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
reject(record.arg);
|
|
16
|
+
function fromPinWithName() {
|
|
17
|
+
return _fromPinWithName.apply(this, arguments);
|
|
145
18
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
function maybeInvokeDelegate(delegate, context) {
|
|
161
|
-
var method = delegate.iterator[context.method];
|
|
162
|
-
|
|
163
|
-
if (undefined === method) {
|
|
164
|
-
if (context.delegate = null, "throw" === context.method) {
|
|
165
|
-
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
166
|
-
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
19
|
+
return fromPinWithName;
|
|
20
|
+
}(),
|
|
21
|
+
pinWithName: function () {
|
|
22
|
+
var _pinWithName = (0, _asyncToGenerator2.default)(function* (name, value) {
|
|
23
|
+
try {
|
|
24
|
+
var values = JSON.stringify(value);
|
|
25
|
+
yield RNStorage.setItemAsync(name, values);
|
|
26
|
+
} catch (e) {
|
|
27
|
+
console.error(e.message);
|
|
167
28
|
}
|
|
168
|
-
|
|
169
|
-
return ContinueSentinel;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
173
|
-
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
174
|
-
var info = record.arg;
|
|
175
|
-
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);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
function pushTryEntry(locs) {
|
|
179
|
-
var entry = {
|
|
180
|
-
tryLoc: locs[0]
|
|
181
|
-
};
|
|
182
|
-
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
function resetTryEntry(entry) {
|
|
186
|
-
var record = entry.completion || {};
|
|
187
|
-
record.type = "normal", delete record.arg, entry.completion = record;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
function Context(tryLocsList) {
|
|
191
|
-
this.tryEntries = [{
|
|
192
|
-
tryLoc: "root"
|
|
193
|
-
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
function values(iterable) {
|
|
197
|
-
if (iterable) {
|
|
198
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
199
|
-
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
200
|
-
if ("function" == typeof iterable.next) return iterable;
|
|
201
|
-
|
|
202
|
-
if (!isNaN(iterable.length)) {
|
|
203
|
-
var i = -1,
|
|
204
|
-
next = function next() {
|
|
205
|
-
for (; ++i < iterable.length;) {
|
|
206
|
-
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
return next.value = undefined, next.done = !0, next;
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
return next.next = next;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
return {
|
|
217
|
-
next: doneResult
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
function doneResult() {
|
|
222
|
-
return {
|
|
223
|
-
value: undefined,
|
|
224
|
-
done: !0
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
229
|
-
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
230
|
-
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
231
|
-
}, exports.mark = function (genFun) {
|
|
232
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
233
|
-
}, exports.awrap = function (arg) {
|
|
234
|
-
return {
|
|
235
|
-
__await: arg
|
|
236
|
-
};
|
|
237
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
238
|
-
return this;
|
|
239
|
-
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
240
|
-
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
241
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
242
|
-
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
243
|
-
return result.done ? result.value : iter.next();
|
|
244
29
|
});
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
}), define(Gp, "toString", function () {
|
|
248
|
-
return "[object Generator]";
|
|
249
|
-
}), exports.keys = function (object) {
|
|
250
|
-
var keys = [];
|
|
251
|
-
|
|
252
|
-
for (var key in object) {
|
|
253
|
-
keys.push(key);
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
return keys.reverse(), function next() {
|
|
257
|
-
for (; keys.length;) {
|
|
258
|
-
var key = keys.pop();
|
|
259
|
-
if (key in object) return next.value = key, next.done = !1, next;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
return next.done = !0, next;
|
|
263
|
-
};
|
|
264
|
-
}, exports.values = values, Context.prototype = {
|
|
265
|
-
constructor: Context,
|
|
266
|
-
reset: function (skipTempReset) {
|
|
267
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) {
|
|
268
|
-
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
269
|
-
}
|
|
270
|
-
},
|
|
271
|
-
stop: function () {
|
|
272
|
-
this.done = !0;
|
|
273
|
-
var rootRecord = this.tryEntries[0].completion;
|
|
274
|
-
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
275
|
-
return this.rval;
|
|
276
|
-
},
|
|
277
|
-
dispatchException: function (exception) {
|
|
278
|
-
if (this.done) throw exception;
|
|
279
|
-
var context = this;
|
|
280
|
-
|
|
281
|
-
function handle(loc, caught) {
|
|
282
|
-
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
286
|
-
var entry = this.tryEntries[i],
|
|
287
|
-
record = entry.completion;
|
|
288
|
-
if ("root" === entry.tryLoc) return handle("end");
|
|
289
|
-
|
|
290
|
-
if (entry.tryLoc <= this.prev) {
|
|
291
|
-
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
292
|
-
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
293
|
-
|
|
294
|
-
if (hasCatch && hasFinally) {
|
|
295
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
296
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
297
|
-
} else if (hasCatch) {
|
|
298
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
299
|
-
} else {
|
|
300
|
-
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
301
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
},
|
|
306
|
-
abrupt: function (type, arg) {
|
|
307
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
308
|
-
var entry = this.tryEntries[i];
|
|
309
|
-
|
|
310
|
-
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
311
|
-
var finallyEntry = entry;
|
|
312
|
-
break;
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
317
|
-
var record = finallyEntry ? finallyEntry.completion : {};
|
|
318
|
-
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
319
|
-
},
|
|
320
|
-
complete: function (record, afterLoc) {
|
|
321
|
-
if ("throw" === record.type) throw record.arg;
|
|
322
|
-
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;
|
|
323
|
-
},
|
|
324
|
-
finish: function (finallyLoc) {
|
|
325
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
326
|
-
var entry = this.tryEntries[i];
|
|
327
|
-
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
328
|
-
}
|
|
329
|
-
},
|
|
330
|
-
catch: function (tryLoc) {
|
|
331
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
332
|
-
var entry = this.tryEntries[i];
|
|
333
|
-
|
|
334
|
-
if (entry.tryLoc === tryLoc) {
|
|
335
|
-
var record = entry.completion;
|
|
336
|
-
|
|
337
|
-
if ("throw" === record.type) {
|
|
338
|
-
var thrown = record.arg;
|
|
339
|
-
resetTryEntry(entry);
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
return thrown;
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
throw new Error("illegal catch attempt");
|
|
347
|
-
},
|
|
348
|
-
delegateYield: function (iterable, resultName, nextLoc) {
|
|
349
|
-
return this.delegate = {
|
|
350
|
-
iterator: values(iterable),
|
|
351
|
-
resultName: resultName,
|
|
352
|
-
nextLoc: nextLoc
|
|
353
|
-
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
30
|
+
function pinWithName() {
|
|
31
|
+
return _pinWithName.apply(this, arguments);
|
|
354
32
|
}
|
|
355
|
-
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
var RNStorage = require('./StorageController.react-native');
|
|
359
|
-
|
|
360
|
-
var LocalDatastoreController = {
|
|
361
|
-
fromPinWithName: function (name) {
|
|
362
|
-
var values, objects;
|
|
363
|
-
return _regeneratorRuntime().async(function (_context) {
|
|
364
|
-
while (1) {
|
|
365
|
-
switch (_context.prev = _context.next) {
|
|
366
|
-
case 0:
|
|
367
|
-
_context.next = 2;
|
|
368
|
-
return _regeneratorRuntime().awrap(RNStorage.getItemAsync(name));
|
|
369
|
-
|
|
370
|
-
case 2:
|
|
371
|
-
values = _context.sent;
|
|
372
|
-
|
|
373
|
-
if (values) {
|
|
374
|
-
_context.next = 5;
|
|
375
|
-
break;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
return _context.abrupt("return", []);
|
|
379
|
-
|
|
380
|
-
case 5:
|
|
381
|
-
objects = JSON.parse(values);
|
|
382
|
-
return _context.abrupt("return", objects);
|
|
383
|
-
|
|
384
|
-
case 7:
|
|
385
|
-
case "end":
|
|
386
|
-
return _context.stop();
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
}, null, null, null, Promise);
|
|
390
|
-
},
|
|
391
|
-
pinWithName: function (name, value) {
|
|
392
|
-
var values;
|
|
393
|
-
return _regeneratorRuntime().async(function (_context2) {
|
|
394
|
-
while (1) {
|
|
395
|
-
switch (_context2.prev = _context2.next) {
|
|
396
|
-
case 0:
|
|
397
|
-
_context2.prev = 0;
|
|
398
|
-
values = JSON.stringify(value);
|
|
399
|
-
_context2.next = 4;
|
|
400
|
-
return _regeneratorRuntime().awrap(RNStorage.setItemAsync(name, values));
|
|
401
|
-
|
|
402
|
-
case 4:
|
|
403
|
-
_context2.next = 9;
|
|
404
|
-
break;
|
|
405
|
-
|
|
406
|
-
case 6:
|
|
407
|
-
_context2.prev = 6;
|
|
408
|
-
_context2.t0 = _context2["catch"](0);
|
|
409
|
-
console.error(_context2.t0.message);
|
|
410
|
-
|
|
411
|
-
case 9:
|
|
412
|
-
case "end":
|
|
413
|
-
return _context2.stop();
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
}, null, null, [[0, 6]], Promise);
|
|
417
|
-
},
|
|
33
|
+
return pinWithName;
|
|
34
|
+
}(),
|
|
418
35
|
unPinWithName: function (name) {
|
|
419
36
|
return RNStorage.removeItemAsync(name);
|
|
420
37
|
},
|
|
421
38
|
getAllContents: function () {
|
|
422
|
-
var
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
case 2:
|
|
431
|
-
keys = _context3.sent;
|
|
432
|
-
batch = [];
|
|
433
|
-
|
|
434
|
-
for (i = 0; i < keys.length; i += 1) {
|
|
435
|
-
key = keys[i];
|
|
436
|
-
|
|
437
|
-
if ((0, _LocalDatastoreUtils.isLocalDatastoreKey)(key)) {
|
|
438
|
-
batch.push(key);
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
LDS = {};
|
|
443
|
-
results = [];
|
|
444
|
-
_context3.prev = 7;
|
|
445
|
-
_context3.next = 10;
|
|
446
|
-
return _regeneratorRuntime().awrap(RNStorage.multiGet(batch));
|
|
447
|
-
|
|
448
|
-
case 10:
|
|
449
|
-
results = _context3.sent;
|
|
450
|
-
_context3.next = 17;
|
|
451
|
-
break;
|
|
452
|
-
|
|
453
|
-
case 13:
|
|
454
|
-
_context3.prev = 13;
|
|
455
|
-
_context3.t0 = _context3["catch"](7);
|
|
456
|
-
console.error('Error getAllContents: ', _context3.t0);
|
|
457
|
-
return _context3.abrupt("return", {});
|
|
458
|
-
|
|
459
|
-
case 17:
|
|
460
|
-
results.forEach(function (pair) {
|
|
461
|
-
var _pair = (0, _slicedToArray2.default)(pair, 2),
|
|
462
|
-
key = _pair[0],
|
|
463
|
-
value = _pair[1];
|
|
464
|
-
|
|
465
|
-
try {
|
|
466
|
-
LDS[key] = JSON.parse(value);
|
|
467
|
-
} catch (error) {
|
|
468
|
-
LDS[key] = null;
|
|
469
|
-
}
|
|
470
|
-
});
|
|
471
|
-
return _context3.abrupt("return", LDS);
|
|
472
|
-
|
|
473
|
-
case 19:
|
|
474
|
-
case "end":
|
|
475
|
-
return _context3.stop();
|
|
39
|
+
var _getAllContents = (0, _asyncToGenerator2.default)(function* () {
|
|
40
|
+
var keys = yield RNStorage.getAllKeysAsync();
|
|
41
|
+
var batch = [];
|
|
42
|
+
for (var i = 0; i < keys.length; i += 1) {
|
|
43
|
+
var key = keys[i];
|
|
44
|
+
if ((0, _LocalDatastoreUtils.isLocalDatastoreKey)(key)) {
|
|
45
|
+
batch.push(key);
|
|
476
46
|
}
|
|
477
47
|
}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
case 6:
|
|
496
|
-
results = _context4.sent;
|
|
497
|
-
results.map(function (pair) {
|
|
498
|
-
var _pair2 = (0, _slicedToArray2.default)(pair, 2),
|
|
499
|
-
key = _pair2[0],
|
|
500
|
-
value = _pair2[1];
|
|
501
|
-
|
|
502
|
-
storage[key] = value;
|
|
503
|
-
});
|
|
504
|
-
return _context4.abrupt("return", storage);
|
|
505
|
-
|
|
506
|
-
case 9:
|
|
507
|
-
case "end":
|
|
508
|
-
return _context4.stop();
|
|
48
|
+
var LDS = {};
|
|
49
|
+
var results = [];
|
|
50
|
+
try {
|
|
51
|
+
results = yield RNStorage.multiGet(batch);
|
|
52
|
+
} catch (error) {
|
|
53
|
+
console.error('Error getAllContents: ', error);
|
|
54
|
+
return {};
|
|
55
|
+
}
|
|
56
|
+
results.forEach(function (pair) {
|
|
57
|
+
var _pair = (0, _slicedToArray2.default)(pair, 2),
|
|
58
|
+
key = _pair[0],
|
|
59
|
+
value = _pair[1];
|
|
60
|
+
try {
|
|
61
|
+
LDS[key] = JSON.parse(value);
|
|
62
|
+
} catch (error) {
|
|
63
|
+
LDS[key] = null;
|
|
509
64
|
}
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
|
|
65
|
+
});
|
|
66
|
+
return LDS;
|
|
67
|
+
});
|
|
68
|
+
function getAllContents() {
|
|
69
|
+
return _getAllContents.apply(this, arguments);
|
|
70
|
+
}
|
|
71
|
+
return getAllContents;
|
|
72
|
+
}(),
|
|
73
|
+
getRawStorage: function () {
|
|
74
|
+
var _getRawStorage = (0, _asyncToGenerator2.default)(function* () {
|
|
75
|
+
var keys = yield RNStorage.getAllKeysAsync();
|
|
76
|
+
var storage = {};
|
|
77
|
+
var results = yield RNStorage.multiGet(keys);
|
|
78
|
+
results.map(function (pair) {
|
|
79
|
+
var _pair2 = (0, _slicedToArray2.default)(pair, 2),
|
|
80
|
+
key = _pair2[0],
|
|
81
|
+
value = _pair2[1];
|
|
82
|
+
storage[key] = value;
|
|
83
|
+
});
|
|
84
|
+
return storage;
|
|
85
|
+
});
|
|
86
|
+
function getRawStorage() {
|
|
87
|
+
return _getRawStorage.apply(this, arguments);
|
|
88
|
+
}
|
|
89
|
+
return getRawStorage;
|
|
90
|
+
}(),
|
|
513
91
|
clear: function () {
|
|
514
|
-
var
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
case 2:
|
|
523
|
-
keys = _context5.sent;
|
|
524
|
-
batch = [];
|
|
525
|
-
|
|
526
|
-
for (i = 0; i < keys.length; i += 1) {
|
|
527
|
-
key = keys[i];
|
|
528
|
-
|
|
529
|
-
if ((0, _LocalDatastoreUtils.isLocalDatastoreKey)(key)) {
|
|
530
|
-
batch.push(key);
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
return _context5.abrupt("return", RNStorage.multiRemove(batch).catch(function (error) {
|
|
535
|
-
return console.error('Error clearing local datastore: ', error);
|
|
536
|
-
}));
|
|
537
|
-
|
|
538
|
-
case 6:
|
|
539
|
-
case "end":
|
|
540
|
-
return _context5.stop();
|
|
92
|
+
var _clear = (0, _asyncToGenerator2.default)(function* () {
|
|
93
|
+
var keys = yield RNStorage.getAllKeysAsync();
|
|
94
|
+
var batch = [];
|
|
95
|
+
for (var i = 0; i < keys.length; i += 1) {
|
|
96
|
+
var key = keys[i];
|
|
97
|
+
if ((0, _LocalDatastoreUtils.isLocalDatastoreKey)(key)) {
|
|
98
|
+
batch.push(key);
|
|
541
99
|
}
|
|
542
100
|
}
|
|
543
|
-
|
|
544
|
-
|
|
101
|
+
return RNStorage.multiRemove(batch).catch(function (error) {
|
|
102
|
+
return console.error('Error clearing local datastore: ', error);
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
function clear() {
|
|
106
|
+
return _clear.apply(this, arguments);
|
|
107
|
+
}
|
|
108
|
+
return clear;
|
|
109
|
+
}()
|
|
545
110
|
};
|
|
546
111
|
module.exports = LocalDatastoreController;
|
|
@@ -9,7 +9,6 @@ var PIN_PREFIX = 'parsePin_';
|
|
|
9
9
|
exports.PIN_PREFIX = PIN_PREFIX;
|
|
10
10
|
var OBJECT_PREFIX = 'Parse_LDS_';
|
|
11
11
|
exports.OBJECT_PREFIX = OBJECT_PREFIX;
|
|
12
|
-
|
|
13
12
|
function isLocalDatastoreKey(key) {
|
|
14
13
|
return !!(key && (key === DEFAULT_PIN || key.startsWith(PIN_PREFIX) || key.startsWith(OBJECT_PREFIX)));
|
|
15
14
|
}
|