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