diff --git a/apps/telemetry-backend/src/prisma/contract.d.ts b/apps/telemetry-backend/src/prisma/contract.d.ts index 09c89461dff8..154d10323efb 100644 --- a/apps/telemetry-backend/src/prisma/contract.d.ts +++ b/apps/telemetry-backend/src/prisma/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@prisma/orm-postgres/adapter/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@prisma/orm-postgres/target/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@prisma/orm-postgres/target/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/docs/architecture docs/adrs/ADR 203 - Trait-targeted operation arguments.md b/docs/architecture docs/adrs/ADR 203 - Trait-targeted operation arguments.md index 66c68fcd87f2..26a394bb52be 100644 --- a/docs/architecture docs/adrs/ADR 203 - Trait-targeted operation arguments.md +++ b/docs/architecture docs/adrs/ADR 203 - Trait-targeted operation arguments.md @@ -2,7 +2,7 @@ ## Context -Adapters and extensions register query operations (e.g., `ilike`, `cosineDistance`) that attach to fields of a given shape. Until now an operation declared its `self` argument as a specific `codecId` — `pgvector/vector@1` for `cosineDistance`, for example. The type and runtime machinery then surfaced that operation on every field whose codec matched that ID. +Adapters and extensions register query operations (e.g., `ilike`, `cosineDistance`) that attach to fields of a given shape. (Per [ADR 206](ADR%20206%20-%20Operations%20as%20TypeScript%20functions.md)'s amendment, a target registers its built-in operations too — `ilike` is contributed by the Postgres target, not its adapter.) Until now an operation declared its `self` argument as a specific `codecId` — `pgvector/vector@1` for `cosineDistance`, for example. The type and runtime machinery then surfaced that operation on every field whose codec matched that ID. Codec-ID targeting works when an operation is tied to one concrete codec. It breaks down when an operation is defined by a *capability* that multiple codecs share: @@ -21,10 +21,10 @@ Extend operation argument specs with an optional `traits` field alongside `codec ## Grounding example -Adapter-provided operations declare their arguments as trait-targeted where appropriate. The Postgres `ilike` descriptor names no specific textual codec — just the `textual` trait on its self argument: +Operations contributed by a target, adapter or extension declare their arguments as trait-targeted where appropriate. The Postgres target's `ilike` descriptor names no specific textual codec — just the `textual` trait on its self argument: ```typescript -// Adapter descriptor (runtime shape) +// Postgres target descriptor (runtime shape) { method: 'ilike', args: [ @@ -52,7 +52,7 @@ readonly ilike: { }; ``` -From this single descriptor, every textual field in the contract gains the operation. A non-textual field does not. An adapter that does not register the operation never exposes it, regardless of what codecs are on the target. +From this single descriptor, every textual field in the contract gains the operation. A non-textual field does not. A target, adapter or extension that does not register the operation never exposes it, regardless of what codecs are on the target. ## Design principles @@ -60,7 +60,7 @@ From this single descriptor, every textual field in the contract gains the opera 2. **Traits are a closed union at the type level, an open set at runtime.** `CodecTrait` is a union so type matching stays structural and narrowing works; `ParamSpec.traits` is `readonly string[]` at runtime so registries can carry forward trait values they don't statically know about. 3. **Return targeting stays exact.** Predicate detection and result decoding depend on knowing the concrete return codec. `ReturnSpec` enforces this separately, so loosening `ParamSpec.codecId` to optional does not weaken return-type guarantees. 4. **Registration does the expansion work.** Operation lookup is on the hot path — it happens for every field access on an ORM model accessor. Trait resolution runs once per operation at registration time so field access remains a single map lookup. -5. **Same descriptor, different reachability per contract.** Contracts see different operation sets because their adapters register different operations — not because core branches on target. This preserves the thin-core discipline from [ADR 005](ADR%20005%20-%20Thin%20Core%20Fat%20Targets.md). +5. **Same descriptor, different reachability per contract.** Contracts see different operation sets because their targets, adapters and extensions register different operations — not because core branches on target. This preserves the thin-core discipline from [ADR 005](ADR%20005%20-%20Thin%20Core%20Fat%20Targets.md). ## How matching works @@ -89,7 +89,7 @@ The ORM client surfaces this distinction by returning an `AnyExpression` (compos ## Interaction with other subsystems - **Codec registry** ([ADR 030](ADR%20030%20-%20Result%20decoding%20%26%20codecs%20registry.md)). Traits are codec metadata, owned by the codec registry. Operation matching reads traits from there; no new source of truth is introduced. -- **Adapter SPI** ([ADR 016](ADR%20016%20-%20Adapter%20SPI%20for%20Lowering.md)). Adapter runtime descriptors expose `queryOperations()` alongside the existing lowering surface. Contract emission picks up `types.queryOperationTypes` from descriptor meta, and trait-targeted operations flow through the same pipeline as codec-ID operations. +- **Adapter SPI** ([ADR 016](ADR%20016%20-%20Adapter%20SPI%20for%20Lowering.md)). Target, adapter and extension runtime descriptors expose `queryOperations()`; for adapters it sits alongside the existing lowering surface. Contract emission picks up `types.queryOperationTypes` from descriptor meta, and trait-targeted operations flow through the same pipeline as codec-ID operations. - **Contract extension encoding** ([ADR 105](ADR%20105%20-%20Contract%20extension%20encoding.md)) and [ADR 106](ADR%20106%20-%20Canonicalization%20for%20extensions.md). Trait-targeted argument specs serialize with `traits` as a string at the type level and as a string array at runtime. Canonicalization treats the `traits` field as opaque to the extension owner. - **Extension compatibility** ([ADR 017](ADR%20017%20-%20Extension%20Compatibility%20Policy.md)). Trait-targeting is additive. Existing codec-ID-targeted operations continue to work without changes. @@ -104,8 +104,8 @@ The ORM client surfaces this distinction by returning an `AnyExpression` (compos ### Positive -- Adapter-specific operations that apply to a capability (rather than one codec) can be registered once and automatically attach to every matching codec — including codecs added later by downstream extensions. -- Operations are reachable only on contracts whose adapter registered them. Capability-based operators no longer need runtime guards to reject calls on unsupported targets; the operation is absent from the type surface. +- Target-, adapter- or extension-specific operations that apply to a capability (rather than one codec) can be registered once and automatically attach to every matching codec — including codecs added later by downstream extensions. +- Operations are reachable only on contracts whose target, adapter or extension registered them. Capability-based operators no longer need runtime guards to reject calls on unsupported targets; the operation is absent from the type surface. - Boolean-returning extension operations are predicates by construction, composable with `and`/`or`/`not` without special-casing per operation. ### Trade-offs @@ -137,7 +137,7 @@ Doubles the surface — adapters, runtime registries, and type-level matchers al ## Open questions - Whether trait-targeted arguments should support OR-composition of required traits. Today `traits` is a single string at the type level and a conjunction at runtime. A more expressive combinator can be added later without breaking the current shape. -- How the emitter pipeline should validate that every adapter-declared `QueryOperationTypes` entry has a corresponding runtime descriptor registered. The two are wired through descriptor meta but not cross-checked at emission time. +- How the emitter pipeline should validate that every contributor-declared `QueryOperationTypes` entry has a corresponding runtime descriptor registered. The two are wired through descriptor meta but not cross-checked at emission time. ## Decision record diff --git a/docs/architecture docs/adrs/ADR 206 - Operations as TypeScript functions.md b/docs/architecture docs/adrs/ADR 206 - Operations as TypeScript functions.md index fc0b944d02f3..86d66dd80c24 100644 --- a/docs/architecture docs/adrs/ADR 206 - Operations as TypeScript functions.md +++ b/docs/architecture docs/adrs/ADR 206 - Operations as TypeScript functions.md @@ -2,7 +2,7 @@ ## Context -Operations contributed by adapters and extensions — `ilike`, `cosineDistance`, and any future operator — are described to the framework by a declarative record: an argument list in which each argument targets a codec by identity or by trait, a return codec, and a lowering spec. The framework reads that record, derives call signatures for the SQL builder's `fns` surface and the ORM column helper, and wraps user-supplied values as parameter references using the codec identity on each argument position. +Operations contributed by targets, adapters and extensions — `ilike`, `cosineDistance`, and any future operator — are described to the framework by a declarative record: an argument list in which each argument targets a codec by identity or by trait, a return codec, and a lowering spec. The framework reads that record, derives call signatures for the SQL builder's `fns` surface and the ORM column helper, and wraps user-supplied values as parameter references using the codec identity on each argument position. The shape of that record is a closed structure. It can say "this argument accepts any expression of codec X" or "of any codec with traits T", and nothing else. It cannot express a generic tying two argument codecs together, a non-database TypeScript type such as a numeric dimension or an option bag, a conditional return codec that depends on the argument codec, or a method overload. Every operation is forced into the single shape that the records can describe. Extensions that want more do not have a way to ask for it. @@ -12,7 +12,7 @@ Authoring an operation also duplicates information. The runtime descriptor carri Operations are authored as TypeScript functions. The function's signature is the type-level surface. The function's body is the runtime — it receives user arguments (values or expressions), wraps them into parameter references with the appropriate codec via the `toExpr(value, codecId?)` helper, and returns an AST expression node produced by `buildOperation({ method, self, args, returns, lowering })`. Each parameter type is written either as `CodecExpression` when the argument is bound to an exact codec, or as `TraitExpression` when the argument is gated by capability traits; both union an `Expression` of the matching shape, a raw JS value from the codec-types map, and `null` when `Nullable` is true. Alongside the function each operation carries an `SqlOperationDescriptor` with three fields: `method`, an optional `self` dispatch hint naming either the codec identity or the trait set its first argument targets, and the `impl` function. The return codec, the lowering template, and the codecs of subsequent arguments live inside the AST node the function constructs, not on the descriptor. -Because both `CodecExpression` and `TraitExpression` take the contract's codec-types map as a type parameter, each adapter and extension exposes its operation contributions behind a factory generic over that map — `QueryOperationTypes` at the type level and a matching `QueryOperations()` function at the runtime level. The contract-assembly layer calls the factory once with the contract's concrete codec-types map. Every signature that reaches the SQL builder or the ORM client is already concrete; there is no lane-level projection step that rewrites authored types into contract-bound types. +Because both `CodecExpression` and `TraitExpression` take the contract's codec-types map as a type parameter, each target, adapter and extension exposes its operation contributions behind a factory generic over that map — `QueryOperationTypes` at the type level and a matching `QueryOperations()` function at the runtime level. The contract-assembly layer calls the factory once with the contract's concrete codec-types map. Every signature that reaches the SQL builder or the ORM client is already concrete; there is no lane-level projection step that rewrites authored types into contract-bound types. ## Design principles @@ -20,7 +20,7 @@ Because both `CodecExpression` and `TraitExpression` take the contract's codec-t 2. **Dispatch metadata is the minimum.** `SqlOperationDescriptor` carries `method`, an optional `self` hint, and the `impl` function. The return codec, the lowering spec, and the argument wrapping all live inside the function's body or on the AST node the function builds. 3. **`self` is the single source of truth for column-helper reachability.** The same hint is read by the ORM at runtime to index operations by codec and by the type system to decide which operations appear on a field. Because the two planes consume the same value, they cannot disagree. 4. **Argument wrapping belongs to the operation.** The dispatch layer does not know the codec of any argument and does not need to. An operation whose second argument is an exact textual codec calls `toExpr(arg, 'pg/text@1')` to wrap it; an operation whose argument is a raw numeric dimension is responsible for embedding it as a literal in the AST node. -5. **The codec-types map is bound at factory-call time.** Each adapter and extension exposes its operations behind a `QueryOperationTypes` factory generic over the contract's codec-types map. The contract-assembly layer instantiates the factory with the contract's concrete map. Authored signatures reach the SQL builder and ORM client already specialised to that contract; no mapped-type signature projection at the lane boundary is needed. +5. **The codec-types map is bound at factory-call time.** Each target, adapter and extension exposes its operations behind a `QueryOperationTypes` factory generic over the contract's codec-types map. The contract-assembly layer instantiates the factory with the contract's concrete map. Authored signatures reach the SQL builder and ORM client already specialised to that contract; no mapped-type signature projection at the lane boundary is needed. ## How matching works @@ -37,7 +37,7 @@ The distinction between predicate operations (return a boolean, composable insid ## Interaction with other subsystems - **Operation arguments.** [ADR 203](ADR%20203%20-%20Trait-targeted%20operation%20arguments.md) introduced codec-identity and trait-set targeting for argument specs. The primitive survives — the self hint uses the same vocabulary — but it now applies only to the ORM column-helper dispatch. The SQL builder no longer reads argument specs; it calls the authored function directly. -- **Adapter SPI.** [ADR 016](ADR%20016%20-%20Adapter%20SPI%20for%20Lowering.md) described how adapters contribute lowering. The adapter runtime descriptor's `queryOperations` slot now yields a factory rather than a const array. The contract-assembly layer calls the factory with the contract's codec-types map. +- **Adapter SPI.** [ADR 016](ADR%20016%20-%20Adapter%20SPI%20for%20Lowering.md) described how adapters contribute lowering. The adapter runtime descriptor's `queryOperations` slot now yields a factory rather than a const array. The contract-assembly layer calls the factory with the contract's codec-types map. The amendment below then moved a target's built-in operations off the adapter and onto the target descriptor's identical slot. - **Codec registry.** [ADR 030](ADR%20030%20-%20Result%20decoding%20%26%20codecs%20registry.md) defines codec metadata including traits. The ORM column helper continues to read traits from the registry to expand trait-targeted self hints. Codec-types flow from the same registry into the contract and onward into each operation factory. - **Extension compatibility.** [ADR 017](ADR%20017%20-%20Extension%20Compatibility%20Policy.md) is honoured: old declarative operation records are not retained, so the decision is a breaking change for extensions that ship their own operation contributions. The breakage is local — each extension rewrites its operation contribution at the factory boundary, without changes elsewhere in the authoring surface. @@ -75,10 +75,22 @@ Let authors continue to write the declarative record in most cases, and attach a Have `CodecExpression` and `TraitExpression` read the JS-value type from a globally augmented interface, so authors can write signatures without the `CT` type parameter. Rejected. The augmentation collapses a TypeScript project to a single contract. A library that works with two contracts in one program — for example a migration tool inspecting source and target — would see the registries overlap. +## Amendment: a target's built-in operations are contributed by its target pack + +A target's own query vocabulary lives in the target pack, not the adapter. [ADR 005](ADR%20005%20-%20Thin%20Core%20Fat%20Targets.md) puts dialect vocabulary in the target; [ADR 016](ADR%20016%20-%20Adapter%20SPI%20for%20Lowering.md) leaves the adapter responsible for rendering an AST and binding its parameters. Deciding that Postgres spells case-insensitive matching `ILIKE`, or that full-text search goes through `to_tsvector` and `websearch_to_tsquery`, is the first kind of decision and not the second. + +So `@internal/target-postgres` contributes `ilike` — which moved there — along with `fullTextMatches`, `fullTextRank` and `fullTextHeadline`, and `@internal/adapter-postgres` contributes no query operations at all; its `operation-types` export is gone rather than kept as a shim. Nothing in the framework had to change: `SqlStaticContributions.queryOperations` was already optional on every SQL component, `createSqlExecutionStack` already iterates the target, and `extractQueryOperationTypeImports` already reads `types.queryOperationTypes` from every descriptor. An adapter may still contribute a genuinely adapter-specific operation; Postgres simply has none. Extensions are unaffected. + +Emitted Postgres `contract.d.ts` files follow, importing `QueryOperationTypes` from `@internal/target-postgres/operation-types` under the alias `PgTargetQueryOps`. `contract.json` does not change and no contract hash moves; an application re-emits its types and keeps working. + +The full-text operations take the search string as a bound `pg/text@1` parameter and an options object whose members — the text-search configuration, `ts_rank`'s normalization bitmask, `ts_headline`'s markers and word counts — Postgres will not accept as parameters and which therefore reach the SQL as literals. Each is validated before a statement exists, against an allowlist for the configuration and a range or character rule for the rest, and anything else throws `RUNTIME.ARGUMENT_INVALID`. `websearch_to_tsquery` is the only query parser used: it accepts what a search box collects and raises no syntax error on arbitrary input. + +Anchors: [`query-operations.ts`](../../../packages/3-targets/3-targets/postgres/src/core/query-operations.ts) and [`full-text-options.ts`](../../../packages/3-targets/3-targets/postgres/src/core/full-text-options.ts) for the operations and their option checks; [`descriptor-meta.ts`](../../../packages/3-targets/3-targets/postgres/src/core/descriptor-meta.ts) for the import spec the emitter writes. + ## Open questions -- Where exactly the factory boundary sits in the adapter SPI. The adapter runtime descriptor exposes a `queryOperations` slot whose shape is `() => readonly SqlOperationDescriptor[]`; today each adapter's thunk calls its `QueryOperations()` factory internally with an unconstrained `CT`. Threading the contract's concrete codec-types map through the slot remains an open design question. +- Where exactly the factory boundary sits in the contributor SPI. Target, adapter and extension runtime descriptors expose a `queryOperations` slot whose shape is `() => SqlOperationDescriptors`; today each contributor's thunk (the Postgres target's included) calls its `QueryOperations()` factory internally with an unconstrained `CT`, and the runtime's `createSqlExecutionStack` calls the slot with no type argument, so the binding described under Decision is nominal at runtime and concrete only in the emitted `contract.d.ts`, where the emitter instantiates each `QueryOperationTypes` alias with the contract's `CodecTypes`. Threading the contract's concrete codec-types map through the runtime slot remains an open design question. ## Decision record -Operations are authored as TypeScript functions whose parameters use `CodecExpression` or `TraitExpression`, accompanied by an `SqlOperationDescriptor` whose `self` field names the codec or trait the first argument targets. Adapters and extensions expose operation contributions behind a `QueryOperationTypes` factory which the contract-assembly layer instantiates once. The SQL builder surface flows each authored `impl` through unchanged; the ORM column helper reads the `self` hint to decide reachability. The framework validates only the `self` hint and dispatches by `method`; the runtime costs of argument wrapping (via `toExpr`), return-codec attachment, and lowering are paid by the authored function itself (via `buildOperation`). +Operations are authored as TypeScript functions whose parameters use `CodecExpression` or `TraitExpression`, accompanied by an `SqlOperationDescriptor` whose `self` field names the codec or trait the first argument targets. Targets, adapters and extensions expose operation contributions behind a `QueryOperationTypes` factory which the contract-assembly layer instantiates once. The SQL builder surface flows each authored `impl` through unchanged; the ORM column helper reads the `self` hint to decide reachability. The framework validates only the `self` hint and dispatches by `method`; the runtime costs of argument wrapping (via `toExpr`), return-codec attachment, and lowering are paid by the authored function itself (via `buildOperation`). diff --git a/docs/architecture docs/adrs/ADR 236 - Target-contributed model attributes.md b/docs/architecture docs/adrs/ADR 236 - Target-contributed model attributes.md index 66520c86791e..f2e61b72080b 100644 --- a/docs/architecture docs/adrs/ADR 236 - Target-contributed model attributes.md +++ b/docs/architecture docs/adrs/ADR 236 - Target-contributed model attributes.md @@ -72,7 +72,7 @@ A registry of `AuthoringModelAttributeDescriptor`s. Each descriptor: - **claims a bare `@@` attribute name** (`attribute: 'rls'`); - **supplies a factory for the declarative parameter spec** — a `ModelAttributeSpecFactory`, called with the declaring model's context and returning a spec built with the same `modelAttribute(...)` constructors as every other declarative attribute ([ADR 231](ADR%20231%20-%20Declarative%20attribute%20specifications.md)) — so parsing, validation, and printing come for free from the generic machinery. A spec that needs nothing from the context, like `@@rls`, returns a hoisted module constant so its identity is stable across calls; -- **supplies a `lower` function** that turns the parsed attribute into a pack entity keyed into the namespace's `entries`. +- **supplies a `lower` function** that turns the parsed attribute into a pack entity keyed into the namespace's `entries`. A lowering may instead return `{ index }`; see the amendment below. The factory indirection is uniform across every registered attribute spec, so one entry shape serves both this channel and the family built-ins that share the registry. @@ -99,6 +99,16 @@ The field expresses exactly one constraint — *one* ref parameter's model must - Both SPIs are durable public framework surface with a single consumer (`@@rls`). The shapes are the narrowest that serve it; a second consumer may force widening (e.g. multiple `requiresModelAttribute` pairs), which is additive but still a surface change. - An argument-less attribute's `lower` receives an empty parse (`Record`); the descriptor machinery's generality is unused until an attribute with parameters arrives. +## Amendment: a contributed attribute may produce a table index + +A lowering returns either the entity it always could or `{ index }`, an opaque payload the family narrows. The SQL interpreter checks it with `isAuthoredIndexInput` and pushes it onto the same `indexNodes` list `@@index` fills, so index naming, index-type registration and the name-xor-map rules are shared rather than reimplemented. The framework declares only the arm: an index's *shape* belongs to the family, because a Mongo index and a SQL index agree on nothing but the word. + +Two smaller additions serve the same case. A descriptor may declare itself `repeatable`, which skips the duplicate-attribute diagnostic, since a model may want several such indexes. And the lowering context resolves a field of the declaring model to its storage name and to the codec it stores through — `fieldStorageName` and `fieldCodecId` — so a lowering that renders storage-level text never guesses past `@map` or a naming convention, and can refuse a field whose values it cannot express. + +Postgres's `@@fullTextIndex` is the first attribute to use all three. It renders `to_tsvector('', "")` from the resolved column and the same language allowlist the query operations check, and refuses a field that is not stored through a textual codec. Postgres uses such an index only for a query whose expression is the same function over the same configuration literal and the same column — it compares parsed expressions, not text, so qualifying the column or not makes no difference. Sharing one renderer between the attribute, the TypeScript helper and the operations keeps the *rendering* from diverging, but it cannot make the two agree on the configuration: an author who passes one language to the index and another to the operation gets no error, just a sequential scan. + +Anchors: the `{ index }` arm and `repeatable` in [`interpreter.ts`](../../../packages/2-sql/2-authoring/contract-psl/src/interpreter.ts); the attribute in [`authoring.ts`](../../../packages/3-targets/3-targets/postgres/src/core/authoring.ts); the one place its expression is rendered in [`full-text-index-expression.ts`](../../../packages/3-targets/3-targets/postgres/src/core/full-text-index-expression.ts); and [`full-text-index-usage.test.ts`](../../../test/integration/test/sql-builder/full-text-index-usage.test.ts), which proves with `EXPLAIN` against a real server that Postgres chooses the index for the SQL the lanes lower. + ## Alternatives considered **A procedural interpreter hook.** The target registers a callback the interpreter invokes per model, free to inspect and validate anything. Rejected for the same reasons ADR 231 rejects procedural attribute parsing: a hook can do anything, so nothing about it is statically inspectable — the printer, the language server, and the validator each need the *declarative* facts (which attributes exist, what parameters they take, what they require) that a callback hides. Every hook also re-implements parameter parsing and error wording, where descriptors get both generically with uniform diagnostics. And one-per-name descriptor keys make collisions between packs a load-time error instead of a silent override. diff --git a/docs/architecture docs/subsystems/2. Contract Emitter & Types.md b/docs/architecture docs/subsystems/2. Contract Emitter & Types.md index 4693f073f0b3..5b271f282796 100644 --- a/docs/architecture docs/subsystems/2. Contract Emitter & Types.md +++ b/docs/architecture docs/subsystems/2. Contract Emitter & Types.md @@ -218,7 +218,7 @@ Minimal excerpt (SQL): ```typescript // ⚠️ GENERATED FILE - DO NOT EDIT import type { CodecTypes as PgTypes } from '@internal/target-postgres/codec-types'; -import type { OperationTypes as PgOps } from '@internal/adapter-postgres/operation-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, TypeMaps as TypeMapsType } from '@internal/sql-contract/types'; import type { @@ -232,8 +232,18 @@ export type StorageHash = StorageHashBase<'…'>; export type ProfileHash = ProfileHashBase<'…'>; export type CodecTypes = PgTypes; -export type OperationTypes = PgOps; -export type TypeMaps = TypeMapsType; +export type LaneCodecTypes = CodecTypes; +export type QueryOperationTypes = PgTargetQueryOps; +export type AggregateTypes = { /* … per-aggregate codec and trait maps … */ }; +export type TypeMaps = TypeMapsType< + CodecTypes, + QueryOperationTypes, + FieldOutputTypes, + FieldInputTypes, + StorageColumnTypes, + StorageColumnInputTypes, + AggregateTypes +>; type ContractBase = Omit< ContractType<{ readonly storageHash: StorageHash; readonly namespaces: { readonly public: { readonly tables: { /* … storage tables with columns, PKs, FKs, indexes … */ } } } }>, diff --git a/docs/reference/error-reference.md b/docs/reference/error-reference.md index 7d0df3a2ff85..421b55289f01 100644 --- a/docs/reference/error-reference.md +++ b/docs/reference/error-reference.md @@ -379,7 +379,7 @@ A native type name in the contract fails the identifier-safety pattern required ### CONTRACT.PACK_CONTRIBUTION_INVALID -A composed pack's contribution is malformed or collides with another contribution; this is the extension-author-facing bucket. Covers: entity types colliding with reserved helper keys, duplicate entity kinds or index-type registrations, a registered entity kind with no `lowerEntityHandles` lowering, an invalid `indexTypes` shape, entries-slot collisions between a model attribute and a block entry kind, bad authoring-helper paths, a codec registered with an entity-ref arg but no `columnFromEntity` hook, and print-time contribution mismatches (missing/mismatched PSL block descriptor, param descriptor kind disagreeing with the AST node, unregistered codec id, raw literal that is not valid JSON). Raised during contract authoring/lowering and PSL printing. Payload: `packId`, `contribution`, `reason`, `keyword`, `paramName`, `codecId`. +A composed pack's contribution is malformed or collides with another contribution; this is the extension-author-facing bucket. Covers: entity types colliding with reserved helper keys, duplicate entity kinds or index-type registrations, a registered entity kind with no `lowerEntityHandles` lowering, an invalid `indexTypes` shape, entries-slot collisions between a model attribute and a block entry kind, a model attribute that lowers to a malformed index, bad authoring-helper paths, a codec registered with an entity-ref arg but no `columnFromEntity` hook, and print-time contribution mismatches (missing/mismatched PSL block descriptor, param descriptor kind disagreeing with the AST node, unregistered codec id, raw literal that is not valid JSON). Raised during contract authoring/lowering and PSL printing. Payload: `packId`, `contribution`, `reason`, `keyword`, `paramName`, `codecId`. ### CONTRACT.PACK_FAMILY_MISMATCH @@ -723,6 +723,10 @@ Two trait-matching aggregate descriptors for one operation both claim a register A lane terminal (SQL DSL `.build()`, ORM collection terminal) received an annotation whose declared `applicableTo` set does not include the operation kind being built: the runtime check that backs up the type-level annotation validation when it is bypassed via casts or dynamic invocation. Payload: `namespace`, `terminalName`, `kind`, `applicableTo`. +### RUNTIME.ARGUMENT_INVALID + +A built-in Postgres query operation received an argument it cannot use. Today the only such argument is the `language` of `fullTextMatches`, `fullTextRank` and `fullTextHeadline`: the language is written into the SQL as an inline literal rather than a bound parameter, so it is checked against the text-search configurations a stock PostgreSQL server ships with and anything else is refused. Raised while the query is being built, before any SQL reaches the database. Payload: `helper`, `argument`, `received`. + ### RUNTIME.AST_INVALID A lowered SQL AST is structurally invalid: a subquery projecting other than one column, an INSERT with zero rows, a missing column value, an empty onConflict column list or do-update-set, an UPDATE with no SET assignments, an INSERT target table absent from contract storage, or an AST node constructed with invalid arguments (empty FunctionSource column aliases, a CaseExpr with no branches, a raw query declaring a `__proto__` result column, a name that cannot survive as a column, so alias it in SQL and declare the alias). Raised by the Postgres and SQLite SQL renderers and by AST node construction in relational-core. Payload: `node`, `table`, `column`; construction sites carry node-specific fields. diff --git a/examples/bundle-size/src/postgres/generated/contract.d.ts b/examples/bundle-size/src/postgres/generated/contract.d.ts index 202f34df2b86..2ce98494d7f6 100644 --- a/examples/bundle-size/src/postgres/generated/contract.d.ts +++ b/examples/bundle-size/src/postgres/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@prisma/orm-postgres/adapter/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@prisma/orm-postgres/target/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@prisma/orm-postgres/target/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/examples/multi-extension-monorepo/app/src/contract.d.ts b/examples/multi-extension-monorepo/app/src/contract.d.ts index 5dfd8d4219ae..b9379543e26a 100644 --- a/examples/multi-extension-monorepo/app/src/contract.d.ts +++ b/examples/multi-extension-monorepo/app/src/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@prisma/orm-postgres/adapter/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@prisma/orm-postgres/target/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@prisma/orm-postgres/target/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/examples/multi-extension-monorepo/packages/audit/migrations/snapshots/d009a7c12d910e42e7319f0e56ef3113548bd5d3262f06759caf861afd4468f5/contract.d.ts b/examples/multi-extension-monorepo/packages/audit/migrations/snapshots/d009a7c12d910e42e7319f0e56ef3113548bd5d3262f06759caf861afd4468f5/contract.d.ts index a5aa563b3f30..c21b40bb3211 100644 --- a/examples/multi-extension-monorepo/packages/audit/migrations/snapshots/d009a7c12d910e42e7319f0e56ef3113548bd5d3262f06759caf861afd4468f5/contract.d.ts +++ b/examples/multi-extension-monorepo/packages/audit/migrations/snapshots/d009a7c12d910e42e7319f0e56ef3113548bd5d3262f06759caf861afd4468f5/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@prisma/orm-postgres/adapter/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@prisma/orm-postgres/target/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@prisma/orm-postgres/target/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/examples/multi-extension-monorepo/packages/audit/src/contract.d.ts b/examples/multi-extension-monorepo/packages/audit/src/contract.d.ts index a5aa563b3f30..c21b40bb3211 100644 --- a/examples/multi-extension-monorepo/packages/audit/src/contract.d.ts +++ b/examples/multi-extension-monorepo/packages/audit/src/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@prisma/orm-postgres/adapter/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@prisma/orm-postgres/target/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@prisma/orm-postgres/target/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/examples/multi-extension-monorepo/packages/feature-flags/migrations/snapshots/7d110d82b575662c90102339516066ae91f9633527a9fa7c2f2769b714234a98/contract.d.ts b/examples/multi-extension-monorepo/packages/feature-flags/migrations/snapshots/7d110d82b575662c90102339516066ae91f9633527a9fa7c2f2769b714234a98/contract.d.ts index 5ef06876826d..63b8369837a8 100644 --- a/examples/multi-extension-monorepo/packages/feature-flags/migrations/snapshots/7d110d82b575662c90102339516066ae91f9633527a9fa7c2f2769b714234a98/contract.d.ts +++ b/examples/multi-extension-monorepo/packages/feature-flags/migrations/snapshots/7d110d82b575662c90102339516066ae91f9633527a9fa7c2f2769b714234a98/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@prisma/orm-postgres/adapter/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@prisma/orm-postgres/target/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@prisma/orm-postgres/target/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/examples/multi-extension-monorepo/packages/feature-flags/src/contract.d.ts b/examples/multi-extension-monorepo/packages/feature-flags/src/contract.d.ts index 5ef06876826d..63b8369837a8 100644 --- a/examples/multi-extension-monorepo/packages/feature-flags/src/contract.d.ts +++ b/examples/multi-extension-monorepo/packages/feature-flags/src/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@prisma/orm-postgres/adapter/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@prisma/orm-postgres/target/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@prisma/orm-postgres/target/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/examples/paradedb-demo/src/prisma/contract.d.ts b/examples/paradedb-demo/src/prisma/contract.d.ts index 6f4e88dbc51e..28a3745545d9 100644 --- a/examples/paradedb-demo/src/prisma/contract.d.ts +++ b/examples/paradedb-demo/src/prisma/contract.d.ts @@ -2,7 +2,6 @@ // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit import type { QueryOperationTypes as ParadeDbQueryOperationTypes } from '@prisma/orm-extension-paradedb/operation-types'; -import type { QueryOperationTypes as PgAdapterQueryOps } from '@prisma/orm-postgres/adapter/operation-types'; import type { Bit, Char, @@ -20,6 +19,7 @@ import type { VarBit, Varchar, } from '@prisma/orm-postgres/target/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@prisma/orm-postgres/target/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps & +export type QueryOperationTypes = PgTargetQueryOps & ParadeDbQueryOperationTypes; export type AggregateTypes = { readonly avg: { diff --git a/examples/prisma-8-cloudflare-worker/src/prisma/contract.d.ts b/examples/prisma-8-cloudflare-worker/src/prisma/contract.d.ts index e625410526aa..038e8d119c35 100644 --- a/examples/prisma-8-cloudflare-worker/src/prisma/contract.d.ts +++ b/examples/prisma-8-cloudflare-worker/src/prisma/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@prisma/orm-postgres/adapter/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@prisma/orm-postgres/target/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@prisma/orm-postgres/target/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/examples/prisma-8-demo/migrations/snapshots/62d81d607d929760f7d740b45bb97acc1dba361363c4851b19ee5a1cb4fecbe3/contract.d.ts b/examples/prisma-8-demo/migrations/snapshots/62d81d607d929760f7d740b45bb97acc1dba361363c4851b19ee5a1cb4fecbe3/contract.d.ts index 739d76993b05..2bce065a9f84 100644 --- a/examples/prisma-8-demo/migrations/snapshots/62d81d607d929760f7d740b45bb97acc1dba361363c4851b19ee5a1cb4fecbe3/contract.d.ts +++ b/examples/prisma-8-demo/migrations/snapshots/62d81d607d929760f7d740b45bb97acc1dba361363c4851b19ee5a1cb4fecbe3/contract.d.ts @@ -6,7 +6,6 @@ import type { Vector, } from '@prisma/orm-extension-pgvector/codec-types'; import type { QueryOperationTypes as PgVectorQueryOperationTypes } from '@prisma/orm-extension-pgvector/operation-types'; -import type { QueryOperationTypes as PgAdapterQueryOps } from '@prisma/orm-postgres/adapter/operation-types'; import type { Bit, Char, @@ -24,6 +23,7 @@ import type { VarBit, Varchar, } from '@prisma/orm-postgres/target/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@prisma/orm-postgres/target/operation-types'; import type { ContractWithTypeMaps, @@ -47,7 +47,7 @@ export type ProfileHash = export type CodecTypes = PgTypes & PgVectorTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps & +export type QueryOperationTypes = PgTargetQueryOps & PgVectorQueryOperationTypes; export type AggregateTypes = { readonly avg: { diff --git a/examples/prisma-8-demo/migrations/snapshots/8abaa3b97115767c5fee67bcd90de0cec3ac1f14a59875c2f5d22887ba435f89/contract.d.ts b/examples/prisma-8-demo/migrations/snapshots/8abaa3b97115767c5fee67bcd90de0cec3ac1f14a59875c2f5d22887ba435f89/contract.d.ts index 76633874a727..3df91f820b26 100644 --- a/examples/prisma-8-demo/migrations/snapshots/8abaa3b97115767c5fee67bcd90de0cec3ac1f14a59875c2f5d22887ba435f89/contract.d.ts +++ b/examples/prisma-8-demo/migrations/snapshots/8abaa3b97115767c5fee67bcd90de0cec3ac1f14a59875c2f5d22887ba435f89/contract.d.ts @@ -6,7 +6,6 @@ import type { Vector, } from '@prisma/orm-extension-pgvector/codec-types'; import type { QueryOperationTypes as PgVectorQueryOperationTypes } from '@prisma/orm-extension-pgvector/operation-types'; -import type { QueryOperationTypes as PgAdapterQueryOps } from '@prisma/orm-postgres/adapter/operation-types'; import type { Bit, Char, @@ -24,6 +23,7 @@ import type { VarBit, Varchar, } from '@prisma/orm-postgres/target/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@prisma/orm-postgres/target/operation-types'; import type { ContractWithTypeMaps, @@ -47,7 +47,7 @@ export type ProfileHash = export type CodecTypes = PgTypes & PgVectorTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps & +export type QueryOperationTypes = PgTargetQueryOps & PgVectorQueryOperationTypes; export type AggregateTypes = { readonly avg: { diff --git a/examples/prisma-8-demo/migrations/snapshots/f62a4154d0b48cb144ca4f74667fc6922e770f81edd5517393285fb92d07dddc/contract.d.ts b/examples/prisma-8-demo/migrations/snapshots/f62a4154d0b48cb144ca4f74667fc6922e770f81edd5517393285fb92d07dddc/contract.d.ts index 5502cc92b46d..f7eac767011f 100644 --- a/examples/prisma-8-demo/migrations/snapshots/f62a4154d0b48cb144ca4f74667fc6922e770f81edd5517393285fb92d07dddc/contract.d.ts +++ b/examples/prisma-8-demo/migrations/snapshots/f62a4154d0b48cb144ca4f74667fc6922e770f81edd5517393285fb92d07dddc/contract.d.ts @@ -6,7 +6,6 @@ import type { Vector, } from '@prisma/orm-extension-pgvector/codec-types'; import type { QueryOperationTypes as PgVectorQueryOperationTypes } from '@prisma/orm-extension-pgvector/operation-types'; -import type { QueryOperationTypes as PgAdapterQueryOps } from '@prisma/orm-postgres/adapter/operation-types'; import type { Bit, Char, @@ -24,6 +23,7 @@ import type { VarBit, Varchar, } from '@prisma/orm-postgres/target/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@prisma/orm-postgres/target/operation-types'; import type { ContractWithTypeMaps, @@ -47,7 +47,7 @@ export type ProfileHash = export type CodecTypes = PgTypes & PgVectorTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps & +export type QueryOperationTypes = PgTargetQueryOps & PgVectorQueryOperationTypes; export type AggregateTypes = { readonly avg: { diff --git a/examples/prisma-8-demo/src/prisma/contract.d.ts b/examples/prisma-8-demo/src/prisma/contract.d.ts index 739d76993b05..2bce065a9f84 100644 --- a/examples/prisma-8-demo/src/prisma/contract.d.ts +++ b/examples/prisma-8-demo/src/prisma/contract.d.ts @@ -6,7 +6,6 @@ import type { Vector, } from '@prisma/orm-extension-pgvector/codec-types'; import type { QueryOperationTypes as PgVectorQueryOperationTypes } from '@prisma/orm-extension-pgvector/operation-types'; -import type { QueryOperationTypes as PgAdapterQueryOps } from '@prisma/orm-postgres/adapter/operation-types'; import type { Bit, Char, @@ -24,6 +23,7 @@ import type { VarBit, Varchar, } from '@prisma/orm-postgres/target/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@prisma/orm-postgres/target/operation-types'; import type { ContractWithTypeMaps, @@ -47,7 +47,7 @@ export type ProfileHash = export type CodecTypes = PgTypes & PgVectorTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps & +export type QueryOperationTypes = PgTargetQueryOps & PgVectorQueryOperationTypes; export type AggregateTypes = { readonly avg: { diff --git a/examples/prisma-8-postgis-demo/migrations/snapshots/22e2633fb68e81380243a7fb492d650f4b45dcf990f2a3a146744fe8e2277423/contract.d.ts b/examples/prisma-8-postgis-demo/migrations/snapshots/22e2633fb68e81380243a7fb492d650f4b45dcf990f2a3a146744fe8e2277423/contract.d.ts index 53dbb81cca70..5957a498e2f7 100644 --- a/examples/prisma-8-postgis-demo/migrations/snapshots/22e2633fb68e81380243a7fb492d650f4b45dcf990f2a3a146744fe8e2277423/contract.d.ts +++ b/examples/prisma-8-postgis-demo/migrations/snapshots/22e2633fb68e81380243a7fb492d650f4b45dcf990f2a3a146744fe8e2277423/contract.d.ts @@ -6,7 +6,6 @@ import type { Geometry, } from '@prisma/orm-extension-postgis/codec-types'; import type { QueryOperationTypes as PostgisQueryOperationTypes } from '@prisma/orm-extension-postgis/operation-types'; -import type { QueryOperationTypes as PgAdapterQueryOps } from '@prisma/orm-postgres/adapter/operation-types'; import type { Bit, Char, @@ -24,6 +23,7 @@ import type { VarBit, Varchar, } from '@prisma/orm-postgres/target/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@prisma/orm-postgres/target/operation-types'; import type { ContractWithTypeMaps, @@ -47,7 +47,7 @@ export type ProfileHash = export type CodecTypes = PgTypes & PostgisTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps & +export type QueryOperationTypes = PgTargetQueryOps & PostgisQueryOperationTypes; export type AggregateTypes = { readonly avg: { diff --git a/examples/prisma-8-postgis-demo/src/prisma/contract.d.ts b/examples/prisma-8-postgis-demo/src/prisma/contract.d.ts index 53dbb81cca70..5957a498e2f7 100644 --- a/examples/prisma-8-postgis-demo/src/prisma/contract.d.ts +++ b/examples/prisma-8-postgis-demo/src/prisma/contract.d.ts @@ -6,7 +6,6 @@ import type { Geometry, } from '@prisma/orm-extension-postgis/codec-types'; import type { QueryOperationTypes as PostgisQueryOperationTypes } from '@prisma/orm-extension-postgis/operation-types'; -import type { QueryOperationTypes as PgAdapterQueryOps } from '@prisma/orm-postgres/adapter/operation-types'; import type { Bit, Char, @@ -24,6 +23,7 @@ import type { VarBit, Varchar, } from '@prisma/orm-postgres/target/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@prisma/orm-postgres/target/operation-types'; import type { ContractWithTypeMaps, @@ -47,7 +47,7 @@ export type ProfileHash = export type CodecTypes = PgTypes & PostgisTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps & +export type QueryOperationTypes = PgTargetQueryOps & PostgisQueryOperationTypes; export type AggregateTypes = { readonly avg: { diff --git a/examples/prisma7-adoption/generated/prisma8/contract.d.ts b/examples/prisma7-adoption/generated/prisma8/contract.d.ts index edcf1033080a..fe21d66f39cf 100644 --- a/examples/prisma7-adoption/generated/prisma8/contract.d.ts +++ b/examples/prisma7-adoption/generated/prisma8/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@prisma/orm-postgres/adapter/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@prisma/orm-postgres/target/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@prisma/orm-postgres/target/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/examples/react-router-demo/src/prisma/contract.d.ts b/examples/react-router-demo/src/prisma/contract.d.ts index 44cd1726d624..b22e72420051 100644 --- a/examples/react-router-demo/src/prisma/contract.d.ts +++ b/examples/react-router-demo/src/prisma/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@prisma/orm-postgres/adapter/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@prisma/orm-postgres/target/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@prisma/orm-postgres/target/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/examples/supabase/src/contract.d.ts b/examples/supabase/src/contract.d.ts index 06e648fe6430..cd41d199abec 100644 --- a/examples/supabase/src/contract.d.ts +++ b/examples/supabase/src/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@prisma/orm-postgres/adapter/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@prisma/orm-postgres/target/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@prisma/orm-postgres/target/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/packages/0-config/tsdown/shell-testkit.ts b/packages/0-config/tsdown/shell-testkit.ts index caf1ba4acb1c..5ee17901e729 100644 --- a/packages/0-config/tsdown/shell-testkit.ts +++ b/packages/0-config/tsdown/shell-testkit.ts @@ -326,7 +326,6 @@ function shellMapModules(installedPackageDir: string): ReadonlySet { export const knownInternalNamesInDist: readonly string[] = [ '@internal/*', '@internal/adapter-mongo/codec-types', - '@internal/adapter-postgres/operation-types', '@internal/adapter-sqlite/codec-types', '@internal/cli', '@internal/cli-telemetry', @@ -379,6 +378,7 @@ export const knownInternalNamesInDist: readonly string[] = [ '@internal/target-postgres/codec-types', '@internal/target-postgres/codecs', '@internal/target-postgres/errors', + '@internal/target-postgres/operation-types', '@internal/target-sqlite', '@internal/target-sqlite/errors', '@internal/utils', diff --git a/packages/0-shared/publish-surface/src/shells.ts b/packages/0-shared/publish-surface/src/shells.ts index bc5e3330605e..eba28a3f7f00 100644 --- a/packages/0-shared/publish-surface/src/shells.ts +++ b/packages/0-shared/publish-surface/src/shells.ts @@ -640,6 +640,7 @@ export const publicShells: ReadonlyMap = new Map< 'migration', 'native-type-normalizer', 'op-factory-call', + 'operation-types', 'pack', 'planner', 'planner-ddl-builders', diff --git a/packages/0-shared/publish-surface/test/consumer-surface.test.ts b/packages/0-shared/publish-surface/test/consumer-surface.test.ts index d31f064bea4e..d510f2a14f34 100644 --- a/packages/0-shared/publish-surface/test/consumer-surface.test.ts +++ b/packages/0-shared/publish-surface/test/consumer-surface.test.ts @@ -106,9 +106,9 @@ describe('the published surface against the applications that will consume it', '@internal/framework-components/control', '@internal/sql-contract/types', '@internal/mongo-contract', - '@internal/adapter-postgres/operation-types', '@internal/adapter-mongo/codec-types', '@internal/target-postgres/codec-types', + '@internal/target-postgres/operation-types', '@internal/postgres/migration', '@internal/sqlite/migration', '@internal/target-mongo/migration', diff --git a/packages/0-shared/publish-surface/test/import-roots.test.ts b/packages/0-shared/publish-surface/test/import-roots.test.ts index 74ed3964dcaa..a6cb8c574ea8 100644 --- a/packages/0-shared/publish-surface/test/import-roots.test.ts +++ b/packages/0-shared/publish-surface/test/import-roots.test.ts @@ -49,8 +49,8 @@ describe('resolveImportSpecifier', () => { '@prisma/orm-postgres/target/codec-types', ); expect( - resolveImportSpecifier('@internal/adapter-postgres/operation-types', postgresFacade), - ).toBe('@prisma/orm-postgres/adapter/operation-types'); + resolveImportSpecifier('@internal/target-postgres/operation-types', postgresFacade), + ).toBe('@prisma/orm-postgres/target/operation-types'); }); it('resolves the facade package itself to the facade shell', () => { diff --git a/packages/1-framework/1-core/framework-components/src/exports/authoring.ts b/packages/1-framework/1-core/framework-components/src/exports/authoring.ts index d70efe0566e4..9a195e494d88 100644 --- a/packages/1-framework/1-core/framework-components/src/exports/authoring.ts +++ b/packages/1-framework/1-core/framework-components/src/exports/authoring.ts @@ -16,6 +16,8 @@ export type { AuthoringModelAttributeContext, AuthoringModelAttributeDescriptor, AuthoringModelAttributeDescriptorNamespace, + AuthoringModelAttributeEntityOutput, + AuthoringModelAttributeIndexOutput, AuthoringModelAttributeLoweringOutput, AuthoringPslBlockDescriptor, AuthoringPslBlockDescriptorNamespace, diff --git a/packages/1-framework/1-core/framework-components/src/shared/framework-authoring.ts b/packages/1-framework/1-core/framework-components/src/shared/framework-authoring.ts index 6181fc0b654b..006441130332 100644 --- a/packages/1-framework/1-core/framework-components/src/shared/framework-authoring.ts +++ b/packages/1-framework/1-core/framework-components/src/shared/framework-authoring.ts @@ -474,21 +474,53 @@ export interface AuthoringModelAttributeContext extends AuthoringEntityContext { readonly modelName: string; readonly storageName: string; readonly namespaceId: string; + /** + * The storage name a field of the declaring model maps to, or `undefined` + * when the model declares no such field. The interpreter owns the mapping + * — a lowering that renders storage-level text must ask for the name here + * rather than reusing the authored field name, which `@map` may rename. + */ + readonly fieldStorageName: (fieldName: string) => string | undefined; + /** + * The codec a field of the declaring model stores its values through, or + * `undefined` when the model declares no such field or the field is not a + * stored value at all. A lowering that only makes sense over certain value + * kinds checks this rather than guessing from the field's declared type. + */ + readonly fieldCodecId: (fieldName: string) => string | undefined; } /** * What a model-attribute lowering returns when it produces an entity: `key` * is the identity the entity is stored under within its `entries` slot - * (`entries[attribute][key]`); `entity` is the value stored there. A - * lowering that instead pushed a diagnostic through - * {@link AuthoringModelAttributeContext.diagnostics} returns `undefined` — - * the same convention {@link AuthoringEntityTypeFactoryOutput} uses. + * (`entries[attribute][key]`); `entity` is the value stored there. */ -export interface AuthoringModelAttributeLoweringOutput { +export interface AuthoringModelAttributeEntityOutput { readonly key: string; readonly entity: unknown; } +/** + * What a model-attribute lowering returns when it produces an index on the + * declaring model's storage rather than a standalone entity. The framework + * never reads `index`: its shape is the family's authored-index input, which + * the family interpreter narrows and files through the same path its own + * index attribute uses, so naming and validation are shared. + */ +export interface AuthoringModelAttributeIndexOutput { + readonly index: unknown; +} + +/** + * What a model-attribute lowering returns. A lowering that instead pushed a + * diagnostic through {@link AuthoringModelAttributeContext.diagnostics} + * returns `undefined` — the same convention + * {@link AuthoringEntityTypeFactoryOutput} uses. + */ +export type AuthoringModelAttributeLoweringOutput = + | AuthoringModelAttributeEntityOutput + | AuthoringModelAttributeIndexOutput; + /** * Declarative descriptor for an extension-contributed `@@` model attribute. * @@ -512,6 +544,11 @@ export interface AuthoringModelAttributeDescriptor { readonly kind: 'modelAttribute'; readonly attribute: string; readonly spec: unknown; + /** + * Whether one model may declare this attribute more than once. Defaults to + * false, which is what the duplicate diagnostic enforces. + */ + readonly repeatable?: boolean; readonly lower: ( parsed: Out, ctx: AuthoringModelAttributeContext, diff --git a/packages/2-sql/1-core/contract/src/exports/index-naming.ts b/packages/2-sql/1-core/contract/src/exports/index-naming.ts index 316c4589cc02..6cb09a639687 100644 --- a/packages/2-sql/1-core/contract/src/exports/index-naming.ts +++ b/packages/2-sql/1-core/contract/src/exports/index-naming.ts @@ -2,5 +2,6 @@ export { type AuthoredIndexInput, type AuthoredIndexMethod, exactNameBodyWarning, + isAuthoredIndexInput, lowerAuthoredIndex, } from '../index-naming'; diff --git a/packages/2-sql/1-core/contract/src/index-naming.ts b/packages/2-sql/1-core/contract/src/index-naming.ts index d36dff253876..637e7afcb90c 100644 --- a/packages/2-sql/1-core/contract/src/index-naming.ts +++ b/packages/2-sql/1-core/contract/src/index-naming.ts @@ -45,6 +45,39 @@ export type AuthoredIndexInput = AuthoredIndexElements & readonly name: string | undefined; }; +/** + * Narrows the opaque payload a contributed model attribute returns under + * `index` (see `AuthoringModelAttributeIndexOutput`). The framework hands the + * value through untyped because an index's shape belongs to the family; this + * is the SQL family's boundary check. It proves the structure only — the + * name/map and expression rules stay where `@@index` enforces them, in + * {@link lowerAuthoredIndex}. + */ +export function isAuthoredIndexInput(value: unknown): value is AuthoredIndexInput { + if (typeof value !== 'object' || value === null) return false; + const candidate: Record = { ...value }; + const hasExpression = typeof candidate['expression'] === 'string'; + const hasColumns = + Array.isArray(candidate['columns']) && + candidate['columns'].every((element) => typeof element === 'string'); + if (hasExpression === hasColumns) return false; + if (!isOptionalString(candidate['where'])) return false; + if (!isOptionalString(candidate['map'])) return false; + if (!isOptionalString(candidate['name'])) return false; + if (candidate['unique'] !== undefined && typeof candidate['unique'] !== 'boolean') return false; + if (candidate['type'] === undefined) return candidate['options'] === undefined; + if (typeof candidate['type'] !== 'string') return false; + const options = candidate['options']; + return ( + options === undefined || + (typeof options === 'object' && options !== null && !Array.isArray(options)) + ); +} + +function isOptionalString(value: unknown): boolean { + return value === undefined || typeof value === 'string'; +} + const EXACT_NAME_BODY_PREAMBLE = "Drift detection compares the authored SQL text byte-for-byte against Postgres's reprinted form, which is only reliable when the text was captured by contract infer."; diff --git a/packages/2-sql/1-core/operations/README.md b/packages/2-sql/1-core/operations/README.md index 6162628aae5d..d9e7929f54e2 100644 --- a/packages/2-sql/1-core/operations/README.md +++ b/packages/2-sql/1-core/operations/README.md @@ -17,7 +17,7 @@ This package provides SQL-specific operation types that extend the generic `Oper - **SQL Operation Types**: SQL-specific operation entry and descriptor types - `SqlOperationEntry`: Extends `OperationEntry` with a `lowering` field (`SqlLoweringSpec`) - `SqlOperationDescriptor`: Alias for `SqlOperationEntry` used at registration sites - - `SqlOperationDescriptors`: `Readonly>` — the keyed-record shape adapter/extension `queryOperations()` factories return + - `SqlOperationDescriptors`: `Readonly>` — the keyed-record shape target/adapter/extension `queryOperations()` factories return - `SqlLoweringSpec`: SQL-specific lowering specification (`targetFamily`, `strategy`, `template`) - `SqlOperationRegistry`: Typed registry alias (`OperationRegistry`) diff --git a/packages/2-sql/2-authoring/contract-psl/src/interpreter.ts b/packages/2-sql/2-authoring/contract-psl/src/interpreter.ts index 99291dfb0caa..f5b24226c110 100644 --- a/packages/2-sql/2-authoring/contract-psl/src/interpreter.ts +++ b/packages/2-sql/2-authoring/contract-psl/src/interpreter.ts @@ -64,6 +64,7 @@ import { } from '@internal/psl-parser'; import { fkRelationPairKey, type InvalidFkPairing } from '@internal/psl-parser/interpret'; import type { DocumentAst, PslSources } from '@internal/psl-parser/syntax'; +import { isAuthoredIndexInput } from '@internal/sql-contract/index-naming'; import type { SqlModelStorage, SqlNamespaceBase, @@ -1117,7 +1118,10 @@ function buildModelNodeFromPsl(input: BuildModelNodeInput): BuildModelNodeResult } const contributedModelAttribute = input.modelAttributesByName.get(modelAttribute.name); if (contributedModelAttribute !== undefined) { - if (declaredContributedModelAttributes.has(modelAttribute.name)) { + if ( + contributedModelAttribute.repeatable !== true && + declaredContributedModelAttributes.has(modelAttribute.name) + ) { diagnostics.push( duplicateModelAttributeDiagnostic({ name: modelAttribute.name, @@ -1166,6 +1170,9 @@ function buildModelNodeFromPsl(input: BuildModelNodeInput): BuildModelNodeResult target: input.targetId, modelName: model.name, storageName: tableName, + fieldStorageName: (fieldName) => mapping.fieldColumns.get(fieldName), + fieldCodecId: (fieldName) => + resolvedFields.find((resolved) => resolved.field.name === fieldName)?.descriptor.codecId, namespaceId: modelNamespaceId ?? input.defaultNamespaceId, sourceId: source.sources.sourceFileFor(source.node).filename, diagnostics: { @@ -1179,6 +1186,17 @@ function buildModelNodeFromPsl(input: BuildModelNodeInput): BuildModelNodeResult if (lowered === undefined) { continue; } + if ('index' in lowered) { + if (!isAuthoredIndexInput(lowered.index)) { + throw contractError( + 'CONTRACT.PACK_CONTRIBUTION_INVALID', + `model attribute "@@${modelAttribute.name}" on model "${model.name}" lowered to a malformed index. A contributed attribute that returns { index } must return an authored-index input: exactly one of a columns list or an expression, plus explicit where/unique/name/map and a type-with-options pair.`, + { meta: { attribute: modelAttribute.name, modelName: model.name } }, + ); + } + indexNodes.push(lowered.index); + continue; + } const slot = modelAttributeEntities[contributedModelAttribute.attribute] ?? {}; modelAttributeEntities[contributedModelAttribute.attribute] = slot; slot[lowered.key] = lowered.entity; diff --git a/packages/2-sql/2-authoring/contract-psl/test/interpreter.model-attribute-indexes.test.ts b/packages/2-sql/2-authoring/contract-psl/test/interpreter.model-attribute-indexes.test.ts new file mode 100644 index 000000000000..e25b08c3ce93 --- /dev/null +++ b/packages/2-sql/2-authoring/contract-psl/test/interpreter.model-attribute-indexes.test.ts @@ -0,0 +1,184 @@ +/** + * A contributed model attribute may lower to a table index instead of a + * namespaced entity. The interpreter files it through the same path `@@index` + * uses, so naming and validation are shared rather than duplicated. + */ +import type { AuthoringContributions } from '@internal/framework-components/authoring'; +import type { ModelAttributeSpecFactory } from '@internal/psl-parser'; +import { fieldRef, list, modelAttribute, optional, str } from '@internal/psl-parser'; +import { defineIndexTypes } from '@internal/sql-contract/index-types'; +import { type } from 'arktype'; +import { describe, expect, it } from 'vitest'; +import { createTestSqlNamespace } from '../../../1-core/contract/test/test-support'; +import { interpretPslDocumentToSqlContract } from '../src/interpreter'; +import { + createBuiltinLikeControlMutationDefaults, + postgresScalarTypeDescriptors, + postgresTarget, + symbolTableInputFromParseArgs, +} from './fixtures'; +import { sqlStorageFromSuccessfulSqlInterpretation } from './interpret-sql-contract-storage'; +import { unboundTables } from './unbound-tables'; + +const builtinControlMutationDefaults = createBuiltinLikeControlMutationDefaults(); + +/** + * The contributed index goes through the target's index-type registration + * like any other, so the test target has to register the method it names. + */ +const targetWithIndexTypes = { + ...postgresTarget, + indexTypes: defineIndexTypes().add('gin', { options: type('object') }), +}; + +const searchIndexSpecFactory: ModelAttributeSpecFactory = () => + modelAttribute('searchIndex', { + documentation: 'Indexes one text column for full-text search.', + positional: [ + { + key: 'fields', + type: list(fieldRef(), { allowEmpty: false, unique: true }), + documentation: 'The single field to index.', + }, + ], + named: { + name: { type: optional(str()), documentation: 'Wire-name prefix for the index.' }, + }, + }); + +type SearchIndexParsed = { readonly fields: readonly string[]; readonly name?: string }; + +function searchIndexContributions(repeatable?: boolean): AuthoringContributions { + return { + modelAttributes: { + searchIndex: { + kind: 'modelAttribute', + attribute: 'searchIndex', + spec: searchIndexSpecFactory, + ...(repeatable === undefined ? {} : { repeatable }), + lower: (parsed: SearchIndexParsed, ctx) => { + const field = parsed.fields[0]; + if (field === undefined) return undefined; + const storageName = ctx.fieldStorageName(field); + if (storageName === undefined) return undefined; + return { + index: { + expression: `to_tsvector('english', "${storageName}")`, + type: 'gin', + // `undefined`, not `{}`: the string form leaves `options` + // absent when the author writes none, and an empty bag would + // make the two forms differ in the emitted contract. + options: undefined, + where: undefined, + unique: undefined, + map: undefined, + name: parsed.name, + }, + }; + }, + }, + }, + }; +} + +function interpret(schema: string, authoringContributions?: AuthoringContributions) { + const document = symbolTableInputFromParseArgs({ schema, sourceId: 'schema.prisma' }); + return interpretPslDocumentToSqlContract({ + ...document, + target: targetWithIndexTypes, + scalarColumnDescriptors: postgresScalarTypeDescriptors, + composedExtensionContracts: new Map(), + controlMutationDefaults: builtinControlMutationDefaults, + createNamespace: createTestSqlNamespace, + capabilities: { sql: { scalarList: true } }, + ...(authoringContributions !== undefined ? { authoringContributions } : {}), + }); +} + +function indexesOf(schema: string, authoringContributions?: AuthoringContributions) { + const result = interpret(schema, authoringContributions); + expect(result.ok).toBe(true); + if (!result.ok) return []; + return unboundTables(sqlStorageFromSuccessfulSqlInterpretation(result.value))['Message']!.indexes; +} + +describe('a contributed model attribute that lowers to an index', () => { + it('produces the same index as the equivalent @@index(expression:)', () => { + const contributed = indexesOf( + `model Message { + id Int @id + text String + @@searchIndex([text], name: "message_text_search") +}`, + searchIndexContributions(), + ); + + const authored = indexesOf( + `model Message { + id Int @id + text String + @@index(expression: "to_tsvector('english', \\"text\\")", type: "gin", name: "message_text_search") +}`, + ); + + expect(contributed).toEqual(authored); + expect(contributed).toHaveLength(1); + }); + + it('renders the storage column name of a renamed field, not the field name', () => { + const indexes = indexesOf( + `model Message { + id Int @id + text String @map("body_text") + @@searchIndex([text], name: "message_text_search") +}`, + searchIndexContributions(), + ); + + expect(indexes[0]).toMatchObject({ + expression: `to_tsvector('english', "body_text")`, + }); + }); + + it('files two indexes when the descriptor is repeatable', () => { + const indexes = indexesOf( + `model Message { + id Int @id + text String + summary String + @@searchIndex([text], name: "message_text_search") + @@searchIndex([summary], name: "message_summary_search") +}`, + searchIndexContributions(true), + ); + + expect(indexes.map((index) => index.prefix)).toEqual([ + 'message_text_search', + 'message_summary_search', + ]); + }); + + it('still rejects a duplicate when the descriptor is not repeatable', () => { + const result = interpret( + `model Message { + id Int @id + text String + summary String + @@searchIndex([text], name: "message_text_search") + @@searchIndex([summary], name: "message_summary_search") +}`, + searchIndexContributions(), + ); + + expect(result.ok).toBe(false); + if (result.ok) return; + expect(result.failure.diagnostics).toEqual( + expect.arrayContaining([ + expect.objectContaining({ + code: 'PSL_DUPLICATE_ATTRIBUTE', + message: '`@@searchIndex` declared more than once on model "Message".', + }), + ]), + ); + }); +}); diff --git a/packages/2-sql/2-authoring/contract-ts/README.md b/packages/2-sql/2-authoring/contract-ts/README.md index 3c647795f08a..d8101e7d67a6 100644 --- a/packages/2-sql/2-authoring/contract-ts/README.md +++ b/packages/2-sql/2-authoring/contract-ts/README.md @@ -245,6 +245,8 @@ constraints.index({ expression: 'eql_v3.eq_term(email)', name: 'users_email_eq' - **Fields form** — `constraints.index(cols | [cols...], options?)`. Options: `unique?`, `where?` (partial-index predicate, WHERE body without the keyword), `name?` xor `map?`, and — when the target pack registers index types — `type?` paired with its `options?` (e.g. `type: 'hash', options: {}`). The pack-typed arm requires the `options` key at compile time; PSL accepts `type:` without `options:` (absent validates as `{}`) — both lower to the same IR. - **Expression form** — `constraints.index({ expression, ...options })`. The expression is the whole CREATE INDEX element list as one opaque string; `name` or `map` is required (no default name can be derived from an expression). Same remaining options as the fields form. + The expression may instead be `{ fields, render }`, which defers rendering until lowering knows the storage column names: `fields` are `ColumnRef`s resolved exactly as the fields form resolves them — a `.column()` override first, then the contract's column naming convention — and `render` receives the resolved names in order and returns the element list. Use this whenever the expression names a column, because neither the override nor the naming convention is knowable while the model is being authored; a string written by hand silently stops matching the column it names when either changes. The rendered string is what reaches the IR, so nothing downstream sees a new shape. The Postgres facade's `fullTextIndex(cols.text, { name })` is built this way. + `name:` declares a **wire-named** index: the physical name is `_<8-hex content hash>`, and renames plan as `ALTER INDEX … RENAME`. `map:` adopts an **exact** physical name verbatim (no hash) — intended for objects captured by `contract infer`. Combining `map:` with a SQL body (`expression`/`where`) emits the `PN_EXACT_NAME_BODY_COMPARISON` warning at build time: drift detection byte-compares the authored text against Postgres's reprinted form, which is only reliable for infer-captured text. Prefer `name:` for hand-authored bodies. ### Helper Notes diff --git a/packages/2-sql/2-authoring/contract-ts/src/contract-dsl.ts b/packages/2-sql/2-authoring/contract-ts/src/contract-dsl.ts index 94526bace037..4a99e99ee293 100644 --- a/packages/2-sql/2-authoring/contract-ts/src/contract-dsl.ts +++ b/packages/2-sql/2-authoring/contract-ts/src/contract-dsl.ts @@ -841,7 +841,7 @@ type IndexInput< type ExpressionIndexInput< Name extends string | undefined, IndexTypes extends IndexTypeMap, -> = IndexInput & { readonly expression: string }; +> = IndexInput & { readonly expression: IndexExpressionInput }; type ForeignKeyOptions = ConstraintOptions & { @@ -870,6 +870,30 @@ export type UniqueConstraint string; +}; + +/** Opaque SQL, either written out or rendered at lowering. */ +export type IndexExpressionInput = string | DeferredIndexExpression; + /** An authored index constraint's element structure — field tuple xor expression. */ export type IndexConstraintElements = | { @@ -880,7 +904,7 @@ export type IndexConstraintElements, + expression: DeferredIndexExpression, + fieldCodecIds: Readonly>, +): readonly DeferredIndexColumn[] { + const fieldNames = expression.fields.map((ref) => ref.fieldName); + const columnNames = mapFieldNamesToColumnNames(spec.modelName, fieldNames, spec.fieldToColumn); + return fieldNames.map((fieldName, position) => { + const name = columnNames[position]; + const codecId = fieldCodecIds[fieldName]; + if (name === undefined || codecId === undefined) { + throw new InternalError( + `Deferred index expression on "${spec.modelName}" resolved no column for field "${fieldName}"`, + ); + } + return { name, codecId }; + }); +} + function resolveModelNode( spec: RuntimeModelSpec, allSpecs: ReadonlyMap, @@ -824,6 +850,8 @@ function resolveModelNode( extensions?: Record>, ): ModelNode { const fields: FieldNode[] = []; + /** Filled by the field loop below, read by a deferred index expression. */ + const fieldCodecIds: Record = {}; for (const [fieldName, fieldBuilder] of Object.entries(spec.fieldBuilders)) { const fieldState = fieldBuilder.build(); @@ -838,6 +866,7 @@ function resolveModelNode( if (!columnName) { throw new InternalError(`Column name resolution failed for "${spec.modelName}.${fieldName}"`); } + fieldCodecIds[fieldName] = descriptor.codecId; const enumHandle = 'typeRef' in fieldState && isEnumTypeHandle(fieldState.typeRef) @@ -879,7 +908,15 @@ function resolveModelNode( ...method, }; return index.expression !== undefined - ? { ...carried, expression: index.expression } + ? { + ...carried, + expression: + typeof index.expression === 'string' + ? index.expression + : index.expression.render( + resolveDeferredColumns(spec, index.expression, fieldCodecIds), + ), + } : { ...carried, columns: mapFieldNamesToColumnNames( diff --git a/packages/2-sql/2-authoring/contract-ts/src/exports/contract-builder.ts b/packages/2-sql/2-authoring/contract-ts/src/exports/contract-builder.ts index 2c72c06829eb..e073434daa18 100644 --- a/packages/2-sql/2-authoring/contract-ts/src/exports/contract-builder.ts +++ b/packages/2-sql/2-authoring/contract-ts/src/exports/contract-builder.ts @@ -30,7 +30,15 @@ export type { RelationNode, UniqueConstraintNode, } from '../contract-definition'; -export type { CheckKind, TargetFieldRef } from '../contract-dsl'; +export type { + CheckKind, + ColumnRef, + DeferredIndexColumn, + DeferredIndexExpression, + IndexConstraint, + IndexExpressionInput, + TargetFieldRef, +} from '../contract-dsl'; export { buildContractDefinition } from '../contract-lowering'; export type { ExtractCodecTypesFromPack } from '../contract-types'; export { autoincrement, now } from '../default-functions'; diff --git a/packages/2-sql/2-authoring/contract-ts/test/contract-builder.deferred-index-expression.test.ts b/packages/2-sql/2-authoring/contract-ts/test/contract-builder.deferred-index-expression.test.ts new file mode 100644 index 000000000000..a83221d9102f --- /dev/null +++ b/packages/2-sql/2-authoring/contract-ts/test/contract-builder.deferred-index-expression.test.ts @@ -0,0 +1,113 @@ +/** + * An index expression may be deferred: the author names fields and supplies a + * renderer, and lowering resolves each field to its storage column before + * rendering. That is the only way an expression index can survive a + * `.column()` override or a contract-level column naming convention, both of + * which are unknown while the model is being authored. + */ +import type { FamilyPackRef, TargetPackRef } from '@internal/framework-components/components'; +import { describe, expect, it } from 'vitest'; +import { createTestSqlNamespace } from '../../../1-core/contract/test/test-support'; +import { type ContractInput, defineContract, field, model } from '../src/contract-builder'; +import type { DeferredIndexColumn } from '../src/contract-dsl'; +import { columnDescriptor } from './helpers/column-descriptor'; +import { unboundTables } from './unbound-tables'; + +const int4Column = columnDescriptor('pg/int4@1'); +const textColumn = columnDescriptor('pg/text@1'); + +const bareFamilyPack: FamilyPackRef<'sql'> = { + kind: 'family', + id: 'sql', + familyId: 'sql', + version: '0.0.1', +}; + +const postgresTargetPack: TargetPackRef<'sql', 'postgres'> = { + kind: 'target', + id: 'postgres', + familyId: 'sql', + targetId: 'postgres', + version: '0.0.1', + defaultNamespaceId: 'public', +}; + +const render = (columns: readonly DeferredIndexColumn[]) => + `to_tsvector('english', "${columns[0]?.name}")`; + +function messageIndexes(options: { + readonly mappedColumn?: string; + readonly naming?: ContractInput['naming']; +}) { + const searchText = options.mappedColumn + ? field.column(textColumn).column(options.mappedColumn) + : field.column(textColumn); + const contract = defineContract({ + family: bareFamilyPack, + target: postgresTargetPack, + createNamespace: createTestSqlNamespace, + ...(options.naming !== undefined ? { naming: options.naming } : {}), + models: { + Message: model('Message', { + fields: { id: field.column(int4Column).id(), searchText }, + }).sql(({ cols, constraints }) => ({ + table: 'message', + indexes: [ + constraints.index({ + expression: { fields: [cols.searchText], render }, + name: 'message_text_search', + }), + ], + })), + }, + }); + return unboundTables(contract.storage)['message']!.indexes; +} + +describe('a deferred index expression', () => { + it('renders the column name the default mapping produces', () => { + expect(messageIndexes({})[0]).toMatchObject({ + expression: `to_tsvector('english', "searchText")`, + prefix: 'message_text_search', + }); + }); + + it('renders a .column() override, not the field name', () => { + expect(messageIndexes({ mappedColumn: 'body_text' })[0]).toMatchObject({ + expression: `to_tsvector('english', "body_text")`, + }); + }); + + it("renders the contract's column naming convention", () => { + expect(messageIndexes({ naming: { columns: 'snake_case' } })[0]).toMatchObject({ + expression: `to_tsvector('english', "search_text")`, + }); + }); + + it('lowers to exactly what the equivalent string expression lowers to', () => { + const deferred = messageIndexes({ mappedColumn: 'body_text' }); + const literal = defineContract({ + family: bareFamilyPack, + target: postgresTargetPack, + createNamespace: createTestSqlNamespace, + models: { + Message: model('Message', { + fields: { + id: field.column(int4Column).id(), + searchText: field.column(textColumn).column('body_text'), + }, + }).sql(({ constraints }) => ({ + table: 'message', + indexes: [ + constraints.index({ + expression: `to_tsvector('english', "body_text")`, + name: 'message_text_search', + }), + ], + })), + }, + }); + + expect(deferred).toEqual(unboundTables(literal.storage)['message']!.indexes); + }); +}); diff --git a/packages/2-sql/3-tooling/emitter/test/import-roots.test.ts b/packages/2-sql/3-tooling/emitter/test/import-roots.test.ts index a732daf6e0f1..b475b666df6f 100644 --- a/packages/2-sql/3-tooling/emitter/test/import-roots.test.ts +++ b/packages/2-sql/3-tooling/emitter/test/import-roots.test.ts @@ -35,7 +35,7 @@ const codecTypeImports: TypesImportSpec[] = [ ]; const queryOperationTypeImports: TypesImportSpec[] = [ { - package: '@internal/adapter-postgres/operation-types', + package: '@internal/target-postgres/operation-types', named: 'QueryOperationTypes', alias: 'PgQueryOps', }, @@ -82,21 +82,21 @@ function emit(root: ImportRoot): string { describe('emitted contract types under each import root', () => { it('names workspace packages under the internal root', () => { expect(importedSpecifiers(emit(internalImportRoot)).sort()).toEqual([ - '@internal/adapter-postgres/operation-types', '@internal/contract/types', '@internal/extension-pgvector/codec-types', '@internal/sql-contract/types', '@internal/target-postgres/codec-types', + '@internal/target-postgres/operation-types', ]); }); it('names the facade and the extension pack under the facade root', () => { expect(importedSpecifiers(emit(postgresFacade)).sort()).toEqual([ '@prisma/orm-extension-pgvector/codec-types', - '@prisma/orm-postgres/adapter/operation-types', '@prisma/orm-postgres/contract/types', '@prisma/orm-postgres/family-contract/types', '@prisma/orm-postgres/target/codec-types', + '@prisma/orm-postgres/target/operation-types', ]); }); @@ -105,8 +105,8 @@ describe('emitted contract types under each import root', () => { '@prisma/orm-extension-pgvector/codec-types', '@prisma/orm-family-sql/contract/types', '@prisma/orm-framework/contract/types', - '@prisma/orm-target-postgres/adapter/operation-types', '@prisma/orm-target-postgres/target/codec-types', + '@prisma/orm-target-postgres/target/operation-types', ]); }); diff --git a/packages/2-sql/4-lanes/sql-builder/test/fixtures/generated/contract.d.ts b/packages/2-sql/4-lanes/sql-builder/test/fixtures/generated/contract.d.ts index 8c8cd56d6ba7..3a2844b6bdee 100644 --- a/packages/2-sql/4-lanes/sql-builder/test/fixtures/generated/contract.d.ts +++ b/packages/2-sql/4-lanes/sql-builder/test/fixtures/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/packages/3-extensions/paradedb/migrations/snapshots/0c0734babd6eeb868fee1f281ca96963022475611560e9f170f465daa35f8599/contract.d.ts b/packages/3-extensions/paradedb/migrations/snapshots/0c0734babd6eeb868fee1f281ca96963022475611560e9f170f465daa35f8599/contract.d.ts index e3612c17ca8e..8513ae8dc8d0 100644 --- a/packages/3-extensions/paradedb/migrations/snapshots/0c0734babd6eeb868fee1f281ca96963022475611560e9f170f465daa35f8599/contract.d.ts +++ b/packages/3-extensions/paradedb/migrations/snapshots/0c0734babd6eeb868fee1f281ca96963022475611560e9f170f465daa35f8599/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/packages/3-extensions/paradedb/src/contract.d.ts b/packages/3-extensions/paradedb/src/contract.d.ts index e3612c17ca8e..8513ae8dc8d0 100644 --- a/packages/3-extensions/paradedb/src/contract.d.ts +++ b/packages/3-extensions/paradedb/src/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/packages/3-extensions/pgvector/migrations/snapshots/3d2c56a2944685bd21b05bc8a8d73164397df51c014201902932fbe7e80ff1b8/contract.d.ts b/packages/3-extensions/pgvector/migrations/snapshots/3d2c56a2944685bd21b05bc8a8d73164397df51c014201902932fbe7e80ff1b8/contract.d.ts index dd99835bbcd0..7aac63d62956 100644 --- a/packages/3-extensions/pgvector/migrations/snapshots/3d2c56a2944685bd21b05bc8a8d73164397df51c014201902932fbe7e80ff1b8/contract.d.ts +++ b/packages/3-extensions/pgvector/migrations/snapshots/3d2c56a2944685bd21b05bc8a8d73164397df51c014201902932fbe7e80ff1b8/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/packages/3-extensions/pgvector/src/contract.d.ts b/packages/3-extensions/pgvector/src/contract.d.ts index dd99835bbcd0..7aac63d62956 100644 --- a/packages/3-extensions/pgvector/src/contract.d.ts +++ b/packages/3-extensions/pgvector/src/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/packages/3-extensions/postgis/migrations/snapshots/7e98a4d9437e6be2f2fa7fca02fbc01c245586997a937f97cab60788612512e5/contract.d.ts b/packages/3-extensions/postgis/migrations/snapshots/7e98a4d9437e6be2f2fa7fca02fbc01c245586997a937f97cab60788612512e5/contract.d.ts index 334302c418cd..dd30ccfea43e 100644 --- a/packages/3-extensions/postgis/migrations/snapshots/7e98a4d9437e6be2f2fa7fca02fbc01c245586997a937f97cab60788612512e5/contract.d.ts +++ b/packages/3-extensions/postgis/migrations/snapshots/7e98a4d9437e6be2f2fa7fca02fbc01c245586997a937f97cab60788612512e5/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/packages/3-extensions/postgis/src/contract.d.ts b/packages/3-extensions/postgis/src/contract.d.ts index 334302c418cd..dd30ccfea43e 100644 --- a/packages/3-extensions/postgis/src/contract.d.ts +++ b/packages/3-extensions/postgis/src/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/packages/3-extensions/postgres/src/contract/full-text-index.ts b/packages/3-extensions/postgres/src/contract/full-text-index.ts new file mode 100644 index 000000000000..b9a594365628 --- /dev/null +++ b/packages/3-extensions/postgres/src/contract/full-text-index.ts @@ -0,0 +1,92 @@ +import type { ColumnRef, IndexConstraint } from '@internal/sql-contract-ts/contract-builder'; +import type { FullTextSearchLanguage } from '@internal/target-postgres/operation-types'; +import { + DEFAULT_FULL_TEXT_SEARCH_LANGUAGE, + isFullTextIndexableCodec, + renderFullTextIndexExpression, +} from '@internal/target-postgres/sql-utils'; +import { invariant } from '@internal/utils/assertions'; +import { postgresError } from '../errors'; + +type FullTextIndexOptionsBase = { + readonly language?: FullTextSearchLanguage; + /** The SQL predicate restricting rows included in a partial index. */ + readonly where?: string; +}; + +/** + * The wire-named form. `Name` stays literal so the model's `sql()` stage sees the + * index's name and refuses a duplicate, exactly as it does for `constraints.index`. + */ +type FullTextIndexNameOptions = FullTextIndexOptionsBase & { + readonly name: Name; + readonly map?: never; +}; + +/** The exact-named form: `map` is adopted verbatim and carries no wire name. */ +type FullTextIndexMapOptions = FullTextIndexOptionsBase & { + readonly map: string; + readonly name?: never; +}; + +type FullTextIndexOptions = FullTextIndexNameOptions | FullTextIndexMapOptions; + +/** + * A GIN index over the `to_tsvector` expression `fullTextMatches`, + * `fullTextRank` and `fullTextHeadline` lower to — the TypeScript twin of + * `@@fullTextIndex`. Pass it to a model's `sql({ indexes: [...] })`. + * + * The expression is rendered at lowering, once the column's storage name is + * known, so a `.column()` override or a column naming convention is honoured + * rather than guessed. Pass the same `language` here and to the operation: a + * mismatch is not an error, the query simply stops using the index. + */ +export function fullTextIndex( + column: ColumnRef, + options: FullTextIndexNameOptions, +): IndexConstraint; +export function fullTextIndex( + column: ColumnRef, + options: FullTextIndexMapOptions, +): IndexConstraint; +export function fullTextIndex( + column: ColumnRef, + options: FullTextIndexOptions, +): IndexConstraint { + const language = options.language ?? DEFAULT_FULL_TEXT_SEARCH_LANGUAGE; + return { + kind: 'index', + expression: { + fields: [column], + render: (columns) => { + const resolved = columns[0]; + // Lowering resolves one column per field it was given, or raises + // `CONTRACT.FIELD_UNKNOWN`; this helper hands it exactly one. + invariant( + resolved !== undefined, + `fullTextIndex resolved no column for field "${column.fieldName}"`, + ); + if (!isFullTextIndexableCodec(resolved.codecId)) { + throw postgresError( + 'CONTRACT.INDEX_INVALID', + `fullTextIndex indexes a text column, but "${column.fieldName}" is stored as \`${resolved.codecId}\`.`, + { + why: 'to_tsvector takes text; Postgres rejects the CREATE INDEX for any other column type.', + fix: 'Index a text, varchar, char or enum column, or drop the index.', + meta: { + helper: 'fullTextIndex', + fieldName: column.fieldName, + codecId: resolved.codecId, + }, + }, + ); + } + return renderFullTextIndexExpression(language, resolved.name); + }, + }, + type: 'gin', + ...(options.where !== undefined ? { where: options.where } : {}), + ...(options.name !== undefined ? { name: options.name } : {}), + ...(options.map !== undefined ? { map: options.map } : {}), + }; +} diff --git a/packages/3-extensions/postgres/src/errors.ts b/packages/3-extensions/postgres/src/errors.ts index 1254dc871b8d..8b4b4dbfdb7c 100644 --- a/packages/3-extensions/postgres/src/errors.ts +++ b/packages/3-extensions/postgres/src/errors.ts @@ -3,6 +3,7 @@ import { structuredError } from '@internal/utils/structured-error'; export type PostgresErrorCode = | 'CONTRACT.ENUM_INVALID' + | 'CONTRACT.INDEX_INVALID' | 'CONTRACT.POLICY_INVALID' | 'RUNTIME.BINDING_INVALID' | 'RUNTIME.BINDING_MISSING' diff --git a/packages/3-extensions/postgres/src/exports/contract-builder.ts b/packages/3-extensions/postgres/src/exports/contract-builder.ts index d55f725af220..464728f0b425 100644 --- a/packages/3-extensions/postgres/src/exports/contract-builder.ts +++ b/packages/3-extensions/postgres/src/exports/contract-builder.ts @@ -28,6 +28,7 @@ export { } from '@internal/sql-contract-ts/contract-builder'; export { defineContract } from '../contract/define-contract'; export { enumType } from '../contract/enum-type'; +export { fullTextIndex } from '../contract/full-text-index'; export { type NativeEnumHandle, nativeEnum, pg } from '../contract/native-enum'; export { policyAll, diff --git a/packages/3-extensions/postgres/test/contract-builder/full-text-index.test-d.ts b/packages/3-extensions/postgres/test/contract-builder/full-text-index.test-d.ts new file mode 100644 index 000000000000..27015642d1f4 --- /dev/null +++ b/packages/3-extensions/postgres/test/contract-builder/full-text-index.test-d.ts @@ -0,0 +1,46 @@ +/** + * `fullTextIndex` keeps its `name` literal, so the model's `sql()` stage can see + * the index's name and refuse a duplicate exactly as it does for + * `constraints.index`. A `map:` index carries no wire name and so never collides. + */ +import type { ColumnRef } from '@internal/sql-contract-ts/contract-builder'; +import { expectTypeOf, test } from 'vitest'; +import { field, fullTextIndex, model } from '../../src/exports/contract-builder'; + +const intColumn = { codecId: 'pg/int4@1', nativeType: 'int4' } as const; +const textColumn = { codecId: 'pg/text@1', nativeType: 'text' } as const; + +const fields = { id: field.column(intColumn).id(), text: field.column(textColumn) }; + +test('the name stays literal rather than widening to string', () => { + const index = fullTextIndex<'message_search'>( + { kind: 'columnRef', fieldName: 'text' }, + { name: 'message_search' }, + ); + expectTypeOf(index.name).toEqualTypeOf<'message_search' | undefined>(); +}); + +test('a map: index carries no wire name', () => { + const index = fullTextIndex({ kind: 'columnRef', fieldName: 'text' }, { map: 'message_search' }); + expectTypeOf(index.name).toEqualTypeOf(); +}); + +/** + * Duplicate-name detection does not currently fire for indexes from either + * helper: `constraints.index` is reachable only inside `sql(callback)`, which + * widens the returned tuple, and `IndexConstraint.name` is optional, so + * `NamedConstraintLiteralName` sees `Name | undefined` rather than a literal. + * Keeping `Name` literal here is the half this helper owns; the day the check + * starts biting, it bites this helper too. + */ +test('two indexes with distinct names are accepted in the object form', () => { + const text: ColumnRef<'text'> = { kind: 'columnRef', fieldName: 'text' }; + + model('Message', { fields }).sql({ + table: 'message', + indexes: [ + fullTextIndex(text, { name: 'message_search' }), + fullTextIndex(text, { language: 'german', name: 'message_search_de' }), + ], + }); +}); diff --git a/packages/3-extensions/postgres/test/contract-builder/full-text-index.test.ts b/packages/3-extensions/postgres/test/contract-builder/full-text-index.test.ts new file mode 100644 index 000000000000..1eba80269a6f --- /dev/null +++ b/packages/3-extensions/postgres/test/contract-builder/full-text-index.test.ts @@ -0,0 +1,185 @@ +/** + * `fullTextIndex(cols.x, { name })` is the TypeScript twin of + * `@@fullTextIndex([x], name: …)`. Both render the expression the full-text + * operations lower to, from the resolved storage column, so the two surfaces + * produce the same index for the same model. + */ +import { assembleAuthoringContributions } from '@internal/framework-components/control'; +import { buildSymbolTable } from '@internal/psl-parser'; +import { parse } from '@internal/psl-parser/syntax'; +import { interpretPslDocumentToSqlContract } from '@internal/sql-contract-psl'; +import postgresTargetControl from '@internal/target-postgres/control'; +import postgresPack from '@internal/target-postgres/pack'; +import { + DEFAULT_FULL_TEXT_SEARCH_LANGUAGE, + renderFullTextIndexExpression, +} from '@internal/target-postgres/sql-utils'; +import { postgresCreateNamespace } from '@internal/target-postgres/types'; +import { blindCast } from '@internal/utils/casts'; +import { describe, expect, it } from 'vitest'; +import { defineContract, field, fullTextIndex, model } from '../../src/exports/contract-builder'; + +/** + * Both surfaces file the index onto the namespace's `message` table; the two + * namespace values have different static types, so this reads the one shape + * both share. + */ +function indexesOfPublicMessage( + namespace: unknown, +): readonly { expression?: string; where?: string }[] { + const table = blindCast< + { + readonly table?: Record< + string, + { readonly indexes?: readonly { expression?: string; where?: string }[] } + >; + }, + 'both the PSL and the TS build produce a Postgres namespace; only its indexes are read here' + >(namespace).table; + return table?.['message']?.indexes ?? []; +} + +const intColumn = { codecId: 'pg/int4@1', nativeType: 'int4' } as const; +const textColumn = { codecId: 'pg/text@1', nativeType: 'text' } as const; + +const PSL = ` +model Message { + id Int @id + text String @map("body_text") + + @@fullTextIndex([text], name: "message_text_search") + @@map("message") +} +`; + +// The real target descriptor, so the attribute surface under test is the one +// a composed stack actually gets. +const assembled = assembleAuthoringContributions([postgresTargetControl]); + +function pslIndexes() { + const { document, sources } = parse(PSL, 'full-text-index.test.psl'); + const { symbolTable } = buildSymbolTable({ + documents: [document], + sources, + pslBlockDescriptors: assembled.pslBlockDescriptors, + }); + const result = interpretPslDocumentToSqlContract({ + document, + symbolTable, + sources, + capabilities: {}, + target: postgresPack, + scalarColumnDescriptors: new Map([ + ['Int', { codecId: 'pg/int4@1', nativeType: 'int4' }], + ['String', { codecId: 'pg/text@1', nativeType: 'text' }], + ]), + authoringContributions: assembled, + composedExtensionContracts: new Map(), + createNamespace: postgresCreateNamespace, + }); + expect(result.ok).toBe(true); + if (!result.ok) return []; + return indexesOfPublicMessage(result.value.storage.namespaces['public']); +} + +function tsIndexes() { + const contract = defineContract({ + models: { + Message: model('Message', { + fields: { + id: field.column(intColumn).id(), + text: field.column(textColumn).column('body_text'), + }, + }).sql(({ cols }) => ({ + table: 'message', + indexes: [fullTextIndex(cols.text, { name: 'message_text_search' })], + })), + }, + }); + return indexesOfPublicMessage(contract.storage.namespaces['public']); +} + +describe('fullTextIndex, the TypeScript twin of @@fullTextIndex', () => { + it('renders the storage column name, not the field name', () => { + expect(tsIndexes()[0]).toMatchObject({ + expression: `to_tsvector('english', "body_text")`, + type: 'gin', + prefix: 'message_text_search', + }); + }); + + it('produces the index the PSL attribute produces for the same model', () => { + expect(tsIndexes()).toEqual(pslIndexes()); + }); + + it('defaults to the language the target declares, not a copy of it', () => { + expect(tsIndexes()[0]?.expression).toBe( + renderFullTextIndexExpression(DEFAULT_FULL_TEXT_SEARCH_LANGUAGE, 'body_text'), + ); + }); + + it('passes a where predicate through to a partial index', () => { + const contract = defineContract({ + models: { + Message: model('Message', { + fields: { id: field.column(intColumn).id(), text: field.column(textColumn) }, + }).sql(({ cols }) => ({ + table: 'message', + indexes: [ + fullTextIndex(cols.text, { where: 'id > 0', name: 'message_text_search_live' }), + ], + })), + }, + }); + + expect(indexesOfPublicMessage(contract.storage.namespaces['public'])[0]).toMatchObject({ + where: 'id > 0', + }); + }); + + it('refuses a column that is not stored through a textual codec', () => { + expect(() => + defineContract({ + models: { + Message: model('Message', { + fields: { id: field.column(intColumn).id(), views: field.column(intColumn) }, + }).sql(({ cols }) => ({ + table: 'message', + indexes: [fullTextIndex(cols.views, { name: 'message_views_search' })], + })), + }, + }), + ).toThrow(expect.objectContaining({ code: 'CONTRACT.INDEX_INVALID' })); + }); + + it('names the field and its codec when it refuses one', () => { + expect(() => + defineContract({ + models: { + Message: model('Message', { + fields: { id: field.column(intColumn).id(), views: field.column(intColumn) }, + }).sql(({ cols }) => ({ + table: 'message', + indexes: [fullTextIndex(cols.views, { name: 'message_views_search' })], + })), + }, + }), + ).toThrow(/views.*pg\/int4@1/); + }); + + it('renders a non-default language', () => { + const contract = defineContract({ + models: { + Message: model('Message', { + fields: { id: field.column(intColumn).id(), text: field.column(textColumn) }, + }).sql(({ cols }) => ({ + table: 'message', + indexes: [fullTextIndex(cols.text, { language: 'german', name: 'message_de' })], + })), + }, + }); + expect(indexesOfPublicMessage(contract.storage.namespaces['public'])[0]).toMatchObject({ + expression: `to_tsvector('german', "text")`, + }); + }); +}); diff --git a/packages/3-extensions/postgres/test/fixtures/generated/contract.d.ts b/packages/3-extensions/postgres/test/fixtures/generated/contract.d.ts index 8c8cd56d6ba7..3a2844b6bdee 100644 --- a/packages/3-extensions/postgres/test/fixtures/generated/contract.d.ts +++ b/packages/3-extensions/postgres/test/fixtures/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/packages/3-extensions/sql-orm-client/scripts/strip-pgvector-fixture.mjs b/packages/3-extensions/sql-orm-client/scripts/strip-pgvector-fixture.mjs index bdfb1e5ab6bd..d225da4da819 100644 --- a/packages/3-extensions/sql-orm-client/scripts/strip-pgvector-fixture.mjs +++ b/packages/3-extensions/sql-orm-client/scripts/strip-pgvector-fixture.mjs @@ -33,10 +33,9 @@ const source = readFileSync(target, 'utf8'); * be. That is not something this script should care about. */ const importBlock = - /import type \{ QueryOperationTypes as PgAdapterQueryOps \} from '@internal\/adapter-postgres\/operation-types';\nimport type \{[\s\S]*?\} from '@internal\/extension-pgvector\/codec-types';\nimport type \{ QueryOperationTypes as PgVectorQueryOperationTypes \} from '@internal\/extension-pgvector\/operation-types';/; + /import type \{[^}]*\} from '@internal\/extension-pgvector\/codec-types';\nimport type \{ QueryOperationTypes as PgVectorQueryOperationTypes \} from '@internal\/extension-pgvector\/operation-types';/; const replacement = [ - "import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types';", '// pgvector types replaced with local aliases (see note above)', 'type PgVectorTypes = object;', 'type Vector<_N extends number> = number[];', diff --git a/packages/3-extensions/sql-orm-client/test/fixtures/generated/contract.d.ts b/packages/3-extensions/sql-orm-client/test/fixtures/generated/contract.d.ts index 28a77d074856..9c4754152dcc 100644 --- a/packages/3-extensions/sql-orm-client/test/fixtures/generated/contract.d.ts +++ b/packages/3-extensions/sql-orm-client/test/fixtures/generated/contract.d.ts @@ -6,7 +6,6 @@ // in this package-level copy to avoid a circular Turbo build dependency. // (@internal/extension-pgvector → @internal/postgres → @internal/sql-orm-client) // The integration tests that exercise pgvector-specific operations live in test/integration/. -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; // pgvector types replaced with local aliases (see note above) type PgVectorTypes = object; type Vector<_N extends number> = number[]; @@ -28,6 +27,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -51,7 +51,7 @@ export type ProfileHash = export type CodecTypes = PgTypes & PgVectorTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps & +export type QueryOperationTypes = PgTargetQueryOps & PgVectorQueryOperationTypes; export type AggregateTypes = { readonly avg: { diff --git a/packages/3-extensions/sql-orm-client/test/fixtures/junction-namespaces/generated/contract.d.ts b/packages/3-extensions/sql-orm-client/test/fixtures/junction-namespaces/generated/contract.d.ts index a23c242c624d..be403c6b7aca 100644 --- a/packages/3-extensions/sql-orm-client/test/fixtures/junction-namespaces/generated/contract.d.ts +++ b/packages/3-extensions/sql-orm-client/test/fixtures/junction-namespaces/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/packages/3-extensions/supabase/src/contract/contract.d.ts b/packages/3-extensions/supabase/src/contract/contract.d.ts index c704aa3ee05e..0d8309b4f054 100644 --- a/packages/3-extensions/supabase/src/contract/contract.d.ts +++ b/packages/3-extensions/supabase/src/contract/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/packages/3-extensions/supabase/test/fixtures/example-app/contract.d.ts b/packages/3-extensions/supabase/test/fixtures/example-app/contract.d.ts index c002977109b8..f950cdd10654 100644 --- a/packages/3-extensions/supabase/test/fixtures/example-app/contract.d.ts +++ b/packages/3-extensions/supabase/test/fixtures/example-app/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/packages/3-extensions/supabase/test/fixtures/no-policy/contract.d.ts b/packages/3-extensions/supabase/test/fixtures/no-policy/contract.d.ts index a2b588cc6e36..1c1733abddd5 100644 --- a/packages/3-extensions/supabase/test/fixtures/no-policy/contract.d.ts +++ b/packages/3-extensions/supabase/test/fixtures/no-policy/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/packages/3-extensions/supabase/test/fixtures/renamed-policy/contract.d.ts b/packages/3-extensions/supabase/test/fixtures/renamed-policy/contract.d.ts index f6477b7ac095..e40091865818 100644 --- a/packages/3-extensions/supabase/test/fixtures/renamed-policy/contract.d.ts +++ b/packages/3-extensions/supabase/test/fixtures/renamed-policy/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/packages/3-targets/3-targets/postgres/README.md b/packages/3-targets/3-targets/postgres/README.md index 78ee7375ba72..550441a9e0c6 100644 --- a/packages/3-targets/3-targets/postgres/README.md +++ b/packages/3-targets/3-targets/postgres/README.md @@ -115,6 +115,57 @@ export const contract = defineContract({ Pack refs are pure JSON-friendly objects that make TypeScript contract authoring work in both emit and no-emit workflows without requiring separate manifest files. +### Full-text search + +This package contributes the built-in Postgres query operations — `ilike`, and the three full-text search operations below — through `queryOperations` on its runtime descriptor, with their types on `./operation-types`. Emitted `contract.d.ts` files import them from there. + +`fullTextMatches` is a predicate, `fullTextRank` scores a row for ordering, and `fullTextHeadline` returns the matched text with `` around the matching words. All three take the search string as a bound parameter and lower to `websearch_to_tsquery`, so a user can type `"an exact phrase"` and `-excluded` and get what those mean in a search box. + +Each takes an options object as its second argument. `language` is common to all three and defaults to `english`; `fullTextRank` adds `normalization` (the `ts_rank` bitmask, 0 to 63) and `coverDensity` (which selects `ts_rank_cd`); `fullTextHeadline` adds `startSel`, `stopSel`, `maxWords`, `minWords` and `highlightAll`, which become `ts_headline`'s fourth argument: + +```typescript +row.text.fullTextRank(query, { language: 'german', normalization: 32, coverDensity: true }); +row.text.fullTextHeadline(query, { startSel: '', stopSel: '', maxWords: 20 }); +``` + +Postgres takes no parameter in any of those positions, so every option is written into the SQL as a literal and is therefore checked first: an unknown configuration, a normalization outside 0 to 63, a word count that is not a positive integer, a `minWords` above `maxWords`, or a marker carrying `ts_headline`'s own `"` `,` `=` delimiters all raise `RUNTIME.ARGUMENT_INVALID` before a statement is built. + +Through the ORM: + +```typescript +const hits = await db.orm.public.Message.select('id', 'text') + .where((row) => row.text.fullTextMatches(query)) + .orderBy((row) => row.text.fullTextRank(query).desc()) + .limit(20) + .all(); +``` + +Through the SQL builder: + +```typescript +const snippets = db.sql.public.message + .select('id') + .select('snippet', (f, fns) => fns.fullTextHeadline(f.text, query)) + .where((f, fns) => fns.fullTextMatches(f.text, query)) + .build(); +``` + +Postgres computes `to_tsvector` per row unless an index covers the predicate's expression — the same `to_tsvector`, the same configuration literal and the same column, which it compares as parsed expressions rather than as text. `@@fullTextIndex`, contributed by this package, renders that expression from the field and the language, so you never write it by hand: + +```prisma +@@fullTextIndex([text], name: "message_text_search") +``` + +The TypeScript contract builder has the same helper, exported from the facade's contract-builder entry: + +```typescript +model('Message', { fields: { id, text } }).sql(({ cols }) => ({ + indexes: [fullTextIndex(cols.text, { name: 'message_text_search' })], +})); +``` + +It takes exactly one field, an optional `language` (default `english`, from the same allowlist the operations accept), an optional `where:` for a partial index, and `name:` xor `map:` like any expression index; it is repeatable, so a model may index several columns. Pass the same `language` here and to the operation: a mismatch is not an error, the query just stops using the index and falls back to a sequential scan. The column name comes from the resolved storage column, so `@map` is honoured. `@@index(expression: "to_tsvector('english', \"text\")", type: "gin", name: …)` still works for anything the attribute does not cover — but then the expression is yours to keep in step. + ## Codec descriptor authoring PostgreSQL-bound codecs use the public `PostgresCodecDescriptor` protocol, `postgresCodec(...)` adapter, and `definePostgresCodecs(...)` tuple helper exported from `@internal/target-postgres/codec-descriptor`. See the [codec authoring guide](../../../../docs/reference/codec-authoring-guide.md#target-owned-sql-codec-descriptors) for subclassing, generic adaptation, stack contribution, validation, array projection, and the current renderer transition. @@ -158,6 +209,7 @@ Postgres prints a `timestamptz` value in the session's time zone, and dates and - `./control`: Control plane entry point for `SqlControlTargetDescriptor` - `./runtime`: Runtime entry point for target-specific runtime code - `./pack`: Pure pack ref for `defineContract({ family, target: postgresPack, ... })` +- `./operation-types`: `QueryOperationTypes` for the built-in Postgres query operations, plus `FullTextSearchLanguage` - `./prisma7-binding`: `prisma7PostgresBinding`, this target's view for the Prisma 7 contract source (see above) ## Tests diff --git a/packages/3-targets/3-targets/postgres/package.json b/packages/3-targets/3-targets/postgres/package.json index 50dfc37d680c..aaa27364462c 100644 --- a/packages/3-targets/3-targets/postgres/package.json +++ b/packages/3-targets/3-targets/postgres/package.json @@ -77,6 +77,7 @@ "./migration": "./dist/migration.mjs", "./native-type-normalizer": "./dist/native-type-normalizer.mjs", "./op-factory-call": "./dist/op-factory-call.mjs", + "./operation-types": "./dist/operation-types.mjs", "./pack": "./dist/pack.mjs", "./planner": "./dist/planner.mjs", "./planner-ddl-builders": "./dist/planner-ddl-builders.mjs", diff --git a/packages/3-targets/3-targets/postgres/src/core/authoring.ts b/packages/3-targets/3-targets/postgres/src/core/authoring.ts index 9d871dc3b00a..556d64128bc6 100644 --- a/packages/3-targets/3-targets/postgres/src/core/authoring.ts +++ b/packages/3-targets/3-targets/postgres/src/core/authoring.ts @@ -17,7 +17,16 @@ import type { import { UNBOUND_NAMESPACE_ID } from '@internal/framework-components/ir'; import type { ContributedPslDiagnosticCode } from '@internal/framework-components/psl-ast'; import type { ModelAttributeSpecFactory } from '@internal/psl-parser'; -import { blockAttribute, leafDiagnostic, modelAttribute, str } from '@internal/psl-parser'; +import { + blockAttribute, + fieldRef, + leafDiagnostic, + list, + modelAttribute, + oneOf, + optional, + str, +} from '@internal/psl-parser'; import type { EntityHandleLoweringInput, LoweredPackEntity, @@ -39,6 +48,10 @@ import { PG_TIMESTAMPTZ_TEMPORAL_CODEC_ID, } from './codec-ids'; import { postgresError } from './errors'; +import { + isFullTextIndexableCodec, + renderFullTextIndexExpression, +} from './full-text-index-expression'; import { postgresNowGeneratorIds } from './now-generators'; import { PostgresNativeEnum } from './postgres-native-enum'; import { PostgresRlsEnablement, type PostgresRlsEnablementInput } from './postgres-rls-enablement'; @@ -51,6 +64,11 @@ import { PostgresRoleSchema, } from './postgres-validators'; import { computeContentHash, POLICY_OPERATION_PREDICATES } from './rls/canonicalize'; +import { + DEFAULT_FULL_TEXT_SEARCH_LANGUAGE, + type FullTextSearchLanguage, + POSTGRES_TEXT_SEARCH_LANGUAGES, +} from './text-search-languages'; // Contributed diagnostic codes, declared once as typed consts — the // `ContributedPslDiagnosticCode` type is the only thing enforcing the @@ -60,6 +78,13 @@ import { computeContentHash, POLICY_OPERATION_PREDICATES } from './rls/canonical const PSL_RLS_PREDICATE_NOT_FOR_OPERATION: ContributedPslDiagnosticCode = 'PSL_RLS_PREDICATE_NOT_FOR_OPERATION'; const PSL_POLICY_INVALID_MAP: ContributedPslDiagnosticCode = 'PSL_POLICY_INVALID_MAP'; +const PSL_FULL_TEXT_INDEX_ONE_FIELD: ContributedPslDiagnosticCode = 'PSL_FULL_TEXT_INDEX_ONE_FIELD'; +const PSL_FULL_TEXT_INDEX_REQUIRES_NAME: ContributedPslDiagnosticCode = + 'PSL_FULL_TEXT_INDEX_REQUIRES_NAME'; +const PSL_FULL_TEXT_INDEX_NAME_XOR_MAP: ContributedPslDiagnosticCode = + 'PSL_FULL_TEXT_INDEX_NAME_XOR_MAP'; +const PSL_FULL_TEXT_INDEX_TEXT_FIELD: ContributedPslDiagnosticCode = + 'PSL_FULL_TEXT_INDEX_TEXT_FIELD'; const PSL_NATIVE_ENUM_BARE_MEMBER: ContributedPslDiagnosticCode = 'PSL_NATIVE_ENUM_BARE_MEMBER'; const PSL_EXTENSION_INVALID_VALUE: ContributedPslDiagnosticCode = 'PSL_EXTENSION_INVALID_VALUE'; const PSL_NATIVE_ENUM_DUPLICATE_MEMBER_VALUE: ContributedPslDiagnosticCode = @@ -687,6 +712,85 @@ const postgresRlsSpec = modelAttribute('rls', { const postgresRlsSpecFactory: ModelAttributeSpecFactory = () => postgresRlsSpec; +const [firstLanguage, ...remainingLanguages] = POSTGRES_TEXT_SEARCH_LANGUAGES; + +const postgresFullTextIndexSpec = modelAttribute('fullTextIndex', { + documentation: + 'Indexes one text column for full-text search, rendering the expression `fullTextMatches`, `fullTextRank` and `fullTextHeadline` lower to.', + positional: [ + { + key: 'fields', + type: list(fieldRef(), { allowEmpty: false, unique: true }), + documentation: 'The single field to index.', + }, + ], + named: { + language: { + type: optional( + oneOf(str(firstLanguage), ...remainingLanguages.map((language) => str(language))), + ), + documentation: + 'The text-search configuration. Defaults to `english`, and must match the language the query operations are given.', + }, + name: { + type: optional(str()), + documentation: 'The index name. Mutually exclusive with `map`.', + }, + map: { + type: optional(str()), + documentation: 'The database index name. Mutually exclusive with `name`.', + }, + where: { + type: optional(str()), + documentation: 'The SQL predicate restricting rows included in a partial index.', + }, + }, + refine: (value, ctx, attributeNode) => { + const diagnostics = []; + if (value.fields.length !== 1) { + diagnostics.push( + leafDiagnostic( + ctx, + attributeNode, + 'The full-text operations work on one column; declare one `@@fullTextIndex` per column', + PSL_FULL_TEXT_INDEX_ONE_FIELD, + ), + ); + } + if (value.name === undefined && value.map === undefined) { + diagnostics.push( + leafDiagnostic( + ctx, + attributeNode, + '`@@fullTextIndex` requires a `name` or `map` argument (a default name cannot be derived from an expression)', + PSL_FULL_TEXT_INDEX_REQUIRES_NAME, + ), + ); + } + if (value.name !== undefined && value.map !== undefined) { + diagnostics.push( + leafDiagnostic( + ctx, + attributeNode, + '`@@fullTextIndex` takes at most one of `name` and `map`', + PSL_FULL_TEXT_INDEX_NAME_XOR_MAP, + ), + ); + } + return diagnostics; + }, +}); + +const postgresFullTextIndexSpecFactory: ModelAttributeSpecFactory = () => postgresFullTextIndexSpec; + +type PostgresFullTextIndexParsed = { + readonly fields: readonly string[]; + readonly language?: FullTextSearchLanguage; + readonly name?: string; + readonly map?: string; + readonly where?: string; +}; + /** * `@@` model attributes contributed by the Postgres target pack. * @@ -709,6 +813,45 @@ export const postgresAuthoringModelAttributes = { }), }), }, + fullTextIndex: { + kind: 'modelAttribute', + attribute: 'fullTextIndex', + spec: postgresFullTextIndexSpecFactory, + repeatable: true, + lower: (parsed: PostgresFullTextIndexParsed, ctx: AuthoringModelAttributeContext) => { + const fieldName = parsed.fields[0]; + invariant( + fieldName !== undefined && parsed.fields.length === 1, + `@@fullTextIndex on "${ctx.modelName}" lowered with ${parsed.fields.length} fields`, + ); + const columnName = ctx.fieldStorageName(fieldName); + const codecId = ctx.fieldCodecId(fieldName); + // A relation field parses as a field reference but stores no value, so it + // reaches here with neither a column nor a codec. + if (columnName === undefined || codecId === undefined || !isFullTextIndexableCodec(codecId)) { + ctx.diagnostics?.push({ + code: PSL_FULL_TEXT_INDEX_TEXT_FIELD, + message: `\`@@fullTextIndex\` indexes a text column, but "${ctx.modelName}.${fieldName}" is ${codecId === undefined ? 'not a stored scalar field' : `stored as \`${codecId}\``}.`, + sourceId: ctx.sourceId ?? 'unknown', + }); + return undefined; + } + return { + index: { + expression: renderFullTextIndexExpression( + parsed.language ?? DEFAULT_FULL_TEXT_SEARCH_LANGUAGE, + columnName, + ), + type: 'gin', + options: undefined, + where: parsed.where, + unique: undefined, + name: parsed.name, + map: parsed.map, + }, + }; + }, + }, } as const satisfies AuthoringModelAttributeDescriptorNamespace; export const postgresAuthoringFieldPresets = { diff --git a/packages/3-targets/3-targets/postgres/src/core/descriptor-meta.ts b/packages/3-targets/3-targets/postgres/src/core/descriptor-meta.ts index 6bb88039954d..59aad0031456 100644 --- a/packages/3-targets/3-targets/postgres/src/core/descriptor-meta.ts +++ b/packages/3-targets/3-targets/postgres/src/core/descriptor-meta.ts @@ -30,6 +30,15 @@ const postgresTargetDescriptorMetaBase = { renderCheckExpressions: postgresRenderCheckExpressions, lowerEntityHandles: postgresLowerEntityHandles, }, + types: { + queryOperationTypes: { + import: { + package: '@internal/target-postgres/operation-types', + named: 'QueryOperationTypes', + alias: 'PgTargetQueryOps', + }, + }, + }, } as const; export const postgresTargetDescriptorMeta: typeof postgresTargetDescriptorMetaBase & { diff --git a/packages/3-targets/3-targets/postgres/src/core/errors.ts b/packages/3-targets/3-targets/postgres/src/core/errors.ts index f3853d77bc99..4293967263f5 100644 --- a/packages/3-targets/3-targets/postgres/src/core/errors.ts +++ b/packages/3-targets/3-targets/postgres/src/core/errors.ts @@ -18,6 +18,7 @@ export type PostgresTargetErrorCode = | 'MIGRATION.CONTRACT_SPACE_VIOLATION' | 'MIGRATION.POSTGRES_CONTROL_STACK_MISSING' | 'MIGRATION.TARGET_MISMATCH' + | 'RUNTIME.ARGUMENT_INVALID' | 'RUNTIME.DECODE_FAILED' | 'RUNTIME.ENCODE_FAILED' | 'RUNTIME.TEMPORAL_UNAVAILABLE' diff --git a/packages/3-targets/3-targets/postgres/src/core/full-text-index-expression.ts b/packages/3-targets/3-targets/postgres/src/core/full-text-index-expression.ts new file mode 100644 index 000000000000..490ec093e7d7 --- /dev/null +++ b/packages/3-targets/3-targets/postgres/src/core/full-text-index-expression.ts @@ -0,0 +1,37 @@ +import { codecDescriptors } from './codecs'; +import { quoteIdentifier } from './sql-utils'; +import type { FullTextSearchLanguage } from './text-search-languages'; + +/** + * The index expression that covers `fullTextMatches`, `fullTextRank` and + * `fullTextHeadline` on a column. Postgres uses an expression index only when the + * indexed expression is the same `to_tsvector` over the same configuration literal and + * the same column as the query, so both the `@@fullTextIndex` attribute and the + * TypeScript helper render it here rather than each spelling it out. + */ +export function renderFullTextIndexExpression( + language: FullTextSearchLanguage, + columnName: string, +): string { + return `to_tsvector('${language}', ${quoteIdentifier(columnName)})`; +} + +/** Widens a descriptor's trait tuple, so membership is a plain string test. */ +function traitsOf(descriptor: { readonly traits: readonly string[] }): readonly string[] { + return descriptor.traits; +} + +const TEXTUAL_CODEC_IDS: ReadonlySet = new Set( + codecDescriptors + .filter((descriptor) => traitsOf(descriptor).includes('textual')) + .map((descriptor) => descriptor.codecId), +); + +/** + * Whether a column stored through this codec can be indexed for full-text search. + * Read from the codec descriptors themselves, so both authoring surfaces accept + * exactly the columns the `textual` operations dispatch on. + */ +export function isFullTextIndexableCodec(codecId: string): boolean { + return TEXTUAL_CODEC_IDS.has(codecId); +} diff --git a/packages/3-targets/3-targets/postgres/src/core/full-text-options.ts b/packages/3-targets/3-targets/postgres/src/core/full-text-options.ts new file mode 100644 index 000000000000..b65fc4e340b8 --- /dev/null +++ b/packages/3-targets/3-targets/postgres/src/core/full-text-options.ts @@ -0,0 +1,153 @@ +/** + * Options for the Postgres full-text operations, and the checks each one goes through. + * + * Every option here reaches the SQL as an inline literal rather than a bound parameter, because + * Postgres accepts no parameter in these positions. Each is therefore validated before a statement + * exists; anything unrecognized throws `RUNTIME.ARGUMENT_INVALID`. + * + * The headline markers are the only free text among them, and `checkMarker` restricts their + * characters precisely so that the literal path never carries a quote or a backslash for + * `escapeLiteral` to have to reason about. + */ +import { LiteralExpr } from '@internal/sql-relational-core/ast'; +import { postgresError } from './errors'; +import { + type FullTextSearchLanguage, + isFullTextSearchLanguage, + POSTGRES_TEXT_SEARCH_LANGUAGES, +} from './text-search-languages'; + +export interface FullTextMatchesOptions { + /** Text-search configuration. Defaults to `english`. */ + readonly language?: FullTextSearchLanguage; +} + +export interface FullTextRankOptions extends FullTextMatchesOptions { + /** `ts_rank` normalization bitmask, 0 to 63; see the PostgreSQL manual. */ + readonly normalization?: number; + /** Rank by cover density (`ts_rank_cd`) instead of `ts_rank`. */ + readonly coverDensity?: boolean; +} + +export interface FullTextHeadlineOptions extends FullTextMatchesOptions { + /** Markup placed before each match. */ + readonly startSel?: string; + /** Markup placed after each match. */ + readonly stopSel?: string; + /** Longest headline, in words. */ + readonly maxWords?: number; + /** Shortest headline, in words; below `maxWords` when both are given. */ + readonly minWords?: number; + /** Mark up the whole document rather than extracting fragments. */ + readonly highlightAll?: boolean; +} + +function invalid(method: string, argument: string, received: unknown, why: string, fix: string) { + return postgresError('RUNTIME.ARGUMENT_INVALID', `${method}: ${why}`, { + why: 'The option is written into the SQL as an inline literal, not a bound parameter, so it is checked before the statement is built.', + fix, + meta: { helper: method, argument, received }, + }); +} + +export function languageLiteral(method: string, language: string): LiteralExpr { + if (!isFullTextSearchLanguage(language)) { + throw invalid( + method, + 'language', + language, + `'${language}' is not a PostgreSQL text-search configuration Prisma recognizes.`, + `Pass one of: ${POSTGRES_TEXT_SEARCH_LANGUAGES.join(', ')}.`, + ); + } + return LiteralExpr.of(language); +} + +export function normalizationLiteral(method: string, normalization: number): LiteralExpr { + if (!Number.isInteger(normalization) || normalization < 0 || normalization > 63) { + throw invalid( + method, + 'normalization', + normalization, + `normalization must be an integer between 0 and 63, received ${normalization}.`, + 'Combine the flags documented for ts_rank, e.g. 32 to divide the rank by itself plus one.', + ); + } + return LiteralExpr.of(normalization); +} + +function checkWordCount(method: string, argument: string, value: number): void { + if (!Number.isInteger(value) || value < 1) { + throw invalid( + method, + argument, + value, + `${argument} must be a positive integer, received ${value}.`, + 'Pass a whole number of words, one or more.', + ); + } +} + +/** Non-empty, and none of `"` `,` `=` `\` or whitespace. */ +const MARKER = /^[^"=,\\\s]+$/; + +function checkMarker(method: string, argument: string, value: string): void { + if (!MARKER.test(value)) { + throw invalid( + method, + argument, + value, + `${argument} must be non-empty and free of " , = \\ and whitespace, received ${JSON.stringify(value)}.`, + 'ts_headline parses its options as a quoted, comma-separated list of Key=Value pairs, and the whole list reaches SQL as one literal, so a marker carrying those characters cannot survive either step. Use markup such as or .', + ); + } +} + +/** + * The fourth `ts_headline` argument: one text literal of `Key=Value` pairs. Returns `undefined` when + * nothing but the language was given, so the common call keeps rendering the three-argument form. + */ +export function headlineOptionsLiteral( + method: string, + options: FullTextHeadlineOptions, +): LiteralExpr | undefined { + const pairs: string[] = []; + if (options.startSel !== undefined) { + checkMarker(method, 'startSel', options.startSel); + pairs.push(`StartSel=${options.startSel}`); + } + if (options.stopSel !== undefined) { + checkMarker(method, 'stopSel', options.stopSel); + pairs.push(`StopSel=${options.stopSel}`); + } + if (options.maxWords !== undefined) { + checkWordCount(method, 'maxWords', options.maxWords); + pairs.push(`MaxWords=${options.maxWords}`); + } + if (options.minWords !== undefined) { + checkWordCount(method, 'minWords', options.minWords); + if (options.maxWords !== undefined && options.minWords >= options.maxWords) { + throw invalid( + method, + 'minWords', + options.minWords, + `minWords (${options.minWords}) must be below maxWords (${options.maxWords}).`, + 'Postgres requires MinWords strictly below MaxWords. Lower minWords, or raise maxWords.', + ); + } + pairs.push(`MinWords=${options.minWords}`); + } + if (options.highlightAll !== undefined) { + if (typeof options.highlightAll !== 'boolean') { + throw invalid( + method, + 'highlightAll', + options.highlightAll, + `highlightAll must be a boolean, received ${JSON.stringify(options.highlightAll)}.`, + 'Pass true to mark up the whole document, or false to extract fragments.', + ); + } + pairs.push(`HighlightAll=${options.highlightAll}`); + } + return pairs.length === 0 ? undefined : LiteralExpr.of(pairs.join(', ')); +} diff --git a/packages/3-targets/3-targets/postgres/src/core/query-operations.ts b/packages/3-targets/3-targets/postgres/src/core/query-operations.ts new file mode 100644 index 000000000000..cb5388a96ce0 --- /dev/null +++ b/packages/3-targets/3-targets/postgres/src/core/query-operations.ts @@ -0,0 +1,101 @@ +import { buildOperation, toExpr } from '@internal/sql-relational-core/expression'; +import type { QueryOperationTypes } from '../types/operation-types'; +import { PG_BOOL_CODEC_ID, PG_FLOAT4_CODEC_ID, PG_TEXT_CODEC_ID } from './codec-ids'; +import { + type FullTextHeadlineOptions, + type FullTextMatchesOptions, + type FullTextRankOptions, + headlineOptionsLiteral, + languageLiteral, + normalizationLiteral, +} from './full-text-options'; +import { DEFAULT_FULL_TEXT_SEARCH_LANGUAGE } from './text-search-languages'; + +type CodecTypesBase = Record; + +const TEXT_REF = { codecId: PG_TEXT_CODEC_ID } as const; + +const languageOf = (options: FullTextMatchesOptions) => + options.language ?? DEFAULT_FULL_TEXT_SEARCH_LANGUAGE; + +export function postgresQueryOperations(): QueryOperationTypes { + return { + ilike: { + self: { traits: ['textual'] }, + impl: (self, pattern) => + buildOperation({ + method: 'ilike', + args: [toExpr(self), toExpr(pattern, TEXT_REF)], + returns: { codecId: PG_BOOL_CODEC_ID, nullable: false }, + lowering: { targetFamily: 'sql', strategy: 'infix', template: '{{self}} ILIKE {{arg0}}' }, + }), + }, + fullTextMatches: { + self: { traits: ['textual'] }, + impl: (self, query, options: FullTextMatchesOptions = {}) => + buildOperation({ + method: 'fullTextMatches', + args: [ + toExpr(self), + toExpr(query, TEXT_REF), + languageLiteral('fullTextMatches', languageOf(options)), + ], + returns: { codecId: PG_BOOL_CODEC_ID, nullable: false }, + lowering: { + targetFamily: 'sql', + strategy: 'function', + template: 'to_tsvector({{arg1}}, {{self}}) @@ websearch_to_tsquery({{arg1}}, {{arg0}})', + }, + }), + }, + fullTextRank: { + self: { traits: ['textual'] }, + impl: (self, query, options: FullTextRankOptions = {}) => { + const fn = options.coverDensity === true ? 'ts_rank_cd' : 'ts_rank'; + const normalization = + options.normalization === undefined + ? undefined + : normalizationLiteral('fullTextRank', options.normalization); + const vectorAndQuery = + 'to_tsvector({{arg1}}, {{self}}), websearch_to_tsquery({{arg1}}, {{arg0}})'; + return buildOperation({ + method: 'fullTextRank', + args: [ + toExpr(self), + toExpr(query, TEXT_REF), + languageLiteral('fullTextRank', languageOf(options)), + ...(normalization === undefined ? [] : [normalization]), + ], + returns: { codecId: PG_FLOAT4_CODEC_ID, nullable: false }, + lowering: { + targetFamily: 'sql', + strategy: 'function', + template: `${fn}(${vectorAndQuery}${normalization === undefined ? '' : ', {{arg2}}'})`, + }, + }); + }, + }, + fullTextHeadline: { + self: { traits: ['textual'] }, + impl: (self, query, options: FullTextHeadlineOptions = {}) => { + const headlineOptions = headlineOptionsLiteral('fullTextHeadline', options); + const base = 'ts_headline({{arg1}}, {{self}}, websearch_to_tsquery({{arg1}}, {{arg0}})'; + return buildOperation({ + method: 'fullTextHeadline', + args: [ + toExpr(self), + toExpr(query, TEXT_REF), + languageLiteral('fullTextHeadline', languageOf(options)), + ...(headlineOptions === undefined ? [] : [headlineOptions]), + ], + returns: { codecId: PG_TEXT_CODEC_ID, nullable: false }, + lowering: { + targetFamily: 'sql', + strategy: 'function', + template: `${base}${headlineOptions === undefined ? '' : ', {{arg2}}'})`, + }, + }); + }, + }, + }; +} diff --git a/packages/3-targets/3-targets/postgres/src/core/text-search-languages.ts b/packages/3-targets/3-targets/postgres/src/core/text-search-languages.ts new file mode 100644 index 000000000000..54641fff92b0 --- /dev/null +++ b/packages/3-targets/3-targets/postgres/src/core/text-search-languages.ts @@ -0,0 +1,45 @@ +/** + * The text-search configurations a stock PostgreSQL server ships with. The language reaches SQL as + * an inline literal rather than a bound parameter, so only names on this list may be used. + */ +export const POSTGRES_TEXT_SEARCH_LANGUAGES = [ + 'simple', + 'arabic', + 'armenian', + 'basque', + 'catalan', + 'danish', + 'dutch', + 'english', + 'finnish', + 'french', + 'german', + 'greek', + 'hindi', + 'hungarian', + 'indonesian', + 'irish', + 'italian', + 'lithuanian', + 'nepali', + 'norwegian', + 'portuguese', + 'romanian', + 'russian', + 'serbian', + 'spanish', + 'swedish', + 'tamil', + 'turkish', + 'yiddish', +] as const; + +export type FullTextSearchLanguage = (typeof POSTGRES_TEXT_SEARCH_LANGUAGES)[number]; + +export const DEFAULT_FULL_TEXT_SEARCH_LANGUAGE: FullTextSearchLanguage = 'english'; + +const KNOWN_LANGUAGES: ReadonlySet = new Set(POSTGRES_TEXT_SEARCH_LANGUAGES); + +export function isFullTextSearchLanguage(language: string): language is FullTextSearchLanguage { + return KNOWN_LANGUAGES.has(language); +} diff --git a/packages/3-targets/3-targets/postgres/src/exports/operation-types.ts b/packages/3-targets/3-targets/postgres/src/exports/operation-types.ts new file mode 100644 index 000000000000..6c2380e56936 --- /dev/null +++ b/packages/3-targets/3-targets/postgres/src/exports/operation-types.ts @@ -0,0 +1,7 @@ +export type { + FullTextHeadlineOptions, + FullTextMatchesOptions, + FullTextRankOptions, +} from '../core/full-text-options'; +export type { FullTextSearchLanguage } from '../core/text-search-languages'; +export type { QueryOperationTypes } from '../types/operation-types'; diff --git a/packages/3-targets/3-targets/postgres/src/exports/runtime.ts b/packages/3-targets/3-targets/postgres/src/exports/runtime.ts index 0ca48451d50d..4f46aa791bdf 100644 --- a/packages/3-targets/3-targets/postgres/src/exports/runtime.ts +++ b/packages/3-targets/3-targets/postgres/src/exports/runtime.ts @@ -3,8 +3,10 @@ import type { RuntimeTargetDescriptor, RuntimeTargetInstance, } from '@internal/framework-components/execution'; +import type { SqlOperationDescriptors } from '@internal/sql-operations'; import { postgresTargetDescriptorMetaRuntime } from '../core/descriptor-meta-runtime'; import { decodePostgresListText } from '../core/list-decoder'; +import { postgresQueryOperations } from '../core/query-operations'; export { INSTANT_NOW_GENERATOR_ID, instantNow } from '../core/instant-now-generator'; export { decodePostgresListText } from '../core/list-decoder'; @@ -35,10 +37,12 @@ const postgresRuntimeTargetDescriptor: RuntimeTargetDescriptor< > & { readonly codecs: () => readonly AnyCodecDescriptor[]; readonly listDecoder: () => PostgresListDecoder; + readonly queryOperations: () => SqlOperationDescriptors; } = { ...postgresTargetDescriptorMetaRuntime, codecs: () => [], listDecoder: () => decodePostgresListText, + queryOperations: () => postgresQueryOperations(), create(): PostgresRuntimeTargetInstance { return { familyId: 'sql', diff --git a/packages/3-targets/3-targets/postgres/src/exports/sql-utils.ts b/packages/3-targets/3-targets/postgres/src/exports/sql-utils.ts index 05a2b7803850..b396690f1218 100644 --- a/packages/3-targets/3-targets/postgres/src/exports/sql-utils.ts +++ b/packages/3-targets/3-targets/postgres/src/exports/sql-utils.ts @@ -1,3 +1,7 @@ +export { + isFullTextIndexableCodec, + renderFullTextIndexExpression, +} from '../core/full-text-index-expression'; export { escapeLiteral, qualifyName, @@ -5,3 +9,4 @@ export { quoteQualifiedName, validateEnumValueLength, } from '../core/sql-utils'; +export { DEFAULT_FULL_TEXT_SEARCH_LANGUAGE } from '../core/text-search-languages'; diff --git a/packages/3-targets/3-targets/postgres/src/types/operation-types.ts b/packages/3-targets/3-targets/postgres/src/types/operation-types.ts new file mode 100644 index 000000000000..a0c21328fcaf --- /dev/null +++ b/packages/3-targets/3-targets/postgres/src/types/operation-types.ts @@ -0,0 +1,56 @@ +import type { SqlQueryOperationTypes } from '@internal/sql-contract/types'; +import type { + CodecExpression, + Expression, + TraitExpression, +} from '@internal/sql-relational-core/expression'; +import type { + FullTextHeadlineOptions, + FullTextMatchesOptions, + FullTextRankOptions, +} from '../core/full-text-options'; + +type CodecTypesBase = Record; + +type TextualSelfSpec = { readonly traits: readonly ['textual'] }; + +type TextualSelf = TraitExpression; + +type TextArgument = CodecExpression<'pg/text@1', false, CT>; + +export type QueryOperationTypes = SqlQueryOperationTypes< + CT, + { + readonly ilike: { + readonly self: TextualSelfSpec; + readonly impl: ( + self: TextualSelf, + pattern: TextArgument, + ) => Expression<{ codecId: 'pg/bool@1'; nullable: false }>; + }; + readonly fullTextMatches: { + readonly self: TextualSelfSpec; + readonly impl: ( + self: TextualSelf, + query: TextArgument, + options?: FullTextMatchesOptions, + ) => Expression<{ codecId: 'pg/bool@1'; nullable: false }>; + }; + readonly fullTextRank: { + readonly self: TextualSelfSpec; + readonly impl: ( + self: TextualSelf, + query: TextArgument, + options?: FullTextRankOptions, + ) => Expression<{ codecId: 'pg/float4@1'; nullable: false }>; + }; + readonly fullTextHeadline: { + readonly self: TextualSelfSpec; + readonly impl: ( + self: TextualSelf, + query: TextArgument, + options?: FullTextHeadlineOptions, + ) => Expression<{ codecId: 'pg/text@1'; nullable: false }>; + }; + } +>; diff --git a/packages/3-targets/3-targets/postgres/test/fixtures/namespaced-contract.d.ts b/packages/3-targets/3-targets/postgres/test/fixtures/namespaced-contract.d.ts index 11c9f990daa7..ad37a849d445 100644 --- a/packages/3-targets/3-targets/postgres/test/fixtures/namespaced-contract.d.ts +++ b/packages/3-targets/3-targets/postgres/test/fixtures/namespaced-contract.d.ts @@ -1,7 +1,7 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { Bit, Char, @@ -37,7 +37,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; type DefaultLiteralValue = CodecId extends keyof CodecTypes ? CodecTypes[CodecId]['output'] : _Encoded; diff --git a/packages/3-targets/3-targets/postgres/test/migrations/full-text-index-planning.test.ts b/packages/3-targets/3-targets/postgres/test/migrations/full-text-index-planning.test.ts new file mode 100644 index 000000000000..aa051d6a7ee0 --- /dev/null +++ b/packages/3-targets/3-targets/postgres/test/migrations/full-text-index-planning.test.ts @@ -0,0 +1,164 @@ +/** + * A GIN index over `to_tsvector(...)` reaches the planner as a + * `PostgresCreateIndex` carrying the access method and the expression + * verbatim — whether it came from `@@fullTextIndex`, which renders the + * expression, or from a hand-written `@@index(expression:)`. The SQL bytes are + * asserted beside the renderer in the adapter package. + */ +import type { Contract } from '@internal/contract/types'; +import type { ExecuteRequestLowerer } from '@internal/family-sql/control-adapter'; +import { + APP_SPACE_ID, + assembleAuthoringContributions, +} from '@internal/framework-components/control'; +import { buildSymbolTable } from '@internal/psl-parser'; +import { parse } from '@internal/psl-parser/syntax'; +import type { SqlStorage } from '@internal/sql-contract/types'; +import { interpretPslDocumentToSqlContract } from '@internal/sql-contract-psl'; +import { blindCast } from '@internal/utils/casts'; +import { describe, expect, it } from 'vitest'; +import { + postgresAuthoringEntityTypes, + postgresAuthoringModelAttributes, + postgresAuthoringPslBlockDescriptors, +} from '../../src/core/authoring'; +import { PostgresCreateIndex } from '../../src/core/ddl/nodes'; +import { postgresTargetDescriptorMeta } from '../../src/core/descriptor-meta'; +import { createPostgresMigrationPlanner } from '../../src/core/migrations/planner'; +import { postgresCreateNamespace } from '../../src/core/postgres-schema'; +import { PostgresDatabaseSchemaNode } from '../../src/core/schema-ir/postgres-database-schema-node'; +import { PostgresNamespaceSchemaNode } from '../../src/core/schema-ir/postgres-namespace-schema-node'; +import { PostgresTableSchemaNode } from '../../src/core/schema-ir/postgres-table-schema-node'; + +const TYPED_ATTRIBUTE_SCHEMA = ` +model Message { + id Int @id + text String + @@fullTextIndex([text], name: "message_text_search") +} +`; + +const HAND_WRITTEN_EXPRESSION_SCHEMA = ` +model Message { + id Int @id + text String + @@index(expression: "to_tsvector('english', \\"text\\")", type: "gin", name: "message_text_search") +} +`; + +const assembled = assembleAuthoringContributions([ + { + authoring: { + entityTypes: postgresAuthoringEntityTypes, + pslBlockDescriptors: postgresAuthoringPslBlockDescriptors, + modelAttributes: postgresAuthoringModelAttributes, + type: { + Int: { kind: 'typeConstructor', output: { codecId: 'pg/int4@1', nativeType: 'int4' } }, + String: { kind: 'typeConstructor', output: { codecId: 'pg/text@1', nativeType: 'text' } }, + }, + }, + }, +]); + +function authoredContract(schema: string): Contract { + const { document, sources } = parse(schema, 'full-text-index-planning.test.psl'); + const { symbolTable } = buildSymbolTable({ + documents: [document], + sources, + pslBlockDescriptors: assembled.pslBlockDescriptors, + }); + const result = interpretPslDocumentToSqlContract({ + document, + symbolTable, + sources, + capabilities: {}, + target: postgresTargetDescriptorMeta, + scalarColumnDescriptors: new Map([ + ['Int', { codecId: 'pg/int4@1', nativeType: 'int4' }], + ['String', { codecId: 'pg/text@1', nativeType: 'text' }], + ]), + authoringContributions: assembled, + composedExtensionContracts: new Map(), + createNamespace: postgresCreateNamespace, + }); + expect(result.ok).toBe(true); + if (!result.ok) throw new Error('PSL interpretation failed'); + return blindCast< + Contract, + 'the interpreter returns the framework Contract supertype; a Postgres schema is SQL storage' + >(result.value); +} + +/** The table exists with no indexes, so only the index is left to plan. */ +function liveSchemaWithoutTheIndex(): PostgresDatabaseSchemaNode { + return new PostgresDatabaseSchemaNode({ + namespaces: { + public: new PostgresNamespaceSchemaNode({ + schemaName: 'public', + tables: { + Message: new PostgresTableSchemaNode({ + name: 'Message', + columns: { + id: { name: 'id', nativeType: 'int4', nullable: false }, + text: { name: 'text', nativeType: 'text', nullable: false }, + }, + primaryKey: { columns: ['id'] }, + foreignKeys: [], + uniques: [], + indexes: [], + rlsEnabled: false, + }), + }, + }), + }, + roles: [], + existingSchemas: ['public'], + pgVersion: 'unknown', + }); +} + +async function plannedCreateIndexNodes(schema: string): Promise { + const lowered: unknown[] = []; + const lowerer: ExecuteRequestLowerer = { + lower: () => ({ sql: 'stub', params: [] }), + lowerToExecuteRequest: async (ast) => { + lowered.push(ast); + return { sql: 'stub', params: [] }; + }, + }; + const result = createPostgresMigrationPlanner(lowerer).plan({ + contract: authoredContract(schema), + schema: liveSchemaWithoutTheIndex(), + policy: { allowedOperationClasses: ['additive', 'widening', 'destructive'] }, + fromContract: null, + frameworkComponents: [], + spaceId: APP_SPACE_ID, + snapshotsImportPath: '../../snapshots', + }); + expect(result.kind).toBe('success'); + if (result.kind !== 'success') return []; + await Promise.all(result.plan.operations); + return lowered.filter((node) => node instanceof PostgresCreateIndex); +} + +describe('a GIN index over to_tsvector, authored in PSL', () => { + it('plans one CREATE INDEX from @@fullTextIndex', async () => { + const nodes = await plannedCreateIndexNodes(TYPED_ATTRIBUTE_SCHEMA); + expect(nodes).toHaveLength(1); + const node = nodes[0]!; + expect(node.type).toBe('gin'); + expect(node.elements).toEqual({ expression: `to_tsvector('english', "text")` }); + expect(node.table).toBe('Message'); + expect(node.name.startsWith('message_text_search')).toBe(true); + }); + + it('plans the same CREATE INDEX from a hand-written @@index(expression:)', async () => { + const nodes = await plannedCreateIndexNodes(HAND_WRITTEN_EXPRESSION_SCHEMA); + expect(nodes).toHaveLength(1); + const node = nodes[0]!; + expect(node.type).toBe('gin'); + expect(node.elements).toEqual({ expression: `to_tsvector('english', "text")` }); + expect(node.table).toBe('Message'); + expect(node.name.startsWith('message_text_search')).toBe(true); + }); +}); diff --git a/packages/3-targets/3-targets/postgres/test/psl-full-text-index.test.ts b/packages/3-targets/3-targets/postgres/test/psl-full-text-index.test.ts new file mode 100644 index 000000000000..7b6fc5c68322 --- /dev/null +++ b/packages/3-targets/3-targets/postgres/test/psl-full-text-index.test.ts @@ -0,0 +1,252 @@ +/** + * `@@fullTextIndex` renders the same expression the full-text operations + * lower to, so neither is hand-written. Passing a different language to each + * still leaves the index unused; only the rendering is shared. It is the documented + * way to index a text column; `@@index(expression:)` stays available for + * anything this attribute does not cover. + */ +import { assembleAuthoringContributions } from '@internal/framework-components/control'; +import { buildSymbolTable } from '@internal/psl-parser'; +import { parse } from '@internal/psl-parser/syntax'; +import { interpretPslDocumentToSqlContract } from '@internal/sql-contract-psl'; +import { describe, expect, it } from 'vitest'; +import { + postgresAuthoringEntityTypes, + postgresAuthoringModelAttributes, + postgresAuthoringPslBlockDescriptors, + postgresAuthoringTypes, +} from '../src/core/authoring'; +import { postgresIndexTypes } from '../src/core/index-types'; +import { type PostgresSchema, postgresCreateNamespace } from '../src/core/postgres-schema'; + +const assembled = assembleAuthoringContributions([ + { + authoring: { + entityTypes: postgresAuthoringEntityTypes, + pslBlockDescriptors: postgresAuthoringPslBlockDescriptors, + modelAttributes: postgresAuthoringModelAttributes, + type: postgresAuthoringTypes, + }, + }, +]); + +const postgresTarget = { + kind: 'target' as const, + familyId: 'sql' as const, + targetId: 'postgres' as const, + id: 'postgres', + version: '0.0.1', + capabilities: {}, + defaultNamespaceId: 'public', + indexTypes: postgresIndexTypes, +}; + +const scalarTypeDescriptors = new Map([ + ['String', { codecId: 'pg/text@1', nativeType: 'text' }], + ['Int', { codecId: 'pg/int4@1', nativeType: 'int4' }], + // The family's varchar codec, to prove the attribute accepts every `textual` + // codec rather than `pg/text@1` alone. + ['Varchar', { codecId: 'sql/varchar@1', nativeType: 'character varying' }], +]); + +function interpret(source: string) { + const { document, sources } = parse(source, 'psl-full-text-index.test.psl'); + const { symbolTable, diagnostics } = buildSymbolTable({ + documents: [document], + sources, + pslBlockDescriptors: assembled.pslBlockDescriptors, + }); + expect(diagnostics).toEqual([]); + + return interpretPslDocumentToSqlContract({ + document, + symbolTable, + sources, + target: postgresTarget, + scalarColumnDescriptors: scalarTypeDescriptors, + authoringContributions: assembled, + composedExtensionContracts: new Map(), + createNamespace: postgresCreateNamespace, + capabilities: { sql: { scalarList: true } }, + }); +} + +function indexesOf(source: string) { + const result = interpret(source); + expect(result.ok).toBe(true); + if (!result.ok) return []; + const namespace = result.value.storage.namespaces['public'] as PostgresSchema; + return namespace.table['Message']?.indexes ?? []; +} + +function diagnosticsOf(source: string) { + const result = interpret(source); + expect(result.ok).toBe(false); + if (result.ok) return []; + return result.failure.diagnostics; +} + +const model = (body: string) => ` +model Message { + id Int @id + text String + summary String +${body} +} +`; + +describe('@@fullTextIndex', () => { + it('produces the index the equivalent @@index(expression:) produces', () => { + const typed = indexesOf(model(` @@fullTextIndex([text], name: "message_text_search")`)); + const authored = indexesOf( + model( + ` @@index(expression: "to_tsvector('english', \\"text\\")", type: "gin", name: "message_text_search")`, + ), + ); + + expect(typed).toEqual(authored); + expect(typed).toHaveLength(1); + expect(typed[0]).toMatchObject({ + expression: `to_tsvector('english', "text")`, + type: 'gin', + prefix: 'message_text_search', + }); + }); + + it('renders the language it was given', () => { + const indexes = indexesOf( + model(` @@fullTextIndex([text], language: "german", name: "message_text_search_de")`), + ); + + expect(indexes[0]).toMatchObject({ expression: `to_tsvector('german', "text")` }); + }); + + it('renders the storage column name of a renamed field, not the field name', () => { + const indexes = indexesOf(` +model Message { + id Int @id + text String @map("body_text") + @@fullTextIndex([text], name: "message_text_search") +} +`); + + expect(indexes[0]).toMatchObject({ expression: `to_tsvector('english', "body_text")` }); + }); + + it('files one index per declaration, so a model may search two columns', () => { + const indexes = indexesOf( + model(` @@fullTextIndex([text], name: "message_text_search") + @@fullTextIndex([summary], name: "message_summary_search")`), + ); + + expect(indexes.map((index) => index.prefix)).toEqual([ + 'message_text_search', + 'message_summary_search', + ]); + }); + + it('passes a where predicate through to the index, like @@index(expression:, where:)', () => { + const typed = indexesOf( + model(` @@fullTextIndex([text], where: "id > 0", name: "message_text_search_live")`), + ); + const authored = indexesOf( + model( + ` @@index(expression: "to_tsvector('english', \\"text\\")", type: "gin", where: "id > 0", name: "message_text_search_live")`, + ), + ); + + expect(typed).toEqual(authored); + expect(typed[0]).toMatchObject({ where: 'id > 0' }); + }); + + it('rejects a field that is not textual, naming the field and its type', () => { + const diagnostics = diagnosticsOf(model(` @@fullTextIndex([id], name: "message_id_search")`)); + + expect(diagnostics).toEqual( + expect.arrayContaining([ + expect.objectContaining({ + code: 'PSL_FULL_TEXT_INDEX_TEXT_FIELD', + message: expect.stringContaining('Message.id'), + }), + ]), + ); + expect(diagnostics[0]?.message).toContain('pg/int4@1'); + }); + + it('rejects a relation field', () => { + expect( + diagnosticsOf(` +model Author { + id Int @id + messages Message[] +} + +model Message { + id Int @id + text String + authorId Int + author Author @relation(fields: [authorId], references: [id]) + @@fullTextIndex([author], name: "message_author_search") +} +`), + ).toEqual( + expect.arrayContaining([expect.objectContaining({ code: 'PSL_FULL_TEXT_INDEX_TEXT_FIELD' })]), + ); + }); + + it('accepts a varchar column, mapped', () => { + const indexes = indexesOf(` +model Message { + id Int @id + subject Varchar @map("subject_line") + @@fullTextIndex([subject], name: "message_subject_search") +} +`); + + expect(indexes[0]).toMatchObject({ + expression: `to_tsvector('english', "subject_line")`, + }); + }); + + it('rejects a language Postgres does not ship, naming the ones it does', () => { + const [diagnostic] = diagnosticsOf( + model(` @@fullTextIndex([text], language: "klingon", name: "x")`), + ); + + expect(diagnostic?.message).toContain('"english"'); + expect(diagnostic?.message).toContain('"german"'); + }); + + it('rejects more than one field', () => { + expect(diagnosticsOf(model(` @@fullTextIndex([text, summary], name: "x")`))).toEqual( + expect.arrayContaining([ + expect.objectContaining({ + code: 'PSL_FULL_TEXT_INDEX_ONE_FIELD', + message: expect.stringContaining('one column'), + }), + ]), + ); + }); + + it('requires a name or a map', () => { + expect(diagnosticsOf(model(' @@fullTextIndex([text])'))).toEqual( + expect.arrayContaining([ + expect.objectContaining({ + code: 'PSL_FULL_TEXT_INDEX_REQUIRES_NAME', + message: expect.stringContaining('`name` or `map`'), + }), + ]), + ); + }); + + it('takes at most one of name and map', () => { + expect(diagnosticsOf(model(` @@fullTextIndex([text], name: "a", map: "b")`))).toEqual( + expect.arrayContaining([ + expect.objectContaining({ + code: 'PSL_FULL_TEXT_INDEX_NAME_XOR_MAP', + message: expect.stringContaining('at most one of `name` and `map`'), + }), + ]), + ); + }); +}); diff --git a/packages/3-targets/3-targets/postgres/test/query-operations.test.ts b/packages/3-targets/3-targets/postgres/test/query-operations.test.ts new file mode 100644 index 000000000000..bb203f1af917 --- /dev/null +++ b/packages/3-targets/3-targets/postgres/test/query-operations.test.ts @@ -0,0 +1,270 @@ +import { createSqlOperationRegistry } from '@internal/sql-operations'; +import { LiteralExpr, OperationExpr, ParamRef } from '@internal/sql-relational-core/ast'; +import { describe, expect, it } from 'vitest'; +import { POSTGRES_TEXT_SEARCH_LANGUAGES } from '../src/core/text-search-languages'; +import postgresTargetDescriptor from '../src/exports/runtime'; + +const TEXT_COLUMN_AST = ParamRef.of('body', { codec: { codecId: 'pg/text@1' } }); + +// Stands in for a contract-bound text column: the operations take an Expression on `self` and read +// its AST, not a bare AST node. +const TEXT_COLUMN = { + returnType: { codecId: 'pg/text@1', nullable: false }, + buildAst: () => TEXT_COLUMN_AST, +}; + +function operations() { + return postgresTargetDescriptor.queryOperations?.() ?? {}; +} + +function findOperation(method: string) { + const op = operations()[method]; + if (!op) throw new Error(`${method} not found`); + return op; +} + +function buildOpAst(method: string, ...args: unknown[]): OperationExpr { + const expr = findOperation(method).impl(...(args as never[])) as unknown as { + buildAst(): OperationExpr; + }; + return expr.buildAst(); +} + +describe('postgres target query operations', () => { + it('ilike lowers to the infix ILIKE template', () => { + const ast = buildOpAst('ilike', TEXT_COLUMN, '%launch%'); + + expect(ast).toBeInstanceOf(OperationExpr); + expect(ast.lowering).toEqual({ + targetFamily: 'sql', + strategy: 'infix', + template: '{{self}} ILIKE {{arg0}}', + }); + expect(ast.returns).toEqual({ codecId: 'pg/bool@1', nullable: false }); + }); + + const fullTextOps: ReadonlyArray = [ + [ + 'fullTextMatches', + 'pg/bool@1', + 'to_tsvector({{arg1}}, {{self}}) @@ websearch_to_tsquery({{arg1}}, {{arg0}})', + ], + [ + 'fullTextRank', + 'pg/float4@1', + 'ts_rank(to_tsvector({{arg1}}, {{self}}), websearch_to_tsquery({{arg1}}, {{arg0}}))', + ], + [ + 'fullTextHeadline', + 'pg/text@1', + 'ts_headline({{arg1}}, {{self}}, websearch_to_tsquery({{arg1}}, {{arg0}}))', + ], + ]; + + describe.each(fullTextOps)('%s', (method, returnCodecId, template) => { + it('builds an OperationExpr with the expected lowering and return codec', () => { + const ast = buildOpAst(method, TEXT_COLUMN, 'prisma'); + + expect(ast).toBeInstanceOf(OperationExpr); + expect(ast.lowering).toEqual({ targetFamily: 'sql', strategy: 'function', template }); + expect(ast.returns).toEqual({ codecId: returnCodecId, nullable: false }); + }); + + it('binds the query as a pg/text@1 parameter', () => { + const queryArg = buildOpAst(method, TEXT_COLUMN, 'prisma').args[0]; + + expect(queryArg).toBeInstanceOf(ParamRef); + expect((queryArg as ParamRef).value).toBe('prisma'); + expect((queryArg as ParamRef).codec?.codecId).toBe('pg/text@1'); + }); + + it('embeds the language as a literal, defaulting to english', () => { + const withDefault = buildOpAst(method, TEXT_COLUMN, 'prisma').args[1]; + const withGerman = buildOpAst(method, TEXT_COLUMN, 'prisma', { language: 'german' }).args[1]; + + expect(withDefault?.kind).toBe('literal'); + expect(withDefault).toBeInstanceOf(LiteralExpr); + expect((withDefault as LiteralExpr).value).toBe('english'); + expect((withGerman as LiteralExpr).value).toBe('german'); + }); + + it('rejects a language Postgres has no configuration for', () => { + const klingon = { language: 'klingon' }; + expect(() => buildOpAst(method, TEXT_COLUMN, 'prisma', klingon)).toThrow(/klingon/); + expect(() => buildOpAst(method, TEXT_COLUMN, 'prisma', klingon)).toThrow( + expect.objectContaining({ code: 'RUNTIME.ARGUMENT_INVALID' }), + ); + }); + + it('dispatches on the textual trait', () => { + expect(findOperation(method).self).toEqual({ traits: ['textual'] }); + }); + }); + + describe('fullTextRank options', () => { + const rankTemplate = (ast: OperationExpr) => ast.lowering?.template; + + it('renders ts_rank with no normalization argument when none is given', () => { + expect(rankTemplate(buildOpAst('fullTextRank', TEXT_COLUMN, 'prisma', {}))).toBe( + 'ts_rank(to_tsvector({{arg1}}, {{self}}), websearch_to_tsquery({{arg1}}, {{arg0}}))', + ); + }); + + it('embeds normalization as a numeric literal in a third argument', () => { + const ast = buildOpAst('fullTextRank', TEXT_COLUMN, 'prisma', { normalization: 32 }); + + expect(rankTemplate(ast)).toBe( + 'ts_rank(to_tsvector({{arg1}}, {{self}}), websearch_to_tsquery({{arg1}}, {{arg0}}), {{arg2}})', + ); + expect(ast.args[2]).toBeInstanceOf(LiteralExpr); + expect((ast.args[2] as LiteralExpr).value).toBe(32); + }); + + it('renders ts_rank_cd when coverDensity is set', () => { + expect( + rankTemplate(buildOpAst('fullTextRank', TEXT_COLUMN, 'prisma', { coverDensity: true })), + ).toBe( + 'ts_rank_cd(to_tsvector({{arg1}}, {{self}}), websearch_to_tsquery({{arg1}}, {{arg0}}))', + ); + expect( + rankTemplate(buildOpAst('fullTextRank', TEXT_COLUMN, 'prisma', { coverDensity: false })), + ).toBe('ts_rank(to_tsvector({{arg1}}, {{self}}), websearch_to_tsquery({{arg1}}, {{arg0}}))'); + }); + + it.each([-1, 64, 1.5])('rejects a normalization of %s', (normalization) => { + expect(() => buildOpAst('fullTextRank', TEXT_COLUMN, 'prisma', { normalization })).toThrow( + expect.objectContaining({ code: 'RUNTIME.ARGUMENT_INVALID' }), + ); + }); + }); + + describe('fullTextHeadline options', () => { + const optionsLiteral = (ast: OperationExpr) => (ast.args[2] as LiteralExpr | undefined)?.value; + + it('omits the options argument when only the language is given', () => { + const ast = buildOpAst('fullTextHeadline', TEXT_COLUMN, 'prisma', { language: 'german' }); + + expect(ast.lowering?.template).toBe( + 'ts_headline({{arg1}}, {{self}}, websearch_to_tsquery({{arg1}}, {{arg0}}))', + ); + // query, language — and no third argument. + expect(ast.args).toHaveLength(2); + }); + + it("renders the options as Postgres's Key=Value list, in one literal", () => { + const ast = buildOpAst('fullTextHeadline', TEXT_COLUMN, 'prisma', { + startSel: '', + stopSel: '', + maxWords: 20, + minWords: 5, + highlightAll: false, + }); + + expect(ast.lowering?.template).toBe( + 'ts_headline({{arg1}}, {{self}}, websearch_to_tsquery({{arg1}}, {{arg0}}), {{arg2}})', + ); + expect(optionsLiteral(ast)).toBe( + 'StartSel=, StopSel=, MaxWords=20, MinWords=5, HighlightAll=false', + ); + }); + + it('rejects a maxWords that is not a positive integer', () => { + for (const maxWords of [0, -3, 2.5]) { + expect(() => buildOpAst('fullTextHeadline', TEXT_COLUMN, 'p', { maxWords })).toThrow( + expect.objectContaining({ code: 'RUNTIME.ARGUMENT_INVALID' }), + ); + } + }); + + // Postgres itself requires MinWords strictly below MaxWords. + it.each([ + [10, 5], + [10, 10], + ])('rejects minWords %i against maxWords %i', (minWords, maxWords) => { + expect(() => + buildOpAst('fullTextHeadline', TEXT_COLUMN, 'p', { minWords, maxWords }), + ).toThrow(expect.objectContaining({ code: 'RUNTIME.ARGUMENT_INVALID' })); + }); + + it('accepts minWords below maxWords', () => { + expect(() => + buildOpAst('fullTextHeadline', TEXT_COLUMN, 'p', { minWords: 5, maxWords: 10 }), + ).not.toThrow(); + }); + + it.each(['', 'a,b', 'a=b', 'a"b', 'a b', 'a\\b'])('rejects the marker %o', (startSel) => { + expect(() => buildOpAst('fullTextHeadline', TEXT_COLUMN, 'p', { startSel })).toThrow( + expect.objectContaining({ code: 'RUNTIME.ARGUMENT_INVALID' }), + ); + }); + + it('rejects a highlightAll that is not a boolean', () => { + expect(() => + buildOpAst('fullTextHeadline', TEXT_COLUMN, 'p', { + highlightAll: 'yes' as unknown as never, + }), + ).toThrow(expect.objectContaining({ code: 'RUNTIME.ARGUMENT_INVALID' })); + }); + }); + + it('ilike dispatches on the textual trait', () => { + expect(findOperation('ilike').self).toEqual({ traits: ['textual'] }); + }); + + it('registers every operation in a SQL operation registry', () => { + const registry = createSqlOperationRegistry(); + for (const [name, op] of Object.entries(operations())) { + registry.register(name, op); + } + + const entries = registry.entries(); + for (const method of ['ilike', 'fullTextMatches', 'fullTextRank', 'fullTextHeadline']) { + expect(entries[method]).toBeDefined(); + } + }); + + it('the runtime target descriptor contributes exactly these four operations', () => { + expect(Object.keys(operations()).sort()).toEqual([ + 'fullTextHeadline', + 'fullTextMatches', + 'fullTextRank', + 'ilike', + ]); + }); +}); + +describe('the text-search language allowlist', () => { + it('is exactly the configurations a stock PostgreSQL server ships with', () => { + expect(POSTGRES_TEXT_SEARCH_LANGUAGES).toEqual([ + 'simple', + 'arabic', + 'armenian', + 'basque', + 'catalan', + 'danish', + 'dutch', + 'english', + 'finnish', + 'french', + 'german', + 'greek', + 'hindi', + 'hungarian', + 'indonesian', + 'irish', + 'italian', + 'lithuanian', + 'nepali', + 'norwegian', + 'portuguese', + 'romanian', + 'russian', + 'serbian', + 'spanish', + 'swedish', + 'tamil', + 'turkish', + 'yiddish', + ]); + }); +}); diff --git a/packages/3-targets/3-targets/postgres/tsdown.config.ts b/packages/3-targets/3-targets/postgres/tsdown.config.ts index 6d7b4478e39a..5393314bd0d1 100644 --- a/packages/3-targets/3-targets/postgres/tsdown.config.ts +++ b/packages/3-targets/3-targets/postgres/tsdown.config.ts @@ -18,6 +18,7 @@ export default defineConfig({ 'src/exports/migration.ts', 'src/exports/native-type-normalizer.ts', 'src/exports/op-factory-call.ts', + 'src/exports/operation-types.ts', 'src/exports/pack.ts', 'src/exports/planner-ddl-builders.ts', 'src/exports/planner-identity-values.ts', diff --git a/packages/3-targets/6-adapters/postgres/package.json b/packages/3-targets/6-adapters/postgres/package.json index a67681e94109..a2ae469b0b47 100644 --- a/packages/3-targets/6-adapters/postgres/package.json +++ b/packages/3-targets/6-adapters/postgres/package.json @@ -64,7 +64,6 @@ "./adapter": "./dist/adapter.mjs", "./column-types": "./dist/column-types.mjs", "./control": "./dist/control.mjs", - "./operation-types": "./dist/operation-types.mjs", "./runtime": "./dist/runtime.mjs", "./sql-renderer": "./dist/sql-renderer.mjs", "./types": "./dist/types.mjs", diff --git a/packages/3-targets/6-adapters/postgres/src/core/descriptor-meta.ts b/packages/3-targets/6-adapters/postgres/src/core/descriptor-meta.ts index 116270ad2b88..9574506717f3 100644 --- a/packages/3-targets/6-adapters/postgres/src/core/descriptor-meta.ts +++ b/packages/3-targets/6-adapters/postgres/src/core/descriptor-meta.ts @@ -1,11 +1,4 @@ import type { CodecControlHooks, ExpandNativeTypeInput } from '@internal/family-sql/control'; -import { - buildOperation, - type CodecExpression, - type Expression, - type TraitExpression, - toExpr, -} from '@internal/sql-relational-core/expression'; import { postgresAggregateDescriptors } from '@internal/target-postgres/aggregates'; import { PG_BIT_CODEC_ID, @@ -45,7 +38,6 @@ import { SQL_VARCHAR_CODEC_ID, } from '@internal/target-postgres/codec-ids'; import { postgresCodecRegistry } from '@internal/target-postgres/codecs'; -import type { QueryOperationTypes } from '../types/operation-types'; import { adapterError } from './adapter-errors'; // ============================================================================ Helper functions for reducing boilerplate ============================================================================ @@ -149,27 +141,6 @@ const identityHooks: CodecControlHooks = { expandNativeType: ({ nativeType }) => // ============================================================================ Descriptor metadata ============================================================================ -type CodecTypesBase = Record; - -export function postgresQueryOperations(): QueryOperationTypes { - return { - ilike: { - self: { traits: ['textual'] }, - impl: ( - self: TraitExpression, - pattern: CodecExpression<'pg/text@1', false, CT>, - ): Expression<{ codecId: 'pg/bool@1'; nullable: false }> => { - return buildOperation({ - method: 'ilike', - args: [toExpr(self), toExpr(pattern, { codecId: PG_TEXT_CODEC_ID })], - returns: { codecId: PG_BOOL_CODEC_ID, nullable: false }, - lowering: { targetFamily: 'sql', strategy: 'infix', template: '{{self}} ILIKE {{arg0}}' }, - }); - }, - }, - }; -} - export const postgresAdapterDescriptorMeta = { kind: 'adapter', familyId: 'sql', @@ -351,12 +322,5 @@ export const postgresAdapterDescriptorMeta = { { typeId: PG_UUID_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'uuid' }, { typeId: PG_INET_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'inet' }, ], - queryOperationTypes: { - import: { - package: '@internal/adapter-postgres/operation-types', - named: 'QueryOperationTypes', - alias: 'PgAdapterQueryOps', - }, - }, }, } as const; diff --git a/packages/3-targets/6-adapters/postgres/src/exports/operation-types.ts b/packages/3-targets/6-adapters/postgres/src/exports/operation-types.ts deleted file mode 100644 index 38dc6e72298f..000000000000 --- a/packages/3-targets/6-adapters/postgres/src/exports/operation-types.ts +++ /dev/null @@ -1 +0,0 @@ -export type { QueryOperationTypes } from '../types/operation-types'; diff --git a/packages/3-targets/6-adapters/postgres/src/exports/runtime.ts b/packages/3-targets/6-adapters/postgres/src/exports/runtime.ts index 7d71fe06c110..8ac5cf67d1e0 100644 --- a/packages/3-targets/6-adapters/postgres/src/exports/runtime.ts +++ b/packages/3-targets/6-adapters/postgres/src/exports/runtime.ts @@ -14,7 +14,7 @@ import { } from '@internal/target-postgres/runtime'; import { createPostgresAdapterWithCodecRegistry, postgresRawCodecInferer } from '../core/adapter'; import { assemblePostgresCodecRegistry } from '../core/codec-lookup'; -import { postgresAdapterDescriptorMeta, postgresQueryOperations } from '../core/descriptor-meta'; +import { postgresAdapterDescriptorMeta } from '../core/descriptor-meta'; import type { PostgresContract, PostgresLoweredStatement } from '../core/types'; export interface SqlRuntimeAdapter @@ -49,7 +49,6 @@ const postgresRuntimeAdapterDescriptor: SqlRuntimeAdapterDescriptor<'postgres', { ...postgresAdapterDescriptorMeta, codecs: () => Array.from(postgresCodecRegistry.values()), - queryOperations: () => postgresQueryOperations(), mutationDefaultGenerators: createPostgresMutationDefaultGenerators, rawCodecInferer: postgresRawCodecInferer, create(stack): SqlRuntimeAdapter { diff --git a/packages/3-targets/6-adapters/postgres/src/types/operation-types.ts b/packages/3-targets/6-adapters/postgres/src/types/operation-types.ts deleted file mode 100644 index 8e6eb72e26ea..000000000000 --- a/packages/3-targets/6-adapters/postgres/src/types/operation-types.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { SqlQueryOperationTypes } from '@internal/sql-contract/types'; -import type { - CodecExpression, - Expression, - TraitExpression, -} from '@internal/sql-relational-core/expression'; - -type CodecTypesBase = Record; - -export type QueryOperationTypes = SqlQueryOperationTypes< - CT, - { - readonly ilike: { - readonly self: { readonly traits: readonly ['textual'] }; - readonly impl: ( - self: TraitExpression, - pattern: CodecExpression<'pg/text@1', false, CT>, - ) => Expression<{ codecId: 'pg/bool@1'; nullable: false }>; - }; - } ->; diff --git a/packages/3-targets/6-adapters/postgres/test/descriptor-meta.test.ts b/packages/3-targets/6-adapters/postgres/test/descriptor-meta.test.ts index 9187702b7ba0..e08292fa419d 100644 --- a/packages/3-targets/6-adapters/postgres/test/descriptor-meta.test.ts +++ b/packages/3-targets/6-adapters/postgres/test/descriptor-meta.test.ts @@ -1,6 +1,7 @@ import { describe, expect, it } from 'vitest'; import { postgresNativeAuthoringTypes } from '../src/core/control-mutation-defaults'; import { postgresAdapterDescriptorMeta } from '../src/core/descriptor-meta'; +import postgresRuntimeAdapterDescriptor from '../src/exports/runtime'; const storage = postgresAdapterDescriptorMeta.types.storage; @@ -253,3 +254,15 @@ describe('precision bounds agree between authoring and expansion', () => { }, ); }); + +describe('postgres adapter query operations', () => { + // Postgres built-in operations moved to @internal/target-postgres; the adapter contributes none, + // so a stale slot here would register them twice. + it('the runtime descriptor contributes no query operations', () => { + expect(postgresRuntimeAdapterDescriptor.queryOperations).toBeUndefined(); + }); + + it('the descriptor meta declares no query-operation type import', () => { + expect(postgresAdapterDescriptorMeta.types).not.toHaveProperty('queryOperationTypes'); + }); +}); diff --git a/packages/3-targets/6-adapters/postgres/test/migrations/index-ddl-rendering.test.ts b/packages/3-targets/6-adapters/postgres/test/migrations/index-ddl-rendering.test.ts index 624ed946d2a7..10407eadf4f4 100644 --- a/packages/3-targets/6-adapters/postgres/test/migrations/index-ddl-rendering.test.ts +++ b/packages/3-targets/6-adapters/postgres/test/migrations/index-ddl-rendering.test.ts @@ -177,6 +177,19 @@ describe('CreateIndexCall DDL rendering', () => { ); }); + it('renders a GIN index over to_tsvector, the shape a full-text predicate needs', async () => { + const call = new CreateIndexCall( + 'public', + 'message', + 'message_text_search', + { expression: `to_tsvector('english', "text")` }, + { type: 'gin' }, + ); + expect(await executeSql(call)).toBe( + `CREATE INDEX "message_text_search" ON "public"."message" USING "gin" (to_tsvector('english', "text"))`, + ); + }); + it('combines unique, USING, expression, WITH, and WHERE in clause order', async () => { const call = new CreateIndexCall( 'public', diff --git a/packages/3-targets/6-adapters/postgres/tsdown.config.ts b/packages/3-targets/6-adapters/postgres/tsdown.config.ts index 141e70a95f7c..01100c99e576 100644 --- a/packages/3-targets/6-adapters/postgres/tsdown.config.ts +++ b/packages/3-targets/6-adapters/postgres/tsdown.config.ts @@ -6,7 +6,6 @@ export default defineConfig({ 'src/exports/types.ts', 'src/exports/column-types.ts', 'src/exports/control.ts', - 'src/exports/operation-types.ts', 'src/exports/runtime.ts', 'src/exports/sql-renderer.ts', ], diff --git a/packages/9-public/@prisma/orm-postgres/package.json b/packages/9-public/@prisma/orm-postgres/package.json index 6472d736bf53..3c2a6460917a 100644 --- a/packages/9-public/@prisma/orm-postgres/package.json +++ b/packages/9-public/@prisma/orm-postgres/package.json @@ -45,7 +45,6 @@ "./adapter/adapter": "./dist/adapter__adapter.mjs", "./adapter/column-types": "./dist/adapter__column-types.mjs", "./adapter/control": "./dist/adapter__control.mjs", - "./adapter/operation-types": "./dist/adapter__operation-types.mjs", "./adapter/runtime": "./dist/adapter__runtime.mjs", "./adapter/sql-renderer": "./dist/adapter__sql-renderer.mjs", "./adapter/types": "./dist/adapter__types.mjs", @@ -147,6 +146,7 @@ "./target/migration": "./dist/target__migration.mjs", "./target/native-type-normalizer": "./dist/target__native-type-normalizer.mjs", "./target/op-factory-call": "./dist/target__op-factory-call.mjs", + "./target/operation-types": "./dist/target__operation-types.mjs", "./target/pack": "./dist/target__pack.mjs", "./target/planner": "./dist/target__planner.mjs", "./target/planner-ddl-builders": "./dist/target__planner-ddl-builders.mjs", diff --git a/packages/9-public/@prisma/orm-target-postgres/package.json b/packages/9-public/@prisma/orm-target-postgres/package.json index 95901c653bdc..aca796ac2f29 100644 --- a/packages/9-public/@prisma/orm-target-postgres/package.json +++ b/packages/9-public/@prisma/orm-target-postgres/package.json @@ -50,7 +50,6 @@ "./adapter/adapter": "./dist/adapter__adapter.mjs", "./adapter/column-types": "./dist/adapter__column-types.mjs", "./adapter/control": "./dist/adapter__control.mjs", - "./adapter/operation-types": "./dist/adapter__operation-types.mjs", "./adapter/runtime": "./dist/adapter__runtime.mjs", "./adapter/sql-renderer": "./dist/adapter__sql-renderer.mjs", "./adapter/types": "./dist/adapter__types.mjs", @@ -74,6 +73,7 @@ "./target/migration": "./dist/target__migration.mjs", "./target/native-type-normalizer": "./dist/target__native-type-normalizer.mjs", "./target/op-factory-call": "./dist/target__op-factory-call.mjs", + "./target/operation-types": "./dist/target__operation-types.mjs", "./target/pack": "./dist/target__pack.mjs", "./target/planner": "./dist/target__planner.mjs", "./target/planner-ddl-builders": "./dist/target__planner-ddl-builders.mjs", diff --git a/skills/prisma-8/references/contract.md b/skills/prisma-8/references/contract.md index 19935a37f997..0067beba5a96 100644 --- a/skills/prisma-8/references/contract.md +++ b/skills/prisma-8/references/contract.md @@ -126,6 +126,16 @@ Then run `pnpm prisma contract emit` (or rely on the Vite plugin — see `refere `name:` declares a wire-named index (physical name `_<8-hex hash>`, renames plan as `ALTER INDEX … RENAME`); `map:` adopts an exact physical name verbatim (for infer-captured objects — combining it with a SQL body warns, because drift detection byte-compares the authored text against Postgres's reprint). An `expression:` requires `name:` or `map:`. The TS builder mirrors this via `constraints.index([cols.x], {...})` / `constraints.index({ expression, ... })` — see `packages/2-sql/2-authoring/contract-ts/README.md`. +**Full-text search indexes (PostgreSQL).** Do not hand-write the `to_tsvector` expression — Postgres only uses the index when it is the same `to_tsvector` over the same configuration literal and the same column as the query. Declare `@@fullTextIndex`, which renders the same expression `fullTextMatches` / `fullTextRank` / `fullTextHeadline` lower to (see `references/queries-postgres.md`): + +```prisma +@@fullTextIndex([text], name: "message_text_search") +@@fullTextIndex([summary], language: "german", name: "message_summary_search_de") +@@fullTextIndex([text], where: "archived_at IS NULL", name: "message_text_search_live") +``` + +The TS builder has the same helper: `fullTextIndex(cols.text, { name: 'message_text_search' })`, from `@prisma/orm-postgres/contract-builder`, inside the model's `sql({ indexes: [...] })`. It takes exactly one field, an optional `language` (default `english`, from the same allowlist the operations accept), an optional `where:` for a partial index, and `name:` xor `map:` like any expression index. It is repeatable, so a model may index several columns. Give the index and the operation the same `language` — a mismatch is silent, costing the index and falling back to a sequential scan. It lowers to a GIN index over `to_tsvector('', "")` — the column name resolved through `@map` — so `@@index(expression: …)` remains only for expressions this attribute does not cover. + PSL alias surface for repeated types lives in a top-level `types {}` block: ```prisma diff --git a/skills/prisma-8/references/queries-postgres.md b/skills/prisma-8/references/queries-postgres.md index 1f0354751a93..da2a263bf769 100644 --- a/skills/prisma-8/references/queries-postgres.md +++ b/skills/prisma-8/references/queries-postgres.md @@ -62,6 +62,44 @@ db.orm.public.User.where({ kind: 'admin' }); Operators on the field proxy include `.eq`, `.neq`, `.lt`, `.lte`, `.gt`, `.gte`, `.like`, `.ilike`, `.in([...])`, `.isNull()`, `.isNotNull()`. Extensions add target-specific operators on extension-typed columns (`pgvector`'s `.cosineDistance(...)`, `postgis`'s `.within(...)` / `.intersectsBbox(...)` / `.distanceSphere(...)`). +**Full-text search** is built into the Postgres target, on any text column: `.fullTextMatches(q)` is the predicate, `.fullTextRank(q)` scores a row so you can order by relevance, and `.fullTextHeadline(q)` returns the text with `` around the matches. The search string is a bound parameter lowered to `websearch_to_tsquery`, so `"an exact phrase"` and `-excluded` work the way a user expects from a search box. Each takes an options object as its second argument. `language` defaults to `'english'` and only accepts the configurations a stock PostgreSQL server ships with (`'simple'`, `'german'`, `'french'`, …); `fullTextRank` also takes `normalization` (the `ts_rank` bitmask, 0 to 63) and `coverDensity` (for `ts_rank_cd`); `fullTextHeadline` also takes `startSel`, `stopSel`, `maxWords`, `minWords` and `highlightAll`. Every one of them is written into the SQL as a literal, so anything invalid throws `RUNTIME.ARGUMENT_INVALID` when the query is built. + +```typescript +// ORM: filter by the query, order by relevance. +const hits = await db.orm.public.Message + .select('id', 'text') + .where((m) => m.text.fullTextMatches(query)) + .orderBy((m) => m.text.fullTextRank(query).desc()) + .limit(20) + .all(); + +// SQL builder: the same predicate, plus a snippet with your own markers. +const snippets = db.sql.public.message + .select('id') + .select('snippet', (f, fns) => + fns.fullTextHeadline(f.text, query, { startSel: '', stopSel: '', maxWords: 20 }), + ) + .where((f, fns) => fns.fullTextMatches(f.text, query)) + .build(); +``` + +Without an index Postgres recomputes `to_tsvector` for every row, and it only uses one whose expression is the same `to_tsvector` over the same configuration literal and the same column. `@@fullTextIndex` renders that expression for you — pass it the field and, if you use one, the same language: + +```prisma +@@fullTextIndex([text], name: "message_text_search") +@@fullTextIndex([text], where: "archived_at IS NULL", name: "message_text_search_live") +``` + +Give the index and the operation the same `language`: a mismatch raises no error, the query silently falls back to a sequential scan. + +In a TypeScript contract, the same helper from `@prisma/orm-postgres/contract-builder`: + +```typescript +model('Message', { fields: { id, text } }).sql(({ cols }) => ({ + indexes: [fullTextIndex(cols.text, { name: 'message_text_search' })], +})); +``` + **There is no `.between(a, b)` operator.** Express ranges either as two chained `.where(...)` clauses (the idiomatic form — clauses AND-compose) or with the `and(...)` combinator inside one clause: ```typescript diff --git a/test/e2e/framework/test/fixtures/generated/contract.d.ts b/test/e2e/framework/test/fixtures/generated/contract.d.ts index c41801bfe902..807704e83e10 100644 --- a/test/e2e/framework/test/fixtures/generated/contract.d.ts +++ b/test/e2e/framework/test/fixtures/generated/contract.d.ts @@ -7,7 +7,6 @@ import type { Vector, } from '@prisma/orm-extension-pgvector/codec-types'; import type { QueryOperationTypes as PgVectorQueryOperationTypes } from '@prisma/orm-extension-pgvector/operation-types'; -import type { QueryOperationTypes as PgAdapterQueryOps } from '@prisma/orm-postgres/adapter/operation-types'; import type { Bit, Char, @@ -25,6 +24,7 @@ import type { VarBit, Varchar, } from '@prisma/orm-postgres/target/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@prisma/orm-postgres/target/operation-types'; import type { ContractWithTypeMaps, @@ -48,7 +48,7 @@ export type ProfileHash = export type CodecTypes = PgTypes & ArktypeJsonTypes & PgVectorTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps & +export type QueryOperationTypes = PgTargetQueryOps & PgVectorQueryOperationTypes; export type AggregateTypes = { readonly avg: { diff --git a/test/integration/test/authoring/attribute-specs.lsp-consumability.test.ts b/test/integration/test/authoring/attribute-specs.lsp-consumability.test.ts index 4e321a04b054..c0f195f634c0 100644 --- a/test/integration/test/authoring/attribute-specs.lsp-consumability.test.ts +++ b/test/integration/test/authoring/attribute-specs.lsp-consumability.test.ts @@ -129,6 +129,7 @@ describe('mongo attribute specs are consumable from a resolved language-server p 'check', 'control', 'discriminator', + 'fullTextIndex', 'id', 'index', 'map', diff --git a/test/integration/test/emitter.adapter-query-operation-types.test.ts b/test/integration/test/emitter.target-query-operation-types.test.ts similarity index 79% rename from test/integration/test/emitter.adapter-query-operation-types.test.ts rename to test/integration/test/emitter.target-query-operation-types.test.ts index 2f0d87291988..54ecfb5af123 100644 --- a/test/integration/test/emitter.adapter-query-operation-types.test.ts +++ b/test/integration/test/emitter.target-query-operation-types.test.ts @@ -1,16 +1,16 @@ -import postgresAdapter from '@internal/adapter-postgres/control'; import type { Contract } from '@internal/contract/types'; import { generateContractDts } from '@internal/emitter'; import { extractQueryOperationTypeImports } from '@internal/framework-components/control'; import { UNBOUND_NAMESPACE_ID } from '@internal/framework-components/ir'; import type { SqlStorage } from '@internal/sql-contract/types'; import { sqlEmission } from '@internal/sql-contract-emitter'; +import postgresTarget from '@internal/target-postgres/control'; import { postgresCreateNamespace } from '@internal/target-postgres/types'; import { applicationDomainOf } from '@repo/test-utils'; import { describe, expect, it } from 'vitest'; -describe('emitter + postgres adapter descriptor', () => { - it('surfaces adapter-declared queryOperationTypes.import in generated contract.d.ts', () => { +describe('emitter + postgres target descriptor', () => { + it('surfaces target-declared queryOperationTypes.import in generated contract.d.ts', () => { const ir: Contract = { target: 'postgres', targetFamily: 'sql', @@ -30,7 +30,7 @@ describe('emitter + postgres adapter descriptor', () => { profileHash: 'profile:test' as never, meta: {}, }; - const queryOperationTypeImports = extractQueryOperationTypeImports([postgresAdapter]); + const queryOperationTypeImports = extractQueryOperationTypeImports([postgresTarget]); const types = generateContractDts( ir, @@ -41,8 +41,8 @@ describe('emitter + postgres adapter descriptor', () => { ); expect(types).toContain( - "import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'", + "import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'", ); - expect(types).toContain('export type QueryOperationTypes = PgAdapterQueryOps'); + expect(types).toContain('export type QueryOperationTypes = PgTargetQueryOps'); }); }); diff --git a/test/integration/test/enum-order-by/_fixture/generated/contract.d.ts b/test/integration/test/enum-order-by/_fixture/generated/contract.d.ts index 4285f57b9afe..b9cf62516968 100644 --- a/test/integration/test/enum-order-by/_fixture/generated/contract.d.ts +++ b/test/integration/test/enum-order-by/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/fixtures/contract.d.ts b/test/integration/test/fixtures/contract.d.ts index 0479385ebe9e..fcb51e63723f 100644 --- a/test/integration/test/fixtures/contract.d.ts +++ b/test/integration/test/fixtures/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/namespaced-accessors/fixtures/generated/contract.d.ts b/test/integration/test/namespaced-accessors/fixtures/generated/contract.d.ts index 432868739f81..e13cd8c601dd 100644 --- a/test/integration/test/namespaced-accessors/fixtures/generated/contract.d.ts +++ b/test/integration/test/namespaced-accessors/fixtures/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/aggregation/avg/_fixture/decimal/generated/contract.d.ts b/test/integration/test/ports/engines/queries/aggregation/avg/_fixture/decimal/generated/contract.d.ts index dadf709466e9..ea698c0e4cad 100644 --- a/test/integration/test/ports/engines/queries/aggregation/avg/_fixture/decimal/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/aggregation/avg/_fixture/decimal/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/aggregation/avg/_fixture/numeric/generated/contract.d.ts b/test/integration/test/ports/engines/queries/aggregation/avg/_fixture/numeric/generated/contract.d.ts index ddc0a987c082..2d920401f824 100644 --- a/test/integration/test/ports/engines/queries/aggregation/avg/_fixture/numeric/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/aggregation/avg/_fixture/numeric/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/aggregation/count/_fixture/generated/contract.d.ts b/test/integration/test/ports/engines/queries/aggregation/count/_fixture/generated/contract.d.ts index d7118d4502a1..cda11e9b5596 100644 --- a/test/integration/test/ports/engines/queries/aggregation/count/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/aggregation/count/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/aggregation/group_by/_fixture/main/generated/contract.d.ts b/test/integration/test/ports/engines/queries/aggregation/group_by/_fixture/main/generated/contract.d.ts index e307cd7ea132..62552d560570 100644 --- a/test/integration/test/ports/engines/queries/aggregation/group_by/_fixture/main/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/aggregation/group_by/_fixture/main/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/aggregation/group_by/_fixture/regression-21789/generated/contract.d.ts b/test/integration/test/ports/engines/queries/aggregation/group_by/_fixture/regression-21789/generated/contract.d.ts index f927e461775f..1a9e51028c20 100644 --- a/test/integration/test/ports/engines/queries/aggregation/group_by/_fixture/regression-21789/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/aggregation/group_by/_fixture/regression-21789/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/aggregation/group_by_having/_fixture/common/generated/contract.d.ts b/test/integration/test/ports/engines/queries/aggregation/group_by_having/_fixture/common/generated/contract.d.ts index bfc36a8cf07e..4d9dc4c8fa6c 100644 --- a/test/integration/test/ports/engines/queries/aggregation/group_by_having/_fixture/common/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/aggregation/group_by_having/_fixture/common/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/aggregation/group_by_having/_fixture/decimal/generated/contract.d.ts b/test/integration/test/ports/engines/queries/aggregation/group_by_having/_fixture/decimal/generated/contract.d.ts index d801664e62a3..125a04a2fc2b 100644 --- a/test/integration/test/ports/engines/queries/aggregation/group_by_having/_fixture/decimal/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/aggregation/group_by_having/_fixture/decimal/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/aggregation/many_count_relation/_fixture/compound/generated/contract.d.ts b/test/integration/test/ports/engines/queries/aggregation/many_count_relation/_fixture/compound/generated/contract.d.ts index c6ae2e409662..753b1d038cde 100644 --- a/test/integration/test/ports/engines/queries/aggregation/many_count_relation/_fixture/compound/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/aggregation/many_count_relation/_fixture/compound/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/aggregation/many_count_relation/_fixture/generated/contract.d.ts b/test/integration/test/ports/engines/queries/aggregation/many_count_relation/_fixture/generated/contract.d.ts index bd6dc8e6d816..4095125bb533 100644 --- a/test/integration/test/ports/engines/queries/aggregation/many_count_relation/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/aggregation/many_count_relation/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/aggregation/many_count_relation/_fixture/nested/generated/contract.d.ts b/test/integration/test/ports/engines/queries/aggregation/many_count_relation/_fixture/nested/generated/contract.d.ts index cc14673cb463..18ae2b2919b8 100644 --- a/test/integration/test/ports/engines/queries/aggregation/many_count_relation/_fixture/nested/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/aggregation/many_count_relation/_fixture/nested/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/aggregation/many_count_relation/_fixture/self/generated/contract.d.ts b/test/integration/test/ports/engines/queries/aggregation/many_count_relation/_fixture/self/generated/contract.d.ts index b077c8a74c3d..1cb1361ce9b3 100644 --- a/test/integration/test/ports/engines/queries/aggregation/many_count_relation/_fixture/self/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/aggregation/many_count_relation/_fixture/self/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/aggregation/max/_fixture/common/generated/contract.d.ts b/test/integration/test/ports/engines/queries/aggregation/max/_fixture/common/generated/contract.d.ts index fe4d1a324aca..e8c9daa3ac27 100644 --- a/test/integration/test/ports/engines/queries/aggregation/max/_fixture/common/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/aggregation/max/_fixture/common/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/aggregation/max/_fixture/decimal/generated/contract.d.ts b/test/integration/test/ports/engines/queries/aggregation/max/_fixture/decimal/generated/contract.d.ts index dadf709466e9..ea698c0e4cad 100644 --- a/test/integration/test/ports/engines/queries/aggregation/max/_fixture/decimal/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/aggregation/max/_fixture/decimal/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/aggregation/min/_fixture/common/generated/contract.d.ts b/test/integration/test/ports/engines/queries/aggregation/min/_fixture/common/generated/contract.d.ts index fe4d1a324aca..e8c9daa3ac27 100644 --- a/test/integration/test/ports/engines/queries/aggregation/min/_fixture/common/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/aggregation/min/_fixture/common/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/aggregation/min/_fixture/decimal/generated/contract.d.ts b/test/integration/test/ports/engines/queries/aggregation/min/_fixture/decimal/generated/contract.d.ts index dadf709466e9..ea698c0e4cad 100644 --- a/test/integration/test/ports/engines/queries/aggregation/min/_fixture/decimal/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/aggregation/min/_fixture/decimal/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/aggregation/sum/_fixture/decimal/generated/contract.d.ts b/test/integration/test/ports/engines/queries/aggregation/sum/_fixture/decimal/generated/contract.d.ts index dadf709466e9..ea698c0e4cad 100644 --- a/test/integration/test/ports/engines/queries/aggregation/sum/_fixture/decimal/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/aggregation/sum/_fixture/decimal/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/aggregation/sum/_fixture/numeric/generated/contract.d.ts b/test/integration/test/ports/engines/queries/aggregation/sum/_fixture/numeric/generated/contract.d.ts index ddc0a987c082..2d920401f824 100644 --- a/test/integration/test/ports/engines/queries/aggregation/sum/_fixture/numeric/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/aggregation/sum/_fixture/numeric/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/aggregation/uniq-count-relation/_fixture/base/generated/contract.d.ts b/test/integration/test/ports/engines/queries/aggregation/uniq-count-relation/_fixture/base/generated/contract.d.ts index bd6dc8e6d816..4095125bb533 100644 --- a/test/integration/test/ports/engines/queries/aggregation/uniq-count-relation/_fixture/base/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/aggregation/uniq-count-relation/_fixture/base/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/aggregation/uniq-count-relation/_fixture/nested/generated/contract.d.ts b/test/integration/test/ports/engines/queries/aggregation/uniq-count-relation/_fixture/nested/generated/contract.d.ts index cc14673cb463..18ae2b2919b8 100644 --- a/test/integration/test/ports/engines/queries/aggregation/uniq-count-relation/_fixture/nested/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/aggregation/uniq-count-relation/_fixture/nested/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/data_types/bigint/_fixture/generated/contract.d.ts b/test/integration/test/ports/engines/queries/data_types/bigint/_fixture/generated/contract.d.ts index d7118d4502a1..cda11e9b5596 100644 --- a/test/integration/test/ports/engines/queries/data_types/bigint/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/data_types/bigint/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/data_types/bool/_fixture/generated/contract.d.ts b/test/integration/test/ports/engines/queries/data_types/bool/_fixture/generated/contract.d.ts index d7118d4502a1..cda11e9b5596 100644 --- a/test/integration/test/ports/engines/queries/data_types/bool/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/data_types/bool/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/data_types/bytes/_fixture/relations/generated/contract.d.ts b/test/integration/test/ports/engines/queries/data_types/bytes/_fixture/relations/generated/contract.d.ts index 1e95cdf83918..832b0944a49f 100644 --- a/test/integration/test/ports/engines/queries/data_types/bytes/_fixture/relations/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/data_types/bytes/_fixture/relations/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/data_types/bytes/_fixture/scalars/generated/contract.d.ts b/test/integration/test/ports/engines/queries/data_types/bytes/_fixture/scalars/generated/contract.d.ts index d7118d4502a1..cda11e9b5596 100644 --- a/test/integration/test/ports/engines/queries/data_types/bytes/_fixture/scalars/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/data_types/bytes/_fixture/scalars/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/data_types/datetime/_fixture/generated/contract.d.ts b/test/integration/test/ports/engines/queries/data_types/datetime/_fixture/generated/contract.d.ts index d7118d4502a1..cda11e9b5596 100644 --- a/test/integration/test/ports/engines/queries/data_types/datetime/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/data_types/datetime/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/data_types/decimal/_fixture/generated/contract.d.ts b/test/integration/test/ports/engines/queries/data_types/decimal/_fixture/generated/contract.d.ts index 6b980de61f0c..c452767e0183 100644 --- a/test/integration/test/ports/engines/queries/data_types/decimal/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/data_types/decimal/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/data_types/enum_type/_fixture/postgres/generated/contract.d.ts b/test/integration/test/ports/engines/queries/data_types/enum_type/_fixture/postgres/generated/contract.d.ts index 9befb7a6e590..58226a6921bf 100644 --- a/test/integration/test/ports/engines/queries/data_types/enum_type/_fixture/postgres/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/data_types/enum_type/_fixture/postgres/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/data_types/float/_fixture/generated/contract.d.ts b/test/integration/test/ports/engines/queries/data_types/float/_fixture/generated/contract.d.ts index d7118d4502a1..cda11e9b5596 100644 --- a/test/integration/test/ports/engines/queries/data_types/float/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/data_types/float/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/data_types/int/_fixture/generated/contract.d.ts b/test/integration/test/ports/engines/queries/data_types/int/_fixture/generated/contract.d.ts index d7118d4502a1..cda11e9b5596 100644 --- a/test/integration/test/ports/engines/queries/data_types/int/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/data_types/int/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/data_types/json/_fixture/scalar/generated/contract.d.ts b/test/integration/test/ports/engines/queries/data_types/json/_fixture/scalar/generated/contract.d.ts index e5526157a237..e5dff27ebcd0 100644 --- a/test/integration/test/ports/engines/queries/data_types/json/_fixture/scalar/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/data_types/json/_fixture/scalar/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/data_types/native/postgres/_fixture/other/generated/contract.d.ts b/test/integration/test/ports/engines/queries/data_types/native/postgres/_fixture/other/generated/contract.d.ts index 03a704c688ba..c845ab87985a 100644 --- a/test/integration/test/ports/engines/queries/data_types/native/postgres/_fixture/other/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/data_types/native/postgres/_fixture/other/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/data_types/native/postgres/_fixture/string/generated/contract.d.ts b/test/integration/test/ports/engines/queries/data_types/native/postgres/_fixture/string/generated/contract.d.ts index 4b82f55ddf0d..26d5576d735e 100644 --- a/test/integration/test/ports/engines/queries/data_types/native/postgres/_fixture/string/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/data_types/native/postgres/_fixture/string/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/data_types/string/_fixture/generated/contract.d.ts b/test/integration/test/ports/engines/queries/data_types/string/_fixture/generated/contract.d.ts index d7118d4502a1..cda11e9b5596 100644 --- a/test/integration/test/ports/engines/queries/data_types/string/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/data_types/string/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/data_types/through_relation/_fixture/common/generated/contract.d.ts b/test/integration/test/ports/engines/queries/data_types/through_relation/_fixture/common/generated/contract.d.ts index e510383669e5..fc87fc7c32e0 100644 --- a/test/integration/test/ports/engines/queries/data_types/through_relation/_fixture/common/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/data_types/through_relation/_fixture/common/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/data_types/through_relation/_fixture/decimal/generated/contract.d.ts b/test/integration/test/ports/engines/queries/data_types/through_relation/_fixture/decimal/generated/contract.d.ts index c2a132b7be9d..fe8ba95c966f 100644 --- a/test/integration/test/ports/engines/queries/data_types/through_relation/_fixture/decimal/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/data_types/through_relation/_fixture/decimal/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/data_types/through_relation/_fixture/enum/generated/contract.d.ts b/test/integration/test/ports/engines/queries/data_types/through_relation/_fixture/enum/generated/contract.d.ts index a80422916e26..f48a233e88da 100644 --- a/test/integration/test/ports/engines/queries/data_types/through_relation/_fixture/enum/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/data_types/through_relation/_fixture/enum/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/data_types/through_relation/_fixture/json/generated/contract.d.ts b/test/integration/test/ports/engines/queries/data_types/through_relation/_fixture/json/generated/contract.d.ts index 4846525aed77..4046968f1d49 100644 --- a/test/integration/test/ports/engines/queries/data_types/through_relation/_fixture/json/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/data_types/through_relation/_fixture/json/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/data_types/through_relation/_fixture/lists/generated/contract.d.ts b/test/integration/test/ports/engines/queries/data_types/through_relation/_fixture/lists/generated/contract.d.ts index 1a27e9b24f04..9fc3b9913e1f 100644 --- a/test/integration/test/ports/engines/queries/data_types/through_relation/_fixture/lists/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/data_types/through_relation/_fixture/lists/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/distinct/_fixture/generated/contract.d.ts b/test/integration/test/ports/engines/queries/distinct/_fixture/generated/contract.d.ts index bdb97c47ff95..2506842aa4cc 100644 --- a/test/integration/test/ports/engines/queries/distinct/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/distinct/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/bigint_filter/_fixture/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/bigint_filter/_fixture/generated/contract.d.ts index d7118d4502a1..cda11e9b5596 100644 --- a/test/integration/test/ports/engines/queries/filters/bigint_filter/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/bigint_filter/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/bytes_filter/_fixture/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/bytes_filter/_fixture/generated/contract.d.ts index d7118d4502a1..cda11e9b5596 100644 --- a/test/integration/test/ports/engines/queries/filters/bytes_filter/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/bytes_filter/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/decimal_filter/_fixture/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/decimal_filter/_fixture/generated/contract.d.ts index 87a1be2a8966..a7f2e3d1ae56 100644 --- a/test/integration/test/ports/engines/queries/filters/decimal_filter/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/decimal_filter/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/field_reference/_fixture/decimal-list/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/field_reference/_fixture/decimal-list/generated/contract.d.ts index 40725aa4bbf7..024516480a1d 100644 --- a/test/integration/test/ports/engines/queries/filters/field_reference/_fixture/decimal-list/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/field_reference/_fixture/decimal-list/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/field_reference/_fixture/enum/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/field_reference/_fixture/enum/generated/contract.d.ts index 22e345a49ee8..54615423e0c9 100644 --- a/test/integration/test/ports/engines/queries/filters/field_reference/_fixture/enum/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/field_reference/_fixture/enum/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/field_reference/_fixture/list/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/field_reference/_fixture/list/generated/contract.d.ts index 0c5ddce75bb8..f78b2ad7555b 100644 --- a/test/integration/test/ports/engines/queries/filters/field_reference/_fixture/list/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/field_reference/_fixture/list/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/field_reference/_fixture/mixed/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/field_reference/_fixture/mixed/generated/contract.d.ts index a314e7cb37b0..b27b38979c46 100644 --- a/test/integration/test/ports/engines/queries/filters/field_reference/_fixture/mixed/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/field_reference/_fixture/mixed/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/field_reference/bigint_filter/_fixture/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/field_reference/bigint_filter/_fixture/generated/contract.d.ts index 1286843ee401..d1e7e9279acc 100644 --- a/test/integration/test/ports/engines/queries/filters/field_reference/bigint_filter/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/field_reference/bigint_filter/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/field_reference/bytes_filter/_fixture/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/field_reference/bytes_filter/_fixture/generated/contract.d.ts index 1286843ee401..d1e7e9279acc 100644 --- a/test/integration/test/ports/engines/queries/filters/field_reference/bytes_filter/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/field_reference/bytes_filter/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/field_reference/datetime_filter/_fixture/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/field_reference/datetime_filter/_fixture/generated/contract.d.ts index 1286843ee401..d1e7e9279acc 100644 --- a/test/integration/test/ports/engines/queries/filters/field_reference/datetime_filter/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/field_reference/datetime_filter/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/field_reference/decimal_filter/_fixture/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/field_reference/decimal_filter/_fixture/generated/contract.d.ts index fd688462b383..e2eec3c723eb 100644 --- a/test/integration/test/ports/engines/queries/filters/field_reference/decimal_filter/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/field_reference/decimal_filter/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/field_reference/failure/_fixture/common/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/field_reference/failure/_fixture/common/generated/contract.d.ts index 1286843ee401..d1e7e9279acc 100644 --- a/test/integration/test/ports/engines/queries/filters/field_reference/failure/_fixture/common/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/field_reference/failure/_fixture/common/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/field_reference/failure/_fixture/default/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/field_reference/failure/_fixture/default/generated/contract.d.ts index 2a2ba12429d5..e68fd2812046 100644 --- a/test/integration/test/ports/engines/queries/filters/field_reference/failure/_fixture/default/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/field_reference/failure/_fixture/default/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/field_reference/failure/_fixture/list/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/field_reference/failure/_fixture/list/generated/contract.d.ts index 3cc85e575a61..c2b61e8d7c3c 100644 --- a/test/integration/test/ports/engines/queries/filters/field_reference/failure/_fixture/list/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/field_reference/failure/_fixture/list/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/field_reference/float_filter/_fixture/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/field_reference/float_filter/_fixture/generated/contract.d.ts index 1286843ee401..d1e7e9279acc 100644 --- a/test/integration/test/ports/engines/queries/filters/field_reference/float_filter/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/field_reference/float_filter/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/field_reference/having_filter/_fixture/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/field_reference/having_filter/_fixture/generated/contract.d.ts index 1286843ee401..d1e7e9279acc 100644 --- a/test/integration/test/ports/engines/queries/filters/field_reference/having_filter/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/field_reference/having_filter/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/field_reference/int_filter/_fixture/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/field_reference/int_filter/_fixture/generated/contract.d.ts index 1286843ee401..d1e7e9279acc 100644 --- a/test/integration/test/ports/engines/queries/filters/field_reference/int_filter/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/field_reference/int_filter/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/field_reference/json_filter/_fixture/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/field_reference/json_filter/_fixture/generated/contract.d.ts index bb0fe0c34ac7..3fb07683466f 100644 --- a/test/integration/test/ports/engines/queries/filters/field_reference/json_filter/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/field_reference/json_filter/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/field_reference/json_filter/_fixture/list/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/field_reference/json_filter/_fixture/list/generated/contract.d.ts index f5aee636aa4a..06069953a64f 100644 --- a/test/integration/test/ports/engines/queries/filters/field_reference/json_filter/_fixture/list/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/field_reference/json_filter/_fixture/list/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/field_reference/relation_filter/_fixture/complex/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/field_reference/relation_filter/_fixture/complex/generated/contract.d.ts index 03f615b6b3eb..a1b3b16799e1 100644 --- a/test/integration/test/ports/engines/queries/filters/field_reference/relation_filter/_fixture/complex/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/field_reference/relation_filter/_fixture/complex/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/field_reference/relation_filter/_fixture/one-to-many/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/field_reference/relation_filter/_fixture/one-to-many/generated/contract.d.ts index d3d4eb67da75..6d7ccef8c033 100644 --- a/test/integration/test/ports/engines/queries/filters/field_reference/relation_filter/_fixture/one-to-many/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/field_reference/relation_filter/_fixture/one-to-many/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/field_reference/relation_filter/_fixture/one-to-one-list/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/field_reference/relation_filter/_fixture/one-to-one-list/generated/contract.d.ts index eddc8eeea32a..c9a818e6e32d 100644 --- a/test/integration/test/ports/engines/queries/filters/field_reference/relation_filter/_fixture/one-to-one-list/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/field_reference/relation_filter/_fixture/one-to-one-list/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/field_reference/relation_filter/_fixture/one-to-one/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/field_reference/relation_filter/_fixture/one-to-one/generated/contract.d.ts index 29238eb6e7ef..96180f750ca7 100644 --- a/test/integration/test/ports/engines/queries/filters/field_reference/relation_filter/_fixture/one-to-one/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/field_reference/relation_filter/_fixture/one-to-one/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/field_reference/string_filter/_fixture/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/field_reference/string_filter/_fixture/generated/contract.d.ts index 1286843ee401..d1e7e9279acc 100644 --- a/test/integration/test/ports/engines/queries/filters/field_reference/string_filter/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/field_reference/string_filter/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/filter_regression/_fixture/compound-one-to-many/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/filter_regression/_fixture/compound-one-to-many/generated/contract.d.ts index 2a09c4ac1749..112cf60fd5ab 100644 --- a/test/integration/test/ports/engines/queries/filters/filter_regression/_fixture/compound-one-to-many/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/filter_regression/_fixture/compound-one-to-many/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/filter_regression/_fixture/many-to-many/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/filter_regression/_fixture/many-to-many/generated/contract.d.ts index 89526ca7aa52..07aa05ce15e7 100644 --- a/test/integration/test/ports/engines/queries/filters/filter_regression/_fixture/many-to-many/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/filter_regression/_fixture/many-to-many/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/filter_regression/_fixture/one-to-many/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/filter_regression/_fixture/one-to-many/generated/contract.d.ts index 33e680c53428..9448f6ad872d 100644 --- a/test/integration/test/ports/engines/queries/filters/filter_regression/_fixture/one-to-many/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/filter_regression/_fixture/one-to-many/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/filters/_fixture/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/filters/_fixture/generated/contract.d.ts index 1f0c5051894c..fe90db89ec18 100644 --- a/test/integration/test/ports/engines/queries/filters/filters/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/filters/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/json/_fixture/optional/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/json/_fixture/optional/generated/contract.d.ts index e5526157a237..e5dff27ebcd0 100644 --- a/test/integration/test/ports/engines/queries/filters/json/_fixture/optional/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/json/_fixture/optional/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/list_filters/_fixture/base/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/list_filters/_fixture/base/generated/contract.d.ts index fd6ed74c8c0a..5ea3e168d6d0 100644 --- a/test/integration/test/ports/engines/queries/filters/list_filters/_fixture/base/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/list_filters/_fixture/base/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/list_filters/_fixture/decimal/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/list_filters/_fixture/decimal/generated/contract.d.ts index b65c4d3cc5d8..5210c31bc751 100644 --- a/test/integration/test/ports/engines/queries/filters/list_filters/_fixture/decimal/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/list_filters/_fixture/decimal/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/list_filters/_fixture/json/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/list_filters/_fixture/json/generated/contract.d.ts index 7d1b4bcd219e..80f461c5fa5d 100644 --- a/test/integration/test/ports/engines/queries/filters/list_filters/_fixture/json/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/list_filters/_fixture/json/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/many_relation/_fixture/25103/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/many_relation/_fixture/25103/generated/contract.d.ts index 2f6d441d297a..e597edb2e94e 100644 --- a/test/integration/test/ports/engines/queries/filters/many_relation/_fixture/25103/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/many_relation/_fixture/25103/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/many_relation/_fixture/l2-to-one/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/many_relation/_fixture/l2-to-one/generated/contract.d.ts index 7428038736fa..4c0bac5eeaaf 100644 --- a/test/integration/test/ports/engines/queries/filters/many_relation/_fixture/l2-to-one/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/many_relation/_fixture/l2-to-one/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/one2one_regression/_fixture/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/one2one_regression/_fixture/generated/contract.d.ts index 8af7958c76ea..6cb80e578c6c 100644 --- a/test/integration/test/ports/engines/queries/filters/one2one_regression/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/one2one_regression/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/one_relation/_fixture/21356/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/one_relation/_fixture/21356/generated/contract.d.ts index 2875d316e816..823089d1d75d 100644 --- a/test/integration/test/ports/engines/queries/filters/one_relation/_fixture/21356/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/one_relation/_fixture/21356/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/queries/filters/one_relation/_fixture/21366/generated/contract.d.ts b/test/integration/test/ports/engines/queries/filters/one_relation/_fixture/21366/generated/contract.d.ts index 43688c640b8f..b80ab4239ff8 100644 --- a/test/integration/test/ports/engines/queries/filters/one_relation/_fixture/21366/generated/contract.d.ts +++ b/test/integration/test/ports/engines/queries/filters/one_relation/_fixture/21366/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/engines/writes/top_level_mutations/create_many/_fixture/generated/contract.d.ts b/test/integration/test/ports/engines/writes/top_level_mutations/create_many/_fixture/generated/contract.d.ts index 462fdcdc6bc5..068a57679c50 100644 --- a/test/integration/test/ports/engines/writes/top_level_mutations/create_many/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/engines/writes/top_level_mutations/create_many/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/batching-bigint/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/batching-bigint/_fixture/generated/contract.d.ts index a177faca3b21..1d80fd007736 100644 --- a/test/integration/test/ports/prisma/functional/batching-bigint/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/batching-bigint/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/batching-bytes/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/batching-bytes/_fixture/generated/contract.d.ts index eb79a4b84a9e..a726874bcbb1 100644 --- a/test/integration/test/ports/prisma/functional/batching-bytes/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/batching-bytes/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/blog-update/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/blog-update/_fixture/generated/contract.d.ts index 5a6862e1e7e4..96ec38a36d0f 100644 --- a/test/integration/test/ports/prisma/functional/blog-update/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/blog-update/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/bytes-upsert/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/bytes-upsert/_fixture/generated/contract.d.ts index e197b5445fbf..d5520de86478 100644 --- a/test/integration/test/ports/prisma/functional/bytes-upsert/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/bytes-upsert/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/chunking-query/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/chunking-query/_fixture/generated/contract.d.ts index ba52d426669a..f2da515246fb 100644 --- a/test/integration/test/ports/prisma/functional/chunking-query/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/chunking-query/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/create-default-date/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/create-default-date/_fixture/generated/contract.d.ts index 1e42f902ed69..e7cebcf617b2 100644 --- a/test/integration/test/ports/prisma/functional/create-default-date/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/create-default-date/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/decimal-list/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/decimal-list/_fixture/generated/contract.d.ts index 5ca0db6ee578..f6007b80dad6 100644 --- a/test/integration/test/ports/prisma/functional/decimal-list/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/decimal-list/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/decimal-precision/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/decimal-precision/_fixture/generated/contract.d.ts index d65887a22ae4..108e61143d1e 100644 --- a/test/integration/test/ports/prisma/functional/decimal-precision/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/decimal-precision/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/decimal-scalar/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/decimal-scalar/_fixture/generated/contract.d.ts index 784f1f41bb08..575e3146f754 100644 --- a/test/integration/test/ports/prisma/functional/decimal-scalar/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/decimal-scalar/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/default-selection/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/default-selection/_fixture/generated/contract.d.ts index 4399c6765ead..63557fb78d05 100644 --- a/test/integration/test/ports/prisma/functional/default-selection/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/default-selection/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/distinct/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/distinct/_fixture/generated/contract.d.ts index 9ae85edca91f..31cfd168f9ce 100644 --- a/test/integration/test/ports/prisma/functional/distinct/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/distinct/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/driver-adapters-error-forwarding/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/driver-adapters-error-forwarding/_fixture/generated/contract.d.ts index b37e392e7bb6..3b1f1d07a06e 100644 --- a/test/integration/test/ports/prisma/functional/driver-adapters-error-forwarding/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/driver-adapters-error-forwarding/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/driver-adapters-team-orm-687-bytes/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/driver-adapters-team-orm-687-bytes/_fixture/generated/contract.d.ts index ce3396f338c8..eb57e0b0e781 100644 --- a/test/integration/test/ports/prisma/functional/driver-adapters-team-orm-687-bytes/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/driver-adapters-team-orm-687-bytes/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/driver-adapters-validate-active-provider/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/driver-adapters-validate-active-provider/_fixture/generated/contract.d.ts index c5080489f684..e66f663d7285 100644 --- a/test/integration/test/ports/prisma/functional/driver-adapters-validate-active-provider/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/driver-adapters-validate-active-provider/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/enum-array/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/enum-array/_fixture/generated/contract.d.ts index 02a93cbbbd4e..b95adce983c2 100644 --- a/test/integration/test/ports/prisma/functional/enum-array/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/enum-array/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/extended-where/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/extended-where/_fixture/generated/contract.d.ts index 0f972bda071a..7a7e8491cebb 100644 --- a/test/integration/test/ports/prisma/functional/extended-where/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/extended-where/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/filter-count-relations/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/filter-count-relations/_fixture/generated/contract.d.ts index 99a55cc2d874..03815d191cb6 100644 --- a/test/integration/test/ports/prisma/functional/filter-count-relations/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/filter-count-relations/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/find-unique-or-throw-batching/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/find-unique-or-throw-batching/_fixture/generated/contract.d.ts index 16250b2a01c5..191ce7a57a98 100644 --- a/test/integration/test/ports/prisma/functional/find-unique-or-throw-batching/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/find-unique-or-throw-batching/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/handle-int-overflow/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/handle-int-overflow/_fixture/generated/contract.d.ts index 9fc66902f3a9..d57da311bbd5 100644 --- a/test/integration/test/ports/prisma/functional/handle-int-overflow/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/handle-int-overflow/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/interactive-transactions/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/interactive-transactions/_fixture/generated/contract.d.ts index ba8e57aa4de0..c602eaa51edc 100644 --- a/test/integration/test/ports/prisma/functional/interactive-transactions/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/interactive-transactions/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-11974/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-11974/_fixture/generated/contract.d.ts index d3288d205296..8c0b55fc56f0 100644 --- a/test/integration/test/ports/prisma/functional/issues-11974/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-11974/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-12378/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-12378/_fixture/generated/contract.d.ts index a7489ee187fe..c9e2c91c3806 100644 --- a/test/integration/test/ports/prisma/functional/issues-12378/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-12378/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-12557/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-12557/_fixture/generated/contract.d.ts index e746e30d35f0..423efa3c78e1 100644 --- a/test/integration/test/ports/prisma/functional/issues-12557/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-12557/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-12572/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-12572/_fixture/generated/contract.d.ts index 291a855fa531..cc68bc283d7c 100644 --- a/test/integration/test/ports/prisma/functional/issues-12572/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-12572/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-14271/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-14271/_fixture/generated/contract.d.ts index c1be5e13b075..e26825a19ff4 100644 --- a/test/integration/test/ports/prisma/functional/issues-14271/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-14271/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-14954-date-batch/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-14954-date-batch/_fixture/generated/contract.d.ts index d43a95682ba9..ef92cb267958 100644 --- a/test/integration/test/ports/prisma/functional/issues-14954-date-batch/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-14954-date-batch/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-15044/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-15044/_fixture/generated/contract.d.ts index 688e683db752..0d6fdaa13e1a 100644 --- a/test/integration/test/ports/prisma/functional/issues-15044/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-15044/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-16535-select-enum/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-16535-select-enum/_fixture/generated/contract.d.ts index 0c15b2eff7ab..7418e5d00ac3 100644 --- a/test/integration/test/ports/prisma/functional/issues-16535-select-enum/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-16535-select-enum/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-17005-args-type-conflict/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-17005-args-type-conflict/_fixture/generated/contract.d.ts index d900e8538abe..053315d308ef 100644 --- a/test/integration/test/ports/prisma/functional/issues-17005-args-type-conflict/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-17005-args-type-conflict/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-17030-args-type-conflict/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-17030-args-type-conflict/_fixture/generated/contract.d.ts index af8a6c5e4056..d5423dad6de1 100644 --- a/test/integration/test/ports/prisma/functional/issues-17030-args-type-conflict/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-17030-args-type-conflict/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-18970-invalid-date/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-18970-invalid-date/_fixture/generated/contract.d.ts index 693c4b600bf6..b8386c7b3bf5 100644 --- a/test/integration/test/ports/prisma/functional/issues-18970-invalid-date/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-18970-invalid-date/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-20261-group-by-shortcut/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-20261-group-by-shortcut/_fixture/generated/contract.d.ts index 90d5413574f9..70f7201ab97f 100644 --- a/test/integration/test/ports/prisma/functional/issues-20261-group-by-shortcut/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-20261-group-by-shortcut/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-21352-id-does-not-exist/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-21352-id-does-not-exist/_fixture/generated/contract.d.ts index b207b56f2482..ede3941aa4da 100644 --- a/test/integration/test/ports/prisma/functional/issues-21352-id-does-not-exist/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-21352-id-does-not-exist/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-21454-type-in-json/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-21454-type-in-json/_fixture/generated/contract.d.ts index 13fa29421dff..ef4573af998c 100644 --- a/test/integration/test/ports/prisma/functional/issues-21454-type-in-json/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-21454-type-in-json/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-21631-batching-in-transaction/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-21631-batching-in-transaction/_fixture/generated/contract.d.ts index 7ee089591f30..0ed9adc297c1 100644 --- a/test/integration/test/ports/prisma/functional/issues-21631-batching-in-transaction/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-21631-batching-in-transaction/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-22098-column-does-not-exist/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-22098-column-does-not-exist/_fixture/generated/contract.d.ts index c6d6d4071ccc..5d65d3509f3b 100644 --- a/test/integration/test/ports/prisma/functional/issues-22098-column-does-not-exist/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-22098-column-does-not-exist/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-22610-parallel-batch/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-22610-parallel-batch/_fixture/generated/contract.d.ts index 8696ec55d508..2b65c0453d4f 100644 --- a/test/integration/test/ports/prisma/functional/issues-22610-parallel-batch/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-22610-parallel-batch/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-23201-non-ascii-comments/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-23201-non-ascii-comments/_fixture/generated/contract.d.ts index 024ef3daf60a..570518252a67 100644 --- a/test/integration/test/ports/prisma/functional/issues-23201-non-ascii-comments/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-23201-non-ascii-comments/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-23902/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-23902/_fixture/generated/contract.d.ts index 1f717264ef61..37c5ca2bbb17 100644 --- a/test/integration/test/ports/prisma/functional/issues-23902/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-23902/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-25404/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-25404/_fixture/generated/contract.d.ts index 127dc68d0bdf..24fb3d382c93 100644 --- a/test/integration/test/ports/prisma/functional/issues-25404/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-25404/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-27455-bytes-id/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-27455-bytes-id/_fixture/generated/contract.d.ts index 96df3bea75e6..3087966f28e4 100644 --- a/test/integration/test/ports/prisma/functional/issues-27455-bytes-id/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-27455-bytes-id/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-27511-include-enum-array/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-27511-include-enum-array/_fixture/generated/contract.d.ts index a28f20b9b5dc..4ecb8b6660bc 100644 --- a/test/integration/test/ports/prisma/functional/issues-27511-include-enum-array/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-27511-include-enum-array/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-28151-broken-nested-set/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-28151-broken-nested-set/_fixture/generated/contract.d.ts index 03c3927f0fb9..f378aa3a05bb 100644 --- a/test/integration/test/ports/prisma/functional/issues-28151-broken-nested-set/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-28151-broken-nested-set/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-28192-pg-historical-dates/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-28192-pg-historical-dates/_fixture/generated/contract.d.ts index 49ae74f5c86e..d33f059a89f6 100644 --- a/test/integration/test/ports/prisma/functional/issues-28192-pg-historical-dates/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-28192-pg-historical-dates/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-28591-mapped-enums/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-28591-mapped-enums/_fixture/generated/contract.d.ts index ab6eadb1b481..4113e73c2a02 100644 --- a/test/integration/test/ports/prisma/functional/issues-28591-mapped-enums/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-28591-mapped-enums/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-29010-bigint-precision-relation-joins/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-29010-bigint-precision-relation-joins/_fixture/generated/contract.d.ts index 696ad2608db1..a7520b6ab6b4 100644 --- a/test/integration/test/ports/prisma/functional/issues-29010-bigint-precision-relation-joins/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-29010-bigint-precision-relation-joins/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-29174-jsonb-parameter-regression/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-29174-jsonb-parameter-regression/_fixture/generated/contract.d.ts index 5befd187de99..744c364bfcc3 100644 --- a/test/integration/test/ports/prisma/functional/issues-29174-jsonb-parameter-regression/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-29174-jsonb-parameter-regression/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-29176-cursor-parameter-regression/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-29176-cursor-parameter-regression/_fixture/generated/contract.d.ts index 1f26e7111b60..d3e132802fb9 100644 --- a/test/integration/test/ports/prisma/functional/issues-29176-cursor-parameter-regression/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-29176-cursor-parameter-regression/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-29254-query-plan-cache-mutation/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-29254-query-plan-cache-mutation/_fixture/generated/contract.d.ts index 45e9bb051f1e..185a6ff47c91 100644 --- a/test/integration/test/ports/prisma/functional/issues-29254-query-plan-cache-mutation/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-29254-query-plan-cache-mutation/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-29267-uint8array-in-json/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-29267-uint8array-in-json/_fixture/generated/contract.d.ts index 9ec3065f52b8..293fa1e2af43 100644 --- a/test/integration/test/ports/prisma/functional/issues-29267-uint8array-in-json/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-29267-uint8array-in-json/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-29309-datetime-cursor/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-29309-datetime-cursor/_fixture/generated/contract.d.ts index 1241aeeabc77..58d6249da8ef 100644 --- a/test/integration/test/ports/prisma/functional/issues-29309-datetime-cursor/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-29309-datetime-cursor/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-29331-query-plan-cache-bloat/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-29331-query-plan-cache-bloat/_fixture/generated/contract.d.ts index f36e51dec764..36c38f0a25b1 100644 --- a/test/integration/test/ports/prisma/functional/issues-29331-query-plan-cache-bloat/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-29331-query-plan-cache-bloat/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-4004/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-4004/_fixture/generated/contract.d.ts index d34aae2f0f52..c94689de769e 100644 --- a/test/integration/test/ports/prisma/functional/issues-4004/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-4004/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-5952-decimal-batch/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-5952-decimal-batch/_fixture/generated/contract.d.ts index 18eaef1b21f5..c911d62bd6b4 100644 --- a/test/integration/test/ports/prisma/functional/issues-5952-decimal-batch/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-5952-decimal-batch/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-TML-1664-invalid-enum-value-error/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-TML-1664-invalid-enum-value-error/_fixture/generated/contract.d.ts index 0507765e7a18..46554f7fd00a 100644 --- a/test/integration/test/ports/prisma/functional/issues-TML-1664-invalid-enum-value-error/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-TML-1664-invalid-enum-value-error/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-TML-1664-unknown-enum-value-read-error/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-TML-1664-unknown-enum-value-read-error/_fixture/generated/contract.d.ts index 980b6daecf3c..9075eb4390c0 100644 --- a/test/integration/test/ports/prisma/functional/issues-TML-1664-unknown-enum-value-read-error/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-TML-1664-unknown-enum-value-read-error/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/issues-unmapped-driver-error-user-facing/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/issues-unmapped-driver-error-user-facing/_fixture/generated/contract.d.ts index 4009568bbfbd..fb5e038b1b2b 100644 --- a/test/integration/test/ports/prisma/functional/issues-unmapped-driver-error-user-facing/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/issues-unmapped-driver-error-user-facing/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/json-fields/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/json-fields/_fixture/generated/contract.d.ts index 522c5f67e631..d47fadd6fab4 100644 --- a/test/integration/test/ports/prisma/functional/json-fields/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/json-fields/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/large-floats/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/large-floats/_fixture/generated/contract.d.ts index d4c59fba16ce..89eb2f84981d 100644 --- a/test/integration/test/ports/prisma/functional/large-floats/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/large-floats/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/legacy-aggregations/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/legacy-aggregations/_fixture/generated/contract.d.ts index d522591ea580..220732284dd9 100644 --- a/test/integration/test/ports/prisma/functional/legacy-aggregations/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/legacy-aggregations/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/legacy-json/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/legacy-json/_fixture/generated/contract.d.ts index f2bb64c07854..dc20c52319ee 100644 --- a/test/integration/test/ports/prisma/functional/legacy-json/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/legacy-json/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/legacy-optional-relation-filters/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/legacy-optional-relation-filters/_fixture/generated/contract.d.ts index 44b9ae016315..dc1ad83dec0f 100644 --- a/test/integration/test/ports/prisma/functional/legacy-optional-relation-filters/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/legacy-optional-relation-filters/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/methods-count/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/methods-count/_fixture/generated/contract.d.ts index e3e6d1bf81a2..09d9b9109154 100644 --- a/test/integration/test/ports/prisma/functional/methods-count/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/methods-count/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/methods-createMany/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/methods-createMany/_fixture/generated/contract.d.ts index 1815341bbffd..4a557fef410a 100644 --- a/test/integration/test/ports/prisma/functional/methods-createMany/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/methods-createMany/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/methods-createManyAndReturn/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/methods-createManyAndReturn/_fixture/generated/contract.d.ts index 1815341bbffd..4a557fef410a 100644 --- a/test/integration/test/ports/prisma/functional/methods-createManyAndReturn/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/methods-createManyAndReturn/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/methods-findFirstOrThrow/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/methods-findFirstOrThrow/_fixture/generated/contract.d.ts index d0aa60855f6f..fb8bad787b4f 100644 --- a/test/integration/test/ports/prisma/functional/methods-findFirstOrThrow/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/methods-findFirstOrThrow/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/methods-findUniqueOrThrow/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/methods-findUniqueOrThrow/_fixture/generated/contract.d.ts index c8a475e5b1ac..9742a8681f39 100644 --- a/test/integration/test/ports/prisma/functional/methods-findUniqueOrThrow/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/methods-findUniqueOrThrow/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/methods-updateManyAndReturn/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/methods-updateManyAndReturn/_fixture/generated/contract.d.ts index 1815341bbffd..4a557fef410a 100644 --- a/test/integration/test/ports/prisma/functional/methods-updateManyAndReturn/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/methods-updateManyAndReturn/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/methods-upsert-native-atomic/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/methods-upsert-native-atomic/_fixture/generated/contract.d.ts index ccfaf7cd5647..aacf0d5dcbd2 100644 --- a/test/integration/test/ports/prisma/functional/methods-upsert-native-atomic/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/methods-upsert-native-atomic/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/methods-upsert-simple/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/methods-upsert-simple/_fixture/generated/contract.d.ts index c15e3814600e..584a03ad782d 100644 --- a/test/integration/test/ports/prisma/functional/methods-upsert-simple/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/methods-upsert-simple/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/mixed-string-uuid-datetime-list-inputs/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/mixed-string-uuid-datetime-list-inputs/_fixture/generated/contract.d.ts index 230e67fad495..44696570ce0f 100644 --- a/test/integration/test/ports/prisma/functional/mixed-string-uuid-datetime-list-inputs/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/mixed-string-uuid-datetime-list-inputs/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/multi-schema/_fixture/different-names/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/multi-schema/_fixture/different-names/generated/contract.d.ts index 181dc62274c6..fa99df3ba8c0 100644 --- a/test/integration/test/ports/prisma/functional/multi-schema/_fixture/different-names/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/multi-schema/_fixture/different-names/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/multi-schema/_fixture/identical-names/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/multi-schema/_fixture/identical-names/generated/contract.d.ts index ff93793bd212..3c5bbd4b7859 100644 --- a/test/integration/test/ports/prisma/functional/multi-schema/_fixture/identical-names/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/multi-schema/_fixture/identical-names/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/multi-schema/_fixture/no-map/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/multi-schema/_fixture/no-map/generated/contract.d.ts index f647cee59b3e..7d2929403e54 100644 --- a/test/integration/test/ports/prisma/functional/multi-schema/_fixture/no-map/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/multi-schema/_fixture/no-map/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/multiple-types/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/multiple-types/_fixture/generated/contract.d.ts index f44c5b725473..dde8fc4b4e6c 100644 --- a/test/integration/test/ports/prisma/functional/multiple-types/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/multiple-types/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/optimistic-concurrency-control/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/optimistic-concurrency-control/_fixture/generated/contract.d.ts index d5fe08e5b7b6..2edbb54417fb 100644 --- a/test/integration/test/ports/prisma/functional/optimistic-concurrency-control/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/optimistic-concurrency-control/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/referential-actions-set-default-1to1/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/referential-actions-set-default-1to1/_fixture/generated/contract.d.ts index b3a4a11f8b9e..a80b203e56d3 100644 --- a/test/integration/test/ports/prisma/functional/referential-actions-set-default-1to1/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/referential-actions-set-default-1to1/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/referential-actions-set-default-1ton/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/referential-actions-set-default-1ton/_fixture/generated/contract.d.ts index b3a4a11f8b9e..a80b203e56d3 100644 --- a/test/integration/test/ports/prisma/functional/referential-actions-set-default-1ton/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/referential-actions-set-default-1ton/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/relation-mode-17255-mixed-actions/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/relation-mode-17255-mixed-actions/_fixture/generated/contract.d.ts index 1fb8bbe759ae..b726a630e54c 100644 --- a/test/integration/test/ports/prisma/functional/relation-mode-17255-mixed-actions/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/relation-mode-17255-mixed-actions/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/relation-mode-17255-same-actions/_fixture/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/relation-mode-17255-same-actions/_fixture/generated/contract.d.ts index e47a5d837826..74bdd25b9918 100644 --- a/test/integration/test/ports/prisma/functional/relation-mode-17255-same-actions/_fixture/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/relation-mode-17255-same-actions/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/cascade-map/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/cascade-map/generated/contract.d.ts index a99b1c00da44..97585ed2df47 100644 --- a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/cascade-map/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/cascade-map/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/cascade-plain/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/cascade-plain/generated/contract.d.ts index 316f7b3c866a..009d7bc1ca86 100644 --- a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/cascade-plain/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/cascade-plain/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/noaction-map/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/noaction-map/generated/contract.d.ts index 8d3d04e6f3fc..796f95abb1ac 100644 --- a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/noaction-map/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/noaction-map/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/noaction-plain/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/noaction-plain/generated/contract.d.ts index 79b5d4f4b3ef..3a6fa4ffd78d 100644 --- a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/noaction-plain/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/noaction-plain/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/restrict-map/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/restrict-map/generated/contract.d.ts index 7e856a796b17..8d845c7fa884 100644 --- a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/restrict-map/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/restrict-map/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/restrict-plain/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/restrict-plain/generated/contract.d.ts index 0d842008dc4f..08daf4e5d68f 100644 --- a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/restrict-plain/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/restrict-plain/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/setnull-map/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/setnull-map/generated/contract.d.ts index d1abbd3db607..b5d726577cd5 100644 --- a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/setnull-map/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/setnull-map/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/setnull-plain/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/setnull-plain/generated/contract.d.ts index 29f0b9019bb8..ea0da04d36c5 100644 --- a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/setnull-plain/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-1/_fixture/setnull-plain/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/cascade-map/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/cascade-map/generated/contract.d.ts index 243f0ac12fd0..4c7ae0b55251 100644 --- a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/cascade-map/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/cascade-map/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/cascade-plain/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/cascade-plain/generated/contract.d.ts index 4620c3f47f80..e17af3d62de6 100644 --- a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/cascade-plain/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/cascade-plain/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/noaction-map/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/noaction-map/generated/contract.d.ts index c2da9d48cfe2..dd5cbe0a3795 100644 --- a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/noaction-map/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/noaction-map/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/noaction-plain/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/noaction-plain/generated/contract.d.ts index 1cebaec268e7..359d802b5875 100644 --- a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/noaction-plain/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/noaction-plain/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/restrict-map/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/restrict-map/generated/contract.d.ts index 7c12f2b4dd68..5bbb2d6dc305 100644 --- a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/restrict-map/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/restrict-map/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/restrict-plain/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/restrict-plain/generated/contract.d.ts index a31875a4d927..9903617a5692 100644 --- a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/restrict-plain/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/restrict-plain/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/setnull-map/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/setnull-map/generated/contract.d.ts index fdcd2c3e5375..cb92285f25e2 100644 --- a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/setnull-map/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/setnull-map/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/setnull-plain/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/setnull-plain/generated/contract.d.ts index 3c9b744e2f05..7362619bc2bf 100644 --- a/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/setnull-plain/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/relation-mode-gh-1-to-n/_fixture/setnull-plain/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/relation-mode-gh-m-to-n/_fixture/cascade-nomap/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/relation-mode-gh-m-to-n/_fixture/cascade-nomap/generated/contract.d.ts index df47a8e8a3bb..3aa5fc8d68da 100644 --- a/test/integration/test/ports/prisma/functional/relation-mode-gh-m-to-n/_fixture/cascade-nomap/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/relation-mode-gh-m-to-n/_fixture/cascade-nomap/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/relation-mode-gh-m-to-n/_fixture/default-nomap/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/relation-mode-gh-m-to-n/_fixture/default-nomap/generated/contract.d.ts index b4c5a3063431..1d3507b620d3 100644 --- a/test/integration/test/ports/prisma/functional/relation-mode-gh-m-to-n/_fixture/default-nomap/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/relation-mode-gh-m-to-n/_fixture/default-nomap/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/relation-mode-gh-m-to-n/_fixture/noaction-nomap/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/relation-mode-gh-m-to-n/_fixture/noaction-nomap/generated/contract.d.ts index b4c5a3063431..1d3507b620d3 100644 --- a/test/integration/test/ports/prisma/functional/relation-mode-gh-m-to-n/_fixture/noaction-nomap/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/relation-mode-gh-m-to-n/_fixture/noaction-nomap/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/ports/prisma/functional/relation-mode-gh-m-to-n/_fixture/restrict-nomap/generated/contract.d.ts b/test/integration/test/ports/prisma/functional/relation-mode-gh-m-to-n/_fixture/restrict-nomap/generated/contract.d.ts index 3e9195c142f5..04a962b230e4 100644 --- a/test/integration/test/ports/prisma/functional/relation-mode-gh-m-to-n/_fixture/restrict-nomap/generated/contract.d.ts +++ b/test/integration/test/ports/prisma/functional/relation-mode-gh-m-to-n/_fixture/restrict-nomap/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/sql-builder/extension-functions.test.ts b/test/integration/test/sql-builder/extension-functions.test.ts index 0f528001c485..e740b9325b64 100644 --- a/test/integration/test/sql-builder/extension-functions.test.ts +++ b/test/integration/test/sql-builder/extension-functions.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest'; import { setupIntegrationTest, timeouts } from './setup'; -describe('integration: ilike (adapter operation)', { timeout: timeouts.databaseOperation }, () => { +describe('integration: ilike (target operation)', { timeout: timeouts.databaseOperation }, () => { const { db, runtime } = setupIntegrationTest(); it('ilike filters case-insensitively in WHERE', async () => { @@ -83,3 +83,92 @@ describe('integration: extension functions', { timeout: timeouts.databaseOperati expect(rows.some((r) => r.id === 1)).toBe(true); }); }); + +describe('integration: full-text search', { timeout: timeouts.databaseOperation }, () => { + const { db, runtime } = setupIntegrationTest(); + + const idsMatching = async (query: string, language?: 'german') => { + const rows = await runtime().query( + db() + .public.comments.select('id') + .where((f, fns) => + language === undefined + ? fns.fullTextMatches(f.body, query) + : fns.fullTextMatches(f.body, query, { language }), + ) + .build(), + ); + return rows.map((row) => row.id).sort((a, b) => a - b); + }; + + it('fullTextMatches keeps rows containing the word and drops the rest', async () => { + expect(await idsMatching('alice')).toEqual([101, 102, 106]); + }); + + it('fullTextMatches on a quoted phrase requires the words to be adjacent', async () => { + expect(await idsMatching('"quick brown"')).toEqual([104]); + }); + + it('fullTextMatches excludes rows carrying a -prefixed word', async () => { + expect(await idsMatching('alice -manuscript')).toEqual([101, 102]); + }); + + it('fullTextMatches accepts a non-default language', async () => { + expect(await idsMatching('alice', 'german')).toEqual([101, 102, 106]); + }); + + it('fullTextRank ranks the row with more occurrences first', async () => { + const rows = await runtime().query( + db() + .public.comments.select('id') + .where((f, fns) => fns.fullTextMatches(f.body, 'alice')) + .orderBy((f, fns) => fns.fullTextRank(f.body, 'alice'), { direction: 'desc' }) + .build(), + ); + expect(rows.map((row) => row.id)[0]).toBe(102); + }); + + it('fullTextHeadline takes the markers it is given', async () => { + const row = await runtime() + .query( + db() + .public.comments.select('id') + .select('snippet', (f, fns) => + fns.fullTextHeadline(f.body, 'alice', { startSel: '', stopSel: '' }), + ) + .where((f, fns) => fns.eq(f.id, 101)) + .build(), + ) + .firstOrThrow(); + expect(row.snippet).toBe('alice wrote the report'); + }); + + it('fullTextRank normalizes the score into (0, 1] when asked', async () => { + const rows = await runtime().query( + db() + .public.comments.select('id') + .select('rank', (f, fns) => fns.fullTextRank(f.body, 'alice', { normalization: 32 })) + .where((f, fns) => fns.fullTextMatches(f.body, 'alice')) + .build(), + ); + + expect(rows.length).toBeGreaterThan(0); + for (const row of rows) { + expect(row.rank).toBeGreaterThan(0); + expect(row.rank).toBeLessThanOrEqual(1); + } + }); + + it('fullTextHeadline marks the matched word up', async () => { + const row = await runtime() + .query( + db() + .public.comments.select('id') + .select('snippet', (f, fns) => fns.fullTextHeadline(f.body, 'alice')) + .where((f, fns) => fns.eq(f.id, 101)) + .build(), + ) + .firstOrThrow(); + expect(row.snippet).toBe('alice wrote the report'); + }); +}); diff --git a/test/integration/test/sql-builder/fixtures/contract.ts b/test/integration/test/sql-builder/fixtures/contract.ts index 7594bd89267a..283706ad2fed 100644 --- a/test/integration/test/sql-builder/fixtures/contract.ts +++ b/test/integration/test/sql-builder/fixtures/contract.ts @@ -1,8 +1,14 @@ -import { int4Column, textColumn } from '@internal/adapter-postgres/column-types'; +import { int4Column, textColumn, varcharColumn } from '@internal/adapter-postgres/column-types'; import { vector } from '@internal/extension-pgvector/column-types'; import pgvector from '@internal/extension-pgvector/pack'; import { uuidv4 } from '@internal/ids'; -import { defineContract, field, model, rel } from '@internal/postgres/contract-builder'; +import { + defineContract, + field, + fullTextIndex, + model, + rel, +} from '@internal/postgres/contract-builder'; const UserBase = model('User', { fields: { @@ -31,9 +37,22 @@ const Comment = model('Comment', { fields: { id: field.column(int4Column).id(), body: field.column(textColumn), + // A varchar sibling of `body`: Postgres stores `(subject)::text` inside the + // index expression, and the full-text integration test checks that a query + // over the same column still matches that index. + subject: field.column(varcharColumn(200)), postId: field.column(int4Column).column('post_id'), }, -}).sql({ table: 'comments' }); +}).sql(({ cols }) => ({ + table: 'comments', + indexes: [ + fullTextIndex(cols.body, { name: 'comments_body_search' }), + fullTextIndex(cols.subject, { name: 'comments_subject_search' }), + // Partial: the index-usage test proves Postgres picks this one up for a + // query that carries the same predicate. + fullTextIndex(cols.body, { where: 'post_id = 1', name: 'comments_body_live' }), + ], +})); const Profile = model('Profile', { fields: { diff --git a/test/integration/test/sql-builder/fixtures/generated-no-pgvector/contract.d.ts b/test/integration/test/sql-builder/fixtures/generated-no-pgvector/contract.d.ts index 8c8cd56d6ba7..3a2844b6bdee 100644 --- a/test/integration/test/sql-builder/fixtures/generated-no-pgvector/contract.d.ts +++ b/test/integration/test/sql-builder/fixtures/generated-no-pgvector/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/sql-builder/fixtures/generated/contract.d.ts b/test/integration/test/sql-builder/fixtures/generated/contract.d.ts index a5e52199c9d4..19604143e99d 100644 --- a/test/integration/test/sql-builder/fixtures/generated/contract.d.ts +++ b/test/integration/test/sql-builder/fixtures/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { CodecTypes as PgVectorTypes, Vector } from '@internal/extension-pgvector/codec-types'; import type { QueryOperationTypes as PgVectorQueryOperationTypes } from '@internal/extension-pgvector/operation-types'; import type { @@ -21,6 +20,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -36,7 +36,7 @@ import type { } from '@internal/contract/types'; export type StorageHash = - StorageHashBase<'121dbb4712cd62b323dfeb9c77a406b0f824adb69ed9454150bb537ed460ba38'>; + StorageHashBase<'4e3e7b1a2e6aed06486b55d35bf1fe4b435c2c16ce1a0de8ba7ffc82157b6b64'>; export type ExecutionHash = ExecutionHashBase<'566d74b60e6b5393dcdbf9f250120fa4e1f12c0ae51e1c0958a131d8ed9667b5'>; export type ProfileHash = @@ -44,7 +44,7 @@ export type ProfileHash = export type CodecTypes = PgTypes & PgVectorTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps & +export type QueryOperationTypes = PgTargetQueryOps & PgVectorQueryOperationTypes; export type AggregateTypes = { readonly avg: { @@ -258,6 +258,7 @@ export type FieldOutputTypes = { readonly body: CodecTypes['pg/text@1']['output']; readonly id: CodecTypes['pg/int4@1']['output']; readonly postId: CodecTypes['pg/int4@1']['output']; + readonly subject: Varchar<200>; }; readonly Post: { readonly embedding: Vector<3> | null; @@ -289,6 +290,7 @@ export type FieldInputTypes = { readonly body: CodecTypes['pg/text@1']['input']; readonly id: CodecTypes['pg/int4@1']['input']; readonly postId: CodecTypes['pg/int4@1']['input']; + readonly subject: CodecTypes['sql/varchar@1']['input']; }; readonly Post: { readonly embedding: CodecTypes['pg/vector@1']['input'] | null; @@ -317,6 +319,7 @@ export type StorageColumnTypes = { readonly body: CodecTypes['pg/text@1']['output']; readonly id: CodecTypes['pg/int4@1']['output']; readonly post_id: CodecTypes['pg/int4@1']['output']; + readonly subject: Varchar<200>; }; readonly posts: { readonly embedding: Vector<3> | null; @@ -348,6 +351,7 @@ export type StorageColumnInputTypes = { readonly body: CodecTypes['pg/text@1']['input']; readonly id: CodecTypes['pg/int4@1']['input']; readonly post_id: CodecTypes['pg/int4@1']['input']; + readonly subject: CodecTypes['sql/varchar@1']['input']; }; readonly posts: { readonly embedding: CodecTypes['pg/vector@1']['input'] | null; @@ -380,6 +384,7 @@ export namespace Models { body: CodecTypes['pg/text@1']['output']; id: CodecTypes['pg/int4@1']['output']; postId: CodecTypes['pg/int4@1']['output']; + subject: Varchar<200>; readonly [RelationKeys]?: never; }; export type public_Post = { @@ -475,10 +480,39 @@ type ContractBase = Omit< readonly codecId: 'pg/int4@1'; readonly nullable: false; }; + readonly subject: { + readonly nativeType: 'character varying'; + readonly codecId: 'sql/varchar@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 200 }; + }; }; primaryKey: { readonly columns: readonly ['id'] }; uniques: readonly []; - indexes: readonly []; + indexes: readonly [ + { + readonly name: 'comments_body_live_a3f98ae2'; + readonly prefix: 'comments_body_live'; + readonly expression: 'to_tsvector(\'english\', "body")'; + readonly where: 'post_id = 1'; + readonly unique: false; + readonly type: 'gin'; + }, + { + readonly name: 'comments_body_search_7b2cde4d'; + readonly prefix: 'comments_body_search'; + readonly expression: 'to_tsvector(\'english\', "body")'; + readonly unique: false; + readonly type: 'gin'; + }, + { + readonly name: 'comments_subject_search_2b3d17a7'; + readonly prefix: 'comments_subject_search'; + readonly expression: 'to_tsvector(\'english\', "subject")'; + readonly unique: false; + readonly type: 'gin'; + }, + ]; foreignKeys: readonly []; }; readonly posts: { @@ -626,6 +660,14 @@ type ContractBase = Omit< readonly nullable: false; readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; }; + readonly subject: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/varchar@1'; + readonly typeParams: { readonly length: 200 }; + }; + }; }; readonly relations: Record; readonly storage: { @@ -635,6 +677,7 @@ type ContractBase = Omit< readonly body: { readonly column: 'body' }; readonly id: { readonly column: 'id' }; readonly postId: { readonly column: 'post_id' }; + readonly subject: { readonly column: 'subject' }; }; }; }; diff --git a/test/integration/test/sql-builder/fixtures/generated/contract.json b/test/integration/test/sql-builder/fixtures/generated/contract.json index 6f0db0fe3daf..5402867e86f7 100644 --- a/test/integration/test/sql-builder/fixtures/generated/contract.json +++ b/test/integration/test/sql-builder/fixtures/generated/contract.json @@ -85,6 +85,16 @@ "codecId": "pg/int4@1", "kind": "scalar" } + }, + "subject": { + "nullable": false, + "type": { + "codecId": "sql/varchar@1", + "kind": "scalar", + "typeParams": { + "length": 200 + } + } } }, "relations": {}, @@ -98,6 +108,9 @@ }, "postId": { "column": "post_id" + }, + "subject": { + "column": "subject" } }, "namespaceId": "public", @@ -405,10 +418,41 @@ "codecId": "pg/int4@1", "nativeType": "int4", "nullable": false + }, + "subject": { + "codecId": "sql/varchar@1", + "nativeType": "character varying", + "nullable": false, + "typeParams": { + "length": 200 + } } }, "foreignKeys": [], - "indexes": [], + "indexes": [ + { + "expression": "to_tsvector('english', \"body\")", + "name": "comments_body_live_a3f98ae2", + "prefix": "comments_body_live", + "type": "gin", + "unique": false, + "where": "post_id = 1" + }, + { + "expression": "to_tsvector('english', \"body\")", + "name": "comments_body_search_7b2cde4d", + "prefix": "comments_body_search", + "type": "gin", + "unique": false + }, + { + "expression": "to_tsvector('english', \"subject\")", + "name": "comments_subject_search_2b3d17a7", + "prefix": "comments_subject_search", + "type": "gin", + "unique": false + } + ], "primaryKey": { "columns": [ "id" @@ -521,7 +565,7 @@ "kind": "postgres-schema" } }, - "storageHash": "121dbb4712cd62b323dfeb9c77a406b0f824adb69ed9454150bb537ed460ba38" + "storageHash": "4e3e7b1a2e6aed06486b55d35bf1fe4b435c2c16ce1a0de8ba7ffc82157b6b64" }, "execution": { "executionHash": "566d74b60e6b5393dcdbf9f250120fa4e1f12c0ae51e1c0958a131d8ed9667b5", diff --git a/test/integration/test/sql-builder/full-text-index-usage.test.ts b/test/integration/test/sql-builder/full-text-index-usage.test.ts new file mode 100644 index 000000000000..4903aaac7306 --- /dev/null +++ b/test/integration/test/sql-builder/full-text-index-usage.test.ts @@ -0,0 +1,290 @@ +/** + * Does Postgres actually use the GIN index our `@@fullTextIndex` attribute + * emits, for the SQL our lanes lower? Prisma 7 built such an index and the + * planner never chose it, so nothing here is assumed: + * + * - every index a positive case relies on is created from the DDL our own op + * factory and adapter render for the fixture contract's index node, the + * partial one included, never hand-written; + * - the queries are the real lowered SQL and bound params of the SQL builder + * and the ORM; + * - `EXPLAIN (FORMAT JSON)` on exactly that SQL has to name the index; + * - two negative controls (a different language, and an index built with the + * one-argument `to_tsvector`) must NOT be chosen, so a passing assertion + * means something. + * + * `enable_seqscan = off` makes this a question of whether the index is usable + * at all rather than one about cost estimates on a small table. + */ +import { + createPostgresBuiltinCodecLookup, + PostgresControlAdapter, +} from '@internal/adapter-postgres/control'; +import { Collection } from '@internal/sql-orm-client'; +import type { SqlQueryPlan } from '@internal/sql-relational-core/plan'; +import { CreateIndexCall } from '@internal/target-postgres/op-factory-call'; +import { blindCast } from '@internal/utils/casts'; +import { beforeAll, describe, expect, it } from 'vitest'; +import { setupIntegrationTest, timeouts } from './setup'; + +const QUERY = 'zebra'; + +/** Every `Index Name` anywhere in an EXPLAIN plan tree. */ +function indexNames(node: unknown): readonly string[] { + if (Array.isArray(node)) return node.flatMap(indexNames); + if (node === null || typeof node !== 'object') return []; + const record: Record = { ...node }; + const own = typeof record['Index Name'] === 'string' ? [record['Index Name']] : []; + return [...own, ...Object.values(record).flatMap(indexNames)]; +} + +/** Every `Node Type` anywhere in an EXPLAIN plan tree. */ +function nodeTypes(node: unknown): readonly string[] { + if (Array.isArray(node)) return node.flatMap(nodeTypes); + if (node === null || typeof node !== 'object') return []; + const record: Record = { ...node }; + const own = typeof record['Node Type'] === 'string' ? [record['Node Type']] : []; + return [...own, ...Object.values(record).flatMap(nodeTypes)]; +} + +describe('full-text index usage', { timeout: timeouts.databaseOperation }, () => { + const { db, runtime, client, contract, context, lower } = setupIntegrationTest(); + + const controlAdapter = new PostgresControlAdapter(createPostgresBuiltinCodecLookup()); + + /** The index nodes the fixture's `fullTextIndex(...)` helpers emitted. */ + function fixtureIndexes() { + const namespace = blindCast< + { readonly table: Record[] }> }, + 'the fixture contract is a Postgres schema; only its comment indexes are read here' + >(contract().storage.namespaces['public']); + return namespace.table['comments']!.indexes; + } + + function createIndexCallFor(index: Record): CreateIndexCall { + const where = index['where']; + return new CreateIndexCall( + 'public', + 'comments', + String(index['name']), + { expression: String(index['expression']) }, + { type: String(index['type']), ...(where === undefined ? {} : { where: String(where) }) }, + ); + } + + async function createIndexFromContract(index: Record) { + const op = await createIndexCallFor(index).toOp(controlAdapter); + for (const step of op.execute) { + await client().query(step.sql); + } + } + + /** The physical name the fixture's index carries, wire hash included. */ + function indexNamed(prefix: string): string { + return String(fixtureIndex(prefix)['name']); + } + + /** `lowerSqlPlan` already unwrapped the renderer's slots to bare bound values. */ + async function explain(sql: string, params: readonly unknown[]) { + const result = await client().query(`EXPLAIN (FORMAT JSON) ${sql}`, [...params]); + return result.rows[0]['QUERY PLAN']; + } + + function loweredOf(plan: SqlQueryPlan) { + return lower(plan); + } + + beforeAll(async () => { + for (const index of fixtureIndexes()) await createIndexFromContract(index); + + // A control index over the same column in another configuration: buildable, + // and not the expression our english query renders. + await client().query( + `CREATE INDEX comments_body_simple ON comments USING gin (to_tsvector('simple', "body"))`, + ); + + await client().query(` + INSERT INTO comments (id, body, subject, post_id) + SELECT 1000 + n, + CASE WHEN n % 97 = 0 THEN 'a zebra grazes here' ELSE 'ordinary filler text ' || n END, + CASE WHEN n % 97 = 0 THEN 'zebra subject' ELSE 'filler subject ' || n END, + 1 + FROM generate_series(1, 600) AS n + `); + await client().query('ANALYZE comments'); + await client().query('SET enable_seqscan = off'); + }, timeouts.spinUpPpgDev); + + /** The index node the fixture's `fullTextIndex(...)` emitted under this prefix. */ + function fixtureIndex(prefix: string): Record { + const index = fixtureIndexes().find((candidate) => candidate['prefix'] === prefix); + if (index === undefined) throw new Error(`fixture index ${prefix} is missing`); + return index; + } + + async function renderCreateIndex(prefix: string): Promise { + const op = await createIndexCallFor(fixtureIndex(prefix)).toOp(controlAdapter); + const [step] = op.execute; + return step?.sql ?? ''; + } + + it('creates the index from the DDL our own op factory and adapter render', async () => { + expect(await renderCreateIndex('comments_body_search')).toBe( + `CREATE INDEX "comments_body_search_7b2cde4d" ON "public"."comments" USING "gin" (to_tsvector('english', "body"))`, + ); + }); + + it('renders the WHERE clause for a partial index the attribute emitted', async () => { + expect(await renderCreateIndex('comments_body_live')).toBe( + `CREATE INDEX "comments_body_live_a3f98ae2" ON "public"."comments" USING "gin" (to_tsvector('english', "body")) WHERE (post_id = 1)`, + ); + }); + + it('lowers the predicate to the index expression, with the query bound as a parameter', () => { + const lowered = loweredOf( + db() + .public.comments.select('id') + .where((f, fns) => fns.fullTextMatches(f.body, QUERY)) + .build(), + ); + + // Byte-identical to the index expression in the builder's case. The ORM + // qualifies the column instead, and still matches: Postgres compares parsed + // expression trees, not text. + expect(lowered.sql).toContain(`to_tsvector('english', "body")`); + expect(lowered.sql).toContain(`websearch_to_tsquery('english', $1)`); + expect(lowered.params).toEqual([QUERY]); + }); + + it('uses the index for the SQL builder predicate', async () => { + const lowered = loweredOf( + db() + .public.comments.select('id') + .where((f, fns) => fns.fullTextMatches(f.body, QUERY)) + .build(), + ); + + const plan = await explain(lowered.sql, lowered.params); + expect(indexNames(plan)).toContain(indexNamed('comments_body_search')); + }); + + it('uses the index when the same predicate is ordered by rank and limited', async () => { + const lowered = loweredOf( + db() + .public.comments.select('id') + .where((f, fns) => fns.fullTextMatches(f.body, QUERY)) + .orderBy((f, fns) => fns.fullTextRank(f.body, QUERY), { direction: 'desc' }) + .limit(10) + .build(), + ); + + const plan = await explain(lowered.sql, lowered.params); + expect(indexNames(plan)).toContain(indexNamed('comments_body_search')); + }); + + it('uses the index for the ORM predicate ordered by rank', async () => { + const captured: SqlQueryPlan[] = []; + const real = runtime(); + const recording = blindCast< + typeof real, + 'a recording proxy over the suite runtime; the collection only queries through it' + >({ + ...real, + query: ((plan: SqlQueryPlan, options?: Parameters[1]) => { + captured.push(plan); + return real.query(plan, options); + }) satisfies (...args: never[]) => unknown, + }); + + const comments = new Collection({ runtime: recording, context: context() }, 'Comment', { + namespaceId: 'public', + }); + await comments + .select('id') + .where((row) => row.body.fullTextMatches(QUERY)) + .orderBy((row) => row.body.fullTextRank(QUERY).desc()) + .all(); + + const plan = captured[0]; + expect(plan).toBeDefined(); + if (plan === undefined) return; + const lowered = loweredOf(plan); + expect(lowered.sql).toContain(`to_tsvector('english', "comments"."body")`); + + const explained = await explain(lowered.sql, lowered.params); + expect(indexNames(explained)).toContain(indexNamed('comments_body_search')); + }); + + it('matches the index on a varchar column too', async () => { + const lowered = loweredOf( + db() + .public.comments.select('id') + .where((f, fns) => fns.fullTextMatches(f.subject, QUERY)) + .build(), + ); + + const plan = await explain(lowered.sql, lowered.params); + expect(indexNames(plan)).toContain(indexNamed('comments_subject_search')); + }); + + it('stores the varchar index with the cast Postgres adds, and matches it anyway', async () => { + const definition = await client().query( + `SELECT pg_get_indexdef('${indexNamed('comments_subject_search')}'::regclass) AS def`, + ); + + // Postgres rewrites our `"subject"` to `(subject)::text` inside the stored + // expression, because `to_tsvector(regconfig, text)` takes text. The query + // gets the same implicit cast, which is why the two still meet. + expect(definition.rows[0].def).toContain('(subject)::text'); + }); + + it('uses the partial index @@fullTextIndex(where:) emits for a query carrying that predicate', async () => { + const lowered = loweredOf( + db() + .public.comments.select('id') + .where((f, fns) => fns.fullTextMatches(f.body, QUERY)) + .where((f, fns) => fns.eq(f.post_id, 1)) + .build(), + ); + + const plan = await explain(lowered.sql, lowered.params); + expect(indexNames(plan)).toContain(indexNamed('comments_body_live')); + }); + + describe('negative controls', () => { + it('does not use the english index for a german query', async () => { + const lowered = loweredOf( + db() + .public.comments.select('id') + .where((f, fns) => fns.fullTextMatches(f.body, QUERY, { language: 'german' })) + .build(), + ); + + const plan = await explain(lowered.sql, lowered.params); + expect(indexNames(plan)).not.toContain(indexNamed('comments_body_search')); + expect(nodeTypes(plan)).toContain('Seq Scan'); + }); + + it('does not use an index over the same column in another configuration', async () => { + const lowered = loweredOf( + db() + .public.comments.select('id') + .where((f, fns) => fns.fullTextMatches(f.body, QUERY)) + .build(), + ); + + const plan = await explain(lowered.sql, lowered.params); + expect(indexNames(plan)).not.toContain('comments_body_simple'); + }); + + // The one-argument `to_tsvector(body)` reads `default_text_search_config`, + // so it is not IMMUTABLE and Postgres refuses to index it at all. Rendering + // the configuration into the expression, as the attribute does, is what + // makes the index possible — not merely what makes it match. + it('rejects an index over the one-argument to_tsvector outright', async () => { + await expect( + client().query('CREATE INDEX c_default_config ON comments USING gin (to_tsvector(body))'), + ).rejects.toThrow(/IMMUTABLE/); + }); + }); +}); diff --git a/test/integration/test/sql-builder/playground/extension-functions.test-d.ts b/test/integration/test/sql-builder/playground/extension-functions.test-d.ts index 2a1a0f5fbd5f..15ae66a13271 100644 --- a/test/integration/test/sql-builder/playground/extension-functions.test-d.ts +++ b/test/integration/test/sql-builder/playground/extension-functions.test-d.ts @@ -46,3 +46,65 @@ test('ilike returns boolean expression', () => { return result; }); }); + +test('fullTextMatches returns a non-nullable boolean expression', () => { + db.public.users.select('id').where((f, fns) => { + const result = fns.fullTextMatches(f.name, 'alice'); + expectTypeOf(result).toEqualTypeOf>(); + return result; + }); +}); + +test('fullTextRank returns a non-nullable float4 expression', () => { + const ranked = db.public.users + .select('id') + .select('rank', (f, fns) => { + const result = fns.fullTextRank(f.name, 'alice'); + expectTypeOf(result).toEqualTypeOf>(); + return result; + }) + .build(); + + expectTypeOf(ranked).toEqualTypeOf>(); +}); + +test('fullTextHeadline returns a non-nullable text expression', () => { + const headlined = db.public.users + .select('id') + .select('snippet', (f, fns) => { + const result = fns.fullTextHeadline(f.name, 'alice'); + expectTypeOf(result).toEqualTypeOf>(); + return result; + }) + .build(); + + expectTypeOf(headlined).toEqualTypeOf>(); +}); + +test('the language argument is one of the configurations Postgres ships with', () => { + db.public.users + .select('id') + .where((f, fns) => fns.fullTextMatches(f.name, 'alice', { language: 'german' })); + + db.public.users + .select('id') + // @ts-expect-error 'klingon' is not a PostgreSQL text-search configuration + .where((f, fns) => fns.fullTextMatches(f.name, 'alice', { language: 'klingon' })); +}); + +test('rank and headline options are typed', () => { + db.public.users + .select('id') + .select('rank', (f, fns) => fns.fullTextRank(f.name, 'alice', { normalization: 32 })) + .select('snippet', (f, fns) => fns.fullTextHeadline(f.name, 'alice', { startSel: '' })); + + db.public.users + .select('id') + // @ts-expect-error normalization is a number, not a word + .select('rank', (f, fns) => fns.fullTextRank(f.name, 'alice', { normalization: 'high' })); + + db.public.users + .select('id') + // @ts-expect-error startSel is the marker text, not a number + .select('snippet', (f, fns) => fns.fullTextHeadline(f.name, 'alice', { startSel: 1 })); +}); diff --git a/test/integration/test/sql-builder/setup.ts b/test/integration/test/sql-builder/setup.ts index 41502d840447..27ae6951fdfd 100644 --- a/test/integration/test/sql-builder/setup.ts +++ b/test/integration/test/sql-builder/setup.ts @@ -5,10 +5,13 @@ import pgvector from '@internal/extension-pgvector/runtime'; import { instantiateExecutionStack } from '@internal/framework-components/execution'; import { PostgresRuntimeImpl } from '@internal/postgres/runtime'; import { sql } from '@internal/sql-builder/runtime'; +import type { Adapter, AnyQueryAst, LoweredStatement } from '@internal/sql-relational-core/ast'; +import type { SqlQueryPlan } from '@internal/sql-relational-core/plan'; import type { ExecutionContext } from '@internal/sql-relational-core/query-lane-context'; import { createExecutionContext, createSqlExecutionStack, + lowerSqlPlan, type Runtime, } from '@internal/sql-runtime'; import postgresTarget, { PostgresContractSerializer } from '@internal/target-postgres/runtime'; @@ -30,11 +33,13 @@ const sqlContract = blindCast< export function setupIntegrationTest() { let runtime: Runtime; let context: ExecutionContext; + let client: Client; + let adapter: Adapter; const closeFns: Array<() => Promise> = []; beforeAll(async () => { const database = await createDevDatabase(); - const client = new Client({ connectionString: database.connectionString }); + client = new Client({ connectionString: database.connectionString }); await client.connect(); await setupTestDatabase(client, sqlContract, async (c) => { @@ -60,6 +65,7 @@ export function setupIntegrationTest() { CREATE TABLE comments ( id int4 PRIMARY KEY, body text NOT NULL, + subject varchar(200) NOT NULL, post_id int4 NOT NULL ) `); @@ -86,10 +92,16 @@ export function setupIntegrationTest() { (4, 'Another One', 3, 10, '[1,1,0]') `); await c.query(` - INSERT INTO comments (id, body, post_id) VALUES - (1, 'Great post!', 1), - (2, 'Nice work', 1), - (3, 'Interesting', 3) + INSERT INTO comments (id, body, subject, post_id) VALUES + (1, 'Great post!', 'praise', 1), + (2, 'Nice work', 'praise', 1), + (3, 'Interesting', 'remark', 3), + (101, 'alice wrote the report', 'alice subject line', 1), + (102, 'alice met alice and alice again', 'meeting notes', 1), + (103, 'bob wrote the report', 'bob subject line', 1), + (104, 'the quick brown fox jumps', 'animals', 1), + (105, 'a brown dog and a quick cat', 'animals', 1), + (106, 'alice manuscript draft', 'drafts', 1) `); await c.query(` INSERT INTO profiles (id, user_id, bio) VALUES @@ -125,6 +137,10 @@ export function setupIntegrationTest() { driver: cursorDisabledDriver, }); const driver = stackInstance.driver!; + adapter = blindCast< + Adapter, + 'the stack-composed adapter lowers this contract; the instance type erases the contract parameter' + >(stackInstance.adapter); await driver.connect({ kind: 'pgClient', client }); runtime = new PostgresRuntimeImpl({ @@ -153,5 +169,13 @@ export function setupIntegrationTest() { return { db: () => sql({ context, rawCodecInferer: postgresRawCodecInferer }), runtime: () => runtime, + /** The contract the fixture emits, for tests that read its storage. */ + contract: () => sqlContract, + /** The execution context, for tests that drive another lane over the same stack. */ + context: () => context, + /** The raw connection, for tests that need SQL the DSL does not express (EXPLAIN, DDL). */ + client: () => client, + /** The SQL and bound params a plan lowers to, exactly as the runtime sends them. */ + lower: (plan: SqlQueryPlan) => lowerSqlPlan(adapter, sqlContract, plan), }; } diff --git a/test/integration/test/sql-orm-client/extension-operations.test-d.ts b/test/integration/test/sql-orm-client/extension-operations.test-d.ts index 7a79b6f6d4a5..412bda34a051 100644 --- a/test/integration/test/sql-orm-client/extension-operations.test-d.ts +++ b/test/integration/test/sql-orm-client/extension-operations.test-d.ts @@ -143,3 +143,44 @@ describe('vector field itself: only equality trait', () => { expectTypeOf().not.toHaveProperty('asc'); }); }); + +describe('full-text search operations on text fields', () => { + test('text field exposes the full-text operations', () => { + expectTypeOf().toHaveProperty('fullTextMatches'); + expectTypeOf().toHaveProperty('fullTextRank'); + expectTypeOf().toHaveProperty('fullTextHeadline'); + }); + + test('numeric and vector fields do not', () => { + expectTypeOf().not.toHaveProperty('fullTextMatches'); + expectTypeOf().not.toHaveProperty('fullTextMatches'); + }); + + test('fullTextMatches returns a predicate expression', () => { + type Fn = PostAccessor['title']['fullTextMatches']; + expectTypeOf().toBeFunction(); + expectTypeOf>().toExtend< + import('@internal/sql-relational-core/ast').AnyExpression + >(); + }); + + test('fullTextRank returns numeric comparison methods, so it can order results', () => { + type RankResult = ReturnType; + expectTypeOf().toEqualTypeOf< + ComparisonMethods + >(); + expectTypeOf().toHaveProperty('desc'); + }); + + test('fullTextHeadline returns textual comparison methods', () => { + type HeadlineResult = ReturnType; + expectTypeOf().toHaveProperty('like'); + }); + + test('the language argument is one of the configurations Postgres ships with', () => { + const title = null as unknown as PostAccessor['title']; + title.fullTextMatches('alice', { language: 'german' }); + // @ts-expect-error 'klingon' is not a PostgreSQL text-search configuration + title.fullTextMatches('alice', { language: 'klingon' }); + }); +}); diff --git a/test/integration/test/sql-orm-client/extension-operations.test.ts b/test/integration/test/sql-orm-client/extension-operations.test.ts index 3eeefe0ae6d7..0fc6256c3c15 100644 --- a/test/integration/test/sql-orm-client/extension-operations.test.ts +++ b/test/integration/test/sql-orm-client/extension-operations.test.ts @@ -81,3 +81,56 @@ describe('integration/extension-operations', () => { timeouts.spinUpPpgDev, ); }); + +describe('integration/full-text-search operations', () => { + const seedSearchablePosts = async (runtime: Parameters[0]) => { + await seedUsers(runtime, [{ id: 1, name: 'Alice', email: 'alice@test.com' }]); + await seedPosts(runtime, [ + { id: 1, title: 'alice wrote the report', userId: 1, views: 10, embedding: null }, + { id: 2, title: 'alice met alice and alice again', userId: 1, views: 20, embedding: null }, + { id: 3, title: 'bob wrote the report', userId: 1, views: 30, embedding: null }, + ]); + }; + + it( + 'filters posts by fullTextMatches in where()', + async () => { + await withCollectionRuntime(async (runtime) => { + await seedSearchablePosts(runtime); + + const results = await createPostsCollection(runtime) + .select('id', 'title') + .where((p) => p.title.fullTextMatches('alice')) + .orderBy((p) => p.id.asc()) + .all(); + + expect(results).toEqual([ + { id: 1, title: 'alice wrote the report' }, + { id: 2, title: 'alice met alice and alice again' }, + ]); + }); + }, + timeouts.spinUpPpgDev, + ); + + it( + 'orders posts by fullTextRank in orderBy()', + async () => { + await withCollectionRuntime(async (runtime) => { + await seedSearchablePosts(runtime); + + const results = await createPostsCollection(runtime) + .select('id', 'title') + .where((p) => p.title.fullTextMatches('alice')) + .orderBy((p) => p.title.fullTextRank('alice').desc()) + .all(); + + expect(results).toEqual([ + { id: 2, title: 'alice met alice and alice again' }, + { id: 1, title: 'alice wrote the report' }, + ]); + }); + }, + timeouts.spinUpPpgDev, + ); +}); diff --git a/test/integration/test/sql-orm-client/fixtures/execution-defaulted-tags/generated/contract.d.ts b/test/integration/test/sql-orm-client/fixtures/execution-defaulted-tags/generated/contract.d.ts index ca0ee423fa2e..a66c4061fcbf 100644 --- a/test/integration/test/sql-orm-client/fixtures/execution-defaulted-tags/generated/contract.d.ts +++ b/test/integration/test/sql-orm-client/fixtures/execution-defaulted-tags/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/sql-orm-client/fixtures/generated/contract.d.ts b/test/integration/test/sql-orm-client/fixtures/generated/contract.d.ts index ff0122d784b0..8a7bf82a1907 100644 --- a/test/integration/test/sql-orm-client/fixtures/generated/contract.d.ts +++ b/test/integration/test/sql-orm-client/fixtures/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { CodecTypes as PgVectorTypes, Vector } from '@internal/extension-pgvector/codec-types'; import type { QueryOperationTypes as PgVectorQueryOperationTypes } from '@internal/extension-pgvector/operation-types'; import type { @@ -21,6 +20,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -44,7 +44,7 @@ export type ProfileHash = export type CodecTypes = PgTypes & PgVectorTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps & +export type QueryOperationTypes = PgTargetQueryOps & PgVectorQueryOperationTypes; export type AggregateTypes = { readonly avg: { diff --git a/test/integration/test/sql-orm-client/fixtures/integer-representation/generated/contract.d.ts b/test/integration/test/sql-orm-client/fixtures/integer-representation/generated/contract.d.ts index 784c8537ca63..e1dd52efb692 100644 --- a/test/integration/test/sql-orm-client/fixtures/integer-representation/generated/contract.d.ts +++ b/test/integration/test/sql-orm-client/fixtures/integer-representation/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/sql-orm-client/fixtures/junction-namespaces/generated/contract.d.ts b/test/integration/test/sql-orm-client/fixtures/junction-namespaces/generated/contract.d.ts index a23c242c624d..be403c6b7aca 100644 --- a/test/integration/test/sql-orm-client/fixtures/junction-namespaces/generated/contract.d.ts +++ b/test/integration/test/sql-orm-client/fixtures/junction-namespaces/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/sql-orm-client/fixtures/mn-psl/generated/contract.d.ts b/test/integration/test/sql-orm-client/fixtures/mn-psl/generated/contract.d.ts index 7ed156ecfccf..ddcc45a244a4 100644 --- a/test/integration/test/sql-orm-client/fixtures/mn-psl/generated/contract.d.ts +++ b/test/integration/test/sql-orm-client/fixtures/mn-psl/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/sql-orm-client/fixtures/non-identifier-names/generated/contract.d.ts b/test/integration/test/sql-orm-client/fixtures/non-identifier-names/generated/contract.d.ts index 6de7a74dd01c..33165a73844b 100644 --- a/test/integration/test/sql-orm-client/fixtures/non-identifier-names/generated/contract.d.ts +++ b/test/integration/test/sql-orm-client/fixtures/non-identifier-names/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/sql-orm-client/fixtures/polymorphism/generated/contract.d.ts b/test/integration/test/sql-orm-client/fixtures/polymorphism/generated/contract.d.ts index 1ba49cc7eabf..019bc2883d7b 100644 --- a/test/integration/test/sql-orm-client/fixtures/polymorphism/generated/contract.d.ts +++ b/test/integration/test/sql-orm-client/fixtures/polymorphism/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/sql-orm-client/fixtures/scalar-lists/generated/contract.d.ts b/test/integration/test/sql-orm-client/fixtures/scalar-lists/generated/contract.d.ts index f209845631f3..8a745cb42c8d 100644 --- a/test/integration/test/sql-orm-client/fixtures/scalar-lists/generated/contract.d.ts +++ b/test/integration/test/sql-orm-client/fixtures/scalar-lists/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -41,7 +41,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/sql-orm-client/fixtures/self-relations/contract.prisma b/test/integration/test/sql-orm-client/fixtures/self-relations/contract.prisma index 72f11e033a0b..36b5939d245f 100644 --- a/test/integration/test/sql-orm-client/fixtures/self-relations/contract.prisma +++ b/test/integration/test/sql-orm-client/fixtures/self-relations/contract.prisma @@ -16,6 +16,7 @@ model Person { outgoingLinks PersonConnection[] @relation("connectionSource") incomingLinks PersonConnection[] @relation("connectionTarget") + @@fullTextIndex([name], name: "person_name_search") @@map("people") } diff --git a/test/integration/test/sql-orm-client/fixtures/self-relations/generated/contract.d.ts b/test/integration/test/sql-orm-client/fixtures/self-relations/generated/contract.d.ts index 2210075dba1a..b426994fe1c4 100644 --- a/test/integration/test/sql-orm-client/fixtures/self-relations/generated/contract.d.ts +++ b/test/integration/test/sql-orm-client/fixtures/self-relations/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -34,14 +34,14 @@ import type { } from '@internal/contract/types'; export type StorageHash = - StorageHashBase<'03064b14cc66f1a136c019a42aef7f614624869dca2bd20211872b482eb8fb2a'>; + StorageHashBase<'68cbf64f1e2ea804ae94e926908ae4a093edc4f7e897b835b1eacc66ddd89b2b'>; export type ExecutionHash = ExecutionHashBase; export type ProfileHash = ProfileHashBase<'3916f444a8a17ad749191acf9e08dad97d1a327b88c2f1d45d12f240296aa8b2'>; export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { @@ -423,6 +423,13 @@ type ContractBase = Omit< readonly columns: readonly ['manager_id']; readonly unique: false; }, + { + readonly name: 'person_name_search_2455a3e1'; + readonly prefix: 'person_name_search'; + readonly expression: 'to_tsvector(\'english\', "name")'; + readonly unique: false; + readonly type: 'gin'; + }, ]; foreignKeys: readonly [ { diff --git a/test/integration/test/sql-orm-client/fixtures/self-relations/generated/contract.json b/test/integration/test/sql-orm-client/fixtures/self-relations/generated/contract.json index 6e2cee00408a..c928bf9d01f0 100644 --- a/test/integration/test/sql-orm-client/fixtures/self-relations/generated/contract.json +++ b/test/integration/test/sql-orm-client/fixtures/self-relations/generated/contract.json @@ -434,6 +434,13 @@ "name": "people_manager_id_idx_c3dee277", "prefix": "people_manager_id_idx", "unique": false + }, + { + "expression": "to_tsvector('english', \"name\")", + "name": "person_name_search_2455a3e1", + "prefix": "person_name_search", + "type": "gin", + "unique": false } ], "primaryKey": { @@ -606,7 +613,7 @@ "kind": "postgres-schema" } }, - "storageHash": "03064b14cc66f1a136c019a42aef7f614624869dca2bd20211872b482eb8fb2a" + "storageHash": "68cbf64f1e2ea804ae94e926908ae4a093edc4f7e897b835b1eacc66ddd89b2b" }, "capabilities": { "postgres": { diff --git a/test/integration/test/temporal-defaults/_fixture-timestamp/generated/contract.d.ts b/test/integration/test/temporal-defaults/_fixture-timestamp/generated/contract.d.ts index af68511362d1..428b083b7e28 100644 --- a/test/integration/test/temporal-defaults/_fixture-timestamp/generated/contract.d.ts +++ b/test/integration/test/temporal-defaults/_fixture-timestamp/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/temporal-defaults/_fixture/generated/contract.d.ts b/test/integration/test/temporal-defaults/_fixture/generated/contract.d.ts index 9e427498be86..9e464d484b93 100644 --- a/test/integration/test/temporal-defaults/_fixture/generated/contract.d.ts +++ b/test/integration/test/temporal-defaults/_fixture/generated/contract.d.ts @@ -1,7 +1,6 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; import type { Bit, Char, @@ -19,6 +18,7 @@ import type { VarBit, Varchar, } from '@internal/target-postgres/codec-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { ContractWithTypeMaps, @@ -42,7 +42,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; export type AggregateTypes = { readonly avg: { readonly byCodec: { diff --git a/test/integration/test/value-objects/fixtures/generated/sql-contract.d.ts b/test/integration/test/value-objects/fixtures/generated/sql-contract.d.ts index e97c9dbaff35..859cc8a69779 100644 --- a/test/integration/test/value-objects/fixtures/generated/sql-contract.d.ts +++ b/test/integration/test/value-objects/fixtures/generated/sql-contract.d.ts @@ -1,7 +1,7 @@ // ⚠️ GENERATED FILE - DO NOT EDIT // This file is automatically generated by 'prisma contract emit'. // To regenerate, run: prisma contract emit -import type { QueryOperationTypes as PgAdapterQueryOps } from '@internal/adapter-postgres/operation-types'; +import type { QueryOperationTypes as PgTargetQueryOps } from '@internal/target-postgres/operation-types'; import type { Bit, Char, @@ -37,7 +37,7 @@ export type ProfileHash = export type CodecTypes = PgTypes; export type LaneCodecTypes = CodecTypes; -export type QueryOperationTypes = PgAdapterQueryOps; +export type QueryOperationTypes = PgTargetQueryOps; type DefaultLiteralValue = CodecId extends keyof CodecTypes ? CodecTypes[CodecId]['output'] : _Encoded; diff --git a/upgrade-instructions/pending/postgres-full-text-search/app/instructions.md b/upgrade-instructions/pending/postgres-full-text-search/app/instructions.md new file mode 100644 index 000000000000..be8f82310ff0 --- /dev/null +++ b/upgrade-instructions/pending/postgres-full-text-search/app/instructions.md @@ -0,0 +1,68 @@ +--- +changes: + - id: re-emit-the-contract-for-the-moved-query-operation-types + summary: | + Emitted Postgres `contract.d.ts` files import `QueryOperationTypes` from the target package + instead of the adapter. Run `prisma contract emit` once; an un-emitted contract names a + subpath that no longer exists and stops type-checking. Application source that imported that + subpath directly changes the same way. + detection: + # Covers the emitted `contract.d.ts` and hand-written source alike: both + # name the subpath, and both stop compiling until they are changed. + glob: "**/*.{ts,tsx,mts}" + contains: + - "/adapter/operation-types" +--- + +## `re-emit-the-contract-for-the-moved-query-operation-types` + +The built-in Postgres query operations (`ilike`, and the new `fullTextMatches`, `fullTextRank` and `fullTextHeadline`) are contributed by the Postgres target rather than the Postgres adapter. Emitted contract types follow: the generated line + +```ts +import type { QueryOperationTypes as PgAdapterQueryOps } from '@prisma/orm-postgres/adapter/operation-types'; +``` + +becomes + +```ts +import type { QueryOperationTypes as PgTargetQueryOps } from '@prisma/orm-postgres/target/operation-types'; +``` + +Run `prisma contract emit` and commit the regenerated `contract.d.ts`. Nothing else in the file changes, `contract.json` does not change, and no contract hash moves. Do not hand-edit the generated file. + +Application code that imported `@prisma/orm-postgres/adapter/operation-types` directly imports `@prisma/orm-postgres/target/operation-types` instead. That subpath no longer exists; there is no compatibility re-export. + +To use the new operations, index the column with `@@fullTextIndex`, which renders the `to_tsvector` expression the predicate needs: + +```prisma +model Message { + id Int @id + text String + + @@fullTextIndex([text], name: "message_text_search") +} +``` + +In a TypeScript contract, use the matching helper inside the model's `sql({ indexes: [...] })`: + +```ts +import { fullTextIndex } from '@prisma/orm-postgres/contract-builder'; + +model('Message', { fields: { id, text } }).sql(({ cols }) => ({ + indexes: [ + fullTextIndex(cols.text, { name: 'message_text_search' }), + fullTextIndex(cols.text, { where: 'archived_at IS NULL', name: 'message_text_search_live' }), + ], +})); +``` + +The operations themselves take an options object as their second argument — `language` for all three, plus `normalization` and `coverDensity` on `fullTextRank` and the `ts_headline` options (`startSel`, `stopSel`, `maxWords`, `minWords`, `highlightAll`) on `fullTextHeadline`: + +```ts +await db.orm.public.Message.select('id', 'text') + .where((m) => m.text.fullTextMatches(query)) + .orderBy((m) => m.text.fullTextRank(query, { normalization: 32 }).desc()) + .all(); +``` + +Postgres only uses a full-text index whose expression is the same `to_tsvector` over the same configuration literal and the same column as the query, so prefer these over writing `@@index(expression: "to_tsvector(…)", type: "gin", …)` by hand. Pass the same `language` to the index and to the operation: a mismatch is silent, and the query falls back to a sequential scan. diff --git a/upgrade-instructions/pending/postgres-full-text-search/extension/instructions.md b/upgrade-instructions/pending/postgres-full-text-search/extension/instructions.md new file mode 100644 index 000000000000..9d83f8eef9cc --- /dev/null +++ b/upgrade-instructions/pending/postgres-full-text-search/extension/instructions.md @@ -0,0 +1,28 @@ +--- +changes: + - id: query-operation-types-move-to-the-postgres-target + summary: | + `QueryOperationTypes` moves from `@internal/adapter-postgres/operation-types` to + `@internal/target-postgres/operation-types`. The adapter subpath is gone, with no + compatibility re-export. + detection: + glob: "**/*.{ts,mts,cts}" + matches: + - "adapter-postgres/operation-types" + - "orm-postgres/adapter/operation-types" +--- + +## `query-operation-types-move-to-the-postgres-target` + +The Postgres adapter no longer contributes query operations; the target does. Change the import: + +```ts +// before +import type { QueryOperationTypes } from '@internal/adapter-postgres/operation-types'; +// after +import type { QueryOperationTypes } from '@internal/target-postgres/operation-types'; +``` + +Under the published facade, `@prisma/orm-postgres/adapter/operation-types` becomes `@prisma/orm-postgres/target/operation-types`. Emitted contracts name the target import under the alias `PgTargetQueryOps` instead of `PgAdapterQueryOps`, so a snapshot or fixture that pins emitted contract text needs regenerating. + +The type's shape is unchanged apart from three added operations — `fullTextMatches`, `fullTextRank` and `fullTextHeadline`, all on `textual` columns — so an extension that intersects its own `QueryOperationTypes` with the Postgres one needs no other edit.