@aventara/testing 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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,444 @@
1
1
  # @aventara/testing
2
2
 
3
+ ## 1.0.0-rc.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [9366e16]
8
+ - Updated dependencies [9366e16]
9
+ - Updated dependencies [9366e16]
10
+ - Updated dependencies [9366e16]
11
+ - @aventara/core@1.0.0-rc.2
12
+
13
+ ## 1.0.0-rc.1
14
+
15
+ ### Patch Changes
16
+
17
+ - 8bb1d6a: Breaking: public type and class names take the `Av` prefix. Every public type and class is now `Av` plus what
18
+ it is, with a namespace only where the bare name would be ambiguous: configuration types are `AvConfig…`
19
+ (`AvConfig`, `AvConfigLayer`, `AvConfigResource`, …) and the three Contracts are `AvContract…` (`AvContractCore`,
20
+ `AvContractApplication`, `AvContractClient`). Functions keep their names (`createFramework`, `createFakeAdapter`,
21
+ `createPrismaAdapter`, `defineClientConfig`, `env`), and so do the names that already started with `Av`,
22
+ `AventaraModule`, `AventaraModuleOptions` and `AventaraModuleAsyncOptions`. There are no
23
+ aliases: replace each old name with the new one.
24
+
25
+ Three names merged or left:
26
+
27
+ - `PipelineContext` and `ComputeContext` (which was the same type) are one name, `AvContext`. A compute stage
28
+ now gets its own read-only ctx, `AvComputeContext` (see the ctx entry below).
29
+ - `ComputedRead` is `AvComputeRead`, the one name of a read compute stage: a function, or `{ compute, dependsOn }`.
30
+ `ComputeOnRead`, the bare function type, is no longer exported; `AvComputeRead` accepts the function as it is.
31
+ - `defineFields` and `FrameworkFieldsShape` are removed; `defineResource` replaces them (below).
32
+
33
+ `defineResource` replaces `defineFields`. A Resource's configuration, its root block and its overlay blocks, can
34
+ live in its own module and be spread into each layer's `resources` tree:
35
+
36
+ ```ts
37
+ export const submission = defineResource<Model>()(
38
+ "Submission",
39
+ {
40
+ pipelines: { guards: [signedIn] },
41
+ fields: { title: { pipelines: { pipes: [trim] } } },
42
+ },
43
+ { client: { fields: { title: { pipelines: { validators: [AvZ.maxLength(80)] } } } } },
44
+ );
45
+
46
+ // aventara.config.ts
47
+ resources: { ...submission.root, ...payment.root },
48
+ client: { resources: { ...submission.client } },
49
+ ```
50
+
51
+ It returns `{ root, application?, client? }`, each `{ Submission: block }`; a layer given no block is left out. The
52
+ root block is typed exactly as `resources.Submission` is typed in place: field definitions are checked against what
53
+ the adapter discovered, stages are typed for the Resource, and a key no level admits is a type error at the key.
54
+ Each overlay block is typed as `application.resources.Submission` or `client.resources.Submission` is in place,
55
+ against the root block: it may name a field the root block defines, and a `definition` in it is a type error (and
56
+ `CONFIG_FORBIDDEN_IN_OVERLAY` at startup). Spread, the configuration is the inline one: the same Contracts and
57
+ ClientContract hash. A field `definition` that `defineFields` returned now sits at
58
+ `fields.<field>.definition` inside the block.
59
+
60
+ The generated client's names follow the same rule. Regenerate with `avclient generate`; then rename the
61
+ imports from `AvClient.ts`:
62
+
63
+ | Before | After |
64
+ | ----------------------- | ------------------------- |
65
+ | `AuthError` | `AvAuthError` |
66
+ | `CallOptions` | `AvCallOptions` |
67
+ | `Cause` | `AvCause` |
68
+ | `ConflictError` | `AvConflictError` |
69
+ | `ContractMismatchError` | `AvContractMismatchError` |
70
+ | `Decimal` | `AvDecimal` |
71
+ | `Fetch` | `AvFetch` |
72
+ | `FrameworkError` | `AvError` |
73
+ | `InternalError` | `AvInternalError` |
74
+ | `NotFoundError` | `AvNotFoundError` |
75
+ | `Operation<T>` | `AvOperation<T>` |
76
+ | `OperationCode` | `AvOperationCode` |
77
+ | `ProtocolError` | `AvProtocolError` |
78
+ | `TransportError` | `AvTransportError` |
79
+ | `ValidationCode` | `AvValidationCode` |
80
+ | `ValidationError` | `AvValidationError` |
81
+ | `ValidationIssue` | `AvValidationIssue` |
82
+
83
+ An enum whose name is one of these now walks the rename ladder (`AvDecimal` → `AvDecimalEnum`); an enum named
84
+ `Decimal` is emitted as `Decimal`.
85
+
86
+ `@aventara/core`, every renamed export:
87
+
88
+ | Before | After |
89
+ | ------------------------------------- | ---------------------------------- |
90
+ | `Adapter` | `AvAdapter` |
91
+ | `AdapterDiscoveryDiagnostic` | `AvAdapterDiscoveryDiagnostic` |
92
+ | `AdapterDiscoveryDiagnosticCode` | `AvAdapterDiscoveryDiagnosticCode` |
93
+ | `AdapterModel` | `AvAdapterModel` |
94
+ | `AddedFieldDefinition` | `AvConfigAddedFieldDefinition` |
95
+ | `AfterHook` | `AvAfterHook` |
96
+ | `AnyFrameworkConfig` | `AvConfigAny` |
97
+ | `AnyLayerConfig` | `AvConfigLayerAny` |
98
+ | `AnyResourcesBlock` | `AvConfigResourcesAny` |
99
+ | `ApplicationContract` | `AvContractApplication` |
100
+ | `ApplicationScalarForms` | `AvApplicationScalarForms` |
101
+ | `BeforeHook` | `AvBeforeHook` |
102
+ | `BuiltInScalar` | `AvBuiltInScalar` |
103
+ | `Cause` | `AvCause` |
104
+ | `ClientContract` | `AvContractClient` |
105
+ | `ClientContractProtocol` | `AvContractClientProtocol` |
106
+ | `ComputedRead` | `AvComputeRead` |
107
+ | `ComputeOnCreate` | `AvComputeCreate` |
108
+ | `ComputeOnUpdate` | `AvComputeUpdate` |
109
+ | `ConfigDiagnostic` | `AvConfigDiagnostic` |
110
+ | `ConfigDiagnosticCode` | `AvConfigDiagnosticCode` |
111
+ | `ConfigFieldKey` | `AvConfigFieldKey` |
112
+ | `ConfigLayer` | `AvConfigLayerName` |
113
+ | `Contract` | `AvContract` |
114
+ | `ContractCompilerDiagnostic` | `AvContractCompilerDiagnostic` |
115
+ | `ContractCompilerDiagnosticCode` | `AvContractCompilerDiagnosticCode` |
116
+ | `ContractHash` | `AvContractHash` |
117
+ | `ContractLimits` | `AvContractLimits` |
118
+ | `ContractProtocol` | `AvContractProtocol` |
119
+ | `CoreContract` | `AvContractCore` |
120
+ | `CreateDataInput` | `AvCreateDataInput` |
121
+ | `CursorInput` | `AvCursorInput` |
122
+ | `Decimal` | `AvDecimal` |
123
+ | `DeferredOperationCall` | `AvDeferredOperationCall` |
124
+ | `EffectiveFieldKey` | `AvEffectiveFieldKey` |
125
+ | `EnumDefinition` | `AvEnumDefinition` |
126
+ | `ExactFrameworkConfig` | `AvConfigExact` |
127
+ | `ExecutionOptions` | `AvExecutionOptions` |
128
+ | `Field` | `AvField` |
129
+ | `FieldComputeConfig` | `AvFieldCompute` |
130
+ | `FieldKey` | `AvFieldKey` |
131
+ | `FieldPipe` | `AvFieldPipe` |
132
+ | `FieldWriteGuard` | `AvFieldGuard` |
133
+ | `Filter` | `AvFilter` |
134
+ | `Framework` | `AvFramework` |
135
+ | `FrameworkConfig` | `AvConfig` |
136
+ | `FrameworkConstructionDiagnostic` | `AvConstructionDiagnostic` |
137
+ | `FrameworkConstructionError` | `AvConstructionError` |
138
+ | `FrameworkConstructionStage` | `AvConstructionStage` |
139
+ | `FrameworkContracts` | `AvContracts` |
140
+ | `FrameworkDiagnostic` | `AvDiagnostic` |
141
+ | `FrameworkDiagnosticsSink` | `AvDiagnosticsSink` |
142
+ | `FrameworkError` | `AvError` |
143
+ | `FrameworkExemptionsConfig` | `AvConfigExemptions` |
144
+ | `FrameworkFamilyConfig` | `AvConfigFamily` |
145
+ | `FrameworkFieldDefinition` | `AvConfigFieldDefinition` |
146
+ | `FrameworkFieldLifecycleTrait` | `AvConfigFieldLifecycleTrait` |
147
+ | `FrameworkLayerConfig` | `AvConfigLayer` |
148
+ | `FrameworkLayerKind` | `AvConfigLayerKind` |
149
+ | `FrameworkLimitsConfig` | `AvConfigLimits` |
150
+ | `FrameworkMisuseEvent` | `AvMisuseEvent` |
151
+ | `FrameworkMisuseSink` | `AvMisuseSink` |
152
+ | `FrameworkOperationsConfig` | `AvConfigOperations` |
153
+ | `FrameworkOperationsExemption` | `AvConfigOperationsExemption` |
154
+ | `FrameworkOverlayFieldConfig` | `AvConfigOverlayField` |
155
+ | `FrameworkRelationFieldExemption` | `AvConfigRelationFieldExemption` |
156
+ | `FrameworkResourceConfig` | `AvConfigResource` |
157
+ | `FrameworkResourceExemption` | `AvConfigResourceExemption` |
158
+ | `FrameworkResourceFieldsConfig` | `AvConfigResourceFields` |
159
+ | `FrameworkResourceKey` | `AvConfigResourceKey` |
160
+ | `FrameworkResourcesConfig` | `AvConfigResources` |
161
+ | `FrameworkResourceTransactionsConfig` | `AvConfigResourceTransactions` |
162
+ | `FrameworkRootFieldConfig` | `AvConfigRootField` |
163
+ | `FrameworkScalarFieldExemption` | `AvConfigScalarFieldExemption` |
164
+ | `FrameworkScalarTypeRef` | `AvConfigScalarTypeRef` |
165
+ | `FrameworkVariantConfig` | `AvConfigVariant` |
166
+ | `Guard` | `AvGuard` |
167
+ | `Identifier` | `AvIdentifier` |
168
+ | `IncludeInput` | `AvIncludeInput` |
169
+ | `Interceptor` | `AvInterceptor` |
170
+ | `JsonValue` | `AvJsonValue` |
171
+ | `KnownFieldDefinition` | `AvConfigKnownFieldDefinition` |
172
+ | `LifecycleTrait` | `AvLifecycleTrait` |
173
+ | `NullsOrder` | `AvNullsOrder` |
174
+ | `Operation` | `AvOperation` |
175
+ | `OperationArgumentMap` | `AvOperationArgumentMap` |
176
+ | `OperationArgumentsFor` | `AvOperationArgumentsFor` |
177
+ | `OperationAvailability` | `AvOperationAvailability` |
178
+ | `OperationCall` | `AvOperationCall` |
179
+ | `OperationCode` | `AvOperationCode` |
180
+ | `OperationDiagnostic` | `AvOperationDiagnostic` |
181
+ | `OperationErrorCode` | `AvOperationErrorCode` |
182
+ | `OperationFailureResponse` | `AvOperationFailureResponse` |
183
+ | `OperationFamily` | `AvOperationFamily` |
184
+ | `OperationGrammar` | `AvOperationGrammar` |
185
+ | `OperationIdentity` | `AvOperationIdentity` |
186
+ | `OperationNoMatchResponse` | `AvOperationNoMatchResponse` |
187
+ | `OperationReferenceSurface` | `AvOperationReferenceSurface` |
188
+ | `OperationResponse` | `AvOperationResponse` |
189
+ | `OperationResultFor` | `AvOperationResultFor` |
190
+ | `OperationSlot` | `AvOperationSlot` |
191
+ | `OperationSuccessCode` | `AvOperationSuccessCode` |
192
+ | `OperationSuccessDataCode` | `AvOperationSuccessDataCode` |
193
+ | `OperationSuccessResponse` | `AvOperationSuccessResponse` |
194
+ | `OperationVariant` | `AvOperationVariant` |
195
+ | `OperationVariantScopes` | `AvOperationVariantScopes` |
196
+ | `OrderByEntry` | `AvOrderByEntry` |
197
+ | `OrderByInput` | `AvOrderByInput` |
198
+ | `PaginationCapability` | `AvPaginationCapability` |
199
+ | `Pipe` | `AvPipe` |
200
+ | `PipelineConfig` | `AvPipeline` |
201
+ | `PipelineContext` | `AvContext` |
202
+ | `PipelineTransportContext` | `AvTransportContext` |
203
+ | `ProjectionEntry` | `AvProjectionEntry` |
204
+ | `ProjectionScope` | `AvProjectionScope` |
205
+ | `ProjectionScopes` | `AvProjectionScopes` |
206
+ | `ReferenceableField` | `AvReferenceableField` |
207
+ | `ReferenceBuilder` | `AvReferenceBuilder` |
208
+ | `RelationField` | `AvRelationField` |
209
+ | `RelationFieldCapabilities` | `AvRelationFieldCapabilities` |
210
+ | `RelationFieldCapabilityName` | `AvRelationFieldCapabilityName` |
211
+ | `RelationFieldPipelineConfig` | `AvRelationFieldPipeline` |
212
+ | `RelationFilterCapability` | `AvRelationFilterCapability` |
213
+ | `RelationMutationCapability` | `AvRelationMutationCapability` |
214
+ | `RelationMutationDirective` | `AvRelationMutationDirective` |
215
+ | `RelationProjectionCapability` | `AvRelationProjectionCapability` |
216
+ | `RelationProjectionInput` | `AvRelationProjectionInput` |
217
+ | `RelationReducer` | `AvRelationReducer` |
218
+ | `RelationReducerCapability` | `AvRelationReducerCapability` |
219
+ | `RequestOrigin` | `AvRequestOrigin` |
220
+ | `Resource` | `AvResource` |
221
+ | `ResourceFieldMap` | `AvResourceFieldMap` |
222
+ | `ResourceKey` | `AvResourceKey` |
223
+ | `ResourceOperations` | `AvResourceOperations` |
224
+ | `ScalarDefinition` | `AvScalarDefinition` |
225
+ | `ScalarField` | `AvScalarField` |
226
+ | `ScalarFieldCapabilities` | `AvScalarFieldCapabilities` |
227
+ | `ScalarFieldCapabilityName` | `AvScalarFieldCapabilityName` |
228
+ | `ScalarFieldKey` | `AvScalarFieldKey` |
229
+ | `ScalarFieldPipelineConfig` | `AvScalarFieldPipeline` |
230
+ | `ScalarFilterOperator` | `AvScalarFilterOperator` |
231
+ | `ScalarFormat` | `AvScalarFormat` |
232
+ | `ScalarMutationDirective` | `AvScalarMutationDirective` |
233
+ | `ScalarOrderInput` | `AvScalarOrderInput` |
234
+ | `ScalarRegistry` | `AvScalarRegistry` |
235
+ | `ScalarValueType` | `AvScalarValueType` |
236
+ | `ScopedRelationMutations` | `AvScopedRelationMutations` |
237
+ | `ScopedRelationReducers` | `AvScopedRelationReducers` |
238
+ | `SelectInput` | `AvSelectInput` |
239
+ | `SingleRowResult` | `AvSingleRowResult` |
240
+ | `SortDirection` | `AvSortDirection` |
241
+ | `TransactionAfterHook` | `AvTransactionAfterHook` |
242
+ | `TransactionBeforeHook` | `AvTransactionBeforeHook` |
243
+ | `TransactionCapability` | `AvTransactionCapability` |
244
+ | `TransactionCommittedResponse` | `AvTransactionCommittedResponse` |
245
+ | `TransactionDiagnostic` | `AvTransactionDiagnostic` |
246
+ | `TransactionFilter` | `AvTransactionFilter` |
247
+ | `TransactionGuard` | `AvTransactionGuard` |
248
+ | `TransactionIntegrityError` | `AvTransactionIntegrityError` |
249
+ | `TransactionIntegrityViolation` | `AvTransactionIntegrityViolation` |
250
+ | `TransactionInterceptor` | `AvTransactionInterceptor` |
251
+ | `TransactionPipe` | `AvTransactionPipe` |
252
+ | `TransactionPipelineConfig` | `AvTransactionPipeline` |
253
+ | `TransactionPipelineContext` | `AvTransactionContext` |
254
+ | `TransactionReference` | `AvTransactionReference` |
255
+ | `TransactionResponse` | `AvTransactionResponse` |
256
+ | `TransactionResults` | `AvTransactionResults` |
257
+ | `TransactionRunner` | `AvTransactionRunner` |
258
+ | `TransactionSlotPathError` | `AvTransactionSlotPathError` |
259
+ | `TransactionSlotPathViolation` | `AvTransactionSlotPathViolation` |
260
+ | `UniqueWhereInput` | `AvUniqueWhereInput` |
261
+ | `UpdateDataInput` | `AvUpdateDataInput` |
262
+ | `ValidationCode` | `AvValidationCode` |
263
+ | `ValidationIssue` | `AvValidationIssue` |
264
+ | `WhereInput` | `AvWhereInput` |
265
+ | `WireScalarForms` | `AvWireScalarForms` |
266
+ | `WriteScope` | `AvWriteScope` |
267
+ | `WriteScopes` | `AvWriteScopes` |
268
+
269
+ Error classes whose `name` a log or a test may read:
270
+
271
+ | Before | After |
272
+ | ------------------------ | -------------------------- |
273
+ | `CallerDataError` | `AvCallerDataError` |
274
+ | `ClientConfigError` | `AvClientConfigError` |
275
+ | `ComputedValueError` | `AvComputedValueError` |
276
+ | `ContractProtocolError` | `AvContractProtocolError` |
277
+ | `ContractTransportError` | `AvContractTransportError` |
278
+ | `EnvFileError` | `AvEnvFileError` |
279
+ | `OutputValidationError` | `AvOutputValidationError` |
280
+ | `OutputWriteError` | `AvOutputWriteError` |
281
+ | `PipeOutputError` | `AvPipeOutputError` |
282
+ | `UnmountedRouteError` | `AvUnmountedRouteError` |
283
+
284
+ `@aventara/testing`:
285
+
286
+ | Before | After |
287
+ | ------------------------ | -------------------------- |
288
+ | `AdapterFactory` | `AvAdapterFactory` |
289
+ | `FakeAdapter` | `AvFakeAdapter` |
290
+ | `FakeAdapterExecute` | `AvFakeAdapterExecute` |
291
+ | `FakeAdapterOptions` | `AvFakeAdapterOptions` |
292
+ | `FakeAdapterRollback` | `AvFakeAdapterRollback` |
293
+ | `FakeTransactionOutcome` | `AvFakeTransactionOutcome` |
294
+ | `FakeTransactionTrace` | `AvFakeTransactionTrace` |
295
+
296
+ `@aventara/client` (the `framework.client.ts` config types):
297
+
298
+ | Before | After |
299
+ | ------------------- | --------------------- |
300
+ | `ClientConfigInput` | `AvClientConfigInput` |
301
+ | `ConfigValue` | `AvClientConfigValue` |
302
+ | `EnvReference` | `AvEnvReference` |
303
+
304
+ `@aventara/prisma7-adapter`: its public types and error classes (`createPrismaAdapter` keeps its name):
305
+
306
+ | Before | After |
307
+ | ---------------------------------- | ------------------------------------ |
308
+ | `PrismaAdapterModel` | `AvPrismaAdapterModel` |
309
+ | `PrismaAdapterOptions` | `AvPrismaAdapterOptions` |
310
+ | `PrismaDelegate` | `AvPrismaDelegate` |
311
+ | `PrismaDelegateHost` | `AvPrismaDelegateHost` |
312
+ | `PrismaDelegateIndex` | `AvPrismaDelegateIndex` |
313
+ | `PrismaDiscoveryArtifact` | `AvPrismaDiscoveryArtifact` |
314
+ | `PrismaDriver` | `AvPrismaDriver` |
315
+ | `PrismaIsolationLevel` | `AvPrismaIsolationLevel` |
316
+ | `PrismaProvider` | `AvPrismaProvider` |
317
+ | `PrismaProviderProfile` | `AvPrismaProviderProfile` |
318
+ | `PrismaReferentialAction` | `AvPrismaReferentialAction` |
319
+ | `PrismaReferentialActionTable` | `AvPrismaReferentialActionTable` |
320
+ | `PrismaReferentialEdge` | `AvPrismaReferentialEdge` |
321
+ | `PrismaResourceReferentialActions` | `AvPrismaResourceReferentialActions` |
322
+ | `PrismaTransactionOptions` | `AvPrismaTransactionOptions` |
323
+ | `PrismaCapabilityDerivationError` | `AvPrismaCapabilityDerivationError` |
324
+ | `PrismaDiscoveryArtifactError` | `AvPrismaDiscoveryArtifactError` |
325
+ | `PrismaEmulationError` | `AvPrismaEmulationError` |
326
+ | `PrismaExecutionError` | `AvPrismaExecutionError` |
327
+ | `PrismaExistenceGateError` | `AvPrismaExistenceGateError` |
328
+ | `PrismaFieldProjectionError` | `AvPrismaFieldProjectionError` |
329
+ | `PrismaGenerateCliError` | `AvPrismaGenerateCliError` |
330
+ | `PrismaGenerateStepError` | `AvPrismaGenerateStepError` |
331
+ | `PrismaModelCompositionError` | `AvPrismaModelCompositionError` |
332
+ | `PrismaMutationTranslationError` | `AvPrismaMutationTranslationError` |
333
+ | `PrismaOperationTranslationError` | `AvPrismaOperationTranslationError` |
334
+ | `PrismaOrderTranslationError` | `AvPrismaOrderTranslationError` |
335
+ | `PrismaProjectionTranslationError` | `AvPrismaProjectionTranslationError` |
336
+ | `PrismaResultShapeError` | `AvPrismaResultShapeError` |
337
+ | `PrismaScalarConversionError` | `AvPrismaScalarConversionError` |
338
+ | `PrismaSchemaReaderError` | `AvPrismaSchemaReaderError` |
339
+ | `PrismaTypesReaderError` | `AvPrismaTypesReaderError` |
340
+ | `PrismaWhereTranslationError` | `AvPrismaWhereTranslationError` |
341
+
342
+ - 1b5d3c0: Breaking: every framework member of a pipeline ctx is `$`-prefixed, and ctx is now the framework's executor.
343
+ The rest of ctx is your Resources: `ctx.<Resource>.<family>.<variant>(args)`, plus `ctx.$sql` and
344
+ `ctx.$transaction`. Because a Resource name can never start with `$` (`COMPILER_RESERVED_RESOURCE_NAME`), a Resource
345
+ never shadows a framework member. The old names are gone with no alias. Reading one is a type error; at runtime it
346
+ is `undefined`.
347
+
348
+ | rc.0 | rc.1 |
349
+ | --------------------------------------------------------- | --------------------------------------------------------------------------- |
350
+ | `ctx.resource`, `ctx.family`, `ctx.variant`, `ctx.nested` | `ctx.$operation.resource`, `.family`, `.variant`, `.nested` |
351
+ | `ctx.args` | `ctx.$args` (a transaction stage: the plan, `readonly AvTransactionStep[]`) |
352
+ | `ctx.origin` | `ctx.$origin` |
353
+ | `ctx.requestId` | `ctx.$requestId` |
354
+ | `ctx.transport` | `ctx.$transport` |
355
+ | `ctx.contract` | `ctx.$contract` |
356
+
357
+ A transaction stage's ctx has no `$operation`.
358
+
359
+ ```ts
360
+ hooks: {
361
+ after: [
362
+ async (post, ctx) => {
363
+ await ctx.User.update.unique({ where: { id: authorId }, data: { postCount: { $increment: 1 } } });
364
+ await ctx.$sql`insert into audit_events (actor, action) values (${actorId}, ${"post.create"})`;
365
+ },
366
+ ],
367
+ },
368
+ ```
369
+
370
+ - A ctx call is raw and application-origin. It runs the Framework Validation Layer against the
371
+ ApplicationContract, plus field pipes, field validators and compute. It runs no developer stage: no guards, pipes,
372
+ hooks, interceptors or filters at any level, no field write guards, no nested target guards, no Resource
373
+ transaction stages, and no `forceTransaction` wrapping. So a hook's call never re-enters the hook that made it.
374
+ The application layer's exposure limits it. The client's does not.
375
+ - A call resolves the operation's data directly (a row, a list, a count, or `null` for a first-style miss). A
376
+ failure throws the `AvError` subclass of its code's class (`AvNotFoundError`, `AvValidationError`, …; see the
377
+ in-process calls entry below) carrying the failure's `code` and `cause`.
378
+ - It joins the current transaction. That covers a plan step's stages, a forced call's stages, a Resource's
379
+ transaction stages and a `ctx.$transaction` callback. Outside a transaction each call runs on its own. Under
380
+ `forceTransaction`, an after hook's ctx writes commit with the operation or not at all (the outbox and
381
+ counter-on-another-Resource cases).
382
+ - `ctx.$sql` is the bound tagged template of `appTx.$sql`, run at once. It takes only the tagged-template form,
383
+ binds every value, needs the Adapter's `sqlStatements`, and accepts no `$ref`. It resolves the rows, typed by
384
+ `ctx.$sql<Row>`. Inside a transaction it runs on it; outside one it is a plain statement, with no transaction
385
+ opened around it, and `transactionsStyle: "none"` does not affect it (only `ctx.$transaction` is refused there).
386
+ - `ctx.$transaction(async (tx) => …)` runs the callback in one transaction, with `tx` the ctx bound to it, and
387
+ resolves what the callback returns. A throw rolls it back and is rethrown as it was. Inside an open transaction it
388
+ opens nothing and joins.
389
+ - The executor is typed from the adapter's model, with the application forms and the operation's data
390
+ as the result, like `framework.application`'s success data. A stage typed for any model (`AvGuard` with no model)
391
+ names no Resource.
392
+ - Compute gets a read-only ctx, `AvComputeContext` (new public name). It carries the `$` facts and
393
+ `ctx.<Resource>.find.*` (`find.count` included), and nothing that writes: no write families, no `$sql`, no
394
+ `$transaction`. This holds at runtime too: reaching one throws, and the operation answers `A3000`. A compute
395
+ stage's input is now `{ field, value, data, ctx }` (`{ field, value, record, ctx }` on read). rc.0's `origin`,
396
+ `resource` and `operation` members are gone: use `ctx.$origin`, `ctx.$operation`, and the stage's placement for
397
+ its Resource.
398
+ - A transaction pipe's returned plan is typed `readonly AvTransactionStep[]` (any model). The runtime holds it to
399
+ the plan it was given, as before.
400
+
401
+ - 9c52482: A `$connect` to a row that does not exist now answers `404 A2003` (not found), the same as reading a missing row.
402
+ Before, it answered `422 A2004`. This covers a to-one `$connect` in `create`, `update` and `upsert`, a to-many
403
+ `$connect`, and the same writes inside a transaction plan, where `cause.operation` names the step. The message is
404
+ unchanged: "The operation's arguments referenced a record that does not exist." On `update.first`, the same mistake
405
+ answered `A2014` before, as if the row had changed underneath; it now answers `A2003` too, and a duplicate unique value
406
+ written through `update.first` answers `409 A2008` instead of `A3001`.
407
+
408
+ Clearer top-level messages for an unknown Resource or operation. `A2001` now says "The requested Resource is not
409
+ available." and `A2002` says "The requested operation is not available on this Resource.", instead of "Operation
410
+ arguments failed framework validation.", which stays the message of `A2004`, `A2007` and `A2009`. A transaction step
411
+ whose operation is outside the standard grammar now carries the same issue message as a single call, naming the
412
+ operation and the Resource (for example `Operation "dance.one" is not available on Resource "posts".`), instead of
413
+ "Operation is not part of the standard operation grammar."
414
+
415
+ A `$ref` with no `fingerprint` is `V1000` (required value missing) and answers `422 A2004`. Before, it was `V1017`
416
+ (fingerprint mismatch) under `A2007`. A fingerprint that is present but wrong is still `V1017`.
417
+
418
+ `aventara init` and `aventara new` link to the documentation at https://aventara-framework.vercel.app. The old
419
+ address redirects, so links already written into projects keep working.
420
+
421
+ - Updated dependencies [800123b]
422
+ - Updated dependencies [8bb1d6a]
423
+ - Updated dependencies [68d4395]
424
+ - Updated dependencies [7e3d06f]
425
+ - Updated dependencies [1b5d3c0]
426
+ - Updated dependencies [6317811]
427
+ - Updated dependencies [6d0e5d6]
428
+ - Updated dependencies [7a0cab9]
429
+ - Updated dependencies [eb2a718]
430
+ - Updated dependencies [03312c5]
431
+ - Updated dependencies [123f6dc]
432
+ - Updated dependencies [b65df2e]
433
+ - Updated dependencies [c6e5010]
434
+ - Updated dependencies [c1f9389]
435
+ - Updated dependencies [9c52482]
436
+ - Updated dependencies [8396148]
437
+ - Updated dependencies [e8fbb02]
438
+ - Updated dependencies [916e5f6]
439
+ - Updated dependencies [6cbd158]
440
+ - @aventara/core@1.0.0-rc.1
441
+
3
442
  ## 1.0.0-rc.0
