@aventara/prisma7-adapter 0.1.0-pilot.0

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 (86) hide show
  1. package/LICENSE +91 -0
  2. package/LICENSE-ADDITIONAL-PERMISSION.md +9 -0
  3. package/README.md +564 -0
  4. package/dist/discovery/artifact.loader.d.ts +26 -0
  5. package/dist/discovery/artifact.loader.js +124 -0
  6. package/dist/discovery/capability-surface.interface.d.ts +191 -0
  7. package/dist/discovery/capability-surface.interface.js +13 -0
  8. package/dist/discovery/capability.deriver.d.ts +92 -0
  9. package/dist/discovery/capability.deriver.js +350 -0
  10. package/dist/discovery/discovery-artifact.interface.d.ts +210 -0
  11. package/dist/discovery/discovery-artifact.interface.js +1 -0
  12. package/dist/discovery/enum.mapper.d.ts +59 -0
  13. package/dist/discovery/enum.mapper.js +32 -0
  14. package/dist/discovery/field.mapper.d.ts +244 -0
  15. package/dist/discovery/field.mapper.js +387 -0
  16. package/dist/discovery/identifier.mapper.d.ts +188 -0
  17. package/dist/discovery/identifier.mapper.js +132 -0
  18. package/dist/discovery/model.discoverer.d.ts +108 -0
  19. package/dist/discovery/model.discoverer.js +341 -0
  20. package/dist/discovery/operations.deriver.d.ts +75 -0
  21. package/dist/discovery/operations.deriver.js +92 -0
  22. package/dist/discovery/scalar.mapper.d.ts +81 -0
  23. package/dist/discovery/scalar.mapper.js +51 -0
  24. package/dist/discovery/schema-facts.interface.d.ts +174 -0
  25. package/dist/discovery/schema-facts.interface.js +11 -0
  26. package/dist/discovery/schema.reader.d.ts +162 -0
  27. package/dist/discovery/schema.reader.js +692 -0
  28. package/dist/discovery/types.reader.d.ts +24 -0
  29. package/dist/discovery/types.reader.js +617 -0
  30. package/dist/discovery/vocabulary.dictionary.d.ts +258 -0
  31. package/dist/discovery/vocabulary.dictionary.js +429 -0
  32. package/dist/errors/error.normalizer.d.ts +250 -0
  33. package/dist/errors/error.normalizer.js +135 -0
  34. package/dist/errors/prisma-error.reader.d.ts +144 -0
  35. package/dist/errors/prisma-error.reader.js +167 -0
  36. package/dist/execution/first-variant.emulator.d.ts +64 -0
  37. package/dist/execution/first-variant.emulator.js +205 -0
  38. package/dist/execution/operation.executor.d.ts +87 -0
  39. package/dist/execution/operation.executor.js +210 -0
  40. package/dist/execution/result.shaper.d.ts +103 -0
  41. package/dist/execution/result.shaper.js +141 -0
  42. package/dist/execution/transaction.executor.d.ts +147 -0
  43. package/dist/execution/transaction.executor.js +13 -0
  44. package/dist/generate/artifact.emitter.d.ts +50 -0
  45. package/dist/generate/artifact.emitter.js +105 -0
  46. package/dist/generate/declared-support.reader.d.ts +33 -0
  47. package/dist/generate/declared-support.reader.js +74 -0
  48. package/dist/generate/discovery.bin.d.ts +2 -0
  49. package/dist/generate/discovery.bin.js +15 -0
  50. package/dist/generate/discovery.cli.d.ts +24 -0
  51. package/dist/generate/discovery.cli.js +163 -0
  52. package/dist/generate/existence.gate.d.ts +73 -0
  53. package/dist/generate/existence.gate.js +91 -0
  54. package/dist/generate/index.d.ts +81 -0
  55. package/dist/generate/index.js +65 -0
  56. package/dist/generate/node-version.guard.d.ts +8 -0
  57. package/dist/generate/node-version.guard.js +59 -0
  58. package/dist/generate/prisma-cli.resolver.d.ts +48 -0
  59. package/dist/generate/prisma-cli.resolver.js +95 -0
  60. package/dist/generate/prisma.generate.d.ts +164 -0
  61. package/dist/generate/prisma.generate.js +278 -0
  62. package/dist/generate/reader-crosscheck.d.ts +156 -0
  63. package/dist/generate/reader-crosscheck.js +202 -0
  64. package/dist/index.d.ts +5 -0
  65. package/dist/index.js +1 -0
  66. package/dist/prisma-client.interface.d.ts +48 -0
  67. package/dist/prisma-client.interface.js +9 -0
  68. package/dist/prisma.adapter.d.ts +55 -0
  69. package/dist/prisma.adapter.js +105 -0
  70. package/dist/provider/provider-profile.d.ts +53 -0
  71. package/dist/provider/provider-profile.js +91 -0
  72. package/dist/translation/identifier.addressing.d.ts +80 -0
  73. package/dist/translation/identifier.addressing.js +30 -0
  74. package/dist/translation/mutation.translator.d.ts +115 -0
  75. package/dist/translation/mutation.translator.js +580 -0
  76. package/dist/translation/operation.translator.d.ts +273 -0
  77. package/dist/translation/operation.translator.js +377 -0
  78. package/dist/translation/order-pagination.translator.d.ts +86 -0
  79. package/dist/translation/order-pagination.translator.js +159 -0
  80. package/dist/translation/projection.translator.d.ts +115 -0
  81. package/dist/translation/projection.translator.js +151 -0
  82. package/dist/translation/scalar.conversion.d.ts +101 -0
  83. package/dist/translation/scalar.conversion.js +221 -0
  84. package/dist/translation/where.translator.d.ts +79 -0
  85. package/dist/translation/where.translator.js +254 -0
  86. package/package.json +102 -0
