@mastra/pg 1.0.0-beta.0 → 1.0.0-beta.10

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 (35) hide show
  1. package/CHANGELOG.md +495 -0
  2. package/README.md +3 -0
  3. package/dist/index.cjs +2976 -2039
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.js +2960 -2028
  6. package/dist/index.js.map +1 -1
  7. package/dist/shared/config.d.ts +98 -3
  8. package/dist/shared/config.d.ts.map +1 -1
  9. package/dist/storage/{domains/operations → db}/index.d.ts +77 -45
  10. package/dist/storage/db/index.d.ts.map +1 -0
  11. package/dist/storage/domains/agents/index.d.ts +39 -0
  12. package/dist/storage/domains/agents/index.d.ts.map +1 -0
  13. package/dist/storage/domains/memory/index.d.ts +30 -11
  14. package/dist/storage/domains/memory/index.d.ts.map +1 -1
  15. package/dist/storage/domains/observability/index.d.ts +29 -36
  16. package/dist/storage/domains/observability/index.d.ts.map +1 -1
  17. package/dist/storage/domains/scores/index.d.ts +26 -29
  18. package/dist/storage/domains/scores/index.d.ts.map +1 -1
  19. package/dist/storage/domains/utils.d.ts +1 -5
  20. package/dist/storage/domains/utils.d.ts.map +1 -1
  21. package/dist/storage/domains/workflows/index.d.ts +31 -20
  22. package/dist/storage/domains/workflows/index.d.ts.map +1 -1
  23. package/dist/storage/index.d.ts +30 -195
  24. package/dist/storage/index.d.ts.map +1 -1
  25. package/dist/storage/performance-indexes/performance-test.d.ts +3 -1
  26. package/dist/storage/performance-indexes/performance-test.d.ts.map +1 -1
  27. package/dist/storage/test-utils.d.ts.map +1 -1
  28. package/dist/vector/index.d.ts +42 -6
  29. package/dist/vector/index.d.ts.map +1 -1
  30. package/dist/vector/sql-builder.d.ts +4 -0
  31. package/dist/vector/sql-builder.d.ts.map +1 -1
  32. package/dist/vector/types.d.ts +10 -0
  33. package/dist/vector/types.d.ts.map +1 -1
  34. package/package.json +8 -7
  35. package/dist/storage/domains/operations/index.d.ts.map +0 -1
@@ -1,6 +1,8 @@
1
- import type { ConnectionOptions } from 'tls';
1
+ import type { ConnectionOptions } from 'node:tls';
2
+ import type { CreateIndexOptions } from '@mastra/core/storage';
2
3
  import type { ClientConfig } from 'pg';
3
4
  import type * as pg from 'pg';
5
+ import type pgPromise from 'pg-promise';
4
6
  import type { ISSLConfig } from 'pg-promise/typescript/pg-subset';
