@mastra/mongodb 1.8.0-alpha.0 → 1.8.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/CHANGELOG.md +36 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +56 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +29 -7
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/schedules/index.d.ts.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# @mastra/mongodb
|
|
2
2
|
|
|
3
|
+
## 1.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Extend the schedules storage schema to support owned schedules and richer trigger audit. This is a breaking schema change to `mastra_schedules` and `mastra_schedule_triggers`; scheduled workflows are still in alpha so no compat shim is provided. ([#16166](https://github.com/mastra-ai/mastra/pull/16166))
|
|
8
|
+
- `Schedule` gains optional `ownerType` / `ownerId` so a schedule row can be attributed to an owning subsystem (e.g. an agent that owns a heartbeat schedule). Workflow schedules leave both fields unset.
|
|
9
|
+
- `ScheduleTrigger.status` is renamed to `outcome` and the type is widened to `ScheduleTriggerOutcome` so future outcome values can be added without another rename.
|
|
10
|
+
- `ScheduleTrigger` gains a stable `id` primary key and new `triggerKind`, `parentTriggerId`, and `metadata` fields. `triggerKind` distinguishes `schedule-fire` rows from later `queue-drain` rows (used by upcoming heartbeat work); `parentTriggerId` links related rows; `metadata` carries outcome-specific context.
|
|
11
|
+
- The libsql, pg, and mongodb adapters all add the new columns/indexes. Their `@mastra/core` peer dependency is tightened to `>=1.32.0-0 <2.0.0-0` so installing a new storage adapter against an older core (or vice-versa) surfaces a peer-dependency warning at install time instead of silently writing/reading the wrong field.
|
|
12
|
+
- Scheduler producer, server schemas/handler, and client SDK types are updated to use the new fields. The `triggers` response on `GET /api/schedules/:id/triggers` now returns `outcome` instead of `status`.
|
|
13
|
+
- The bundled Studio (Mastra CLI) is updated to read `outcome` so the schedule detail page keeps polling and rendering publish-failure rows correctly.
|
|
14
|
+
|
|
15
|
+
- Added the `schedules` storage domain so MongoDB-backed Mastra apps can use scheduled workflows. Creates `mastra_schedules` and `mastra_schedule_triggers` collections on init, with default indexes on `(status, next_fire_at)` for due-schedule polling and `(schedule_id, actual_fire_at)` for trigger-history queries. ([#15830](https://github.com/mastra-ai/mastra/pull/15830))
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [[`6dcd65f`](https://github.com/mastra-ai/mastra/commit/6dcd65f2a34069e6dc43ba35f1d11119b9b40bef), [`86c0298`](https://github.com/mastra-ai/mastra/commit/86c0298e647306423c842f9d5ac827bd616bd13d), [`c05c9a1`](https://github.com/mastra-ai/mastra/commit/c05c9a13230988cef6d438a62f37760f31927bc7), [`ca28c23`](https://github.com/mastra-ai/mastra/commit/ca28c232a2f18801a6cf20fe053479237b4d4fb0), [`e24aacb`](https://github.com/mastra-ai/mastra/commit/e24aacba07bd66f5d95b636dc24016fca26b52cf), [`7679a63`](https://github.com/mastra-ai/mastra/commit/7679a634eae8e8ca459fd87538fdf72b4389b07f), [`7fce309`](https://github.com/mastra-ai/mastra/commit/7fce30912b14170bfc41f0ac736cca0f39fe0cd4), [`1d64a76`](https://github.com/mastra-ai/mastra/commit/1d64a765861a0772ea187bab76e5ed37bf82d042), [`1c2dda8`](https://github.com/mastra-ai/mastra/commit/1c2dda805fbfccc0abf55d4cb20cc34402dc3f0c), [`c721164`](https://github.com/mastra-ai/mastra/commit/c7211643f7ac861f83b19a3757cc921487fc9d75), [`1b55954`](https://github.com/mastra-ai/mastra/commit/1b559541c1e08a10e49d01ffc51a634dfc37a286), [`7997c2e`](https://github.com/mastra-ai/mastra/commit/7997c2e55ddd121562a4098cd8d2b89c68433bf1), [`5adc55e`](https://github.com/mastra-ai/mastra/commit/5adc55e63407be8ee977914957d68bcc2a075ceb), [`7679a63`](https://github.com/mastra-ai/mastra/commit/7679a634eae8e8ca459fd87538fdf72b4389b07f), [`a0d9b6d`](https://github.com/mastra-ai/mastra/commit/a0d9b6d6b810aeaa9e177a0dcc99a4402e609634), [`e97ccb9`](https://github.com/mastra-ai/mastra/commit/e97ccb900f8b7a390ce82c9f8eb8d6eb2c5e3777), [`c5daf48`](https://github.com/mastra-ai/mastra/commit/c5daf48556e98c46ae06caf00f92c249912007e9), [`70017d7`](https://github.com/mastra-ai/mastra/commit/70017d72ab741b5d7040e2a15c251a317782e39e), [`cd96779`](https://github.com/mastra-ai/mastra/commit/cd9677937f113b2856dc8b9f3d4bdabcee58bb2e), [`b0c7022`](https://github.com/mastra-ai/mastra/commit/b0c70224f80dad7c0cdbfb22cbff22e0f75c064f), [`e4942bc`](https://github.com/mastra-ai/mastra/commit/e4942bc7fdc903572f7d84f26d5e15f9d39c763d)]:
|
|
20
|
+
- @mastra/core@1.32.0
|
|
21
|
+
|
|
22
|
+
## 1.8.0-alpha.1
|
|
23
|
+
|
|
24
|
+
### Minor Changes
|
|
25
|
+
|
|
26
|
+
- Extend the schedules storage schema to support owned schedules and richer trigger audit. This is a breaking schema change to `mastra_schedules` and `mastra_schedule_triggers`; scheduled workflows are still in alpha so no compat shim is provided. ([#16166](https://github.com/mastra-ai/mastra/pull/16166))
|
|
27
|
+
- `Schedule` gains optional `ownerType` / `ownerId` so a schedule row can be attributed to an owning subsystem (e.g. an agent that owns a heartbeat schedule). Workflow schedules leave both fields unset.
|
|
28
|
+
- `ScheduleTrigger.status` is renamed to `outcome` and the type is widened to `ScheduleTriggerOutcome` so future outcome values can be added without another rename.
|
|
29
|
+
- `ScheduleTrigger` gains a stable `id` primary key and new `triggerKind`, `parentTriggerId`, and `metadata` fields. `triggerKind` distinguishes `schedule-fire` rows from later `queue-drain` rows (used by upcoming heartbeat work); `parentTriggerId` links related rows; `metadata` carries outcome-specific context.
|
|
30
|
+
- The libsql, pg, and mongodb adapters all add the new columns/indexes. Their `@mastra/core` peer dependency is tightened to `>=1.32.0-0 <2.0.0-0` so installing a new storage adapter against an older core (or vice-versa) surfaces a peer-dependency warning at install time instead of silently writing/reading the wrong field.
|
|
31
|
+
- Scheduler producer, server schemas/handler, and client SDK types are updated to use the new fields. The `triggers` response on `GET /api/schedules/:id/triggers` now returns `outcome` instead of `status`.
|
|
32
|
+
- The bundled Studio (Mastra CLI) is updated to read `outcome` so the schedule detail page keeps polling and rendering publish-failure rows correctly.
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- Updated dependencies [[`ca28c23`](https://github.com/mastra-ai/mastra/commit/ca28c232a2f18801a6cf20fe053479237b4d4fb0)]:
|
|
37
|
+
- @mastra/core@1.32.0-alpha.3
|
|
38
|
+
|
|
3
39
|
## 1.8.0-alpha.0
|
|
4
40
|
|
|
5
41
|
### Minor Changes
|
package/dist/docs/SKILL.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -6,7 +6,7 @@ var storage = require('@mastra/core/storage');
|
|
|
6
6
|
var vector = require('@mastra/core/vector');
|
|
7
7
|
var mongodb = require('mongodb');
|
|
8
8
|
var filter = require('@mastra/core/vector/filter');
|
|
9
|
-
var crypto = require('crypto');
|
|
9
|
+
var crypto$1 = require('crypto');
|
|
10
10
|
var agent = require('@mastra/core/agent');
|
|
11
11
|
var evals = require('@mastra/core/evals');
|
|
12
12
|
|
|
@@ -14,7 +14,7 @@ var evals = require('@mastra/core/evals');
|
|
|
14
14
|
|
|
15
15
|
// package.json
|
|
16
16
|
var package_default = {
|
|
17
|
-
version: "1.8.0
|
|
17
|
+
version: "1.8.0"};
|
|
18
18
|
var MongoDBFilterTranslator = class extends filter.BaseFilterTranslator {
|
|
19
19
|
getSupportedOperators() {
|
|
20
20
|
return {
|
|
@@ -1076,7 +1076,7 @@ var MongoDBAgentsStorage = class _MongoDBAgentsStorage extends storage.AgentsSto
|
|
|
1076
1076
|
};
|
|
1077
1077
|
await collection.insertOne(this.serializeAgent(newAgent));
|
|
1078
1078
|
const { id: _id, authorId: _authorId, metadata: _metadata, ...snapshotConfig } = agent;
|
|
1079
|
-
const versionId = crypto.randomUUID();
|
|
1079
|
+
const versionId = crypto$1.randomUUID();
|
|
1080
1080
|
await this.createVersion({
|
|
1081
1081
|
id: versionId,
|
|
1082
1082
|
agentId: agent.id,
|
|
@@ -2021,7 +2021,7 @@ var MongoDBDatasetsStorage = class extends storage.DatasetsStorage {
|
|
|
2021
2021
|
// --- Dataset CRUD ---
|
|
2022
2022
|
async createDataset(input) {
|
|
2023
2023
|
try {
|
|
2024
|
-
const id = crypto.randomUUID();
|
|
2024
|
+
const id = crypto$1.randomUUID();
|
|
2025
2025
|
const now = /* @__PURE__ */ new Date();
|
|
2026
2026
|
const collection = await this.getCollection(storage.TABLE_DATASETS);
|
|
2027
2027
|
const record = {
|
|
@@ -2180,8 +2180,8 @@ var MongoDBDatasetsStorage = class extends storage.DatasetsStorage {
|
|
|
2180
2180
|
// --- Item mutations (SCD-2) ---
|
|
2181
2181
|
async _doAddItem(args) {
|
|
2182
2182
|
try {
|
|
2183
|
-
const id = crypto.randomUUID();
|
|
2184
|
-
const versionId = crypto.randomUUID();
|
|
2183
|
+
const id = crypto$1.randomUUID();
|
|
2184
|
+
const versionId = crypto$1.randomUUID();
|
|
2185
2185
|
const now = /* @__PURE__ */ new Date();
|
|
2186
2186
|
const datasetsCollection = await this.getCollection(storage.TABLE_DATASETS);
|
|
2187
2187
|
const itemsCollection = await this.getCollection(storage.TABLE_DATASET_ITEMS);
|
|
@@ -2270,7 +2270,7 @@ var MongoDBDatasetsStorage = class extends storage.DatasetsStorage {
|
|
|
2270
2270
|
return existing;
|
|
2271
2271
|
}
|
|
2272
2272
|
const now = /* @__PURE__ */ new Date();
|
|
2273
|
-
const versionId = crypto.randomUUID();
|
|
2273
|
+
const versionId = crypto$1.randomUUID();
|
|
2274
2274
|
const mergedInput = args.input !== void 0 ? args.input : existing.input;
|
|
2275
2275
|
const mergedGroundTruth = args.groundTruth !== void 0 ? args.groundTruth : existing.groundTruth;
|
|
2276
2276
|
const mergedExpectedTrajectory = args.expectedTrajectory !== void 0 ? args.expectedTrajectory : existing.expectedTrajectory;
|
|
@@ -2355,7 +2355,7 @@ var MongoDBDatasetsStorage = class extends storage.DatasetsStorage {
|
|
|
2355
2355
|
});
|
|
2356
2356
|
}
|
|
2357
2357
|
const now = /* @__PURE__ */ new Date();
|
|
2358
|
-
const versionId = crypto.randomUUID();
|
|
2358
|
+
const versionId = crypto$1.randomUUID();
|
|
2359
2359
|
const datasetsCollection = await this.getCollection(storage.TABLE_DATASETS);
|
|
2360
2360
|
const itemsCollection = await this.getCollection(storage.TABLE_DATASET_ITEMS);
|
|
2361
2361
|
const versionsCollection = await this.getCollection(storage.TABLE_DATASET_VERSIONS);
|
|
@@ -2422,9 +2422,9 @@ var MongoDBDatasetsStorage = class extends storage.DatasetsStorage {
|
|
|
2422
2422
|
return [];
|
|
2423
2423
|
}
|
|
2424
2424
|
const now = /* @__PURE__ */ new Date();
|
|
2425
|
-
const versionId = crypto.randomUUID();
|
|
2425
|
+
const versionId = crypto$1.randomUUID();
|
|
2426
2426
|
const itemsWithIds = input.items.map((itemInput) => ({
|
|
2427
|
-
generatedId: crypto.randomUUID(),
|
|
2427
|
+
generatedId: crypto$1.randomUUID(),
|
|
2428
2428
|
itemInput
|
|
2429
2429
|
}));
|
|
2430
2430
|
const datasetsCollection = await this.getCollection(storage.TABLE_DATASETS);
|
|
@@ -2514,7 +2514,7 @@ var MongoDBDatasetsStorage = class extends storage.DatasetsStorage {
|
|
|
2514
2514
|
const currentItems = currentRows.map((row) => this.transformItemRow(row));
|
|
2515
2515
|
if (currentItems.length === 0) return;
|
|
2516
2516
|
const now = /* @__PURE__ */ new Date();
|
|
2517
|
-
const versionId = crypto.randomUUID();
|
|
2517
|
+
const versionId = crypto$1.randomUUID();
|
|
2518
2518
|
const datasetsCollection = await this.getCollection(storage.TABLE_DATASETS);
|
|
2519
2519
|
const versionsCollection = await this.getCollection(storage.TABLE_DATASET_VERSIONS);
|
|
2520
2520
|
const result = await datasetsCollection.findOneAndUpdate(
|
|
@@ -2701,7 +2701,7 @@ var MongoDBDatasetsStorage = class extends storage.DatasetsStorage {
|
|
|
2701
2701
|
// --- Dataset versions ---
|
|
2702
2702
|
async createDatasetVersion(datasetId, version) {
|
|
2703
2703
|
try {
|
|
2704
|
-
const id = crypto.randomUUID();
|
|
2704
|
+
const id = crypto$1.randomUUID();
|
|
2705
2705
|
const now = /* @__PURE__ */ new Date();
|
|
2706
2706
|
const collection = await this.getCollection(storage.TABLE_DATASET_VERSIONS);
|
|
2707
2707
|
await collection.insertOne({ id, datasetId, version, createdAt: now });
|
|
@@ -2893,7 +2893,7 @@ var MongoDBExperimentsStorage = class _MongoDBExperimentsStorage extends storage
|
|
|
2893
2893
|
// Experiment CRUD
|
|
2894
2894
|
// -------------------------------------------------------------------------
|
|
2895
2895
|
async createExperiment(input) {
|
|
2896
|
-
const id = input.id ?? crypto.randomUUID();
|
|
2896
|
+
const id = input.id ?? crypto$1.randomUUID();
|
|
2897
2897
|
const now = /* @__PURE__ */ new Date();
|
|
2898
2898
|
const doc = {
|
|
2899
2899
|
id,
|
|
@@ -3079,7 +3079,7 @@ var MongoDBExperimentsStorage = class _MongoDBExperimentsStorage extends storage
|
|
|
3079
3079
|
// Experiment Results
|
|
3080
3080
|
// -------------------------------------------------------------------------
|
|
3081
3081
|
async addExperimentResult(input) {
|
|
3082
|
-
const id = input.id ?? crypto.randomUUID();
|
|
3082
|
+
const id = input.id ?? crypto$1.randomUUID();
|
|
3083
3083
|
const now = /* @__PURE__ */ new Date();
|
|
3084
3084
|
const doc = {
|
|
3085
3085
|
id,
|
|
@@ -3423,7 +3423,7 @@ var MongoDBMCPClientsStorage = class _MongoDBMCPClientsStorage extends storage.M
|
|
|
3423
3423
|
snapshotConfig[field] = mcpClient[field];
|
|
3424
3424
|
}
|
|
3425
3425
|
}
|
|
3426
|
-
const versionId = crypto.randomUUID();
|
|
3426
|
+
const versionId = crypto$1.randomUUID();
|
|
3427
3427
|
try {
|
|
3428
3428
|
await this.createVersion({
|
|
3429
3429
|
id: versionId,
|
|
@@ -3975,7 +3975,7 @@ var MongoDBMCPServersStorage = class _MongoDBMCPServersStorage extends storage.M
|
|
|
3975
3975
|
snapshotConfig[field] = mcpServer[field];
|
|
3976
3976
|
}
|
|
3977
3977
|
}
|
|
3978
|
-
const versionId = crypto.randomUUID();
|
|
3978
|
+
const versionId = crypto$1.randomUUID();
|
|
3979
3979
|
try {
|
|
3980
3980
|
await this.createVersion({
|
|
3981
3981
|
id: versionId,
|
|
@@ -5283,7 +5283,7 @@ var MemoryStorageMongoDB = class _MemoryStorageMongoDB extends storage.MemorySto
|
|
|
5283
5283
|
details: { sourceThreadId }
|
|
5284
5284
|
});
|
|
5285
5285
|
}
|
|
5286
|
-
const newThreadId = providedThreadId || crypto.randomUUID();
|
|
5286
|
+
const newThreadId = providedThreadId || crypto$1.randomUUID();
|
|
5287
5287
|
const existingThread = await this.getThreadById({ threadId: newThreadId });
|
|
5288
5288
|
if (existingThread) {
|
|
5289
5289
|
throw new error.MastraError({
|
|
@@ -5342,7 +5342,7 @@ var MemoryStorageMongoDB = class _MemoryStorageMongoDB extends storage.MemorySto
|
|
|
5342
5342
|
if (sourceMessages.length > 0) {
|
|
5343
5343
|
const messageDocs = [];
|
|
5344
5344
|
for (const sourceMsg of sourceMessages) {
|
|
5345
|
-
const newMessageId = crypto.randomUUID();
|
|
5345
|
+
const newMessageId = crypto$1.randomUUID();
|
|
5346
5346
|
messageIdMap[sourceMsg.id] = newMessageId;
|
|
5347
5347
|
let parsedContent = sourceMsg.content;
|
|
5348
5348
|
if (typeof parsedContent === "string") {
|
|
@@ -5500,7 +5500,7 @@ var MemoryStorageMongoDB = class _MemoryStorageMongoDB extends storage.MemorySto
|
|
|
5500
5500
|
}
|
|
5501
5501
|
async initializeObservationalMemory(input) {
|
|
5502
5502
|
try {
|
|
5503
|
-
const id = crypto.randomUUID();
|
|
5503
|
+
const id = crypto$1.randomUUID();
|
|
5504
5504
|
const now = /* @__PURE__ */ new Date();
|
|
5505
5505
|
const lookupKey = this.getOMKey(input.threadId, input.resourceId);
|
|
5506
5506
|
const record = {
|
|
@@ -5661,7 +5661,7 @@ var MemoryStorageMongoDB = class _MemoryStorageMongoDB extends storage.MemorySto
|
|
|
5661
5661
|
}
|
|
5662
5662
|
async createReflectionGeneration(input) {
|
|
5663
5663
|
try {
|
|
5664
|
-
const id = crypto.randomUUID();
|
|
5664
|
+
const id = crypto$1.randomUUID();
|
|
5665
5665
|
const now = /* @__PURE__ */ new Date();
|
|
5666
5666
|
const lookupKey = this.getOMKey(input.currentRecord.threadId, input.currentRecord.resourceId);
|
|
5667
5667
|
const record = {
|
|
@@ -5948,7 +5948,7 @@ var MemoryStorageMongoDB = class _MemoryStorageMongoDB extends storage.MemorySto
|
|
|
5948
5948
|
try {
|
|
5949
5949
|
const collection = await this.getCollection(OM_TABLE);
|
|
5950
5950
|
const newChunk = {
|
|
5951
|
-
id: `ombuf-${crypto.randomUUID()}`,
|
|
5951
|
+
id: `ombuf-${crypto$1.randomUUID()}`,
|
|
5952
5952
|
cycleId: input.chunk.cycleId,
|
|
5953
5953
|
observations: input.chunk.observations,
|
|
5954
5954
|
tokenCount: input.chunk.tokenCount,
|
|
@@ -7181,7 +7181,7 @@ var MongoDBPromptBlocksStorage = class _MongoDBPromptBlocksStorage extends stora
|
|
|
7181
7181
|
snapshotConfig[field] = promptBlock[field];
|
|
7182
7182
|
}
|
|
7183
7183
|
}
|
|
7184
|
-
const versionId = crypto.randomUUID();
|
|
7184
|
+
const versionId = crypto$1.randomUUID();
|
|
7185
7185
|
await this.createVersion({
|
|
7186
7186
|
id: versionId,
|
|
7187
7187
|
blockId: promptBlock.id,
|
|
@@ -7607,7 +7607,9 @@ function scheduleToDoc(schedule) {
|
|
|
7607
7607
|
last_run_id: schedule.lastRunId ?? null,
|
|
7608
7608
|
created_at: schedule.createdAt,
|
|
7609
7609
|
updated_at: schedule.updatedAt,
|
|
7610
|
-
metadata: schedule.metadata ?? null
|
|
7610
|
+
metadata: schedule.metadata ?? null,
|
|
7611
|
+
owner_type: schedule.ownerType ?? null,
|
|
7612
|
+
owner_id: schedule.ownerId ?? null
|
|
7611
7613
|
};
|
|
7612
7614
|
}
|
|
7613
7615
|
function docToSchedule(doc) {
|
|
@@ -7628,27 +7630,37 @@ function docToSchedule(doc) {
|
|
|
7628
7630
|
if (doc.last_fire_at != null) schedule.lastFireAt = Number(doc.last_fire_at);
|
|
7629
7631
|
if (doc.last_run_id != null) schedule.lastRunId = String(doc.last_run_id);
|
|
7630
7632
|
if (doc.metadata != null) schedule.metadata = doc.metadata;
|
|
7633
|
+
if (doc.owner_type != null) schedule.ownerType = String(doc.owner_type);
|
|
7634
|
+
if (doc.owner_id != null) schedule.ownerId = String(doc.owner_id);
|
|
7631
7635
|
return schedule;
|
|
7632
7636
|
}
|
|
7633
7637
|
function triggerToDoc(trigger) {
|
|
7634
7638
|
return {
|
|
7639
|
+
id: trigger.id ?? crypto.randomUUID(),
|
|
7635
7640
|
schedule_id: trigger.scheduleId,
|
|
7636
7641
|
run_id: trigger.runId,
|
|
7637
7642
|
scheduled_fire_at: trigger.scheduledFireAt,
|
|
7638
7643
|
actual_fire_at: trigger.actualFireAt,
|
|
7639
|
-
|
|
7640
|
-
error: trigger.error ?? null
|
|
7644
|
+
outcome: trigger.outcome,
|
|
7645
|
+
error: trigger.error ?? null,
|
|
7646
|
+
trigger_kind: trigger.triggerKind ?? "schedule-fire",
|
|
7647
|
+
parent_trigger_id: trigger.parentTriggerId ?? null,
|
|
7648
|
+
metadata: trigger.metadata ?? null
|
|
7641
7649
|
};
|
|
7642
7650
|
}
|
|
7643
7651
|
function docToTrigger(doc) {
|
|
7644
7652
|
const trigger = {
|
|
7653
|
+
id: doc.id != null ? String(doc.id) : void 0,
|
|
7645
7654
|
scheduleId: String(doc.schedule_id),
|
|
7646
|
-
runId: String(doc.run_id),
|
|
7655
|
+
runId: doc.run_id != null ? String(doc.run_id) : null,
|
|
7647
7656
|
scheduledFireAt: Number(doc.scheduled_fire_at),
|
|
7648
7657
|
actualFireAt: Number(doc.actual_fire_at),
|
|
7649
|
-
|
|
7658
|
+
outcome: String(doc.outcome),
|
|
7659
|
+
triggerKind: doc.trigger_kind != null ? String(doc.trigger_kind) : "schedule-fire"
|
|
7650
7660
|
};
|
|
7651
7661
|
if (doc.error != null) trigger.error = String(doc.error);
|
|
7662
|
+
if (doc.parent_trigger_id != null) trigger.parentTriggerId = String(doc.parent_trigger_id);
|
|
7663
|
+
if (doc.metadata != null) trigger.metadata = doc.metadata;
|
|
7652
7664
|
return trigger;
|
|
7653
7665
|
}
|
|
7654
7666
|
var SchedulesMongoDB = class _SchedulesMongoDB extends storage.SchedulesStorage {
|
|
@@ -7675,8 +7687,10 @@ var SchedulesMongoDB = class _SchedulesMongoDB extends storage.SchedulesStorage
|
|
|
7675
7687
|
{ collection: storage.TABLE_SCHEDULES, keys: { id: 1 }, options: { unique: true } },
|
|
7676
7688
|
{ collection: storage.TABLE_SCHEDULES, keys: { status: 1, next_fire_at: 1 } },
|
|
7677
7689
|
{ collection: storage.TABLE_SCHEDULES, keys: { "target.workflowId": 1 } },
|
|
7690
|
+
{ collection: storage.TABLE_SCHEDULES, keys: { owner_type: 1, owner_id: 1 } },
|
|
7691
|
+
{ collection: storage.TABLE_SCHEDULE_TRIGGERS, keys: { id: 1 }, options: { unique: true } },
|
|
7678
7692
|
{ collection: storage.TABLE_SCHEDULE_TRIGGERS, keys: { schedule_id: 1, actual_fire_at: -1 } },
|
|
7679
|
-
{ collection: storage.TABLE_SCHEDULE_TRIGGERS, keys: {
|
|
7693
|
+
{ collection: storage.TABLE_SCHEDULE_TRIGGERS, keys: { parent_trigger_id: 1 } }
|
|
7680
7694
|
];
|
|
7681
7695
|
}
|
|
7682
7696
|
async createDefaultIndexes() {
|
|
@@ -7729,6 +7743,12 @@ var SchedulesMongoDB = class _SchedulesMongoDB extends storage.SchedulesStorage
|
|
|
7729
7743
|
const query = {};
|
|
7730
7744
|
if (filter?.status) query.status = filter.status;
|
|
7731
7745
|
if (filter?.workflowId) query["target.workflowId"] = filter.workflowId;
|
|
7746
|
+
if (filter?.ownerType !== void 0) {
|
|
7747
|
+
query.owner_type = filter.ownerType === null ? null : filter.ownerType;
|
|
7748
|
+
}
|
|
7749
|
+
if (filter?.ownerId !== void 0) {
|
|
7750
|
+
query.owner_id = filter.ownerId === null ? null : filter.ownerId;
|
|
7751
|
+
}
|
|
7732
7752
|
const collection = await this.getSchedulesCollection();
|
|
7733
7753
|
const docs = await collection.find(query).sort({ created_at: 1 }).toArray();
|
|
7734
7754
|
return docs.map(docToSchedule);
|
|
@@ -7747,6 +7767,8 @@ var SchedulesMongoDB = class _SchedulesMongoDB extends storage.SchedulesStorage
|
|
|
7747
7767
|
if ("nextFireAt" in patch && patch.nextFireAt !== void 0) $set.next_fire_at = patch.nextFireAt;
|
|
7748
7768
|
if ("target" in patch && patch.target !== void 0) $set.target = patch.target;
|
|
7749
7769
|
if ("metadata" in patch) $set.metadata = patch.metadata ?? null;
|
|
7770
|
+
if ("ownerType" in patch) $set.owner_type = patch.ownerType ?? null;
|
|
7771
|
+
if ("ownerId" in patch) $set.owner_id = patch.ownerId ?? null;
|
|
7750
7772
|
$set.updated_at = Date.now();
|
|
7751
7773
|
const collection = await this.getSchedulesCollection();
|
|
7752
7774
|
const result = await collection.findOneAndUpdate({ id }, { $set }, { returnDocument: "after" });
|
|
@@ -7926,7 +7948,7 @@ var MongoDBScorerDefinitionsStorage = class _MongoDBScorerDefinitionsStorage ext
|
|
|
7926
7948
|
snapshotConfig[field] = scorerDefinition[field];
|
|
7927
7949
|
}
|
|
7928
7950
|
}
|
|
7929
|
-
const versionId = crypto.randomUUID();
|
|
7951
|
+
const versionId = crypto$1.randomUUID();
|
|
7930
7952
|
await this.createVersion({
|
|
7931
7953
|
id: versionId,
|
|
7932
7954
|
scorerDefinitionId: scorerDefinition.id,
|
|
@@ -8457,7 +8479,7 @@ var ScoresStorageMongoDB = class _ScoresStorageMongoDB extends storage.ScoresSto
|
|
|
8457
8479
|
}
|
|
8458
8480
|
try {
|
|
8459
8481
|
const now = /* @__PURE__ */ new Date();
|
|
8460
|
-
const scoreId = crypto.randomUUID();
|
|
8482
|
+
const scoreId = crypto$1.randomUUID();
|
|
8461
8483
|
const scorer = typeof validatedScore.scorer === "string" ? storage.safelyParseJSON(validatedScore.scorer) : validatedScore.scorer;
|
|
8462
8484
|
const preprocessStepResult = typeof validatedScore.preprocessStepResult === "string" ? storage.safelyParseJSON(validatedScore.preprocessStepResult) : validatedScore.preprocessStepResult;
|
|
8463
8485
|
const analyzeStepResult = typeof validatedScore.analyzeStepResult === "string" ? storage.safelyParseJSON(validatedScore.analyzeStepResult) : validatedScore.analyzeStepResult;
|
|
@@ -8842,7 +8864,7 @@ var MongoDBSkillsStorage = class _MongoDBSkillsStorage extends storage.SkillsSto
|
|
|
8842
8864
|
snapshotConfig[field] = skill[field];
|
|
8843
8865
|
}
|
|
8844
8866
|
}
|
|
8845
|
-
const versionId = crypto.randomUUID();
|
|
8867
|
+
const versionId = crypto$1.randomUUID();
|
|
8846
8868
|
try {
|
|
8847
8869
|
await this.createVersion({
|
|
8848
8870
|
id: versionId,
|
|
@@ -8913,7 +8935,7 @@ var MongoDBSkillsStorage = class _MongoDBSkillsStorage extends storage.SkillsSto
|
|
|
8913
8935
|
}
|
|
8914
8936
|
const existingSnapshot = this.extractSnapshotFields(latestVersion);
|
|
8915
8937
|
await this.createVersion({
|
|
8916
|
-
id: crypto.randomUUID(),
|
|
8938
|
+
id: crypto$1.randomUUID(),
|
|
8917
8939
|
skillId: id,
|
|
8918
8940
|
versionNumber: latestVersion.versionNumber + 1,
|
|
8919
8941
|
...existingSnapshot,
|
|
@@ -9823,7 +9845,7 @@ var MongoDBWorkspacesStorage = class _MongoDBWorkspacesStorage extends storage.W
|
|
|
9823
9845
|
snapshotConfig[field] = workspace[field];
|
|
9824
9846
|
}
|
|
9825
9847
|
}
|
|
9826
|
-
const versionId = crypto.randomUUID();
|
|
9848
|
+
const versionId = crypto$1.randomUUID();
|
|
9827
9849
|
try {
|
|
9828
9850
|
await this.createVersion({
|
|
9829
9851
|
id: versionId,
|
|
@@ -9895,7 +9917,7 @@ var MongoDBWorkspacesStorage = class _MongoDBWorkspacesStorage extends storage.W
|
|
|
9895
9917
|
}
|
|
9896
9918
|
const existingSnapshot = this.extractSnapshotFields(latestVersion);
|
|
9897
9919
|
await this.createVersion({
|
|
9898
|
-
id: crypto.randomUUID(),
|
|
9920
|
+
id: crypto$1.randomUUID(),
|
|
9899
9921
|
workspaceId: id,
|
|
9900
9922
|
versionNumber: latestVersion.versionNumber + 1,
|
|
9901
9923
|
...existingSnapshot,
|