@aventara/prisma7-adapter 0.1.0-pilot.0 → 0.1.0-pilot.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 (79) hide show
  1. package/README.md +39 -28
  2. package/dist/discovery/artifact.loader.d.ts +6 -2
  3. package/dist/discovery/artifact.loader.js +12 -57
  4. package/dist/discovery/capability-surface.interface.d.ts +29 -40
  5. package/dist/discovery/capability-surface.interface.js +0 -12
  6. package/dist/discovery/capability.deriver.d.ts +10 -40
  7. package/dist/discovery/capability.deriver.js +0 -179
  8. package/dist/discovery/client-shape.verifier.d.ts +13 -0
  9. package/dist/discovery/client-shape.verifier.js +93 -0
  10. package/dist/discovery/discovery-artifact.interface.d.ts +55 -30
  11. package/dist/discovery/enum.mapper.d.ts +6 -14
  12. package/dist/discovery/enum.mapper.js +1 -2
  13. package/dist/discovery/field.mapper.d.ts +49 -63
  14. package/dist/discovery/field.mapper.js +0 -161
  15. package/dist/discovery/identifier.mapper.d.ts +38 -77
  16. package/dist/discovery/identifier.mapper.js +0 -64
  17. package/dist/discovery/model.discoverer.d.ts +18 -35
  18. package/dist/discovery/model.discoverer.js +66 -141
  19. package/dist/discovery/operations.deriver.d.ts +10 -38
  20. package/dist/discovery/operations.deriver.js +0 -40
  21. package/dist/discovery/scalar.mapper.d.ts +12 -35
  22. package/dist/discovery/scalar.mapper.js +0 -8
  23. package/dist/discovery/schema-facts.interface.d.ts +26 -25
  24. package/dist/discovery/schema-facts.interface.js +0 -10
  25. package/dist/discovery/schema.reader.d.ts +53 -64
  26. package/dist/discovery/schema.reader.js +0 -174
  27. package/dist/discovery/types.reader.d.ts +0 -4
  28. package/dist/discovery/types.reader.js +2 -177
  29. package/dist/discovery/vocabulary.dictionary.d.ts +36 -75
  30. package/dist/discovery/vocabulary.dictionary.js +2 -152
  31. package/dist/errors/error.normalizer.d.ts +85 -135
  32. package/dist/errors/error.normalizer.js +1 -70
  33. package/dist/errors/prisma-error.reader.d.ts +53 -68
  34. package/dist/errors/prisma-error.reader.js +0 -91
  35. package/dist/execution/first-variant.emulator.d.ts +11 -22
  36. package/dist/execution/first-variant.emulator.js +0 -142
  37. package/dist/execution/operation.executor.d.ts +12 -19
  38. package/dist/execution/operation.executor.js +0 -92
  39. package/dist/execution/result.shaper.d.ts +22 -31
  40. package/dist/execution/result.shaper.js +0 -24
  41. package/dist/execution/transaction.executor.d.ts +36 -73
  42. package/dist/generate/artifact.emitter.d.ts +27 -27
  43. package/dist/generate/artifact.emitter.js +30 -13
  44. package/dist/generate/declared-support.reader.d.ts +11 -11
  45. package/dist/generate/declared-support.reader.js +0 -12
  46. package/dist/generate/discovery.bin.js +0 -10
  47. package/dist/generate/discovery.cli.js +0 -55
  48. package/dist/generate/existence.gate.d.ts +26 -32
  49. package/dist/generate/existence.gate.js +0 -6
  50. package/dist/generate/index.d.ts +10 -12
  51. package/dist/generate/index.js +0 -42
  52. package/dist/generate/node-version.guard.js +0 -12
  53. package/dist/generate/prisma-cli.resolver.d.ts +9 -11
  54. package/dist/generate/prisma-cli.resolver.js +0 -13
  55. package/dist/generate/prisma.generate.d.ts +49 -65
  56. package/dist/generate/prisma.generate.js +13 -123
  57. package/dist/generate/reader-crosscheck.d.ts +36 -60
  58. package/dist/generate/reader-crosscheck.js +5 -41
  59. package/dist/prisma-client.interface.d.ts +14 -19
  60. package/dist/prisma-client.interface.js +0 -6
  61. package/dist/prisma.adapter.d.ts +9 -17
  62. package/dist/prisma.adapter.js +11 -53
  63. package/dist/provider/provider-profile.d.ts +6 -23
  64. package/dist/provider/provider-profile.js +0 -64
  65. package/dist/translation/identifier.addressing.d.ts +15 -22
  66. package/dist/translation/identifier.addressing.js +0 -10
  67. package/dist/translation/mutation.translator.d.ts +19 -43
  68. package/dist/translation/mutation.translator.js +1 -209
  69. package/dist/translation/operation.translator.d.ts +36 -63
  70. package/dist/translation/operation.translator.js +1 -51
  71. package/dist/translation/order-pagination.translator.d.ts +24 -31
  72. package/dist/translation/order-pagination.translator.js +0 -43
  73. package/dist/translation/projection.translator.d.ts +25 -58
  74. package/dist/translation/projection.translator.js +0 -27
  75. package/dist/translation/scalar.conversion.d.ts +15 -26
  76. package/dist/translation/scalar.conversion.js +1 -129
  77. package/dist/translation/where.translator.d.ts +17 -28
  78. package/dist/translation/where.translator.js +0 -83
  79. package/package.json +3 -3
