@mastra/pg 0.12.3 → 0.12.4-alpha.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.12.3-alpha.0 build /home/runner/work/mastra/mastra/stores/pg
2
+ > @mastra/pg@0.12.4-alpha.0 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.5.0
8
8
  TSC Build start
9
- TSC ⚡️ Build success in 12290ms
9
+ TSC ⚡️ Build success in 18224ms
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 12231ms
16
+ DTS ⚡️ Build success in 13124ms
17
17
  CLI Cleaning output folder
18
18
  ESM Build start
19
19
  CJS Build start
20
- ESM dist/index.js 86.90 KB
21
- ESM ⚡️ Build success in 1870ms
22
- CJS dist/index.cjs 88.28 KB
23
- CJS ⚡️ Build success in 1870ms
20
+ ESM dist/index.js 102.98 KB
21
+ ESM ⚡️ Build success in 2337ms
22
+ CJS dist/index.cjs 104.50 KB
23
+ CJS ⚡️ Build success in 2337ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @mastra/pg
2
2
 
3
+ ## 0.12.4-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 7ba91fa: Throw mastra errors methods not implemented yet
8
+ - a74b8e3: Wrapped the query method logic inside of a transaction to ensure `SET LOCAL` works as expected -- properly sets the `hnsw.ef_search` value
9
+ - Updated dependencies [f248d53]
10
+ - Updated dependencies [2affc57]
11
+ - Updated dependencies [66e13e3]
12
+ - Updated dependencies [edd9482]
13
+ - Updated dependencies [18344d7]
14
+ - Updated dependencies [9d372c2]
15
+ - Updated dependencies [40c2525]
16
+ - Updated dependencies [e473f27]
17
+ - Updated dependencies [032cb66]
18
+ - Updated dependencies [703ac71]
19
+ - Updated dependencies [a723d69]
20
+ - Updated dependencies [5889a31]
21
+ - Updated dependencies [65e3395]
22
+ - Updated dependencies [4933192]
23
+ - Updated dependencies [d1c77a4]
24
+ - Updated dependencies [bea9dd1]
25
+ - Updated dependencies [dcd4802]
26
+ - Updated dependencies [7ba91fa]
27
+ - @mastra/core@0.11.0-alpha.2
28
+
3
29
  ## 0.12.3
4
30
 
5
31
  ### Patch Changes
@@ -5,34 +5,53 @@ import type { DeleteIndexParams } from '@mastra/core/vector';
5
5
  import type { DeleteVectorParams } from '@mastra/core/vector';
6
6
  import type { DescribeIndexParams } from '@mastra/core/vector';
7
7
  import type { EvalRow } from '@mastra/core/storage';
8
+ import type { IDatabase } from 'pg-promise';
8
9
  import type { IndexStats } from '@mastra/core/vector';
9
10
  import type { ISSLConfig } from 'pg-promise/typescript/pg-subset';
11
+ import { LegacyEvalsStorage } from '@mastra/core/storage';
10
12
  import type { LogicalOperatorValueMap } from '@mastra/core/vector/filter';
11
13
  import type { MastraMessageContentV2 } from '@mastra/core/agent';
12
14
  import type { MastraMessageV1 } from '@mastra/core/memory';
13
15
  import type { MastraMessageV2 } from '@mastra/core/agent';
16
+ import type { MastraMessageV2 as MastraMessageV2_2 } from '@mastra/core/memory';
14
17
  import { MastraStorage } from '@mastra/core/storage';
15
18
  import { MastraVector } from '@mastra/core/vector';
19
+ import { MemoryStorage } from '@mastra/core/storage';
16
20
  import type { OperatorSupport } from '@mastra/core/vector/filter';
17
21
  import type { OperatorValueMap } from '@mastra/core/vector/filter';
18
22
  import type { PaginationArgs } from '@mastra/core/storage';
19
23
  import type { PaginationInfo } from '@mastra/core/storage';
24
+ import type { PaginationInfo as PaginationInfo_2 } from '@mastra/core';
20
25
  import pg from 'pg';