5
7
  /**
6
8
  * Generic PostgreSQL configuration type.
@@ -11,6 +13,55 @@ export type PostgresConfig<SSLType = ISSLConfig | ConnectionOptions> = {
11
13
  schemaName?: string;
12
14
  max?: number;
13
15
  idleTimeoutMillis?: number;
16
+ /**
17
+ * When true, automatic initialization (table creation/migrations) is disabled.
18
+ * This is useful for CI/CD pipelines where you want to:
19
+ * 1. Run migrations explicitly during deployment (not at runtime)
20
+ * 2. Use different credentials for schema changes vs runtime operations
21
+ *
22
+ * When disableInit is true:
23
+ * - The storage will not automatically create/alter tables on first use
24
+ * - You must call `storage.init()` explicitly in your CI/CD scripts
25
+ *
26
+ * @example
27
+ * // In CI/CD script:
28
+ * const storage = new PostgresStore({ ...config, disableInit: false });
29
+ * await storage.init(); // Explicitly run migrations
30
+ *
31
+ * // In runtime application:
32
+ * const storage = new PostgresStore({ ...config, disableInit: true });
33
+ * // No auto-init, tables must already exist
34
+ */
35
+ disableInit?: boolean;
36
+ /**
37
+ * When true, default indexes will not be created during initialization.
38
+ * This is useful when:
39
+ * 1. You want to manage indexes separately or use custom indexes only
40
+ * 2. Default indexes don't match your query patterns
41
+ * 3. You want to reduce initialization time in development
42
+ *
43
+ * @default false
44
+ */
45
+ skipDefaultIndexes?: boolean;
46
+ /**
47
+ * Custom indexes to create during initialization.
48
+ * These indexes are created in addition to default indexes (unless skipDefaultIndexes is true).
49
+ *
50
+ * Each index must specify which table it belongs to. The store will route each index
51
+ * to the appropriate domain based on the table name.
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * const store = new PostgresStore({
56
+ * connectionString: '...',
57
+ * indexes: [
58
+ * { name: 'my_threads_type_idx', table: 'mastra_threads', columns: ['metadata->>\'type\''] },
59
+ * { name: 'my_messages_status_idx', table: 'mastra_messages', columns: ['metadata->>\'status\''] },
60
+ * ],
61
+ * });
62
+ * ```
63
+ */
64
+ indexes?: CreateIndexOptions[];
14
65
  } & ({
15
66
  host: string;
16
67
  port: number;
@@ -24,8 +75,41 @@ export type PostgresConfig<SSLType = ISSLConfig | ConnectionOptions> = {
24
75
  } | ClientConfig);
25
76
  /**
26
77
  * PostgreSQL configuration for PostgresStore (uses pg-promise with ISSLConfig)
78
+ *
79
+ * Accepts either:
80
+ * - A pre-configured pg-promise client: `{ id, client, schemaName? }`
81
+ * - Connection string: `{ id, connectionString, ... }`
82
+ * - Host/port config: `{ id, host, port, database, user, password, ... }`
83
+ * - Cloud SQL connector config: `{ id, stream, ... }`
27
84
  */
28
- export type PostgresStoreConfig = PostgresConfig<ISSLConfig>;
85
+ export type PostgresStoreConfig = PostgresConfig<ISSLConfig> | {
86
+ id: string;
87
+ /**
88
+ * Pre-configured pg-promise database client.
89
+ * Use this when you need to configure the client before initialization,
90
+ * e.g., to add pool listeners or set connection-level settings.
91
+ *
92
+ * @example
93
+ * ```typescript
94
+ * import pgPromise from 'pg-promise';
95
+ *
96
+ * const pgp = pgPromise();
97
+ * const client = pgp({ connectionString: '...' });
98
+ *
99
+ * // Custom setup before using
100
+ * client.$pool.on('connect', async (poolClient) => {
101
+ * await poolClient.query('SET ROLE my_role;');
102
+ * });
103
+ *
104
+ * const store = new PostgresStore({ id: 'my-store', client });
105
+ * ```
106
+ */
107
+ client: pgPromise.IDatabase<{}>;
108
+ schemaName?: string;
109
+ disableInit?: boolean;
110
+ skipDefaultIndexes?: boolean;
111
+ indexes?: CreateIndexOptions[];
112
+ };
29
113
  /**
30
114
  * PostgreSQL configuration for PgVector (uses pg with ConnectionOptions)
31
115
  */
@@ -45,5 +129,16 @@ export declare const isHostConfig: <SSLType>(cfg: PostgresConfig<SSLType>) => cf
45
129
  ssl?: boolean | SSLType;
46
130
  };
47
131
  export declare const isCloudSqlConfig: <SSLType>(cfg: PostgresConfig<SSLType>) => cfg is PostgresConfig<SSLType> & ClientConfig;
48
- export declare const validateConfig: (name: string, config: PostgresConfig<ISSLConfig | ConnectionOptions>) => void;
132
+ /**
133
+ * Type guard for pre-configured client config (PostgresStore only)
134
+ */
135
+ export declare const isClientConfig: (cfg: PostgresStoreConfig) => cfg is {
136
+ id: string;
137
+ client: pgPromise.IDatabase<{}>;
138
+ schemaName?: string;
139
+ disableInit?: boolean;
140
+ skipDefaultIndexes?: boolean;
141
+ indexes?: CreateIndexOptions[];
142
+ };
143
+ export declare const validateConfig: (name: string, config: PostgresStoreConfig) => void;
49
144
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/shared/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,KAAK,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AACvC,OAAO,KAAK,KAAK,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAElE;;;GAGG;AACH,MAAM,MAAM,cAAc,CAAC,OAAO,GAAG,UAAU,GAAG,iBAAiB,IAAI;IACrE,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,GAAG,CACA;IACE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;CACzB,GACD;IACE,gBAAgB,EAAE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AM,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,OAAO,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAGhC,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,QAAQ,mBAAmB,SAuCvE,CAAC"}
@@ -1,16 +1,71 @@
1
- import { StoreOperations } from '@mastra/core/storage';
1
+ import { MastraBase } from '@mastra/core/base';
2
2
  import type { StorageColumn, TABLE_NAMES, CreateIndexOptions, IndexInfo, StorageIndexStats } from '@mastra/core/storage';
