@mcp-abap-adt/adt-backup 0.1.2 → 1.0.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.
Files changed (66) hide show
  1. package/README.md +4 -2
  2. package/dist/bin/adt-backup.js +0 -0
  3. package/dist/lib/auth/createTokenProvider.d.ts +1 -1
  4. package/dist/lib/auth/createTokenProvider.d.ts.map +1 -1
  5. package/dist/lib/auth/createTokenProvider.js +2 -1
  6. package/dist/lib/auth/getSapConfigFromBroker.d.ts +1 -0
  7. package/dist/lib/auth/getSapConfigFromBroker.d.ts.map +1 -1
  8. package/dist/lib/auth/getSapConfigFromBroker.js +94 -95
  9. package/dist/lib/backup/backupObject.js +5 -5
  10. package/dist/lib/backup/readMetadataXmlForType.d.ts +1 -1
  11. package/dist/lib/backup/readMetadataXmlForType.d.ts.map +1 -1
  12. package/dist/lib/backup/readMetadataXmlForType.js +113 -98
  13. package/dist/lib/backup/readSourceText.d.ts +1 -1
  14. package/dist/lib/backup/readSourceText.d.ts.map +1 -1
  15. package/dist/lib/backup/readSourceText.js +96 -93
  16. package/dist/lib/cli/createLogger.d.ts.map +1 -1
  17. package/dist/lib/cli/createLogger.js +18 -0
  18. package/dist/lib/cli/parseArgs.d.ts +1 -1
  19. package/dist/lib/cli/parseArgs.d.ts.map +1 -1
  20. package/dist/lib/cli/parseArgs.js +25 -10
  21. package/dist/lib/cli/usage.d.ts.map +1 -1
  22. package/dist/lib/cli/usage.js +92 -88
  23. package/dist/lib/restore/analyzeDependencies.d.ts +13 -0
  24. package/dist/lib/restore/analyzeDependencies.d.ts.map +1 -0
  25. package/dist/lib/restore/analyzeDependencies.js +187 -0
  26. package/dist/lib/restore/restoreObjects.d.ts.map +1 -1
  27. package/dist/lib/restore/restoreObjects.js +49 -10
  28. package/dist/lib/restore/restoreTreeBackup.d.ts +1 -1
  29. package/dist/lib/restore/restoreTreeBackup.d.ts.map +1 -1
  30. package/dist/lib/restore/restoreTreeBackup.js +192 -42
  31. package/dist/lib/restore/restoreTreeNode.d.ts +1 -1
  32. package/dist/lib/restore/restoreTreeNode.d.ts.map +1 -1
  33. package/dist/lib/restore/restoreTreeNode.js +116 -37
  34. package/dist/lib/run.d.ts.map +1 -1
  35. package/dist/lib/run.js +393 -559
  36. package/dist/lib/tree/buildConfigForNode.d.ts.map +1 -1
  37. package/dist/lib/tree/buildConfigForNode.js +11 -0
  38. package/dist/lib/tree/buildPackageBackupTree.d.ts.map +1 -1
  39. package/dist/lib/tree/buildPackageBackupTree.js +9 -3
  40. package/dist/lib/tree/enrichTreeNode.d.ts.map +1 -1
  41. package/dist/lib/tree/enrichTreeNode.js +17 -1
  42. package/dist/lib/tree/isRestoreImplemented.d.ts.map +1 -1
  43. package/dist/lib/tree/isRestoreImplemented.js +1 -0
  44. package/dist/lib/tree/mapAdtTypeToSupported.d.ts.map +1 -1
  45. package/dist/lib/tree/mapAdtTypeToSupported.js +3 -0
  46. package/dist/lib/tree/readPayloadForType.d.ts.map +1 -1
  47. package/dist/lib/tree/readPayloadForType.js +3 -2
  48. package/dist/lib/types.d.ts +22 -2
  49. package/dist/lib/types.d.ts.map +1 -1
  50. package/dist/lib/utils/applyConfigName.d.ts.map +1 -1
  51. package/dist/lib/utils/applyConfigName.js +3 -0
  52. package/dist/lib/utils/parseBdefSource.d.ts +9 -0
  53. package/dist/lib/utils/parseBdefSource.d.ts.map +1 -0
  54. package/dist/lib/utils/parseBdefSource.js +18 -0
  55. package/dist/lib/verify/formatVerifyResultsText.d.ts +1 -1
  56. package/dist/lib/verify/formatVerifyResultsText.d.ts.map +1 -1
  57. package/dist/lib/verify/formatVerifyResultsText.js +76 -14
  58. package/dist/lib/verify/types.d.ts +3 -0
  59. package/dist/lib/verify/types.d.ts.map +1 -1
  60. package/dist/lib/verify/verifyBackup.d.ts +4 -2
  61. package/dist/lib/verify/verifyBackup.d.ts.map +1 -1
  62. package/dist/lib/verify/verifyBackup.js +67 -32
  63. package/dist/lib/verify/verifyObjectInSystem.d.ts +1 -1
  64. package/dist/lib/verify/verifyObjectInSystem.d.ts.map +1 -1
  65. package/dist/lib/verify/verifyObjectInSystem.js +39 -105
  66. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"buildConfigForNode.d.ts","sourceRoot":"","sources":["../../../src/lib/tree/buildConfigForNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAa5D,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,aAAa,EACnB,IAAI,EAAE,MAAM,EACZ,iBAAiB,EAAE,MAAM,GAAG,SAAS,EACrC,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CAqJnC"}