4
443
 
5
444
  ### Major Changes
package/README.md CHANGED
@@ -1,15 +1,15 @@
1
1
  # `@aventara/testing`
2
2
 
3
- Conformance fixtures and testing utilities for Aventara extensions: what an adapter or a transport host is held to,
4
- from outside.
3
+ Conformance fixtures and testing utilities for Aventara extensions. They test an adapter or a transport host from
4
+ outside.
5
5
 
6
- - `createFakeAdapter` — an in-memory adapter, with transaction tracing, for testing code that runs a `Framework`
6
+ - `createFakeAdapter`: an in-memory adapter, with transaction tracing, for testing code that runs an `AvFramework`
7
7
  without a database.
8
- - `runAvProtocolConformance(driver)` — drives the protocol corpus (`AvProtocolFixtures`) through one host and reports,
8
+ - `runAvProtocolConformance(driver)`: drives the protocol corpus (`AvProtocolFixtures`) through one host and reports,
9
9
  per row, every mismatch with the expected status, code, cause, headers and body. A host supplies an
10
- `AvProtocolDriver`: given a `Framework`, a session that sends one protocol request and returns the answer, and closes.
11
- - `AvProtocolCorpus` — the corpus's server side, for serving it through your own client or host (below).
12
- - `@aventara/testing/fixtures/protocol-v1.json` — the same corpus as plain JSON, for a client or host written in any
10
+ `AvProtocolDriver`: given an `AvFramework`, a session that sends one protocol request and returns the answer, and closes.
11
+ - `AvProtocolCorpus`: the corpus's server side, for serving it through your own client or host (below).
12
+ - `@aventara/testing/fixtures/protocol-v1.json`: the same corpus as plain JSON, for a client or host written in any
13
13
  language (below).
