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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/CHANGELOG.md +504 -0
  2. package/README.md +159 -141
  3. package/dist/cli/command.parser.d.ts +5 -5
  4. package/dist/cli/command.parser.js +13 -13
  5. package/dist/cli/generation-failure.renderer.js +24 -24
  6. package/dist/config/client-config.interface.d.ts +7 -7
  7. package/dist/config/config.loader.d.ts +10 -4
  8. package/dist/config/config.loader.js +16 -7
  9. package/dist/config/config.resolver.d.ts +7 -7
  10. package/dist/config/config.resolver.js +12 -12
  11. package/dist/config/env.cascade.d.ts +2 -2
  12. package/dist/config/env.cascade.js +4 -4
  13. package/dist/config/module-style.resolver.d.ts +1 -1
  14. package/dist/config/module-style.resolver.js +2 -2
  15. package/dist/config/tsconfig.locator.d.ts +1 -1
  16. package/dist/config/tsconfig.locator.js +2 -2
  17. package/dist/contract/contract.acceptance.d.ts +4 -4
  18. package/dist/contract/contract.acceptance.js +4 -4
  19. package/dist/contract/contract.fetcher.d.ts +3 -3
  20. package/dist/contract/contract.fetcher.js +6 -6
  21. package/dist/contract/contract.loader.d.ts +6 -6
  22. package/dist/contract/contract.loader.js +2 -2
  23. package/dist/emit/client-surface.emitter.d.ts +2 -2
  24. package/dist/emit/client-surface.emitter.js +61 -40
  25. package/dist/emit/client-tree.emitter.d.ts +3 -3
  26. package/dist/emit/client-tree.emitter.js +8 -5
  27. package/dist/emit/contract-carrier.emitter.d.ts +3 -3
  28. package/dist/emit/derivation.emitter.js +1 -0
  29. package/dist/emit/descriptor.emitter.d.ts +2 -2
  30. package/dist/emit/descriptor.emitter.js +1 -1
  31. package/dist/emit/emitted-tree.interface.d.ts +1 -1
  32. package/dist/emit/enum.emitter.d.ts +2 -2
  33. package/dist/emit/field-check.emitter.d.ts +21 -0
  34. package/dist/emit/field-check.emitter.js +592 -0
  35. package/dist/emit/json-shape.emitter.d.ts +2 -2
  36. package/dist/emit/name.deriver.d.ts +6 -6
  37. package/dist/emit/name.deriver.js +14 -14
  38. package/dist/emit/named-type.emitter.d.ts +2 -2
  39. package/dist/emit/runtime.emitter.d.ts +2 -2
  40. package/dist/emit/runtime.emitter.js +166 -112
  41. package/dist/emit/scalar.codec.d.ts +1 -1
  42. package/dist/emit/scalar.codec.js +246 -29
  43. package/dist/emit/transaction.emitter.js +30 -14
  44. package/dist/generate.d.ts +2 -2
  45. package/dist/generate.js +2 -2
  46. package/dist/index.d.ts +1 -1
  47. package/dist/init/client-init.errors.d.ts +4 -4
  48. package/dist/init/client-init.errors.js +4 -4
  49. package/dist/init/client-init.orchestrator.js +7 -7
  50. package/dist/init/client-init.questions.d.ts +5 -5
  51. package/dist/init/client-init.questions.js +10 -10
  52. package/dist/init/client-project.inspector.d.ts +2 -2
  53. package/dist/init/client-project.inspector.js +3 -3
  54. package/dist/output/output.validator.d.ts +3 -4
  55. package/dist/output/output.validator.js +2 -2
  56. package/dist/output/output.writer.d.ts +5 -5
  57. package/dist/output/output.writer.js +12 -12
  58. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,509 @@
1
1
  # @aventara/client
2
2
 
