@aventara/core 1.0.0-rc.1 → 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 (228) hide show
  1. package/CHANGELOG.md +943 -16
  2. package/ERRORS.md +142 -0
  3. package/README.md +274 -16
  4. package/dist/adapters/adapter-discovery-diagnostic.guidance.d.ts +6 -0
  5. package/dist/adapters/adapter-discovery-diagnostic.guidance.js +7 -0
  6. package/dist/adapters/adapter-field.d.ts +22 -0
  7. package/dist/adapters/adapter-identifier.d.ts +9 -0
  8. package/dist/adapters/adapter-identifier.js +6 -1
  9. package/dist/adapters/adapter-model.d.ts +9 -0
  10. package/dist/adapters/adapter-operation.d.ts +18 -3
  11. package/dist/adapters/adapter-resource.d.ts +5 -0
  12. package/dist/adapters/adapter.interface.d.ts +10 -0
  13. package/dist/avz/avz.d.ts +1 -1
  14. package/dist/avz/json-shape.registry.d.ts +2 -1
  15. package/dist/compiler/contract-compiler-diagnostic.guidance.d.ts +6 -0
  16. package/dist/compiler/contract-compiler-diagnostic.guidance.js +97 -0
  17. package/dist/compiler/contract.compiler.d.ts +6 -0
  18. package/dist/compiler/contract.compiler.js +227 -24
  19. package/dist/compiler/managed-elsewhere.projector.d.ts +52 -0
  20. package/dist/compiler/managed-elsewhere.projector.js +179 -0
  21. package/dist/compiler/managed-elsewhere.validator.d.ts +9 -0
  22. package/dist/compiler/managed-elsewhere.validator.js +74 -0
  23. package/dist/config/computed-fields.d.ts +62 -0
  24. package/dist/config/computed-fields.js +73 -0
  25. package/dist/config/config-diagnostic.guidance.d.ts +6 -0
  26. package/dist/config/config-diagnostic.guidance.js +32 -0
  27. package/dist/config/config.resolver.d.ts +24 -0
  28. package/dist/config/config.resolver.js +65 -0
  29. package/dist/config/config.validator.js +222 -8
  30. package/dist/config/define-resource.d.ts +1 -5
  31. package/dist/config/entrypoint.normalizer.d.ts +3 -2
  32. package/dist/config/exact-framework-config.d.ts +67 -22
  33. package/dist/config/field-compute.resolver.d.ts +2 -0
  34. package/dist/config/field-compute.resolver.js +8 -0
  35. package/dist/config/framework-config.d.ts +53 -15
  36. package/dist/config/framework-resources-config.d.ts +25 -14
  37. package/dist/config/pipeline-config.d.ts +4 -4
  38. package/dist/config/pipeline-tree.resolver.d.ts +2 -2
  39. package/dist/contracts/access-route.rules.d.ts +10 -0
  40. package/dist/contracts/access-route.rules.js +45 -0
  41. package/dist/contracts/capability.d.ts +26 -1
  42. package/dist/contracts/capability.js +20 -0
  43. package/dist/contracts/client-contract-structure.validator.d.ts +301 -89
  44. package/dist/contracts/client-contract-structure.validator.js +37 -2
  45. package/dist/contracts/contract-access.d.ts +29 -0
  46. package/dist/contracts/contract-access.js +1 -0
  47. package/dist/contracts/contract-canonicalizer.d.ts +9 -1
  48. package/dist/contracts/contract-canonicalizer.js +30 -4
  49. package/dist/contracts/contract-hash.d.ts +0 -1
  50. package/dist/contracts/contract-hash.js +1 -1
  51. package/dist/contracts/contract.d.ts +27 -1
  52. package/dist/contracts/field.d.ts +58 -1
  53. package/dist/contracts/json-schema.projector.d.ts +11 -0
  54. package/dist/contracts/json-schema.projector.js +78 -0
  55. package/dist/contracts/scalar-value-type.d.ts +3 -1
  56. package/dist/framework/access-facade.d.ts +116 -0
  57. package/dist/framework/access-facade.js +120 -0
  58. package/dist/framework/contract-view.d.ts +120 -16
  59. package/dist/framework/framework-construction.error.d.ts +14 -4
  60. package/dist/framework/framework-construction.error.js +18 -2
  61. package/dist/framework/framework.d.ts +26 -5
  62. package/dist/framework/framework.factory.d.ts +1 -1
  63. package/dist/framework/framework.factory.js +115 -23
  64. package/dist/framework/operation-facade.d.ts +80 -13
  65. package/dist/framework/operation-facade.js +2 -1
  66. package/dist/index.d.ts +17 -5
  67. package/dist/index.js +1 -0
  68. package/dist/internal.d.ts +7 -2
  69. package/dist/internal.js +6 -0
  70. package/dist/operations/database-refusal.d.ts +51 -0
  71. package/dist/operations/database-refusal.js +45 -0
  72. package/dist/operations/operation-arguments.d.ts +148 -60
  73. package/dist/operations/operation-call.d.ts +9 -5
  74. package/dist/operations/operation-result.d.ts +6 -4
  75. package/dist/operations/operation-validator-core.js +159 -36
  76. package/dist/operations/operation-validator.d.ts +1 -1
  77. package/dist/operations/structural-limits.walker.d.ts +1 -1
  78. package/dist/operations/validation-code.guidance.d.ts +6 -0
  79. package/dist/operations/validation-code.guidance.js +90 -0
  80. package/dist/operations/write-scope.resolver.d.ts +4 -0
  81. package/dist/operations/write-scope.resolver.js +2 -0
  82. package/dist/policy/access-provider.interface.d.ts +91 -0
  83. package/dist/policy/access-provider.interface.js +1 -0
  84. package/dist/policy/access-provider.registry.d.ts +17 -0
  85. package/dist/policy/access-provider.registry.js +15 -0
  86. package/dist/policy/access-question.d.ts +20 -0
  87. package/dist/policy/access-question.js +1 -0
  88. package/dist/policy/access-question.registry.d.ts +5 -0
  89. package/dist/policy/access-question.registry.js +19 -0
  90. package/dist/policy/access-question.runtime.d.ts +36 -0
  91. package/dist/policy/access-question.runtime.js +297 -0
  92. package/dist/policy/access-verb.table.d.ts +56 -0
  93. package/dist/policy/access-verb.table.js +21 -0
  94. package/dist/policy/access-verbs.d.ts +46 -0
  95. package/dist/policy/access-verbs.js +1 -0
  96. package/dist/policy/policy-admission.d.ts +20 -0
  97. package/dist/policy/policy-admission.js +409 -0
  98. package/dist/policy/policy-after-update.runtime.d.ts +79 -0
  99. package/dist/policy/policy-after-update.runtime.js +208 -0
  100. package/dist/policy/policy-condition.d.ts +15 -0
  101. package/dist/policy/policy-condition.js +36 -0
  102. package/dist/policy/policy-engine.d.ts +205 -0
  103. package/dist/policy/policy-engine.js +1 -0
  104. package/dist/policy/policy-named-rows.d.ts +18 -0
  105. package/dist/policy/policy-named-rows.js +51 -0
  106. package/dist/policy/policy-nested-write.runtime.d.ts +44 -0
  107. package/dist/policy/policy-nested-write.runtime.js +545 -0
  108. package/dist/policy/policy-read.runtime.d.ts +81 -0
  109. package/dist/policy/policy-read.runtime.js +503 -0
  110. package/dist/policy/policy-reference-write.runtime.d.ts +51 -0
  111. package/dist/policy/policy-reference-write.runtime.js +345 -0
  112. package/dist/policy/policy-request.d.ts +41 -0
  113. package/dist/policy/policy-request.js +63 -0
  114. package/dist/policy/policy-session.d.ts +106 -0
  115. package/dist/policy/policy-session.js +295 -0
  116. package/dist/policy/policy-startup.validator.d.ts +10 -0
  117. package/dist/policy/policy-startup.validator.js +112 -0
  118. package/dist/policy/policy-write.runtime.d.ts +39 -0
  119. package/dist/policy/policy-write.runtime.js +532 -0
  120. package/dist/prebuilt/core-version.generated.d.ts +2 -0
  121. package/dist/prebuilt/core-version.generated.js +1 -0
  122. package/dist/prebuilt/prebuilt-changes.d.ts +29 -0
  123. package/dist/prebuilt/prebuilt-changes.js +65 -0
  124. package/dist/prebuilt/prebuilt-contracts.d.ts +40 -0
  125. package/dist/prebuilt/prebuilt-contracts.emitter.d.ts +16 -0
  126. package/dist/prebuilt/prebuilt-contracts.emitter.js +50 -0
  127. package/dist/prebuilt/prebuilt-contracts.js +1 -0
  128. package/dist/prebuilt/prebuilt-contracts.loader.d.ts +19 -0
  129. package/dist/prebuilt/prebuilt-contracts.loader.js +77 -0
  130. package/dist/prebuilt/prebuilt-inputs.fingerprint.d.ts +16 -0
  131. package/dist/prebuilt/prebuilt-inputs.fingerprint.js +229 -0
  132. package/dist/protocol/absent-route.responder.d.ts +9 -27
  133. package/dist/protocol/absent-route.responder.js +36 -3
  134. package/dist/protocol/contract-document.responder.d.ts +2 -1
  135. package/dist/protocol/http-request.decoder.d.ts +19 -3
  136. package/dist/protocol/http-request.decoder.js +24 -1
  137. package/dist/protocol/http-request.reader.d.ts +6 -3
  138. package/dist/protocol/http-request.reader.js +1 -0
  139. package/dist/protocol/http-response.encoder.js +2 -2
  140. package/dist/protocol/protocol-headers.d.ts +3 -3
  141. package/dist/protocol/protocol-surface.d.ts +6 -1
  142. package/dist/protocol/protocol-surface.js +7 -0
  143. package/dist/protocol/protocol.binder.d.ts +16 -1
  144. package/dist/protocol/protocol.binder.js +4 -1
  145. package/dist/protocol/protocol.handler.d.ts +12 -1
  146. package/dist/protocol/protocol.handler.js +86 -17
  147. package/dist/runtime/caller-data.copier.d.ts +18 -3
  148. package/dist/runtime/caller-data.copier.js +21 -8
  149. package/dist/runtime/caller-data.door.d.ts +13 -6
  150. package/dist/runtime/computed-read-runtime.d.ts +6 -1
  151. package/dist/runtime/computed-read-runtime.js +232 -45
  152. package/dist/runtime/computed-value.error.d.ts +3 -2
  153. package/dist/runtime/computed-value.error.js +3 -2
  154. package/dist/runtime/context-executor.runtime.d.ts +4 -3
  155. package/dist/runtime/context-executor.runtime.js +4 -2
  156. package/dist/runtime/core-class.brand.d.ts +10 -0
  157. package/dist/runtime/core-class.brand.js +21 -0
  158. package/dist/runtime/create-requirement.d.ts +31 -5
  159. package/dist/runtime/create-requirement.js +129 -21
  160. package/dist/runtime/decimal.d.ts +14 -0
  161. package/dist/runtime/decimal.js +21 -0
  162. package/dist/runtime/diagnostics-reporter.d.ts +44 -9
  163. package/dist/runtime/diagnostics-reporter.js +13 -1
  164. package/dist/runtime/error-boundary.d.ts +9 -2
  165. package/dist/runtime/error-boundary.js +12 -0
  166. package/dist/runtime/error-guidance.d.ts +12 -0
  167. package/dist/runtime/error-guidance.js +1 -0
  168. package/dist/runtime/error.catalog.d.ts +49 -0
  169. package/dist/runtime/error.catalog.js +49 -0
  170. package/dist/runtime/execution-options.d.ts +8 -0
  171. package/dist/runtime/field-check.evaluator.d.ts +0 -2
  172. package/dist/runtime/field-check.evaluator.js +1 -1
  173. package/dist/runtime/field-compute.d.ts +11 -10
  174. package/dist/runtime/field-stage.runtime.d.ts +3 -1
  175. package/dist/runtime/field-stage.runtime.js +8 -4
  176. package/dist/runtime/field-validator.runtime.d.ts +19 -1
  177. package/dist/runtime/field-validator.runtime.js +47 -8
  178. package/dist/runtime/framework-error.js +9 -0
  179. package/dist/runtime/framework-warning.emitter.d.ts +6 -0
  180. package/dist/runtime/framework-warning.emitter.js +8 -0
  181. package/dist/runtime/json-value.d.ts +10 -5
  182. package/dist/runtime/level-lifecycle.runtime.d.ts +4 -3
  183. package/dist/runtime/level-lifecycle.runtime.js +3 -5
  184. package/dist/runtime/mutation-planner.d.ts +1 -6
  185. package/dist/runtime/mutation-planner.js +3 -14
  186. package/dist/runtime/operation-code.guidance.d.ts +6 -0
  187. package/dist/runtime/operation-code.guidance.js +167 -0
  188. package/dist/runtime/operation-request.d.ts +16 -9
  189. package/dist/runtime/operation-runtime.d.ts +35 -17
  190. package/dist/runtime/operation-runtime.js +220 -49
  191. package/dist/runtime/outcome-mapper.d.ts +2 -1
  192. package/dist/runtime/output-validator.d.ts +1 -1
  193. package/dist/runtime/owned-execution.registry.d.ts +13 -3
  194. package/dist/runtime/pipe-output.validator.d.ts +10 -0
  195. package/dist/runtime/pipe-output.validator.js +4 -2
  196. package/dist/runtime/pipeline.d.ts +47 -22
  197. package/dist/runtime/readonly-value.d.ts +20 -5
  198. package/dist/runtime/readonly-value.js +74 -26
  199. package/dist/runtime/referential-action.d.ts +1 -1
  200. package/dist/runtime/scalar-runtime.d.ts +4 -11
  201. package/dist/runtime/scalar-runtime.js +91 -22
  202. package/dist/runtime/unsent-value.normalizer.d.ts +15 -0
  203. package/dist/runtime/unsent-value.normalizer.js +128 -0
  204. package/dist/transactions/operation-arguments-encoder.js +8 -3
  205. package/dist/transactions/operation-fingerprint.js +2 -2
  206. package/dist/transactions/sql-statement.d.ts +10 -2
  207. package/dist/transactions/sql-statement.validator.d.ts +2 -2
  208. package/dist/transactions/sql-statement.validator.js +38 -5
  209. package/dist/transactions/transaction-envelope.d.ts +5 -4
  210. package/dist/transactions/transaction-integrity-error.js +2 -0
  211. package/dist/transactions/transaction-plan-assembler.d.ts +12 -5
  212. package/dist/transactions/transaction-plan-assembler.js +48 -10
  213. package/dist/transactions/transaction-plan-validator.d.ts +23 -7
  214. package/dist/transactions/transaction-plan-validator.js +27 -1
  215. package/dist/transactions/transaction-reference-resolver.d.ts +3 -2
  216. package/dist/transactions/transaction-reference-validator.d.ts +43 -3
  217. package/dist/transactions/transaction-reference-validator.js +83 -57
  218. package/dist/transactions/transaction-reference.d.ts +1 -1
  219. package/dist/transactions/transaction-reference.js +5 -0
  220. package/dist/transactions/transaction-request.d.ts +8 -8
  221. package/dist/transactions/transaction-runtime.d.ts +5 -2
  222. package/dist/transactions/transaction-runtime.js +79 -27
  223. package/dist/transactions/transaction-settlement.runtime.d.ts +4 -3
  224. package/dist/transactions/transaction-slot-path-error.js +2 -0
  225. package/dist/transactions/transaction-stage.runtime.d.ts +5 -3
  226. package/dist/transactions/transaction-stage.runtime.js +7 -4
  227. package/package.json +6 -5
  228. package/src/runtime/field-check.evaluator.ts +1 -1
