@mastra/pg 0.3.2-alpha.0 → 0.3.2-alpha.3

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.3.2-alpha.0 build /home/runner/work/mastra/mastra/stores/pg
2
+ > @mastra/pg@0.3.2-alpha.3 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 10901ms
9
+ TSC ⚡️ Build success in 12025ms
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 11727ms
16
+ DTS ⚡️ Build success in 12342ms
17
17
  CLI Cleaning output folder
18
18
  ESM Build start
19
19
  CJS Build start
20
- ESM dist/index.js 54.59 KB
21
- ESM ⚡️ Build success in 1404ms
22
- CJS dist/index.cjs 55.07 KB
23
- CJS ⚡️ Build success in 1408ms
20
+ ESM dist/index.js 54.89 KB
21
+ ESM ⚡️ Build success in 1446ms
22
+ CJS dist/index.cjs 55.37 KB
23
+ CJS ⚡️ Build success in 1447ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # @mastra/pg
2
2
 
3
+ ## 0.3.2-alpha.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 4155f47: Add parameters to filter workflow runs
8
+ Add fromDate and toDate to telemetry parameters
9
+ - Updated dependencies [967b41c]
10
+ - Updated dependencies [4155f47]
11
+ - Updated dependencies [17826a9]
12
+ - @mastra/core@0.9.2-alpha.3
13
+
14
+ ## 0.3.2-alpha.2
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies [26738f4]
19
+ - @mastra/core@0.9.2-alpha.2
20
+
21
+ ## 0.3.2-alpha.1
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies [b804723]
26
+ - @mastra/core@0.9.2-alpha.1
27
+
3
28
  ## 0.3.2-alpha.0
4
29
 
5
30
  ### Patch Changes
@@ -294,13 +294,15 @@ declare class PostgresStore extends MastraStorage {
294
294
  tableName: TABLE_NAMES;
295
295
  records: Record<string, any>[];
296
296
  }): Promise<void>;
