@mastra/mysql 0.16.0 → 0.17.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.
@@ -3,7 +3,7 @@ name: mastra-mysql
3
3
  description: Documentation for @mastra/mysql. Use when working with @mastra/mysql APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/mysql"
6
- version: "0.16.0"
6
+ version: "0.17.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -18,9 +18,5 @@ Read the individual reference documents for detailed explanations and code examp
18
18
 
19
19
  - [MySQL](references/integrations-databases-mysql.md) - Persist Mastra application data in MySQL with connection pooling, automatic schema initialization, and configurable indexes.
20
20
 
21
- ### Reference
22
-
23
- - [Reference: Storage retention (prune)](references/reference-storage-retention.md) - prune() deletes rows. It caps growth and is safe to run against large tables (batched, bounded, resumable, cancellable).
24
-
25
21
 
26
22
  Read [assets/SOURCE_MAP.json](assets/SOURCE_MAP.json) for source code references.
@@ -1,6 +1,87 @@
1
1
  {
2
- "version": "0.16.0",
2
+ "version": "0.17.0",
3
3
  "package": "@mastra/mysql",
4
- "exports": {},
4
+ "exports": {
5
+ "AgentsMySQL": {
6
+ "types": "dist/storage/domains/agents/index.d.ts",
7
+ "implementation": "dist/index.js",
8
+ "line": 778
9
+ },
10
+ "BlobsMySQL": {
11
+ "types": "dist/storage/domains/blobs/index.d.ts",
12
+ "implementation": "dist/index.js",
13
+ "line": 1727
14
+ },
15
+ "DatasetsMySQL": {
16
+ "types": "dist/storage/domains/datasets/index.d.ts",
17
+ "implementation": "dist/index.js",
18
+ "line": 1962
19
+ },
20
+ "ExperimentsMySQL": {
21
+ "types": "dist/storage/domains/experiments/index.d.ts",
22
+ "implementation": "dist/index.js",
23
+ "line": 3098
24
+ },
25
+ "MCPClientsMySQL": {
26
+ "types": "dist/storage/domains/mcp-clients/index.d.ts",
27
+ "implementation": "dist/index.js",
28
+ "line": 6064
29
+ },
30
+ "MCPServersMySQL": {
31
+ "types": "dist/storage/domains/mcp-servers/index.d.ts",
32
+ "implementation": "dist/index.js",
33
+ "line": 6537
34
+ },
35
+ "MemoryMySQL": {
36
+ "types": "dist/storage/domains/memory/index.d.ts",
37
+ "implementation": "dist/index.js",
38
+ "line": 7271
39
+ },
40
+ "MySQLStore": {
41
+ "types": "dist/storage/index.d.ts",
42
+ "implementation": "dist/index.js",
43
+ "line": 13526
44
+ },
45
+ "ObservabilityMySQL": {
46
+ "types": "dist/storage/domains/observability/index.d.ts",
47
+ "implementation": "dist/index.js",
48
+ "line": 9385
49
+ },
50
+ "PromptBlocksMySQL": {
51
+ "types": "dist/storage/domains/prompt-blocks/index.d.ts",
52
+ "implementation": "dist/index.js",
53
+ "line": 9904
54
+ },
55
+ "ScorerDefinitionsMySQL": {
56
+ "types": "dist/storage/domains/scorer-definitions/index.d.ts",
57
+ "implementation": "dist/index.js",
58
+ "line": 10662
59
+ },
60
+ "ScoresMySQL": {
61
+ "types": "dist/storage/domains/scores/index.d.ts",
62
+ "implementation": "dist/index.js",
63
+ "line": 11149
64
+ },
65
+ "SkillsMySQL": {
66
+ "types": "dist/storage/domains/skills/index.d.ts",
67
+ "implementation": "dist/index.js",
68
+ "line": 11446
69
+ },
70
+ "StoreOperationsMySQL": {
71
+ "types": "dist/storage/domains/operations/index.d.ts",
72
+ "implementation": "dist/index.js",
73
+ "line": 184
74
+ },
75
+ "WorkflowsMySQL": {
76
+ "types": "dist/storage/domains/workflows/index.d.ts",
77
+ "implementation": "dist/index.js",
78
+ "line": 12397
79
+ },
80
+ "WorkspacesMySQL": {
81
+ "types": "dist/storage/domains/workspaces/index.d.ts",
82
+ "implementation": "dist/index.js",
83
+ "line": 12930
84
+ }
85
+ },
5
86
  "modules": {}
6
87
  }
