@mastra/mysql 0.10.2 → 0.11.0-alpha.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.
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +45 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +45 -6
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/background-tasks/index.d.ts +2 -4
- package/dist/storage/domains/background-tasks/index.d.ts.map +1 -1
- package/dist/storage/domains/skills/index.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1406,7 +1406,9 @@ function rowToTask(row) {
|
|
|
1406
1406
|
createdAt: parseDateTime(row.createdAt),
|
|
1407
1407
|
startedAt: parseDateTime(row.startedAt),
|
|
1408
1408
|
suspendedAt: parseDateTime(row.suspendedAt),
|
|
1409
|
-
completedAt: parseDateTime(row.completedAt)
|
|
1409
|
+
completedAt: parseDateTime(row.completedAt),
|
|
1410
|
+
ownerId: row.ownerId != null ? String(row.ownerId) : void 0,
|
|
1411
|
+
leaseExpiresAt: parseDateTime(row.leaseExpiresAt)
|
|
1410
1412
|
};
|
|
1411
1413
|
}
|
|
1412
1414
|
var BackgroundTasksMySQL = class BackgroundTasksMySQL extends BackgroundTasksStorage {
|
|
@@ -1427,6 +1429,16 @@ var BackgroundTasksMySQL = class BackgroundTasksMySQL extends BackgroundTasksSto
|
|
|
1427
1429
|
tableName: TABLE_BACKGROUND_TASKS,
|
|
1428
1430
|
schema: TABLE_SCHEMAS[TABLE_BACKGROUND_TASKS]
|
|
1429
1431
|
});
|
|
1432
|
+
await this.operations.alterTable({
|
|
1433
|
+
tableName: TABLE_BACKGROUND_TASKS,
|
|
1434
|
+
schema: TABLE_SCHEMAS[TABLE_BACKGROUND_TASKS],
|
|
1435
|
+
ifNotExists: [
|
|
1436
|
+
"suspend_payload",
|
|
1437
|
+
"suspendedAt",
|
|
1438
|
+
"ownerId",
|
|
1439
|
+
"leaseExpiresAt"
|
|
1440
|
+
]
|
|
1441
|
+
});
|
|
1430
1442
|
await this.createDefaultIndexes();
|
|
1431
1443
|
await this.createCustomIndexes();
|
|
1432
1444
|
}
|
|
@@ -1478,7 +1490,7 @@ var BackgroundTasksMySQL = class BackgroundTasksMySQL extends BackgroundTasksSto
|
|
|
1478
1490
|
await this.operations.clearTable({ tableName: TABLE_BACKGROUND_TASKS });
|
|
1479
1491
|
}
|
|
1480
1492
|
async createTask(task) {
|
|
1481
|
-
await this.pool.execute(`INSERT INTO ${formatTableName(TABLE_BACKGROUND_TASKS)} (${quoteIdentifier("id", "column name")}, ${quoteIdentifier("tool_call_id", "column name")}, ${quoteIdentifier("tool_name", "column name")}, ${quoteIdentifier("agent_id", "column name")}, ${quoteIdentifier("thread_id", "column name")}, ${quoteIdentifier("resource_id", "column name")}, ${quoteIdentifier("run_id", "column name")}, ${quoteIdentifier("status", "column name")}, ${quoteIdentifier("args", "column name")}, ${quoteIdentifier("result", "column name")}, ${quoteIdentifier("error", "column name")}, ${quoteIdentifier("suspend_payload", "column name")}, ${quoteIdentifier("retry_count", "column name")}, ${quoteIdentifier("max_retries", "column name")}, ${quoteIdentifier("timeout_ms", "column name")}, ${quoteIdentifier("createdAt", "column name")}, ${quoteIdentifier("startedAt", "column name")}, ${quoteIdentifier("suspendedAt", "column name")}, ${quoteIdentifier("completedAt", "column name")}) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [
|
|
1493
|
+
await this.pool.execute(`INSERT INTO ${formatTableName(TABLE_BACKGROUND_TASKS)} (${quoteIdentifier("id", "column name")}, ${quoteIdentifier("tool_call_id", "column name")}, ${quoteIdentifier("tool_name", "column name")}, ${quoteIdentifier("agent_id", "column name")}, ${quoteIdentifier("thread_id", "column name")}, ${quoteIdentifier("resource_id", "column name")}, ${quoteIdentifier("run_id", "column name")}, ${quoteIdentifier("status", "column name")}, ${quoteIdentifier("args", "column name")}, ${quoteIdentifier("result", "column name")}, ${quoteIdentifier("error", "column name")}, ${quoteIdentifier("suspend_payload", "column name")}, ${quoteIdentifier("retry_count", "column name")}, ${quoteIdentifier("max_retries", "column name")}, ${quoteIdentifier("timeout_ms", "column name")}, ${quoteIdentifier("createdAt", "column name")}, ${quoteIdentifier("startedAt", "column name")}, ${quoteIdentifier("suspendedAt", "column name")}, ${quoteIdentifier("completedAt", "column name")}, ${quoteIdentifier("ownerId", "column name")}, ${quoteIdentifier("leaseExpiresAt", "column name")}) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [
|
|
1482
1494
|
task.id,
|
|
1483
1495
|
task.toolCallId,
|
|
1484
1496
|
task.toolName,
|
|
@@ -1497,7 +1509,9 @@ var BackgroundTasksMySQL = class BackgroundTasksMySQL extends BackgroundTasksSto
|
|
|
1497
1509
|
transformToSqlValue(task.createdAt),
|
|
1498
1510
|
transformToSqlValue(task.startedAt),
|
|
1499
1511
|
transformToSqlValue(task.suspendedAt),
|
|
1500
|
-
transformToSqlValue(task.completedAt)
|
|
1512
|
+
transformToSqlValue(task.completedAt),
|
|
1513
|
+
task.ownerId ?? null,
|
|
1514
|
+
transformToSqlValue(task.leaseExpiresAt)
|
|
1501
1515
|
]);
|
|
1502
1516
|
}
|
|
1503
1517
|
async updateTask(taskId, update, options) {
|
|
@@ -1535,11 +1549,33 @@ var BackgroundTasksMySQL = class BackgroundTasksMySQL extends BackgroundTasksSto
|
|
|
1535
1549
|
setClauses.push(`${quoteIdentifier("completedAt", "column name")} = ?`);
|
|
1536
1550
|
params.push(transformToSqlValue(update.completedAt));
|
|
1537
1551
|
}
|
|
1552
|
+
if ("ownerId" in update) {
|
|
1553
|
+
setClauses.push(`${quoteIdentifier("ownerId", "column name")} = ?`);
|
|
1554
|
+
params.push(update.ownerId ?? null);
|
|
1555
|
+
}
|
|
1556
|
+
if ("leaseExpiresAt" in update) {
|
|
1557
|
+
setClauses.push(`${quoteIdentifier("leaseExpiresAt", "column name")} = ?`);
|
|
1558
|
+
params.push(transformToSqlValue(update.leaseExpiresAt));
|
|
1559
|
+
}
|
|
1538
1560
|
if (setClauses.length === 0) return false;
|
|
1539
1561
|
params.push(taskId);
|
|
1540
|
-
const
|
|
1541
|
-
if (options?.expectedStatus)
|
|
1542
|
-
|
|
1562
|
+
const predicates = [];
|
|
1563
|
+
if (options?.expectedStatus) {
|
|
1564
|
+
predicates.push(`${quoteIdentifier("status", "column name")} = ?`);
|
|
1565
|
+
params.push(options.expectedStatus);
|
|
1566
|
+
}
|
|
1567
|
+
if (options?.expectedOwnerId !== void 0) if (options.expectedOwnerId === null) predicates.push(`${quoteIdentifier("ownerId", "column name")} IS NULL`);
|
|
1568
|
+
else {
|
|
1569
|
+
predicates.push(`${quoteIdentifier("ownerId", "column name")} = ?`);
|
|
1570
|
+
params.push(options.expectedOwnerId);
|
|
1571
|
+
}
|
|
1572
|
+
if (options?.expectedLeaseExpiresAt !== void 0) if (options.expectedLeaseExpiresAt === null) predicates.push(`${quoteIdentifier("leaseExpiresAt", "column name")} IS NULL`);
|
|
1573
|
+
else {
|
|
1574
|
+
predicates.push(`${quoteIdentifier("leaseExpiresAt", "column name")} = ?`);
|
|
1575
|
+
params.push(transformToSqlValue(options.expectedLeaseExpiresAt));
|
|
1576
|
+
}
|
|
1577
|
+
const predicateSql = predicates.length > 0 ? ` AND ${predicates.join(" AND ")}` : "";
|
|
1578
|
+
const [result] = await this.pool.execute(`UPDATE ${formatTableName(TABLE_BACKGROUND_TASKS)} SET ${setClauses.join(", ")} WHERE ${quoteIdentifier("id", "column name")} = ?${predicateSql}`, params);
|
|
1543
1579
|
return result.affectedRows > 0;
|
|
1544
1580
|
}
|
|
1545
1581
|
async getTask(taskId) {
|
|
@@ -9897,6 +9933,7 @@ const SNAPSHOT_FIELDS$1 = [
|
|
|
9897
9933
|
"references",
|
|
9898
9934
|
"scripts",
|
|
9899
9935
|
"assets",
|
|
9936
|
+
"files",
|
|
9900
9937
|
"metadata",
|
|
9901
9938
|
"tree"
|
|
9902
9939
|
];
|
|
@@ -10009,6 +10046,7 @@ var SkillsMySQL = class SkillsMySQL extends SkillsStorage {
|
|
|
10009
10046
|
references: this.safeParseJSON(row.references),
|
|
10010
10047
|
scripts: this.safeParseJSON(row.scripts),
|
|
10011
10048
|
assets: this.safeParseJSON(row.assets),
|
|
10049
|
+
files: this.safeParseJSON(row.files),
|
|
10012
10050
|
metadata: this.safeParseJSON(row.metadata),
|
|
10013
10051
|
tree: this.safeParseJSON(row.tree),
|
|
10014
10052
|
changedFields: this.safeParseJSON(row.changedFields),
|
|
@@ -10279,6 +10317,7 @@ var SkillsMySQL = class SkillsMySQL extends SkillsStorage {
|
|
|
10279
10317
|
references: input.references ?? null,
|
|
10280
10318
|
scripts: input.scripts ?? null,
|
|
10281
10319
|
assets: input.assets ?? null,
|
|
10320
|
+
files: input.files ?? null,
|
|
10282
10321
|
metadata: input.metadata ?? null,
|
|
10283
10322
|
tree: input.tree ?? null,
|
|
10284
10323
|
changedFields: input.changedFields ?? null,
|