parse 5.2.0-alpha.1 → 5.2.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/parse.js +10519 -15246
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +10499 -15371
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/Analytics.js +7 -11
- package/lib/browser/AnonymousUtils.js +17 -22
- package/lib/browser/Cloud.js +23 -41
- package/lib/browser/CoreManager.js +71 -79
- package/lib/browser/CryptoController.js +14 -9
- package/lib/browser/EventEmitter.js +9 -2
- package/lib/browser/EventuallyQueue.js +156 -357
- package/lib/browser/FacebookUtils.js +23 -28
- package/lib/browser/IndexedDBStorageController.js +18 -14
- package/lib/browser/InstallationController.js +55 -121
- package/lib/browser/LiveQueryClient.js +312 -485
- package/lib/browser/LiveQuerySubscription.js +25 -28
- package/lib/browser/LocalDatastore.js +258 -624
- package/lib/browser/LocalDatastoreController.default.js +42 -226
- package/lib/browser/LocalDatastoreController.js +11 -1
- package/lib/browser/LocalDatastoreController.react-native.js +66 -160
- package/lib/browser/LocalDatastoreUtils.js +4 -7
- package/lib/browser/ObjectStateMutations.js +54 -96
- package/lib/browser/OfflineQuery.js +106 -198
- package/lib/browser/Parse.js +44 -60
- package/lib/browser/ParseACL.js +242 -288
- package/lib/browser/ParseCLP.js +372 -572
- package/lib/browser/ParseConfig.js +115 -138
- package/lib/browser/ParseError.js +85 -182
- package/lib/browser/ParseFile.js +294 -438
- package/lib/browser/ParseGeoPoint.js +121 -146
- package/lib/browser/ParseHooks.js +23 -25
- package/lib/browser/ParseInstallation.js +225 -367
- package/lib/browser/ParseLiveQuery.js +74 -148
- package/lib/browser/ParseObject.js +2014 -2621
- package/lib/browser/ParseOp.js +343 -484
- package/lib/browser/ParsePolygon.js +101 -120
- package/lib/browser/ParseQuery.js +1708 -2052
- package/lib/browser/ParseRelation.js +99 -118
- package/lib/browser/ParseRole.js +88 -140
- package/lib/browser/ParseSchema.js +372 -434
- package/lib/browser/ParseSession.js +62 -110
- package/lib/browser/ParseUser.js +941 -1284
- package/lib/browser/Push.js +15 -38
- package/lib/browser/RESTController.js +85 -124
- package/lib/browser/SingleInstanceStateController.js +57 -86
- package/lib/browser/Socket.weapp.js +50 -33
- package/lib/browser/Storage.js +23 -28
- package/lib/browser/StorageController.browser.js +16 -13
- package/lib/browser/StorageController.default.js +15 -14
- package/lib/browser/StorageController.js +14 -1
- package/lib/browser/StorageController.react-native.js +31 -30
- package/lib/browser/StorageController.weapp.js +19 -13
- package/lib/browser/TaskQueue.js +31 -43
- package/lib/browser/UniqueInstanceStateController.js +65 -86
- package/lib/browser/WebSocketController.js +11 -4
- package/lib/browser/Xhr.weapp.js +90 -78
- package/lib/browser/arrayContainsObject.js +3 -3
- package/lib/browser/canBeSerialized.js +10 -11
- package/lib/browser/decode.js +11 -11
- package/lib/browser/encode.js +11 -11
- package/lib/browser/equals.js +9 -10
- package/lib/browser/escape.js +2 -2
- package/lib/browser/isRevocableSession.js +1 -1
- package/lib/browser/parseDate.js +10 -10
- package/lib/browser/promiseUtils.js +19 -19
- package/lib/browser/unique.js +4 -4
- package/lib/browser/unsavedChildren.js +20 -21
- package/lib/browser/uuid.js +2 -4
- package/lib/node/Analytics.js +5 -9
- package/lib/node/AnonymousUtils.js +10 -15
- package/lib/node/Cloud.js +11 -11
- package/lib/node/CoreManager.js +59 -67
- package/lib/node/CryptoController.js +8 -3
- package/lib/node/EventEmitter.js +7 -1
- package/lib/node/EventuallyQueue.js +20 -39
- package/lib/node/FacebookUtils.js +4 -8
- package/lib/node/IndexedDBStorageController.js +14 -10
- package/lib/node/InstallationController.js +12 -13
- package/lib/node/LiveQueryClient.js +23 -21
- package/lib/node/LiveQuerySubscription.js +6 -7
- package/lib/node/LocalDatastore.js +23 -23
- package/lib/node/LocalDatastoreController.default.js +11 -12
- package/lib/node/LocalDatastoreController.js +14 -1
- package/lib/node/LocalDatastoreController.react-native.js +25 -21
- package/lib/node/LocalDatastoreUtils.js +4 -7
- package/lib/node/ObjectStateMutations.js +12 -22
- package/lib/node/OfflineQuery.js +37 -23
- package/lib/node/Parse.js +36 -50
- package/lib/node/ParseACL.js +21 -30
- package/lib/node/ParseCLP.js +38 -40
- package/lib/node/ParseConfig.js +10 -17
- package/lib/node/ParseError.js +460 -461
- package/lib/node/ParseFile.js +27 -47
- package/lib/node/ParseGeoPoint.js +16 -17
- package/lib/node/ParseHooks.js +16 -18
- package/lib/node/ParseInstallation.js +10 -11
- package/lib/node/ParseLiveQuery.js +9 -14
- package/lib/node/ParseObject.js +142 -173
- package/lib/node/ParseOp.js +35 -47
- package/lib/node/ParsePolygon.js +14 -20
- package/lib/node/ParseQuery.js +100 -123
- package/lib/node/ParseRelation.js +10 -19
- package/lib/node/ParseRole.js +10 -11
- package/lib/node/ParseSchema.js +29 -42
- package/lib/node/ParseSession.js +10 -11
- package/lib/node/ParseUser.js +76 -87
- package/lib/node/Push.js +7 -12
- package/lib/node/RESTController.js +24 -36
- package/lib/node/SingleInstanceStateController.js +41 -69
- package/lib/node/Socket.weapp.js +23 -2
- package/lib/node/Storage.js +14 -19
- package/lib/node/StorageController.browser.js +10 -8
- package/lib/node/StorageController.default.js +9 -9
- package/lib/node/StorageController.js +16 -1
- package/lib/node/StorageController.react-native.js +20 -20
- package/lib/node/StorageController.weapp.js +14 -8
- package/lib/node/TaskQueue.js +2 -3
- package/lib/node/UniqueInstanceStateController.js +43 -63
- package/lib/node/WebSocketController.js +15 -2
- package/lib/node/Xhr.weapp.js +11 -2
- package/lib/node/arrayContainsObject.js +4 -4
- package/lib/node/canBeSerialized.js +5 -5
- package/lib/node/decode.js +4 -4
- package/lib/node/encode.js +5 -5
- package/lib/node/equals.js +4 -4
- package/lib/node/escape.js +1 -1
- package/lib/node/isRevocableSession.js +1 -1
- package/lib/node/parseDate.js +1 -1
- package/lib/node/promiseUtils.js +7 -7
- package/lib/node/unique.js +5 -5
- package/lib/node/unsavedChildren.js +5 -5
- package/lib/node/uuid.js +2 -4
- package/lib/react-native/Analytics.js +2 -2
- package/lib/react-native/AnonymousUtils.js +3 -4
- package/lib/react-native/CoreManager.js +2 -3
- package/lib/react-native/CryptoController.js +6 -1
- package/lib/react-native/EventEmitter.js +6 -1
- package/lib/react-native/EventuallyQueue.js +1 -2
- package/lib/react-native/FacebookUtils.js +1 -2
- package/lib/react-native/IndexedDBStorageController.js +11 -5
- package/lib/react-native/InstallationController.js +1 -2
- package/lib/react-native/LiveQueryClient.js +8 -7
- package/lib/react-native/LiveQuerySubscription.js +2 -4
- package/lib/react-native/LocalDatastore.js +3 -3
- package/lib/react-native/LocalDatastoreController.default.js +1 -2
- package/lib/react-native/LocalDatastoreController.js +11 -1
- package/lib/react-native/LocalDatastoreController.react-native.js +11 -12
- package/lib/react-native/LocalDatastoreUtils.js +3 -6
- package/lib/react-native/OfflineQuery.js +25 -20
- package/lib/react-native/Parse.js +24 -38
- package/lib/react-native/ParseACL.js +4 -6
- package/lib/react-native/ParseCLP.js +2 -4
- package/lib/react-native/ParseConfig.js +4 -6
- package/lib/react-native/ParseError.js +13 -31
- package/lib/react-native/ParseFile.js +3 -4
- package/lib/react-native/ParseGeoPoint.js +2 -4
- package/lib/react-native/ParseInstallation.js +13 -30
- package/lib/react-native/ParseLiveQuery.js +2 -4
- package/lib/react-native/ParseObject.js +77 -87
- package/lib/react-native/ParseOp.js +41 -79
- package/lib/react-native/ParsePolygon.js +2 -4
- package/lib/react-native/ParseQuery.js +43 -45
- package/lib/react-native/ParseRelation.js +2 -4
- package/lib/react-native/ParseRole.js +13 -30
- package/lib/react-native/ParseSchema.js +3 -5
- package/lib/react-native/ParseSession.js +12 -29
- package/lib/react-native/ParseUser.js +24 -49
- package/lib/react-native/RESTController.js +10 -4
- package/lib/react-native/SingleInstanceStateController.js +23 -37
- package/lib/react-native/Socket.weapp.js +9 -4
- package/lib/react-native/Storage.js +1 -2
- package/lib/react-native/StorageController.browser.js +6 -1
- package/lib/react-native/StorageController.default.js +6 -1
- package/lib/react-native/StorageController.js +13 -1
- package/lib/react-native/StorageController.react-native.js +11 -6
- package/lib/react-native/StorageController.weapp.js +6 -1
- package/lib/react-native/TaskQueue.js +2 -4
- package/lib/react-native/UniqueInstanceStateController.js +23 -37
- package/lib/react-native/WebSocketController.js +9 -1
- package/lib/react-native/Xhr.weapp.js +9 -4
- package/lib/react-native/unsavedChildren.js +3 -3
- package/lib/react-native/uuid.js +1 -2
- package/lib/weapp/Analytics.js +7 -11
- package/lib/weapp/AnonymousUtils.js +17 -22
- package/lib/weapp/Cloud.js +23 -41
- package/lib/weapp/CoreManager.js +71 -79
- package/lib/weapp/CryptoController.js +14 -9
- package/lib/weapp/EventEmitter.js +9 -2
- package/lib/weapp/EventuallyQueue.js +156 -357
- package/lib/weapp/FacebookUtils.js +23 -28
- package/lib/weapp/IndexedDBStorageController.js +18 -14
- package/lib/weapp/InstallationController.js +55 -121
- package/lib/weapp/LiveQueryClient.js +312 -485
- package/lib/weapp/LiveQuerySubscription.js +25 -28
- package/lib/weapp/LocalDatastore.js +258 -624
- package/lib/weapp/LocalDatastoreController.default.js +42 -226
- package/lib/weapp/LocalDatastoreController.js +11 -1
- package/lib/weapp/LocalDatastoreController.react-native.js +66 -160
- package/lib/weapp/LocalDatastoreUtils.js +4 -7
- package/lib/weapp/ObjectStateMutations.js +54 -96
- package/lib/weapp/OfflineQuery.js +106 -198
- package/lib/weapp/Parse.js +44 -59
- package/lib/weapp/ParseACL.js +242 -288
- package/lib/weapp/ParseCLP.js +372 -572
- package/lib/weapp/ParseConfig.js +115 -138
- package/lib/weapp/ParseError.js +85 -182
- package/lib/weapp/ParseFile.js +295 -440
- package/lib/weapp/ParseGeoPoint.js +121 -146
- package/lib/weapp/ParseHooks.js +23 -25
- package/lib/weapp/ParseInstallation.js +225 -367
- package/lib/weapp/ParseLiveQuery.js +74 -148
- package/lib/weapp/ParseObject.js +2014 -2621
- package/lib/weapp/ParseOp.js +343 -484
- package/lib/weapp/ParsePolygon.js +101 -120
- package/lib/weapp/ParseQuery.js +1708 -2052
- package/lib/weapp/ParseRelation.js +99 -118
- package/lib/weapp/ParseRole.js +88 -140
- package/lib/weapp/ParseSchema.js +372 -434
- package/lib/weapp/ParseSession.js +62 -110
- package/lib/weapp/ParseUser.js +941 -1284
- package/lib/weapp/Push.js +15 -38
- package/lib/weapp/RESTController.js +86 -125
- package/lib/weapp/SingleInstanceStateController.js +57 -86
- package/lib/weapp/Socket.weapp.js +50 -33
- package/lib/weapp/Storage.js +23 -28
- package/lib/weapp/StorageController.browser.js +16 -13
- package/lib/weapp/StorageController.default.js +15 -14
- package/lib/weapp/StorageController.js +14 -1
- package/lib/weapp/StorageController.react-native.js +31 -30
- package/lib/weapp/StorageController.weapp.js +19 -13
- package/lib/weapp/TaskQueue.js +31 -43
- package/lib/weapp/UniqueInstanceStateController.js +65 -86
- package/lib/weapp/WebSocketController.js +11 -4
- package/lib/weapp/Xhr.weapp.js +90 -78
- package/lib/weapp/arrayContainsObject.js +3 -3
- package/lib/weapp/canBeSerialized.js +10 -11
- package/lib/weapp/decode.js +11 -11
- package/lib/weapp/encode.js +11 -11
- package/lib/weapp/equals.js +9 -10
- package/lib/weapp/escape.js +2 -2
- package/lib/weapp/isRevocableSession.js +1 -1
- package/lib/weapp/parseDate.js +10 -10
- package/lib/weapp/promiseUtils.js +19 -19
- package/lib/weapp/unique.js +4 -4
- package/lib/weapp/unsavedChildren.js +20 -21
- package/lib/weapp/uuid.js +6 -8
- package/package.json +24 -30
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
|
|
4
3
|
var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
|
|
5
4
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
6
5
|
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
@@ -25,68 +24,40 @@ exports.removeState = removeState;
|
|
|
25
24
|
exports.setPendingOp = setPendingOp;
|
|
26
25
|
exports.setServerData = setServerData;
|
|
27
26
|
var ObjectStateMutations = _interopRequireWildcard(require("./ObjectStateMutations"));
|
|
28
|
-
function _getRequireWildcardCache(
|
|
29
|
-
if (typeof _WeakMap
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
return (_getRequireWildcardCache = function (
|
|
33
|
-
return
|
|
34
|
-
})(
|
|
35
|
-
}
|
|
36
|
-
function _interopRequireWildcard(
|
|
37
|
-
if (!
|
|
38
|
-
|
|
27
|
+
function _getRequireWildcardCache(e) {
|
|
28
|
+
if ("function" != typeof _WeakMap) return null;
|
|
29
|
+
var r = new _WeakMap(),
|
|
30
|
+
t = new _WeakMap();
|
|
31
|
+
return (_getRequireWildcardCache = function (e) {
|
|
32
|
+
return e ? t : r;
|
|
33
|
+
})(e);
|
|
34
|
+
}
|
|
35
|
+
function _interopRequireWildcard(e, r) {
|
|
36
|
+
if (!r && e && e.__esModule) return e;
|
|
37
|
+
if (null === e || "object" != typeof e && "function" != typeof e) return {
|
|
38
|
+
default: e
|
|
39
|
+
};
|
|
40
|
+
var t = _getRequireWildcardCache(r);
|
|
41
|
+
if (t && t.has(e)) return t.get(e);
|
|
42
|
+
var n = {
|
|
43
|
+
__proto__: null
|
|
44
|
+
};
|
|
45
|
+
for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
|
|
46
|
+
var i = _Object$defineProperty && _Object$getOwnPropertyDescriptor ? _Object$getOwnPropertyDescriptor(e, u) : null;
|
|
47
|
+
i && (i.get || i.set) ? _Object$defineProperty(n, u, i) : n[u] = e[u];
|
|
39
48
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
46
|
-
if (cache && cache.has(obj)) {
|
|
47
|
-
return cache.get(obj);
|
|
48
|
-
}
|
|
49
|
-
var newObj = {};
|
|
50
|
-
for (var key in obj) {
|
|
51
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
52
|
-
var desc = _Object$defineProperty && _Object$getOwnPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null;
|
|
53
|
-
if (desc && (desc.get || desc.set)) {
|
|
54
|
-
_Object$defineProperty(newObj, key, desc);
|
|
55
|
-
} else {
|
|
56
|
-
newObj[key] = obj[key];
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
newObj.default = obj;
|
|
61
|
-
if (cache) {
|
|
62
|
-
cache.set(obj, newObj);
|
|
63
|
-
}
|
|
64
|
-
return newObj;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* @flow
|
|
68
|
-
*/
|
|
69
|
-
/*:: import type { Op } from './ParseOp';*/
|
|
70
|
-
/*:: import type { AttributeMap, ObjectCache, OpsMap, State } from './ObjectStateMutations';*/
|
|
71
|
-
/*:: type ObjectIdentifier = {
|
|
72
|
-
className: string,
|
|
73
|
-
id: string,
|
|
74
|
-
};*/
|
|
75
|
-
var objectState
|
|
76
|
-
/*: {
|
|
77
|
-
[className: string]: {
|
|
78
|
-
[id: string]: State,
|
|
79
|
-
},
|
|
80
|
-
}*/ = {};
|
|
81
|
-
function getState(obj /*: ObjectIdentifier*/) /*: ?State*/{
|
|
82
|
-
var classData = objectState[obj.className];
|
|
49
|
+
return n.default = e, t && t.set(e, n), n;
|
|
50
|
+
}
|
|
51
|
+
let objectState = {};
|
|
52
|
+
function getState(obj) {
|
|
53
|
+
const classData = objectState[obj.className];
|
|
83
54
|
if (classData) {
|
|
84
55
|
return classData[obj.id] || null;
|
|
85
56
|
}
|
|
86
57
|
return null;
|
|
87
58
|
}
|
|
88
|
-
function initializeState(obj
|
|
89
|
-
|
|
59
|
+
function initializeState(obj, initial) {
|
|
60
|
+
let state = getState(obj);
|
|
90
61
|
if (state) {
|
|
91
62
|
return state;
|
|
92
63
|
}
|
|
@@ -99,76 +70,76 @@ function initializeState(obj /*: ObjectIdentifier*/, initial /*:: ?: State*/) /*
|
|
|
99
70
|
state = objectState[obj.className][obj.id] = initial;
|
|
100
71
|
return state;
|
|
101
72
|
}
|
|
102
|
-
function removeState(obj
|
|
103
|
-
|
|
73
|
+
function removeState(obj) {
|
|
74
|
+
const state = getState(obj);
|
|
104
75
|
if (state === null) {
|
|
105
76
|
return null;
|
|
106
77
|
}
|
|
107
78
|
delete objectState[obj.className][obj.id];
|
|
108
79
|
return state;
|
|
109
80
|
}
|
|
110
|
-
function getServerData(obj
|
|
111
|
-
|
|
81
|
+
function getServerData(obj) {
|
|
82
|
+
const state = getState(obj);
|
|
112
83
|
if (state) {
|
|
113
84
|
return state.serverData;
|
|
114
85
|
}
|
|
115
86
|
return {};
|
|
116
87
|
}
|
|
117
|
-
function setServerData(obj
|
|
118
|
-
|
|
88
|
+
function setServerData(obj, attributes) {
|
|
89
|
+
const serverData = initializeState(obj).serverData;
|
|
119
90
|
ObjectStateMutations.setServerData(serverData, attributes);
|
|
120
91
|
}
|
|
121
|
-
function getPendingOps(obj
|
|
122
|
-
|
|
92
|
+
function getPendingOps(obj) {
|
|
93
|
+
const state = getState(obj);
|
|
123
94
|
if (state) {
|
|
124
95
|
return state.pendingOps;
|
|
125
96
|
}
|
|
126
97
|
return [{}];
|
|
127
98
|
}
|
|
128
|
-
function setPendingOp(obj
|
|
129
|
-
|
|
99
|
+
function setPendingOp(obj, attr, op) {
|
|
100
|
+
const pendingOps = initializeState(obj).pendingOps;
|
|
130
101
|
ObjectStateMutations.setPendingOp(pendingOps, attr, op);
|
|
131
102
|
}
|
|
132
|
-
function pushPendingState(obj
|
|
133
|
-
|
|
103
|
+
function pushPendingState(obj) {
|
|
104
|
+
const pendingOps = initializeState(obj).pendingOps;
|
|
134
105
|
ObjectStateMutations.pushPendingState(pendingOps);
|
|
135
106
|
}
|
|
136
|
-
function popPendingState(obj
|
|
137
|
-
|
|
107
|
+
function popPendingState(obj) {
|
|
108
|
+
const pendingOps = initializeState(obj).pendingOps;
|
|
138
109
|
return ObjectStateMutations.popPendingState(pendingOps);
|
|
139
110
|
}
|
|
140
|
-
function mergeFirstPendingState(obj
|
|
141
|
-
|
|
111
|
+
function mergeFirstPendingState(obj) {
|
|
112
|
+
const pendingOps = getPendingOps(obj);
|
|
142
113
|
ObjectStateMutations.mergeFirstPendingState(pendingOps);
|
|
143
114
|
}
|
|
144
|
-
function getObjectCache(obj
|
|
145
|
-
|
|
115
|
+
function getObjectCache(obj) {
|
|
116
|
+
const state = getState(obj);
|
|
146
117
|
if (state) {
|
|
147
118
|
return state.objectCache;
|
|
148
119
|
}
|
|
149
120
|
return {};
|
|
150
121
|
}
|
|
151
|
-
function estimateAttribute(obj
|
|
152
|
-
|
|
153
|
-
|
|
122
|
+
function estimateAttribute(obj, attr) {
|
|
123
|
+
const serverData = getServerData(obj);
|
|
124
|
+
const pendingOps = getPendingOps(obj);
|
|
154
125
|
return ObjectStateMutations.estimateAttribute(serverData, pendingOps, obj, attr);
|
|
155
126
|
}
|
|
156
|
-
function estimateAttributes(obj
|
|
157
|
-
|
|
158
|
-
|
|
127
|
+
function estimateAttributes(obj) {
|
|
128
|
+
const serverData = getServerData(obj);
|
|
129
|
+
const pendingOps = getPendingOps(obj);
|
|
159
130
|
return ObjectStateMutations.estimateAttributes(serverData, pendingOps, obj);
|
|
160
131
|
}
|
|
161
|
-
function commitServerChanges(obj
|
|
162
|
-
|
|
132
|
+
function commitServerChanges(obj, changes) {
|
|
133
|
+
const state = initializeState(obj);
|
|
163
134
|
ObjectStateMutations.commitServerChanges(state.serverData, state.objectCache, changes);
|
|
164
135
|
}
|
|
165
|
-
function enqueueTask(obj
|
|
166
|
-
|
|
136
|
+
function enqueueTask(obj, task) {
|
|
137
|
+
const state = initializeState(obj);
|
|
167
138
|
return state.tasks.enqueue(task);
|
|
168
139
|
}
|
|
169
140
|
function clearAllState() {
|
|
170
141
|
objectState = {};
|
|
171
142
|
}
|
|
172
|
-
function duplicateState(source
|
|
143
|
+
function duplicateState(source, dest) {
|
|
173
144
|
dest.id = source.id;
|
|
174
145
|
}
|
|
@@ -1,44 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
3
4
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
this
|
|
12
|
-
this
|
|
13
|
-
this
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
_Object$defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
10
|
+
class SocketWeapp {
|
|
11
|
+
constructor(serverURL) {
|
|
12
|
+
(0, _defineProperty2.default)(this, "onopen", void 0);
|
|
13
|
+
(0, _defineProperty2.default)(this, "onmessage", void 0);
|
|
14
|
+
(0, _defineProperty2.default)(this, "onclose", void 0);
|
|
15
|
+
(0, _defineProperty2.default)(this, "onerror", void 0);
|
|
16
|
+
this.onopen = () => {};
|
|
17
|
+
this.onmessage = () => {};
|
|
18
|
+
this.onclose = () => {};
|
|
19
|
+
this.onerror = () => {};
|
|
20
|
+
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
wx.onSocketOpen(() => {
|
|
23
|
+
this.onopen();
|
|
16
24
|
});
|
|
17
|
-
|
|
18
|
-
|
|
25
|
+
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
wx.onSocketMessage(msg => {
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
this.onmessage(msg);
|
|
19
30
|
});
|
|
20
|
-
|
|
21
|
-
|
|
31
|
+
|
|
32
|
+
// @ts-ignore
|
|
33
|
+
wx.onSocketClose(event => {
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
this.onclose(event);
|
|
22
36
|
});
|
|
23
|
-
|
|
24
|
-
|
|
37
|
+
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
wx.onSocketError(error => {
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
this.onerror(error);
|
|
25
42
|
});
|
|
43
|
+
|
|
44
|
+
// @ts-ignore
|
|
26
45
|
wx.connectSocket({
|
|
27
46
|
url: serverURL
|
|
28
47
|
});
|
|
29
48
|
}
|
|
30
|
-
(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return SocketWeapp;
|
|
44
|
-
}();
|
|
49
|
+
send(data) {
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
wx.sendSocketMessage({
|
|
52
|
+
data
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
close() {
|
|
56
|
+
// @ts-ignore
|
|
57
|
+
wx.closeSocket();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
module.exports = SocketWeapp;
|
|
61
|
+
var _default = exports.default = SocketWeapp;
|
package/lib/weapp/Storage.js
CHANGED
|
@@ -8,72 +8,68 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
10
10
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var Storage = {
|
|
16
|
-
async: function () /*: boolean*/{
|
|
17
|
-
var controller = _CoreManager.default.getStorageController();
|
|
11
|
+
const Storage = {
|
|
12
|
+
async() {
|
|
13
|
+
const controller = _CoreManager.default.getStorageController();
|
|
18
14
|
return !!controller.async;
|
|
19
15
|
},
|
|
20
|
-
getItem
|
|
21
|
-
|
|
16
|
+
getItem(path) {
|
|
17
|
+
const controller = _CoreManager.default.getStorageController();
|
|
22
18
|
if (controller.async === 1) {
|
|
23
19
|
throw new Error('Synchronous storage is not supported by the current storage controller');
|
|
24
20
|
}
|
|
25
21
|
return controller.getItem(path);
|
|
26
22
|
},
|
|
27
|
-
getItemAsync
|
|
28
|
-
|
|
23
|
+
getItemAsync(path) {
|
|
24
|
+
const controller = _CoreManager.default.getStorageController();
|
|
29
25
|
if (controller.async === 1) {
|
|
30
26
|
return controller.getItemAsync(path);
|
|
31
27
|
}
|
|
32
28
|
return _promise.default.resolve(controller.getItem(path));
|
|
33
29
|
},
|
|
34
|
-
setItem
|
|
35
|
-
|
|
30
|
+
setItem(path, value) {
|
|
31
|
+
const controller = _CoreManager.default.getStorageController();
|
|
36
32
|
if (controller.async === 1) {
|
|
37
33
|
throw new Error('Synchronous storage is not supported by the current storage controller');
|
|
38
34
|
}
|
|
39
35
|
return controller.setItem(path, value);
|
|
40
36
|
},
|
|
41
|
-
setItemAsync
|
|
42
|
-
|
|
37
|
+
setItemAsync(path, value) {
|
|
38
|
+
const controller = _CoreManager.default.getStorageController();
|
|
43
39
|
if (controller.async === 1) {
|
|
44
40
|
return controller.setItemAsync(path, value);
|
|
45
41
|
}
|
|
46
42
|
return _promise.default.resolve(controller.setItem(path, value));
|
|
47
43
|
},
|
|
48
|
-
removeItem
|
|
49
|
-
|
|
44
|
+
removeItem(path) {
|
|
45
|
+
const controller = _CoreManager.default.getStorageController();
|
|
50
46
|
if (controller.async === 1) {
|
|
51
47
|
throw new Error('Synchronous storage is not supported by the current storage controller');
|
|
52
48
|
}
|
|
53
49
|
return controller.removeItem(path);
|
|
54
50
|
},
|
|
55
|
-
removeItemAsync
|
|
56
|
-
|
|
51
|
+
removeItemAsync(path) {
|
|
52
|
+
const controller = _CoreManager.default.getStorageController();
|
|
57
53
|
if (controller.async === 1) {
|
|
58
54
|
return controller.removeItemAsync(path);
|
|
59
55
|
}
|
|
60
56
|
return _promise.default.resolve(controller.removeItem(path));
|
|
61
57
|
},
|
|
62
|
-
getAllKeys
|
|
63
|
-
|
|
58
|
+
getAllKeys() {
|
|
59
|
+
const controller = _CoreManager.default.getStorageController();
|
|
64
60
|
if (controller.async === 1) {
|
|
65
61
|
throw new Error('Synchronous storage is not supported by the current storage controller');
|
|
66
62
|
}
|
|
67
63
|
return controller.getAllKeys();
|
|
68
64
|
},
|
|
69
|
-
getAllKeysAsync
|
|
70
|
-
|
|
65
|
+
getAllKeysAsync() {
|
|
66
|
+
const controller = _CoreManager.default.getStorageController();
|
|
71
67
|
if (controller.async === 1) {
|
|
72
68
|
return controller.getAllKeysAsync();
|
|
73
69
|
}
|
|
74
70
|
return _promise.default.resolve(controller.getAllKeys());
|
|
75
71
|
},
|
|
76
|
-
generatePath
|
|
72
|
+
generatePath(path) {
|
|
77
73
|
if (!_CoreManager.default.get('APPLICATION_ID')) {
|
|
78
74
|
throw new Error('You need to call Parse.initialize before using Parse.');
|
|
79
75
|
}
|
|
@@ -85,13 +81,12 @@ var Storage = {
|
|
|
85
81
|
}
|
|
86
82
|
return 'Parse/' + _CoreManager.default.get('APPLICATION_ID') + '/' + path;
|
|
87
83
|
},
|
|
88
|
-
_clear
|
|
89
|
-
|
|
84
|
+
_clear() {
|
|
85
|
+
const controller = _CoreManager.default.getStorageController();
|
|
90
86
|
if (controller.hasOwnProperty('clear')) {
|
|
91
87
|
controller.clear();
|
|
92
88
|
}
|
|
93
89
|
}
|
|
94
90
|
};
|
|
95
91
|
module.exports = Storage;
|
|
96
|
-
var _default = Storage;
|
|
97
|
-
exports.default = _default;
|
|
92
|
+
var _default = exports.default = Storage;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
4
|
+
_Object$defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
7
8
|
/* global localStorage */
|
|
8
|
-
|
|
9
|
+
|
|
10
|
+
const StorageController = {
|
|
9
11
|
async: 0,
|
|
10
|
-
getItem
|
|
12
|
+
getItem(path) {
|
|
11
13
|
return localStorage.getItem(path);
|
|
12
14
|
},
|
|
13
|
-
setItem
|
|
15
|
+
setItem(path, value) {
|
|
14
16
|
try {
|
|
15
17
|
localStorage.setItem(path, value);
|
|
16
18
|
} catch (e) {
|
|
@@ -18,18 +20,19 @@ var StorageController = {
|
|
|
18
20
|
console.log(e.message);
|
|
19
21
|
}
|
|
20
22
|
},
|
|
21
|
-
removeItem
|
|
23
|
+
removeItem(path) {
|
|
22
24
|
localStorage.removeItem(path);
|
|
23
25
|
},
|
|
24
|
-
getAllKeys
|
|
25
|
-
|
|
26
|
-
for (
|
|
26
|
+
getAllKeys() {
|
|
27
|
+
const keys = [];
|
|
28
|
+
for (let i = 0; i < localStorage.length; i += 1) {
|
|
27
29
|
keys.push(localStorage.key(i));
|
|
28
30
|
}
|
|
29
31
|
return keys;
|
|
30
32
|
},
|
|
31
|
-
clear
|
|
33
|
+
clear() {
|
|
32
34
|
localStorage.clear();
|
|
33
35
|
}
|
|
34
36
|
};
|
|
35
|
-
module.exports = StorageController;
|
|
37
|
+
module.exports = StorageController;
|
|
38
|
+
var _default = exports.default = StorageController;
|
|
@@ -1,37 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
3
4
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
5
|
+
_Object$defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
4
9
|
var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
|
|
5
|
-
/**
|
|
6
|
-
* @flow
|
|
7
|
-
* @private
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
10
|
// When there is no native storage interface, we default to an in-memory map
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const memMap = {};
|
|
12
|
+
const StorageController = {
|
|
13
13
|
async: 0,
|
|
14
|
-
getItem
|
|
14
|
+
getItem(path) {
|
|
15
15
|
if (memMap.hasOwnProperty(path)) {
|
|
16
16
|
return memMap[path];
|
|
17
17
|
}
|
|
18
18
|
return null;
|
|
19
19
|
},
|
|
20
|
-
setItem
|
|
20
|
+
setItem(path, value) {
|
|
21
21
|
memMap[path] = String(value);
|
|
22
22
|
},
|
|
23
|
-
removeItem
|
|
23
|
+
removeItem(path) {
|
|
24
24
|
delete memMap[path];
|
|
25
25
|
},
|
|
26
|
-
getAllKeys
|
|
26
|
+
getAllKeys() {
|
|
27
27
|
return (0, _keys.default)(memMap);
|
|
28
28
|
},
|
|
29
|
-
clear
|
|
30
|
-
for (
|
|
29
|
+
clear() {
|
|
30
|
+
for (const key in memMap) {
|
|
31
31
|
if (memMap.hasOwnProperty(key)) {
|
|
32
32
|
delete memMap[key];
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
module.exports = StorageController;
|
|
37
|
+
module.exports = StorageController;
|
|
38
|
+
var _default = exports.default = StorageController;
|
|
@@ -1,3 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
5
|
+
_Object$defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _StorageController = _interopRequireDefault(require("./StorageController.react-native"));
|
|
10
|
+
var _StorageController2 = _interopRequireDefault(require("./StorageController.browser"));
|
|
11
|
+
var _StorageController3 = _interopRequireDefault(require("./StorageController.weapp"));
|
|
12
|
+
var _StorageController4 = _interopRequireDefault(require("./StorageController.default"));
|
|
13
|
+
let StorageController = _StorageController4.default;
|
|
14
|
+
StorageController = _StorageController3.default;
|
|
15
|
+
module.exports = StorageController;
|
|
16
|
+
var _default = exports.default = StorageController;
|
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
3
4
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
5
|
+
_Object$defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
4
9
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
5
10
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
6
|
-
|
|
7
|
-
* @flow
|
|
8
|
-
* @private
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
var StorageController = {
|
|
11
|
+
const StorageController = {
|
|
12
12
|
async: 1,
|
|
13
|
-
getItemAsync
|
|
14
|
-
return new _promise.default(
|
|
15
|
-
_CoreManager.default.getAsyncStorage().getItem(path,
|
|
13
|
+
getItemAsync(path) {
|
|
14
|
+
return new _promise.default((resolve, reject) => {
|
|
15
|
+
_CoreManager.default.getAsyncStorage().getItem(path, (err, value) => {
|
|
16
16
|
if (err) {
|
|
17
17
|
reject(err);
|
|
18
18
|
} else {
|
|
19
|
-
resolve(value);
|
|
19
|
+
resolve(value || null);
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
});
|
|
23
23
|
},
|
|
24
|
-
setItemAsync
|
|
25
|
-
return new _promise.default(
|
|
26
|
-
_CoreManager.default.getAsyncStorage().setItem(path, value,
|
|
24
|
+
setItemAsync(path, value) {
|
|
25
|
+
return new _promise.default((resolve, reject) => {
|
|
26
|
+
_CoreManager.default.getAsyncStorage().setItem(path, value, err => {
|
|
27
27
|
if (err) {
|
|
28
28
|
reject(err);
|
|
29
29
|
} else {
|
|
30
|
-
resolve(
|
|
30
|
+
resolve();
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
33
|
});
|
|
34
34
|
},
|
|
35
|
-
removeItemAsync
|
|
36
|
-
return new _promise.default(
|
|
37
|
-
_CoreManager.default.getAsyncStorage().removeItem(path,
|
|
35
|
+
removeItemAsync(path) {
|
|
36
|
+
return new _promise.default((resolve, reject) => {
|
|
37
|
+
_CoreManager.default.getAsyncStorage().removeItem(path, err => {
|
|
38
38
|
if (err) {
|
|
39
39
|
reject(err);
|
|
40
40
|
} else {
|
|
@@ -43,31 +43,31 @@ var StorageController = {
|
|
|
43
43
|
});
|
|
44
44
|
});
|
|
45
45
|
},
|
|
46
|
-
getAllKeysAsync
|
|
47
|
-
return new _promise.default(
|
|
48
|
-
_CoreManager.default.getAsyncStorage().getAllKeys(
|
|
46
|
+
getAllKeysAsync() {
|
|
47
|
+
return new _promise.default((resolve, reject) => {
|
|
48
|
+
_CoreManager.default.getAsyncStorage().getAllKeys((err, keys) => {
|
|
49
49
|
if (err) {
|
|
50
50
|
reject(err);
|
|
51
51
|
} else {
|
|
52
|
-
resolve(keys);
|
|
52
|
+
resolve(keys || []);
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
55
|
});
|
|
56
56
|
},
|
|
57
|
-
multiGet
|
|
58
|
-
return new _promise.default(
|
|
59
|
-
_CoreManager.default.getAsyncStorage().multiGet(keys,
|
|
57
|
+
multiGet(keys) {
|
|
58
|
+
return new _promise.default((resolve, reject) => {
|
|
59
|
+
_CoreManager.default.getAsyncStorage().multiGet(keys, (err, result) => {
|
|
60
60
|
if (err) {
|
|
61
61
|
reject(err);
|
|
62
62
|
} else {
|
|
63
|
-
resolve(result);
|
|
63
|
+
resolve(result || null);
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
});
|
|
67
67
|
},
|
|
68
|
-
multiRemove
|
|
69
|
-
return new _promise.default(
|
|
70
|
-
_CoreManager.default.getAsyncStorage().multiRemove(keys,
|
|
68
|
+
multiRemove(keys) {
|
|
69
|
+
return new _promise.default((resolve, reject) => {
|
|
70
|
+
_CoreManager.default.getAsyncStorage().multiRemove(keys, err => {
|
|
71
71
|
if (err) {
|
|
72
72
|
reject(err);
|
|
73
73
|
} else {
|
|
@@ -76,8 +76,9 @@ var StorageController = {
|
|
|
76
76
|
});
|
|
77
77
|
});
|
|
78
78
|
},
|
|
79
|
-
clear
|
|
79
|
+
clear() {
|
|
80
80
|
return _CoreManager.default.getAsyncStorage().clear();
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
|
-
module.exports = StorageController;
|
|
83
|
+
module.exports = StorageController;
|
|
84
|
+
var _default = exports.default = StorageController;
|