@mastra/convex 1.2.0 → 1.2.1-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/CHANGELOG.md +9 -0
- package/dist/{chunk-AJFME2ZF.js → chunk-5T45UI6I.js} +113 -2
- package/dist/chunk-5T45UI6I.js.map +1 -0
- package/dist/{chunk-ORSDZTO4.cjs → chunk-MECAZ6GY.cjs} +113 -2
- package/dist/chunk-MECAZ6GY.cjs.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +6 -6
- package/dist/index.cjs +49 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +44 -10
- package/dist/index.js.map +1 -1
- package/dist/server/index.cjs +6 -6
- package/dist/server/index.js +1 -1
- package/dist/server/storage.d.ts.map +1 -1
- package/dist/server/workflow-snapshot.d.ts +8 -0
- package/dist/server/workflow-snapshot.d.ts.map +1 -0
- package/dist/storage/db/index.d.ts +14 -1
- package/dist/storage/db/index.d.ts.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts +2 -2
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/types.d.ts +14 -0
- package/dist/storage/types.d.ts.map +1 -1
- package/package.json +5 -5
- package/dist/chunk-AJFME2ZF.js.map +0 -1
- package/dist/chunk-ORSDZTO4.cjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { mastraCache, mastraNativeVectorAction, mastraNativeVectorMutation, mastraNativeVectorQuery, mastraStorage } from './chunk-
|
|
1
|
+
export { mastraCache, mastraNativeVectorAction, mastraNativeVectorMutation, mastraNativeVectorQuery, mastraStorage } from './chunk-5T45UI6I.js';
|
|
2
2
|
export { TABLE_BACKGROUND_TASKS, TABLE_CHANNEL_CONFIG, TABLE_CHANNEL_INSTALLATIONS, TABLE_MESSAGES, TABLE_RESOURCES, TABLE_SCHEDULES, TABLE_SCHEDULE_TRIGGERS, TABLE_SCORERS, TABLE_THREADS, TABLE_WORKFLOW_SNAPSHOT, defineMastraNativeVectorTable, mastraBackgroundTasksTable, mastraCacheListItemsTable, mastraCacheTable, mastraChannelConfigTable, mastraChannelInstallationsTable, mastraDocumentsTable, mastraMessagesTable, mastraResourcesTable, mastraScheduleTriggersTable, mastraSchedulesTable, mastraScoresTable, mastraThreadsTable, mastraVectorIndexesTable, mastraVectorsTable, mastraWorkflowSnapshotsTable } from './chunk-MC75WADX.js';
|
|
3
3
|
import { MastraServerCache } from '@mastra/core/cache';
|
|
4
4
|
import { MastraCompositeStore, createVectorErrorId, MemoryStorage, TABLE_THREADS, TABLE_MESSAGES, TABLE_RESOURCES, createStorageErrorId, normalizePerPage, calculatePagination, filterByDateRange, safelyParseJSON, WorkflowsStorage, TABLE_WORKFLOW_SNAPSHOT, ScoresStorage, TABLE_SCORERS, ChannelsStorage, TABLE_CHANNEL_INSTALLATIONS, TABLE_CHANNEL_CONFIG, SchedulesStorage, TABLE_SCHEDULE_TRIGGERS, TABLE_SCHEDULES, BackgroundTasksStorage, TABLE_BACKGROUND_TASKS } from '@mastra/core/storage';
|
|
@@ -374,6 +374,44 @@ var ConvexDB = class extends MastraBase {
|
|
|
374
374
|
ids
|
|
375
375
|
});
|
|
376
376
|
}
|
|
377
|
+
async mergeWorkflowStepResult({
|
|
378
|
+
workflowName,
|
|
379
|
+
runId,
|
|
380
|
+
stepId,
|
|
381
|
+
result,
|
|
382
|
+
requestContext
|
|
383
|
+
}) {
|
|
384
|
+
const context = await this.client.callStorage({
|
|
385
|
+
op: "mergeWorkflowStepResult",
|
|
386
|
+
tableName: TABLE_WORKFLOW_SNAPSHOT,
|
|
387
|
+
workflowName,
|
|
388
|
+
runId,
|
|
389
|
+
stepId,
|
|
390
|
+
result: JSON.stringify(result),
|
|
391
|
+
requestContext: JSON.stringify(requestContext)
|
|
392
|
+
});
|
|
393
|
+
if (!context) {
|
|
394
|
+
throw new Error(`Convex workflow step merge returned no context for runId ${runId}`);
|
|
395
|
+
}
|
|
396
|
+
return JSON.parse(context);
|
|
397
|
+
}
|
|
398
|
+
async mergeWorkflowState({
|
|
399
|
+
workflowName,
|
|
400
|
+
runId,
|
|
401
|
+
opts
|
|
402
|
+
}) {
|
|
403
|
+
const snapshot = await this.client.callStorage({
|
|
404
|
+
op: "mergeWorkflowState",
|
|
405
|
+
tableName: TABLE_WORKFLOW_SNAPSHOT,
|
|
406
|
+
workflowName,
|
|
407
|
+
runId,
|
|
408
|
+
opts: JSON.stringify(opts)
|
|
409
|
+
});
|
|
410
|
+
if (!snapshot) {
|
|
411
|
+
throw new Error(`Convex workflow state merge returned no snapshot for runId ${runId}`);
|
|
412
|
+
}
|
|
413
|
+
return JSON.parse(snapshot);
|
|
414
|
+
}
|
|
377
415
|
async createSchedule(record) {
|
|
378
416
|
if (!record.id) {
|
|
379
417
|
throw new Error(`Schedule is missing an id`);
|
|
@@ -1634,22 +1672,18 @@ var WorkflowsConvex = class extends WorkflowsStorage {
|
|
|
1634
1672
|
this.#db = new ConvexDB(client);
|
|
1635
1673
|
}
|
|
1636
1674
|
supportsConcurrentUpdates() {
|
|
1637
|
-
return
|
|
1675
|
+
return true;
|
|
1638
1676
|
}
|
|
1639
1677
|
async init() {
|
|
1640
1678
|
}
|
|
1641
1679
|
async dangerouslyClearAll() {
|
|
1642
1680
|
await this.#db.clearTable({ tableName: TABLE_WORKFLOW_SNAPSHOT });
|
|
1643
1681
|
}
|
|
1644
|
-
async updateWorkflowResults(
|
|
1645
|
-
|
|
1646
|
-
"updateWorkflowResults is not implemented for Convex storage. Convex does not support atomic read-modify-write operations needed for concurrent workflow updates."
|
|
1647
|
-
);
|
|
1682
|
+
async updateWorkflowResults(args) {
|
|
1683
|
+
return this.#db.mergeWorkflowStepResult(args);
|
|
1648
1684
|
}
|
|
1649
|
-
async updateWorkflowState(
|
|
1650
|
-
|
|
1651
|
-
"updateWorkflowState is not implemented for Convex storage. Convex does not support atomic read-modify-write operations needed for concurrent workflow updates."
|
|
1652
|
-
);
|
|
1685
|
+
async updateWorkflowState(args) {
|
|
1686
|
+
return this.#db.mergeWorkflowState(args);
|
|
1653
1687
|
}
|
|
1654
1688
|
async persistWorkflowSnapshot({
|
|
1655
1689
|
workflowName,
|