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
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
4
|
-
|
|
5
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
6
|
-
|
|
7
3
|
var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
|
|
8
|
-
|
|
9
4
|
var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
|
|
10
|
-
|
|
5
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
6
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
11
7
|
_Object$defineProperty(exports, "__esModule", {
|
|
12
8
|
value: true
|
|
13
9
|
});
|
|
14
|
-
|
|
15
10
|
exports.clearAllState = clearAllState;
|
|
16
11
|
exports.commitServerChanges = commitServerChanges;
|
|
17
12
|
exports.duplicateState = duplicateState;
|
|
@@ -29,9 +24,7 @@ exports.pushPendingState = pushPendingState;
|
|
|
29
24
|
exports.removeState = removeState;
|
|
30
25
|
exports.setPendingOp = setPendingOp;
|
|
31
26
|
exports.setServerData = setServerData;
|
|
32
|
-
|
|
33
27
|
var ObjectStateMutations = _interopRequireWildcard(require("./ObjectStateMutations"));
|
|
34
|
-
|
|
35
28
|
function _getRequireWildcardCache(nodeInterop) {
|
|
36
29
|
if (typeof _WeakMap !== "function") return null;
|
|
37
30
|
var cacheBabelInterop = new _WeakMap();
|
|
@@ -40,30 +33,23 @@ function _getRequireWildcardCache(nodeInterop) {
|
|
|
40
33
|
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
41
34
|
})(nodeInterop);
|
|
42
35
|
}
|
|
43
|
-
|
|
44
36
|
function _interopRequireWildcard(obj, nodeInterop) {
|
|
45
37
|
if (!nodeInterop && obj && obj.__esModule) {
|
|
46
38
|
return obj;
|
|
47
39
|
}
|
|
48
|
-
|
|
49
40
|
if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
|
|
50
41
|
return {
|
|
51
42
|
default: obj
|
|
52
43
|
};
|
|
53
44
|
}
|
|
54
|
-
|
|
55
45
|
var cache = _getRequireWildcardCache(nodeInterop);
|
|
56
|
-
|
|
57
46
|
if (cache && cache.has(obj)) {
|
|
58
47
|
return cache.get(obj);
|
|
59
48
|
}
|
|
60
|
-
|
|
61
49
|
var newObj = {};
|
|
62
|
-
|
|
63
50
|
for (var key in obj) {
|
|
64
51
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
65
52
|
var desc = _Object$defineProperty && _Object$getOwnPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null;
|
|
66
|
-
|
|
67
53
|
if (desc && (desc.get || desc.set)) {
|
|
68
54
|
_Object$defineProperty(newObj, key, desc);
|
|
69
55
|
} else {
|
|
@@ -71,217 +57,113 @@ function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
71
57
|
}
|
|
72
58
|
}
|
|
73
59
|
}
|
|
74
|
-
|
|
75
60
|
newObj.default = obj;
|
|
76
|
-
|
|
77
61
|
if (cache) {
|
|
78
62
|
cache.set(obj, newObj);
|
|
79
63
|
}
|
|
80
|
-
|
|
81
64
|
return newObj;
|
|
82
65
|
}
|
|
83
66
|
/**
|
|
84
67
|
* @flow
|
|
85
68
|
*/
|
|
86
69
|
|
|
87
|
-
|
|
88
70
|
var objectState
|
|
89
71
|
/*: {
|
|
90
72
|
[className: string]: {
|
|
91
73
|
[id: string]: State,
|
|
92
74
|
},
|
|
93
|
-
}*/
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
function getState(obj
|
|
97
|
-
/*: ObjectIdentifier*/
|
|
98
|
-
)
|
|
99
|
-
/*: ?State*/
|
|
100
|
-
{
|
|
75
|
+
}*/ = {};
|
|
76
|
+
function getState(obj /*: ObjectIdentifier*/) /*: ?State*/{
|
|
101
77
|
var classData = objectState[obj.className];
|
|
102
|
-
|
|
103
78
|
if (classData) {
|
|
104
79
|
return classData[obj.id] || null;
|
|
105
80
|
}
|
|
106
|
-
|
|
107
81
|
return null;
|
|
108
82
|
}
|
|
109
|
-
|
|
110
|
-
function initializeState(obj
|
|
111
|
-
/*: ObjectIdentifier*/
|
|
112
|
-
, initial
|
|
113
|
-
/*:: ?: State*/
|
|
114
|
-
)
|
|
115
|
-
/*: State*/
|
|
116
|
-
{
|
|
83
|
+
function initializeState(obj /*: ObjectIdentifier*/, initial /*:: ?: State*/) /*: State*/{
|
|
117
84
|
var state = getState(obj);
|
|
118
|
-
|
|
119
85
|
if (state) {
|
|
120
86
|
return state;
|
|
121
87
|
}
|
|
122
|
-
|
|
123
88
|
if (!objectState[obj.className]) {
|
|
124
89
|
objectState[obj.className] = {};
|
|
125
90
|
}
|
|
126
|
-
|
|
127
91
|
if (!initial) {
|
|
128
92
|
initial = ObjectStateMutations.defaultState();
|
|
129
93
|
}
|
|
130
|
-
|
|
131
94
|
state = objectState[obj.className][obj.id] = initial;
|
|
132
95
|
return state;
|
|
133
96
|
}
|
|
134
|
-
|
|
135
|
-
function removeState(obj
|
|
136
|
-
/*: ObjectIdentifier*/
|
|
137
|
-
)
|
|
138
|
-
/*: ?State*/
|
|
139
|
-
{
|
|
97
|
+
function removeState(obj /*: ObjectIdentifier*/) /*: ?State*/{
|
|
140
98
|
var state = getState(obj);
|
|
141
|
-
|
|
142
99
|
if (state === null) {
|
|
143
100
|
return null;
|
|
144
101
|
}
|
|
145
|
-
|
|
146
102
|
delete objectState[obj.className][obj.id];
|
|
147
103
|
return state;
|
|
148
104
|
}
|
|
149
|
-
|
|
150
|
-
function getServerData(obj
|
|
151
|
-
/*: ObjectIdentifier*/
|
|
152
|
-
)
|
|
153
|
-
/*: AttributeMap*/
|
|
154
|
-
{
|
|
105
|
+
function getServerData(obj /*: ObjectIdentifier*/) /*: AttributeMap*/{
|
|
155
106
|
var state = getState(obj);
|
|
156
|
-
|
|
157
107
|
if (state) {
|
|
158
108
|
return state.serverData;
|
|
159
109
|
}
|
|
160
|
-
|
|
161
110
|
return {};
|
|
162
111
|
}
|
|
163
|
-
|
|
164
|
-
function setServerData(obj
|
|
165
|
-
/*: ObjectIdentifier*/
|
|
166
|
-
, attributes
|
|
167
|
-
/*: AttributeMap*/
|
|
168
|
-
) {
|
|
112
|
+
function setServerData(obj /*: ObjectIdentifier*/, attributes /*: AttributeMap*/) {
|
|
169
113
|
var serverData = initializeState(obj).serverData;
|
|
170
114
|
ObjectStateMutations.setServerData(serverData, attributes);
|
|
171
115
|
}
|
|
172
|
-
|
|
173
|
-
function getPendingOps(obj
|
|
174
|
-
/*: ObjectIdentifier*/
|
|
175
|
-
)
|
|
176
|
-
/*: Array<OpsMap>*/
|
|
177
|
-
{
|
|
116
|
+
function getPendingOps(obj /*: ObjectIdentifier*/) /*: Array<OpsMap>*/{
|
|
178
117
|
var state = getState(obj);
|
|
179
|
-
|
|
180
118
|
if (state) {
|
|
181
119
|
return state.pendingOps;
|
|
182
120
|
}
|
|
183
|
-
|
|
184
121
|
return [{}];
|
|
185
122
|
}
|
|
186
|
-
|
|
187
|
-
function setPendingOp(obj
|
|
188
|
-
/*: ObjectIdentifier*/
|
|
189
|
-
, attr
|
|
190
|
-
/*: string*/
|
|
191
|
-
, op
|
|
192
|
-
/*: ?Op*/
|
|
193
|
-
) {
|
|
123
|
+
function setPendingOp(obj /*: ObjectIdentifier*/, attr /*: string*/, op /*: ?Op*/) {
|
|
194
124
|
var pendingOps = initializeState(obj).pendingOps;
|
|
195
125
|
ObjectStateMutations.setPendingOp(pendingOps, attr, op);
|
|
196
126
|
}
|
|
197
|
-
|
|
198
|
-
function pushPendingState(obj
|
|
199
|
-
/*: ObjectIdentifier*/
|
|
200
|
-
) {
|
|
127
|
+
function pushPendingState(obj /*: ObjectIdentifier*/) {
|
|
201
128
|
var pendingOps = initializeState(obj).pendingOps;
|
|
202
129
|
ObjectStateMutations.pushPendingState(pendingOps);
|
|
203
130
|
}
|
|
204
|
-
|
|
205
|
-
function popPendingState(obj
|
|
206
|
-
/*: ObjectIdentifier*/
|
|
207
|
-
)
|
|
208
|
-
/*: OpsMap*/
|
|
209
|
-
{
|
|
131
|
+
function popPendingState(obj /*: ObjectIdentifier*/) /*: OpsMap*/{
|
|
210
132
|
var pendingOps = initializeState(obj).pendingOps;
|
|
211
133
|
return ObjectStateMutations.popPendingState(pendingOps);
|
|
212
134
|
}
|
|
213
|
-
|
|
214
|
-
function mergeFirstPendingState(obj
|
|
215
|
-
/*: ObjectIdentifier*/
|
|
216
|
-
) {
|
|
135
|
+
function mergeFirstPendingState(obj /*: ObjectIdentifier*/) {
|
|
217
136
|
var pendingOps = getPendingOps(obj);
|
|
218
137
|
ObjectStateMutations.mergeFirstPendingState(pendingOps);
|
|
219
138
|
}
|
|
220
|
-
|
|
221
|
-
function getObjectCache(obj
|
|
222
|
-
/*: ObjectIdentifier*/
|
|
223
|
-
)
|
|
224
|
-
/*: ObjectCache*/
|
|
225
|
-
{
|
|
139
|
+
function getObjectCache(obj /*: ObjectIdentifier*/) /*: ObjectCache*/{
|
|
226
140
|
var state = getState(obj);
|
|
227
|
-
|
|
228
141
|
if (state) {
|
|
229
142
|
return state.objectCache;
|
|
230
143
|
}
|
|
231
|
-
|
|
232
144
|
return {};
|
|
233
145
|
}
|
|
234
|
-
|
|
235
|
-
function estimateAttribute(obj
|
|
236
|
-
/*: ObjectIdentifier*/
|
|
237
|
-
, attr
|
|
238
|
-
/*: string*/
|
|
239
|
-
)
|
|
240
|
-
/*: mixed*/
|
|
241
|
-
{
|
|
146
|
+
function estimateAttribute(obj /*: ObjectIdentifier*/, attr /*: string*/) /*: mixed*/{
|
|
242
147
|
var serverData = getServerData(obj);
|
|
243
148
|
var pendingOps = getPendingOps(obj);
|
|
244
149
|
return ObjectStateMutations.estimateAttribute(serverData, pendingOps, obj.className, obj.id, attr);
|
|
245
150
|
}
|
|
246
|
-
|
|
247
|
-
function estimateAttributes(obj
|
|
248
|
-
/*: ObjectIdentifier*/
|
|
249
|
-
)
|
|
250
|
-
/*: AttributeMap*/
|
|
251
|
-
{
|
|
151
|
+
function estimateAttributes(obj /*: ObjectIdentifier*/) /*: AttributeMap*/{
|
|
252
152
|
var serverData = getServerData(obj);
|
|
253
153
|
var pendingOps = getPendingOps(obj);
|
|
254
154
|
return ObjectStateMutations.estimateAttributes(serverData, pendingOps, obj.className, obj.id);
|
|
255
155
|
}
|
|
256
|
-
|
|
257
|
-
function commitServerChanges(obj
|
|
258
|
-
/*: ObjectIdentifier*/
|
|
259
|
-
, changes
|
|
260
|
-
/*: AttributeMap*/
|
|
261
|
-
) {
|
|
156
|
+
function commitServerChanges(obj /*: ObjectIdentifier*/, changes /*: AttributeMap*/) {
|
|
262
157
|
var state = initializeState(obj);
|
|
263
158
|
ObjectStateMutations.commitServerChanges(state.serverData, state.objectCache, changes);
|
|
264
159
|
}
|
|
265
|
-
|
|
266
|
-
function enqueueTask(obj
|
|
267
|
-
/*: ObjectIdentifier*/
|
|
268
|
-
, task
|
|
269
|
-
/*: () => Promise*/
|
|
270
|
-
)
|
|
271
|
-
/*: Promise*/
|
|
272
|
-
{
|
|
160
|
+
function enqueueTask(obj /*: ObjectIdentifier*/, task /*: () => Promise*/) /*: Promise*/{
|
|
273
161
|
var state = initializeState(obj);
|
|
274
162
|
return state.tasks.enqueue(task);
|
|
275
163
|
}
|
|
276
|
-
|
|
277
164
|
function clearAllState() {
|
|
278
165
|
objectState = {};
|
|
279
166
|
}
|
|
280
|
-
|
|
281
|
-
function duplicateState(source
|
|
282
|
-
/*: { id: string }*/
|
|
283
|
-
, dest
|
|
284
|
-
/*: { id: string }*/
|
|
285
|
-
) {
|
|
167
|
+
function duplicateState(source /*: { id: string }*/, dest /*: { id: string }*/) {
|
|
286
168
|
dest.id = source.id;
|
|
287
169
|
}
|
|
@@ -1,33 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
6
|
-
|
|
7
5
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
8
|
-
|
|
9
6
|
module.exports = /*#__PURE__*/function () {
|
|
10
7
|
function SocketWeapp(serverURL) {
|
|
11
8
|
var _this = this;
|
|
12
|
-
|
|
13
9
|
(0, _classCallCheck2.default)(this, SocketWeapp);
|
|
14
|
-
|
|
15
10
|
this.onopen = function () {};
|
|
16
|
-
|
|
17
11
|
this.onmessage = function () {};
|
|
18
|
-
|
|
19
12
|
this.onclose = function () {};
|
|
20
|
-
|
|
21
13
|
this.onerror = function () {};
|
|
22
|
-
|
|
23
14
|
wx.onSocketOpen(function () {
|
|
24
15
|
_this.onopen();
|
|
25
16
|
});
|
|
26
17
|
wx.onSocketMessage(function (msg) {
|
|
27
18
|
_this.onmessage(msg);
|
|
28
19
|
});
|
|
29
|
-
wx.onSocketClose(function () {
|
|
30
|
-
_this.onclose();
|
|
20
|
+
wx.onSocketClose(function (event) {
|
|
21
|
+
_this.onclose(event);
|
|
31
22
|
});
|
|
32
23
|
wx.onSocketError(function (error) {
|
|
33
24
|
_this.onerror(error);
|
|
@@ -36,7 +27,6 @@ module.exports = /*#__PURE__*/function () {
|
|
|
36
27
|
url: serverURL
|
|
37
28
|
});
|
|
38
29
|
}
|
|
39
|
-
|
|
40
30
|
(0, _createClass2.default)(SocketWeapp, [{
|
|
41
31
|
key: "send",
|
|
42
32
|
value: function (data) {
|
package/lib/weapp/Storage.js
CHANGED
|
@@ -1,154 +1,91 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
6
|
-
|
|
7
5
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
8
6
|
/**
|
|
9
7
|
* @flow
|
|
10
8
|
*/
|
|
11
9
|
|
|
12
|
-
|
|
13
10
|
var Storage = {
|
|
14
|
-
async: function ()
|
|
15
|
-
/*: boolean*/
|
|
16
|
-
{
|
|
11
|
+
async: function () /*: boolean*/{
|
|
17
12
|
var controller = _CoreManager.default.getStorageController();
|
|
18
|
-
|
|
19
13
|
return !!controller.async;
|
|
20
14
|
},
|
|
21
|
-
getItem: function (path
|
|
22
|
-
/*: string*/
|
|
23
|
-
)
|
|
24
|
-
/*: ?string*/
|
|
25
|
-
{
|
|
15
|
+
getItem: function (path /*: string*/) /*: ?string*/{
|
|
26
16
|
var controller = _CoreManager.default.getStorageController();
|
|
27
|
-
|
|
28
17
|
if (controller.async === 1) {
|
|
29
18
|
throw new Error('Synchronous storage is not supported by the current storage controller');
|
|
30
19
|
}
|
|
31
|
-
|
|
32
20
|
return controller.getItem(path);
|
|
33
21
|
},
|
|
34
|
-
getItemAsync: function (path
|
|
35
|
-
/*: string*/
|
|
36
|
-
)
|
|
37
|
-
/*: Promise<string>*/
|
|
38
|
-
{
|
|
22
|
+
getItemAsync: function (path /*: string*/) /*: Promise<string>*/{
|
|
39
23
|
var controller = _CoreManager.default.getStorageController();
|
|
40
|
-
|
|
41
24
|
if (controller.async === 1) {
|
|
42
25
|
return controller.getItemAsync(path);
|
|
43
26
|
}
|
|
44
|
-
|
|
45
27
|
return _promise.default.resolve(controller.getItem(path));
|
|
46
28
|
},
|
|
47
|
-
setItem: function (path
|
|
48
|
-
/*: string*/
|
|
49
|
-
, value
|
|
50
|
-
/*: string*/
|
|
51
|
-
)
|
|
52
|
-
/*: void*/
|
|
53
|
-
{
|
|
29
|
+
setItem: function (path /*: string*/, value /*: string*/) /*: void*/{
|
|
54
30
|
var controller = _CoreManager.default.getStorageController();
|
|
55
|
-
|
|
56
31
|
if (controller.async === 1) {
|
|
57
32
|
throw new Error('Synchronous storage is not supported by the current storage controller');
|
|
58
33
|
}
|
|
59
|
-
|
|
60
34
|
return controller.setItem(path, value);
|
|
61
35
|
},
|
|
62
|
-
setItemAsync: function (path
|
|
63
|
-
/*: string*/
|
|
64
|
-
, value
|
|
65
|
-
/*: string*/
|
|
66
|
-
)
|
|
67
|
-
/*: Promise<void>*/
|
|
68
|
-
{
|
|
36
|
+
setItemAsync: function (path /*: string*/, value /*: string*/) /*: Promise<void>*/{
|
|
69
37
|
var controller = _CoreManager.default.getStorageController();
|
|
70
|
-
|
|
71
38
|
if (controller.async === 1) {
|
|
72
39
|
return controller.setItemAsync(path, value);
|
|
73
40
|
}
|
|
74
|
-
|
|
75
41
|
return _promise.default.resolve(controller.setItem(path, value));
|
|
76
42
|
},
|
|
77
|
-
removeItem: function (path
|
|
78
|
-
/*: string*/
|
|
79
|
-
)
|
|
80
|
-
/*: void*/
|
|
81
|
-
{
|
|
43
|
+
removeItem: function (path /*: string*/) /*: void*/{
|
|
82
44
|
var controller = _CoreManager.default.getStorageController();
|
|
83
|
-
|
|
84
45
|
if (controller.async === 1) {
|
|
85
46
|
throw new Error('Synchronous storage is not supported by the current storage controller');
|
|
86
47
|
}
|
|
87
|
-
|
|
88
48
|
return controller.removeItem(path);
|
|
89
49
|
},
|
|
90
|
-
removeItemAsync: function (path
|
|
91
|
-
/*: string*/
|
|
92
|
-
)
|
|
93
|
-
/*: Promise<void>*/
|
|
94
|
-
{
|
|
50
|
+
removeItemAsync: function (path /*: string*/) /*: Promise<void>*/{
|
|
95
51
|
var controller = _CoreManager.default.getStorageController();
|
|
96
|
-
|
|
97
52
|
if (controller.async === 1) {
|
|
98
53
|
return controller.removeItemAsync(path);
|
|
99
54
|
}
|
|
100
|
-
|
|
101
55
|
return _promise.default.resolve(controller.removeItem(path));
|
|
102
56
|
},
|
|
103
|
-
getAllKeys: function ()
|
|
104
|
-
/*: Array<string>*/
|
|
105
|
-
{
|
|
57
|
+
getAllKeys: function () /*: Array<string>*/{
|
|
106
58
|
var controller = _CoreManager.default.getStorageController();
|
|
107
|
-
|
|
108
59
|
if (controller.async === 1) {
|
|
109
60
|
throw new Error('Synchronous storage is not supported by the current storage controller');
|
|
110
61
|
}
|
|
111
|
-
|
|
112
62
|
return controller.getAllKeys();
|
|
113
63
|
},
|
|
114
|
-
getAllKeysAsync: function ()
|
|
115
|
-
/*: Promise<Array<string>>*/
|
|
116
|
-
{
|
|
64
|
+
getAllKeysAsync: function () /*: Promise<Array<string>>*/{
|
|
117
65
|
var controller = _CoreManager.default.getStorageController();
|
|
118
|
-
|
|
119
66
|
if (controller.async === 1) {
|
|
120
67
|
return controller.getAllKeysAsync();
|
|
121
68
|
}
|
|
122
|
-
|
|
123
69
|
return _promise.default.resolve(controller.getAllKeys());
|
|
124
70
|
},
|
|
125
|
-
generatePath: function (path
|
|
126
|
-
/*: string*/
|
|
127
|
-
)
|
|
128
|
-
/*: string*/
|
|
129
|
-
{
|
|
71
|
+
generatePath: function (path /*: string*/) /*: string*/{
|
|
130
72
|
if (!_CoreManager.default.get('APPLICATION_ID')) {
|
|
131
73
|
throw new Error('You need to call Parse.initialize before using Parse.');
|
|
132
74
|
}
|
|
133
|
-
|
|
134
75
|
if (typeof path !== 'string') {
|
|
135
76
|
throw new Error('Tried to get a Storage path that was not a String.');
|
|
136
77
|
}
|
|
137
|
-
|
|
138
78
|
if (path[0] === '/') {
|
|
139
79
|
path = path.substr(1);
|
|
140
80
|
}
|
|
141
|
-
|
|
142
81
|
return 'Parse/' + _CoreManager.default.get('APPLICATION_ID') + '/' + path;
|
|
143
82
|
},
|
|
144
83
|
_clear: function () {
|
|
145
84
|
var controller = _CoreManager.default.getStorageController();
|
|
146
|
-
|
|
147
85
|
if (controller.hasOwnProperty('clear')) {
|
|
148
86
|
controller.clear();
|
|
149
87
|
}
|
|
150
88
|
}
|
|
151
89
|
};
|
|
152
90
|
module.exports = Storage;
|
|
153
|
-
|
|
154
91
|
_CoreManager.default.setStorageController(require('./StorageController.weapp'));
|
|
@@ -1,25 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
|
|
2
3
|
/**
|
|
3
4
|
* @flow
|
|
4
5
|
* @private
|
|
5
6
|
*/
|
|
6
|
-
|
|
7
7
|
/* global localStorage */
|
|
8
|
-
|
|
9
8
|
var StorageController = {
|
|
10
9
|
async: 0,
|
|
11
|
-
getItem: function (path
|
|
12
|
-
/*: string*/
|
|
13
|
-
)
|
|
14
|
-
/*: ?string*/
|
|
15
|
-
{
|
|
10
|
+
getItem: function (path /*: string*/) /*: ?string*/{
|
|
16
11
|
return localStorage.getItem(path);
|
|
17
12
|
},
|
|
18
|
-
setItem: function (path
|
|
19
|
-
/*: string*/
|
|
20
|
-
, value
|
|
21
|
-
/*: string*/
|
|
22
|
-
) {
|
|
13
|
+
setItem: function (path /*: string*/, value /*: string*/) {
|
|
23
14
|
try {
|
|
24
15
|
localStorage.setItem(path, value);
|
|
25
16
|
} catch (e) {
|
|
@@ -27,18 +18,14 @@ var StorageController = {
|
|
|
27
18
|
console.log(e.message);
|
|
28
19
|
}
|
|
29
20
|
},
|
|
30
|
-
removeItem: function (path
|
|
31
|
-
/*: string*/
|
|
32
|
-
) {
|
|
21
|
+
removeItem: function (path /*: string*/) {
|
|
33
22
|
localStorage.removeItem(path);
|
|
34
23
|
},
|
|
35
24
|
getAllKeys: function () {
|
|
36
25
|
var keys = [];
|
|
37
|
-
|
|
38
26
|
for (var i = 0; i < localStorage.length; i += 1) {
|
|
39
27
|
keys.push(localStorage.key(i));
|
|
40
28
|
}
|
|
41
|
-
|
|
42
29
|
return keys;
|
|
43
30
|
},
|
|
44
31
|
clear: function () {
|
|
@@ -1,39 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
|
|
6
5
|
/**
|
|
7
6
|
* @flow
|
|
8
7
|
* @private
|
|
9
8
|
*/
|
|
10
|
-
// When there is no native storage interface, we default to an in-memory map
|
|
11
|
-
|
|
12
9
|
|
|
10
|
+
// When there is no native storage interface, we default to an in-memory map
|
|
13
11
|
var memMap = {};
|
|
14
12
|
var StorageController = {
|
|
15
13
|
async: 0,
|
|
16
|
-
getItem: function (path
|
|
17
|
-
/*: string*/
|
|
18
|
-
)
|
|
19
|
-
/*: ?string*/
|
|
20
|
-
{
|
|
14
|
+
getItem: function (path /*: string*/) /*: ?string*/{
|
|
21
15
|
if (memMap.hasOwnProperty(path)) {
|
|
22
16
|
return memMap[path];
|
|
23
17
|
}
|
|
24
|
-
|
|
25
18
|
return null;
|
|
26
19
|
},
|
|
27
|
-
setItem: function (path
|
|
28
|
-
/*: string*/
|
|
29
|
-
, value
|
|
30
|
-
/*: string*/
|
|
31
|
-
) {
|
|
20
|
+
setItem: function (path /*: string*/, value /*: string*/) {
|
|
32
21
|
memMap[path] = String(value);
|
|
33
22
|
},
|
|
34
|
-
removeItem: function (path
|
|
35
|
-
/*: string*/
|
|
36
|
-
) {
|
|
23
|
+
removeItem: function (path /*: string*/) {
|
|
37
24
|
delete memMap[path];
|
|
38
25
|
},
|
|
39
26
|
getAllKeys: function () {
|
|
@@ -1,23 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
6
|
-
|
|
7
5
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
8
6
|
/**
|
|
9
7
|
* @flow
|
|
10
8
|
* @private
|
|
11
9
|
*/
|
|
12
10
|
|
|
13
|
-
|
|
14
11
|
var StorageController = {
|
|
15
12
|
async: 1,
|
|
16
|
-
getItemAsync: function (path
|
|
17
|
-
/*: string*/
|
|
18
|
-
)
|
|
19
|
-
/*: Promise*/
|
|
20
|
-
{
|
|
13
|
+
getItemAsync: function (path /*: string*/) /*: Promise*/{
|
|
21
14
|
return new _promise.default(function (resolve, reject) {
|
|
22
15
|
_CoreManager.default.getAsyncStorage().getItem(path, function (err, value) {
|
|
23
16
|
if (err) {
|
|
@@ -28,13 +21,7 @@ var StorageController = {
|
|
|
28
21
|
});
|
|
29
22
|
});
|
|
30
23
|
},
|
|
31
|
-
setItemAsync: function (path
|
|
32
|
-
/*: string*/
|
|
33
|
-
, value
|
|
34
|
-
/*: string*/
|
|
35
|
-
)
|
|
36
|
-
/*: Promise*/
|
|
37
|
-
{
|
|
24
|
+
setItemAsync: function (path /*: string*/, value /*: string*/) /*: Promise*/{
|
|
38
25
|
return new _promise.default(function (resolve, reject) {
|
|
39
26
|
_CoreManager.default.getAsyncStorage().setItem(path, value, function (err, value) {
|
|
40
27
|
if (err) {
|
|
@@ -45,11 +32,7 @@ var StorageController = {
|
|
|
45
32
|
});
|
|
46
33
|
});
|
|
47
34
|
},
|
|
48
|
-
removeItemAsync: function (path
|
|
49
|
-
/*: string*/
|
|
50
|
-
)
|
|
51
|
-
/*: Promise*/
|
|
52
|
-
{
|
|
35
|
+
removeItemAsync: function (path /*: string*/) /*: Promise*/{
|
|
53
36
|
return new _promise.default(function (resolve, reject) {
|
|
54
37
|
_CoreManager.default.getAsyncStorage().removeItem(path, function (err) {
|
|
55
38
|
if (err) {
|
|
@@ -60,9 +43,7 @@ var StorageController = {
|
|
|
60
43
|
});
|
|
61
44
|
});
|
|
62
45
|
},
|
|
63
|
-
getAllKeysAsync: function ()
|
|
64
|
-
/*: Promise*/
|
|
65
|
-
{
|
|
46
|
+
getAllKeysAsync: function () /*: Promise*/{
|
|
66
47
|
return new _promise.default(function (resolve, reject) {
|
|
67
48
|
_CoreManager.default.getAsyncStorage().getAllKeys(function (err, keys) {
|
|
68
49
|
if (err) {
|
|
@@ -73,11 +54,7 @@ var StorageController = {
|
|
|
73
54
|
});
|
|
74
55
|
});
|
|
75
56
|
},
|
|
76
|
-
multiGet: function (keys
|
|
77
|
-
/*: Array<string>*/
|
|
78
|
-
)
|
|
79
|
-
/*: Promise<Array<Array<string>>>*/
|
|
80
|
-
{
|
|
57
|
+
multiGet: function (keys /*: Array<string>*/) /*: Promise<Array<Array<string>>>*/{
|
|
81
58
|
return new _promise.default(function (resolve, reject) {
|
|
82
59
|
_CoreManager.default.getAsyncStorage().multiGet(keys, function (err, result) {
|
|
83
60
|
if (err) {
|
|
@@ -88,11 +65,7 @@ var StorageController = {
|
|
|
88
65
|
});
|
|
89
66
|
});
|
|
90
67
|
},
|
|
91
|
-
multiRemove: function (keys
|
|
92
|
-
/*: Array<string>*/
|
|
93
|
-
)
|
|
94
|
-
/*: Promise*/
|
|
95
|
-
{
|
|
68
|
+
multiRemove: function (keys /*: Array<string>*/) /*: Promise*/{
|
|
96
69
|
return new _promise.default(function (resolve, reject) {
|
|
97
70
|
_CoreManager.default.getAsyncStorage().multiRemove(keys, function (err) {
|
|
98
71
|
if (err) {
|