14
14
 
15
15
  It depends on `@aventara/core` only.
@@ -17,15 +17,15 @@ It depends on `@aventara/core` only.
17
17
  ## Install
18
18
 
19
19
  ```bash
20
- npm install --save-dev @aventara/testing
20
+ npm install --save-dev @aventara/testing@rc
21
21
  ```
22
22
 
23
23
  Node `^22.18.0 || >=24.2.0`. ES modules.
24
24
 
25
25
  ## Serving the corpus through your own stack
26
26
 
27
- `runAvProtocolConformance` builds the corpus `Framework` itself. To serve it from a host or test bench of your own — to
28
- point a client you are writing at it, say — take it from `AvProtocolCorpus`:
27
+ `runAvProtocolConformance` builds the corpus `AvFramework` itself. To serve it from a host or test bench of your own,
28
+ for example to point a client you are writing at it, take it from `AvProtocolCorpus`:
29
29
 
30
30
  ```ts
31
31
  import { AvProtocolCorpus, AvProtocolFixtures } from "@aventara/testing";
@@ -35,12 +35,12 @@ const framework = await AvProtocolCorpus.framework();
35
35
  // then send each row's `request` and compare the answer with the row's `server`.
36
36
  ```
37
37
 
38
- - `framework(contractHash?)` — a fresh corpus `Framework`, backed by an in-memory adapter whose answers every row
38
+ - `framework(contractHash?)`: a fresh corpus `AvFramework`, backed by an in-memory adapter whose answers every row
39
39
  states. Pass a row's `Aventara-Contract-Hash` to get the contract that row targets: a few rows target a second
