@aventara/prisma7-adapter 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 (80) hide show
  1. package/CHANGELOG.md +552 -0
  2. package/README.md +407 -329
  3. package/dist/discovery/artifact.loader.d.ts +10 -6
  4. package/dist/discovery/artifact.loader.js +20 -20
  5. package/dist/discovery/capability-surface.interface.d.ts +1 -1
  6. package/dist/discovery/capability.deriver.d.ts +9 -6
  7. package/dist/discovery/capability.deriver.js +41 -6
  8. package/dist/discovery/client-shape.verifier.d.ts +1 -1
  9. package/dist/discovery/client-shape.verifier.js +2 -2
  10. package/dist/discovery/discovery-artifact.interface.d.ts +38 -47
  11. package/dist/discovery/discovery-artifact.interface.js +1 -1
  12. package/dist/discovery/enum.mapper.d.ts +2 -2
  13. package/dist/discovery/field.mapper.d.ts +13 -13
  14. package/dist/discovery/field.mapper.js +10 -10
  15. package/dist/discovery/identifier.mapper.d.ts +7 -7
  16. package/dist/discovery/installed-client.locator.d.ts +13 -0
  17. package/dist/discovery/installed-client.locator.js +43 -0
  18. package/dist/discovery/model.discoverer.d.ts +7 -4
  19. package/dist/discovery/model.discoverer.js +61 -19
  20. package/dist/discovery/operations.deriver.d.ts +6 -6
  21. package/dist/discovery/schema-facts.interface.d.ts +3 -3
  22. package/dist/discovery/schema.reader.d.ts +2 -2
  23. package/dist/discovery/schema.reader.js +5 -5
  24. package/dist/discovery/types.reader.d.ts +2 -2
  25. package/dist/discovery/types.reader.js +22 -22
  26. package/dist/discovery/vocabulary.dictionary.d.ts +14 -14
  27. package/dist/discovery/vocabulary.dictionary.js +1 -1
  28. package/dist/errors/back-reference.locator.d.ts +25 -0
  29. package/dist/errors/back-reference.locator.js +100 -0
  30. package/dist/errors/bigint-binding.locator.d.ts +7 -0
  31. package/dist/errors/bigint-binding.locator.js +27 -0
  32. package/dist/errors/error.normalizer.d.ts +44 -6
  33. package/dist/errors/error.normalizer.js +96 -7
  34. package/dist/errors/prisma-error.reader.d.ts +6 -0
  35. package/dist/errors/prisma-error.reader.js +3 -0
  36. package/dist/execution/first-variant.emulator.d.ts +4 -4
  37. package/dist/execution/first-variant.emulator.js +13 -9
  38. package/dist/execution/operation.executor.d.ts +15 -9
  39. package/dist/execution/operation.executor.js +34 -17
  40. package/dist/execution/result.shaper.d.ts +3 -3
  41. package/dist/execution/result.shaper.js +7 -7
  42. package/dist/execution/sql-statement.executor.d.ts +9 -0
  43. package/dist/execution/sql-statement.executor.js +58 -0
  44. package/dist/execution/transaction.executor.d.ts +12 -8
  45. package/dist/execution/transaction.executor.js +11 -5
  46. package/dist/generate/artifact.emitter.d.ts +11 -7
  47. package/dist/generate/artifact.emitter.js +60 -18
  48. package/dist/generate/computed-fields.reader.d.ts +19 -0
  49. package/dist/generate/computed-fields.reader.js +210 -0
  50. package/dist/generate/declared-support.reader.d.ts +1 -1
  51. package/dist/generate/discovery.cli.d.ts +4 -3
  52. package/dist/generate/discovery.cli.js +31 -15
  53. package/dist/generate/existence.gate.d.ts +4 -4
  54. package/dist/generate/existence.gate.js +4 -4
  55. package/dist/generate/index.d.ts +13 -5
  56. package/dist/generate/index.js +5 -2
  57. package/dist/generate/prisma.generate.d.ts +24 -8
  58. package/dist/generate/prisma.generate.js +52 -15
  59. package/dist/index.d.ts +4 -4
  60. package/dist/prisma-client.interface.d.ts +22 -8
  61. package/dist/prisma-client.interface.js +7 -0
  62. package/dist/prisma.adapter.d.ts +16 -16
  63. package/dist/prisma.adapter.js +48 -5
  64. package/dist/provider/provider-profile.d.ts +29 -13
  65. package/dist/provider/provider-profile.js +21 -0
  66. package/dist/translation/json-null.sentinel.d.ts +7 -0
  67. package/dist/translation/json-null.sentinel.js +17 -0
  68. package/dist/translation/mutation.translator.d.ts +8 -8
  69. package/dist/translation/mutation.translator.js +37 -30
  70. package/dist/translation/operation.translator.d.ts +7 -7
  71. package/dist/translation/operation.translator.js +12 -12
  72. package/dist/translation/order-pagination.translator.d.ts +5 -5
  73. package/dist/translation/order-pagination.translator.js +16 -16
  74. package/dist/translation/projection.translator.d.ts +4 -4
  75. package/dist/translation/projection.translator.js +11 -11
  76. package/dist/translation/scalar.conversion.d.ts +9 -9
  77. package/dist/translation/scalar.conversion.js +11 -11
  78. package/dist/translation/where.translator.d.ts +5 -5
  79. package/dist/translation/where.translator.js +114 -31
  80. package/package.json +6 -6
package/CHANGELOG.md CHANGED
@@ -1,5 +1,557 @@
1
1
  # @aventara/prisma7-adapter
2
2
 
