@mcp-abap-adt/adt-backup 0.1.0 → 0.1.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.
Files changed (39) hide show
  1. package/dist/lib/dependencies/collectTreeDependencies.d.ts.map +1 -1
  2. package/dist/lib/dependencies/collectTreeDependencies.js +1 -1
  3. package/dist/lib/restore/deleteBackupObjects.d.ts.map +1 -1
  4. package/dist/lib/restore/deleteBackupObjects.js +2 -4
  5. package/dist/lib/restore/restoreTreeNode.d.ts.map +1 -1
  6. package/dist/lib/restore/restoreTreeNode.js +5 -4
  7. package/dist/lib/utils/diffUnified.js +1 -1
  8. package/dist/lib/utils/index.d.ts +0 -1
  9. package/dist/lib/utils/index.d.ts.map +1 -1
  10. package/dist/lib/utils/index.js +0 -1
  11. package/dist/lib/verify/verifyObjectInSystem.d.ts.map +1 -1
  12. package/dist/lib/xml/index.d.ts +0 -6
  13. package/dist/lib/xml/index.d.ts.map +1 -1
  14. package/dist/lib/xml/index.js +0 -6
  15. package/package.json +1 -1
  16. package/dist/lib/utils/asArray.d.ts +0 -2
  17. package/dist/lib/utils/asArray.d.ts.map +0 -1
  18. package/dist/lib/utils/asArray.js +0 -9
  19. package/dist/lib/utils/diffAttributes.d.ts +0 -17
  20. package/dist/lib/utils/diffAttributes.d.ts.map +0 -1
  21. package/dist/lib/utils/diffAttributes.js +0 -27
  22. package/dist/lib/xml/flattenXmlAttributes.d.ts +0 -2
  23. package/dist/lib/xml/flattenXmlAttributes.d.ts.map +0 -1
  24. package/dist/lib/xml/flattenXmlAttributes.js +0 -82
  25. package/dist/lib/xml/getNodeDescription.d.ts +0 -3
  26. package/dist/lib/xml/getNodeDescription.d.ts.map +0 -1
  27. package/dist/lib/xml/getNodeDescription.js +0 -12
  28. package/dist/lib/xml/getNodeName.d.ts +0 -3
  29. package/dist/lib/xml/getNodeName.d.ts.map +0 -1
  30. package/dist/lib/xml/getNodeName.js +0 -12
  31. package/dist/lib/xml/getNodeType.d.ts +0 -3
  32. package/dist/lib/xml/getNodeType.d.ts.map +0 -1
  33. package/dist/lib/xml/getNodeType.js +0 -12
  34. package/dist/lib/xml/isNodeObject.d.ts +0 -3
  35. package/dist/lib/xml/isNodeObject.d.ts.map +0 -1
  36. package/dist/lib/xml/isNodeObject.js +0 -12
  37. package/dist/lib/xml/readAttr.d.ts +0 -3
  38. package/dist/lib/xml/readAttr.d.ts.map +0 -1
  39. package/dist/lib/xml/readAttr.js +0 -16
@@ -1 +1 @@
1
- {"version":3,"file":"collectTreeDependencies.d.ts","sourceRoot":"","sources":["../../../src/lib/dependencies/collectTreeDependencies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAK3D,OAAO,KAAK,EAAE,cAAc,EAA6B,MAAM,UAAU,CAAC;AAkC1E,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,IAAI,CAAC,CA6Ff"}
1
+ {"version":3,"file":"collectTreeDependencies.d.ts","sourceRoot":"","sources":["../../../src/lib/dependencies/collectTreeDependencies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAK3D,OAAO,KAAK,EAAE,cAAc,EAA6B,MAAM,UAAU,CAAC;AAkC1E,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,IAAI,CAAC,CA+Ff"}
@@ -93,7 +93,7 @@ async function collectTreeDependencies(client, root) {
93
93
  }
94
94
  }
95
95
  catch (error) {
96
- (0, logVerbose_1.logVerbose)(2, ` Error getting dependencies for ${objectName}: ${error.message}`);
96
+ (0, logVerbose_1.logVerbose)(2, `Warning: failed to collect dependencies for ${node.adtType}:${node.name}: ${error instanceof Error ? error.message : String(error)}`);
97
97
  }
98
98
  }