3
+ ## 1.0.0-rc.2
4
+
5
+ ### Patch Changes
6
+
7
+ - The optional `typescript` peer range is `>=5.7.0` (it was `>=5.5.0`), the lowest TypeScript Aventara's types
8
+ compile under. `avclient generate` type-checks the client with TypeScript 5.7 or later; under an older one it parses
9
+ the output with Node's TypeScript parser (`checked: syntax`) and says so in one warning, as it did below 5.5.
10
+ - A generated client sends an `undefined` array element (or a hole) as `null`, as `JSON.stringify` writes it, and its
11
+ `json` codec leaves out a key holding `undefined` and writes such an element as `null`. A `json` value
12
+ `{ a: undefined, b: [undefined] }` is sent as `{"b":[null]}`, the value the server stores when an in-process caller
13
+ passes it. In rc.1 the client refused the array element with a `TypeError` before sending. Regenerate the client.
14
+ - A generated client's `json` values admit a key holding `undefined` in their type, as core's `AvJsonValue` now does,
15
+ so an object with optional properties can be passed where a `json` value is taken; the key is not sent. In rc.1 it
16
+ was a compile error. Regenerate the client.
17
+ - A generated client refuses at compile time a filter `mode` or `path` that qualifies no operator: one alone, or one
18
+ whose only neighbour is a `not` holding operators (`{ mode: "insensitive", not: { contains: "x" } }`). Write it
19
+ inside the `not`. The server refuses the same filters (`A2004`, `V1001`). Regenerate the client.
20
+ - A generated client types a filter's `mode` by the field: `"default"` always, and `"sensitive"` or `"insensitive"`
21
+ only where the ClientContract's `filterModes` lists them; any other mode is a compile error. On a `json` field an
22
+ operator object that names `path` takes the modes `pathFilterModes` lists instead, so on Postgres
23
+ `where: { meta: { stringContains: "x", mode: "insensitive" } }` is a compile error and
24
+ `where: { meta: { path: ["label"], stringContains: "x", mode: "insensitive" } }` compiles. `isEmpty` is typed as a boolean, `path` as an array of strings and a `json` field's `string*`
25
+ operand as a string. The server refuses the same values (`A2004`), so the client adds no runtime check of its own.
26
+ Regenerate the client: the Contract hash changes.
27
+ - The generated client refuses an `undefined` value in a filter before anything is sent. JSON drops `undefined`, so
28
+ `avClient.Post.update.many({ where: { id: undefined }, data })` reached the server as `where: {}` and updated every
29
+ row; the same went for `find`, `count`, `delete` and a transaction step. Now an `undefined` anywhere inside a
30
+ `where` (`AND`, `OR`, `NOT`, relation filters, operator objects such as `{ equals: undefined }` or
31
+ `{ isEmpty: undefined }`, `in` lists), a `cursor`, a unique selector, the `where` or `cursor` of a relation in
32
+ `select` or `include`, or a nested write's selectors (`$connect`, `$disconnect`, `$set`, `$delete`, the `where` of
33
+ `$update`, `$upsert` and `$connectOrCreate`) throws `AvValidationError` (`A2004`) with a `V1001` issue at the path
34
+ the server uses (`["arguments", "where", "id"]`, or `["operations", 0, "args", "where", "id"]` with the step's
35
+ `operation` for a transaction), and no request is made. A `where`, `cursor`, `limit` or `offset` that is itself
36
+ `undefined` is refused the same way, with the server's code (`V1001`; `V1007` for a unique selector, `V1009` for a
37
+ cursor), at the top level, in a relation under `select` or `include`, and in a nested write's `where`. Leave the
38
+ key out to mean no filter. Write data is unchanged: an `undefined` field there is not sent. Regenerate the client
39
+ to get the check.
40
+ - `avclient generate` in a directory with no config names the extensions it looks for as the docs list them:
41
+ `no framework.client.ts, .mts, .cts, .js, .mjs or .cjs in <directory>; …`. In rc.1 it read
42
+ `no framework.client.{js,ts,mjs,cjs,mts,cts} in <directory>`. `avclient --help` and `avclient generate --help` list
43
+ them in the same order: `framework.client.ts (or .mts, .cts, .js, .mjs, .cjs)`. Which files are read is unchanged.
44
+ - Updated dependencies [9366e16]
45
+ - Updated dependencies [9366e16]
46
+ - Updated dependencies [9366e16]
47
+ - Updated dependencies [9366e16]
48
+ - @aventara/core@1.0.0-rc.2
49
+
50
+ ## 1.0.0-rc.1
51
+
52
+ ### Patch Changes
53
+
54
+ - 8bb1d6a: Breaking: public type and class names take the `Av` prefix. Every public type and class is now `Av` plus what
55
+ it is, with a namespace only where the bare name would be ambiguous: configuration types are `AvConfig…`
56
+ (`AvConfig`, `AvConfigLayer`, `AvConfigResource`, …) and the three Contracts are `AvContract…` (`AvContractCore`,
57
+ `AvContractApplication`, `AvContractClient`). Functions keep their names (`createFramework`, `createFakeAdapter`,
58
+ `createPrismaAdapter`, `defineClientConfig`, `env`), and so do the names that already started with `Av`,
59
+ `AventaraModule`, `AventaraModuleOptions` and `AventaraModuleAsyncOptions`. There are no
60
+ aliases: replace each old name with the new one.
61
+
62
+ Three names merged or left:
63
+
64
+ - `PipelineContext` and `ComputeContext` (which was the same type) are one name, `AvContext`. A compute stage
65
+ now gets its own read-only ctx, `AvComputeContext` (see the ctx entry in `@aventara/core`'s changelog).
66
+ - `ComputedRead` is `AvComputeRead`, the one name of a read compute stage: a function, or `{ compute, dependsOn }`.
67
+ `ComputeOnRead`, the bare function type, is no longer exported; `AvComputeRead` accepts the function as it is.
68
+ - `defineFields` and `FrameworkFieldsShape` are removed; `defineResource` replaces them (below).
69
+
70
+ `defineResource` replaces `defineFields`. A Resource's configuration, its root block and its overlay blocks, can
71
+ live in its own module and be spread into each layer's `resources` tree:
72
+
73
+ ```ts
74
+ export const submission = defineResource<Model>()(
75
+ "Submission",
76
+ {
77
+ pipelines: { guards: [signedIn] },
78
+ fields: { title: { pipelines: { pipes: [trim] } } },
79
+ },
80
+ { client: { fields: { title: { pipelines: { validators: [AvZ.maxLength(80)] } } } } },
81
+ );
82
+
83
+ // aventara.config.ts
84
+ resources: { ...submission.root, ...payment.root },
85
+ client: { resources: { ...submission.client } },
86
+ ```
87
+
88
+ It returns `{ root, application?, client? }`, each `{ Submission: block }`; a layer given no block is left out. The
89
+ root block is typed exactly as `resources.Submission` is typed in place: field definitions are checked against what
90
+ the adapter discovered, stages are typed for the Resource, and a key no level admits is a type error at the key.
91
+ Each overlay block is typed as `application.resources.Submission` or `client.resources.Submission` is in place,
92
+ against the root block: it may name a field the root block defines, and a `definition` in it is a type error (and
93
+ `CONFIG_FORBIDDEN_IN_OVERLAY` at startup). Spread, the configuration is the inline one: the same Contracts and
94
+ ClientContract hash. A field `definition` that `defineFields` returned now sits at
95
+ `fields.<field>.definition` inside the block.
96
+
97
+ The generated client's names follow the same rule. Regenerate with `avclient generate`; then rename the
98
+ imports from `AvClient.ts`:
99
+
100
+ | Before | After |
101
+ | ----------------------- | ------------------------- |
102
+ | `AuthError` | `AvAuthError` |
103
+ | `CallOptions` | `AvCallOptions` |
104
+ | `Cause` | `AvCause` |
105
+ | `ConflictError` | `AvConflictError` |
106
+ | `ContractMismatchError` | `AvContractMismatchError` |
107
+ | `Decimal` | `AvDecimal` |
108
+ | `Fetch` | `AvFetch` |
109
+ | `FrameworkError` | `AvError` |
110
+ | `InternalError` | `AvInternalError` |
111
+ | `NotFoundError` | `AvNotFoundError` |
112
+ | `Operation<T>` | `AvOperation<T>` |
113
+ | `OperationCode` | `AvOperationCode` |
114
+ | `ProtocolError` | `AvProtocolError` |
115
+ | `TransportError` | `AvTransportError` |
116
+ | `ValidationCode` | `AvValidationCode` |
117
+ | `ValidationError` | `AvValidationError` |
118
+ | `ValidationIssue` | `AvValidationIssue` |
119
+
120
+ An enum whose name is one of these now walks the rename ladder (`AvDecimal` → `AvDecimalEnum`); an enum named
121
+ `Decimal` is emitted as `Decimal`.
122
+
123
+ `@aventara/core`, every renamed export:
124
+
125
+ | Before | After |
126
+ | ------------------------------------- | ---------------------------------- |
127
+ | `Adapter` | `AvAdapter` |
128
+ | `AdapterDiscoveryDiagnostic` | `AvAdapterDiscoveryDiagnostic` |
129
+ | `AdapterDiscoveryDiagnosticCode` | `AvAdapterDiscoveryDiagnosticCode` |
130
+ | `AdapterModel` | `AvAdapterModel` |
131
+ | `AddedFieldDefinition` | `AvConfigAddedFieldDefinition` |
132
+ | `AfterHook` | `AvAfterHook` |
133
+ | `AnyFrameworkConfig` | `AvConfigAny` |
134
+ | `AnyLayerConfig` | `AvConfigLayerAny` |
135
+ | `AnyResourcesBlock` | `AvConfigResourcesAny` |
136
+ | `ApplicationContract` | `AvContractApplication` |
137
+ | `ApplicationScalarForms` | `AvApplicationScalarForms` |
138
+ | `BeforeHook` | `AvBeforeHook` |
139
+ | `BuiltInScalar` | `AvBuiltInScalar` |
140
+ | `Cause` | `AvCause` |
141
+ | `ClientContract` | `AvContractClient` |
142
+ | `ClientContractProtocol` | `AvContractClientProtocol` |
143
+ | `ComputedRead` | `AvComputeRead` |
144
+ | `ComputeOnCreate` | `AvComputeCreate` |
145
+ | `ComputeOnUpdate` | `AvComputeUpdate` |
146
+ | `ConfigDiagnostic` | `AvConfigDiagnostic` |
147
+ | `ConfigDiagnosticCode` | `AvConfigDiagnosticCode` |
148
+ | `ConfigFieldKey` | `AvConfigFieldKey` |
149
+ | `ConfigLayer` | `AvConfigLayerName` |
150
+ | `Contract` | `AvContract` |
151
+ | `ContractCompilerDiagnostic` | `AvContractCompilerDiagnostic` |
152
+ | `ContractCompilerDiagnosticCode` | `AvContractCompilerDiagnosticCode` |
153
+ | `ContractHash` | `AvContractHash` |
154
+ | `ContractLimits` | `AvContractLimits` |
155
+ | `ContractProtocol` | `AvContractProtocol` |
156
+ | `CoreContract` | `AvContractCore` |
157
+ | `CreateDataInput` | `AvCreateDataInput` |
158
+ | `CursorInput` | `AvCursorInput` |
159
+ | `Decimal` | `AvDecimal` |
160
+ | `DeferredOperationCall` | `AvDeferredOperationCall` |
161
+ | `EffectiveFieldKey` | `AvEffectiveFieldKey` |
162
+ | `EnumDefinition` | `AvEnumDefinition` |
163
+ | `ExactFrameworkConfig` | `AvConfigExact` |
164
+ | `ExecutionOptions` | `AvExecutionOptions` |
165
+ | `Field` | `AvField` |
166
+ | `FieldComputeConfig` | `AvFieldCompute` |
167
+ | `FieldKey` | `AvFieldKey` |
168
+ | `FieldPipe` | `AvFieldPipe` |
169
+ | `FieldWriteGuard` | `AvFieldGuard` |
170
+ | `Filter` | `AvFilter` |
171
+ | `Framework` | `AvFramework` |
172
+ | `FrameworkConfig` | `AvConfig` |
173
+ | `FrameworkConstructionDiagnostic` | `AvConstructionDiagnostic` |
174
+ | `FrameworkConstructionError` | `AvConstructionError` |
175
+ | `FrameworkConstructionStage` | `AvConstructionStage` |
176
+ | `FrameworkContracts` | `AvContracts` |
177
+ | `FrameworkDiagnostic` | `AvDiagnostic` |
178
+ | `FrameworkDiagnosticsSink` | `AvDiagnosticsSink` |
179
+ | `FrameworkError` | `AvError` |
180
+ | `FrameworkExemptionsConfig` | `AvConfigExemptions` |
181
+ | `FrameworkFamilyConfig` | `AvConfigFamily` |
182
+ | `FrameworkFieldDefinition` | `AvConfigFieldDefinition` |
183
+ | `FrameworkFieldLifecycleTrait` | `AvConfigFieldLifecycleTrait` |
184
+ | `FrameworkLayerConfig` | `AvConfigLayer` |
185
+ | `FrameworkLayerKind` | `AvConfigLayerKind` |
186
+ | `FrameworkLimitsConfig` | `AvConfigLimits` |
187
+ | `FrameworkMisuseEvent` | `AvMisuseEvent` |
188
+ | `FrameworkMisuseSink` | `AvMisuseSink` |
189
+ | `FrameworkOperationsConfig` | `AvConfigOperations` |
190
+ | `FrameworkOperationsExemption` | `AvConfigOperationsExemption` |
191
+ | `FrameworkOverlayFieldConfig` | `AvConfigOverlayField` |
192
+ | `FrameworkRelationFieldExemption` | `AvConfigRelationFieldExemption` |
193
+ | `FrameworkResourceConfig` | `AvConfigResource` |
194
+ | `FrameworkResourceExemption` | `AvConfigResourceExemption` |
195
+ | `FrameworkResourceFieldsConfig` | `AvConfigResourceFields` |
196
+ | `FrameworkResourceKey` | `AvConfigResourceKey` |
197
+ | `FrameworkResourcesConfig` | `AvConfigResources` |
198
+ | `FrameworkResourceTransactionsConfig` | `AvConfigResourceTransactions` |
199
+ | `FrameworkRootFieldConfig` | `AvConfigRootField` |
200
+ | `FrameworkScalarFieldExemption` | `AvConfigScalarFieldExemption` |
201
+ | `FrameworkScalarTypeRef` | `AvConfigScalarTypeRef` |
202
+ | `FrameworkVariantConfig` | `AvConfigVariant` |
203
+ | `Guard` | `AvGuard` |
204
+ | `Identifier` | `AvIdentifier` |
205
+ | `IncludeInput` | `AvIncludeInput` |
206
+ | `Interceptor` | `AvInterceptor` |
207
+ | `JsonValue` | `AvJsonValue` |
208
+ | `KnownFieldDefinition` | `AvConfigKnownFieldDefinition` |
209
+ | `LifecycleTrait` | `AvLifecycleTrait` |
210
+ | `NullsOrder` | `AvNullsOrder` |
211
+ | `Operation` | `AvOperation` |
212
+ | `OperationArgumentMap` | `AvOperationArgumentMap` |
213
+ | `OperationArgumentsFor` | `AvOperationArgumentsFor` |
214
+ | `OperationAvailability` | `AvOperationAvailability` |
215
+ | `OperationCall` | `AvOperationCall` |
216
+ | `OperationCode` | `AvOperationCode` |
217
+ | `OperationDiagnostic` | `AvOperationDiagnostic` |
218
+ | `OperationErrorCode` | `AvOperationErrorCode` |
219
+ | `OperationFailureResponse` | `AvOperationFailureResponse` |
220
+ | `OperationFamily` | `AvOperationFamily` |
221
+ | `OperationGrammar` | `AvOperationGrammar` |
222
+ | `OperationIdentity` | `AvOperationIdentity` |
223
+ | `OperationNoMatchResponse` | `AvOperationNoMatchResponse` |
224
+ | `OperationReferenceSurface` | `AvOperationReferenceSurface` |
225
+ | `OperationResponse` | `AvOperationResponse` |
226
+ | `OperationResultFor` | `AvOperationResultFor` |
227
+ | `OperationSlot` | `AvOperationSlot` |
228
+ | `OperationSuccessCode` | `AvOperationSuccessCode` |
229
+ | `OperationSuccessDataCode` | `AvOperationSuccessDataCode` |
230
+ | `OperationSuccessResponse` | `AvOperationSuccessResponse` |
231
+ | `OperationVariant` | `AvOperationVariant` |
232
+ | `OperationVariantScopes` | `AvOperationVariantScopes` |
233
+ | `OrderByEntry` | `AvOrderByEntry` |
234
+ | `OrderByInput` | `AvOrderByInput` |
235
+ | `PaginationCapability` | `AvPaginationCapability` |
236
+ | `Pipe` | `AvPipe` |
237
+ | `PipelineConfig` | `AvPipeline` |
238
+ | `PipelineContext` | `AvContext` |
239
+ | `PipelineTransportContext` | `AvTransportContext` |
240
+ | `ProjectionEntry` | `AvProjectionEntry` |
241
+ | `ProjectionScope` | `AvProjectionScope` |
242
+ | `ProjectionScopes` | `AvProjectionScopes` |
243
+ | `ReferenceableField` | `AvReferenceableField` |
244
+ | `ReferenceBuilder` | `AvReferenceBuilder` |
245
+ | `RelationField` | `AvRelationField` |
246
+ | `RelationFieldCapabilities` | `AvRelationFieldCapabilities` |
247
+ | `RelationFieldCapabilityName` | `AvRelationFieldCapabilityName` |
248
+ | `RelationFieldPipelineConfig` | `AvRelationFieldPipeline` |
249
+ | `RelationFilterCapability` | `AvRelationFilterCapability` |
250
+ | `RelationMutationCapability` | `AvRelationMutationCapability` |
251
+ | `RelationMutationDirective` | `AvRelationMutationDirective` |
252
+ | `RelationProjectionCapability` | `AvRelationProjectionCapability` |
253
+ | `RelationProjectionInput` | `AvRelationProjectionInput` |
254
+ | `RelationReducer` | `AvRelationReducer` |
255
+ | `RelationReducerCapability` | `AvRelationReducerCapability` |
256
+ | `RequestOrigin` | `AvRequestOrigin` |
257
+ | `Resource` | `AvResource` |
258
+ | `ResourceFieldMap` | `AvResourceFieldMap` |
259
+ | `ResourceKey` | `AvResourceKey` |
260
+ | `ResourceOperations` | `AvResourceOperations` |
261
+ | `ScalarDefinition` | `AvScalarDefinition` |
262
+ | `ScalarField` | `AvScalarField` |
263
+ | `ScalarFieldCapabilities` | `AvScalarFieldCapabilities` |
264
+ | `ScalarFieldCapabilityName` | `AvScalarFieldCapabilityName` |
265
+ | `ScalarFieldKey` | `AvScalarFieldKey` |
266
+ | `ScalarFieldPipelineConfig` | `AvScalarFieldPipeline` |
267
+ | `ScalarFilterOperator` | `AvScalarFilterOperator` |
268
+ | `ScalarFormat` | `AvScalarFormat` |
269
+ | `ScalarMutationDirective` | `AvScalarMutationDirective` |
270
+ | `ScalarOrderInput` | `AvScalarOrderInput` |
271
+ | `ScalarRegistry` | `AvScalarRegistry` |
272
+ | `ScalarValueType` | `AvScalarValueType` |
273
+ | `ScopedRelationMutations` | `AvScopedRelationMutations` |
274
+ | `ScopedRelationReducers` | `AvScopedRelationReducers` |
275
+ | `SelectInput` | `AvSelectInput` |
276
+ | `SingleRowResult` | `AvSingleRowResult` |
277
+ | `SortDirection` | `AvSortDirection` |
278
+ | `TransactionAfterHook` | `AvTransactionAfterHook` |
279
+ | `TransactionBeforeHook` | `AvTransactionBeforeHook` |
280
+ | `TransactionCapability` | `AvTransactionCapability` |
281
+ | `TransactionCommittedResponse` | `AvTransactionCommittedResponse` |
282
+ | `TransactionDiagnostic` | `AvTransactionDiagnostic` |
283
+ | `TransactionFilter` | `AvTransactionFilter` |
284
+ | `TransactionGuard` | `AvTransactionGuard` |
285
+ | `TransactionIntegrityError` | `AvTransactionIntegrityError` |
286
+ | `TransactionIntegrityViolation` | `AvTransactionIntegrityViolation` |
287
+ | `TransactionInterceptor` | `AvTransactionInterceptor` |
288
+ | `TransactionPipe` | `AvTransactionPipe` |
289
+ | `TransactionPipelineConfig` | `AvTransactionPipeline` |
290
+ | `TransactionPipelineContext` | `AvTransactionContext` |
291
+ | `TransactionReference` | `AvTransactionReference` |
292
+ | `TransactionResponse` | `AvTransactionResponse` |
293
+ | `TransactionResults` | `AvTransactionResults` |
294
+ | `TransactionRunner` | `AvTransactionRunner` |
295
+ | `TransactionSlotPathError` | `AvTransactionSlotPathError` |
296
+ | `TransactionSlotPathViolation` | `AvTransactionSlotPathViolation` |
297
+ | `UniqueWhereInput` | `AvUniqueWhereInput` |
298
+ | `UpdateDataInput` | `AvUpdateDataInput` |
299
+ | `ValidationCode` | `AvValidationCode` |
300
+ | `ValidationIssue` | `AvValidationIssue` |
301
+ | `WhereInput` | `AvWhereInput` |
302
+ | `WireScalarForms` | `AvWireScalarForms` |
303
+ | `WriteScope` | `AvWriteScope` |
304
+ | `WriteScopes` | `AvWriteScopes` |
305
+
306
+ Error classes whose `name` a log or a test may read:
307
+
308
+ | Before | After |
309
+ | ------------------------ | -------------------------- |
310
+ | `CallerDataError` | `AvCallerDataError` |
311
+ | `ClientConfigError` | `AvClientConfigError` |
312
+ | `ComputedValueError` | `AvComputedValueError` |
313
+ | `ContractProtocolError` | `AvContractProtocolError` |
314
+ | `ContractTransportError` | `AvContractTransportError` |
315
+ | `EnvFileError` | `AvEnvFileError` |
316
+ | `OutputValidationError` | `AvOutputValidationError` |
317
+ | `OutputWriteError` | `AvOutputWriteError` |
318
+ | `PipeOutputError` | `AvPipeOutputError` |
319
+ | `UnmountedRouteError` | `AvUnmountedRouteError` |
320
+
321
+ `@aventara/testing`:
322
+
323
+ | Before | After |
324
+ | ------------------------ | -------------------------- |
325
+ | `AdapterFactory` | `AvAdapterFactory` |
326
+ | `FakeAdapter` | `AvFakeAdapter` |
327
+ | `FakeAdapterExecute` | `AvFakeAdapterExecute` |
328
+ | `FakeAdapterOptions` | `AvFakeAdapterOptions` |
329
+ | `FakeAdapterRollback` | `AvFakeAdapterRollback` |
330
+ | `FakeTransactionOutcome` | `AvFakeTransactionOutcome` |
331
+ | `FakeTransactionTrace` | `AvFakeTransactionTrace` |
332
+
333
+ `@aventara/client` (the `framework.client.ts` config types):
334
+
335
+ | Before | After |
336
+ | ------------------- | --------------------- |
337
+ | `ClientConfigInput` | `AvClientConfigInput` |
338
+ | `ConfigValue` | `AvClientConfigValue` |
339
+ | `EnvReference` | `AvEnvReference` |
340
+
341
+ `@aventara/prisma7-adapter`: its public types and error classes (`createPrismaAdapter` keeps its name):
342
+
343
+ | Before | After |
344
+ | ---------------------------------- | ------------------------------------ |
345
+ | `PrismaAdapterModel` | `AvPrismaAdapterModel` |
346
+ | `PrismaAdapterOptions` | `AvPrismaAdapterOptions` |
347
+ | `PrismaDelegate` | `AvPrismaDelegate` |
348
+ | `PrismaDelegateHost` | `AvPrismaDelegateHost` |
349
+ | `PrismaDelegateIndex` | `AvPrismaDelegateIndex` |
350
+ | `PrismaDiscoveryArtifact` | `AvPrismaDiscoveryArtifact` |
351
+ | `PrismaDriver` | `AvPrismaDriver` |
352
+ | `PrismaIsolationLevel` | `AvPrismaIsolationLevel` |
353
+ | `PrismaProvider` | `AvPrismaProvider` |
354
+ | `PrismaProviderProfile` | `AvPrismaProviderProfile` |
355
+ | `PrismaReferentialAction` | `AvPrismaReferentialAction` |
356
+ | `PrismaReferentialActionTable` | `AvPrismaReferentialActionTable` |
357
+ | `PrismaReferentialEdge` | `AvPrismaReferentialEdge` |
358
+ | `PrismaResourceReferentialActions` | `AvPrismaResourceReferentialActions` |
359
+ | `PrismaTransactionOptions` | `AvPrismaTransactionOptions` |
360
+ | `PrismaCapabilityDerivationError` | `AvPrismaCapabilityDerivationError` |
361
+ | `PrismaDiscoveryArtifactError` | `AvPrismaDiscoveryArtifactError` |
362
+ | `PrismaEmulationError` | `AvPrismaEmulationError` |
363
+ | `PrismaExecutionError` | `AvPrismaExecutionError` |
364
+ | `PrismaExistenceGateError` | `AvPrismaExistenceGateError` |
365
+ | `PrismaFieldProjectionError` | `AvPrismaFieldProjectionError` |
366
+ | `PrismaGenerateCliError` | `AvPrismaGenerateCliError` |
367
+ | `PrismaGenerateStepError` | `AvPrismaGenerateStepError` |
368
+ | `PrismaModelCompositionError` | `AvPrismaModelCompositionError` |
369
+ | `PrismaMutationTranslationError` | `AvPrismaMutationTranslationError` |
370
+ | `PrismaOperationTranslationError` | `AvPrismaOperationTranslationError` |
371
+ | `PrismaOrderTranslationError` | `AvPrismaOrderTranslationError` |
372
+ | `PrismaProjectionTranslationError` | `AvPrismaProjectionTranslationError` |
373
+ | `PrismaResultShapeError` | `AvPrismaResultShapeError` |
374
+ | `PrismaScalarConversionError` | `AvPrismaScalarConversionError` |
375
+ | `PrismaSchemaReaderError` | `AvPrismaSchemaReaderError` |
376
+ | `PrismaTypesReaderError` | `AvPrismaTypesReaderError` |
377
+ | `PrismaWhereTranslationError` | `AvPrismaWhereTranslationError` |
378
+
379
+ - 68d4395: New: the generated client checks field validators before it sends. When the ClientContract carries a field's
380
+ `validators` or a Json Shape's checks, `avclient generate` emits them into the client with the check code that runs
381
+ them, and every call and every transaction checks the values it holds first. A call that breaks a check rejects with
382
+ the same `AvValidationError` the server would answer, `A2004` with the same issues (`code`, `path`, `check`,
383
+ `params`, `message`), and no request is sent:
384
+
385
+ ```ts
386
+ try {
387
+ await avClient.projects.create.one({ data: { id: "p1", name: "no" } });
388
+ } catch (error) {
389
+ // error instanceof AvValidationError, error.code === "A2004", nothing was sent:
390
+ // error.cause.issues[0] → { code: "V1004", path: ["arguments", "data", "name"],
391
+ // message: "Value must be at least 3 characters long.", check: "min_length", params: { minimum: 3 } }
392
+ }
393
+ ```
394
+
395
+ - The server checks every value again. The client checks a value as the caller wrote it and the server checks it
396
+ after its field pipes, so a field pipe that normalizes a value (trims it, lower-cases it) must not turn a value the
397
+ client accepted into one the server refuses.
398
+ - A transaction is checked whole before it is sent: a bad literal value in any step rejects with the server's answer,
399
+ `cause.operation` naming the step. A `$ref` value is checked by the server, at its step.
400
+ - Nested write data, list fields (each entry and the list's length), `$push` entries and Json Shape checks are all
401
+ checked, a Json Shape's checks with the other validators in the order the call wrote the fields, and a plan step
402
+ by step, as the server does. A Json value that does not match its shape is sent, and the server answers it.
403
+ - The check code is `@aventara/core`'s own, copied into the generated output; the client still imports nothing from
404
+ `@aventara/*` or zod at runtime. A contract with no checks generates the same files as before.
405
+ - `AvValidationIssue` declares `check` and `params`, and the client keeps them on the issues a server sends (they
406
+ were dropped before).
407
+ - The server lists validator issues in the order the call wrote the fields (it used the model's field order), and a
408
+ Json Shape's issues in the order of its keys as the Contract lists them, so the client can list the same issues in
409
+ the same order. An issue inside a nested write whose operand is one entry rather than a list no longer names an
410
+ index the request does not have (`[…, "$update", "data", …]`, not `[…, "$update", 0, "data", …]`).
411
+
412
+ - 7a0cab9: A `where` now offers each field only the filter operators that field allows. The types of `framework.client`,
413
+ `framework.application`, `framework.clientTx`, `framework.appTx` and a generated client read the operators from the
414
+ field's effective `filter` capability, so an operator the server would refuse with `V1006` is now a type error
415
+ instead. That covers an operator the adapter does not offer for the field's type (no `contains` on an Int), an
416
+ operator a layer's exemptions removed (the client layer narrowing `email` to `equals` is refused on
417
+ `framework.client` and still allowed on `framework.application`), and operators inside a nested `not`. A plain
418
+ value, `null` or `$ref` as shorthand is equality, so it is only accepted where the field allows `equals`, and a field
419
+ narrowed to no operators at all can no longer be named in a `where`. Runtime behavior is unchanged.
420
+
421
+ A generated client picks this up when it is regenerated with this version of `@aventara/client`.
422
+
423
+ - c6e5010: Breaking: one stage order, and hooks now run inside interceptors. Every operation runs
424
+
425
+ ```
426
+ guards → pipes → validators → interceptors (before) → hooks.before → operation → hooks.after → interceptors (after) → filters
427
+ ```
428
+
429
+ Each stage runs over every level, outer to inner, before the next starts, so every interceptor wraps every hook: all
430
+ interceptors enter, then every `before` hook runs, then the operation, then every `after` hook (inner to outer), then
431
+ the interceptors unwind (inner to outer). In rc.0 every `before` hook ran ahead of every interceptor, every `after`
432
+ hook after every interceptor had unwound, and the overlay's `after` hooks after the root's; now the overlay's run
433
+ before the root's. Filters run inner to outer, and the first filter that handles an error wins. A call that a guard,
434
+ a pipe's output or a validator refuses runs no interceptor and no hook; the filters still see a thrown error. Inside
435
+ a transaction, a step's error its own filters leave unhandled continues to the Resource transaction filters (the
436
+ transaction's outer layer) before it is answered.
437
+
438
+ New: stages at every level of `resources`. `resources.<R>.pipelines`, `resources.<R>.operations.<family>.pipelines`
439
+ and `resources.<R>.operations.<family>.<variant>.pipelines` run now, in both layers, level by level: root layer,
440
+ overlay layer, root Resource, overlay Resource, root family, overlay family, root variant, overlay variant. Nothing
441
+ below removes a stage above. A stage is told the level it sits at: a Resource's `ctx.$operation.resource` is its name, a
442
+ family's `ctx.$operation.family` too, a variant's `ctx.$operation.variant` as well.
443
+
444
+ - Field pipes (`resources.<R>.fields.<f>.pipelines.pipes`) are pure: value in, value out, no `ctx`. They run on
445
+ each value the caller sent in top-level create, update or upsert data, right after the operation's pipes, root's
446
+ then overlay's; guards see the value as sent. In a transaction they run on every step's literal values before the
447
+ 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
448
+ (`A3004`). A relation field takes no field pipes (`COMPILER_RELATION_FIELD_CONFIG_UNSUPPORTED`).
449
+ - Field write guards (`resources.<R>.fields.<f>.pipelines.guards`) refuse with `A4001` when the caller sends
450
+ the field in create, update or upsert data, a relation field's `$connect` included. They run right after the
451
+ operation's guards, last among the guards.
452
+ - Transactions: every step's guards, pipes and validators run before the transaction opens, in plan order; an
453
+ operation pipe sees a `$ref` as the reference it is. A refused step opens nothing. Then BEGIN, and at each step
454
+ its `$ref`s are resolved, their field pipes and validators run, then the step's interceptors and hooks around its
455
+ adapter call. A forced call runs the same way. A step's guards and pipes no longer run inside the transaction, so
456
+ their ctx calls do not join it.
457
+ - Resource transaction stages (`resources.<R>.transactions.pipelines`) run once per transaction with a
458
+ top-level step on the Resource, inside it: guards and pipes see the whole plan (`ctx.$args`, `$ref`s unresolved),
459
+ interceptors and hooks wrap every step, and the `after` hooks see every step's result before the commit, so a
460
+ throw rolls everything back. Touched Resources run in the order their first step appears; a SQL step touches
461
+ nothing. A transaction pipe may change a step's arguments; they are held to the server's rules and their
462
+ validators at the step.
463
+ - `forceTransaction` on a family or a variant runs a plain call of that operation as a one-step transaction,
464
+ so its after hooks commit with the write or not at all, and the Resource's transaction stages run. It holds when
465
+ any layer sets it. As a step of a plan it is just a step. Under an effective `transactionsStyle: "none"` it is a
466
+ startup error (`CONFIG_INVALID_VALUE`).
467
+
468
+ Breaking: a transaction has one origin. `framework.transaction` refuses a list that mixes `appTx` and
469
+ `clientTx` handles: `A2004` with one new `V1020` issue, "Transaction mixes application and client steps.", at the
470
+ first step of the other origin, before anything runs. An `appTx.$sql` step is application-origin. Run each
471
+ origin's steps as its own transaction. The generated client's error codes include `V1020`.
472
+
473
+ - Generated clients changed. Regenerate with `avclient generate` after upgrading. `AvOperationCall` lost its
474
+ `Settlement` parameter, because every direct call now resolves its data. The generated tree no longer copies two
475
+ declaration files, `derivation/runtime/operation-response.d.ts` and `derivation/transactions/transaction-response.d.ts`,
476
+ since nothing in it uses them now. And core's in-process calls (`framework.application`, `framework.client`,
477
+ `framework.transaction`) now throw the same `AvError` subclasses the generated client throws, chosen by the same
478
+ code-to-class table, so the server and the client classify every failure the same way.
479
+
480
+ - Generated clients type required create fields. The ClientContract now states each Resource's create requirements
481
+ (`createRequirements`), and a generated client's create payloads require them: leaving out a required field, or
482
+ writing a required relation neither way or both ways (`author` and `authorId`), is a type error. A nested create
483
+ gets the relation it is created through from its parent. The Client Contract's hash changes; regenerate with
484
+ `avclient generate`. The generated tree copies one more declaration file, `derivation/contracts/create-requirements.d.ts`.
485
+
486
+ - Updated dependencies [800123b]
487
+ - Updated dependencies [8bb1d6a]
488
+ - Updated dependencies [68d4395]
489
+ - Updated dependencies [7e3d06f]
490
+ - Updated dependencies [1b5d3c0]
491
+ - Updated dependencies [6317811]
492
+ - Updated dependencies [6d0e5d6]
493
+ - Updated dependencies [7a0cab9]
494
+ - Updated dependencies [eb2a718]
495
+ - Updated dependencies [03312c5]
496
+ - Updated dependencies [123f6dc]
497
+ - Updated dependencies [b65df2e]
498
+ - Updated dependencies [c6e5010]
499
+ - Updated dependencies [c1f9389]
500
+ - Updated dependencies [9c52482]
501
+ - Updated dependencies [8396148]
502
+ - Updated dependencies [e8fbb02]
503
+ - Updated dependencies [916e5f6]
504
+ - Updated dependencies [6cbd158]
505
+ - @aventara/core@1.0.0-rc.1
506
+
3
507
  ## 1.0.0-rc.0
4
508
 
5
509
  ### Major Changes