@mastra/mysql 0.13.1 → 0.13.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/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/reference-storage-retention.md +15 -12
- package/dist/index.cjs +58 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +58 -0
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +8 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/operations/index.d.ts +1 -1
- package/dist/storage/domains/operations/index.d.ts.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts +8 -1
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/docs/SKILL.md
CHANGED
|
@@ -12,18 +12,21 @@ Retention covers **growth tables** only: tables that accumulate rows unbounded a
|
|
|
12
12
|
|
|
13
13
|
Storage adapters use the shared core retention contract for `prune()`, or a database-native mechanism when that better matches the backend.
|
|
14
14
|
|
|
15
|
-
| Adapter
|
|
16
|
-
|
|
|
17
|
-
| libSQL
|
|
18
|
-
| PostgreSQL
|
|
19
|
-
| MongoDB
|
|
20
|
-
| DuckDB
|
|
21
|
-
| MySQL
|
|
22
|
-
| Microsoft SQL Server
|
|
23
|
-
| Oracle Database
|
|
24
|
-
| Amazon Aurora DSQL
|
|
25
|
-
| Google Cloud Spanner
|
|
26
|
-
|
|
|
15
|
+
| Adapter | Mechanism | Retention support |
|
|
16
|
+
| --------------------------------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
17
|
+
| libSQL | `prune()` | All supported growth domains |
|
|
18
|
+
| PostgreSQL | `prune()` | All supported growth domains. vNext observability drops expired partitions or chunks |
|
|
19
|
+
| MongoDB | `prune()` or native TTL | All supported growth domains. Native TTL indexes are also available |
|
|
20
|
+
| DuckDB | `prune()` | Observability spans, metrics, logs, scores, and feedback |
|
|
21
|
+
| MySQL | `prune()` | Observability spans, durable agent run fencing (`runOwnership`, `runFences`) |
|
|
22
|
+
| Microsoft SQL Server | `prune()` | Observability spans, durable agent run fencing (`runOwnership`, `runFences`) |
|
|
23
|
+
| Oracle Database | `prune()` | Observability spans and logs, durable agent run fencing (`runOwnership`, `runFences`) |
|
|
24
|
+
| Amazon Aurora DSQL | `prune()` | Observability spans, durable agent run fencing (`runOwnership`, `runFences`) |
|
|
25
|
+
| Google Cloud Spanner | `prune()` | Observability spans, plus metrics when metrics storage is enabled. Durable agent run fencing (`runOwnership`, `runFences`) |
|
|
26
|
+
| DynamoDB | `prune()` | Durable agent run fencing (`runOwnership`, `runFences`) |
|
|
27
|
+
| Convex | `prune()` | Durable agent run fencing (`runOwnership`, `runFences`). Redeploy your Convex functions after upgrading |
|
|
28
|
+
| Cloudflare D1 and Durable Objects | `prune()` | Durable agent run fencing (`runOwnership`, `runFences`) |
|
|
29
|
+
| ClickHouse | Native TTL | Observability spans, metrics, logs, scores, and feedback. When all five signals have finite retention, deletion-request records expire after the longest signal retention plus 30 days |
|
|
27
30
|
|
|
28
31
|
## Storage-specific maintenance
|
|
29
32
|
|
package/dist/index.cjs
CHANGED
|
@@ -6283,6 +6283,17 @@ var MemoryMySQL = class MemoryMySQL extends _mastra_core_storage.MemoryStorage {
|
|
|
6283
6283
|
_mastra_core_storage.TABLE_MESSAGES,
|
|
6284
6284
|
_mastra_core_storage.TABLE_RESOURCES
|
|
6285
6285
|
];
|
|
6286
|
+
/**
|
|
6287
|
+
* Tables `prune()` can clean up. Run fences anchor on `retiredAt` (epoch ms), which stays NULL until the
|
|
6288
|
+
* execution holding the fence settles, so a running execution's fence is
|
|
6289
|
+
* never pruned.
|
|
6290
|
+
*/
|
|
6291
|
+
static retentionTables = { runFences: {
|
|
6292
|
+
table: _mastra_core_storage.TABLE_MEMORY_RUN_FENCES,
|
|
6293
|
+
column: "retiredAt",
|
|
6294
|
+
indexed: false,
|
|
6295
|
+
anchorType: "epoch-ms"
|
|
6296
|
+
} };
|
|
6286
6297
|
constructor({ pool, operations, skipDefaultIndexes, indexes }) {
|
|
6287
6298
|
super();
|
|
6288
6299
|
this.pool = pool;
|
|
@@ -6455,6 +6466,24 @@ var MemoryMySQL = class MemoryMySQL extends _mastra_core_storage.MemoryStorage {
|
|
|
6455
6466
|
if (!this.#indexes || this.#indexes.length === 0) return;
|
|
6456
6467
|
for (const indexDef of this.#indexes) await this.operations.createIndex(indexDef);
|
|
6457
6468
|
}
|
|
6469
|
+
async prune(policies, options) {
|
|
6470
|
+
return (0, _mastra_core_storage.executeRetentionPrune)({
|
|
6471
|
+
domain: "memory",
|
|
6472
|
+
targets: (0, _mastra_core_storage.resolveRetentionTargets)({
|
|
6473
|
+
policies,
|
|
6474
|
+
descriptor: MemoryMySQL.retentionTables,
|
|
6475
|
+
order: ["runFences"]
|
|
6476
|
+
}),
|
|
6477
|
+
options,
|
|
6478
|
+
cutoffFor: (target, now) => (0, _mastra_core_storage.retentionCutoffMs)(target.policy, now),
|
|
6479
|
+
deleteBatch: (target, cutoff, limit) => this.operations.pruneBatch({
|
|
6480
|
+
tableName: target.table,
|
|
6481
|
+
column: target.column,
|
|
6482
|
+
cutoff,
|
|
6483
|
+
limit
|
|
6484
|
+
})
|
|
6485
|
+
});
|
|
6486
|
+
}
|
|
6458
6487
|
async dangerouslyClearAll() {
|
|
6459
6488
|
await this.pool.execute(`DELETE FROM ${formatTableName(_mastra_core_storage.TABLE_MESSAGES)}`);
|
|
6460
6489
|
await this.pool.execute(`DELETE FROM ${formatTableName(_mastra_core_storage.TABLE_THREADS)}`);
|
|
@@ -11360,6 +11389,17 @@ var WorkflowsMySQL = class WorkflowsMySQL extends _mastra_core_storage.Workflows
|
|
|
11360
11389
|
/** Tables managed by this domain */
|
|
11361
11390
|
static MANAGED_TABLES = [_mastra_core_storage.TABLE_WORKFLOW_SNAPSHOT];
|
|
11362
11391
|
/**
|
|
11392
|
+
* Tables `prune()` can clean up. Run ownership rows anchor on `updatedAt` (epoch ms), which every
|
|
11393
|
+
* claim, renewal and release refreshes, so a live execution's row is never
|
|
11394
|
+
* older than its renew interval.
|
|
11395
|
+
*/
|
|
11396
|
+
static retentionTables = { runOwnership: {
|
|
11397
|
+
table: _mastra_core_storage.TABLE_WORKFLOW_RUN_OWNERS,
|
|
11398
|
+
column: "updatedAt",
|
|
11399
|
+
indexed: false,
|
|
11400
|
+
anchorType: "epoch-ms"
|
|
11401
|
+
} };
|
|
11402
|
+
/**
|
|
11363
11403
|
* Returns default index definitions for the workflows domain tables.
|
|
11364
11404
|
* Currently no default indexes are defined for workflows.
|
|
11365
11405
|
*/
|
|
@@ -11427,6 +11467,24 @@ var WorkflowsMySQL = class WorkflowsMySQL extends _mastra_core_storage.Workflows
|
|
|
11427
11467
|
await this.createDefaultIndexes();
|
|
11428
11468
|
await this.createCustomIndexes();
|
|
11429
11469
|
}
|
|
11470
|
+
async prune(policies, options) {
|
|
11471
|
+
return (0, _mastra_core_storage.executeRetentionPrune)({
|
|
11472
|
+
domain: "workflows",
|
|
11473
|
+
targets: (0, _mastra_core_storage.resolveRetentionTargets)({
|
|
11474
|
+
policies,
|
|
11475
|
+
descriptor: WorkflowsMySQL.retentionTables,
|
|
11476
|
+
order: ["runOwnership"]
|
|
11477
|
+
}),
|
|
11478
|
+
options,
|
|
11479
|
+
cutoffFor: (target, now) => (0, _mastra_core_storage.retentionCutoffMs)(target.policy, now),
|
|
11480
|
+
deleteBatch: (target, cutoff, limit) => this.operations.pruneBatch({
|
|
11481
|
+
tableName: target.table,
|
|
11482
|
+
column: target.column,
|
|
11483
|
+
cutoff,
|
|
11484
|
+
limit
|
|
11485
|
+
})
|
|
11486
|
+
});
|
|
11487
|
+
}
|
|
11430
11488
|
async dangerouslyClearAll() {
|
|
11431
11489
|
await this.pool.execute(`DELETE FROM ${formatTableName(_mastra_core_storage.TABLE_WORKFLOW_SNAPSHOT)}`);
|
|
11432
11490
|
await this.pool.execute(`DELETE FROM ${RUN_OWNERS_TABLE}`);
|