@@ -2,7 +2,9 @@ import type { AvContract } from "../contracts/contract.js";
2
2
  import type { AvField } from "../contracts/field.js";
3
3
  import type { AvValidationIssue } from "../operations/validation-code.js";
4
4
  import type { AvOperationFailureResponse } from "../runtime/operation-response.js";
5
+ import type { OperationFingerprint } from "./deferred-operation.js";
5
6
  import type { CandidateTransactionOperation, TransactionReferenceSlot, ValidatedTransactionStep } from "./transaction-plan-validator.js";
7
+ import type { TransactionReferenceCandidateSlot } from "./transaction-reference-collector.js";
6
8
  type Path = readonly (string | number)[];
7
9
  type ReferenceValidationResult = {
8
10
  readonly ok: true;
@@ -20,10 +22,8 @@ export declare function invalidSourceIndexIssue(operationPath: Path): AvValidati
20
22
  * integer naming a step before the referencing one (`V1016`).
21
23
  */
22
24
  export declare function referenceSourceAt(earlier: readonly ValidatedTransactionStep[], sourceIndex: unknown, referencingIndex: number): ValidatedTransactionStep | undefined;
23
- /** The `V1010` refusal of a reference whose source is an `appTx.$sql` step. */
24
- export declare function sqlSourceIssue(pathPath: Path): AvValidationIssue;
25
25
  /** The field a reference reads from its source step, or why it cannot read one. */
26
- export type ReferenceSourceRead = {
26
+ type ReferenceSourceRead = {
27
27
  readonly ok: true;
28
28
  readonly field: AvField<AvContract>;
29
29
  } | {
@@ -39,6 +39,46 @@ export type ReferenceSourceRead = {
39
39
  * the source's to read. Assignability to a destination is the caller's.
40
40
  */
41
41
  export declare function referenceSourceField(source: ValidatedTransactionStep, segment: string, pathPath: Path): ReferenceSourceRead;
42
+ /** A `$ref` control object read through: its source step, field and fingerprint. */
43
+ type ReferenceCandidateInspection = {
44
+ readonly ok: true;
45
+ readonly source: Extract<ValidatedTransactionStep, {
46
+ kind: "operation";
47
+ }>;
48
+ readonly segment: string;
49
+ readonly fingerprint: OperationFingerprint;
50
+ readonly field: AvField<AvContract>;
51
+ /** The candidate's `path` member's own path, where a type refusal stands. */
52
+ readonly pathPath: Path;
53
+ } | {
54
+ readonly ok: false;
55
+ readonly issue: AvValidationIssue;
56
+ };
57
+ /**
58
+ * Inspects one `$ref` control object standing at `slotPath` of step
59
+ * `referencingIndex`, through property descriptors only: its shape, its source
60
+ * step (an earlier one, never a SQL step), the source's fingerprint and the one
61
+ * field its path reads from the source's projection. Assignability to the
62
+ * destination is the caller's. Shared by an operation step's slots and an
63
+ * `appTx.$sql` value, so both refuse a malformed reference alike.
64
+ */
65
+ export declare function inspectReferenceCandidate(candidate: unknown, slotPath: Path, earlier: readonly ValidatedTransactionStep[], referencingIndex: number): ReferenceCandidateInspection;
66
+ /** The validated slots of a step's candidates, or the first one's refusal. */
67
+ type ReferenceSlotsValidation = {
68
+ readonly ok: true;
69
+ readonly references: readonly TransactionReferenceSlot[];
70
+ } | {
71
+ readonly ok: false;
72
+ readonly issue: AvValidationIssue;
73
+ };
74
+ /**
75
+ * Judges every `$ref` candidate of step `index` by the Framework Validation
76
+ * Layer's reference rules — its shape, an earlier non-SQL source step, that
77
+ * step's fingerprint, a field of its single-row projection, and type
78
+ * compatibility with the slot it stands in — and answers the validated slots,
79
+ * or the first refusal.
80
+ */
81
+ export declare function validateReferenceSlots(candidates: readonly TransactionReferenceCandidateSlot[], earlier: readonly ValidatedTransactionStep[], index: number): ReferenceSlotsValidation;
42
82
  /** Validates every passive reference candidate before operation fingerprinting. */
43
83
  export declare function validateTransactionReferences(operation: CandidateTransactionOperation, earlier: readonly ValidatedTransactionStep[]): ReferenceValidationResult;
44
84
  export {};
@@ -179,7 +179,7 @@ export function referenceSourceAt(earlier, sourceIndex, referencingIndex) {
179
179
  ? source
180
180
  : undefined;
181
181
  }
182
- export function sqlSourceIssue(pathPath) {
182
+ function sqlSourceIssue(pathPath) {
183
183
  return validationIssue("V1010", pathPath, "Transaction reference source is a SQL step, whose rows cannot be referenced.");
184
184
  }
185
185
  export function referenceSourceField(source, segment, pathPath) {
@@ -212,66 +212,84 @@ export function referenceSourceField(source, segment, pathPath) {
212
212
  }
213
213
  const CANDIDATE_KEYS = new Set(["$ref"]);
214
214
  const REFERENCE_KEYS = new Set(["operation", "fingerprint", "path"]);
215
- export function validateTransactionReferences(operation, earlier) {
215
+ export function inspectReferenceCandidate(candidate, slotPath, earlier, referencingIndex) {
216
+ const refused = (issue) => ({ ok: false, issue });
217
+ const candidateInspection = inspectControlObject(candidate, CANDIDATE_KEYS, slotPath, validationIssue("V1001", slotPath, "Reference control value must be an object."));
218
+ if (!candidateInspection.ok) {
219
+ return refused(candidateInspection.issue);
220
+ }
221
+ const refPath = [...slotPath, "$ref"];
222
+ const refProperty = inspectOwnDataProperty(candidateInspection.value, "$ref", refPath, "V1001", slotPath);
223
+ if (!refProperty.ok) {
224
+ return refused(refProperty.issue);
225
+ }
226
+ const operationPath = [...refPath, "operation"];
227
+ const referenceInspection = inspectControlObject(refProperty.value, REFERENCE_KEYS, refPath, validationIssue("V1016", operationPath, "Transaction reference operation index is invalid."));
228
+ if (!referenceInspection.ok) {
229
+ return refused(referenceInspection.issue);
230
+ }
231
+ const sourceIndexProperty = inspectOwnDataProperty(referenceInspection.value, "operation", operationPath, "V1016", refPath);
232
+ if (!sourceIndexProperty.ok) {
233
+ return refused(sourceIndexProperty.issue);
234
+ }
235
+ const source = referenceSourceAt(earlier, sourceIndexProperty.value, referencingIndex);
236
+ if (source === undefined) {
237
+ return refused(invalidSourceIndexIssue(operationPath));
238
+ }
239
+ if (source.kind === "sql") {
240
+ return refused(sqlSourceIssue([...refPath, "path"]));
241
+ }
242
+ const fingerprintPath = [...refPath, "fingerprint"];
243
+ const fingerprintProperty = inspectOwnDataProperty(referenceInspection.value, "fingerprint", fingerprintPath, "V1000", refPath);
244
+ if (!fingerprintProperty.ok) {
245
+ return refused(fingerprintProperty.issue);
246
+ }
247
+ const fingerprint = fingerprintProperty.value;
248
+ if (!isOperationFingerprint(fingerprint) ||
249
+ fingerprint !== source.fingerprint) {
250
+ return refused(validationIssue("V1017", fingerprintPath, "Transaction reference fingerprint does not match its source operation."));
251
+ }
252
+ const pathPath = [...refPath, "path"];
253
+ const pathProperty = inspectOwnDataProperty(referenceInspection.value, "path", pathPath, "V1010", refPath);
254
+ if (!pathProperty.ok) {
255
+ return refused(pathProperty.issue);
256
+ }
257
+ const pathInspection = inspectPathTuple(pathProperty.value, pathPath);
258
+ if (!pathInspection.ok) {
259
+ return refused(pathInspection.issue);
260
+ }
261
+ const { segment } = pathInspection;
262
+ if (containsUnpairedSurrogate(segment)) {
263
+ return refused(validationIssue("V1010", pathPath, "Transaction reference path contains invalid Unicode."));
264
+ }
265
+ const sourceRead = referenceSourceField(source, segment, pathPath);
266
+ if (!sourceRead.ok) {
267
+ return refused(sourceRead.issue);
268
+ }
269
+ return {
270
+ ok: true,
271
+ source,
272
+ segment,
273
+ fingerprint,
274
+ field: sourceRead.field,
275
+ pathPath,
276
+ };
277
+ }
278
+ export function validateReferenceSlots(candidates, earlier, index) {
216
279
  const references = [];
217
- for (const slot of operation.candidates) {
218
- const candidateInspection = inspectControlObject(slot.candidate, CANDIDATE_KEYS, slot.path, validationIssue("V1001", slot.path, "Reference control value must be an object."));
219
- if (!candidateInspection.ok) {
220
- return failure(candidateInspection.issue, operation.index);
280
+ for (const slot of candidates) {
281
+ const inspection = inspectReferenceCandidate(slot.candidate, slot.path, earlier, index);
282
+ if (!inspection.ok) {
283
+ return inspection;
221
284
  }
222
- const refPath = [...slot.path, "$ref"];
223
- const refProperty = inspectOwnDataProperty(candidateInspection.value, "$ref", refPath, "V1001", slot.path);
224
- if (!refProperty.ok) {
225
- return failure(refProperty.issue, operation.index);
226
- }
227
- const operationPath = [...refPath, "operation"];
228
- const referenceInspection = inspectControlObject(refProperty.value, REFERENCE_KEYS, refPath, validationIssue("V1016", operationPath, "Transaction reference operation index is invalid."));
229
- if (!referenceInspection.ok) {
230
- return failure(referenceInspection.issue, operation.index);
231
- }
232
- const sourceIndexProperty = inspectOwnDataProperty(referenceInspection.value, "operation", operationPath, "V1016", refPath);
233
- if (!sourceIndexProperty.ok) {
234
- return failure(sourceIndexProperty.issue, operation.index);
235
- }
236
- const sourceIndex = sourceIndexProperty.value;
237
- const source = referenceSourceAt(earlier, sourceIndex, operation.index);
238
- if (source === undefined) {
239
- return failure(invalidSourceIndexIssue(operationPath), operation.index);
240
- }
241
- if (source.kind === "sql") {
242
- return failure(sqlSourceIssue([...refPath, "path"]), operation.index);
243
- }
244
- const fingerprintPath = [...refPath, "fingerprint"];
245
- const fingerprintProperty = inspectOwnDataProperty(referenceInspection.value, "fingerprint", fingerprintPath, "V1000", refPath);
246
- if (!fingerprintProperty.ok) {
247
- return failure(fingerprintProperty.issue, operation.index);
248
- }
249
- const fingerprint = fingerprintProperty.value;
250
- if (!isOperationFingerprint(fingerprint) ||
251
- fingerprint !== source.fingerprint) {
252
- return failure(validationIssue("V1017", fingerprintPath, "Transaction reference fingerprint does not match its source operation."), operation.index);
253
- }
254
- const pathPath = [...refPath, "path"];
255
- const pathProperty = inspectOwnDataProperty(referenceInspection.value, "path", pathPath, "V1010", refPath);
256
- if (!pathProperty.ok) {
257
- return failure(pathProperty.issue, operation.index);
258
- }
259
- const pathInspection = inspectPathTuple(pathProperty.value, pathPath);
260
- if (!pathInspection.ok) {
261
- return failure(pathInspection.issue, operation.index);
262
- }
263
- const { segment } = pathInspection;
264
- if (containsUnpairedSurrogate(segment)) {
265
- return failure(validationIssue("V1010", pathPath, "Transaction reference path contains invalid Unicode."), operation.index);
266
- }
267
- const sourceRead = referenceSourceField(source, segment, pathPath);
268
- if (!sourceRead.ok) {
269
- return failure(sourceRead.issue, operation.index);
270
- }
271
- const sourceField = sourceRead.field;
285
+ const { source, segment, fingerprint, pathPath } = inspection;
286
+ const sourceField = inspection.field;
272
287
  if (sourceField.kind !== "scalar" ||
273
288
  !isAssignable(sourceField, slot.field, slot.shape)) {
274
- return failure(validationIssue("V1011", pathPath, "Transaction reference source type is not assignable to its destination."), operation.index);
289
+ return {
290
+ ok: false,
291
+ issue: validationIssue("V1011", pathPath, "Transaction reference source type is not assignable to its destination."),
292
+ };
275
293
  }
276
294
  const reference = Object.freeze({
277
295
  $ref: Object.freeze({
@@ -289,6 +307,14 @@ export function validateTransactionReferences(operation, earlier) {
289
307
  reference,
290
308
  });
291
309
  }
310
+ return { ok: true, references };
311
+ }
312
+ export function validateTransactionReferences(operation, earlier) {
313
+ const validation = validateReferenceSlots(operation.candidates, earlier, operation.index);
314
+ if (!validation.ok) {
315
+ return failure(validation.issue, operation.index);
316
+ }
317
+ const { references } = validation;
292
318
  const controls = references.map((slot) => ({
293
319
  path: slot.path,
294
320
  value: slot.reference,
@@ -22,7 +22,7 @@ export type AvTransactionReference<Value = unknown> = {
22
22
  readonly [REFERENCE_VALUE]?: Value;
23
23
  };
24
24
  /** Whether a value is an ordinary value or a `$ref` candidate. */
25
- export type TransactionReferenceCandidateRoute = {
25
+ type TransactionReferenceCandidateRoute = {
26
26
  readonly kind: "ordinary";
27
27
  } | {
28
28
  readonly kind: "candidate";
@@ -14,6 +14,11 @@ export function routeTransactionReferenceCandidate(value) {
14
14
  if (!ownKeys.includes("$ref") || referenceDescriptor === undefined) {
15
15
  return ORDINARY_ROUTE;
16
16
  }
17
+ if ("value" in referenceDescriptor &&
18
+ (referenceDescriptor.value === null ||
19
+ typeof referenceDescriptor.value !== "object")) {
20
+ return ORDINARY_ROUTE;
21
+ }
17
22
  return {
18
23
  kind: "candidate",
19
24
  candidate: value,
@@ -1,4 +1,4 @@
1
- import type { ClientProtocolIdentity } from "../runtime/operation-request.js";
1
+ import type { AvRequestProtocol } from "../runtime/operation-request.js";
2
2
  import type { AvTransportContext } from "../runtime/pipeline.js";
3
3
  import type { AvState } from "../runtime/request-state.js";
4
4
  type TransactionRequestBase = {
@@ -11,29 +11,29 @@ type TransactionRequestBase = {
11
11
  readonly state?: AvState;
12
12
  };
13
13
  /** An in-process transaction request, run under the Application Contract. */
14
- export type ApplicationTransactionRequest = TransactionRequestBase & {
14
+ export type AvApplicationTransactionRequest = TransactionRequestBase & {
15
15
  readonly origin: "application";
16
16
  readonly protocol?: never;
17
17
  readonly transport?: never;
18
18
  };
19
19
  /** A remote transaction request, run under the Client Contract. */
20
- export type ClientTransactionRequest = TransactionRequestBase & {
20
+ export type AvClientTransactionRequest = TransactionRequestBase & {
21
21
  readonly origin: "client";
22
- readonly protocol: ClientProtocolIdentity;
22
+ readonly protocol: AvRequestProtocol;
23
23
  readonly transport?: AvTransportContext;
24
24
  };
25
25
  /** An AI agent's transaction request, run under the Agent Contract. */
26
- export type AgentTransactionRequest = TransactionRequestBase & {
26
+ export type AvAgentTransactionRequest = TransactionRequestBase & {
27
27
  readonly origin: "agent";
28
- readonly protocol: ClientProtocolIdentity;
28
+ readonly protocol: AvRequestProtocol;
29
29
  readonly transport?: AvTransportContext;
30
30
  };
31
31
  /** One transaction request, as `framework.executeTransaction` takes it. */
32
- export type FrameworkTransactionRequest = ApplicationTransactionRequest | ClientTransactionRequest | AgentTransactionRequest;
32
+ export type AvTransactionRequest = AvApplicationTransactionRequest | AvClientTransactionRequest | AvAgentTransactionRequest;
33
33
  /**
34
34
  * The origin one plan operation runs under: its own layer's Contract, its own
35
35
  * pipelines, and — for a client or agent step — the protocol identity it is
36
36
  * accepted with.
37
37
  */
38
- export type TransactionOperationOrigin = Pick<ApplicationTransactionRequest, "origin"> | Pick<ClientTransactionRequest, "origin" | "protocol" | "transport"> | Pick<AgentTransactionRequest, "origin" | "protocol" | "transport">;
38
+ export type TransactionOperationOrigin = Pick<AvApplicationTransactionRequest, "origin"> | Pick<AvClientTransactionRequest, "origin" | "protocol" | "transport"> | Pick<AvAgentTransactionRequest, "origin" | "protocol" | "transport">;
39
39
  export {};
@@ -1,8 +1,9 @@
1
1
  import type { AvAdapterModel } from "../adapters/adapter-model.js";
2
+ import { type PolicyCaller } from "../policy/policy-request.js";
2
3
  import type { TransactionDiagnosticsChannel } from "../runtime/diagnostics-reporter.js";
3
4
  import type { OperationPipelineDependencies, OperationRuntimeDependencies } from "../runtime/operation-runtime.js";
4
5
  import type { PlanArguments } from "./transaction-plan-validator.js";
5
- import type { FrameworkTransactionRequest, TransactionOperationOrigin } from "./transaction-request.js";
6
+ import type { AvTransactionRequest, TransactionOperationOrigin } from "./transaction-request.js";
6
7
  import type { AvTransactionResponse } from "./transaction-response.js";
7
8
  /**
8
9
  * The transaction executor core. Like the operation executor it owns no
@@ -13,7 +14,9 @@ import type { AvTransactionResponse } from "./transaction-response.js";
13
14
  * runner's mixed plans), and `planArguments` whether the steps' arguments are
14
15
  * copied at the door; see `validateTransactionPlan`.
15
16
  */
16
- export type FrameworkTransactionExecutor = (request: FrameworkTransactionRequest, diagnostics: TransactionDiagnosticsChannel, origins: readonly TransactionOperationOrigin[] | undefined, planArguments: PlanArguments) => Promise<AvTransactionResponse>;
17
+ export type FrameworkTransactionExecutor = (request: AvTransactionRequest, diagnostics: TransactionDiagnosticsChannel, origins: readonly TransactionOperationOrigin[] | undefined, planArguments: PlanArguments,
18
+ /** The principal an application run's steps run as (`{ as }`), when it names one. */
19
+ caller?: PolicyCaller) => Promise<AvTransactionResponse>;
17
20
  /**
18
21
  * Validates a whole plan through the Framework Validation Layer, then runs it inside
19
22
  * exactly one Adapter transaction. The touched Resources' transaction stages and
@@ -1,16 +1,19 @@
1
1
  import { transactionLevelsOf } from "../config/pipeline-tree.resolver.js";
2
+ import { openRequestPolicy, } from "../policy/policy-request.js";
2
3
  import { AdapterBoundary, planOperationArgumentsPath, planStepPath, sanitizeOperationFailure, } from "../runtime/error-boundary.js";
3
- import { isPlainRecord, valueAt } from "../runtime/field-stage.runtime.js";
4
4
  import { internalFailure, operationSuccess, } from "../runtime/operation-response.js";
5
- import { admitOperation, executeAdmittedOperation, prepareStep, withRequestState, } from "../runtime/operation-runtime.js";
5
+ import { admitOperation, EVERY_FIELD, executeAdmittedOperation, prepareStep, STEP_PIPES, withRequestState, } from "../runtime/operation-runtime.js";
6
6
  import { mapValidationOutcome } from "../runtime/outcome-mapper.js";
7
+ import { refusedStageOutput, serverContractFor, } from "../runtime/pipe-output.validator.js";
7
8
  import { resolveCascadeClosure } from "../runtime/referential-action.js";
8
9
  import { AvTransactionIntegrityError } from "./transaction-integrity-error.js";
9
10
  import { validateTransactionPlan } from "./transaction-plan-validator.js";
11
+ import { collectTransactionReferenceCandidates } from "./transaction-reference-collector.js";
10
12
  import { resolveSqlStatement, resolveTransactionReferences, } from "./transaction-reference-resolver.js";
13
+ import { validateReferenceSlots } from "./transaction-reference-validator.js";
11
14
  import { transactionCommitted, transactionInfrastructureFailure, transactionOperationFailure, } from "./transaction-response.js";
12
15
  import { settleTransaction } from "./transaction-settlement.runtime.js";
13
- import { touchedTransactionLevels, transactionFacts, } from "./transaction-stage.runtime.js";
16
+ import { TRANSACTION_PIPES, touchedTransactionLevels, transactionFacts, } from "./transaction-stage.runtime.js";
14
17
  export function createTransactionRuntime(dependencies, pipelineDependencies) {
15
18
  const { adapter } = dependencies;
16
19
  const planDependencies = {
@@ -18,13 +21,13 @@ export function createTransactionRuntime(dependencies, pipelineDependencies) {
18
21
  cascades: resolveCascadeClosure(adapter.referentialActions),
19
22
  sqlStatements: adapter.sqlStatements === true,
20
23
  };
21
- return async (seeded, diagnostics, origins, planArguments) => {
24
+ return async (seeded, diagnostics, origins, planArguments, caller) => {
22
25
  const request = withRequestState(seeded);
23
26
  const validation = await validateTransactionPlan(planDependencies, request, origins, planArguments);
24
27
  if (!validation.ok) {
25
28
  return validation.response;
26
29
  }
27
- return executeTransactionPlan(adapter, pipelineDependencies, request, validation.plan, request.state, diagnostics);
30
+ return executeTransactionPlan(dependencies, pipelineDependencies, request, validation.plan, request.state, diagnostics, caller);
28
31
  };
29
32
  }
30
33
  function planOrigin(request, plan) {
@@ -59,39 +62,79 @@ function pathKey(path) {
59
62
  function relativeSlotPath(operation, path) {
60
63
  return path.slice(planOperationArgumentsPath(operation.index).length);
61
64
  }
62
- function standsAt(args, path, slot) {
63
- const value = valueAt(args, path);
64
- if (value === slot.reference) {
65
- return true;
65
+ function standingReferences(core, operation, args, steps, subject) {
66
+ const candidates = collectTransactionReferenceCandidates(serverContractFor(core, operation.contract), operation.request, operation.index, args);
67
+ const validation = validateReferenceSlots(candidates, steps, operation.index);
68
+ if (validation.ok) {
69
+ return validation;
66
70
  }
67
- const reference = isPlainRecord(value) ? value.$ref : undefined;
68
- if (!isPlainRecord(reference) || !Array.isArray(reference.path)) {
69
- return false;
71
+ const { issue } = validation;
72
+ const refused = refusedStageOutput(operation.request, [
73
+ {
74
+ ...issue,
75
+ path: ["arguments", ...relativeSlotPath(operation, issue.path ?? [])],
76
+ },
77
+ ], subject);
78
+ if (refused === undefined) {
79
+ throw new TypeError("A refused reference produced no refusal.");
70
80
  }
71
- const expected = slot.reference.$ref;
72
- return (reference.operation === expected.operation &&
73
- reference.path.length === 1 &&
74
- reference.path[0] === expected.path[0]);
75
- }
76
- function slotKeys(operation) {
77
- return new Set(operation.references.map((slot) => pathKey(relativeSlotPath(operation, slot.path))));
81
+ return { ok: false, ...refused };
78
82
  }
79
- async function executeTransactionPlan(adapter, dependencies, request, plan, state, diagnostics) {
80
- const stateful = (operation) => ({ ...operation.request, state });
83
+ async function executeTransactionPlan(runtime, dependencies, request, plan, state, diagnostics, caller) {
84
+ const { adapter } = runtime;
85
+ const steps = new Map();
86
+ const stateful = (operation) => {
87
+ const known = steps.get(operation);
88
+ if (known !== undefined) {
89
+ return known;
90
+ }
91
+ const settle = (policy) => {
92
+ const step = policy === undefined
93
+ ? { ...operation.request, state }
94
+ : { ...operation.request, state, policy };
95
+ steps.set(operation, step);
96
+ return step;
97
+ };
98
+ const policy = openRequestPolicy(runtime.config.policy, runtime.contracts.core, { origin: operation.request.origin, state }, caller, adapter);
99
+ return policy instanceof Promise ? policy.then(settle) : settle(policy);
100
+ };
81
101
  const admitted = [];
102
+ const standing = [];
82
103
  for (const step of plan.operations) {
83
104
  if (step.kind === "sql") {
84
105
  admitted.push({ ok: true, args: undefined, piped: false });
106
+ standing.push([]);
85
107
  continue;
86
108
  }
87
- const references = slotKeys(step);
88
- const admission = await admitOperation(dependencies, stateful(step), step.contract, step.arguments, planOperationArgumentsPath(step.index), diagnostics.operation(step.request, step.index), { requestId: request.requestId, transaction: undefined, state }, {
89
- select: (path) => !references.has(pathKey(path)),
109
+ const report = diagnostics.operation(step.request, step.index);
110
+ let stepRequest;
111
+ try {
112
+ const opened = stateful(step);
113
+ stepRequest = opened instanceof Promise ? await opened : opened;
114
+ }
115
+ catch (error) {
116
+ report(error, "A3000");
117
+ return transactionOperationFailure(internalFailure(), step.index);
118
+ }
119
+ const admission = await admitOperation(dependencies, stepRequest, step.contract, step.arguments, planOperationArgumentsPath(step.index), report, { requestId: request.requestId, transaction: undefined, state }, {
120
+ select: EVERY_FIELD,
90
121
  validation: { transactionReferences: true },
122
+ beforeBegin: true,
91
123
  });
92
124
  if (!admission.ok) {
93
125
  return transactionOperationFailure(admission.response, step.index);
94
126
  }
127
+ if (!admission.piped) {
128
+ standing.push(step.references);
129
+ }
130
+ else {
131
+ const references = standingReferences(dependencies.contracts.core, step, admission.args, plan.operations, STEP_PIPES);
132
+ if (!references.ok) {
133
+ report(references.error, "A3004");
134
+ return transactionOperationFailure(references.response, step.index);
135
+ }
136
+ standing.push(references.references);
137
+ }
95
138
  admitted.push(admission);
96
139
  }
97
140
  const origin = planOrigin(request, plan);
@@ -101,9 +144,18 @@ async function executeTransactionPlan(adapter, dependencies, request, plan, stat
101
144
  const runPlanOperation = async (operation, args, transactionPiped, executor, results, outer) => {
102
145
  const report = diagnostics.operation(operation.request, operation.index);
103
146
  const argumentsPath = planOperationArgumentsPath(operation.index);
104
- const stepRequest = stateful(operation);
147
+ const opened = stateful(operation);
148
+ const stepRequest = opened instanceof Promise ? await opened : opened;
105
149
  try {
106
- const live = operation.references.filter((slot) => standsAt(args, relativeSlotPath(operation, slot.path), slot));
150
+ let live = standing[operation.index] ?? operation.references;
151
+ if (transactionPiped) {
152
+ const references = standingReferences(dependencies.contracts.core, operation, args, plan.operations, TRANSACTION_PIPES);
153
+ if (!references.ok) {
154
+ report(references.error, "A3004");
155
+ return references.response;
156
+ }
157
+ live = references.references;
158
+ }
107
159
  const resolved = resolveTransactionReferences({
108
160
  ...operation,
109
161
  arguments: args,
@@ -119,7 +171,7 @@ async function executeTransactionPlan(adapter, dependencies, request, plan, stat
119
171
  written: (path) => written.has(pathKey(path)),
120
172
  transactionPiped,
121
173
  pipedAroundReferences: admitted[operation.index]?.piped === true &&
122
- operation.references.length > 0,
174
+ (live.length > 0 || operation.references.length > 0),
123
175
  }, outer);
124
176
  if (!prepared.ok) {
125
177
  return prepared.response;
@@ -14,9 +14,9 @@ import { type TransactionStepView } from "./transaction-stage.runtime.js";
14
14
  * the touched Resources' transaction filters answer it once the transaction
15
15
  * interceptors have unwound. Its answer is the step's own outcome.
16
16
  */
17
- export type TransactionStepRunner<M extends AvAdapterModel> = (index: number, step: TransactionStepView, piped: boolean, executor: AvAdapterTransactionExecutor<M>, results: readonly unknown[], outer: OuterFailureLayer) => Promise<AvOperationResponse>;
17
+ type TransactionStepRunner<M extends AvAdapterModel> = (index: number, step: TransactionStepView, piped: boolean, executor: AvAdapterTransactionExecutor<M>, results: readonly unknown[], outer: OuterFailureLayer) => Promise<AvOperationResponse>;
18
18
  /** How one transaction settled. */
19
- export type TransactionSettlement =
19
+ type TransactionSettlement =
20
20
  /** Committed: every step's own outcome, in plan order. */
21
21
  {
22
22
  readonly kind: "committed";
@@ -34,7 +34,7 @@ export type TransactionSettlement =
34
34
  readonly error: unknown;
35
35
  readonly operation: number | undefined;
36
36
  };
37
- export type TransactionSettlementInput<M extends AvAdapterModel> = {
37
+ type TransactionSettlementInput<M extends AvAdapterModel> = {
38
38
  readonly adapter: AvAdapter<M>;
39
39
  /** The touched Resources' transaction levels, outer to inner. */
40
40
  readonly levels: readonly ResolvedTransactionPipelineConfig[];
@@ -49,3 +49,4 @@ export type TransactionSettlementInput<M extends AvAdapterModel> = {
49
49
  };
50
50
  /** Runs `plan` inside one Adapter transaction, its stages around its steps, and settles it. */
51
51
  export declare function settleTransaction<M extends AvAdapterModel>(input: TransactionSettlementInput<M>): Promise<TransactionSettlement>;
52
+ export {};
@@ -1,3 +1,4 @@
1
+ import { brandCoreClass } from "../runtime/core-class.brand.js";
1
2
  const TRANSACTION_SLOT_PATH_MESSAGES = {
2
3
  "slot-prefix": "Transaction slot path does not name a member below the operation's arguments.",
3
4
  "absent-member": "Transaction slot path names an absent member of the operation arguments.",
@@ -11,3 +12,4 @@ export class AvTransactionSlotPathError extends Error {
11
12
  this.violation = violation;
12
13
  }
13
14
  }
15
+ brandCoreClass(AvTransactionSlotPathError, "AvTransactionSlotPathError");
@@ -23,11 +23,12 @@ export type TransactionStepView = AvTransactionStep;
23
23
  export declare const TRANSACTION_PIPES = "Transaction pipes";
24
24
  /**
25
25
  * The `$` facts a transaction stage is told: the plan as `$args`, not one
26
- * operation (`$operation` is absent).
26
+ * operation (`$operation` is absent). Each ctx holds its own frozen copy of the
27
+ * plan, a `Date` or a `Uint8Array` in a step's arguments fresh.
27
28
  */
28
29
  export declare function transactionFacts(contract: AvContract, request: Pick<OperationExecutionRequest, "origin" | "requestId" | "transport">, plan: readonly TransactionStepView[]): ContextFacts;
29
30
  /** How the transaction stages around a plan's steps ended. */
30
- export type TransactionStagesOutcome =
31
+ type TransactionStagesOutcome =
31
32
  /** Every stage and step ran; the steps' results, as the stages left them. */
32
33
  {
33
34
  readonly kind: "ran";
@@ -60,7 +61,7 @@ export type TransactionStagesOutcome =
60
61
  * changed it, in which case every operation step's arguments are held to the
61
62
  * server's rules and its validators again before it runs.
62
63
  */
63
- export type StagedPlan = {
64
+ type StagedPlan = {
64
65
  readonly plan: readonly TransactionStepView[];
65
66
  readonly piped: boolean;
66
67
  };
@@ -79,3 +80,4 @@ export declare function runTransactionStages(levels: readonly ResolvedTransactio
79
80
  * exact reverse (the first that handles it wins), then final sanitization.
80
81
  */
81
82
  export declare function resolveTransactionStageFailure(error: unknown, levels: readonly ResolvedTransactionPipelineConfig[], context: AvTransactionContext, report: DiagnosticsReporter, view: CallerArgumentsView): Promise<AvOperationFailureResponse>;
83
+ export {};
@@ -2,7 +2,7 @@ import { AdapterBoundary, resolveOperationFailure, } from "../runtime/error-boun
2
2
  import { runLevelLifecycle, } from "../runtime/level-lifecycle.runtime.js";
3
3
  import { operationFailure } from "../runtime/operation-response.js";
4
4
  import { AvPipeOutputError, PIPE_OUTPUT_FAILURE_MESSAGE, } from "../runtime/pipe-output.validator.js";
5
- import { deepFreeze } from "../runtime/readonly-value.js";
5
+ import { deepFreeze, frozenCopy } from "../runtime/readonly-value.js";
6
6
  import { AvTransactionIntegrityError } from "./transaction-integrity-error.js";
7
7
  export const TRANSACTION_ABORT = Object.freeze({ reason: "aventara-transaction-abort" });
8
8
  export const TRANSACTION_PIPES = "Transaction pipes";
@@ -10,7 +10,7 @@ export function transactionFacts(contract, request, plan) {
10
10
  return {
11
11
  $contract: contract,
12
12
  $origin: request.origin,
13
- $args: plan,
13
+ $args: frozenCopy(plan),
14
14
  $requestId: request.requestId,
15
15
  ...(request.origin !== "application" && request.transport !== undefined
16
16
  ? { $transport: request.transport }
@@ -86,8 +86,11 @@ export async function runTransactionStages(levels, plan, contextOf, runSteps) {
86
86
  let pipeIndex = 0;
87
87
  for (const level of levels) {
88
88
  for (const pipe of level.pipes) {
89
- const returned = await pipe(current, contextOf(current));
90
- if (returned !== undefined && returned !== current) {
89
+ const told = frozenCopy(current);
90
+ const returned = await pipe(told, contextOf(current));
91
+ if (returned !== undefined &&
92
+ returned !== told &&
93
+ returned !== current) {
91
94
  const accepted = acceptPlan(current, returned, pipeIndex);
92
95
  if (typeof accepted === "string") {
93
96
  return {
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@aventara/core",
3
- "version": "1.0.0-rc.1",
3
+ "version": "1.0.0-rc.10",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "description": "Core runtime, contract compiler, and extension APIs for Aventara.",
6
6
  "type": "module",
7
7
  "engines": {
8
- "node": "^22.18.0 || >=24.2.0"
8
+ "node": "^22.23.4 || >=24.22.1"
9
9
  },
10
10
  "main": "./dist/index.js",
11
11
  "types": "./dist/index.d.ts",
@@ -34,19 +34,20 @@
34
34
  "files": [
35
35
  "dist",
36
36
  "src/runtime/field-check.evaluator.ts",
37
+ "ERRORS.md",
37
38
  "LICENSE-ADDITIONAL-PERMISSION.md",
38
39
  "CHANGELOG.md"
39
40
  ],
40
41
  "dependencies": {
41
- "zod": "^4.6.5"
42
+ "zod": "^4.6.7"
42
43
  },
43
44
  "publishConfig": {
44
45
  "access": "public"
45
46
  },
46
47
  "scripts": {
47
- "build": "node ../../scripts/build/build-output.cleaner.ts dist && tsc -p tsconfig.json --removeComments --declaration false && tsc -p tsconfig.json --emitDeclarationOnly && node ../../scripts/build/declaration-comments.sanitizer.ts dist",
48
+ "build": "node ../../scripts/build/build-output.cleaner.ts dist && node scripts/core-version.generator.ts && tsc -p tsconfig.json --removeComments --declaration false && tsc -p tsconfig.json --emitDeclarationOnly && node ../../scripts/build/declaration-comments.sanitizer.ts dist && node scripts/errors-markdown.generator.ts",
48
49
  "typecheck": "tsc -p tsconfig.typecheck.json --noEmit",
49
50
  "test": "vitest run --typecheck --config ../../vitest.config.mts --root .",
50
- "lint": "biome lint src"
51
+ "lint": "biome lint src scripts"
51
52
  }
52
53
  }
@@ -712,7 +712,7 @@ export function entryCheckIssues(
712
712
  }
713
713
 
714
714
  /** Whether a check judges a list's own length (`AvZ.minItems`/`AvZ.maxItems`). */
715
- export function isListCheck(check: AvFieldCheck): boolean {
715
+ function isListCheck(check: AvFieldCheck): boolean {
716
716
  return (
717
717
  (check.check === "max_length" || check.check === "min_length") &&
718
718
  check.list === true