@mastra/pg 0.14.0 → 0.14.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/workflows/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhF,OAAO,EAAE,gBAAgB,EAA2B,MAAM,sBAAsB,CAAC;AACjF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAuBvD,qBAAa,WAAY,SAAQ,gBAAgB;IACxC,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC;IAC7B,OAAO,CAAC,UAAU,CAAoB;IACtC,OAAO,CAAC,MAAM,CAAS;gBAEX,EACV,MAAM,EACN,UAAU,EACV,MAAM,GACP,EAAE;QACD,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC;QACtB,UAAU,EAAE,iBAAiB,CAAC;QAC9B,MAAM,EAAE,MAAM,CAAC;KAChB;IAOK,uBAAuB,CAAC,EAC5B,YAAY,EACZ,KAAK,EACL,QAAQ,GACT,EAAE;QACD,YAAY,EAAE,MAAM,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,gBAAgB,CAAC;KAC5B,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBX,oBAAoB,CAAC,EACzB,YAAY,EACZ,KAAK,GACN,EAAE;QACD,YAAY,EAAE,MAAM,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAoB9B,kBAAkB,CAAC,EACvB,KAAK,EACL,YAAY,GACb,EAAE;QACD,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,CAAC,E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C5B,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBX,oBAAoB,CAAC,EACzB,YAAY,EACZ,KAAK,GACN,EAAE;QACD,YAAY,EAAE,MAAM,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAoB9B,kBAAkB,CAAC,EACvB,KAAK,EACL,YAAY,GACb,EAAE;QACD,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAoDzB,eAAe,CAAC,EACpB,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,KAAK,EACL,MAAM,EACN,UAAU,GACX,GAAE;QACD,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,EAAE,IAAI,CAAC;QAChB,MAAM,CAAC,EAAE,IAAI,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,UAAU,CAAC,EAAE,MAAM,CAAC;KAChB,GAAG,OAAO,CAAC,YAAY,CAAC;CA8E/B"}
@@ -1 +1 @@
1
- {"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../src/storage/test-utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,GAAG,CAAC;AAExC,eAAO,MAAM,WAAW,EAAE,cAMzB,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAA6H,CAAC;AAE3J,wBAAgB,OAAO,SAqWtB"}
1
+ {"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../src/storage/test-utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,GAAG,CAAC;AAExC,eAAO,MAAM,WAAW,EAAE,cAMzB,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAA6H,CAAC;AAE3J,wBAAgB,OAAO,SAuWtB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/pg",
3
- "version": "0.14.0",
3
+ "version": "0.14.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",
@@ -33,13 +33,13 @@
33
33
  "tsup": "^8.5.0",
34
34
  "typescript": "^5.8.3",
35
35
  "vitest": "^3.2.4",
36
- "@internal/lint": "0.0.29",
37
- "@internal/storage-test-utils": "0.0.25",
38
- "@mastra/core": "0.13.2",
39
- "@internal/types-builder": "0.0.4"
36
+ "@internal/lint": "0.0.30",
37
+ "@mastra/core": "0.14.0",
38
+ "@internal/storage-test-utils": "0.0.26",
39
+ "@internal/types-builder": "0.0.5"
40
40
  },
41
41
  "peerDependencies": {
42
- "@mastra/core": ">=0.13.0-0 <0.14.0-0"
42
+ "@mastra/core": ">=0.13.0-0 <0.15.0-0"
43
43
  },
44
44
  "scripts": {
45
45
  "build": "tsup --silent --config tsup.config.ts",
@@ -289,7 +289,7 @@ export class StoreOperationsPG extends StoreOperations {
289
289
  const values = keyEntries.map(([_, value]) => value);
290
290
 
291
291
  const result = await this.client.oneOrNone<R>(
292
- `SELECT * FROM ${getTableName({ indexName: tableName, schemaName: getSchemaName(this.schemaName) })} WHERE ${conditions}`,
292
+ `SELECT * FROM ${getTableName({ indexName: tableName, schemaName: getSchemaName(this.schemaName) })} WHERE ${conditions} ORDER BY "createdAt" DESC LIMIT 1`,
293
293
  values,
294
294
  );
295
295
 
@@ -131,6 +131,7 @@ export class WorkflowsPG extends WorkflowsStorage {
131
131
  const query = `
132
132
  SELECT * FROM ${getTableName({ indexName: TABLE_WORKFLOW_SNAPSHOT, schemaName: this.schema })}
133
133
  ${whereClause}
134
+ ORDER BY "createdAt" DESC LIMIT 1
134
135
  `;
135
136
 
136
137
  const queryValues = values;
@@ -80,6 +80,8 @@ export function pgTests() {
80
80
  const BASE_SCHEMA = {
81
81
  id: { type: 'integer', primaryKey: true, nullable: false },
82
82
  name: { type: 'text', nullable: true },
83
+ createdAt: { type: 'timestamp', nullable: false },
84
+ updatedAt: { type: 'timestamp', nullable: false },
83
85
  } as Record<string, StorageColumn>;
84
86
 
85
87
  beforeEach(async () => {
@@ -116,7 +118,7 @@ export function pgTests() {
116
118
 
117
119
  await store.insert({
118
120
  tableName: camelCaseTable as TABLE_NAMES,
119
- record: { id: '1', name: 'Alice' },
121
+ record: { id: '1', name: 'Alice', createdAt: new Date(), updatedAt: new Date() },
120
122
  });
121
123
 
122
124
  const row: any = await store.load({
@@ -136,7 +138,7 @@ export function pgTests() {
136
138
 
137
139
  await store.insert({
138
140
  tableName: snakeCaseTable as TABLE_NAMES,
139
- record: { id: '2', name: 'Bob' },
141
+ record: { id: '2', name: 'Bob', createdAt: new Date(), updatedAt: new Date() },
140
142
  });
141
143
 
142
144
  const row: any = await store.load({