@mastra/pg 0.13.1 → 0.13.2-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +24 -0
- package/dist/index.cjs +36 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +36 -19
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +1 -1
- package/dist/storage/domains/operations/index.d.ts.map +1 -1
- package/dist/storage/domains/scores/index.d.ts +2 -2
- package/dist/storage/domains/scores/index.d.ts.map +1 -1
- package/dist/storage/domains/traces/index.d.ts +1 -1
- package/dist/storage/domains/workflows/index.d.ts +1 -1
- package/dist/vector/index.d.ts +2 -2
- package/dist/vector/performance.helpers.d.ts +1 -1
- package/dist/vector/sql-builder.d.ts +1 -1
- package/package.json +7 -6
- package/src/storage/domains/operations/index.ts +0 -2
- package/src/storage/domains/scores/index.ts +41 -20
- package/src/storage/domains/traces/index.ts +5 -5
- package/tsup.config.ts +2 -7
|
@@ -3,7 +3,7 @@ import type { MastraMessageV1, MastraMessageV2, StorageThreadType } from '@mastr
|
|
|
3
3
|
import { MemoryStorage } from '@mastra/core/storage';
|
|
4
4
|
import type { StorageGetMessagesArg, PaginationInfo, StorageResourceType, ThreadSortOptions } from '@mastra/core/storage';
|
|
5
5
|
import type { IDatabase } from 'pg-promise';
|
|
6
|
-
import type { StoreOperationsPG } from '../operations';
|
|
6
|
+
import type { StoreOperationsPG } from '../operations/index.js';
|
|
7
7
|
export declare class MemoryPG extends MemoryStorage {
|
|
8
8
|
private client;
|
|
9
9
|
private schema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/operations/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAA2B,MAAM,sBAAsB,CAAC;AAChF,OAAO,KAAK,EAAE,aAAa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M,EAAE,aAAa,CAAC,CAAC;QACtC,WAAW,EAAE,MAAM,EAAE,CAAC;KACvB,GAAG,OAAO,CAAC,IAAI,CAAC;IAwCX,IAAI,CAAC,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE;QAAE,SAAS,EAAE,WAAW,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAwCzG,WAAW,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;QAAE,SAAS,EAAE,WAAW,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB9G,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE;QAAE,SAAS,EAAE,WAAW,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAmB1E"}
|
|
@@ -2,7 +2,7 @@ import type { PaginationInfo, StoragePagination } from '@mastra/core';
|
|
|
2
2
|
import type { ScoreRowData } from '@mastra/core/scores';
|
|
3
3
|
import { ScoresStorage } from '@mastra/core/storage';
|
|
4
4
|
import type { IDatabase } from 'pg-promise';
|
|
5
|
-
import type { StoreOperationsPG } from '../operations';
|
|
5
|
+
import type { StoreOperationsPG } from '../operations/index.js';
|
|
6
6
|
export declare class ScoresPG extends ScoresStorage {
|
|
7
7
|
client: IDatabase<{}>;
|
|
8
8
|
private operations;
|
|
@@ -22,7 +22,7 @@ export declare class ScoresPG extends ScoresStorage {
|
|
|
22
22
|
pagination: PaginationInfo;
|
|
23
23
|
scores: ScoreRowData[];
|
|
24
24
|
}>;
|
|
25
|
-
saveScore(score: Omit<ScoreRowData, 'createdAt' | 'updatedAt'>): Promise<{
|
|
25
|
+
saveScore(score: Omit<ScoreRowData, 'id' | 'createdAt' | 'updatedAt'>): Promise<{
|
|
26
26
|
score: ScoreRowData;
|
|
27
27
|
}>;
|
|
28
28
|
getScoresByRunId({ runId, pagination, }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/scores/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/scores/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAmB,aAAa,EAAiB,MAAM,sBAAsB,CAAC;AACrF,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,CAAC;QACtB,UAAU,EAAE,iBAAiB,CAAC;QAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB;IAOK,YAAY,CAAC,EAAE,EAAE,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAoBlE,mBAAmB,CAAC,EACxB,QAAQ,EACR,UAAU,GACX,EAAE;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,iBAAiB,CAAC;KAC/B,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;IA2C7D,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,GAAG,WAAW,GAAG,WAAW,CAAC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,YAAY,CAAA;KAAE,CAAC;IAmDxG,gBAAgB,CAAC,EACrB,KAAK,EACL,UAAU,GACX,EAAE;QACD,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,iBAAiB,CAAC;KAC/B,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;IA2C7D,mBAAmB,CAAC,EACxB,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;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;CA2CpE"}
|
|
@@ -2,7 +2,7 @@ import type { PaginationInfo, StorageGetTracesArg, StorageGetTracesPaginatedArg
|
|
|
2
2
|
import { TracesStorage } from '@mastra/core/storage';
|
|
3
3
|
import type { Trace } from '@mastra/core/telemetry';
|
|
4
4
|
import type { IDatabase } from 'pg-promise';
|
|
5
|
-
import type { StoreOperationsPG } from '../operations';
|
|
5
|
+
import type { StoreOperationsPG } from '../operations/index.js';
|
|
6
6
|
export declare class TracesPG extends TracesStorage {
|
|
7
7
|
client: IDatabase<{}>;
|
|
8
8
|
private operations;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { WorkflowRun, WorkflowRuns, WorkflowRunState } from '@mastra/core';
|
|
2
2
|
import { WorkflowsStorage } from '@mastra/core/storage';
|
|
3
3
|
import type { IDatabase } from 'pg-promise';
|
|
4
|
-
import type { StoreOperationsPG } from '../operations';
|
|
4
|
+
import type { StoreOperationsPG } from '../operations/index.js';
|
|
5
5
|
export declare class WorkflowsPG extends WorkflowsStorage {
|
|
6
6
|
client: IDatabase<{}>;
|
|
7
7
|
private operations;
|
package/dist/vector/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { MastraVector } from '@mastra/core/vector';
|
|
2
2
|
import type { IndexStats, QueryResult, QueryVectorParams, CreateIndexParams, UpsertVectorParams, DescribeIndexParams, DeleteIndexParams, DeleteVectorParams, UpdateVectorParams } from '@mastra/core/vector';
|
|
3
3
|
import pg from 'pg';
|
|
4
|
-
import type { PGVectorFilter } from './filter';
|
|
5
|
-
import type { IndexConfig, IndexType } from './types';
|
|
4
|
+
import type { PGVectorFilter } from './filter.js';
|
|
5
|
+
import type { IndexConfig, IndexType } from './types.js';
|
|
6
6
|
export interface PGIndexStats extends IndexStats {
|
|
7
7
|
type: IndexType;
|
|
8
8
|
config: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/pg",
|
|
3
|
-
"version": "0.13.1",
|
|
3
|
+
"version": "0.13.2-alpha.1",
|
|
4
4
|
"description": "Postgres provider for Mastra - includes both vector and db storage capabilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"default": "./dist/index.js"
|
|
13
13
|
},
|
|
14
14
|
"require": {
|
|
15
|
-
"types": "./dist/index.d.
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
16
|
"default": "./dist/index.cjs"
|
|
17
17
|
}
|
|
18
18
|
},
|
|
@@ -33,12 +33,13 @@
|
|
|
33
33
|
"tsup": "^8.5.0",
|
|
34
34
|
"typescript": "^5.8.3",
|
|
35
35
|
"vitest": "^3.2.4",
|
|
36
|
-
"@internal/
|
|
37
|
-
"@internal/
|
|
38
|
-
"@mastra/core": "0.
|
|
36
|
+
"@internal/lint": "0.0.26",
|
|
37
|
+
"@internal/storage-test-utils": "0.0.22",
|
|
38
|
+
"@mastra/core": "0.13.0-alpha.2",
|
|
39
|
+
"@internal/types-builder": "0.0.1"
|
|
39
40
|
},
|
|
40
41
|
"peerDependencies": {
|
|
41
|
-
"@mastra/core": ">=0.
|
|
42
|
+
"@mastra/core": ">=0.13.0-0 <0.14.0-0"
|
|
42
43
|
},
|
|
43
44
|
"scripts": {
|
|
44
45
|
"build": "tsup --silent --config tsup.config.ts",
|
|
@@ -208,8 +208,6 @@ export class StoreOperationsPG extends StoreOperations {
|
|
|
208
208
|
|
|
209
209
|
await this.client.none(sql);
|
|
210
210
|
|
|
211
|
-
console.log('Alter Table SQL', tableName);
|
|
212
|
-
console.log('timeZColumnNames', timeZColumnNames);
|
|
213
211
|
await this.alterTable({
|
|
214
212
|
tableName,
|
|
215
213
|
schema,
|
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
import type { PaginationInfo, StoragePagination } from '@mastra/core';
|
|
2
2
|
import { ErrorCategory, ErrorDomain, MastraError } from '@mastra/core/error';
|
|
3
3
|
import type { ScoreRowData } from '@mastra/core/scores';
|
|
4
|
-
import { ScoresStorage, TABLE_SCORERS } from '@mastra/core/storage';
|
|
4
|
+
import { safelyParseJSON, ScoresStorage, TABLE_SCORERS } from '@mastra/core/storage';
|
|
5
5
|
import type { IDatabase } from 'pg-promise';
|
|
6
6
|
import type { StoreOperationsPG } from '../operations';
|
|
7
7
|
import { getTableName } from '../utils';
|
|
8
8
|
|
|
9
9
|
function transformScoreRow(row: Record<string, any>): ScoreRowData {
|
|
10
|
-
let input = undefined;
|
|
11
|
-
|
|
12
|
-
if (row.input) {
|
|
13
|
-
try {
|
|
14
|
-
input = JSON.parse(row.input);
|
|
15
|
-
} catch {
|
|
16
|
-
input = row.input;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
10
|
return {
|
|
20
11
|
...row,
|
|
21
|
-
input,
|
|
12
|
+
input: safelyParseJSON(row.input),
|
|
13
|
+
scorer: safelyParseJSON(row.scorer),
|
|
14
|
+
preprocessStepResult: safelyParseJSON(row.preprocessStepResult),
|
|
15
|
+
analyzeStepResult: safelyParseJSON(row.analyzeStepResult),
|
|
16
|
+
metadata: safelyParseJSON(row.metadata),
|
|
17
|
+
output: safelyParseJSON(row.output),
|
|
18
|
+
additionalContext: safelyParseJSON(row.additionalContext),
|
|
19
|
+
runtimeContext: safelyParseJSON(row.runtimeContext),
|
|
20
|
+
entity: safelyParseJSON(row.entity),
|
|
22
21
|
createdAt: row.createdAtZ || row.createdAt,
|
|
23
22
|
updatedAt: row.updatedAtZ || row.updatedAt,
|
|
24
23
|
} as ScoreRowData;
|
|
@@ -99,7 +98,7 @@ export class ScoresPG extends ScoresStorage {
|
|
|
99
98
|
perPage: pagination.perPage,
|
|
100
99
|
hasMore: Number(total?.count) > (pagination.page + 1) * pagination.perPage,
|
|
101
100
|
},
|
|
102
|
-
scores: result,
|
|
101
|
+
scores: result.map(transformScoreRow),
|
|
103
102
|
};
|
|
104
103
|
} catch (error) {
|
|
105
104
|
throw new MastraError(
|
|
@@ -113,20 +112,44 @@ export class ScoresPG extends ScoresStorage {
|
|
|
113
112
|
}
|
|
114
113
|
}
|
|
115
114
|
|
|
116
|
-
async saveScore(score: Omit<ScoreRowData, 'createdAt' | 'updatedAt'>): Promise<{ score: ScoreRowData }> {
|
|
115
|
+
async saveScore(score: Omit<ScoreRowData, 'id' | 'createdAt' | 'updatedAt'>): Promise<{ score: ScoreRowData }> {
|
|
117
116
|
try {
|
|
118
|
-
|
|
117
|
+
// Generate ID like other storage implementations
|
|
118
|
+
const scoreId = crypto.randomUUID();
|
|
119
|
+
|
|
120
|
+
const {
|
|
121
|
+
scorer,
|
|
122
|
+
preprocessStepResult,
|
|
123
|
+
analyzeStepResult,
|
|
124
|
+
metadata,
|
|
125
|
+
input,
|
|
126
|
+
output,
|
|
127
|
+
additionalContext,
|
|
128
|
+
runtimeContext,
|
|
129
|
+
entity,
|
|
130
|
+
...rest
|
|
131
|
+
} = score;
|
|
132
|
+
|
|
119
133
|
await this.operations.insert({
|
|
120
134
|
tableName: TABLE_SCORERS,
|
|
121
135
|
record: {
|
|
136
|
+
id: scoreId,
|
|
122
137
|
...rest,
|
|
123
|
-
input: JSON.stringify(input),
|
|
138
|
+
input: JSON.stringify(input) || '',
|
|
139
|
+
output: JSON.stringify(output) || '',
|
|
140
|
+
scorer: scorer ? JSON.stringify(scorer) : null,
|
|
141
|
+
preprocessStepResult: preprocessStepResult ? JSON.stringify(preprocessStepResult) : null,
|
|
142
|
+
analyzeStepResult: analyzeStepResult ? JSON.stringify(analyzeStepResult) : null,
|
|
143
|
+
metadata: metadata ? JSON.stringify(metadata) : null,
|
|
144
|
+
additionalContext: additionalContext ? JSON.stringify(additionalContext) : null,
|
|
145
|
+
runtimeContext: runtimeContext ? JSON.stringify(runtimeContext) : null,
|
|
146
|
+
entity: entity ? JSON.stringify(entity) : null,
|
|
124
147
|
createdAt: new Date().toISOString(),
|
|
125
148
|
updatedAt: new Date().toISOString(),
|
|
126
149
|
},
|
|
127
150
|
});
|
|
128
151
|
|
|
129
|
-
const scoreFromDb = await this.getScoreById({ id:
|
|
152
|
+
const scoreFromDb = await this.getScoreById({ id: scoreId });
|
|
130
153
|
return { score: scoreFromDb! };
|
|
131
154
|
} catch (error) {
|
|
132
155
|
throw new MastraError(
|
|
@@ -152,8 +175,6 @@ export class ScoresPG extends ScoresStorage {
|
|
|
152
175
|
`SELECT COUNT(*) FROM ${getTableName({ indexName: TABLE_SCORERS, schemaName: this.schema })} WHERE "runId" = $1`,
|
|
153
176
|
[runId],
|
|
154
177
|
);
|
|
155
|
-
console.log(`total: ${total?.count}`);
|
|
156
|
-
console.log(`typeof total: ${typeof total?.count}`);
|
|
157
178
|
if (total?.count === '0' || !total?.count) {
|
|
158
179
|
return {
|
|
159
180
|
pagination: {
|
|
@@ -177,7 +198,7 @@ export class ScoresPG extends ScoresStorage {
|
|
|
177
198
|
perPage: pagination.perPage,
|
|
178
199
|
hasMore: Number(total?.count) > (pagination.page + 1) * pagination.perPage,
|
|
179
200
|
},
|
|
180
|
-
scores: result,
|
|
201
|
+
scores: result.map(transformScoreRow),
|
|
181
202
|
};
|
|
182
203
|
} catch (error) {
|
|
183
204
|
throw new MastraError(
|
|
@@ -229,7 +250,7 @@ export class ScoresPG extends ScoresStorage {
|
|
|
229
250
|
perPage: pagination.perPage,
|
|
230
251
|
hasMore: Number(total?.count) > (pagination.page + 1) * pagination.perPage,
|
|
231
252
|
},
|
|
232
|
-
scores: result,
|
|
253
|
+
scores: result.map(transformScoreRow),
|
|
233
254
|
};
|
|
234
255
|
} catch (error) {
|
|
235
256
|
throw new MastraError(
|
|
@@ -121,13 +121,13 @@ export class TracesPG extends TracesStorage {
|
|
|
121
121
|
name: row.name,
|
|
122
122
|
scope: row.scope,
|
|
123
123
|
kind: row.kind,
|
|
124
|
-
status: safelyParseJSON(row.status
|
|
125
|
-
events: safelyParseJSON(row.events
|
|
126
|
-
links: safelyParseJSON(row.links
|
|
127
|
-
attributes: safelyParseJSON(row.attributes
|
|
124
|
+
status: safelyParseJSON(row.status),
|
|
125
|
+
events: safelyParseJSON(row.events),
|
|
126
|
+
links: safelyParseJSON(row.links),
|
|
127
|
+
attributes: safelyParseJSON(row.attributes),
|
|
128
128
|
startTime: row.startTime,
|
|
129
129
|
endTime: row.endTime,
|
|
130
|
-
other: safelyParseJSON(row.other
|
|
130
|
+
other: safelyParseJSON(row.other),
|
|
131
131
|
createdAt: row.createdAtZ || row.createdAt,
|
|
132
132
|
})) as Trace[];
|
|
133
133
|
|
package/tsup.config.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { promisify } from 'util';
|
|
1
|
+
import { generateTypes } from '@internal/types-builder';
|
|
3
2
|
import { defineConfig } from 'tsup';
|
|
4
3
|
|
|
5
|
-
const exec = promisify(spawn);
|
|
6
|
-
|
|
7
4
|
export default defineConfig({
|
|
8
5
|
entry: ['src/index.ts'],
|
|
9
6
|
format: ['esm', 'cjs'],
|
|
@@ -15,8 +12,6 @@ export default defineConfig({
|
|
|
15
12
|
},
|
|
16
13
|
sourcemap: true,
|
|
17
14
|
onSuccess: async () => {
|
|
18
|
-
await
|
|
19
|
-
stdio: 'inherit',
|
|
20
|
-
});
|
|
15
|
+
await generateTypes(process.cwd());
|
|
21
16
|
},
|
|
22
17
|
});
|