40
40
  contract without transactions, and every other hash (a stale one included) gets the main contract.
41
- - `entrypoint` — where the corpus is mounted; every row's `path` is relative to it.
42
- - `clientContractHash` — the main ClientContract's hash: what a client generated against it sends, and what
43
- `GET /_contract` names.
41
+ - `entrypoint`: where the corpus is mounted; every row's `path` is relative to it.
42
+ - `clientContractHash`: the main ClientContract's hash. A client generated against it sends this hash, and
43
+ `GET /_contract` names it.
44
44
 
45
45
  A row whose `client.outcome` is `"transport-error"` describes an answer no host produces (a proxy's HTML page, a
46
46
  dropped connection); skip it when serving, as the conformance run does. A row's `adapterCalls` counts the operations
@@ -48,9 +48,9 @@ the corpus adapter was handed, which only the conformance run can observe.
48
48
 
49
49
  ## The corpus as JSON
50
50
 
51
- `@aventara/testing/fixtures/protocol-v1.json` holds the whole corpus for protocol version 1, generated from
52
- `AvProtocolFixtures` when the package is built — every row, in the same order and with the same fields — so a client or
53
- host written in another language can be held to the same answers:
51
+ `@aventara/testing/fixtures/protocol-v1.json` holds the whole corpus for protocol version 1. It is generated from
52
+ `AvProtocolFixtures` when the package is built, with every row in the same order and with the same fields, so a client
53
+ or host written in another language can be held to the same answers:
54
54
 
