@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.
@@ -1,23 +1,23 @@
1
1
 
2
- > @mastra/pg@0.2.7-alpha.5 build /home/runner/work/mastra/mastra/stores/pg
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
  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 10178ms
9
+ TSC ⚡️ Build success in 10263ms
10
10
  DTS Build start
11
11
  CLI Target: es2022
12
12
  Analysis will use the bundled TypeScript version 5.8.2
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.2
15
15
  Writing package typings: /home/runner/work/mastra/mastra/stores/pg/dist/_tsup-dts-rollup.d.cts
16
- DTS ⚡️ Build success in 10075ms
16
+ DTS ⚡️ Build success in 11464ms
17
17
  CLI Cleaning output folder
18
18
  ESM Build start
19
19
  CJS Build start
20
- ESM dist/index.js 40.60 KB
21
- ESM ⚡️ Build success in 1332ms
22
- CJS dist/index.cjs 41.03 KB
23
- CJS ⚡️ Build success in 1332ms
20
+ CJS dist/index.cjs 40.86 KB
21
+ CJS ⚡️ Build success in 1298ms
22
+ ESM dist/index.js 40.44 KB
23
+ ESM ⚡️ Build success in 1321ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @mastra/pg
2
2
 
3
+ ## 0.2.7-alpha.6
4
+
5
+ ### Patch Changes
6
+
7
+ - a3f0e90: Update storage initialization to ensure tables are present
8
+ - Updated dependencies [a3f0e90]
9
+ - @mastra/core@0.8.0-alpha.6
10
+
3
11
  ## 0.2.7-alpha.5
4
12
 
5
13
  ### Patch Changes
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
- return this.db.manyOrNone(query, [agentName]).then((rows) => rows?.map((row) => this.transformEvalRow(row)) ?? []);
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 Promise.resolve([]);
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
- return this.db.manyOrNone(query, [agentName]).then((rows) => rows?.map((row) => this.transformEvalRow(row)) ?? []);
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 Promise.resolve([]);
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.5",
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.5"
26
+ "@mastra/core": "^0.8.0-alpha.6"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@microsoft/api-extractor": "^7.52.1",
@@ -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
- return this.db.manyOrNone(query, [agentName]).then(rows => rows?.map(row => this.transformEvalRow(row)) ?? []);
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 Promise.resolve([]);
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;