parse 5.2.0-alpha.1 → 5.2.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 +10102 -15029
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +10093 -15165
- 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 +308 -484
- 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 +2 -6
- package/lib/node/AnonymousUtils.js +7 -12
- package/lib/node/Cloud.js +8 -8
- 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 +17 -36
- package/lib/node/FacebookUtils.js +1 -5
- package/lib/node/IndexedDBStorageController.js +14 -10
- package/lib/node/InstallationController.js +9 -10
- package/lib/node/LiveQueryClient.js +12 -14
- package/lib/node/LiveQuerySubscription.js +3 -4
- package/lib/node/LocalDatastore.js +20 -20
- package/lib/node/LocalDatastoreController.default.js +8 -9
- 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 +9 -19
- package/lib/node/OfflineQuery.js +37 -23
- package/lib/node/Parse.js +33 -47
- package/lib/node/ParseACL.js +18 -27
- package/lib/node/ParseCLP.js +35 -37
- package/lib/node/ParseConfig.js +7 -14
- package/lib/node/ParseError.js +457 -458
- package/lib/node/ParseFile.js +24 -44
- package/lib/node/ParseGeoPoint.js +16 -17
- package/lib/node/ParseHooks.js +13 -15
- package/lib/node/ParseInstallation.js +7 -8
- package/lib/node/ParseLiveQuery.js +6 -11
- package/lib/node/ParseObject.js +139 -170
- package/lib/node/ParseOp.js +32 -44
- package/lib/node/ParsePolygon.js +11 -17
- package/lib/node/ParseQuery.js +97 -120
- package/lib/node/ParseRelation.js +7 -16
- package/lib/node/ParseRole.js +7 -8
- package/lib/node/ParseSchema.js +26 -39
- package/lib/node/ParseSession.js +7 -8
- package/lib/node/ParseUser.js +73 -84
- package/lib/node/Push.js +4 -9
- package/lib/node/RESTController.js +21 -33
- package/lib/node/SingleInstanceStateController.js +41 -69
- package/lib/node/Socket.weapp.js +23 -2
- package/lib/node/Storage.js +11 -16
- 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 +17 -17
- package/lib/node/StorageController.weapp.js +14 -8
- package/lib/node/TaskQueue.js +2 -3
- package/lib/node/UniqueInstanceStateController.js +40 -60
- package/lib/node/WebSocketController.js +15 -2
- package/lib/node/Xhr.weapp.js +11 -2
- package/lib/node/arrayContainsObject.js +1 -1
- package/lib/node/canBeSerialized.js +2 -2
- package/lib/node/decode.js +1 -1
- package/lib/node/encode.js +2 -2
- package/lib/node/equals.js +1 -1
- 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 +2 -2
- package/lib/node/unsavedChildren.js +2 -2
- 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 +2 -4
- 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 +308 -484
- 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 +19 -25
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _Object$keys2 = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
|
4
|
-
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
|
|
5
|
-
var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
|
|
6
|
-
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
7
|
-
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
|
8
|
-
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
|
|
9
|
-
var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
|
|
10
3
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
11
4
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
12
5
|
_Object$defineProperty(exports, "__esModule", {
|
|
@@ -21,9 +14,6 @@ exports.popPendingState = popPendingState;
|
|
|
21
14
|
exports.pushPendingState = pushPendingState;
|
|
22
15
|
exports.setPendingOp = setPendingOp;
|
|
23
16
|
exports.setServerData = setServerData;
|
|
24
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
|
|
25
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
26
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/toConsumableArray"));
|
|
27
17
|
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
28
18
|
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
29
19
|
var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
|
|
@@ -37,39 +27,7 @@ var _ParseFile = _interopRequireDefault(require("./ParseFile"));
|
|
|
37
27
|
var _ParseRelation = _interopRequireDefault(require("./ParseRelation"));
|
|
38
28
|
var _TaskQueue = _interopRequireDefault(require("./TaskQueue"));
|
|
39
29
|
var _ParseOp = require("./ParseOp");
|
|
40
|
-
function
|
|
41
|
-
var keys = _Object$keys2(object);
|
|
42
|
-
if (_Object$getOwnPropertySymbols) {
|
|
43
|
-
var symbols = _Object$getOwnPropertySymbols(object);
|
|
44
|
-
enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) {
|
|
45
|
-
return _Object$getOwnPropertyDescriptor(object, sym).enumerable;
|
|
46
|
-
})), keys.push.apply(keys, symbols);
|
|
47
|
-
}
|
|
48
|
-
return keys;
|
|
49
|
-
}
|
|
50
|
-
function _objectSpread(target) {
|
|
51
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
52
|
-
var _context2, _context3;
|
|
53
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
54
|
-
i % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(source), !0)).call(_context2, function (key) {
|
|
55
|
-
(0, _defineProperty2.default)(target, key, source[key]);
|
|
56
|
-
}) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context3 = ownKeys(Object(source))).call(_context3, function (key) {
|
|
57
|
-
_Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key));
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
return target;
|
|
61
|
-
}
|
|
62
|
-
/*:: export type AttributeMap = { [attr: string]: any };*/
|
|
63
|
-
/*:: export type OpsMap = { [attr: string]: Op };*/
|
|
64
|
-
/*:: export type ObjectCache = { [attr: string]: string };*/
|
|
65
|
-
/*:: export type State = {
|
|
66
|
-
serverData: AttributeMap,
|
|
67
|
-
pendingOps: Array<OpsMap>,
|
|
68
|
-
objectCache: ObjectCache,
|
|
69
|
-
tasks: TaskQueue,
|
|
70
|
-
existed: boolean,
|
|
71
|
-
};*/
|
|
72
|
-
function defaultState() /*: State*/{
|
|
30
|
+
function defaultState() {
|
|
73
31
|
return {
|
|
74
32
|
serverData: {},
|
|
75
33
|
pendingOps: [{}],
|
|
@@ -78,50 +36,50 @@ function defaultState() /*: State*/{
|
|
|
78
36
|
existed: false
|
|
79
37
|
};
|
|
80
38
|
}
|
|
81
|
-
function setServerData(serverData
|
|
82
|
-
for (
|
|
83
|
-
if (typeof attributes[
|
|
84
|
-
serverData[
|
|
39
|
+
function setServerData(serverData, attributes) {
|
|
40
|
+
for (const attr in attributes) {
|
|
41
|
+
if (typeof attributes[attr] !== 'undefined') {
|
|
42
|
+
serverData[attr] = attributes[attr];
|
|
85
43
|
} else {
|
|
86
|
-
delete serverData[
|
|
44
|
+
delete serverData[attr];
|
|
87
45
|
}
|
|
88
46
|
}
|
|
89
47
|
}
|
|
90
|
-
function setPendingOp(pendingOps
|
|
91
|
-
|
|
48
|
+
function setPendingOp(pendingOps, attr, op) {
|
|
49
|
+
const last = pendingOps.length - 1;
|
|
92
50
|
if (op) {
|
|
93
51
|
pendingOps[last][attr] = op;
|
|
94
52
|
} else {
|
|
95
53
|
delete pendingOps[last][attr];
|
|
96
54
|
}
|
|
97
55
|
}
|
|
98
|
-
function pushPendingState(pendingOps
|
|
56
|
+
function pushPendingState(pendingOps) {
|
|
99
57
|
pendingOps.push({});
|
|
100
58
|
}
|
|
101
|
-
function popPendingState(pendingOps
|
|
102
|
-
|
|
59
|
+
function popPendingState(pendingOps) {
|
|
60
|
+
const first = pendingOps.shift();
|
|
103
61
|
if (!pendingOps.length) {
|
|
104
62
|
pendingOps[0] = {};
|
|
105
63
|
}
|
|
106
64
|
return first;
|
|
107
65
|
}
|
|
108
|
-
function mergeFirstPendingState(pendingOps
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
for (
|
|
112
|
-
if (next[
|
|
113
|
-
|
|
66
|
+
function mergeFirstPendingState(pendingOps) {
|
|
67
|
+
const first = popPendingState(pendingOps);
|
|
68
|
+
const next = pendingOps[0];
|
|
69
|
+
for (const attr in first) {
|
|
70
|
+
if (next[attr] && first[attr]) {
|
|
71
|
+
const merged = next[attr].mergeWith(first[attr]);
|
|
114
72
|
if (merged) {
|
|
115
|
-
next[
|
|
73
|
+
next[attr] = merged;
|
|
116
74
|
}
|
|
117
75
|
} else {
|
|
118
|
-
next[
|
|
76
|
+
next[attr] = first[attr];
|
|
119
77
|
}
|
|
120
78
|
}
|
|
121
79
|
}
|
|
122
|
-
function estimateAttribute(serverData
|
|
123
|
-
|
|
124
|
-
for (
|
|
80
|
+
function estimateAttribute(serverData, pendingOps, object, attr) {
|
|
81
|
+
let value = serverData[attr];
|
|
82
|
+
for (let i = 0; i < pendingOps.length; i++) {
|
|
125
83
|
if (pendingOps[i][attr]) {
|
|
126
84
|
if (pendingOps[i][attr] instanceof _ParseOp.RelationOp) {
|
|
127
85
|
if (object.id) {
|
|
@@ -134,12 +92,12 @@ function estimateAttribute(serverData /*: AttributeMap*/, pendingOps /*: Array<O
|
|
|
134
92
|
}
|
|
135
93
|
return value;
|
|
136
94
|
}
|
|
137
|
-
function estimateAttributes(serverData
|
|
138
|
-
|
|
95
|
+
function estimateAttributes(serverData, pendingOps, object) {
|
|
96
|
+
const data = {};
|
|
139
97
|
for (var attr in serverData) {
|
|
140
98
|
data[attr] = serverData[attr];
|
|
141
99
|
}
|
|
142
|
-
for (
|
|
100
|
+
for (let i = 0; i < pendingOps.length; i++) {
|
|
143
101
|
for (attr in pendingOps[i]) {
|
|
144
102
|
if (pendingOps[i][attr] instanceof _ParseOp.RelationOp) {
|
|
145
103
|
if (object.id) {
|
|
@@ -148,28 +106,30 @@ function estimateAttributes(serverData /*: AttributeMap*/, pendingOps /*: Array<
|
|
|
148
106
|
} else {
|
|
149
107
|
if ((0, _includes.default)(attr).call(attr, '.')) {
|
|
150
108
|
// similar to nestedSet function
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
for (
|
|
155
|
-
|
|
156
|
-
if (!(key in
|
|
157
|
-
|
|
109
|
+
const fields = attr.split('.');
|
|
110
|
+
const last = fields[fields.length - 1];
|
|
111
|
+
let object = data;
|
|
112
|
+
for (let i = 0; i < fields.length - 1; i++) {
|
|
113
|
+
const key = fields[i];
|
|
114
|
+
if (!(key in object)) {
|
|
115
|
+
const nextKey = fields[i + 1];
|
|
158
116
|
if (!isNaN(nextKey)) {
|
|
159
|
-
|
|
117
|
+
object[key] = [];
|
|
160
118
|
} else {
|
|
161
|
-
|
|
119
|
+
object[key] = {};
|
|
162
120
|
}
|
|
163
121
|
} else {
|
|
164
|
-
if ((0, _isArray.default)(
|
|
165
|
-
|
|
122
|
+
if ((0, _isArray.default)(object[key])) {
|
|
123
|
+
object[key] = [...object[key]];
|
|
166
124
|
} else {
|
|
167
|
-
|
|
125
|
+
object[key] = {
|
|
126
|
+
...object[key]
|
|
127
|
+
};
|
|
168
128
|
}
|
|
169
129
|
}
|
|
170
|
-
|
|
130
|
+
object = object[key];
|
|
171
131
|
}
|
|
172
|
-
|
|
132
|
+
object[last] = pendingOps[i][attr].applyTo(object[last]);
|
|
173
133
|
} else {
|
|
174
134
|
data[attr] = pendingOps[i][attr].applyTo(data[attr]);
|
|
175
135
|
}
|
|
@@ -190,11 +150,11 @@ function estimateAttributes(serverData /*: AttributeMap*/, pendingOps /*: Array<
|
|
|
190
150
|
* @param value The value to assign. If it's an `undefined` then the key is deleted.
|
|
191
151
|
*/
|
|
192
152
|
function nestedSet(obj, key, value) {
|
|
193
|
-
|
|
194
|
-
for (
|
|
195
|
-
|
|
153
|
+
const paths = key.split('.');
|
|
154
|
+
for (let i = 0; i < paths.length - 1; i++) {
|
|
155
|
+
const path = paths[i];
|
|
196
156
|
if (!(path in obj)) {
|
|
197
|
-
|
|
157
|
+
const nextPath = paths[i + 1];
|
|
198
158
|
if (!isNaN(nextPath)) {
|
|
199
159
|
obj[path] = [];
|
|
200
160
|
} else {
|
|
@@ -209,21 +169,19 @@ function nestedSet(obj, key, value) {
|
|
|
209
169
|
obj[paths[paths.length - 1]] = value;
|
|
210
170
|
}
|
|
211
171
|
}
|
|
212
|
-
function commitServerChanges(serverData
|
|
213
|
-
|
|
214
|
-
for (
|
|
172
|
+
function commitServerChanges(serverData, objectCache, changes) {
|
|
173
|
+
const ParseObject = _CoreManager.default.getParseObject();
|
|
174
|
+
for (const attr in changes) {
|
|
215
175
|
var _context;
|
|
216
|
-
|
|
176
|
+
let val = changes[attr];
|
|
217
177
|
// Check for JSON array { '0': { something }, '1': { something } }
|
|
218
|
-
if (val &&
|
|
219
|
-
return !isNaN((0, _parseInt2.default)(k));
|
|
220
|
-
})) {
|
|
178
|
+
if (val && typeof val === 'object' && !(0, _isArray.default)(val) && (0, _keys.default)(val).length > 0 && (0, _some.default)(_context = (0, _keys.default)(val)).call(_context, k => !isNaN((0, _parseInt2.default)(k)))) {
|
|
221
179
|
val = (0, _values.default)(val);
|
|
222
180
|
}
|
|
223
|
-
nestedSet(serverData,
|
|
224
|
-
if (val &&
|
|
225
|
-
|
|
226
|
-
objectCache[
|
|
181
|
+
nestedSet(serverData, attr, val);
|
|
182
|
+
if (val && typeof val === 'object' && !(val instanceof ParseObject) && !(val instanceof _ParseFile.default) && !(val instanceof _ParseRelation.default)) {
|
|
183
|
+
const json = (0, _encode.default)(val, false, true);
|
|
184
|
+
objectCache[attr] = (0, _stringify.default)(json);
|
|
227
185
|
}
|
|
228
186
|
}
|
|
229
187
|
}
|