@aventara/core 1.0.0-rc.0 → 1.0.0-rc.10

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 (338) hide show
  1. package/CHANGELOG.md +2068 -1
  2. package/ERRORS.md +142 -0
  3. package/README.md +485 -60
  4. package/dist/adapters/adapter-discovery-diagnostic.d.ts +4 -4
  5. package/dist/adapters/adapter-discovery-diagnostic.guidance.d.ts +6 -0
  6. package/dist/adapters/adapter-discovery-diagnostic.guidance.js +7 -0
  7. package/dist/adapters/adapter-field.d.ts +33 -11
  8. package/dist/adapters/adapter-identifier.d.ts +15 -6
  9. package/dist/adapters/adapter-identifier.js +6 -1
  10. package/dist/adapters/adapter-model.d.ts +18 -9
  11. package/dist/adapters/adapter-operation-executor.interface.d.ts +4 -4
  12. package/dist/adapters/adapter-operation.d.ts +21 -6
  13. package/dist/adapters/adapter-resource.d.ts +23 -9
  14. package/dist/adapters/adapter-sql-statement.d.ts +19 -0
  15. package/dist/adapters/adapter-transaction-executor.interface.d.ts +19 -0
  16. package/dist/adapters/adapter.interface.d.ts +59 -29
  17. package/dist/avz/avz-check.factory.d.ts +83 -0
  18. package/dist/avz/avz-check.factory.js +116 -0
  19. package/dist/avz/avz-check.registry.d.ts +35 -0
  20. package/dist/avz/avz-check.registry.js +9 -0
  21. package/dist/avz/avz.d.ts +203 -0
  22. package/dist/{json → avz}/avz.js +150 -8
  23. package/dist/{json → avz}/index.d.ts +2 -1
  24. package/dist/{json → avz}/json-shape.registry.d.ts +9 -8
  25. package/dist/{json → avz}/zod-issue.translator.d.ts +8 -2
  26. package/dist/{json → avz}/zod-issue.translator.js +7 -0
  27. package/dist/compiler/contract-compiler-diagnostic.d.ts +31 -5
  28. package/dist/compiler/contract-compiler-diagnostic.guidance.d.ts +6 -0
  29. package/dist/compiler/contract-compiler-diagnostic.guidance.js +97 -0
  30. package/dist/compiler/contract.compiler.d.ts +23 -17
  31. package/dist/compiler/contract.compiler.js +753 -443
  32. package/dist/compiler/create-requirements.projector.d.ts +49 -0
  33. package/dist/compiler/create-requirements.projector.js +423 -0
  34. package/dist/compiler/field-validator.compiler.d.ts +47 -0
  35. package/dist/compiler/field-validator.compiler.js +238 -0
  36. package/dist/compiler/managed-elsewhere.projector.d.ts +52 -0
  37. package/dist/compiler/managed-elsewhere.projector.js +179 -0
  38. package/dist/compiler/managed-elsewhere.validator.d.ts +9 -0
  39. package/dist/compiler/managed-elsewhere.validator.js +74 -0
  40. package/dist/config/any-framework-config.d.ts +19 -12
  41. package/dist/config/computed-fields.d.ts +62 -0
  42. package/dist/config/computed-fields.js +73 -0
  43. package/dist/config/config-diagnostic.d.ts +11 -4
  44. package/dist/config/config-diagnostic.guidance.d.ts +6 -0
  45. package/dist/config/config-diagnostic.guidance.js +32 -0
  46. package/dist/config/config-layer.d.ts +15 -6
  47. package/dist/config/config.resolver.d.ts +98 -31
  48. package/dist/config/config.resolver.js +173 -44
  49. package/dist/config/config.validator.d.ts +7 -7
  50. package/dist/config/config.validator.js +792 -69
  51. package/dist/config/define-resource.d.ts +53 -0
  52. package/dist/config/define-resource.js +14 -0
  53. package/dist/config/effective-fields.d.ts +19 -23
  54. package/dist/config/entrypoint.normalizer.d.ts +4 -3
  55. package/dist/config/exact-framework-config.d.ts +325 -0
  56. package/dist/config/field-compute.resolver.d.ts +21 -0
  57. package/dist/config/field-compute.resolver.js +123 -0
  58. package/dist/config/field-pipeline-config.d.ts +47 -0
  59. package/dist/config/forced-operation.validator.d.ts +10 -0
  60. package/dist/config/forced-operation.validator.js +66 -0
  61. package/dist/config/framework-config.d.ts +148 -39
  62. package/dist/config/framework-exemptions-config.d.ts +91 -0
  63. package/dist/config/framework-exemptions-config.js +1 -0
  64. package/dist/config/framework-field-definition.d.ts +78 -0
  65. package/dist/config/framework-field-definition.js +28 -0
  66. package/dist/config/framework-resources-config.d.ts +127 -0
  67. package/dist/config/framework-resources-config.js +1 -0
  68. package/dist/config/pipeline-config.d.ts +56 -20
  69. package/dist/config/pipeline-tree.resolver.d.ts +79 -0
  70. package/dist/config/pipeline-tree.resolver.js +220 -0
  71. package/dist/config/stage-type.eraser.d.ts +65 -0
  72. package/dist/config/stage-type.eraser.js +1 -0
  73. package/dist/contracts/access-route.rules.d.ts +10 -0
  74. package/dist/contracts/access-route.rules.js +45 -0
  75. package/dist/contracts/capability.d.ts +37 -12
  76. package/dist/contracts/capability.js +20 -0
  77. package/dist/contracts/client-contract-structure.validator.d.ts +621 -114
  78. package/dist/contracts/client-contract-structure.validator.js +189 -10
  79. package/dist/contracts/contract-access.d.ts +29 -0
  80. package/dist/contracts/contract-access.js +1 -0
  81. package/dist/contracts/contract-canonicalizer.d.ts +27 -3
  82. package/dist/contracts/contract-canonicalizer.js +168 -29
  83. package/dist/contracts/contract-hash.d.ts +11 -7
  84. package/dist/contracts/contract-hash.js +4 -3
  85. package/dist/contracts/contract-limits.d.ts +4 -1
  86. package/dist/contracts/contract-limits.js +1 -0
  87. package/dist/contracts/contract-lookup.d.ts +5 -5
  88. package/dist/contracts/contract-protocol.d.ts +4 -4
  89. package/dist/contracts/contract.d.ts +51 -17
  90. package/dist/contracts/create-requirements.d.ts +35 -0
  91. package/dist/contracts/create-requirements.js +1 -0
  92. package/dist/contracts/enum-definition.d.ts +1 -1
  93. package/dist/contracts/field-check.d.ts +101 -0
  94. package/dist/contracts/field-check.js +1 -0
  95. package/dist/contracts/field.d.ts +109 -42
  96. package/dist/contracts/identifier.d.ts +4 -4
  97. package/dist/contracts/json-schema.projector.d.ts +11 -0
  98. package/dist/contracts/json-schema.projector.js +78 -0
  99. package/dist/contracts/json-shape.d.ts +12 -1
  100. package/dist/contracts/lifecycle-trait.d.ts +2 -2
  101. package/dist/contracts/resource-operations.d.ts +28 -28
  102. package/dist/contracts/resource.d.ts +15 -9
  103. package/dist/contracts/scalar-value-type.d.ts +17 -15
  104. package/dist/contracts/scalar.d.ts +3 -3
  105. package/dist/contracts/transaction-capability.d.ts +1 -1
  106. package/dist/contracts/wire-scalar-format.d.ts +4 -4
  107. package/dist/framework/access-facade.d.ts +116 -0
  108. package/dist/framework/access-facade.js +120 -0
  109. package/dist/framework/contract-view.d.ts +315 -145
  110. package/dist/framework/framework-construction.error.d.ts +21 -11
  111. package/dist/framework/framework-construction.error.js +20 -4
  112. package/dist/framework/framework.d.ts +71 -26
  113. package/dist/framework/framework.factory.d.ts +8 -6
  114. package/dist/framework/framework.factory.js +150 -38
  115. package/dist/framework/operation-facade.d.ts +192 -54
  116. package/dist/framework/operation-facade.js +10 -1
  117. package/dist/index.d.ts +67 -50
  118. package/dist/index.js +7 -6
  119. package/dist/internal.d.ts +20 -10
  120. package/dist/internal.js +9 -1
  121. package/dist/operations/database-refusal.d.ts +51 -0
  122. package/dist/operations/database-refusal.js +45 -0
  123. package/dist/operations/operation-arguments.d.ts +381 -228
  124. package/dist/operations/operation-call.d.ts +31 -28
  125. package/dist/operations/operation-identity.d.ts +10 -10
  126. package/dist/operations/operation-result.d.ts +25 -23
  127. package/dist/operations/operation-validator-core.d.ts +6 -6
  128. package/dist/operations/operation-validator-core.js +172 -38
  129. package/dist/operations/operation-validator.d.ts +10 -10
  130. package/dist/operations/projection-scope.resolver.d.ts +6 -6
  131. package/dist/operations/structural-limits.walker.d.ts +7 -7
  132. package/dist/operations/structural-limits.walker.js +145 -0
  133. package/dist/operations/validation-code.d.ts +11 -6
  134. package/dist/operations/validation-code.guidance.d.ts +6 -0
  135. package/dist/operations/validation-code.guidance.js +90 -0
  136. package/dist/operations/validation-code.js +4 -0
  137. package/dist/operations/write-scope.resolver.d.ts +10 -6
  138. package/dist/operations/write-scope.resolver.js +2 -0
  139. package/dist/policy/access-provider.interface.d.ts +91 -0
  140. package/dist/policy/access-provider.interface.js +1 -0
  141. package/dist/policy/access-provider.registry.d.ts +17 -0
  142. package/dist/policy/access-provider.registry.js +15 -0
  143. package/dist/policy/access-question.d.ts +20 -0
  144. package/dist/policy/access-question.js +1 -0
  145. package/dist/policy/access-question.registry.d.ts +5 -0
  146. package/dist/policy/access-question.registry.js +19 -0
  147. package/dist/policy/access-question.runtime.d.ts +36 -0
  148. package/dist/policy/access-question.runtime.js +297 -0
  149. package/dist/policy/access-verb.table.d.ts +56 -0
  150. package/dist/policy/access-verb.table.js +21 -0
  151. package/dist/policy/access-verbs.d.ts +46 -0
  152. package/dist/policy/access-verbs.js +1 -0
  153. package/dist/policy/policy-admission.d.ts +20 -0
  154. package/dist/policy/policy-admission.js +409 -0
  155. package/dist/policy/policy-after-update.runtime.d.ts +79 -0
  156. package/dist/policy/policy-after-update.runtime.js +208 -0
  157. package/dist/policy/policy-condition.d.ts +15 -0
  158. package/dist/policy/policy-condition.js +36 -0
  159. package/dist/policy/policy-engine.d.ts +205 -0
  160. package/dist/policy/policy-engine.js +1 -0
  161. package/dist/policy/policy-named-rows.d.ts +18 -0
  162. package/dist/policy/policy-named-rows.js +51 -0
  163. package/dist/policy/policy-nested-write.runtime.d.ts +44 -0
  164. package/dist/policy/policy-nested-write.runtime.js +545 -0
  165. package/dist/policy/policy-read.runtime.d.ts +81 -0
  166. package/dist/policy/policy-read.runtime.js +503 -0
  167. package/dist/policy/policy-reference-write.runtime.d.ts +51 -0
  168. package/dist/policy/policy-reference-write.runtime.js +345 -0
  169. package/dist/policy/policy-request.d.ts +41 -0
  170. package/dist/policy/policy-request.js +63 -0
  171. package/dist/policy/policy-session.d.ts +106 -0
  172. package/dist/policy/policy-session.js +295 -0
  173. package/dist/policy/policy-startup.validator.d.ts +10 -0
  174. package/dist/policy/policy-startup.validator.js +112 -0
  175. package/dist/policy/policy-write.runtime.d.ts +39 -0
  176. package/dist/policy/policy-write.runtime.js +532 -0
  177. package/dist/prebuilt/core-version.generated.d.ts +2 -0
  178. package/dist/prebuilt/core-version.generated.js +1 -0
  179. package/dist/prebuilt/prebuilt-changes.d.ts +29 -0
  180. package/dist/prebuilt/prebuilt-changes.js +65 -0
  181. package/dist/prebuilt/prebuilt-contracts.d.ts +40 -0
  182. package/dist/prebuilt/prebuilt-contracts.emitter.d.ts +16 -0
  183. package/dist/prebuilt/prebuilt-contracts.emitter.js +50 -0
  184. package/dist/prebuilt/prebuilt-contracts.js +1 -0
  185. package/dist/prebuilt/prebuilt-contracts.loader.d.ts +19 -0
  186. package/dist/prebuilt/prebuilt-contracts.loader.js +77 -0
  187. package/dist/prebuilt/prebuilt-inputs.fingerprint.d.ts +16 -0
  188. package/dist/prebuilt/prebuilt-inputs.fingerprint.js +229 -0
  189. package/dist/protocol/absent-route.responder.d.ts +17 -34
  190. package/dist/protocol/absent-route.responder.js +53 -20
  191. package/dist/protocol/contract-document.responder.d.ts +5 -4
  192. package/dist/protocol/contract-document.responder.js +2 -2
  193. package/dist/protocol/http-request.decoder.d.ts +33 -13
  194. package/dist/protocol/http-request.decoder.js +34 -11
  195. package/dist/protocol/http-request.reader.d.ts +9 -6
  196. package/dist/protocol/http-request.reader.js +1 -0
  197. package/dist/protocol/http-response.encoder.d.ts +4 -4
  198. package/dist/protocol/http-response.encoder.js +94 -55
  199. package/dist/protocol/http-status.table.d.ts +2 -2
  200. package/dist/protocol/operation-response.guard.d.ts +2 -2
  201. package/dist/protocol/protocol-headers.d.ts +3 -3
  202. package/dist/protocol/protocol-surface.d.ts +10 -5
  203. package/dist/protocol/protocol-surface.js +7 -0
  204. package/dist/protocol/protocol.binder.d.ts +66 -28
  205. package/dist/protocol/protocol.binder.js +16 -10
  206. package/dist/protocol/protocol.handler.d.ts +34 -14
  207. package/dist/protocol/protocol.handler.js +122 -18
  208. package/dist/protocol/unmounted-route.error.d.ts +4 -4
  209. package/dist/protocol/unmounted-route.error.js +2 -2
  210. package/dist/runtime/caller-data.copier.d.ts +22 -7
  211. package/dist/runtime/caller-data.copier.js +30 -17
  212. package/dist/runtime/caller-data.door.d.ts +18 -11
  213. package/dist/runtime/caller-data.door.js +6 -4
  214. package/dist/runtime/computed-read-runtime.d.ts +12 -6
  215. package/dist/runtime/computed-read-runtime.js +271 -71
  216. package/dist/runtime/computed-value.error.d.ts +7 -6
  217. package/dist/runtime/computed-value.error.js +5 -4
  218. package/dist/runtime/context-executor.runtime.d.ts +60 -0
  219. package/dist/runtime/context-executor.runtime.js +277 -0
  220. package/dist/runtime/core-class.brand.d.ts +10 -0
  221. package/dist/runtime/core-class.brand.js +21 -0
  222. package/dist/runtime/create-requirement.d.ts +34 -79
  223. package/dist/runtime/create-requirement.js +205 -74
  224. package/dist/runtime/decimal.d.ts +16 -2
  225. package/dist/runtime/decimal.js +22 -1
  226. package/dist/runtime/diagnostics-reporter.d.ts +91 -30
  227. package/dist/runtime/diagnostics-reporter.js +37 -1
  228. package/dist/runtime/error-boundary.d.ts +73 -9
  229. package/dist/runtime/error-boundary.js +57 -19
  230. package/dist/runtime/error-guidance.d.ts +12 -0
  231. package/dist/runtime/error-guidance.js +1 -0
  232. package/dist/runtime/error.catalog.d.ts +49 -0
  233. package/dist/runtime/error.catalog.js +49 -0
  234. package/dist/runtime/execution-options.d.ts +18 -2
  235. package/dist/runtime/field-check.evaluator.d.ts +27 -0
  236. package/dist/runtime/field-check.evaluator.js +521 -0
  237. package/dist/runtime/field-compute.d.ts +65 -0
  238. package/dist/runtime/field-compute.js +1 -0
  239. package/dist/runtime/field-stage.plan.d.ts +15 -0
  240. package/dist/runtime/field-stage.plan.js +27 -0
  241. package/dist/runtime/field-stage.runtime.d.ts +37 -0
  242. package/dist/runtime/field-stage.runtime.js +147 -0
  243. package/dist/runtime/field-validator.runtime.d.ts +29 -0
  244. package/dist/runtime/field-validator.runtime.js +126 -0
  245. package/dist/runtime/framework-error-class.table.d.ts +33 -0
  246. package/dist/runtime/framework-error-class.table.js +25 -0
  247. package/dist/runtime/framework-error.d.ts +68 -8
  248. package/dist/runtime/framework-error.factory.d.ts +4 -0
  249. package/dist/runtime/framework-error.factory.js +15 -0
  250. package/dist/runtime/framework-error.js +32 -2
  251. package/dist/runtime/framework-warning.emitter.d.ts +6 -0
  252. package/dist/runtime/framework-warning.emitter.js +8 -0
  253. package/dist/runtime/interceptor-next.error.d.ts +5 -0
  254. package/dist/runtime/interceptor-next.error.js +6 -0
  255. package/dist/runtime/json-value.d.ts +11 -6
  256. package/dist/runtime/level-lifecycle.runtime.d.ts +26 -0
  257. package/dist/runtime/level-lifecycle.runtime.js +40 -0
  258. package/dist/runtime/misuse-reporter.d.ts +12 -12
  259. package/dist/runtime/mutation-planner.d.ts +20 -16
  260. package/dist/runtime/mutation-planner.js +48 -35
  261. package/dist/runtime/nested-write.walker.d.ts +32 -0
  262. package/dist/runtime/nested-write.walker.js +73 -0
  263. package/dist/runtime/operation-code.guidance.d.ts +6 -0
  264. package/dist/runtime/operation-code.guidance.js +167 -0
  265. package/dist/runtime/operation-request.d.ts +45 -11
  266. package/dist/runtime/operation-response.d.ts +17 -17
  267. package/dist/runtime/operation-runtime.d.ts +133 -27
  268. package/dist/runtime/operation-runtime.js +576 -84
  269. package/dist/runtime/outcome-mapper.d.ts +17 -5
  270. package/dist/runtime/outcome-mapper.js +23 -6
  271. package/dist/runtime/output-validator.d.ts +11 -11
  272. package/dist/runtime/output-validator.js +3 -3
  273. package/dist/runtime/owned-execution.registry.d.ts +16 -6
  274. package/dist/runtime/pipe-output.validator.d.ts +43 -18
  275. package/dist/runtime/pipe-output.validator.js +15 -13
  276. package/dist/runtime/pipeline.d.ts +221 -34
  277. package/dist/runtime/readonly-value.d.ts +47 -0
  278. package/dist/runtime/readonly-value.js +189 -0
  279. package/dist/runtime/referential-action.d.ts +1 -1
  280. package/dist/runtime/request-envelope.validator.d.ts +3 -3
  281. package/dist/runtime/request-envelope.validator.js +12 -7
  282. package/dist/runtime/request-id.d.ts +1 -1
  283. package/dist/runtime/request-state.d.ts +14 -0
  284. package/dist/runtime/request-state.js +1 -0
  285. package/dist/runtime/request-state.resolver.d.ts +12 -0
  286. package/dist/runtime/request-state.resolver.js +20 -0
  287. package/dist/runtime/scalar-runtime.d.ts +33 -25
  288. package/dist/runtime/scalar-runtime.js +105 -38
  289. package/dist/runtime/unsent-value.normalizer.d.ts +15 -0
  290. package/dist/runtime/unsent-value.normalizer.js +128 -0
  291. package/dist/transactions/deferred-operation.d.ts +35 -20
  292. package/dist/transactions/operation-arguments-encoder.d.ts +3 -3
  293. package/dist/transactions/operation-arguments-encoder.js +8 -3
  294. package/dist/transactions/operation-fingerprint.js +2 -2
  295. package/dist/transactions/sql-statement.d.ts +85 -0
  296. package/dist/transactions/sql-statement.js +47 -0
  297. package/dist/transactions/sql-statement.validator.d.ts +44 -0
  298. package/dist/transactions/sql-statement.validator.js +167 -0
  299. package/dist/transactions/transaction-envelope.d.ts +9 -8
  300. package/dist/transactions/transaction-integrity-error.d.ts +6 -6
  301. package/dist/transactions/transaction-integrity-error.js +7 -2
  302. package/dist/transactions/transaction-plan-assembler.d.ts +30 -13
  303. package/dist/transactions/transaction-plan-assembler.js +184 -32
  304. package/dist/transactions/transaction-plan-validator.d.ts +50 -25
  305. package/dist/transactions/transaction-plan-validator.js +96 -38
  306. package/dist/transactions/transaction-reference-collector.d.ts +5 -5
  307. package/dist/transactions/transaction-reference-resolver.d.ts +21 -3
  308. package/dist/transactions/transaction-reference-resolver.js +26 -14
  309. package/dist/transactions/transaction-reference-validator.d.ts +74 -4
  310. package/dist/transactions/transaction-reference-validator.js +129 -71
  311. package/dist/transactions/transaction-reference.d.ts +14 -14
  312. package/dist/transactions/transaction-reference.js +5 -0
  313. package/dist/transactions/transaction-request.d.ts +22 -9
  314. package/dist/transactions/transaction-response.d.ts +6 -6
  315. package/dist/transactions/transaction-runtime.d.ts +12 -8
  316. package/dist/transactions/transaction-runtime.js +218 -50
  317. package/dist/transactions/transaction-settlement.runtime.d.ts +52 -0
  318. package/dist/transactions/transaction-settlement.runtime.js +120 -0
  319. package/dist/transactions/transaction-slot-path-error.d.ts +4 -4
  320. package/dist/transactions/transaction-slot-path-error.js +4 -2
  321. package/dist/transactions/transaction-slot-writer.js +2 -2
  322. package/dist/transactions/transaction-stage.runtime.d.ts +83 -0
  323. package/dist/transactions/transaction-stage.runtime.js +126 -0
  324. package/package.json +11 -9
  325. package/src/runtime/field-check.evaluator.ts +720 -0
  326. package/dist/config/define-fields.d.ts +0 -42
  327. package/dist/config/define-fields.js +0 -3
  328. package/dist/config/framework-behaviors-config.d.ts +0 -30
  329. package/dist/config/framework-fields-config.d.ts +0 -42
  330. package/dist/config/framework-restrictions-config.d.ts +0 -142
  331. package/dist/json/avz.d.ts +0 -96
  332. package/dist/runtime/field-behavior.d.ts +0 -48
  333. /package/dist/{config/framework-behaviors-config.js → adapters/adapter-sql-statement.js} +0 -0
  334. /package/dist/{config/framework-fields-config.js → adapters/adapter-transaction-executor.interface.js} +0 -0
  335. /package/dist/{json → avz}/index.js +0 -0
  336. /package/dist/{json → avz}/json-shape.registry.js +0 -0
  337. /package/dist/config/{framework-restrictions-config.js → exact-framework-config.js} +0 -0
  338. /package/dist/{runtime/field-behavior.js → config/field-pipeline-config.js} +0 -0