@@ -1,21 +1,18 @@
1
1
  import { type AdapterModel } from "@aventara/core";
2
2
  import type { PrismaIdentifierAddress } from "../discovery/discovery-artifact.interface.js";
3
3
  /**
4
- * T-7 — `orderBy` and pagination translation. Pure functions over plain data:
5
- * no client, no database, no provider name.
6
- *
7
- * # C-831 is a one-directional rename, and this module is the only place it happens
4
+ * Pure functions over plain data: no client, no database, no provider name.
8
5
  *
9
6
  * The public names are `limit`, `offset` and `cursor`. `take` and `skip` are
10
7
  * Prisma's and appear nowhere in this adapter's public types — they are produced
11
8
  * here and nowhere else. The tables below are TOTAL over core's own unions, so a
12
9
  * pagination capability or a reducer added to core with no emission site is a
13
- * compile error (C-855).
10
+ * compile error.
14
11
  *
15
12
  * # An absent argument and an `undefined` one are different arguments
16
13
  *
17
- * `take: undefined` is a present key with no value, and `"take" in args` is what
18
- * a provider sees. Every key below is added only when its Aventara argument is
14
+ * `take: undefined` is a present key with no value, and `"take" in args` is what a
15
+ * provider sees. Every key below is added only when its Aventara argument is
19
16
  * present, which is also why `0` is carried through rather than tested for
20
17
  * truthiness.
21
18
  */
