@mastra/pg 0.3.5-alpha.0 → 0.10.0

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.
@@ -1,23 +1,23 @@
1
1
 
2
- > @mastra/pg@0.3.5-alpha.0 build /home/runner/work/mastra/mastra/stores/pg
2
+ > @mastra/pg@0.10.0-alpha.1 build /home/runner/work/mastra/mastra/stores/pg
3
3
  > tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting
4
4
 
5
5
  CLI Building entry: src/index.ts
6
6
  CLI Using tsconfig: tsconfig.json
7
7
  CLI tsup v8.4.0
8
8
  TSC Build start
9
- TSC ⚡️ Build success in 9464ms
9
+ TSC ⚡️ Build success in 9529ms
10
10
  DTS Build start
11
11
  CLI Target: es2022
12
12
  Analysis will use the bundled TypeScript version 5.8.3
13
13
  Writing package typings: /home/runner/work/mastra/mastra/stores/pg/dist/_tsup-dts-rollup.d.ts
14
14
  Analysis will use the bundled TypeScript version 5.8.3
15
15
  Writing package typings: /home/runner/work/mastra/mastra/stores/pg/dist/_tsup-dts-rollup.d.cts
16
- DTS ⚡️ Build success in 12331ms
16
+ DTS ⚡️ Build success in 11794ms
17
17
  CLI Cleaning output folder
18
18
  ESM Build start
19
19
  CJS Build start
20
- CJS dist/index.cjs 61.67 KB
21
- CJS ⚡️ Build success in 1494ms
22
- ESM dist/index.js 61.16 KB
23
- ESM ⚡️ Build success in 1495ms
20
+ CJS dist/index.cjs 57.80 KB
21
+ CJS ⚡️ Build success in 1416ms
22
+ ESM dist/index.js 57.30 KB
23
+ ESM ⚡️ Build success in 1416ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,58 @@
1
1
  # @mastra/pg
2
2
 
3
+ ## 0.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 83da932: Move @mastra/core to peerdeps
8
+
9
+ ### Patch Changes
10
+
11
+ - b3a3d63: BREAKING: Make vnext workflow the default worklow, and old workflow legacy_workflow
12
+ - eabdcd9: [MASTRA-3451] SQL Injection Protection
13
+ - d0ee3c6: Change all public functions and constructors in vector stores to use named args and prepare to phase out positional args
14
+ - a7292b0: BREAKING(@mastra/core, all vector stores): Vector store breaking changes (remove deprecated functions and positional arguments)
15
+ - Updated dependencies [b3a3d63]
16
+ - Updated dependencies [344f453]
17
+ - Updated dependencies [0a3ae6d]
18
+ - Updated dependencies [95911be]
19
+ - Updated dependencies [f53a6ac]
20
+ - Updated dependencies [5eb5a99]
21
+ - Updated dependencies [7e632c5]
22
+ - Updated dependencies [1e9fbfa]
23
+ - Updated dependencies [eabdcd9]
24
+ - Updated dependencies [90be034]
25
+ - Updated dependencies [99f050a]
26
+ - Updated dependencies [d0ee3c6]
27
+ - Updated dependencies [b2ae5aa]
28
+ - Updated dependencies [23f258c]
29
+ - Updated dependencies [a7292b0]
30
+ - Updated dependencies [0dcb9f0]
31
+ - Updated dependencies [2672a05]
32
+ - @mastra/core@0.10.0
33
+
34
+ ## 0.4.0-alpha.1
35
+
36
+ ### Minor Changes
37
+
38
+ - 83da932: Move @mastra/core to peerdeps
39
+
40
+ ### Patch Changes
41
+
42
+ - b3a3d63: BREAKING: Make vnext workflow the default worklow, and old workflow legacy_workflow
43
+ - a7292b0: BREAKING(@mastra/core, all vector stores): Vector store breaking changes (remove deprecated functions and positional arguments)
44
+ - Updated dependencies [b3a3d63]
45
+ - Updated dependencies [344f453]
46
+ - Updated dependencies [0a3ae6d]
47
+ - Updated dependencies [95911be]
48
+ - Updated dependencies [5eb5a99]
49
+ - Updated dependencies [7e632c5]
50
+ - Updated dependencies [1e9fbfa]
51
+ - Updated dependencies [b2ae5aa]
52
+ - Updated dependencies [a7292b0]
53
+ - Updated dependencies [0dcb9f0]
54
+ - @mastra/core@0.10.0-alpha.1
55
+
3
56
  ## 0.3.5-alpha.0
