@prisma-next/extension-paradedb 0.5.0-dev.9 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -109
- package/dist/control.d.mts +21 -1
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +37 -2
- package/dist/control.mjs.map +1 -0
- package/dist/descriptor-meta-CmokJ02r.mjs +260 -0
- package/dist/descriptor-meta-CmokJ02r.mjs.map +1 -0
- package/dist/index-types-BWFfNqUb.mjs +11 -0
- package/dist/index-types-BWFfNqUb.mjs.map +1 -0
- package/dist/index-types.d.mts +9 -106
- package/dist/index-types.d.mts.map +1 -1
- package/dist/index-types.mjs +2 -84
- package/dist/operation-types-DXmTJ7jd.d.mts +135 -0
- package/dist/operation-types-DXmTJ7jd.d.mts.map +1 -0
- package/dist/operation-types.d.mts +2 -0
- package/dist/operation-types.mjs +1 -0
- package/dist/pack.d.mts +16 -0
- package/dist/pack.d.mts.map +1 -1
- package/dist/pack.mjs +3 -5
- package/dist/pack.mjs.map +1 -1
- package/dist/runtime.d.mts +7 -0
- package/dist/runtime.d.mts.map +1 -0
- package/dist/runtime.mjs +21 -0
- package/dist/runtime.mjs.map +1 -0
- package/package.json +21 -7
- package/src/core/constants.ts +0 -18
- package/src/core/descriptor-meta.ts +200 -0
- package/src/core/proximity-chain.ts +83 -0
- package/src/exports/control.ts +53 -2
- package/src/exports/index-types.ts +2 -12
- package/src/exports/operation-types.ts +1 -0
- package/src/exports/runtime.ts +20 -0
- package/src/types/index-types.ts +12 -179
- package/src/types/operation-types.ts +84 -0
- package/dist/descriptor-meta-BTFnIGJ6.mjs +0 -20
- package/dist/descriptor-meta-BTFnIGJ6.mjs.map +0 -1
- package/dist/index-types.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -4,21 +4,21 @@ ParadeDB full-text search extension pack for Prisma Next.
|
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
This extension pack
|
|
7
|
+
This extension pack registers a `'bm25'` index type with the SQL family's index-type registry, so contracts can author BM25 full-text search indexes via the standard `constraints.index(...)` surface and the Postgres adapter emits `CREATE INDEX ... USING bm25 WITH (...)` DDL.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
The v1 surface covers the `key_field` storage parameter only. Per-field tokenizer and column configuration is deferred to expression-index support.
|
|
10
10
|
|
|
11
11
|
## Responsibilities
|
|
12
12
|
|
|
13
|
-
- **
|
|
14
|
-
- **
|
|
15
|
-
- **
|
|
16
|
-
- **Pack Ref Export**: Ships a pure `/pack` entrypoint for TypeScript contract authoring
|
|
13
|
+
- **bm25 index registration**: declares a `'bm25'` entry via `defineIndexTypes()` carrying an arktype validator for the bm25 options shape
|
|
14
|
+
- **Extension descriptor**: declares the `paradedb/bm25` capability for contract-level feature detection
|
|
15
|
+
- **Pack ref export**: ships a pure `/pack` entrypoint for TypeScript contract authoring
|
|
17
16
|
|
|
18
17
|
## Dependencies
|
|
19
18
|
|
|
20
|
-
- **`@prisma-next/contract`**:
|
|
21
|
-
- **`@prisma-next/contract-authoring`**:
|
|
19
|
+
- **`@prisma-next/sql-contract`**: index-type registry primitive
|
|
20
|
+
- **`@prisma-next/contract`** / **`@prisma-next/contract-authoring`**: core contract types
|
|
21
|
+
- **`arktype`**: option-shape validation
|
|
22
22
|
|
|
23
23
|
## Installation
|
|
24
24
|
|
|
@@ -28,15 +28,14 @@ pnpm add @prisma-next/extension-paradedb
|
|
|
28
28
|
|
|
29
29
|
## Usage
|
|
30
30
|
|
|
31
|
-
### Contract
|
|
31
|
+
### Contract definition
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
Author bm25 indexes via the standard `constraints.index(...)` surface; the registered `'bm25'` entry narrows `options` per-`type`:
|
|
34
34
|
|
|
35
35
|
```typescript
|
|
36
|
-
import { int4Column, textColumn
|
|
36
|
+
import { int4Column, textColumn } from '@prisma-next/adapter-postgres/column-types';
|
|
37
37
|
import sqlFamily from '@prisma-next/family-sql/pack';
|
|
38
38
|
import { defineContract, field, model } from '@prisma-next/sql-contract-ts/contract-builder';
|
|
39
|
-
import { bm25, bm25Index } from '@prisma-next/extension-paradedb/index-types';
|
|
40
39
|
import paradedb from '@prisma-next/extension-paradedb/pack';
|
|
41
40
|
import postgres from '@prisma-next/target-postgres/pack';
|
|
42
41
|
|
|
@@ -48,121 +47,40 @@ export const contract = defineContract({
|
|
|
48
47
|
Item: model('Item', {
|
|
49
48
|
fields: {
|
|
50
49
|
id: field.column(int4Column).id(),
|
|
51
|
-
|
|
52
|
-
category: field.column(textColumn),
|
|
53
|
-
rating: field.column(int4Column),
|
|
54
|
-
metadata: field.column(jsonbColumn),
|
|
50
|
+
body: field.column(textColumn),
|
|
55
51
|
},
|
|
56
|
-
}).sql({
|
|
52
|
+
}).sql(({ cols, constraints }) => ({
|
|
57
53
|
table: 'items',
|
|
58
54
|
indexes: [
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
bm25.text('category'),
|
|
64
|
-
bm25.numeric('rating'),
|
|
65
|
-
bm25.json('metadata', { tokenizer: 'ngram', min: 2, max: 3 }),
|
|
66
|
-
],
|
|
67
|
-
name: 'search_idx',
|
|
55
|
+
constraints.index([cols.body], {
|
|
56
|
+
name: 'item_body_bm25_idx',
|
|
57
|
+
type: 'bm25',
|
|
58
|
+
options: { key_field: 'id' },
|
|
68
59
|
}),
|
|
69
60
|
],
|
|
70
|
-
}),
|
|
61
|
+
})),
|
|
71
62
|
},
|
|
72
63
|
});
|
|
73
64
|
```
|
|
74
65
|
|
|
75
|
-
###
|
|
66
|
+
### key_field
|
|
76
67
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
| Builder | Description | Tokenizer support |
|
|
80
|
-
|---------|-------------|-------------------|
|
|
81
|
-
| `bm25.text(column, opts?)` | Text field (`text`, `varchar`) | Yes — any tokenizer + stemmer, remove_emojis |
|
|
82
|
-
| `bm25.numeric(column)` | Numeric field (filterable, sortable) | No |
|
|
83
|
-
| `bm25.boolean(column)` | Boolean field | No |
|
|
84
|
-
| `bm25.json(column, opts?)` | JSON/JSONB field | Yes — tokenizer + ngram params |
|
|
85
|
-
| `bm25.datetime(column)` | Timestamp/date field | No |
|
|
86
|
-
| `bm25.range(column)` | Range field | No |
|
|
87
|
-
| `bm25.expression(sql, opts)` | Raw SQL expression | Yes — `alias` required |
|
|
88
|
-
|
|
89
|
-
### Expression-Based Fields
|
|
90
|
-
|
|
91
|
-
For computed or JSON sub-field indexing, use `bm25.expression()` with a raw SQL string:
|
|
92
|
-
|
|
93
|
-
```typescript
|
|
94
|
-
.index(
|
|
95
|
-
bm25Index({
|
|
96
|
-
keyField: 'id',
|
|
97
|
-
fields: [
|
|
98
|
-
bm25.text('description'),
|
|
99
|
-
bm25.expression("description || ' ' || category", {
|
|
100
|
-
alias: 'concat',
|
|
101
|
-
tokenizer: 'simple',
|
|
102
|
-
}),
|
|
103
|
-
bm25.expression("(metadata->>'color')", {
|
|
104
|
-
alias: 'meta_color',
|
|
105
|
-
tokenizer: 'ngram',
|
|
106
|
-
min: 2,
|
|
107
|
-
max: 3,
|
|
108
|
-
}),
|
|
109
|
-
],
|
|
110
|
-
}),
|
|
111
|
-
)
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
### keyField Behavior
|
|
115
|
-
|
|
116
|
-
ParadeDB BM25 indexes require a `key_field` — a unique column that identifies each document:
|
|
117
|
-
|
|
118
|
-
- **Required**: Set `keyField` explicitly in `bm25Index(...)`.
|
|
119
|
-
- **Recommended**: Use the table primary key in most cases.
|
|
120
|
-
- **Override**: You can choose another unique column when needed.
|
|
121
|
-
|
|
122
|
-
```typescript
|
|
123
|
-
.index(bm25Index({ keyField: 'id', fields: [bm25.text('body')] }))
|
|
124
|
-
.index(bm25Index({ keyField: 'uuid', fields: [bm25.text('body')] }))
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
## Tokenizers
|
|
128
|
-
|
|
129
|
-
All 12 built-in ParadeDB tokenizers are available via the `TokenizerId` type:
|
|
130
|
-
|
|
131
|
-
| Tokenizer | Description |
|
|
132
|
-
|-----------|-------------|
|
|
133
|
-
| `unicode_words` | Default. Unicode word boundaries (UAX #29). Lowercases. |
|
|
134
|
-
| `simple` | Splits on non-alphanumeric. Lowercases. |
|
|
135
|
-
| `ngram` | Character n-grams of configurable length. |
|
|
136
|
-
| `icu` | ICU Unicode standard segmentation. Multilingual. |
|
|
137
|
-
| `regex_pattern` | Regex-based tokenization. |
|
|
138
|
-
| `source_code` | camelCase / snake_case splitting. |
|
|
139
|
-
| `literal` | No splitting. Exact match, sort, aggregation. |
|
|
140
|
-
| `literal_normalized` | Literal + lowercase + token filters. |
|
|
141
|
-
| `whitespace` | Whitespace splitting + lowercase. |
|
|
142
|
-
| `chinese_compatible` | CJK-aware word segmentation. |
|
|
143
|
-
| `jieba` | Chinese segmentation via Jieba. |
|
|
144
|
-
| `lindera` | Japanese/Korean/Chinese via Lindera. |
|
|
68
|
+
ParadeDB BM25 indexes require a `key_field` — a unique column that identifies each document. It is required, must be a string, and is typically (but not always) the table's primary key.
|
|
145
69
|
|
|
146
70
|
## Capabilities
|
|
147
71
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
- `paradedb/bm25`: Indicates support for BM25 full-text search indexes
|
|
151
|
-
|
|
152
|
-
## Not Yet Implemented
|
|
72
|
+
- `paradedb/bm25` — indicates support for BM25 full-text search indexes
|
|
153
73
|
|
|
154
|
-
|
|
74
|
+
## Not yet implemented
|
|
155
75
|
|
|
156
|
-
-
|
|
157
|
-
-
|
|
158
|
-
-
|
|
159
|
-
-
|
|
160
|
-
- **Database dependencies**: `CREATE EXTENSION pg_search` via migration planner
|
|
76
|
+
- Per-column / per-expression tokenizer configuration (deferred to expression-index support)
|
|
77
|
+
- `@@@` operator and `pdb.*` query builder functions
|
|
78
|
+
- `CREATE EXTENSION pg_search` via migration planner
|
|
79
|
+
- Scoring, aggregation, and highlight functions
|
|
161
80
|
|
|
162
81
|
## References
|
|
163
82
|
|
|
164
83
|
- [ParadeDB documentation](https://docs.paradedb.com/)
|
|
165
84
|
- [ParadeDB CREATE INDEX](https://docs.paradedb.com/documentation/indexing/create-index)
|
|
166
|
-
- [
|
|
167
|
-
- [pg_search source](https://github.com/paradedb/paradedb/tree/main/pg_search)
|
|
85
|
+
- [ADR 210 — Index-type registry](../../../docs/architecture%20docs/adrs/ADR%20210%20-%20Index-type%20registry.md)
|
|
168
86
|
- [Prisma Next Architecture Overview](../../../docs/Architecture%20Overview.md)
|
package/dist/control.d.mts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import * as _$_prisma_next_sql_contract_index_types0 from "@prisma-next/sql-contract/index-types";
|
|
2
|
+
import { SqlControlExtensionDescriptor } from "@prisma-next/family-sql/control";
|
|
3
|
+
|
|
1
4
|
//#region src/core/descriptor-meta.d.ts
|
|
2
5
|
declare const paradedbPackMeta: {
|
|
3
6
|
readonly kind: "extension";
|
|
@@ -10,7 +13,24 @@ declare const paradedbPackMeta: {
|
|
|
10
13
|
readonly 'paradedb/bm25': true;
|
|
11
14
|
};
|
|
12
15
|
};
|
|
16
|
+
readonly indexTypes: _$_prisma_next_sql_contract_index_types0.IndexTypeBuilder<Record<never, never> & Record<"bm25", {
|
|
17
|
+
readonly options: {
|
|
18
|
+
key_field: string;
|
|
19
|
+
};
|
|
20
|
+
}>>;
|
|
21
|
+
readonly types: {
|
|
22
|
+
readonly queryOperationTypes: {
|
|
23
|
+
readonly import: {
|
|
24
|
+
readonly package: "@prisma-next/extension-paradedb/operation-types";
|
|
25
|
+
readonly named: "QueryOperationTypes";
|
|
26
|
+
readonly alias: "ParadeDbQueryOperationTypes";
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
13
30
|
};
|
|
14
31
|
//#endregion
|
|
15
|
-
|
|
32
|
+
//#region src/exports/control.d.ts
|
|
33
|
+
declare const paradedbExtensionDescriptor: SqlControlExtensionDescriptor<'postgres'>;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { paradedbExtensionDescriptor as default, paradedbExtensionDescriptor, paradedbPackMeta };
|
|
16
36
|
//# sourceMappingURL=control.d.mts.map
|
package/dist/control.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.d.mts","names":[],"sources":["../src/core/descriptor-meta.ts"
|
|
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"}
|
package/dist/control.mjs
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
|
-
import { t as paradedbPackMeta } from "./descriptor-meta-
|
|
1
|
+
import { n as paradedbQueryOperations, t as paradedbPackMeta } from "./descriptor-meta-CmokJ02r.mjs";
|
|
2
|
+
//#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')"
|
|
23
|
+
}]
|
|
24
|
+
}]
|
|
25
|
+
}] };
|
|
26
|
+
const paradedbExtensionDescriptor = {
|
|
27
|
+
...paradedbPackMeta,
|
|
28
|
+
queryOperations: () => paradedbQueryOperations(),
|
|
29
|
+
databaseDependencies: paradedbDatabaseDependencies,
|
|
30
|
+
create: () => ({
|
|
31
|
+
familyId: "sql",
|
|
32
|
+
targetId: "postgres"
|
|
33
|
+
})
|
|
34
|
+
};
|
|
35
|
+
//#endregion
|
|
36
|
+
export { paradedbExtensionDescriptor as default, paradedbExtensionDescriptor, paradedbPackMeta };
|
|
2
37
|
|
|
3
|
-
|
|
38
|
+
//# sourceMappingURL=control.mjs.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { t as paradedbIndexTypes } from "./index-types-BWFfNqUb.mjs";
|
|
2
|
+
import { LiteralExpr, OperationExpr } from "@prisma-next/sql-relational-core/ast";
|
|
3
|
+
import { buildOperation, toExpr } from "@prisma-next/sql-relational-core/expression";
|
|
4
|
+
//#region src/core/constants.ts
|
|
5
|
+
/**
|
|
6
|
+
* Extension ID for ParadeDB pg_search.
|
|
7
|
+
*/
|
|
8
|
+
const PARADEDB_EXTENSION_ID = "paradedb";
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/core/proximity-chain.ts
|
|
11
|
+
const TEXT$1 = "pg/text@1";
|
|
12
|
+
var ParadeDbProximityChain = class ParadeDbProximityChain {
|
|
13
|
+
returnType = {
|
|
14
|
+
codecId: TEXT$1,
|
|
15
|
+
nullable: false
|
|
16
|
+
};
|
|
17
|
+
start;
|
|
18
|
+
steps;
|
|
19
|
+
constructor(start, steps = []) {
|
|
20
|
+
this.start = start;
|
|
21
|
+
this.steps = steps;
|
|
22
|
+
}
|
|
23
|
+
within(distance, term, options) {
|
|
24
|
+
if (!Number.isInteger(distance) || distance < 0) throw new Error(`paradeDbProximity.within: distance must be a non-negative integer; got ${String(distance)}`);
|
|
25
|
+
return new ParadeDbProximityChain(this.start, [...this.steps, {
|
|
26
|
+
distance,
|
|
27
|
+
term,
|
|
28
|
+
ordered: options?.ordered === true
|
|
29
|
+
}]);
|
|
30
|
+
}
|
|
31
|
+
buildAst() {
|
|
32
|
+
if (this.steps.length === 0) throw new Error("paradeDbProximity: chain must have at least one .within(distance, term) step");
|
|
33
|
+
const args = [toExpr(this.start, TEXT$1)];
|
|
34
|
+
let template = "({{self}}";
|
|
35
|
+
this.steps.forEach((step, i) => {
|
|
36
|
+
const op = step.ordered ? "##>" : "##";
|
|
37
|
+
args.push(LiteralExpr.of(step.distance));
|
|
38
|
+
args.push(toExpr(step.term, TEXT$1));
|
|
39
|
+
template += ` ${op} {{arg${2 * i}}} ${op} {{arg${2 * i + 1}}}`;
|
|
40
|
+
});
|
|
41
|
+
template += ")";
|
|
42
|
+
const [self, ...rest] = args;
|
|
43
|
+
if (!self) throw new Error("paradeDbProximity: invariant violation — empty args");
|
|
44
|
+
return new OperationExpr({
|
|
45
|
+
method: "paradeDbProximity",
|
|
46
|
+
self,
|
|
47
|
+
args: rest.length > 0 ? rest : void 0,
|
|
48
|
+
returns: this.returnType,
|
|
49
|
+
lowering: {
|
|
50
|
+
targetFamily: "sql",
|
|
51
|
+
strategy: "function",
|
|
52
|
+
template
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/core/descriptor-meta.ts
|
|
59
|
+
const TEXT = "pg/text@1";
|
|
60
|
+
const BOOL = "pg/bool@1";
|
|
61
|
+
const FLOAT4 = "pg/float4@1";
|
|
62
|
+
const INT4 = "pg/int4@1";
|
|
63
|
+
function paradedbQueryOperations() {
|
|
64
|
+
return {
|
|
65
|
+
paradeDbMatch: {
|
|
66
|
+
self: { codecId: TEXT },
|
|
67
|
+
impl: (self, query) => buildOperation({
|
|
68
|
+
method: "paradeDbMatch",
|
|
69
|
+
args: [toExpr(self, TEXT), toExpr(query, TEXT)],
|
|
70
|
+
returns: {
|
|
71
|
+
codecId: BOOL,
|
|
72
|
+
nullable: false
|
|
73
|
+
},
|
|
74
|
+
lowering: {
|
|
75
|
+
targetFamily: "sql",
|
|
76
|
+
strategy: "function",
|
|
77
|
+
template: "{{self}} @@@ {{arg0}}"
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
},
|
|
81
|
+
paradeDbMatchAny: {
|
|
82
|
+
self: { codecId: TEXT },
|
|
83
|
+
impl: (self, query) => buildOperation({
|
|
84
|
+
method: "paradeDbMatchAny",
|
|
85
|
+
args: [toExpr(self, TEXT), toExpr(query, TEXT)],
|
|
86
|
+
returns: {
|
|
87
|
+
codecId: BOOL,
|
|
88
|
+
nullable: false
|
|
89
|
+
},
|
|
90
|
+
lowering: {
|
|
91
|
+
targetFamily: "sql",
|
|
92
|
+
strategy: "function",
|
|
93
|
+
template: "{{self}} ||| {{arg0}}"
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
},
|
|
97
|
+
paradeDbMatchAll: {
|
|
98
|
+
self: { codecId: TEXT },
|
|
99
|
+
impl: (self, query) => buildOperation({
|
|
100
|
+
method: "paradeDbMatchAll",
|
|
101
|
+
args: [toExpr(self, TEXT), toExpr(query, TEXT)],
|
|
102
|
+
returns: {
|
|
103
|
+
codecId: BOOL,
|
|
104
|
+
nullable: false
|
|
105
|
+
},
|
|
106
|
+
lowering: {
|
|
107
|
+
targetFamily: "sql",
|
|
108
|
+
strategy: "function",
|
|
109
|
+
template: "{{self}} &&& {{arg0}}"
|
|
110
|
+
}
|
|
111
|
+
})
|
|
112
|
+
},
|
|
113
|
+
paradeDbTerm: {
|
|
114
|
+
self: { codecId: TEXT },
|
|
115
|
+
impl: (self, query) => buildOperation({
|
|
116
|
+
method: "paradeDbTerm",
|
|
117
|
+
args: [toExpr(self, TEXT), toExpr(query, TEXT)],
|
|
118
|
+
returns: {
|
|
119
|
+
codecId: BOOL,
|
|
120
|
+
nullable: false
|
|
121
|
+
},
|
|
122
|
+
lowering: {
|
|
123
|
+
targetFamily: "sql",
|
|
124
|
+
strategy: "function",
|
|
125
|
+
template: "{{self}} === {{arg0}}"
|
|
126
|
+
}
|
|
127
|
+
})
|
|
128
|
+
},
|
|
129
|
+
paradeDbPhrase: {
|
|
130
|
+
self: { codecId: TEXT },
|
|
131
|
+
impl: (self, query) => buildOperation({
|
|
132
|
+
method: "paradeDbPhrase",
|
|
133
|
+
args: [toExpr(self, TEXT), toExpr(query, TEXT)],
|
|
134
|
+
returns: {
|
|
135
|
+
codecId: BOOL,
|
|
136
|
+
nullable: false
|
|
137
|
+
},
|
|
138
|
+
lowering: {
|
|
139
|
+
targetFamily: "sql",
|
|
140
|
+
strategy: "function",
|
|
141
|
+
template: "{{self}} ### {{arg0}}"
|
|
142
|
+
}
|
|
143
|
+
})
|
|
144
|
+
},
|
|
145
|
+
paradeDbScore: {
|
|
146
|
+
self: { codecId: INT4 },
|
|
147
|
+
impl: (self) => buildOperation({
|
|
148
|
+
method: "paradeDbScore",
|
|
149
|
+
args: [toExpr(self, INT4)],
|
|
150
|
+
returns: {
|
|
151
|
+
codecId: FLOAT4,
|
|
152
|
+
nullable: false
|
|
153
|
+
},
|
|
154
|
+
lowering: {
|
|
155
|
+
targetFamily: "sql",
|
|
156
|
+
strategy: "function",
|
|
157
|
+
template: "pdb.score({{self}})"
|
|
158
|
+
}
|
|
159
|
+
})
|
|
160
|
+
},
|
|
161
|
+
paradeDbFuzzy: {
|
|
162
|
+
self: { codecId: TEXT },
|
|
163
|
+
impl: (self, distance) => {
|
|
164
|
+
if (!Number.isInteger(distance) || distance < 0 || distance > 2) throw new Error(`paradeDbFuzzy: distance must be an integer in [0, 2]; got ${String(distance)}`);
|
|
165
|
+
return buildOperation({
|
|
166
|
+
method: "paradeDbFuzzy",
|
|
167
|
+
args: [toExpr(self, TEXT), LiteralExpr.of(distance)],
|
|
168
|
+
returns: {
|
|
169
|
+
codecId: TEXT,
|
|
170
|
+
nullable: false
|
|
171
|
+
},
|
|
172
|
+
lowering: {
|
|
173
|
+
targetFamily: "sql",
|
|
174
|
+
strategy: "function",
|
|
175
|
+
template: "{{self}}::pdb.fuzzy({{arg0}})"
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
paradeDbBoost: {
|
|
181
|
+
self: { codecId: TEXT },
|
|
182
|
+
impl: (self, weight) => {
|
|
183
|
+
if (!Number.isInteger(weight) || weight < -2048 || weight > 2048) throw new Error(`paradeDbBoost: boost must be an integer in [-2048, 2048]; got ${String(weight)}`);
|
|
184
|
+
return buildOperation({
|
|
185
|
+
method: "paradeDbBoost",
|
|
186
|
+
args: [toExpr(self, TEXT), LiteralExpr.of(weight)],
|
|
187
|
+
returns: {
|
|
188
|
+
codecId: TEXT,
|
|
189
|
+
nullable: false
|
|
190
|
+
},
|
|
191
|
+
lowering: {
|
|
192
|
+
targetFamily: "sql",
|
|
193
|
+
strategy: "function",
|
|
194
|
+
template: "{{self}}::pdb.boost({{arg0}})"
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
paradeDbConst: {
|
|
200
|
+
self: { codecId: TEXT },
|
|
201
|
+
impl: (self, value) => {
|
|
202
|
+
if (!Number.isInteger(value)) throw new Error(`paradeDbConst: value must be an integer; got ${String(value)}`);
|
|
203
|
+
return buildOperation({
|
|
204
|
+
method: "paradeDbConst",
|
|
205
|
+
args: [toExpr(self, TEXT), LiteralExpr.of(value)],
|
|
206
|
+
returns: {
|
|
207
|
+
codecId: TEXT,
|
|
208
|
+
nullable: false
|
|
209
|
+
},
|
|
210
|
+
lowering: {
|
|
211
|
+
targetFamily: "sql",
|
|
212
|
+
strategy: "function",
|
|
213
|
+
template: "{{self}}::pdb.const({{arg0}})"
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
paradeDbSlop: {
|
|
219
|
+
self: { codecId: TEXT },
|
|
220
|
+
impl: (self, slop) => {
|
|
221
|
+
if (!Number.isInteger(slop) || slop < 0) throw new Error(`paradeDbSlop: slop must be a non-negative integer; got ${String(slop)}`);
|
|
222
|
+
return buildOperation({
|
|
223
|
+
method: "paradeDbSlop",
|
|
224
|
+
args: [toExpr(self, TEXT), LiteralExpr.of(slop)],
|
|
225
|
+
returns: {
|
|
226
|
+
codecId: TEXT,
|
|
227
|
+
nullable: false
|
|
228
|
+
},
|
|
229
|
+
lowering: {
|
|
230
|
+
targetFamily: "sql",
|
|
231
|
+
strategy: "function",
|
|
232
|
+
template: "{{self}}::pdb.slop({{arg0}})"
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
paradeDbProximity: {
|
|
238
|
+
self: { codecId: TEXT },
|
|
239
|
+
impl: (start) => new ParadeDbProximityChain(start)
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
const paradedbPackMeta = {
|
|
244
|
+
kind: "extension",
|
|
245
|
+
id: PARADEDB_EXTENSION_ID,
|
|
246
|
+
familyId: "sql",
|
|
247
|
+
targetId: "postgres",
|
|
248
|
+
version: "0.0.1",
|
|
249
|
+
capabilities: { postgres: { "paradedb/bm25": true } },
|
|
250
|
+
indexTypes: paradedbIndexTypes,
|
|
251
|
+
types: { queryOperationTypes: { import: {
|
|
252
|
+
package: "@prisma-next/extension-paradedb/operation-types",
|
|
253
|
+
named: "QueryOperationTypes",
|
|
254
|
+
alias: "ParadeDbQueryOperationTypes"
|
|
255
|
+
} } }
|
|
256
|
+
};
|
|
257
|
+
//#endregion
|
|
258
|
+
export { paradedbQueryOperations as n, paradedbPackMeta as t };
|
|
259
|
+
|
|
260
|
+
//# sourceMappingURL=descriptor-meta-CmokJ02r.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
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,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,IAAI,MACR,+EACD;EAEH,MAAM,OAAwB,CAAC,OAAO,KAAK,OAAOA,OAAK,CAAC;EACxD,IAAI,WAAW;EACf,KAAK,MAAM,SAAS,MAAM,MAAM;GAC9B,MAAM,KAAK,KAAK,UAAU,QAAQ;GAClC,KAAK,KAAK,YAAY,GAAG,KAAK,SAAS,CAAC;GACxC,KAAK,KAAK,OAAO,KAAK,MAAMA,OAAK,CAAC;GAClC,YAAY,IAAI,GAAG,QAAQ,IAAI,EAAE,KAAK,GAAG,QAAQ,IAAI,IAAI,EAAE;IAC3D;EACF,YAAY;EACZ,MAAM,CAAC,MAAM,GAAG,QAAQ;EACxB,IAAI,CAAC,MACH,MAAM,IAAI,MAAM,sDAAsD;EAExE,OAAO,IAAI,cAAc;GACvB,QAAQ;GACR;GACA,MAAM,KAAK,SAAS,IAAI,OAAO,KAAA;GAC/B,SAAS,KAAK;GACd,UAAU;IACR,cAAc;IACd,UAAU;IACV;IACD;GACF,CAAC;;;;;ACvEN,MAAM,OAAO;AACb,MAAM,OAAO;AACb,MAAM,SAAS;AACf,MAAM,OAAO;AAEb,SAAgB,0BAA8E;CAC5F,OAAO;EAGL,eAAe;GACb,MAAM,EAAE,SAAS,MAAM;GACvB,OAAO,MAAM,UACX,eAAe;IACb,QAAQ;IACR,MAAM,CAAC,OAAO,MAAM,KAAK,EAAE,OAAO,OAAO,KAAK,CAAC;IAC/C,SAAS;KAAE,SAAS;KAAM,UAAU;KAAO;IAC3C,UAAU;KACR,cAAc;KACd,UAAU;KACV,UAAU;KACX;IACF,CAAC;GACL;EACD,kBAAkB;GAChB,MAAM,EAAE,SAAS,MAAM;GACvB,OAAO,MAAM,UACX,eAAe;IACb,QAAQ;IACR,MAAM,CAAC,OAAO,MAAM,KAAK,EAAE,OAAO,OAAO,KAAK,CAAC;IAC/C,SAAS;KAAE,SAAS;KAAM,UAAU;KAAO;IAC3C,UAAU;KACR,cAAc;KACd,UAAU;KACV,UAAU;KACX;IACF,CAAC;GACL;EACD,kBAAkB;GAChB,MAAM,EAAE,SAAS,MAAM;GACvB,OAAO,MAAM,UACX,eAAe;IACb,QAAQ;IACR,MAAM,CAAC,OAAO,MAAM,KAAK,EAAE,OAAO,OAAO,KAAK,CAAC;IAC/C,SAAS;KAAE,SAAS;KAAM,UAAU;KAAO;IAC3C,UAAU;KACR,cAAc;KACd,UAAU;KACV,UAAU;KACX;IACF,CAAC;GACL;EAED,cAAc;GACZ,MAAM,EAAE,SAAS,MAAM;GACvB,OAAO,MAAM,UACX,eAAe;IACb,QAAQ;IACR,MAAM,CAAC,OAAO,MAAM,KAAK,EAAE,OAAO,OAAO,KAAK,CAAC;IAC/C,SAAS;KAAE,SAAS;KAAM,UAAU;KAAO;IAC3C,UAAU;KACR,cAAc;KACd,UAAU;KACV,UAAU;KACX;IACF,CAAC;GACL;EAED,gBAAgB;GACd,MAAM,EAAE,SAAS,MAAM;GACvB,OAAO,MAAM,UACX,eAAe;IACb,QAAQ;IACR,MAAM,CAAC,OAAO,MAAM,KAAK,EAAE,OAAO,OAAO,KAAK,CAAC;IAC/C,SAAS;KAAE,SAAS;KAAM,UAAU;KAAO;IAC3C,UAAU;KACR,cAAc;KACd,UAAU;KACV,UAAU;KACX;IACF,CAAC;GACL;EAED,eAAe;GACb,MAAM,EAAE,SAAS,MAAM;GACvB,OAAO,SACL,eAAe;IACb,QAAQ;IACR,MAAM,CAAC,OAAO,MAAM,KAAK,CAAC;IAC1B,SAAS;KAAE,SAAS;KAAQ,UAAU;KAAO;IAC7C,UAAU;KACR,cAAc;KACd,UAAU;KACV,UAAU;KACX;IACF,CAAC;GACL;EAGD,eAAe;GACb,MAAM,EAAE,SAAS,MAAM;GACvB,OAAO,MAAM,aAAa;IACxB,IAAI,CAAC,OAAO,UAAU,SAAS,IAAI,WAAW,KAAK,WAAW,GAC5D,MAAM,IAAI,MACR,6DAA6D,OAAO,SAAS,GAC9E;IAEH,OAAO,eAAe;KACpB,QAAQ;KACR,MAAM,CAAC,OAAO,MAAM,KAAK,EAAE,YAAY,GAAG,SAAS,CAAC;KACpD,SAAS;MAAE,SAAS;MAAM,UAAU;MAAO;KAC3C,UAAU;MACR,cAAc;MACd,UAAU;MACV,UAAU;MACX;KACF,CAAC;;GAEL;EAED,eAAe;GACb,MAAM,EAAE,SAAS,MAAM;GACvB,OAAO,MAAM,WAAW;IACtB,IAAI,CAAC,OAAO,UAAU,OAAO,IAAI,SAAS,SAAS,SAAS,MAC1D,MAAM,IAAI,MACR,iEAAiE,OAAO,OAAO,GAChF;IAEH,OAAO,eAAe;KACpB,QAAQ;KACR,MAAM,CAAC,OAAO,MAAM,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC;KAClD,SAAS;MAAE,SAAS;MAAM,UAAU;MAAO;KAC3C,UAAU;MACR,cAAc;MACd,UAAU;MACV,UAAU;MACX;KACF,CAAC;;GAEL;EACD,eAAe;GACb,MAAM,EAAE,SAAS,MAAM;GACvB,OAAO,MAAM,UAAU;IACrB,IAAI,CAAC,OAAO,UAAU,MAAM,EAC1B,MAAM,IAAI,MAAM,gDAAgD,OAAO,MAAM,GAAG;IAElF,OAAO,eAAe;KACpB,QAAQ;KACR,MAAM,CAAC,OAAO,MAAM,KAAK,EAAE,YAAY,GAAG,MAAM,CAAC;KACjD,SAAS;MAAE,SAAS;MAAM,UAAU;MAAO;KAC3C,UAAU;MACR,cAAc;MACd,UAAU;MACV,UAAU;MACX;KACF,CAAC;;GAEL;EACD,cAAc;GACZ,MAAM,EAAE,SAAS,MAAM;GACvB,OAAO,MAAM,SAAS;IACpB,IAAI,CAAC,OAAO,UAAU,KAAK,IAAI,OAAO,GACpC,MAAM,IAAI,MAAM,0DAA0D,OAAO,KAAK,GAAG;IAE3F,OAAO,eAAe;KACpB,QAAQ;KACR,MAAM,CAAC,OAAO,MAAM,KAAK,EAAE,YAAY,GAAG,KAAK,CAAC;KAChD,SAAS;MAAE,SAAS;MAAM,UAAU;MAAO;KAC3C,UAAU;MACR,cAAc;MACd,UAAU;MACV,UAAU;MACX;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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { defineIndexTypes } from "@prisma-next/sql-contract/index-types";
|
|
2
|
+
import { type } from "arktype";
|
|
3
|
+
//#region src/types/index-types.ts
|
|
4
|
+
const paradedbIndexTypes = defineIndexTypes().add("bm25", { options: type({
|
|
5
|
+
"+": "reject",
|
|
6
|
+
key_field: "string"
|
|
7
|
+
}) });
|
|
8
|
+
//#endregion
|
|
9
|
+
export { paradedbIndexTypes as t };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=index-types-BWFfNqUb.mjs.map
|
|
@@ -0,0 +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"}
|