@prisma-next/extension-paradedb 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -71,11 +71,23 @@ ParadeDB BM25 indexes require a `key_field` — a unique column that identifies
71
71
 
72
72
  - `paradedb/bm25` — indicates support for BM25 full-text search indexes
73
73
 
74
+ ## Authoring (maintainers)
75
+
76
+ The extension's contract + baseline migration are emitted on-disk inside this package using the same pipeline application authors use:
77
+
78
+ - `pnpm build:contract-space` — runs `prisma-next contract emit` to produce `src/contract.{json,d.ts}` from the PSL source at `src/contract.prisma`.
79
+ - `pnpm exec prisma-next migration plan --name <slug>` (run from this package directory) — scaffolds a new migration directory under `migrations/<dirName>/` for schema changes. **Not chained into `pnpm build`**: `migration plan` is non-idempotent (each invocation generates a new timestamped directory), so it runs manually when the contract source changes. Note: paradedb's contract declares no tables or models, so the planner currently refuses to scaffold the baseline migration (this is **Path B** authoring per [ADR 212](../../../docs/architecture%20docs/adrs/ADR%20212%20-%20Contract%20spaces.md#contract-space-package-layout)). That directory was hand-authored once (Migration subclass + seed `migration.json` preserving the full `toContract`) and `pnpm tsx migrations/<dirName>/migration.ts` re-emits `ops.json` + `migration.json` deterministically. Future migrations that add tables or models can use `migration plan` directly (Path A).
80
+ - `pnpm tsx migrations/<dirName>/migration.ts` (run from this package directory) — re-emits `ops.json` + `migration.json` from the hand-edited subclass. Use `tsx`, not bare `node`, because the Migration subclass imports relative TypeScript siblings which Node's native loader can't resolve without a TS-aware loader.
81
+ - `migrations/refs/head.json` is hand-pinned with the latest migration's `to` hash + `providedInvariants`.
82
+
83
+ The descriptor at `src/exports/control.ts` then JSON-imports those artefacts and synthesises the framework's `MigrationPackage` shape.
84
+
85
+ See [ADR 212 — Contract spaces](../../../docs/architecture%20docs/adrs/ADR%20212%20-%20Contract%20spaces.md) ("Contract-space package layout") for the canonical layout and rationale.
86
+
74
87
  ## Not yet implemented
75
88
 
76
89
  - Per-column / per-expression tokenizer configuration (deferred to expression-index support)
77
90
  - `@@@` operator and `pdb.*` query builder functions
78
- - `CREATE EXTENSION pg_search` via migration planner
79
91
  - Scoring, aggregation, and highlight functions
80
92
 
81
93
  ## References
