@mastra/pg 1.14.2-alpha.0 → 1.14.2
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/CHANGELOG.md +46 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +25 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +25 -11
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -160,7 +160,7 @@ var createNumericOperator = (symbol) => {
|
|
|
160
160
|
const isNumeric = typeof value === "number" || typeof value === "string" && !isNaN(Number(value)) && value.trim() !== "";
|
|
161
161
|
if (isNumeric) {
|
|
162
162
|
return {
|
|
163
|
-
sql: `(CASE WHEN jsonb_typeof(metadata#>'{${jsonPathKey}}') = 'number' THEN (metadata#>>'{${jsonPathKey}}')::numeric ${symbol} $${paramIndex}::numeric ELSE
|
|
163
|
+
sql: `(CASE WHEN jsonb_typeof(metadata#>'{${jsonPathKey}}') = 'number' THEN (metadata#>>'{${jsonPathKey}}')::numeric ${symbol} $${paramIndex}::numeric ELSE NULL END)`,
|
|
164
164
|
needsValue: true
|
|
165
165
|
};
|
|
166
166
|
} else {
|
|
@@ -18275,11 +18275,12 @@ var WorkflowsPG = class _WorkflowsPG extends WorkflowsStorage {
|
|
|
18275
18275
|
const now = /* @__PURE__ */ new Date();
|
|
18276
18276
|
const sanitizedSnapshot = sanitizeJsonForPg(JSON.stringify(snapshot));
|
|
18277
18277
|
await t.none(
|
|
18278
|
-
`INSERT INTO ${tableName}
|
|
18279
|
-
|
|
18278
|
+
`INSERT INTO ${tableName}
|
|
18279
|
+
(workflow_name, run_id, snapshot, "createdAt", "updatedAt", "createdAtZ", "updatedAtZ")
|
|
18280
|
+
VALUES ($1, $2, $3, $4, $5, $6, $7)
|
|
18280
18281
|
ON CONFLICT (workflow_name, run_id) DO UPDATE
|
|
18281
|
-
SET snapshot = $3, "updatedAt" = $5`,
|
|
18282
|
-
[workflowName, runId, sanitizedSnapshot, now, now]
|
|
18282
|
+
SET snapshot = $3, "updatedAt" = $5, "updatedAtZ" = $7`,
|
|
18283
|
+
[workflowName, runId, sanitizedSnapshot, now, now, now, now]
|
|
18283
18284
|
);
|
|
18284
18285
|
return snapshot.context;
|
|
18285
18286
|
});
|
|
@@ -18321,9 +18322,12 @@ var WorkflowsPG = class _WorkflowsPG extends WorkflowsStorage {
|
|
|
18321
18322
|
}
|
|
18322
18323
|
const updatedSnapshot = { ...snapshot, ...opts };
|
|
18323
18324
|
const sanitizedSnapshot = sanitizeJsonForPg(JSON.stringify(updatedSnapshot));
|
|
18325
|
+
const now = /* @__PURE__ */ new Date();
|
|
18324
18326
|
await t.none(
|
|
18325
|
-
`UPDATE ${tableName}
|
|
18326
|
-
|
|
18327
|
+
`UPDATE ${tableName}
|
|
18328
|
+
SET snapshot = $1, "updatedAt" = $2, "updatedAtZ" = $3
|
|
18329
|
+
WHERE workflow_name = $4 AND run_id = $5`,
|
|
18330
|
+
[sanitizedSnapshot, now, now, workflowName, runId]
|
|
18327
18331
|
);
|
|
18328
18332
|
return updatedSnapshot;
|
|
18329
18333
|
});
|
|
@@ -18356,11 +18360,21 @@ var WorkflowsPG = class _WorkflowsPG extends WorkflowsStorage {
|
|
|
18356
18360
|
const updatedAtValue = updatedAt ? updatedAt : now;
|
|
18357
18361
|
const sanitizedSnapshot = sanitizeJsonForPg(JSON.stringify(snapshot));
|
|
18358
18362
|
await this.#db.client.none(
|
|
18359
|
-
`INSERT INTO ${getTableName7({ indexName: TABLE_WORKFLOW_SNAPSHOT, schemaName: getSchemaName7(this.#schema) })}
|
|
18360
|
-
|
|
18363
|
+
`INSERT INTO ${getTableName7({ indexName: TABLE_WORKFLOW_SNAPSHOT, schemaName: getSchemaName7(this.#schema) })}
|
|
18364
|
+
(workflow_name, run_id, "resourceId", snapshot, "createdAt", "updatedAt", "createdAtZ", "updatedAtZ")
|
|
18365
|
+
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
|
|
18361
18366
|
ON CONFLICT (workflow_name, run_id) DO UPDATE
|
|
18362
|
-
SET "resourceId" = $3, snapshot = $4, "updatedAt" = $6`,
|
|
18363
|
-
[
|
|
18367
|
+
SET "resourceId" = $3, snapshot = $4, "updatedAt" = $6, "updatedAtZ" = $8`,
|
|
18368
|
+
[
|
|
18369
|
+
workflowName,
|
|
18370
|
+
runId,
|
|
18371
|
+
resourceId,
|
|
18372
|
+
sanitizedSnapshot,
|
|
18373
|
+
createdAtValue,
|
|
18374
|
+
updatedAtValue,
|
|
18375
|
+
createdAtValue,
|
|
18376
|
+
updatedAtValue
|
|
18377
|
+
]
|
|
18364
18378
|
);
|
|
18365
18379
|
} catch (error) {
|
|
18366
18380
|
throw new MastraError(
|