parse 6.2.0-alpha.2 → 7.0.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/dist/parse.js +58692 -26593
- package/dist/parse.min.js +1 -14
- package/dist/parse.weapp.js +58735 -26628
- package/dist/parse.weapp.min.js +1 -14
- package/index.js +1 -1
- package/lib/browser/CoreManager.js +3 -4
- package/lib/browser/ObjectStateMutations.js +51 -9
- package/lib/browser/Parse.js +42 -44
- package/lib/browser/ParseFile.js +72 -52
- package/lib/browser/ParseObject.js +31 -28
- package/lib/browser/ParseOp.js +2 -2
- package/lib/browser/ParseQuery.js +14 -14
- package/lib/browser/RESTController.js +153 -129
- package/lib/browser/SingleInstanceStateController.js +28 -27
- package/lib/browser/UniqueInstanceStateController.js +19 -23
- package/lib/browser/Xhr.weapp.js +62 -102
- package/lib/browser/decode.js +8 -1
- package/lib/browser/encode.js +9 -1
- package/lib/browser/isDangerousKey.js +29 -0
- package/lib/node/CoreManager.js +3 -4
- package/lib/node/ObjectStateMutations.js +50 -9
- package/lib/node/Parse.js +43 -47
- package/lib/node/ParseFile.js +73 -68
- package/lib/node/ParseObject.js +28 -27
- package/lib/node/RESTController.js +151 -128
- package/lib/node/SingleInstanceStateController.js +26 -28
- package/lib/node/UniqueInstanceStateController.js +19 -24
- package/lib/node/Xhr.weapp.js +58 -81
- package/lib/node/decode.js +8 -1
- package/lib/node/encode.js +9 -1
- package/lib/node/isDangerousKey.js +25 -0
- package/lib/react-native/CoreManager.js +3 -4
- package/lib/react-native/ObjectStateMutations.js +40 -9
- package/lib/react-native/Parse.js +25 -37
- package/lib/react-native/ParseFile.js +61 -49
- package/lib/react-native/ParseObject.js +28 -27
- package/lib/react-native/ParseQuery.js +25 -25
- package/lib/react-native/RESTController.js +185 -150
- package/lib/react-native/SingleInstanceStateController.js +23 -28
- package/lib/react-native/UniqueInstanceStateController.js +19 -24
- package/lib/react-native/Xhr.weapp.js +63 -95
- package/lib/react-native/decode.js +7 -1
- package/lib/react-native/encode.js +7 -1
- package/lib/react-native/isDangerousKey.js +17 -0
- package/lib/weapp/CoreManager.js +3 -4
- package/lib/weapp/ObjectStateMutations.js +51 -9
- package/lib/weapp/Parse.js +40 -44
- package/lib/weapp/ParseFile.js +72 -53
- package/lib/weapp/ParseObject.js +31 -28
- package/lib/weapp/ParseOp.js +2 -2
- package/lib/weapp/ParseQuery.js +14 -14
- package/lib/weapp/RESTController.js +154 -130
- package/lib/weapp/SingleInstanceStateController.js +28 -27
- package/lib/weapp/UniqueInstanceStateController.js +19 -23
- package/lib/weapp/Xhr.weapp.js +62 -102
- package/lib/weapp/decode.js +8 -1
- package/lib/weapp/encode.js +9 -1
- package/lib/weapp/isDangerousKey.js +29 -0
- package/node.js +1 -1
- package/package.json +33 -35
- package/react-native.js +1 -1
- package/types/Parse.d.ts +16 -10
- package/types/ParseFile.d.ts +19 -4
- package/types/ParseObject.d.ts +1 -1
- package/types/RESTController.d.ts +2 -7
- package/types/SingleInstanceStateController.d.ts +3 -3
- package/types/Xhr.weapp.d.ts +1 -29
- package/types/isDangerousKey.d.ts +7 -0
- package/weapp.js +1 -1
|
@@ -21,32 +21,29 @@ exports.removeState = removeState;
|
|
|
21
21
|
exports.setPendingOp = setPendingOp;
|
|
22
22
|
exports.setServerData = setServerData;
|
|
23
23
|
var ObjectStateMutations = _interopRequireWildcard(require("./ObjectStateMutations"));
|
|
24
|
-
function
|
|
25
|
-
if ("function"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return n.default = e, t && t.set(e, n), n;
|
|
48
|
-
}
|
|
49
|
-
let objectState = {};
|
|
24
|
+
function _interopRequireWildcard(e, t) {
|
|
25
|
+
if ("function" == typeof WeakMap) var r = new WeakMap(),
|
|
26
|
+
n = new WeakMap();
|
|
27
|
+
return (_interopRequireWildcard = function (e, t) {
|
|
28
|
+
if (!t && e && e.__esModule) return e;
|
|
29
|
+
var o,
|
|
30
|
+
i,
|
|
31
|
+
f = {
|
|
32
|
+
__proto__: null,
|
|
33
|
+
default: e
|
|
34
|
+
};
|
|
35
|
+
if (null === e || "object" != typeof e && "function" != typeof e) return f;
|
|
36
|
+
if (o = t ? n : r) {
|
|
37
|
+
if (o.has(e)) return o.get(e);
|
|
38
|
+
o.set(e, f);
|
|
39
|
+
}
|
|
40
|
+
for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]);
|
|
41
|
+
return f;
|
|
42
|
+
})(e, t);
|
|
43
|
+
}
|
|
44
|
+
// Use Object.create(null) to create an object without prototype chain
|
|
45
|
+
// This prevents prototype pollution attacks
|
|
46
|
+
let objectState = Object.create(null);
|
|
50
47
|
function getState(obj) {
|
|
51
48
|
const classData = objectState[obj.className];
|
|
52
49
|
if (classData) {
|
|
@@ -60,7 +57,8 @@ function initializeState(obj, initial) {
|
|
|
60
57
|
return state;
|
|
61
58
|
}
|
|
62
59
|
if (!objectState[obj.className]) {
|
|
63
|
-
|
|
60
|
+
// Use Object.create(null) for nested objects too
|
|
61
|
+
objectState[obj.className] = Object.create(null);
|
|
64
62
|
}
|
|
65
63
|
if (!initial) {
|
|
66
64
|
initial = ObjectStateMutations.defaultState();
|
|
@@ -136,7 +134,7 @@ function enqueueTask(obj, task) {
|
|
|
136
134
|
return state.tasks.enqueue(task);
|
|
137
135
|
}
|
|
138
136
|
function clearAllState() {
|
|
139
|
-
objectState =
|
|
137
|
+
objectState = Object.create(null);
|
|
140
138
|
}
|
|
141
139
|
function duplicateState(source, dest) {
|
|
142
140
|
dest.id = source.id;
|
|
@@ -27,30 +27,25 @@ function _interopRequireDefault(e) {
|
|
|
27
27
|
default: e
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
if ("function"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
|
|
50
|
-
var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
|
|
51
|
-
i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
|
|
52
|
-
}
|
|
53
|
-
return n.default = e, t && t.set(e, n), n;
|
|
30
|
+
function _interopRequireWildcard(e, t) {
|
|
31
|
+
if ("function" == typeof WeakMap) var r = new WeakMap(),
|
|
32
|
+
n = new WeakMap();
|
|
33
|
+
return (_interopRequireWildcard = function (e, t) {
|
|
34
|
+
if (!t && e && e.__esModule) return e;
|
|
35
|
+
var o,
|
|
36
|
+
i,
|
|
37
|
+
f = {
|
|
38
|
+
__proto__: null,
|
|
39
|
+
default: e
|
|
40
|
+
};
|
|
41
|
+
if (null === e || "object" != typeof e && "function" != typeof e) return f;
|
|
42
|
+
if (o = t ? n : r) {
|
|
43
|
+
if (o.has(e)) return o.get(e);
|
|
44
|
+
o.set(e, f);
|
|
45
|
+
}
|
|
46
|
+
for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]);
|
|
47
|
+
return f;
|
|
48
|
+
})(e, t);
|
|
54
49
|
}
|
|
55
50
|
let objectState = new WeakMap();
|
|
56
51
|
function getState(obj) {
|
package/lib/node/Xhr.weapp.js
CHANGED
|
@@ -3,87 +3,64 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
this.method = method;
|
|
44
|
-
this.url = url;
|
|
45
|
-
}
|
|
46
|
-
abort() {
|
|
47
|
-
if (!this.requestTask) {
|
|
48
|
-
return;
|
|
6
|
+
exports.polyfillFetch = polyfillFetch;
|
|
7
|
+
/* istanbul ignore file */
|
|
8
|
+
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
function parseResponse(res) {
|
|
11
|
+
let headers = res.header || {};
|
|
12
|
+
headers = Object.keys(headers).reduce((map, key) => {
|
|
13
|
+
map[key.toLowerCase()] = headers[key];
|
|
14
|
+
return map;
|
|
15
|
+
}, {});
|
|
16
|
+
return {
|
|
17
|
+
status: res.statusCode,
|
|
18
|
+
json: () => {
|
|
19
|
+
if (typeof res.data === 'object') {
|
|
20
|
+
return Promise.resolve(res.data);
|
|
21
|
+
}
|
|
22
|
+
let json = {};
|
|
23
|
+
try {
|
|
24
|
+
json = JSON.parse(res.data);
|
|
25
|
+
} catch (err) {
|
|
26
|
+
console.error(err);
|
|
27
|
+
}
|
|
28
|
+
return Promise.resolve(json);
|
|
29
|
+
},
|
|
30
|
+
headers: {
|
|
31
|
+
keys: () => Object.keys(headers),
|
|
32
|
+
get: n => headers[n.toLowerCase()],
|
|
33
|
+
has: n => n.toLowerCase() in headers,
|
|
34
|
+
entries: () => {
|
|
35
|
+
const all = [];
|
|
36
|
+
for (const key in headers) {
|
|
37
|
+
if (headers[key]) {
|
|
38
|
+
all.push([key, headers[key]]);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return all;
|
|
42
|
+
}
|
|
49
43
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
this.requestTask = wx.request({
|
|
59
|
-
url: this.url,
|
|
60
|
-
method: this.method,
|
|
61
|
-
data: data,
|
|
62
|
-
header: this.header,
|
|
63
|
-
responseType: this.responseType,
|
|
64
|
-
success: res => {
|
|
65
|
-
this.status = res.statusCode;
|
|
66
|
-
this.response = res.data;
|
|
67
|
-
this.responseHeader = res.header;
|
|
68
|
-
this.responseText = JSON.stringify(res.data);
|
|
69
|
-
this.requestTask = null;
|
|
70
|
-
this.onreadystatechange();
|
|
71
|
-
},
|
|
72
|
-
fail: err => {
|
|
73
|
-
this.requestTask = null;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function polyfillFetch() {
|
|
47
|
+
const typedGlobal = global;
|
|
48
|
+
if (typeof typedGlobal.fetch !== 'function') {
|
|
49
|
+
typedGlobal.fetch = (url, options) => {
|
|
50
|
+
const dataType = url.match(/\.(txt|json|html|txt|csv)/) ? 'text' : 'arraybuffer';
|
|
51
|
+
return new Promise((resolve, reject) => {
|
|
74
52
|
// @ts-ignore
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
53
|
+
wx.request({
|
|
54
|
+
url,
|
|
55
|
+
method: options.method || 'GET',
|
|
56
|
+
data: options.body,
|
|
57
|
+
header: options.headers,
|
|
58
|
+
dataType,
|
|
59
|
+
responseType: dataType,
|
|
60
|
+
success: response => resolve(parseResponse(response)),
|
|
61
|
+
fail: error => reject(error)
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
};
|
|
87
65
|
}
|
|
88
|
-
}
|
|
89
|
-
var _default = exports.default = XhrWeapp;
|
|
66
|
+
}
|
package/lib/node/decode.js
CHANGED
|
@@ -9,6 +9,7 @@ var _ParseFile = _interopRequireDefault(require("./ParseFile"));
|
|
|
9
9
|
var _ParseGeoPoint = _interopRequireDefault(require("./ParseGeoPoint"));
|
|
10
10
|
var _ParsePolygon = _interopRequireDefault(require("./ParsePolygon"));
|
|
11
11
|
var _ParseRelation = _interopRequireDefault(require("./ParseRelation"));
|
|
12
|
+
var _isDangerousKey = require("./isDangerousKey");
|
|
12
13
|
function _interopRequireDefault(e) {
|
|
13
14
|
return e && e.__esModule ? e : {
|
|
14
15
|
default: e
|
|
@@ -61,7 +62,13 @@ function decode(value) {
|
|
|
61
62
|
}
|
|
62
63
|
const copy = {};
|
|
63
64
|
for (const k in value) {
|
|
64
|
-
|
|
65
|
+
if (Object.prototype.hasOwnProperty.call(value, k)) {
|
|
66
|
+
// Skip dangerous keys that could pollute prototypes
|
|
67
|
+
if ((0, _isDangerousKey.isDangerousKey)(k)) {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
copy[k] = decode(value[k]);
|
|
71
|
+
}
|
|
65
72
|
}
|
|
66
73
|
return copy;
|
|
67
74
|
}
|
package/lib/node/encode.js
CHANGED
|
@@ -10,6 +10,7 @@ var _ParseFile = _interopRequireDefault(require("./ParseFile"));
|
|
|
10
10
|
var _ParseGeoPoint = _interopRequireDefault(require("./ParseGeoPoint"));
|
|
11
11
|
var _ParsePolygon = _interopRequireDefault(require("./ParsePolygon"));
|
|
12
12
|
var _ParseRelation = _interopRequireDefault(require("./ParseRelation"));
|
|
13
|
+
var _isDangerousKey = require("./isDangerousKey");
|
|
13
14
|
function _interopRequireDefault(e) {
|
|
14
15
|
return e && e.__esModule ? e : {
|
|
15
16
|
default: e
|
|
@@ -63,7 +64,14 @@ function encode(value, disallowObjects, forcePointers, seen, offline) {
|
|
|
63
64
|
if (value && typeof value === 'object') {
|
|
64
65
|
const output = {};
|
|
65
66
|
for (const k in value) {
|
|
66
|
-
|
|
67
|
+
// Only iterate over own properties
|
|
68
|
+
if (Object.prototype.hasOwnProperty.call(value, k)) {
|
|
69
|
+
// Skip dangerous keys that could pollute prototypes
|
|
70
|
+
if ((0, _isDangerousKey.isDangerousKey)(k)) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
output[k] = encode(value[k], disallowObjects, forcePointers, seen, offline);
|
|
74
|
+
}
|
|
67
75
|
}
|
|
68
76
|
return output;
|
|
69
77
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isDangerousKey = isDangerousKey;
|
|
7
|
+
/**
|
|
8
|
+
* Check if a property name or path is potentially dangerous for prototype pollution
|
|
9
|
+
* Dangerous keys include: __proto__, constructor, prototype
|
|
10
|
+
* @param key - The property name or dotted path to check
|
|
11
|
+
* @returns true if the key is dangerous, false otherwise
|
|
12
|
+
*/
|
|
13
|
+
function isDangerousKey(key) {
|
|
14
|
+
const dangerousKeys = ["__proto__", "constructor", "prototype"];
|
|
15
|
+
// Check if the key itself is dangerous
|
|
16
|
+
if (dangerousKeys.includes(key)) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
// Check if any part of a dotted path is dangerous
|
|
20
|
+
if (key.includes(".")) {
|
|
21
|
+
const parts = key.split(".");
|
|
22
|
+
return parts.some(part => dangerousKeys.includes(part));
|
|
23
|
+
}
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
@@ -8,11 +8,9 @@ var config = {
|
|
|
8
8
|
REQUEST_BATCH_SIZE: 20,
|
|
9
9
|
REQUEST_HEADERS: {},
|
|
10
10
|
SERVER_URL: 'https://api.parse.com/1',
|
|
11
|
-
SERVER_AUTH_TYPE: null,
|
|
12
|
-
SERVER_AUTH_TOKEN: null,
|
|
13
11
|
LIVEQUERY_SERVER_URL: null,
|
|
14
12
|
ENCRYPTED_KEY: null,
|
|
15
|
-
VERSION: 'js' + "
|
|
13
|
+
VERSION: 'js' + "7.0.0-alpha.1",
|
|
16
14
|
APPLICATION_ID: null,
|
|
17
15
|
JAVASCRIPT_KEY: null,
|
|
18
16
|
MAINTENANCE_KEY: null,
|
|
@@ -23,7 +21,8 @@ var config = {
|
|
|
23
21
|
ENCRYPTED_USER: false,
|
|
24
22
|
IDEMPOTENCY: false,
|
|
25
23
|
ALLOW_CUSTOM_OBJECT_ID: false,
|
|
26
|
-
PARSE_ERRORS: []
|
|
24
|
+
PARSE_ERRORS: [],
|
|
25
|
+
NODE_LOGGING: false
|
|
27
26
|
};
|
|
28
27
|
function requireMethods(name, methods, controller) {
|
|
29
28
|
methods.forEach(function (func) {
|
|
@@ -18,18 +18,25 @@ var _ParseFile = _interopRequireDefault(require("./ParseFile"));
|
|
|
18
18
|
var _ParseRelation = _interopRequireDefault(require("./ParseRelation"));
|
|
19
19
|
var _TaskQueue = _interopRequireDefault(require("./TaskQueue"));
|
|
20
20
|
var _ParseOp = require("./ParseOp");
|
|
21
|
+
var _isDangerousKey = require("./isDangerousKey");
|
|
21
22
|
function defaultState() {
|
|
22
23
|
return {
|
|
23
|
-
serverData:
|
|
24
|
-
pendingOps: [
|
|
25
|
-
objectCache:
|
|
24
|
+
serverData: Object.create(null),
|
|
25
|
+
pendingOps: [Object.create(null)],
|
|
26
|
+
objectCache: Object.create(null),
|
|
26
27
|
tasks: new _TaskQueue.default(),
|
|
27
28
|
existed: false
|
|
28
29
|
};
|
|
29
30
|
}
|
|
30
31
|
function setServerData(serverData, attributes) {
|
|
31
32
|
for (var attr in attributes) {
|
|
32
|
-
if (
|
|
33
|
+
if (!Object.prototype.hasOwnProperty.call(attributes, attr)) {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
if ((0, _isDangerousKey.isDangerousKey)(attr)) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
if (typeof attributes[attr] !== "undefined") {
|
|
33
40
|
serverData[attr] = attributes[attr];
|
|
34
41
|
} else {
|
|
35
42
|
delete serverData[attr];
|
|
@@ -37,6 +44,9 @@ function setServerData(serverData, attributes) {
|
|
|
37
44
|
}
|
|
38
45
|
}
|
|
39
46
|
function setPendingOp(pendingOps, attr, op) {
|
|
47
|
+
if ((0, _isDangerousKey.isDangerousKey)(attr)) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
40
50
|
var last = pendingOps.length - 1;
|
|
41
51
|
if (op) {
|
|
42
52
|
pendingOps[last][attr] = op;
|
|
@@ -45,12 +55,12 @@ function setPendingOp(pendingOps, attr, op) {
|
|
|
45
55
|
}
|
|
46
56
|
}
|
|
47
57
|
function pushPendingState(pendingOps) {
|
|
48
|
-
pendingOps.push(
|
|
58
|
+
pendingOps.push(Object.create(null));
|
|
49
59
|
}
|
|
50
60
|
function popPendingState(pendingOps) {
|
|
51
61
|
var first = pendingOps.shift();
|
|
52
62
|
if (!pendingOps.length) {
|
|
53
|
-
pendingOps[0] =
|
|
63
|
+
pendingOps[0] = Object.create(null);
|
|
54
64
|
}
|
|
55
65
|
return first;
|
|
56
66
|
}
|
|
@@ -58,6 +68,12 @@ function mergeFirstPendingState(pendingOps) {
|
|
|
58
68
|
var first = popPendingState(pendingOps);
|
|
59
69
|
var next = pendingOps[0];
|
|
60
70
|
for (var attr in first) {
|
|
71
|
+
if (!Object.prototype.hasOwnProperty.call(first, attr)) {
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if ((0, _isDangerousKey.isDangerousKey)(attr)) {
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
61
77
|
if (next[attr] && first[attr]) {
|
|
62
78
|
var merged = next[attr].mergeWith(first[attr]);
|
|
63
79
|
if (merged) {
|
|
@@ -69,6 +85,9 @@ function mergeFirstPendingState(pendingOps) {
|
|
|
69
85
|
}
|
|
70
86
|
}
|
|
71
87
|
function estimateAttribute(serverData, pendingOps, object, attr) {
|
|
88
|
+
if ((0, _isDangerousKey.isDangerousKey)(attr)) {
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
72
91
|
var value = serverData[attr];
|
|
73
92
|
for (var i = 0; i < pendingOps.length; i++) {
|
|
74
93
|
if (pendingOps[i][attr]) {
|
|
@@ -84,12 +103,18 @@ function estimateAttribute(serverData, pendingOps, object, attr) {
|
|
|
84
103
|
return value;
|
|
85
104
|
}
|
|
86
105
|
function estimateAttributes(serverData, pendingOps, object) {
|
|
87
|
-
var data =
|
|
106
|
+
var data = Object.create(null);
|
|
88
107
|
for (var attr in serverData) {
|
|
89
108
|
data[attr] = serverData[attr];
|
|
90
109
|
}
|
|
91
110
|
for (var i = 0; i < pendingOps.length; i++) {
|
|
92
111
|
for (attr in pendingOps[i]) {
|
|
112
|
+
if (!Object.prototype.hasOwnProperty.call(pendingOps[i], attr)) {
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
if ((0, _isDangerousKey.isDangerousKey)(attr)) {
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
93
118
|
if (pendingOps[i][attr] instanceof _ParseOp.RelationOp) {
|
|
94
119
|
if (object.id) {
|
|
95
120
|
data[attr] = pendingOps[i][attr].applyTo(data[attr], object, attr);
|
|
@@ -106,7 +131,7 @@ function estimateAttributes(serverData, pendingOps, object) {
|
|
|
106
131
|
if (!isNaN(nextKey)) {
|
|
107
132
|
_object[key] = [];
|
|
108
133
|
} else {
|
|
109
|
-
_object[key] =
|
|
134
|
+
_object[key] = Object.create(null);
|
|
110
135
|
}
|
|
111
136
|
} else {
|
|
112
137
|
if (Array.isArray(_object[key])) {
|
|
@@ -135,7 +160,7 @@ function nestedSet(obj, key, value) {
|
|
|
135
160
|
if (!isNaN(nextPath)) {
|
|
136
161
|
obj[path] = [];
|
|
137
162
|
} else {
|
|
138
|
-
obj[path] =
|
|
163
|
+
obj[path] = Object.create(null);
|
|
139
164
|
}
|
|
140
165
|
}
|
|
141
166
|
obj = obj[path];
|
|
@@ -149,6 +174,12 @@ function nestedSet(obj, key, value) {
|
|
|
149
174
|
function commitServerChanges(serverData, objectCache, changes) {
|
|
150
175
|
var ParseObject = _CoreManager.default.getParseObject();
|
|
151
176
|
for (var attr in changes) {
|
|
177
|
+
if (!Object.prototype.hasOwnProperty.call(changes, attr)) {
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
if ((0, _isDangerousKey.isDangerousKey)(attr)) {
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
152
183
|
var val = changes[attr];
|
|
153
184
|
nestedSet(serverData, attr, val);
|
|
154
185
|
if (val && typeof val === 'object' && !(val instanceof ParseObject) && !(val instanceof _ParseFile.default) && !(val instanceof _ParseRelation.default)) {
|
|
@@ -41,30 +41,25 @@ var _LiveQueryClient = _interopRequireDefault(require("./LiveQueryClient"));
|
|
|
41
41
|
var _LocalDatastoreController = _interopRequireDefault(require("./LocalDatastoreController"));
|
|
42
42
|
var _StorageController = _interopRequireDefault(require("./StorageController"));
|
|
43
43
|
var _WebSocketController = _interopRequireDefault(require("./WebSocketController"));
|
|
44
|
-
function
|
|
45
|
-
if ("function"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
|
|
64
|
-
var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
|
|
65
|
-
i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
|
|
66
|
-
}
|
|
67
|
-
return n.default = e, t && t.set(e, n), n;
|
|
44
|
+
function _interopRequireWildcard(e, t) {
|
|
45
|
+
if ("function" == typeof WeakMap) var r = new WeakMap(),
|
|
46
|
+
n = new WeakMap();
|
|
47
|
+
return (_interopRequireWildcard = function (e, t) {
|
|
48
|
+
if (!t && e && e.__esModule) return e;
|
|
49
|
+
var o,
|
|
50
|
+
i,
|
|
51
|
+
f = {
|
|
52
|
+
__proto__: null,
|
|
53
|
+
default: e
|
|
54
|
+
};
|
|
55
|
+
if (null === e || "object" != typeof e && "function" != typeof e) return f;
|
|
56
|
+
if (o = t ? n : r) {
|
|
57
|
+
if (o.has(e)) return o.get(e);
|
|
58
|
+
o.set(e, f);
|
|
59
|
+
}
|
|
60
|
+
for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]);
|
|
61
|
+
return f;
|
|
62
|
+
})(e, t);
|
|
68
63
|
}
|
|
69
64
|
var Parse = {
|
|
70
65
|
ACL: _ParseACL.default,
|
|
@@ -166,18 +161,6 @@ var Parse = {
|
|
|
166
161
|
get serverURL() {
|
|
167
162
|
return _CoreManager.default.get('SERVER_URL');
|
|
168
163
|
},
|
|
169
|
-
set serverAuthToken(value) {
|
|
170
|
-
_CoreManager.default.set('SERVER_AUTH_TOKEN', value);
|
|
171
|
-
},
|
|
172
|
-
get serverAuthToken() {
|
|
173
|
-
return _CoreManager.default.get('SERVER_AUTH_TOKEN');
|
|
174
|
-
},
|
|
175
|
-
set serverAuthType(value) {
|
|
176
|
-
_CoreManager.default.set('SERVER_AUTH_TYPE', value);
|
|
177
|
-
},
|
|
178
|
-
get serverAuthType() {
|
|
179
|
-
return _CoreManager.default.get('SERVER_AUTH_TYPE');
|
|
180
|
-
},
|
|
181
164
|
set LiveQuery(liveQuery) {
|
|
182
165
|
_CoreManager.default.setLiveQuery(liveQuery);
|
|
183
166
|
},
|
|
@@ -214,6 +197,12 @@ var Parse = {
|
|
|
214
197
|
get allowCustomObjectId() {
|
|
215
198
|
return _CoreManager.default.get('ALLOW_CUSTOM_OBJECT_ID');
|
|
216
199
|
},
|
|
200
|
+
set nodeLogging(value) {
|
|
201
|
+
_CoreManager.default.set('NODE_LOGGING', value);
|
|
202
|
+
},
|
|
203
|
+
get nodeLogging() {
|
|
204
|
+
return _CoreManager.default.get('NODE_LOGGING');
|
|
205
|
+
},
|
|
217
206
|
_request: function () {
|
|
218
207
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
219
208
|
args[_key] = arguments[_key];
|
|
@@ -267,5 +256,4 @@ var Parse = {
|
|
|
267
256
|
};
|
|
268
257
|
_CoreManager.default.setRESTController(_RESTController.default);
|
|
269
258
|
Parse.Parse = Parse;
|
|
270
|
-
module.exports = Parse;
|
|
271
259
|
var _default = exports.default = Parse;
|