@mastra/oracledb 0.5.2-alpha.1 → 0.5.3-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 -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/db/index.d.ts +1 -1
- package/dist/storage/db/index.d.ts.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/workflows/index.d.ts +8 -1
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -5699,6 +5699,17 @@ var MemoryOracle = class MemoryOracle extends MemoryStorage {
|
|
|
5699
5699
|
TABLE_OBSERVATIONAL_MEMORY,
|
|
5700
5700
|
TABLE_MEMORY_RUN_FENCES
|
|
5701
5701
|
];
|
|
5702
|
+
/**
|
|
5703
|
+
* Tables `prune()` can clean up. Run fences anchor on `retiredAt` (epoch ms), which stays NULL until the
|
|
5704
|
+
* execution holding the fence settles, so a running execution's fence is
|
|
5705
|
+
* never pruned.
|
|
5706
|
+
*/
|
|
5707
|
+
static retentionTables = { runFences: {
|
|
5708
|
+
table: TABLE_MEMORY_RUN_FENCES,
|
|
5709
|
+
column: "retiredAt",
|
|
5710
|
+
indexed: false,
|
|
5711
|
+
anchorType: "epoch-ms"
|
|
5712
|
+
} };
|
|
5702
5713
|
db;
|
|
5703
5714
|
schemaName;
|
|
5704
5715
|
messageBatchSize;
|
|
@@ -5749,6 +5760,24 @@ var MemoryOracle = class MemoryOracle extends MemoryStorage {
|
|
|
5749
5760
|
async backfillObservationalMemorySupersededBy() {
|
|
5750
5761
|
await this.ctx.db.withConnection((connection) => backfillObservationalMemorySupersededBy(this.ctx, connection));
|
|
5751
5762
|
}
|
|
5763
|
+
async prune(policies, options) {
|
|
5764
|
+
return executeRetentionPrune({
|
|
5765
|
+
domain: "memory",
|
|
5766
|
+
targets: resolveRetentionTargets({
|
|
5767
|
+
policies,
|
|
5768
|
+
descriptor: MemoryOracle.retentionTables,
|
|
5769
|
+
order: ["runFences"]
|
|
5770
|
+
}),
|
|
5771
|
+
options,
|
|
5772
|
+
cutoffFor: (target, now) => retentionCutoffMs(target.policy, now),
|
|
5773
|
+
deleteBatch: (target, cutoff, limit) => this.db.pruneBatch({
|
|
5774
|
+
tableName: target.table,
|
|
5775
|
+
column: target.column,
|
|
5776
|
+
cutoff,
|
|
5777
|
+
limit
|
|
5778
|
+
})
|
|
5779
|
+
});
|
|
5780
|
+
}
|
|
5752
5781
|
async dangerouslyClearAll() {
|
|
5753
5782
|
await clearAllMemoryTables(this.ctx);
|
|
5754
5783
|
await this.db.clearTable(TABLE_MEMORY_RUN_FENCES);
|
|
@@ -8340,6 +8369,17 @@ function toRunOwnershipRecord(runId, row) {
|
|
|
8340
8369
|
}
|
|
8341
8370
|
var WorkflowsOracle = class WorkflowsOracle extends WorkflowsStorage {
|
|
8342
8371
|
static MANAGED_TABLES = [TABLE_WORKFLOW_SNAPSHOT, TABLE_WORKFLOW_RUN_OWNERS];
|
|
8372
|
+
/**
|
|
8373
|
+
* Tables `prune()` can clean up. Run ownership rows anchor on `updatedAt` (epoch ms), which every
|
|
8374
|
+
* claim, renewal and release refreshes, so a live execution's row is never
|
|
8375
|
+
* older than its renew interval.
|
|
8376
|
+
*/
|
|
8377
|
+
static retentionTables = { runOwnership: {
|
|
8378
|
+
table: TABLE_WORKFLOW_RUN_OWNERS,
|
|
8379
|
+
column: "updatedAt",
|
|
8380
|
+
indexed: false,
|
|
8381
|
+
anchorType: "epoch-ms"
|
|
8382
|
+
} };
|
|
8343
8383
|
db;
|
|
8344
8384
|
schemaName;
|
|
8345
8385
|
skipDefaultIndexes;
|
|
@@ -8358,6 +8398,24 @@ var WorkflowsOracle = class WorkflowsOracle extends WorkflowsStorage {
|
|
|
8358
8398
|
await this.createTables();
|
|
8359
8399
|
await this.createIndexes();
|
|
8360
8400
|
}
|
|
8401
|
+
async prune(policies, options) {
|
|
8402
|
+
return executeRetentionPrune({
|
|
8403
|
+
domain: "workflows",
|
|
8404
|
+
targets: resolveRetentionTargets({
|
|
8405
|
+
policies,
|
|
8406
|
+
descriptor: WorkflowsOracle.retentionTables,
|
|
8407
|
+
order: ["runOwnership"]
|
|
8408
|
+
}),
|
|
8409
|
+
options,
|
|
8410
|
+
cutoffFor: (target, now) => retentionCutoffMs(target.policy, now),
|
|
8411
|
+
deleteBatch: (target, cutoff, limit) => this.db.pruneBatch({
|
|
8412
|
+
tableName: target.table,
|
|
8413
|
+
column: target.column,
|
|
8414
|
+
cutoff,
|
|
8415
|
+
limit
|
|
8416
|
+
})
|
|
8417
|
+
});
|
|
8418
|
+
}
|
|
8361
8419
|
async dangerouslyClearAll() {
|
|
8362
8420
|
await this.db.clearTable(TABLE_WORKFLOW_SNAPSHOT);
|
|
8363
8421
|
await this.db.clearTable(TABLE_WORKFLOW_RUN_OWNERS);
|