parse 3.2.0 → 3.4.0-alpha.1
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/README.md +36 -41
- package/dist/parse.js +3670 -2420
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +3684 -2513
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/AnonymousUtils.js +1 -1
- package/lib/browser/Cloud.js +2 -2
- package/lib/browser/CoreManager.js +1 -1
- package/lib/browser/InstallationController.js +1 -1
- package/lib/browser/LiveQueryClient.js +4 -6
- package/lib/browser/LiveQuerySubscription.js +1 -1
- package/lib/browser/LocalDatastore.js +3 -5
- package/lib/browser/LocalDatastoreController.js +3 -5
- package/lib/browser/LocalDatastoreUtils.js +1 -1
- package/lib/browser/ObjectStateMutations.js +28 -10
- package/lib/browser/OfflineQuery.js +197 -22
- package/lib/browser/Parse.js +77 -6
- package/lib/browser/ParseCLP.js +9 -8
- package/lib/browser/ParseError.js +9 -1
- package/lib/browser/ParseFile.js +6 -3
- package/lib/browser/ParseHooks.js +9 -9
- package/lib/browser/ParseInstallation.js +1 -1
- package/lib/browser/ParseObject.js +72 -16
- package/lib/browser/ParseOp.js +2 -6
- package/lib/browser/ParseRole.js +1 -1
- package/lib/browser/ParseSession.js +1 -1
- package/lib/browser/ParseUser.js +1 -1
- package/lib/browser/Push.js +1 -1
- package/lib/browser/RESTController.js +7 -4
- package/lib/browser/SingleInstanceStateController.js +67 -14
- package/lib/browser/UniqueInstanceStateController.js +68 -15
- package/lib/browser/promiseUtils.js +1 -1
- package/lib/browser/uuid.js +5 -0
- package/lib/node/AnonymousUtils.js +1 -1
- package/lib/node/Cloud.js +2 -2
- package/lib/node/CoreManager.js +1 -1
- package/lib/node/InstallationController.js +1 -1
- package/lib/node/LocalDatastoreUtils.js +1 -1
- package/lib/node/ObjectStateMutations.js +29 -10
- package/lib/node/OfflineQuery.js +162 -0
- package/lib/node/Parse.js +28 -17
- package/lib/node/ParseCLP.js +7 -3
- package/lib/node/ParseError.js +8 -0
- package/lib/node/ParseFile.js +7 -3
- package/lib/node/ParseHooks.js +9 -9
- package/lib/node/ParseObject.js +25 -18
- package/lib/node/ParseOp.js +1 -5
- package/lib/node/Push.js +1 -1
- package/lib/node/RESTController.js +8 -4
- package/lib/node/SingleInstanceStateController.js +23 -25
- package/lib/node/UniqueInstanceStateController.js +23 -25
- package/lib/node/promiseUtils.js +2 -2
- package/lib/node/uuid.js +5 -0
- package/lib/react-native/AnonymousUtils.js +1 -1
- package/lib/react-native/Cloud.js +2 -2
- package/lib/react-native/CoreManager.js +1 -1
- package/lib/react-native/EventEmitter.js +4 -0
- package/lib/react-native/InstallationController.js +1 -1
- package/lib/react-native/LiveQueryClient.js +16 -20
- package/lib/react-native/LiveQuerySubscription.js +1 -1
- package/lib/react-native/LocalDatastore.js +15 -19
- package/lib/react-native/LocalDatastoreController.js +15 -19
- package/lib/react-native/LocalDatastoreUtils.js +1 -1
- package/lib/react-native/ObjectStateMutations.js +29 -10
- package/lib/react-native/OfflineQuery.js +171 -27
- package/lib/react-native/Parse.js +65 -5
- package/lib/react-native/ParseCLP.js +22 -22
- package/lib/react-native/ParseError.js +2 -1
- package/lib/react-native/ParseFile.js +7 -3
- package/lib/react-native/ParseHooks.js +9 -9
- package/lib/react-native/ParseInstallation.js +1 -1
- package/lib/react-native/ParseObject.js +74 -26
- package/lib/react-native/ParseOp.js +2 -2
- package/lib/react-native/ParseRole.js +1 -1
- package/lib/react-native/ParseSession.js +1 -1
- package/lib/react-native/ParseUser.js +1 -1
- package/lib/react-native/Push.js +1 -1
- package/lib/react-native/RESTController.js +8 -4
- package/lib/react-native/SingleInstanceStateController.js +63 -15
- package/lib/react-native/UniqueInstanceStateController.js +63 -15
- package/lib/react-native/promiseUtils.js +1 -1
- package/lib/react-native/uuid.js +3 -0
- package/lib/weapp/AnonymousUtils.js +1 -1
- package/lib/weapp/Cloud.js +2 -2
- package/lib/weapp/CoreManager.js +1 -1
- package/lib/weapp/InstallationController.js +1 -1
- package/lib/weapp/LiveQueryClient.js +4 -6
- package/lib/weapp/LiveQuerySubscription.js +1 -1
- package/lib/weapp/LocalDatastore.js +3 -5
- package/lib/weapp/LocalDatastoreController.js +3 -5
- package/lib/weapp/LocalDatastoreUtils.js +1 -1
- package/lib/weapp/ObjectStateMutations.js +28 -10
- package/lib/weapp/OfflineQuery.js +197 -22
- package/lib/weapp/Parse.js +77 -6
- package/lib/weapp/ParseCLP.js +9 -8
- package/lib/weapp/ParseError.js +9 -1
- package/lib/weapp/ParseFile.js +6 -3
- package/lib/weapp/ParseHooks.js +9 -9
- package/lib/weapp/ParseInstallation.js +1 -1
- package/lib/weapp/ParseObject.js +72 -16
- package/lib/weapp/ParseOp.js +2 -6
- package/lib/weapp/ParseRole.js +1 -1
- package/lib/weapp/ParseSession.js +1 -1
- package/lib/weapp/ParseUser.js +1 -1
- package/lib/weapp/Push.js +1 -1
- package/lib/weapp/RESTController.js +7 -4
- package/lib/weapp/SingleInstanceStateController.js +67 -14
- package/lib/weapp/UniqueInstanceStateController.js +68 -15
- package/lib/weapp/promiseUtils.js +1 -1
- package/lib/weapp/uuid.js +21 -0
- package/package.json +14 -7
- package/CHANGELOG.md +0 -408
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.commitServerChanges = commitServerChanges;
|
|
6
7
|
exports.defaultState = defaultState;
|
|
7
|
-
exports.setServerData = setServerData;
|
|
8
|
-
exports.setPendingOp = setPendingOp;
|
|
9
|
-
exports.pushPendingState = pushPendingState;
|
|
10
|
-
exports.popPendingState = popPendingState;
|
|
11
|
-
exports.mergeFirstPendingState = mergeFirstPendingState;
|
|
12
8
|
exports.estimateAttribute = estimateAttribute;
|
|
13
9
|
exports.estimateAttributes = estimateAttributes;
|
|
14
|
-
exports.
|
|
10
|
+
exports.mergeFirstPendingState = mergeFirstPendingState;
|
|
11
|
+
exports.popPendingState = popPendingState;
|
|
12
|
+
exports.pushPendingState = pushPendingState;
|
|
13
|
+
exports.setPendingOp = setPendingOp;
|
|
14
|
+
exports.setServerData = setServerData;
|
|
15
15
|
|
|
16
16
|
var _encode = _interopRequireDefault(require("./encode"));
|
|
17
17
|
|
|
@@ -36,9 +36,13 @@ function ownKeys(object, enumerableOnly) {
|
|
|
36
36
|
|
|
37
37
|
if (Object.getOwnPropertySymbols) {
|
|
38
38
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
|
|
40
|
+
if (enumerableOnly) {
|
|
41
|
+
symbols = symbols.filter(function (sym) {
|
|
42
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
42
46
|
keys.push.apply(keys, symbols);
|
|
43
47
|
}
|
|
44
48
|
|
|
@@ -251,6 +255,21 @@ function estimateAttributes(serverData
|
|
|
251
255
|
return data;
|
|
252
256
|
}
|
|
253
257
|
|
|
258
|
+
function nestedSet(obj, key, value) {
|
|
259
|
+
const path = key.split('.');
|
|
260
|
+
|
|
261
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
262
|
+
if (!(path[i] in obj)) obj[path[i]] = {};
|
|
263
|
+
obj = obj[path[i]];
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
if (typeof value === 'undefined') {
|
|
267
|
+
delete obj[path[path.length - 1]];
|
|
268
|
+
} else {
|
|
269
|
+
obj[path[path.length - 1]] = value;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
254
273
|
function commitServerChanges(serverData
|
|
255
274
|
/*: AttributeMap*/
|
|
256
275
|
, objectCache
|
|
@@ -260,7 +279,7 @@ function commitServerChanges(serverData
|
|
|
260
279
|
) {
|
|
261
280
|
for (const attr in changes) {
|
|
262
281
|
const val = changes[attr];
|
|
263
|
-
serverData
|
|
282
|
+
nestedSet(serverData, attr, val);
|
|
264
283
|
|
|
265
284
|
if (val && typeof val === 'object' && !(val instanceof _ParseObject.default) && !(val instanceof _ParseFile.default) && !(val instanceof _ParseRelation.default)) {
|
|
266
285
|
const json = (0, _encode.default)(val, false, true);
|
package/lib/node/OfflineQuery.js
CHANGED
|
@@ -101,6 +101,157 @@ function equalObjectsGeneric(obj, compareTo, eqlFn) {
|
|
|
101
101
|
|
|
102
102
|
return eqlFn(obj, compareTo);
|
|
103
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* @typedef RelativeTimeToDateResult
|
|
106
|
+
* @property {string} status The conversion status, `error` if conversion failed or
|
|
107
|
+
* `success` if conversion succeeded.
|
|
108
|
+
* @property {string} info The error message if conversion failed, or the relative
|
|
109
|
+
* time indication (`past`, `present`, `future`) if conversion succeeded.
|
|
110
|
+
* @property {Date|undefined} result The converted date, or `undefined` if conversion
|
|
111
|
+
* failed.
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Converts human readable relative date string, for example, 'in 10 days' to a date
|
|
116
|
+
* relative to now.
|
|
117
|
+
*
|
|
118
|
+
* @param {string} text The text to convert.
|
|
119
|
+
* @param {Date} [now=new Date()] The date from which add or subtract. Default is now.
|
|
120
|
+
* @returns {RelativeTimeToDateResult}
|
|
121
|
+
*/
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
function relativeTimeToDate(text, now = new Date()) {
|
|
125
|
+
text = text.toLowerCase();
|
|
126
|
+
let parts = text.split(' '); // Filter out whitespace
|
|
127
|
+
|
|
128
|
+
parts = parts.filter(part => part !== '');
|
|
129
|
+
const future = parts[0] === 'in';
|
|
130
|
+
const past = parts[parts.length - 1] === 'ago';
|
|
131
|
+
|
|
132
|
+
if (!future && !past && text !== 'now') {
|
|
133
|
+
return {
|
|
134
|
+
status: 'error',
|
|
135
|
+
info: "Time should either start with 'in' or end with 'ago'"
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (future && past) {
|
|
140
|
+
return {
|
|
141
|
+
status: 'error',
|
|
142
|
+
info: "Time cannot have both 'in' and 'ago'"
|
|
143
|
+
};
|
|
144
|
+
} // strip the 'ago' or 'in'
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
if (future) {
|
|
148
|
+
parts = parts.slice(1);
|
|
149
|
+
} else {
|
|
150
|
+
// past
|
|
151
|
+
parts = parts.slice(0, parts.length - 1);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (parts.length % 2 !== 0 && text !== 'now') {
|
|
155
|
+
return {
|
|
156
|
+
status: 'error',
|
|
157
|
+
info: 'Invalid time string. Dangling unit or number.'
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const pairs = [];
|
|
162
|
+
|
|
163
|
+
while (parts.length) {
|
|
164
|
+
pairs.push([parts.shift(), parts.shift()]);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
let seconds = 0;
|
|
168
|
+
|
|
169
|
+
for (const [num, interval] of pairs) {
|
|
170
|
+
const val = Number(num);
|
|
171
|
+
|
|
172
|
+
if (!Number.isInteger(val)) {
|
|
173
|
+
return {
|
|
174
|
+
status: 'error',
|
|
175
|
+
info: `'${num}' is not an integer.`
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
switch (interval) {
|
|
180
|
+
case 'yr':
|
|
181
|
+
case 'yrs':
|
|
182
|
+
case 'year':
|
|
183
|
+
case 'years':
|
|
184
|
+
seconds += val * 31536000; // 365 * 24 * 60 * 60
|
|
185
|
+
|
|
186
|
+
break;
|
|
187
|
+
|
|
188
|
+
case 'wk':
|
|
189
|
+
case 'wks':
|
|
190
|
+
case 'week':
|
|
191
|
+
case 'weeks':
|
|
192
|
+
seconds += val * 604800; // 7 * 24 * 60 * 60
|
|
193
|
+
|
|
194
|
+
break;
|
|
195
|
+
|
|
196
|
+
case 'd':
|
|
197
|
+
case 'day':
|
|
198
|
+
case 'days':
|
|
199
|
+
seconds += val * 86400; // 24 * 60 * 60
|
|
200
|
+
|
|
201
|
+
break;
|
|
202
|
+
|
|
203
|
+
case 'hr':
|
|
204
|
+
case 'hrs':
|
|
205
|
+
case 'hour':
|
|
206
|
+
case 'hours':
|
|
207
|
+
seconds += val * 3600; // 60 * 60
|
|
208
|
+
|
|
209
|
+
break;
|
|
210
|
+
|
|
211
|
+
case 'min':
|
|
212
|
+
case 'mins':
|
|
213
|
+
case 'minute':
|
|
214
|
+
case 'minutes':
|
|
215
|
+
seconds += val * 60;
|
|
216
|
+
break;
|
|
217
|
+
|
|
218
|
+
case 'sec':
|
|
219
|
+
case 'secs':
|
|
220
|
+
case 'second':
|
|
221
|
+
case 'seconds':
|
|
222
|
+
seconds += val;
|
|
223
|
+
break;
|
|
224
|
+
|
|
225
|
+
default:
|
|
226
|
+
return {
|
|
227
|
+
status: 'error',
|
|
228
|
+
info: `Invalid interval: '${interval}'`
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const milliseconds = seconds * 1000;
|
|
234
|
+
|
|
235
|
+
if (future) {
|
|
236
|
+
return {
|
|
237
|
+
status: 'success',
|
|
238
|
+
info: 'future',
|
|
239
|
+
result: new Date(now.valueOf() + milliseconds)
|
|
240
|
+
};
|
|
241
|
+
} else if (past) {
|
|
242
|
+
return {
|
|
243
|
+
status: 'success',
|
|
244
|
+
info: 'past',
|
|
245
|
+
result: new Date(now.valueOf() - milliseconds)
|
|
246
|
+
};
|
|
247
|
+
} else {
|
|
248
|
+
return {
|
|
249
|
+
status: 'success',
|
|
250
|
+
info: 'present',
|
|
251
|
+
result: new Date(now.valueOf())
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
}
|
|
104
255
|
/**
|
|
105
256
|
* Determines whether an object matches a single key's constraints
|
|
106
257
|
*
|
|
@@ -195,6 +346,17 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
|
|
|
195
346
|
|
|
196
347
|
if (compareTo.__type) {
|
|
197
348
|
compareTo = decode(compareTo);
|
|
349
|
+
} // is it a $relativeTime? convert to date
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
if (compareTo['$relativeTime']) {
|
|
353
|
+
const parserResult = relativeTimeToDate(compareTo['$relativeTime']);
|
|
354
|
+
|
|
355
|
+
if (parserResult.status !== 'success') {
|
|
356
|
+
throw new ParseError(ParseError.INVALID_JSON, `bad $relativeTime (${key}) value. ${parserResult.info}`);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
compareTo = parserResult.result;
|
|
198
360
|
} // Compare Date Object or Date String
|
|
199
361
|
|
|
200
362
|
|
package/lib/node/Parse.js
CHANGED
|
@@ -16,19 +16,17 @@ var ParseOp = _interopRequireWildcard(require("./ParseOp"));
|
|
|
16
16
|
|
|
17
17
|
var _RESTController = _interopRequireDefault(require("./RESTController"));
|
|
18
18
|
|
|
19
|
-
function _getRequireWildcardCache() {
|
|
19
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
20
20
|
if (typeof WeakMap !== "function") return null;
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
_getRequireWildcardCache = function () {
|
|
24
|
-
return
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
return cache;
|
|
21
|
+
var cacheBabelInterop = new WeakMap();
|
|
22
|
+
var cacheNodeInterop = new WeakMap();
|
|
23
|
+
return (_getRequireWildcardCache = function (nodeInterop) {
|
|
24
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
25
|
+
})(nodeInterop);
|
|
28
26
|
}
|
|
29
27
|
|
|
30
|
-
function _interopRequireWildcard(obj) {
|
|
31
|
-
if (obj && obj.__esModule) {
|
|
28
|
+
function _interopRequireWildcard(obj, nodeInterop) {
|
|
29
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
32
30
|
return obj;
|
|
33
31
|
}
|
|
34
32
|
|
|
@@ -38,7 +36,7 @@ function _interopRequireWildcard(obj) {
|
|
|
38
36
|
};
|
|
39
37
|
}
|
|
40
38
|
|
|
41
|
-
var cache = _getRequireWildcardCache();
|
|
39
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
42
40
|
|
|
43
41
|
if (cache && cache.has(obj)) {
|
|
44
42
|
return cache.get(obj);
|
|
@@ -48,7 +46,7 @@ function _interopRequireWildcard(obj) {
|
|
|
48
46
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
49
47
|
|
|
50
48
|
for (var key in obj) {
|
|
51
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
49
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
52
50
|
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
53
51
|
|
|
54
52
|
if (desc && (desc.get || desc.set)) {
|
|
@@ -107,8 +105,6 @@ const Parse = {
|
|
|
107
105
|
/*: string*/
|
|
108
106
|
) {
|
|
109
107
|
Parse._initialize(applicationId, javaScriptKey);
|
|
110
|
-
|
|
111
|
-
_EventuallyQueue.default.poll();
|
|
112
108
|
},
|
|
113
109
|
|
|
114
110
|
_initialize(applicationId
|
|
@@ -356,14 +352,29 @@ Parse._getInstallationId = function () {
|
|
|
356
352
|
};
|
|
357
353
|
/**
|
|
358
354
|
* Enable pinning in your application.
|
|
359
|
-
* This must be called
|
|
355
|
+
* This must be called after `Parse.initialize` in your application.
|
|
360
356
|
*
|
|
357
|
+
* @param [polling] Allow pinging the server /health endpoint. Default true
|
|
358
|
+
* @param [ms] Milliseconds to ping the server. Default 2000ms
|
|
361
359
|
* @static
|
|
362
360
|
*/
|
|
363
361
|
|
|
364
362
|
|
|
365
|
-
Parse.enableLocalDatastore = function (
|
|
366
|
-
|
|
363
|
+
Parse.enableLocalDatastore = function (polling = true, ms
|
|
364
|
+
/*: number*/
|
|
365
|
+
= 2000) {
|
|
366
|
+
if (!Parse.applicationId) {
|
|
367
|
+
console.log("'enableLocalDataStore' must be called after 'initialize'");
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
if (!Parse.LocalDatastore.isEnabled) {
|
|
372
|
+
Parse.LocalDatastore.isEnabled = true;
|
|
373
|
+
|
|
374
|
+
if (polling) {
|
|
375
|
+
_EventuallyQueue.default.poll(ms);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
367
378
|
};
|
|
368
379
|
/**
|
|
369
380
|
* Flag that indicates whether Local Datastore is enabled.
|
package/lib/node/ParseCLP.js
CHANGED
|
@@ -20,9 +20,13 @@ function ownKeys(object, enumerableOnly) {
|
|
|
20
20
|
|
|
21
21
|
if (Object.getOwnPropertySymbols) {
|
|
22
22
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
|
|
24
|
+
if (enumerableOnly) {
|
|
25
|
+
symbols = symbols.filter(function (sym) {
|
|
26
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
26
30
|
keys.push.apply(keys, symbols);
|
|
27
31
|
}
|
|
28
32
|
|
package/lib/node/ParseError.js
CHANGED
|
@@ -385,6 +385,14 @@ ParseError.DUPLICATE_REQUEST = 159;
|
|
|
385
385
|
*/
|
|
386
386
|
|
|
387
387
|
ParseError.INVALID_EVENT_NAME = 160;
|
|
388
|
+
/**
|
|
389
|
+
* Error code indicating that a field had an invalid value.
|
|
390
|
+
*
|
|
391
|
+
* @property {number} INVALID_VALUE
|
|
392
|
+
* @static
|
|
393
|
+
*/
|
|
394
|
+
|
|
395
|
+
ParseError.INVALID_VALUE = 162;
|
|
388
396
|
/**
|
|
389
397
|
* Error code indicating that the username is missing or empty.
|
|
390
398
|
*
|
package/lib/node/ParseFile.js
CHANGED
|
@@ -18,9 +18,13 @@ function ownKeys(object, enumerableOnly) {
|
|
|
18
18
|
|
|
19
19
|
if (Object.getOwnPropertySymbols) {
|
|
20
20
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
|
|
22
|
+
if (enumerableOnly) {
|
|
23
|
+
symbols = symbols.filter(function (sym) {
|
|
24
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
24
28
|
keys.push.apply(keys, symbols);
|
|
25
29
|
}
|
|
26
30
|
|
package/lib/node/ParseHooks.js
CHANGED
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
exports.getTriggers = getTriggers;
|
|
8
|
-
exports.getFunction = getFunction;
|
|
9
|
-
exports.getTrigger = getTrigger;
|
|
6
|
+
exports.create = create;
|
|
10
7
|
exports.createFunction = createFunction;
|
|
11
8
|
exports.createTrigger = createTrigger;
|
|
12
|
-
exports.
|
|
13
|
-
exports.
|
|
14
|
-
exports.
|
|
15
|
-
exports.
|
|
9
|
+
exports.getFunction = getFunction;
|
|
10
|
+
exports.getFunctions = getFunctions;
|
|
11
|
+
exports.getTrigger = getTrigger;
|
|
12
|
+
exports.getTriggers = getTriggers;
|
|
13
|
+
exports.remove = remove;
|
|
16
14
|
exports.removeFunction = removeFunction;
|
|
17
15
|
exports.removeTrigger = removeTrigger;
|
|
18
|
-
exports.
|
|
16
|
+
exports.update = update;
|
|
17
|
+
exports.updateFunction = updateFunction;
|
|
18
|
+
exports.updateTrigger = updateTrigger;
|
|
19
19
|
|
|
20
20
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
21
21
|
|
package/lib/node/ParseObject.js
CHANGED
|
@@ -43,19 +43,17 @@ var UniqueInstanceStateController = _interopRequireWildcard(require("./UniqueIns
|
|
|
43
43
|
|
|
44
44
|
var _unsavedChildren = _interopRequireDefault(require("./unsavedChildren"));
|
|
45
45
|
|
|
46
|
-
function _getRequireWildcardCache() {
|
|
46
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
47
47
|
if (typeof WeakMap !== "function") return null;
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
_getRequireWildcardCache = function () {
|
|
51
|
-
return
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
return cache;
|
|
48
|
+
var cacheBabelInterop = new WeakMap();
|
|
49
|
+
var cacheNodeInterop = new WeakMap();
|
|
50
|
+
return (_getRequireWildcardCache = function (nodeInterop) {
|
|
51
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
52
|
+
})(nodeInterop);
|
|
55
53
|
}
|
|
56
54
|
|
|
57
|
-
function _interopRequireWildcard(obj) {
|
|
58
|
-
if (obj && obj.__esModule) {
|
|
55
|
+
function _interopRequireWildcard(obj, nodeInterop) {
|
|
56
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
59
57
|
return obj;
|
|
60
58
|
}
|
|
61
59
|
|
|
@@ -65,7 +63,7 @@ function _interopRequireWildcard(obj) {
|
|
|
65
63
|
};
|
|
66
64
|
}
|
|
67
65
|
|
|
68
|
-
var cache = _getRequireWildcardCache();
|
|
66
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
69
67
|
|
|
70
68
|
if (cache && cache.has(obj)) {
|
|
71
69
|
return cache.get(obj);
|
|
@@ -75,7 +73,7 @@ function _interopRequireWildcard(obj) {
|
|
|
75
73
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
76
74
|
|
|
77
75
|
for (var key in obj) {
|
|
78
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
76
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
79
77
|
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
80
78
|
|
|
81
79
|
if (desc && (desc.get || desc.set)) {
|
|
@@ -106,9 +104,13 @@ function ownKeys(object, enumerableOnly) {
|
|
|
106
104
|
|
|
107
105
|
if (Object.getOwnPropertySymbols) {
|
|
108
106
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
107
|
+
|
|
108
|
+
if (enumerableOnly) {
|
|
109
|
+
symbols = symbols.filter(function (sym) {
|
|
110
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
112
114
|
keys.push.apply(keys, symbols);
|
|
113
115
|
}
|
|
114
116
|
|
|
@@ -150,7 +152,7 @@ function _defineProperty(obj, key, value) {
|
|
|
150
152
|
return obj;
|
|
151
153
|
}
|
|
152
154
|
|
|
153
|
-
const uuidv4 = require('uuid
|
|
155
|
+
const uuidv4 = require('./uuid');
|
|
154
156
|
/*:: export type Pointer = {
|
|
155
157
|
__type: string,
|
|
156
158
|
className: string,
|
|
@@ -611,7 +613,7 @@ class ParseObject {
|
|
|
611
613
|
for (var attr in pending) {
|
|
612
614
|
if (pending[attr] instanceof _ParseOp.RelationOp) {
|
|
613
615
|
changes[attr] = pending[attr].applyTo(undefined, this, attr);
|
|
614
|
-
} else if (!(attr in response)
|
|
616
|
+
} else if (!(attr in response)) {
|
|
615
617
|
// Only SetOps and UnsetOps should not come back with results
|
|
616
618
|
changes[attr] = pending[attr].applyTo(undefined);
|
|
617
619
|
}
|
|
@@ -1703,9 +1705,11 @@ class ParseObject {
|
|
|
1703
1705
|
* or<pre>
|
|
1704
1706
|
* object.save(attrs, options);</pre>
|
|
1705
1707
|
* or<pre>
|
|
1708
|
+
* object.save(key, value);</pre>
|
|
1709
|
+
* or<pre>
|
|
1706
1710
|
* object.save(key, value, options);</pre>
|
|
1707
1711
|
*
|
|
1708
|
-
*
|
|
1712
|
+
* Example 1: <pre>
|
|
1709
1713
|
* gameTurn.save({
|
|
1710
1714
|
* player: "Jake Cutter",
|
|
1711
1715
|
* diceRoll: 2
|
|
@@ -1715,6 +1719,9 @@ class ParseObject {
|
|
|
1715
1719
|
* // The save failed. Error is an instance of Parse.Error.
|
|
1716
1720
|
* });</pre>
|
|
1717
1721
|
*
|
|
1722
|
+
* Example 2: <pre>
|
|
1723
|
+
* gameTurn.save("player", "Jake Cutter");</pre>
|
|
1724
|
+
*
|
|
1718
1725
|
* @param {string | object | null} [arg1]
|
|
1719
1726
|
* Valid options are:<ul>
|
|
1720
1727
|
* <li>`Object` - Key/value pairs to update on the object.</li>
|
package/lib/node/ParseOp.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.UnsetOp = exports.SetOp = exports.RemoveOp = exports.RelationOp = exports.Op = exports.IncrementOp = exports.AddUniqueOp = exports.AddOp = void 0;
|
|
6
7
|
exports.opFromJSON = opFromJSON;
|
|
7
|
-
exports.RelationOp = exports.RemoveOp = exports.AddUniqueOp = exports.AddOp = exports.IncrementOp = exports.UnsetOp = exports.SetOp = exports.Op = void 0;
|
|
8
8
|
|
|
9
9
|
var _arrayContainsObject = _interopRequireDefault(require("./arrayContainsObject"));
|
|
10
10
|
|
|
@@ -105,16 +105,12 @@ function opFromJSON(json
|
|
|
105
105
|
class Op {
|
|
106
106
|
// Empty parent class
|
|
107
107
|
applyTo()
|
|
108
|
-
/*: mixed*/
|
|
109
|
-
|
|
110
108
|
/*: mixed*/
|
|
111
109
|
{}
|
|
112
110
|
/* eslint-disable-line no-unused-vars */
|
|
113
111
|
|
|
114
112
|
|
|
115
113
|
mergeWith()
|
|
116
|
-
/*: Op*/
|
|
117
|
-
|
|
118
114
|
/*: ?Op*/
|
|
119
115
|
{}
|
|
120
116
|
/* eslint-disable-line no-unused-vars */
|
package/lib/node/Push.js
CHANGED
|
@@ -17,9 +17,13 @@ function ownKeys(object, enumerableOnly) {
|
|
|
17
17
|
|
|
18
18
|
if (Object.getOwnPropertySymbols) {
|
|
19
19
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
|
|
21
|
+
if (enumerableOnly) {
|
|
22
|
+
symbols = symbols.filter(function (sym) {
|
|
23
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
23
27
|
keys.push.apply(keys, symbols);
|
|
24
28
|
}
|
|
25
29
|
|
|
@@ -74,7 +78,7 @@ function _defineProperty(obj, key, value) {
|
|
|
74
78
|
/* global XMLHttpRequest, XDomainRequest */
|
|
75
79
|
|
|
76
80
|
|
|
77
|
-
const uuidv4 = require('uuid
|
|
81
|
+
const uuidv4 = require('./uuid');
|
|
78
82
|
|
|
79
83
|
let XHR = null;
|
|
80
84
|
|
|
@@ -3,39 +3,37 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.clearAllState = clearAllState;
|
|
7
|
+
exports.commitServerChanges = commitServerChanges;
|
|
8
|
+
exports.duplicateState = duplicateState;
|
|
9
|
+
exports.enqueueTask = enqueueTask;
|
|
10
|
+
exports.estimateAttribute = estimateAttribute;
|
|
11
|
+
exports.estimateAttributes = estimateAttributes;
|
|
12
|
+
exports.getObjectCache = getObjectCache;
|
|
13
|
+
exports.getPendingOps = getPendingOps;
|
|
14
|
+
exports.getServerData = getServerData;
|
|
6
15
|
exports.getState = getState;
|
|
7
16
|
exports.initializeState = initializeState;
|
|
17
|
+
exports.mergeFirstPendingState = mergeFirstPendingState;
|
|
18
|
+
exports.popPendingState = popPendingState;
|
|
19
|
+
exports.pushPendingState = pushPendingState;
|
|
8
20
|
exports.removeState = removeState;
|
|
9
|
-
exports.getServerData = getServerData;
|
|
10
|
-
exports.setServerData = setServerData;
|
|
11
|
-
exports.getPendingOps = getPendingOps;
|
|
12
21
|
exports.setPendingOp = setPendingOp;
|
|
13
|
-
exports.
|
|
14
|
-
exports.popPendingState = popPendingState;
|
|
15
|
-
exports.mergeFirstPendingState = mergeFirstPendingState;
|
|
16
|
-
exports.getObjectCache = getObjectCache;
|
|
17
|
-
exports.estimateAttribute = estimateAttribute;
|
|
18
|
-
exports.estimateAttributes = estimateAttributes;
|
|
19
|
-
exports.commitServerChanges = commitServerChanges;
|
|
20
|
-
exports.enqueueTask = enqueueTask;
|
|
21
|
-
exports.clearAllState = clearAllState;
|
|
22
|
-
exports.duplicateState = duplicateState;
|
|
22
|
+
exports.setServerData = setServerData;
|
|
23
23
|
|
|
24
24
|
var ObjectStateMutations = _interopRequireWildcard(require("./ObjectStateMutations"));
|
|
25
25
|
|
|
26
|
-
function _getRequireWildcardCache() {
|
|
26
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
27
27
|
if (typeof WeakMap !== "function") return null;
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
_getRequireWildcardCache = function () {
|
|
31
|
-
return
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
return cache;
|
|
28
|
+
var cacheBabelInterop = new WeakMap();
|
|
29
|
+
var cacheNodeInterop = new WeakMap();
|
|
30
|
+
return (_getRequireWildcardCache = function (nodeInterop) {
|
|
31
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
32
|
+
})(nodeInterop);
|
|
35
33
|
}
|
|
36
34
|
|
|
37
|
-
function _interopRequireWildcard(obj) {
|
|
38
|
-
if (obj && obj.__esModule) {
|
|
35
|
+
function _interopRequireWildcard(obj, nodeInterop) {
|
|
36
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
39
37
|
return obj;
|
|
40
38
|
}
|
|
41
39
|
|
|
@@ -45,7 +43,7 @@ function _interopRequireWildcard(obj) {
|
|
|
45
43
|
};
|
|
46
44
|
}
|
|
47
45
|
|
|
48
|
-
var cache = _getRequireWildcardCache();
|
|
46
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
49
47
|
|
|
50
48
|
if (cache && cache.has(obj)) {
|
|
51
49
|
return cache.get(obj);
|
|
@@ -55,7 +53,7 @@ function _interopRequireWildcard(obj) {
|
|
|
55
53
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
56
54
|
|
|
57
55
|
for (var key in obj) {
|
|
58
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
56
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
59
57
|
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
60
58
|
|
|
61
59
|
if (desc && (desc.get || desc.set)) {
|