@prisma/orm-extension-pgvector 0.16.0-dev.36
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/LICENSE +201 -0
- package/README.md +27 -0
- package/dist/codec-types-BFcjjrT--s4MwG0qH.d.mts +55 -0
- package/dist/codec-types-BFcjjrT--s4MwG0qH.d.mts.map +1 -0
- package/dist/codec-types.d.mts +2 -0
- package/dist/codec-types.mjs +1 -0
- package/dist/column-types.d.mts +23 -0
- package/dist/column-types.d.mts.map +1 -0
- package/dist/column-types.mjs +33 -0
- package/dist/column-types.mjs.map +1 -0
- package/dist/control.d.mts +7 -0
- package/dist/control.d.mts.map +1 -0
- package/dist/control.mjs +148 -0
- package/dist/control.mjs.map +1 -0
- package/dist/descriptor-meta-Dk8eTHcA-DeyZ_87T.mjs +227 -0
- package/dist/descriptor-meta-Dk8eTHcA-DeyZ_87T.mjs.map +1 -0
- package/dist/errors-9-gSu3kD-Vg4apMXQ.mjs +17 -0
- package/dist/errors-9-gSu3kD-Vg4apMXQ.mjs.map +1 -0
- package/dist/operation-types-D37jCdyS-ClyVMplO.d.mts +38 -0
- package/dist/operation-types-D37jCdyS-ClyVMplO.d.mts.map +1 -0
- package/dist/operation-types.d.mts +2 -0
- package/dist/operation-types.mjs +1 -0
- package/dist/pack.d.mts +83 -0
- package/dist/pack.d.mts.map +1 -0
- package/dist/pack.mjs +2 -0
- package/dist/runtime.d.mts +16 -0
- package/dist/runtime.d.mts.map +1 -0
- package/dist/runtime.mjs +22 -0
- package/dist/runtime.mjs.map +1 -0
- package/package.json +57 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [2026] [Prisma Data, Inc]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# @prisma/orm-extension-pgvector
|
|
2
|
+
|
|
3
|
+
Embedding columns and vector similarity search for Prisma Next on PostgreSQL, powered by [pgvector](https://github.com/pgvector/pgvector).
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
pnpm add @prisma/orm-extension-pgvector
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Entrypoints
|
|
10
|
+
|
|
11
|
+
| Namespace | Surface |
|
|
12
|
+
| --- | --- |
|
|
13
|
+
| `/pack` | the extension pack an application composes into `extensions: [...]` — pure, no runtime imports |
|
|
14
|
+
| `/column-types` | the `Vector(n)` column author |
|
|
15
|
+
| `/codec-types`, `/operation-types` | types emitted contracts reference |
|
|
16
|
+
| `/runtime` | the runtime extension that registers the codec and operations |
|
|
17
|
+
| `/control` | the control descriptor and baseline migration that install the server extension |
|
|
18
|
+
|
|
19
|
+
## Responsibilities
|
|
20
|
+
|
|
21
|
+
Dimensioned vector storage and search: the `pg/vector@1` codec (`number[]` at runtime, `Vector<N>` in `contract.d.ts`), similarity operations such as `cosineDistance`, and a baseline migration that runs `CREATE EXTENSION IF NOT EXISTS vector` when the pack is composed into an application.
|
|
22
|
+
|
|
23
|
+
## Dependencies
|
|
24
|
+
|
|
25
|
+
`@prisma/orm-framework`, `@prisma/orm-family-sql`, and `@prisma/orm-toolchain` at exact lockstep versions, plus `arktype` and `@standard-schema/spec`.
|
|
26
|
+
|
|
27
|
+
`@prisma/orm-target-postgres` is an exact-pinned **peer** dependency: the application supplies it, directly or through a facade, and everyone shares that one copy. A hard dependency would let an application upgrade the facade without upgrading this pack and end up with two target copies whose codec and operation registries have quietly diverged; as a peer that combination fails to install instead.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { AnyCodecDescriptor, CodecCallContext, CodecImpl, CodecInstanceContext } from "@prisma/orm-framework/components/codec";
|
|
2
|
+
import { ExtractCodecTypes, ProjectionExpr } from "@prisma/orm-family-sql/relational-core/ast";
|
|
3
|
+
import { PostgresCodecDescriptor } from "@prisma/orm-target-postgres/target/codec-descriptor";
|
|
4
|
+
import { JsonValue } from "@prisma/orm-framework/contract/types";
|
|
5
|
+
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
6
|
+
//#region ../../../3-extensions/pgvector/dist/codec-types-BFcjjrT-.d.mts
|
|
7
|
+
//#region src/core/constants.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Codec ID for pgvector's vector type.
|
|
10
|
+
*/
|
|
11
|
+
declare const VECTOR_CODEC_ID: "pg/vector@1";
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/core/codecs.d.ts
|
|
14
|
+
type VectorConversionCode = 'RUNTIME.ENCODE_FAILED' | 'RUNTIME.DECODE_FAILED';
|
|
15
|
+
type VectorParams = {
|
|
16
|
+
readonly length: number;
|
|
17
|
+
};
|
|
18
|
+
declare class PgVectorCodec extends CodecImpl<typeof VECTOR_CODEC_ID, readonly ['equality'], string, number[]> {
|
|
19
|
+
readonly length: number;
|
|
20
|
+
constructor(descriptor: AnyCodecDescriptor, length: number);
|
|
21
|
+
assertVector(value: unknown, code: VectorConversionCode): asserts value is number[];
|
|
22
|
+
encode(value: number[], _ctx: CodecCallContext): Promise<string>;
|
|
23
|
+
decode(wire: string, _ctx: CodecCallContext): Promise<number[]>;
|
|
24
|
+
encodeJson(value: number[]): JsonValue;
|
|
25
|
+
decodeJson(json: JsonValue): number[];
|
|
26
|
+
}
|
|
27
|
+
declare class PgVectorDescriptor extends PostgresCodecDescriptor<VectorParams> {
|
|
28
|
+
protected nativeType(): string;
|
|
29
|
+
protected jsonProjection(expression: ProjectionExpr): ProjectionExpr;
|
|
30
|
+
readonly codecId: "pg/vector@1";
|
|
31
|
+
readonly traits: readonly ["equality"];
|
|
32
|
+
readonly targetTypes: readonly ["vector"];
|
|
33
|
+
readonly paramsSchema: StandardSchemaV1<VectorParams>;
|
|
34
|
+
renderOutputType(params: VectorParams): string;
|
|
35
|
+
factory(params: VectorParams): (ctx: CodecInstanceContext) => PgVectorCodec;
|
|
36
|
+
}
|
|
37
|
+
declare const codecDescriptorMap: {
|
|
38
|
+
readonly vector: PgVectorDescriptor;
|
|
39
|
+
};
|
|
40
|
+
type CodecTypes$1 = ExtractCodecTypes<typeof codecDescriptorMap>;
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/types/codec-types.d.ts
|
|
43
|
+
/**
|
|
44
|
+
* Type-level branded vector.
|
|
45
|
+
*
|
|
46
|
+
* The runtime values are plain number arrays, but parameterized column typing can
|
|
47
|
+
* carry the dimension at the type level (e.g. Vector<1536>).
|
|
48
|
+
*/
|
|
49
|
+
type Vector<N extends number = number> = number[] & {
|
|
50
|
+
readonly __vectorLength?: N;
|
|
51
|
+
};
|
|
52
|
+
type CodecTypes = CodecTypes$1;
|
|
53
|
+
//#endregion
|
|
54
|
+
export { Vector as n, CodecTypes as t };
|
|
55
|
+
//# sourceMappingURL=codec-types-BFcjjrT--s4MwG0qH.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codec-types-BFcjjrT--s4MwG0qH.d.mts","names":[],"sources":["../../../../3-extensions/pgvector/dist/codec-types-BFcjjrT-.d.mts"],"mappings":";;;;;;;;;;cASc;;;KAGT;KACA;WACM;;cAEG,sBAAsB,iBAAiB;WAC1C;EACT,YAAY,YAAY,oBAAoB;EAC5C,aAAa,gBAAgB,MAAM,+BAA+B;EAClE,OAAO,iBAAiB,MAAM,mBAAmB;EACjD,OAAO,cAAc,MAAM,mBAAmB;EAC9C,WAAW,kBAAkB;EAC7B,WAAW,MAAM;;cAEL,2BAA2B,wBAAwB;YACrD;YACA,eAAe,YAAY,iBAAiB;WAC7C;WACA;WACA;WACA,cAAc,iBAAiB;EACxC,iBAAiB,QAAQ;EACzB,QAAQ,QAAQ,gBAAgB,KAAK,yBAAyB;;cAElD;WACH,QAAQ;;KAEd,eAAe,yBAAyB;;;;;;;;;KASxC,OAAO;WACD,iBAAiB;;KAEvB,aAAa"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ColumnTypeDescriptor } from "@prisma/orm-framework/components/codec";
|
|
2
|
+
//#region ../../../3-extensions/pgvector/dist/column-types.d.mts
|
|
3
|
+
//#region src/exports/column-types.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Factory for creating dimensioned vector column descriptors.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* .column('embedding', { type: vector(1536), nullable: false })
|
|
10
|
+
* // Produces: nativeType: 'vector', typeParams: { length: 1536 }
|
|
11
|
+
* ```
|
|
12
|
+
* @param length - The dimension of the vector (e.g., 1536 for OpenAI embeddings)
|
|
13
|
+
* @returns A column type descriptor with `typeParams.length` set
|
|
14
|
+
* @throws `CONTRACT.ARGUMENT_INVALID` if length is not an integer in the range [1, VECTOR_MAX_DIM]
|
|
15
|
+
*/
|
|
16
|
+
declare function vector<N extends number>(length: N): ColumnTypeDescriptor & {
|
|
17
|
+
readonly typeParams: {
|
|
18
|
+
readonly length: N;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
export { vector };
|
|
23
|
+
//# sourceMappingURL=column-types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"column-types.d.mts","names":[],"sources":["../../../../3-extensions/pgvector/dist/column-types.d.mts"],"mappings":";;;;;;;;;;;;;;;iBAciB,OAAO,kBAAkB,QAAQ,IAAI;WAC3C;aACE,QAAQ"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { n as VECTOR_MAX_DIM, r as pgVectorError, t as VECTOR_CODEC_ID } from "./errors-9-gSu3kD-Vg4apMXQ.mjs";
|
|
2
|
+
//#region ../../../3-extensions/pgvector/dist/column-types.mjs
|
|
3
|
+
/**
|
|
4
|
+
* Factory for creating dimensioned vector column descriptors.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* .column('embedding', { type: vector(1536), nullable: false })
|
|
9
|
+
* // Produces: nativeType: 'vector', typeParams: { length: 1536 }
|
|
10
|
+
* ```
|
|
11
|
+
* @param length - The dimension of the vector (e.g., 1536 for OpenAI embeddings)
|
|
12
|
+
* @returns A column type descriptor with `typeParams.length` set
|
|
13
|
+
* @throws `CONTRACT.ARGUMENT_INVALID` if length is not an integer in the range [1, VECTOR_MAX_DIM]
|
|
14
|
+
*/
|
|
15
|
+
function vector(length) {
|
|
16
|
+
if (!Number.isInteger(length) || length < 1 || length > 16e3) throw pgVectorError("CONTRACT.ARGUMENT_INVALID", `pgvector: dimension must be an integer in [1, ${VECTOR_MAX_DIM}], got ${length}`, {
|
|
17
|
+
fix: `Pass an integer dimension between 1 and ${VECTOR_MAX_DIM}, e.g. vector(1536).`,
|
|
18
|
+
meta: {
|
|
19
|
+
helperPath: "vector",
|
|
20
|
+
expected: `an integer in [1, ${VECTOR_MAX_DIM}]`,
|
|
21
|
+
received: length
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return {
|
|
25
|
+
codecId: VECTOR_CODEC_ID,
|
|
26
|
+
nativeType: "vector",
|
|
27
|
+
typeParams: { length }
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { vector };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=column-types.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"column-types.mjs","names":[],"sources":["../../../../3-extensions/pgvector/dist/column-types.mjs"],"sourcesContent":["import { n as VECTOR_CODEC_ID, r as VECTOR_MAX_DIM, t as pgVectorError } from \"./errors-9-gSu3kD.mjs\";\n//#region src/exports/column-types.ts\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', typeParams: { length: 1536 }\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* @throws `CONTRACT.ARGUMENT_INVALID` if length is not an integer in the range [1, VECTOR_MAX_DIM]\n*/\nfunction vector(length) {\n\tif (!Number.isInteger(length) || length < 1 || length > 16e3) throw pgVectorError(\"CONTRACT.ARGUMENT_INVALID\", `pgvector: dimension must be an integer in [1, ${VECTOR_MAX_DIM}], got ${length}`, {\n\t\tfix: `Pass an integer dimension between 1 and ${VECTOR_MAX_DIM}, e.g. vector(1536).`,\n\t\tmeta: {\n\t\t\thelperPath: \"vector\",\n\t\t\texpected: `an integer in [1, ${VECTOR_MAX_DIM}]`,\n\t\t\treceived: length\n\t\t}\n\t});\n\treturn {\n\t\tcodecId: VECTOR_CODEC_ID,\n\t\tnativeType: \"vector\",\n\t\ttypeParams: { length }\n\t};\n}\n//#endregion\nexport { vector };\n\n//# sourceMappingURL=column-types.mjs.map"],"mappings":";;;;;;;;;;;;;;AAcA,SAAS,OAAO,QAAQ;CACvB,IAAI,CAAC,OAAO,UAAU,MAAM,KAAK,SAAS,KAAK,SAAS,MAAM,MAAM,cAAc,6BAA6B,iDAAiD,eAAe,SAAS,UAAU;EACjM,KAAK,2CAA2C,eAAe;EAC/D,MAAM;GACL,YAAY;GACZ,UAAU,qBAAqB,eAAe;GAC9C,UAAU;EACX;CACD,CAAC;CACD,OAAO;EACN,SAAS;EACT,YAAY;EACZ,YAAY,EAAE,OAAO;CACtB;AACD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SqlControlExtensionDescriptor } from "@prisma/orm-family-sql/family/control";
|
|
2
|
+
//#region ../../../3-extensions/pgvector/dist/control.d.mts
|
|
3
|
+
//#region src/exports/control.d.ts
|
|
4
|
+
declare const pgvectorExtensionDescriptor: SqlControlExtensionDescriptor<'postgres'>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { pgvectorExtensionDescriptor as default, pgvectorExtensionDescriptor };
|
|
7
|
+
//# sourceMappingURL=control.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control.d.mts","names":[],"sources":["../../../../3-extensions/pgvector/dist/control.d.mts"],"mappings":";;;cAEc,6BAA6B"}
|
package/dist/control.mjs
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { n as pgvectorPackMeta, r as pgvectorQueryOperations } from "./descriptor-meta-Dk8eTHcA-DeyZ_87T.mjs";
|
|
2
|
+
import { contractSpaceFromJson } from "@prisma/orm-toolchain/migration-tools/spaces";
|
|
3
|
+
//#region ../../../3-extensions/pgvector/dist/control.mjs
|
|
4
|
+
var migration_default = {
|
|
5
|
+
from: null,
|
|
6
|
+
to: "3d2c56a2944685bd21b05bc8a8d73164397df51c014201902932fbe7e80ff1b8",
|
|
7
|
+
providedInvariants: ["pgvector:install-vector-v1"],
|
|
8
|
+
createdAt: "2026-06-01T00:00:00.000Z",
|
|
9
|
+
migrationHash: "12b0b77e65c4899ba04e88ed040b1cb3390b4b18a889460f8a83cb6047ff1fa5"
|
|
10
|
+
};
|
|
11
|
+
var ops_default = [{
|
|
12
|
+
"id": "pgvector.install-vector-extension",
|
|
13
|
+
"label": "Enable extension \"vector\"",
|
|
14
|
+
"operationClass": "additive",
|
|
15
|
+
"invariantId": "pgvector:install-vector-v1",
|
|
16
|
+
"target": {
|
|
17
|
+
"id": "postgres",
|
|
18
|
+
"details": {
|
|
19
|
+
"schema": "public",
|
|
20
|
+
"objectType": "dependency",
|
|
21
|
+
"name": "vector"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"precheck": [{
|
|
25
|
+
"description": "verify extension \"vector\" is not already enabled",
|
|
26
|
+
"sql": "SELECT NOT EXISTS (SELECT 1 AS \"one\" FROM \"pg_extension\" WHERE \"extname\" = $1) AS \"result\"",
|
|
27
|
+
"params": ["vector"]
|
|
28
|
+
}],
|
|
29
|
+
"execute": [{
|
|
30
|
+
"description": "create extension \"vector\"",
|
|
31
|
+
"sql": "CREATE EXTENSION IF NOT EXISTS vector"
|
|
32
|
+
}],
|
|
33
|
+
"postcheck": [{
|
|
34
|
+
"description": "confirm extension \"vector\" is enabled",
|
|
35
|
+
"sql": "SELECT EXISTS (SELECT 1 AS \"one\" FROM \"pg_extension\" WHERE \"extname\" = $1) AS \"result\"",
|
|
36
|
+
"params": ["vector"]
|
|
37
|
+
}]
|
|
38
|
+
}];
|
|
39
|
+
var head_default = {
|
|
40
|
+
hash: "3d2c56a2944685bd21b05bc8a8d73164397df51c014201902932fbe7e80ff1b8",
|
|
41
|
+
invariants: ["pgvector:install-vector-v1"]
|
|
42
|
+
};
|
|
43
|
+
var contract_default = {
|
|
44
|
+
schemaVersion: "1",
|
|
45
|
+
targetFamily: "sql",
|
|
46
|
+
target: "postgres",
|
|
47
|
+
profileHash: "3916f444a8a17ad749191acf9e08dad97d1a327b88c2f1d45d12f240296aa8b2",
|
|
48
|
+
roots: {},
|
|
49
|
+
domain: { "namespaces": { "public": { "models": {} } } },
|
|
50
|
+
storage: {
|
|
51
|
+
"namespaces": { "public": {
|
|
52
|
+
"entries": { "table": {} },
|
|
53
|
+
"id": "public",
|
|
54
|
+
"kind": "postgres-schema"
|
|
55
|
+
} },
|
|
56
|
+
"storageHash": "3d2c56a2944685bd21b05bc8a8d73164397df51c014201902932fbe7e80ff1b8",
|
|
57
|
+
"types": { "vector": {
|
|
58
|
+
"codecId": "pg/vector@1",
|
|
59
|
+
"kind": "codec-instance",
|
|
60
|
+
"nativeType": "vector"
|
|
61
|
+
} }
|
|
62
|
+
},
|
|
63
|
+
capabilities: {
|
|
64
|
+
"postgres": {
|
|
65
|
+
"distinctOn": true,
|
|
66
|
+
"jsonAgg": true,
|
|
67
|
+
"lateral": true,
|
|
68
|
+
"limit": true,
|
|
69
|
+
"orderBy": true,
|
|
70
|
+
"returning": true
|
|
71
|
+
},
|
|
72
|
+
"sql": {
|
|
73
|
+
"defaultInInsert": true,
|
|
74
|
+
"enums": true,
|
|
75
|
+
"lateral": true,
|
|
76
|
+
"returning": true,
|
|
77
|
+
"scalarList": true
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
extensions: {},
|
|
81
|
+
meta: {},
|
|
82
|
+
_generated: {
|
|
83
|
+
"warning": "⚠️ GENERATED FILE - DO NOT EDIT",
|
|
84
|
+
"message": "This file is automatically generated by \"prisma-next contract emit\".",
|
|
85
|
+
"regenerate": "To regenerate, run: prisma-next contract emit"
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Static names and identifiers used across pgvector's contract space.
|
|
90
|
+
*
|
|
91
|
+
* Centralised here so the contract IR (`./contract`), the baseline
|
|
92
|
+
* migration ops (`./migrations`), the head ref, and the descriptor
|
|
93
|
+
* (`../exports/control`) all reference the same values without typos.
|
|
94
|
+
*
|
|
95
|
+
* The space identifier `'pgvector'` is what the framework writes to
|
|
96
|
+
* `migrations/` in the user's repo and what the marker table's
|
|
97
|
+
* `space` column carries for pgvector-owned rows.
|
|
98
|
+
*
|
|
99
|
+
* The `pgvector:*` invariantId namespace is locked here — once
|
|
100
|
+
* published, an invariantId is immutable so downstream consumers can
|
|
101
|
+
* reference it by literal string match.
|
|
102
|
+
*/
|
|
103
|
+
const PGVECTOR_SPACE_ID = "pgvector";
|
|
104
|
+
const PGVECTOR_CODEC_ID = "pg/vector@1";
|
|
105
|
+
const BASELINE_DIR_NAME = "20260601T0000_install_vector_extension";
|
|
106
|
+
function buildVectorIdentityValue(typeParams) {
|
|
107
|
+
const length = typeParams?.["length"];
|
|
108
|
+
if (typeof length !== "number" || !Number.isInteger(length) || length <= 0) return null;
|
|
109
|
+
return `'${`[${new Array(length).fill("0").join(",")}]`}'::vector`;
|
|
110
|
+
}
|
|
111
|
+
const vectorControlPlaneHooks = {
|
|
112
|
+
expandNativeType: ({ nativeType, typeParams }) => {
|
|
113
|
+
const length = typeParams?.["length"];
|
|
114
|
+
if (typeof length === "number" && Number.isInteger(length) && length > 0) return `${nativeType}(${length})`;
|
|
115
|
+
return nativeType;
|
|
116
|
+
},
|
|
117
|
+
resolveIdentityValue: ({ typeParams }) => buildVectorIdentityValue(typeParams)
|
|
118
|
+
};
|
|
119
|
+
const pgvectorContractSpace = contractSpaceFromJson({
|
|
120
|
+
contractJson: contract_default,
|
|
121
|
+
migrations: [{
|
|
122
|
+
dirName: BASELINE_DIR_NAME,
|
|
123
|
+
metadata: migration_default,
|
|
124
|
+
ops: ops_default
|
|
125
|
+
}],
|
|
126
|
+
headRef: head_default
|
|
127
|
+
});
|
|
128
|
+
const pgvectorExtensionDescriptor = {
|
|
129
|
+
...pgvectorPackMeta,
|
|
130
|
+
id: PGVECTOR_SPACE_ID,
|
|
131
|
+
contractSpace: pgvectorContractSpace,
|
|
132
|
+
types: {
|
|
133
|
+
...pgvectorPackMeta.types,
|
|
134
|
+
codecTypes: {
|
|
135
|
+
...pgvectorPackMeta.types.codecTypes,
|
|
136
|
+
controlPlaneHooks: { [PGVECTOR_CODEC_ID]: vectorControlPlaneHooks }
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
queryOperations: () => pgvectorQueryOperations(),
|
|
140
|
+
create: () => ({
|
|
141
|
+
familyId: "sql",
|
|
142
|
+
targetId: "postgres"
|
|
143
|
+
})
|
|
144
|
+
};
|
|
145
|
+
//#endregion
|
|
146
|
+
export { pgvectorExtensionDescriptor as default, pgvectorExtensionDescriptor };
|
|
147
|
+
|
|
148
|
+
//# sourceMappingURL=control.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control.mjs","names":[],"sources":["../../../../3-extensions/pgvector/dist/control.mjs"],"sourcesContent":["import { n as pgvectorQueryOperations, t as pgvectorPackMeta } from \"./descriptor-meta-Dk8eTHcA.mjs\";\nimport { contractSpaceFromJson } from \"@internal/migration-tools/spaces\";\n//#region migrations/20260601T0000_install_vector_extension/migration.json\nvar migration_default = {\n\tfrom: null,\n\tto: \"3d2c56a2944685bd21b05bc8a8d73164397df51c014201902932fbe7e80ff1b8\",\n\tprovidedInvariants: [\"pgvector:install-vector-v1\"],\n\tcreatedAt: \"2026-06-01T00:00:00.000Z\",\n\tmigrationHash: \"12b0b77e65c4899ba04e88ed040b1cb3390b4b18a889460f8a83cb6047ff1fa5\"\n};\n//#endregion\n//#region migrations/20260601T0000_install_vector_extension/ops.json\nvar ops_default = [{\n\t\"id\": \"pgvector.install-vector-extension\",\n\t\"label\": \"Enable extension \\\"vector\\\"\",\n\t\"operationClass\": \"additive\",\n\t\"invariantId\": \"pgvector:install-vector-v1\",\n\t\"target\": {\n\t\t\"id\": \"postgres\",\n\t\t\"details\": {\n\t\t\t\"schema\": \"public\",\n\t\t\t\"objectType\": \"dependency\",\n\t\t\t\"name\": \"vector\"\n\t\t}\n\t},\n\t\"precheck\": [{\n\t\t\"description\": \"verify extension \\\"vector\\\" is not already enabled\",\n\t\t\"sql\": \"SELECT NOT EXISTS (SELECT 1 AS \\\"one\\\" FROM \\\"pg_extension\\\" WHERE \\\"extname\\\" = $1) AS \\\"result\\\"\",\n\t\t\"params\": [\"vector\"]\n\t}],\n\t\"execute\": [{\n\t\t\"description\": \"create extension \\\"vector\\\"\",\n\t\t\"sql\": \"CREATE EXTENSION IF NOT EXISTS vector\"\n\t}],\n\t\"postcheck\": [{\n\t\t\"description\": \"confirm extension \\\"vector\\\" is enabled\",\n\t\t\"sql\": \"SELECT EXISTS (SELECT 1 AS \\\"one\\\" FROM \\\"pg_extension\\\" WHERE \\\"extname\\\" = $1) AS \\\"result\\\"\",\n\t\t\"params\": [\"vector\"]\n\t}]\n}];\n//#endregion\n//#region migrations/refs/head.json\nvar head_default = {\n\thash: \"3d2c56a2944685bd21b05bc8a8d73164397df51c014201902932fbe7e80ff1b8\",\n\tinvariants: [\"pgvector:install-vector-v1\"]\n};\n//#endregion\n//#region src/contract.json\nvar contract_default = {\n\tschemaVersion: \"1\",\n\ttargetFamily: \"sql\",\n\ttarget: \"postgres\",\n\tprofileHash: \"3916f444a8a17ad749191acf9e08dad97d1a327b88c2f1d45d12f240296aa8b2\",\n\troots: {},\n\tdomain: { \"namespaces\": { \"public\": { \"models\": {} } } },\n\tstorage: {\n\t\t\"namespaces\": { \"public\": {\n\t\t\t\"entries\": { \"table\": {} },\n\t\t\t\"id\": \"public\",\n\t\t\t\"kind\": \"postgres-schema\"\n\t\t} },\n\t\t\"storageHash\": \"3d2c56a2944685bd21b05bc8a8d73164397df51c014201902932fbe7e80ff1b8\",\n\t\t\"types\": { \"vector\": {\n\t\t\t\"codecId\": \"pg/vector@1\",\n\t\t\t\"kind\": \"codec-instance\",\n\t\t\t\"nativeType\": \"vector\"\n\t\t} }\n\t},\n\tcapabilities: {\n\t\t\"postgres\": {\n\t\t\t\"distinctOn\": true,\n\t\t\t\"jsonAgg\": true,\n\t\t\t\"lateral\": true,\n\t\t\t\"limit\": true,\n\t\t\t\"orderBy\": true,\n\t\t\t\"returning\": true\n\t\t},\n\t\t\"sql\": {\n\t\t\t\"defaultInInsert\": true,\n\t\t\t\"enums\": true,\n\t\t\t\"lateral\": true,\n\t\t\t\"returning\": true,\n\t\t\t\"scalarList\": true\n\t\t}\n\t},\n\textensions: {},\n\tmeta: {},\n\t_generated: {\n\t\t\"warning\": \"⚠️ GENERATED FILE - DO NOT EDIT\",\n\t\t\"message\": \"This file is automatically generated by \\\"prisma-next contract emit\\\".\",\n\t\t\"regenerate\": \"To regenerate, run: prisma-next contract emit\"\n\t}\n};\n//#endregion\n//#region src/core/contract-space-constants.ts\n/**\n* Static names and identifiers used across pgvector's contract space.\n*\n* Centralised here so the contract IR (`./contract`), the baseline\n* migration ops (`./migrations`), the head ref, and the descriptor\n* (`../exports/control`) all reference the same values without typos.\n*\n* The space identifier `'pgvector'` is what the framework writes to\n* `migrations/` in the user's repo and what the marker table's\n* `space` column carries for pgvector-owned rows.\n*\n* The `pgvector:*` invariantId namespace is locked here — once\n* published, an invariantId is immutable so downstream consumers can\n* reference it by literal string match.\n*/\nconst PGVECTOR_SPACE_ID = \"pgvector\";\n//#endregion\n//#region src/exports/control.ts\nconst PGVECTOR_CODEC_ID = \"pg/vector@1\";\nconst BASELINE_DIR_NAME = \"20260601T0000_install_vector_extension\";\nfunction buildVectorIdentityValue(typeParams) {\n\tconst length = typeParams?.[\"length\"];\n\tif (typeof length !== \"number\" || !Number.isInteger(length) || length <= 0) return null;\n\treturn `'${`[${new Array(length).fill(\"0\").join(\",\")}]`}'::vector`;\n}\nconst vectorControlPlaneHooks = {\n\texpandNativeType: ({ nativeType, typeParams }) => {\n\t\tconst length = typeParams?.[\"length\"];\n\t\tif (typeof length === \"number\" && Number.isInteger(length) && length > 0) return `${nativeType}(${length})`;\n\t\treturn nativeType;\n\t},\n\tresolveIdentityValue: ({ typeParams }) => buildVectorIdentityValue(typeParams)\n};\nconst pgvectorContractSpace = contractSpaceFromJson({\n\tcontractJson: contract_default,\n\tmigrations: [{\n\t\tdirName: BASELINE_DIR_NAME,\n\t\tmetadata: migration_default,\n\t\tops: ops_default\n\t}],\n\theadRef: head_default\n});\nconst pgvectorExtensionDescriptor = {\n\t...pgvectorPackMeta,\n\tid: PGVECTOR_SPACE_ID,\n\tcontractSpace: pgvectorContractSpace,\n\ttypes: {\n\t\t...pgvectorPackMeta.types,\n\t\tcodecTypes: {\n\t\t\t...pgvectorPackMeta.types.codecTypes,\n\t\t\tcontrolPlaneHooks: { [PGVECTOR_CODEC_ID]: vectorControlPlaneHooks }\n\t\t}\n\t},\n\tqueryOperations: () => pgvectorQueryOperations(),\n\tcreate: () => ({\n\t\tfamilyId: \"sql\",\n\t\ttargetId: \"postgres\"\n\t})\n};\n//#endregion\nexport { pgvectorExtensionDescriptor as default, pgvectorExtensionDescriptor };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;AAGA,IAAI,oBAAoB;CACvB,MAAM;CACN,IAAI;CACJ,oBAAoB,CAAC,4BAA4B;CACjD,WAAW;CACX,eAAe;AAChB;AAGA,IAAI,cAAc,CAAC;CAClB,MAAM;CACN,SAAS;CACT,kBAAkB;CAClB,eAAe;CACf,UAAU;EACT,MAAM;EACN,WAAW;GACV,UAAU;GACV,cAAc;GACd,QAAQ;EACT;CACD;CACA,YAAY,CAAC;EACZ,eAAe;EACf,OAAO;EACP,UAAU,CAAC,QAAQ;CACpB,CAAC;CACD,WAAW,CAAC;EACX,eAAe;EACf,OAAO;CACR,CAAC;CACD,aAAa,CAAC;EACb,eAAe;EACf,OAAO;EACP,UAAU,CAAC,QAAQ;CACpB,CAAC;AACF,CAAC;AAGD,IAAI,eAAe;CAClB,MAAM;CACN,YAAY,CAAC,4BAA4B;AAC1C;AAGA,IAAI,mBAAmB;CACtB,eAAe;CACf,cAAc;CACd,QAAQ;CACR,aAAa;CACb,OAAO,CAAC;CACR,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,CAAC,EAAE,EAAE,EAAE;CACvD,SAAS;EACR,cAAc,EAAE,UAAU;GACzB,WAAW,EAAE,SAAS,CAAC,EAAE;GACzB,MAAM;GACN,QAAQ;EACT,EAAE;EACF,eAAe;EACf,SAAS,EAAE,UAAU;GACpB,WAAW;GACX,QAAQ;GACR,cAAc;EACf,EAAE;CACH;CACA,cAAc;EACb,YAAY;GACX,cAAc;GACd,WAAW;GACX,WAAW;GACX,SAAS;GACT,WAAW;GACX,aAAa;EACd;EACA,OAAO;GACN,mBAAmB;GACnB,SAAS;GACT,WAAW;GACX,aAAa;GACb,cAAc;EACf;CACD;CACA,YAAY,CAAC;CACb,MAAM,CAAC;CACP,YAAY;EACX,WAAW;EACX,WAAW;EACX,cAAc;CACf;AACD;;;;;;;;;;;;;;;;AAkBA,MAAM,oBAAoB;AAG1B,MAAM,oBAAoB;AAC1B,MAAM,oBAAoB;AAC1B,SAAS,yBAAyB,YAAY;CAC7C,MAAM,SAAS,aAAa;CAC5B,IAAI,OAAO,WAAW,YAAY,CAAC,OAAO,UAAU,MAAM,KAAK,UAAU,GAAG,OAAO;CACnF,OAAO,IAAI,IAAI,IAAI,MAAM,MAAM,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,GAAG;AACzD;AACA,MAAM,0BAA0B;CAC/B,mBAAmB,EAAE,YAAY,iBAAiB;EACjD,MAAM,SAAS,aAAa;EAC5B,IAAI,OAAO,WAAW,YAAY,OAAO,UAAU,MAAM,KAAK,SAAS,GAAG,OAAO,GAAG,WAAW,GAAG,OAAO;EACzG,OAAO;CACR;CACA,uBAAuB,EAAE,iBAAiB,yBAAyB,UAAU;AAC9E;AACA,MAAM,wBAAwB,sBAAsB;CACnD,cAAc;CACd,YAAY,CAAC;EACZ,SAAS;EACT,UAAU;EACV,KAAK;CACN,CAAC;CACD,SAAS;AACV,CAAC;AACD,MAAM,8BAA8B;CACnC,GAAG;CACH,IAAI;CACJ,eAAe;CACf,OAAO;EACN,GAAG,iBAAiB;EACpB,YAAY;GACX,GAAG,iBAAiB,MAAM;GAC1B,mBAAmB,GAAG,oBAAoB,wBAAwB;EACnE;CACD;CACA,uBAAuB,wBAAwB;CAC/C,eAAe;EACd,UAAU;EACV,UAAU;CACX;AACD"}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { n as VECTOR_MAX_DIM, r as pgVectorError, t as VECTOR_CODEC_ID } from "./errors-9-gSu3kD-Vg4apMXQ.mjs";
|
|
2
|
+
import { buildOperation, codecOf, toExpr } from "@prisma/orm-family-sql/relational-core/expression";
|
|
3
|
+
import { buildCodecDescriptorRegistry } from "@prisma/orm-family-sql/relational-core/codec-descriptor-registry";
|
|
4
|
+
import { CodecImpl } from "@prisma/orm-framework/components/codec";
|
|
5
|
+
import { CastExpr, FunctionCallExpr } from "@prisma/orm-family-sql/relational-core/ast";
|
|
6
|
+
import { PostgresCodecDescriptor, definePostgresCodecs } from "@prisma/orm-target-postgres/target/codec-descriptor";
|
|
7
|
+
import { type } from "arktype";
|
|
8
|
+
//#region ../../../3-extensions/pgvector/dist/descriptor-meta-Dk8eTHcA.mjs
|
|
9
|
+
const pgvectorAuthoringTypes = { pgvector: { Vector: {
|
|
10
|
+
kind: "typeConstructor",
|
|
11
|
+
args: [{
|
|
12
|
+
kind: "number",
|
|
13
|
+
name: "length",
|
|
14
|
+
integer: true,
|
|
15
|
+
minimum: 1,
|
|
16
|
+
maximum: VECTOR_MAX_DIM
|
|
17
|
+
}],
|
|
18
|
+
output: {
|
|
19
|
+
codecId: "pg/vector@1",
|
|
20
|
+
nativeType: "vector",
|
|
21
|
+
typeParams: { length: {
|
|
22
|
+
kind: "arg",
|
|
23
|
+
index: 0
|
|
24
|
+
} }
|
|
25
|
+
}
|
|
26
|
+
} } };
|
|
27
|
+
const vectorParamsSchema = type({ length: "number" }).narrow((params, ctx) => {
|
|
28
|
+
const { length } = params;
|
|
29
|
+
if (!Number.isInteger(length)) return ctx.mustBe("an integer");
|
|
30
|
+
if (length < 1 || length > 16e3) return ctx.mustBe(`in the range [1, ${VECTOR_MAX_DIM}]`);
|
|
31
|
+
return true;
|
|
32
|
+
});
|
|
33
|
+
const PG_VECTOR_NATIVE_TYPE = "vector";
|
|
34
|
+
function parseVector(value) {
|
|
35
|
+
if (!value.startsWith("[") || !value.endsWith("]")) throw pgVectorError("RUNTIME.DECODE_FAILED", `Invalid vector format: expected "[...]", got "${value}"`, {
|
|
36
|
+
why: "The database returned a vector value that is not in the PostgreSQL \"[x,y,z]\" text format.",
|
|
37
|
+
meta: {
|
|
38
|
+
codecId: VECTOR_CODEC_ID,
|
|
39
|
+
wirePreview: value
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
const content = value.slice(1, -1).trim();
|
|
43
|
+
return content === "" ? [] : content.split(",").map((entry) => {
|
|
44
|
+
const number = Number.parseFloat(entry.trim());
|
|
45
|
+
if (Number.isNaN(number)) throw pgVectorError("RUNTIME.DECODE_FAILED", `Invalid vector value: "${entry}" is not a number`, {
|
|
46
|
+
why: "A vector entry returned by the database could not be parsed as a number.",
|
|
47
|
+
meta: {
|
|
48
|
+
codecId: VECTOR_CODEC_ID,
|
|
49
|
+
wirePreview: value
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
return number;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
var PgVectorCodec = class extends CodecImpl {
|
|
56
|
+
length;
|
|
57
|
+
constructor(descriptor, length) {
|
|
58
|
+
super(descriptor);
|
|
59
|
+
this.length = length;
|
|
60
|
+
}
|
|
61
|
+
assertVector(value, code) {
|
|
62
|
+
const meta = {
|
|
63
|
+
codecId: VECTOR_CODEC_ID,
|
|
64
|
+
expectedLength: this.length
|
|
65
|
+
};
|
|
66
|
+
if (!Array.isArray(value)) throw pgVectorError(code, "Vector value must be an array of numbers", { meta });
|
|
67
|
+
for (const element of value) {
|
|
68
|
+
if (typeof element !== "number") throw pgVectorError(code, "Vector value must contain only numbers", { meta });
|
|
69
|
+
if (!Number.isFinite(element)) throw pgVectorError(code, "Vector value must contain only finite numbers", { meta });
|
|
70
|
+
}
|
|
71
|
+
if (value.length !== this.length) throw pgVectorError(code, `Vector length mismatch: expected ${this.length}, got ${value.length}`, {
|
|
72
|
+
why: `This column is declared as vector(${this.length}); every value must have exactly that many dimensions.`,
|
|
73
|
+
meta: {
|
|
74
|
+
...meta,
|
|
75
|
+
receivedLength: value.length
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
async encode(value, _ctx) {
|
|
80
|
+
this.assertVector(value, "RUNTIME.ENCODE_FAILED");
|
|
81
|
+
return `[${value.join(",")}]`;
|
|
82
|
+
}
|
|
83
|
+
async decode(wire, _ctx) {
|
|
84
|
+
if (typeof wire !== "string") throw pgVectorError("RUNTIME.DECODE_FAILED", "Vector wire value must be a string", { meta: { codecId: VECTOR_CODEC_ID } });
|
|
85
|
+
const value = parseVector(wire);
|
|
86
|
+
this.assertVector(value, "RUNTIME.DECODE_FAILED");
|
|
87
|
+
return value;
|
|
88
|
+
}
|
|
89
|
+
encodeJson(value) {
|
|
90
|
+
this.assertVector(value, "RUNTIME.ENCODE_FAILED");
|
|
91
|
+
return [...value];
|
|
92
|
+
}
|
|
93
|
+
decodeJson(json) {
|
|
94
|
+
if (!Array.isArray(json)) throw pgVectorError("RUNTIME.DECODE_FAILED", "Vector database JSON value must be an array", { meta: { codecId: VECTOR_CODEC_ID } });
|
|
95
|
+
const value = [...json];
|
|
96
|
+
this.assertVector(value, "RUNTIME.DECODE_FAILED");
|
|
97
|
+
return value;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Projects a `vector` as a JSON numeric array.
|
|
102
|
+
*
|
|
103
|
+
* A `vector` handed straight to a JSON constructor is rendered through its text
|
|
104
|
+
* output function, so it arrives as the *string* `"[1,2,3]"` rather than as an
|
|
105
|
+
* array.
|
|
106
|
+
*
|
|
107
|
+
* The route matters as much as the destination. A vector's elements are `real`,
|
|
108
|
+
* and its text form prints the shortest decimal that round-trips *as a `real`* —
|
|
109
|
+
* `0.1` for a value the application holds as `0.10000000149011612`. Reading that
|
|
110
|
+
* text back as a double therefore lands on a different number, so casting the
|
|
111
|
+
* text to `json` would lose precision the value still had. Widening each element
|
|
112
|
+
* to `float8` first keeps the exact value the `real` denotes, which is what
|
|
113
|
+
* `encodeJson` returns.
|
|
114
|
+
*/
|
|
115
|
+
const jsonArrayFromVectorElements = (expression) => FunctionCallExpr.of("array_to_json", [CastExpr.as(CastExpr.as(expression, "real[]"), "float8[]")]);
|
|
116
|
+
var PgVectorDescriptor = class extends PostgresCodecDescriptor {
|
|
117
|
+
nativeType() {
|
|
118
|
+
return PG_VECTOR_NATIVE_TYPE;
|
|
119
|
+
}
|
|
120
|
+
jsonProjection(expression) {
|
|
121
|
+
return jsonArrayFromVectorElements(expression);
|
|
122
|
+
}
|
|
123
|
+
codecId = VECTOR_CODEC_ID;
|
|
124
|
+
traits = ["equality"];
|
|
125
|
+
targetTypes = ["vector"];
|
|
126
|
+
paramsSchema = vectorParamsSchema;
|
|
127
|
+
renderOutputType(params) {
|
|
128
|
+
return `Vector<${params.length}>`;
|
|
129
|
+
}
|
|
130
|
+
factory(params) {
|
|
131
|
+
return () => new PgVectorCodec(this, params.length);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
const codecDescriptorMap = { vector: new PgVectorDescriptor() };
|
|
135
|
+
/**
|
|
136
|
+
* Registry of every codec descriptor shipped by `@internal/extension-pgvector`.
|
|
137
|
+
*
|
|
138
|
+
* Public consumer surface for the pgvector codec set. Currently a single entry (`pg/vector@1`); the registry shape stays consistent with the other codec-shipping packages so consumers don't need to special-case extensions. See ADR 208.
|
|
139
|
+
*/
|
|
140
|
+
const pgvectorCodecRegistry = buildCodecDescriptorRegistry(definePostgresCodecs(Object.values(codecDescriptorMap)));
|
|
141
|
+
const pgvectorTypeId = "pg/vector@1";
|
|
142
|
+
function pgvectorQueryOperations() {
|
|
143
|
+
return {
|
|
144
|
+
cosineDistance: {
|
|
145
|
+
self: { codecId: pgvectorTypeId },
|
|
146
|
+
impl: (self, other) => {
|
|
147
|
+
const selfCodec = codecOf(self);
|
|
148
|
+
return buildOperation({
|
|
149
|
+
method: "cosineDistance",
|
|
150
|
+
args: [toExpr(self, selfCodec), toExpr(other, selfCodec)],
|
|
151
|
+
returns: {
|
|
152
|
+
codecId: "pg/float8@1",
|
|
153
|
+
nullable: false
|
|
154
|
+
},
|
|
155
|
+
lowering: {
|
|
156
|
+
targetFamily: "sql",
|
|
157
|
+
strategy: "function",
|
|
158
|
+
template: "{{self}} <=> {{arg0}}"
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
cosineSimilarity: {
|
|
164
|
+
self: { codecId: pgvectorTypeId },
|
|
165
|
+
impl: (self, other) => {
|
|
166
|
+
const selfCodec = codecOf(self);
|
|
167
|
+
return buildOperation({
|
|
168
|
+
method: "cosineSimilarity",
|
|
169
|
+
args: [toExpr(self, selfCodec), toExpr(other, selfCodec)],
|
|
170
|
+
returns: {
|
|
171
|
+
codecId: "pg/float8@1",
|
|
172
|
+
nullable: false
|
|
173
|
+
},
|
|
174
|
+
lowering: {
|
|
175
|
+
targetFamily: "sql",
|
|
176
|
+
strategy: "function",
|
|
177
|
+
template: "1 - ({{self}} <=> {{arg0}})"
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
const pgvectorPackMeta = {
|
|
185
|
+
kind: "extension",
|
|
186
|
+
id: "pgvector",
|
|
187
|
+
familyId: "sql",
|
|
188
|
+
targetId: "postgres",
|
|
189
|
+
version: "0.0.1",
|
|
190
|
+
capabilities: { postgres: { "pgvector.cosine": true } },
|
|
191
|
+
authoring: { type: pgvectorAuthoringTypes },
|
|
192
|
+
types: {
|
|
193
|
+
codecTypes: {
|
|
194
|
+
codecDescriptors: Array.from(pgvectorCodecRegistry.values()),
|
|
195
|
+
import: {
|
|
196
|
+
package: "@internal/extension-pgvector/codec-types",
|
|
197
|
+
named: "CodecTypes",
|
|
198
|
+
alias: "PgVectorTypes"
|
|
199
|
+
},
|
|
200
|
+
typeImports: [{
|
|
201
|
+
package: "@internal/extension-pgvector/codec-types",
|
|
202
|
+
named: "Vector",
|
|
203
|
+
alias: "Vector"
|
|
204
|
+
}]
|
|
205
|
+
},
|
|
206
|
+
operationTypes: { import: {
|
|
207
|
+
package: "@internal/extension-pgvector/operation-types",
|
|
208
|
+
named: "OperationTypes",
|
|
209
|
+
alias: "PgVectorOperationTypes"
|
|
210
|
+
} },
|
|
211
|
+
queryOperationTypes: { import: {
|
|
212
|
+
package: "@internal/extension-pgvector/operation-types",
|
|
213
|
+
named: "QueryOperationTypes",
|
|
214
|
+
alias: "PgVectorQueryOperationTypes"
|
|
215
|
+
} },
|
|
216
|
+
storage: [{
|
|
217
|
+
typeId: pgvectorTypeId,
|
|
218
|
+
familyId: "sql",
|
|
219
|
+
targetId: "postgres",
|
|
220
|
+
nativeType: "vector"
|
|
221
|
+
}]
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
//#endregion
|
|
225
|
+
export { pgvectorPackMeta as n, pgvectorQueryOperations as r, pgvectorCodecRegistry as t };
|
|
226
|
+
|
|
227
|
+
//# sourceMappingURL=descriptor-meta-Dk8eTHcA-DeyZ_87T.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptor-meta-Dk8eTHcA-DeyZ_87T.mjs","names":[],"sources":["../../../../3-extensions/pgvector/dist/descriptor-meta-Dk8eTHcA.mjs"],"sourcesContent":["import { n as VECTOR_CODEC_ID, r as VECTOR_MAX_DIM, t as pgVectorError } from \"./errors-9-gSu3kD.mjs\";\nimport { buildOperation, codecOf, toExpr } from \"@internal/sql-relational-core/expression\";\nimport { buildCodecDescriptorRegistry } from \"@internal/sql-relational-core/codec-descriptor-registry\";\nimport { CodecImpl } from \"@internal/framework-components/codec\";\nimport { CastExpr, FunctionCallExpr } from \"@internal/sql-relational-core/ast\";\nimport { PostgresCodecDescriptor, definePostgresCodecs } from \"@internal/target-postgres/codec-descriptor\";\nimport { type } from \"arktype\";\n//#region src/core/authoring.ts\nconst pgvectorAuthoringTypes = { pgvector: { Vector: {\n\tkind: \"typeConstructor\",\n\targs: [{\n\t\tkind: \"number\",\n\t\tname: \"length\",\n\t\tinteger: true,\n\t\tminimum: 1,\n\t\tmaximum: VECTOR_MAX_DIM\n\t}],\n\toutput: {\n\t\tcodecId: \"pg/vector@1\",\n\t\tnativeType: \"vector\",\n\t\ttypeParams: { length: {\n\t\t\tkind: \"arg\",\n\t\t\tindex: 0\n\t\t} }\n\t}\n} } };\n//#endregion\n//#region src/core/codecs.ts\nconst vectorParamsSchema = type({ length: \"number\" }).narrow((params, ctx) => {\n\tconst { length } = params;\n\tif (!Number.isInteger(length)) return ctx.mustBe(\"an integer\");\n\tif (length < 1 || length > 16e3) return ctx.mustBe(`in the range [1, ${VECTOR_MAX_DIM}]`);\n\treturn true;\n});\nconst PG_VECTOR_NATIVE_TYPE = \"vector\";\nfunction parseVector(value) {\n\tif (!value.startsWith(\"[\") || !value.endsWith(\"]\")) throw pgVectorError(\"RUNTIME.DECODE_FAILED\", `Invalid vector format: expected \"[...]\", got \"${value}\"`, {\n\t\twhy: \"The database returned a vector value that is not in the PostgreSQL \\\"[x,y,z]\\\" text format.\",\n\t\tmeta: {\n\t\t\tcodecId: VECTOR_CODEC_ID,\n\t\t\twirePreview: value\n\t\t}\n\t});\n\tconst content = value.slice(1, -1).trim();\n\treturn content === \"\" ? [] : content.split(\",\").map((entry) => {\n\t\tconst number = Number.parseFloat(entry.trim());\n\t\tif (Number.isNaN(number)) throw pgVectorError(\"RUNTIME.DECODE_FAILED\", `Invalid vector value: \"${entry}\" is not a number`, {\n\t\t\twhy: \"A vector entry returned by the database could not be parsed as a number.\",\n\t\t\tmeta: {\n\t\t\t\tcodecId: VECTOR_CODEC_ID,\n\t\t\t\twirePreview: value\n\t\t\t}\n\t\t});\n\t\treturn number;\n\t});\n}\nvar PgVectorCodec = class extends CodecImpl {\n\tlength;\n\tconstructor(descriptor, length) {\n\t\tsuper(descriptor);\n\t\tthis.length = length;\n\t}\n\tassertVector(value, code) {\n\t\tconst meta = {\n\t\t\tcodecId: VECTOR_CODEC_ID,\n\t\t\texpectedLength: this.length\n\t\t};\n\t\tif (!Array.isArray(value)) throw pgVectorError(code, \"Vector value must be an array of numbers\", { meta });\n\t\tfor (const element of value) {\n\t\t\tif (typeof element !== \"number\") throw pgVectorError(code, \"Vector value must contain only numbers\", { meta });\n\t\t\tif (!Number.isFinite(element)) throw pgVectorError(code, \"Vector value must contain only finite numbers\", { meta });\n\t\t}\n\t\tif (value.length !== this.length) throw pgVectorError(code, `Vector length mismatch: expected ${this.length}, got ${value.length}`, {\n\t\t\twhy: `This column is declared as vector(${this.length}); every value must have exactly that many dimensions.`,\n\t\t\tmeta: {\n\t\t\t\t...meta,\n\t\t\t\treceivedLength: value.length\n\t\t\t}\n\t\t});\n\t}\n\tasync encode(value, _ctx) {\n\t\tthis.assertVector(value, \"RUNTIME.ENCODE_FAILED\");\n\t\treturn `[${value.join(\",\")}]`;\n\t}\n\tasync decode(wire, _ctx) {\n\t\tif (typeof wire !== \"string\") throw pgVectorError(\"RUNTIME.DECODE_FAILED\", \"Vector wire value must be a string\", { meta: { codecId: VECTOR_CODEC_ID } });\n\t\tconst value = parseVector(wire);\n\t\tthis.assertVector(value, \"RUNTIME.DECODE_FAILED\");\n\t\treturn value;\n\t}\n\tencodeJson(value) {\n\t\tthis.assertVector(value, \"RUNTIME.ENCODE_FAILED\");\n\t\treturn [...value];\n\t}\n\tdecodeJson(json) {\n\t\tif (!Array.isArray(json)) throw pgVectorError(\"RUNTIME.DECODE_FAILED\", \"Vector database JSON value must be an array\", { meta: { codecId: VECTOR_CODEC_ID } });\n\t\tconst value = [...json];\n\t\tthis.assertVector(value, \"RUNTIME.DECODE_FAILED\");\n\t\treturn value;\n\t}\n};\n/**\n* Projects a `vector` as a JSON numeric array.\n*\n* A `vector` handed straight to a JSON constructor is rendered through its text\n* output function, so it arrives as the *string* `\"[1,2,3]\"` rather than as an\n* array.\n*\n* The route matters as much as the destination. A vector's elements are `real`,\n* and its text form prints the shortest decimal that round-trips *as a `real`* —\n* `0.1` for a value the application holds as `0.10000000149011612`. Reading that\n* text back as a double therefore lands on a different number, so casting the\n* text to `json` would lose precision the value still had. Widening each element\n* to `float8` first keeps the exact value the `real` denotes, which is what\n* `encodeJson` returns.\n*/\nconst jsonArrayFromVectorElements = (expression) => FunctionCallExpr.of(\"array_to_json\", [CastExpr.as(CastExpr.as(expression, \"real[]\"), \"float8[]\")]);\nvar PgVectorDescriptor = class extends PostgresCodecDescriptor {\n\tnativeType() {\n\t\treturn PG_VECTOR_NATIVE_TYPE;\n\t}\n\tjsonProjection(expression) {\n\t\treturn jsonArrayFromVectorElements(expression);\n\t}\n\tcodecId = VECTOR_CODEC_ID;\n\ttraits = [\"equality\"];\n\ttargetTypes = [\"vector\"];\n\tparamsSchema = vectorParamsSchema;\n\trenderOutputType(params) {\n\t\treturn `Vector<${params.length}>`;\n\t}\n\tfactory(params) {\n\t\treturn () => new PgVectorCodec(this, params.length);\n\t}\n};\nconst codecDescriptorMap = { vector: new PgVectorDescriptor() };\n//#endregion\n//#region src/core/registry.ts\n/**\n* Registry of every codec descriptor shipped by `@internal/extension-pgvector`.\n*\n* Public consumer surface for the pgvector codec set. Currently a single entry (`pg/vector@1`); the registry shape stays consistent with the other codec-shipping packages so consumers don't need to special-case extensions. See ADR 208.\n*/\nconst pgvectorCodecRegistry = buildCodecDescriptorRegistry(definePostgresCodecs(Object.values(codecDescriptorMap)));\n//#endregion\n//#region src/core/descriptor-meta.ts\nconst pgvectorTypeId = \"pg/vector@1\";\nfunction pgvectorQueryOperations() {\n\treturn {\n\t\tcosineDistance: {\n\t\t\tself: { codecId: pgvectorTypeId },\n\t\t\timpl: (self, other) => {\n\t\t\t\tconst selfCodec = codecOf(self);\n\t\t\t\treturn buildOperation({\n\t\t\t\t\tmethod: \"cosineDistance\",\n\t\t\t\t\targs: [toExpr(self, selfCodec), toExpr(other, selfCodec)],\n\t\t\t\t\treturns: {\n\t\t\t\t\t\tcodecId: \"pg/float8@1\",\n\t\t\t\t\t\tnullable: false\n\t\t\t\t\t},\n\t\t\t\t\tlowering: {\n\t\t\t\t\t\ttargetFamily: \"sql\",\n\t\t\t\t\t\tstrategy: \"function\",\n\t\t\t\t\t\ttemplate: \"{{self}} <=> {{arg0}}\"\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tcosineSimilarity: {\n\t\t\tself: { codecId: pgvectorTypeId },\n\t\t\timpl: (self, other) => {\n\t\t\t\tconst selfCodec = codecOf(self);\n\t\t\t\treturn buildOperation({\n\t\t\t\t\tmethod: \"cosineSimilarity\",\n\t\t\t\t\targs: [toExpr(self, selfCodec), toExpr(other, selfCodec)],\n\t\t\t\t\treturns: {\n\t\t\t\t\t\tcodecId: \"pg/float8@1\",\n\t\t\t\t\t\tnullable: false\n\t\t\t\t\t},\n\t\t\t\t\tlowering: {\n\t\t\t\t\t\ttargetFamily: \"sql\",\n\t\t\t\t\t\tstrategy: \"function\",\n\t\t\t\t\t\ttemplate: \"1 - ({{self}} <=> {{arg0}})\"\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t};\n}\nconst pgvectorPackMeta = {\n\tkind: \"extension\",\n\tid: \"pgvector\",\n\tfamilyId: \"sql\",\n\ttargetId: \"postgres\",\n\tversion: \"0.0.1\",\n\tcapabilities: { postgres: { \"pgvector.cosine\": true } },\n\tauthoring: { type: pgvectorAuthoringTypes },\n\ttypes: {\n\t\tcodecTypes: {\n\t\t\tcodecDescriptors: Array.from(pgvectorCodecRegistry.values()),\n\t\t\timport: {\n\t\t\t\tpackage: \"@internal/extension-pgvector/codec-types\",\n\t\t\t\tnamed: \"CodecTypes\",\n\t\t\t\talias: \"PgVectorTypes\"\n\t\t\t},\n\t\t\ttypeImports: [{\n\t\t\t\tpackage: \"@internal/extension-pgvector/codec-types\",\n\t\t\t\tnamed: \"Vector\",\n\t\t\t\talias: \"Vector\"\n\t\t\t}]\n\t\t},\n\t\toperationTypes: { import: {\n\t\t\tpackage: \"@internal/extension-pgvector/operation-types\",\n\t\t\tnamed: \"OperationTypes\",\n\t\t\talias: \"PgVectorOperationTypes\"\n\t\t} },\n\t\tqueryOperationTypes: { import: {\n\t\t\tpackage: \"@internal/extension-pgvector/operation-types\",\n\t\t\tnamed: \"QueryOperationTypes\",\n\t\t\talias: \"PgVectorQueryOperationTypes\"\n\t\t} },\n\t\tstorage: [{\n\t\t\ttypeId: pgvectorTypeId,\n\t\t\tfamilyId: \"sql\",\n\t\t\ttargetId: \"postgres\",\n\t\t\tnativeType: \"vector\"\n\t\t}]\n\t}\n};\n//#endregion\nexport { pgvectorQueryOperations as n, pgvectorCodecRegistry as r, pgvectorPackMeta as t };\n\n//# sourceMappingURL=descriptor-meta-Dk8eTHcA.mjs.map"],"mappings":"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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { structuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
2
|
+
//#region ../../../3-extensions/pgvector/dist/errors-9-gSu3kD.mjs
|
|
3
|
+
/**
|
|
4
|
+
* Codec ID for pgvector's vector type.
|
|
5
|
+
*/
|
|
6
|
+
const VECTOR_CODEC_ID = "pg/vector@1";
|
|
7
|
+
/**
|
|
8
|
+
* Maximum dimension for pgvector vectors (VECTOR_MAX_DIM from pgvector).
|
|
9
|
+
*/
|
|
10
|
+
const VECTOR_MAX_DIM = 16e3;
|
|
11
|
+
function pgVectorError(code, message, options) {
|
|
12
|
+
return structuredError(code, message, options);
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { VECTOR_MAX_DIM as n, pgVectorError as r, VECTOR_CODEC_ID as t };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=errors-9-gSu3kD-Vg4apMXQ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-9-gSu3kD-Vg4apMXQ.mjs","names":[],"sources":["../../../../3-extensions/pgvector/dist/errors-9-gSu3kD.mjs"],"sourcesContent":["import { structuredError } from \"@internal/utils/structured-error\";\n//#region src/core/constants.ts\n/**\n* Codec ID for pgvector's vector type.\n*/\nconst VECTOR_CODEC_ID = \"pg/vector@1\";\n/**\n* Maximum dimension for pgvector vectors (VECTOR_MAX_DIM from pgvector).\n*/\nconst VECTOR_MAX_DIM = 16e3;\n//#endregion\n//#region src/core/errors.ts\nfunction pgVectorError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n//#endregion\nexport { VECTOR_CODEC_ID as n, VECTOR_MAX_DIM as r, pgVectorError as t };\n\n//# sourceMappingURL=errors-9-gSu3kD.mjs.map"],"mappings":";;;;;AAKA,MAAM,kBAAkB;;;;AAIxB,MAAM,iBAAiB;AAGvB,SAAS,cAAc,MAAM,SAAS,SAAS;CAC9C,OAAO,gBAAgB,MAAM,SAAS,OAAO;AAC9C"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { CodecExpression, Expression } from "@prisma/orm-family-sql/relational-core/expression";
|
|
2
|
+
import { SqlQueryOperationTypes } from "@prisma/orm-family-sql/contract/types";
|
|
3
|
+
//#region ../../../3-extensions/pgvector/dist/operation-types-D37jCdyS.d.mts
|
|
4
|
+
//#region src/types/operation-types.d.ts
|
|
5
|
+
type CodecTypesBase = Record<string, {
|
|
6
|
+
readonly input: unknown;
|
|
7
|
+
readonly output: unknown;
|
|
8
|
+
}>;
|
|
9
|
+
/**
|
|
10
|
+
* Operation type definitions for pgvector extension.
|
|
11
|
+
*
|
|
12
|
+
* This file exports type-only definitions for operation method signatures.
|
|
13
|
+
* These types are imported by contract.d.ts files for compile-time type inference.
|
|
14
|
+
*/
|
|
15
|
+
/** Flat operation signatures for the query builder. */
|
|
16
|
+
type QueryOperationTypes<CT extends CodecTypesBase> = SqlQueryOperationTypes<CT, {
|
|
17
|
+
readonly cosineDistance: {
|
|
18
|
+
readonly self: {
|
|
19
|
+
readonly codecId: 'pg/vector@1';
|
|
20
|
+
};
|
|
21
|
+
readonly impl: (self: CodecExpression<'pg/vector@1', boolean, CT>, other: CodecExpression<'pg/vector@1', boolean, CT>) => Expression<{
|
|
22
|
+
codecId: 'pg/float8@1';
|
|
23
|
+
nullable: false;
|
|
24
|
+
}>;
|
|
25
|
+
};
|
|
26
|
+
readonly cosineSimilarity: {
|
|
27
|
+
readonly self: {
|
|
28
|
+
readonly codecId: 'pg/vector@1';
|
|
29
|
+
};
|
|
30
|
+
readonly impl: (self: CodecExpression<'pg/vector@1', boolean, CT>, other: CodecExpression<'pg/vector@1', boolean, CT>) => Expression<{
|
|
31
|
+
codecId: 'pg/float8@1';
|
|
32
|
+
nullable: false;
|
|
33
|
+
}>;
|
|
34
|
+
};
|
|
35
|
+
}>;
|
|
36
|
+
//#endregion
|
|
37
|
+
export { QueryOperationTypes as t };
|
|
38
|
+
//# sourceMappingURL=operation-types-D37jCdyS-ClyVMplO.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation-types-D37jCdyS-ClyVMplO.d.mts","names":[],"sources":["../../../../3-extensions/pgvector/dist/operation-types-D37jCdyS.d.mts"],"mappings":";;;;KAGK,iBAAiB;WACX;WACA;;;;;;;;;KASN,oBAAoB,WAAW,kBAAkB,uBAAuB;WAClE;aACE;eACE;;aAEF,OAAO,MAAM,wCAAwC,KAAK,OAAO,wCAAwC,QAAQ;MACxH;MACA;;;WAGK;aACE;eACE;;aAEF,OAAO,MAAM,wCAAwC,KAAK,OAAO,wCAAwC,QAAQ;MACxH;MACA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/pack.d.mts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { t as CodecTypes } from "./codec-types-BFcjjrT--s4MwG0qH.mjs";
|
|
2
|
+
import "./operation-types-D37jCdyS-ClyVMplO.mjs";
|
|
3
|
+
//#region ../../../3-extensions/pgvector/dist/pack.d.mts
|
|
4
|
+
//#region src/core/descriptor-meta.d.ts
|
|
5
|
+
declare const pgvectorPackMetaBase: {
|
|
6
|
+
readonly kind: "extension";
|
|
7
|
+
readonly id: "pgvector";
|
|
8
|
+
readonly familyId: "sql";
|
|
9
|
+
readonly targetId: "postgres";
|
|
10
|
+
readonly version: "0.0.1";
|
|
11
|
+
readonly capabilities: {
|
|
12
|
+
readonly postgres: {
|
|
13
|
+
readonly 'pgvector.cosine': true;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
readonly authoring: {
|
|
17
|
+
readonly type: {
|
|
18
|
+
readonly pgvector: {
|
|
19
|
+
readonly Vector: {
|
|
20
|
+
readonly kind: "typeConstructor";
|
|
21
|
+
readonly args: readonly [{
|
|
22
|
+
readonly kind: "number";
|
|
23
|
+
readonly name: "length";
|
|
24
|
+
readonly integer: true;
|
|
25
|
+
readonly minimum: 1;
|
|
26
|
+
readonly maximum: 16000;
|
|
27
|
+
}];
|
|
28
|
+
readonly output: {
|
|
29
|
+
readonly codecId: "pg/vector@1";
|
|
30
|
+
readonly nativeType: "vector";
|
|
31
|
+
readonly typeParams: {
|
|
32
|
+
readonly length: {
|
|
33
|
+
readonly kind: "arg";
|
|
34
|
+
readonly index: 0;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
readonly types: {
|
|
43
|
+
readonly codecTypes: {
|
|
44
|
+
readonly codecDescriptors: import("@prisma/orm-framework/components/codec").CodecDescriptor<unknown>[];
|
|
45
|
+
readonly import: {
|
|
46
|
+
readonly package: "@internal/extension-pgvector/codec-types";
|
|
47
|
+
readonly named: "CodecTypes";
|
|
48
|
+
readonly alias: "PgVectorTypes";
|
|
49
|
+
};
|
|
50
|
+
readonly typeImports: readonly [{
|
|
51
|
+
readonly package: "@internal/extension-pgvector/codec-types";
|
|
52
|
+
readonly named: "Vector";
|
|
53
|
+
readonly alias: "Vector";
|
|
54
|
+
}];
|
|
55
|
+
};
|
|
56
|
+
readonly operationTypes: {
|
|
57
|
+
readonly import: {
|
|
58
|
+
readonly package: "@internal/extension-pgvector/operation-types";
|
|
59
|
+
readonly named: "OperationTypes";
|
|
60
|
+
readonly alias: "PgVectorOperationTypes";
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
readonly queryOperationTypes: {
|
|
64
|
+
readonly import: {
|
|
65
|
+
readonly package: "@internal/extension-pgvector/operation-types";
|
|
66
|
+
readonly named: "QueryOperationTypes";
|
|
67
|
+
readonly alias: "PgVectorQueryOperationTypes";
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
readonly storage: readonly [{
|
|
71
|
+
readonly typeId: "pg/vector@1";
|
|
72
|
+
readonly familyId: "sql";
|
|
73
|
+
readonly targetId: "postgres";
|
|
74
|
+
readonly nativeType: "vector";
|
|
75
|
+
}];
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
declare const pgvectorPackMeta: typeof pgvectorPackMetaBase & {
|
|
79
|
+
readonly __codecTypes?: CodecTypes;
|
|
80
|
+
};
|
|
81
|
+
//#endregion
|
|
82
|
+
export { pgvectorPackMeta as default };
|
|
83
|
+
//# sourceMappingURL=pack.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pack.d.mts","names":[],"sources":["../../../../3-extensions/pgvector/dist/pack.d.mts"],"mappings":";;;;cAGc;WACH;WACA;WACA;WACA;WACA;WACA;aACE;eACE;;;WAGJ;aACE;eACE;iBACE;mBACE;mBACA;qBACE;qBACA;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;;;;;;;;WAQd;aACE;eACE,iEAAiE;eACjE;iBACE;iBACA;iBACA;;eAEF;iBACE;iBACA;iBACA;;;aAGJ;eACE;iBACE;iBACA;iBACA;;;aAGJ;eACE;iBACE;iBACA;iBACA;;;aAGJ;eACE;eACA;eACA;eACA;;;;cAID,yBAAyB;WAC5B,eAAe"}
|
package/dist/pack.mjs
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SqlRuntimeExtensionDescriptor } from "@prisma/orm-family-sql/runtime";
|
|
2
|
+
import { CodecDescriptorRegistry } from "@prisma/orm-family-sql/relational-core/query-lane-context";
|
|
3
|
+
//#region ../../../3-extensions/pgvector/dist/runtime.d.mts
|
|
4
|
+
//#region src/core/registry.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Registry of every codec descriptor shipped by `@internal/extension-pgvector`.
|
|
7
|
+
*
|
|
8
|
+
* Public consumer surface for the pgvector codec set. Currently a single entry (`pg/vector@1`); the registry shape stays consistent with the other codec-shipping packages so consumers don't need to special-case extensions. See ADR 208.
|
|
9
|
+
*/
|
|
10
|
+
declare const pgvectorCodecRegistry: CodecDescriptorRegistry;
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/exports/runtime.d.ts
|
|
13
|
+
declare const pgvectorRuntimeDescriptor: SqlRuntimeExtensionDescriptor<'postgres'>;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { pgvectorRuntimeDescriptor as default, pgvectorCodecRegistry };
|
|
16
|
+
//# sourceMappingURL=runtime.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.mts","names":[],"sources":["../../../../3-extensions/pgvector/dist/runtime.d.mts"],"mappings":";;;;;;;;;cAQc,uBAAuB;;;cAGvB,2BAA2B"}
|
package/dist/runtime.mjs
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { n as pgvectorPackMeta, r as pgvectorQueryOperations, t as pgvectorCodecRegistry } from "./descriptor-meta-Dk8eTHcA-DeyZ_87T.mjs";
|
|
2
|
+
//#region ../../../3-extensions/pgvector/dist/runtime.mjs
|
|
3
|
+
const pgvectorRuntimeDescriptor = {
|
|
4
|
+
kind: "extension",
|
|
5
|
+
id: pgvectorPackMeta.id,
|
|
6
|
+
version: pgvectorPackMeta.version,
|
|
7
|
+
familyId: "sql",
|
|
8
|
+
targetId: "postgres",
|
|
9
|
+
types: { codecTypes: { codecDescriptors: Array.from(pgvectorCodecRegistry.values()) } },
|
|
10
|
+
codecs: () => Array.from(pgvectorCodecRegistry.values()),
|
|
11
|
+
queryOperations: () => pgvectorQueryOperations(),
|
|
12
|
+
create() {
|
|
13
|
+
return {
|
|
14
|
+
familyId: "sql",
|
|
15
|
+
targetId: "postgres"
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
export { pgvectorRuntimeDescriptor as default, pgvectorCodecRegistry };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=runtime.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.mjs","names":[],"sources":["../../../../3-extensions/pgvector/dist/runtime.mjs"],"sourcesContent":["import { n as pgvectorQueryOperations, r as pgvectorCodecRegistry, t as pgvectorPackMeta } from \"./descriptor-meta-Dk8eTHcA.mjs\";\n//#region src/exports/runtime.ts\nconst pgvectorRuntimeDescriptor = {\n\tkind: \"extension\",\n\tid: pgvectorPackMeta.id,\n\tversion: pgvectorPackMeta.version,\n\tfamilyId: \"sql\",\n\ttargetId: \"postgres\",\n\ttypes: { codecTypes: { codecDescriptors: Array.from(pgvectorCodecRegistry.values()) } },\n\tcodecs: () => Array.from(pgvectorCodecRegistry.values()),\n\tqueryOperations: () => pgvectorQueryOperations(),\n\tcreate() {\n\t\treturn {\n\t\t\tfamilyId: \"sql\",\n\t\t\ttargetId: \"postgres\"\n\t\t};\n\t}\n};\n//#endregion\nexport { pgvectorRuntimeDescriptor as default, pgvectorCodecRegistry };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;AAEA,MAAM,4BAA4B;CACjC,MAAM;CACN,IAAI,iBAAiB;CACrB,SAAS,iBAAiB;CAC1B,UAAU;CACV,UAAU;CACV,OAAO,EAAE,YAAY,EAAE,kBAAkB,MAAM,KAAK,sBAAsB,OAAO,CAAC,EAAE,EAAE;CACtF,cAAc,MAAM,KAAK,sBAAsB,OAAO,CAAC;CACvD,uBAAuB,wBAAwB;CAC/C,SAAS;EACR,OAAO;GACN,UAAU;GACV,UAAU;EACX;CACD;AACD"}
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@prisma/orm-extension-pgvector",
|
|
3
|
+
"version": "0.16.0-dev.36",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"description": "pgvector embedding columns, distance operators, and indexes for Prisma Next",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@prisma/orm-family-sql": "0.16.0-dev.36",
|
|
13
|
+
"@prisma/orm-framework": "0.16.0-dev.36",
|
|
14
|
+
"@prisma/orm-toolchain": "0.16.0-dev.36",
|
|
15
|
+
"@standard-schema/spec": "^1.1.0",
|
|
16
|
+
"arktype": "^2.2.2"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@internal/extension-pgvector": "0.16.0-dev.36",
|
|
20
|
+
"@repo/tsconfig": "0.16.0-dev.36",
|
|
21
|
+
"@internal/publish-surface": "0.16.0-dev.36",
|
|
22
|
+
"@repo/tsdown": "0.16.0-dev.36",
|
|
23
|
+
"@prisma/orm-target-postgres": "0.16.0-dev.36",
|
|
24
|
+
"tsdown": "0.22.14",
|
|
25
|
+
"typescript": "5.9.3",
|
|
26
|
+
"vitest": "4.1.10"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"@prisma/orm-target-postgres": "0.16.0-dev.36",
|
|
30
|
+
"typescript": ">=5.9"
|
|
31
|
+
},
|
|
32
|
+
"peerDependenciesMeta": {
|
|
33
|
+
"typescript": {
|
|
34
|
+
"optional": true
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"exports": {
|
|
38
|
+
"./codec-types": "./dist/codec-types.mjs",
|
|
39
|
+
"./column-types": "./dist/column-types.mjs",
|
|
40
|
+
"./control": "./dist/control.mjs",
|
|
41
|
+
"./operation-types": "./dist/operation-types.mjs",
|
|
42
|
+
"./pack": "./dist/pack.mjs",
|
|
43
|
+
"./runtime": "./dist/runtime.mjs",
|
|
44
|
+
"./package.json": "./package.json"
|
|
45
|
+
},
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "https://github.com/prisma/prisma.git",
|
|
49
|
+
"directory": "packages/9-public/@prisma/orm-extension-pgvector"
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build": "tsdown",
|
|
53
|
+
"lint": "biome check . --error-on-warnings",
|
|
54
|
+
"clean": "rm -rf dist src-gen",
|
|
55
|
+
"test": "vitest run"
|
|
56
|
+
}
|
|
57
|
+
}
|