@kernl-sdk/pg 0.1.25 → 0.1.26

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.
Files changed (30) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +9 -0
  3. package/dist/__tests__/memory-integration.test.js +1 -1
  4. package/dist/pgvector/__tests__/handle.test.js +13 -13
  5. package/dist/pgvector/__tests__/integration/document.integration.test.js +21 -21
  6. package/dist/pgvector/__tests__/integration/edge.integration.test.js +32 -32
  7. package/dist/pgvector/__tests__/integration/filters.integration.test.js +5 -5
  8. package/dist/pgvector/__tests__/integration/lifecycle.integration.test.js +12 -12
  9. package/dist/pgvector/__tests__/integration/query.integration.test.d.ts +1 -1
  10. package/dist/pgvector/__tests__/integration/query.integration.test.js +51 -51
  11. package/dist/pgvector/__tests__/search.test.js +1 -1
  12. package/dist/pgvector/sql/__tests__/limit.test.js +20 -20
  13. package/dist/pgvector/sql/__tests__/query.test.js +17 -17
  14. package/dist/pgvector/sql/limit.js +2 -2
  15. package/dist/pgvector/sql/query.d.ts +1 -1
  16. package/dist/pgvector/sql/query.d.ts.map +1 -1
  17. package/dist/pgvector/sql/query.js +1 -1
  18. package/package.json +6 -6
  19. package/src/__tests__/memory-integration.test.ts +1 -1
  20. package/src/pgvector/__tests__/handle.test.ts +13 -13
  21. package/src/pgvector/__tests__/integration/document.integration.test.ts +21 -21
  22. package/src/pgvector/__tests__/integration/edge.integration.test.ts +32 -32
  23. package/src/pgvector/__tests__/integration/filters.integration.test.ts +5 -5
  24. package/src/pgvector/__tests__/integration/lifecycle.integration.test.ts +12 -12
  25. package/src/pgvector/__tests__/integration/query.integration.test.ts +51 -51
  26. package/src/pgvector/__tests__/search.test.ts +1 -1
  27. package/src/pgvector/sql/__tests__/limit.test.ts +20 -20
  28. package/src/pgvector/sql/__tests__/query.test.ts +17 -17
  29. package/src/pgvector/sql/limit.ts +2 -2
  30. package/src/pgvector/sql/query.ts +2 -2
@@ -22,7 +22,7 @@ describe("sqlize", () => {
22
22
  schema: "public",
23
23
  table: "docs",
24
24
  });
25
- expect(result.limit).toEqual({ topK: 10, offset: 0 });
25
+ expect(result.limit).toEqual({ limit: 10, offset: 0 });
26
26
  });
