@adobe/helix-admin-support 6.0.0 → 6.0.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/CHANGELOG.md +7 -0
- package/package.json +8 -8
- package/src/flatJson2Object.js +17 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [6.0.1](https://github.com/adobe/helix-admin-support/compare/v6.0.0...v6.0.1) (2026-11-24)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* harden flatJson2object ([837d401](https://github.com/adobe/helix-admin-support/commit/837d40191215c20643a02553b463cf6b4a6cd7c1))
|
|
7
|
+
|
|
1
8
|
# [6.0.0](https://github.com/adobe/helix-admin-support/compare/v5.2.2...v6.0.0) (2026-09-18)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-admin-support",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"description": "Helix Admin Support Library",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@smithy/node-http-handler": "^4.0.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@adobe/eslint-config-helix": "3.0.
|
|
48
|
+
"@adobe/eslint-config-helix": "3.0.35",
|
|
49
49
|
"@adobe/helix-shared-storage-s3": "2.0.1",
|
|
50
50
|
"@adobe/jsonschema2md": "8.0.11",
|
|
51
51
|
"@eslint/config-helpers": "0.7.0",
|
|
@@ -55,16 +55,16 @@
|
|
|
55
55
|
"eslint": "9.39.5",
|
|
56
56
|
"husky": "9.1.7",
|
|
57
57
|
"jsdoc-to-markdown": "9.1.3",
|
|
58
|
-
"json-schema-to-typescript": "
|
|
58
|
+
"json-schema-to-typescript": "16.0.0",
|
|
59
59
|
"junit-report-builder": "5.1.2",
|
|
60
|
-
"lint-staged": "17.
|
|
61
|
-
"mocha": "
|
|
62
|
-
"mocha-multi-reporters": "1.5.
|
|
60
|
+
"lint-staged": "17.6.0",
|
|
61
|
+
"mocha": "12.0.3",
|
|
62
|
+
"mocha-multi-reporters": "1.5.2",
|
|
63
63
|
"mocha-suppress-logs": "0.6.0",
|
|
64
|
-
"nock": "
|
|
64
|
+
"nock": "15.0.6",
|
|
65
65
|
"semantic-release": "25.0.9",
|
|
66
66
|
"xml2js": "0.6.2",
|
|
67
|
-
"yaml": "2.9.
|
|
67
|
+
"yaml": "2.9.1"
|
|
68
68
|
},
|
|
69
69
|
"lint-staged": {
|
|
70
70
|
"*.js": "eslint",
|
package/src/flatJson2Object.js
CHANGED
|
@@ -53,35 +53,39 @@
|
|
|
53
53
|
* @param {string} [keyName = 'key'] name of the key column.
|
|
54
54
|
* @param {string} [valueName = 'value'] name of the value column.
|
|
55
55
|
*/
|
|
56
|
+
function setProperty(o, key, value) {
|
|
57
|
+
Object.defineProperty(o, key, {
|
|
58
|
+
value,
|
|
59
|
+
writable: true,
|
|
60
|
+
enumerable: true,
|
|
61
|
+
configurable: true,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
56
65
|
export function flatJson2object(rows, keyName = 'key', valueName = 'value') {
|
|
57
66
|
const arrays = [];
|
|
58
67
|
const update = (o, segs, value) => {
|
|
59
68
|
const seg = segs.shift();
|
|
60
69
|
if (segs.length) {
|
|
61
|
-
if (seg
|
|
70
|
+
if (Object.hasOwn(o, seg)) {
|
|
62
71
|
update(o[seg], segs, value);
|
|
63
72
|
return o;
|
|
64
73
|
}
|
|
65
74
|
const n = Number.parseInt(segs[0], 10);
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
// eslint-disable-next-line no-param-reassign
|
|
71
|
-
o[seg] = update([], segs, value);
|
|
72
|
-
arrays.push(o[seg]);
|
|
75
|
+
const child = Number.isNaN(n) ? Object.create(null) : [];
|
|
76
|
+
setProperty(o, seg, update(child, segs, value));
|
|
77
|
+
if (Array.isArray(child)) {
|
|
78
|
+
arrays.push(child);
|
|
73
79
|
}
|
|
74
80
|
return o;
|
|
75
81
|
}
|
|
76
|
-
if (!(seg
|
|
77
|
-
|
|
78
|
-
o[seg] = value;
|
|
82
|
+
if (!Object.hasOwn(o, seg)) {
|
|
83
|
+
setProperty(o, seg, value);
|
|
79
84
|
} else if (Array.isArray(o[seg])) {
|
|
80
85
|
// eslint-disable-next-line no-param-reassign
|
|
81
86
|
o[seg].push(value);
|
|
82
87
|
} else {
|
|
83
|
-
|
|
84
|
-
o[seg] = [o[seg], value];
|
|
88
|
+
setProperty(o, seg, [o[seg], value]);
|
|
85
89
|
}
|
|
86
90
|
return o;
|
|
87
91
|
};
|