@mastra/pg 0.2.7-alpha.5 → 0.2.7-alpha.6
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 +7 -7
- package/CHANGELOG.md +8 -0
- package/dist/index.cjs +4 -8
- package/dist/index.js +4 -8
- package/package.json +2 -2
- package/src/storage/index.ts +4 -9
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/pg@0.2.7-alpha.
|
|
2
|
+
> @mastra/pg@0.2.7-alpha.6 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
|
[34mCLI[39m Building entry: src/index.ts
|
|
6
6
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
7
|
[34mCLI[39m tsup v8.4.0
|
|
8
8
|
[34mTSC[39m Build start
|
|
9
|
-
[32mTSC[39m ⚡️ Build success in
|
|
9
|
+
[32mTSC[39m ⚡️ Build success in 10263ms
|
|
10
10
|
[34mDTS[39m Build start
|
|
11
11
|
[34mCLI[39m Target: es2022
|
|
12
12
|
Analysis will use the bundled TypeScript version 5.8.2
|
|
13
13
|
[36mWriting package typings: /home/runner/work/mastra/mastra/stores/pg/dist/_tsup-dts-rollup.d.ts[39m
|
|
14
14
|
Analysis will use the bundled TypeScript version 5.8.2
|
|
15
15
|
[36mWriting package typings: /home/runner/work/mastra/mastra/stores/pg/dist/_tsup-dts-rollup.d.cts[39m
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 11464ms
|
|
17
17
|
[34mCLI[39m Cleaning output folder
|
|
18
18
|
[34mESM[39m Build start
|
|
19
19
|
[34mCJS[39m Build start
|
|
20
|
-
[
|
|
21
|
-
[
|
|
22
|
-
[
|
|
23
|
-
[
|
|
20
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m40.86 KB[39m
|
|
21
|
+
[32mCJS[39m ⚡️ Build success in 1298ms
|
|
22
|
+
[32mESM[39m [1mdist/index.js [22m[32m40.44 KB[39m
|
|
23
|
+
[32mESM[39m ⚡️ Build success in 1321ms
|
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -722,15 +722,16 @@ var PostgresStore = class extends storage.MastraStorage {
|
|
|
722
722
|
}
|
|
723
723
|
);
|
|
724
724
|
}
|
|
725
|
-
getEvalsByAgentName(agentName, type) {
|
|
725
|
+
async getEvalsByAgentName(agentName, type) {
|
|
726
726
|
try {
|
|
727
727
|
const baseQuery = `SELECT * FROM ${storage.TABLE_EVALS} WHERE agent_name = $1`;
|
|
728
728
|
const typeCondition = type === "test" ? " AND test_info IS NOT NULL AND test_info->>'testPath' IS NOT NULL" : type === "live" ? " AND (test_info IS NULL OR test_info->>'testPath' IS NULL)" : "";
|
|
729
729
|
const query = `${baseQuery}${typeCondition} ORDER BY created_at DESC`;
|
|
730
|
-
|
|
730
|
+
const rows = await this.db.manyOrNone(query, [agentName]);
|
|
731
|
+
return rows?.map((row) => this.transformEvalRow(row)) ?? [];
|
|
731
732
|
} catch (error) {
|
|
732
733
|
if (error instanceof Error && error.message.includes("relation") && error.message.includes("does not exist")) {
|
|
733
|
-
return
|
|
734
|
+
return [];
|
|
734
735
|
}
|
|
735
736
|
console.error("Failed to get evals for the specified agent: " + error?.message);
|
|
736
737
|
throw error;
|
|
@@ -817,11 +818,6 @@ var PostgresStore = class extends storage.MastraStorage {
|
|
|
817
818
|
args.push(value);
|
|
818
819
|
}
|
|
819
820
|
}
|
|
820
|
-
console.log(
|
|
821
|
-
"QUERY",
|
|
822
|
-
`SELECT * FROM ${storage.TABLE_TRACES} ${whereClause} ORDER BY "createdAt" DESC LIMIT ${limit} OFFSET ${offset}`,
|
|
823
|
-
args
|
|
824
|
-
);
|
|
825
821
|
const result = await this.db.manyOrNone(`SELECT * FROM ${storage.TABLE_TRACES} ${whereClause} ORDER BY "createdAt" DESC LIMIT ${limit} OFFSET ${offset}`, args);
|
|
826
822
|
if (!result) {
|
|
827
823
|
return [];
|
package/dist/index.js
CHANGED
|
@@ -714,15 +714,16 @@ var PostgresStore = class extends MastraStorage {
|
|
|
714
714
|
}
|
|
715
715
|
);
|
|
716
716
|
}
|
|
717
|
-
getEvalsByAgentName(agentName, type) {
|
|
717
|
+
async getEvalsByAgentName(agentName, type) {
|
|
718
718
|
try {
|
|
719
719
|
const baseQuery = `SELECT * FROM ${TABLE_EVALS} WHERE agent_name = $1`;
|
|
720
720
|
const typeCondition = type === "test" ? " AND test_info IS NOT NULL AND test_info->>'testPath' IS NOT NULL" : type === "live" ? " AND (test_info IS NULL OR test_info->>'testPath' IS NULL)" : "";
|
|
721
721
|
const query = `${baseQuery}${typeCondition} ORDER BY created_at DESC`;
|
|
722
|
-
|
|
722
|
+
const rows = await this.db.manyOrNone(query, [agentName]);
|
|
723
|
+
return rows?.map((row) => this.transformEvalRow(row)) ?? [];
|
|
723
724
|
} catch (error) {
|
|
724
725
|
if (error instanceof Error && error.message.includes("relation") && error.message.includes("does not exist")) {
|
|
725
|
-
return
|
|
726
|
+
return [];
|
|
726
727
|
}
|
|
727
728
|
console.error("Failed to get evals for the specified agent: " + error?.message);
|
|
728
729
|
throw error;
|
|
@@ -809,11 +810,6 @@ var PostgresStore = class extends MastraStorage {
|
|
|
809
810
|
args.push(value);
|
|
810
811
|
}
|
|
811
812
|
}
|
|
812
|
-
console.log(
|
|
813
|
-
"QUERY",
|
|
814
|
-
`SELECT * FROM ${TABLE_TRACES} ${whereClause} ORDER BY "createdAt" DESC LIMIT ${limit} OFFSET ${offset}`,
|
|
815
|
-
args
|
|
816
|
-
);
|
|
817
813
|
const result = await this.db.manyOrNone(`SELECT * FROM ${TABLE_TRACES} ${whereClause} ORDER BY "createdAt" DESC LIMIT ${limit} OFFSET ${offset}`, args);
|
|
818
814
|
if (!result) {
|
|
819
815
|
return [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/pg",
|
|
3
|
-
"version": "0.2.7-alpha.
|
|
3
|
+
"version": "0.2.7-alpha.6",
|
|
4
4
|
"description": "Postgres provider for Mastra - includes both vector and db storage capabilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"pg": "^8.13.3",
|
|
24
24
|
"pg-promise": "^11.11.0",
|
|
25
25
|
"xxhash-wasm": "^1.1.0",
|
|
26
|
-
"@mastra/core": "^0.8.0-alpha.
|
|
26
|
+
"@mastra/core": "^0.8.0-alpha.6"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@microsoft/api-extractor": "^7.52.1",
|
package/src/storage/index.ts
CHANGED
|
@@ -47,7 +47,7 @@ export class PostgresStore extends MastraStorage {
|
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]> {
|
|
50
|
+
async getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]> {
|
|
51
51
|
try {
|
|
52
52
|
const baseQuery = `SELECT * FROM ${TABLE_EVALS} WHERE agent_name = $1`;
|
|
53
53
|
const typeCondition =
|
|
@@ -59,11 +59,12 @@ export class PostgresStore extends MastraStorage {
|
|
|
59
59
|
|
|
60
60
|
const query = `${baseQuery}${typeCondition} ORDER BY created_at DESC`;
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
const rows = await this.db.manyOrNone(query, [agentName]);
|
|
63
|
+
return rows?.map(row => this.transformEvalRow(row)) ?? [];
|
|
63
64
|
} catch (error) {
|
|
64
65
|
// Handle case where table doesn't exist yet
|
|
65
66
|
if (error instanceof Error && error.message.includes('relation') && error.message.includes('does not exist')) {
|
|
66
|
-
return
|
|
67
|
+
return [];
|
|
67
68
|
}
|
|
68
69
|
console.error('Failed to get evals for the specified agent: ' + (error as any)?.message);
|
|
69
70
|
throw error;
|
|
@@ -170,12 +171,6 @@ export class PostgresStore extends MastraStorage {
|
|
|
170
171
|
}
|
|
171
172
|
}
|
|
172
173
|
|
|
173
|
-
console.log(
|
|
174
|
-
'QUERY',
|
|
175
|
-
`SELECT * FROM ${TABLE_TRACES} ${whereClause} ORDER BY "createdAt" DESC LIMIT ${limit} OFFSET ${offset}`,
|
|
176
|
-
args,
|
|
177
|
-
);
|
|
178
|
-
|
|
179
174
|
const result = await this.db.manyOrNone<{
|
|
180
175
|
id: string;
|
|
181
176
|
parentSpanId: string;
|