@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.
@@ -1,4 +1,194 @@
1
+ import { LiteralExpr } from '@prisma-next/sql-relational-core/ast';
2
+ import { buildOperation, toExpr } from '@prisma-next/sql-relational-core/expression';
3
+ import { paradedbIndexTypes } from '../types/index-types';
4
+ import type { QueryOperationTypes } from '../types/operation-types';
1
5
  import { PARADEDB_EXTENSION_ID } from './constants';
6
+ import { ParadeDbProximityChain } from './proximity-chain';
7
+
8
+ type CodecTypesBase = Record<string, { readonly input: unknown; readonly output: unknown }>;
9
+
10
+ const TEXT = 'pg/text@1' as const;
11
+ const BOOL = 'pg/bool@1' as const;
12
+ const FLOAT4 = 'pg/float4@1' as const;
13
+ const INT4 = 'pg/int4@1' as const;
14
+
15
+ export function paradedbQueryOperations<CT extends CodecTypesBase>(): QueryOperationTypes<CT> {
16
+ return {
17
+ // `@@@` accepts both text and structured query types on its RHS.
18
+ // https://docs.paradedb.com/documentation/full-text/match
19
+ paradeDbMatch: {
20
+ self: { codecId: TEXT },
21
+ impl: (self, query) =>
22
+ buildOperation({
23
+ method: 'paradeDbMatch',
24
+ args: [toExpr(self, TEXT), toExpr(query, TEXT)],
25
+ returns: { codecId: BOOL, nullable: false },
26
+ lowering: {
27
+ targetFamily: 'sql',
28
+ strategy: 'function',
29
+ template: '{{self}} @@@ {{arg0}}',
30
+ },
31
+ }),
32
+ },
33
+ paradeDbMatchAny: {
34
+ self: { codecId: TEXT },
35
+ impl: (self, query) =>
36
+ buildOperation({
37
+ method: 'paradeDbMatchAny',
38
+ args: [toExpr(self, TEXT), toExpr(query, TEXT)],
39
+ returns: { codecId: BOOL, nullable: false },
40
+ lowering: {
41
+ targetFamily: 'sql',
42
+ strategy: 'function',
43
+ template: '{{self}} ||| {{arg0}}',
44
+ },
45
+ }),
46
+ },
47
+ paradeDbMatchAll: {
48
+ self: { codecId: TEXT },
49
+ impl: (self, query) =>
50
+ buildOperation({
51
+ method: 'paradeDbMatchAll',
52
+ args: [toExpr(self, TEXT), toExpr(query, TEXT)],
53
+ returns: { codecId: BOOL, nullable: false },
54
+ lowering: {
55
+ targetFamily: 'sql',
56
+ strategy: 'function',
57
+ template: '{{self}} &&& {{arg0}}',
58
+ },
59
+ }),
60
+ },
61
+ // https://docs.paradedb.com/documentation/full-text/term
62
+ paradeDbTerm: {
63
+ self: { codecId: TEXT },
64
+ impl: (self, query) =>
65
+ buildOperation({
66
+ method: 'paradeDbTerm',
67
+ args: [toExpr(self, TEXT), toExpr(query, TEXT)],
68
+ returns: { codecId: BOOL, nullable: false },
69
+ lowering: {
70
+ targetFamily: 'sql',
71
+ strategy: 'function',
72
+ template: '{{self}} === {{arg0}}',
73
+ },
74
+ }),
75
+ },
76
+ // https://docs.paradedb.com/documentation/full-text/phrase
77
+ paradeDbPhrase: {
78
+ self: { codecId: TEXT },
79
+ impl: (self, query) =>
80
+ buildOperation({
81
+ method: 'paradeDbPhrase',
82
+ args: [toExpr(self, TEXT), toExpr(query, TEXT)],
83
+ returns: { codecId: BOOL, nullable: false },
84
+ lowering: {
85
+ targetFamily: 'sql',
86
+ strategy: 'function',
87
+ template: '{{self}} ### {{arg0}}',
88
+ },
89
+ }),
90
+ },
91
+ // https://docs.paradedb.com/documentation/sorting/score
92
+ paradeDbScore: {
93
+ self: { codecId: INT4 },
94
+ impl: (self) =>
95
+ buildOperation({
96
+ method: 'paradeDbScore',
97
+ args: [toExpr(self, INT4)],
98
+ returns: { codecId: FLOAT4, nullable: false },
99
+ lowering: {
100
+ targetFamily: 'sql',
101
+ strategy: 'function',
102
+ template: 'pdb.score({{self}})',
103
+ },
104
+ }),
105
+ },
106
+ // PG rejects parameterized typmods, so the cast argument lowers to a literal.
107
+ // https://docs.paradedb.com/documentation/full-text/fuzzy
108
+ paradeDbFuzzy: {
109
+ self: { codecId: TEXT },
110
+ impl: (self, distance) => {
111
+ if (!Number.isInteger(distance) || distance < 0 || distance > 2) {
112
+ throw new Error(
113
+ `paradeDbFuzzy: distance must be an integer in [0, 2]; got ${String(distance)}`,
114
+ );
115
+ }
116
+ return buildOperation({
117
+ method: 'paradeDbFuzzy',
118
+ args: [toExpr(self, TEXT), LiteralExpr.of(distance)],
119
+ returns: { codecId: TEXT, nullable: false },
120
+ lowering: {
121
+ targetFamily: 'sql',
122
+ strategy: 'function',
123
+ template: '{{self}}::pdb.fuzzy({{arg0}})',
124
+ },
125
+ });
126
+ },
127
+ },
128
+ // https://docs.paradedb.com/documentation/sorting/boost
129
+ paradeDbBoost: {
130
+ self: { codecId: TEXT },
131
+ impl: (self, weight) => {
132
+ if (!Number.isInteger(weight) || weight < -2048 || weight > 2048) {
133
+ throw new Error(
134
+ `paradeDbBoost: boost must be an integer in [-2048, 2048]; got ${String(weight)}`,
135
+ );
136
+ }
137
+ return buildOperation({
138
+ method: 'paradeDbBoost',
139
+ args: [toExpr(self, TEXT), LiteralExpr.of(weight)],
140
+ returns: { codecId: TEXT, nullable: false },
141
+ lowering: {
142
+ targetFamily: 'sql',
143
+ strategy: 'function',
144
+ template: '{{self}}::pdb.boost({{arg0}})',
145
+ },
146
+ });
147
+ },
148
+ },
149
+ paradeDbConst: {
150
+ self: { codecId: TEXT },
151
+ impl: (self, value) => {
152
+ if (!Number.isInteger(value)) {
153
+ throw new Error(`paradeDbConst: value must be an integer; got ${String(value)}`);
154
+ }
155
+ return buildOperation({
156
+ method: 'paradeDbConst',
157
+ args: [toExpr(self, TEXT), LiteralExpr.of(value)],
158
+ returns: { codecId: TEXT, nullable: false },
159
+ lowering: {
160
+ targetFamily: 'sql',
161
+ strategy: 'function',
162
+ template: '{{self}}::pdb.const({{arg0}})',
163
+ },
164
+ });
165
+ },
166
+ },
167
+ paradeDbSlop: {
168
+ self: { codecId: TEXT },
169
+ impl: (self, slop) => {
170
+ if (!Number.isInteger(slop) || slop < 0) {
171
+ throw new Error(`paradeDbSlop: slop must be a non-negative integer; got ${String(slop)}`);
172
+ }
173
+ return buildOperation({
174
+ method: 'paradeDbSlop',
175
+ args: [toExpr(self, TEXT), LiteralExpr.of(slop)],
176
+ returns: { codecId: TEXT, nullable: false },
177
+ lowering: {
178
+ targetFamily: 'sql',
179
+ strategy: 'function',
180
+ template: '{{self}}::pdb.slop({{arg0}})',
181
+ },
182
+ });
183
+ },
184
+ },
185
+ // https://docs.paradedb.com/documentation/full-text/proximity
186
+ paradeDbProximity: {
187
+ self: { codecId: TEXT },
188
+ impl: (start) => new ParadeDbProximityChain(start),
189
+ },
190
+ };
191
+ }
2
192
 