@@ -0,0 +1,174 @@
1
+ /**
2
+ * T-3, source **PSL** — the output of the bounded `schema.prisma` reader.
3
+ *
4
+ * Nothing here is imported from `@prisma/client`: these are this adapter's own
5
+ * facts over schema text, which is what keeps discovery a pure function of plain
6
+ * data and unit-testable without a generated client (T-3).
7
+ *
8
+ * Read `schema.reader.ts`'s header for the boundary these facts are drawn on:
9
+ * the reader **locates** tokens and never **evaluates** them.
10
+ */
11
+ import type { PrismaReferentialAction } from "./discovery-artifact.interface.js";
12
+ /** Where a fact — or an unhandled construct — was found. One-based lines, as `prisma validate` reports them. */
13
+ export type PrismaSchemaSite = {
14
+ /** The schema file as the caller named it; a folder read names each member file (D-802, Prisma 7 folders). */
15
+ readonly file: string;
16
+ readonly line: number;
17
+ };
18
+ /**
19
+ * A construct the reader **does not recognise at all** — bucket 3 of the reader's
20
+ * three-way classification: a `type`/`view` block, an unrecognised `@relation`
21
+ * argument, or any attribute spelling added after 7.10.0.
22
+ *
23
+ * `@map`, `@@map`, `@@index` and `@@id`/`@@unique`'s `map:` are **not** here: they
24
+ * are recognised and deliberately discarded (bucket 2, the reader's explicit
25
+ * `DISCARDED_ATTRIBUTES` list), because their values appear nowhere on the 🟢
26
+ * generated surface. Recording them would fail the generate step on any schema
27
+ * that maps a column name. `name:` is **not** discarded — see
28
+ * {@link PrismaSchemaBlockIdentifier}.
29
+ *
30
+ * Bucket 3 is recorded rather than dropped because silently dropping an
31
+ * unrecognised attribute is how a grammar change becomes wrong output instead of
32
+ * a build stop. A non-empty `PrismaSchemaFacts.unhandled` FAILS the generate step
33
+ * (T-3.1 invariant 5).
34
+ */
35
+ export type PrismaSchemaUnknown = {
36
+ readonly kind: PrismaSchemaUnknownKind;
37
+ /** The construct's spelling as PSL writes it: `@map`, `@@index`, `view`, `onDelete`. */
38
+ readonly spelling: string;
39
+ /** The whole construct as written, comments already removed. Opaque text; never parsed. */
40
+ readonly text: string;
41
+ /** The enclosing block's name, or `null` at the top level. */
42
+ readonly block: string | null;
43
+ readonly site: PrismaSchemaSite;
44
+ };
45
+ export type PrismaSchemaUnknownKind =
46
+ /** An `@…` on a field declaration. */
47
+ "field-attribute"
48
+ /** An `@@…` on its own line inside a block. */
49
+ | "block-attribute"
50
+ /** A named argument of a recognised attribute that the reader neither models nor deliberately discards. */
51
+ | "attribute-argument"
52
+ /** A top-level block whose keyword is neither `model`, `enum`, `generator` nor `datasource`. */
53
+ | "block"
54
+ /** A line the reader could not classify at all. */
55
+ | "line";
56
+ export type PrismaSchemaFacts = {
57
+ readonly enums: readonly PrismaSchemaEnum[];
58
+ readonly models: readonly PrismaSchemaModel[];
59
+ /** Attributes and blocks the reader does not recognise at all (a `type`/`view` block, an
60
+ * unrecognised argument, any spelling added after 7.10.0). `@map`/`@@map`/`@@index` are
61
+ * recognised and deliberately discarded instead, so they never appear here.
62
+ * Never silently dropped: a non-empty list FAILS the generate step (T-3.1 invariant 5). */
63
+ readonly unhandled: readonly PrismaSchemaUnknown[];
64
+ };
65
+ export type PrismaSchemaEnum = {
66
+ readonly name: string;
67
+ /** Declaration order is semantic (§19.2); a member-level `@map` is discarded (bucket 2), not recorded. */
68
+ readonly values: readonly string[];
69
+ readonly site: PrismaSchemaSite;
70
+ };
71
+ /**
72
+ * A block-level uniqueness criterion — `@@id([…])` or `@@unique([…])` — as PSL
73
+ * states it: the members in **the attribute's own order**, and `name:`'s value
74
+ * when the attribute carries one.
75
+ *
76
+ * `name:` is carried rather than discarded because bucket 2's rule is that an
77
+ * attribute argument is discardable **iff its value appears nowhere on the 🟢
78
+ * surface**, and this one appears there twice. Measured at 7.10.0 (regenerated
79
+ * 2026-09-29): `@@unique([b, a], name: "altKey")` emits
80
+ * `altKey?: Prisma.NamedUniqueAltKeyCompoundUniqueInput` in `WhereUniqueInput`
81
+ * and keys `}, "id" | "altKey">`, and `@@id([a, b], name: "pk")` keys `}, "pk">`
82
+ * — the custom name **replaces** the positional `b_a` / `a_b` alias. `map:` does
83
+ * stay discarded: `named_idx` appears in the whole generated tree only in the 🛑
84
+ * `internal/class.ts` inline-schema blob.
85
+ *
86
+ * The list itself is read from the positional argument or from `fields:`,
87
+ * whichever the schema writes, and in whatever order the other arguments follow:
88
+ * `@@unique([b, a])`, `@@unique(fields: [b, a])` and
89
+ * `@@unique(name: "k", map: "m", fields: [b, a])` are all valid at 7.10.0 and the
90
+ * first two produce the identical generated key `b_a`.
91
+ *
92
+ * `null` means the attribute wrote no `name:`, not "the positional form": the
93
+ * positional key is derivable from `members`, and a name is derivable from
94
+ * nothing, so only the undecidable half is recorded. What derives the addressing
95
+ * key from the pair is `identifier.mapper.ts`.
96
+ */
97
+ export type PrismaSchemaBlockIdentifier = {
98
+ /** Member order as written in the attribute's list. Never sorted. */
99
+ readonly members: readonly string[];
100
+ /** `name:`'s value, or `null` when the attribute wrote none. */
101
+ readonly name: string | null;
102
+ };
103
+ export type PrismaSchemaModel = {
104
+ readonly name: string;
105
+ readonly fields: readonly PrismaSchemaField[];
106
+ /** `@@id([…])` — members as written in the attribute's list, plus its `name:`. */
107
+ readonly blockId: PrismaSchemaBlockIdentifier | null;
108
+ /** `@@unique([…])` — members as written in the attribute's list, never the field order. */
109
+ readonly blockUniques: readonly PrismaSchemaBlockIdentifier[];
110
+ /** `@@ignore` */
111
+ readonly ignored: boolean;
112
+ readonly site: PrismaSchemaSite;
113
+ };
114
+ export type PrismaSchemaField = {
115
+ readonly name: string;
116
+ /** A built-in scalar, an enum name, or a model name. Which one it is, is not PSL's to say. */
117
+ readonly type: string;
118
+ /** `[]` */
119
+ readonly list: boolean;
120
+ /** `?` — the ONLY source of nullability (T-3.1 invariant 4). */
121
+ readonly optional: boolean;
122
+ /** `@id` */
123
+ readonly id: boolean;
124
+ /** `@unique` */
125
+ readonly unique: boolean;
126
+ /** `@updatedAt` */
127
+ readonly updatedAt: boolean;
128
+ /** `@default(…)`'s argument as RAW TEXT — matched against a table, never parsed (T-3.1 invariant 5). */
129
+ readonly defaultArgument: string | null;
130
+ readonly relation: PrismaSchemaRelation | null;
131
+ /**
132
+ * `@db.*` as written, e.g. `@db.Decimal(10, 2)`. Kept verbatim and never
133
+ * parsed. A native type is the **only** proof discovery accepts for
134
+ * `format` (C-809, spec §6.1 "when the adapter can prove the format");
135
+ * configuration may then override it, since `AdapterScalarField.format`
136
+ * and `FrameworkScalarFieldConfig.format` are separate members the
137
+ * compiler layers.
138
+ */
139
+ readonly native: readonly string[];
140
+ /** `@ignore` */
141
+ readonly ignored: boolean;
142
+ readonly site: PrismaSchemaSite;
143
+ };
144
+ export type PrismaSchemaRelation = {
145
+ /** `@relation("Name")` — the ONLY evidence pairing a back-reference with its forward reference. */
146
+ readonly name: string | null;
147
+ /** The FK scalar(s); read, used, then discarded (C-813). */
148
+ readonly fields: readonly string[] | null;
149
+ readonly references: readonly string[] | null;
150
+ /**
151
+ * `@relation(onDelete: …)`, in Aventara's words, **already resolved**: an
152
+ * absent argument carries Prisma's effective default rather than a third
153
+ * state, because an absent action and the explicitly-written default are one
154
+ * fact about what a delete does.
155
+ *
156
+ * `null` means **this edge is not the owning side** — it declares no
157
+ * `fields:`, so no foreign key and no action belong to it. PSL enforces that
158
+ * itself: `prisma validate` 7.10.0 answers *"The relation field `reqs` on
159
+ * Model `Alpha` must not specify the `onDelete` or `onUpdate` argument in the
160
+ * @relation attribute. You must only specify it on the opposite field `alpha`
161
+ * on model `Req`"*. `null` therefore reads as "ask the other edge", never as
162
+ * "no action applies". It is also what an unreadable action spelling leaves
163
+ * behind, and that case is recorded in `unhandled` and fails the generate
164
+ * step, so no consumer sees it.
165
+ *
166
+ * The inversion matters to every consumer: the action is declared on the
167
+ * CHILD and fires when the PARENT is deleted. Read with
168
+ * `PrismaSchemaField.type` — the target model — one owning edge says
169
+ * "deleting a `<type>` does `<onDelete>` to a row of the enclosing model".
170
+ */
171
+ readonly onDelete: PrismaReferentialAction | null;
172
+ /** `@relation(onUpdate: …)`, resolved the same way. Read independently of `onDelete`. */
173
+ readonly onUpdate: PrismaReferentialAction | null;
174
+ };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * T-3, source **PSL** — the output of the bounded `schema.prisma` reader.
3
+ *
4
+ * Nothing here is imported from `@prisma/client`: these are this adapter's own
5
+ * facts over schema text, which is what keeps discovery a pure function of plain
6
+ * data and unit-testable without a generated client (T-3).
7
+ *
8
+ * Read `schema.reader.ts`'s header for the boundary these facts are drawn on:
9
+ * the reader **locates** tokens and never **evaluates** them.
10
+ */
11
+ export {};
@@ -0,0 +1,162 @@
1
+ import type { PrismaSchemaFacts } from "./schema-facts.interface.js";
2
+ /**
3
+ * T-3, source **PSL** — the bounded `schema.prisma` reader.
4
+ *
5
+ * # The boundary, and why this file is a reader and not a parser
6
+ *
7
+ * It **locates** tokens and never **evaluates** them.
8
+ *
9
+ * PSL's model body is line-oriented by the language's own rule, not by this
10
+ * reader's assumption. Re-measured against `prisma` 7.10.0 on 2026-09-28, all
11
+ * four constructs that would let a declaration legally span lines are
12
+ * **rejected** with `Error code: P1012` — so the classic regex-parser failure
13
+ * cannot occur:
14
+ *
15
+ * 1. a wrapped `@@unique([…])` — the error COUNT is layout-dependent, the
16
+ * rejection is not. A two-line wrap (`@@unique([x,` / `y])`) gives 2 errors,
17
+ * both `error: Error validating: This line is not a valid field or attribute
18
+ * definition.`; a four-line wrap gives 4 — three of that sentence plus one
19
+ * `Error validating model "A": This field declaration is invalid. It is
20
+ * either missing a name or a type.`
21
+ * 2. a wrapped field attribute (`@default(uuid())` on the line below `id String @id`)
22
+ * — 1 error, `This line is not a valid field or attribute definition.`
23
+ * 3. two block attributes on one line (`@@unique([x]) @@index([y])`) — 1 error,
24
+ * `This line is not a valid field or attribute definition.`
25
+ * 4. a split field declaration (`id` then `String @id`) — 2 errors, **both**
26
+ * `Error validating model "A": This field declaration is invalid. It is either
27
+ * missing a name or a type.`
28
+ *
29
+ * **Correction to the plan's wording (2026-09-28, re-measured, not inherited).**
30
+ * The plan and T-3 previously said all four are rejected *with* `P1012 … This
31
+ * line is not a valid field or attribute definition`. All four are indeed
32
+ * `P1012`, **and the line-oriented conclusion holds unchanged** — the design did
33
+ * not move. But case 4 never emits that sentence at all (it emits *"This field
34
+ * declaration is invalid. It is either missing a name or a type."* twice), and
35
+ * case 1 emits a second, different sentence besides it. The evidence supports the
36
+ * rule; the single-sentence attribution does not, and the plan now says so.
37
+ *
38
+ * Re-running it: `prisma` lives at `packages/prisma7-adapter/node_modules/.bin/
39
+ * prisma`, not the worktree root. Invoked from the root it silently produces no
40
+ * output, which looks exactly like "no errors".
41
+ *
42
+ * # What crossing the boundary would mean
43
+ *
44
+ * The day this reader **evaluates** — resolving `env()`, interpreting
45
+ * `dbgenerated(…)`, modelling `type`/`view` blocks, following `@@schema`, or
46
+ * reconstructing relations without `@relation` names — it has become a parser and
47
+ * needs a different decision. Hence:
48
+ *
49
+ * - `@default`'s argument is kept as **raw text** and matched against a table
50
+ * downstream, never parsed (T-3.1 invariant 5).
51
+ * - `@db.*` is kept **as written** and never parsed. It is the only proof
52
+ * discovery accepts for `format` (C-809); configuration overrides it later.
53
+ * - a field's `type` stays the written token — `Grade` is not resolved to the
54
+ * enum, which is also why a schema **folder** needs no linker (below).
55
+ * - an attribute is classified three ways, not two (below), and only the third
56
+ * class is recorded in `unhandled`. A non-empty `unhandled` fails the generate
57
+ * step: silently dropping an **unrecognised** attribute is how a grammar change
58
+ * becomes wrong output instead of a build stop. The version fence is what
59
+ * converts a grammar change from silent wrongness into a build stop.
60
+ *
61
+ * # The three-way classification (corrected 2026-09-28)
62
+ *
63
+ * 1. **recognised and modelled** — `FIELD_ATTRIBUTES`, `BLOCK_ATTRIBUTES`,
64
+ * `@db.*` and `RELATION_ARGUMENTS`.
65
+ * 2. **recognised and deliberately discarded**, via the explicit
66
+ * `DISCARDED_ATTRIBUTES` / `DISCARDED_BLOCK_ATTRIBUTE_ARGUMENTS` lists —
67
+ * `@map`, `@@map`, `@@index`, and `@@id`/`@@unique`'s `map:` argument. The
68
+ * rule is one line long: an argument is discardable **iff its value appears
69
+ * nowhere on the 🟢 surface**. The list being explicit is the point: the
70
+ * discard is a decision a reader can see and audit, not an omission. That
71
+ * rule is also what took `name:` back OFF this list (2026-09-29): its value
72
+ * is a `WhereUniqueInput` key and an `AtLeast` key, so it is carried on
73
+ * `PrismaSchemaBlockIdentifier`.
74
+ * 3. **unrecognised** — on neither list, therefore `unhandled`, therefore a build
75
+ * stop.
76
+ *
77
+ * # Surface-invisibility was EVIDENCE, not the meaning (2026-09-29)
78
+ *
79
+ * Bucket 2's rule reads "discardable iff the value appears nowhere on the 🟢
80
+ * surface", and `@relation(onDelete: Cascade)` passes that test: measured at
81
+ * 7.10.0, `Cascade` reaches nothing but the 🛑 `internal/class.ts` inline-schema
82
+ * blob. It is still **not** discardable, and this is the first construct where
83
+ * the test and the rule it stands for come apart.
84
+ *
85
+ * The rule's *reason* was that such attributes configure the database below the
86
+ * ORM entrypoint and therefore carry no framework meaning. A referential action
87
+ * fails that reason while passing the test: it changes what a delete **does** —
88
+ * rows disappear that the caller never named — which is exactly what a
89
+ * transaction planner must reason about before it agrees to run a plan. So
90
+ * invisibility on the generated types is *evidence* for "no framework meaning",
91
+ * and evidence can be outweighed; it was never the meaning itself. `@map` and
92
+ * `@@index` remain discarded because they fail the test AND the reason.
93
+ * `@relation`'s `map:` joins them: a foreign-key constraint name is genuinely
94
+ * DB-side, and it was bucket 3 until now, which made `@relation(map: …)` — valid
95
+ * PSL — a build stop on its own.
96
+ *
97
+ * Actions are read on both arguments and carried **resolved**: an absent
98
+ * argument is not a third state, it is Prisma's effective default, measured
99
+ * rather than assumed (see `REFERENTIAL_ACTIONS` and
100
+ * `resolvePrismaReferentialDefaults`).
101
+ *
102
+ * Bucket 2 previously did not exist, and a field-level `@map` landed in
103
+ * `unhandled`: the framework would have refused to build against any schema that
104
+ * maps a column name, which is most real Prisma schemas. It was invisible only
105
+ * because both Phase 8 schemas use zero `@map`. The enum **member**-level `@map`
106
+ * discard, which T-3's `PrismaSchemaEnum` and Task 3's enum-mapper case already
107
+ * required, folds into bucket 2 and stops being a special case.
108
+ *
109
+ * # Arguments are located by NAME, never by position (added 2026-09-29)
110
+ *
111
+ * PSL lets the same argument list arrive positionally or named, and lets the
112
+ * named arguments come in any order. Measured against `prisma validate` 7.10.0
113
+ * and against a generated client on 2026-09-29: `@@unique([b, a])`,
114
+ * `@@unique(fields: [b, a])`, `@@unique(name: "k", map: "m", fields: [b, a])`
115
+ * and every other permutation are accepted, and the client keys the unnamed ones
116
+ * `b_a` and the named ones `k` regardless of the order they were written in. The
117
+ * spelling is therefore not a fact about the schema, and a reader that took the
118
+ * list to be the FIRST argument read `@@unique(fields: [b, a])` as one member
119
+ * called `fields: [b, a]` — silently, with `unhandled` empty — so the generate
120
+ * step refused a schema Prisma accepts. ARGUMENT order does not matter; MEMBER
121
+ * order inside the list still does, because it is part of the identity and of
122
+ * the addressing key.
123
+ *
124
+ * The same rule applies to `@relation`, which mixes a positional argument (the
125
+ * relation name) with named ones; it was already order-independent and its FK
126
+ * read was unaffected.
127
+ *
128
+ * A list whose members are not plain field names — `@@unique([a(sort: Desc)])`,
129
+ * valid PSL at 7.10.0 — cannot be located without evaluating, so it is bucket 3
130
+ * rather than a guess.
131
+ *
132
+ * # One deliberate non-recording beyond the buckets
133
+ *
134
+ * `generator` and `datasource` block bodies are skipped, not recorded: they are
135
+ * tooling configuration, not model content, and their contents are exactly what
136
+ * this reader must not evaluate (`env()` lives there).
137
+ *
138
+ * # A schema folder is readdir plus merge
139
+ *
140
+ * Prisma 7 accepts a folder (`prisma validate --schema <folder>` verified at
141
+ * 7.10.0). Blocks are file-local and references are by name, so there is no
142
+ * cross-file grammar and **no linker**: reading a folder appends each file's
143
+ * facts in filename order and nothing is rewritten. Every fact keeps the file and
144
+ * line it was written on.
145
+ */
146
+ export type PrismaSchemaSource = {
147
+ readonly file: string;
148
+ readonly text: string;
149
+ };
150
+ export declare class PrismaSchemaReaderError extends Error {
151
+ readonly name = "PrismaSchemaReaderError";
152
+ }
153
+ /**
154
+ * Reads a schema file, or a schema **folder** (Prisma 7 accepts either).
155
+ * A folder is read as readdir-plus-merge in filename order.
156
+ */
157
+ export declare function readPrismaSchema(location: string): Promise<PrismaSchemaFacts>;
158
+ /**
159
+ * The reader proper, over text already in hand. Merging several sources is
160
+ * concatenation: blocks are file-local and references are by name.
161
+ */
162
+ export declare function readPrismaSchemaSources(sources: readonly PrismaSchemaSource[]): PrismaSchemaFacts;