3
+ ## 1.0.0-rc.2
4
+
5
+ ### Patch Changes
6
+
7
+ - On Cloudflare D1, a `BigInt` value beyond ±(2^53 − 1) is answered `A2004`, not `A3001`. `@prisma/adapter-d1`
8
+ binds a bigint as a JavaScript number and refuses one beyond that range before the statement runs, written,
9
+ compared in a filter or used in an `$increment`, and Prisma reports it as a database error (`P2039`). The adapter
10
+ answers that refusal as a value the database refused: `422 A2004` with one `V1004` issue, `The database refused
11
+ this value: it is outside the range its column can hold.`, at the value in the arguments (for example
12
+ `["arguments", "where", "views", "gt"]`). Nothing is written by the refused statement. It reads the arguments only
13
+ after the driver refused them, and only for the D1 driver; every other D1 database error stays `A3001`, and so does
14
+ a raw `ctx.$sql` statement binding such a value. Within ±(2^53 − 1) a bigint round-trips exactly on D1.
15
+ In rc.1 the refusal answered `500 A3001`. Measured on 7.10.0 through Miniflare's D1 binding.
16
+ - The README's D1 notes are corrected: D1 is measured in process through Miniflare, where Prisma's client refuses
17
+ an interactive `$transaction` and the D1 driver runs Prisma's implicit transaction for a nested write as single
18
+ statements, so a nested write is not atomic on D1.
19
+ - The optional `typescript` peer range is `>=5.7.0 <7` (it was `>=5.5.0 <7`). Under TypeScript 5.5 and 5.6 a
20
+ variant's stages written inline in `createFramework` are told `unknown` arguments, so `ctx.$args.data` and the
21
+ documented spread pipe `(args) => ({ ...args, data: { ...args.data, title: "t" } })` do not compile; TypeScript 5.7
22
+ and later type them. A project on TypeScript 5.5 or 5.6 upgrades to 5.7 or later.
23
+ - `createPrismaAdapter` checks the installed `@prisma/client`'s major against the discovery artifact's, as the
24
+ README says. It reads the version from `@prisma/client/package.json`, resolved from the adapter's own location and
25
+ then from the working directory, and refuses an artifact generated against another major with
26
+ `AvPrismaDiscoveryArtifactError`. In rc.1 the artifact's version stood in for the installed one when no
27
+ `installedPrismaVersion` was passed, which a scaffolded project never does, so the check compared the artifact with
28
+ itself. Where the version cannot be read (a runtime without Node's module loader, a bundle deployed without
29
+ `@prisma/client`), the adapter starts and emits a warning, code `AVENTARA_PRISMA_VERSION_UNCHECKED`, saying the
30
+ majors were not compared. `installedPrismaVersion` still overrides the version read.
31
+ - `aventara-prisma7-generate` refuses an `--out` inside `--client`, before `prisma generate` runs: exit 1 and one
32
+ sentence naming both paths. Prisma's next `prisma generate` clears the client's directory, so an artifact written
33
+ there was deleted. In rc.1 the step wrote it and exited 0. The same refusal applies to
34
+ `generatePrismaDiscoveryArtifact` and `runPrismaGenerateStep`.
35
+ - `aventara-prisma7-generate` refuses an `--out` that names a directory in one sentence (exit 1), before
36
+ `prisma generate` runs. In rc.1 it ran Prisma and then failed with an `EISDIR` stack trace.
37
+ - A nested write that writes its relation back is answered `A2004`, not `A3001`. Prisma writes a record reached
38
+ through a relation without that relation's other end, so it refuses a post created in `author.posts` that names
39
+ `author` or `authorId`, and a category created in a post's `category` that nests `posts`. The discovery artifact
40
+ now states each relation's other end (`inverse`, paired from the schema by relation name) and no relation writable
41
+ at the `"loopback"` position, so `@aventara/core` refuses such a write before any guard or SQL: `A2004`, `V1012` at
42
+ the field written back. It holds for `$create`, `$connectOrCreate`, `$update` and `$upsert`, to-one and to-many,
43
+ self-relations and one-to-ones. Where a layer hides the relation's other end, its Contract states no pairing and
44
+ Prisma's client is the one that refuses: the adapter answers that refusal as the caller's too, `A2004` with a
45
+ `V1012` issue at the field and the message `The data source refused this nested write: a record written through a
46
+ relation cannot write that relation or its reference fields back.` It reads the arguments only after Prisma
47
+ refused them; every other refusal of Prisma's client stays `A3001`. In rc.1 every case answered `500 A3001`.
48
+ Measured on 7.10.0, SQLite and PostgreSQL. Run `npm run aventara:prepare` to regenerate the artifact: the model's
49
+ hash and every Contract's hash change.
50
+ - The discovery artifact states each relation's reference fields (`referenceFields`, read from the schema's
51
+ `@relation(fields: …)`), on optional and required relations alike, and none on the end that holds no reference.
52
+ So the types leave `categoryId` out of a post created in `Category.posts`, as `@aventara/core` refuses it. Run
53
+ `npm run aventara:prepare` to regenerate the artifact: the model's hash and every Contract's hash change.
54
+ - A `$divide` by zero is answered `A2004`, not `A3001`. It reaches the database as given: PostgreSQL refuses the
55
+ division (`P2039`, `22012`) and the adapter answers `V1004` `The database refused this value: it divides by zero.`;
56
+ SQLite computes NULL and the `NOT NULL` column refuses it (`P2011`), answered `V1004` `The database refused this
57
+ value: the write computes no value for a column that requires one, as a division by zero does.` Both at
58
+ `["arguments"]`, nothing written. `P2011` reaches the adapter only this way: core refuses a `null` for a required
59
+ field and a missing one, and so does Prisma's client before the query. In rc.1 both answered `500 A3001`. Measured
60
+ on 7.10.0 for `Int`, `BigInt`, `Float` and `Decimal`, in `update` and `updateMany`.
61
+ - `null` on a nullable `Json` field is the database NULL, as on every other nullable field. A write of `null`
62
+ (create, update, upsert, bulk, nested, a plan step) is sent as Prisma's `DbNull`; `{ meta: null }` and
63
+ `{ meta: { equals: null } }` are sent as Prisma's `AnyNull` and match every row that reads back `null` (a database
64
+ NULL or a JSON `null` stored by other means), and `{ meta: { not: null } }` matches the other rows. A JSON `null`
65
+ inside a value is sent as written, and so is a `null` beside a `path`: Prisma matches the documents whose value at
66
+ that path is a JSON `null`. In rc.1 a write of `null` stored a JSON `null`, `equals: null` matched only the stored
67
+ JSON nulls, and `{ meta: null }` failed with `500 A3001`. Reads are unchanged. Measured on 7.10.0, SQLite and
68
+ PostgreSQL.
69
+ - A to-one relation filter is sent under Prisma's `is`. `{ category: {} }` matches the rows that have a related row and
70
+ `{ NOT: { category: {} } }` the rows that have none. In rc.1 the empty predicate was sent unwrapped, which Prisma
71
+ reads as no condition: both matched every row, and `Post.delete.count({ where: { NOT: { author: {} } } })` deleted
72
+ every post although each has its required author. A non-empty nested `where` and `null` match what they did.
73
+ - A value the database refuses is answered `A2004`, not `A3001`. Text-match operands and written values reach Prisma
74
+ as given (`%` and `_` are what the engine's `LIKE` makes of them, a column rounds or keeps what it does); when
75
+ PostgreSQL refuses a caller's value, the adapter answers `A2004` with one issue at `["arguments"]` (Prisma's error
76
+ names no column): `V1004` for a value too long for its column (`P2000`), out of its column's range (`P2020`: a
77
+ `Decimal` past its precision, `Number.MAX_VALUE` in a `Float`, an `Int` `$increment` past 2^31) or a `DateTime`
78
+ outside PostgreSQL's range (`P2039`, `22009`); `V1001` for U+0000 in text or `json` (`P2039`, `22021` and `22P05`),
79
+ a lone surrogate in `json` (`P2007`) and a `LIKE` pattern ending in `\` (`P2039`, `22025`). The issue's message
80
+ says which of these the database refused, in core's words and none of the database's (`The database refused this
81
+ value: it is longer than its column can hold.`), not the code's generic text. Inside a plan the
82
+ issue stands at the step (`["operations", i, "args"]`) and the plan rolls back. Every other database failure stays
83
+ `A3001`. In rc.1 each of these answered `500 A3001`. Measured on 7.10.0, SQLite and PostgreSQL; SQLite refused none
84
+ of these values.
85
+ - A field's `not` holding an operator object now means the negation of the whole object, on every field type, on
86
+ both engines, in reads and in bulk writes. `{ f: { not: X } }` matches exactly the rows `{ NOT: { f: X } }` matches:
87
+ a row where `X` is neither true nor false (the column is `NULL`, a `json` `path` is not in the document, a `json`
88
+ value is not the kind the operator reads) matches neither `X` nor `not: X`, as SQL's `NOT` reads it. The adapter
89
+ sends it to Prisma as `NOT` of the field's filter, ANDed with the rest of the `where`, because Prisma's own
90
+ field-level `not` says less (measured on 7.10.0, SQLite and PostgreSQL):
91
+ - In rc.1, a `json` field's `not` holding operators matched every row on both engines, because Prisma reads that
92
+ `not` as a JSON value to compare the document with. That covers `{ meta: { not: { path: ["label"],
93
+ stringContains: "x" } } }`, `{ meta: { not: { equals: { a: 1 } } } }` and every other operator under it, and an
94
+ `update.many`, `update.count`, `delete.count` or `delete.first` under such a filter wrote or deleted every row
95
+ the rest of the filter allowed.
96
+ - In rc.1, two or more operators under `not` were negated one at a time and ANDed, so
97
+ `{ views: { not: { gt: 2, lte: 5 } } }` matched no row. It now matches the rows outside that range.
98
+ - In rc.1 on PostgreSQL, a `mode` inside `not` (`{ title: { not: { contains: "x", mode: "insensitive" } } }`)
99
+ failed with `A3001`, because Prisma's filter under `not` has no `mode`. It now matches the titles that do not
100
+ contain `x` in any case.
101
+
102
+ The object under `not` is its own level: nothing from the object around it reaches into it. In rc.1 on
103
+ PostgreSQL, `{ title: { mode: "insensitive", not: { contains: "x" } } }` excluded `X` as well as `x`, because Prisma
104
+ applied the outer `mode` inside its own `not`. Core now refuses that filter (`A2004`, `V1001` at the `mode`); write
105
+ `{ title: { not: { contains: "x", mode: "insensitive" } } }`. A plain value under `not` (`{ not: "x" }`,
106
+ `{ not: null }`) is equality negated and is sent as before.
107
+ - A `json` field's bare value in a filter is equality on both engines: `{ meta: "x" }` and `{ meta: [1, 2] }` are sent
108
+ to Prisma as `{ equals: … }`. In rc.1 they failed with `A3001`, because Prisma's Json filter takes no bare value.
109
+ - Filter modes, measured on each engine. PostgreSQL offers `"default"`, `"sensitive"` and `"insensitive"` on a string
110
+ column and on a `json` value at a `path`; on a whole `json` document it offers `"default"` and `"sensitive"`, because
111
+ Prisma accepts an insensitive `stringContains` there and PostgreSQL then fails (`42883 function lower(jsonb) does not
112
+ exist`, answered `A3001`). That filter is now refused before any query (`A2004`, `V1006` at the `mode`). SQLite, and
113
+ so D1, offers `"default"` only: its `LIKE` folds ASCII case and nothing else, and `equals` folds none, so neither
114
+ promise holds. Every string field with a text operator now offers `mode` (on SQLite with `"default"` alone), and
115
+ `"default"` and `"sensitive"` are sent to Prisma as no `mode` at all. Regenerate the discovery artifact
116
+ (`aventara:prepare`).
117
+ - 9366e16: The discovery artifact names the model's type: it exports `AvModel`, and `model` is declared with it
118
+ (`typeof model` is `AvModel`). A project that emits declarations (Nest's `declaration: true`) now writes that
119
+ name wherever an exported declaration holds the model, instead of the whole model. Over 50 models the scaffold's
120
+ `aventara.config.d.ts` goes from 485 KB to 0.4 KB, and a `buildFramework` / `AppFramework` module from 931 KB to
121
+ 0.6 KB (1.2 MB to 0.6 KB, and 2.4 MB to 22 KB for exported configurations holding typed stages, in the consumer-build
122
+ gate). Regenerate the artifact (`aventara:prepare`, which runs on install, build and start) to get it; Contract bytes
123
+ and hashes are unchanged.
124
+ - New: `aventara-prisma7-generate --config <file>`, optional. Given your Aventara configuration module
125
+ (`src/aventara.config.ts` in a project set up by `aventara`; its `aventaraConfig` export, a function or a value, or
126
+ its default export), the artifact states which fields it computes on create and on update, per layer. They are read
127
+ off the configuration's TypeScript type, never by running it, so nothing connects to a database and no environment
128
+ is needed. The artifact exports them as `computedFields` (type `AvComputedFields`), carries them on `AvModel` so a
129
+ variant's guards, pipes and filters may leave exactly those fields out of a create, and hands them to the framework
130
+ through `discovery.computedFields`, which it compares with the configuration at startup. A configuration that is
131
+ not a literal where a compute stage is written (one annotated with the wide `AvConfig`, a conditional spread) is not
132
+ read: the step prints where, and the artifact states nothing, so those stages may leave any create field out. A
133
+ `--config` file that does not exist, or exports neither `aventaraConfig` nor a default, stops the step.
134
+ `generatePrismaDiscoveryArtifact` and `runPrismaGenerateStep` take the same `config`, and
135
+ `readConfigComputedFields` is exported from `@aventara/prisma7-adapter/generate`.
136
+ - The discovery artifact's format is now 4 (`computedFields` is new): an artifact written before it is refused with
137
+ the regeneration instruction. `aventara:prepare` regenerates it on install, build and start.
138
+ - A transaction that expired (or was closed) under a step is answered `A3002`, as when the COMMIT finds it expired:
139
+ Prisma's `P2028`, raised by the step's own call, is the transaction's failure, at that step (`cause.operation`),
140
+ and the plan rolls back. In rc.1 it was unclassified and answered `500 A3001`, an adapter failure. Measured on
141
+ 7.10.0, SQLite and PostgreSQL.
142
+ - Updated dependencies [9366e16]
143
+ - Updated dependencies [9366e16]
144
+ - Updated dependencies [9366e16]
145
+ - Updated dependencies [9366e16]
146
+ - @aventara/core@1.0.0-rc.2
147
+
148
+ ## 1.0.0-rc.1
149
+
150
+ ### Patch Changes
151
+
152
+ - 800123b: New: `framework.appTx.$sql`, a developer SQL step in an application transaction. Write it as a tagged template,
153
+ `` framework.appTx.$sql<Row>`select pgmq.send('jobs', jsonb_build_object('postId', ${post.$ref("id")}))` ``, and put it in
154
+ `framework.transaction([...])` beside the other steps. Every interpolated value is a bound parameter, never SQL text:
155
+ strings, numbers, booleans, `bigint`, `null`, `Date`, `Decimal`, bytes, JSON values (bound as JSON text, so cast them
156
+ with `::jsonb`), and a `$ref` to an earlier step's field, read after that step ran. The statement runs in order in the
157
+ same database transaction, so a failure anywhere rolls everything back, and its rows are that step's entry in the
158
+ result, typed `Row[]` (or `unknown[]`). A plain-string call is refused, a later step cannot `$ref` a SQL step's rows,
159
+ and no pipeline runs around it.
160
+
161
+ It is server-side only: `clientTx` has no `$sql`, the ClientContract and its hash are unchanged, and `/_transactions`
162
+ cannot carry one.
163
+
164
+ The Prisma 7 adapter runs it with `$queryRaw` in its tagged form on the transaction client. A raw query's failure is
165
+ `P2010` on Prisma 7.10.0: a uniqueness or foreign-key violation answers `A2008`, anything else `A3001`. The rule is now
166
+ that Aventara never writes raw SQL itself, and developer SQL only goes through this bound template.
167
+
168
+ Adapter authors: an adapter declares `sqlStatements: true`, has an `executeSql` of its own (a plain statement, outside
169
+ any transaction: a stage's `ctx.$sql` there) and gives its transaction executor one too (`AvAdapter.executeSql`,
170
+ `AvAdapterTransactionExecutor`, `AvAdapterSqlStatement` in `@aventara/core/internal`). Without the declaration, a plan
171
+ with a SQL step is refused with `A2002`. The Prisma 7 adapter runs a statement outside a transaction with `$queryRaw`
172
+ on the base client, and declares `sqlStatements` with every driver.
173
+
174
+ - 8bb1d6a: Breaking: public type and class names take the `Av` prefix. Every public type and class is now `Av` plus what
175
+ it is, with a namespace only where the bare name would be ambiguous: configuration types are `AvConfig…`
176
+ (`AvConfig`, `AvConfigLayer`, `AvConfigResource`, …) and the three Contracts are `AvContract…` (`AvContractCore`,
177
+ `AvContractApplication`, `AvContractClient`). Functions keep their names (`createFramework`, `createFakeAdapter`,
178
+ `createPrismaAdapter`, `defineClientConfig`, `env`), and so do the names that already started with `Av`,
179
+ `AventaraModule`, `AventaraModuleOptions` and `AventaraModuleAsyncOptions`. There are no
180
+ aliases: replace each old name with the new one.
181
+
182
+ Three names merged or left:
183
+
184
+ - `PipelineContext` and `ComputeContext` (which was the same type) are one name, `AvContext`. A compute stage
185
+ now gets its own read-only ctx, `AvComputeContext` (see the ctx entry in `@aventara/core`'s changelog).
186
+ - `ComputedRead` is `AvComputeRead`, the one name of a read compute stage: a function, or `{ compute, dependsOn }`.
187
+ `ComputeOnRead`, the bare function type, is no longer exported; `AvComputeRead` accepts the function as it is.
188
+ - `defineFields` and `FrameworkFieldsShape` are removed; `defineResource` replaces them (below).
189
+
190
+ `defineResource` replaces `defineFields`. A Resource's configuration, its root block and its overlay blocks, can
191
+ live in its own module and be spread into each layer's `resources` tree:
192
+
193
+ ```ts
194
+ export const submission = defineResource<Model>()(
195
+ "Submission",
196
+ {
197
+ pipelines: { guards: [signedIn] },
198
+ fields: { title: { pipelines: { pipes: [trim] } } },
199
+ },
200
+ { client: { fields: { title: { pipelines: { validators: [AvZ.maxLength(80)] } } } } },
201
+ );
202
+
203
+ // aventara.config.ts
204
+ resources: { ...submission.root, ...payment.root },
205
+ client: { resources: { ...submission.client } },
206
+ ```
207
+
208
+ It returns `{ root, application?, client? }`, each `{ Submission: block }`; a layer given no block is left out. The
209
+ root block is typed exactly as `resources.Submission` is typed in place: field definitions are checked against what
210
+ the adapter discovered, stages are typed for the Resource, and a key no level admits is a type error at the key.
211
+ Each overlay block is typed as `application.resources.Submission` or `client.resources.Submission` is in place,
212
+ against the root block: it may name a field the root block defines, and a `definition` in it is a type error (and
213
+ `CONFIG_FORBIDDEN_IN_OVERLAY` at startup). Spread, the configuration is the inline one: the same Contracts and
214
+ ClientContract hash. A field `definition` that `defineFields` returned now sits at
215
+ `fields.<field>.definition` inside the block.
216
+
217
+ The generated client's names follow the same rule. Regenerate with `avclient generate`; then rename the
218
+ imports from `AvClient.ts`:
219
+
220
+ | Before | After |
221
+ | ----------------------- | ------------------------- |
222
+ | `AuthError` | `AvAuthError` |
223
+ | `CallOptions` | `AvCallOptions` |
224
+ | `Cause` | `AvCause` |
225
+ | `ConflictError` | `AvConflictError` |
226
+ | `ContractMismatchError` | `AvContractMismatchError` |
227
+ | `Decimal` | `AvDecimal` |
228
+ | `Fetch` | `AvFetch` |
229
+ | `FrameworkError` | `AvError` |
230
+ | `InternalError` | `AvInternalError` |
231
+ | `NotFoundError` | `AvNotFoundError` |
232
+ | `Operation<T>` | `AvOperation<T>` |
233
+ | `OperationCode` | `AvOperationCode` |
234
+ | `ProtocolError` | `AvProtocolError` |
235
+ | `TransportError` | `AvTransportError` |
236
+ | `ValidationCode` | `AvValidationCode` |
237
+ | `ValidationError` | `AvValidationError` |
238
+ | `ValidationIssue` | `AvValidationIssue` |
239
+
240
+ An enum whose name is one of these now walks the rename ladder (`AvDecimal` → `AvDecimalEnum`); an enum named
241
+ `Decimal` is emitted as `Decimal`.
242
+
243
+ `@aventara/core`, every renamed export:
244
+
245
+ | Before | After |
246
+ | ------------------------------------- | ---------------------------------- |
247
+ | `Adapter` | `AvAdapter` |
248
+ | `AdapterDiscoveryDiagnostic` | `AvAdapterDiscoveryDiagnostic` |
249
+ | `AdapterDiscoveryDiagnosticCode` | `AvAdapterDiscoveryDiagnosticCode` |
250
+ | `AdapterModel` | `AvAdapterModel` |
251
+ | `AddedFieldDefinition` | `AvConfigAddedFieldDefinition` |
252
+ | `AfterHook` | `AvAfterHook` |
253
+ | `AnyFrameworkConfig` | `AvConfigAny` |
254
+ | `AnyLayerConfig` | `AvConfigLayerAny` |
255
+ | `AnyResourcesBlock` | `AvConfigResourcesAny` |
256
+ | `ApplicationContract` | `AvContractApplication` |
257
+ | `ApplicationScalarForms` | `AvApplicationScalarForms` |
258
+ | `BeforeHook` | `AvBeforeHook` |
259
+ | `BuiltInScalar` | `AvBuiltInScalar` |
260
+ | `Cause` | `AvCause` |
261
+ | `ClientContract` | `AvContractClient` |
262
+ | `ClientContractProtocol` | `AvContractClientProtocol` |
263
+ | `ComputedRead` | `AvComputeRead` |
264
+ | `ComputeOnCreate` | `AvComputeCreate` |
265
+ | `ComputeOnUpdate` | `AvComputeUpdate` |
266
+ | `ConfigDiagnostic` | `AvConfigDiagnostic` |
267
+ | `ConfigDiagnosticCode` | `AvConfigDiagnosticCode` |
268
+ | `ConfigFieldKey` | `AvConfigFieldKey` |
269
+ | `ConfigLayer` | `AvConfigLayerName` |
270
+ | `Contract` | `AvContract` |
271
+ | `ContractCompilerDiagnostic` | `AvContractCompilerDiagnostic` |
272
+ | `ContractCompilerDiagnosticCode` | `AvContractCompilerDiagnosticCode` |
273
+ | `ContractHash` | `AvContractHash` |
274
+ | `ContractLimits` | `AvContractLimits` |
275
+ | `ContractProtocol` | `AvContractProtocol` |
276
+ | `CoreContract` | `AvContractCore` |
277
+ | `CreateDataInput` | `AvCreateDataInput` |
278
+ | `CursorInput` | `AvCursorInput` |
279
+ | `Decimal` | `AvDecimal` |
280
+ | `DeferredOperationCall` | `AvDeferredOperationCall` |
281
+ | `EffectiveFieldKey` | `AvEffectiveFieldKey` |
282
+ | `EnumDefinition` | `AvEnumDefinition` |
283
+ | `ExactFrameworkConfig` | `AvConfigExact` |
284
+ | `ExecutionOptions` | `AvExecutionOptions` |
285
+ | `Field` | `AvField` |
286
+ | `FieldComputeConfig` | `AvFieldCompute` |
287
+ | `FieldKey` | `AvFieldKey` |
288
+ | `FieldPipe` | `AvFieldPipe` |
289
+ | `FieldWriteGuard` | `AvFieldGuard` |
290
+ | `Filter` | `AvFilter` |
291
+ | `Framework` | `AvFramework` |
292
+ | `FrameworkConfig` | `AvConfig` |
293
+ | `FrameworkConstructionDiagnostic` | `AvConstructionDiagnostic` |
294
+ | `FrameworkConstructionError` | `AvConstructionError` |
295
+ | `FrameworkConstructionStage` | `AvConstructionStage` |
296
+ | `FrameworkContracts` | `AvContracts` |
297
+ | `FrameworkDiagnostic` | `AvDiagnostic` |
298
+ | `FrameworkDiagnosticsSink` | `AvDiagnosticsSink` |
299
+ | `FrameworkError` | `AvError` |
300
+ | `FrameworkExemptionsConfig` | `AvConfigExemptions` |
301
+ | `FrameworkFamilyConfig` | `AvConfigFamily` |
302
+ | `FrameworkFieldDefinition` | `AvConfigFieldDefinition` |
303
+ | `FrameworkFieldLifecycleTrait` | `AvConfigFieldLifecycleTrait` |
304
+ | `FrameworkLayerConfig` | `AvConfigLayer` |
305
+ | `FrameworkLayerKind` | `AvConfigLayerKind` |
306
+ | `FrameworkLimitsConfig` | `AvConfigLimits` |
307
+ | `FrameworkMisuseEvent` | `AvMisuseEvent` |
308
+ | `FrameworkMisuseSink` | `AvMisuseSink` |
309
+ | `FrameworkOperationsConfig` | `AvConfigOperations` |
310
+ | `FrameworkOperationsExemption` | `AvConfigOperationsExemption` |
311
+ | `FrameworkOverlayFieldConfig` | `AvConfigOverlayField` |
312
+ | `FrameworkRelationFieldExemption` | `AvConfigRelationFieldExemption` |
313
+ | `FrameworkResourceConfig` | `AvConfigResource` |
314
+ | `FrameworkResourceExemption` | `AvConfigResourceExemption` |
315
+ | `FrameworkResourceFieldsConfig` | `AvConfigResourceFields` |
316
+ | `FrameworkResourceKey` | `AvConfigResourceKey` |
317
+ | `FrameworkResourcesConfig` | `AvConfigResources` |
318
+ | `FrameworkResourceTransactionsConfig` | `AvConfigResourceTransactions` |
319
+ | `FrameworkRootFieldConfig` | `AvConfigRootField` |
320
+ | `FrameworkScalarFieldExemption` | `AvConfigScalarFieldExemption` |
321
+ | `FrameworkScalarTypeRef` | `AvConfigScalarTypeRef` |
322
+ | `FrameworkVariantConfig` | `AvConfigVariant` |
323
+ | `Guard` | `AvGuard` |
324
+ | `Identifier` | `AvIdentifier` |
325
+ | `IncludeInput` | `AvIncludeInput` |
326
+ | `Interceptor` | `AvInterceptor` |
327
+ | `JsonValue` | `AvJsonValue` |
328
+ | `KnownFieldDefinition` | `AvConfigKnownFieldDefinition` |
329
+ | `LifecycleTrait` | `AvLifecycleTrait` |
330
+ | `NullsOrder` | `AvNullsOrder` |
331
+ | `Operation` | `AvOperation` |
332
+ | `OperationArgumentMap` | `AvOperationArgumentMap` |
333
+ | `OperationArgumentsFor` | `AvOperationArgumentsFor` |
334
+ | `OperationAvailability` | `AvOperationAvailability` |
335
+ | `OperationCall` | `AvOperationCall` |
336
+ | `OperationCode` | `AvOperationCode` |
337
+ | `OperationDiagnostic` | `AvOperationDiagnostic` |
338
+ | `OperationErrorCode` | `AvOperationErrorCode` |
339
+ | `OperationFailureResponse` | `AvOperationFailureResponse` |
340
+ | `OperationFamily` | `AvOperationFamily` |
341
+ | `OperationGrammar` | `AvOperationGrammar` |
342
+ | `OperationIdentity` | `AvOperationIdentity` |
343
+ | `OperationNoMatchResponse` | `AvOperationNoMatchResponse` |
344
+ | `OperationReferenceSurface` | `AvOperationReferenceSurface` |
345
+ | `OperationResponse` | `AvOperationResponse` |
346
+ | `OperationResultFor` | `AvOperationResultFor` |
347
+ | `OperationSlot` | `AvOperationSlot` |
348
+ | `OperationSuccessCode` | `AvOperationSuccessCode` |
349
+ | `OperationSuccessDataCode` | `AvOperationSuccessDataCode` |
350
+ | `OperationSuccessResponse` | `AvOperationSuccessResponse` |
351
+ | `OperationVariant` | `AvOperationVariant` |
352
+ | `OperationVariantScopes` | `AvOperationVariantScopes` |
353
+ | `OrderByEntry` | `AvOrderByEntry` |
354
+ | `OrderByInput` | `AvOrderByInput` |
355
+ | `PaginationCapability` | `AvPaginationCapability` |
356
+ | `Pipe` | `AvPipe` |
357
+ | `PipelineConfig` | `AvPipeline` |
358
+ | `PipelineContext` | `AvContext` |
359
+ | `PipelineTransportContext` | `AvTransportContext` |
360
+ | `ProjectionEntry` | `AvProjectionEntry` |
361
+ | `ProjectionScope` | `AvProjectionScope` |
362
+ | `ProjectionScopes` | `AvProjectionScopes` |
363
+ | `ReferenceableField` | `AvReferenceableField` |
364
+ | `ReferenceBuilder` | `AvReferenceBuilder` |
365
+ | `RelationField` | `AvRelationField` |
366
+ | `RelationFieldCapabilities` | `AvRelationFieldCapabilities` |
367
+ | `RelationFieldCapabilityName` | `AvRelationFieldCapabilityName` |
368
+ | `RelationFieldPipelineConfig` | `AvRelationFieldPipeline` |
369
+ | `RelationFilterCapability` | `AvRelationFilterCapability` |
370
+ | `RelationMutationCapability` | `AvRelationMutationCapability` |
371
+ | `RelationMutationDirective` | `AvRelationMutationDirective` |
372
+ | `RelationProjectionCapability` | `AvRelationProjectionCapability` |
373
+ | `RelationProjectionInput` | `AvRelationProjectionInput` |
374
+ | `RelationReducer` | `AvRelationReducer` |
375
+ | `RelationReducerCapability` | `AvRelationReducerCapability` |
376
+ | `RequestOrigin` | `AvRequestOrigin` |
377
+ | `Resource` | `AvResource` |
378
+ | `ResourceFieldMap` | `AvResourceFieldMap` |
379
+ | `ResourceKey` | `AvResourceKey` |
380
+ | `ResourceOperations` | `AvResourceOperations` |
381
+ | `ScalarDefinition` | `AvScalarDefinition` |
382
+ | `ScalarField` | `AvScalarField` |
383
+ | `ScalarFieldCapabilities` | `AvScalarFieldCapabilities` |
384
+ | `ScalarFieldCapabilityName` | `AvScalarFieldCapabilityName` |
385
+ | `ScalarFieldKey` | `AvScalarFieldKey` |
386
+ | `ScalarFieldPipelineConfig` | `AvScalarFieldPipeline` |
387
+ | `ScalarFilterOperator` | `AvScalarFilterOperator` |
388
+ | `ScalarFormat` | `AvScalarFormat` |
389
+ | `ScalarMutationDirective` | `AvScalarMutationDirective` |
390
+ | `ScalarOrderInput` | `AvScalarOrderInput` |
391
+ | `ScalarRegistry` | `AvScalarRegistry` |
392
+ | `ScalarValueType` | `AvScalarValueType` |
393
+ | `ScopedRelationMutations` | `AvScopedRelationMutations` |
394
+ | `ScopedRelationReducers` | `AvScopedRelationReducers` |
395
+ | `SelectInput` | `AvSelectInput` |
396
+ | `SingleRowResult` | `AvSingleRowResult` |
397
+ | `SortDirection` | `AvSortDirection` |
398
+ | `TransactionAfterHook` | `AvTransactionAfterHook` |
399
+ | `TransactionBeforeHook` | `AvTransactionBeforeHook` |
400
+ | `TransactionCapability` | `AvTransactionCapability` |
401
+ | `TransactionCommittedResponse` | `AvTransactionCommittedResponse` |
402
+ | `TransactionDiagnostic` | `AvTransactionDiagnostic` |
403
+ | `TransactionFilter` | `AvTransactionFilter` |
404
+ | `TransactionGuard` | `AvTransactionGuard` |
405
+ | `TransactionIntegrityError` | `AvTransactionIntegrityError` |
406
+ | `TransactionIntegrityViolation` | `AvTransactionIntegrityViolation` |
407
+ | `TransactionInterceptor` | `AvTransactionInterceptor` |
408
+ | `TransactionPipe` | `AvTransactionPipe` |
409
+ | `TransactionPipelineConfig` | `AvTransactionPipeline` |
410
+ | `TransactionPipelineContext` | `AvTransactionContext` |
411
+ | `TransactionReference` | `AvTransactionReference` |
412
+ | `TransactionResponse` | `AvTransactionResponse` |
413
+ | `TransactionResults` | `AvTransactionResults` |
414
+ | `TransactionRunner` | `AvTransactionRunner` |
415
+ | `TransactionSlotPathError` | `AvTransactionSlotPathError` |
416
+ | `TransactionSlotPathViolation` | `AvTransactionSlotPathViolation` |
417
+ | `UniqueWhereInput` | `AvUniqueWhereInput` |
418
+ | `UpdateDataInput` | `AvUpdateDataInput` |
419
+ | `ValidationCode` | `AvValidationCode` |
420
+ | `ValidationIssue` | `AvValidationIssue` |
421
+ | `WhereInput` | `AvWhereInput` |
422
+ | `WireScalarForms` | `AvWireScalarForms` |
423
+ | `WriteScope` | `AvWriteScope` |
424
+ | `WriteScopes` | `AvWriteScopes` |
425
+
426
+ Error classes whose `name` a log or a test may read:
427
+
428
+ | Before | After |
429
+ | ------------------------ | -------------------------- |
430
+ | `CallerDataError` | `AvCallerDataError` |
431
+ | `ClientConfigError` | `AvClientConfigError` |
432
+ | `ComputedValueError` | `AvComputedValueError` |
433
+ | `ContractProtocolError` | `AvContractProtocolError` |
434
+ | `ContractTransportError` | `AvContractTransportError` |
435
+ | `EnvFileError` | `AvEnvFileError` |
436
+ | `OutputValidationError` | `AvOutputValidationError` |
437
+ | `OutputWriteError` | `AvOutputWriteError` |
438
+ | `PipeOutputError` | `AvPipeOutputError` |
439
+ | `UnmountedRouteError` | `AvUnmountedRouteError` |
440
+
441
+ `@aventara/testing`:
442
+
443
+ | Before | After |
444
+ | ------------------------ | -------------------------- |
445
+ | `AdapterFactory` | `AvAdapterFactory` |
446
+ | `FakeAdapter` | `AvFakeAdapter` |
447
+ | `FakeAdapterExecute` | `AvFakeAdapterExecute` |
448
+ | `FakeAdapterOptions` | `AvFakeAdapterOptions` |
449
+ | `FakeAdapterRollback` | `AvFakeAdapterRollback` |
450
+ | `FakeTransactionOutcome` | `AvFakeTransactionOutcome` |
451
+ | `FakeTransactionTrace` | `AvFakeTransactionTrace` |
452
+
453
+ `@aventara/client` (the `framework.client.ts` config types):
454
+
455
+ | Before | After |
456
+ | ------------------- | --------------------- |
457
+ | `ClientConfigInput` | `AvClientConfigInput` |
458
+ | `ConfigValue` | `AvClientConfigValue` |
459
+ | `EnvReference` | `AvEnvReference` |
460
+
461
+ `@aventara/prisma7-adapter`: its public types and error classes (`createPrismaAdapter` keeps its name):
462
+
463
+ | Before | After |
464
+ | ---------------------------------- | ------------------------------------ |
465
+ | `PrismaAdapterModel` | `AvPrismaAdapterModel` |
466
+ | `PrismaAdapterOptions` | `AvPrismaAdapterOptions` |
467
+ | `PrismaDelegate` | `AvPrismaDelegate` |
468
+ | `PrismaDelegateHost` | `AvPrismaDelegateHost` |
469
+ | `PrismaDelegateIndex` | `AvPrismaDelegateIndex` |
470
+ | `PrismaDiscoveryArtifact` | `AvPrismaDiscoveryArtifact` |
471
+ | `PrismaDriver` | `AvPrismaDriver` |
472
+ | `PrismaIsolationLevel` | `AvPrismaIsolationLevel` |
473
+ | `PrismaProvider` | `AvPrismaProvider` |
474
+ | `PrismaProviderProfile` | `AvPrismaProviderProfile` |
475
+ | `PrismaReferentialAction` | `AvPrismaReferentialAction` |
476
+ | `PrismaReferentialActionTable` | `AvPrismaReferentialActionTable` |
477
+ | `PrismaReferentialEdge` | `AvPrismaReferentialEdge` |
478
+ | `PrismaResourceReferentialActions` | `AvPrismaResourceReferentialActions` |
479
+ | `PrismaTransactionOptions` | `AvPrismaTransactionOptions` |
480
+ | `PrismaCapabilityDerivationError` | `AvPrismaCapabilityDerivationError` |
481
+ | `PrismaDiscoveryArtifactError` | `AvPrismaDiscoveryArtifactError` |
482
+ | `PrismaEmulationError` | `AvPrismaEmulationError` |
483
+ | `PrismaExecutionError` | `AvPrismaExecutionError` |
484
+ | `PrismaExistenceGateError` | `AvPrismaExistenceGateError` |
485
+ | `PrismaFieldProjectionError` | `AvPrismaFieldProjectionError` |
486
+ | `PrismaGenerateCliError` | `AvPrismaGenerateCliError` |
487
+ | `PrismaGenerateStepError` | `AvPrismaGenerateStepError` |
488
+ | `PrismaModelCompositionError` | `AvPrismaModelCompositionError` |
489
+ | `PrismaMutationTranslationError` | `AvPrismaMutationTranslationError` |
490
+ | `PrismaOperationTranslationError` | `AvPrismaOperationTranslationError` |
491
+ | `PrismaOrderTranslationError` | `AvPrismaOrderTranslationError` |
492
+ | `PrismaProjectionTranslationError` | `AvPrismaProjectionTranslationError` |
493
+ | `PrismaResultShapeError` | `AvPrismaResultShapeError` |
494
+ | `PrismaScalarConversionError` | `AvPrismaScalarConversionError` |
495
+ | `PrismaSchemaReaderError` | `AvPrismaSchemaReaderError` |
496
+ | `PrismaTypesReaderError` | `AvPrismaTypesReaderError` |
497
+ | `PrismaWhereTranslationError` | `AvPrismaWhereTranslationError` |
498
+
499
+ - 9c52482: A `$connect` to a row that does not exist now answers `404 A2003` (not found), the same as reading a missing row.
500
+ Before, it answered `422 A2004`. This covers a to-one `$connect` in `create`, `update` and `upsert`, a to-many
501
+ `$connect`, and the same writes inside a transaction plan, where `cause.operation` names the step. The message is
502
+ unchanged: "The operation's arguments referenced a record that does not exist." On `update.first`, the same mistake
503
+ answered `A2014` before, as if the row had changed underneath; it now answers `A2003` too, and a duplicate unique value
504
+ written through `update.first` answers `409 A2008` instead of `A3001`.
505
+
506
+ Clearer top-level messages for an unknown Resource or operation. `A2001` now says "The requested Resource is not
507
+ available." and `A2002` says "The requested operation is not available on this Resource.", instead of "Operation
508
+ arguments failed framework validation.", which stays the message of `A2004`, `A2007` and `A2009`. A transaction step
509
+ whose operation is outside the standard grammar now carries the same issue message as a single call, naming the
510
+ operation and the Resource (for example `Operation "dance.one" is not available on Resource "posts".`), instead of
511
+ "Operation is not part of the standard operation grammar."
512
+
513
+ A `$ref` with no `fingerprint` is `V1000` (required value missing) and answers `422 A2004`. Before, it was `V1017`
514
+ (fingerprint mismatch) under `A2007`. A fingerprint that is present but wrong is still `V1017`.
515
+
516
+ `aventara init` and `aventara new` link to the documentation at https://aventara-framework.vercel.app. The old
517
+ address redirects, so links already written into projects keep working.
518
+
519
+ - 916e5f6: A stage's `ctx.$sql` outside a transaction is a plain statement: the adapter runs it with `$queryRaw` in its
520
+ tagged form on the base client, with no `BEGIN` around it. Inside a transaction it still runs on the transaction
521
+ client. The adapter now declares `sqlStatements` with every driver, `@prisma/adapter-d1` included: there, with no
522
+ interactive transaction, `ctx.$sql` runs as a plain statement, and a transaction plan stays unavailable. In-process calls
523
+ (`framework.application`, `framework.client`, `framework.transaction`) now resolve data and throw `AvError`
524
+ subclasses (see `@aventara/core`).
525
+
526
+ - Breaking: the discovery artifact states each Resource's create requirements on its model
527
+ (`model.resources.<R>.createRequirements`): `required` columns, `oneOf` required relations with the fields holding
528
+ their reference, and `parentSupplies` for nested creates. The separate `createRequirements` table beside the model is
529
+ removed, and the artifact format is now 3: regenerate the artifact with `npm run aventara:prepare` (or
530
+ `aventara-prisma7-generate`). The model, and so `modelHash` and the Client Contract's hash, change for every schema
531
+ with a required column or relation. Required create fields are now typed in every create call (see
532
+ `@aventara/core`).
533
+
534
+ - Updated dependencies [800123b]
535
+ - Updated dependencies [8bb1d6a]
536
+ - Updated dependencies [68d4395]
537
+ - Updated dependencies [7e3d06f]
538
+ - Updated dependencies [1b5d3c0]
539
+ - Updated dependencies [6317811]
540
+ - Updated dependencies [6d0e5d6]
541
+ - Updated dependencies [7a0cab9]
542
+ - Updated dependencies [eb2a718]
543
+ - Updated dependencies [03312c5]
544
+ - Updated dependencies [123f6dc]
545
+ - Updated dependencies [b65df2e]
546
+ - Updated dependencies [c6e5010]
547
+ - Updated dependencies [c1f9389]
548
+ - Updated dependencies [9c52482]
549
+ - Updated dependencies [8396148]
550
+ - Updated dependencies [e8fbb02]
551
+ - Updated dependencies [916e5f6]
552
+ - Updated dependencies [6cbd158]
553
+ - @aventara/core@1.0.0-rc.1
554
+
3
555
  ## 1.0.0-rc.0
4
556
 
5
557
  ### Major Changes