@@ -83,4 +95,5 @@ ParadeDB BM25 indexes require a `key_field` — a unique column that identifies
83
95
  - [ParadeDB documentation](https://docs.paradedb.com/)
84
96
  - [ParadeDB CREATE INDEX](https://docs.paradedb.com/documentation/indexing/create-index)
85
97
  - [ADR 210 — Index-type registry](../../../docs/architecture%20docs/adrs/ADR%20210%20-%20Index-type%20registry.md)
98
+ - [ADR 212 — Contract spaces](../../../docs/architecture%20docs/adrs/ADR%20212%20-%20Contract%20spaces.md)
86
99
  - [Prisma Next Architecture Overview](../../../docs/Architecture%20Overview.md)
@@ -1 +1 @@
1
- {"version":3,"file":"control.d.mts","names":[],"sources":["../src/core/descriptor-meta.ts","../src/exports/control.ts"],"mappings":";;;;cAgMa,gBAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;cCtJP,2BAAA,EAA6B,6BAAA"}
1
+ {"version":3,"file":"control.d.mts","names":[],"sources":["../src/core/descriptor-meta.ts","../src/exports/control.ts"],"mappings":";;;;cAgMa,gBAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;cCtIP,2BAAA,EAA6B,6BAAA"}
package/dist/control.mjs CHANGED
@@ -1,32 +1,127 @@
1
- import { n as paradedbQueryOperations, t as paradedbPackMeta } from "./descriptor-meta-CmokJ02r.mjs";
1
+ import { n as paradedbQueryOperations, r as PARADEDB_SPACE_ID, t as paradedbPackMeta } from "./descriptor-meta-Dr4mAlbx.mjs";
2
+ import { contractSpaceFromJson } from "@prisma-next/migration-tools/spaces";
3
+ //#endregion
2
4
  //#region src/exports/control.ts
3
- const paradedbDatabaseDependencies = { init: [{
4
- id: "postgres.extension.pg_search",
5
- label: "Enable pg_search extension",
6
- install: [{
7
- id: "extension.pg_search",
8
- label: "Enable extension \"pg_search\"",
9
- summary: "Ensures the pg_search extension is available for ParadeDB BM25 operations",
10
- operationClass: "additive",
11
- target: { id: "postgres" },
12
- precheck: [{
13
- description: "verify extension \"pg_search\" is not already enabled",
14
- sql: "SELECT NOT EXISTS (SELECT 1 FROM pg_extension WHERE extname = 'pg_search')"
15
- }],
16
- execute: [{
17
- description: "create extension \"pg_search\"",
18
- sql: "CREATE EXTENSION IF NOT EXISTS pg_search"
19
- }],
20
- postcheck: [{
21
- description: "confirm extension \"pg_search\" is enabled",
22
- sql: "SELECT EXISTS (SELECT 1 FROM pg_extension WHERE extname = 'pg_search')"
5
+ const paradedbContractSpace = contractSpaceFromJson({
6
+ contractJson: {
7
+ schemaVersion: "1",
8
+ targetFamily: "sql",
9
+ target: "postgres",
10
+ profileHash: "sha256:1a8dbe044289f30a1de958fe800cc5a8378b285d2e126a8c44b58864bac2c18e",
11
+ roots: {},
12
+ models: {},
13
+ storage: {
14
+ "storageHash": "sha256:7d13ea93bd4726b9962c00ced807a79149e3ff69e0a47d936c0e82f39a637393",
15
+ "tables": {}
16
+ },
17
+ capabilities: {
18
+ "postgres": {
19
+ "jsonAgg": true,
20
+ "lateral": true,
21
+ "limit": true,
22
+ "orderBy": true,
23
+ "returning": true
24
+ },
25
+ "sql": {
26
+ "defaultInInsert": true,
27
+ "enums": true,
28
+ "returning": true
29
+ }
30
+ },
31
+ extensionPacks: {},
32
+ meta: {},
33
+ _generated: {
34
+ "warning": "⚠️ GENERATED FILE - DO NOT EDIT",
35
+ "message": "This file is automatically generated by \"prisma-next contract emit\".",
36
+ "regenerate": "To regenerate, run: prisma-next contract emit"
37
+ }
38
+ },
39
+ migrations: [{
40
+ dirName: "20260601T0000_install_pg_search_extension",
41
+ metadata: {
42
+ from: null,
43
+ to: "sha256:7d13ea93bd4726b9962c00ced807a79149e3ff69e0a47d936c0e82f39a637393",
44
+ labels: [],
45
+ providedInvariants: ["paradedb:install-pg-search-v1"],
46
+ createdAt: "2026-06-01T00:00:00.000Z",
47
+ fromContract: null,
48
+ toContract: {
49
+ "schemaVersion": "1",
50
+ "targetFamily": "sql",
51
+ "target": "postgres",
52
+ "profileHash": "sha256:1a8dbe044289f30a1de958fe800cc5a8378b285d2e126a8c44b58864bac2c18e",
53
+ "roots": {},
54
+ "models": {},
55
+ "storage": {
56
+ "storageHash": "sha256:7d13ea93bd4726b9962c00ced807a79149e3ff69e0a47d936c0e82f39a637393",
57
+ "tables": {}
58
+ },
59
+ "capabilities": {
60
+ "postgres": {
61
+ "jsonAgg": true,
62
+ "lateral": true,
63
+ "limit": true,
64
+ "orderBy": true,
65
+ "returning": true
66
+ },
67
+ "sql": {
68
+ "defaultInInsert": true,
69
+ "enums": true,
70
+ "returning": true
71
+ }
72
+ },
73
+ "extensionPacks": {},
74
+ "meta": {},
75
+ "_generated": {
76
+ "warning": "⚠️ GENERATED FILE - DO NOT EDIT",
77
+ "message": "This file is automatically generated by \"prisma-next contract emit\".",
78
+ "regenerate": "To regenerate, run: prisma-next contract emit"
79
+ }
80
+ },
81
+ hints: {
82
+ "used": [],
83
+ "applied": [],
84
+ "plannerVersion": "2.0.0"
85
+ },
86
+ migrationHash: "sha256:3eb230aa63c65ee27e664c067dbf6a23c59e03fd0ad34b3f09d74fe4053b3ab4"
87
+ },
88
+ ops: [{
89
+ "id": "paradedb.install-pg-search-extension",
90
+ "label": "Enable extension \"pg_search\"",
91
+ "operationClass": "additive",
92
+ "invariantId": "paradedb:install-pg-search-v1",
93
+ "target": {
94
+ "id": "postgres",
95
+ "details": {
96
+ "schema": "public",
97
+ "objectType": "dependency",
98
+ "name": "pg_search"
99
+ }
100
+ },
101
+ "precheck": [{
102
+ "description": "verify extension \"pg_search\" is not already enabled",
103
+ "sql": "SELECT NOT EXISTS (SELECT 1 FROM pg_extension WHERE extname = 'pg_search')"
104
+ }],
105
+ "execute": [{
106
+ "description": "create extension \"pg_search\"",
107
+ "sql": "CREATE EXTENSION IF NOT EXISTS pg_search"
108
+ }],
109
+ "postcheck": [{
110
+ "description": "confirm extension \"pg_search\" is enabled",
111
+ "sql": "SELECT EXISTS (SELECT 1 FROM pg_extension WHERE extname = 'pg_search')"
112
+ }]
23
113
  }]
24
- }]
25
- }] };
114
+ }],
115
+ headRef: {
116
+ hash: "sha256:7d13ea93bd4726b9962c00ced807a79149e3ff69e0a47d936c0e82f39a637393",
117
+ invariants: ["paradedb:install-pg-search-v1"]
118
+ }
119
+ });
26
120
  const paradedbExtensionDescriptor = {
27
121
  ...paradedbPackMeta,
122
+ id: PARADEDB_SPACE_ID,
123
+ contractSpace: paradedbContractSpace,
28
124
  queryOperations: () => paradedbQueryOperations(),
29
- databaseDependencies: paradedbDatabaseDependencies,
30
125
  create: () => ({
31
126
  familyId: "sql",
32
127
  targetId: "postgres"
@@ -1 +1 @@
1
- {"version":3,"file":"control.mjs","names":[],"sources":["../src/exports/control.ts"],"sourcesContent":["import type {\n ComponentDatabaseDependencies,\n SqlControlExtensionDescriptor,\n} from '@prisma-next/family-sql/control';\nimport { paradedbPackMeta, paradedbQueryOperations } from '../core/descriptor-meta';\n\nconst paradedbDatabaseDependencies: ComponentDatabaseDependencies<unknown> = {\n init: [\n {\n id: 'postgres.extension.pg_search',\n label: 'Enable pg_search extension',\n install: [\n {\n id: 'extension.pg_search',\n label: 'Enable extension \"pg_search\"',\n summary: 'Ensures the pg_search extension is available for ParadeDB BM25 operations',\n operationClass: 'additive',\n target: { id: 'postgres' },\n precheck: [\n {\n description: 'verify extension \"pg_search\" is not already enabled',\n sql: \"SELECT NOT EXISTS (SELECT 1 FROM pg_extension WHERE extname = 'pg_search')\",\n },\n ],\n execute: [\n {\n description: 'create extension \"pg_search\"',\n sql: 'CREATE EXTENSION IF NOT EXISTS pg_search',\n },\n ],\n postcheck: [\n {\n description: 'confirm extension \"pg_search\" is enabled',\n sql: \"SELECT EXISTS (SELECT 1 FROM pg_extension WHERE extname = 'pg_search')\",\n },\n ],\n },\n ],\n },\n ],\n};\n\nconst paradedbExtensionDescriptor: SqlControlExtensionDescriptor<'postgres'> = {\n ...paradedbPackMeta,\n queryOperations: () => paradedbQueryOperations(),\n databaseDependencies: paradedbDatabaseDependencies,\n create: () => ({\n familyId: 'sql' as const,\n targetId: 'postgres' as const,\n }),\n};\n\nexport { paradedbExtensionDescriptor, paradedbPackMeta };\nexport default paradedbExtensionDescriptor;\n"],"mappings":";;AAMA,MAAM,+BAAuE,EAC3E,MAAM,CACJ;CACE,IAAI;CACJ,OAAO;CACP,SAAS,CACP;EACE,IAAI;EACJ,OAAO;EACP,SAAS;EACT,gBAAgB;EAChB,QAAQ,EAAE,IAAI,YAAY;EAC1B,UAAU,CACR;GACE,aAAa;GACb,KAAK;GACN,CACF;EACD,SAAS,CACP;GACE,aAAa;GACb,KAAK;GACN,CACF;EACD,WAAW,CACT;GACE,aAAa;GACb,KAAK;GACN,CACF;EACF,CACF;CACF,CACF,EACF;AAED,MAAM,8BAAyE;CAC7E,GAAG;CACH,uBAAuB,yBAAyB;CAChD,sBAAsB;CACtB,eAAe;EACb,UAAU;EACV,UAAU;EACX;CACF"}
1
+ {"version":3,"file":"control.mjs","names":["baselineMetadata","baselineOps"],"sources":["../migrations/20260601T0000_install_pg_search_extension/migration.json","../migrations/20260601T0000_install_pg_search_extension/ops.json","../migrations/refs/head.json","../src/contract.json","../src/exports/control.ts"],"sourcesContent":["","","","","/**\n * Control-plane descriptor for the paradedb extension.\n *\n * **Contract-space package layout.** The extension's contract\n * + migrations are emitted by the same pipeline application authors use:\n *\n * `prisma-next contract emit` → `<package>/src/contract.{json,d.ts}`\n * `prisma-next migration plan` `<package>/migrations/<dir>/...`\n *\n * The descriptor wires those JSON artefacts via JSON-import declarations\n * so they flow through the consuming application's module resolver\n * without filesystem assumptions, and synthesises the canonical\n * {@link import('@prisma-next/framework-components/control').MigrationPackage}\n * shape for the framework's runner / verifier to consume. Readers in\n * `@prisma-next/migration-tools` add `dirPath` when loading from disk\n * (`OnDiskMigrationPackage`); descriptor-bundled packages do not need\n * it because the framework reads them directly from the descriptor.\n *\n * Wired surfaces:\n *\n * - `contractSpace.{contractJson,migrations,headRef}` sourced from\n * the on-disk artefacts emitted by `build:contract-space`.\n * - `queryOperations` — BM25 full-text search operations registered\n * via `paradedbQueryOperations()`.\n *\n * @see docs/architecture docs/adrs/ADR 212 - Contract spaces.md\n * (contract-space package layout convention).\n */\n\nimport type { Contract } from '@prisma-next/contract/types';\nimport type { SqlControlExtensionDescriptor } from '@prisma-next/family-sql/control';\nimport { contractSpaceFromJson } from '@prisma-next/migration-tools/spaces';\nimport type { SqlStorage } from '@prisma-next/sql-contract/types';\nimport baselineMetadata from '../../migrations/20260601T0000_install_pg_search_extension/migration.json' with {\n type: 'json',\n};\nimport baselineOps from '../../migrations/20260601T0000_install_pg_search_extension/ops.json' with {\n type: 'json',\n};\nimport headRef from '../../migrations/refs/head.json' with { type: 'json' };\nimport contractJson from '../contract.json' with { type: 'json' };\nimport { PARADEDB_SPACE_ID } from '../core/constants';\nimport { paradedbPackMeta, paradedbQueryOperations } from '../core/descriptor-meta';\n\nconst BASELINE_DIR_NAME = '20260601T0000_install_pg_search_extension';\n\nconst paradedbContractSpace = contractSpaceFromJson<Contract<SqlStorage>>({\n contractJson,\n migrations: [\n {\n dirName: BASELINE_DIR_NAME,\n metadata: baselineMetadata,\n ops: baselineOps,\n },\n ],\n headRef,\n});\n\nconst paradedbExtensionDescriptor: SqlControlExtensionDescriptor<'postgres'> = {\n ...paradedbPackMeta,\n id: PARADEDB_SPACE_ID,\n contractSpace: paradedbContractSpace,\n queryOperations: () => paradedbQueryOperations(),\n create: () => ({\n familyId: 'sql' as const,\n targetId: 'postgres' as const,\n }),\n};\n\nexport { paradedbExtensionDescriptor, paradedbPackMeta };\nexport default paradedbExtensionDescriptor;\n"],"mappings":";;;;AI8CA,MAAM,wBAAwB,sBAA4C;CACxE,cAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;CACA,YAAY,CACV;EACE,SAAS;EACT,UAAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAAA;EACV,KAAKC;;;;;;;;;;;;;;;;;;;;;;;;;IAAAA;EACN,CACF;CACD,SAAA;;;EAAA;CACD,CAAC;AAEF,MAAM,8BAAyE;CAC7E,GAAG;CACH,IAAI;CACJ,eAAe;CACf,uBAAuB,yBAAyB;CAChD,eAAe;EACb,UAAU;EACV,UAAU;EACX;CACF"}
@@ -1,4 +1,4 @@
1
- import { t as paradedbIndexTypes } from "./index-types-BWFfNqUb.mjs";
1
+ import { t as paradedbIndexTypes } from "./index-types-BZqoAhWT.mjs";
2
2
  import { LiteralExpr, OperationExpr } from "@prisma-next/sql-relational-core/ast";
3
3
  import { buildOperation, toExpr } from "@prisma-next/sql-relational-core/expression";
4
4
  //#region src/core/constants.ts
@@ -6,6 +6,22 @@ import { buildOperation, toExpr } from "@prisma-next/sql-relational-core/express
6
6
  * Extension ID for ParadeDB pg_search.
7
7
  */
8
8
  const PARADEDB_EXTENSION_ID = "paradedb";
9
+ /**
10
+ * Static names and identifiers used across paradedb's contract space.
11
+ *
12
+ * Centralised here so the contract IR (`./contract`), the baseline
13
+ * migration ops (`./migrations`), the head ref, and the descriptor
14
+ * (`../exports/control`) all reference the same values without typos.
15
+ *
16
+ * The space identifier `'paradedb'` is what the framework writes to
17
+ * `migrations/` in the user's repo and what the marker table's
18
+ * `space` column carries for paradedb-owned rows.
19
+ *
20
+ * The `paradedb:*` invariantId namespace is locked here — once
21
+ * published, an invariantId is immutable so downstream consumers can
22
+ * reference it by literal string match.
23
+ */
24
+ const PARADEDB_SPACE_ID = "paradedb";
9
25
  //#endregion
10
26
  //#region src/core/proximity-chain.ts
11
27
  const TEXT$1 = "pg/text@1";
@@ -255,6 +271,6 @@ const paradedbPackMeta = {
255
271
  } } }
256
272
  };
257
273
  //#endregion
258
- export { paradedbQueryOperations as n, paradedbPackMeta as t };
274
+ export { paradedbQueryOperations as n, PARADEDB_SPACE_ID as r, paradedbPackMeta as t };
259
275
 
260
- //# sourceMappingURL=descriptor-meta-CmokJ02r.mjs.map
276
+ //# sourceMappingURL=descriptor-meta-Dr4mAlbx.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descriptor-meta-Dr4mAlbx.mjs","names":["TEXT"],"sources":["../src/core/constants.ts","../src/core/proximity-chain.ts","../src/core/descriptor-meta.ts"],"sourcesContent":["/**\n * Extension ID for ParadeDB pg_search.\n */\nexport const PARADEDB_EXTENSION_ID = 'paradedb' as const;\n\n/**\n * Static names and identifiers used across paradedb's contract space.\n *\n * Centralised here so the contract IR (`./contract`), the baseline\n * migration ops (`./migrations`), the head ref, and the descriptor\n * (`../exports/control`) all reference the same values without typos.\n *\n * The space identifier `'paradedb'` is what the framework writes to\n * `migrations/` in the user's repo and what the marker table's\n * `space` column carries for paradedb-owned rows.\n *\n * The `paradedb:*` invariantId namespace is locked here — once\n * published, an invariantId is immutable so downstream consumers can\n * reference it by literal string match.\n */\nexport const PARADEDB_SPACE_ID = 'paradedb' as const;\n\nexport const PARADEDB_BASELINE_MIGRATION_NAME =\n '20260601T0000_install_pg_search_extension' as const;\n\n/**\n * `paradedb:*` invariantIds emitted by the baseline migration. Each id,\n * once published, is immutable: downstream consumers reference them by\n * literal string match.\n */\nexport const PARADEDB_INVARIANTS = {\n installPgSearch: 'paradedb:install-pg-search-v1',\n} as const;\n","import {\n type AnyExpression,\n LiteralExpr,\n OperationExpr,\n} from '@prisma-next/sql-relational-core/ast';\nimport { type Expression, toExpr } from '@prisma-next/sql-relational-core/expression';\n\nconst TEXT = 'pg/text@1' as const;\n\nexport type ProximityTerm = unknown;\n\nexport interface ProximityWithinOptions {\n readonly ordered?: boolean;\n}\n\ninterface ProximityStep {\n readonly distance: number;\n readonly term: ProximityTerm;\n readonly ordered: boolean;\n}\n\n// https://docs.paradedb.com/documentation/full-text/proximity\nexport class ParadeDbProximityChain\n implements Expression<{ codecId: 'pg/text@1'; nullable: false }>\n{\n readonly returnType = { codecId: TEXT, nullable: false } as const;\n\n private readonly start: ProximityTerm;\n private readonly steps: readonly ProximityStep[];\n\n constructor(start: ProximityTerm, steps: readonly ProximityStep[] = []) {\n this.start = start;\n this.steps = steps;\n }\n\n within(\n distance: number,\n term: ProximityTerm,\n options?: ProximityWithinOptions,\n ): ParadeDbProximityChain {\n if (!Number.isInteger(distance) || distance < 0) {\n throw new Error(\n `paradeDbProximity.within: distance must be a non-negative integer; got ${String(distance)}`,\n );\n }\n return new ParadeDbProximityChain(this.start, [\n ...this.steps,\n { distance, term, ordered: options?.ordered === true },\n ]);\n }\n\n buildAst(): AnyExpression {\n if (this.steps.length === 0) {\n throw new Error(\n 'paradeDbProximity: chain must have at least one .within(distance, term) step',\n );\n }\n const args: AnyExpression[] = [toExpr(this.start, TEXT)];\n let template = '({{self}}';\n this.steps.forEach((step, i) => {\n const op = step.ordered ? '##>' : '##';\n args.push(LiteralExpr.of(step.distance));\n args.push(toExpr(step.term, TEXT));\n template += ` ${op} {{arg${2 * i}}} ${op} {{arg${2 * i + 1}}}`;\n });\n template += ')';\n const [self, ...rest] = args;\n if (!self) {\n throw new Error('paradeDbProximity: invariant violation — empty args');\n }\n return new OperationExpr({\n method: 'paradeDbProximity',\n self,\n args: rest.length > 0 ? rest : undefined,\n returns: this.returnType,\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template,\n },\n });\n }\n}\n","import { LiteralExpr } from '@prisma-next/sql-relational-core/ast';\nimport { buildOperation, toExpr } from '@prisma-next/sql-relational-core/expression';\nimport { paradedbIndexTypes } from '../types/index-types';\nimport type { QueryOperationTypes } from '../types/operation-types';\nimport { PARADEDB_EXTENSION_ID } from './constants';\nimport { ParadeDbProximityChain } from './proximity-chain';\n\ntype CodecTypesBase = Record<string, { readonly input: unknown; readonly output: unknown }>;\n\nconst TEXT = 'pg/text@1' as const;\nconst BOOL = 'pg/bool@1' as const;\nconst FLOAT4 = 'pg/float4@1' as const;\nconst INT4 = 'pg/int4@1' as const;\n\nexport function paradedbQueryOperations<CT extends CodecTypesBase>(): QueryOperationTypes<CT> {\n return {\n // `@@@` accepts both text and structured query types on its RHS.\n // https://docs.paradedb.com/documentation/full-text/match\n paradeDbMatch: {\n self: { codecId: TEXT },\n impl: (self, query) =>\n buildOperation({\n method: 'paradeDbMatch',\n args: [toExpr(self, TEXT), toExpr(query, TEXT)],\n returns: { codecId: BOOL, nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: '{{self}} @@@ {{arg0}}',\n },\n }),\n },\n paradeDbMatchAny: {\n self: { codecId: TEXT },\n impl: (self, query) =>\n buildOperation({\n method: 'paradeDbMatchAny',\n args: [toExpr(self, TEXT), toExpr(query, TEXT)],\n returns: { codecId: BOOL, nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: '{{self}} ||| {{arg0}}',\n },\n }),\n },\n paradeDbMatchAll: {\n self: { codecId: TEXT },\n impl: (self, query) =>\n buildOperation({\n method: 'paradeDbMatchAll',\n args: [toExpr(self, TEXT), toExpr(query, TEXT)],\n returns: { codecId: BOOL, nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: '{{self}} &&& {{arg0}}',\n },\n }),\n },\n // https://docs.paradedb.com/documentation/full-text/term\n paradeDbTerm: {\n self: { codecId: TEXT },\n impl: (self, query) =>\n buildOperation({\n method: 'paradeDbTerm',\n args: [toExpr(self, TEXT), toExpr(query, TEXT)],\n returns: { codecId: BOOL, nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: '{{self}} === {{arg0}}',\n },\n }),\n },\n // https://docs.paradedb.com/documentation/full-text/phrase\n paradeDbPhrase: {\n self: { codecId: TEXT },\n impl: (self, query) =>\n buildOperation({\n method: 'paradeDbPhrase',\n args: [toExpr(self, TEXT), toExpr(query, TEXT)],\n returns: { codecId: BOOL, nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: '{{self}} ### {{arg0}}',\n },\n }),\n },\n // https://docs.paradedb.com/documentation/sorting/score\n paradeDbScore: {\n self: { codecId: INT4 },\n impl: (self) =>\n buildOperation({\n method: 'paradeDbScore',\n args: [toExpr(self, INT4)],\n returns: { codecId: FLOAT4, nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: 'pdb.score({{self}})',\n },\n }),\n },\n // PG rejects parameterized typmods, so the cast argument lowers to a literal.\n // https://docs.paradedb.com/documentation/full-text/fuzzy\n paradeDbFuzzy: {\n self: { codecId: TEXT },\n impl: (self, distance) => {\n if (!Number.isInteger(distance) || distance < 0 || distance > 2) {\n throw new Error(\n `paradeDbFuzzy: distance must be an integer in [0, 2]; got ${String(distance)}`,\n );\n }\n return buildOperation({\n method: 'paradeDbFuzzy',\n args: [toExpr(self, TEXT), LiteralExpr.of(distance)],\n returns: { codecId: TEXT, nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: '{{self}}::pdb.fuzzy({{arg0}})',\n },\n });\n },\n },\n // https://docs.paradedb.com/documentation/sorting/boost\n paradeDbBoost: {\n self: { codecId: TEXT },\n impl: (self, weight) => {\n if (!Number.isInteger(weight) || weight < -2048 || weight > 2048) {\n throw new Error(\n `paradeDbBoost: boost must be an integer in [-2048, 2048]; got ${String(weight)}`,\n );\n }\n return buildOperation({\n method: 'paradeDbBoost',\n args: [toExpr(self, TEXT), LiteralExpr.of(weight)],\n returns: { codecId: TEXT, nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: '{{self}}::pdb.boost({{arg0}})',\n },\n });\n },\n },\n paradeDbConst: {\n self: { codecId: TEXT },\n impl: (self, value) => {\n if (!Number.isInteger(value)) {\n throw new Error(`paradeDbConst: value must be an integer; got ${String(value)}`);\n }\n return buildOperation({\n method: 'paradeDbConst',\n args: [toExpr(self, TEXT), LiteralExpr.of(value)],\n returns: { codecId: TEXT, nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: '{{self}}::pdb.const({{arg0}})',\n },\n });\n },\n },\n paradeDbSlop: {\n self: { codecId: TEXT },\n impl: (self, slop) => {\n if (!Number.isInteger(slop) || slop < 0) {\n throw new Error(`paradeDbSlop: slop must be a non-negative integer; got ${String(slop)}`);\n }\n return buildOperation({\n method: 'paradeDbSlop',\n args: [toExpr(self, TEXT), LiteralExpr.of(slop)],\n returns: { codecId: TEXT, nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: '{{self}}::pdb.slop({{arg0}})',\n },\n });\n },\n },\n // https://docs.paradedb.com/documentation/full-text/proximity\n paradeDbProximity: {\n self: { codecId: TEXT },\n impl: (start) => new ParadeDbProximityChain(start),\n },\n };\n}\n\nexport const paradedbPackMeta = {\n kind: 'extension',\n id: PARADEDB_EXTENSION_ID,\n familyId: 'sql',\n targetId: 'postgres',\n version: '0.0.1',\n capabilities: {\n postgres: {\n 'paradedb/bm25': true,\n },\n },\n indexTypes: paradedbIndexTypes,\n types: {\n queryOperationTypes: {\n import: {\n package: '@prisma-next/extension-paradedb/operation-types',\n named: 'QueryOperationTypes',\n alias: 'ParadeDbQueryOperationTypes',\n },\n },\n },\n} as const;\n"],"mappings":";;;;;;;AAGA,MAAa,wBAAwB;;;;;;;;;;;;;;;;AAiBrC,MAAa,oBAAoB;;;ACbjC,MAAMA,SAAO;AAeb,IAAa,yBAAb,MAAa,uBAEb;CACE,aAAsB;EAAE,SAASA;EAAM,UAAU;EAAO;CAExD;CACA;CAEA,YAAY,OAAsB,QAAkC,EAAE,EAAE;EACtE,KAAK,QAAQ;EACb,KAAK,QAAQ;;CAGf,OACE,UACA,MACA,SACwB;EACxB,IAAI,CAAC,OAAO,UAAU,SAAS,IAAI,WAAW,GAC5C,MAAM,IAAI,MACR,0EAA0E,OAAO,SAAS,GAC3F;EAEH,OAAO,IAAI,uBAAuB,KAAK,OAAO,CAC5C,GAAG,KAAK,OACR;GAAE;GAAU;GAAM,SAAS,SAAS,YAAY;GAAM,CACvD,CAAC;;CAGJ,WAA0B;EACxB,IAAI,KAAK,MAAM,WAAW,GACxB,MAAM,IAA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ACX;KACF,CAAC;;GAEL;EAED,mBAAmB;GACjB,MAAM,EAAE,SAAS,MAAM;GACvB,OAAO,UAAU,IAAI,uBAAuB,MAAM;GACnD;EACF;;AAGH,MAAa,mBAAmB;CAC9B,MAAM;CACN,IAAI;CACJ,UAAU;CACV,UAAU;CACV,SAAS;CACT,cAAc,EACZ,UAAU,EACR,iBAAiB,MAClB,EACF;CACD,YAAY;CACZ,OAAO,EACL,qBAAqB,EACnB,QAAQ;EACN,SAAS;EACT,OAAO;EACP,OAAO;EACR,EACF,EACF;CACF"}
@@ -8,4 +8,4 @@ const paradedbIndexTypes = defineIndexTypes().add("bm25", { options: type({
8
8
  //#endregion
9
9
  export { paradedbIndexTypes as t };
10
10
 
11
- //# sourceMappingURL=index-types-BWFfNqUb.mjs.map
11
+ //# sourceMappingURL=index-types-BZqoAhWT.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-types-BWFfNqUb.mjs","names":[],"sources":["../src/types/index-types.ts"],"sourcesContent":["import { defineIndexTypes } from '@prisma-next/sql-contract/index-types';\nimport { type } from 'arktype';\n\nexport const paradedbIndexTypes = defineIndexTypes().add('bm25', {\n options: type({\n '+': 'reject',\n key_field: 'string',\n }),\n});\n\nexport type IndexTypes = typeof paradedbIndexTypes.IndexTypes;\nexport type Bm25IndexOptions = IndexTypes['bm25']['options'];\n"],"mappings":";;;AAGA,MAAa,qBAAqB,kBAAkB,CAAC,IAAI,QAAQ,EAC/D,SAAS,KAAK;CACZ,KAAK;CACL,WAAW;CACZ,CAAC,EACH,CAAC"}
1
+ {"version":3,"file":"index-types-BZqoAhWT.mjs","names":[],"sources":["../src/types/index-types.ts"],"sourcesContent":["import { defineIndexTypes } from '@prisma-next/sql-contract/index-types';\nimport { type } from 'arktype';\n\nexport const paradedbIndexTypes = defineIndexTypes().add('bm25', {\n options: type({\n '+': 'reject',\n key_field: 'string',\n }),\n});\n\nexport type IndexTypes = typeof paradedbIndexTypes.IndexTypes;\nexport type Bm25IndexOptions = IndexTypes['bm25']['options'];\n"],"mappings":";;;AAGA,MAAa,qBAAqB,kBAAkB,CAAC,IAAI,QAAQ,EAC/D,SAAS,KAAK;CACZ,KAAK;CACL,WAAW;CACZ,CAAC,EACH,CAAC"}
@@ -1,2 +1,2 @@
1
- import { t as paradedbIndexTypes } from "./index-types-BWFfNqUb.mjs";
1
+ import { t as paradedbIndexTypes } from "./index-types-BZqoAhWT.mjs";
2
2
  export { paradedbIndexTypes };
package/dist/pack.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as paradedbPackMeta } from "./descriptor-meta-CmokJ02r.mjs";
1
+ import { t as paradedbPackMeta } from "./descriptor-meta-Dr4mAlbx.mjs";
2
2
  //#region src/exports/pack.ts
3
3
  const paradedbPack = paradedbPackMeta;
4
4
  //#endregion
package/dist/runtime.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as paradedbQueryOperations, t as paradedbPackMeta } from "./descriptor-meta-CmokJ02r.mjs";
1
+ import { n as paradedbQueryOperations, t as paradedbPackMeta } from "./descriptor-meta-Dr4mAlbx.mjs";
2
2
  //#region src/exports/runtime.ts
3
3
  const paradedbRuntimeDescriptor = {
4
4
  kind: "extension",
package/package.json CHANGED
@@ -1,27 +1,30 @@
1
1
  {
2
2
  "name": "@prisma-next/extension-paradedb",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "dependencies": {
8
8
  "arktype": "^2.1.25",
9
- "@prisma-next/contract": "0.5.0",
10
- "@prisma-next/contract-authoring": "0.5.0",
11
- "@prisma-next/family-sql": "0.5.0",
12
- "@prisma-next/sql-contract": "0.5.0",
13
- "@prisma-next/sql-operations": "0.5.0",
14
- "@prisma-next/sql-relational-core": "0.5.0",
15
- "@prisma-next/framework-components": "0.5.0",
16
- "@prisma-next/sql-runtime": "0.5.0"
9
+ "@prisma-next/contract": "0.5.1",
10
+ "@prisma-next/family-sql": "0.5.1",
11
+ "@prisma-next/contract-authoring": "0.5.1",
12
+ "@prisma-next/migration-tools": "0.5.1",
13
+ "@prisma-next/sql-contract": "0.5.1",
14
+ "@prisma-next/sql-operations": "0.5.1",
15
+ "@prisma-next/sql-relational-core": "0.5.1",
16
+ "@prisma-next/sql-runtime": "0.5.1",
17
+ "@prisma-next/framework-components": "0.5.1"
17
18
  },
18
19
  "devDependencies": {
19
20
  "tsdown": "0.22.0",
20
21
  "typescript": "5.9.3",
21
22
  "vitest": "4.1.5",
22
- "@prisma-next/adapter-postgres": "0.5.0",
23
- "@prisma-next/operations": "0.5.0",
24
- "@prisma-next/sql-contract-ts": "0.5.0",
23
+ "@prisma-next/adapter-postgres": "0.5.1",
24
+ "@prisma-next/cli": "0.5.1",
25
+ "@prisma-next/operations": "0.5.1",
26
+ "@prisma-next/sql-contract-ts": "0.5.1",
27
+ "@prisma-next/target-postgres": "0.5.1",
25
28
  "@prisma-next/test-utils": "0.0.1",
26
29
  "@prisma-next/tsconfig": "0.0.0",
27
30
  "@prisma-next/tsdown": "0.0.0"
@@ -44,6 +47,7 @@
44
47
  "directory": "packages/3-extensions/paradedb"
45
48
  },
46
49
  "scripts": {
50
+ "build:contract-space": "prisma-next contract emit",
47
51
  "build": "tsdown",
48
52
  "test": "vitest run",
49
53
  "test:coverage": "vitest run --coverage",
@@ -0,0 +1,81 @@
1
+ // ⚠️ GENERATED FILE - DO NOT EDIT
2
+ // This file is automatically generated by 'prisma-next contract emit'.
3
+ // To regenerate, run: prisma-next contract emit
4
+ import type { CodecTypes as PgTypes } from '@prisma-next/target-postgres/codec-types';
5
+ import type { JsonValue } from '@prisma-next/target-postgres/codec-types';
6
+ import type { Char } from '@prisma-next/target-postgres/codec-types';
7
+ import type { Varchar } from '@prisma-next/target-postgres/codec-types';
8
+ import type { Numeric } from '@prisma-next/target-postgres/codec-types';
9
+ import type { Bit } from '@prisma-next/target-postgres/codec-types';
10
+ import type { VarBit } from '@prisma-next/target-postgres/codec-types';
11
+ import type { Timestamp } from '@prisma-next/target-postgres/codec-types';
12
+ import type { Timestamptz } from '@prisma-next/target-postgres/codec-types';
13
+ import type { Time } from '@prisma-next/target-postgres/codec-types';
14
+ import type { Timetz } from '@prisma-next/target-postgres/codec-types';
15
+ import type { Interval } from '@prisma-next/target-postgres/codec-types';
16
+ import type { QueryOperationTypes as PgAdapterQueryOps } from '@prisma-next/adapter-postgres/operation-types';
17
+
18
+ import type {
19
+ ContractWithTypeMaps,
20
+ TypeMaps as TypeMapsType,
21
+ } from '@prisma-next/sql-contract/types';
22
+ import type {
23
+ Contract as ContractType,
24
+ ExecutionHashBase,
25
+ ProfileHashBase,
26
+ StorageHashBase,
27
+ } from '@prisma-next/contract/types';
28
+
29
+ export type StorageHash =
30
+ StorageHashBase<'sha256:7d13ea93bd4726b9962c00ced807a79149e3ff69e0a47d936c0e82f39a637393'>;
31
+ export type ExecutionHash = ExecutionHashBase<string>;
32
+ export type ProfileHash =
33
+ ProfileHashBase<'sha256:1a8dbe044289f30a1de958fe800cc5a8378b285d2e126a8c44b58864bac2c18e'>;
34
+
35
+ export type CodecTypes = PgTypes;
36
+ export type LaneCodecTypes = CodecTypes;
37
+ export type QueryOperationTypes = PgAdapterQueryOps<CodecTypes>;
38
+ type DefaultLiteralValue<CodecId extends string, _Encoded> = CodecId extends keyof CodecTypes
39
+ ? CodecTypes[CodecId]['output']
40
+ : _Encoded;
41
+
42
+ export type FieldOutputTypes = Record<string, never>;
43
+ export type FieldInputTypes = Record<string, never>;
44
+ export type TypeMaps = TypeMapsType<
45
+ CodecTypes,
46
+ QueryOperationTypes,
47
+ FieldOutputTypes,
48
+ FieldInputTypes
49
+ >;
50
+
51
+ type ContractBase = ContractType<
52
+ { readonly tables: {}; readonly types: Record<string, never>; readonly storageHash: StorageHash },
53
+ Record<string, never>
54
+ > & {
55
+ readonly target: 'postgres';
56
+ readonly targetFamily: 'sql';
57
+ readonly roots: Record<string, string>;
58
+ readonly capabilities: {
59
+ readonly postgres: {
60
+ readonly jsonAgg: true;
61
+ readonly lateral: true;
62
+ readonly limit: true;
63
+ readonly orderBy: true;
64
+ readonly returning: true;
65
+ };
66
+ readonly sql: {
67
+ readonly defaultInInsert: true;
68
+ readonly enums: true;
69
+ readonly returning: true;
70
+ };
71
+ };
72
+ readonly extensionPacks: {};
73
+ readonly meta: {};
74
+
75
+ readonly profileHash: ProfileHash;
76
+ };
77
+
78
+ export type Contract = ContractWithTypeMaps<ContractBase, TypeMaps>;
79
+
80
+ export type Tables = Contract['storage']['tables'];
81
+ export type Models = Contract['models'];
@@ -0,0 +1,33 @@
1
+ {
2
+ "schemaVersion": "1",
3
+ "targetFamily": "sql",
4
+ "target": "postgres",
5
+ "profileHash": "sha256:1a8dbe044289f30a1de958fe800cc5a8378b285d2e126a8c44b58864bac2c18e",
6
+ "roots": {},
7
+ "models": {},
8
+ "storage": {
9
+ "storageHash": "sha256:7d13ea93bd4726b9962c00ced807a79149e3ff69e0a47d936c0e82f39a637393",
10
+ "tables": {}
11
+ },
12
+ "capabilities": {
13
+ "postgres": {
14
+ "jsonAgg": true,
15
+ "lateral": true,
16
+ "limit": true,
17
+ "orderBy": true,
18
+ "returning": true
19
+ },
20
+ "sql": {
21
+ "defaultInInsert": true,
22
+ "enums": true,
23
+ "returning": true
24
+ }
25
+ },
26
+ "extensionPacks": {},
27
+ "meta": {},
28
+ "_generated": {
29
+ "warning": "⚠️ GENERATED FILE - DO NOT EDIT",
30
+ "message": "This file is automatically generated by \"prisma-next contract emit\".",
31
+ "regenerate": "To regenerate, run: prisma-next contract emit"
32
+ }
33
+ }
@@ -0,0 +1,22 @@
1
+ // PSL contract source for the `extension-paradedb` package.
2
+ //
3
+ // Authored against the contract-space package layout convention. The same
4
+ // emit pipeline application authors use is applied here:
5
+ //
6
+ // `prisma-next contract emit` → `<package>/src/contract.{json,d.ts}`
7
+ // `prisma-next migration plan` → `<package>/migrations/<dirName>/`
8
+ //
9
+ // The descriptor at `src/exports/control.ts` then wires the emitted JSON
10
+ // artefacts via JSON-import declarations.
11
+ //
12
+ // ## IR coverage
13
+ //
14
+ // paradedb ships **no tables** and **no native types** of its own. Its
15
+ // baseline migration installs the `pg_search` Postgres extension; all
16
+ // BM25 index configuration is carried by the user contract's own models
17
+ // (via the `'bm25'` index-type entry registered in `src/types/index-types.ts`).
18
+ // The contract IR is therefore intentionally empty — the space is still
19
+ // required so the migration runner can track the `pg_search` installation
20
+ // invariant independently of any user models.
21
+ //
22
+ // @see docs/architecture docs/adrs/ADR 212 - Contract spaces.md
@@ -2,3 +2,32 @@
2
2
  * Extension ID for ParadeDB pg_search.
3
3
  */
4
4
  export const PARADEDB_EXTENSION_ID = 'paradedb' as const;
5
+
6
+ /**
7
+ * Static names and identifiers used across paradedb's contract space.
8
+ *
9
+ * Centralised here so the contract IR (`./contract`), the baseline
10
+ * migration ops (`./migrations`), the head ref, and the descriptor
11
+ * (`../exports/control`) all reference the same values without typos.
12
+ *
13
+ * The space identifier `'paradedb'` is what the framework writes to
14
+ * `migrations/` in the user's repo and what the marker table's
15
+ * `space` column carries for paradedb-owned rows.
16
+ *
17
+ * The `paradedb:*` invariantId namespace is locked here — once
18
+ * published, an invariantId is immutable so downstream consumers can
19
+ * reference it by literal string match.
20
+ */
21
+ export const PARADEDB_SPACE_ID = 'paradedb' as const;
22
+
23
+ export const PARADEDB_BASELINE_MIGRATION_NAME =
24
+ '20260601T0000_install_pg_search_extension' as const;
25
+
26
+ /**
27
+ * `paradedb:*` invariantIds emitted by the baseline migration. Each id,
28
+ * once published, is immutable: downstream consumers reference them by
29
+ * literal string match.
30
+ */
31
+ export const PARADEDB_INVARIANTS = {
32
+ installPgSearch: 'paradedb:install-pg-search-v1',
33
+ } as const;
@@ -1,49 +1,66 @@
1
- import type {
2
- ComponentDatabaseDependencies,
3
- SqlControlExtensionDescriptor,
4
- } from '@prisma-next/family-sql/control';
1
+ /**
2
+ * Control-plane descriptor for the paradedb extension.
3
+ *
4
+ * **Contract-space package layout.** The extension's contract
5
+ * + migrations are emitted by the same pipeline application authors use:
6
+ *
7
+ * `prisma-next contract emit` → `<package>/src/contract.{json,d.ts}`
8
+ * `prisma-next migration plan` → `<package>/migrations/<dir>/...`
9
+ *
10
+ * The descriptor wires those JSON artefacts via JSON-import declarations
11
+ * so they flow through the consuming application's module resolver
12
+ * without filesystem assumptions, and synthesises the canonical
13
+ * {@link import('@prisma-next/framework-components/control').MigrationPackage}
14
+ * shape for the framework's runner / verifier to consume. Readers in
15
+ * `@prisma-next/migration-tools` add `dirPath` when loading from disk
16
+ * (`OnDiskMigrationPackage`); descriptor-bundled packages do not need
17
+ * it because the framework reads them directly from the descriptor.
18
+ *
19
+ * Wired surfaces:
20
+ *
21
+ * - `contractSpace.{contractJson,migrations,headRef}` — sourced from
22
+ * the on-disk artefacts emitted by `build:contract-space`.
23
+ * - `queryOperations` — BM25 full-text search operations registered
24
+ * via `paradedbQueryOperations()`.
25
+ *
26
+ * @see docs/architecture docs/adrs/ADR 212 - Contract spaces.md
27
+ * (contract-space package layout convention).
28
+ */
29
+
30
+ import type { Contract } from '@prisma-next/contract/types';
31
+ import type { SqlControlExtensionDescriptor } from '@prisma-next/family-sql/control';
32
+ import { contractSpaceFromJson } from '@prisma-next/migration-tools/spaces';
33
+ import type { SqlStorage } from '@prisma-next/sql-contract/types';
34
+ import baselineMetadata from '../../migrations/20260601T0000_install_pg_search_extension/migration.json' with {
35
+ type: 'json',
36
+ };
37
+ import baselineOps from '../../migrations/20260601T0000_install_pg_search_extension/ops.json' with {
38
+ type: 'json',
39
+ };
40
+ import headRef from '../../migrations/refs/head.json' with { type: 'json' };
41
+ import contractJson from '../contract.json' with { type: 'json' };
42
+ import { PARADEDB_SPACE_ID } from '../core/constants';
5
43
  import { paradedbPackMeta, paradedbQueryOperations } from '../core/descriptor-meta';
6
44
 
7
- const paradedbDatabaseDependencies: ComponentDatabaseDependencies<unknown> = {
8
- init: [
45
+ const BASELINE_DIR_NAME = '20260601T0000_install_pg_search_extension';
46
+
47
+ const paradedbContractSpace = contractSpaceFromJson<Contract<SqlStorage>>({
48
+ contractJson,
49
+ migrations: [
9
50
  {
10
- id: 'postgres.extension.pg_search',
11
- label: 'Enable pg_search extension',
12
- install: [
13
- {
14
- id: 'extension.pg_search',
15
- label: 'Enable extension "pg_search"',
16
- summary: 'Ensures the pg_search extension is available for ParadeDB BM25 operations',
17
- operationClass: 'additive',
18
- target: { id: 'postgres' },
19
- precheck: [
20
- {
21
- description: 'verify extension "pg_search" is not already enabled',
22
- sql: "SELECT NOT EXISTS (SELECT 1 FROM pg_extension WHERE extname = 'pg_search')",
23
- },
24
- ],
25
- execute: [
26
- {
27
- description: 'create extension "pg_search"',
28
- sql: 'CREATE EXTENSION IF NOT EXISTS pg_search',
29
- },
30
- ],
31
- postcheck: [
32
- {
33
- description: 'confirm extension "pg_search" is enabled',
34
- sql: "SELECT EXISTS (SELECT 1 FROM pg_extension WHERE extname = 'pg_search')",
35
- },
36
- ],
37
- },
38
- ],
51
+ dirName: BASELINE_DIR_NAME,
52
+ metadata: baselineMetadata,
53
+ ops: baselineOps,
39
54
  },
40
55
  ],
41
- };
56
+ headRef,
57
+ });
42
58
 
43
59
  const paradedbExtensionDescriptor: SqlControlExtensionDescriptor<'postgres'> = {
44
60
  ...paradedbPackMeta,
61
+ id: PARADEDB_SPACE_ID,
62
+ contractSpace: paradedbContractSpace,
45
63
  queryOperations: () => paradedbQueryOperations(),
46
- databaseDependencies: paradedbDatabaseDependencies,
47
64
  create: () => ({
48
65
  familyId: 'sql' as const,
49
66
  targetId: 'postgres' as const,
@@ -1 +0,0 @@
1
- {"version":3,"file":"descriptor-meta-CmokJ02r.mjs","names":["TEXT"],"sources":["../src/core/constants.ts","../src/core/proximity-chain.ts","../src/core/descriptor-meta.ts"],"sourcesContent":["/**\n * Extension ID for ParadeDB pg_search.\n */\nexport const PARADEDB_EXTENSION_ID = 'paradedb' as const;\n","import {\n type AnyExpression,\n LiteralExpr,\n OperationExpr,\n} from '@prisma-next/sql-relational-core/ast';\nimport { type Expression, toExpr } from '@prisma-next/sql-relational-core/expression';\n\nconst TEXT = 'pg/text@1' as const;\n\nexport type ProximityTerm = unknown;\n\nexport interface ProximityWithinOptions {\n readonly ordered?: boolean;\n}\n\ninterface ProximityStep {\n readonly distance: number;\n readonly term: ProximityTerm;\n readonly ordered: boolean;\n}\n\n// https://docs.paradedb.com/documentation/full-text/proximity\nexport class ParadeDbProximityChain\n implements Expression<{ codecId: 'pg/text@1'; nullable: false }>\n{\n readonly returnType = { codecId: TEXT, nullable: false } as const;\n\n private readonly start: ProximityTerm;\n private readonly steps: readonly ProximityStep[];\n\n constructor(start: ProximityTerm, steps: readonly ProximityStep[] = []) {\n this.start = start;\n this.steps = steps;\n }\n\n within(\n distance: number,\n term: ProximityTerm,\n options?: ProximityWithinOptions,\n ): ParadeDbProximityChain {\n if (!Number.isInteger(distance) || distance < 0) {\n throw new Error(\n `paradeDbProximity.within: distance must be a non-negative integer; got ${String(distance)}`,\n );\n }\n return new ParadeDbProximityChain(this.start, [\n ...this.steps,\n { distance, term, ordered: options?.ordered === true },\n ]);\n }\n\n buildAst(): AnyExpression {\n if (this.steps.length === 0) {\n throw new Error(\n 'paradeDbProximity: chain must have at least one .within(distance, term) step',\n );\n }\n const args: AnyExpression[] = [toExpr(this.start, TEXT)];\n let template = '({{self}}';\n this.steps.forEach((step, i) => {\n const op = step.ordered ? '##>' : '##';\n args.push(LiteralExpr.of(step.distance));\n args.push(toExpr(step.term, TEXT));\n template += ` ${op} {{arg${2 * i}}} ${op} {{arg${2 * i + 1}}}`;\n });\n template += ')';\n const [self, ...rest] = args;\n if (!self) {\n throw new Error('paradeDbProximity: invariant violation — empty args');\n }\n return new OperationExpr({\n method: 'paradeDbProximity',\n self,\n args: rest.length > 0 ? rest : undefined,\n returns: this.returnType,\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template,\n },\n });\n }\n}\n","import { LiteralExpr } from '@prisma-next/sql-relational-core/ast';\nimport { buildOperation, toExpr } from '@prisma-next/sql-relational-core/expression';\nimport { paradedbIndexTypes } from '../types/index-types';\nimport type { QueryOperationTypes } from '../types/operation-types';\nimport { PARADEDB_EXTENSION_ID } from './constants';\nimport { ParadeDbProximityChain } from './proximity-chain';\n\ntype CodecTypesBase = Record<string, { readonly input: unknown; readonly output: unknown }>;\n\nconst TEXT = 'pg/text@1' as const;\nconst BOOL = 'pg/bool@1' as const;\nconst FLOAT4 = 'pg/float4@1' as const;\nconst INT4 = 'pg/int4@1' as const;\n\nexport function paradedbQueryOperations<CT extends CodecTypesBase>(): QueryOperationTypes<CT> {\n return {\n // `@@@` accepts both text and structured query types on its RHS.\n // https://docs.paradedb.com/documentation/full-text/match\n paradeDbMatch: {\n self: { codecId: TEXT },\n impl: (self, query) =>\n buildOperation({\n method: 'paradeDbMatch',\n args: [toExpr(self, TEXT), toExpr(query, TEXT)],\n returns: { codecId: BOOL, nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: '{{self}} @@@ {{arg0}}',\n },\n }),\n },\n paradeDbMatchAny: {\n self: { codecId: TEXT },\n impl: (self, query) =>\n buildOperation({\n method: 'paradeDbMatchAny',\n args: [toExpr(self, TEXT), toExpr(query, TEXT)],\n returns: { codecId: BOOL, nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: '{{self}} ||| {{arg0}}',\n },\n }),\n },\n paradeDbMatchAll: {\n self: { codecId: TEXT },\n impl: (self, query) =>\n buildOperation({\n method: 'paradeDbMatchAll',\n args: [toExpr(self, TEXT), toExpr(query, TEXT)],\n returns: { codecId: BOOL, nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: '{{self}} &&& {{arg0}}',\n },\n }),\n },\n // https://docs.paradedb.com/documentation/full-text/term\n paradeDbTerm: {\n self: { codecId: TEXT },\n impl: (self, query) =>\n buildOperation({\n method: 'paradeDbTerm',\n args: [toExpr(self, TEXT), toExpr(query, TEXT)],\n returns: { codecId: BOOL, nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: '{{self}} === {{arg0}}',\n },\n }),\n },\n // https://docs.paradedb.com/documentation/full-text/phrase\n paradeDbPhrase: {\n self: { codecId: TEXT },\n impl: (self, query) =>\n buildOperation({\n method: 'paradeDbPhrase',\n args: [toExpr(self, TEXT), toExpr(query, TEXT)],\n returns: { codecId: BOOL, nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: '{{self}} ### {{arg0}}',\n },\n }),\n },\n // https://docs.paradedb.com/documentation/sorting/score\n paradeDbScore: {\n self: { codecId: INT4 },\n impl: (self) =>\n buildOperation({\n method: 'paradeDbScore',\n args: [toExpr(self, INT4)],\n returns: { codecId: FLOAT4, nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: 'pdb.score({{self}})',\n },\n }),\n },\n // PG rejects parameterized typmods, so the cast argument lowers to a literal.\n // https://docs.paradedb.com/documentation/full-text/fuzzy\n paradeDbFuzzy: {\n self: { codecId: TEXT },\n impl: (self, distance) => {\n if (!Number.isInteger(distance) || distance < 0 || distance > 2) {\n throw new Error(\n `paradeDbFuzzy: distance must be an integer in [0, 2]; got ${String(distance)}`,\n );\n }\n return buildOperation({\n method: 'paradeDbFuzzy',\n args: [toExpr(self, TEXT), LiteralExpr.of(distance)],\n returns: { codecId: TEXT, nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: '{{self}}::pdb.fuzzy({{arg0}})',\n },\n });\n },\n },\n // https://docs.paradedb.com/documentation/sorting/boost\n paradeDbBoost: {\n self: { codecId: TEXT },\n impl: (self, weight) => {\n if (!Number.isInteger(weight) || weight < -2048 || weight > 2048) {\n throw new Error(\n `paradeDbBoost: boost must be an integer in [-2048, 2048]; got ${String(weight)}`,\n );\n }\n return buildOperation({\n method: 'paradeDbBoost',\n args: [toExpr(self, TEXT), LiteralExpr.of(weight)],\n returns: { codecId: TEXT, nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: '{{self}}::pdb.boost({{arg0}})',\n },\n });\n },\n },\n paradeDbConst: {\n self: { codecId: TEXT },\n impl: (self, value) => {\n if (!Number.isInteger(value)) {\n throw new Error(`paradeDbConst: value must be an integer; got ${String(value)}`);\n }\n return buildOperation({\n method: 'paradeDbConst',\n args: [toExpr(self, TEXT), LiteralExpr.of(value)],\n returns: { codecId: TEXT, nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: '{{self}}::pdb.const({{arg0}})',\n },\n });\n },\n },\n paradeDbSlop: {\n self: { codecId: TEXT },\n impl: (self, slop) => {\n if (!Number.isInteger(slop) || slop < 0) {\n throw new Error(`paradeDbSlop: slop must be a non-negative integer; got ${String(slop)}`);\n }\n return buildOperation({\n method: 'paradeDbSlop',\n args: [toExpr(self, TEXT), LiteralExpr.of(slop)],\n returns: { codecId: TEXT, nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: '{{self}}::pdb.slop({{arg0}})',\n },\n });\n },\n },\n // https://docs.paradedb.com/documentation/full-text/proximity\n paradeDbProximity: {\n self: { codecId: TEXT },\n impl: (start) => new ParadeDbProximityChain(start),\n },\n };\n}\n\nexport const paradedbPackMeta = {\n kind: 'extension',\n id: PARADEDB_EXTENSION_ID,\n familyId: 'sql',\n targetId: 'postgres',\n version: '0.0.1',\n capabilities: {\n postgres: {\n 'paradedb/bm25': true,\n },\n },\n indexTypes: paradedbIndexTypes,\n types: {\n queryOperationTypes: {\n import: {\n package: '@prisma-next/extension-paradedb/operation-types',\n named: 'QueryOperationTypes',\n alias: 'ParadeDbQueryOperationTypes',\n },\n },\n },\n} as const;\n"],"mappings":";;;;;;;AAGA,MAAa,wBAAwB;;;ACIrC,MAAMA,SAAO;AAeb,IAAa,yBAAb,MAAa,uBAEb;CACE,aAAsB;EAAE,SAASA;EAAM,UAAU;EAAO;CAExD;CACA;CAEA,YAAY,OAAsB,QAAkC,EAAE,EAAE;EACtE,KAAK,QAAQ;EACb,KAAK,QAAQ;;CAGf,OACE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