@@ -33,37 +30,33 @@ export type PaginationTranslation = {
33
30
  /**
34
31
  * The Aventara cursor: the active ordered scalar fields and their values.
35
32
  *
36
- * **Only the identifier subset is emitted, and that is faithful translation
37
- * rather than a silent drop (C-855).** Settled 2026-10-02; do not re-open
38
- * without reading `validateCursor` first.
33
+ * **Only the identifier subset is emitted, and that is faithful translation rather
34
+ * than a silent drop.** Settled 2026-10-02; do not re-open without reading
35
+ * `validateCursor` first.
39
36
  *
40
- * Core's `CursorInput` type is `Partial<Record<ScalarFieldKey, unknown>>`,
41
- * which reads as permissive, but `operation-validator-core.ts`'s
42
- * `validateCursor` pins it exactly: the cursor's keys must **equal** the
43
- * active ordered scalar fields, and `orderBy` must include a complete
44
- * Resource identifier as a tie-breaker. So the non-identifier keys are not
45
- * optional context a caller happened to send — core requires every one of
46
- * them, and has already verified they match `orderBy`.
37
+ * Core's `CursorInput` type is `Partial<Record<ScalarFieldKey, unknown>>`, which
38
+ * reads as permissive, but `operation-validator-core.ts`'s `validateCursor` pins
39
+ * it exactly: the cursor's keys must **equal** the active ordered scalar fields,
40
+ * and `orderBy` must include a complete Resource identifier as a tie-breaker. So
41
+ * the non-identifier keys are not optional context a caller happened to send —
42
+ * core requires every one of them, and has already verified they match `orderBy`.
47
43
  *
48
44
  * Prisma's `cursor` is a `<M>WhereUniqueInput`: it locates a *row*, and the
49
45
  * ordering comes from `orderBy`, which this module translates alongside. The
50
46
  * identifier therefore determines the position completely, and the remaining
51
- * ordered keys are already expressed in the emitted `orderBy`. Nothing is
52
- * lost — which is why this is translation and not the MikroORM failure mode
53
- * C-855 names.
47
+ * ordered keys are already expressed in the emitted `orderBy`.
54
48
  *
55
- * Two things follow, both load-bearing. Passing the extra keys through would
56
- * make them equality members of a where-unique, *narrowing* the lookup: a key
57
- * whose value no longer matches the stored row would resolve the cursor to
58
- * nothing and return an empty page instead of a correct one. And narrowing
59
- * core's `CursorInput` to the identifier — considered and rejected — would
60
- * break the determinism contract `validateCursor` enforces, since core needs
61
- * the full ordered set to know the position is unambiguous.
49
+ * Two things follow, both load-bearing. Passing the extra keys through would make
50
+ * them equality members of a where-unique, *narrowing* the lookup: a key whose
51
+ * value no longer matches the stored row would resolve the cursor to nothing and
52
+ * return an empty page instead of a correct one. And narrowing core's
53
+ * `CursorInput` to the identifier — considered and rejected — would break the
54
+ * determinism contract `validateCursor` enforces, since core needs the full
55
+ * ordered set to know the position is unambiguous.
62
56
  *
63
- * The type is loose because the Contract is passive data; the precision lives
64
- * in the validator. That is the pattern throughout `operation-arguments.ts`,
65
- * and reading the type without its validator is how this was briefly
66
- * mis-analysed.
57
+ * The type is loose because the Contract is passive data; the precision lives in
58
+ * the validator. That is the pattern throughout `operation-arguments.ts`, and
59
+ * reading the type without its validator is how this was briefly mis-analysed.
67
60
  */
68
61
  readonly cursor?: Readonly<Record<string, unknown>>;
69
62
  /**
@@ -1,25 +1,5 @@
1
1
  import { advertisedReducers, } from "@aventara/core";
2
2
  import { addressIdentifier } from "./identifier.addressing.js";
3
- /**
4
- * T-7 — `orderBy` and pagination translation. Pure functions over plain data:
5
- * no client, no database, no provider name.
6
- *
7
- * # C-831 is a one-directional rename, and this module is the only place it happens
8
- *
9
- * The public names are `limit`, `offset` and `cursor`. `take` and `skip` are
10
- * Prisma's and appear nowhere in this adapter's public types — they are produced
11
- * here and nowhere else. The tables below are TOTAL over core's own unions, so a
12
- * pagination capability or a reducer added to core with no emission site is a
13
- * compile error (C-855).
14
- *
15
- * # An absent argument and an `undefined` one are different arguments
16
- *
17
- * `take: undefined` is a present key with no value, and `"take" in args` is what
18
- * a provider sees. Every key below is added only when its Aventara argument is
19
- * present, which is also why `0` is carried through rather than tested for
20
- * truthiness.
21
- */
22
- /** An order or cursor the discovered model does not license. */
23
3
  export class PrismaOrderTranslationError extends Error {
24
4
  name = "PrismaOrderTranslationError";
25
5
  }
@@ -28,7 +8,6 @@ const PAGINATION_TOKENS = {
28
8
  offset: "skip",
29
9
  cursor: "cursor",
30
10
  };
31
- /** The reducer vocabulary, on the ORDER side (`<M>OrderByRelationAggregateInput`). */
32
11
  const REDUCER_TOKENS = {
33
12
  $count: "_count",
34
13
  };
@@ -45,19 +24,7 @@ export function translatePagination(input) {
45
24
  }
46
25
  return emitted;
47
26
  }