1
+ {"version":3,"file":"buildConfigForNode.d.ts","sourceRoot":"","sources":["../../../src/lib/tree/buildConfigForNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAa5D,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,aAAa,EACnB,IAAI,EAAE,MAAM,EACZ,iBAAiB,EAAE,MAAM,GAAG,SAAS,EACrC,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CAgKnC"}
@@ -75,6 +75,17 @@ async function buildConfigForNode(type, name, functionGroupName, metadataXml) {
75
75
  description,
76
76
  });
77
77
  }
78
+ case 'accessControl': {
79
+ if (!metadataXml) {
80
+ return undefined;
81
+ }
82
+ const { description, packageName } = (0, extractMetadata_1.extractMetadata)(metadataXml);
83
+ return (0, applyConfigName_1.applyConfigName)(type, name, functionGroupName, {
84
+ accessControlName: name,
85
+ packageName,
86
+ description,
87
+ });
88
+ }
78
89
  case 'serviceBinding': {
79
90
  if (!metadataXml) {
80
91
  return undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"buildPackageBackupTree.d.ts","sourceRoot":"","sources":["../../../src/lib/tree/buildPackageBackupTree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAG3D,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,UAAU,CAAC;AAG/D,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,SAAS,EACjB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,cAAc,CAAC,CAwBzB"}
1
+ {"version":3,"file":"buildPackageBackupTree.d.ts","sourceRoot":"","sources":["../../../src/lib/tree/buildPackageBackupTree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAG3D,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,UAAU,CAAC;AAI/D,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,SAAS,EACjB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,cAAc,CAAC,CAiCzB"}
@@ -4,9 +4,10 @@ exports.buildPackageBackupTree = buildPackageBackupTree;
4
4
  const logVerbose_1 = require("../cli/logVerbose");
5
5
  const collectTreeDependencies_1 = require("../dependencies/collectTreeDependencies");
6
6
  const enrichTreeNode_1 = require("./enrichTreeNode");
7
+ const flattenTree_1 = require("./flattenTree");
7
8
  async function buildPackageBackupTree(client, packageName) {
8
9
  const packageNameUpper = packageName.toUpperCase();
9
- (0, logVerbose_1.logVerbose)(2, `Fetching package hierarchy for ${packageNameUpper}`);
10
+ (0, logVerbose_1.logVerbose)(1, `Fetching package hierarchy for ${packageNameUpper}`);
10
11
  const hierarchy = await client
11
12
  .getUtils()
12
13
  .getPackageHierarchy(packageNameUpper);
@@ -14,9 +15,14 @@ async function buildPackageBackupTree(client, packageName) {
14
15
  ...hierarchy,
15
16
  restoreStatus: 'not-implemented',
16
17
  };
17
- (0, logVerbose_1.logVerbose)(2, `Building node tree for ${packageNameUpper}`);
18
+ (0, logVerbose_1.logVerbose)(1, `Enriching objects for ${packageNameUpper}`);
18
19
  const enrichedRoot = await (0, enrichTreeNode_1.enrichTreeNode)(rootTree, client, true);
19
- (0, logVerbose_1.logVerbose)(2, `Collecting where-used dependencies for ${packageNameUpper}`);
20
+ const allNodes = (0, flattenTree_1.flattenTree)(enrichedRoot);
21
+ const backed = allNodes.filter((n) => n.type && n.codeBase64);
22
+ const skipped = allNodes.filter((n) => !n.type && n.adtType);
23
+ const noPayload = allNodes.filter((n) => n.type && !n.codeBase64);
24
+ (0, logVerbose_1.logVerbose)(1, `Summary: ${backed.length} backed up, ${skipped.length} unsupported, ${noPayload.length} without payload`);
25
+ (0, logVerbose_1.logVerbose)(1, `Collecting dependencies for ${packageNameUpper}`);
20
26
  await (0, collectTreeDependencies_1.collectTreeDependencies)(client, enrichedRoot);
21
27
  return {
22
28
  schemaVersion: 2,
@@ -1 +1 @@
1
- {"version":3,"file":"enrichTreeNode.d.ts","sourceRoot":"","sources":["../../../src/lib/tree/enrichTreeNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAI3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAS/C,wBAAsB,cAAc,CAClC,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,SAAS,EACjB,WAAW,EAAE,OAAO,EACpB,uBAAuB,CAAC,EAAE,MAAM,GAC/B,OAAO,CAAC,cAAc,CAAC,CAiFzB"}
1
+ {"version":3,"file":"enrichTreeNode.d.ts","sourceRoot":"","sources":["../../../src/lib/tree/enrichTreeNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAI3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAU/C,wBAAsB,cAAc,CAClC,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,SAAS,EACjB,WAAW,EAAE,OAAO,EACpB,uBAAuB,CAAC,EAAE,MAAM,GAC/B,OAAO,CAAC,cAAc,CAAC,CAkGzB"}
@@ -5,6 +5,7 @@ const readMetadataXmlForType_1 = require("../backup/readMetadataXmlForType");
5
5
  const logVerbose_1 = require("../cli/logVerbose");
6
6
  const encodeBase64_1 = require("../crypto/encodeBase64");
7
7
  const ensureDescription_1 = require("../utils/ensureDescription");
8
+ const parseBdefSource_1 = require("../utils/parseBdefSource");
8
9
  const parseBehaviorDefinitionFromClass_1 = require("../utils/parseBehaviorDefinitionFromClass");
9
10
  const extractMetadata_1 = require("../xml/extractMetadata");
10
11
  const buildConfigForNode_1 = require("./buildConfigForNode");
@@ -30,6 +31,12 @@ async function enrichTreeNode(node, client, includeCode, parentFunctionGroupName
30
31
  : 'not-implemented';
31
32
  }
32
33
  (0, logVerbose_1.logVerbose)(3, `Node: ${node.name} [${node.adtType || 'unknown'}] -> ${mappedType || 'unknown'} (${nextNode.restoreStatus})`);
34
+ if (!mappedType && node.adtType) {
35
+ (0, logVerbose_1.logVerbose)(1, ` [SKIP] ${node.name} — unsupported type ${node.adtType}`);
36
+ }
37
+ if (mappedType && includeCode) {
38
+ (0, logVerbose_1.logVerbose)(2, ` Reading ${mappedType}:${node.name}`);
39
+ }
33
40
  const metadataXml = mappedType && includeCode
34
41
  ? await (0, readMetadataXmlForType_1.readMetadataXmlForType)(client, mappedType, node.name)
35
42
  : undefined;
@@ -37,7 +44,7 @@ async function enrichTreeNode(node, client, includeCode, parentFunctionGroupName
37
44
  nextNode.description = (0, extractMetadata_1.extractMetadata)(metadataXml).description;
38
45
  }
39
46
  if (mappedType && includeCode) {
40
- const config = await (0, buildConfigForNode_1.buildConfigForNode)(mappedType, node.name, functionGroupName, metadataXml);
47
+ const config = await (0, buildConfigForNode_1.buildConfigForNode)(mappedType, node.name, functionGroupName, metadataXml ?? undefined);
41
48
  if (config) {
42
49
  nextNode.config = (0, ensureDescription_1.ensureDescription)(config, node.name);
43
50
  }
@@ -47,6 +54,15 @@ async function enrichTreeNode(node, client, includeCode, parentFunctionGroupName
47
54
  if (payload.payload) {
48
55
  nextNode.codeBase64 = (0, encodeBase64_1.encodeBase64)(payload.payload);
49
56
  nextNode.codeFormat = payload.format;
57
+ if (mappedType === 'behaviorDefinition') {
58
+ const bdefInfo = (0, parseBdefSource_1.parseBdefSource)(payload.payload);
59
+ if (bdefInfo.rootEntity || bdefInfo.implementationType) {
60
+ nextNode.config = {
61
+ ...(nextNode.config || {}),
62
+ ...bdefInfo,
63
+ };
64
+ }
65
+ }
50
66
  if (mappedType === 'behaviorImplementation') {
51
67
  const behaviorDefinition = (0, parseBehaviorDefinitionFromClass_1.parseBehaviorDefinitionFromClass)(payload.payload);
52
68
  if (behaviorDefinition) {
@@ -1 +1 @@
1
- {"version":3,"file":"isRestoreImplemented.d.ts","sourceRoot":"","sources":["../../../src/lib/tree/isRestoreImplemented.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,wBAAgB,oBAAoB,CAAC,IAAI,CAAC,EAAE,aAAa,GAAG,OAAO,CAwBlE"}
1
+ {"version":3,"file":"isRestoreImplemented.d.ts","sourceRoot":"","sources":["../../../src/lib/tree/isRestoreImplemented.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,wBAAgB,oBAAoB,CAAC,IAAI,CAAC,EAAE,aAAa,GAAG,OAAO,CAyBlE"}
@@ -21,6 +21,7 @@ function isRestoreImplemented(type) {
21
21
  case 'behaviorDefinition':
22
22
  case 'behaviorImplementation':
23
23
  case 'enhancement':
24
+ case 'accessControl':
24
25
  return true;
25
26
  default:
26
27
  return false;
@@ -1 +1 @@
1
- {"version":3,"file":"mapAdtTypeToSupported.d.ts","sourceRoot":"","sources":["../../../src/lib/tree/mapAdtTypeToSupported.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,wBAAgB,qBAAqB,CACnC,OAAO,CAAC,EAAE,MAAM,GACf,aAAa,GAAG,SAAS,CA8D3B"}
1
+ {"version":3,"file":"mapAdtTypeToSupported.d.ts","sourceRoot":"","sources":["../../../src/lib/tree/mapAdtTypeToSupported.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,wBAAgB,qBAAqB,CACnC,OAAO,CAAC,EAAE,MAAM,GACf,aAAa,GAAG,SAAS,CAgE3B"}
@@ -33,6 +33,7 @@ function mapAdtTypeToSupported(adtType) {
33
33
  'BIMP/BI': 'behaviorImplementation',
34
34
  'BIMP/BO': 'behaviorImplementation',
35
35
  'ENHO/ENH': 'enhancement',
36
+ 'DCLS/DL': 'accessControl',
36
37
  };
37
38
  if (map[normalized]) {
38
39
  return map[normalized];
@@ -74,5 +75,7 @@ function mapAdtTypeToSupported(adtType) {
74
75
  return 'behaviorImplementation';
75
76
  if (normalized.startsWith('ENHO/'))
76
77
  return 'enhancement';
78
+ if (normalized.startsWith('DCLS/'))
79
+ return 'accessControl';
77
80
  return undefined;
78
81
  }
@@ -1 +1 @@
1
- {"version":3,"file":"readPayloadForType.d.ts","sourceRoot":"","sources":["../../../src/lib/tree/readPayloadForType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAG3D,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9D,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,aAAa,EACnB,IAAI,EAAE,MAAM,EACZ,iBAAiB,CAAC,EAAE,MAAM,GACzB,OAAO,CAAC;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,cAAc,CAAC,YAAY,CAAC,CAAA;CAAE,CAAC,CAsCtE"}
1
+ {"version":3,"file":"readPayloadForType.d.ts","sourceRoot":"","sources":["../../../src/lib/tree/readPayloadForType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAG3D,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9D,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,aAAa,EACnB,IAAI,EAAE,MAAM,EACZ,iBAAiB,CAAC,EAAE,MAAM,GACzB,OAAO,CAAC;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,cAAc,CAAC,YAAY,CAAC,CAAA;CAAE,CAAC,CAuCtE"}
@@ -17,13 +17,14 @@ async function readPayloadForType(client, type, name, functionGroupName) {
17
17
  case 'behaviorDefinition':
18
18
  case 'behaviorImplementation':
19
19
  case 'enhancement':
20
+ case 'accessControl':
20
21
  case 'tableType': {
21
22
  const payload = await (0, readSourceText_1.readSourceText)(client, {
22
23
  type,
23
24
  name,
24
25
  functionGroupName,
25
26
  });
26
- return { payload, format: 'source' };
27
+ return { payload: payload ?? undefined, format: 'source' };
27
28
  }
28
29
  case 'domain':
29
30
  case 'dataElement':
@@ -31,7 +32,7 @@ async function readPayloadForType(client, type, name, functionGroupName) {
31
32
  case 'functionGroup':
32
33
  case 'serviceBinding': {
33
34
  const xml = await (0, readMetadataXmlForType_1.readMetadataXmlForType)(client, type, name, functionGroupName);
34
- return { payload: xml, format: 'xml' };
35
+ return { payload: xml ?? undefined, format: 'xml' };
35
36
  }
36
37
  default:
37
38
  return {};
@@ -1,5 +1,5 @@
1
- export type SupportedType = 'package' | 'domain' | 'dataElement' | 'structure' | 'table' | 'tableType' | 'view' | 'class' | 'interface' | 'program' | 'functionGroup' | 'functionModule' | 'serviceDefinition' | 'serviceBinding' | 'metadataExtension' | 'behaviorDefinition' | 'behaviorImplementation' | 'enhancement' | 'unitTest' | 'cdsUnitTest';
2
- export type RestoreMode = 'create' | 'update' | 'upsert';
1
+ export type SupportedType = 'package' | 'domain' | 'dataElement' | 'structure' | 'table' | 'tableType' | 'view' | 'class' | 'interface' | 'program' | 'functionGroup' | 'functionModule' | 'serviceDefinition' | 'serviceBinding' | 'metadataExtension' | 'behaviorDefinition' | 'behaviorImplementation' | 'enhancement' | 'accessControl' | 'unitTest' | 'cdsUnitTest';
2
+ export type RestoreMode = 'create' | 'update' | 'upsert' | 'skip';
3
3
  export type BackupConfig = Record<string, unknown>;
4
4
  export interface ObjectSpec {
5
5
  type: SupportedType;
@@ -42,6 +42,26 @@ export interface BackupTreeFile {
42
42
  root: BackupTreeNode;
43
43
  checksum?: string;
44
44
  }
45
+ export interface RestorePlanAction {
46
+ id: string;
47
+ type: SupportedType;
48
+ name: string;
49
+ functionGroupName?: string;
50
+ action: 'create' | 'update' | 'skip';
51
+ adtType?: string;
52
+ }
53
+ export interface RestorePlanGroup {
54
+ id: number;
55
+ isCircular: boolean;
56
+ actions: RestorePlanAction[];
57
+ }
58
+ export interface RestorePlan {
59
+ schemaVersion: 1;
60
+ generatedAt: string;
61
+ backupFile: string;
62
+ targetPackage: string;
63
+ groups: RestorePlanGroup[];
64
+ }
45
65
  export type NodeValue = Record<string, unknown> | unknown[] | string | number | null;
46
66
  export type NodeRecord = Record<string, NodeValue>;
47
67
  export interface VirtualFolderEntry {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GACrB,SAAS,GACT,QAAQ,GACR,aAAa,GACb,WAAW,GACX,OAAO,GACP,WAAW,GACX,MAAM,GACN,OAAO,GACP,WAAW,GACX,SAAS,GACT,eAAe,GACf,gBAAgB,GAChB,mBAAmB,GACnB,gBAAgB,GAChB,mBAAmB,GACnB,oBAAoB,GACpB,wBAAwB,GACxB,aAAa,GACb,UAAU,GACV,aAAa,CAAC;AAElB,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEzD,MAAM,MAAM,YAA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Y,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE5D,wBAAgB,eAAe,CAC7B,IAAI,EAAE,aAAa,EACnB,IAAI,EAAE,MAAM,EACZ,iBAAiB,CAAC,EAAE,MAAM,EAC1B,MAAM,CAAC,EAAE,YAAY,GACpB,YAAY,CAkEd"}
1
+ {"version":3,"file":"applyConfigName.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/applyConfigName.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE5D,wBAAgB,eAAe,CAC7B,IAAI,EAAE,aAAa,EACnB,IAAI,EAAE,MAAM,EACZ,iBAAiB,CAAC,EAAE,MAAM,EAC1B,MAAM,CAAC,EAAE,YAAY,GACpB,YAAY,CAqEd"}
@@ -59,6 +59,9 @@ function applyConfigName(type, name, functionGroupName, config) {
59
59
  case 'enhancement':
60
60
  finalConfig.enhancementName = name;
61
61
  break;
62
+ case 'accessControl':
63
+ finalConfig.accessControlName = name;
64
+ break;
62
65
  case 'unitTest':
63
66
  finalConfig.className = name;
64
67
  break;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Extracts rootEntity and implementationType from BDEF source code.
3
+ * Used both during backup (to enrich config) and restore (fallback for old backups).
4
+ */
5
+ export declare function parseBdefSource(source: string): {
6
+ rootEntity?: string;
7
+ implementationType?: 'Managed' | 'Unmanaged' | 'Abstract' | 'Projection';
8
+ };
9
+ //# sourceMappingURL=parseBdefSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseBdefSource.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/parseBdefSource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,YAAY,CAAC;CAC1E,CAeA"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseBdefSource = parseBdefSource;
4
+ /**
5
+ * Extracts rootEntity and implementationType from BDEF source code.
6
+ * Used both during backup (to enrich config) and restore (fallback for old backups).
7
+ */
8
+ function parseBdefSource(source) {
9
+ const entityMatch = source.match(/define\s+behavior\s+for\s+([A-Z0-9_/]+)/i);
10
+ const typeMatch = source.match(/^(managed|unmanaged|abstract|projection)\b/i);
11
+ return {
12
+ rootEntity: entityMatch?.[1] || undefined,
13
+ implementationType: typeMatch
14
+ ? (typeMatch[1].charAt(0).toUpperCase() +
15
+ typeMatch[1].slice(1).toLowerCase())
16
+ : undefined,
17
+ };
18
+ }
@@ -1,3 +1,3 @@
1
1
  import type { VerifyEntry, VerifySummary } from './types';
2
- export declare function formatVerifyResultsText(entries: VerifyEntry[], summary: VerifySummary): string;
2
+ export declare function formatVerifyResultsText(entries: VerifyEntry[], summary: VerifySummary, mode?: 'pre-restore' | 'post-restore', verbosity?: number, skipIds?: Set<string>): string;
3
3
  //# sourceMappingURL=formatVerifyResultsText.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"formatVerifyResultsText.d.ts","sourceRoot":"","sources":["../../../src/lib/verify/formatVerifyResultsText.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE1D,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,WAAW,EAAE,EACtB,OAAO,EAAE,aAAa,GACrB,MAAM,CA+BR"}
1
+ {"version":3,"file":"formatVerifyResultsText.d.ts","sourceRoot":"","sources":["../../../src/lib/verify/formatVerifyResultsText.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE1D,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,WAAW,EAAE,EACtB,OAAO,EAAE,aAAa,EACtB,IAAI,GAAE,aAAa,GAAG,cAA8B,EACpD,SAAS,SAAI,EACb,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GACpB,MAAM,CA6FR"}
@@ -2,29 +2,91 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.formatVerifyResultsText = formatVerifyResultsText;
4
4
  const formatObjectSpec_1 = require("../utils/formatObjectSpec");
5
- function formatVerifyResultsText(entries, summary) {
5
+ function formatVerifyResultsText(entries, summary, mode = 'pre-restore', verbosity = 1, skipIds) {
6
6
  const lines = [];
7
- lines.push(`Total: ${summary.total}, ok: ${summary.ok}, missing: ${summary.missing}, ` +
8
- `type-mismatch: ${summary.typeMismatch}, package-mismatch: ${summary.packageMismatch}, ` +
9
- `source-mismatch: ${summary.sourceMismatch}, unsupported: ${summary.unsupported}, ` +
10
- `error: ${summary.error}`);
7
+ // 1. Process objects list
11
8
  for (const entry of entries) {
12
- if (entry.status === 'ok') {
13
- continue;
14
- }
15
9
  const spec = (0, formatObjectSpec_1.formatObjectSpec)({
16
10
  type: entry.type,
17
11
  name: entry.name,
18
12
  functionGroupName: entry.functionGroupName,
19
13
  });
20
- const parts = [`${entry.status} ${spec}`];
21
- if (entry.expectedPackage || entry.actualPackage) {
22
- parts.push(`package=${entry.expectedPackage ?? '-'} -> ${entry.actualPackage ?? '-'}`);
14
+ const isMissing = entry.status === 'missing';
15
+ const objectId = `${entry.type}:${entry.name}`;
16
+ const isSkipped = skipIds?.has(objectId) ?? false;
17
+ const isActuallyOk = mode === 'pre-restore'
18
+ ? !isSkipped && (isMissing || entry.status === 'ok')
19
+ : entry.status === 'ok';
20
+ // logic:
21
+ // verbosity 0: show nothing
22
+ // verbosity 1: show only failures + skipped
23
+ // verbosity 2+: show everything
24
+ if (verbosity === 1 && isActuallyOk) {
25
+ continue;
23
26
  }
24
- if (entry.message) {
25
- parts.push(entry.message);
27
+ if (verbosity >= 2 || !isActuallyOk) {
28
+ let label = '';
29
+ let detail = '';
30
+ if (mode === 'pre-restore') {
31
+ if (isMissing) {
32
+ label = 'CREATE';
33
+ detail = 'New object (not in system)';
34
+ }
35
+ else if (isSkipped) {
36
+ label = 'SKIP ';
37
+ detail = `Existing object skipped (in package ${entry.actualPackage || 'unknown'})`;
38
+ }
39
+ else if (entry.status === 'ok' ||
40
+ entry.status === 'package-mismatch' ||
41
+ entry.status === 'source-mismatch') {
42
+ label = 'UPDATE';
43
+ detail = `Existing object in package ${entry.actualPackage || 'unknown'}`;
44
+ }
45
+ else {
46
+ label = 'ERROR ';
47
+ detail = entry.message || entry.status;
48
+ }
49
+ }
50
+ else {
51
+ // post-restore
52
+ if (entry.status === 'ok') {
53
+ label = 'OK ';
54
+ detail = `successfully restored in ${entry.actualPackage}`;
55
+ }
56
+ else if (isMissing) {
57
+ label = 'FAILED ';
58
+ detail = 'NOT FOUND after restore';
59
+ }
60
+ else {
61
+ label = 'ERROR ';
62
+ detail = entry.message || entry.status;
63
+ }
64
+ }
65
+ lines.push(`${label} ${spec} | ${detail}`);
26
66
  }
27
- lines.push(parts.join(' | '));
67
+ }
68
+ // 2. Summary - ALWAYS show at the bottom
69
+ const summaryParts = [
70
+ `Total: ${summary.total}`,
71
+ `ok: ${summary.ok}`,
72
+ `missing: ${summary.missing}`,
73
+ `error: ${summary.error}`,
74
+ `conflicts: ${summary.conflicts}`,
75
+ ];
76
+ if (mode === 'pre-restore') {
77
+ if (summary.create !== undefined)
78
+ summaryParts.push(`create: ${summary.create}`);
79
+ if (summary.update !== undefined)
80
+ summaryParts.push(`update: ${summary.update}`);
81
+ if (summary.skip !== undefined && summary.skip > 0)
82
+ summaryParts.push(`skip: ${summary.skip}`);
83
+ }
84
+ if (lines.length > 0) {
85
+ lines.push(`\n${'='.repeat(40)}`);
86
+ }
87
+ lines.push(`Summary (${mode}): ${summaryParts.join(', ')}`);
88
+ if (lines.length > 1) {
89
+ lines.push('='.repeat(40));
28
90
  }
29
91
  return lines.join('\n');
30
92
  }
@@ -19,5 +19,8 @@ export interface VerifySummary {
19
19
  unsupported: number;
20
20
  error: number;
21
21
  conflicts: number;
22
+ create?: number;
23
+ update?: number;
24
+ skip?: number;
22
25
  }
23
26
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/verify/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,MAAM,MAAM,YAAY,GACpB,IAAI,GACJ,SAAS,GACT,eAAe,GACf,kBAAkB,GAClB,iBAAiB,GACjB,aAAa,GACb,OAAO,CAAC;AAEZ,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,YAAY,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/verify/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,MAAM,MAAM,YAAY,GACpB,IAAI,GACJ,SAAS,GACT,eAAe,GACf,kBAAkB,GAClB,iBAAiB,GACjB,aAAa,GACb,OAAO,CAAC;AAEZ,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,YAAY,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
@@ -1,9 +1,11 @@
1
1
  import type { AdtClient } from '@mcp-abap-adt/adt-clients';
2
2
  import type { BackupFile, BackupTreeFile } from '../types';
3
3
  import type { VerifyEntry, VerifySummary } from './types';
4
- export declare function verifyBackup(client: AdtClient, backup: BackupFile | BackupTreeFile, options?: {
4
+ export interface VerifyOptions {
5
5
  strict?: boolean;
6
- }): Promise<{
6
+ mode?: 'pre-restore' | 'post-restore';
7
+ }
8
+ export declare function verifyBackup(client: AdtClient, backup: BackupFile | BackupTreeFile, options?: VerifyOptions): Promise<{
7
9
  entries: VerifyEntry[];
8
10
  summary: VerifySummary;
9
11
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"verifyBackup.d.ts","sourceRoot":"","sources":["../../../src/lib/verify/verifyBackup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAkB,MAAM,UAAU,CAAC;AAG3E,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG1D,wBAAsB,YAAY,CAChC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,UAAU,GAAG,cAAc,EACnC,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAC7B,OAAO,CAAC;IAAE,OAAO,EAAE,WAAW,EAAE,CAAC;IAAC,OAAO,EAAE,aAAa,CAAA;CAAE,CAAC,CAsE7D"}
1
+ {"version":3,"file":"verifyBackup.d.ts","sourceRoot":"","sources":["../../../src/lib/verify/verifyBackup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG3D,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG1D,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,aAAa,GAAG,cAAc,CAAC;CACvC;AAED,wBAAsB,YAAY,CAChC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,UAAU,GAAG,cAAc,EACnC,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC;IAAE,OAAO,EAAE,WAAW,EAAE,CAAC;IAAC,OAAO,EAAE,aAAa,CAAA;CAAE,CAAC,CAK7D"}
@@ -1,54 +1,89 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.verifyBackup = verifyBackup;
4
+ const logVerbose_1 = require("../cli/logVerbose");
4
5
  const collectBackupNodes_1 = require("./collectBackupNodes");
5
6
  const getExpectedPackage_1 = require("./getExpectedPackage");
6
7
  const verifyObjectInSystem_1 = require("./verifyObjectInSystem");
7
8
  async function verifyBackup(client, backup, options) {
9
+ const mode = options?.mode || 'pre-restore';
10
+ (0, logVerbose_1.logVerbose)(1, `Verifying objects in backup (${mode} mode)...`);
11
+ const entries = await verifyIndividual(client, backup, options);
12
+ return { entries, summary: buildSummary(entries, options) };
13
+ }
14
+ async function verifyIndividual(client, backup, options) {
8
15
  const entries = [];
16
+ const nodes = [];
17
+ const mode = options?.mode || 'pre-restore';
9
18
  if (backup.schemaVersion === 2) {
10
- const tree = backup;
11
- const nodes = [];
12
- (0, collectBackupNodes_1.collectBackupNodes)(tree.root, nodes);
13
- for (const node of nodes) {
14
- if (!node.type) {
15
- continue;
16
- }
19
+ (0, collectBackupNodes_1.collectBackupNodes)(backup.root, nodes);
20
+ }
21
+ else {
22
+ nodes.push(...backup.objects);
23
+ }
24
+ (0, logVerbose_1.logVerbose)(1, `Processing ${nodes.length} objects...`);
25
+ let count = 0;
26
+ for (const node of nodes) {
27
+ if (!node.type)
28
+ continue;
29
+ count++;
30
+ // Always show progress at level 1 or higher (-v, -vv)
31
+ if (count % 10 === 0 || count === nodes.length) {
32
+ (0, logVerbose_1.logVerbose)(1, ` Progress: ${count}/${nodes.length} objects processed...`);
33
+ }
34
+ try {
17
35
  const entry = await (0, verifyObjectInSystem_1.verifyObjectInSystem)(client, {
18
36
  type: node.type,
19
37
  name: node.name,
20
38
  functionGroupName: node.functionGroupName,
21
- }, (0, getExpectedPackage_1.getExpectedPackage)(node.config), undefined, node.codeBase64, node.codeFormat);
39
+ }, (0, getExpectedPackage_1.getExpectedPackage)(node.config), node.source, node.codeBase64, node.codeFormat || (node.source ? 'source' : undefined), mode === 'post-restore' ? 'inactive' : 'active');
40
+ // Detailed object log ONLY for level 2 or higher (-vv)
41
+ const actionLabel = mode === 'pre-restore'
42
+ ? entry.status === 'missing'
43
+ ? 'CREATE'
44
+ : 'UPDATE'
45
+ : entry.status === 'ok'
46
+ ? 'OK '
47
+ : 'FAILED';
48
+ (0, logVerbose_1.logVerbose)(2, ` [${actionLabel}] ${node.type}:${node.name}`);
22
49
  entries.push(entry);
23
50
  }
24
- }
25
- else {
26
- const flat = backup;
27
- for (const obj of flat.objects) {
28
- const entry = await (0, verifyObjectInSystem_1.verifyObjectInSystem)(client, {
29
- type: obj.type,
30
- name: obj.name,
31
- functionGroupName: obj.functionGroupName,
32
- }, (0, getExpectedPackage_1.getExpectedPackage)(obj.config), obj.source, undefined, obj.source ? 'source' : undefined);
33
- entries.push(entry);
51
+ catch (error) {
52
+ (0, logVerbose_1.logVerbose)(1, ` [ERROR ] ${node.type}:${node.name} | ${error.message}`);
53
+ entries.push({
54
+ type: node.type,
55
+ name: node.name,
56
+ status: 'error',
57
+ message: error.message,
58
+ });
34
59
  }
35
60
  }
61
+ return entries;
62
+ }
63
+ function buildSummary(entries, options) {
36
64
  const strict = options?.strict ?? false;
37
- const conflictStatuses = strict
38
- ? ['type-mismatch', 'package-mismatch', 'error', 'source-mismatch']
39
- : ['type-mismatch', 'package-mismatch', 'error'];
40
- const summary = {
65
+ const mode = options?.mode ?? 'pre-restore';
66
+ const conflictStatuses = ['type-mismatch', 'package-mismatch', 'error'];
67
+ if (strict)
68
+ conflictStatuses.push('source-mismatch');
69
+ if (mode === 'post-restore')
70
+ conflictStatuses.push('missing');
71
+ const missingCount = entries.filter((e) => e.status === 'missing').length;
72
+ const okCount = entries.filter((e) => e.status === 'ok').length;
73
+ const pkgMismatchCount = entries.filter((e) => e.status === 'package-mismatch').length;
74
+ const sourceMismatchCount = entries.filter((e) => e.status === 'source-mismatch').length;
75
+ return {
41
76
  total: entries.length,
42
- ok: entries.filter((entry) => entry.status === 'ok').length,
43
- missing: entries.filter((entry) => entry.status === 'missing').length,
44
- typeMismatch: entries.filter((entry) => entry.status === 'type-mismatch')
45
- .length,
46
- packageMismatch: entries.filter((entry) => entry.status === 'package-mismatch').length,
47
- sourceMismatch: entries.filter((entry) => entry.status === 'source-mismatch').length,
48
- unsupported: entries.filter((entry) => entry.status === 'unsupported')
77
+ ok: mode === 'pre-restore' ? okCount + missingCount : okCount,
78
+ missing: missingCount,
79
+ create: missingCount,
80
+ update: okCount + pkgMismatchCount + sourceMismatchCount,
81
+ typeMismatch: entries.filter((e) => e.status === 'type-mismatch').length,
82
+ packageMismatch: pkgMismatchCount,
83
+ sourceMismatch: sourceMismatchCount,
84
+ unsupported: entries.filter((e) => e.status === 'unsupported').length,
85
+ error: entries.filter((e) => e.status === 'error').length,
86
+ conflicts: entries.filter((e) => conflictStatuses.includes(e.status))
49
87
  .length,
50
- error: entries.filter((entry) => entry.status === 'error').length,
51
- conflicts: entries.filter((entry) => conflictStatuses.includes(entry.status)).length,
52
88
  };
53
- return { entries, summary };
54
89
  }
@@ -1,5 +1,5 @@
1
1
  import type { AdtClient } from '@mcp-abap-adt/adt-clients';
2
2
  import type { ObjectSpec } from '../types';
3
3
  import type { VerifyEntry } from './types';
4
- export declare function verifyObjectInSystem(client: AdtClient, spec: ObjectSpec, expectedPackage?: string, expectedSource?: string, expectedSourceBase64?: string, expectedFormat?: 'source' | 'xml' | 'json'): Promise<VerifyEntry>;
4
+ export declare function verifyObjectInSystem(client: AdtClient, spec: ObjectSpec, expectedPackage?: string, expectedSource?: string, expectedSourceBase64?: string, expectedFormat?: 'source' | 'xml' | 'json', version?: 'active' | 'inactive'): Promise<VerifyEntry>;
5
5
  //# sourceMappingURL=verifyObjectInSystem.d.ts.map
@@ -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;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"}
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;AAI3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,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,EAC1C,OAAO,GAAE,QAAQ,GAAG,UAAqB,GACxC,OAAO,CAAC,WAAW,CAAC,CA+EtB"}