3
3
  import type { IDatabase } from 'pg-promise';
4
- export type { CreateIndexOptions, IndexInfo, StorageIndexStats };
5
- export declare class StoreOperationsPG extends StoreOperations {
4
+ import type { ISSLConfig } from 'pg-promise/typescript/pg-subset';
5
+ /**
6
+ * Configuration for standalone domain usage.
7
+ * Accepts either:
8
+ * 1. An existing pg-promise database instance
9
+ * 2. Config to create a new client internally
10
+ */
11
+ export type PgDomainConfig = PgDomainClientConfig | PgDomainRestConfig;
12
+ /**
13
+ * Pass an existing pg-promise database instance
14
+ */
15
+ export interface PgDomainClientConfig {
16
+ /** The pg-promise database instance */
6
17
  client: IDatabase<{}>;
18
+ /** Optional schema name (defaults to 'public') */
7
19
  schemaName?: string;
8
- private setupSchemaPromise;
9
- private schemaSetupComplete;
10
- constructor({ client, schemaName }: {
11
- client: IDatabase<{}>;
12
- schemaName?: string;
13
- });
20
+ /** When true, default indexes will not be created during initialization */
21
+ skipDefaultIndexes?: boolean;
22
+ /** Custom indexes to create for this domain's tables */
23
+ indexes?: CreateIndexOptions[];
24
+ }
25
+ /**
26
+ * Pass config to create a new pg-promise client internally
27
+ */
28
+ export type PgDomainRestConfig = {
29
+ /** Optional schema name (defaults to 'public') */
30
+ schemaName?: string;
31
+ /** When true, default indexes will not be created during initialization */
32
+ skipDefaultIndexes?: boolean;
33
+ /** Custom indexes to create for this domain's tables */
34
+ indexes?: CreateIndexOptions[];
35
+ } & ({
36
+ host: string;
37
+ port: number;
38
+ database: string;
39
+ user: string;
40
+ password: string;
41
+ ssl?: boolean | ISSLConfig;
42
+ } | {
43
+ connectionString: string;
44
+ ssl?: boolean | ISSLConfig;
45
+ });
46
+ /**
47
+ * Resolves PgDomainConfig to a pg-promise database instance and schema.
48
+ * Handles creating a new client if config is provided.
49
+ */
50
+ export declare function resolvePgConfig(config: PgDomainConfig): {
51
+ client: IDatabase<{}>;
52
+ schemaName?: string;
53
+ skipDefaultIndexes?: boolean;
54
+ indexes?: CreateIndexOptions[];
55
+ };
56
+ /**
57
+ * Internal config for PgDB - accepts already-resolved client
58
+ */
59
+ export interface PgDBInternalConfig {
60
+ client: IDatabase<{}>;
61
+ schemaName?: string;
62
+ skipDefaultIndexes?: boolean;
63
+ }
64
+ export declare class PgDB extends MastraBase {
65
+ client: IDatabase<{}>;
66
+ schemaName?: string;
67
+ skipDefaultIndexes?: boolean;
68
+ constructor(config: PgDBInternalConfig);
14
69
  hasColumn(table: string, column: string): Promise<boolean>;
15
70
  /**
16
71
  * Prepares values for insertion, handling JSONB columns by stringifying them
@@ -21,11 +76,12 @@ export declare class StoreOperationsPG extends StoreOperations {
21
76
  */
22
77
  private addTimestampZColumns;
23
78
  /**
24
- * Prepares a value for database operations, handling Date objects and JSON serialization
25
- * This is schema-aware and only stringifies objects for JSONB columns
79
+ * Prepares a value for database operations
26
80
  */
27
81
  private prepareValue;
28
82
  private setupSchema;
83
+ protected getSqlType(type: StorageColumn['type']): string;
84
+ protected getDefaultValue(type: StorageColumn['type']): string;
29
85
  insert({ tableName, record }: {
30
86
  tableName: TABLE_NAMES;
31
87
  record: Record<string, any>;
@@ -33,15 +89,16 @@ export declare class StoreOperationsPG extends StoreOperations {
33
89
  clearTable({ tableName }: {
34
90
  tableName: TABLE_NAMES;
35
91
  }): Promise<void>;
36
- protected getDefaultValue(type: StorageColumn['type']): string;
37
92
  createTable({ tableName, schema, }: {
38
93
  tableName: TABLE_NAMES;
39
94
  schema: Record<string, StorageColumn>;
40
95
  }): Promise<void>;
96
+ private setupTimestampTriggers;
41
97
  /**
42
- * Set up timestamp triggers for a table to automatically manage createdAt/updatedAt
98
+ * Migrates the spans table schema from OLD_SPAN_SCHEMA to current SPAN_SCHEMA.
99
+ * This adds new columns that don't exist in old schema.
43
100
  */
44
- private setupTimestampTriggers;
101
+ private migrateSpansTable;
45
102
  /**
46
103
  * Alters table schema to add columns if they don't exist
47
104
  * @param tableName Name of the table
@@ -64,43 +121,15 @@ export declare class StoreOperationsPG extends StoreOperations {
64
121
  dropTable({ tableName }: {
65
122
  tableName: TABLE_NAMES;
66
123
  }): Promise<void>;
67
- /**
68
- * Create a new index on a table
69
- */
70
124
  createIndex(options: CreateIndexOptions): Promise<void>;
71
- /**
72
- * Drop an existing index
73
- */
74
125
  dropIndex(indexName: string): Promise<void>;
75
- /**
76
- * List indexes for a specific table or all tables
77
- */
78
126
  listIndexes(tableName?: string): Promise<IndexInfo[]>;
79
- /**
80
- * Returns definitions for automatic performance indexes
81
- * These composite indexes cover both filtering and sorting in single index
82
- */
83
- protected getAutomaticIndexDefinitions(): CreateIndexOptions[];
84
- /**
85
- * Creates automatic indexes for optimal query performance
86
- * Uses getAutomaticIndexDefinitions() to determine which indexes to create
87
- */
88
- createAutomaticIndexes(): Promise<void>;
89
- /**
90
- * Get detailed statistics for a specific index
91
- */
92
127
  describeIndex(indexName: string): Promise<StorageIndexStats>;
93
- /**
94
- * Update a single record in the database
95
- */
96
128
  update({ tableName, keys, data, }: {
97
129
  tableName: TABLE_NAMES;
98
130
  keys: Record<string, any>;
99
131
  data: Record<string, any>;
100
132
  }): Promise<void>;
101
- /**
102
- * Update multiple records in a single batch transaction
103
- */
104
133
  batchUpdate({ tableName, updates, }: {
105
134
  tableName: TABLE_NAMES;
106
135
  updates: Array<{
@@ -108,12 +137,15 @@ export declare class StoreOperationsPG extends StoreOperations {
108
137
  data: Record<string, any>;
109
138
  }>;
110
139
  }): Promise<void>;
111
- /**
112
- * Delete multiple records by keys
113
- */
114
140
  batchDelete({ tableName, keys }: {
115
141
  tableName: TABLE_NAMES;
116
142
  keys: Record<string, any>[];
117
143
  }): Promise<void>;
144
+ /**
145
+ * Delete all data from a table (alias for clearTable for consistency with other stores)
146
+ */
147
+ deleteData({ tableName }: {
148
+ tableName: TABLE_NAMES;
149
+ }): Promise<void>;
118
150
  }
119
151
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/db/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAU/C,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,SAAS,EACT,iBAAiB,EAClB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAElE;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,oBAAoB,GAAG,kBAAkB,CAAC;AAEvE;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,uCAAuC;IACvC,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC;IACtB,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2EAA2E;IAC3E,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,wDAAwD;IACxD,OAAO,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2EAA2E;IAC3E,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,wDAAwD;IACxD,OAAO,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAChC,GAAG,CACA;IACE,IAAI,EAAE,MAAM,CAA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
+ import { AgentsStorage } from '@mastra/core/storage';
2
+ import type { StorageAgentType, StorageCreateAgentInput, StorageUpdateAgentInput, StorageListAgentsInput, StorageListAgentsOutput, CreateIndexOptions } from '@mastra/core/storage';
3
+ import type { PgDomainConfig } from '../../db/index.js';
4
+ export declare class AgentsPG extends AgentsStorage {
5
+ #private;
6
+ /** Tables managed by this domain */
7
+ static readonly MANAGED_TABLES: readonly ["mastra_agents"];
8
+ constructor(config: PgDomainConfig);
9
+ /**
10
+ * Returns default index definitions for the agents domain tables.
11
+ * Currently no default indexes are defined for agents.
12
+ */
13
+ getDefaultIndexDefinitions(): CreateIndexOptions[];
14
+ /**
15
+ * Creates default indexes for optimal query performance.
16
+ * Currently no default indexes are defined for agents.
17
+ */
18
+ createDefaultIndexes(): Promise<void>;
19
+ init(): Promise<void>;
20
+ /**
21
+ * Creates custom user-defined indexes for this domain's tables.
22
+ */
23
+ createCustomIndexes(): Promise<void>;
24
+ dangerouslyClearAll(): Promise<void>;
25
+ private parseJson;
26
+ private parseRow;
27
+ getAgentById({ id }: {
28
+ id: string;
29
+ }): Promise<StorageAgentType | null>;
30
+ createAgent({ agent }: {
31
+ agent: StorageCreateAgentInput;
32
+ }): Promise<StorageAgentType>;
33
+ updateAgent({ id, ...updates }: StorageUpdateAgentInput): Promise<StorageAgentType>;
34
+ deleteAgent({ id }: {
35
+ id: string;
36
+ }): Promise<void>;
37
+ listAgents(args?: StorageListAgentsInput): Promise<StorageListAgentsOutput>;
38
+ }
39
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/agents/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EAMd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,gBAAgB,EAChB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/C,qBAAa,QAAS,SAAQ,aAAa;;IAMzC,oCAAoC;IACpC,MAAM,CAAC,QAAQ,CAAC,cAAc,6BAA2B;gBAE7C,MAAM,EAAE,cAAc;IAUlC;;;OAGG;IACH,0BAA0B,IAAI,kBAAkB,EAAE;IAIlD;;;OAGG;IACG,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAOrC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAM3B;;OAEG;IACG,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAepC,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1C,OAAO,CAAC,SAAS;IA2BjB,OAAO,CAAC,QAAQ;IAqBV,YAAY,CAAC,EAAE,EAAE,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAwBtE,WAAW,CAAC,EAAE,KAAK,EAAE,EAAE;QAAE,KAAK,EAAE,uBAAuB,CAAA;KAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAoDrF,WAAW,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,EAAE,EAAE,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAsInF,WAAW,CAAC,EAAE,EAAE,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBlD,UAAU,CAAC,IAAI,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,uBAAuB,CAAC;CA+DlF"}
@@ -1,18 +1,27 @@
1
1
  import type { MastraMessageContentV2 } from '@mastra/core/agent';
2
2
  import type { MastraDBMessage, StorageThreadType } from '@mastra/core/memory';
3
3
  import { MemoryStorage } from '@mastra/core/storage';
4
- import type { StorageResourceType, StorageListMessagesInput, StorageListMessagesOutput, StorageListThreadsByResourceIdInput, StorageListThreadsByResourceIdOutput } from '@mastra/core/storage';
5
- import type { IDatabase } from 'pg-promise';
6
- import type { StoreOperationsPG } from '../operations/index.js';
4
+ import type { StorageResourceType, StorageListMessagesInput, StorageListMessagesOutput, StorageListThreadsByResourceIdInput, StorageListThreadsByResourceIdOutput, CreateIndexOptions } from '@mastra/core/storage';
5
+ import type { PgDomainConfig } from '../../db/index.js';
7
6
  export declare class MemoryPG extends MemoryStorage {
8
- private client;
9
- private schema;
10
- private operations;
11
- constructor({ client, schema, operations, }: {
12
- client: IDatabase<{}>;
13
- schema: string;
14
- operations: StoreOperationsPG;
15
- });
7
+ #private;
8
+ /** Tables managed by this domain */
9
+ static readonly MANAGED_TABLES: readonly ["mastra_threads", "mastra_messages", "mastra_resources"];
10
+ constructor(config: PgDomainConfig);
11
+ init(): Promise<void>;
12
+ /**
13
+ * Returns default index definitions for the memory domain tables.
14
+ */
15
+ getDefaultIndexDefinitions(): CreateIndexOptions[];
16
+ /**
17
+ * Creates default indexes for optimal query performance.
18
+ */
19
+ createDefaultIndexes(): Promise<void>;
20
+ /**
21
+ * Creates custom user-defined indexes for this domain's tables.
22
+ */
23
+ createCustomIndexes(): Promise<void>;
24
+ dangerouslyClearAll(): Promise<void>;
16
25
  /**
17
26
  * Normalizes message row from database by applying createdAtZ fallback
18
27
  */
@@ -32,6 +41,16 @@ export declare class MemoryPG extends MemoryStorage {
32
41
  deleteThread({ threadId }: {
33
42
  threadId: string;
34
43
  }): Promise<void>;
44
+ /**
45
+ * Fetches messages around target messages using cursor-based pagination.
46
+ *
47
+ * This replaces the previous ROW_NUMBER() approach which caused severe performance
48
+ * issues on large tables (see GitHub issue #11150). The old approach required
49
+ * scanning and sorting ALL messages in a thread to assign row numbers.
50
+ *
51
+ * The new approach uses the existing (thread_id, createdAt) index to efficiently
52
+ * fetch only the messages needed by using createdAt as a cursor.
53
+ */
35
54
  private _getIncludedMessages;
36
55
  private parseRow;
37
56
  listMessagesById({ messageIds }: {
@@ -1 +1 @@
1
- {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AG;YACvD,EAAE,EAAE,MAAM,CAAC;YACX,OAAO,CAAC,EAAE;gBACR,QAAQ,CAAC,EAAE,sBAAsB,CAAC,UAAU,CAAC,CAAC;gBAC9C,OAAO,CAAC,EAAE,sBAAsB,CAAC,SAAS,CAAC,CAAC;aAC7C,CAAC;SACH,CAAC,EAAE,CAAC;KACN,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAkHxB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAwCnD,eAAe,CAAC,EAAE,UAAU,EAAE,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAoB5F,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE;QAAE,QAAQ,EAAE,mBAAmB,CAAA;KAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAY3F,cAAc,CAAC,EACnB,UAAU,EACV,aAAa,EACb,QAAQ,GACT,EAAE;QACD,UAAU,EAAE,MAAM,CAAC;QACnB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACpC,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAuDjC"}
@@ -1,44 +1,37 @@
1
- import type { TracingStorageStrategy } from '@mastra/core/observability';
2
1
  import { ObservabilityStorage } from '@mastra/core/storage';
3
- import type { SpanRecord, TraceRecord, TracesPaginatedArg, CreateSpanRecord, PaginationInfo, UpdateSpanRecord } from '@mastra/core/storage';
4
- import type { IDatabase } from 'pg-promise';
5
- import type { StoreOperationsPG } from '../operations/index.js';
2
+ import type { TracingStorageStrategy, ListTracesArgs, UpdateSpanArgs, BatchDeleteTracesArgs, BatchUpdateSpansArgs, BatchCreateSpansArgs, CreateSpanArgs, GetSpanArgs, GetSpanResponse, GetRootSpanArgs, GetRootSpanResponse, GetTraceArgs, GetTraceResponse, ListTracesResponse, CreateIndexOptions } from '@mastra/core/storage';
3
+ import type { PgDomainConfig } from '../../db/index.js';
6
4
  export declare class ObservabilityPG extends ObservabilityStorage {
7
- client: IDatabase<{}>;
8
- private operations;
9
- private schema?;
10
- constructor({ client, operations, schema, }: {
11
- client: IDatabase<{}>;
12
- operations: StoreOperationsPG;
13
- schema?: string;
14
- });
5
+ #private;
6
+ /** Tables managed by this domain */
7
+ static readonly MANAGED_TABLES: readonly ["mastra_ai_spans"];
8
+ constructor(config: PgDomainConfig);
9
+ init(): Promise<void>;
10
+ /**
11
+ * Returns default index definitions for the observability domain tables.
12
+ */
13
+ getDefaultIndexDefinitions(): CreateIndexOptions[];
14
+ /**
15
+ * Creates default indexes for optimal query performance.
16
+ */
17
+ createDefaultIndexes(): Promise<void>;
18
+ /**
19
+ * Creates custom user-defined indexes for this domain's tables.
20
+ */
21
+ createCustomIndexes(): Promise<void>;
22
+ dangerouslyClearAll(): Promise<void>;
15
23
  get tracingStrategy(): {
16
24
  preferred: TracingStorageStrategy;
17
25
  supported: TracingStorageStrategy[];
18
26
  };
19
- createSpan(span: CreateSpanRecord): Promise<void>;
20
- getTrace(traceId: string): Promise<TraceRecord | null>;
21
- updateSpan({ spanId, traceId, updates, }: {
22
- spanId: string;
23
- traceId: string;
24
- updates: Partial<UpdateSpanRecord>;
25
- }): Promise<void>;
26
- getTracesPaginated({ filters, pagination, }: TracesPaginatedArg): Promise<{
27
- pagination: PaginationInfo;
28
- spans: SpanRecord[];
29
- }>;
30
- batchCreateSpans(args: {
31
- records: CreateSpanRecord[];
32
- }): Promise<void>;
33
- batchUpdateSpans(args: {
34
- records: {
35
- traceId: string;
36
- spanId: string;
37
- updates: Partial<UpdateSpanRecord>;
38
- }[];
39
- }): Promise<void>;
40
- batchDeleteTraces(args: {
41
- traceIds: string[];
42
- }): Promise<void>;
27
+ createSpan(args: CreateSpanArgs): Promise<void>;
28
+ getSpan(args: GetSpanArgs): Promise<GetSpanResponse | null>;
29
+ getRootSpan(args: GetRootSpanArgs): Promise<GetRootSpanResponse | null>;
30
+ getTrace(args: GetTraceArgs): Promise<GetTraceResponse | null>;
31
+ updateSpan(args: UpdateSpanArgs): Promise<void>;
32
+ listTraces(args: ListTracesArgs): Promise<ListTracesResponse>;
33
+ batchCreateSpans(args: BatchCreateSpansArgs): Promise<void>;
34
+ batchUpdateSpans(args: BatchUpdateSpansArgs): Promise<void>;
35
+ batchDeleteTraces(args: BatchDeleteTracesArgs): Promise<void>;
43
36
  }
44
37
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/observability/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAe,oBAAoB,EAAe,MAAM,sBAAsB,CAAC;AACtF,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGvD,qBAAa,eAAgB,SAAQ,oBAAoB;IAChD,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC;IAC7B,OAAO,CAAC,UAAU,CAAoB;IACtC,OAAO,CAAC,MAAM,CAAC,CAAS;gBAEZ,EACV,MAAM,EACN,UAAU,EACV,MAAM,GACP,EAAE;QACD,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC;QACtB,UAAU,EAAE,iBAAiB,CAAC;QAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB;IAOD,IAAoB,eAAe,IAAI;QACrC,SAAS,EAAE,sBAAsB,CAAC;QAClC,SAAS,EAAE,sBAAsB,EAAE,CAAC;KACrC,CAKA;IAEK,UAAU,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAiCjD,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IA+CtD,UAAU,CAAC,EACf,MAAM,EACN,OAAO,EACP,OAAO,GACR,EAAE;QACD,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;KACpC,GAAG,OAAO,CAAC,IAAI,CAAC;IAgCX,kBAAkB,CAAC,EACvB,OAAO,EACP,UAAU,GACX,EAAE,kBAAkB,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,KAAK,EAAE,UAAU,EAAE,CAAA;KAAE,CAAC;IA+G9E,gBAAgB,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,gBAAgB,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAgCtE,gBAAgB,CAAC,IAAI,EAAE;QAC3B,OAAO,EAAE;YACP,OAAO,EAAE,MAAM,CAAC;YAChB,MAAM,EAAE,MAAM,CAAC;YACf,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;SACpC,EAAE,CAAC;KACL,GAAG,OAAO,CAAC,IAAI,CAAC;IAyCX,iBAAiB,CAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAoBrE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/observability/index.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,oBAAoB,EAIrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAEV,sBAAsB,EACtB,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,eAAe,EACf,eAAe,EACf,mBAAmB,EACn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AAiB,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;CAoBpE"}
@@ -1,17 +1,26 @@
1
- import type { ScoreRowData, ScoringSource } from '@mastra/core/evals';
2
- import type { PaginationInfo, StoragePagination } from '@mastra/core/storage';
1
+ import type { ListScoresResponse, SaveScorePayload, ScoreRowData, ScoringSource } from '@mastra/core/evals';
2
+ import type { StoragePagination, CreateIndexOptions } from '@mastra/core/storage';
3
3
  import { ScoresStorage } from '@mastra/core/storage';
4
- import type { IDatabase } from 'pg-promise';
5
- import type { StoreOperationsPG } from '../operations/index.js';
4
+ import type { PgDomainConfig } from '../../db/index.js';
6
5
  export declare class ScoresPG extends ScoresStorage {
7
- client: IDatabase<{}>;
8
- private operations;
9
- private schema?;
10
- constructor({ client, operations, schema, }: {
11
- client: IDatabase<{}>;
12
- operations: StoreOperationsPG;
13
- schema?: string;
14
- });
6
+ #private;
7
+ /** Tables managed by this domain */
8
+ static readonly MANAGED_TABLES: readonly ["mastra_scorers"];
9
+ constructor(config: PgDomainConfig);
10
+ init(): Promise<void>;
11
+ /**
12
+ * Returns default index definitions for the scores domain tables.
13
+ */
14
+ getDefaultIndexDefinitions(): CreateIndexOptions[];
15
+ /**
16
+ * Creates default indexes for optimal query performance.
17
+ */
18
+ createDefaultIndexes(): Promise<void>;
19
+ /**
20
+ * Creates custom user-defined indexes for this domain's tables.
21
+ */
22
+ createCustomIndexes(): Promise<void>;
23
+ dangerouslyClearAll(): Promise<void>;
15
24
  getScoreById({ id }: {
16
25
  id: string;
17
26
  }): Promise<ScoreRowData | null>;
@@ -21,35 +30,23 @@ export declare class ScoresPG extends ScoresStorage {
21
30
  entityId?: string;
22
31
  entityType?: string;
23
32
  source?: ScoringSource;
24
- }): Promise<{
25
- pagination: PaginationInfo;
26
- scores: ScoreRowData[];
27
- }>;
28
- saveScore(score: Omit<ScoreRowData, 'id' | 'createdAt' | 'updatedAt'>): Promise<{
33
+ }): Promise<ListScoresResponse>;
34
+ saveScore(score: SaveScorePayload): Promise<{
29
35
  score: ScoreRowData;
30
36
  }>;
31
37
  listScoresByRunId({ runId, pagination, }: {
32
38
  runId: string;
33
39
  pagination: StoragePagination;
34
- }): Promise<{
35
- pagination: PaginationInfo;
36
- scores: ScoreRowData[];
37
- }>;
40
+ }): Promise<ListScoresResponse>;
38
41
  listScoresByEntityId({ entityId, entityType, pagination, }: {
39
42
  pagination: StoragePagination;
40
43
  entityId: string;
41
44
  entityType: string;
42
- }): Promise<{
43
- pagination: PaginationInfo;
44
- scores: ScoreRowData[];
45
- }>;
45
+ }): Promise<ListScoresResponse>;
46
46
  listScoresBySpan({ traceId, spanId, pagination, }: {
47
47
  traceId: string;
48
48
  spanId: string;
49
49
  pagination: StoragePagination;
50
- }): Promise<{
51
- pagination: PaginationInfo;
52
- scores: ScoreRowData[];
53
- }>;
50
+ }): Promise<ListScoresResponse>;
54
51
  }
55
52
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/scores/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAA6B,MAAM,oBAAoB,CAAC;AACjG,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAIL,aAAa,EAEd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAoBvD,qBAAa,QAAS,SAAQ,aAAa;IAClC,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC;IAC7B,OAAO,CAAC,UAAU,CAAoB;IACtC,OAAO,CAAC,MAAM,CAAC,CAAS;gBAEZ,EACV,MAAM,EACN,UAAU,EACV,MAAM,GACP,EAAE;QACD,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC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EAAE,iBAAiB,CAAC;QAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,MAAM,CAAC,EAAE,aAAa,CAAC;KACxB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAsEzB,SAAS,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,YAAY,CAAA;KAAE,CAAC;IAuEpE,iBAAiB,CAAC,EACtB,KAAK,EACL,UAAU,GACX,EAAE;QACD,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,iBAAiB,CAAC;KAC/B,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAkDzB,oBAAoB,CAAC,EACzB,QAAQ,EACR,UAAU,EACV,UAAU,GACX,EAAE;QACD,UAAU,EAAE,iBAAiB,CAAC;QAC9B,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAkDzB,gBAAgB,CAAC,EACrB,OAAO,EACP,MAAM,EACN,UAAU,GACX,EAAE;QACD,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,iBAAiB,CAAC;KAC/B,GAAG,OAAO,CAAC,kBAAkB,CAAC;CA0ChC"}
@@ -1,13 +1,9 @@
1
- import type { PaginationArgs, StorageColumn, TABLE_NAMES } from '@mastra/core/storage';
1
+ import type { StorageColumn, TABLE_NAMES } from '@mastra/core/storage';
2
2
  export declare function getSchemaName(schema?: string): string | undefined;
3
3
  export declare function getTableName({ indexName, schemaName }: {
4
4
  indexName: string;
5
5
  schemaName?: string;
6
6
  }): string;
7
- /**
8
- * Build date range filter for queries
9
- */
10
- export declare function buildDateRangeFilter(dateRange: PaginationArgs['dateRange'], fieldName: string): Record<string, any>;
11
7
  /**
12
8
  * Prepare WHERE clause for PostgreSQL queries
13
9
  */