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

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 (267) hide show
  1. package/CHANGELOG.md +1434 -0
  2. package/ERRORS.md +142 -0
  3. package/README.md +247 -57
  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 +25 -11
  8. package/dist/adapters/adapter-identifier.d.ts +6 -6
  9. package/dist/adapters/adapter-model.d.ts +18 -9
  10. package/dist/adapters/adapter-operation-executor.interface.d.ts +4 -4
  11. package/dist/adapters/adapter-operation.d.ts +3 -3
  12. package/dist/adapters/adapter-resource.d.ts +18 -9
  13. package/dist/adapters/adapter-sql-statement.d.ts +19 -0
  14. package/dist/adapters/adapter-transaction-executor.interface.d.ts +19 -0
  15. package/dist/adapters/adapter.interface.d.ts +59 -29
  16. package/dist/avz/avz-check.factory.d.ts +83 -0
  17. package/dist/avz/avz-check.factory.js +116 -0
  18. package/dist/avz/avz-check.registry.d.ts +35 -0
  19. package/dist/avz/avz-check.registry.js +9 -0
  20. package/dist/avz/avz.d.ts +203 -0
  21. package/dist/{json → avz}/avz.js +150 -8
  22. package/dist/{json → avz}/index.d.ts +2 -1
  23. package/dist/{json → avz}/json-shape.registry.d.ts +7 -7
  24. package/dist/{json → avz}/zod-issue.translator.d.ts +8 -2
  25. package/dist/{json → avz}/zod-issue.translator.js +7 -0
  26. package/dist/compiler/contract-compiler-diagnostic.d.ts +31 -5
  27. package/dist/compiler/contract-compiler-diagnostic.guidance.d.ts +6 -0
  28. package/dist/compiler/contract-compiler-diagnostic.guidance.js +97 -0
  29. package/dist/compiler/contract.compiler.d.ts +18 -18
  30. package/dist/compiler/contract.compiler.js +637 -442
  31. package/dist/compiler/create-requirements.projector.d.ts +49 -0
  32. package/dist/compiler/create-requirements.projector.js +423 -0
  33. package/dist/compiler/field-validator.compiler.d.ts +47 -0
  34. package/dist/compiler/field-validator.compiler.js +238 -0
  35. package/dist/config/any-framework-config.d.ts +19 -12
  36. package/dist/config/computed-fields.d.ts +62 -0
  37. package/dist/config/computed-fields.js +80 -0
  38. package/dist/config/config-diagnostic.d.ts +11 -4
  39. package/dist/config/config-diagnostic.guidance.d.ts +6 -0
  40. package/dist/config/config-diagnostic.guidance.js +32 -0
  41. package/dist/config/config-layer.d.ts +15 -6
  42. package/dist/config/config.resolver.d.ts +74 -31
  43. package/dist/config/config.resolver.js +108 -44
  44. package/dist/config/config.validator.d.ts +7 -7
  45. package/dist/config/config.validator.js +581 -72
  46. package/dist/config/define-resource.d.ts +57 -0
  47. package/dist/config/define-resource.js +14 -0
  48. package/dist/config/effective-fields.d.ts +19 -23
  49. package/dist/config/entrypoint.normalizer.d.ts +1 -1
  50. package/dist/config/exact-framework-config.d.ts +308 -0
  51. package/dist/config/field-compute.resolver.d.ts +21 -0
  52. package/dist/config/field-compute.resolver.js +123 -0
  53. package/dist/config/field-pipeline-config.d.ts +47 -0
  54. package/dist/config/forced-operation.validator.d.ts +10 -0
  55. package/dist/config/forced-operation.validator.js +66 -0
  56. package/dist/config/framework-config.d.ts +111 -39
  57. package/dist/config/framework-exemptions-config.d.ts +91 -0
  58. package/dist/config/framework-exemptions-config.js +1 -0
  59. package/dist/config/framework-field-definition.d.ts +78 -0
  60. package/dist/config/framework-field-definition.js +28 -0
  61. package/dist/config/framework-resources-config.d.ts +122 -0
  62. package/dist/config/framework-resources-config.js +1 -0
  63. package/dist/config/pipeline-config.d.ts +56 -20
  64. package/dist/config/pipeline-tree.resolver.d.ts +79 -0
  65. package/dist/config/pipeline-tree.resolver.js +220 -0
  66. package/dist/config/stage-type.eraser.d.ts +65 -0
  67. package/dist/config/stage-type.eraser.js +1 -0
  68. package/dist/contracts/capability.d.ts +21 -12
  69. package/dist/contracts/capability.js +2 -0
  70. package/dist/contracts/client-contract-structure.validator.d.ts +388 -63
  71. package/dist/contracts/client-contract-structure.validator.js +156 -10
  72. package/dist/contracts/contract-canonicalizer.d.ts +26 -3
  73. package/dist/contracts/contract-canonicalizer.js +156 -29
  74. package/dist/contracts/contract-hash.d.ts +12 -7
  75. package/dist/contracts/contract-hash.js +3 -2
  76. package/dist/contracts/contract-limits.d.ts +4 -1
  77. package/dist/contracts/contract-limits.js +1 -0
  78. package/dist/contracts/contract-lookup.d.ts +5 -5
  79. package/dist/contracts/contract-protocol.d.ts +4 -4
  80. package/dist/contracts/contract.d.ts +24 -16
  81. package/dist/contracts/create-requirements.d.ts +35 -0
  82. package/dist/contracts/create-requirements.js +1 -0
  83. package/dist/contracts/enum-definition.d.ts +1 -1
  84. package/dist/contracts/field-check.d.ts +101 -0
  85. package/dist/contracts/field-check.js +1 -0
  86. package/dist/contracts/field.d.ts +81 -42
  87. package/dist/contracts/identifier.d.ts +4 -4
  88. package/dist/contracts/json-shape.d.ts +12 -1
  89. package/dist/contracts/lifecycle-trait.d.ts +2 -2
  90. package/dist/contracts/resource-operations.d.ts +28 -28
  91. package/dist/contracts/resource.d.ts +15 -9
  92. package/dist/contracts/scalar-value-type.d.ts +15 -15
  93. package/dist/contracts/scalar.d.ts +3 -3
  94. package/dist/contracts/transaction-capability.d.ts +1 -1
  95. package/dist/contracts/wire-scalar-format.d.ts +4 -4
  96. package/dist/framework/contract-view.d.ts +213 -147
  97. package/dist/framework/framework-construction.error.d.ts +19 -10
  98. package/dist/framework/framework-construction.error.js +7 -3
  99. package/dist/framework/framework.d.ts +47 -23
  100. package/dist/framework/framework.factory.d.ts +8 -6
  101. package/dist/framework/framework.factory.js +49 -22
  102. package/dist/framework/operation-facade.d.ts +123 -52
  103. package/dist/framework/operation-facade.js +9 -1
  104. package/dist/index.d.ts +57 -50
  105. package/dist/index.js +7 -6
  106. package/dist/internal.d.ts +17 -10
  107. package/dist/internal.js +4 -1
  108. package/dist/operations/database-refusal.d.ts +51 -0
  109. package/dist/operations/database-refusal.js +45 -0
  110. package/dist/operations/operation-arguments.d.ts +343 -207
  111. package/dist/operations/operation-call.d.ts +27 -28
  112. package/dist/operations/operation-identity.d.ts +10 -10
  113. package/dist/operations/operation-result.d.ts +21 -21
  114. package/dist/operations/operation-validator-core.d.ts +6 -6
  115. package/dist/operations/operation-validator-core.js +99 -6
  116. package/dist/operations/operation-validator.d.ts +9 -9
  117. package/dist/operations/projection-scope.resolver.d.ts +6 -6
  118. package/dist/operations/structural-limits.walker.d.ts +6 -6
  119. package/dist/operations/structural-limits.walker.js +145 -0
  120. package/dist/operations/validation-code.d.ts +11 -6
  121. package/dist/operations/validation-code.guidance.d.ts +6 -0
  122. package/dist/operations/validation-code.guidance.js +90 -0
  123. package/dist/operations/validation-code.js +4 -0
  124. package/dist/operations/write-scope.resolver.d.ts +10 -6
  125. package/dist/operations/write-scope.resolver.js +2 -0
  126. package/dist/protocol/absent-route.responder.d.ts +13 -12
  127. package/dist/protocol/absent-route.responder.js +19 -19
  128. package/dist/protocol/contract-document.responder.d.ts +3 -3
  129. package/dist/protocol/contract-document.responder.js +2 -2
  130. package/dist/protocol/http-request.decoder.d.ts +17 -13
  131. package/dist/protocol/http-request.decoder.js +10 -10
  132. package/dist/protocol/http-request.reader.d.ts +3 -3
  133. package/dist/protocol/http-response.encoder.d.ts +4 -4
  134. package/dist/protocol/http-response.encoder.js +94 -55
  135. package/dist/protocol/http-status.table.d.ts +2 -2
  136. package/dist/protocol/operation-response.guard.d.ts +2 -2
  137. package/dist/protocol/protocol-surface.d.ts +4 -4
  138. package/dist/protocol/protocol.binder.d.ts +50 -27
  139. package/dist/protocol/protocol.binder.js +12 -9
  140. package/dist/protocol/protocol.handler.d.ts +22 -13
  141. package/dist/protocol/protocol.handler.js +91 -17
  142. package/dist/protocol/unmounted-route.error.d.ts +4 -4
  143. package/dist/protocol/unmounted-route.error.js +2 -2
  144. package/dist/runtime/caller-data.copier.d.ts +22 -5
  145. package/dist/runtime/caller-data.copier.js +31 -14
  146. package/dist/runtime/caller-data.door.d.ts +17 -11
  147. package/dist/runtime/caller-data.door.js +6 -4
  148. package/dist/runtime/computed-read-runtime.d.ts +7 -6
  149. package/dist/runtime/computed-read-runtime.js +76 -50
  150. package/dist/runtime/computed-value.error.d.ts +7 -6
  151. package/dist/runtime/computed-value.error.js +5 -4
  152. package/dist/runtime/context-executor.runtime.d.ts +59 -0
  153. package/dist/runtime/context-executor.runtime.js +275 -0
  154. package/dist/runtime/create-requirement.d.ts +44 -79
  155. package/dist/runtime/create-requirement.js +213 -73
  156. package/dist/runtime/decimal.d.ts +2 -2
  157. package/dist/runtime/decimal.js +1 -1
  158. package/dist/runtime/diagnostics-reporter.d.ts +54 -27
  159. package/dist/runtime/diagnostics-reporter.js +24 -0
  160. package/dist/runtime/error-boundary.d.ts +65 -8
  161. package/dist/runtime/error-boundary.js +49 -19
  162. package/dist/runtime/error-guidance.d.ts +12 -0
  163. package/dist/runtime/error-guidance.js +1 -0
  164. package/dist/runtime/error.catalog.d.ts +49 -0
  165. package/dist/runtime/error.catalog.js +49 -0
  166. package/dist/runtime/execution-options.d.ts +10 -2
  167. package/dist/runtime/field-check.evaluator.d.ts +29 -0
  168. package/dist/runtime/field-check.evaluator.js +521 -0
  169. package/dist/runtime/field-compute.d.ts +64 -0
  170. package/dist/runtime/field-compute.js +1 -0
  171. package/dist/runtime/field-stage.plan.d.ts +15 -0
  172. package/dist/runtime/field-stage.plan.js +27 -0
  173. package/dist/runtime/field-stage.runtime.d.ts +37 -0
  174. package/dist/runtime/field-stage.runtime.js +147 -0
  175. package/dist/runtime/field-validator.runtime.d.ts +19 -0
  176. package/dist/runtime/field-validator.runtime.js +92 -0
  177. package/dist/runtime/framework-error-class.table.d.ts +33 -0
  178. package/dist/runtime/framework-error-class.table.js +25 -0
  179. package/dist/runtime/framework-error.d.ts +68 -8
  180. package/dist/runtime/framework-error.factory.d.ts +4 -0
  181. package/dist/runtime/framework-error.factory.js +15 -0
  182. package/dist/runtime/framework-error.js +23 -2
  183. package/dist/runtime/interceptor-next.error.d.ts +5 -0
  184. package/dist/runtime/interceptor-next.error.js +6 -0
  185. package/dist/runtime/json-value.d.ts +11 -6
  186. package/dist/runtime/level-lifecycle.runtime.d.ts +25 -0
  187. package/dist/runtime/level-lifecycle.runtime.js +39 -0
  188. package/dist/runtime/misuse-reporter.d.ts +12 -12
  189. package/dist/runtime/mutation-planner.d.ts +19 -10
  190. package/dist/runtime/mutation-planner.js +48 -35
  191. package/dist/runtime/nested-write.walker.d.ts +32 -0
  192. package/dist/runtime/nested-write.walker.js +73 -0
  193. package/dist/runtime/operation-code.guidance.d.ts +6 -0
  194. package/dist/runtime/operation-code.guidance.js +167 -0
  195. package/dist/runtime/operation-request.d.ts +33 -6
  196. package/dist/runtime/operation-response.d.ts +17 -17
  197. package/dist/runtime/operation-runtime.d.ts +127 -25
  198. package/dist/runtime/operation-runtime.js +441 -78
  199. package/dist/runtime/outcome-mapper.d.ts +16 -5
  200. package/dist/runtime/outcome-mapper.js +23 -6
  201. package/dist/runtime/output-validator.d.ts +10 -10
  202. package/dist/runtime/output-validator.js +3 -3
  203. package/dist/runtime/owned-execution.registry.d.ts +16 -6
  204. package/dist/runtime/pipe-output.validator.d.ts +43 -18
  205. package/dist/runtime/pipe-output.validator.js +15 -13
  206. package/dist/runtime/pipeline.d.ts +223 -34
  207. package/dist/runtime/readonly-value.d.ts +43 -0
  208. package/dist/runtime/readonly-value.js +150 -0
  209. package/dist/runtime/request-envelope.validator.d.ts +3 -3
  210. package/dist/runtime/request-envelope.validator.js +12 -7
  211. package/dist/runtime/request-id.d.ts +1 -1
  212. package/dist/runtime/request-state.d.ts +14 -0
  213. package/dist/runtime/request-state.js +1 -0
  214. package/dist/runtime/request-state.resolver.d.ts +12 -0
  215. package/dist/runtime/request-state.resolver.js +20 -0
  216. package/dist/runtime/scalar-runtime.d.ts +35 -16
  217. package/dist/runtime/scalar-runtime.js +102 -34
  218. package/dist/runtime/unsent-value.normalizer.d.ts +15 -0
  219. package/dist/runtime/unsent-value.normalizer.js +128 -0
  220. package/dist/transactions/deferred-operation.d.ts +35 -20
  221. package/dist/transactions/operation-arguments-encoder.d.ts +3 -3
  222. package/dist/transactions/operation-arguments-encoder.js +2 -2
  223. package/dist/transactions/operation-fingerprint.js +2 -2
  224. package/dist/transactions/sql-statement.d.ts +85 -0
  225. package/dist/transactions/sql-statement.js +47 -0
  226. package/dist/transactions/sql-statement.validator.d.ts +44 -0
  227. package/dist/transactions/sql-statement.validator.js +167 -0
  228. package/dist/transactions/transaction-envelope.d.ts +4 -4
  229. package/dist/transactions/transaction-integrity-error.d.ts +6 -6
  230. package/dist/transactions/transaction-integrity-error.js +5 -2
  231. package/dist/transactions/transaction-plan-assembler.d.ts +21 -11
  232. package/dist/transactions/transaction-plan-assembler.js +169 -32
  233. package/dist/transactions/transaction-plan-validator.d.ts +45 -20
  234. package/dist/transactions/transaction-plan-validator.js +96 -38
  235. package/dist/transactions/transaction-reference-collector.d.ts +5 -5
  236. package/dist/transactions/transaction-reference-resolver.d.ts +19 -2
  237. package/dist/transactions/transaction-reference-resolver.js +26 -14
  238. package/dist/transactions/transaction-reference-validator.d.ts +76 -4
  239. package/dist/transactions/transaction-reference-validator.js +129 -71
  240. package/dist/transactions/transaction-reference.d.ts +13 -13
  241. package/dist/transactions/transaction-reference.js +5 -0
  242. package/dist/transactions/transaction-request.d.ts +18 -5
  243. package/dist/transactions/transaction-response.d.ts +6 -6
  244. package/dist/transactions/transaction-runtime.d.ts +8 -7
  245. package/dist/transactions/transaction-runtime.js +191 -50
  246. package/dist/transactions/transaction-settlement.runtime.d.ts +51 -0
  247. package/dist/transactions/transaction-settlement.runtime.js +120 -0
  248. package/dist/transactions/transaction-slot-path-error.d.ts +4 -4
  249. package/dist/transactions/transaction-slot-path-error.js +2 -2
  250. package/dist/transactions/transaction-slot-writer.js +2 -2
  251. package/dist/transactions/transaction-stage.runtime.d.ts +82 -0
  252. package/dist/transactions/transaction-stage.runtime.js +126 -0
  253. package/package.json +9 -7
  254. package/src/runtime/field-check.evaluator.ts +720 -0
  255. package/dist/config/define-fields.d.ts +0 -42
  256. package/dist/config/define-fields.js +0 -3
  257. package/dist/config/framework-behaviors-config.d.ts +0 -30
  258. package/dist/config/framework-fields-config.d.ts +0 -42
  259. package/dist/config/framework-restrictions-config.d.ts +0 -142
  260. package/dist/json/avz.d.ts +0 -96
  261. package/dist/runtime/field-behavior.d.ts +0 -48
  262. /package/dist/{config/framework-behaviors-config.js → adapters/adapter-sql-statement.js} +0 -0
  263. /package/dist/{config/framework-fields-config.js → adapters/adapter-transaction-executor.interface.js} +0 -0
  264. /package/dist/{json → avz}/index.js +0 -0
  265. /package/dist/{json → avz}/json-shape.registry.js +0 -0
  266. /package/dist/config/{framework-restrictions-config.js → exact-framework-config.js} +0 -0
  267. /package/dist/{runtime/field-behavior.js → config/field-pipeline-config.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,1438 @@
1
1
  # @aventara/core
2
2
 
3
+ ## 1.0.0-rc.2
4
+
5
+ ### Patch Changes
6
+
7
+ - A pipe may move a transaction step's `$ref`. A pipe sees a `$ref` as the reference it is, unresolved, and a
8
+ scoping pipe moves it: `({ args }) => ({ ...args, where: { AND: [args.where ?? {}, { published: true }] } })` puts
9
+ the caller's `where: { categoryId: cat.$ref("id") }` at `where.AND.0.categoryId`. The reference is now resolved
10
+ wherever the pipe put it: in an `AND`, an `OR` or a `NOT`, in a relation filter, under any operator, or copied from a
11
+ data value into another field or into a `$connect` key. Before, only a reference still standing where the caller
12
+ wrote it was resolved, and the step failed inside the transaction with `500 A3004` ("A server pipeline produced
13
+ invalid arguments."), the `diagnostics` sink naming the moved `$ref` (`V1006: Filter operator "$ref" is not
14
+ available on field "categoryId"`, or `V1001` under `gte`). A moved reference is held to the rules a reference the
15
+ caller writes at that place is held to (where a `$ref` may stand, its source step, and its source field's type
16
+ against its new place): one that breaks them, such as a `$ref` moved into an `orderBy` or onto a field of another
17
+ type, is still the server's `A3004`, and an operation pipe's is now answered before the transaction opens. A
18
+ transaction pipe that moves a `$ref` is held to the same rules at its step. A literal a pipe writes where the caller
19
+ had a `$ref` now goes through that field's pipes, as any other value does.
20
+ - A relation the request writes together with its reference field (`{ authorId: 1, author: { $connect: { id: 1 } } }`)
21
+ is refused by the framework validation, before any guard, pipe or compute stage runs and, in a plan, before the
22
+ transaction opens: `A2004`, `V1012` at the relation, as before. In rc.1 it was judged only after the guards, pipes
23
+ and write compute, so the developer's stages ran on the request first, and a plan opened its transaction and ran the
24
+ steps before it.
25
+ - The field validators run after write compute. The order of a call is now the framework validation, the guards, the
26
+ pipes and field pipes, write compute, then the re-check: Aventara's own checks again on what the pipes and compute
27
+ produced, then the field validators (a Json field's shape among them) on every value the adapter will be handed,
28
+ then the interceptors and hooks. So a validator judges what is stored: a value a `compute.create` or
29
+ `compute.update` stage replaces is judged as computed, not as the caller sent it. In rc.1 the validators ran after
30
+ the pipes and before write compute, and a computed value was not judged by them. A plan step and a forced call still
31
+ judge before the transaction opens the literal values no write compute stage of their phase changes, so a caller's
32
+ refusal there opens nothing; the rest is judged at the step, and a refusal rolls the transaction back.
33
+ - A computed write value its field's validators or Json shape refuse is answered `A2004` at the field, as any validator
34
+ refusal is (`{ code: "V1003", path: ["arguments", "data", "slug"], check: "string_format", … }`), at the top level,
35
+ in nested writes and in both branches of an upsert. In rc.1 such a value was not judged at all. A computed value of
36
+ the wrong type is still the server's error: `A3000`, its issues to the `diagnostics` sink on an
37
+ `AvComputedValueError`. `compute.read` values are output and are not judged.
38
+ - A field computed on read with no `dependsOn` (the function form, `read: () => "stamped"`) has the Resource's
39
+ identifier read for it, the adapter's first one (with Prisma, the primary key when the model declares it first), so
40
+ each row comes back whatever else is selected; a `dependsOn` field is read as before. The answer holds exactly what
41
+ was selected: `{ select: ["stamp"] }` answers `[{ stamp: "stamped" }]` on every reading variant and in a write's
42
+ `select`, and inside a relation projection (`{ select: [{ category: { select: ["stamp"] } }] }`) the relation's row
43
+ is read and computed. In rc.1 a select of only such fields handed the adapter an empty projection, which Prisma
44
+ cannot express: `500 A3001` at the top level, and inside a relation the row was not read (`500 A3000`).
45
+ - Every stage told a frozen view gets its own copy of a `Date` or a `Uint8Array`, which freezing cannot reach: a guard,
46
+ a field write guard, a pipe (its input and its `ctx.$args`), a field pipe, write compute (`data`, `value`,
47
+ `ctx.$args`), an interceptor, a before hook, each after hook (the result and `ctx.$args`), a filter and a Resource
48
+ transaction stage. Changing one in place changes only that stage's copy, never what a later stage is told, what is
49
+ written or what the caller receives; data changes only by returning it. In rc.1 every stage after write compute
50
+ shared one copy, so an after hook was told the `Date` a before hook had changed in place, and a guard or a pipe was
51
+ told the framework's own value. Arguments holding no such value are handed on as they are, at no cost per stage; a
52
+ copy is made only along the path to one (about 3 µs per stage for a record with a `Date` and a 64-byte
53
+ `Uint8Array`).
54
+ - A `compute.read` stage is told the row as its own deep-frozen copy, a `Date` or a `Uint8Array` in it copied, like
55
+ every stage above; its field's `value` too. It returns its field's value: writing into `record` throws a
56
+ `TypeError`, answered `A3000` when the stage lets it through, as a pipe's write into its arguments is. The answer is
57
+ built from the row as read. In rc.1 the stage was told a mutable copy of the row and the answer was built from it,
58
+ so `record.title = "x"` changed the title every surface answered. The copy costs about 1.3 µs per row and stage
59
+ (1.8 µs with a `Date` and 64 bytes): a 100-row read with one computed field took 0.33 ms instead of 0.19 ms.
60
+ - A record written through a relation cannot write that relation back. Inside a post created in `author.posts`,
61
+ `author` and `authorId` are what the write the post sits in supplies; inside a category created in a post's
62
+ `category`, `posts` is (`{ posts: { $create: { category: { $create: { posts: { $create: … } } } } } }`). The
63
+ framework validation refuses such a write before any guard, pipe or adapter work: `A2004` with one `V1012` issue at
64
+ the field (`["arguments", "data", "posts", "$create", "category", "$create", "posts"]`), message `Relation "posts"
65
+ is the relation this Category is written through, from its other end ("Post.category"): the write it sits in
66
+ supplies it.`, under every directive that carries a record (`$create`, `$connectOrCreate`, `$update`, `$upsert`),
67
+ to-one and to-many, and in a plan step. Only the edge walked is refused: a self-relation's other edge to the same
68
+ Resource stays writable. It is a type error on the façades, the builders and the generated client. In rc.1 the
69
+ Contract admitted these writes and the Prisma adapter answered `500 A3001`.
70
+ - The Contract states each relation's other end, `inverse` on a relation field (`User.posts` has `inverse: "author"`),
71
+ as the adapter pairs them, and only where the layer shows that other end. The write axis has a third position,
72
+ `"loopback"`: that other end inside a record written through the relation. An adapter states whether a relation is
73
+ writable there as it states the other two positions (an arm that lists `"loopback"`, or an unqualified arm). A
74
+ Contract whose adapter states a pairing has a new hash; one that states none is unchanged, and so is an arm that
75
+ lists every position. `AvAdapterRelationField.inverse` is how an adapter states the pairing.
76
+ - The Contract states which scalar fields hold each relation's reference: `referenceFields` on a relation field
77
+ (`Post.category` has `referenceFields: ["categoryId"]`; a composite reference lists every field, in the order the
78
+ data source pairs them with the target's key), on an optional relation as on a required one. It is absent on the
79
+ end that holds no reference (`Category.posts`), never an empty list. A layer keeps the fields it shows, in the
80
+ adapter's order, and leaves the property out when it shows none. The argument types now leave a loopback edge's
81
+ reference fields out for an optional relation too: `categoryId` in a post created in `Category.posts` is a type
82
+ error on the façades, the builders and the generated client, as the framework validation refuses it (`V1012`). In
83
+ rc.1 only a required relation's reference fields were left out, read off `createRequirements`.
84
+ `AvAdapterRelationField.referenceFields` is how an adapter states them. A Contract whose adapter states them has a
85
+ new hash.
86
+ - A computed value is held to every named `format` its field declares, not only `uuid`: a `compute.read`,
87
+ `compute.create` or `compute.update` value that breaks `email`, `url`, `ipv4` or any other of zod's named formats
88
+ is the server's error, `A3000`, its `V1003` issue to the `diagnostics` sink on an `AvComputedValueError`, as a value
89
+ of the wrong type is. Each entry of a list field is judged. In rc.1 only `uuid` was checked and any other format
90
+ reached the caller unchecked. A relative path is no URL: compute an absolute one into a `format: "url"` field
91
+ (`` `https://example.com/p/${record.slug}` ``), or leave `format` out. A caller's own value is still held only to
92
+ `uuid` (a format describes the value; a rule on caller input is a validator, `AvZ.url()`).
93
+ - `AvErrorCatalog` (and `ERRORS.md`): `A2004` and `V1012` list a record written through a relation that writes that
94
+ relation, or a field holding its reference, back. An adapter that meets one core cannot see (the layer hides the
95
+ relation's other end, so its Contract states no pairing) answers it with the new `V1012` sentence `The data source
96
+ refused this nested write: a record written through a relation cannot write that relation or its reference fields
97
+ back.`, which the response boundary keeps as it keeps a database refusal's.
98
+ - A nested `$update` on a to-many relation is a bulk write: its one `data` applies to every related row its `where`
99
+ matches, so it takes what `update.many`'s `data` takes. A relation the adapter does not offer in a bulk write is
100
+ refused before the adapter with `A2004` and `V1006` at the member
101
+ (`["arguments", "data", "posts", "$update", "data", "category"]`, `Relation "category" is not writable during
102
+ update.`), and is a type error on the façades, the builders and the generated client. A to-one `$update` is
103
+ unchanged. In rc.1 the Contract admitted it and the Prisma adapter refused it as `500 A3001`.
104
+ - `AvErrorCatalog` (and `ERRORS.md`): `A3002` lists a transaction that expired or was closed under a step among its
105
+ causes, and `V1006` a relation write in a to-many `$update`'s `data`.
106
+ - A relation a pipe or a compute stage writes together with its reference field is the server's error: the caller
107
+ gets `A3004` with the generic pipe-output message, and the `diagnostics` sink gets an `AvPipeOutputError` holding the
108
+ `V1012` issue and its path. In rc.1 the caller got `A2004`/`V1012`, as if it had sent both. A pipe's output that
109
+ breaks a field validator or a Json field's shape is still the caller's `A2004`: those are the developer's rules for
110
+ what may be stored, not Aventara's.
111
+ - In a transaction plan, a `$ref` holding no object (`{ payload: { $ref: "x" } }`, `{ $ref: null }`) is answered as a
112
+ single call answers it: `A2004` with `V1006` at the `$ref` key (`Mutation directive "$ref" is not available on field
113
+ "payload".`), at `["operations", i, "args", …, "$ref"]`. In rc.1 a plan read it as a malformed reference:
114
+ `A2007` with `V1016` at `…, "$ref", "operation"`. A `$ref` holding an object is still a reference, and a broken one
115
+ still `A2007`.
116
+ - `AvJsonValue` admits a key holding `undefined`, so an object with optional properties
117
+ (`{ readonly note?: string }`) is assignable to a `json` field; the key is left out at runtime. In rc.1 the type
118
+ refused it. An array element holding `undefined` is still a type error (at runtime it is `null`).
119
+ - `AvErrorCatalog` (and `ERRORS.md`): `V1001` lists two directives in one scalar action object among its causes,
120
+ `A2004` a computed value the validators refuse, `A3000` a computed value of the wrong type, and `A3004` a reference
121
+ a pipe or write compute wrote together with its relation.
122
+ - A scalar action object holds one directive. `{ score: { $increment: 1, $decrement: 2 } }` is refused before the
123
+ adapter with `A2004` and `V1001` at the field (`Scalar mutation action objects may contain only one directive.`),
124
+ and is a type error on the façades, the builders and the generated client. In rc.1 it passed validation and the
125
+ ORM refused it: `500 A3001`. A directive the field does not offer is still `V1006` at the directive.
126
+ - An `undefined` inside a `json` value is what JSON makes of it, on every surface: a key holding it is left out and an
127
+ array element holding it (or a hole) is `null`, as `JSON.stringify` writes them, so
128
+ `{ meta: { a: undefined, b: [undefined] } }` stores `{"b":[null]}` through `framework.application`,
129
+ `framework.client`, `framework.execute`, the ctx executor and a plan step, as it does through the generated client
130
+ and over HTTP. The same holds in a `json` filter operand, and an operation's fingerprint is computed from the value
131
+ as JSON carries it. In rc.1 the in-process surfaces refused the key with `A2004`/`V1001`, and a hole in an array
132
+ inside a `json` value was dropped, moving the elements after it down one index.
133
+ - `DATABASE_REFUSALS` has two more sentences an adapter answers a refused value with, both `V1004`:
134
+ `The database refused this value: it divides by zero.` and `The database refused this value: the write computes no
135
+ value for a column that requires one, as a division by zero does.`
136
+ - `AvErrorCatalog`'s `A2004` entry (and `ERRORS.md`) covers a value the database refused: an adapter answers it with
137
+ one issue at `["arguments"]`, `V1004` for a length or range, `V1001` otherwise, and the issue's message says what
138
+ the database refused (`The database refused this value: its text cannot contain the NUL character (U+0000).`).
139
+ The response boundary keeps such a message only when it is core's own sentence for that refusal under its own
140
+ code; every other adapter issue message is still replaced by the code's published text.
141
+ - An `appTx` or `clientTx` builder no longer runs a getter inside an object carrying `$ref` when it copies a step's
142
+ arguments: it mirrors the object as `framework.executeTransaction` does, and the run refuses it the same way
143
+ (`A2004`, `V1001` at the extra key). In rc.1 the builder ran the getter at the call.
144
+ - `AvProtocol.bind(framework).handleOperation` copies a `{ kind: "parsed" }` body at the call, before it awaits the
145
+ state seed, so a host that changes its parsed object after the call changes nothing, and a body that cannot be
146
+ copied is refused at the call (`A2004`, `V1001` at its path). In rc.1 the copy was taken after the first await.
147
+ - `AvProtocol.bind(framework).handleTransaction` takes a `{ kind: "parsed" }` plan at the call, before it awaits the
148
+ state seed, as `framework.executeTransaction` takes one: the plan's structure is mirrored by its property
149
+ descriptors, so no getter the plan validator refuses runs, and each step's arguments are copied, its `$ref` control
150
+ objects mirrored. A host that changes the plan after the call changes nothing, and a step whose arguments cannot be
151
+ copied is answered at its turn (`A2004`, `V1001` at its path). In rc.1 the plan was read after the first await, so a
152
+ step changed after the call failed its fingerprint (`A2007`, `V1017`) or ran as changed.
153
+ - `framework.appTx.$sql` mirrors a `$ref` control object among its values as the builders mirror one in a step's
154
+ arguments: no getter inside it runs, and a malformed one is refused as `framework.executeTransaction` refuses it
155
+ (`A2004`, `V1001` at its extra key). A well-formed hand-written `{ $ref: { operation, fingerprint, path } }` is read
156
+ as a reference to that step's field, held to the same checks as one in an operation step. In rc.1 the value was
157
+ copied by value at the call, which ran its getters, and bound as JSON text.
158
+ - An `orderBy` value that is no order says what is wrong with it. A `$ref` there is refused with `A transaction
159
+ reference cannot stand in orderBy: order "email" by "asc", "desc" or { sort, nulls }.`, and a malformed null-order
160
+ object with `Null ordering for "email" must be exactly { sort: "asc" | "desc", nulls: "first" | "last" }.`. The
161
+ code (`V1001`) and path are unchanged; rc.1 answered both with `Extended null ordering for "email" must contain sort
162
+ and nulls.`
163
+ - Each filter operator object stands alone: a `mode` or `path` qualifies only the operators written beside it, and an
164
+ object under `not` has its own. A `mode` or `path` with no comparing operator beside it is refused with `A2004` and
165
+ `V1001` at that key, before the adapter, with the message `mode on field "title" qualifies no operator: write it next
166
+ to the operator it applies to (inside "not" to apply to a negated one).`. That covers `{ mode: "insensitive", not: {
167
+ contains: "x" } }` (write `{ not: { contains: "x", mode: "insensitive" } }`), `{ path: ["label"], not: { … } }`
168
+ (write the `path` inside the `not`), and a `mode` or `path` alone, such as `{ title: { mode: "default" } }`, which
169
+ reached the adapter as no condition and matched every row. A value under `not` (`{ path: ["label"], not: "x" }`)
170
+ compares at its own level and is accepted. The typed calls refuse the same objects at compile time.
171
+ - An error catalog: `AvErrorCatalog`, exported from `@aventara/core`, maps every outcome code (`A1000` to `A4002`),
172
+ validation code (`V1000` to `V1021`) and startup code (`CONFIG_…`, `DISCOVERY_…`, `COMPILER_…`) to its `kind`,
173
+ `message`, `cause`, `fix` and `docs` URL, the code's entry on the error-codes page
174
+ (`https://aventara-framework.vercel.app/docs/error-codes#a2004`: the code in lower case). The package also ships the
175
+ catalog as `ERRORS.md`, one table per kind. New names: `AvErrorCatalog` (a value and its type),
176
+ `AvErrorCatalogEntry`, `AvErrorCatalogCode`, `AvErrorKind`.
177
+ - A startup diagnostic links to its documentation: every entry of `AvConstructionError`'s `diagnostics` is now
178
+ `{ code, path, message, docs }`, where `docs` is `AvErrorCatalog[code].docs`. Codes, paths and messages are
179
+ unchanged. A test that compares a whole diagnostic with `toEqual` now sees the `docs` key.
180
+ - A spread of the arguments compiles on a Resource with a `json` field. A variant pipe returning
181
+ `{ ...args, data: { ...args.data, slug } }`, or a guard spreading `ctx.$args.data`, was TS2589 ("Type instantiation
182
+ is excessively deep and possibly infinite"), inline and in `defineResource`: the deep read-only typing re-entered
183
+ `AvJsonValue` through its array member without end. `AvDeepReadonly` now maps an array through its own
184
+ `readonly …[]` branch (a tuple keeps its positions); the types a stage is told are unchanged, and a wrong value in a
185
+ pipe's return is still a compile error.
186
+ - An explicit `undefined` in write data means the key was not sent, as Prisma reads its data. In a create's or
187
+ update's `data`, an upsert's `create` and `update`, each record of a bulk create and every nested create or update,
188
+ `{ name: undefined }` is now `{}`: on a create an optional field takes what leaving it out gives it and a required one
189
+ is missing (`A2004` with `V1000` at its path); an update leaves the field untouched. Before, it was refused as
190
+ `A2004`/`V1001` "Value must be a string.". The same holds for the in-process façades, ctx calls, `appTx` plans and
191
+ the arguments a pipe or a transaction pipe returns: an optional field a pipe sets to `undefined` is omitted, a
192
+ required one is a dropped field (`A3004`). Filters and unique selectors are unchanged: `where: { id: undefined }` is
193
+ still refused (`V1001`), so an `update.many` or `delete.many` never widens to every row. The refusal says why, in the
194
+ generated client's words where they apply in process: `Value must not be undefined: it would be left out, and the
195
+ request would reach more rows.` (it said what the value is not, such as `Value must be a string.`). This holds at
196
+ any depth of a filter, a unique selector or a cursor: an operator's operand, an `in` entry, an `AND` entry, a `NOT`,
197
+ a relation filter, a relation's `where` under `select` or `include`, and a nested write's `$connect`, `$disconnect`,
198
+ `$set` and `$update` selectors. Code and path are unchanged.
199
+ - An `undefined` `mode`, `isEmpty` or `path` in a filter is refused (`A2004` with `V1001` at the operand), as every
200
+ other operator's `undefined` already was. These three are passed to the adapter as given, so
201
+ `{ tags: { isEmpty: undefined } }` reached it as no condition and matched every row.
202
+ - A filter operand of the wrong type is refused (`A2004` with `V1001` at the operand) before the adapter is called:
203
+ `mode` takes `"default"`, `"sensitive"` or `"insensitive"`, `isEmpty` a boolean, `path` an array of strings (a wrong
204
+ entry is named at its index) and a `json` field's `stringContains`, `stringStartsWith` and `stringEndsWith` a string.
205
+ Before, a value such as `mode: "loud"`, `isEmpty: 3`, `path: "a.b"` or `stringContains: 3` from an HTTP or MCP caller
206
+ reached the adapter, and the ORM refused it as `A3001`. The typed calls and the generated client type these operands
207
+ the same way: `mode`, `isEmpty` and `path` were `unknown`, and a `json` `string*` operand accepted any non-null JSON
208
+ value.
209
+ - Filter modes are advertised per field. `mode` has three values: `"default"` is the database's own comparison and
210
+ every field that offers `mode` takes it; `"sensitive"` and `"insensitive"` are an explicit promise, taken only where
211
+ the field's new `capabilities.filterModes` lists them (and, on a `json` field that offers `path`,
212
+ `capabilities.pathFilterModes` when the filter names a `path`). The Contract and the ClientContract carry both lists,
213
+ configuration never names them, and a layer that hides `mode` or `path` drops them. A mode the field does not offer is
214
+ refused like an unadvertised operator: `A2004` with `V1006` at the `mode`, `Filter mode "insensitive" is not available
215
+ on field "email".`; the typed calls offer only the field's modes, and on a `json` field the list that applies: an
216
+ operator object with `path` takes `pathFilterModes`, one without it `filterModes`. On Postgres
217
+ `where: { meta: { stringContains: "x", mode: "insensitive" } }` is a compile error (`Property 'path' is missing`),
218
+ and the same filter with `path: ["label"]` compiles. Contract hashes change for every field that offers `mode`:
219
+ regenerate the client.
220
+ - A `where`, `limit`, `offset` or `cursor` argument set to `undefined` is refused with a message that says what to
221
+ write: `where must not be undefined: leave the key out to mean no filter.` (and the same for `limit`, `offset` and
222
+ `cursor`), at the top level and in a relation under `select` or `include`. The code and path are unchanged
223
+ (`A2004` with `V1001` at the key; `V1009` for `cursor`). A wrong value keeps its message, such as
224
+ `where must be an object.` or `limit must be a non-negative integer.`.
225
+ - 9366e16: MCP endpoint polish:
226
+
227
+ - A request with no bearer credentials (no `Authorization` header, or another scheme such as `Basic`) is answered
228
+ `401` with `WWW-Authenticate: Bearer resource_metadata="…"` and no error code, as RFC 6750 §3.1 asks; its body no
229
+ longer says "Missing Authorization header". A bad bearer token keeps `error="invalid_token"`.
230
+ - A `mcp.authorization.verify` that throws is still answered `401`, and is now reported to the `diagnostics` sink as
231
+ an `AvMcpDiagnostic` holding the error.
232
+ - With `mcp` configured and `@aventara/mcp` missing, the startup error names the command that installs it at the
233
+ installed `@aventara/core`'s exact version: `npm install --save-exact @aventara/mcp@<version>`.
234
+
235
+ - 9366e16: A variant's guards, pipes and filters may leave out of a create exactly the fields your configuration's
236
+ `compute.create` stages fill. Write compute runs after those stages, so a field it fills may still be missing when
237
+ they run, and a pipe may return a create without it: in a pipe, `args.data.slug` is `string | undefined` when
238
+ `slug` has a `compute.create`, and every other required field stays required. A stage's type cannot read the
239
+ configuration it is written in, so the adapter's generate step reads the configuration's type (`aventara:prepare`
240
+ passes `--config src/aventara.config.ts`) and writes which fields each layer computes into the model's type. A
241
+ stage counts the layers whose compute runs for its requests: a root stage the root's, the application's, the
242
+ client's and the agent's; an `application` or `client` stage the root's and its own (and the agent's, when the agent
243
+ extends it); an `agent` stage the root's, its own and its parent's. This holds inline in `createFramework`, in
244
+ `AventaraModule`'s `config`, and in `defineResource` blocks and their overlays, for a create's `data`, an upsert's
245
+ `create` and a nested create. Values are still typed. Hooks and interceptors run after compute and keep every
246
+ requirement. A model generated without a configuration lifts every create requirement in those stages, as before.
247
+ - Breaking: a create missing a required field is refused before any pipeline stage runs. The framework's own
248
+ validation (types, unknown fields, structure) now also checks that every create position holds the fields its
249
+ layer requires (`A2004`/`V1000` at the field), before the guards, where it ran after the pipes and compute. A field a
250
+ `compute.create` stage fills is not required there and stays optional until compute. So a guard or a pipe is always
251
+ told a create that holds every other required field, which is what their types say, and a pipe can no longer fill a
252
+ required field the caller left out: give that field a `compute.create` stage or a database default. This holds for
253
+ a create's `data`, every bulk record, an upsert's `create` branch and nested creates, and for each step of a
254
+ transaction before it opens (a `$ref` counts as a value). Which fields are required is already public in the client
255
+ contract, so the earlier answer reveals nothing new.
256
+ - A required create field the caller sent and a pipe then dropped is now the server's error: the caller gets `A3004`
257
+ with the generic pipe-output message, and the `diagnostics` sink gets an `AvPipeOutputError` holding the `V1000`
258
+ issue. Until now the caller got `A2004`/`V1000`, as if it had left the field out.
259
+ - New: `AvConfigComputedFields`, the shape of that statement: per layer (`root`, `application`, `client`, `agent`),
260
+ per Resource, the fields with a `compute.create` and a `compute.update` stage, and the layer the agent extends. The
261
+ adapter hands it to the framework as `AvAdapter.computedFields`, and the framework compares it with the
262
+ configuration it starts with. When they differ (you changed a compute stage and did not run `aventara:prepare`),
263
+ startup emits one warning, `AVENTARA_STALE_GENERATED_TYPES`, naming each difference:
264
+
265
+ ```text
266
+ (node:1234) [AVENTARA_STALE_GENERATED_TYPES] AventaraWarning: generated types are stale: run aventara:prepare. The computed fields the pre-compute stages are typed with differ from the configuration's:
267
+ - computed in the configuration, not in the types: root User.handle (update)
268
+ ```
269
+
270
+ It is a warning and changes nothing at runtime: the statement only types the stages.
271
+ - A `compute.create` stage that returns `undefined` for a field a create cannot do without (not nullable, no default,
272
+ not generated) and that the caller did not send now fails as the server's error: the caller gets `A3000`, and the
273
+ `diagnostics` sink gets an `AvComputedValueError` whose message is
274
+ `compute.create on <Resource>.<field> returned undefined for a required field`. The field left the create
275
+ requirements because the stage fills it; until now the create reached the database without it, and the
276
+ database's refusal answered `A3001`. This holds for a create's `data`, every record of a bulk create, an upsert's `create`
277
+ branch and a nested create. A reference field counts as missing only when the record writes neither its relation nor
278
+ every reference field, and a nested create's field the parent supplies is never missing. Updates are not checked:
279
+ nothing is required of an update.
280
+ - 9366e16: A Pick layer (`exposed: false`) that names what its parent hid now says why in the type error. A Resource, field,
281
+ family, variant or capability the root (or, for the agent, the layer it extends) hid is typed as
282
+ `readonly ["Error: client cannot expose 'Post.internalNote': hidden by root"]`, so the error TypeScript reports through
283
+ the scaffold's `aventaraConfig()` and `AventaraModule.forRootAsync` ends at:
284
+
285
+ ```text
286
+ The types of 'client.exemptions.resources.Post.fields.internalNote' are incompatible between these types.
287
+ Type 'readonly ["select"]' is not assignable to type 'readonly ["Error: client cannot expose 'Post.internalNote': hidden by root"]'.
288
+ Type '"select"' is not assignable to type '"Error: client cannot expose 'Post.internalNote': hidden by root"'.
289
+ ```
290
+
291
+ where it ended at `Type 'readonly ["select"]' is not assignable to type 'never'.` An entry written `true` names it
292
+ the same way (`Type 'boolean' is not assignable to type 'readonly ["Error: client cannot expose 'Comment': hidden by
293
+ root"]'.`), where it ended at `Type 'true' is not assignable to type 'never'.`. Written inline in `createFramework`
294
+ or `AventaraModule.forRoot`, the error at a `true` entry starts with the sentence:
295
+ `Type 'true' is not assignable to type 'true & (readonly ["Error: client cannot expose 'Comment': hidden by root"] & …)'`.
296
+ An inline literal's list still reads `not assignable to type 'never'` at the key.
297
+
298
+ ## 1.0.0-rc.1
299
+
300
+ ### Patch Changes
301
+
302
+ - 800123b: New: `framework.appTx.$sql`, a developer SQL step in an application transaction. Write it as a tagged template,
303
+ `` framework.appTx.$sql<Row>`select pgmq.send('jobs', jsonb_build_object('postId', ${post.$ref("id")}))` ``, and put it in
304
+ `framework.transaction([...])` beside the other steps. Every interpolated value is a bound parameter, never SQL text:
305
+ strings, numbers, booleans, `bigint`, `null`, `Date`, `Decimal`, bytes, JSON values (bound as JSON text, so cast them
306
+ with `::jsonb`), and a `$ref` to an earlier step's field, read after that step ran. The statement runs in order in the
307
+ same database transaction, so a failure anywhere rolls everything back, and its rows are that step's entry in the
308
+ result, typed `Row[]` (or `unknown[]`). A plain-string call is refused, a later step cannot `$ref` a SQL step's rows,
309
+ and no pipeline runs around it.
310
+
311
+ It is server-side only: `clientTx` has no `$sql`, the ClientContract and its hash are unchanged, and `/_transactions`
312
+ cannot carry one.
313
+
314
+ The Prisma 7 adapter runs it with `$queryRaw` in its tagged form on the transaction client. A raw query's failure is
315
+ `P2010` on Prisma 7.10.0: a uniqueness or foreign-key violation answers `A2008`, anything else `A3001`. The rule is now
316
+ that Aventara never writes raw SQL itself, and developer SQL only goes through this bound template.
317
+
318
+ Adapter authors: an adapter declares `sqlStatements: true`, has an `executeSql` of its own (a plain statement, outside
319
+ any transaction: a stage's `ctx.$sql` there) and gives its transaction executor one too (`AvAdapter.executeSql`,
320
+ `AvAdapterTransactionExecutor`, `AvAdapterSqlStatement` in `@aventara/core/internal`). Without the declaration, a plan
321
+ with a SQL step is refused with `A2002`. The Prisma 7 adapter runs a statement outside a transaction with `$queryRaw`
322
+ on the base client, and declares `sqlStatements` with every driver.
323
+
324
+ - 8bb1d6a: Breaking: public type and class names take the `Av` prefix. Every public type and class is now `Av` plus what
325
+ it is, with a namespace only where the bare name would be ambiguous: configuration types are `AvConfig…`
326
+ (`AvConfig`, `AvConfigLayer`, `AvConfigResource`, …) and the three Contracts are `AvContract…` (`AvContractCore`,
327
+ `AvContractApplication`, `AvContractClient`). Functions keep their names (`createFramework`, `createFakeAdapter`,
328
+ `createPrismaAdapter`, `defineClientConfig`, `env`), and so do the names that already started with `Av`,
329
+ `AventaraModule`, `AventaraModuleOptions` and `AventaraModuleAsyncOptions`. There are no
330
+ aliases: replace each old name with the new one.
331
+
332
+ Three names merged or left:
333
+
334
+ - `PipelineContext` and `ComputeContext` (which was the same type) are one name, `AvContext`. A compute stage
335
+ now gets its own read-only ctx, `AvComputeContext` (see the ctx entry below).
336
+ - `ComputedRead` is `AvComputeRead`, the one name of a read compute stage: a function, or `{ compute, dependsOn }`.
337
+ `ComputeOnRead`, the bare function type, is no longer exported; `AvComputeRead` accepts the function as it is.
338
+ - `defineFields` and `FrameworkFieldsShape` are removed; `defineResource` replaces them (below).
339
+
340
+ `defineResource` replaces `defineFields`. A Resource's configuration, its root block and its overlay blocks, can
341
+ live in its own module and be spread into each layer's `resources` tree:
342
+
343
+ ```ts
344
+ export const submission = defineResource<Model>()(
345
+ "Submission",
346
+ {
347
+ pipelines: { guards: [signedIn] },
348
+ fields: { title: { pipelines: { pipes: [trim] } } },
349
+ },
350
+ { client: { fields: { title: { pipelines: { validators: [AvZ.maxLength(80)] } } } } },
351
+ );
352
+
353
+ // aventara.config.ts
354
+ resources: { ...submission.root, ...payment.root },
355
+ client: { resources: { ...submission.client } },
356
+ ```
357
+
358
+ It returns `{ root, application?, client? }`, each `{ Submission: block }`; a layer given no block is left out. The
359
+ root block is typed exactly as `resources.Submission` is typed in place: field definitions are checked against what
360
+ the adapter discovered, stages are typed for the Resource, and a key no level admits is a type error at the key.
361
+ Each overlay block is typed as `application.resources.Submission` or `client.resources.Submission` is in place,
362
+ against the root block: it may name a field the root block defines, and a `definition` in it is a type error (and
363
+ `CONFIG_FORBIDDEN_IN_OVERLAY` at startup). Spread, the configuration is the inline one: the same Contracts and
364
+ ClientContract hash. A field `definition` that `defineFields` returned now sits at
365
+ `fields.<field>.definition` inside the block.
366
+
367
+ The generated client's names follow the same rule. Regenerate with `avclient generate`; then rename the
368
+ imports from `AvClient.ts`:
369
+
370
+ | Before | After |
371
+ | ----------------------- | ------------------------- |
372
+ | `AuthError` | `AvAuthError` |
373
+ | `CallOptions` | `AvCallOptions` |
374
+ | `Cause` | `AvCause` |
375
+ | `ConflictError` | `AvConflictError` |
376
+ | `ContractMismatchError` | `AvContractMismatchError` |
377
+ | `Decimal` | `AvDecimal` |
378
+ | `Fetch` | `AvFetch` |
379
+ | `FrameworkError` | `AvError` |
380
+ | `InternalError` | `AvInternalError` |
381
+ | `NotFoundError` | `AvNotFoundError` |
382
+ | `Operation<T>` | `AvOperation<T>` |
383
+ | `OperationCode` | `AvOperationCode` |
384
+ | `ProtocolError` | `AvProtocolError` |
385
+ | `TransportError` | `AvTransportError` |
386
+ | `ValidationCode` | `AvValidationCode` |
387
+ | `ValidationError` | `AvValidationError` |
388
+ | `ValidationIssue` | `AvValidationIssue` |
389
+
390
+ An enum whose name is one of these now walks the rename ladder (`AvDecimal` → `AvDecimalEnum`); an enum named
391
+ `Decimal` is emitted as `Decimal`.
392
+
393
+ `@aventara/core`, every renamed export:
394
+
395
+ | Before | After |
396
+ | ------------------------------------- | ---------------------------------- |
397
+ | `Adapter` | `AvAdapter` |
398
+ | `AdapterDiscoveryDiagnostic` | `AvAdapterDiscoveryDiagnostic` |
399
+ | `AdapterDiscoveryDiagnosticCode` | `AvAdapterDiscoveryDiagnosticCode` |
400
+ | `AdapterModel` | `AvAdapterModel` |
401
+ | `AddedFieldDefinition` | `AvConfigAddedFieldDefinition` |
402
+ | `AfterHook` | `AvAfterHook` |
403
+ | `AnyFrameworkConfig` | `AvConfigAny` |
404
+ | `AnyLayerConfig` | `AvConfigLayerAny` |
405
+ | `AnyResourcesBlock` | `AvConfigResourcesAny` |
406
+ | `ApplicationContract` | `AvContractApplication` |
407
+ | `ApplicationScalarForms` | `AvApplicationScalarForms` |
408
+ | `BeforeHook` | `AvBeforeHook` |
409
+ | `BuiltInScalar` | `AvBuiltInScalar` |
410
+ | `Cause` | `AvCause` |
411
+ | `ClientContract` | `AvContractClient` |
412
+ | `ClientContractProtocol` | `AvContractClientProtocol` |
413
+ | `ComputedRead` | `AvComputeRead` |
414
+ | `ComputeOnCreate` | `AvComputeCreate` |
415
+ | `ComputeOnUpdate` | `AvComputeUpdate` |
416
+ | `ConfigDiagnostic` | `AvConfigDiagnostic` |
417
+ | `ConfigDiagnosticCode` | `AvConfigDiagnosticCode` |
418
+ | `ConfigFieldKey` | `AvConfigFieldKey` |
419
+ | `ConfigLayer` | `AvConfigLayerName` |
420
+ | `Contract` | `AvContract` |
421
+ | `ContractCompilerDiagnostic` | `AvContractCompilerDiagnostic` |
422
+ | `ContractCompilerDiagnosticCode` | `AvContractCompilerDiagnosticCode` |
423
+ | `ContractHash` | `AvContractHash` |
424
+ | `ContractLimits` | `AvContractLimits` |
425
+ | `ContractProtocol` | `AvContractProtocol` |
426
+ | `CoreContract` | `AvContractCore` |
427
+ | `CreateDataInput` | `AvCreateDataInput` |
428
+ | `CursorInput` | `AvCursorInput` |
429
+ | `Decimal` | `AvDecimal` |
430
+ | `DeferredOperationCall` | `AvDeferredOperationCall` |
431
+ | `EffectiveFieldKey` | `AvEffectiveFieldKey` |
432
+ | `EnumDefinition` | `AvEnumDefinition` |
433
+ | `ExactFrameworkConfig` | `AvConfigExact` |
434
+ | `ExecutionOptions` | `AvExecutionOptions` |
435
+ | `Field` | `AvField` |
436
+ | `FieldComputeConfig` | `AvFieldCompute` |
437
+ | `FieldKey` | `AvFieldKey` |
438
+ | `FieldPipe` | `AvFieldPipe` |
439
+ | `FieldWriteGuard` | `AvFieldGuard` |
440
+ | `Filter` | `AvFilter` |
441
+ | `Framework` | `AvFramework` |
442
+ | `FrameworkConfig` | `AvConfig` |
443
+ | `FrameworkConstructionDiagnostic` | `AvConstructionDiagnostic` |
444
+ | `FrameworkConstructionError` | `AvConstructionError` |
445
+ | `FrameworkConstructionStage` | `AvConstructionStage` |
446
+ | `FrameworkContracts` | `AvContracts` |
447
+ | `FrameworkDiagnostic` | `AvDiagnostic` |
448
+ | `FrameworkDiagnosticsSink` | `AvDiagnosticsSink` |
449
+ | `FrameworkError` | `AvError` |
450
+ | `FrameworkExemptionsConfig` | `AvConfigExemptions` |
451
+ | `FrameworkFamilyConfig` | `AvConfigFamily` |
452
+ | `FrameworkFieldDefinition` | `AvConfigFieldDefinition` |
453
+ | `FrameworkFieldLifecycleTrait` | `AvConfigFieldLifecycleTrait` |
454
+ | `FrameworkLayerConfig` | `AvConfigLayer` |
455
+ | `FrameworkLayerKind` | `AvConfigLayerKind` |
456
+ | `FrameworkLimitsConfig` | `AvConfigLimits` |
457
+ | `FrameworkMisuseEvent` | `AvMisuseEvent` |
458
+ | `FrameworkMisuseSink` | `AvMisuseSink` |
459
+ | `FrameworkOperationsConfig` | `AvConfigOperations` |
460
+ | `FrameworkOperationsExemption` | `AvConfigOperationsExemption` |
461
+ | `FrameworkOverlayFieldConfig` | `AvConfigOverlayField` |
462
+ | `FrameworkRelationFieldExemption` | `AvConfigRelationFieldExemption` |
463
+ | `FrameworkResourceConfig` | `AvConfigResource` |
464
+ | `FrameworkResourceExemption` | `AvConfigResourceExemption` |
465
+ | `FrameworkResourceFieldsConfig` | `AvConfigResourceFields` |
466
+ | `FrameworkResourceKey` | `AvConfigResourceKey` |
467
+ | `FrameworkResourcesConfig` | `AvConfigResources` |
468
+ | `FrameworkResourceTransactionsConfig` | `AvConfigResourceTransactions` |
469
+ | `FrameworkRootFieldConfig` | `AvConfigRootField` |
470
+ | `FrameworkScalarFieldExemption` | `AvConfigScalarFieldExemption` |
471
+ | `FrameworkScalarTypeRef` | `AvConfigScalarTypeRef` |
472
+ | `FrameworkVariantConfig` | `AvConfigVariant` |
473
+ | `Guard` | `AvGuard` |
474
+ | `Identifier` | `AvIdentifier` |
475
+ | `IncludeInput` | `AvIncludeInput` |
476
+ | `Interceptor` | `AvInterceptor` |
477
+ | `JsonValue` | `AvJsonValue` |
478
+ | `KnownFieldDefinition` | `AvConfigKnownFieldDefinition` |
479
+ | `LifecycleTrait` | `AvLifecycleTrait` |
480
+ | `NullsOrder` | `AvNullsOrder` |
481
+ | `Operation` | `AvOperation` |
482
+ | `OperationArgumentMap` | `AvOperationArgumentMap` |
483
+ | `OperationArgumentsFor` | `AvOperationArgumentsFor` |
484
+ | `OperationAvailability` | `AvOperationAvailability` |
485
+ | `OperationCall` | `AvOperationCall` |
486
+ | `OperationCode` | `AvOperationCode` |
487
+ | `OperationDiagnostic` | `AvOperationDiagnostic` |
488
+ | `OperationErrorCode` | `AvOperationErrorCode` |
489
+ | `OperationFailureResponse` | `AvOperationFailureResponse` |
490
+ | `OperationFamily` | `AvOperationFamily` |
491
+ | `OperationGrammar` | `AvOperationGrammar` |
492
+ | `OperationIdentity` | `AvOperationIdentity` |
493
+ | `OperationNoMatchResponse` | `AvOperationNoMatchResponse` |
494
+ | `OperationReferenceSurface` | `AvOperationReferenceSurface` |
495
+ | `OperationResponse` | `AvOperationResponse` |
496
+ | `OperationResultFor` | `AvOperationResultFor` |
497
+ | `OperationSlot` | `AvOperationSlot` |
498
+ | `OperationSuccessCode` | `AvOperationSuccessCode` |
499
+ | `OperationSuccessDataCode` | `AvOperationSuccessDataCode` |
500
+ | `OperationSuccessResponse` | `AvOperationSuccessResponse` |
501
+ | `OperationVariant` | `AvOperationVariant` |
502
+ | `OperationVariantScopes` | `AvOperationVariantScopes` |
503
+ | `OrderByEntry` | `AvOrderByEntry` |
504
+ | `OrderByInput` | `AvOrderByInput` |
505
+ | `PaginationCapability` | `AvPaginationCapability` |
506
+ | `Pipe` | `AvPipe` |
507
+ | `PipelineConfig` | `AvPipeline` |
508
+ | `PipelineContext` | `AvContext` |
509
+ | `PipelineTransportContext` | `AvTransportContext` |
510
+ | `ProjectionEntry` | `AvProjectionEntry` |
511
+ | `ProjectionScope` | `AvProjectionScope` |
512
+ | `ProjectionScopes` | `AvProjectionScopes` |
513
+ | `ReferenceableField` | `AvReferenceableField` |
514
+ | `ReferenceBuilder` | `AvReferenceBuilder` |
515
+ | `RelationField` | `AvRelationField` |
516
+ | `RelationFieldCapabilities` | `AvRelationFieldCapabilities` |
517
+ | `RelationFieldCapabilityName` | `AvRelationFieldCapabilityName` |
518
+ | `RelationFieldPipelineConfig` | `AvRelationFieldPipeline` |
519
+ | `RelationFilterCapability` | `AvRelationFilterCapability` |
520
+ | `RelationMutationCapability` | `AvRelationMutationCapability` |
521
+ | `RelationMutationDirective` | `AvRelationMutationDirective` |
522
+ | `RelationProjectionCapability` | `AvRelationProjectionCapability` |
523
+ | `RelationProjectionInput` | `AvRelationProjectionInput` |
524
+ | `RelationReducer` | `AvRelationReducer` |
525
+ | `RelationReducerCapability` | `AvRelationReducerCapability` |
526
+ | `RequestOrigin` | `AvRequestOrigin` |
527
+ | `Resource` | `AvResource` |
528
+ | `ResourceFieldMap` | `AvResourceFieldMap` |
529
+ | `ResourceKey` | `AvResourceKey` |
530
+ | `ResourceOperations` | `AvResourceOperations` |
531
+ | `ScalarDefinition` | `AvScalarDefinition` |
532
+ | `ScalarField` | `AvScalarField` |
533
+ | `ScalarFieldCapabilities` | `AvScalarFieldCapabilities` |
534
+ | `ScalarFieldCapabilityName` | `AvScalarFieldCapabilityName` |
535
+ | `ScalarFieldKey` | `AvScalarFieldKey` |
536
+ | `ScalarFieldPipelineConfig` | `AvScalarFieldPipeline` |
537
+ | `ScalarFilterOperator` | `AvScalarFilterOperator` |
538
+ | `ScalarFormat` | `AvScalarFormat` |
539
+ | `ScalarMutationDirective` | `AvScalarMutationDirective` |
540
+ | `ScalarOrderInput` | `AvScalarOrderInput` |
541
+ | `ScalarRegistry` | `AvScalarRegistry` |
542
+ | `ScalarValueType` | `AvScalarValueType` |
543
+ | `ScopedRelationMutations` | `AvScopedRelationMutations` |
544
+ | `ScopedRelationReducers` | `AvScopedRelationReducers` |
545
+ | `SelectInput` | `AvSelectInput` |
546
+ | `SingleRowResult` | `AvSingleRowResult` |
547
+ | `SortDirection` | `AvSortDirection` |
548
+ | `TransactionAfterHook` | `AvTransactionAfterHook` |
549
+ | `TransactionBeforeHook` | `AvTransactionBeforeHook` |
550
+ | `TransactionCapability` | `AvTransactionCapability` |
551
+ | `TransactionCommittedResponse` | `AvTransactionCommittedResponse` |
552
+ | `TransactionDiagnostic` | `AvTransactionDiagnostic` |
553
+ | `TransactionFilter` | `AvTransactionFilter` |
554
+ | `TransactionGuard` | `AvTransactionGuard` |
555
+ | `TransactionIntegrityError` | `AvTransactionIntegrityError` |
556
+ | `TransactionIntegrityViolation` | `AvTransactionIntegrityViolation` |
557
+ | `TransactionInterceptor` | `AvTransactionInterceptor` |
558
+ | `TransactionPipe` | `AvTransactionPipe` |
559
+ | `TransactionPipelineConfig` | `AvTransactionPipeline` |
560
+ | `TransactionPipelineContext` | `AvTransactionContext` |
561
+ | `TransactionReference` | `AvTransactionReference` |
562
+ | `TransactionResponse` | `AvTransactionResponse` |
563
+ | `TransactionResults` | `AvTransactionResults` |
564
+ | `TransactionRunner` | `AvTransactionRunner` |
565
+ | `TransactionSlotPathError` | `AvTransactionSlotPathError` |
566
+ | `TransactionSlotPathViolation` | `AvTransactionSlotPathViolation` |
567
+ | `UniqueWhereInput` | `AvUniqueWhereInput` |
568
+ | `UpdateDataInput` | `AvUpdateDataInput` |
569
+ | `ValidationCode` | `AvValidationCode` |
570
+ | `ValidationIssue` | `AvValidationIssue` |
571
+ | `WhereInput` | `AvWhereInput` |
572
+ | `WireScalarForms` | `AvWireScalarForms` |
573
+ | `WriteScope` | `AvWriteScope` |
574
+ | `WriteScopes` | `AvWriteScopes` |
575
+
576
+ Error classes whose `name` a log or a test may read:
577
+
578
+ | Before | After |
579
+ | ------------------------ | -------------------------- |
580
+ | `CallerDataError` | `AvCallerDataError` |
581
+ | `ClientConfigError` | `AvClientConfigError` |
582
+ | `ComputedValueError` | `AvComputedValueError` |
583
+ | `ContractProtocolError` | `AvContractProtocolError` |
584
+ | `ContractTransportError` | `AvContractTransportError` |
585
+ | `EnvFileError` | `AvEnvFileError` |
586
+ | `OutputValidationError` | `AvOutputValidationError` |
587
+ | `OutputWriteError` | `AvOutputWriteError` |
588
+ | `PipeOutputError` | `AvPipeOutputError` |
589
+ | `UnmountedRouteError` | `AvUnmountedRouteError` |
590
+
591
+ `@aventara/testing`:
592
+
593
+ | Before | After |
594
+ | ------------------------ | -------------------------- |
595
+ | `AdapterFactory` | `AvAdapterFactory` |
596
+ | `FakeAdapter` | `AvFakeAdapter` |
597
+ | `FakeAdapterExecute` | `AvFakeAdapterExecute` |
598
+ | `FakeAdapterOptions` | `AvFakeAdapterOptions` |
599
+ | `FakeAdapterRollback` | `AvFakeAdapterRollback` |
600
+ | `FakeTransactionOutcome` | `AvFakeTransactionOutcome` |
601
+ | `FakeTransactionTrace` | `AvFakeTransactionTrace` |
602
+
603
+ `@aventara/client` (the `framework.client.ts` config types):
604
+
605
+ | Before | After |
606
+ | ------------------- | --------------------- |
607
+ | `ClientConfigInput` | `AvClientConfigInput` |
608
+ | `ConfigValue` | `AvClientConfigValue` |
609
+ | `EnvReference` | `AvEnvReference` |
610
+
611
+ `@aventara/prisma7-adapter`: its public types and error classes (`createPrismaAdapter` keeps its name):
612
+
613
+ | Before | After |
614
+ | ---------------------------------- | ------------------------------------ |
615
+ | `PrismaAdapterModel` | `AvPrismaAdapterModel` |
616
+ | `PrismaAdapterOptions` | `AvPrismaAdapterOptions` |
617
+ | `PrismaDelegate` | `AvPrismaDelegate` |
618
+ | `PrismaDelegateHost` | `AvPrismaDelegateHost` |
619
+ | `PrismaDelegateIndex` | `AvPrismaDelegateIndex` |
620
+ | `PrismaDiscoveryArtifact` | `AvPrismaDiscoveryArtifact` |
621
+ | `PrismaDriver` | `AvPrismaDriver` |
622
+ | `PrismaIsolationLevel` | `AvPrismaIsolationLevel` |
623
+ | `PrismaProvider` | `AvPrismaProvider` |
624
+ | `PrismaProviderProfile` | `AvPrismaProviderProfile` |
625
+ | `PrismaReferentialAction` | `AvPrismaReferentialAction` |
626
+ | `PrismaReferentialActionTable` | `AvPrismaReferentialActionTable` |
627
+ | `PrismaReferentialEdge` | `AvPrismaReferentialEdge` |
628
+ | `PrismaResourceReferentialActions` | `AvPrismaResourceReferentialActions` |
629
+ | `PrismaTransactionOptions` | `AvPrismaTransactionOptions` |
630
+ | `PrismaCapabilityDerivationError` | `AvPrismaCapabilityDerivationError` |
631
+ | `PrismaDiscoveryArtifactError` | `AvPrismaDiscoveryArtifactError` |
632
+ | `PrismaEmulationError` | `AvPrismaEmulationError` |
633
+ | `PrismaExecutionError` | `AvPrismaExecutionError` |
634
+ | `PrismaExistenceGateError` | `AvPrismaExistenceGateError` |
635
+ | `PrismaFieldProjectionError` | `AvPrismaFieldProjectionError` |
636
+ | `PrismaGenerateCliError` | `AvPrismaGenerateCliError` |
637
+ | `PrismaGenerateStepError` | `AvPrismaGenerateStepError` |
638
+ | `PrismaModelCompositionError` | `AvPrismaModelCompositionError` |
639
+ | `PrismaMutationTranslationError` | `AvPrismaMutationTranslationError` |
640
+ | `PrismaOperationTranslationError` | `AvPrismaOperationTranslationError` |
641
+ | `PrismaOrderTranslationError` | `AvPrismaOrderTranslationError` |
642
+ | `PrismaProjectionTranslationError` | `AvPrismaProjectionTranslationError` |
643
+ | `PrismaResultShapeError` | `AvPrismaResultShapeError` |
644
+ | `PrismaScalarConversionError` | `AvPrismaScalarConversionError` |
645
+ | `PrismaSchemaReaderError` | `AvPrismaSchemaReaderError` |
646
+ | `PrismaTypesReaderError` | `AvPrismaTypesReaderError` |
647
+ | `PrismaWhereTranslationError` | `AvPrismaWhereTranslationError` |
648
+
649
+ - 68d4395: New: the generated client checks field validators before it sends. When the ClientContract carries a field's
650
+ `validators` or a Json Shape's checks, `avclient generate` emits them into the client with the check code that runs
651
+ them, and every call and every transaction checks the values it holds first. A call that breaks a check rejects with
652
+ the same `AvValidationError` the server would answer, `A2004` with the same issues (`code`, `path`, `check`,
653
+ `params`, `message`), and no request is sent:
654
+
655
+ ```ts
656
+ try {
657
+ await avClient.projects.create.one({ data: { id: "p1", name: "no" } });
658
+ } catch (error) {
659
+ // error instanceof AvValidationError, error.code === "A2004", nothing was sent:
660
+ // error.cause.issues[0] → { code: "V1004", path: ["arguments", "data", "name"],
661
+ // message: "Value must be at least 3 characters long.", check: "min_length", params: { minimum: 3 } }
662
+ }
663
+ ```
664
+
665
+ - The server checks every value again. The client checks a value as the caller wrote it and the server checks it
666
+ after its field pipes, so a field pipe that normalizes a value (trims it, lower-cases it) must not turn a value the
667
+ client accepted into one the server refuses.
668
+ - A transaction is checked whole before it is sent: a bad literal value in any step rejects with the server's answer,
669
+ `cause.operation` naming the step. A `$ref` value is checked by the server, at its step.
670
+ - Nested write data, list fields (each entry and the list's length), `$push` entries and Json Shape checks are all
671
+ checked, a Json Shape's checks with the other validators in the order the call wrote the fields, and a plan step
672
+ by step, as the server does. A Json value that does not match its shape is sent, and the server answers it.
673
+ - The check code is `@aventara/core`'s own, copied into the generated output; the client still imports nothing from
674
+ `@aventara/*` or zod at runtime. A contract with no checks generates the same files as before.
675
+ - `AvValidationIssue` declares `check` and `params`, and the client keeps them on the issues a server sends (they
676
+ were dropped before).
677
+ - The server lists validator issues in the order the call wrote the fields (it used the model's field order), and a
678
+ Json Shape's issues in the order of its keys as the Contract lists them, so the client can list the same issues in
679
+ the same order. An issue inside a nested write whose operand is one entry rather than a list no longer names an
680
+ index the request does not have (`[…, "$update", "data", …]`, not `[…, "$update", 0, "data", …]`).
681
+
682
+ - 7e3d06f: Breaking: the configuration has a new shape. Every layer (the root, `application` and `client`) now holds the
683
+ same six keys: `exposed`, `transactionsStyle`, `limits`, `pipelines`, `resources` and `exemptions`. Everything about
684
+ one Resource lives under `resources.<Resource>`: its fields, and each field's `definition` and `pipelines`. The old
685
+ keys are refused when the framework starts, with a message that names where each one moved:
686
+
687
+ | Before (rc.0) | Now (rc.1) |
688
+ | ------------------------------------------------------- | ----------------------------------------------------------------------------------- |
689
+ | `fields: { Post: { url: { type, nullable, … } } }` | `resources: { Post: { fields: { url: { definition: { type, nullable, … } } } } }` |
690
+ | `behaviors: { Post: { fields: { slug: { create } } } }` | `resources: { Post: { fields: { slug: { pipelines: { compute: { create } } } } } }` |
691
+ | `transactions: "none"` | `transactionsStyle: "none"` |
692
+ | `restrictions` | `exposed` + `exemptions` (see below) |
693
+ | `@aventara/core/json` | `@aventara/core/avz` |
694
+
695
+ Before:
696
+
697
+ ```ts
698
+ createFramework({
699
+ api: "/api",
700
+ adapter,
701
+ transactions: "interactive",
702
+ fields: {
703
+ Post: {
704
+ url: {
705
+ type: { scalar: "string" },
706
+ nullable: false,
707
+ list: false,
708
+ lifecycle: ["VIRTUAL"],
709
+ },
710
+ },
711
+ },
712
+ behaviors: {
713
+ Post: {
714
+ fields: {
715
+ url: {
716
+ read: {
717
+ dependsOn: ["slug"],
718
+ compute: ({ record }) => `/p/${record.slug}`,
719
+ },
720
+ },
721
+ },
722
+ },
723
+ },
724
+ });
725
+ ```
726
+
727
+ After:
728
+
729
+ ```ts
730
+ createFramework({
731
+ api: "/api",
732
+ adapter,
733
+ transactionsStyle: "interactive",
734
+ resources: {
735
+ Post: {
736
+ fields: {
737
+ url: {
738
+ definition: {
739
+ type: { scalar: "string" },
740
+ nullable: false,
741
+ list: false,
742
+ lifecycle: ["VIRTUAL"],
743
+ },
744
+ pipelines: {
745
+ compute: {
746
+ read: {
747
+ dependsOn: ["slug"],
748
+ compute: ({ record }) => `/p/${record.slug}`,
749
+ },
750
+ },
751
+ },
752
+ },
753
+ },
754
+ },
755
+ },
756
+ });
757
+ ```
758
+
759
+ What else changed:
760
+
761
+ - A field is defined at the root only. A `definition` in `application` or `client` is refused
762
+ (`CONFIG_FORBIDDEN_IN_OVERLAY`). Define the field
763
+ at the root; `application` and `client` can still add compute stages to it.
764
+ - Computed values chain. When the root and an overlay both compute a field, the root's stage runs first and the
765
+ overlay's receives its result as `value`. A stage can no longer be turned off with `false`. Returning `undefined`
766
+ keeps the current value. An upsert computes its create branch with `compute.create` and its update branch with
767
+ `compute.update`.
768
+ - A discovered field keeps the adapter's facts. On a field the adapter discovered you may restate its own `type`,
769
+ `nullable` and `list`, and give a Json field its shape (`definition.json`). Setting a different type, any `format`
770
+ or any `capabilities` on it is refused. `format` is for fields you add, and it must be one of zod's named string
771
+ formats (`"email"`, `"url"`, `"uuid"`, …); any other name is a type error and refused at startup.
772
+ - A misplaced key is a type error. In a configuration written inline in `createFramework({ ... })` or
773
+ `AventaraModule.forRoot`, a key that has no place there (a typo, an old key, `compute` on a relation field, a field
774
+ name neither your schema nor the root has) is now a type error at that key, and still refused at startup.
775
+ - A Resource whose name starts with `$` is refused at startup (`$` names are the framework's).
776
+ - The Json shape builder moved from `@aventara/core/json` to `@aventara/core/avz`. Change the import; `AvZ` is
777
+ the same.
778
+
779
+ `exposed` and `exemptions`, which replace `restrictions`, have their own entry.
780
+
781
+ - 1b5d3c0: Breaking: every framework member of a pipeline ctx is `$`-prefixed, and ctx is now the framework's executor.
782
+ The rest of ctx is your Resources: `ctx.<Resource>.<family>.<variant>(args)`, plus `ctx.$sql` and
783
+ `ctx.$transaction`. Because a Resource name can never start with `$` (`COMPILER_RESERVED_RESOURCE_NAME`), a Resource
784
+ never shadows a framework member. The old names are gone with no alias. Reading one is a type error; at runtime it
785
+ is `undefined`.
786
+
787
+ | rc.0 | rc.1 |
788
+ | --------------------------------------------------------- | --------------------------------------------------------------------------- |
789
+ | `ctx.resource`, `ctx.family`, `ctx.variant`, `ctx.nested` | `ctx.$operation.resource`, `.family`, `.variant`, `.nested` |
790
+ | `ctx.args` | `ctx.$args` (a transaction stage: the plan, `readonly AvTransactionStep[]`) |
791
+ | `ctx.origin` | `ctx.$origin` |
792
+ | `ctx.requestId` | `ctx.$requestId` |
793
+ | `ctx.transport` | `ctx.$transport` |
794
+ | `ctx.contract` | `ctx.$contract` |
795
+
796
+ A transaction stage's ctx has no `$operation`. Every ctx also carries `ctx.$state`, the request's writable state (see
797
+ the `$state` entry below).
798
+
799
+ ```ts
800
+ hooks: {
801
+ after: [
802
+ async (post, ctx) => {
803
+ await ctx.User.update.unique({ where: { id: authorId }, data: { postCount: { $increment: 1 } } });
804
+ await ctx.$sql`insert into audit_events (actor, action) values (${actorId}, ${"post.create"})`;
805
+ },
806
+ ],
807
+ },
808
+ ```
809
+
810
+ - A ctx call is raw and application-origin. It runs the Framework Validation Layer against the
811
+ ApplicationContract, plus field pipes, field validators and compute. It runs no developer stage: no guards, pipes,
812
+ hooks, interceptors or filters at any level, no field write guards, no nested target guards, no Resource
813
+ transaction stages, and no `forceTransaction` wrapping. So a hook's call never re-enters the hook that made it.
814
+ The application layer's exposure limits it. The client's does not.
815
+ - A call resolves the operation's data directly (a row, a list, a count, or `null` for a first-style miss). A
816
+ failure throws the `AvError` subclass of its code's class (`AvNotFoundError`, `AvValidationError`, …; see the
817
+ in-process calls entry below) carrying the failure's `code` and `cause`.
818
+ - It joins the current transaction. That covers a plan step's interceptors and hooks, a forced call's, a Resource's
819
+ transaction stages and a `ctx.$transaction` callback. A step's guards and pipes run before the transaction opens,
820
+ so their calls run on their own, as every call outside a transaction does. Under
821
+ `forceTransaction`, an after hook's ctx writes commit with the operation or not at all (the outbox and
822
+ counter-on-another-Resource cases).
823
+ - `ctx.$sql` is the bound tagged template of `appTx.$sql`, run at once. It takes only the tagged-template form,
824
+ binds every value, needs the Adapter's `sqlStatements`, and accepts no `$ref`. It resolves the rows, typed by
825
+ `ctx.$sql<Row>`. Inside a transaction it runs on it; outside one it is a plain statement, with no transaction
826
+ opened around it, and `transactionsStyle: "none"` does not affect it (only `ctx.$transaction` is refused there).
827
+ - `ctx.$transaction(async (tx) => …)` runs the callback in one transaction, with `tx` the ctx bound to it, and
828
+ resolves what the callback returns. A throw rolls it back and is rethrown as it was. Inside an open transaction it
829
+ opens nothing and joins.
830
+ - The executor is typed from the adapter's model, with the application forms and the operation's data
831
+ as the result, like `framework.application`'s success data. A stage typed for any model (`AvGuard` with no model)
832
+ names no Resource.
833
+ - Compute gets a read-only ctx, `AvComputeContext` (new public name). It carries the `$` facts, a read-only view
834
+ of `ctx.$state`, and `ctx.<Resource>.find.*` (`find.count` included), and nothing that writes: no write families, no `$sql`, no
835
+ `$transaction`. This holds at runtime too: reaching one throws, and the operation answers `A3000`. A compute
836
+ stage's input is now `{ field, value, data, ctx }` (`{ field, value, record, ctx }` on read). rc.0's `origin`,
837
+ `resource` and `operation` members are gone: use `ctx.$origin`, `ctx.$operation`, and the stage's placement for
838
+ its Resource.
839
+ - A transaction pipe's returned plan is typed `readonly AvTransactionStep[]` (any model). The runtime holds it to
840
+ the plan it was given, as before.
841
+
842
+ - 6317811: Breaking: `exposed` and `exemptions` replace `restrictions`. Every layer (the root, `application` and `client`)
843
+ says what it exposes with two keys: `exposed`, the layer's default, and `exemptions`, the entries that are the
844
+ opposite of it.
845
+
846
+ - `exposed: true` (the root's default) exposes everything the layer above offers, and `exemptions` lists what to
847
+ hide. `exposed: false` exposes nothing, and `exemptions` lists the only things to expose.
848
+ - In `exemptions`, `true` exempts an entry whole, `false` and `[]` exempt nothing, a list exempts the listed
849
+ entries one level down, and an object goes one level deeper. A Resource takes `true`, `false` or
850
+ `{ operations, fields }`. Operations are nested: `operations: { find: ["many"], update: { unique: true } }`.
851
+ A field takes a list of capability names, or an object per capability whose token lists name filter operators,
852
+ directives, reducers or pagination kinds.
853
+ - A list now always means "exempt these". rc.0's `filter: ["equals"]` meant "keep only `equals`"; under
854
+ `exposed: true` the same intent is the list of the operators to remove.
855
+ - Overlays only narrow. `application` and `client` start from the root's view. An overlay can no longer bring
856
+ back what the root hid (rc.0's `hidden: false`); that is now refused at startup, and the message names the other
857
+ overlay to hide it in instead. Expose an entry at the root and hide it in the overlay that must not see it.
858
+ - An overlay that sets `exemptions` must also set its own `exposed`.
859
+ - Relation positions are the adapter's: an exemption can no longer narrow where a relation is projected or written.
860
+ - A unique operation (`find.unique`, `update.unique`, `delete.unique`, `upsert.unique`) needs an identifier. Picking
861
+ one without the identifier's fields, or hiding every identifier while one stays exposed, is refused at startup
862
+ with `COMPILER_MISSING_IDENTIFIER` instead of the operation silently disappearing.
863
+
864
+ Every name in `exemptions` must exist, in both styles: a Resource, field, family, variant, capability or token the
865
+ adapter does not offer is refused at startup with its path (`COMPILER_UNKNOWN_RESOURCE`, `COMPILER_UNKNOWN_FIELD`,
866
+ `COMPILER_UNAVAILABLE_OPERATION`, `COMPILER_UNAVAILABLE_CAPABILITY`), and in a configuration written inline in
867
+ `createFramework({ ... })` it is a type error first. Under `exposed: true`, hiding in an overlay what the root
868
+ already hid does nothing.
869
+
870
+ Before (rc.0):
871
+
872
+ ```ts
873
+ createFramework({
874
+ api: "/api",
875
+ adapter,
876
+ restrictions: {
877
+ User: {
878
+ fields: {
879
+ passwordHash: { hidden: true },
880
+ email: { capabilities: { filter: ["equals"] } },
881
+ },
882
+ },
883
+ },
884
+ client: {
885
+ restrictions: {
886
+ AuditLog: { hidden: true },
887
+ Post: { operations: { delete: { unique: false } } },
888
+ },
889
+ },
890
+ });
891
+ ```
892
+
893
+ After (rc.1):
894
+
895
+ ```ts
896
+ createFramework({
897
+ api: "/api",
898
+ adapter,
899
+ // The root: `exposed` defaults to true, so these are hidden from every origin.
900
+ exemptions: {
901
+ resources: {
902
+ User: {
903
+ fields: {
904
+ passwordHash: true,
905
+ email: { filter: ["contains", "startsWith"] }, // remove every operator but `equals`
906
+ },
907
+ },
908
+ },
909
+ },
910
+ client: {
911
+ exposed: true,
912
+ exemptions: {
913
+ resources: {
914
+ AuditLog: true,
915
+ Post: { operations: { delete: ["unique"] } },
916
+ },
917
+ },
918
+ },
919
+ });
920
+ ```
921
+
922
+ Or expose only what a frontend calls:
923
+
924
+ ```ts
925
+ client: {
926
+ exposed: false,
927
+ exemptions: {
928
+ resources: {
929
+ Post: {
930
+ operations: { find: ["many", "unique"], create: ["one"] },
931
+ fields: { id: ["select"], title: ["select", "create"], body: ["select", "create"] },
932
+ },
933
+ },
934
+ },
935
+ },
936
+ ```
937
+
938
+ `aventara init` and `aventara new` now write `exposed: true` into `src/aventara.config.ts`, with a comment that
939
+ links the exposure documentation.
940
+
941
+ - 6d0e5d6: New: field validators. `resources.<R>.fields.<f>.pipelines.validators` takes declarative checks written with
942
+ `AvZ` from `@aventara/core/avz`, in zod's check vocabulary:
943
+
944
+ ```ts
945
+ import { AvZ } from "@aventara/core/avz";
946
+
947
+ resources: {
948
+ Project: {
949
+ fields: {
950
+ name: { pipelines: { validators: [AvZ.minLength(3), AvZ.maxLength(80)] } },
951
+ slug: { pipelines: { validators: [AvZ.regex(/^[a-z0-9-]+$/)] } },
952
+ budget: { pipelines: { validators: [AvZ.gte(0), AvZ.multipleOf(100)] } },
953
+ tags: { pipelines: { validators: [AvZ.maxItems(5), AvZ.maxLength(20)] } }, // at most 5 tags of at most 20 characters
954
+ },
955
+ },
956
+ },
957
+ ```
958
+
959
+ - The builders: `lt`, `lte`, `gt`, `gte`, `positive`, `nonnegative`, `negative`, `nonpositive`, `multipleOf`,
960
+ `minLength`, `maxLength`, `length`, `minItems`, `maxItems`, `minSize`, `maxSize`, `size`, `regex`, `includes`,
961
+ `startsWith`, `endsWith`, `lowercase`, `uppercase`, and one per named format: `email`, `url`, `uuid`, `e164`,
962
+ `ipv4`, `ipv6`, `base64`, `nanoid`, `cuid`, `ulid` and the rest, with `AvZ.iso.datetime()`, `.date()`, `.time()`
963
+ and `.duration()`. Each behaves as zod 4's check does.
964
+ - A check has to fit the field's type: `AvZ.maxLength` on an `int` field, or `AvZ.maxItems` on a field that is not a
965
+ list, is a type error and a startup error (`COMPILER_INVALID_VALIDATOR`, naming the path and why). On a list field
966
+ `minItems`/`maxItems` check the list and every other check applies to each entry. A bound is a number, a bigint or a
967
+ `Date`, matching the field.
968
+ - A Json field takes no `validators` key. Its checks go in its `definition.json` shape, written as zod/mini writes
969
+ them: `AvZ.object({ code: AvZ.string().check(AvZ.length(4)), tags: AvZ.array(AvZ.string()).check(AvZ.maxItems(3)) })`.
970
+ - Where they run: once, after every pipe (the guards, then the operation's pipes, then the field pipes) and before
971
+ any interceptor or hook; for a transaction plan or a forced call, on every step's literal values before the
972
+ transaction opens, and on a `$ref` value at its step; on nested write data with the target Resource's checks.
973
+ What they judged is what is written: no later stage can change it. Validators add up across layers: the root's
974
+ apply to both origins, an overlay's to its own.
975
+ - A Json field's shape is one of its validators. Its structure and its checks are judged where validators run, after
976
+ every pipe (rc.0 judged the shape before the pipes), with the same reach: plan literals before the transaction
977
+ opens, a `$ref` value at its step, and nested write data. Its issues come in the order the call wrote the fields,
978
+ with the other validators'. Before the
979
+ pipes the framework only checks that a Json value is plain JSON. A field or operation pipe whose Json output breaks
980
+ the shape is answered `A2004`, as the caller's, not `A3004`. The shape still types the field.
981
+ - A failure answers `A2004` (HTTP 422) with one issue per broken rule, on `V1004` (range, length, size) or `V1003`
982
+ (pattern, format). Each issue now also carries zod's `check` name and the check's `params`, for example
983
+ `{ "code": "V1004", "path": ["arguments", "data", "name"], "check": "max_length", "params": { "maximum": 80 }, "message": "Value must be at most 80 characters long." }`.
984
+ - The checks are in the Contract: a field's `validators` (`AvFieldCheck`, now exported) and a Json Shape node's
985
+ `checks`, only on fields the layer exposes. Adding, removing or changing a client-visible check changes the
986
+ ClientContract hash, so regenerate the client. The generated client runs the same checks before it sends a call.
987
+
988
+ - 7a0cab9: A `where` now offers each field only the filter operators that field allows. The types of `framework.client`,
989
+ `framework.application`, `framework.clientTx`, `framework.appTx` and a generated client read the operators from the
990
+ field's effective `filter` capability, so an operator the server would refuse with `V1006` is now a type error
991
+ instead. That covers an operator the adapter does not offer for the field's type (no `contains` on an Int), an
992
+ operator a layer's exemptions removed (the client layer narrowing `email` to `equals` is refused on
993
+ `framework.client` and still allowed on `framework.application`), and operators inside a nested `not`. A plain
994
+ value, `null` or `$ref` as shorthand is equality, so it is only accepted where the field allows `equals`, and a field
995
+ narrowed to no operators at all can no longer be named in a `where`. Runtime behavior is unchanged.
996
+
997
+ A generated client picks this up when it is regenerated with this version of `@aventara/client`.
998
+
999
+ - eb2a718: New limit `maxJsonDepth` (default 64): how deeply a `json` field's value may nest. Each array or object inside the value
1000
+ is one level, counted from the value itself, wherever it is written or filtered on. A value past the limit is refused
1001
+ with `A2009` and the new issue code `V1021` at the field's path, before anything else reads it, in single calls,
1002
+ transaction steps and over HTTP. It is set like the other limits, at the root or per layer, and appears in the
1003
+ Contract's `limits`, so the ClientContract hash changes: regenerate your client. `maxNestingDepth` does not count Json
1004
+ values. Before, a value 10,000 levels deep was written and then failed over HTTP with an internal `A3003`, and in a
1005
+ transaction failed with `A3000`. The HTTP response encoder and `canonicalizeJson` no longer recurse on a value's depth,
1006
+ so a deep value already in your database is read without an error.
1007
+ - 03312c5: Fixed a bug where operators inside `not` weren't checked against a field's allowed operators. On a field whose
1008
+ `filter` capability allowed only `equals` and `not`, a request like `where: { id: { not: { contains: "a" } } }` passed
1009
+ validation and reached the adapter, so a remote caller could use an operator the client layer had removed. Operators
1010
+ inside `not` are now checked at every depth, in single calls and transaction steps, under `AND`/`OR`/`NOT` and relation
1011
+ filters, and are refused with `A2004`/`V1006` at the nested operator's path. A `not` written as a plain value, `null` or
1012
+ `$ref` means "not equal", so it is accepted only where the field allows `equals`; the types now say the same. An empty
1013
+ `not: {}` is refused with `V1001`, like an empty filter object.
1014
+ - 123f6dc: Breaking: nested writes now run the target's guards. When a create, update or upsert reaches another Resource
1015
+ through a relation directive, that target Resource's own guards and field stages now run on the nested data, in
1016
+ Node, before the single adapter call (still one call). In rc.0 a nested write ran none of them, so a client could
1017
+ create a Category through `Post.create({ data: { category: { $create: … } } })` past a guard that refuses
1018
+ `Category.create`. That call is now refused with `A4001`.
1019
+
1020
+ Which stages a directive runs on its target:
1021
+
1022
+ | Directive | The target's stages |
1023
+ | -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
1024
+ | `$create`, `$connectOrCreate` | Resource and `create` guards; field stages on the created data |
1025
+ | `$update`, `$upsert` | Resource and `update` guards; field stages (an `$upsert`'s `create` branch gets the create field stages and `compute.create`, its `update` branch the update ones) |
1026
+ | `$delete` | Resource and `delete` guards |
1027
+ | `$connect`, `$disconnect`, `$set` on a to-one whose key the parent holds | None: the parent's relation field write guard covers it |
1028
+ | `$connect`, `$disconnect`, `$set` on a to-many, or a to-one whose key the target holds | Resource and `update` guards |
1029
+
1030
+ - The field stages are the target's field pipes, field validators, field write guards and write compute.
1031
+ - Order: each kind runs after the top-level operation's stages of the same kind, for the targets depth first in
1032
+ data order: the operation's guards and field write guards, then each target's Resource guards, family guards and
1033
+ field write guards; the operation's pipes; the operation's field pipes, then the targets'; the validators; the
1034
+ operation's write compute, then the targets'.
1035
+ - What a target's stage is told: `ctx.$operation.resource` is the target, `ctx.$operation.family` the family its directive maps to,
1036
+ `ctx.$operation.variant` is `"one"`, `ctx.$operation.nested` is `true` and `ctx.$args` is the directive's entry (for example the
1037
+ `$create` data, or a `$connect`'s identifier). A family stage's `ctx.$operation.variant` is now typed as the family's
1038
+ variants or `"one"`, for `create`, `update` and `delete`.
1039
+ - Not run for a target: its layer and variant stages, operation pipes, hooks, interceptors and filters, and its
1040
+ Resource transaction stages. A nested write is part of its parent's operation; an error a target's guard throws
1041
+ goes through the parent operation's filters.
1042
+ - Who holds the key is read from the adapter's referential edges (`AvAdapter.referentialActions`). An adapter
1043
+ that states no edge for a to-one relation is read as the target holding it, so the target's `update` guards run.
1044
+ - The same holds for a transaction step and a forced call: each step's nested targets' guards, field pipes and
1045
+ validators run with the step's own before the transaction opens, and a nested `$ref` value goes through the
1046
+ target's field pipes and validators when it resolves at its step.
1047
+
1048
+ - b65df2e: Fixed a gap where a chain of `not` inside a scalar filter (`{ id: { not: { not: … } } }`) wasn't counted toward
1049
+ `maxNestingDepth`. A 50-level chain reached the adapter, and a 5,000-level one failed with an internal `A3000` error
1050
+ (a stack overflow) instead of a validation error. Each `not` whose value is an object now counts as one level of
1051
+ `where` nesting, like `NOT`, so a chain past the limit is refused with `A2009`/`V1013` before anything runs, in single
1052
+ calls, transaction steps and over HTTP. `framework.transaction` no longer overflows on deeply nested arguments either.
1053
+ - c6e5010: Breaking: one stage order, and hooks now run inside interceptors. Every operation runs
1054
+
1055
+ ```
1056
+ guards → pipes → validators → interceptors (before) → hooks.before → operation → hooks.after → interceptors (after) → filters
1057
+ ```
1058
+
1059
+ Each stage runs over every level, outer to inner, before the next starts, so every interceptor wraps every hook: all
1060
+ interceptors enter, then every `before` hook runs, then the operation, then every `after` hook (inner to outer), then
1061
+ the interceptors unwind (inner to outer). In rc.0 every `before` hook ran ahead of every interceptor, every `after`
1062
+ hook after every interceptor had unwound, and the overlay's `after` hooks after the root's; now the overlay's run
1063
+ before the root's. Filters run inner to outer, and the first filter that handles an error wins. A call that a guard,
1064
+ a pipe's output or a validator refuses runs no interceptor and no hook; the filters still see a thrown error. Inside
1065
+ a transaction, a step's error its own filters leave unhandled continues to the Resource transaction filters (the
1066
+ transaction's outer layer) before it is answered.
1067
+
1068
+ New: stages at every level of `resources`. `resources.<R>.pipelines`, `resources.<R>.operations.<family>.pipelines`
1069
+ and `resources.<R>.operations.<family>.<variant>.pipelines` run now, in both layers, level by level: root layer,
1070
+ overlay layer, root Resource, overlay Resource, root family, overlay family, root variant, overlay variant. Nothing
1071
+ below removes a stage above. A stage is told the level it sits at: a Resource's `ctx.$operation.resource` is its name, a
1072
+ family's `ctx.$operation.family` too, a variant's `ctx.$operation.variant` as well.
1073
+
1074
+ - Field pipes (`resources.<R>.fields.<f>.pipelines.pipes`) are pure: value in, value out, no `ctx`. They run on
1075
+ each value the caller sent in top-level create, update or upsert data, right after the operation's pipes, root's
1076
+ then overlay's; guards see the value as sent. In a transaction they run on every step's literal values before the
1077
+ transaction opens, and on a `$ref` value when it is resolved at its step. A value a field pipe returns is held to the server's rules
1078
+ (`A3004`). A relation field takes no field pipes (`COMPILER_RELATION_FIELD_CONFIG_UNSUPPORTED`).
1079
+ - Field write guards (`resources.<R>.fields.<f>.pipelines.guards`) refuse with `A4001` when the caller sends
1080
+ the field in create, update or upsert data, a relation field's `$connect` included. They run right after the
1081
+ operation's guards, last among the guards.
1082
+ - Transactions: every step's guards, pipes and validators run before the transaction opens, in plan order; an
1083
+ operation pipe sees a `$ref` as the reference it is. A refused step opens nothing. Then BEGIN, and at each step
1084
+ its `$ref`s are resolved, their field pipes and validators run, then the step's interceptors and hooks around its
1085
+ adapter call. A forced call runs the same way. A step's guards and pipes no longer run inside the transaction, so
1086
+ their ctx calls do not join it.
1087
+ - Resource transaction stages (`resources.<R>.transactions.pipelines`) run once per transaction with a
1088
+ top-level step on the Resource, inside it: guards and pipes see the whole plan (`ctx.$args`, `$ref`s unresolved),
1089
+ interceptors and hooks wrap every step, and the `after` hooks see every step's result before the commit, so a
1090
+ throw rolls everything back. Touched Resources run in the order their first step appears; a SQL step touches
1091
+ nothing. A transaction pipe may change a step's arguments; they are held to the server's rules and their
1092
+ validators at the step.
1093
+ - `forceTransaction` on a family or a variant runs a plain call of that operation as a one-step transaction,
1094
+ so its after hooks commit with the write or not at all, and the Resource's transaction stages run. It holds when
1095
+ any layer sets it. As a step of a plan it is just a step. Under an effective `transactionsStyle: "none"` it is a
1096
+ startup error (`CONFIG_INVALID_VALUE`).
1097
+
1098
+ Breaking: a transaction has one origin. `framework.transaction` refuses a list that mixes `appTx` and
1099
+ `clientTx` handles: `A2004` with one new `V1020` issue, "Transaction mixes application and client steps.", at the
1100
+ first step of the other origin, before anything runs. An `appTx.$sql` step is application-origin. Run each
1101
+ origin's steps as its own transaction. The generated client's error codes include `V1020`.
1102
+
1103
+ - c1f9389: A forced operation no longer commits a failed step when a Resource transaction interceptor catches the rollback.
1104
+ A transaction plan and a plain call of a `forceTransaction` operation now settle through one path, so the check that
1105
+ already kept a plan from committing a swallowed failure covers forced calls too.
1106
+
1107
+ `next()` runs once. A Resource transaction interceptor that calls it a second time, or resolves without calling it,
1108
+ rolls the whole transaction back and answers `A3002`, with an `AvTransactionIntegrityError` (`next-called-twice` or
1109
+ `steps-not-run`) on the diagnostics channel. An operation interceptor's second `next()` is refused the same way and
1110
+ answers `A3000`. Both hold even when the interceptor catches the refusal, and no filter sees it.
1111
+
1112
+ What a field pipe returns is checked against the server's rules before the transaction opens, for a plan step and
1113
+ for a forced call. A refusal (`A3004`) no longer opens a transaction or runs transaction stages first.
1114
+
1115
+ A `compute.read` `dependsOn` is resolved against the adapter's model, before exposure. A field hidden at the root can
1116
+ now be a dependency: it is read for the compute and never returned. A dependency must be a scalar field the adapter
1117
+ stores on the same Resource; the type of `dependsOn` now says so.
1118
+
1119
+ Under `exposed: false`, an exemption object that grants nothing (`{}`, `{ select: false }`, `{ create: [] }`, or a
1120
+ Resource object that grants no field and no operation) leaves the field or Resource out of the Contract, exactly as
1121
+ leaving the entry out does. Its name no longer reaches the ClientContract, and the hash is the same either way.
1122
+
1123
+ Compute mistakes are reported once, at the path where they were written. A root mistake is no longer repeated under
1124
+ `application` and `client` paths.
1125
+
1126
+ `forceTransaction: true` is a type error where the types know the effective `transactionsStyle` is `"none"`: the
1127
+ adapter's model states `transactions: "none"`, or the layers state a literal `"none"`.
1128
+
1129
+ Resource transaction stages are told a typed plan. `ctx.$args` is `readonly AvTransactionStep[]`, an operation step
1130
+ `{ resource, family, variant, args }` or a SQL step `{ sql }`, and a transaction pipe returns that type or `undefined`.
1131
+ `AvTransactionStep` is a new public type.
1132
+
1133
+ Renamed compiler codes: `COMPILER_MISSING_READ_BEHAVIOR` is now `COMPILER_MISSING_READ_COMPUTE`, and
1134
+ `COMPILER_INVALID_BEHAVIOR_DEPENDENCY` is now `COMPILER_INVALID_COMPUTE_DEPENDENCY`.
1135
+
1136
+ Smaller fixes: a plan with steps of two origins is refused with `V1020` when the plan is validated too, not only by the
1137
+ typed runner; a transaction pipe may return a deep copy of a SQL step; `validators: []` is accepted; a `hidden` key on a Resource or field entry is `CONFIG_MOVED_PROPERTY`; and
1138
+ an overlay's moved `restrictions` key now names `client.exposed + client.exemptions`.
1139
+
1140
+ - 9c52482: A `$connect` to a row that does not exist now answers `404 A2003` (not found), the same as reading a missing row.
1141
+ Before, it answered `422 A2004`. This covers a to-one `$connect` in `create`, `update` and `upsert`, a to-many
1142
+ `$connect`, and the same writes inside a transaction plan, where `cause.operation` names the step. The message is
1143
+ unchanged: "The operation's arguments referenced a record that does not exist." On `update.first`, the same mistake
1144
+ answered `A2014` before, as if the row had changed underneath; it now answers `A2003` too, and a duplicate unique value
1145
+ written through `update.first` answers `409 A2008` instead of `A3001`.
1146
+
1147
+ Clearer top-level messages for an unknown Resource or operation. `A2001` now says "The requested Resource is not
1148
+ available." and `A2002` says "The requested operation is not available on this Resource.", instead of "Operation
1149
+ arguments failed framework validation.", which stays the message of `A2004`, `A2007` and `A2009`. A transaction step
1150
+ whose operation is outside the standard grammar now carries the same issue message as a single call, naming the
1151
+ operation and the Resource (for example `Operation "dance.one" is not available on Resource "posts".`), instead of
1152
+ "Operation is not part of the standard operation grammar."
1153
+
1154
+ A `$ref` with no `fingerprint` is `V1000` (required value missing) and answers `422 A2004`. Before, it was `V1017`
1155
+ (fingerprint mismatch) under `A2007`. A fingerprint that is present but wrong is still `V1017`.
1156
+
1157
+ `aventara init` and `aventara new` link to the documentation at https://aventara-framework.vercel.app. The old
1158
+ address redirects, so links already written into projects keep working.
1159
+
1160
+ - 8396148: Types: a method that returns a call's result without a return type now compiles in a project that emits
1161
+ declarations (`declaration: true`, Nest's default). With a shaped Json field, or a `$sql` or `clientTx` handle in
1162
+ the result, TypeScript stopped with TS2742 (TS2883 in TypeScript 6) or TS4053, because the declaration had to name
1163
+ a type that was not exported. Two type exports are new: `AvZShapedSchema` from `@aventara/core/avz` (a shaped Json
1164
+ field's schema in a typed Contract view) and `AvOperationHandle<T, Origin>` from `@aventara/core` (the opaque part of
1165
+ a transaction handle).
1166
+
1167
+ A handle now carries its builder's origin: `framework.transaction([...])` with `appTx` and `clientTx` handles in one
1168
+ list is a type error (it was refused only at runtime, `A2004` / `V1020`, which still guards). `AvOperation<T>`
1169
+ takes an optional second type argument, `"application"` or `"client"`; a handle typed without it joins either list.
1170
+
1171
+ A method that returns a façade node without a return type now compiles there too:
1172
+ `posts() { return this.framework.application.Post; }`, a whole surface, a Resource, a family, on any of
1173
+ `application`, `client`, `appTx` and `clientTx`. The declaration writes the node's name with the Contract view as
1174
+ its argument, instead of expanding every call under it, which TypeScript refused (TS4053, then TS7056 "exceeds the
1175
+ maximum length the compiler will serialize") from a few Resources up. Twelve type exports are new, one set per
1176
+ surface: `AvApplicationFacade`, `AvApplicationResourceFacade`, `AvApplicationFamilyFacade`, and the same for
1177
+ `AvClient…`, `AvAppTx…` and `AvClientTx…`. Measured over 50 Resources (Nest 12's `tsconfig`, TypeScript 6): each such
1178
+ method emits about 400 KB of declaration and the build peaks at about 370 MB. A variant (`…Post.find.many`)
1179
+ is still a call type the declaration cannot name: give that method a return type, or return the call's result.
1180
+
1181
+ An exported `defineResource(...)` result, and an exported configuration or Framework builder that holds typed
1182
+ stages (spread from a `defineResource` result or written inline in `createFramework`), now compile there too. Before,
1183
+ one typed variant pipe was enough for TS7056: a declaration wrote each inline stage's parameter types, and with them
1184
+ the whole model, once per parameter. The types that carry a configuration onwards now state each stage list by its
1185
+ public type for any model (`readonly AvGuard[]`, `readonly AvPipe[]`, …): `defineResource` returns the new
1186
+ `AvDefinedResource<R, Block, Overlays>`, and `createFramework`'s `AvFramework<M, Cfg>` carries the configuration that
1187
+ way. Every key, field definition, `forceTransaction`, validator and compute phase is kept as written, so a spread
1188
+ block is still checked where it is placed and the façades are unchanged; `AvFramework<M, typeof config>` still
1189
+ receives `createFramework(config)`. Measured with the scaffold's shape over 2 Resources, the declarations shrink from
1190
+ 5.4 MB to 84 KB; over 50 Resources they emit (before: TS7056) and the build peaks under 400 MB.
1191
+
1192
+ - e8fbb02: Breaking: data is read-only once it is final, and every stage gets `ctx.$state`.
1193
+
1194
+ Pipes are now the only stage that changes the arguments. A pipe is told frozen arguments and returns new ones (or
1195
+ `undefined` to keep them); changing them in place throws a `TypeError`. Guards, interceptors, hooks and filters are
1196
+ told frozen arguments too, and an `after` hook a frozen copy of the result. The validators judge what the pipes
1197
+ returned, and that is exactly what the adapter writes: a hook or an interceptor can no longer change the write after
1198
+ validation. An interceptor may still return a different result after `next()`; the output check holds it. The result a
1199
+ caller receives is not frozen. A `Date` or a `Uint8Array` cannot be frozen, so after validation each stage gets its
1200
+ own copy of it. Compute fills its fields on the framework's own copy, and its `data` is a frozen snapshot.
1201
+
1202
+ ```ts
1203
+ // rc.1: return new arguments instead of changing them.
1204
+ pipes: [(args) => ({ ...args, data: { ...args.data, ownerId: ownerOf(args) } })],
1205
+ ```
1206
+
1207
+ `ctx.$state` is the one writable space per request. Declare what it holds once, then read and write it in any stage:
1208
+
1209
+ ```ts
1210
+ declare module "@aventara/core" {
1211
+ interface AvState {
1212
+ user?: { id: string; roles: string[] };
1213
+ }
1214
+ }
1215
+
1216
+ const signedIn: AvGuard = (ctx) => ctx.$state.user !== undefined;
1217
+ ```
1218
+
1219
+ - One object per request. A transaction's steps and its Resource transaction stages share it, and a ctx call,
1220
+ `ctx.$sql` and `ctx.$transaction` inherit the stage's. Compute gets a read-only view; writing through it throws a
1221
+ `TypeError`.
1222
+ - Seed it per call: `framework.application.Post.create.one(args, { state })`, the same on `framework.client`, and
1223
+ `framework.transaction(handles, { state })`. The object is used as it is, so you see what the stages wrote. A call
1224
+ that seeds nothing starts with `{}`.
1225
+ - `framework.execute` and `executeTransaction` take it as the request's `state` member (not an object: `A2004`,
1226
+ `V1001` at `["state"]`). `AvProtocol.bind(framework).handleOperation(request, { state: () => … })` and
1227
+ `handleTransaction` take a seed function, called once the request is decoded. A seed that throws an `AvError`
1228
+ answers that error; any other throw answers `A3000` and reaches diagnostics.
1229
+ - `@aventara/nest` seeds it from the platform request (see its changelog).
1230
+
1231
+ New public types: `AvState` and `AvDeepReadonly<T>`, the read-only shape to claim when a stage reads
1232
+ `ctx.$args` (`ctx.$args as AvDeepReadonly<PostArgs>`). A generated client copies `AvState`'s declaration with the
1233
+ rest of core's types; it does nothing there.
1234
+
1235
+ - 916e5f6: Breaking: in-process calls return data and throw, with the generated client's error classes.
1236
+ `framework.application`, `framework.client` and `framework.transaction` now settle the way the generated client
1237
+ does: they resolve the data and throw every failure as the `AvError` subclass of its code's class. The subclasses
1238
+ are new exports of `@aventara/core`, chosen by one code→class table the generated client reads too:
1239
+
1240
+ | Class | Codes |
1241
+ | ------------------------- | ------------------------------------------- |
1242
+ | `AvProtocolError` | A2000, A2001, A2002, A2006, A2010–A2012 |
1243
+ | `AvNotFoundError` | A2003 |
1244
+ | `AvValidationError` | A2004, A2007, A2009 |
1245
+ | `AvContractMismatchError` | A2005 |
1246
+ | `AvConflictError` | A2008, A2013, A2014 |
1247
+ | `AvInternalError` | A3000–A3004 |
1248
+ | `AvAuthError` | A4000–A4002 |
1249
+
1250
+ `instanceof` works, and `error.code` and `error.cause` are what the envelope carried (a transaction's
1251
+ `cause.operation` names the failing step). A stage's ctx calls throw the same subclasses. `framework.execute`,
1252
+ `framework.executeTransaction` and the protocol binding still answer the envelope: it is the transport's format.
1253
+
1254
+ ```ts
1255
+ // Before
1256
+ const res = await framework.application.Post.find.unique({ where: { id }, select: ["id", "title"] });
1257
+ if (res.code !== "A1000") return null;
1258
+ return res.data;
1259
+ const result = await framework.transaction([user, post]);
1260
+ if (result.code === "A1009") use(result.data[1]);
1261
+
1262
+ // After
1263
+ try {
1264
+ return await framework.application.Post.find.unique({ where: { id }, select: ["id", "title"] });
1265
+ } catch (error) {
1266
+ if (error instanceof AvNotFoundError) return null;
1267
+ throw error;
1268
+ }
1269
+ const [created, written] = await framework.transaction([user, post]);
1270
+ ```
1271
+
1272
+ The façades' result types follow: a call resolves the operation's slot (`T`, or `T | null` for a `first`), and
1273
+ `framework.transaction` resolves its results tuple. `AvOperationCall` loses its `Settlement` parameter (every direct
1274
+ call settles to data), and `AvError` takes its code as a type parameter (`AvError<"A2003">`); `new AvError(code,
1275
+ cause)` is unchanged.
1276
+
1277
+ New: a stage registered at a variant (`resources.<R>.operations.<family>.<variant>.pipelines`) gets its operation's
1278
+ arguments typed. `ctx.$args` is that operation's arguments, deep read-only, so a write is a type error and the editor
1279
+ completes `data`, `where`, `select`; a pipe there is told that type, deep read-only too, and must return it (or
1280
+ `undefined`). The type is read from the model's Application Contract view in the application forms, and a reference
1281
+ position also admits a plan step's unresolved `$ref`. Layer, Resource and family stages keep `unknown`. A pipe typed
1282
+ for any operation (`AvPipe`) still fits a variant; its output is held to the server's rules at runtime (`A3004`). The
1283
+ stage types `AvContext`, `AvGuard`, `AvPipe`, `AvBeforeHook`, `AvAfterHook`, `AvInterceptor`, `AvFilter` and
1284
+ `AvPipeline` take the arguments as a new last type parameter, `unknown` by default.
1285
+
1286
+ Behaviour change: a Resource's transaction filters are the transaction's outer layer, and they run last. An error a
1287
+ step throws inside a transaction goes through that step's own filters first, inner to outer; when none handles it,
1288
+ the transaction interceptors unwind (their `next()` rejects), and then it goes to the touched Resources' transaction
1289
+ filters (the last-touched Resource's first) before it is answered. A transaction interceptor's `next()` rejects with
1290
+ the failed step's outcome as the `AvError` a façade would throw for it (`AvNotFoundError` for a unique miss,
1291
+ `instanceof` works, `code` and `cause` are set); before, it rejected with an internal rollback object. An error the
1292
+ step's filters leave unhandled reaches the interceptor sanitized, as the caller would get it. Catching it still cannot
1293
+ commit the failed step. An error a transaction stage throws goes to the
1294
+ transaction filters alone, also after the interceptors have unwound. ROLLBACK follows both. Before, a step's
1295
+ unhandled error was answered without reaching them.
1296
+
1297
+ Behaviour change: a strict unique operation that matches no row (`find.unique`, `update.unique`, `delete.unique`)
1298
+ now fails at the operation, inside the pipeline, as a missing `$connect` target already did. No `after` hook runs
1299
+ for it, an interceptor's `next()` throws the `AvNotFoundError` (it resolved `null` before), the filters see it and
1300
+ may answer another outcome, and a forced call or a transaction step rolls back. Unhandled, it is the same `A2003`
1301
+ as before: the façades throw `AvNotFoundError` and HTTP answers `404`. A `find.first`, `update.first` or
1302
+ `delete.first` that matches no row still resolves `null`, and its `after` hooks run.
1303
+
1304
+ Performance: field write guards and field pipes are dispatched from lists planned at startup, per origin and
1305
+ Resource. A call to a Resource with no field guard reads no record for one, a `create.many` walks its records for
1306
+ guards only when a guarded field is registered, and nested data is walked for guards only when some guard exists.
1307
+
1308
+ - Breaking: required create fields are typed. Each Resource now states what a create cannot do without, and every
1309
+ create payload is typed by it: `framework.application`, `framework.client`, `appTx`/`clientTx`, a stage's `ctx` and
1310
+ typed `args`, and generated clients. Leaving out a required field is a type error, and so is writing a required
1311
+ relation neither way or both ways:
1312
+
1313
+ ```ts
1314
+ await framework.application.Post.create.one({ data: { title: "Hi", authorId } }); // ok
1315
+ await framework.application.Post.create.one({ data: { title: "Hi", author: { $connect: { id } } } }); // ok
1316
+ await framework.application.Post.create.one({ data: { title: "Hi" } }); // type error: `author` or `authorId`
1317
+ await framework.application.Post.create.one({ data: { authorId } }); // type error: `title`
1318
+ ```
1319
+
1320
+ It covers `create.one`'s `data`, every `create.many` and `create.count` record, `upsert`'s `create`, and nested
1321
+ `$create`, `$connectOrCreate` and `$upsert` payloads. A create nested through a relation gets that relation from its
1322
+ parent, so `author: { $create: … }` is not needed inside `Author.posts.$create`. A `$ref` satisfies a field.
1323
+
1324
+ The fact is a new optional member of every Resource in every Contract, `createRequirements`
1325
+ (`AvCreateRequirements`, `AvCreateRequirementGroup`): `required` (fields), `oneOf` (each required to-one relation and
1326
+ the fields holding its reference, `[["author", "authorId"]]`; a composite reference is all of its fields together),
1327
+ and `parentSupplies` (what a nested create gets from its parent). Each layer's Contract states only what that layer
1328
+ lets a caller write: when the layer hides `authorId`, `author` alone is required; when it hides `author`, `authorId`
1329
+ is. A field a `compute.create` stage fills is not required. The Client Contract's hash changes for every schema with a
1330
+ required field or relation, so regenerate your clients.
1331
+
1332
+ Adapter authors: the requirements move from the adapter's own `createRequirements` table, which is removed, onto its
1333
+ model (`AvAdapterResource.createRequirements`, the same shape as the Contract's, before any layer is applied). A name
1334
+ there that is no field of the right kind fails construction with `COMPILER_UNKNOWN_FIELD`.
1335
+
1336
+ The runtime check is unchanged in what it answers (`A2004` with `V1000` at the missing field, or at the relation where
1337
+ the caller may write it; `V1012` for both), and now reads the active Contract's statement. Two consequences: a
1338
+ relation the layer requires alone is reported without naming a reference field the layer hides, and a required
1339
+ relation's reference fields come from the statement, so an adapter that states no referential edges still has a
1340
+ required relation written either way.
1341
+
1342
+ A field an operation pipe fills on the server is now required of the caller. Give it a `compute.create` stage or a
1343
+ database default so callers can leave it out, or have them pass it.
1344
+
1345
+ A layer that still creates a Resource can no longer leave a requirement unwritable. Hiding a required field (or
1346
+ exempting its `create` capability), or a required relation together with a reference field it needs, while the layer
1347
+ keeps a `create` or `upsert` variant or a nested create into the Resource, fails construction with
1348
+ `COMPILER_HIDDEN_REQUIRED_FIELD`. A composite reference is written whole: each of its blocked fields needs a
1349
+ `compute.create`. For example:
1350
+
1351
+ ```text
1352
+ the client layer still creates resource "Post" (create.one, upsert.unique) but hides its required field "tenantId",
1353
+ which every create must write; expose "tenantId", give "tenantId" a compute.create, or exempt the create operation
1354
+ ```
1355
+
1356
+ A pipe that filled the hidden field is not enough. Move the value into a `compute.create` stage on the field (at the
1357
+ root or in that layer), keep the field exposed, or exempt the layer's create operations.
1358
+
1359
+ A `create.many` or `create.count` record cannot write a relation, so a required relation is met there by its
1360
+ reference fields alone. In those records `authorId` is plainly required by the types, and a record without it answers
1361
+ `A2004` with `V1000` at `data.<n>.authorId` (before, a layer that hid `authorId` let it reach the database, which
1362
+ answered `A3001`). A layer that hides `authorId`, even with `author` exposed, while it keeps `create.many` or
1363
+ `create.count` now fails construction with `COMPILER_HIDDEN_REQUIRED_FIELD`:
1364
+
1365
+ ```text
1366
+ the client layer still creates resource "Post" in bulk (create.count, create.many) but hides its reference field
1367
+ "authorId", which every bulk create must write: a bulk record cannot write the relation "author"; expose "authorId",
1368
+ give "authorId" a compute.create, or exempt create.count and create.many
1369
+ ```
1370
+
1371
+ A `compute.create` written inline in `createFramework({ ... })` without parameter types now counts, at the root and in
1372
+ an overlay: the field it fills is no longer required by the types. Before, such a stage made the whole inline
1373
+ configuration's type fall back to the untyped one, so the façades ignored it (and everything else the literal stated).
1374
+ For that, a `compute.create` or `compute.update` stage's `field` and `data` are keyed by `string` now, not by your
1375
+ field names; their values were `unknown` already. `AvComputeCreate` and `AvComputeUpdate` take the model alone
1376
+ (`AvComputeCreate<Model>`).
1377
+
1378
+ - Breaking: the root key `entrypoint` is now `api`, and `framework.entrypoint` is `framework.api`. The value is the
1379
+ same mount path, normalized the same way:
1380
+
1381
+ ```ts
1382
+ createFramework({ api: "/api", adapter });
1383
+ ```
1384
+
1385
+ `entrypoint` is refused with `CONFIG_MOVED_PROPERTY` ("entrypoint moved in rc.1: use api") and is a type error. A
1386
+ generated client still takes `entrypoint` (the server's URL), and so do `defineClientConfig` and
1387
+ `avclient init --entrypoint`: those name where a client points, not where the server mounts.
1388
+
1389
+ - New: the `agent` layer and the Agent Contract, the base for serving AI agents over MCP. `agent` holds the six layer
1390
+ keys an overlay holds, plus `extends`: the layer it starts from, `"client"` (the default), `"application"` or
1391
+ `"root"`. Its view is that layer's final view, narrowed by its own `exposed`/`exemptions`; it never widens it. An
1392
+ exemption that would expose what its parent hid fails construction, and the message names the parent:
1393
+
1394
+ ```text
1395
+ field "Post.body" is hidden by client, the layer agent extends, and the agent layer only narrows that view;
1396
+ expose it in client, or extend a layer that exposes it
1397
+ ```
1398
+
1399
+ Stages run along the chain: the root's, then the parent overlay's, then the agent's, level by level, and every stage
1400
+ is told `ctx.$origin === "agent"` (`AvRequestOrigin` and `AvConfigLayerName` gain `"agent"`). Compute chains the same
1401
+ way. `limits` and `transactionsStyle` are the parent's effective values unless the agent states its own. Left out,
1402
+ the agent layer is its parent's view exactly. `defineResource` takes an `agent` block beside `application` and
1403
+ `client`.
1404
+
1405
+ The layer compiles to `framework.contracts.agent` (`AvContractAgent`), built and identified like the Client Contract:
1406
+ its protocol version and its own hash over its own content, so an agent that exposes what the client exposes has the
1407
+ client's hash. Required create fields, hidden-requirement checks and `forceTransaction` checks apply to it as to any
1408
+ layer, and a refusal names `agent`.
1409
+
1410
+ `AvProtocol.bind(framework, { origin: "agent" })` runs agent calls through the same decoding and validation as HTTP
1411
+ client calls: its surface and `/_contract` are the Agent Contract's, the identity headers must carry the Agent
1412
+ Contract's hash (the Client Contract's is `A2005`), and the calls run under the agent's pipelines. The default
1413
+ binding is unchanged. `framework.execute` and `executeTransaction` take `origin: "agent"` with the Agent Contract's
1414
+ protocol identity.
1415
+
1416
+ - New: the root key `mcp` turns MCP on. It is a mount path (`mcp: "/mcp"`), or `{ path, authorization }` where
1417
+ `authorization` is `{ servers, verify }`: the OAuth authorization servers (https URLs) a caller gets its token from,
1418
+ and `verify(token)`, which resolves the caller or `null`. The path is written as `api` is and must not be `api` itself
1419
+ or inside its `_` namespace. Each mistake is a startup error at its path (`mcp.path`,
1420
+ `mcp.authorization.servers[1]`, …). The resolved endpoint is `framework.mcp` (`AvMcpEndpoint`), for the host that
1421
+ serves it; `undefined` when MCP is off. `agent` without `mcp` is allowed.
1422
+
1423
+ - New: `AvDiagnostic` has a third kind, `AvMcpDiagnostic` (`kind: "mcp"`). When the MCP endpoint itself fails, outside
1424
+ any tool call's operation (the MCP SDK's server or transport), the caller gets a bare `500` and the diagnostics sink
1425
+ gets the raw error with `code: "A3000"`, `origin: "agent"` and a minted `requestId`. A sink that narrows on `kind`
1426
+ now has three arms.
1427
+
1428
+ - Faster startup: each remote Contract (client and agent) is written as canonical JSON once. Its hash, the Contract
1429
+ object and the `/_contract` body all come from that one text instead of four separate passes. The bytes and
1430
+ hashes are unchanged. `createFramework` plus binding the client and agent protocols took 186 ms at 117 Resources and
1431
+ now takes 133 ms (90 to 67 ms at 50, 20 to 15 ms at 6).
1432
+
1433
+ - Smaller edge bundles: `@aventara/core/avz` imports only the zod builders it uses, so a bundler drops the rest of
1434
+ `zod/mini`, its locales included. A minified bundle of the entry went from 453 KB to 48 KB.
1435
+
3
1436
  ## 1.0.0-rc.0
4
1437
 
5
1438
  ### Major Changes
@@ -185,6 +1618,7 @@
185
1618
 
186
1619
  A value whose first read throws is now refused even if reading it again would succeed: `A2004`/`V1001` at the object
187
1620
  or array whose read failed. Before, it was copied from the second read.
1621
+
188
1622
  - 2d00ad7: An issue your own code throws from a transaction step now keeps its `path`. A pipe, guard, hook, interceptor,
189
1623
  filter or computed behavior does not know where its operation stands in a plan, so it writes the path as it would for
190
1624
  a single call — `["arguments", "data", "name"]`. Inside `framework.transaction`, `framework.executeTransaction` and