27
27
  it("throws on multi-signal fusion (not supported by pgvector)", () => {
28
28
  expect(() => sqlize({
@@ -55,14 +55,14 @@ describe("sqlize", () => {
55
55
  it("converts query with pagination", () => {
56
56
  const result = sqlize({
57
57
  query: [{ embedding: [0.1, 0.2] }],
58
- topK: 25,
58
+ limit: 25,
59
59
  offset: 50,
60
60
  }, { pkey: "id", schema: "public", table: "docs" });
61
- expect(result.limit).toEqual({ topK: 25, offset: 50 });
61
+ expect(result.limit).toEqual({ limit: 25, offset: 50 });
62
62
  });
63
63
  it("uses default pagination values", () => {
64
64
  const result = sqlize({ query: [{ embedding: [0.1, 0.2] }] }, { pkey: "id", schema: "public", table: "docs" });
65
- expect(result.limit).toEqual({ topK: 10, offset: 0 });
65
+ expect(result.limit).toEqual({ limit: 10, offset: 0 });
66
66
  });
67
67
  it("passes binding through to all inputs", () => {
68
68
  const binding = {
@@ -90,7 +90,7 @@ describe("sqlize", () => {
90
90
  const result = sqlize({
91
91
  filter: { status: "active" },
92
92
  orderBy: { field: "created_at", direction: "desc" },
93
- topK: 100,
93
+ limit: 100,
94
94
  }, { pkey: "id", schema: "public", table: "docs" });
95
95
  expect(result.select.signals).toEqual([]);
96
96
  expect(result.order.signals).toEqual([]);
@@ -132,7 +132,7 @@ describe("sqlize", () => {
132
132
  },
133
133
  },
134
134
  };
135
- const result = sqlize({ filter: { status: "active" }, topK: 50 }, { pkey: "id", schema: "public", table: "docs", binding });
135
+ const result = sqlize({ filter: { status: "active" }, limit: 50 }, { pkey: "id", schema: "public", table: "docs", binding });
136
136
  expect(result.select.binding).toBe(binding);
137
137
  expect(result.order.binding).toBe(binding);
138
138
  expect(result.select.signals).toEqual([]);
@@ -142,7 +142,7 @@ describe("sqlize", () => {
142
142
  it("handles orderBy without query signals", () => {
143
143
  const result = sqlize({
144
144
  orderBy: { field: "created_at", direction: "asc" },
145
- topK: 20,
145
+ limit: 20,
146
146
  }, { pkey: "id", schema: "public", table: "docs" });
147
147
  expect(result.select.signals).toEqual([]);
148
148
  expect(result.order.signals).toEqual([]);
@@ -150,7 +150,7 @@ describe("sqlize", () => {
150
150
  field: "created_at",
151
151
  direction: "asc",
152
152
  });
153
- expect(result.limit).toEqual({ topK: 20, offset: 0 });
153
+ expect(result.limit).toEqual({ limit: 20, offset: 0 });
154
154
  });
155
155
  });
156
156
  describe("edge cases", () => {
@@ -177,7 +177,7 @@ describe("sqlize", () => {
177
177
  query: [{ embedding: [0.1, 0.2, 0.3] }],
178
178
  filter: { status: "active", views: { $gt: 100 } },
179
179
  orderBy: { field: "created_at", direction: "desc" },
180
- topK: 50,
180
+ limit: 50,
181
181
  offset: 25,
182
182
  }, { pkey: "doc_id", schema: "public", table: "documents", binding });
183
183
  expect(result.select.pkey).toBe("doc_id");
@@ -192,7 +192,7 @@ describe("sqlize", () => {
192
192
  direction: "desc",
193
193
  });
194
194
  expect(result.order.binding).toBe(binding);
195
- expect(result.limit).toEqual({ topK: 50, offset: 25 });
195
+ expect(result.limit).toEqual({ limit: 50, offset: 25 });
196
196
  });
197
197
  it("handles undefined filter", () => {
198
198
  const result = sqlize({ query: [{ embedding: [0.1, 0.2] }] }, { pkey: "id", schema: "public", table: "docs" });
@@ -228,7 +228,7 @@ describe("full pipeline integration", () => {
228
228
  const query = sqlize({
229
229
  query: [{ embedding: vector }],
230
230
  filter: { status: "active", views: { $gt: 100 } },
231
- topK: 25,
231
+ limit: 25,
232
232
  offset: 50,
233
233
  }, { pkey: "doc_id", schema: "public", table: "documents", binding });
234
234
  // Step 2: encode each clause (include: false to exclude extra columns)
@@ -266,7 +266,7 @@ describe("full pipeline integration", () => {
266
266
  $or: [{ featured: true }, { views: { $gte: 1000 } }],
267
267
  },
268
268
  orderBy: { field: "created_at", direction: "desc" },
269
- topK: 10,
269
+ limit: 10,
270
270
  }, { pkey: "id", schema: "public", table: "docs" });
271
271
  const select = SQL_SELECT.encode(query.select);
272
272
  const whereStartIdx = 1 + select.params.length;
@@ -302,7 +302,7 @@ describe("full pipeline integration", () => {
302
302
  ],
303
303
  deleted_at: null,
304
304
  },
305
- topK: 5,
305
+ limit: 5,
306
306
  }, { pkey: "id", schema: "public", table: "docs" });
307
307
  const select = SQL_SELECT.encode(query.select);
308
308
  const whereStartIdx = 1 + select.params.length;
@@ -333,7 +333,7 @@ describe("full pipeline integration", () => {
333
333
  },
334
334
  },
335
335
  };
336
- const query = sqlize({ query: [{ embedding: vector }], topK: 10 }, { pkey: "id", schema: "public", table: "docs", binding });
336
+ const query = sqlize({ query: [{ embedding: vector }], limit: 10 }, { pkey: "id", schema: "public", table: "docs", binding });
337
337
  const select = SQL_SELECT.encode({ ...query.select, include: false });
338
338
  const order = SQL_ORDER.encode(query.order);
339
339
  // Euclidean uses <-> operator
@@ -355,7 +355,7 @@ describe("full pipeline integration", () => {
355
355
  },
356
356
  },
357
357
  };
358
- const query = sqlize({ query: [{ embedding: vector }], topK: 10 }, { pkey: "id", schema: "public", table: "docs", binding });
358
+ const query = sqlize({ query: [{ embedding: vector }], limit: 10 }, { pkey: "id", schema: "public", table: "docs", binding });
359
359
  const select = SQL_SELECT.encode({ ...query.select, include: false });
360
360
  const order = SQL_ORDER.encode(query.order);
361
361
  // Dot product uses <#> operator
@@ -368,7 +368,7 @@ describe("full pipeline integration", () => {
368
368
  const query = sqlize({
369
369
  query: [{ embedding: [0.1, 0.2] }],
370
370
  filter: { a: 1, b: 2, c: 3 },
371
- topK: 10,
371
+ limit: 10,
372
372
  offset: 20,
373
373
  }, { pkey: "id", schema: "public", table: "docs" });
374
374
  const select = SQL_SELECT.encode(query.select);
@@ -379,7 +379,7 @@ describe("full pipeline integration", () => {
379
379
  // Verify no gaps in indices
380
380
  // SELECT: $1 (vector)
381
381
  // WHERE: $2, $3, $4 (a, b, c)
382
- // LIMIT: $5, $6 (topK, offset)
382
+ // LIMIT: $5, $6 (limit, offset)
383
383
  expect(select.params).toHaveLength(1); // $1
384
384
  expect(whereStartIdx).toBe(2);
385
385
  expect(where.params).toHaveLength(3); // $2, $3, $4
@@ -2,12 +2,12 @@
2
2
  * Codec for building sql LIMIT clause.
3
3
  */
4
4
  export const SQL_LIMIT = {
5
- encode({ topK, offset, startIdx }) {
5
+ encode({ limit, offset, startIdx }) {
6
6
  const parts = [];
7
7
  const params = [];
8
8
  let idx = startIdx;
9
9
  parts.push(`LIMIT $${idx++}`);
10
- params.push(topK);
10
+ params.push(limit);
11
11
  if (offset > 0) {
12
12
  parts.push(`OFFSET $${idx++}`);
13
13
  params.push(offset);
@@ -39,7 +39,7 @@ export interface OrderInput {
39
39
  table?: string;
40
40
  }
41
41
  export interface LimitInput {
42
- topK: number;
42
+ limit: number;
43
43
  offset: number;
44
44
  startIdx: number;
45
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/pgvector/sql/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,OAAO,EACP,WAAW,EACX,aAAa,EACd,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,GAAG,YAAY,CAsD7E;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACpC,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;CAC9B;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB"}
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/pgvector/sql/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,OAAO,EACP,WAAW,EACX,aAAa,EACd,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,GAAG,YAAY,CAsD7E;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACpC,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;CAC9B;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB"}
@@ -49,6 +49,6 @@ export function sqlize(query, config) {
49
49
  schema: config.schema,
50
50
  table: config.table,
51
51
  },
52
- limit: { topK: query.topK ?? 10, offset: query.offset ?? 0 },
52
+ limit: { limit: query.limit ?? 10, offset: query.offset ?? 0 },
53
53
  };
54
54
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kernl-sdk/pg",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "description": "PostgreSQL storage adapter for kernl",
5
5
  "keywords": [
6
6
  "kernl",
@@ -35,15 +35,15 @@
35
35
  "tsc-alias": "^1.8.10",
36
36
  "typescript": "5.9.2",
37
37
  "vitest": "^4.0.8",
38
- "@kernl-sdk/ai": "^0.3.2",
39
- "@kernl-sdk/protocol": "^0.3.1"
38
+ "@kernl-sdk/ai": "^0.3.3",
39
+ "@kernl-sdk/protocol": "^0.4.0"
40
40
  },
41
41
  "dependencies": {
42
42
  "pg": "^8.16.3",
43
- "kernl": "^0.9.1",
44
- "@kernl-sdk/retrieval": "^0.1.5",
43
+ "kernl": "^0.10.0",
44
+ "@kernl-sdk/retrieval": "^0.1.6",
45
45
  "@kernl-sdk/shared": "^0.3.1",
46
- "@kernl-sdk/storage": "0.1.25"
46
+ "@kernl-sdk/storage": "0.1.26"
47
47
  },
48
48
  "scripts": {
49
49
  "clean": "rm -rf dist",
@@ -202,7 +202,7 @@ describe.sequential(
202
202
  expect(results[0].document?.id).toBe("m1");
203
203
  });
204
204
 
205
- it("respects topK limit", async () => {
205
+ it("respects limit", async () => {
206
206
  await kernl.memories.create({
207
207
  id: "m1",
208
208
  scope: { namespace: "test" },
@@ -120,7 +120,7 @@ describe.sequential("PGIndexHandle", () => {
120
120
  const handle = search.index("docs");
121
121
  const results = await handle.query({
122
122
  query: [{ embedding: [0.1, 0.2, 0.3] }],
123
- topK: 2,
123
+ limit: 2,
124
124
  });
125
125
 
126
126
  expect(results).toHaveLength(2);
@@ -136,7 +136,7 @@ describe.sequential("PGIndexHandle", () => {
136
136
  const results = await handle.query({
137
137
  query: [{ embedding: [0.1, 0.2, 0.3] }],
138
138
  filter: { status: "active" },
139
- topK: 10,
139
+ limit: 10,
140
140
  });
141
141
 
142
142
  expect(results).toHaveLength(2);
@@ -152,7 +152,7 @@ describe.sequential("PGIndexHandle", () => {
152
152
  const results = await handle.query({
153
153
  query: [{ embedding: [0.1, 0.2, 0.3] }],
154
154
  filter: { views: { $gte: 100 } },
155
- topK: 10,
155
+ limit: 10,
156
156
  });
157
157
 
158
158
  expect(results.length).toBeGreaterThanOrEqual(2);
@@ -170,7 +170,7 @@ describe.sequential("PGIndexHandle", () => {
170
170
  filter: {
171
171
  $or: [{ status: "draft" }, { status: "archived" }],
172
172
  },
173
- topK: 10,
173
+ limit: 10,
174
174
  });
175
175
 
176
176
  expect(results).toHaveLength(2);
@@ -186,19 +186,19 @@ describe.sequential("PGIndexHandle", () => {
186
186
  const results = await handle.query({
187
187
  query: [{ embedding: [0.1, 0.2, 0.3] }],
188
188
  filter: { status: { $in: ["active", "draft"] } },
189
- topK: 10,
189
+ limit: 10,
190
190
  });
191
191
 
192
192
  expect(results).toHaveLength(3);
193
193
  });
194
194
 
195
- it("respects topK limit", async () => {
195
+ it("respects limit", async () => {
196
196
  await insertDocs();
197
197
 
198
198
  const handle = search.index("docs");
199
199
  const results = await handle.query({
200
200
  query: [{ embedding: [0.5, 0.5, 0.5] }],
201
- topK: 2,
201
+ limit: 2,
202
202
  });
203
203
 
204
204
  expect(results).toHaveLength(2);
@@ -212,14 +212,14 @@ describe.sequential("PGIndexHandle", () => {
212
212
  // Get first 2
213
213
  const page1 = await handle.query({
214
214
  query: [{ embedding: [0.5, 0.5, 0.5] }],
215
- topK: 2,
215
+ limit: 2,
216
216
  offset: 0,
217
217
  });
218
218
 
219
219
  // Get next 2
220
220
  const page2 = await handle.query({
221
221
  query: [{ embedding: [0.5, 0.5, 0.5] }],
222
- topK: 2,
222
+ limit: 2,
223
223
  offset: 2,
224
224
  });
225
225
 
@@ -235,7 +235,7 @@ describe.sequential("PGIndexHandle", () => {
235
235
  const results = await handle.query({
236
236
  filter: { status: "active" },
237
237
  orderBy: { field: "views", direction: "desc" },
238
- topK: 10,
238
+ limit: 10,
239
239
  });
240
240
 
241
241
  expect(results).toHaveLength(2);
@@ -249,7 +249,7 @@ describe.sequential("PGIndexHandle", () => {
249
249
  const handle = search.index("docs");
250
250
  const results = await handle.query({
251
251
  query: [{ embedding: [0.1, 0.2, 0.3] }],
252
- topK: 1,
252
+ limit: 1,
253
253
  });
254
254
 
255
255
  expect(results[0].document).toHaveProperty("title");
@@ -266,7 +266,7 @@ describe.sequential("PGIndexHandle", () => {
266
266
  const results = await handle.query({
267
267
  query: [{ embedding: [0.1, 0.2, 0.3] }],
268
268
  filter: { status: "nonexistent" },
269
- topK: 10,
269
+ limit: 10,
270
270
  });
271
271
 
272
272
  expect(results).toEqual([]);
@@ -311,7 +311,7 @@ describe.sequential("PGIndexHandle", () => {
311
311
  const handle = search.index<DocFields>("typed-docs");
312
312
  const results = await handle.query({
313
313
  query: [{ embedding: [0.1, 0.2, 0.3] }],
314
- topK: 1,
314
+ limit: 1,
315
315
  });
316
316
 
317
317
  // TypeScript should allow these without errors
@@ -93,7 +93,7 @@ describe.sequential("pgvector document operations integration tests", () => {
93
93
  // Verify document was inserted
94
94
  const hits = await handle.query({
95
95
  query: [{ embedding: [0.1, 0.2, 0.3, 0.4] }],
96
- topK: 1,
96
+ limit: 1,
97
97
  });
98
98
 
99
99
  expect(hits).toHaveLength(1);
@@ -162,7 +162,7 @@ describe.sequential("pgvector document operations integration tests", () => {
162
162
  // Verify update
163
163
  const hits = await handle.query({
164
164
  filter: { id: "doc-1" },
165
- topK: 1,
165
+ limit: 1,
166
166
  });
167
167
 
168
168
  expect(hits[0].document?.title).toBe("Updated Title");
@@ -244,7 +244,7 @@ describe.sequential("pgvector document operations integration tests", () => {
244
244
  // Verify count
245
245
  const hits = await handle.query({
246
246
  query: [{ embedding: [0.5, 0.5, 0.5, 0.5] }],
247
- topK: 1000,
247
+ limit: 1000,
248
248
  });
249
249
 
250
250
  expect(hits).toHaveLength(100);
@@ -264,7 +264,7 @@ describe.sequential("pgvector document operations integration tests", () => {
264
264
 
265
265
  const hits = await handle.query({
266
266
  filter: { id: "vec-test" },
267
- topK: 1,
267
+ limit: 1,
268
268
  });
269
269
 
270
270
  // Vector values should be preserved (within floating point precision)
@@ -298,7 +298,7 @@ describe.sequential("pgvector document operations integration tests", () => {
298
298
 
299
299
  const hits = await nullHandle.query({
300
300
  filter: { id: "doc-null" },
301
- topK: 1,
301
+ limit: 1,
302
302
  });
303
303
 
304
304
  expect(hits[0].document?.title).toBe("Has Title");
@@ -343,7 +343,7 @@ describe.sequential("pgvector document operations integration tests", () => {
343
343
 
344
344
  const hits = await handle.query({
345
345
  filter: { id: "patch-1" },
346
- topK: 1,
346
+ limit: 1,
347
347
  });
348
348
 
349
349
  expect(hits[0].document?.title).toBe("Updated Title");
@@ -363,7 +363,7 @@ describe.sequential("pgvector document operations integration tests", () => {
363
363
 
364
364
  const hits = await handle.query({
365
365
  filter: { id: "patch-1" },
366
- topK: 1,
366
+ limit: 1,
367
367
  });
368
368
 
369
369
  expect(hits[0].document?.title).toBe("New Title");
@@ -382,7 +382,7 @@ describe.sequential("pgvector document operations integration tests", () => {
382
382
 
383
383
  const hits = await handle.query({
384
384
  filter: { id: "patch-1" },
385
- topK: 1,
385
+ limit: 1,
386
386
  });
387
387
 
388
388
  const stored = hits[0].document?.embedding;
@@ -399,7 +399,7 @@ describe.sequential("pgvector document operations integration tests", () => {
399
399
 
400
400
  const hits = await handle.query({
401
401
  query: [{ embedding: [0.5, 0.5, 0.5, 0.5] }],
402
- topK: 10,
402
+ limit: 10,
403
403
  });
404
404
 
405
405
  const doc1 = hits.find((h) => h.id === "patch-1");
@@ -438,7 +438,7 @@ describe.sequential("pgvector document operations integration tests", () => {
438
438
 
439
439
  const hits = await nullHandle.query({
440
440
  filter: { id: "doc-1" },
441
- topK: 1,
441
+ limit: 1,
442
442
  });
443
443
 
444
444
  expect(hits[0].document?.subtitle).toBeNull();
@@ -467,7 +467,7 @@ describe.sequential("pgvector document operations integration tests", () => {
467
467
 
468
468
  const hits = await handle.query({
469
469
  filter: { id: "patch-1" },
470
- topK: 1,
470
+ limit: 1,
471
471
  });
472
472
 
473
473
  expect(hits[0].document?.title).toBe("Updated");
@@ -527,7 +527,7 @@ describe.sequential("pgvector document operations integration tests", () => {
527
527
  // Verify deletion
528
528
  const hits = await handle.query({
529
529
  filter: { id: "del-1" },
530
- topK: 1,
530
+ limit: 1,
531
531
  });
532
532
 
533
533
  expect(hits).toHaveLength(0);
@@ -541,7 +541,7 @@ describe.sequential("pgvector document operations integration tests", () => {
541
541
  // Verify only del-3 remains
542
542
  const hits = await handle.query({
543
543
  query: [{ embedding: [0.5, 0.5, 0.5, 0.5] }],
544
- topK: 10,
544
+ limit: 10,
545
545
  });
546
546
 
547
547
  expect(hits).toHaveLength(1);
@@ -570,7 +570,7 @@ describe.sequential("pgvector document operations integration tests", () => {
570
570
 
571
571
  const hits = await handle.query({
572
572
  query: [{ embedding: [0.5, 0.5, 0.5, 0.5] }],
573
- topK: 10,
573
+ limit: 10,
574
574
  });
575
575
 
576
576
  expect(hits).toHaveLength(0);
@@ -594,7 +594,7 @@ describe.sequential("pgvector document operations integration tests", () => {
594
594
 
595
595
  const hits = await handle.query({
596
596
  filter: { views: 0 },
597
- topK: 1,
597
+ limit: 1,
598
598
  });
599
599
 
600
600
  expect(hits).toHaveLength(1);
@@ -613,7 +613,7 @@ describe.sequential("pgvector document operations integration tests", () => {
613
613
 
614
614
  const hits = await handle.query({
615
615
  filter: { views: -50 },
616
- topK: 1,
616
+ limit: 1,
617
617
  });
618
618
 
619
619
  expect(hits).toHaveLength(1);
@@ -642,12 +642,12 @@ describe.sequential("pgvector document operations integration tests", () => {
642
642
 
643
643
  const trueHits = await handle.query({
644
644
  filter: { published: true },
645
- topK: 10,
645
+ limit: 10,
646
646
  });
647
647
 
648
648
  const falseHits = await handle.query({
649
649
  filter: { published: false },
650
- topK: 10,
650
+ limit: 10,
651
651
  });
652
652
 
653
653
  expect(trueHits).toHaveLength(1);
@@ -668,7 +668,7 @@ describe.sequential("pgvector document operations integration tests", () => {
668
668
 
669
669
  const hits = await handle.query({
670
670
  filter: { title: "" },
671
- topK: 1,
671
+ limit: 1,
672
672
  });
673
673
 
674
674
  expect(hits).toHaveLength(1);
@@ -687,7 +687,7 @@ describe.sequential("pgvector document operations integration tests", () => {
687
687
 
688
688
  const hits = await handle.query({
689
689
  filter: { id: "unicode-test" },
690
- topK: 1,
690
+ limit: 1,
691
691
  });
692
692
 
693
693
  expect(hits[0].document?.title).toBe("Hello 世界 🌍");
@@ -708,7 +708,7 @@ describe.sequential("pgvector document operations integration tests", () => {
708
708
 
709
709
  const hits = await handle.query({
710
710
  filter: { id: "long-string" },
711
- topK: 1,
711
+ limit: 1,
712
712
  });
713
713
 
714
714
  expect(hits[0].document?.content).toBe(longString);