@prisma-next/extension-pgvector 0.3.0-pr.93.5 → 0.3.0-pr.94.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/dist/codec-types.d.mts +15 -0
- package/dist/codec-types.d.mts.map +1 -0
- package/dist/codec-types.mjs +1 -0
- package/dist/{exports/column-types.d.ts → column-types.d.mts} +7 -4
- package/dist/column-types.d.mts.map +1 -0
- package/dist/column-types.mjs +9 -0
- package/dist/column-types.mjs.map +1 -0
- package/dist/control.d.mts +12 -0
- package/dist/control.d.mts.map +1 -0
- package/dist/control.mjs +60 -0
- package/dist/control.mjs.map +1 -0
- package/dist/descriptor-meta-C1XaLvd_.mjs +57 -0
- package/dist/descriptor-meta-C1XaLvd_.mjs.map +1 -0
- package/dist/operation-types.d.mts +32 -0
- package/dist/operation-types.d.mts.map +1 -0
- package/dist/operation-types.mjs +1 -0
- package/dist/pack.d.mts +54 -0
- package/dist/pack.d.mts.map +1 -0
- package/dist/pack.mjs +9 -0
- package/dist/pack.mjs.map +1 -0
- package/dist/{exports/runtime.d.ts → runtime.d.mts} +7 -3
- package/dist/runtime.d.mts.map +1 -0
- package/dist/runtime.mjs +72 -0
- package/dist/runtime.mjs.map +1 -0
- package/package.json +30 -44
- package/dist/chunk-SHWLERB3.js +0 -60
- package/dist/chunk-SHWLERB3.js.map +0 -1
- package/dist/core/codecs.d.ts +0 -23
- package/dist/core/codecs.d.ts.map +0 -1
- package/dist/core/descriptor-meta.d.ts +0 -53
- package/dist/core/descriptor-meta.d.ts.map +0 -1
- package/dist/exports/codec-types.d.ts +0 -7
- package/dist/exports/codec-types.d.ts.map +0 -1
- package/dist/exports/codec-types.js +0 -1
- package/dist/exports/codec-types.js.map +0 -1
- package/dist/exports/column-types.d.ts.map +0 -1
- package/dist/exports/column-types.js +0 -9
- package/dist/exports/column-types.js.map +0 -1
- package/dist/exports/control.d.ts +0 -9
- package/dist/exports/control.d.ts.map +0 -1
- package/dist/exports/control.js +0 -67
- package/dist/exports/control.js.map +0 -1
- package/dist/exports/operation-types.d.ts +0 -7
- package/dist/exports/operation-types.d.ts.map +0 -1
- package/dist/exports/operation-types.js +0 -1
- package/dist/exports/operation-types.js.map +0 -1
- package/dist/exports/pack.d.ts +0 -52
- package/dist/exports/pack.d.ts.map +0 -1
- package/dist/exports/pack.js +0 -11
- package/dist/exports/pack.js.map +0 -1
- package/dist/exports/runtime.d.ts.map +0 -1
- package/dist/exports/runtime.js +0 -86
- package/dist/exports/runtime.js.map +0 -1
- package/dist/types/codec-types.d.ts +0 -10
- package/dist/types/codec-types.d.ts.map +0 -1
- package/dist/types/operation-types.d.ts +0 -31
- package/dist/types/operation-types.d.ts.map +0 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as _prisma_next_sql_relational_core_ast0 from "@prisma-next/sql-relational-core/ast";
|
|
2
|
+
|
|
3
|
+
//#region src/core/codecs.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Vector codec implementation for pgvector extension.
|
|
7
|
+
*
|
|
8
|
+
* Provides encoding/decoding for the `vector` PostgreSQL type.
|
|
9
|
+
* Wire format is a string like `[1,2,3]` (PostgreSQL vector text format).
|
|
10
|
+
*/
|
|
11
|
+
declare const codecs: _prisma_next_sql_relational_core_ast0.CodecDefBuilder<{} & Record<"vector", _prisma_next_sql_relational_core_ast0.Codec<"pg/vector@1", string, number[]>>>;
|
|
12
|
+
type CodecTypes = typeof codecs.CodecTypes;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { type CodecTypes };
|
|
15
|
+
//# sourceMappingURL=codec-types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codec-types.d.mts","names":[],"sources":["../src/core/codecs.ts"],"sourcesContent":[],"mappings":";;;;;;;AA0DY;;;cAAN,MAAM,EAAA,qCAAA,CAAA,eAAA,CAAA,CAAA,CAAA,GAAA,MAAA,CAAA,QAAA,EAA8C,qCAAA,CAA9C,KAAA,CAAA,aAAA,EAAA,MAAA,EAAA,MAAA,EAAA,CAAA,CAAA,CAAA;KAOA,UAAA,UAAoB,MAAA,CAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
//#region src/exports/column-types.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* Column type descriptors for pgvector extension.
|
|
3
4
|
*
|
|
4
5
|
* These descriptors provide both codecId and nativeType for use in contract authoring.
|
|
5
6
|
* They are derived from the same source of truth as codec definitions and manifests.
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
declare const vectorColumn: {
|
|
9
|
+
readonly codecId: "pg/vector@1";
|
|
10
|
+
readonly nativeType: "vector";
|
|
10
11
|
};
|
|
11
|
-
//#
|
|
12
|
+
//#endregion
|
|
13
|
+
export { vectorColumn };
|
|
14
|
+
//# sourceMappingURL=column-types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"column-types.d.mts","names":[],"sources":["../src/exports/column-types.ts"],"sourcesContent":[],"mappings":";;AASA;;;;;cAAa"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"column-types.mjs","names":[],"sources":["../src/exports/column-types.ts"],"sourcesContent":["/**\n * Column type descriptors for pgvector extension.\n *\n * These descriptors provide both codecId and nativeType for use in contract authoring.\n * They are derived from the same source of truth as codec definitions and manifests.\n */\n\nimport type { ColumnTypeDescriptor } from '@prisma-next/contract-authoring';\n\nexport const vectorColumn = {\n codecId: 'pg/vector@1',\n nativeType: 'vector',\n} as const satisfies ColumnTypeDescriptor;\n"],"mappings":";AASA,MAAa,eAAe;CAC1B,SAAS;CACT,YAAY;CACb"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SqlControlExtensionDescriptor } from "@prisma-next/family-sql/control";
|
|
2
|
+
|
|
3
|
+
//#region src/exports/control.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* pgvector extension descriptor for CLI config.
|
|
7
|
+
* Declares database dependencies for the 'vector' Postgres extension.
|
|
8
|
+
*/
|
|
9
|
+
declare const pgvectorExtensionDescriptor: SqlControlExtensionDescriptor<'postgres'>;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { pgvectorExtensionDescriptor as default, pgvectorExtensionDescriptor };
|
|
12
|
+
//# sourceMappingURL=control.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control.d.mts","names":[],"sources":["../src/exports/control.ts"],"sourcesContent":[],"mappings":";;;;;;AAIyC;;cAkEnC,6BAA6B"}
|
package/dist/control.mjs
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { t as pgvectorPackMeta } from "./descriptor-meta-C1XaLvd_.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/exports/control.ts
|
|
4
|
+
/**
|
|
5
|
+
* Pure verification hook: checks whether the 'vector' extension is installed
|
|
6
|
+
* based on the in-memory schema IR (no DB I/O).
|
|
7
|
+
*/
|
|
8
|
+
function verifyVectorExtensionInstalled(schema) {
|
|
9
|
+
if (!schema.extensions.includes("vector")) return [{
|
|
10
|
+
kind: "extension_missing",
|
|
11
|
+
table: "",
|
|
12
|
+
message: "Extension \"vector\" is missing from database (required by pgvector)"
|
|
13
|
+
}];
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Database dependencies for the pgvector extension.
|
|
18
|
+
* Declares the 'vector' Postgres extension as a required dependency.
|
|
19
|
+
*/
|
|
20
|
+
const pgvectorDatabaseDependencies = { init: [{
|
|
21
|
+
id: "postgres.extension.vector",
|
|
22
|
+
label: "Enable vector extension",
|
|
23
|
+
install: [{
|
|
24
|
+
id: "extension.vector",
|
|
25
|
+
label: "Enable extension \"vector\"",
|
|
26
|
+
summary: "Ensures the vector extension is available for pgvector operations",
|
|
27
|
+
operationClass: "additive",
|
|
28
|
+
target: { id: "postgres" },
|
|
29
|
+
precheck: [{
|
|
30
|
+
description: "verify extension \"vector\" is not already enabled",
|
|
31
|
+
sql: "SELECT NOT EXISTS (SELECT 1 FROM pg_extension WHERE extname = 'vector')"
|
|
32
|
+
}],
|
|
33
|
+
execute: [{
|
|
34
|
+
description: "create extension \"vector\"",
|
|
35
|
+
sql: "CREATE EXTENSION IF NOT EXISTS vector"
|
|
36
|
+
}],
|
|
37
|
+
postcheck: [{
|
|
38
|
+
description: "confirm extension \"vector\" is enabled",
|
|
39
|
+
sql: "SELECT EXISTS (SELECT 1 FROM pg_extension WHERE extname = 'vector')"
|
|
40
|
+
}]
|
|
41
|
+
}],
|
|
42
|
+
verifyDatabaseDependencyInstalled: verifyVectorExtensionInstalled
|
|
43
|
+
}] };
|
|
44
|
+
/**
|
|
45
|
+
* pgvector extension descriptor for CLI config.
|
|
46
|
+
* Declares database dependencies for the 'vector' Postgres extension.
|
|
47
|
+
*/
|
|
48
|
+
const pgvectorExtensionDescriptor = {
|
|
49
|
+
...pgvectorPackMeta,
|
|
50
|
+
databaseDependencies: pgvectorDatabaseDependencies,
|
|
51
|
+
create: () => ({
|
|
52
|
+
familyId: "sql",
|
|
53
|
+
targetId: "postgres"
|
|
54
|
+
})
|
|
55
|
+
};
|
|
56
|
+
var control_default = pgvectorExtensionDescriptor;
|
|
57
|
+
|
|
58
|
+
//#endregion
|
|
59
|
+
export { control_default as default, pgvectorExtensionDescriptor };
|
|
60
|
+
//# sourceMappingURL=control.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control.mjs","names":["pgvectorDatabaseDependencies: ComponentDatabaseDependencies<unknown>","pgvectorExtensionDescriptor: SqlControlExtensionDescriptor<'postgres'>"],"sources":["../src/exports/control.ts"],"sourcesContent":["import type { SchemaIssue } from '@prisma-next/core-control-plane/types';\nimport type {\n ComponentDatabaseDependencies,\n SqlControlExtensionDescriptor,\n} from '@prisma-next/family-sql/control';\nimport type { SqlSchemaIR } from '@prisma-next/sql-schema-ir/types';\nimport { pgvectorPackMeta } from '../core/descriptor-meta';\n\n/**\n * Pure verification hook: checks whether the 'vector' extension is installed\n * based on the in-memory schema IR (no DB I/O).\n */\nfunction verifyVectorExtensionInstalled(schema: SqlSchemaIR): readonly SchemaIssue[] {\n if (!schema.extensions.includes('vector')) {\n return [\n {\n kind: 'extension_missing',\n table: '',\n message: 'Extension \"vector\" is missing from database (required by pgvector)',\n },\n ];\n }\n return [];\n}\n\n/**\n * Database dependencies for the pgvector extension.\n * Declares the 'vector' Postgres extension as a required dependency.\n */\nconst pgvectorDatabaseDependencies: ComponentDatabaseDependencies<unknown> = {\n init: [\n {\n id: 'postgres.extension.vector',\n label: 'Enable vector extension',\n install: [\n {\n id: 'extension.vector',\n label: 'Enable extension \"vector\"',\n summary: 'Ensures the vector extension is available for pgvector operations',\n operationClass: 'additive',\n target: { id: 'postgres' },\n precheck: [\n {\n description: 'verify extension \"vector\" is not already enabled',\n sql: \"SELECT NOT EXISTS (SELECT 1 FROM pg_extension WHERE extname = 'vector')\",\n },\n ],\n execute: [\n {\n description: 'create extension \"vector\"',\n sql: 'CREATE EXTENSION IF NOT EXISTS vector',\n },\n ],\n postcheck: [\n {\n description: 'confirm extension \"vector\" is enabled',\n sql: \"SELECT EXISTS (SELECT 1 FROM pg_extension WHERE extname = 'vector')\",\n },\n ],\n },\n ],\n verifyDatabaseDependencyInstalled: verifyVectorExtensionInstalled,\n },\n ],\n};\n\n/**\n * pgvector extension descriptor for CLI config.\n * Declares database dependencies for the 'vector' Postgres extension.\n */\nconst pgvectorExtensionDescriptor: SqlControlExtensionDescriptor<'postgres'> = {\n ...pgvectorPackMeta,\n databaseDependencies: pgvectorDatabaseDependencies,\n create: () => ({\n familyId: 'sql' as const,\n targetId: 'postgres' as const,\n }),\n};\n\nexport { pgvectorExtensionDescriptor };\nexport default pgvectorExtensionDescriptor;\n"],"mappings":";;;;;;;AAYA,SAAS,+BAA+B,QAA6C;AACnF,KAAI,CAAC,OAAO,WAAW,SAAS,SAAS,CACvC,QAAO,CACL;EACE,MAAM;EACN,OAAO;EACP,SAAS;EACV,CACF;AAEH,QAAO,EAAE;;;;;;AAOX,MAAMA,+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;CACD,mCAAmC;CACpC,CACF,EACF;;;;;AAMD,MAAMC,8BAAyE;CAC7E,GAAG;CACH,sBAAsB;CACtB,eAAe;EACb,UAAU;EACV,UAAU;EACX;CACF;AAGD,sBAAe"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
//#region src/core/descriptor-meta.ts
|
|
2
|
+
const pgvectorTypeId = "pg/vector@1";
|
|
3
|
+
/**
|
|
4
|
+
* Shared operation definition used by both pack metadata and runtime descriptor.
|
|
5
|
+
* Frozen to prevent accidental mutation.
|
|
6
|
+
*/
|
|
7
|
+
const cosineDistanceOperation = Object.freeze({
|
|
8
|
+
method: "cosineDistance",
|
|
9
|
+
args: [{ kind: "param" }],
|
|
10
|
+
returns: {
|
|
11
|
+
kind: "builtin",
|
|
12
|
+
type: "number"
|
|
13
|
+
},
|
|
14
|
+
lowering: {
|
|
15
|
+
targetFamily: "sql",
|
|
16
|
+
strategy: "function",
|
|
17
|
+
template: "1 - ({{self}} <=> {{arg0}})"
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
const pgvectorPackMeta = {
|
|
21
|
+
kind: "extension",
|
|
22
|
+
id: "pgvector",
|
|
23
|
+
familyId: "sql",
|
|
24
|
+
targetId: "postgres",
|
|
25
|
+
version: "0.0.1",
|
|
26
|
+
capabilities: { postgres: { "pgvector/cosine": true } },
|
|
27
|
+
types: {
|
|
28
|
+
codecTypes: { import: {
|
|
29
|
+
package: "@prisma-next/extension-pgvector/codec-types",
|
|
30
|
+
named: "CodecTypes",
|
|
31
|
+
alias: "PgVectorTypes"
|
|
32
|
+
} },
|
|
33
|
+
operationTypes: { import: {
|
|
34
|
+
package: "@prisma-next/extension-pgvector/operation-types",
|
|
35
|
+
named: "OperationTypes",
|
|
36
|
+
alias: "PgVectorOperationTypes"
|
|
37
|
+
} },
|
|
38
|
+
storage: [{
|
|
39
|
+
typeId: pgvectorTypeId,
|
|
40
|
+
familyId: "sql",
|
|
41
|
+
targetId: "postgres",
|
|
42
|
+
nativeType: "vector"
|
|
43
|
+
}]
|
|
44
|
+
},
|
|
45
|
+
operations: [{
|
|
46
|
+
for: pgvectorTypeId,
|
|
47
|
+
...cosineDistanceOperation
|
|
48
|
+
}]
|
|
49
|
+
};
|
|
50
|
+
const pgvectorRuntimeOperation = {
|
|
51
|
+
forTypeId: pgvectorTypeId,
|
|
52
|
+
...cosineDistanceOperation
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
//#endregion
|
|
56
|
+
export { pgvectorRuntimeOperation as n, pgvectorPackMeta as t };
|
|
57
|
+
//# sourceMappingURL=descriptor-meta-C1XaLvd_.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptor-meta-C1XaLvd_.mjs","names":["pgvectorRuntimeOperation: SqlOperationSignature"],"sources":["../src/core/descriptor-meta.ts"],"sourcesContent":["import type { ExtensionPackRef } from '@prisma-next/contract/framework-components';\nimport type { SqlOperationSignature } from '@prisma-next/sql-operations';\n\nconst pgvectorTypeId = 'pg/vector@1' as const;\n\nconst cosineLowering = {\n targetFamily: 'sql',\n strategy: 'function',\n template: '1 - ({{self}} <=> {{arg0}})',\n} as const;\n\n/**\n * Shared operation definition used by both pack metadata and runtime descriptor.\n * Frozen to prevent accidental mutation.\n */\nconst cosineDistanceOperation = Object.freeze({\n method: 'cosineDistance',\n args: [{ kind: 'param' }],\n returns: { kind: 'builtin', type: 'number' },\n lowering: cosineLowering,\n} as const);\n\nexport const pgvectorPackMeta = {\n kind: 'extension',\n id: 'pgvector',\n familyId: 'sql',\n targetId: 'postgres',\n version: '0.0.1',\n capabilities: {\n postgres: {\n 'pgvector/cosine': true,\n },\n },\n types: {\n codecTypes: {\n import: {\n package: '@prisma-next/extension-pgvector/codec-types',\n named: 'CodecTypes',\n alias: 'PgVectorTypes',\n },\n },\n operationTypes: {\n import: {\n package: '@prisma-next/extension-pgvector/operation-types',\n named: 'OperationTypes',\n alias: 'PgVectorOperationTypes',\n },\n },\n storage: [\n { typeId: pgvectorTypeId, familyId: 'sql', targetId: 'postgres', nativeType: 'vector' },\n ],\n },\n operations: [\n {\n for: pgvectorTypeId,\n ...cosineDistanceOperation,\n },\n ],\n} as const satisfies ExtensionPackRef<'sql', 'postgres'>;\n\nexport const pgvectorRuntimeOperation: SqlOperationSignature = {\n forTypeId: pgvectorTypeId,\n ...cosineDistanceOperation,\n};\n"],"mappings":";AAGA,MAAM,iBAAiB;;;;;AAYvB,MAAM,0BAA0B,OAAO,OAAO;CAC5C,QAAQ;CACR,MAAM,CAAC,EAAE,MAAM,SAAS,CAAC;CACzB,SAAS;EAAE,MAAM;EAAW,MAAM;EAAU;CAC5C,UAdqB;EACrB,cAAc;EACd,UAAU;EACV,UAAU;EACX;CAWA,CAAU;AAEX,MAAa,mBAAmB;CAC9B,MAAM;CACN,IAAI;CACJ,UAAU;CACV,UAAU;CACV,SAAS;CACT,cAAc,EACZ,UAAU,EACR,mBAAmB,MACpB,EACF;CACD,OAAO;EACL,YAAY,EACV,QAAQ;GACN,SAAS;GACT,OAAO;GACP,OAAO;GACR,EACF;EACD,gBAAgB,EACd,QAAQ;GACN,SAAS;GACT,OAAO;GACP,OAAO;GACR,EACF;EACD,SAAS,CACP;GAAE,QAAQ;GAAgB,UAAU;GAAO,UAAU;GAAY,YAAY;GAAU,CACxF;EACF;CACD,YAAY,CACV;EACE,KAAK;EACL,GAAG;EACJ,CACF;CACF;AAED,MAAaA,2BAAkD;CAC7D,WAAW;CACX,GAAG;CACJ"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/types/operation-types.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Operation type definitions for pgvector extension.
|
|
4
|
+
*
|
|
5
|
+
* This file exports type-only definitions for operation method signatures.
|
|
6
|
+
* These types are imported by contract.d.ts files for compile-time type inference.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Operation types for pgvector extension.
|
|
10
|
+
* Maps typeId to operation methods.
|
|
11
|
+
*/
|
|
12
|
+
type OperationTypes = {
|
|
13
|
+
readonly 'pg/vector@1': {
|
|
14
|
+
readonly cosineDistance: {
|
|
15
|
+
readonly args: readonly [{
|
|
16
|
+
readonly kind: 'param';
|
|
17
|
+
}];
|
|
18
|
+
readonly returns: {
|
|
19
|
+
readonly kind: 'builtin';
|
|
20
|
+
readonly type: 'number';
|
|
21
|
+
};
|
|
22
|
+
readonly lowering: {
|
|
23
|
+
readonly targetFamily: 'sql';
|
|
24
|
+
readonly strategy: 'function';
|
|
25
|
+
readonly template: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
export { type OperationTypes };
|
|
32
|
+
//# sourceMappingURL=operation-types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation-types.d.mts","names":[],"sources":["../src/types/operation-types.ts"],"sourcesContent":[],"mappings":";;AAWA;;;;;;;;;KAAY,cAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/pack.d.mts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
//#region src/exports/pack.d.ts
|
|
2
|
+
declare const pgvectorPack: {
|
|
3
|
+
readonly kind: "extension";
|
|
4
|
+
readonly id: "pgvector";
|
|
5
|
+
readonly familyId: "sql";
|
|
6
|
+
readonly targetId: "postgres";
|
|
7
|
+
readonly version: "0.0.1";
|
|
8
|
+
readonly capabilities: {
|
|
9
|
+
readonly postgres: {
|
|
10
|
+
readonly 'pgvector/cosine': true;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
readonly types: {
|
|
14
|
+
readonly codecTypes: {
|
|
15
|
+
readonly import: {
|
|
16
|
+
readonly package: "@prisma-next/extension-pgvector/codec-types";
|
|
17
|
+
readonly named: "CodecTypes";
|
|
18
|
+
readonly alias: "PgVectorTypes";
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
readonly operationTypes: {
|
|
22
|
+
readonly import: {
|
|
23
|
+
readonly package: "@prisma-next/extension-pgvector/operation-types";
|
|
24
|
+
readonly named: "OperationTypes";
|
|
25
|
+
readonly alias: "PgVectorOperationTypes";
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
readonly storage: readonly [{
|
|
29
|
+
readonly typeId: "pg/vector@1";
|
|
30
|
+
readonly familyId: "sql";
|
|
31
|
+
readonly targetId: "postgres";
|
|
32
|
+
readonly nativeType: "vector";
|
|
33
|
+
}];
|
|
34
|
+
};
|
|
35
|
+
readonly operations: readonly [{
|
|
36
|
+
readonly method: "cosineDistance";
|
|
37
|
+
readonly args: readonly [{
|
|
38
|
+
readonly kind: "param";
|
|
39
|
+
}];
|
|
40
|
+
readonly returns: {
|
|
41
|
+
readonly kind: "builtin";
|
|
42
|
+
readonly type: "number";
|
|
43
|
+
};
|
|
44
|
+
readonly lowering: {
|
|
45
|
+
readonly targetFamily: "sql";
|
|
46
|
+
readonly strategy: "function";
|
|
47
|
+
readonly template: "1 - ({{self}} <=> {{arg0}})";
|
|
48
|
+
};
|
|
49
|
+
readonly for: "pg/vector@1";
|
|
50
|
+
}];
|
|
51
|
+
};
|
|
52
|
+
//#endregion
|
|
53
|
+
export { pgvectorPack as default };
|
|
54
|
+
//# sourceMappingURL=pack.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pack.d.mts","names":[],"sources":["../src/exports/pack.ts"],"sourcesContent":[],"mappings":";cAEM;EAAA,SAAA,IAAA,EAA+B,WAAA"}
|
package/dist/pack.mjs
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { t as pgvectorPackMeta } from "./descriptor-meta-C1XaLvd_.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/exports/pack.ts
|
|
4
|
+
const pgvectorPack = pgvectorPackMeta;
|
|
5
|
+
var pack_default = pgvectorPack;
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
export { pack_default as default };
|
|
9
|
+
//# sourceMappingURL=pack.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pack.mjs","names":[],"sources":["../src/exports/pack.ts"],"sourcesContent":["import { pgvectorPackMeta } from '../core/descriptor-meta';\n\nconst pgvectorPack = pgvectorPackMeta;\n\nexport default pgvectorPack;\n"],"mappings":";;;AAEA,MAAM,eAAe;AAErB,mBAAe"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { SqlRuntimeExtensionDescriptor } from "@prisma-next/sql-runtime";
|
|
2
|
+
|
|
3
|
+
//#region src/exports/runtime.d.ts
|
|
4
|
+
|
|
2
5
|
/**
|
|
3
6
|
* pgvector SQL runtime extension descriptor.
|
|
4
7
|
* Provides metadata and factory for creating runtime extension instances.
|
|
5
8
|
*/
|
|
6
9
|
declare const pgvectorRuntimeDescriptor: SqlRuntimeExtensionDescriptor<'postgres'>;
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
//#endregion
|
|
11
|
+
export { pgvectorRuntimeDescriptor as default };
|
|
12
|
+
//# sourceMappingURL=runtime.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.mts","names":[],"sources":["../src/exports/runtime.ts"],"sourcesContent":[],"mappings":";;;;;;AAMkC;;cA8B5B,2BAA2B"}
|
package/dist/runtime.mjs
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { n as pgvectorRuntimeOperation, t as pgvectorPackMeta } from "./descriptor-meta-C1XaLvd_.mjs";
|
|
2
|
+
import { codec, createCodecRegistry, defineCodecs } from "@prisma-next/sql-relational-core/ast";
|
|
3
|
+
|
|
4
|
+
//#region src/core/codecs.ts
|
|
5
|
+
/**
|
|
6
|
+
* Vector codec implementation for pgvector extension.
|
|
7
|
+
*
|
|
8
|
+
* Provides encoding/decoding for the `vector` PostgreSQL type.
|
|
9
|
+
* Wire format is a string like `[1,2,3]` (PostgreSQL vector text format).
|
|
10
|
+
*/
|
|
11
|
+
const pgVectorCodec = codec({
|
|
12
|
+
typeId: "pg/vector@1",
|
|
13
|
+
targetTypes: ["vector"],
|
|
14
|
+
encode: (value) => {
|
|
15
|
+
if (!Array.isArray(value)) throw new Error("Vector value must be an array of numbers");
|
|
16
|
+
if (!value.every((v) => typeof v === "number")) throw new Error("Vector value must contain only numbers");
|
|
17
|
+
return `[${value.join(",")}]`;
|
|
18
|
+
},
|
|
19
|
+
decode: (wire) => {
|
|
20
|
+
if (typeof wire !== "string") throw new Error("Vector wire value must be a string");
|
|
21
|
+
if (!wire.startsWith("[") || !wire.endsWith("]")) throw new Error(`Invalid vector format: expected "[...]", got "${wire}"`);
|
|
22
|
+
const content = wire.slice(1, -1).trim();
|
|
23
|
+
if (content === "") return [];
|
|
24
|
+
return content.split(",").map((v) => {
|
|
25
|
+
const num = Number.parseFloat(v.trim());
|
|
26
|
+
if (Number.isNaN(num)) throw new Error(`Invalid vector value: "${v}" is not a number`);
|
|
27
|
+
return num;
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
meta: { db: { sql: { postgres: { nativeType: "vector" } } } }
|
|
31
|
+
});
|
|
32
|
+
const codecs = defineCodecs().add("vector", pgVectorCodec);
|
|
33
|
+
const codecDefinitions = codecs.codecDefinitions;
|
|
34
|
+
const dataTypes = codecs.dataTypes;
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/exports/runtime.ts
|
|
38
|
+
/**
|
|
39
|
+
* pgvector SQL runtime extension instance.
|
|
40
|
+
* Provides codecs and operations for vector data type and similarity operations.
|
|
41
|
+
*/
|
|
42
|
+
var PgVectorRuntimeExtensionInstance = class {
|
|
43
|
+
familyId = "sql";
|
|
44
|
+
targetId = "postgres";
|
|
45
|
+
codecs() {
|
|
46
|
+
const registry = createCodecRegistry();
|
|
47
|
+
for (const def of Object.values(codecDefinitions)) registry.register(def.codec);
|
|
48
|
+
return registry;
|
|
49
|
+
}
|
|
50
|
+
operations() {
|
|
51
|
+
return [pgvectorRuntimeOperation];
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* pgvector SQL runtime extension descriptor.
|
|
56
|
+
* Provides metadata and factory for creating runtime extension instances.
|
|
57
|
+
*/
|
|
58
|
+
const pgvectorRuntimeDescriptor = {
|
|
59
|
+
kind: "extension",
|
|
60
|
+
id: pgvectorPackMeta.id,
|
|
61
|
+
version: pgvectorPackMeta.version,
|
|
62
|
+
familyId: "sql",
|
|
63
|
+
targetId: "postgres",
|
|
64
|
+
create() {
|
|
65
|
+
return new PgVectorRuntimeExtensionInstance();
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
var runtime_default = pgvectorRuntimeDescriptor;
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
export { runtime_default as default };
|
|
72
|
+
//# sourceMappingURL=runtime.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.mjs","names":["pgvectorRuntimeDescriptor: SqlRuntimeExtensionDescriptor<'postgres'>"],"sources":["../src/core/codecs.ts","../src/exports/runtime.ts"],"sourcesContent":["/**\n * Vector codec implementation for pgvector extension.\n *\n * Provides encoding/decoding for the `vector` PostgreSQL type.\n * Wire format is a string like `[1,2,3]` (PostgreSQL vector text format).\n */\n\nimport { codec, defineCodecs } from '@prisma-next/sql-relational-core/ast';\n\nconst pgVectorCodec = codec<'pg/vector@1', string, number[]>({\n typeId: 'pg/vector@1',\n targetTypes: ['vector'],\n encode: (value: number[]): string => {\n // Validate that value is an array of numbers\n if (!Array.isArray(value)) {\n throw new Error('Vector value must be an array of numbers');\n }\n if (!value.every((v) => typeof v === 'number')) {\n throw new Error('Vector value must contain only numbers');\n }\n // Format as PostgreSQL vector text format: [1,2,3]\n // PostgreSQL's pg library requires the vector format string\n return `[${value.join(',')}]`;\n },\n decode: (wire: string): number[] => {\n // Handle string format from PostgreSQL: [1,2,3]\n if (typeof wire !== 'string') {\n throw new Error('Vector wire value must be a string');\n }\n // Parse PostgreSQL vector format: [1,2,3]\n if (!wire.startsWith('[') || !wire.endsWith(']')) {\n throw new Error(`Invalid vector format: expected \"[...]\", got \"${wire}\"`);\n }\n const content = wire.slice(1, -1).trim();\n if (content === '') {\n return [];\n }\n const values = content.split(',').map((v) => {\n const num = Number.parseFloat(v.trim());\n if (Number.isNaN(num)) {\n throw new Error(`Invalid vector value: \"${v}\" is not a number`);\n }\n return num;\n });\n return values;\n },\n meta: {\n db: {\n sql: {\n postgres: {\n nativeType: 'vector',\n },\n },\n },\n },\n});\n\n// Build codec definitions using the builder DSL\nconst codecs = defineCodecs().add('vector', pgVectorCodec);\n\n// Export derived structures directly from codecs builder\nexport const codecDefinitions = codecs.codecDefinitions;\nexport const dataTypes = codecs.dataTypes;\n\n// Export types derived from codecs builder\nexport type CodecTypes = typeof codecs.CodecTypes;\n","import type { SqlOperationSignature } from '@prisma-next/sql-operations';\nimport type { CodecRegistry } from '@prisma-next/sql-relational-core/ast';\nimport { createCodecRegistry } from '@prisma-next/sql-relational-core/ast';\nimport type {\n SqlRuntimeExtensionDescriptor,\n SqlRuntimeExtensionInstance,\n} from '@prisma-next/sql-runtime';\nimport { codecDefinitions } from '../core/codecs';\nimport { pgvectorPackMeta, pgvectorRuntimeOperation } from '../core/descriptor-meta';\n\n/**\n * pgvector SQL runtime extension instance.\n * Provides codecs and operations for vector data type and similarity operations.\n */\nclass PgVectorRuntimeExtensionInstance implements SqlRuntimeExtensionInstance<'postgres'> {\n readonly familyId = 'sql' as const;\n readonly targetId = 'postgres' as const;\n\n codecs(): CodecRegistry {\n const registry = createCodecRegistry();\n // Register all codecs from codecDefinitions\n for (const def of Object.values(codecDefinitions)) {\n registry.register(def.codec);\n }\n return registry;\n }\n\n operations(): ReadonlyArray<SqlOperationSignature> {\n return [pgvectorRuntimeOperation];\n }\n}\n\n/**\n * pgvector SQL runtime extension descriptor.\n * Provides metadata and factory for creating runtime extension instances.\n */\nconst pgvectorRuntimeDescriptor: SqlRuntimeExtensionDescriptor<'postgres'> = {\n kind: 'extension' as const,\n id: pgvectorPackMeta.id,\n version: pgvectorPackMeta.version,\n familyId: 'sql' as const,\n targetId: 'postgres' as const,\n create(): SqlRuntimeExtensionInstance<'postgres'> {\n return new PgVectorRuntimeExtensionInstance();\n },\n};\n\nexport default pgvectorRuntimeDescriptor;\n"],"mappings":";;;;;;;;;;AASA,MAAM,gBAAgB,MAAuC;CAC3D,QAAQ;CACR,aAAa,CAAC,SAAS;CACvB,SAAS,UAA4B;AAEnC,MAAI,CAAC,MAAM,QAAQ,MAAM,CACvB,OAAM,IAAI,MAAM,2CAA2C;AAE7D,MAAI,CAAC,MAAM,OAAO,MAAM,OAAO,MAAM,SAAS,CAC5C,OAAM,IAAI,MAAM,yCAAyC;AAI3D,SAAO,IAAI,MAAM,KAAK,IAAI,CAAC;;CAE7B,SAAS,SAA2B;AAElC,MAAI,OAAO,SAAS,SAClB,OAAM,IAAI,MAAM,qCAAqC;AAGvD,MAAI,CAAC,KAAK,WAAW,IAAI,IAAI,CAAC,KAAK,SAAS,IAAI,CAC9C,OAAM,IAAI,MAAM,iDAAiD,KAAK,GAAG;EAE3E,MAAM,UAAU,KAAK,MAAM,GAAG,GAAG,CAAC,MAAM;AACxC,MAAI,YAAY,GACd,QAAO,EAAE;AASX,SAPe,QAAQ,MAAM,IAAI,CAAC,KAAK,MAAM;GAC3C,MAAM,MAAM,OAAO,WAAW,EAAE,MAAM,CAAC;AACvC,OAAI,OAAO,MAAM,IAAI,CACnB,OAAM,IAAI,MAAM,0BAA0B,EAAE,mBAAmB;AAEjE,UAAO;IACP;;CAGJ,MAAM,EACJ,IAAI,EACF,KAAK,EACH,UAAU,EACR,YAAY,UACb,EACF,EACF,EACF;CACF,CAAC;AAGF,MAAM,SAAS,cAAc,CAAC,IAAI,UAAU,cAAc;AAG1D,MAAa,mBAAmB,OAAO;AACvC,MAAa,YAAY,OAAO;;;;;;;;AChDhC,IAAM,mCAAN,MAA0F;CACxF,AAAS,WAAW;CACpB,AAAS,WAAW;CAEpB,SAAwB;EACtB,MAAM,WAAW,qBAAqB;AAEtC,OAAK,MAAM,OAAO,OAAO,OAAO,iBAAiB,CAC/C,UAAS,SAAS,IAAI,MAAM;AAE9B,SAAO;;CAGT,aAAmD;AACjD,SAAO,CAAC,yBAAyB;;;;;;;AAQrC,MAAMA,4BAAuE;CAC3E,MAAM;CACN,IAAI,iBAAiB;CACrB,SAAS,iBAAiB;CAC1B,UAAU;CACV,UAAU;CACV,SAAkD;AAChD,SAAO,IAAI,kCAAkC;;CAEhD;AAED,sBAAe"}
|
package/package.json
CHANGED
|
@@ -1,65 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/extension-pgvector",
|
|
3
|
-
"version": "0.3.0-pr.
|
|
3
|
+
"version": "0.3.0-pr.94.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"arktype": "^2.0.0",
|
|
8
|
-
"@prisma-next/cli": "0.3.0-pr.
|
|
9
|
-
"@prisma-next/contract": "0.3.0-pr.
|
|
10
|
-
"@prisma-next/contract-authoring": "0.3.0-pr.
|
|
11
|
-
"@prisma-next/
|
|
12
|
-
"@prisma-next/sql-operations": "0.3.0-pr.
|
|
13
|
-
"@prisma-next/
|
|
14
|
-
"@prisma-next/
|
|
15
|
-
"@prisma-next/sql-runtime": "0.3.0-pr.
|
|
16
|
-
"@prisma-next/sql-schema-ir": "0.3.0-pr.
|
|
8
|
+
"@prisma-next/cli": "0.3.0-pr.94.1",
|
|
9
|
+
"@prisma-next/contract": "0.3.0-pr.94.1",
|
|
10
|
+
"@prisma-next/contract-authoring": "0.3.0-pr.94.1",
|
|
11
|
+
"@prisma-next/family-sql": "0.3.0-pr.94.1",
|
|
12
|
+
"@prisma-next/sql-operations": "0.3.0-pr.94.1",
|
|
13
|
+
"@prisma-next/core-control-plane": "0.3.0-pr.94.1",
|
|
14
|
+
"@prisma-next/sql-relational-core": "0.3.0-pr.94.1",
|
|
15
|
+
"@prisma-next/sql-runtime": "0.3.0-pr.94.1",
|
|
16
|
+
"@prisma-next/sql-schema-ir": "0.3.0-pr.94.1"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"
|
|
19
|
+
"tsdown": "0.18.4",
|
|
20
20
|
"typescript": "5.9.3",
|
|
21
21
|
"vitest": "4.0.16",
|
|
22
|
-
"@prisma-next/adapter-postgres": "0.3.0-pr.
|
|
23
|
-
"@prisma-next/operations": "0.3.0-pr.
|
|
24
|
-
"@prisma-next/sql-contract": "0.3.0-pr.
|
|
25
|
-
"@prisma-next/sql-
|
|
26
|
-
"@prisma-next/sql-
|
|
27
|
-
"@prisma-next/
|
|
28
|
-
"@prisma-next/
|
|
22
|
+
"@prisma-next/adapter-postgres": "0.3.0-pr.94.1",
|
|
23
|
+
"@prisma-next/operations": "0.3.0-pr.94.1",
|
|
24
|
+
"@prisma-next/sql-contract": "0.3.0-pr.94.1",
|
|
25
|
+
"@prisma-next/sql-lane": "0.3.0-pr.94.1",
|
|
26
|
+
"@prisma-next/sql-contract-ts": "0.3.0-pr.94.1",
|
|
27
|
+
"@prisma-next/tsconfig": "0.0.0",
|
|
28
|
+
"@prisma-next/tsdown": "0.0.0",
|
|
29
|
+
"@prisma-next/test-utils": "0.0.1"
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=20"
|
|
29
33
|
},
|
|
30
34
|
"files": [
|
|
31
35
|
"dist",
|
|
32
36
|
"src"
|
|
33
37
|
],
|
|
34
38
|
"exports": {
|
|
35
|
-
"./
|
|
36
|
-
"./
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"./runtime":
|
|
41
|
-
|
|
42
|
-
"import": "./dist/exports/runtime.js"
|
|
43
|
-
},
|
|
44
|
-
"./pack": {
|
|
45
|
-
"types": "./dist/exports/pack.d.ts",
|
|
46
|
-
"import": "./dist/exports/pack.js"
|
|
47
|
-
},
|
|
48
|
-
"./codec-types": {
|
|
49
|
-
"types": "./dist/exports/codec-types.d.ts",
|
|
50
|
-
"import": "./dist/exports/codec-types.js"
|
|
51
|
-
},
|
|
52
|
-
"./column-types": {
|
|
53
|
-
"types": "./dist/exports/column-types.d.ts",
|
|
54
|
-
"import": "./dist/exports/column-types.js"
|
|
55
|
-
},
|
|
56
|
-
"./operation-types": {
|
|
57
|
-
"types": "./dist/exports/operation-types.d.ts",
|
|
58
|
-
"import": "./dist/exports/operation-types.js"
|
|
59
|
-
}
|
|
39
|
+
"./codec-types": "./dist/codec-types.mjs",
|
|
40
|
+
"./column-types": "./dist/column-types.mjs",
|
|
41
|
+
"./control": "./dist/control.mjs",
|
|
42
|
+
"./operation-types": "./dist/operation-types.mjs",
|
|
43
|
+
"./pack": "./dist/pack.mjs",
|
|
44
|
+
"./runtime": "./dist/runtime.mjs",
|
|
45
|
+
"./package.json": "./package.json"
|
|
60
46
|
},
|
|
61
47
|
"scripts": {
|
|
62
|
-
"build": "
|
|
48
|
+
"build": "tsdown",
|
|
63
49
|
"test": "vitest run",
|
|
64
50
|
"test:coverage": "vitest run --coverage",
|
|
65
51
|
"typecheck": "tsc --noEmit",
|
package/dist/chunk-SHWLERB3.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
// src/core/descriptor-meta.ts
|
|
2
|
-
var pgvectorTypeId = "pg/vector@1";
|
|
3
|
-
var cosineLowering = {
|
|
4
|
-
targetFamily: "sql",
|
|
5
|
-
strategy: "function",
|
|
6
|
-
template: "1 - ({{self}} <=> {{arg0}})"
|
|
7
|
-
};
|
|
8
|
-
var cosineDistanceOperation = Object.freeze({
|
|
9
|
-
method: "cosineDistance",
|
|
10
|
-
args: [{ kind: "param" }],
|
|
11
|
-
returns: { kind: "builtin", type: "number" },
|
|
12
|
-
lowering: cosineLowering
|
|
13
|
-
});
|
|
14
|
-
var pgvectorPackMeta = {
|
|
15
|
-
kind: "extension",
|
|
16
|
-
id: "pgvector",
|
|
17
|
-
familyId: "sql",
|
|
18
|
-
targetId: "postgres",
|
|
19
|
-
version: "0.0.1",
|
|
20
|
-
capabilities: {
|
|
21
|
-
postgres: {
|
|
22
|
-
"pgvector/cosine": true
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
types: {
|
|
26
|
-
codecTypes: {
|
|
27
|
-
import: {
|
|
28
|
-
package: "@prisma-next/extension-pgvector/codec-types",
|
|
29
|
-
named: "CodecTypes",
|
|
30
|
-
alias: "PgVectorTypes"
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
operationTypes: {
|
|
34
|
-
import: {
|
|
35
|
-
package: "@prisma-next/extension-pgvector/operation-types",
|
|
36
|
-
named: "OperationTypes",
|
|
37
|
-
alias: "PgVectorOperationTypes"
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
storage: [
|
|
41
|
-
{ typeId: pgvectorTypeId, familyId: "sql", targetId: "postgres", nativeType: "vector" }
|
|
42
|
-
]
|
|
43
|
-
},
|
|
44
|
-
operations: [
|
|
45
|
-
{
|
|
46
|
-
for: pgvectorTypeId,
|
|
47
|
-
...cosineDistanceOperation
|
|
48
|
-
}
|
|
49
|
-
]
|
|
50
|
-
};
|
|
51
|
-
var pgvectorRuntimeOperation = {
|
|
52
|
-
forTypeId: pgvectorTypeId,
|
|
53
|
-
...cosineDistanceOperation
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export {
|
|
57
|
-
pgvectorPackMeta,
|
|
58
|
-
pgvectorRuntimeOperation
|
|
59
|
-
};
|
|
60
|
-
//# sourceMappingURL=chunk-SHWLERB3.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/descriptor-meta.ts"],"sourcesContent":["import type { ExtensionPackRef } from '@prisma-next/contract/framework-components';\nimport type { SqlOperationSignature } from '@prisma-next/sql-operations';\n\nconst pgvectorTypeId = 'pg/vector@1' as const;\n\nconst cosineLowering = {\n targetFamily: 'sql',\n strategy: 'function',\n template: '1 - ({{self}} <=> {{arg0}})',\n} as const;\n\n/**\n * Shared operation definition used by both pack metadata and runtime descriptor.\n * Frozen to prevent accidental mutation.\n */\nconst cosineDistanceOperation = Object.freeze({\n method: 'cosineDistance',\n args: [{ kind: 'param' }],\n returns: { kind: 'builtin', type: 'number' },\n lowering: cosineLowering,\n} as const);\n\nexport const pgvectorPackMeta = {\n kind: 'extension',\n id: 'pgvector',\n familyId: 'sql',\n targetId: 'postgres',\n version: '0.0.1',\n capabilities: {\n postgres: {\n 'pgvector/cosine': true,\n },\n },\n types: {\n codecTypes: {\n import: {\n package: '@prisma-next/extension-pgvector/codec-types',\n named: 'CodecTypes',\n alias: 'PgVectorTypes',\n },\n },\n operationTypes: {\n import: {\n package: '@prisma-next/extension-pgvector/operation-types',\n named: 'OperationTypes',\n alias: 'PgVectorOperationTypes',\n },\n },\n storage: [\n { typeId: pgvectorTypeId, familyId: 'sql', targetId: 'postgres', nativeType: 'vector' },\n ],\n },\n operations: [\n {\n for: pgvectorTypeId,\n ...cosineDistanceOperation,\n },\n ],\n} as const satisfies ExtensionPackRef<'sql', 'postgres'>;\n\nexport const pgvectorRuntimeOperation: SqlOperationSignature = {\n forTypeId: pgvectorTypeId,\n ...cosineDistanceOperation,\n};\n"],"mappings":";AAGA,IAAM,iBAAiB;AAEvB,IAAM,iBAAiB;AAAA,EACrB,cAAc;AAAA,EACd,UAAU;AAAA,EACV,UAAU;AACZ;AAMA,IAAM,0BAA0B,OAAO,OAAO;AAAA,EAC5C,QAAQ;AAAA,EACR,MAAM,CAAC,EAAE,MAAM,QAAQ,CAAC;AAAA,EACxB,SAAS,EAAE,MAAM,WAAW,MAAM,SAAS;AAAA,EAC3C,UAAU;AACZ,CAAU;AAEH,IAAM,mBAAmB;AAAA,EAC9B,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,UAAU;AAAA,EACV,UAAU;AAAA,EACV,SAAS;AAAA,EACT,cAAc;AAAA,IACZ,UAAU;AAAA,MACR,mBAAmB;AAAA,IACrB;AAAA,EACF;AAAA,EACA,OAAO;AAAA,IACL,YAAY;AAAA,MACV,QAAQ;AAAA,QACN,SAAS;AAAA,QACT,OAAO;AAAA,QACP,OAAO;AAAA,MACT;AAAA,IACF;AAAA,IACA,gBAAgB;AAAA,MACd,QAAQ;AAAA,QACN,SAAS;AAAA,QACT,OAAO;AAAA,QACP,OAAO;AAAA,MACT;AAAA,IACF;AAAA,IACA,SAAS;AAAA,MACP,EAAE,QAAQ,gBAAgB,UAAU,OAAO,UAAU,YAAY,YAAY,SAAS;AAAA,IACxF;AAAA,EACF;AAAA,EACA,YAAY;AAAA,IACV;AAAA,MACE,KAAK;AAAA,MACL,GAAG;AAAA,IACL;AAAA,EACF;AACF;AAEO,IAAM,2BAAkD;AAAA,EAC7D,WAAW;AAAA,EACX,GAAG;AACL;","names":[]}
|
package/dist/core/codecs.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Vector codec implementation for pgvector extension.
|
|
3
|
-
*
|
|
4
|
-
* Provides encoding/decoding for the `vector` PostgreSQL type.
|
|
5
|
-
* Wire format is a string like `[1,2,3]` (PostgreSQL vector text format).
|
|
6
|
-
*/
|
|
7
|
-
declare const codecs: import("@prisma-next/sql-relational-core/ast").CodecDefBuilder<{} & Record<"vector", import("@prisma-next/sql-relational-core/ast").Codec<"pg/vector@1", string, number[]>>>;
|
|
8
|
-
export declare const codecDefinitions: {
|
|
9
|
-
readonly vector: {
|
|
10
|
-
readonly typeId: "pg/vector@1";
|
|
11
|
-
readonly scalar: "vector";
|
|
12
|
-
readonly codec: import("@prisma-next/sql-relational-core/ast").Codec<"pg/vector@1", string, number[]>;
|
|
13
|
-
readonly input: number[];
|
|
14
|
-
readonly output: number[];
|
|
15
|
-
readonly jsType: number[];
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
export declare const dataTypes: {
|
|
19
|
-
readonly vector: "pg/vector@1";
|
|
20
|
-
};
|
|
21
|
-
export type CodecTypes = typeof codecs.CodecTypes;
|
|
22
|
-
export {};
|
|
23
|
-
//# sourceMappingURL=codecs.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codecs.d.ts","sourceRoot":"","sources":["../../src/core/codecs.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAqDH,QAAA,MAAM,MAAM,8KAA8C,CAAC;AAG3D,eAAO,MAAM,gBAAgB;;;;;;;;;CAA0B,CAAC;AACxD,eAAO,MAAM,SAAS;;CAAmB,CAAC;AAG1C,MAAM,MAAM,UAAU,GAAG,OAAO,MAAM,CAAC,UAAU,CAAC"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { SqlOperationSignature } from '@prisma-next/sql-operations';
|
|
2
|
-
export declare const pgvectorPackMeta: {
|
|
3
|
-
readonly kind: "extension";
|
|
4
|
-
readonly id: "pgvector";
|
|
5
|
-
readonly familyId: "sql";
|
|
6
|
-
readonly targetId: "postgres";
|
|
7
|
-
readonly version: "0.0.1";
|
|
8
|
-
readonly capabilities: {
|
|
9
|
-
readonly postgres: {
|
|
10
|
-
readonly 'pgvector/cosine': true;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
readonly types: {
|
|
14
|
-
readonly codecTypes: {
|
|
15
|
-
readonly import: {
|
|
16
|
-
readonly package: "@prisma-next/extension-pgvector/codec-types";
|
|
17
|
-
readonly named: "CodecTypes";
|
|
18
|
-
readonly alias: "PgVectorTypes";
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
readonly operationTypes: {
|
|
22
|
-
readonly import: {
|
|
23
|
-
readonly package: "@prisma-next/extension-pgvector/operation-types";
|
|
24
|
-
readonly named: "OperationTypes";
|
|
25
|
-
readonly alias: "PgVectorOperationTypes";
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
readonly storage: readonly [{
|
|
29
|
-
readonly typeId: "pg/vector@1";
|
|
30
|
-
readonly familyId: "sql";
|
|
31
|
-
readonly targetId: "postgres";
|
|
32
|
-
readonly nativeType: "vector";
|
|
33
|
-
}];
|
|
34
|
-
};
|
|
35
|
-
readonly operations: readonly [{
|
|
36
|
-
readonly method: "cosineDistance";
|
|
37
|
-
readonly args: readonly [{
|
|
38
|
-
readonly kind: "param";
|
|
39
|
-
}];
|
|
40
|
-
readonly returns: {
|
|
41
|
-
readonly kind: "builtin";
|
|
42
|
-
readonly type: "number";
|
|
43
|
-
};
|
|
44
|
-
readonly lowering: {
|
|
45
|
-
readonly targetFamily: "sql";
|
|
46
|
-
readonly strategy: "function";
|
|
47
|
-
readonly template: "1 - ({{self}} <=> {{arg0}})";
|
|
48
|
-
};
|
|
49
|
-
readonly for: "pg/vector@1";
|
|
50
|
-
}];
|
|
51
|
-
};
|
|
52
|
-
export declare const pgvectorRuntimeOperation: SqlOperationSignature;
|
|
53
|
-
//# sourceMappingURL=descriptor-meta.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"descriptor-meta.d.ts","sourceRoot":"","sources":["../../src/core/descriptor-meta.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAqBzE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoC2B,CAAC;AAEzD,eAAO,MAAM,wBAAwB,EAAE,qBAGtC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codec-types.d.ts","sourceRoot":"","sources":["../../src/exports/codec-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=codec-types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"column-types.d.ts","sourceRoot":"","sources":["../../src/exports/column-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,eAAO,MAAM,YAAY;;;CAGgB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/exports/column-types.ts"],"sourcesContent":["/**\n * Column type descriptors for pgvector extension.\n *\n * These descriptors provide both codecId and nativeType for use in contract authoring.\n * They are derived from the same source of truth as codec definitions and manifests.\n */\n\nimport type { ColumnTypeDescriptor } from '@prisma-next/contract-authoring';\n\nexport const vectorColumn = {\n codecId: 'pg/vector@1',\n nativeType: 'vector',\n} as const satisfies ColumnTypeDescriptor;\n"],"mappings":";AASO,IAAM,eAAe;AAAA,EAC1B,SAAS;AAAA,EACT,YAAY;AACd;","names":[]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { SqlControlExtensionDescriptor } from '@prisma-next/family-sql/control';
|
|
2
|
-
/**
|
|
3
|
-
* pgvector extension descriptor for CLI config.
|
|
4
|
-
* Declares database dependencies for the 'vector' Postgres extension.
|
|
5
|
-
*/
|
|
6
|
-
declare const pgvectorExtensionDescriptor: SqlControlExtensionDescriptor<'postgres'>;
|
|
7
|
-
export { pgvectorExtensionDescriptor };
|
|
8
|
-
export default pgvectorExtensionDescriptor;
|
|
9
|
-
//# sourceMappingURL=control.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"control.d.ts","sourceRoot":"","sources":["../../src/exports/control.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,6BAA6B,EAC9B,MAAM,iCAAiC,CAAC;AA8DzC;;;GAGG;AACH,QAAA,MAAM,2BAA2B,EAAE,6BAA6B,CAAC,UAAU,CAO1E,CAAC;AAEF,OAAO,EAAE,2BAA2B,EAAE,CAAC;AACvC,eAAe,2BAA2B,CAAC"}
|
package/dist/exports/control.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
pgvectorPackMeta
|
|
3
|
-
} from "../chunk-SHWLERB3.js";
|
|
4
|
-
|
|
5
|
-
// src/exports/control.ts
|
|
6
|
-
function verifyVectorExtensionInstalled(schema) {
|
|
7
|
-
if (!schema.extensions.includes("vector")) {
|
|
8
|
-
return [
|
|
9
|
-
{
|
|
10
|
-
kind: "extension_missing",
|
|
11
|
-
table: "",
|
|
12
|
-
message: 'Extension "vector" is missing from database (required by pgvector)'
|
|
13
|
-
}
|
|
14
|
-
];
|
|
15
|
-
}
|
|
16
|
-
return [];
|
|
17
|
-
}
|
|
18
|
-
var pgvectorDatabaseDependencies = {
|
|
19
|
-
init: [
|
|
20
|
-
{
|
|
21
|
-
id: "postgres.extension.vector",
|
|
22
|
-
label: "Enable vector extension",
|
|
23
|
-
install: [
|
|
24
|
-
{
|
|
25
|
-
id: "extension.vector",
|
|
26
|
-
label: 'Enable extension "vector"',
|
|
27
|
-
summary: "Ensures the vector extension is available for pgvector operations",
|
|
28
|
-
operationClass: "additive",
|
|
29
|
-
target: { id: "postgres" },
|
|
30
|
-
precheck: [
|
|
31
|
-
{
|
|
32
|
-
description: 'verify extension "vector" is not already enabled',
|
|
33
|
-
sql: "SELECT NOT EXISTS (SELECT 1 FROM pg_extension WHERE extname = 'vector')"
|
|
34
|
-
}
|
|
35
|
-
],
|
|
36
|
-
execute: [
|
|
37
|
-
{
|
|
38
|
-
description: 'create extension "vector"',
|
|
39
|
-
sql: "CREATE EXTENSION IF NOT EXISTS vector"
|
|
40
|
-
}
|
|
41
|
-
],
|
|
42
|
-
postcheck: [
|
|
43
|
-
{
|
|
44
|
-
description: 'confirm extension "vector" is enabled',
|
|
45
|
-
sql: "SELECT EXISTS (SELECT 1 FROM pg_extension WHERE extname = 'vector')"
|
|
46
|
-
}
|
|
47
|
-
]
|
|
48
|
-
}
|
|
49
|
-
],
|
|
50
|
-
verifyDatabaseDependencyInstalled: verifyVectorExtensionInstalled
|
|
51
|
-
}
|
|
52
|
-
]
|
|
53
|
-
};
|
|
54
|
-
var pgvectorExtensionDescriptor = {
|
|
55
|
-
...pgvectorPackMeta,
|
|
56
|
-
databaseDependencies: pgvectorDatabaseDependencies,
|
|
57
|
-
create: () => ({
|
|
58
|
-
familyId: "sql",
|
|
59
|
-
targetId: "postgres"
|
|
60
|
-
})
|
|
61
|
-
};
|
|
62
|
-
var control_default = pgvectorExtensionDescriptor;
|
|
63
|
-
export {
|
|
64
|
-
control_default as default,
|
|
65
|
-
pgvectorExtensionDescriptor
|
|
66
|
-
};
|
|
67
|
-
//# sourceMappingURL=control.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/exports/control.ts"],"sourcesContent":["import type { SchemaIssue } from '@prisma-next/core-control-plane/types';\nimport type {\n ComponentDatabaseDependencies,\n SqlControlExtensionDescriptor,\n} from '@prisma-next/family-sql/control';\nimport type { SqlSchemaIR } from '@prisma-next/sql-schema-ir/types';\nimport { pgvectorPackMeta } from '../core/descriptor-meta';\n\n/**\n * Pure verification hook: checks whether the 'vector' extension is installed\n * based on the in-memory schema IR (no DB I/O).\n */\nfunction verifyVectorExtensionInstalled(schema: SqlSchemaIR): readonly SchemaIssue[] {\n if (!schema.extensions.includes('vector')) {\n return [\n {\n kind: 'extension_missing',\n table: '',\n message: 'Extension \"vector\" is missing from database (required by pgvector)',\n },\n ];\n }\n return [];\n}\n\n/**\n * Database dependencies for the pgvector extension.\n * Declares the 'vector' Postgres extension as a required dependency.\n */\nconst pgvectorDatabaseDependencies: ComponentDatabaseDependencies<unknown> = {\n init: [\n {\n id: 'postgres.extension.vector',\n label: 'Enable vector extension',\n install: [\n {\n id: 'extension.vector',\n label: 'Enable extension \"vector\"',\n summary: 'Ensures the vector extension is available for pgvector operations',\n operationClass: 'additive',\n target: { id: 'postgres' },\n precheck: [\n {\n description: 'verify extension \"vector\" is not already enabled',\n sql: \"SELECT NOT EXISTS (SELECT 1 FROM pg_extension WHERE extname = 'vector')\",\n },\n ],\n execute: [\n {\n description: 'create extension \"vector\"',\n sql: 'CREATE EXTENSION IF NOT EXISTS vector',\n },\n ],\n postcheck: [\n {\n description: 'confirm extension \"vector\" is enabled',\n sql: \"SELECT EXISTS (SELECT 1 FROM pg_extension WHERE extname = 'vector')\",\n },\n ],\n },\n ],\n verifyDatabaseDependencyInstalled: verifyVectorExtensionInstalled,\n },\n ],\n};\n\n/**\n * pgvector extension descriptor for CLI config.\n * Declares database dependencies for the 'vector' Postgres extension.\n */\nconst pgvectorExtensionDescriptor: SqlControlExtensionDescriptor<'postgres'> = {\n ...pgvectorPackMeta,\n databaseDependencies: pgvectorDatabaseDependencies,\n create: () => ({\n familyId: 'sql' as const,\n targetId: 'postgres' as const,\n }),\n};\n\nexport { pgvectorExtensionDescriptor };\nexport default pgvectorExtensionDescriptor;\n"],"mappings":";;;;;AAYA,SAAS,+BAA+B,QAA6C;AACnF,MAAI,CAAC,OAAO,WAAW,SAAS,QAAQ,GAAG;AACzC,WAAO;AAAA,MACL;AAAA,QACE,MAAM;AAAA,QACN,OAAO;AAAA,QACP,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF;AACA,SAAO,CAAC;AACV;AAMA,IAAM,+BAAuE;AAAA,EAC3E,MAAM;AAAA,IACJ;AAAA,MACE,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,SAAS;AAAA,QACP;AAAA,UACE,IAAI;AAAA,UACJ,OAAO;AAAA,UACP,SAAS;AAAA,UACT,gBAAgB;AAAA,UAChB,QAAQ,EAAE,IAAI,WAAW;AAAA,UACzB,UAAU;AAAA,YACR;AAAA,cACE,aAAa;AAAA,cACb,KAAK;AAAA,YACP;AAAA,UACF;AAAA,UACA,SAAS;AAAA,YACP;AAAA,cACE,aAAa;AAAA,cACb,KAAK;AAAA,YACP;AAAA,UACF;AAAA,UACA,WAAW;AAAA,YACT;AAAA,cACE,aAAa;AAAA,cACb,KAAK;AAAA,YACP;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,MACA,mCAAmC;AAAA,IACrC;AAAA,EACF;AACF;AAMA,IAAM,8BAAyE;AAAA,EAC7E,GAAG;AAAA,EACH,sBAAsB;AAAA,EACtB,QAAQ,OAAO;AAAA,IACb,UAAU;AAAA,IACV,UAAU;AAAA,EACZ;AACF;AAGA,IAAO,kBAAQ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operation-types.d.ts","sourceRoot":"","sources":["../../src/exports/operation-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=operation-types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/exports/pack.d.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
declare const pgvectorPack: {
|
|
2
|
-
readonly kind: "extension";
|
|
3
|
-
readonly id: "pgvector";
|
|
4
|
-
readonly familyId: "sql";
|
|
5
|
-
readonly targetId: "postgres";
|
|
6
|
-
readonly version: "0.0.1";
|
|
7
|
-
readonly capabilities: {
|
|
8
|
-
readonly postgres: {
|
|
9
|
-
readonly 'pgvector/cosine': true;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
readonly types: {
|
|
13
|
-
readonly codecTypes: {
|
|
14
|
-
readonly import: {
|
|
15
|
-
readonly package: "@prisma-next/extension-pgvector/codec-types";
|
|
16
|
-
readonly named: "CodecTypes";
|
|
17
|
-
readonly alias: "PgVectorTypes";
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
readonly operationTypes: {
|
|
21
|
-
readonly import: {
|
|
22
|
-
readonly package: "@prisma-next/extension-pgvector/operation-types";
|
|
23
|
-
readonly named: "OperationTypes";
|
|
24
|
-
readonly alias: "PgVectorOperationTypes";
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
readonly storage: readonly [{
|
|
28
|
-
readonly typeId: "pg/vector@1";
|
|
29
|
-
readonly familyId: "sql";
|
|
30
|
-
readonly targetId: "postgres";
|
|
31
|
-
readonly nativeType: "vector";
|
|
32
|
-
}];
|
|
33
|
-
};
|
|
34
|
-
readonly operations: readonly [{
|
|
35
|
-
readonly method: "cosineDistance";
|
|
36
|
-
readonly args: readonly [{
|
|
37
|
-
readonly kind: "param";
|
|
38
|
-
}];
|
|
39
|
-
readonly returns: {
|
|
40
|
-
readonly kind: "builtin";
|
|
41
|
-
readonly type: "number";
|
|
42
|
-
};
|
|
43
|
-
readonly lowering: {
|
|
44
|
-
readonly targetFamily: "sql";
|
|
45
|
-
readonly strategy: "function";
|
|
46
|
-
readonly template: "1 - ({{self}} <=> {{arg0}})";
|
|
47
|
-
};
|
|
48
|
-
readonly for: "pg/vector@1";
|
|
49
|
-
}];
|
|
50
|
-
};
|
|
51
|
-
export default pgvectorPack;
|
|
52
|
-
//# sourceMappingURL=pack.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pack.d.ts","sourceRoot":"","sources":["../../src/exports/pack.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAmB,CAAC;AAEtC,eAAe,YAAY,CAAC"}
|
package/dist/exports/pack.js
DELETED
package/dist/exports/pack.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/exports/pack.ts"],"sourcesContent":["import { pgvectorPackMeta } from '../core/descriptor-meta';\n\nconst pgvectorPack = pgvectorPackMeta;\n\nexport default pgvectorPack;\n"],"mappings":";;;;;AAEA,IAAM,eAAe;AAErB,IAAO,eAAQ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/exports/runtime.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,6BAA6B,EAE9B,MAAM,0BAA0B,CAAC;AA0BlC;;;GAGG;AACH,QAAA,MAAM,yBAAyB,EAAE,6BAA6B,CAAC,UAAU,CASxE,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
|
package/dist/exports/runtime.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
pgvectorPackMeta,
|
|
3
|
-
pgvectorRuntimeOperation
|
|
4
|
-
} from "../chunk-SHWLERB3.js";
|
|
5
|
-
|
|
6
|
-
// src/exports/runtime.ts
|
|
7
|
-
import { createCodecRegistry } from "@prisma-next/sql-relational-core/ast";
|
|
8
|
-
|
|
9
|
-
// src/core/codecs.ts
|
|
10
|
-
import { codec, defineCodecs } from "@prisma-next/sql-relational-core/ast";
|
|
11
|
-
var pgVectorCodec = codec({
|
|
12
|
-
typeId: "pg/vector@1",
|
|
13
|
-
targetTypes: ["vector"],
|
|
14
|
-
encode: (value) => {
|
|
15
|
-
if (!Array.isArray(value)) {
|
|
16
|
-
throw new Error("Vector value must be an array of numbers");
|
|
17
|
-
}
|
|
18
|
-
if (!value.every((v) => typeof v === "number")) {
|
|
19
|
-
throw new Error("Vector value must contain only numbers");
|
|
20
|
-
}
|
|
21
|
-
return `[${value.join(",")}]`;
|
|
22
|
-
},
|
|
23
|
-
decode: (wire) => {
|
|
24
|
-
if (typeof wire !== "string") {
|
|
25
|
-
throw new Error("Vector wire value must be a string");
|
|
26
|
-
}
|
|
27
|
-
if (!wire.startsWith("[") || !wire.endsWith("]")) {
|
|
28
|
-
throw new Error(`Invalid vector format: expected "[...]", got "${wire}"`);
|
|
29
|
-
}
|
|
30
|
-
const content = wire.slice(1, -1).trim();
|
|
31
|
-
if (content === "") {
|
|
32
|
-
return [];
|
|
33
|
-
}
|
|
34
|
-
const values = content.split(",").map((v) => {
|
|
35
|
-
const num = Number.parseFloat(v.trim());
|
|
36
|
-
if (Number.isNaN(num)) {
|
|
37
|
-
throw new Error(`Invalid vector value: "${v}" is not a number`);
|
|
38
|
-
}
|
|
39
|
-
return num;
|
|
40
|
-
});
|
|
41
|
-
return values;
|
|
42
|
-
},
|
|
43
|
-
meta: {
|
|
44
|
-
db: {
|
|
45
|
-
sql: {
|
|
46
|
-
postgres: {
|
|
47
|
-
nativeType: "vector"
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
var codecs = defineCodecs().add("vector", pgVectorCodec);
|
|
54
|
-
var codecDefinitions = codecs.codecDefinitions;
|
|
55
|
-
var dataTypes = codecs.dataTypes;
|
|
56
|
-
|
|
57
|
-
// src/exports/runtime.ts
|
|
58
|
-
var PgVectorRuntimeExtensionInstance = class {
|
|
59
|
-
familyId = "sql";
|
|
60
|
-
targetId = "postgres";
|
|
61
|
-
codecs() {
|
|
62
|
-
const registry = createCodecRegistry();
|
|
63
|
-
for (const def of Object.values(codecDefinitions)) {
|
|
64
|
-
registry.register(def.codec);
|
|
65
|
-
}
|
|
66
|
-
return registry;
|
|
67
|
-
}
|
|
68
|
-
operations() {
|
|
69
|
-
return [pgvectorRuntimeOperation];
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
var pgvectorRuntimeDescriptor = {
|
|
73
|
-
kind: "extension",
|
|
74
|
-
id: pgvectorPackMeta.id,
|
|
75
|
-
version: pgvectorPackMeta.version,
|
|
76
|
-
familyId: "sql",
|
|
77
|
-
targetId: "postgres",
|
|
78
|
-
create() {
|
|
79
|
-
return new PgVectorRuntimeExtensionInstance();
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
var runtime_default = pgvectorRuntimeDescriptor;
|
|
83
|
-
export {
|
|
84
|
-
runtime_default as default
|
|
85
|
-
};
|
|
86
|
-
//# sourceMappingURL=runtime.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/exports/runtime.ts","../../src/core/codecs.ts"],"sourcesContent":["import type { SqlOperationSignature } from '@prisma-next/sql-operations';\nimport type { CodecRegistry } from '@prisma-next/sql-relational-core/ast';\nimport { createCodecRegistry } from '@prisma-next/sql-relational-core/ast';\nimport type {\n SqlRuntimeExtensionDescriptor,\n SqlRuntimeExtensionInstance,\n} from '@prisma-next/sql-runtime';\nimport { codecDefinitions } from '../core/codecs';\nimport { pgvectorPackMeta, pgvectorRuntimeOperation } from '../core/descriptor-meta';\n\n/**\n * pgvector SQL runtime extension instance.\n * Provides codecs and operations for vector data type and similarity operations.\n */\nclass PgVectorRuntimeExtensionInstance implements SqlRuntimeExtensionInstance<'postgres'> {\n readonly familyId = 'sql' as const;\n readonly targetId = 'postgres' as const;\n\n codecs(): CodecRegistry {\n const registry = createCodecRegistry();\n // Register all codecs from codecDefinitions\n for (const def of Object.values(codecDefinitions)) {\n registry.register(def.codec);\n }\n return registry;\n }\n\n operations(): ReadonlyArray<SqlOperationSignature> {\n return [pgvectorRuntimeOperation];\n }\n}\n\n/**\n * pgvector SQL runtime extension descriptor.\n * Provides metadata and factory for creating runtime extension instances.\n */\nconst pgvectorRuntimeDescriptor: SqlRuntimeExtensionDescriptor<'postgres'> = {\n kind: 'extension' as const,\n id: pgvectorPackMeta.id,\n version: pgvectorPackMeta.version,\n familyId: 'sql' as const,\n targetId: 'postgres' as const,\n create(): SqlRuntimeExtensionInstance<'postgres'> {\n return new PgVectorRuntimeExtensionInstance();\n },\n};\n\nexport default pgvectorRuntimeDescriptor;\n","/**\n * Vector codec implementation for pgvector extension.\n *\n * Provides encoding/decoding for the `vector` PostgreSQL type.\n * Wire format is a string like `[1,2,3]` (PostgreSQL vector text format).\n */\n\nimport { codec, defineCodecs } from '@prisma-next/sql-relational-core/ast';\n\nconst pgVectorCodec = codec<'pg/vector@1', string, number[]>({\n typeId: 'pg/vector@1',\n targetTypes: ['vector'],\n encode: (value: number[]): string => {\n // Validate that value is an array of numbers\n if (!Array.isArray(value)) {\n throw new Error('Vector value must be an array of numbers');\n }\n if (!value.every((v) => typeof v === 'number')) {\n throw new Error('Vector value must contain only numbers');\n }\n // Format as PostgreSQL vector text format: [1,2,3]\n // PostgreSQL's pg library requires the vector format string\n return `[${value.join(',')}]`;\n },\n decode: (wire: string): number[] => {\n // Handle string format from PostgreSQL: [1,2,3]\n if (typeof wire !== 'string') {\n throw new Error('Vector wire value must be a string');\n }\n // Parse PostgreSQL vector format: [1,2,3]\n if (!wire.startsWith('[') || !wire.endsWith(']')) {\n throw new Error(`Invalid vector format: expected \"[...]\", got \"${wire}\"`);\n }\n const content = wire.slice(1, -1).trim();\n if (content === '') {\n return [];\n }\n const values = content.split(',').map((v) => {\n const num = Number.parseFloat(v.trim());\n if (Number.isNaN(num)) {\n throw new Error(`Invalid vector value: \"${v}\" is not a number`);\n }\n return num;\n });\n return values;\n },\n meta: {\n db: {\n sql: {\n postgres: {\n nativeType: 'vector',\n },\n },\n },\n },\n});\n\n// Build codec definitions using the builder DSL\nconst codecs = defineCodecs().add('vector', pgVectorCodec);\n\n// Export derived structures directly from codecs builder\nexport const codecDefinitions = codecs.codecDefinitions;\nexport const dataTypes = codecs.dataTypes;\n\n// Export types derived from codecs builder\nexport type CodecTypes = typeof codecs.CodecTypes;\n"],"mappings":";;;;;;AAEA,SAAS,2BAA2B;;;ACKpC,SAAS,OAAO,oBAAoB;AAEpC,IAAM,gBAAgB,MAAuC;AAAA,EAC3D,QAAQ;AAAA,EACR,aAAa,CAAC,QAAQ;AAAA,EACtB,QAAQ,CAAC,UAA4B;AAEnC,QAAI,CAAC,MAAM,QAAQ,KAAK,GAAG;AACzB,YAAM,IAAI,MAAM,0CAA0C;AAAA,IAC5D;AACA,QAAI,CAAC,MAAM,MAAM,CAAC,MAAM,OAAO,MAAM,QAAQ,GAAG;AAC9C,YAAM,IAAI,MAAM,wCAAwC;AAAA,IAC1D;AAGA,WAAO,IAAI,MAAM,KAAK,GAAG,CAAC;AAAA,EAC5B;AAAA,EACA,QAAQ,CAAC,SAA2B;AAElC,QAAI,OAAO,SAAS,UAAU;AAC5B,YAAM,IAAI,MAAM,oCAAoC;AAAA,IACtD;AAEA,QAAI,CAAC,KAAK,WAAW,GAAG,KAAK,CAAC,KAAK,SAAS,GAAG,GAAG;AAChD,YAAM,IAAI,MAAM,iDAAiD,IAAI,GAAG;AAAA,IAC1E;AACA,UAAM,UAAU,KAAK,MAAM,GAAG,EAAE,EAAE,KAAK;AACvC,QAAI,YAAY,IAAI;AAClB,aAAO,CAAC;AAAA,IACV;AACA,UAAM,SAAS,QAAQ,MAAM,GAAG,EAAE,IAAI,CAAC,MAAM;AAC3C,YAAM,MAAM,OAAO,WAAW,EAAE,KAAK,CAAC;AACtC,UAAI,OAAO,MAAM,GAAG,GAAG;AACrB,cAAM,IAAI,MAAM,0BAA0B,CAAC,mBAAmB;AAAA,MAChE;AACA,aAAO;AAAA,IACT,CAAC;AACD,WAAO;AAAA,EACT;AAAA,EACA,MAAM;AAAA,IACJ,IAAI;AAAA,MACF,KAAK;AAAA,QACH,UAAU;AAAA,UACR,YAAY;AAAA,QACd;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF,CAAC;AAGD,IAAM,SAAS,aAAa,EAAE,IAAI,UAAU,aAAa;AAGlD,IAAM,mBAAmB,OAAO;AAChC,IAAM,YAAY,OAAO;;;ADhDhC,IAAM,mCAAN,MAA0F;AAAA,EAC/E,WAAW;AAAA,EACX,WAAW;AAAA,EAEpB,SAAwB;AACtB,UAAM,WAAW,oBAAoB;AAErC,eAAW,OAAO,OAAO,OAAO,gBAAgB,GAAG;AACjD,eAAS,SAAS,IAAI,KAAK;AAAA,IAC7B;AACA,WAAO;AAAA,EACT;AAAA,EAEA,aAAmD;AACjD,WAAO,CAAC,wBAAwB;AAAA,EAClC;AACF;AAMA,IAAM,4BAAuE;AAAA,EAC3E,MAAM;AAAA,EACN,IAAI,iBAAiB;AAAA,EACrB,SAAS,iBAAiB;AAAA,EAC1B,UAAU;AAAA,EACV,UAAU;AAAA,EACV,SAAkD;AAChD,WAAO,IAAI,iCAAiC;AAAA,EAC9C;AACF;AAEA,IAAO,kBAAQ;","names":[]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Codec type definitions for pgvector extension.
|
|
3
|
-
*
|
|
4
|
-
* This file exports type-only definitions for codec input/output types.
|
|
5
|
-
* These types are imported by contract.d.ts files for compile-time type inference.
|
|
6
|
-
*
|
|
7
|
-
* Runtime codec implementations are provided by the extension's codec registry.
|
|
8
|
-
*/
|
|
9
|
-
export type { CodecTypes } from '../core/codecs';
|
|
10
|
-
//# sourceMappingURL=codec-types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codec-types.d.ts","sourceRoot":"","sources":["../../src/types/codec-types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Operation type definitions for pgvector extension.
|
|
3
|
-
*
|
|
4
|
-
* This file exports type-only definitions for operation method signatures.
|
|
5
|
-
* These types are imported by contract.d.ts files for compile-time type inference.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Operation types for pgvector extension.
|
|
9
|
-
* Maps typeId to operation methods.
|
|
10
|
-
*/
|
|
11
|
-
export type OperationTypes = {
|
|
12
|
-
readonly 'pg/vector@1': {
|
|
13
|
-
readonly cosineDistance: {
|
|
14
|
-
readonly args: readonly [
|
|
15
|
-
{
|
|
16
|
-
readonly kind: 'param';
|
|
17
|
-
}
|
|
18
|
-
];
|
|
19
|
-
readonly returns: {
|
|
20
|
-
readonly kind: 'builtin';
|
|
21
|
-
readonly type: 'number';
|
|
22
|
-
};
|
|
23
|
-
readonly lowering: {
|
|
24
|
-
readonly targetFamily: 'sql';
|
|
25
|
-
readonly strategy: 'function';
|
|
26
|
-
readonly template: string;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
//# sourceMappingURL=operation-types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operation-types.d.ts","sourceRoot":"","sources":["../../src/types/operation-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,aAAa,EAAE;QACtB,QAAQ,CAAC,cAAc,EAAE;YACvB,QAAQ,CAAC,IAAI,EAAE,SAAS;gBACtB;oBACE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;iBACxB;aACF,CAAC;YACF,QAAQ,CAAC,OAAO,EAAE;gBAChB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;gBACzB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;aACzB,CAAC;YACF,QAAQ,CAAC,QAAQ,EAAE;gBACjB,QAAQ,CAAC,YAAY,EAAE,KAAK,CAAC;gBAC7B,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;gBAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;aAC3B,CAAC;SACH,CAAC;KACH,CAAC;CACH,CAAC"}
|