99
99
  }
@@ -1 +1 @@
1
- {"version":3,"file":"deleteBackupObjects.d.ts","sourceRoot":"","sources":["../../../src/lib/restore/deleteBackupObjects.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/C,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,cAAc,EACtB,gBAAgB,CAAC,EAAE,MAAM,GACxB,OAAO,CAAC,IAAI,CAAC,CAsBf"}
1
+ {"version":3,"file":"deleteBackupObjects.d.ts","sourceRoot":"","sources":["../../../src/lib/restore/deleteBackupObjects.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/C,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,cAAc,EACtB,gBAAgB,CAAC,EAAE,MAAM,GACxB,OAAO,CAAC,IAAI,CAAC,CAwBf"}
@@ -8,12 +8,10 @@ async function deleteBackupObjects(client, backup, transportRequest) {
8
8
  return;
9
9
  }
10
10
  const checkResponse = await client.getUtils().checkDeletionGroup(targets);
11
- const messages = checkResponse.data?.messages || [];
11
+ const messages = (checkResponse.data?.messages || []);
12
12
  const errors = messages.filter((m) => m.severity === 'error' || m.severity === 'E');
13
13
  if (errors.length > 0) {
14
- const errorList = errors
15
- .map((e) => `${e.objName}: ${e.text}`)
16
- .join('\n');
14
+ const errorList = errors.map((e) => `${e.objName}: ${e.text}`).join('\n');
17
15
  throw new Error(`Deletion check failed before cleanup:\n${errorList}`);
18
16
  }
19
17
  await client
@@ -1 +1 @@
1
- {"version":3,"file":"restoreTreeNode.d.ts","sourceRoot":"","sources":["../../../src/lib/restore/restoreTreeNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EAkBV,MAAM,2BAA2B,CAAC;AAGnC,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAK5D,wBAAsB,eAAe,CACnC,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,OAAO,EACjB,gBAAgB,CAAC,EAAE,MAAM,EACzB,yBAAyB,CAAC,EAAE,MAAM,EAClC,kBAAkB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAC/B,OAAO,CAAC,IAAI,CAAC,CAiUf"}
1
+ {"version":3,"file":"restoreTreeNode.d.ts","sourceRoot":"","sources":["../../../src/lib/restore/restoreTreeNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EAkBV,MAAM,2BAA2B,CAAC;AAGnC,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAK5D,wBAAsB,eAAe,CACnC,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,OAAO,EACjB,gBAAgB,CAAC,EAAE,MAAM,EACzB,yBAAyB,CAAC,EAAE,MAAM,EAClC,kBAAkB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAC/B,OAAO,CAAC,IAAI,CAAC,CAqUf"}
@@ -266,10 +266,11 @@ async function restoreTreeNode(client, node, mode, activate, transportRequest, s
266
266
  }
267
267
  }
268
268
  catch (error) {
269
- if (error.response?.data) {
270
- console.error(`Error restoring ${node.type}:${node.name}:`, typeof error.response.data === 'string'
271
- ? error.response.data
272
- : JSON.stringify(error.response.data, null, 2));
269
+ const err = error;
270
+ if (err.response?.data) {
271
+ console.error(`Error restoring ${node.type}:${node.name}:`, typeof err.response.data === 'string'
272
+ ? err.response.data
273
+ : JSON.stringify(err.response.data, null, 2));
273
274
  }
274
275
  throw error;
275
276
  }
@@ -61,7 +61,7 @@ function backtrackEdits(oldLines, newLines, trace, offset) {
61
61
  }
62
62
  return edits.reverse();
63
63
  }
64
- function buildUnifiedHunks(oldLines, newLines, edits, context) {
64
+ function buildUnifiedHunks(_oldLines, _newLines, edits, context) {
65
65
  const hunks = [];
66
66
  let oldLine = 1;
67
67
  let newLine = 1;
@@ -1,5 +1,4 @@
1
1
  export * from './applyConfigName';
2
- export * from './asArray';
3
2
  export * from './asConfig';
4
3
  export * from './ensureDescription';
5
4
  export * from './formatObjectSpec';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,oCAAoC,CAAC;AACnD,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,oCAAoC,CAAC;AACnD,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
@@ -15,7 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./applyConfigName"), exports);
18
- __exportStar(require("./asArray"), exports);
19
18
  __exportStar(require("./asConfig"), exports);
20
19
  __exportStar(require("./ensureDescription"), exports);
21
20
  __exportStar(require("./formatObjectSpec"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"verifyObjectInSystem.d.ts","sourceRoot":"","sources":["../../../src/lib/verify/verifyObjectInSystem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAK3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAG3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAwB3C,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,UAAU,EAChB,eAAe,CAAC,EAAE,MAAM,EACxB,cAAc,CAAC,EAAE,MAAM,EACvB,oBAAoB,CAAC,EAAE,MAAM,EAC7B,cAAc,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,GACzC,OAAO,CAAC,WAAW,CAAC,CA+HtB"}
1
+ {"version":3,"file":"verifyObjectInSystem.d.ts","sourceRoot":"","sources":["../../../src/lib/verify/verifyObjectInSystem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAK3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAG3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAyB3C,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,UAAU,EAChB,eAAe,CAAC,EAAE,MAAM,EACxB,cAAc,CAAC,EAAE,MAAM,EACvB,oBAAoB,CAAC,EAAE,MAAM,EAC7B,cAAc,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,GACzC,OAAO,CAAC,WAAW,CAAC,CA+HtB"}
@@ -3,17 +3,11 @@ export * from './findAttribute';
3
3
  export * from './findNode';
4
4
  export * from './findNodeValue';
5
5
  export * from './findPackageName';
6
- export * from './flattenXmlAttributes';
7
6
  export * from './getAttribute';
8
7
  export * from './getNodeAttribute';
9
- export * from './getNodeDescription';
10
- export * from './getNodeName';
11
- export * from './getNodeType';
12
- export * from './isNodeObject';
13
8
  export * from './parseDataElementConfig';
14
9
  export * from './parseDomainConfig';
15
10
  export * from './parsePackageConfig';
16
- export * from './readAttr';
17
11
  export * from './toBoolean';
18
12
  export * from './toNumber';
19
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/xml/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/xml/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
@@ -19,16 +19,10 @@ __exportStar(require("./findAttribute"), exports);
19
19
  __exportStar(require("./findNode"), exports);
20
20
  __exportStar(require("./findNodeValue"), exports);
21
21
  __exportStar(require("./findPackageName"), exports);
22
- __exportStar(require("./flattenXmlAttributes"), exports);
23
22
  __exportStar(require("./getAttribute"), exports);
24
23
  __exportStar(require("./getNodeAttribute"), exports);
25
- __exportStar(require("./getNodeDescription"), exports);
26
- __exportStar(require("./getNodeName"), exports);
27
- __exportStar(require("./getNodeType"), exports);
28
- __exportStar(require("./isNodeObject"), exports);
29
24
  __exportStar(require("./parseDataElementConfig"), exports);
30
25
  __exportStar(require("./parseDomainConfig"), exports);
31
26
  __exportStar(require("./parsePackageConfig"), exports);
32
- __exportStar(require("./readAttr"), exports);
33
27
  __exportStar(require("./toBoolean"), exports);
34
28
  __exportStar(require("./toNumber"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-abap-adt/adt-backup",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "ADT backup CLI for SAP ABAP objects (recursive package backups and restores)",
5
5
  "main": "dist/bin/adt-backup.js",
6
6
  "types": "dist/bin/adt-backup.d.ts",
@@ -1,2 +0,0 @@
1
- export declare function asArray<T>(value?: T | T[]): T[];
2
- //# sourceMappingURL=asArray.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"asArray.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/asArray.ts"],"names":[],"mappings":"AAAA,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,CAK/C"}
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.asArray = asArray;
4
- function asArray(value) {
5
- if (value === undefined) {
6
- return [];
7
- }
8
- return Array.isArray(value) ? value : [value];
9
- }
@@ -1,17 +0,0 @@
1
- export type AttributeDiff = {
2
- added: Array<{
3
- key: string;
4
- value: string;
5
- }>;
6
- removed: Array<{
7
- key: string;
8
- value: string;
9
- }>;
10
- changed: Array<{
11
- key: string;
12
- before: string;
13
- after: string;
14
- }>;
15
- };
16
- export declare function diffAttributes(beforeMap: Map<string, string>, afterMap: Map<string, string>): AttributeDiff;
17
- //# sourceMappingURL=diffAttributes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"diffAttributes.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/diffAttributes.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC7C,OAAO,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,OAAO,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAChE,CAAC;AAEF,wBAAgB,cAAc,CAC5B,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAC5B,aAAa,CA2Bf"}
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.diffAttributes = diffAttributes;
4
- function diffAttributes(beforeMap, afterMap) {
5
- const added = [];
6
- const removed = [];
7
- const changed = [];
8
- for (const [key, value] of beforeMap.entries()) {
9
- if (!afterMap.has(key)) {
10
- removed.push({ key, value });
11
- continue;
12
- }
13
- const nextValue = afterMap.get(key);
14
- if (nextValue !== value && nextValue !== undefined) {
15
- changed.push({ key, before: value, after: nextValue });
16
- }
17
- }
18
- for (const [key, value] of afterMap.entries()) {
19
- if (!beforeMap.has(key)) {
20
- added.push({ key, value });
21
- }
22
- }
23
- added.sort((a, b) => a.key.localeCompare(b.key));
24
- removed.sort((a, b) => a.key.localeCompare(b.key));
25
- changed.sort((a, b) => a.key.localeCompare(b.key));
26
- return { added, removed, changed };
27
- }
@@ -1,2 +0,0 @@
1
- export declare function flattenXmlAttributes(xml: string): Map<string, string>;
2
- //# sourceMappingURL=flattenXmlAttributes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"flattenXmlAttributes.d.ts","sourceRoot":"","sources":["../../../src/lib/xml/flattenXmlAttributes.ts"],"names":[],"mappings":"AAoFA,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAKrE"}
@@ -1,82 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.flattenXmlAttributes = flattenXmlAttributes;
4
- const xmlParser_1 = require("../constants/xmlParser");
5
- const ARRAY_KEY_ATTRS = ['rel', 'name', 'id', 'type', 'href', 'title'];
6
- function getAttrValue(record, attr) {
7
- const value = record[`@_${attr}`];
8
- return typeof value === 'string' && value.trim() ? value : undefined;
9
- }
10
- function buildArrayItemKey(item) {
11
- const parts = [];
12
- for (const attr of ARRAY_KEY_ATTRS) {
13
- const value = getAttrValue(item, attr);
14
- if (value) {
15
- parts.push(`${attr}=${value}`);
16
- }
17
- }
18
- if (parts.length === 0) {
19
- return undefined;
20
- }
21
- return parts.join('|');
22
- }
23
- function normalizeKey(key) {
24
- return key.replace(/[[\]\s]/g, '_');
25
- }
26
- function visit(value, path, out) {
27
- if (Array.isArray(value)) {
28
- const entries = value.map((item) => {
29
- const record = item && typeof item === 'object' && !Array.isArray(item)
30
- ? item
31
- : undefined;
32
- const key = record ? buildArrayItemKey(record) : undefined;
33
- return { item, key };
34
- });
35
- const counts = new Map();
36
- entries.sort((a, b) => {
37
- if (!a.key && !b.key) {
38
- return 0;
39
- }
40
- if (!a.key) {
41
- return 1;
42
- }
43
- if (!b.key) {
44
- return -1;
45
- }
46
- return a.key.localeCompare(b.key);
47
- });
48
- entries.forEach(({ item, key }, index) => {
49
- if (!key) {
50
- visit(item, `${path}[${index}]`, out);
51
- return;
52
- }
53
- const normalized = normalizeKey(key);
54
- const nextCount = (counts.get(normalized) || 0) + 1;
55
- counts.set(normalized, nextCount);
56
- const suffix = nextCount > 1 ? `#${nextCount}` : '';
57
- visit(item, `${path}[${normalized}${suffix}]`, out);
58
- });
59
- return;
60
- }
61
- if (!value || typeof value !== 'object') {
62
- return;
63
- }
64
- const record = value;
65
- for (const [key, child] of Object.entries(record)) {
66
- if (key.startsWith('@_')) {
67
- const attrName = key.slice(2);
68
- const attrValue = typeof child === 'string' ? child : JSON.stringify(child);
69
- const attrPath = path ? `${path}@${attrName}` : `@${attrName}`;
70
- out.set(attrPath, attrValue);
71
- continue;
72
- }
73
- const nextPath = path ? `${path}.${key}` : key;
74
- visit(child, nextPath, out);
75
- }
76
- }
77
- function flattenXmlAttributes(xml) {
78
- const parsed = xmlParser_1.xmlParser.parse(xml);
79
- const out = new Map();
80
- visit(parsed, '', out);
81
- return out;
82
- }
@@ -1,3 +0,0 @@
1
- import type { NodeRecord } from '../types';
2
- export declare function getNodeDescription(node: NodeRecord): string | undefined;
3
- //# sourceMappingURL=getNodeDescription.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getNodeDescription.d.ts","sourceRoot":"","sources":["../../../src/lib/xml/getNodeDescription.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAG3C,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAOvE"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getNodeDescription = getNodeDescription;
4
- const getAttribute_1 = require("./getAttribute");
5
- function getNodeDescription(node) {
6
- return (0, getAttribute_1.getAttribute)(node, [
7
- '@_adtcore:description',
8
- '@_description',
9
- 'adtcore:description',
10
- 'description',
11
- ]);
12
- }
@@ -1,3 +0,0 @@
1
- import type { NodeRecord } from '../types';
2
- export declare function getNodeName(node: NodeRecord): string | undefined;
3
- //# sourceMappingURL=getNodeName.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getNodeName.d.ts","sourceRoot":"","sources":["../../../src/lib/xml/getNodeName.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAG3C,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAOhE"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getNodeName = getNodeName;
4
- const getAttribute_1 = require("./getAttribute");
5
- function getNodeName(node) {
6
- return (0, getAttribute_1.getAttribute)(node, [
7
- '@_adtcore:name',
8
- '@_name',
9
- 'adtcore:name',
10
- 'name',
11
- ]);
12
- }
@@ -1,3 +0,0 @@
1
- import type { NodeRecord } from '../types';
2
- export declare function getNodeType(node: NodeRecord): string | undefined;
3
- //# sourceMappingURL=getNodeType.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getNodeType.d.ts","sourceRoot":"","sources":["../../../src/lib/xml/getNodeType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAG3C,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAOhE"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getNodeType = getNodeType;
4
- const getAttribute_1 = require("./getAttribute");
5
- function getNodeType(node) {
6
- return (0, getAttribute_1.getAttribute)(node, [
7
- '@_adtcore:type',
8
- '@_type',
9
- 'adtcore:type',
10
- 'type',
11
- ]);
12
- }
@@ -1,3 +0,0 @@
1
- import type { NodeRecord, NodeValue } from '../types';
2
- export declare function isNodeObject(node: NodeValue): node is NodeRecord;
3
- //# sourceMappingURL=isNodeObject.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isNodeObject.d.ts","sourceRoot":"","sources":["../../../src/lib/xml/isNodeObject.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAEtD,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,IAAI,UAAU,CAQhE"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isNodeObject = isNodeObject;
4
- function isNodeObject(node) {
5
- if (!node || typeof node !== 'object') {
6
- return false;
7
- }
8
- if (Array.isArray(node)) {
9
- return false;
10
- }
11
- return true;
12
- }
@@ -1,3 +0,0 @@
1
- import type { NodeRecord } from '../types';
2
- export declare function readAttr(node: NodeRecord, name: string): string | undefined;
3
- //# sourceMappingURL=readAttr.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"readAttr.d.ts","sourceRoot":"","sources":["../../../src/lib/xml/readAttr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,wBAAgB,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAY3E"}
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.readAttr = readAttr;
4
- function readAttr(node, name) {
5
- const value = node[`@_${name}`];
6
- if (value === undefined || value === null) {
7
- return undefined;
8
- }
9
- if (typeof value === 'string') {
10
- return value;
11
- }
12
- if (typeof value === 'number' || typeof value === 'boolean') {
13
- return String(value);
14
- }
15
- return undefined;
16
- }