arc-1 0.6.9 → 0.7.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 (157) hide show
  1. package/README.md +12 -9
  2. package/bin/arc1-cli.js +10 -0
  3. package/bin/arc1.js +1 -1
  4. package/dist/adt/abapgit.d.ts +39 -0
  5. package/dist/adt/abapgit.d.ts.map +1 -0
  6. package/dist/adt/abapgit.js +333 -0
  7. package/dist/adt/abapgit.js.map +1 -0
  8. package/dist/adt/cds-impact.d.ts +35 -0
  9. package/dist/adt/cds-impact.d.ts.map +1 -1
  10. package/dist/adt/cds-impact.js +71 -0
  11. package/dist/adt/cds-impact.js.map +1 -1
  12. package/dist/adt/client.d.ts +4 -1
  13. package/dist/adt/client.d.ts.map +1 -1
  14. package/dist/adt/client.js +18 -5
  15. package/dist/adt/client.js.map +1 -1
  16. package/dist/adt/config.d.ts +1 -0
  17. package/dist/adt/config.d.ts.map +1 -1
  18. package/dist/adt/config.js +1 -0
  19. package/dist/adt/config.js.map +1 -1
  20. package/dist/adt/crud.d.ts.map +1 -1
  21. package/dist/adt/crud.js +74 -8
  22. package/dist/adt/crud.js.map +1 -1
  23. package/dist/adt/devtools.d.ts +39 -3
  24. package/dist/adt/devtools.d.ts.map +1 -1
  25. package/dist/adt/devtools.js +237 -25
  26. package/dist/adt/devtools.js.map +1 -1
  27. package/dist/adt/diagnostics.d.ts +69 -7
  28. package/dist/adt/diagnostics.d.ts.map +1 -1
  29. package/dist/adt/diagnostics.js +694 -36
  30. package/dist/adt/diagnostics.js.map +1 -1
  31. package/dist/adt/errors.d.ts +36 -2
  32. package/dist/adt/errors.d.ts.map +1 -1
  33. package/dist/adt/errors.js +111 -11
  34. package/dist/adt/errors.js.map +1 -1
  35. package/dist/adt/features.d.ts.map +1 -1
  36. package/dist/adt/features.js +3 -0
  37. package/dist/adt/features.js.map +1 -1
  38. package/dist/adt/gcts.d.ts +68 -0
  39. package/dist/adt/gcts.d.ts.map +1 -0
  40. package/dist/adt/gcts.js +239 -0
  41. package/dist/adt/gcts.js.map +1 -0
  42. package/dist/adt/http.d.ts.map +1 -1
  43. package/dist/adt/http.js +86 -1
  44. package/dist/adt/http.js.map +1 -1
  45. package/dist/adt/rap-handlers.d.ts +165 -0
  46. package/dist/adt/rap-handlers.d.ts.map +1 -0
  47. package/dist/adt/rap-handlers.js +835 -0
  48. package/dist/adt/rap-handlers.js.map +1 -0
  49. package/dist/adt/rap-preflight.d.ts +43 -0
  50. package/dist/adt/rap-preflight.d.ts.map +1 -0
  51. package/dist/adt/rap-preflight.js +405 -0
  52. package/dist/adt/rap-preflight.js.map +1 -0
  53. package/dist/adt/safety.d.ts +60 -33
  54. package/dist/adt/safety.d.ts.map +1 -1
  55. package/dist/adt/safety.js +204 -113
  56. package/dist/adt/safety.js.map +1 -1
  57. package/dist/adt/transport.d.ts +1 -1
  58. package/dist/adt/transport.d.ts.map +1 -1
  59. package/dist/adt/transport.js +6 -3
  60. package/dist/adt/transport.js.map +1 -1
  61. package/dist/adt/types.d.ts +225 -0
  62. package/dist/adt/types.d.ts.map +1 -1
  63. package/dist/adt/xml-parser.d.ts +15 -1
  64. package/dist/adt/xml-parser.d.ts.map +1 -1
  65. package/dist/adt/xml-parser.js +28 -15
  66. package/dist/adt/xml-parser.js.map +1 -1
  67. package/dist/authz/policy.d.ts +53 -0
  68. package/dist/authz/policy.d.ts.map +1 -0
  69. package/dist/authz/policy.js +199 -0
  70. package/dist/authz/policy.js.map +1 -0
  71. package/dist/cli-args.d.ts +14 -0
  72. package/dist/cli-args.d.ts.map +1 -0
  73. package/dist/cli-args.js +62 -0
  74. package/dist/cli-args.js.map +1 -0
  75. package/dist/cli.d.ts +13 -7
  76. package/dist/cli.d.ts.map +1 -1
  77. package/dist/cli.js +252 -55
  78. package/dist/cli.js.map +1 -1
  79. package/dist/extract-sap-cookies.d.ts +24 -0
  80. package/dist/extract-sap-cookies.d.ts.map +1 -0
  81. package/dist/extract-sap-cookies.js +317 -0
  82. package/dist/extract-sap-cookies.js.map +1 -0
  83. package/dist/handlers/hyperfocused.d.ts +4 -3
  84. package/dist/handlers/hyperfocused.d.ts.map +1 -1
  85. package/dist/handlers/hyperfocused.js +25 -16
  86. package/dist/handlers/hyperfocused.js.map +1 -1
  87. package/dist/handlers/intent.d.ts +4 -12
  88. package/dist/handlers/intent.d.ts.map +1 -1
  89. package/dist/handlers/intent.js +1448 -89
  90. package/dist/handlers/intent.js.map +1 -1
  91. package/dist/handlers/schemas.d.ts +83 -11
  92. package/dist/handlers/schemas.d.ts.map +1 -1
  93. package/dist/handlers/schemas.js +115 -4
  94. package/dist/handlers/schemas.js.map +1 -1
  95. package/dist/handlers/tools.d.ts +4 -3
  96. package/dist/handlers/tools.d.ts.map +1 -1
  97. package/dist/handlers/tools.js +342 -143
  98. package/dist/handlers/tools.js.map +1 -1
  99. package/dist/index.d.ts +1 -1
  100. package/dist/index.js +7 -6
  101. package/dist/index.js.map +1 -1
  102. package/dist/probe/catalog.d.ts +30 -0
  103. package/dist/probe/catalog.d.ts.map +1 -0
  104. package/dist/probe/catalog.js +196 -0
  105. package/dist/probe/catalog.js.map +1 -0
  106. package/dist/probe/fixtures.d.ts +54 -0
  107. package/dist/probe/fixtures.d.ts.map +1 -0
  108. package/dist/probe/fixtures.js +94 -0
  109. package/dist/probe/fixtures.js.map +1 -0
  110. package/dist/probe/format.d.ts +10 -0
  111. package/dist/probe/format.d.ts.map +1 -0
  112. package/dist/probe/format.js +114 -0
  113. package/dist/probe/format.js.map +1 -0
  114. package/dist/probe/quality.d.ts +13 -0
  115. package/dist/probe/quality.d.ts.map +1 -0
  116. package/dist/probe/quality.js +50 -0
  117. package/dist/probe/quality.js.map +1 -0
  118. package/dist/probe/runner.d.ts +48 -0
  119. package/dist/probe/runner.d.ts.map +1 -0
  120. package/dist/probe/runner.js +211 -0
  121. package/dist/probe/runner.js.map +1 -0
  122. package/dist/probe/types.d.ts +159 -0
  123. package/dist/probe/types.d.ts.map +1 -0
  124. package/dist/probe/types.js +11 -0
  125. package/dist/probe/types.js.map +1 -0
  126. package/dist/server/audit.d.ts +26 -3
  127. package/dist/server/audit.d.ts.map +1 -1
  128. package/dist/server/audit.js +12 -1
  129. package/dist/server/audit.js.map +1 -1
  130. package/dist/server/config.d.ts +34 -19
  131. package/dist/server/config.d.ts.map +1 -1
  132. package/dist/server/config.js +327 -187
  133. package/dist/server/config.js.map +1 -1
  134. package/dist/server/deny-actions.d.ts +31 -0
  135. package/dist/server/deny-actions.d.ts.map +1 -0
  136. package/dist/server/deny-actions.js +156 -0
  137. package/dist/server/deny-actions.js.map +1 -0
  138. package/dist/server/effective-policy-log.d.ts +27 -0
  139. package/dist/server/effective-policy-log.d.ts.map +1 -0
  140. package/dist/server/effective-policy-log.js +103 -0
  141. package/dist/server/effective-policy-log.js.map +1 -0
  142. package/dist/server/http.d.ts.map +1 -1
  143. package/dist/server/http.js +15 -16
  144. package/dist/server/http.js.map +1 -1
  145. package/dist/server/server.d.ts +38 -4
  146. package/dist/server/server.d.ts.map +1 -1
  147. package/dist/server/server.js +234 -31
  148. package/dist/server/server.js.map +1 -1
  149. package/dist/server/types.d.ts +31 -13
  150. package/dist/server/types.d.ts.map +1 -1
  151. package/dist/server/types.js +11 -10
  152. package/dist/server/types.js.map +1 -1
  153. package/dist/server/xsuaa.d.ts +1 -2
  154. package/dist/server/xsuaa.d.ts.map +1 -1
  155. package/dist/server/xsuaa.js +13 -14
  156. package/dist/server/xsuaa.js.map +1 -1
  157. package/package.json +9 -3