3
193
  export const paradedbPackMeta = {
4
194
  kind: 'extension',
@@ -11,4 +201,14 @@ export const paradedbPackMeta = {
11
201
  'paradedb/bm25': true,
12
202
  },
13
203
  },
204
+ indexTypes: paradedbIndexTypes,
205
+ types: {
206
+ queryOperationTypes: {
207
+ import: {
208
+ package: '@prisma-next/extension-paradedb/operation-types',
209
+ named: 'QueryOperationTypes',
210
+ alias: 'ParadeDbQueryOperationTypes',
211
+ },
212
+ },
213
+ },
14
214
  } as const;
@@ -0,0 +1,83 @@
1
+ import {
2
+ type AnyExpression,
3
+ LiteralExpr,
4
+ OperationExpr,
5
+ } from '@prisma-next/sql-relational-core/ast';
6
+ import { type Expression, toExpr } from '@prisma-next/sql-relational-core/expression';
7
+
8
+ const TEXT = 'pg/text@1' as const;
9
+
10
+ export type ProximityTerm = unknown;
11
+
12
+ export interface ProximityWithinOptions {
13
+ readonly ordered?: boolean;
14
+ }
15
+
16
+ interface ProximityStep {
17
+ readonly distance: number;
18
+ readonly term: ProximityTerm;
19
+ readonly ordered: boolean;
20
+ }
21
+
22
+ // https://docs.paradedb.com/documentation/full-text/proximity
23
+ export class ParadeDbProximityChain
24
+ implements Expression<{ codecId: 'pg/text@1'; nullable: false }>
25
+ {
26
+ readonly returnType = { codecId: TEXT, nullable: false } as const;
27
+
28
+ private readonly start: ProximityTerm;
29
+ private readonly steps: readonly ProximityStep[];
30
+
31
+ constructor(start: ProximityTerm, steps: readonly ProximityStep[] = []) {
32
+ this.start = start;
33
+ this.steps = steps;
34
+ }
35
+
36
+ within(
37
+ distance: number,
38
+ term: ProximityTerm,
39
+ options?: ProximityWithinOptions,
40
+ ): ParadeDbProximityChain {
41
+ if (!Number.isInteger(distance) || distance < 0) {
42
+ throw new Error(
43
+ `paradeDbProximity.within: distance must be a non-negative integer; got ${String(distance)}`,
44
+ );
45
+ }
46
+ return new ParadeDbProximityChain(this.start, [
47
+ ...this.steps,
48
+ { distance, term, ordered: options?.ordered === true },
49
+ ]);
50
+ }
51
+
52
+ buildAst(): AnyExpression {
53
+ if (this.steps.length === 0) {
54
+ throw new Error(
55
+ 'paradeDbProximity: chain must have at least one .within(distance, term) step',
56
+ );
57
+ }
58
+ const args: AnyExpression[] = [toExpr(this.start, TEXT)];
59
+ let template = '({{self}}';
60
+ this.steps.forEach((step, i) => {
61
+ const op = step.ordered ? '##>' : '##';
62
+ args.push(LiteralExpr.of(step.distance));
63
+ args.push(toExpr(step.term, TEXT));
64
+ template += ` ${op} {{arg${2 * i}}} ${op} {{arg${2 * i + 1}}}`;
65
+ });
66
+ template += ')';
67
+ const [self, ...rest] = args;
68
+ if (!self) {
69
+ throw new Error('paradeDbProximity: invariant violation — empty args');
70
+ }
71
+ return new OperationExpr({
72
+ method: 'paradeDbProximity',
73
+ self,
74
+ args: rest.length > 0 ? rest : undefined,
75
+ returns: this.returnType,
76
+ lowering: {
77
+ targetFamily: 'sql',
78
+ strategy: 'function',
79
+ template,
80
+ },
81
+ });
82
+ }
83
+ }
@@ -1,3 +1,54 @@
1
- import { paradedbPackMeta } from '../core/descriptor-meta';
1
+ import type {
2
+ ComponentDatabaseDependencies,
3
+ SqlControlExtensionDescriptor,
4
+ } from '@prisma-next/family-sql/control';
5
+ import { paradedbPackMeta, paradedbQueryOperations } from '../core/descriptor-meta';
2
6
 