48
- /**
49
- * The Aventara cursor carries the active ordered scalar fields; core guarantees
50
- * that they include a complete identifier (`V1009` — *"orderBy must include a
51
- * complete Resource identifier as an explicit tie-breaker"*). Prisma's `cursor`
52
- * is an ADDRESS, so the identifier is what is emitted: the remaining ordered
53
- * fields are the ordering, which `orderBy` already carries, and adding them as
54
- * equality members of a where-unique would narrow the address rather than
55
- * sharpen it.
56
- */
57
27
  function addressCursor(cursor, identifiers) {
58
- // `"subset"`: the cursor carries every active ordered scalar field, of which
59
- // the identifier is one part (`validateCursor`), so extra keys are expected.
60
- // The values are already Prisma-shaped, so the emitter is the identity.
61
28
  const addressed = addressIdentifier({
62
29
  addresses: identifiers,
63
30
  values: cursor,
@@ -71,8 +38,6 @@ function addressCursor(cursor, identifiers) {
71
38
  }
72
39
  export function translateOrderBy(input) {
73
40
  if (Array.isArray(input.orderBy)) {
74
- // The precedence list keeps its shape: Prisma reads an array as precedence
75
- // too, and collapsing it would reorder the request.
76
41
  return input.orderBy.map((entry, index) => translateEntry(input.model, input.resource, entry, `orderBy[${index}]`));
77
42
  }
78
43
  return translateEntry(input.model, input.resource, input.orderBy, "orderBy");
@@ -86,8 +51,6 @@ function translateEntry(model, resourceKey, entry, path) {
86
51
  throw new PrismaOrderTranslationError(`${path} must be an object`);
87
52
  }
88
53
  const keys = Object.keys(entry);
89
- // Core's rule, mirrored: one precedence entry is one field, because the order
90
- // of keys in an object is not a precedence a caller can rely on.
91
54
  if (keys.length !== 1) {
92
55
  throw new PrismaOrderTranslationError(`${path} must contain exactly one field`);
93
56
  }
@@ -113,9 +76,6 @@ function translateScalarOrder(field, value, path) {
113
76
  if (!isRecord(value)) {
114
77
  throw new PrismaOrderTranslationError(`${path} must be "asc", "desc" or an explicit null order`);
115
78
  }
116
- // C-836: the extended form is `SortOrderInput`, and the deriver advertises
117
- // `orderNulls` only where the generated types admit it for THIS field. Prisma's
118
- // spelling is the same `{ sort, nulls }`, so the translation is the gate.
119
79
  if (field.capabilities.orderNulls !== true) {
120
80
  throw new PrismaOrderTranslationError(`${path}: explicit null ordering is not advertised on this field`);
121
81
  }
@@ -132,11 +92,8 @@ function translateRelationOrder(model, field, value, path) {
132
92
  throw new PrismaOrderTranslationError(`${path} must be an object`);
133
93
  }
134
94
  if (field.cardinality === "one") {
135
- // A to-one edge orders by the target's own fields.
136
95
  return translateEntry(model, field.target, value, path);
137
96
  }
138
- // A to-many edge orders by its advertised reducer and by nothing else:
139
- // `<M>OrderByRelationAggregateInput` carries `_count` alone.
140
97
  const keys = Object.keys(value);
141
98
  const [reducer] = keys;
142
99
  if (keys.length !== 1 || reducer === undefined || !isReducer(reducer)) {
@@ -1,74 +1,50 @@
1
1
  import type { RelationReducer } from "@aventara/core";
2
2
  /**
3
- * Task 8 — the projection half of T-7: Aventara `select`/`include`/`$count` →
4
- * Prisma `select`/`include`/`_count` (C-832, C-833).
5
- *
6
3
  * **What arrives here is core's plan, not a caller's request.** By the time an
7
4
  * `AdapterOperation` reaches the adapter, `planReadOperation` has resolved
8
5
  * `include` into `select`, expanded every relation it could resolve into object
9
- * form, and dropped VIRTUAL scalars from the adapter's half while keeping them
10
- * in the projection plan it validates against
11
- * **[CORE, runtime/computed-read-runtime.ts]**. So this module reads one shape:
12
- * `select` as an array whose entries are field-name strings, the reducer string
13
- * `"$count"`, or single-key objects carrying a relation's own arguments beside a
14
- * nested `select`.
6
+ * form, and dropped VIRTUAL scalars from the adapter's half while keeping them in
7
+ * the projection plan it validates against **[CORE,
8
+ * runtime/computed-read-runtime.ts]**. So this module reads one shape: `select` as
9
+ * an array whose entries are field-name strings, the reducer string `"$count"`, or
10
+ * single-key objects carrying a relation's own arguments beside a nested `select`.
15
11
  *
16
12
  * **Three translations are worth stating because they are not obvious:**
17
13
  *
18
- * 1. *The default projection emits nothing at all.* C-833's claim is that
19
- * Prisma's default read projection — every scalar, no relations — IS the
20
- * framework default (§10.1), so the honest translation of "no `select`" is
21
- * an empty argument fragment rather than a reconstructed scalar list. A
22
- * reconstructed list would have to be derived from the model and would drift
14
+ * 1. A reconstructed list would have to be derived from the model and would drift
23
15
  * from it; this cannot.
24
- * 2. *A string entry becomes `true`, whether it names a scalar or a relation.*
25
- * §10.2 says a relation string uses the target Resource's default
26
- * projection, and `posts: true` is exactly how Prisma spells that. Since the
27
- * two emissions coincide, the translator needs no model lookup to tell a
28
- * scalar from a relation — and therefore cannot get that lookup wrong.
16
+ * 2. Since the two emissions coincide, the translator needs no model lookup to
17
+ * tell a scalar from a relation — and therefore cannot get that lookup wrong.
29
18
  * 3. *`$count` is lifted to the level that owns the edge.* Aventara writes the
30
- * reducer inside the relation's own `select` (§10.3); Prisma writes it in the
31
- * PARENT's `select`, under `_count`. The `where` placed in `_count` is the
32
- * relation's *translated* `where` and carries no pagination, which is what
33
- * makes `count` the total matching the nested `where` before
34
- * limit/offset/cursor (C-832).
19
+ * reducer inside the relation's own `select`; Prisma writes it in the PARENT's
20
+ * `select`, under `_count`. The `where` placed in `_count` is the relation's
21
+ * *translated* `where` and carries no pagination, which is what makes `count`
22
+ * the total matching the nested `where` before limit/offset/cursor.
35
23
  *
36
- * **One call, not two (D-822, measured 2026-10-02).** D-822 left open whether
37
- * Prisma's relation `_count` is affected by a `take`/`skip` on the same relation
38
- * in the same query, and required Task 8 to establish it before choosing a
39
- * shape. Measured against real databases on both engines — `@prisma/client`
40
- * 7.10.0, `_count: { select: { posts: { where } } }` beside
41
- * `posts: { where, take, skip }` — the count was `3` in every case while the row
42
- * set was `3`, `1`, `2`, `1` and `1` for no pagination, `take: 1`, `skip: 1`,
43
- * `take: 1 + skip: 1` and `take: 2 + skip: 2`, and `3` again with
44
- * `cursor + take: 1`. SQLite and PostgreSQL agreed exactly. The filtered-count
45
- * claim ("since 4.3.0") was re-measured in the same run: `_count` of the same
46
- * edge answered `5` unfiltered and `3` with the `where`. So the translation is
47
- * one call and the two-call fallback D-822 allowed for is not needed.
24
+ * Measured against real databases on both engines — `@prisma/client` 7.10.0,
25
+ * `_count: { select: { posts: { where } } }` beside `posts: { where, take, skip }`
26
+ * — the count was `3` in every case while the row set was `3`, `1`, `2`, `1` and
27
+ * `1` for no pagination, `take: 1`, `skip: 1`, `take: 1 + skip: 1` and `take: 2 +
28
+ * skip: 2`, and `3` again with `cursor + take: 1`. SQLite and PostgreSQL agreed
29
+ * exactly. The filtered-count claim ("since 4.3.0") was re-measured in the same
30
+ * run: `_count` of the same edge answered `5` unfiltered and `3` with the `where`.
48
31
  *
49
- * **The relation-argument translator is injected.** `where`, `orderBy`,
50
- * `limit`, `offset` and `cursor` are Task 7's vocabulary
51
- * (`where.translator.ts`, `order-pagination.translator.ts`); this module owns
52
- * the projection and nothing else. Injecting the seam also makes the `_count`
53
- * filter the *same* translated `where` the relation read uses, rather than a
54
- * second translation of the same predicate that could drift from it.
32
+ * Injecting the seam also makes the `_count` filter the *same* translated `where`
33
+ * the relation read uses, rather than a second translation of the same predicate
34
+ * that could drift from it.
55
35
  */
56
36
  /** Core's own word for the reducer set, so the adapter cannot invent a second one. */
57
37
  export type PrismaRelationProjection = {
58
38
  readonly field: string;
59
39
  /** Non-empty exactly when the edge requested a reducer. */
60
40
  readonly reducers: readonly RelationReducer[];
61
- /** Whether any row field was requested beside the reducer (§10.3's third shape). */
41
+ /** Whether any row field was requested beside the reducer. */
62
42
  readonly rows: boolean;
63
43
  readonly projection: PrismaProjectionPlan;
64
44
  };
65
45
  /**
66
- * What T-8 called `ReadProjectionPlanLike`, renamed because it is not a view of
67
- * a plan: `AdapterOperation` carries only `{ family, variant, resource,
68
- * arguments }` **[CORE]**, so the adapter *reconstructs* the reducer positions
69
- * from the arguments core planned, and this module is their owner. It records
70
- * only the edges that need reshaping — an edge with no reducer anywhere beneath
71
- * it is absent, which is what lets the shaper return such a row untouched.
46
+ * It records only the edges that need reshaping — an edge with no reducer anywhere
47
+ * beneath it is absent, which is what lets the shaper return such a row untouched.
72
48
  */
73
49
  export type PrismaProjectionPlan = {
74
50
  readonly relations: readonly PrismaRelationProjection[];
@@ -77,10 +53,6 @@ export type PrismaProjectionPlan = {
77
53
  export type PrismaProjectionContext = {
78
54
  readonly path: readonly string[];
79
55
  };
80
- /**
81
- * Task 7's `where`/`orderBy`/pagination translation, as this module's one
82
- * dependency: Aventara relation arguments in, Prisma relation arguments out.
83
- */
84
56
  export type PrismaRelationArgumentTranslator = (args: Readonly<Record<string, unknown>>, context: PrismaProjectionContext) => Readonly<Record<string, unknown>>;
85
57
  export type PrismaProjectionDependencies = {
86
58
  readonly translateRelationArguments: PrismaRelationArgumentTranslator;
@@ -96,11 +68,6 @@ export type PrismaProjectionTranslation = {
96
68
  };
97
69
  /**
98
70
  * A projection the adapter will not translate.
99
- *
100
- * Every case is one core's validation should already have rejected, and each is
101
- * raised rather than worked around: translating an `include` as "no relations",
102
- * or an empty `select` as "every scalar", would answer a different question in
103
- * silence, which is C-855's failure mode seen from the translation side.
104
71
  */
105
72
  export declare class PrismaProjectionTranslationError extends Error {
106
73
  constructor(reason: string, path: readonly string[]);
@@ -1,11 +1,3 @@
1
- /**
2
- * A projection the adapter will not translate.
3
- *
4
- * Every case is one core's validation should already have rejected, and each is
5
- * raised rather than worked around: translating an `include` as "no relations",
6
- * or an empty `select` as "every scalar", would answer a different question in
7
- * silence, which is C-855's failure mode seen from the translation side.
8
- */
9
1
  export class PrismaProjectionTranslationError extends Error {
10
2
  constructor(reason, path) {
11
3
  const where = path.length === 0 ? "the root projection" : path.join(".");
@@ -13,13 +5,11 @@ export class PrismaProjectionTranslationError extends Error {
13
5
  this.name = "PrismaProjectionTranslationError";
14
6
  }
15
7
  }
16
- /** Prisma's spelling of the reducer; the dictionary's `_count` → `$count` row, read backwards. */
17
8
  const PRISMA_COUNT_KEY = "_count";
18
9
  const AVENTARA_COUNT_REDUCER = "$count";
19
10
  function isRecord(value) {
20
11
  return typeof value === "object" && value !== null && !Array.isArray(value);
21
12
  }
22
- /** The single-key `{ relation: { … } }` entry core emits for a customized edge. */
23
13
  function relationEntry(entry, path) {
24
14
  const keys = Object.keys(entry);
25
15
  const field = keys[0];
@@ -55,8 +45,6 @@ function translateRelation(field, value, dependencies, path) {
55
45
  const nested = rowEntries === undefined || rowEntries.length === 0
56
46
  ? undefined
57
47
  : translateLevel(rowEntries, dependencies, here);
58
- // An edge whose only requested entries were row fields keeps Prisma's own
59
- // default projection when none were named at all (§10.2's relation string).
60
48
  const rows = entries === undefined || (rowEntries?.length ?? 0) > 0;
61
49
  const selected = rows
62
50
  ? {
@@ -73,15 +61,11 @@ function translateRelation(field, value, dependencies, path) {
73
61
  }
74
62
  : undefined;
75
63
  return {
76
- // `true` rather than `{}`: an edge with neither arguments nor a nested
77
- // projection is exactly "the target's default projection".
78
64
  selected: selected === undefined
79
65
  ? undefined
80
66
  : Object.keys(selected).length === 0
81
67
  ? true
82
68
  : selected,
83
- // The count carries the translated `where` and NOTHING else, which is what
84
- // makes it the pre-pagination total (C-832).
85
69
  counted: reducerRequested
86
70
  ? translated.where === undefined
87
71
  ? true
@@ -102,8 +86,6 @@ function translateLevel(select, dependencies, path) {
102
86
  if (entry === AVENTARA_COUNT_REDUCER) {
103
87
  throw new PrismaProjectionTranslationError("`$count` is an edge reducer and is only valid inside a relation projection", path);
104
88
  }
105
- // A scalar and a relation string translate alike, and Prisma reads
106
- // `relation: true` as the target's default projection (§10.2).
107
89
  prismaSelect[entry] = true;
108
90
  continue;
109
91
  }
@@ -127,20 +109,11 @@ function translateLevel(select, dependencies, path) {
127
109
  }
128
110
  return { select: prismaSelect, plan: { relations } };
129
111
  }
130
- /**
131
- * Translates core's planned projection into the Prisma projection arguments and
132
- * the plan the result shaper needs to place every `$count` envelope.
133
- *
134
- * @throws {PrismaProjectionTranslationError} for a projection the adapter will
135
- * not translate rather than silently reinterpret.
136
- */
137
112
  export function translateProjection(args, dependencies) {
138
113
  if (args.include !== undefined) {
139
114
  throw new PrismaProjectionTranslationError("An operation projection must arrive as `select`; core resolves `include` before the adapter", []);
140
115
  }
141
116
  if (args.select === undefined) {
142
- // C-833: Prisma's default read projection is the framework default, so the
143
- // translation is to request nothing.
144
117
  return { args: {}, plan: { relations: [] } };
145
118
  }
146
119
  if (!Array.isArray(args.select)) {
@@ -1,19 +1,13 @@
1
1
  import { type AdapterField, type AdapterModel } from "@aventara/core";
2
2
  /**
3
- * C-834 — the scalar value conversion, in **one** table and **both**
4
- * directions.
5
- *
6
3
  * # Why this is a module and not three private helpers
7
4
  *
8
5
  * Three consumers cross the same boundary with the same values: a write's `data`
9
6
  * (`mutation.translator.ts`), a filter operand (`where.translator.ts`) and a row
10
7
  * coming back (`execution/result.shaper.ts`). The emission table was born inside
11
- * the mutation translator, which is where the first of the three needed it; a
12
- * copy in each consumer would be three places to answer "what does a `decimal`
13
- * look like on the wire", and the second copy to drift would be the one nobody
14
- * reads. {@link SCALAR_BOUNDARY_CROSSINGS} is therefore the single owner, and
15
- * Task 10's `identifier.addressing.ts` is the precedent — extracted for exactly
16
- * this reason.
8
+ * the mutation translator, which is where the first of the three needed it; a copy
9
+ * in each consumer would be three places to answer "what does a `decimal` look
10
+ * like on the wire", and the second copy to drift would be the one nobody reads.
17
11
  *
18
12
  * The table is TOTAL over core's `BuiltInScalar` by a mapped type, so a tenth
19
13
  * scalar added to the protocol is a compile error here rather than a value that
@@ -22,9 +16,9 @@ import { type AdapterField, type AdapterModel } from "@aventara/core";
22
16
  * # `decimal` is the one real conversion, and that is measured
23
17
  *
24
18
  * Eight of the nine scalars pass through in both directions, re-measured on both
25
- * driver adapters at `@prisma/client` 7.10.0 (2026-10-02): a `bigint` primitive,
26
- * a `Date` and a `Uint8Array` are what the generated input types accept and what
27
- * a read returns (`Buffer.isBuffer(v) === false`, `v instanceof Uint8Array ===
19
+ * driver adapters at `@prisma/client` 7.10.0 (2026-10-02): a `bigint` primitive, a
20
+ * `Date` and a `Uint8Array` are what the generated input types accept and what a
21
+ * read returns (`Buffer.isBuffer(v) === false`, `v instanceof Uint8Array ===
28
22
  * true`), `Json` is written and returned as a plain object (its prototype IS
29
23
  * `Object.prototype`, which is what core's own `isPlainRecord` output check
30
24
  * requires **[CORE, runtime/scalar-runtime.ts]**), and an enum member is its own
@@ -32,12 +26,8 @@ import { type AdapterField, type AdapterModel } from "@aventara/core";
32
26
  * (`normalizeScalarAtom`'s `"application"` branch), so a pass-through is a
33
27
  * decision, not an omission.
34
28
  *
35
- * `decimal` is the exception §6.2 names: *the public `Decimal` MUST NOT be
36
- * `Prisma.Decimal`*, and it is not — core's `Decimal` is a class with one
37
- * private `#value` and a `toString`, while Prisma's is its bundled decimal.js,
38
- * whose constructor is named `Decimal2`. Neither accepts the other, so the
39
- * crossing is a real conversion both ways: out, the base-10 string; in, core's
40
- * own `Decimal`.
29
+ * Neither accepts the other, so the crossing is a real conversion both ways: out,
30
+ * the base-10 string; in, core's own `Decimal`.
41
31
  *
42
32
  * # Outbound: three different failures, none of them a type error
43
33
  *
@@ -62,17 +52,16 @@ import { type AdapterField, type AdapterModel } from "@aventara/core";
62
52
  * *runtime* form of every scalar — `value instanceof Decimal` for a decimal
63
53
  * **[CORE, runtime/output-validator.ts → normalizeScalarFieldValue]**. A
64
54
  * `Decimal2` is not one, so an unconverted read fails core's own validation and
65
- * the caller is told `A3000`. Converting here is therefore not a courtesy: it is
66
- * the adapter's half of §6.2.
55
+ * the caller is told `A3000`.
67
56
  *
68
57
  * # The scalar identity comes from the model, never from the value
69
58
  *
70
- * Both directions are keyed by the field's discovered scalar, never by the
71
- * runtime shape of the value. A `Json` column holding `{ "x": 1 }` and a
72
- * `Decimal` reaching Prisma are both "an object", and a `Json` column holding
73
- * the string `"12.5"` is indistinguishable from a decimal string: shape-sniffing
74
- * would convert one of those sooner or later, and silently. The discovered model
75
- * already knows, so it is asked.
59
+ * Both directions are keyed by the field's discovered scalar, never by the runtime
60
+ * shape of the value. A `Json` column holding `{ "x": 1 }` and a `Decimal`
61
+ * reaching Prisma are both "an object", and a `Json` column holding the string
62
+ * `"12.5"` is indistinguishable from a decimal string: shape-sniffing would
63
+ * convert one of those sooner or later, and silently. The discovered model already
64
+ * knows, so it is asked.
76
65
  */
77
66
  /** A value this adapter will not convert rather than misrepresent. */
78
67
  export declare class PrismaScalarConversionError extends Error {