@prisma-next/extension-pgvector 0.3.0-pr.100.1 → 0.3.0-pr.100.2

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.
@@ -4,8 +4,30 @@
4
4
  * These descriptors provide both codecId and nativeType for use in contract authoring.
5
5
  * They are derived from the same source of truth as codec definitions and manifests.
6
6
  */
7
+ import type { ColumnTypeDescriptor } from '@prisma-next/contract-authoring';
8
+ /**
9
+ * Static vector column descriptor without dimension.
10
+ * Use `vector(N)` for dimensioned vectors that produce `vector(N)` DDL.
11
+ */
7
12
  export declare const vectorColumn: {
8
13
  readonly codecId: "pg/vector@1";
9
14
  readonly nativeType: "vector";
10
15
  };
16
+ /**
17
+ * Factory for creating dimensioned vector column descriptors.
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * .column('embedding', { type: vector(1536), nullable: false })
22
+ * // Produces: nativeType: 'vector(1536)', typeParams: { length: 1536 }
23
+ * ```
24
+ *
25
+ * @param length - The dimension of the vector (e.g., 1536 for OpenAI embeddings)
26
+ * @returns A column type descriptor with `typeParams.length` set
27
+ */
28
+ export declare function vector<N extends number>(length: N): ColumnTypeDescriptor & {
29
+ readonly typeParams: {
30
+ readonly length: N;
31
+ };
32
+ };
11
33
  //# sourceMappingURL=column-types.d.ts.map
@@ -1 +1 @@
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
+ {"version":3,"file":"column-types.d.ts","sourceRoot":"","sources":["../../src/exports/column-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAE5E;;;GAGG;AACH,eAAO,MAAM,YAAY;;;CAGgB,CAAC;AAE1C;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,MAAM,EACrC,MAAM,EAAE,CAAC,GACR,oBAAoB,GAAG;IAAE,QAAQ,CAAC,UAAU,EAAE;QAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;KAAE,CAAA;CAAE,CAMxE"}
@@ -3,7 +3,15 @@ var vectorColumn = {
3
3
  codecId: "pg/vector@1",
4
4
  nativeType: "vector"
5
5
  };
6
+ function vector(length) {
7
+ return {
8
+ codecId: "pg/vector@1",
9
+ nativeType: `vector(${length})`,
10
+ typeParams: { length }
11
+ };
12
+ }
6
13
  export {
14
+ vector,
7
15
  vectorColumn
8
16
  };
9
17
  //# sourceMappingURL=column-types.js.map
@@ -1 +1 @@
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
+ {"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\n/**\n * Static vector column descriptor without dimension.\n * Use `vector(N)` for dimensioned vectors that produce `vector(N)` DDL.\n */\nexport const vectorColumn = {\n codecId: 'pg/vector@1',\n nativeType: 'vector',\n} as const satisfies ColumnTypeDescriptor;\n\n/**\n * Factory for creating dimensioned vector column descriptors.\n *\n * @example\n * ```typescript\n * .column('embedding', { type: vector(1536), nullable: false })\n * // Produces: nativeType: 'vector(1536)', typeParams: { length: 1536 }\n * ```\n *\n * @param length - The dimension of the vector (e.g., 1536 for OpenAI embeddings)\n * @returns A column type descriptor with `typeParams.length` set\n */\nexport function vector<N extends number>(\n length: N,\n): ColumnTypeDescriptor & { readonly typeParams: { readonly length: N } } {\n return {\n codecId: 'pg/vector@1',\n nativeType: `vector(${length})`,\n typeParams: { length },\n } as const;\n}\n"],"mappings":";AAaO,IAAM,eAAe;AAAA,EAC1B,SAAS;AAAA,EACT,YAAY;AACd;AAcO,SAAS,OACd,QACwE;AACxE,SAAO;AAAA,IACL,SAAS;AAAA,IACT,YAAY,UAAU,MAAM;AAAA,IAC5B,YAAY,EAAE,OAAO;AAAA,EACvB;AACF;","names":[]}
package/package.json CHANGED
@@ -1,31 +1,31 @@
1
1
  {
2
2
  "name": "@prisma-next/extension-pgvector",
3
- "version": "0.3.0-pr.100.1",
3
+ "version": "0.3.0-pr.100.2",
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.100.1",
9
- "@prisma-next/contract": "0.3.0-pr.100.1",
10
- "@prisma-next/contract-authoring": "0.3.0-pr.100.1",
11
- "@prisma-next/core-control-plane": "0.3.0-pr.100.1",
12
- "@prisma-next/family-sql": "0.3.0-pr.100.1",
13
- "@prisma-next/sql-operations": "0.3.0-pr.100.1",
14
- "@prisma-next/sql-relational-core": "0.3.0-pr.100.1",
15
- "@prisma-next/sql-runtime": "0.3.0-pr.100.1",
16
- "@prisma-next/sql-schema-ir": "0.3.0-pr.100.1"
8
+ "@prisma-next/cli": "0.3.0-pr.100.2",
9
+ "@prisma-next/contract-authoring": "0.3.0-pr.100.2",
10
+ "@prisma-next/core-control-plane": "0.3.0-pr.100.2",
11
+ "@prisma-next/family-sql": "0.3.0-pr.100.2",
12
+ "@prisma-next/sql-operations": "0.3.0-pr.100.2",
13
+ "@prisma-next/sql-relational-core": "0.3.0-pr.100.2",
14
+ "@prisma-next/sql-runtime": "0.3.0-pr.100.2",
15
+ "@prisma-next/sql-schema-ir": "0.3.0-pr.100.2",
16
+ "@prisma-next/contract": "0.3.0-pr.100.2"
17
17
  },
