@vibeorm/extensions 5.0.3 → 5.1.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/index.js +12 -9
- package/dist/index.js.map +4 -4
- package/dist/search/index.js +6 -5
- package/dist/search/index.js.map +3 -3
- package/dist/trgm/index.js.map +1 -1
- package/dist/vector/index.js +7 -5
- package/dist/vector/index.js.map +3 -3
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -744,7 +744,7 @@ function createSearchDelegate(config) {
|
|
|
744
744
|
text += ` LIMIT ${take}`;
|
|
745
745
|
if (skip !== null)
|
|
746
746
|
text += ` OFFSET ${skip}`;
|
|
747
|
-
const rows = await ctx.executeRows({ text, values: collector.values, method: "search" });
|
|
747
|
+
const rows = await ctx.executeRows({ text, values: collector.values, method: "search", single: true });
|
|
748
748
|
return shapeHits({
|
|
749
749
|
rows,
|
|
750
750
|
highlightsRequested: args.highlight !== undefined,
|
|
@@ -857,22 +857,23 @@ function search(options = {}) {
|
|
|
857
857
|
const dts = pkField === null ? [
|
|
858
858
|
`readonly search: (args: {`,
|
|
859
859
|
...argLines,
|
|
860
|
-
`}) =>
|
|
860
|
+
`}) => import("@vibeorm/runtime").QueryOperation<SearchHit<${typeNames.payload}>[], "read">;`
|
|
861
861
|
] : [
|
|
862
862
|
`readonly search: {`,
|
|
863
863
|
` (args: {`,
|
|
864
864
|
...argLines.map((line) => ` ${line}`),
|
|
865
865
|
` readonly select: "id";`,
|
|
866
|
-
` }):
|
|
866
|
+
` }): import("@vibeorm/runtime").QueryOperation<SearchHit<Pick<${typeNames.payload}, ${JSON.stringify(pkField)}>>[], "read">;`,
|
|
867
867
|
` (args: {`,
|
|
868
868
|
...argLines.map((line) => ` ${line}`),
|
|
869
869
|
` readonly select?: "row";`,
|
|
870
|
-
` }):
|
|
870
|
+
` }): import("@vibeorm/runtime").QueryOperation<SearchHit<${typeNames.payload}>[], "read">;`,
|
|
871
871
|
`};`
|
|
872
872
|
];
|
|
873
873
|
return {
|
|
874
874
|
kind: "method",
|
|
875
875
|
readOnly: true,
|
|
876
|
+
lazy: true,
|
|
876
877
|
runtimeGlue: `createSearchDelegate(${JSON.stringify(config)})`,
|
|
877
878
|
imports: [{ from: "@vibeorm/extensions/search", names: ["createSearchDelegate"] }],
|
|
878
879
|
dtsImports: [{ from: "@vibeorm/extensions/search", names: ["SearchHit"] }],
|
|
@@ -1095,7 +1096,8 @@ function createVectorNamespace(config) {
|
|
|
1095
1096
|
const rows = await ctx.executeRows({
|
|
1096
1097
|
text,
|
|
1097
1098
|
values: collector.values,
|
|
1098
|
-
method: "vector.nearest"
|
|
1099
|
+
method: "vector.nearest",
|
|
1100
|
+
single: true
|
|
1099
1101
|
});
|
|
1100
1102
|
return rows.map((row) => {
|
|
1101
1103
|
const { [DISTANCE_ALIAS]: distance, ...rest } = row;
|
|
@@ -1110,7 +1112,7 @@ function createVectorNamespace(config) {
|
|
|
1110
1112
|
if (expr !== undefined)
|
|
1111
1113
|
text += ` WHERE ${renderExpr2({ dialect, expr, collector })}`;
|
|
1112
1114
|
text += ` RETURNING 1 AS ${quote("_vibe_set")}`;
|
|
1113
|
-
const rows = await ctx.executeRows({ text, values: collector.values, method: "vector.set" });
|
|
1115
|
+
const rows = await ctx.executeRows({ text, values: collector.values, method: "vector.set", single: true });
|
|
1114
1116
|
return rows.length;
|
|
1115
1117
|
}
|
|
1116
1118
|
};
|
|
@@ -1206,6 +1208,7 @@ function vector(options = {}) {
|
|
|
1206
1208
|
return {
|
|
1207
1209
|
kind: "namespace",
|
|
1208
1210
|
readOnly: ["nearest"],
|
|
1211
|
+
lazy: true,
|
|
1209
1212
|
runtimeGlue: `createVectorNamespace(${JSON.stringify(config)})`,
|
|
1210
1213
|
imports: [{ from: "@vibeorm/extensions/vector", names: ["createVectorNamespace"] }],
|
|
1211
1214
|
dtsImports: [{ from: "@vibeorm/extensions/vector", names: ["VectorHit", "VectorMetric"] }],
|
|
@@ -1218,12 +1221,12 @@ function vector(options = {}) {
|
|
|
1218
1221
|
` readonly take?: number;`,
|
|
1219
1222
|
` readonly where?: ${typeNames.whereInput};`,
|
|
1220
1223
|
` readonly maxDistance?: number;`,
|
|
1221
|
-
` }) =>
|
|
1224
|
+
` }) => import("@vibeorm/runtime").QueryOperation<VectorHit<${typeNames.payload}>[], "read">;`,
|
|
1222
1225
|
` readonly set: (args: {`,
|
|
1223
1226
|
` readonly where: ${typeNames.whereInput};`,
|
|
1224
1227
|
` readonly by: ${byUnion};`,
|
|
1225
1228
|
` readonly to: readonly number[];`,
|
|
1226
|
-
` }) =>
|
|
1229
|
+
` }) => import("@vibeorm/runtime").QueryOperation<number, "write">;`,
|
|
1227
1230
|
`};`
|
|
1228
1231
|
]
|
|
1229
1232
|
};
|
|
@@ -1425,4 +1428,4 @@ export {
|
|
|
1425
1428
|
vector
|
|
1426
1429
|
};
|
|
1427
1430
|
|
|
1428
|
-
//# debugId=
|
|
1431
|
+
//# debugId=3DC4605A479A3C7A64756E2164756E21
|