@wix/sdk 1.17.9 → 1.19.0
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/build/flat-utils.d.ts +1 -5
- package/build/flat-utils.js +15 -6
- package/build/index.d.ts +1 -0
- package/build/index.js +1 -0
- package/build/object-utils.d.ts +4 -0
- package/build/object-utils.js +38 -0
- package/cjs/build/flat-utils.d.ts +1 -5
- package/cjs/build/flat-utils.js +15 -6
- package/cjs/build/index.d.ts +1 -0
- package/cjs/build/index.js +3 -1
- package/cjs/build/object-utils.d.ts +4 -0
- package/cjs/build/object-utils.js +42 -0
- package/package.json +4 -4
package/build/flat-utils.d.ts
CHANGED
package/build/flat-utils.js
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { set, toPathObject } from './object-utils.js';
|
|
2
|
+
export function unflatten(flatObject) {
|
|
3
|
+
const result = {};
|
|
4
|
+
for (const [flatKey, value] of Object.entries(flatObject)) {
|
|
5
|
+
// Skip prototype pollution keys
|
|
6
|
+
if (isPrototypePollutionKey(flatKey)) {
|
|
7
|
+
continue;
|
|
8
|
+
}
|
|
9
|
+
const path = toPathObject(flatKey);
|
|
10
|
+
set(result, path, value);
|
|
11
|
+
}
|
|
12
|
+
return result;
|
|
13
|
+
}
|
|
14
|
+
function isPrototypePollutionKey(key) {
|
|
15
|
+
return key === '__proto__' || key === 'constructor' || key === 'prototype';
|
|
7
16
|
}
|
package/build/index.d.ts
CHANGED
package/build/index.js
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const DELIMITER = '.';
|
|
2
|
+
export function set(obj, path, value) {
|
|
3
|
+
if (obj == null) {
|
|
4
|
+
throw new Error('Cannot set value on null or undefined');
|
|
5
|
+
}
|
|
6
|
+
const keys = toPathObject(path);
|
|
7
|
+
let current = obj;
|
|
8
|
+
for (let i = 0; i < keys.length; i++) {
|
|
9
|
+
const key = keys[i];
|
|
10
|
+
// Last key → assign value
|
|
11
|
+
if (i === keys.length - 1) {
|
|
12
|
+
current[key] = value;
|
|
13
|
+
break;
|
|
14
|
+
}
|
|
15
|
+
// Create object or array if missing
|
|
16
|
+
const nextKey = keys[i + 1];
|
|
17
|
+
if (!(key in current) || current[key] == null) {
|
|
18
|
+
current[key] = typeof nextKey === 'number' ? [] : {};
|
|
19
|
+
}
|
|
20
|
+
else if (typeof current[key] !== 'object' || current[key] === null) {
|
|
21
|
+
// Overwrite non-object values
|
|
22
|
+
current[key] = typeof nextKey === 'number' ? [] : {};
|
|
23
|
+
}
|
|
24
|
+
current = current[key];
|
|
25
|
+
}
|
|
26
|
+
return obj;
|
|
27
|
+
}
|
|
28
|
+
export function toPathObject(path) {
|
|
29
|
+
if (Array.isArray(path)) {
|
|
30
|
+
return path;
|
|
31
|
+
}
|
|
32
|
+
return path
|
|
33
|
+
.split(DELIMITER)
|
|
34
|
+
.map((segment) => (isNumericSegment(segment) ? Number(segment) : segment));
|
|
35
|
+
}
|
|
36
|
+
function isNumericSegment(segment) {
|
|
37
|
+
return /^\d+$/.test(segment);
|
|
38
|
+
}
|
package/cjs/build/flat-utils.js
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
* TODO - implement this function
|
|
5
|
-
*/
|
|
6
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
3
|
exports.unflatten = unflatten;
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
const object_utils_js_1 = require("./object-utils.js");
|
|
5
|
+
function unflatten(flatObject) {
|
|
6
|
+
const result = {};
|
|
7
|
+
for (const [flatKey, value] of Object.entries(flatObject)) {
|
|
8
|
+
// Skip prototype pollution keys
|
|
9
|
+
if (isPrototypePollutionKey(flatKey)) {
|
|
10
|
+
continue;
|
|
11
|
+
}
|
|
12
|
+
const path = (0, object_utils_js_1.toPathObject)(flatKey);
|
|
13
|
+
(0, object_utils_js_1.set)(result, path, value);
|
|
14
|
+
}
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
function isPrototypePollutionKey(key) {
|
|
18
|
+
return key === '__proto__' || key === 'constructor' || key === 'prototype';
|
|
10
19
|
}
|
package/cjs/build/index.d.ts
CHANGED
package/cjs/build/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.DEFAULT_API_URL = void 0;
|
|
17
|
+
exports.createNanoEvents = exports.DEFAULT_API_URL = void 0;
|
|
18
18
|
__exportStar(require("./wixClient.js"), exports);
|
|
19
19
|
__exportStar(require("./wixMedia.js"), exports);
|
|
20
20
|
__exportStar(require("./auth/oauth2/OAuthStrategy.js"), exports);
|
|
@@ -24,3 +24,5 @@ __exportStar(require("./auth/AppStrategy.js"), exports);
|
|
|
24
24
|
__exportStar(require("@wix/sdk-types"), exports);
|
|
25
25
|
var common_js_1 = require("./common.js");
|
|
26
26
|
Object.defineProperty(exports, "DEFAULT_API_URL", { enumerable: true, get: function () { return common_js_1.DEFAULT_API_URL; } });
|
|
27
|
+
var nanoevents_js_1 = require("./nanoevents.js");
|
|
28
|
+
Object.defineProperty(exports, "createNanoEvents", { enumerable: true, get: function () { return nanoevents_js_1.createNanoEvents; } });
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.set = set;
|
|
4
|
+
exports.toPathObject = toPathObject;
|
|
5
|
+
const DELIMITER = '.';
|
|
6
|
+
function set(obj, path, value) {
|
|
7
|
+
if (obj == null) {
|
|
8
|
+
throw new Error('Cannot set value on null or undefined');
|
|
9
|
+
}
|
|
10
|
+
const keys = toPathObject(path);
|
|
11
|
+
let current = obj;
|
|
12
|
+
for (let i = 0; i < keys.length; i++) {
|
|
13
|
+
const key = keys[i];
|
|
14
|
+
// Last key → assign value
|
|
15
|
+
if (i === keys.length - 1) {
|
|
16
|
+
current[key] = value;
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
19
|
+
// Create object or array if missing
|
|
20
|
+
const nextKey = keys[i + 1];
|
|
21
|
+
if (!(key in current) || current[key] == null) {
|
|
22
|
+
current[key] = typeof nextKey === 'number' ? [] : {};
|
|
23
|
+
}
|
|
24
|
+
else if (typeof current[key] !== 'object' || current[key] === null) {
|
|
25
|
+
// Overwrite non-object values
|
|
26
|
+
current[key] = typeof nextKey === 'number' ? [] : {};
|
|
27
|
+
}
|
|
28
|
+
current = current[key];
|
|
29
|
+
}
|
|
30
|
+
return obj;
|
|
31
|
+
}
|
|
32
|
+
function toPathObject(path) {
|
|
33
|
+
if (Array.isArray(path)) {
|
|
34
|
+
return path;
|
|
35
|
+
}
|
|
36
|
+
return path
|
|
37
|
+
.split(DELIMITER)
|
|
38
|
+
.map((segment) => (isNumericSegment(segment) ? Number(segment) : segment));
|
|
39
|
+
}
|
|
40
|
+
function isNumericSegment(segment) {
|
|
41
|
+
return /^\d+$/.test(segment);
|
|
42
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Ronny Ringel",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"@wix/image-kit": "^1.114.0",
|
|
77
77
|
"@wix/redirects": "^1.0.70",
|
|
78
78
|
"@wix/sdk-context": "0.0.1",
|
|
79
|
-
"@wix/sdk-runtime": "1.0.
|
|
79
|
+
"@wix/sdk-runtime": "1.0.2",
|
|
80
80
|
"@wix/sdk-types": "1.16.0",
|
|
81
81
|
"jose": "^5.10.0",
|
|
82
82
|
"type-fest": "^4.41.0"
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"@wix/events": "^1.0.382",
|
|
93
93
|
"@wix/metro": "^1.0.93",
|
|
94
94
|
"@wix/metro-runtime": "^1.1891.0",
|
|
95
|
-
"@wix/sdk-runtime": "1.0.
|
|
95
|
+
"@wix/sdk-runtime": "1.0.2",
|
|
96
96
|
"eslint": "^8.57.1",
|
|
97
97
|
"eslint-config-sdk": "1.0.0",
|
|
98
98
|
"graphql": "^16.8.0",
|
|
@@ -126,5 +126,5 @@
|
|
|
126
126
|
"wallaby": {
|
|
127
127
|
"autoDetect": true
|
|
128
128
|
},
|
|
129
|
-
"falconPackageHash": "
|
|
129
|
+
"falconPackageHash": "63afb7d530a2d141dbd766ef8d0c61a8a391c81110da69913d9fd6d8"
|
|
130
130
|
}
|