297
- getTraces({ name, scope, page, perPage, attributes, filters, }: {
297
+ getTraces({ name, scope, page, perPage, attributes, filters, fromDate, toDate, }: {
298
298
  name?: string;
299
299
  scope?: string;
300
300
  page: number;
301
301
  perPage: number;
302
302
  attributes?: Record<string, string>;
303
303
  filters?: Record<string, any>;
304
+ fromDate?: Date;
305
+ toDate?: Date;
304
306
  }): Promise<any[]>;
305
307
  private setupSchema;
306
308
  createTable({ tableName, schema, }: {
@@ -294,13 +294,15 @@ declare class PostgresStore extends MastraStorage {
294
294
  tableName: TABLE_NAMES;
295
295
  records: Record<string, any>[];
296
296
  }): Promise<void>;
297
- getTraces({ name, scope, page, perPage, attributes, filters, }: {
297
+ getTraces({ name, scope, page, perPage, attributes, filters, fromDate, toDate, }: {
298
298
  name?: string;
299
299
  scope?: string;
300
300
  page: number;
301
301
  perPage: number;
302
302
  attributes?: Record<string, string>;
303
303
  filters?: Record<string, any>;
304
+ fromDate?: Date;
305
+ toDate?: Date;
304
306
  }): Promise<any[]>;
305
307
  private setupSchema;
306
308
  createTable({ tableName, schema, }: {
package/dist/index.cjs CHANGED
@@ -949,7 +949,9 @@ var PostgresStore = class extends storage.MastraStorage {
949
949
  page,
950
950
  perPage,
951
951
  attributes,
952
- filters
952
+ filters,
953
+ fromDate,
954
+ toDate
953
955
  }) {
954
956
  let idx = 1;
955
957
  const limit = perPage;
@@ -972,6 +974,12 @@ var PostgresStore = class extends storage.MastraStorage {
972
974
  conditions.push(`${key} = $${idx++}`);
973
975
  });
974
976
  }
977
+ if (fromDate) {
978
+ conditions.push(`createdAt >= $${idx++}`);
979
+ }
980
+ if (toDate) {
981
+ conditions.push(`createdAt <= $${idx++}`);
982
+ }
975
983
  const whereClause = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
976
984
  if (name) {
977
985
  args.push(name);
@@ -989,6 +997,12 @@ var PostgresStore = class extends storage.MastraStorage {
989
997
  args.push(value);
990
998
  }
991
999
  }
1000
+ if (fromDate) {
1001
+ args.push(fromDate.toISOString());
1002
+ }
1003
+ if (toDate) {
1004
+ args.push(toDate.toISOString());
1005
+ }
992
1006
  const result = await this.db.manyOrNone(
993
1007
  `SELECT * FROM ${this.getTableName(storage.TABLE_TRACES)} ${whereClause} ORDER BY "createdAt" DESC LIMIT ${limit} OFFSET ${offset}`,
994
1008
  args
package/dist/index.js CHANGED
@@ -941,7 +941,9 @@ var PostgresStore = class extends MastraStorage {
941
941
  page,
942
942
  perPage,
943
943
  attributes,
944
- filters
944
+ filters,
945
+ fromDate,
946
+ toDate
945
947
  }) {
946
948
  let idx = 1;
947
949
  const limit = perPage;
@@ -964,6 +966,12 @@ var PostgresStore = class extends MastraStorage {
964
966
  conditions.push(`${key} = $${idx++}`);
965
967
  });
966
968
  }
969
+ if (fromDate) {
970
+ conditions.push(`createdAt >= $${idx++}`);
971
+ }
972
+ if (toDate) {
973
+ conditions.push(`createdAt <= $${idx++}`);
974
+ }
967
975
  const whereClause = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
968
976
  if (name) {
969
977
  args.push(name);
@@ -981,6 +989,12 @@ var PostgresStore = class extends MastraStorage {
981
989
  args.push(value);
982
990
  }
983
991
  }
992
+ if (fromDate) {
993
+ args.push(fromDate.toISOString());
994
+ }
995
+ if (toDate) {
996
+ args.push(toDate.toISOString());
997
+ }
984
998
  const result = await this.db.manyOrNone(
985
999
  `SELECT * FROM ${this.getTableName(TABLE_TRACES)} ${whereClause} ORDER BY "createdAt" DESC LIMIT ${limit} OFFSET ${offset}`,
986
1000
  args
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/pg",
3
- "version": "0.3.2-alpha.0",
3
+ "version": "0.3.2-alpha.3",
4
4
  "description": "Postgres provider for Mastra - includes both vector and db storage capabilities",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -24,7 +24,7 @@
24
24
  "pg": "^8.13.3",
25
25
  "pg-promise": "^11.11.0",
26
26
  "xxhash-wasm": "^1.1.0",
27
- "@mastra/core": "^0.9.2-alpha.0"
27
+ "@mastra/core": "^0.9.2-alpha.3"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@microsoft/api-extractor": "^7.52.5",
@@ -165,6 +165,8 @@ export class PostgresStore extends MastraStorage {
165
165
  perPage,
166
166
  attributes,
167
167
  filters,
168
+ fromDate,
169
+ toDate,
168
170
  }: {
169
171
  name?: string;
170
172
  scope?: string;
@@ -172,6 +174,8 @@ export class PostgresStore extends MastraStorage {
172
174
  perPage: number;
173
175
  attributes?: Record<string, string>;
174
176
  filters?: Record<string, any>;
177
+ fromDate?: Date;
178
+ toDate?: Date;
175
179
  }): Promise<any[]> {
176
180
  let idx = 1;
177
181
  const limit = perPage;
@@ -198,6 +202,14 @@ export class PostgresStore extends MastraStorage {
198
202
  });
199
203
  }
200
204
 
205
+ if (fromDate) {
206
+ conditions.push(`createdAt >= $${idx++}`);
207
+ }
208
+
209
+ if (toDate) {
210
+ conditions.push(`createdAt <= $${idx++}`);
211
+ }
212
+
201
213
  const whereClause = conditions.length > 0 ? `WHERE ${conditions.join(' AND ')}` : '';
202
214
 
203
215
  if (name) {
@@ -220,6 +232,14 @@ export class PostgresStore extends MastraStorage {
220
232
  }
221
233
  }
222
234
 
235
+ if (fromDate) {
236
+ args.push(fromDate.toISOString());
237
+ }
238
+
239
+ if (toDate) {
240
+ args.push(toDate.toISOString());
241
+ }
242
+
223
243
  const result = await this.db.manyOrNone<{
224
244
  id: string;
225
245
  parentSpanId: string;