package/dist/index.cjs CHANGED
@@ -10406,6 +10406,8 @@ function rowToSchedule(row) {
10406
10406
  if (metadata !== void 0) schedule.metadata = metadata;
10407
10407
  if (row.owner_type != null) schedule.ownerType = String(row.owner_type);
10408
10408
  if (row.owner_id != null) schedule.ownerId = String(row.owner_id);
10409
+ if (row.run_at != null) schedule.runAt = Number(row.run_at);
10410
+ if (row.end_at != null) schedule.endAt = Number(row.end_at);
10409
10411
  return schedule;
10410
10412
  }
10411
10413
  function rowToTrigger(row) {
@@ -10442,6 +10444,11 @@ var SchedulesMySQL = class SchedulesMySQL extends _mastra_core_storage.Schedules
10442
10444
  tableName: _mastra_core_storage.TABLE_SCHEDULES,
10443
10445
  schema: _mastra_core_storage.TABLE_SCHEMAS[_mastra_core_storage.TABLE_SCHEDULES]
10444
10446
  });
10447
+ await this.operations.alterTable({
10448
+ tableName: _mastra_core_storage.TABLE_SCHEDULES,
10449
+ schema: _mastra_core_storage.TABLE_SCHEMAS[_mastra_core_storage.TABLE_SCHEDULES],
10450
+ ifNotExists: ["run_at", "end_at"]
10451
+ });
10445
10452
  await this.operations.createTable({
10446
10453
  tableName: _mastra_core_storage.TABLE_SCHEDULE_TRIGGERS,
10447
10454
  schema: _mastra_core_storage.TABLE_SCHEMAS[_mastra_core_storage.TABLE_SCHEDULE_TRIGGERS]
@@ -10490,7 +10497,7 @@ var SchedulesMySQL = class SchedulesMySQL extends _mastra_core_storage.Schedules
10490
10497
  }
10491
10498
  async createSchedule(schedule) {
10492
10499
  if (await this.getSchedule(schedule.id)) throw new Error(`Schedule with id "${schedule.id}" already exists`);
10493
- await this.pool.execute(`INSERT INTO ${formatTableName(_mastra_core_storage.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 (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [
10500
+ await this.pool.execute(`INSERT INTO ${formatTableName(_mastra_core_storage.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 (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [
10494
10501
  schedule.id,
10495
10502
  JSON.stringify(schedule.target),
10496
10503
  schedule.cron,
@@ -10503,7 +10510,9 @@ var SchedulesMySQL = class SchedulesMySQL extends _mastra_core_storage.Schedules
10503
10510
  schedule.updatedAt,
10504
10511
  schedule.metadata ? JSON.stringify(schedule.metadata) : null,
10505
10512
  schedule.ownerType ?? null,
10506
- schedule.ownerId ?? null
10513
+ schedule.ownerId ?? null,
10514
+ schedule.runAt ?? null,
10515
+ schedule.endAt ?? null
10507
10516
  ]);
10508
10517
  return schedule;
10509
10518
  }
@@ -10581,6 +10590,14 @@ var SchedulesMySQL = class SchedulesMySQL extends _mastra_core_storage.Schedules
10581
10590
  setClauses.push(`${quoteIdentifier("owner_id", "column name")} = ?`);
10582
10591
  params.push(update.ownerId ?? null);
10583
10592
  }
10593
+ if ("runAt" in update) {
10594
+ setClauses.push(`${quoteIdentifier("run_at", "column name")} = ?`);
10595
+ params.push(update.runAt ?? null);
10596
+ }
10597
+ if ("endAt" in update) {
10598
+ setClauses.push(`${quoteIdentifier("end_at", "column name")} = ?`);
10599
+ params.push(update.endAt ?? null);
10600
+ }
10584
10601
  if (setClauses.length === 0) {
10585
10602
  const existing = await this.getSchedule(id);
10586
10603
  if (!existing) throw new Error(`Schedule ${id} not found`);