21
26
  import pgPromise from 'pg-promise';
22
27
  import type { QueryResult } from '@mastra/core/vector';
23
28
  import type { QueryVectorParams } from '@mastra/core/vector';
29
+ import type { ScoreRowData } from '@mastra/core/scores';
30
+ import { ScoresStorage } from '@mastra/core/storage';
24
31
  import type { StorageColumn } from '@mastra/core/storage';
32
+ import type { StorageDomains } from '@mastra/core/storage';
25
33
  import type { StorageGetMessagesArg } from '@mastra/core/storage';
34
+ import type { StorageGetTracesArg } from '@mastra/core/storage';
35
+ import type { StorageGetTracesPaginatedArg } from '@mastra/core/storage';
36
+ import type { StoragePagination } from '@mastra/core/storage';
37
+ import type { StoragePagination as StoragePagination_2 } from '@mastra/core';
26
38
  import type { StorageResourceType } from '@mastra/core/storage';
27
39
  import type { StorageThreadType } from '@mastra/core/memory';
40
+ import { StoreOperations } from '@mastra/core/storage';
28
41
  import type { TABLE_NAMES } from '@mastra/core/storage';
42
+ import type { Trace } from '@mastra/core/telemetry';
43
+ import { TracesStorage } from '@mastra/core/storage';
29
44
  import type { UpdateVectorParams } from '@mastra/core/vector';
30
45
  import type { UpsertVectorParams } from '@mastra/core/vector';
31
46
  import type { VectorFieldValue } from '@mastra/core/vector/filter';
32
47
  import type { VectorFilter } from '@mastra/core/vector/filter';
33
48
  import type { WorkflowRun } from '@mastra/core/storage';
49
+ import type { WorkflowRun as WorkflowRun_2 } from '@mastra/core';
34
50
  import type { WorkflowRuns } from '@mastra/core/storage';
51
+ import type { WorkflowRuns as WorkflowRuns_2 } from '@mastra/core';
35
52
  import type { WorkflowRunState } from '@mastra/core/workflows';
53
+ import type { WorkflowRunState as WorkflowRunState_2 } from '@mastra/core';
54
+ import { WorkflowsStorage } from '@mastra/core/storage';
36
55
 