18
18
  "devDependencies": {
19
19
  "tsup": "8.5.1",
20
20
  "typescript": "5.9.3",
21
21
  "vitest": "4.0.16",
22
- "@prisma-next/adapter-postgres": "0.3.0-pr.100.1",
23
- "@prisma-next/operations": "0.3.0-pr.100.1",
24
- "@prisma-next/sql-contract": "0.3.0-pr.100.1",
25
- "@prisma-next/sql-contract-ts": "0.3.0-pr.100.1",
26
- "@prisma-next/sql-lane": "0.3.0-pr.100.1",
27
- "@prisma-next/tsconfig": "0.0.0",
28
- "@prisma-next/test-utils": "0.0.1"
22
+ "@prisma-next/adapter-postgres": "0.3.0-pr.100.2",
23
+ "@prisma-next/operations": "0.3.0-pr.100.2",
24
+ "@prisma-next/sql-contract": "0.3.0-pr.100.2",
25
+ "@prisma-next/sql-contract-ts": "0.3.0-pr.100.2",
26
+ "@prisma-next/sql-lane": "0.3.0-pr.100.2",
27
+ "@prisma-next/test-utils": "0.0.1",
28
+ "@prisma-next/tsconfig": "0.0.0"
29
29
  },
30
30
  "files": [
31
31
  "dist",
@@ -66,6 +66,6 @@
66
66
  "lint": "biome check . --error-on-warnings",
67
67
  "lint:fix": "biome check --write .",
68
68
  "lint:fix:unsafe": "biome check --write --unsafe .",
69
- "clean": "rm -rf dist coverage .tmp-output"
69
+ "clean": "rm -rf dist dist-tsc dist-tsc-prod coverage .tmp-output"
70
70
  }
71
71
  }
@@ -7,7 +7,33 @@
7
7
 
8
8
  import type { ColumnTypeDescriptor } from '@prisma-next/contract-authoring';
9
9
 
10
+ /**
11
+ * Static vector column descriptor without dimension.
12
+ * Use `vector(N)` for dimensioned vectors that produce `vector(N)` DDL.
13
+ */
10
14
  export const vectorColumn = {
11
15
  codecId: 'pg/vector@1',
12
16
  nativeType: 'vector',
13
17
  } as const satisfies ColumnTypeDescriptor;
18
+
19
+ /**
20
+ * Factory for creating dimensioned vector column descriptors.
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * .column('embedding', { type: vector(1536), nullable: false })
25
+ * // Produces: nativeType: 'vector(1536)', typeParams: { length: 1536 }
26
+ * ```
27
+ *
28
+ * @param length - The dimension of the vector (e.g., 1536 for OpenAI embeddings)
29
+ * @returns A column type descriptor with `typeParams.length` set
30
+ */
31
+ export function vector<N extends number>(
32
+ length: N,
33
+ ): ColumnTypeDescriptor & { readonly typeParams: { readonly length: N } } {
34
+ return {
35
+ codecId: 'pg/vector@1',
36
+ nativeType: `vector(${length})`,
37
+ typeParams: { length },
38
+ } as const;
39
+ }