4
57
 
5
58
  ### Patch Changes
@@ -1,5 +1,4 @@
1
1
  import { BaseFilterTranslator } from '@mastra/core/vector/filter';
2
- import type { CreateIndexArgs } from '@mastra/core/vector';
3
2
  import type { CreateIndexParams } from '@mastra/core/vector';
4
3
  import type { DeleteIndexParams } from '@mastra/core/vector';
5
4
  import type { DeleteVectorParams } from '@mastra/core/vector';
@@ -11,10 +10,8 @@ import { MastraStorage } from '@mastra/core/storage';
11
10
  import { MastraVector } from '@mastra/core/vector';
12
11
  import type { MessageType } from '@mastra/core/memory';
13
12
  import type { OperatorSupport } from '@mastra/core/vector/filter';
14
- import type { ParamsToArgs } from '@mastra/core/vector';
15
13
  import pg from 'pg';
16
14
  import type { QueryResult } from '@mastra/core/vector';
17
- import type { QueryVectorArgs } from '@mastra/core/vector';
18
15
  import type { QueryVectorParams } from '@mastra/core/vector';
19
16
  import type { StorageColumn } from '@mastra/core/storage';
20
17
  import type { StorageGetMessagesArg } from '@mastra/core/storage';
@@ -125,15 +122,11 @@ declare interface IVFConfig {
125
122
 
126
123
  export declare function measureLatency<T>(fn: () => Promise<T>): Promise<[number, T]>;
127
124
 
128
- declare type PgCreateIndexArgs = [...CreateIndexArgs, IndexConfig?, boolean?];
129
-
130
125
  declare interface PgCreateIndexParams extends CreateIndexParams {
131
126
  indexConfig?: IndexConfig;
132
127
  buildIndex?: boolean;
133
128
  }
134
129
 
135
- declare type PgDefineIndexArgs = [string, 'cosine' | 'euclidean' | 'dotproduct', IndexConfig];
136
-
137
130
  declare interface PgDefineIndexParams {
138
131
  indexName: string;
139
132
  metric: 'cosine' | 'euclidean' | 'dotproduct';
@@ -169,8 +162,6 @@ declare interface PGIndexStats extends IndexStats {
169
162
  export { PGIndexStats }
170
163
  export { PGIndexStats as PGIndexStats_alias_1 }
171
164
 
172
- declare type PgQueryVectorArgs = [...QueryVectorArgs, number?, number?, number?];
173
-
174
165
  declare interface PgQueryVectorParams extends QueryVectorParams {
175
166
  minScore?: number;
176
167
  /**
@@ -195,12 +186,7 @@ declare class PgVector extends MastraVector {
195
186
  private installVectorExtensionPromise;
196
187
  private vectorExtensionInstalled;
197
188
  private schemaSetupComplete;
198
- /**
199
- * @deprecated Passing connectionString as a string is deprecated.
200
- * Use the object parameter instead. This signature will be removed on May 20th, 2025.
201
- */
202
- constructor(connectionString: string);
203
- constructor(config: {
189
+ constructor({ connectionString, schemaName, pgPoolOptions, }: {
204
190
  connectionString: string;
205
191
  schemaName?: string;
206
192
  pgPoolOptions?: Omit<pg.PoolConfig, 'connectionString'>;
@@ -208,37 +194,29 @@ declare class PgVector extends MastraVector {
208
194
  private getMutexByName;
209
195
  private getTableName;
210
196
  transformFilter(filter?: VectorFilter): VectorFilter;
211
- getIndexInfo(...args: ParamsToArgs<DescribeIndexParams>): Promise<PGIndexStats>;
212
- query(...args: ParamsToArgs<PgQueryVectorParams> | PgQueryVectorArgs): Promise<QueryResult[]>;
213
- upsert(...args: ParamsToArgs<UpsertVectorParams>): Promise<string[]>;
197
+ getIndexInfo({ indexName }: DescribeIndexParams): Promise<PGIndexStats>;
198
+ query({ indexName, queryVector, topK, filter, includeVector, minScore, ef, probes, }: PgQueryVectorParams): Promise<QueryResult[]>;
199
+ upsert({ indexName, vectors, metadata, ids }: UpsertVectorParams): Promise<string[]>;
214
200
  private hasher;
215
201
  private getIndexCacheKey;
216
202
  private cachedIndexExists;
217
203
  private setupSchema;
218
- createIndex(...args: ParamsToArgs<PgCreateIndexParams> | PgCreateIndexArgs): Promise<void>;
219
- /**
220
- * @deprecated This function is deprecated. Use buildIndex instead
221
- * This function will be removed on May 20th, 2025
222
- */
223
- defineIndex(indexName: string, metric: "cosine" | "euclidean" | "dotproduct" | undefined, indexConfig: IndexConfig): Promise<void>;
224
- buildIndex(...args: ParamsToArgs<PgDefineIndexParams> | PgDefineIndexArgs): Promise<void>;
204
+ createIndex({ indexName, dimension, metric, indexConfig, buildIndex, }: PgCreateIndexParams): Promise<void>;
205
+ buildIndex({ indexName, metric, indexConfig }: PgDefineIndexParams): Promise<void>;
225
206
  private setupIndex;
226
207
  private installVectorExtension;
227
208
  listIndexes(): Promise<string[]>;
228
209
  /**
229
210
  * Retrieves statistics about a vector index.
230
211
  *
231
- * @param params - The parameters for describing an index
232
- * @param params.indexName - The name of the index to describe
212
+ * @param {string} indexName - The name of the index to describe
233
213
  * @returns A promise that resolves to the index statistics including dimension, count and metric
234
214
  */
235
- describeIndex(...args: ParamsToArgs<DescribeIndexParams>): Promise<PGIndexStats>;
236
- deleteIndex(...args: ParamsToArgs<DeleteIndexParams>): Promise<void>;
237
- truncateIndex(...args: ParamsToArgs<DeleteIndexParams>): Promise<void>;
215
+ describeIndex({ indexName }: DescribeIndexParams): Promise<PGIndexStats>;
216
+ deleteIndex({ indexName }: DeleteIndexParams): Promise<void>;
217
+ truncateIndex({ indexName }: DeleteIndexParams): Promise<void>;
238
218
  disconnect(): Promise<void>;
239
219
  /**
240
- * @deprecated Use {@link updateVector} instead. This method will be removed on May 20th, 2025.
241
- *
242
220
  * Updates a vector by its ID with the provided vector and/or metadata.
243
221
  * @param indexName - The name of the index containing the vector.
244
222
  * @param id - The ID of the vector to update.
@@ -248,31 +226,7 @@ declare class PgVector extends MastraVector {
248
226
  * @returns A promise that resolves when the update is complete.
249
227
  * @throws Will throw an error if no updates are provided or if the update operation fails.
250
228
  */
251
- updateIndexById(indexName: string, id: string, update: {
252
- vector?: number[];
253
- metadata?: Record<string, any>;
254
- }): Promise<void>;
255
- /**
256
- * Updates a vector by its ID with the provided vector and/or metadata.
257
- * @param indexName - The name of the index containing the vector.
258
- * @param id - The ID of the vector to update.
259
- * @param update - An object containing the vector and/or metadata to update.
260
- * @param update.vector - An optional array of numbers representing the new vector.
261
- * @param update.metadata - An optional record containing the new metadata.
262
- * @returns A promise that resolves when the update is complete.
263
- * @throws Will throw an error if no updates are provided or if the update operation fails.
264
- */
265
- updateVector(...args: ParamsToArgs<UpdateVectorParams>): Promise<void>;
266
- /**
267
- * @deprecated Use {@link deleteVector} instead. This method will be removed on May 20th, 2025.
268
- *
269
- * Deletes a vector by its ID.
270
- * @param indexName - The name of the index containing the vector.
271
- * @param id - The ID of the vector to delete.
272
- * @returns A promise that resolves when the deletion is complete.
273
- * @throws Will throw an error if the deletion operation fails.
274
- */
275
- deleteIndexById(indexName: string, id: string): Promise<void>;
229
+ updateVector({ indexName, id, update }: UpdateVectorParams): Promise<void>;
276
230
  /**
277
231
  * Deletes a vector by its ID.
278
232
  * @param indexName - The name of the index containing the vector.
@@ -280,7 +234,7 @@ declare class PgVector extends MastraVector {
280
234
  * @returns A promise that resolves when the deletion is complete.
281
235
  * @throws Will throw an error if the deletion operation fails.
282
236
  */
283
- deleteVector(...args: ParamsToArgs<DeleteVectorParams>): Promise<void>;
237
+ deleteVector({ indexName, id }: DeleteVectorParams): Promise<void>;
284
238
  }
285
239
  export { PgVector }
286
240
  export { PgVector as PgVector_alias_1 }
@@ -295,10 +249,6 @@ export { PGVECTOR_PROMPT as PGVECTOR_PROMPT_alias_1 }
295
249
 
296
250
  declare type PostgresConfig = {
297
251
  schemaName?: string;
298
- /**
299
- * @deprecated Use `schemaName` instead. Support for `schema` will be removed on May 20th, 2025.
300
- */
301
- schema?: string;
302
252
  } & ({
303
253
  host: string;
304
254
  port: number;
@@ -1,5 +1,4 @@
1
1
  import { BaseFilterTranslator } from '@mastra/core/vector/filter';
2
- import type { CreateIndexArgs } from '@mastra/core/vector';
3
2
  import type { CreateIndexParams } from '@mastra/core/vector';
4
3
  import type { DeleteIndexParams } from '@mastra/core/vector';
5
4
  import type { DeleteVectorParams } from '@mastra/core/vector';
@@ -11,10 +10,8 @@ import { MastraStorage } from '@mastra/core/storage';
11
10
  import { MastraVector } from '@mastra/core/vector';
12
11
  import type { MessageType } from '@mastra/core/memory';
13
12
  import type { OperatorSupport } from '@mastra/core/vector/filter';
14
- import type { ParamsToArgs } from '@mastra/core/vector';
15
13
  import pg from 'pg';
16
14
  import type { QueryResult } from '@mastra/core/vector';
17
- import type { QueryVectorArgs } from '@mastra/core/vector';
18
15
  import type { QueryVectorParams } from '@mastra/core/vector';
19
16
  import type { StorageColumn } from '@mastra/core/storage';
20
17
  import type { StorageGetMessagesArg } from '@mastra/core/storage';
@@ -125,15 +122,11 @@ declare interface IVFConfig {
125
122
 
126
123
  export declare function measureLatency<T>(fn: () => Promise<T>): Promise<[number, T]>;
127
124
 
128
- declare type PgCreateIndexArgs = [...CreateIndexArgs, IndexConfig?, boolean?];
129
-
130
125
  declare interface PgCreateIndexParams extends CreateIndexParams {
131
126
  indexConfig?: IndexConfig;
132
127
  buildIndex?: boolean;
133
128
  }
134
129
 
135
- declare type PgDefineIndexArgs = [string, 'cosine' | 'euclidean' | 'dotproduct', IndexConfig];
136
-
137
130
  declare interface PgDefineIndexParams {
138
131
  indexName: string;
139
132
  metric: 'cosine' | 'euclidean' | 'dotproduct';
@@ -169,8 +162,6 @@ declare interface PGIndexStats extends IndexStats {
169
162
  export { PGIndexStats }
170
163
  export { PGIndexStats as PGIndexStats_alias_1 }
171
164
 
172
- declare type PgQueryVectorArgs = [...QueryVectorArgs, number?, number?, number?];
173
-
174
165
  declare interface PgQueryVectorParams extends QueryVectorParams {
175
166
  minScore?: number;
176
167
  /**
@@ -195,12 +186,7 @@ declare class PgVector extends MastraVector {
195
186
  private installVectorExtensionPromise;
196
187
  private vectorExtensionInstalled;
197
188
  private schemaSetupComplete;
198
- /**
199
- * @deprecated Passing connectionString as a string is deprecated.
200
- * Use the object parameter instead. This signature will be removed on May 20th, 2025.
201
- */
202
- constructor(connectionString: string);
203
- constructor(config: {
189
+ constructor({ connectionString, schemaName, pgPoolOptions, }: {
204
190
  connectionString: string;
205
191
  schemaName?: string;
206
192
  pgPoolOptions?: Omit<pg.PoolConfig, 'connectionString'>;
@@ -208,37 +194,29 @@ declare class PgVector extends MastraVector {
208
194
  private getMutexByName;
209
195
  private getTableName;
210
196
  transformFilter(filter?: VectorFilter): VectorFilter;
211
- getIndexInfo(...args: ParamsToArgs<DescribeIndexParams>): Promise<PGIndexStats>;
212
- query(...args: ParamsToArgs<PgQueryVectorParams> | PgQueryVectorArgs): Promise<QueryResult[]>;
213
- upsert(...args: ParamsToArgs<UpsertVectorParams>): Promise<string[]>;
197
+ getIndexInfo({ indexName }: DescribeIndexParams): Promise<PGIndexStats>;
198
+ query({ indexName, queryVector, topK, filter, includeVector, minScore, ef, probes, }: PgQueryVectorParams): Promise<QueryResult[]>;
199
+ upsert({ indexName, vectors, metadata, ids }: UpsertVectorParams): Promise<string[]>;
214
200
  private hasher;
215
201
  private getIndexCacheKey;
216
202
  private cachedIndexExists;
217
203
  private setupSchema;
218
- createIndex(...args: ParamsToArgs<PgCreateIndexParams> | PgCreateIndexArgs): Promise<void>;
219
- /**
220
- * @deprecated This function is deprecated. Use buildIndex instead
221
- * This function will be removed on May 20th, 2025
222
- */
223
- defineIndex(indexName: string, metric: "cosine" | "euclidean" | "dotproduct" | undefined, indexConfig: IndexConfig): Promise<void>;
224
- buildIndex(...args: ParamsToArgs<PgDefineIndexParams> | PgDefineIndexArgs): Promise<void>;
204
+ createIndex({ indexName, dimension, metric, indexConfig, buildIndex, }: PgCreateIndexParams): Promise<void>;
205
+ buildIndex({ indexName, metric, indexConfig }: PgDefineIndexParams): Promise<void>;
225
206
  private setupIndex;
226
207
  private installVectorExtension;
227
208
  listIndexes(): Promise<string[]>;
228
209
  /**
229
210
  * Retrieves statistics about a vector index.
230
211
  *
231
- * @param params - The parameters for describing an index
232
- * @param params.indexName - The name of the index to describe
212
+ * @param {string} indexName - The name of the index to describe
233
213
  * @returns A promise that resolves to the index statistics including dimension, count and metric
234
214
  */
235
- describeIndex(...args: ParamsToArgs<DescribeIndexParams>): Promise<PGIndexStats>;
236
- deleteIndex(...args: ParamsToArgs<DeleteIndexParams>): Promise<void>;
237
- truncateIndex(...args: ParamsToArgs<DeleteIndexParams>): Promise<void>;
215
+ describeIndex({ indexName }: DescribeIndexParams): Promise<PGIndexStats>;
216
+ deleteIndex({ indexName }: DeleteIndexParams): Promise<void>;
217
+ truncateIndex({ indexName }: DeleteIndexParams): Promise<void>;
238
218
  disconnect(): Promise<void>;
239
219
  /**
240
- * @deprecated Use {@link updateVector} instead. This method will be removed on May 20th, 2025.
241
- *
242
220
  * Updates a vector by its ID with the provided vector and/or metadata.
243
221
  * @param indexName - The name of the index containing the vector.
244
222
  * @param id - The ID of the vector to update.
@@ -248,31 +226,7 @@ declare class PgVector extends MastraVector {
248
226
  * @returns A promise that resolves when the update is complete.
249
227
  * @throws Will throw an error if no updates are provided or if the update operation fails.
250
228
  */
251
- updateIndexById(indexName: string, id: string, update: {
252
- vector?: number[];
253
- metadata?: Record<string, any>;
254
- }): Promise<void>;
255
- /**
256
- * Updates a vector by its ID with the provided vector and/or metadata.
257
- * @param indexName - The name of the index containing the vector.
258
- * @param id - The ID of the vector to update.
259
- * @param update - An object containing the vector and/or metadata to update.
260
- * @param update.vector - An optional array of numbers representing the new vector.
261
- * @param update.metadata - An optional record containing the new metadata.
262
- * @returns A promise that resolves when the update is complete.
263
- * @throws Will throw an error if no updates are provided or if the update operation fails.
264
- */
265
- updateVector(...args: ParamsToArgs<UpdateVectorParams>): Promise<void>;
266
- /**
267
- * @deprecated Use {@link deleteVector} instead. This method will be removed on May 20th, 2025.
268
- *
269
- * Deletes a vector by its ID.
270
- * @param indexName - The name of the index containing the vector.
271
- * @param id - The ID of the vector to delete.
272
- * @returns A promise that resolves when the deletion is complete.
273
- * @throws Will throw an error if the deletion operation fails.
274
- */
275
- deleteIndexById(indexName: string, id: string): Promise<void>;
229
+ updateVector({ indexName, id, update }: UpdateVectorParams): Promise<void>;
276
230
  /**
277
231
  * Deletes a vector by its ID.
278
232
  * @param indexName - The name of the index containing the vector.
@@ -280,7 +234,7 @@ declare class PgVector extends MastraVector {
280
234
  * @returns A promise that resolves when the deletion is complete.
281
235
  * @throws Will throw an error if the deletion operation fails.
282
236
  */
283
- deleteVector(...args: ParamsToArgs<DeleteVectorParams>): Promise<void>;
237
+ deleteVector({ indexName, id }: DeleteVectorParams): Promise<void>;
284
238
  }
285
239
  export { PgVector }
286
240
  export { PgVector as PgVector_alias_1 }
@@ -295,10 +249,6 @@ export { PGVECTOR_PROMPT as PGVECTOR_PROMPT_alias_1 }
295
249
 
296
250
  declare type PostgresConfig = {
297
251
  schemaName?: string;
298
- /**
299
- * @deprecated Use `schemaName` instead. Support for `schema` will be removed on May 20th, 2025.
300
- */
301
- schema?: string;
302
252
  } & ({
303
253
  host: string;
304
254
  port: number;
package/dist/index.cjs CHANGED
@@ -370,27 +370,11 @@ var PgVector = class extends vector.MastraVector {
370
370
  installVectorExtensionPromise = null;
371
371
  vectorExtensionInstalled = void 0;
372
372
  schemaSetupComplete = void 0;
373
- constructor(config) {
374
- let connectionString;
375
- let pgPoolOptions;
376
- let schemaName;
377
- if (typeof config === "string") {
378
- console.warn(
379
- `DEPRECATION WARNING: Passing connectionString as a string to PgVector constructor is deprecated.
380
-
381
- Please use an object parameter instead:
382
- new PgVector({ connectionString })
383
-
384
- The string signature will be removed on May 20th, 2025.`
385
- );
386
- connectionString = config;
387
- schemaName = void 0;
388
- pgPoolOptions = void 0;
389
- } else {
390
- connectionString = config.connectionString;
391
- schemaName = config.schemaName;
392
- pgPoolOptions = config.pgPoolOptions;
393
- }
373
+ constructor({
374
+ connectionString,
375
+ schemaName,
376
+ pgPoolOptions
377
+ }) {
394
378
  if (!connectionString || connectionString.trim() === "") {
395
379
  throw new Error(
396
380
  "PgVector: connectionString must be provided and cannot be empty. Passing an empty string may cause fallback to local Postgres defaults."
@@ -442,21 +426,22 @@ var PgVector = class extends vector.MastraVector {
442
426
  const translator = new PGFilterTranslator();
443
427
  return translator.translate(filter);
444
428
  }
445
- async getIndexInfo(...args) {
446
- const params = this.normalizeArgs("getIndexInfo", args);
447
- const { indexName } = params;
429
+ async getIndexInfo({ indexName }) {
448
430
  if (!this.describeIndexCache.has(indexName)) {
449
431
  this.describeIndexCache.set(indexName, await this.describeIndex({ indexName }));
450
432
  }
451
433
  return this.describeIndexCache.get(indexName);
452
434
  }
453
- async query(...args) {
454
- const params = this.normalizeArgs("query", args, [
455
- "minScore",
456
- "ef",
457
- "probes"
458
- ]);
459
- const { indexName, queryVector, topK = 10, filter, includeVector = false, minScore = 0, ef, probes } = params;
435
+ async query({
436
+ indexName,
437
+ queryVector,
438
+ topK = 10,
439
+ filter,
440
+ includeVector = false,
441
+ minScore = 0,
442
+ ef,
443
+ probes
444
+ }) {
460
445
  if (!Number.isInteger(topK) || topK <= 0) {
461
446
  throw new Error("topK must be a positive integer");
462
447
  }
@@ -504,9 +489,7 @@ var PgVector = class extends vector.MastraVector {
504
489
  client.release();
505
490
  }
506
491
  }
507
- async upsert(...args) {
508
- const params = this.normalizeArgs("upsert", args);
509
- const { indexName, vectors, metadata, ids } = params;
492
+ async upsert({ indexName, vectors, metadata, ids }) {
510
493
  const tableName = this.getTableName(indexName);
511
494
  const client = await this.pool.connect();
512
495
  try {
@@ -533,7 +516,7 @@ var PgVector = class extends vector.MastraVector {
533
516
  if (match) {
534
517
  const [, expected, actual] = match;
535
518
  throw new Error(
536
- `Vector dimension mismatch: Index "${params.indexName}" expects ${expected} dimensions but got ${actual} dimensions. Either use a matching embedding model or delete and recreate the index with the new dimension.`
519
+ `Vector dimension mismatch: Index "${indexName}" expects ${expected} dimensions but got ${actual} dimensions. Either use a matching embedding model or delete and recreate the index with the new dimension.`
537
520
  );
538
521
  }
539
522
  }
@@ -543,8 +526,13 @@ var PgVector = class extends vector.MastraVector {
543
526
  }
544
527
  }
545
528
  hasher = xxhash__default.default();
546
- async getIndexCacheKey(params) {
547
- const input = params.indexName + params.dimension + params.metric + (params.type || "ivfflat");
529
+ async getIndexCacheKey({
530
+ indexName,
531
+ dimension,
532
+ metric,
533
+ type
534
+ }) {
535
+ const input = indexName + dimension + metric + (type || "ivfflat");
548
536
  return (await this.hasher).h32(input);
549
537
  }
550
538
  cachedIndexExists(indexName, newKey) {
@@ -592,12 +580,13 @@ var PgVector = class extends vector.MastraVector {
592
580
  }
593
581
  await this.setupSchemaPromise;
594
582
  }
595
- async createIndex(...args) {
596
- const params = this.normalizeArgs("createIndex", args, [
597
- "indexConfig",
598
- "buildIndex"
599
- ]);
600
- const { indexName, dimension, metric = "cosine", indexConfig = {}, buildIndex = true } = params;
583
+ async createIndex({
584
+ indexName,
585
+ dimension,
586
+ metric = "cosine",
587
+ indexConfig = {},
588
+ buildIndex = true
589
+ }) {
601
590
  const tableName = this.getTableName(indexName);
602
591
  if (!indexName.match(/^[a-zA-Z_][a-zA-Z0-9_]*$/)) {
603
592
  throw new Error("Invalid index name format");
@@ -638,20 +627,7 @@ var PgVector = class extends vector.MastraVector {
638
627
  }
639
628
  });
640
629
  }
641
- /**
642
- * @deprecated This function is deprecated. Use buildIndex instead
643
- * This function will be removed on May 20th, 2025
644
- */
645
- async defineIndex(indexName, metric = "cosine", indexConfig) {
646
- console.warn("defineIndex is deprecated. Use buildIndex instead. This function will be removed on May 20th, 2025");
647
- return this.buildIndex({ indexName, metric, indexConfig });
648
- }
649
- async buildIndex(...args) {
650
- const params = this.normalizeArgs("buildIndex", args, [
651
- "metric",
652
- "indexConfig"
653
- ]);
654
- const { indexName, metric = "cosine", indexConfig } = params;
630
+ async buildIndex({ indexName, metric = "cosine", indexConfig }) {
655
631
  const client = await this.pool.connect();
656
632
  try {
657
633
  await this.setupIndex({ indexName, metric, indexConfig }, client);
@@ -758,13 +734,10 @@ var PgVector = class extends vector.MastraVector {
758
734
  /**
759
735
  * Retrieves statistics about a vector index.
760
736
  *
761
- * @param params - The parameters for describing an index
762
- * @param params.indexName - The name of the index to describe
737
+ * @param {string} indexName - The name of the index to describe
763
738
  * @returns A promise that resolves to the index statistics including dimension, count and metric
764
739
  */
765
- async describeIndex(...args) {
766
- const params = this.normalizeArgs("describeIndex", args);
767
- const { indexName } = params;
740
+ async describeIndex({ indexName }) {
768
741
  const client = await this.pool.connect();
769
742
  try {
770
743
  const tableName = this.getTableName(indexName);
@@ -838,9 +811,7 @@ var PgVector = class extends vector.MastraVector {
838
811
  client.release();
839
812
  }
840
813
  }
841
- async deleteIndex(...args) {
842
- const params = this.normalizeArgs("deleteIndex", args);
843
- const { indexName } = params;
814
+ async deleteIndex({ indexName }) {
844
815
  const client = await this.pool.connect();
845
816
  try {
846
817
  const tableName = this.getTableName(indexName);
@@ -853,9 +824,7 @@ var PgVector = class extends vector.MastraVector {
853
824
  client.release();
854
825
  }
855
826
  }
856
- async truncateIndex(...args) {
857
- const params = this.normalizeArgs("truncateIndex", args);
858
- const { indexName } = params;
827
+ async truncateIndex({ indexName }) {
859
828
  const client = await this.pool.connect();
860
829
  try {
861
830
  const tableName = this.getTableName(indexName);
@@ -870,26 +839,6 @@ var PgVector = class extends vector.MastraVector {
870
839
  async disconnect() {
871
840
  await this.pool.end();
872
841
  }
873
- /**
874
- * @deprecated Use {@link updateVector} instead. This method will be removed on May 20th, 2025.
875
- *
876
- * Updates a vector by its ID with the provided vector and/or metadata.
877
- * @param indexName - The name of the index containing the vector.
878
- * @param id - The ID of the vector to update.
879
- * @param update - An object containing the vector and/or metadata to update.
880
- * @param update.vector - An optional array of numbers representing the new vector.
881
- * @param update.metadata - An optional record containing the new metadata.
882
- * @returns A promise that resolves when the update is complete.
883
- * @throws Will throw an error if no updates are provided or if the update operation fails.
884
- */
885
- async updateIndexById(indexName, id, update) {
886
- this.logger.warn(
887
- `Deprecation Warning: updateIndexById() is deprecated.
888
- Please use updateVector() instead.
889
- updateIndexById() will be removed on May 20th, 2025.`
890
- );
891
- await this.updateVector({ indexName, id, update });
892
- }
893
842
  /**
894
843
  * Updates a vector by its ID with the provided vector and/or metadata.
895
844
  * @param indexName - The name of the index containing the vector.
@@ -900,9 +849,7 @@ var PgVector = class extends vector.MastraVector {
900
849
  * @returns A promise that resolves when the update is complete.
901
850
  * @throws Will throw an error if no updates are provided or if the update operation fails.
902
851
  */
903
- async updateVector(...args) {
904
- const params = this.normalizeArgs("updateVector", args);
905
- const { indexName, id, update } = params;
852
+ async updateVector({ indexName, id, update }) {
906
853
  if (!update.vector && !update.metadata) {
907
854
  throw new Error("No updates provided");
908
855
  }
@@ -937,32 +884,13 @@ var PgVector = class extends vector.MastraVector {
937
884
  }
938
885
  }
939
886
  /**
940
- * @deprecated Use {@link deleteVector} instead. This method will be removed on May 20th, 2025.
941
- *
942
887
  * Deletes a vector by its ID.
943
888
  * @param indexName - The name of the index containing the vector.
944
889
  * @param id - The ID of the vector to delete.
945
890
  * @returns A promise that resolves when the deletion is complete.
946
891
  * @throws Will throw an error if the deletion operation fails.
947
892
  */
948
- async deleteIndexById(indexName, id) {
949
- this.logger.warn(
950
- `Deprecation Warning: deleteIndexById() is deprecated.
951
- Please use deleteVector() instead.
952
- deleteIndexById() will be removed on May 20th, 2025.`
953
- );
954
- await this.deleteVector({ indexName, id });
955
- }
956
- /**
957
- * Deletes a vector by its ID.
958
- * @param indexName - The name of the index containing the vector.
959
- * @param id - The ID of the vector to delete.
960
- * @returns A promise that resolves when the deletion is complete.
961
- * @throws Will throw an error if the deletion operation fails.
962
- */
963
- async deleteVector(...args) {
964
- const params = this.normalizeArgs("deleteVector", args);
965
- const { indexName, id } = params;
893
+ async deleteVector({ indexName, id }) {
966
894
  const client = await this.pool.connect();
967
895
  try {
968
896
  const tableName = this.getTableName(indexName);
@@ -1003,12 +931,7 @@ var PostgresStore = class extends storage.MastraStorage {
1003
931
  }
1004
932
  super({ name: "PostgresStore" });
1005
933
  this.pgp = pgPromise__default.default();
1006
- if ("schema" in config && config.schema) {
1007
- console.warn(
1008
- '[DEPRECATION NOTICE] The "schema" option in PostgresStore is deprecated. Please use "schemaName" instead. Support for "schema" will be removed on May 20th, 2025.'
1009
- );
1010
- }
1011
- this.schema = config.schemaName ?? config.schema;
934
+ this.schema = config.schemaName;
1012
935
  this.db = this.pgp(
1013
936
  `connectionString` in config ? { connectionString: config.connectionString } : {
1014
937
  host: config.host,