55
55
  ```json
56
56
  {
@@ -62,9 +62,9 @@ host written in another language can be held to the same answers:
62
62
  }
63
63
  ```
64
64
 
65
- - `contracts` — each ClientContract a row targets: its hash and its exact `GET /_contract` bytes (`document`, a
65
+ - `contracts`: each ClientContract a row targets: its hash and its exact `GET /_contract` bytes (`document`, a
66
66
  string). The first is the main contract, `clientContractHash`; a row targets the other by sending its hash.
67
- - `rows` — as `AvProtocolFixture` describes them. One body is too large to write out (one byte over the 1 MiB request
67
+ - `rows`: as `AvProtocolFixture` describes them. One body is too large to write out (one byte over the 1 MiB request
68
68
  limit): its `request.body.content` is a recipe, `{ "prefix": "…", "repeat": "x", "times": 1048567, "suffix": "…" }`,
69
69
  standing for `prefix` + `repeat` repeated `times` times + `suffix`. Every other `content` is the body's text.
70
70
 
@@ -77,5 +77,6 @@ corpus on Express and Fastify in its own tests. Each package's README ships in i
77
77
 
78
78
  ## License
79
79
 
80
- PolyForm Shield 1.0.0 with an additional permission — free to use, including in commercial applications; you may not
81
- use it to build a product that competes with Aventara itself. See `LICENSE` and `LICENSE-ADDITIONAL-PERMISSION.md`.
80
+ PolyForm Shield 1.0.0 with an additional permission. It is free to use, including in commercial applications, but you
81
+ may not use it to build a product that competes with Aventara itself. See `LICENSE` and
82
+ `LICENSE-ADDITIONAL-PERMISSION.md`.
@@ -1,3 +1,3 @@
1
- import type { Adapter, AdapterModel } from "@aventara/core";
1
+ import type { AvAdapter, AvAdapterModel } from "@aventara/core";
2
2
  /** Builds the Adapter under test; reusable adapter conformance suites take one. */
3
- export type AdapterFactory<M extends AdapterModel = AdapterModel> = () => Adapter<M> | Promise<Adapter<M>>;
3
+ export type AvAdapterFactory<M extends AvAdapterModel = AvAdapterModel> = () => AvAdapter<M> | Promise<AvAdapter<M>>;
@@ -1,43 +1,43 @@
1
- import type { Adapter, AdapterModel } from "@aventara/core";
2
- import type { AdapterOperation } from "@aventara/core/internal";
1
+ import type { AvAdapter, AvAdapterModel } from "@aventara/core";
2
+ import type { AvAdapterOperation } from "@aventara/core/internal";
3
3
  /** Answers one operation the fake Adapter is handed. */
4
- export type FakeAdapterExecute<M extends AdapterModel> = (operation: AdapterOperation<M>) => unknown | Promise<unknown>;
4
+ export type AvFakeAdapterExecute<M extends AvAdapterModel> = (operation: AvAdapterOperation<M>) => unknown | Promise<unknown>;
5
5
  /** How a transaction ended: `"committed"` or `"rolled-back"`. */
6
- export type FakeTransactionOutcome = "committed" | "rolled-back";
6
+ export type AvFakeTransactionOutcome = "committed" | "rolled-back";
7
7
  /** One settled transaction boundary: what ran inside it, and how it ended. */
8
- export type FakeTransactionTrace<M extends AdapterModel> = {
8
+ export type AvFakeTransactionTrace<M extends AvAdapterModel> = {
9
9
  /** The operations run inside the transaction, in order. */
10
- readonly operations: readonly AdapterOperation<M>[];
10
+ readonly operations: readonly AvAdapterOperation<M>[];
11
11
  /** How the transaction ended. */
12
- readonly outcome: FakeTransactionOutcome;
12
+ readonly outcome: AvFakeTransactionOutcome;
13
13
  };
14
14
  /**
15
15
  * Rollback for state the test owns: `snapshot` when a transaction begins,
16
16
  * `restore` when its work rejects. Without it, the fake Adapter records
17
17
  * transaction boundaries but keeps whatever the work wrote.
18
18
  */
19
- export type FakeAdapterRollback<S> = {
19
+ export type AvFakeAdapterRollback<S> = {
20
20
  /** Captures the state before a transaction's work runs. */
21
21
  readonly snapshot: () => S;
22
22
  /** Puts the captured state back after the work rejects. */
23
23
  readonly restore: (snapshot: S) => void;
24
24
  };
25
25
  /** Options for {@link createFakeAdapter}. */
26
- export type FakeAdapterOptions<M extends AdapterModel, S = unknown> = {
26
+ export type AvFakeAdapterOptions<M extends AvAdapterModel, S = unknown> = {
27
27
  /** The adapter model the fake Adapter reports. */
28
28
  readonly model: M;
29
29
  /** Answers each operation; without it, every operation resolves `undefined`. */
30
- readonly execute?: FakeAdapterExecute<M>;
31
- /** Makes transactions roll back the test's own state; see {@link FakeAdapterRollback}. */
32
- readonly rollback?: FakeAdapterRollback<S>;
30
+ readonly execute?: AvFakeAdapterExecute<M>;
31
+ /** Makes transactions roll back the test's own state; see {@link AvFakeAdapterRollback}. */
32
+ readonly rollback?: AvFakeAdapterRollback<S>;
33
33
  };
34
34
  /**
35
35
  * The Adapter {@link createFakeAdapter} returns, with a record of every
36
36
  * operation and transaction it ran.
37
37
  */
38
- export type FakeAdapter<M extends AdapterModel = AdapterModel> = Adapter<M> & {
39
- readonly operations: readonly AdapterOperation<M>[];
40
- readonly transactions: readonly FakeTransactionTrace<M>[];
38
+ export type AvFakeAdapter<M extends AvAdapterModel = AvAdapterModel> = AvAdapter<M> & {
39
+ readonly operations: readonly AvAdapterOperation<M>[];
40
+ readonly transactions: readonly AvFakeTransactionTrace<M>[];
41
41
  };
42
42
  /** A provider-free, in-memory Adapter for framework and conformance tests. */
43
- export declare function createFakeAdapter<M extends AdapterModel, S = unknown>(options: FakeAdapterOptions<M, S>): FakeAdapter<M>;
43
+ export declare function createFakeAdapter<M extends AvAdapterModel, S = unknown>(options: AvFakeAdapterOptions<M, S>): AvFakeAdapter<M>;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export type { AdapterFactory } from "./adapters/adapter-factory.js";
2
- export type { FakeAdapter, FakeAdapterExecute, FakeAdapterOptions, FakeAdapterRollback, FakeTransactionOutcome, FakeTransactionTrace, } from "./adapters/fake-adapter.js";
1
+ export type { AvAdapterFactory } from "./adapters/adapter-factory.js";
2
+ export type { AvFakeAdapter, AvFakeAdapterExecute, AvFakeAdapterOptions, AvFakeAdapterRollback, AvFakeTransactionOutcome, AvFakeTransactionTrace, } from "./adapters/fake-adapter.js";
3
3
  export { createFakeAdapter } from "./adapters/fake-adapter.js";
4
4
  export { runAvProtocolConformance } from "./protocol/protocol-conformance.js";
5
5
  export { AvProtocolCorpus } from "./protocol/protocol-corpus.js";