3
- export { paradedbPackMeta };
7
+ const paradedbDatabaseDependencies: ComponentDatabaseDependencies<unknown> = {
8
+ init: [
9
+ {
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
+ ],
39
+ },
40
+ ],
41
+ };
42
+
43
+ const paradedbExtensionDescriptor: SqlControlExtensionDescriptor<'postgres'> = {
44
+ ...paradedbPackMeta,
45
+ queryOperations: () => paradedbQueryOperations(),
46
+ databaseDependencies: paradedbDatabaseDependencies,
47
+ create: () => ({
48
+ familyId: 'sql' as const,
49
+ targetId: 'postgres' as const,
50
+ }),
51
+ };
52
+
53
+ export { paradedbExtensionDescriptor, paradedbPackMeta };
54
+ export default paradedbExtensionDescriptor;
@@ -1,12 +1,2 @@
1
- export type { TokenizerId } from '../core/constants';
2
- export type {
3
- Bm25ColumnFieldConfig,
4
- Bm25ExpressionFieldConfig,
5
- Bm25ExpressionFieldOptions,
6
- Bm25FieldConfig,
7
- Bm25IndexConfig,
8
- Bm25IndexOptions,
9
- Bm25JsonFieldOptions,
10
- Bm25TextFieldOptions,
11
- } from '../types/index-types';
12
- export { bm25, bm25Index } from '../types/index-types';
1
+ export type { Bm25IndexOptions, IndexTypes } from '../types/index-types';
2
+ export { paradedbIndexTypes } from '../types/index-types';
@@ -0,0 +1 @@
1
+ export type { QueryOperationTypes } from '../types/operation-types';
@@ -0,0 +1,20 @@
1
+ import type { SqlRuntimeExtensionDescriptor } from '@prisma-next/sql-runtime';
2
+ import { paradedbPackMeta, paradedbQueryOperations } from '../core/descriptor-meta';
3
+
4
+ const paradedbRuntimeDescriptor: SqlRuntimeExtensionDescriptor<'postgres'> = {
5
+ kind: 'extension' as const,
6
+ id: paradedbPackMeta.id,
7
+ version: paradedbPackMeta.version,
8
+ familyId: 'sql' as const,
9
+ targetId: 'postgres' as const,
10
+ codecs: () => [],
11
+ queryOperations: () => paradedbQueryOperations(),
12
+ create() {
13
+ return {
14
+ familyId: 'sql' as const,
15
+ targetId: 'postgres' as const,
16
+ };
17
+ },
18
+ };
19
+
20
+ export default paradedbRuntimeDescriptor;
@@ -1,179 +1,12 @@
1
- import type { IndexDef } from '@prisma-next/contract-authoring';
2
- import type { TokenizerId } from '../core/constants';
3
-
4
- /**
5
- * BM25 field config for a table column.
6
- */
7
- export type Bm25ColumnFieldConfig = {
8
- readonly column: string;
9
- readonly expression?: never;
10
- readonly tokenizer?: string;
11
- readonly tokenizerParams?: Record<string, unknown>;
12
- readonly alias?: string;
13
- };
14
-
15
- /**
16
- * BM25 field config for a SQL expression.
17
- */
18
- export type Bm25ExpressionFieldConfig = {
19
- readonly expression: string;
20
- readonly column?: never;
21
- readonly alias: string;
22
- readonly tokenizer?: string;
23
- readonly tokenizerParams?: Record<string, unknown>;
24
- };
25
-
26
- /**
27
- * BM25 field config union.
28
- */
29
- export type Bm25FieldConfig = Bm25ColumnFieldConfig | Bm25ExpressionFieldConfig;
30
-
31
- /**
32
- * BM25 index configuration payload stored in `IndexDef.config`.
33
- */
34
- export type Bm25IndexConfig = {
35
- readonly keyField: string;
36
- readonly fields: readonly Bm25FieldConfig[];
37
- };
38
-
39
- /**
40
- * Options for a BM25 text field (text, varchar columns).
41
- */
42
- export type Bm25TextFieldOptions = {
43
- readonly tokenizer?: TokenizerId | (string & {});
44
- readonly stemmer?: string;
45
- readonly alias?: string;
46
- readonly remove_emojis?: boolean;
47
- };
48
-
49
- /**
50
- * Options for a BM25 JSON field (json, jsonb columns).
51
- */
52
- export type Bm25JsonFieldOptions = {
53
- readonly tokenizer?: TokenizerId | (string & {});
54
- readonly alias?: string;
55
- /** Ngram-specific params when tokenizer is 'ngram'. */
56
- readonly min?: number;
57
- readonly max?: number;
58
- };
59
-
60
- /**
61
- * Options for a BM25 expression-based field.
62
- */
63
- export type Bm25ExpressionFieldOptions = {
64
- readonly alias: string;
65
- readonly tokenizer?: TokenizerId | (string & {});
66
- readonly min?: number;
67
- readonly max?: number;
68
- readonly stemmer?: string;
69
- readonly pattern?: string;
70
- };
71
-
72
- type TokenizerConfig = {
73
- readonly tokenizer?: string;
74
- readonly tokenizerParams?: Record<string, unknown>;
75
- };
76
-
77
- /**
78
- * Options for constructing a BM25 index definition.
79
- */
80
- export type Bm25IndexOptions = {
81
- readonly keyField: string;
82
- readonly fields: readonly Bm25FieldConfig[];
83
- readonly name?: string;
84
- };
85
-
86
- /**
87
- * Typed BM25 field builders.
88
- * These produce `Bm25FieldConfig` objects for use in `bm25Index()`.
89
- */
90
- export const bm25 = {
91
- /** Text field with optional tokenizer config. */
92
- text(column: string, opts?: Bm25TextFieldOptions): Bm25FieldConfig {
93
- return {
94
- column,
95
- ...buildTokenizerConfig(opts?.tokenizer, {
96
- stemmer: opts?.stemmer,
97
- remove_emojis: opts?.remove_emojis,
98
- }),
99
- ...(opts?.alias !== undefined && { alias: opts.alias }),
100
- };
101
- },
102
-
103
- /** Numeric field (filterable, sortable in BM25). */
104
- numeric(column: string): Bm25FieldConfig {
105
- return { column };
106
- },
107
-
108
- /** Boolean field. */
109
- boolean(column: string): Bm25FieldConfig {
110
- return { column };
111
- },
112
-
113
- /** JSON/JSONB field with optional tokenizer config. */
114
- json(column: string, opts?: Bm25JsonFieldOptions): Bm25FieldConfig {
115
- return {
116
- column,
117
- ...buildTokenizerConfig(opts?.tokenizer, { min: opts?.min, max: opts?.max }),
118
- ...(opts?.alias !== undefined && { alias: opts.alias }),
119
- };
120
- },
121
-
122
- /** Datetime (timestamp/date) field. */
123
- datetime(column: string): Bm25FieldConfig {
124
- return { column };
125
- },
126
-
127
- /** Range field. */
128
- range(column: string): Bm25FieldConfig {
129
- return { column };
130
- },
131
-
132
- /** Raw SQL expression field. `alias` is required. */
133
- expression(sql: string, opts: Bm25ExpressionFieldOptions): Bm25FieldConfig {
134
- return {
135
- expression: sql,
136
- alias: opts.alias,
137
- ...buildTokenizerConfig(opts.tokenizer, {
138
- min: opts.min,
139
- max: opts.max,
140
- stemmer: opts.stemmer,
141
- pattern: opts.pattern,
142
- }),
143
- };
144
- },
145
- } as const;
146
-
147
- /**
148
- * Creates a generic index definition with a ParadeDB BM25 payload.
149
- *
150
- * `columns` only includes real table columns so core index validation remains
151
- * target-agnostic. Expression fields stay in extension-owned `config.fields`.
152
- */
153
- export function bm25Index(opts: Bm25IndexOptions): IndexDef {
154
- return {
155
- columns: opts.fields.flatMap((field) => ('column' in field ? [field.column] : [])),
156
- ...(opts.name !== undefined && { name: opts.name }),
157
- using: 'bm25',
158
- config: {
159
- keyField: opts.keyField,
160
- fields: opts.fields,
161
- } satisfies Bm25IndexConfig,
162
- };
163
- }
164
-
165
- /**
166
- * Builds `{ tokenizer, tokenizerParams? }` from a tokenizer ID and a bag of params.
167
- * Filters out undefined values and omits `tokenizerParams` when empty.
168
- */
169
- function buildTokenizerConfig(
170
- tokenizer: string | undefined,
171
- params: Record<string, unknown>,
172
- ): TokenizerConfig {
173
- if (!tokenizer) return {};
174
- const filtered = Object.fromEntries(Object.entries(params).filter(([, v]) => v !== undefined));
175
- return {
176
- tokenizer,
177
- ...(Object.keys(filtered).length > 0 && { tokenizerParams: filtered }),
178
- };
179
- }
1
+ import { defineIndexTypes } from '@prisma-next/sql-contract/index-types';
2
+ import { type } from 'arktype';
3
+
4
+ export const paradedbIndexTypes = defineIndexTypes().add('bm25', {
5
+ options: type({
6
+ '+': 'reject',
7
+ key_field: 'string',
8
+ }),
9
+ });
10
+
11
+ export type IndexTypes = typeof paradedbIndexTypes.IndexTypes;
12
+ export type Bm25IndexOptions = IndexTypes['bm25']['options'];
@@ -0,0 +1,84 @@
1
+ import type { SqlQueryOperationTypes } from '@prisma-next/sql-contract/types';
2
+ import type { CodecExpression, Expression } from '@prisma-next/sql-relational-core/expression';
3
+ import type { ParadeDbProximityChain } from '../core/proximity-chain';
4
+
5
+ type CodecTypesBase = Record<string, { readonly input: unknown; readonly output: unknown }>;
6
+
7
+ export type QueryOperationTypes<CT extends CodecTypesBase> = SqlQueryOperationTypes<
8
+ CT,
9
+ {
10
+ readonly paradeDbMatch: {
11
+ readonly self: { readonly codecId: 'pg/text@1' };
12
+ readonly impl: (
13
+ self: CodecExpression<'pg/text@1', boolean, CT>,
14
+ query: CodecExpression<'pg/text@1', boolean, CT>,
15
+ ) => Expression<{ codecId: 'pg/bool@1'; nullable: false }>;
16
+ };
17
+ readonly paradeDbMatchAny: {
18
+ readonly self: { readonly codecId: 'pg/text@1' };
19
+ readonly impl: (
20
+ self: CodecExpression<'pg/text@1', boolean, CT>,
21
+ query: CodecExpression<'pg/text@1', boolean, CT>,
22
+ ) => Expression<{ codecId: 'pg/bool@1'; nullable: false }>;
23
+ };
24
+ readonly paradeDbMatchAll: {
25
+ readonly self: { readonly codecId: 'pg/text@1' };
26
+ readonly impl: (
27
+ self: CodecExpression<'pg/text@1', boolean, CT>,
28
+ query: CodecExpression<'pg/text@1', boolean, CT>,
29
+ ) => Expression<{ codecId: 'pg/bool@1'; nullable: false }>;
30
+ };
31
+ readonly paradeDbTerm: {
32
+ readonly self: { readonly codecId: 'pg/text@1' };
33
+ readonly impl: (
34
+ self: CodecExpression<'pg/text@1', boolean, CT>,
35
+ query: CodecExpression<'pg/text@1', boolean, CT>,
36
+ ) => Expression<{ codecId: 'pg/bool@1'; nullable: false }>;
37
+ };
38
+ readonly paradeDbPhrase: {
39
+ readonly self: { readonly codecId: 'pg/text@1' };
40
+ readonly impl: (
41
+ self: CodecExpression<'pg/text@1', boolean, CT>,
42
+ query: CodecExpression<'pg/text@1', boolean, CT>,
43
+ ) => Expression<{ codecId: 'pg/bool@1'; nullable: false }>;
44
+ };
45
+ readonly paradeDbScore: {
46
+ readonly self: { readonly codecId: 'pg/int4@1' };
47
+ readonly impl: (
48
+ self: CodecExpression<'pg/int4@1', boolean, CT>,
49
+ ) => Expression<{ codecId: 'pg/float4@1'; nullable: false }>;
50
+ };
51
+ readonly paradeDbFuzzy: {
52
+ readonly self: { readonly codecId: 'pg/text@1' };
53
+ readonly impl: (
54
+ self: CodecExpression<'pg/text@1', boolean, CT>,
55
+ distance: number,
56
+ ) => Expression<{ codecId: 'pg/text@1'; nullable: false }>;
57
+ };
58
+ readonly paradeDbBoost: {
59
+ readonly self: { readonly codecId: 'pg/text@1' };
60
+ readonly impl: (
61
+ self: CodecExpression<'pg/text@1', boolean, CT>,
62
+ weight: number,
63
+ ) => Expression<{ codecId: 'pg/text@1'; nullable: false }>;
64
+ };
65
+ readonly paradeDbConst: {
66
+ readonly self: { readonly codecId: 'pg/text@1' };
67
+ readonly impl: (
68
+ self: CodecExpression<'pg/text@1', boolean, CT>,
69
+ value: number,
70
+ ) => Expression<{ codecId: 'pg/text@1'; nullable: false }>;
71
+ };
72
+ readonly paradeDbSlop: {
73
+ readonly self: { readonly codecId: 'pg/text@1' };
74
+ readonly impl: (
75
+ self: CodecExpression<'pg/text@1', boolean, CT>,
76
+ slop: number,
77
+ ) => Expression<{ codecId: 'pg/text@1'; nullable: false }>;
78
+ };
79
+ readonly paradeDbProximity: {
80
+ readonly self: { readonly codecId: 'pg/text@1' };
81
+ readonly impl: (start: CodecExpression<'pg/text@1', boolean, CT>) => ParadeDbProximityChain;
82
+ };
83
+ }
84
+ >;
@@ -1,20 +0,0 @@
1
- //#region src/core/constants.ts
2
- /**
3
- * Extension ID for ParadeDB pg_search.
4
- */
5
- const PARADEDB_EXTENSION_ID = "paradedb";
6
-
7
- //#endregion
8
- //#region src/core/descriptor-meta.ts
9
- const paradedbPackMeta = {
10
- kind: "extension",
11
- id: PARADEDB_EXTENSION_ID,
12
- familyId: "sql",
13
- targetId: "postgres",
14
- version: "0.0.1",
15
- capabilities: { postgres: { "paradedb/bm25": true } }
16
- };
17
-
18
- //#endregion
19
- export { paradedbPackMeta as t };
20
- //# sourceMappingURL=descriptor-meta-BTFnIGJ6.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"descriptor-meta-BTFnIGJ6.mjs","names":[],"sources":["../src/core/constants.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 * Built-in ParadeDB tokenizer IDs.\n * These correspond to the `pdb.*` casting syntax in `CREATE INDEX ... USING bm25`.\n */\nexport type TokenizerId =\n | 'unicode_words'\n | 'simple'\n | 'ngram'\n | 'icu'\n | 'regex_pattern'\n | 'source_code'\n | 'literal'\n | 'literal_normalized'\n | 'whitespace'\n | 'chinese_compatible'\n | 'jieba'\n | 'lindera';\n","import { PARADEDB_EXTENSION_ID } from './constants';\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} as const;\n"],"mappings":";;;;AAGA,MAAa,wBAAwB;;;;ACDrC,MAAa,mBAAmB;CAC9B,MAAM;CACN,IAAI;CACJ,UAAU;CACV,UAAU;CACV,SAAS;CACT,cAAc,EACZ,UAAU,EACR,iBAAiB,MAClB,EACF;CACF"}