@@ -1,50 +1,50 @@
1
- import type { ValidationIssue } from "../operations/validation-code.js";
1
+ import type { AvValidationIssue } from "../operations/validation-code.js";
2
2
  /** Every outcome code, as a runtime list. */
3
3
  export declare const OPERATION_CODES: readonly ["A1000", "A1001", "A1002", "A1003", "A1004", "A1005", "A1006", "A1007", "A1008", "A1009", "A2000", "A2001", "A2002", "A2003", "A2004", "A2005", "A2006", "A2007", "A2008", "A2009", "A2010", "A2011", "A2012", "A2013", "A2014", "A3000", "A3001", "A3002", "A3003", "A3004", "A4000", "A4001", "A4002"];
4
4
  /**
5
5
  * Every outcome code: `A1xxx` success, `A2xxx` caller error, `A3xxx` internal
6
6
  * failure, `A4xxx` authentication or permission denial.
7
7
  */
8
- export type OperationCode = (typeof OPERATION_CODES)[number];
8
+ export type AvOperationCode = (typeof OPERATION_CODES)[number];
9
9
  /** The success codes, `A1xxx`. */
10
- export type OperationSuccessCode = Extract<OperationCode, `A1${string}`>;
10
+ export type AvOperationSuccessCode = Extract<AvOperationCode, `A1${string}`>;
11
11
  /** Every outcome code that is not a success. */
