@mastra/mysql 0.16.0-alpha.3 → 0.17.0-alpha.0
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 -5
- package/dist/docs/assets/SOURCE_MAP.json +83 -2
- package/dist/index.cjs +19 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19 -2
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/schedules/index.d.ts.map +1 -1
- package/package.json +5 -5
- package/dist/docs/references/reference-storage-retention.md +0 -310
package/dist/index.js
CHANGED
|
@@ -10405,6 +10405,8 @@ function rowToSchedule(row) {
|
|
|
10405
10405
|
if (metadata !== void 0) schedule.metadata = metadata;
|
|
10406
10406
|
if (row.owner_type != null) schedule.ownerType = String(row.owner_type);
|
|
10407
10407
|
if (row.owner_id != null) schedule.ownerId = String(row.owner_id);
|
|
10408
|
+
if (row.run_at != null) schedule.runAt = Number(row.run_at);
|
|
10409
|
+
if (row.end_at != null) schedule.endAt = Number(row.end_at);
|
|
10408
10410
|
return schedule;
|
|
10409
10411
|
}
|
|
10410
10412
|
function rowToTrigger(row) {
|
|
@@ -10441,6 +10443,11 @@ var SchedulesMySQL = class SchedulesMySQL extends SchedulesStorage {
|
|
|
10441
10443
|
tableName: TABLE_SCHEDULES,
|
|
10442
10444
|
schema: TABLE_SCHEMAS[TABLE_SCHEDULES]
|
|
10443
10445
|
});
|
|
10446
|
+
await this.operations.alterTable({
|
|
10447
|
+
tableName: TABLE_SCHEDULES,
|
|
10448
|
+
schema: TABLE_SCHEMAS[TABLE_SCHEDULES],
|
|
10449
|
+
ifNotExists: ["run_at", "end_at"]
|
|
10450
|
+
});
|
|
10444
10451
|
await this.operations.createTable({
|
|
10445
10452
|
tableName: TABLE_SCHEDULE_TRIGGERS,
|
|
10446
10453
|
schema: TABLE_SCHEMAS[TABLE_SCHEDULE_TRIGGERS]
|
|
@@ -10489,7 +10496,7 @@ var SchedulesMySQL = class SchedulesMySQL extends SchedulesStorage {
|
|
|
10489
10496
|
}
|
|
10490
10497
|
async createSchedule(schedule) {
|
|
10491
10498
|
if (await this.getSchedule(schedule.id)) throw new Error(`Schedule with id "${schedule.id}" already exists`);
|
|
10492
|
-
await this.pool.execute(`INSERT INTO ${formatTableName(TABLE_SCHEDULES)} (${quoteIdentifier("id", "column name")}, ${quoteIdentifier("target", "column name")}, ${quoteIdentifier("cron", "column name")}, ${quoteIdentifier("timezone", "column name")}, ${quoteIdentifier("status", "column name")}, ${quoteIdentifier("next_fire_at", "column name")}, ${quoteIdentifier("last_fire_at", "column name")}, ${quoteIdentifier("last_run_id", "column name")}, ${quoteIdentifier("created_at", "column name")}, ${quoteIdentifier("updated_at", "column name")}, ${quoteIdentifier("metadata", "column name")}, ${quoteIdentifier("owner_type", "column name")}, ${quoteIdentifier("owner_id", "column name")}) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [
|
|
10499
|
+
await this.pool.execute(`INSERT INTO ${formatTableName(TABLE_SCHEDULES)} (${quoteIdentifier("id", "column name")}, ${quoteIdentifier("target", "column name")}, ${quoteIdentifier("cron", "column name")}, ${quoteIdentifier("timezone", "column name")}, ${quoteIdentifier("status", "column name")}, ${quoteIdentifier("next_fire_at", "column name")}, ${quoteIdentifier("last_fire_at", "column name")}, ${quoteIdentifier("last_run_id", "column name")}, ${quoteIdentifier("created_at", "column name")}, ${quoteIdentifier("updated_at", "column name")}, ${quoteIdentifier("metadata", "column name")}, ${quoteIdentifier("owner_type", "column name")}, ${quoteIdentifier("owner_id", "column name")}, ${quoteIdentifier("run_at", "column name")}, ${quoteIdentifier("end_at", "column name")}) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [
|
|
10493
10500
|
schedule.id,
|
|
10494
10501
|
JSON.stringify(schedule.target),
|
|
10495
10502
|
schedule.cron,
|
|
@@ -10502,7 +10509,9 @@ var SchedulesMySQL = class SchedulesMySQL extends SchedulesStorage {
|
|
|
10502
10509
|
schedule.updatedAt,
|
|
10503
10510
|
schedule.metadata ? JSON.stringify(schedule.metadata) : null,
|
|
10504
10511
|
schedule.ownerType ?? null,
|
|
10505
|
-
schedule.ownerId ?? null
|
|
10512
|
+
schedule.ownerId ?? null,
|
|
10513
|
+
schedule.runAt ?? null,
|
|
10514
|
+
schedule.endAt ?? null
|
|
10506
10515
|
]);
|
|
10507
10516
|
return schedule;
|
|
10508
10517
|
}
|
|
@@ -10580,6 +10589,14 @@ var SchedulesMySQL = class SchedulesMySQL extends SchedulesStorage {
|
|
|
10580
10589
|
setClauses.push(`${quoteIdentifier("owner_id", "column name")} = ?`);
|
|
10581
10590
|
params.push(update.ownerId ?? null);
|
|
10582
10591
|
}
|
|
10592
|
+
if ("runAt" in update) {
|
|
10593
|
+
setClauses.push(`${quoteIdentifier("run_at", "column name")} = ?`);
|
|
10594
|
+
params.push(update.runAt ?? null);
|
|
10595
|
+
}
|
|
10596
|
+
if ("endAt" in update) {
|
|
10597
|
+
setClauses.push(`${quoteIdentifier("end_at", "column name")} = ?`);
|
|
10598
|
+
params.push(update.endAt ?? null);
|
|
10599
|
+
}
|
|
10583
10600
|
if (setClauses.length === 0) {
|
|
10584
10601
|
const existing = await this.getSchedule(id);
|
|
10585
10602
|
if (!existing) throw new Error(`Schedule ${id} not found`);
|