37
56
  export declare const baseTestConfigs: {
38
57
  smokeTests: {
@@ -73,6 +92,8 @@ export declare const calculateRecall: (actual: number[], expected: number[], k:
73
92
 
74
93
  export declare const calculateTimeout: (dimension: number, size: number, k: number) => number;
75
94
 
95
+ export declare const connectionString: string;
96
+
76
97
  export declare function cosineSimilarity(a: number[], b: number[]): number;
77
98
 
78
99
  declare interface FilterResult {
@@ -105,12 +126,19 @@ export declare function getIndexDescription({ type, hnsw, }: {
105
126
 
106
127
  export declare const getListCount: (indexConfig: IndexConfig, size: number) => number | undefined;
107
128
 
129
+ export declare function getSchemaName(schema?: string): string | undefined;
130
+
108
131
  export declare function getSearchEf(k: number, m: number): {
109
132
  default: number;
110
133
  lower: number;
111
134
  higher: number;
112
135
  };
113
136
 
137
+ export declare function getTableName({ indexName, schemaName }: {
138
+ indexName: string;
139
+ schemaName?: string;
140
+ }): string;
141
+
114
142
  export declare const groupBy: <T, K extends keyof T>(array: T[], key: K | ((item: T) => string), reducer?: (group: T[]) => any) => Record<string, any>;
115
143
 
116
144
  declare interface HNSWConfig {
@@ -130,8 +158,106 @@ declare interface IVFConfig {
130
158
  lists?: number;
131
159
  }
132
160
 
161
+ export declare class LegacyEvalsPG extends LegacyEvalsStorage {
162
+ private client;
163
+ private schema;
164
+ constructor({ client, schema }: {
165
+ client: IDatabase<{}>;
166
+ schema: string;
167
+ });
168
+ /** @deprecated use getEvals instead */
169
+ getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
170
+ getEvals(options?: {
171
+ agentName?: string;
172
+ type?: 'test' | 'live';
173
+ } & PaginationArgs): Promise<PaginationInfo & {
174
+ evals: EvalRow[];
175
+ }>;
176
+ }
177
+
133
178
  export declare function measureLatency<T>(fn: () => Promise<T>): Promise<[number, T]>;
134
179
 
180
+ export declare class MemoryPG extends MemoryStorage {
181
+ private client;
182
+ private schema;
183
+ private operations;
184
+ constructor({ client, schema, operations, }: {
185
+ client: IDatabase<{}>;
186
+ schema: string;
187
+ operations: StoreOperationsPG;
188
+ });
189
+ getThreadById({ threadId }: {
190
+ threadId: string;
191
+ }): Promise<StorageThreadType | null>;
192
+ /**
193
+ * @deprecated use getThreadsByResourceIdPaginated instead
194
+ */
195
+ getThreadsByResourceId(args: {
196
+ resourceId: string;
197
+ }): Promise<StorageThreadType[]>;
198
+ getThreadsByResourceIdPaginated(args: {
199
+ resourceId: string;
200
+ page: number;
201
+ perPage: number;
202
+ }): Promise<PaginationInfo & {
203
+ threads: StorageThreadType[];
204
+ }>;
205
+ saveThread({ thread }: {
206
+ thread: StorageThreadType;
207
+ }): Promise<StorageThreadType>;
208
+ updateThread({ id, title, metadata, }: {
209
+ id: string;
210
+ title: string;
211
+ metadata: Record<string, unknown>;
212
+ }): Promise<StorageThreadType>;
213
+ deleteThread({ threadId }: {
214
+ threadId: string;
215
+ }): Promise<void>;
216
+ private _getIncludedMessages;
217
+ /**
218
+ * @deprecated use getMessagesPaginated instead
219
+ */
220
+ getMessages(args: StorageGetMessagesArg & {
221
+ format?: 'v1';
222
+ }): Promise<MastraMessageV1[]>;
223
+ getMessages(args: StorageGetMessagesArg & {
224
+ format: 'v2';
225
+ }): Promise<MastraMessageV2_2[]>;
226
+ getMessagesPaginated(args: StorageGetMessagesArg & {
227
+ format?: 'v1' | 'v2';
228
+ }): Promise<PaginationInfo & {
229
+ messages: MastraMessageV1[] | MastraMessageV2_2[];
230
+ }>;
231
+ saveMessages(args: {
232
+ messages: MastraMessageV1[];
233
+ format?: undefined | 'v1';
234
+ }): Promise<MastraMessageV1[]>;
235
+ saveMessages(args: {
236
+ messages: MastraMessageV2_2[];
237
+ format: 'v2';
238
+ }): Promise<MastraMessageV2_2[]>;
239
+ updateMessages({ messages, }: {
240
+ messages: (Partial<Omit<MastraMessageV2_2, 'createdAt'>> & {
241
+ id: string;
242
+ content?: {
243
+ metadata?: MastraMessageContentV2['metadata'];
244
+ content?: MastraMessageContentV2['content'];
245
+ };
246
+ })[];
247
+ }): Promise<MastraMessageV2_2[]>;
248
+ getResourceById({ resourceId }: {
249
+ resourceId: string;
250
+ }): Promise<StorageResourceType | null>;
251
+ saveResource({ resource }: {
252
+ resource: StorageResourceType;
253
+ }): Promise<StorageResourceType>;
254
+ updateResource({ resourceId, workingMemory, metadata, }: {
255
+ resourceId: string;
256
+ workingMemory?: string;
257
+ metadata?: Record<string, unknown>;
258
+ }): Promise<StorageResourceType>;
259
+ }
260
+
135
261
  declare type PGBlacklisted = BlacklistedRootOperators | '$contains' | '$size';
136
262
 
137
263
  declare interface PgCreateIndexParams extends CreateIndexParams {
@@ -200,6 +326,8 @@ declare interface PgQueryVectorParams extends QueryVectorParams<PGVectorFilter>
200
326
  probes?: number;
201
327
  }
202
328
 
329
+ export declare function pgTests(): void;
330
+
203
331
  declare class PgVector extends MastraVector<PGVectorFilter> {
204
332
  pool: pg.Pool;
205
333
  private describeIndexCache;
@@ -292,56 +420,38 @@ export { PostgresConfig as PostgresConfig_alias_1 }
292
420
  declare class PostgresStore extends MastraStorage {
293
421
  db: pgPromise.IDatabase<{}>;
294
422
  pgp: pgPromise.IMain;
423
+ private client;
295
424
  private schema?;
296
- private setupSchemaPromise;
297
- private schemaSetupComplete;
425
+ stores: StorageDomains;
298
426
  constructor(config: PostgresConfig);
299
427
  get supports(): {
300
428
  selectByIncludeResourceScope: boolean;
301
429
  resourceWorkingMemory: boolean;
430
+ hasColumn: boolean;
431
+ createTable: boolean;
302
432
  };
303
- private getTableName;
304
- private getSchemaName;
305
433
  /** @deprecated use getEvals instead */
306
434
  getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
307
- private transformEvalRow;
308
- batchInsert({ tableName, records }: {
309
- tableName: TABLE_NAMES;
310
- records: Record<string, any>[];
311
- }): Promise<void>;
435
+ getEvals(options?: {
436
+ agentName?: string;
437
+ type?: 'test' | 'live';
438
+ } & PaginationArgs): Promise<PaginationInfo & {
439
+ evals: EvalRow[];
440
+ }>;
312
441
  /**
313
442
  * @deprecated use getTracesPaginated instead
314
443
  */
315
- getTraces(args: {
316
- name?: string;
317
- scope?: string;
318
- attributes?: Record<string, string>;
319
- filters?: Record<string, any>;
320
- page: number;
321
- perPage?: number;
322
- fromDate?: Date;
323
- toDate?: Date;
324
- }): Promise<any[]>;
325
- getTracesPaginated(args: {
326
- name?: string;
327
- scope?: string;
328
- attributes?: Record<string, string>;
329
- filters?: Record<string, any>;
330
- } & PaginationArgs): Promise<PaginationInfo & {
331
- traces: any[];
444
+ getTraces(args: StorageGetTracesArg): Promise<Trace[]>;
445
+ getTracesPaginated(args: StorageGetTracesPaginatedArg): Promise<PaginationInfo & {
446
+ traces: Trace[];
332
447
  }>;
333
- private setupSchema;
448
+ batchTraceInsert({ records }: {
449
+ records: Record<string, any>[];
450
+ }): Promise<void>;
334
451
  createTable({ tableName, schema, }: {
335
452
  tableName: TABLE_NAMES;
336
453
  schema: Record<string, StorageColumn>;
337
454
  }): Promise<void>;
338
- protected getDefaultValue(type: StorageColumn['type']): string;
339
- /**
340
- * Alters table schema to add columns if they don't exist
341
- * @param tableName Name of the table
342
- * @param schema Schema of the table
343
- * @param ifNotExists Array of column names to add if they don't exist
344
- */
345
455
  alterTable({ tableName, schema, ifNotExists, }: {
346
456
  tableName: TABLE_NAMES;
347
457
  schema: Record<string, StorageColumn>;
@@ -350,14 +460,24 @@ declare class PostgresStore extends MastraStorage {
350
460
  clearTable({ tableName }: {
351
461
  tableName: TABLE_NAMES;
352
462
  }): Promise<void>;
463
+ dropTable({ tableName }: {
464
+ tableName: TABLE_NAMES;
465
+ }): Promise<void>;
353
466
  insert({ tableName, record }: {
354
467
  tableName: TABLE_NAMES;
355
468
  record: Record<string, any>;
356
469
  }): Promise<void>;
470
+ batchInsert({ tableName, records }: {
471
+ tableName: TABLE_NAMES;
472
+ records: Record<string, any>[];
473
+ }): Promise<void>;
357
474
  load<R>({ tableName, keys }: {
358
475
  tableName: TABLE_NAMES;
359
476
  keys: Record<string, string>;
360
477
  }): Promise<R | null>;
478
+ /**
479
+ * Memory
480
+ */
361
481
  getThreadById({ threadId }: {
362
482
  threadId: string;
363
483
  }): Promise<StorageThreadType | null>;
@@ -369,7 +489,9 @@ declare class PostgresStore extends MastraStorage {
369
489
  }): Promise<StorageThreadType[]>;
370
490
  getThreadsByResourceIdPaginated(args: {
371
491
  resourceId: string;
372
- } & PaginationArgs): Promise<PaginationInfo & {
492
+ page: number;
493
+ perPage: number;
494
+ }): Promise<PaginationInfo & {
373
495
  threads: StorageThreadType[];
374
496
  }>;
375
497
  saveThread({ thread }: {
@@ -383,7 +505,6 @@ declare class PostgresStore extends MastraStorage {
383
505
  deleteThread({ threadId }: {
384
506
  threadId: string;
385
507
  }): Promise<void>;
386
- private _getIncludedMessages;
387
508
  /**
388
509
  * @deprecated use getMessagesPaginated instead
389
510
  */
@@ -406,6 +527,29 @@ declare class PostgresStore extends MastraStorage {
406
527
  messages: MastraMessageV2[];
407
528
  format: 'v2';
408
529
  }): Promise<MastraMessageV2[]>;
530
+ updateMessages({ messages, }: {
531
+ messages: (Partial<Omit<MastraMessageV2, 'createdAt'>> & {
532
+ id: string;
533
+ content?: {
534
+ metadata?: MastraMessageContentV2['metadata'];
535
+ content?: MastraMessageContentV2['content'];
536
+ };
537
+ })[];
538
+ }): Promise<MastraMessageV2[]>;
539
+ getResourceById({ resourceId }: {
540
+ resourceId: string;
541
+ }): Promise<StorageResourceType | null>;
542
+ saveResource({ resource }: {
543
+ resource: StorageResourceType;
544
+ }): Promise<StorageResourceType>;
545
+ updateResource({ resourceId, workingMemory, metadata, }: {
546
+ resourceId: string;
547
+ workingMemory?: string;
548
+ metadata?: Record<string, unknown>;
549
+ }): Promise<StorageResourceType>;
550
+ /**
551
+ * Workflows
552
+ */
409
553
  persistWorkflowSnapshot({ workflowName, runId, snapshot, }: {
410
554
  workflowName: string;
411
555
  runId: string;
@@ -415,8 +559,6 @@ declare class PostgresStore extends MastraStorage {
415
559
  workflowName: string;
416
560
  runId: string;
417
561
  }): Promise<WorkflowRunState | null>;
418
- private hasColumn;
419
- private parseWorkflowRun;
420
562
  getWorkflowRuns({ workflowName, fromDate, toDate, limit, offset, resourceId, }?: {
421
563
  workflowName?: string;
422
564
  fromDate?: Date;
@@ -430,36 +572,127 @@ declare class PostgresStore extends MastraStorage {
430
572
  workflowName?: string;
431
573
  }): Promise<WorkflowRun | null>;
432
574
  close(): Promise<void>;
433
- getEvals(options?: {
434
- agentName?: string;
435
- type?: 'test' | 'live';
436
- } & PaginationArgs): Promise<PaginationInfo & {
437
- evals: EvalRow[];
575
+ /**
576
+ * Scorers
577
+ */
578
+ getScoreById({ id: _id }: {
579
+ id: string;
580
+ }): Promise<ScoreRowData | null>;
581
+ getScoresByScorerId({ scorerId: _scorerId, pagination: _pagination, }: {
582
+ scorerId: string;
583
+ pagination: StoragePagination;
584
+ }): Promise<{
585
+ pagination: PaginationInfo;
586
+ scores: ScoreRowData[];
587
+ }>;
588
+ saveScore(_score: ScoreRowData): Promise<{
589
+ score: ScoreRowData;
590
+ }>;
591
+ getScoresByRunId({ runId: _runId, pagination: _pagination, }: {
592
+ runId: string;
593
+ pagination: StoragePagination;
594
+ }): Promise<{
595
+ pagination: PaginationInfo;
596
+ scores: ScoreRowData[];
597
+ }>;
598
+ getScoresByEntityId({ entityId: _entityId, entityType: _entityType, pagination: _pagination, }: {
599
+ pagination: StoragePagination;
600
+ entityId: string;
601
+ entityType: string;
602
+ }): Promise<{
603
+ pagination: PaginationInfo;
604
+ scores: ScoreRowData[];
438
605
  }>;
439
- updateMessages({ messages, }: {
440
- messages: (Partial<Omit<MastraMessageV2, 'createdAt'>> & {
441
- id: string;
442
- content?: {
443
- metadata?: MastraMessageContentV2['metadata'];
444
- content?: MastraMessageContentV2['content'];
445
- };
446
- })[];
447
- }): Promise<MastraMessageV2[]>;
448
- getResourceById({ resourceId }: {
449
- resourceId: string;
450
- }): Promise<StorageResourceType | null>;
451
- saveResource({ resource }: {
452
- resource: StorageResourceType;
453
- }): Promise<StorageResourceType>;
454
- updateResource({ resourceId, workingMemory, metadata, }: {
455
- resourceId: string;
456
- workingMemory?: string;
457
- metadata?: Record<string, unknown>;
458
- }): Promise<StorageResourceType>;
459
606
  }
460
607
  export { PostgresStore }
461
608
  export { PostgresStore as PostgresStore_alias_1 }
462
609
 
610
+ export declare class ScoresPG extends ScoresStorage {
611
+ client: IDatabase<{}>;
612
+ private operations;
613
+ constructor({ client, operations }: {
614
+ client: IDatabase<{}>;
615
+ operations: StoreOperationsPG;
616
+ });
617
+ getScoreById({ id }: {
618
+ id: string;
619
+ }): Promise<ScoreRowData | null>;
620
+ getScoresByScorerId({ scorerId, pagination, }: {
621
+ scorerId: string;
622
+ pagination: StoragePagination_2;
623
+ }): Promise<{
624
+ pagination: PaginationInfo_2;
625
+ scores: ScoreRowData[];
626
+ }>;
627
+ saveScore(score: Omit<ScoreRowData, 'createdAt' | 'updatedAt'>): Promise<{
628
+ score: ScoreRowData;
629
+ }>;
630
+ getScoresByRunId({ runId, pagination, }: {
631
+ runId: string;
632
+ pagination: StoragePagination_2;
633
+ }): Promise<{
634
+ pagination: PaginationInfo_2;
635
+ scores: ScoreRowData[];
636
+ }>;
637
+ getScoresByEntityId({ entityId, entityType, pagination, }: {
638
+ pagination: StoragePagination_2;
639
+ entityId: string;
640
+ entityType: string;
641
+ }): Promise<{
642
+ pagination: PaginationInfo_2;
643
+ scores: ScoreRowData[];
644
+ }>;
645
+ }
646
+
647
+ export declare class StoreOperationsPG extends StoreOperations {
648
+ client: IDatabase<{}>;
649
+ schemaName?: string;
650
+ private setupSchemaPromise;
651
+ private schemaSetupComplete;
652
+ constructor({ client, schemaName }: {
653
+ client: IDatabase<{}>;
654
+ schemaName?: string;
655
+ });
656
+ hasColumn(table: string, column: string): Promise<boolean>;
657
+ private setupSchema;
658
+ insert({ tableName, record }: {
659
+ tableName: TABLE_NAMES;
660
+ record: Record<string, any>;
661
+ }): Promise<void>;
662
+ clearTable({ tableName }: {
663
+ tableName: TABLE_NAMES;
664
+ }): Promise<void>;
665
+ protected getDefaultValue(type: StorageColumn['type']): string;
666
+ createTable({ tableName, schema, }: {
667
+ tableName: TABLE_NAMES;
668
+ schema: Record<string, StorageColumn>;
669
+ }): Promise<void>;
670
+ /**
671
+ * Alters table schema to add columns if they don't exist
672
+ * @param tableName Name of the table
673
+ * @param schema Schema of the table
674
+ * @param ifNotExists Array of column names to add if they don't exist
675
+ */
676
+ alterTable({ tableName, schema, ifNotExists, }: {
677
+ tableName: TABLE_NAMES;
678
+ schema: Record<string, StorageColumn>;
679
+ ifNotExists: string[];
680
+ }): Promise<void>;
681
+ load<R>({ tableName, keys }: {
682
+ tableName: TABLE_NAMES;
683
+ keys: Record<string, string>;
684
+ }): Promise<R | null>;
685
+ batchInsert({ tableName, records }: {
686
+ tableName: TABLE_NAMES;
687
+ records: Record<string, any>[];
688
+ }): Promise<void>;
689
+ dropTable({ tableName }: {
690
+ tableName: TABLE_NAMES;
691
+ }): Promise<void>;
692
+ }
693
+
694
+ export declare const TEST_CONFIG: PostgresConfig;
695
+
463
696
  export declare interface TestConfig {
464
697
  dimension: number;
465
698
  size: number;
@@ -494,6 +727,56 @@ export declare interface TestResult {
494
727
  };
495
728
  }
496
729
 
730
+ export declare class TracesPG extends TracesStorage {
731
+ client: IDatabase<{}>;
732
+ private operations;
733
+ private schema?;
734
+ constructor({ client, operations, schema, }: {
735
+ client: IDatabase<{}>;
736
+ operations: StoreOperationsPG;
737
+ schema?: string;
738
+ });
739
+ getTraces(args: StorageGetTracesArg): Promise<Trace[]>;
740
+ getTracesPaginated(args: StorageGetTracesPaginatedArg): Promise<PaginationInfo & {
741
+ traces: Trace[];
742
+ }>;
743
+ batchTraceInsert({ records }: {
744
+ records: Record<string, any>[];
745
+ }): Promise<void>;
746
+ }
747
+
497
748
  export declare function warmupQuery(vectorDB: PgVector, indexName: string, dimension: number, k: number): Promise<void>;
498
749
 
750
+ export declare class WorkflowsPG extends WorkflowsStorage {
751
+ client: IDatabase<{}>;
752
+ private operations;
753
+ private schema;
754
+ constructor({ client, operations, schema, }: {
755
+ client: IDatabase<{}>;
756
+ operations: StoreOperationsPG;
757
+ schema: string;
758
+ });
759
+ persistWorkflowSnapshot({ workflowName, runId, snapshot, }: {
760
+ workflowName: string;
761
+ runId: string;
762
+ snapshot: WorkflowRunState_2;
763
+ }): Promise<void>;
764
+ loadWorkflowSnapshot({ workflowName, runId, }: {
765
+ workflowName: string;
766
+ runId: string;
767
+ }): Promise<WorkflowRunState_2 | null>;
768
+ getWorkflowRunById({ runId, workflowName, }: {
769
+ runId: string;
770
+ workflowName?: string;
771
+ }): Promise<WorkflowRun_2 | null>;
772
+ getWorkflowRuns({ workflowName, fromDate, toDate, limit, offset, resourceId, }?: {
773
+ workflowName?: string;
774
+ fromDate?: Date;
775
+ toDate?: Date;
776
+ limit?: number;
777
+ offset?: number;
778
+ resourceId?: string;
779
+ }): Promise<WorkflowRuns_2>;
780
+ }
781
+
499
782
  export { }