12
- export type OperationErrorCode = Exclude<OperationCode, OperationSuccessCode>;
12
+ export type AvOperationErrorCode = Exclude<AvOperationCode, AvOperationSuccessCode>;
13
13
  /** Internal-failure family: nothing in the cause is caller-actionable. */
14
- export type OperationInternalErrorCode = Extract<OperationErrorCode, `A3${string}`>;
14
+ export type OperationInternalErrorCode = Extract<AvOperationErrorCode, `A3${string}`>;
15
15
  /** Why a request failed: a message, and the validation issues when there are any. */
16
- export type Cause = {
16
+ export type AvCause = {
17
17
  readonly message: string;
18
- readonly issues?: readonly ValidationIssue[];
18
+ readonly issues?: readonly AvValidationIssue[];
19
19
  readonly operation?: number;
20
20
  };
21
21
  /** The response envelope: `{ data, code, cause }`. */
22
- type OperationResponseEnvelope<TData, TCode extends OperationCode, TCause extends Cause | null> = {
22
+ type OperationResponseEnvelope<TData, TCode extends AvOperationCode, TCause extends AvCause | null> = {
23
23
  readonly data: TData;
24
24
  readonly code: TCode;
25
25
  readonly cause: TCause;
26
26
  };
27
27
  /** Success codes that carry response data (every success code but A1001). */
28
- export type OperationSuccessDataCode = Exclude<OperationSuccessCode, "A1001">;
28
+ export type AvOperationSuccessDataCode = Exclude<AvOperationSuccessCode, "A1001">;
29
29
  /** A success with data: `cause` is `null`. */
30
- export type OperationSuccessResponse<T> = OperationResponseEnvelope<T, OperationSuccessDataCode, null>;
30
+ export type AvOperationSuccessResponse<T> = OperationResponseEnvelope<T, AvOperationSuccessDataCode, null>;
31
31
  /** A success with no matching row (`A1001`): `data` and `cause` are `null`. */
32
- export type OperationNoMatchResponse = OperationResponseEnvelope<null, "A1001", null>;
32
+ export type AvOperationNoMatchResponse = OperationResponseEnvelope<null, "A1001", null>;
33
33
  /** A failure: `data` is `null` and `cause` says why. */
34
- export type OperationFailureResponse = OperationResponseEnvelope<null, OperationErrorCode, Cause>;
34
+ export type AvOperationFailureResponse = OperationResponseEnvelope<null, AvOperationErrorCode, AvCause>;
35
35
  /**
36
36
  * What an operation answers: success with data, a no-match success (`A1001`),
37
37
  * or a failure with a cause.
38
38
  */
39
- export type OperationResponse<T = unknown> = OperationSuccessResponse<T> | OperationNoMatchResponse | OperationFailureResponse;
39
+ export type AvOperationResponse<T = unknown> = AvOperationSuccessResponse<T> | AvOperationNoMatchResponse | AvOperationFailureResponse;
40
40
  /** Builds a success response with data. */
41
- export declare function operationSuccess<T>(data: T, code: OperationSuccessDataCode): OperationSuccessResponse<T>;
41
+ export declare function operationSuccess<T>(data: T, code: AvOperationSuccessDataCode): AvOperationSuccessResponse<T>;
42
42
  /** Builds the no-match success arm (A1001). */
43
- export declare function operationNoMatch(): OperationNoMatchResponse;
43
+ export declare function operationNoMatch(): AvOperationNoMatchResponse;
44
44
  /** Builds a failure response. */
45
- export declare function operationFailure(code: OperationErrorCode, cause: Cause): OperationFailureResponse;
45
+ export declare function operationFailure(code: AvOperationErrorCode, cause: AvCause): AvOperationFailureResponse;
46
46
  /** The one generic internal-failure text; every A3000 carries it. */
47
47
  export declare const INTERNAL_FAILURE_MESSAGE = "Internal framework error.";
48
48
  /** The response every internal failure (`A3000`) answers with. */
49
- export declare function internalFailure(): OperationFailureResponse;
49
+ export declare function internalFailure(): AvOperationFailureResponse;
50
50
  export {};
@@ -1,20 +1,27 @@
1
- import type { Adapter } from "../adapters/adapter.interface.js";
2
- import type { AdapterModel } from "../adapters/adapter-model.js";
3
- import type { AdapterOperationExecutor } from "../adapters/adapter-operation-executor.interface.js";
4
- import type { FrameworkContracts } from "../compiler/contract.compiler.js";
1
+ import type { AvAdapter } from "../adapters/adapter.interface.js";
2
+ import type { AvAdapterModel } from "../adapters/adapter-model.js";
3
+ import type { AvAdapterOperationExecutor } from "../adapters/adapter-operation-executor.interface.js";
4
+ import type { AvAdapterTransactionExecutor } from "../adapters/adapter-transaction-executor.interface.js";
5
+ import type { AvContracts } from "../compiler/contract.compiler.js";
5
6
  import type { ResolvedFrameworkConfig } from "../config/config.resolver.js";
6
- import type { Contract } from "../contracts/contract.js";
7
+ import type { AvRequestOrigin, RemoteRequestOrigin } from "../config/config-layer.js";
8
+ import type { AvContract } from "../contracts/contract.js";
7
9
  import type { OperationValidationOptions, SemanticOperationArguments } from "../operations/operation-validator.js";
8
- import type { FrameworkTransactionRequest } from "../transactions/transaction-request.js";
10
+ import { type PolicyCaller } from "../policy/policy-request.js";
11
+ import type { AvTransactionRequest } from "../transactions/transaction-request.js";
9
12
  import { type ArgumentsSource } from "./caller-data.door.js";
13
+ import { type ContextExecutor, type ExecutorScope } from "./context-executor.runtime.js";
10
14
  import { type RecordWriteFacts } from "./create-requirement.js";
11
- import type { DiagnosticsReporter } from "./diagnostics-reporter.js";
12
- import type { ClientProtocolIdentity, FrameworkOperationRequest, OperationExecutionRequest } from "./operation-request.js";
13
- import type { OperationFailureResponse, OperationResponse } from "./operation-response.js";
15
+ import { type DiagnosticsReporter } from "./diagnostics-reporter.js";
16
+ import { type OuterFailureLayer } from "./error-boundary.js";
17
+ import { type FieldStagePlan } from "./field-stage.plan.js";
18
+ import type { AvOperationRequest, AvRequestProtocol, StatefulOperationRequest } from "./operation-request.js";
19
+ import type { AvOperationFailureResponse, AvOperationResponse } from "./operation-response.js";
20
+ import type { AvState } from "./request-state.js";
14
21
  import { type NormalizationWrite } from "./scalar-runtime.js";
15
- export type OperationRuntimeDependencies<M extends AdapterModel> = {
16
- readonly adapter: Adapter<M>;
17
- readonly contracts: FrameworkContracts;
22
+ export type OperationRuntimeDependencies<M extends AvAdapterModel> = {
23
+ readonly adapter: AvAdapter<M>;
24
+ readonly contracts: AvContracts;
18
25
  readonly config: ResolvedFrameworkConfig<M>;
19
26
  };
20
27
  /**
@@ -22,13 +29,49 @@ export type OperationRuntimeDependencies<M extends AdapterModel> = {
22
29
  * single Adapter call goes through the executor passed beside it, so inside a
23
30
  * transaction plan the root Adapter is unreachable by type.
24
31
  */
25
- export type OperationPipelineDependencies<M extends AdapterModel> = Omit<OperationRuntimeDependencies<M>, "adapter"> & {
32
+ export type OperationPipelineDependencies<M extends AvAdapterModel> = Omit<OperationRuntimeDependencies<M>, "adapter"> & {
26
33
  /**
27
34
  * The Adapter's create requirements and referential edges, read once at
28
35
  * construction.
29
36
  */
30
37
  readonly recordWrites: RecordWriteFacts;
38
+ /** Builds every stage's ctx: its `$` facts and the executor. */
39
+ readonly contexts: ContextExecutor<M>;
40
+ /** Each origin's field-stage dispatch, planned at construction. */
41
+ readonly fieldStages: {
42
+ readonly [O in AvRequestOrigin]: FieldStagePlan;
43
+ };
31
44
  };
45
+ /**
46
+ * Where one operation's Adapter call runs: standalone, through the Adapter, or
47
+ * inside an open transaction, through its executor.
48
+ */
49
+ type OperationBinding<M extends AvAdapterModel> = {
50
+ readonly kind: "standalone";
51
+ readonly executor: AvAdapterOperationExecutor<M>;
52
+ } | {
53
+ readonly kind: "transaction";
54
+ readonly executor: AvAdapterTransactionExecutor<M>;
55
+ /**
56
+ * A plan step's (or a forced call's) Resource transaction filters: the
57
+ * outer layer an error the step's own filters leave unhandled is handed
58
+ * to, answered once the transaction interceptors have unwound (the rc.1
59
+ * follow-up ruling; the independent re-check). Absent for a ctx call.
60
+ */
61
+ readonly outer?: OuterFailureLayer;
62
+ };
63
+ /** `request` with its state settled. */
64
+ export declare function withRequestState<Request extends {
65
+ readonly state?: AvState;
66
+ }>(request: Request): Request & {
67
+ readonly state: AvState;
68
+ };
69
+ /**
70
+ * Builds what every operation's pipeline shares, the ctx executor included: its
71
+ * raw calls run the application's operation path with every developer stage
72
+ * removed.
73
+ */
74
+ export declare function createPipelineDependencies<M extends AvAdapterModel>(dependencies: OperationRuntimeDependencies<M>, model: M): OperationPipelineDependencies<M>;
32
75
  /**
33
76
  * The executor core owns no diagnostics channel: the framework factory owns
34
77
  * it and hands in one reporter already bound to this request, so every
@@ -37,33 +80,96 @@ export type OperationPipelineDependencies<M extends AdapterModel> = Omit<Operati
37
80
  * request's arguments are the caller's own objects, copied at the door, or data
38
81
  * no caller holds (see {@link ArgumentsSource}).
39
82
  */
40
- export type FrameworkOperationExecutor = (request: FrameworkOperationRequest, report: DiagnosticsReporter, source: ArgumentsSource) => Promise<OperationResponse>;
83
+ export type FrameworkOperationExecutor = (request: AvOperationRequest, report: DiagnosticsReporter, source: ArgumentsSource,
84
+ /** The principal an application call runs as (`{ as }`), when it names one. */
85
+ caller?: PolicyCaller) => Promise<AvOperationResponse>;
41
86
  /** Selects the Contract of the request's origin. */
42
- export declare function activeContract(contracts: FrameworkContracts, request: FrameworkOperationRequest | FrameworkTransactionRequest): Contract;
87
+ export declare function activeContract(contracts: AvContracts, request: AvOperationRequest | AvTransactionRequest): AvContract;
43
88
  /** Creates the transport-independent operation executor owned by core. */
44
- export declare function createOperationRuntime<M extends AdapterModel>(dependencies: OperationRuntimeDependencies<M>): FrameworkOperationExecutor;
89
+ export declare function createOperationRuntime<M extends AvAdapterModel>(dependencies: OperationRuntimeDependencies<M>, pipelineDependencies: OperationPipelineDependencies<M>): FrameworkOperationExecutor;
45
90
  /** Validates the request-level protocol identity. */
46
- export declare function validateProtocolIdentity(contracts: FrameworkContracts, request: FrameworkOperationRequest | FrameworkTransactionRequest): OperationFailureResponse | undefined;
91
+ export declare function validateProtocolIdentity(contracts: AvContracts, request: AvOperationRequest | AvTransactionRequest): AvOperationFailureResponse | undefined;
47
92
  /**
48
- * The stale-client check on one client protocol identity: the protocol version first
49
- * (`A2006`), then the ClientContract hash (`A2005`). Exact match only. The one
93
+ * The stale-client check on one remote protocol identity: the protocol version first
94
+ * (`A2006`), then the hash of the origin's Contract (`A2005`): the ClientContract's
95
+ * for a client, the Agent Contract's for an agent. Exact match only. The one
50
96
  * implementation — the protocol's decoders and absence answers
51
97
  * (`@aventara/core/protocol`) call it too, so a stale client hears the same envelope
52
98
  * whichever layer answers.
53
99
  */
54
- export declare function protocolIdentityFailure(contracts: FrameworkContracts, protocol: ClientProtocolIdentity): OperationFailureResponse | undefined;
55
- export type ValidatedOperationArguments = {
100
+ export declare function protocolIdentityFailure(contracts: AvContracts, protocol: AvRequestProtocol, origin: RemoteRequestOrigin): AvOperationFailureResponse | undefined;
101
+ type ValidatedOperationArguments = {
56
102
  readonly ok: true;
57
103
  readonly arguments: SemanticOperationArguments;
58
104
  } | {
59
105
  readonly ok: false;
60
- readonly response: OperationFailureResponse;
106
+ readonly response: AvOperationFailureResponse;
61
107
  };
62
108
  /** Validates one operation's arguments through the Framework Validation Layer. */
63
- export declare function validateOperationRequest(contract: Contract, request: FrameworkOperationRequest, options?: OperationValidationOptions, write?: NormalizationWrite): ValidatedOperationArguments;
109
+ export declare function validateOperationRequest(contract: AvContract, request: AvOperationRequest, options?: OperationValidationOptions, write?: NormalizationWrite): ValidatedOperationArguments;
110
+ /** The subject a refused output of an operation's pipes is reported under at a plan step. */
111
+ export declare const STEP_PIPES = "Pipes";
112
+ /**
113
+ * Every sent field's path. A `$ref` is an object of `$`-keys, which no field
114
+ * pipe or validator takes, so a plan step's literal values before BEGIN are
115
+ * every field too, wherever a pipe left a reference or a literal.
116
+ */
117
+ export declare const EVERY_FIELD: () => boolean;
118
+ /**
119
+ * What admission leaves: the deep-frozen arguments every later stage reads, and
120
+ * whether a pipe or a field pipe changed them; or the answer that refused the
121
+ * operation.
122
+ */
123
+ export type AdmittedOperation = {
124
+ readonly ok: true;
125
+ readonly args: unknown;
126
+ readonly piped: boolean;
127
+ } | {
128
+ readonly ok: false;
129
+ readonly response: AvOperationFailureResponse;
130
+ };
131
+ /** Which sent values an operation's field stages and validators take, and how its pipe output is checked. */
132
+ type AdmissionScope = {
133
+ /**
134
+ * The sent values the field pipes and validators take: every one for a single
135
+ * call and for a plan step before BEGIN (an unresolved `$ref` is an object of
136
+ * `$`-keys, which they never take), its resolved `$ref` values at the step.
137
+ */
138
+ readonly select: (path: readonly (string | number)[]) => boolean;
139
+ /** Before BEGIN a plan step's `$ref` slots are unresolved: these admit them. */
140
+ readonly validation?: OperationValidationOptions;
141
+ /**
142
+ * A plan step or a forced call, admitted before BEGIN: the validators judge
143
+ * there the sent values no later stage can change (a field with no write
144
+ * compute stage of its record's phase), so a caller's refusal opens no
145
+ * transaction. Everything is judged again after write compute.
146
+ */
147
+ readonly beforeBegin?: boolean;
148
+ };
149
+ /**
150
+ * Runs an operation's admission — its guards and pipes, and before BEGIN the
151
+ * validators of the values nothing after it changes — and answers the
152
+ * deep-frozen arguments the rest of the operation reads, or the refusal.
153
+ */
154
+ export declare function admitOperation<M extends AvAdapterModel>(dependencies: OperationPipelineDependencies<M>, request: StatefulOperationRequest, contract: AvContract, args: unknown, argumentsPath: readonly (string | number)[], report: DiagnosticsReporter, scope: ExecutorScope<M>, admission?: AdmissionScope): Promise<AdmittedOperation>;
155
+ /** How a plan step's arguments were changed between their admission and the step. */
156
+ type StepChanges = {
157
+ /** The sent `$ref` values written at this step: their field stages run now. */
158
+ readonly written: (path: readonly (string | number)[]) => boolean;
159
+ /** A transaction pipe changed the step: every value is judged again. */
160
+ readonly transactionPiped: boolean;
161
+ /** An operation pipe ran before BEGIN on a step with `$ref`s: the resolved arguments are checked again. */
162
+ readonly pipedAroundReferences: boolean;
163
+ };
164
+ /**
165
+ * A plan step's (or a forced call's) arguments at the step: resolved values
166
+ * through their field pipes, and re-checked when a stage changed them.
167
+ */
168
+ export declare function prepareStep<M extends AvAdapterModel>(dependencies: OperationPipelineDependencies<M>, request: StatefulOperationRequest, contract: AvContract, args: unknown, argumentsPath: readonly (string | number)[], report: DiagnosticsReporter, executor: AvAdapterTransactionExecutor<M>, changes: StepChanges, outer: OuterFailureLayer): Promise<AdmittedOperation>;
64
169
  /**
65
- * Everything after the Framework Validation Layer: the developer/runtime path
66
- * wrapped in the post-validation error boundary. Validation failures never
67
- * reach this function, so developer filters never see them.
170
+ * Everything after admission: write compute and the lifecycle around the
171
+ * Adapter call, wrapped in the post-validation error boundary. Validation
172
+ * failures never reach this function, so developer filters never see them.
68
173
  */
69
- export declare function executeValidatedOperation<M extends AdapterModel>(dependencies: OperationPipelineDependencies<M>, request: OperationExecutionRequest, contract: Contract, validatedArguments: unknown, argumentsPath: readonly (string | number)[], executor: AdapterOperationExecutor<M>, report: DiagnosticsReporter): Promise<OperationResponse>;
174
+ export declare function executeAdmittedOperation<M extends AvAdapterModel>(dependencies: OperationPipelineDependencies<M>, request: StatefulOperationRequest, contract: AvContract, admittedArguments: unknown, argumentsPath: readonly (string | number)[], binding: OperationBinding<M>, report: DiagnosticsReporter): Promise<AvOperationResponse>;
175
+ export {};