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

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