@mastra/pg 0.3.2-alpha.1 → 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.
- package/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +18 -0
- package/dist/_tsup-dts-rollup.d.cts +3 -1
- package/dist/_tsup-dts-rollup.d.ts +3 -1
- package/dist/index.cjs +15 -1
- package/dist/index.js +15 -1
- package/package.json +2 -2
- package/src/storage/index.ts +20 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/pg@0.3.2-alpha.
|
|
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
|
[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 12025ms
|
|
10
10
|
[34mDTS[39m Build start
|
|
11
11
|
[34mCLI[39m Target: es2022
|
|
12
12
|
Analysis will use the bundled TypeScript version 5.8.3
|
|
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.3
|
|
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 12342ms
|
|
17
17
|
[34mCLI[39m Cleaning output folder
|
|
18
18
|
[34mESM[39m Build start
|
|
19
19
|
[34mCJS[39m Build start
|
|
20
|
-
[
|
|
21
|
-
[
|
|
22
|
-
[
|
|
23
|
-
[
|
|
20
|
+
[32mESM[39m [1mdist/index.js [22m[32m54.89 KB[39m
|
|
21
|
+
[32mESM[39m ⚡️ Build success in 1446ms
|
|
22
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m55.37 KB[39m
|
|
23
|
+
[32mCJS[39m ⚡️ Build success in 1447ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
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
|
+
|
|
3
21
|
## 0.3.2-alpha.1
|
|
4
22
|
|
|
5
23
|
### 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.
|
|
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.
|
|
27
|
+
"@mastra/core": "^0.9.2-alpha.3"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@microsoft/api-extractor": "^7.52.5",
|
package/src/storage/index.ts
CHANGED
|
@@ -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;
|