@@ -0,0 +1,165 @@
1
+ /**
2
+ * RAP behavior-pool handler scaffolding.
3
+ *
4
+ * Context — this module exists because on-prem RAP development has a tight
5
+ * contract between a BDEF (behavior definition source) and its behavior pool
6
+ * (the ABAP global class named in `managed implementation in class ZBP_...`).
7
+ * Every `action` / `determination` / `validation` / `authorization master`
8
+ * declared in the BDEF requires a matching METHOD signature inside a local
9
+ * handler class (`lhc_<alias>`). If any signature is missing, the class will
10
+ * not activate and the error reported by ADT doesn't tell the developer
11
+ * which signatures are missing — they see a generic "behavior pool does not
12
+ * implement the required method for ..." message.
13
+ *
14
+ * The exported helpers cooperate:
15
+ * 1. extractRapHandlerRequirements — parse BDEF → list of required methods
16
+ * 2. findMissingRapHandlerRequirements — diff required vs. present in class
17
+ * 3. applyRapHandlerSignatures — insert the missing METHODS lines
18
+ * 4. applyRapHandlerImplementationStubs — insert empty METHOD stubs
19
+ * 5. applyRapHandlerScaffold — plan multi-include auto-apply
20
+ *
21
+ * The scaffolder writes declarations plus empty implementations only.
22
+ * Business logic remains the developer's responsibility and can be filled
23
+ * with edit_method.
24
+ *
25
+ * Naming convention: handler classes use the prefix `lhc_` (local handler
26
+ * class) followed by the lowercased alias from the BDEF. This is the RAP
27
+ * convention SAP's own templates use (see cl_abap_behavior_handler examples
28
+ * in /DMO/* and the "Create Behavior Implementation Class" wizard in ADT).
29
+ */
30
+ export type RapHandlerKind = 'action' | 'determination' | 'validation' | 'instance_authorization' | 'global_authorization';
31
+ export interface RapHandlerRequirement {
32
+ kind: RapHandlerKind;
33
+ methodName: string;
34
+ entityName: string;
35
+ entityAlias: string;
36
+ targetHandlerClass: string;
37
+ declarationLine: number;
38
+ signature: string;
39
+ }
40
+ export interface RapHandlerApplySkipped {
41
+ requirement: RapHandlerRequirement;
42
+ reason: string;
43
+ }
44
+ export interface RapHandlerApplyResult {
45
+ updatedSource: string;
46
+ inserted: RapHandlerRequirement[];
47
+ skipped: RapHandlerApplySkipped[];
48
+ changed: boolean;
49
+ }
50
+ export type RapHandlerSectionName = 'main' | 'definitions' | 'implementations';
51
+ export interface RapHandlerSourceSections {
52
+ main: string;
53
+ definitions?: string;
54
+ implementations?: string;
55
+ }
56
+ export interface RapHandlerSectionApplyResults {
57
+ main: RapHandlerApplyResult;
58
+ definitions?: RapHandlerApplyResult;
59
+ implementations?: RapHandlerApplyResult;
60
+ }
61
+ export interface RapHandlerScaffoldPlan {
62
+ sections: RapHandlerSourceSections;
63
+ signatures: RapHandlerSectionApplyResults;
64
+ implementationStubs: RapHandlerSectionApplyResults;
65
+ unresolved: RapHandlerRequirement[];
66
+ changed: Record<RapHandlerSectionName, boolean>;
67
+ changedSections: RapHandlerSectionName[];
68
+ insertedSignatureCount: number;
69
+ insertedImplementationStubCount: number;
70
+ }
71
+ export declare function rapHandlerRequirementKey(requirement: RapHandlerRequirement): string;
72
+ /**
73
+ * Extract RAP behavior-pool handler method requirements from interface BDEF source.
74
+ *
75
+ * For every behavior block (one per entity in the BDEF), this produces the
76
+ * exact METHOD signatures that the behavior pool's `lhc_<alias>` class must
77
+ * declare for the class to activate. The output is used by:
78
+ * - findMissingRapHandlerRequirements: to diff against an existing class
79
+ * - applyRapHandlerSignatures: to synthesize the missing METHODS lines
80
+ *
81
+ * The emitted signatures mirror what SAP's "Create Behavior Implementation"
82
+ * wizard would generate — same FOR MODIFY/FOR DETERMINE ON/FOR VALIDATE ON
83
+ * syntax, same `alias~method` entity reference, same RESULT clause only when
84
+ * the BDEF declares a `result` cardinality.
85
+ */
86
+ export declare function extractRapHandlerRequirements(bdefSource: string): RapHandlerRequirement[];
87
+ /**
88
+ * Parse method declarations (`METHODS ...`) per class definition.
89
+ *
90
+ * The returned Set contains BOTH:
91
+ * 1. Every declared METHOD name in the class (e.g. `submitforapproval`,
92
+ * `set_status_accepted`, `validate_customer`)
93
+ * 2. Every RAP binding-key those methods are bound to (the action /
94
+ * determination / validation / authorization referenced in the
95
+ * `FOR ACTION <alias>~<name>` / `FOR <alias>~<name>` /
96
+ * `FOR INSTANCE AUTHORIZATION ... FOR <alias>` clauses)
97
+ *
98
+ * Why both? Hand-crafted behavior pools (like SAP's own /DMO/BP_TRAVEL_M)
99
+ * routinely use semantic method names that differ from the BDEF action
100
+ * names — e.g. BDEF `action acceptTravel` bound to METHOD
101
+ * `set_status_accepted` via `FOR ACTION travel~acceptTravel`. The
102
+ * scaffolder's missing-requirement check compares by BDEF identifier, so if
103
+ * we only indexed method names, it would incorrectly report
104
+ * `accepttravel` as missing and try to inject a duplicate METHOD line.
105
+ *
106
+ * METHOD declarations can span multiple lines (one line for the name +
107
+ * continuation lines for FOR / IMPORTING / RESULT), so we join the
108
+ * statement up to its terminating `.` before pattern-matching the binding.
109
+ */
110
+ export declare function parseClassDefinitionMethods(source: string): Map<string, Set<string>>;
111
+ /**
112
+ * Determine which RAP handler requirements are missing from class definitions.
113
+ *
114
+ * If the target handler class (`lhc_<alias>`) doesn't exist in the source at
115
+ * all, every requirement for that class is reported missing so the caller
116
+ * can decide whether to create the class or fall through to another include
117
+ * (the scaffold flow searches `main` → `definitions` → `implementations`).
118
+ *
119
+ * Method-name comparison is case-insensitive because ABAP identifiers
120
+ * are — we normalize on both sides so `METHODS SubmitForApproval ...`
121
+ * matches a BDEF `action SubmitForApproval`.
122
+ */
123
+ export declare function findMissingRapHandlerRequirements(requirements: RapHandlerRequirement[], classSource: string): RapHandlerRequirement[];
124
+ export declare function findMissingRapHandlerImplementationStubs(requirements: RapHandlerRequirement[], classSource: string): RapHandlerRequirement[];
125
+ /**
126
+ * Insert missing RAP handler signatures into matching `lhc_*` class definitions.
127
+ *
128
+ * Scope and contract:
129
+ * - Only DEFINITION sections are modified. Use
130
+ * applyRapHandlerImplementationStubs after this step when the scaffold
131
+ * should be immediately patchable with edit_method.
132
+ * - Requirements whose target class (`lhc_<alias>`) is not present in this
133
+ * source are returned in `skipped`, not silently dropped. The caller can
134
+ * then try another include (definitions/implementations) or surface a
135
+ * clear error to the user.
136
+ * - Edits are applied bottom-up (highest line index first) so that earlier
137
+ * splice operations don't shift the indices of later ones.
138
+ * - When a target class exists but has no PRIVATE SECTION at all, the
139
+ * entire PRIVATE SECTION with the signatures is inserted just before
140
+ * ENDCLASS — this covers freshly-generated behavior pools where ADT
141
+ * produced a skeleton without method declarations.
142
+ */
143
+ export declare function applyRapHandlerSignatures(classSource: string, requirements: RapHandlerRequirement[]): RapHandlerApplyResult;
144
+ export declare function applyRapHandlerImplementationStubs(classSource: string, requirements: RapHandlerRequirement[], options?: {
145
+ createImplementationBlocks?: boolean;
146
+ definitionSource?: string;
147
+ }): RapHandlerApplyResult;
148
+ /**
149
+ * Build the complete auto-apply plan for a behavior pool without doing I/O.
150
+ *
151
+ * This is intentionally pure: the MCP handler owns safety checks, locks,
152
+ * linting, and ADT writes; this helper owns the RAP-specific sequencing:
153
+ * 1. insert missing METHODS declarations into whichever include contains
154
+ * the matching `lhc_<alias> DEFINITION`
155
+ * 2. skip stubs whose declarations still could not be placed
156
+ * 3. insert empty METHOD stubs using the concrete ABAP method name from
157
+ * existing/new declarations, including semantic names bound via
158
+ * `FOR ACTION alias~ActionName`
159
+ *
160
+ * Keeping this plan here prevents `intent.ts` from duplicating RAP parser
161
+ * invariants such as "deferred classes are not editable" and "stub method
162
+ * names come from declarations, not necessarily from BDEF action names".
163
+ */
164
+ export declare function applyRapHandlerScaffold(sections: RapHandlerSourceSections, missingSignatures: RapHandlerRequirement[], missingImplementationStubs: RapHandlerRequirement[]): RapHandlerScaffoldPlan;
165
+ //# sourceMappingURL=rap-handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rap-handlers.d.ts","sourceRoot":"","sources":["../../src/adt/rap-handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,MAAM,MAAM,cAAc,GACtB,QAAQ,GACR,eAAe,GACf,YAAY,GACZ,wBAAwB,GACxB,sBAAsB,CAAC;AAE3B,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,cAAc,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,qBAAqB,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC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