@mastra/mongodb 1.18.9 → 1.18.10-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 +9 -7
- package/dist/index.cjs +32 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +32 -17
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/datasets/index.d.ts.map +1 -1
- package/package.json +9 -6
package/dist/docs/SKILL.md
CHANGED
|
@@ -15,7 +15,7 @@ Storage adapters use the shared core retention contract for `prune()`, or a data
|
|
|
15
15
|
| Adapter | Mechanism | Retention support |
|
|
16
16
|
| -------------------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
17
17
|
| libSQL | `prune()` | All supported growth domains |
|
|
18
|
-
| PostgreSQL | `prune()` | All supported growth domains.
|
|
18
|
+
| PostgreSQL | `prune()` | All supported growth domains. vNext observability drops expired partitions or chunks |
|
|
19
19
|
| MongoDB | `prune()` or native TTL | All supported growth domains. Native TTL indexes are also available |
|
|
20
20
|
| DuckDB | `prune()` | Observability spans, metrics, logs, scores, and feedback |
|
|
21
21
|
| MySQL | `prune()` | Observability spans |
|
|
@@ -102,10 +102,10 @@ Each domain specifies its age-prunable tables and the timestamp column that anch
|
|
|
102
102
|
| `memory` | `resources` | `createdAt` | Resource age |
|
|
103
103
|
| `threadState` | `threadState` | `updatedAt` | Inactivity: state for still-active threads survives |
|
|
104
104
|
| `observability` | `spans` | `startedAt` | Span age |
|
|
105
|
-
| `observability` | `metrics` | `timestamp` | Metric event age (
|
|
106
|
-
| `observability` | `logs` | `timestamp` | Log event age (
|
|
107
|
-
| `observability` | `scores` | `timestamp` | Score event age (
|
|
108
|
-
| `observability` | `feedback` | `timestamp` | Feedback event age (
|
|
105
|
+
| `observability` | `metrics` | `timestamp` | Metric event age (vNext only) |
|
|
106
|
+
| `observability` | `logs` | `timestamp` | Log event age (vNext only) |
|
|
107
|
+
| `observability` | `scores` | `timestamp` | Score event age (vNext only) |
|
|
108
|
+
| `observability` | `feedback` | `timestamp` | Feedback event age (vNext only) |
|
|
109
109
|
| `scores` | `scorers` | `createdAt` | Score record age |
|
|
110
110
|
| `workflows` | `workflowSnapshot` | `updatedAt` | Inactivity, suspended or long-running workflows survive |
|
|
111
111
|
| `backgroundTasks` | `backgroundTasks` | `completedAt` | Time since completion, in-flight tasks (`NULL`) are never pruned |
|
|
@@ -122,7 +122,7 @@ Each domain specifies its age-prunable tables and the timestamp column that anch
|
|
|
122
122
|
> - On PostgreSQL, timestamp anchors use the timezone-aware mirror columns (for example `createdAtZ`, `completedAtZ`).
|
|
123
123
|
> - DuckDB observability stores append-only events for all five signals. Its `spans` policy uses the event `timestamp` column rather than `startedAt`.
|
|
124
124
|
> - LibSQL and PostgreSQL support all domains above except `harness`, which PostgreSQL doesn't implement. MongoDB supports all except `threadState` and `harness`. DuckDB, MySQL, Microsoft SQL Server, Oracle Database, Amazon Aurora DSQL, and Google Cloud Spanner currently support retention only in their `observability` domains, with the signal coverage shown in the support matrix.
|
|
125
|
-
> - The
|
|
125
|
+
> - The vNext PostgreSQL observability domain stores signal events in day-partitioned tables (`spans`, `metrics`, `logs`, `scores`, `feedback`). For it, `prune()` drops whole day partitions (or TimescaleDB chunks) that are entirely older than the cutoff instead of deleting rows: effective level of detail is one day, and a partition is only dropped once its entire day is past `maxAge`. `PruneResult.deleted` reports the number of rows in the dropped partitions.
|
|
126
126
|
|
|
127
127
|
## Methods
|
|
128
128
|
|
|
@@ -208,7 +208,9 @@ You can also cancel a long-running prune with an `AbortSignal`: the loop stops b
|
|
|
208
208
|
|
|
209
209
|
ClickHouse observability storage uses native table TTLs instead of `prune()`. Configure retention as days per signal. `init()` applies the TTLs to new and existing tables and skips `ALTER TABLE` statements when the configured TTL is already present.
|
|
210
210
|
|
|
211
|
-
|
|
211
|
+
Omitted signals, and signals set to zero or less, get no TTL. When you remove a signal from `retention`, the next `init()` or `applyRetention()` removes that table's TTL. If Mastra can't read the current TTLs from `system.tables`, it applies the configured TTLs and leaves the others unchanged.
|
|
212
|
+
|
|
213
|
+
For deployments that need to update TTL configuration without running the full initialization path, call `applyRetention()` on the vNext observability store:
|
|
212
214
|
|
|
213
215
|
```typescript
|
|
214
216
|
import { ObservabilityStorageClickhouseVNext } from '@mastra/clickhouse'
|
package/dist/index.cjs
CHANGED
|
@@ -10,7 +10,7 @@ let _mastra_core_agent = require("@mastra/core/agent");
|
|
|
10
10
|
let _mastra_core_evals = require("@mastra/core/evals");
|
|
11
11
|
let _mastra_core_storage_domains_skills = require("@mastra/core/storage/domains/skills");
|
|
12
12
|
//#region package.json
|
|
13
|
-
var version = "1.18.
|
|
13
|
+
var version = "1.18.10-alpha.0";
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/vector/filter.ts
|
|
16
16
|
/**
|
|
@@ -2779,9 +2779,9 @@ var MongoDBDatasetsStorage = class extends _mastra_core_storage.DatasetsStorage
|
|
|
2779
2779
|
name: row.name,
|
|
2780
2780
|
description: row.description ?? void 0,
|
|
2781
2781
|
metadata: typeof row.metadata === "string" ? (0, _mastra_core_storage.safelyParseJSON)(row.metadata) : row.metadata ?? void 0,
|
|
2782
|
-
inputSchema: typeof row.inputSchema === "string" ? (0, _mastra_core_storage.safelyParseJSON)(row.inputSchema) : row.inputSchema,
|
|
2783
|
-
groundTruthSchema: typeof row.groundTruthSchema === "string" ? (0, _mastra_core_storage.safelyParseJSON)(row.groundTruthSchema) : row.groundTruthSchema,
|
|
2784
|
-
requestContextSchema: typeof row.requestContextSchema === "string" ? (0, _mastra_core_storage.safelyParseJSON)(row.requestContextSchema) : row.requestContextSchema,
|
|
2782
|
+
inputSchema: (typeof row.inputSchema === "string" ? (0, _mastra_core_storage.safelyParseJSON)(row.inputSchema) : row.inputSchema) ?? void 0,
|
|
2783
|
+
groundTruthSchema: (typeof row.groundTruthSchema === "string" ? (0, _mastra_core_storage.safelyParseJSON)(row.groundTruthSchema) : row.groundTruthSchema) ?? void 0,
|
|
2784
|
+
requestContextSchema: (typeof row.requestContextSchema === "string" ? (0, _mastra_core_storage.safelyParseJSON)(row.requestContextSchema) : row.requestContextSchema) ?? void 0,
|
|
2785
2785
|
tags: typeof row.tags === "string" ? (0, _mastra_core_storage.safelyParseJSON)(row.tags) : row.tags ?? void 0,
|
|
2786
2786
|
targetType: row.targetType ?? void 0,
|
|
2787
2787
|
targetIds: typeof row.targetIds === "string" ? (0, _mastra_core_storage.safelyParseJSON)(row.targetIds) : row.targetIds ?? void 0,
|
|
@@ -2805,9 +2805,9 @@ var MongoDBDatasetsStorage = class extends _mastra_core_storage.DatasetsStorage
|
|
|
2805
2805
|
externalId: row.externalId ?? null,
|
|
2806
2806
|
organizationId: row.organizationId ?? null,
|
|
2807
2807
|
projectId: row.projectId ?? null,
|
|
2808
|
-
input:
|
|
2809
|
-
groundTruth:
|
|
2810
|
-
expectedTrajectory:
|
|
2808
|
+
input: row.input,
|
|
2809
|
+
groundTruth: row.groundTruth,
|
|
2810
|
+
expectedTrajectory: row.expectedTrajectory,
|
|
2811
2811
|
toolMocks: (typeof row.toolMocks === "string" ? (0, _mastra_core_storage.safelyParseJSON)(row.toolMocks) : row.toolMocks) ?? emptyValue,
|
|
2812
2812
|
unmockedToolPolicy: row.unmockedToolPolicy ?? emptyValue,
|
|
2813
2813
|
scorerIds: (typeof row.scorerIds === "string" ? (0, _mastra_core_storage.safelyParseJSON)(row.scorerIds) : row.scorerIds) ?? emptyValue,
|
|
@@ -3058,8 +3058,8 @@ var MongoDBDatasetsStorage = class extends _mastra_core_storage.DatasetsStorage
|
|
|
3058
3058
|
validTo: null,
|
|
3059
3059
|
isDeleted: false,
|
|
3060
3060
|
input: args.input,
|
|
3061
|
-
groundTruth: args.groundTruth
|
|
3062
|
-
expectedTrajectory: args.expectedTrajectory
|
|
3061
|
+
groundTruth: args.groundTruth,
|
|
3062
|
+
expectedTrajectory: args.expectedTrajectory,
|
|
3063
3063
|
toolMocks: args.toolMocks ?? null,
|
|
3064
3064
|
unmockedToolPolicy: args.unmockedToolPolicy ?? null,
|
|
3065
3065
|
scorerIds: args.scorerIds ?? null,
|
|
@@ -3068,7 +3068,10 @@ var MongoDBDatasetsStorage = class extends _mastra_core_storage.DatasetsStorage
|
|
|
3068
3068
|
source: args.source ?? null,
|
|
3069
3069
|
createdAt: now,
|
|
3070
3070
|
updatedAt: now
|
|
3071
|
-
}, {
|
|
3071
|
+
}, {
|
|
3072
|
+
session,
|
|
3073
|
+
ignoreUndefined: true
|
|
3074
|
+
});
|
|
3072
3075
|
await versionsCollection.insertOne({
|
|
3073
3076
|
id: versionId,
|
|
3074
3077
|
datasetId: args.datasetId,
|
|
@@ -3202,7 +3205,7 @@ var MongoDBDatasetsStorage = class extends _mastra_core_storage.DatasetsStorage
|
|
|
3202
3205
|
isDeleted: false,
|
|
3203
3206
|
input: mergedInput,
|
|
3204
3207
|
groundTruth: mergedGroundTruth,
|
|
3205
|
-
expectedTrajectory: mergedExpectedTrajectory
|
|
3208
|
+
expectedTrajectory: mergedExpectedTrajectory,
|
|
3206
3209
|
toolMocks: mergedToolMocks ?? null,
|
|
3207
3210
|
unmockedToolPolicy: mergedUnmockedToolPolicy ?? null,
|
|
3208
3211
|
scorerIds: mergedScorerIds ?? null,
|
|
@@ -3211,7 +3214,10 @@ var MongoDBDatasetsStorage = class extends _mastra_core_storage.DatasetsStorage
|
|
|
3211
3214
|
source: mergedSource,
|
|
3212
3215
|
createdAt: existing.createdAt,
|
|
3213
3216
|
updatedAt: now
|
|
3214
|
-
}, {
|
|
3217
|
+
}, {
|
|
3218
|
+
session,
|
|
3219
|
+
ignoreUndefined: true
|
|
3220
|
+
});
|
|
3215
3221
|
await versionsCollection.insertOne({
|
|
3216
3222
|
id: versionId,
|
|
3217
3223
|
datasetId: args.datasetId,
|
|
@@ -3299,7 +3305,7 @@ var MongoDBDatasetsStorage = class extends _mastra_core_storage.DatasetsStorage
|
|
|
3299
3305
|
isDeleted: true,
|
|
3300
3306
|
input: existing.input,
|
|
3301
3307
|
groundTruth: existing.groundTruth,
|
|
3302
|
-
expectedTrajectory: existing.expectedTrajectory
|
|
3308
|
+
expectedTrajectory: existing.expectedTrajectory,
|
|
3303
3309
|
toolMocks: existing.toolMocks ?? null,
|
|
3304
3310
|
unmockedToolPolicy: existing.unmockedToolPolicy ?? null,
|
|
3305
3311
|
scorerIds: existing.scorerIds ?? null,
|
|
@@ -3308,7 +3314,10 @@ var MongoDBDatasetsStorage = class extends _mastra_core_storage.DatasetsStorage
|
|
|
3308
3314
|
source: existing.source,
|
|
3309
3315
|
createdAt: existing.createdAt,
|
|
3310
3316
|
updatedAt: now
|
|
3311
|
-
}, {
|
|
3317
|
+
}, {
|
|
3318
|
+
session,
|
|
3319
|
+
ignoreUndefined: true
|
|
3320
|
+
});
|
|
3312
3321
|
await versionsCollection.insertOne({
|
|
3313
3322
|
id: versionId,
|
|
3314
3323
|
datasetId,
|
|
@@ -3460,7 +3469,10 @@ var MongoDBDatasetsStorage = class extends _mastra_core_storage.DatasetsStorage
|
|
|
3460
3469
|
...item,
|
|
3461
3470
|
validTo: null,
|
|
3462
3471
|
isDeleted: false
|
|
3463
|
-
}, {
|
|
3472
|
+
}, {
|
|
3473
|
+
session,
|
|
3474
|
+
ignoreUndefined: true
|
|
3475
|
+
});
|
|
3464
3476
|
resolved.set(item.id, item);
|
|
3465
3477
|
}
|
|
3466
3478
|
await versionsCollection.insertOne({
|
|
@@ -3528,7 +3540,7 @@ var MongoDBDatasetsStorage = class extends _mastra_core_storage.DatasetsStorage
|
|
|
3528
3540
|
isDeleted: true,
|
|
3529
3541
|
input: item.input,
|
|
3530
3542
|
groundTruth: item.groundTruth,
|
|
3531
|
-
expectedTrajectory: item.expectedTrajectory
|
|
3543
|
+
expectedTrajectory: item.expectedTrajectory,
|
|
3532
3544
|
toolMocks: item.toolMocks ?? null,
|
|
3533
3545
|
unmockedToolPolicy: item.unmockedToolPolicy ?? null,
|
|
3534
3546
|
scorerIds: item.scorerIds ?? null,
|
|
@@ -3543,7 +3555,10 @@ var MongoDBDatasetsStorage = class extends _mastra_core_storage.DatasetsStorage
|
|
|
3543
3555
|
validTo: null,
|
|
3544
3556
|
isDeleted: false
|
|
3545
3557
|
}, { $set: { validTo: newVersion } }, { session });
|
|
3546
|
-
await itemsCollection.insertMany(tombstones, {
|
|
3558
|
+
await itemsCollection.insertMany(tombstones, {
|
|
3559
|
+
session,
|
|
3560
|
+
ignoreUndefined: true
|
|
3561
|
+
});
|
|
3547
3562
|
await versionsCollection.insertOne({
|
|
3548
3563
|
id: versionId,
|
|
3549
3564
|
datasetId: input.datasetId,
|