@mastra/convex 1.5.4 → 1.5.5

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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as mastraCache, i as mastraStorage, n as mastraNativeVectorMutation, r as mastraNativeVectorQuery, t as mastraNativeVectorAction } from "./server-DsvFmckG.js";
1
+ import { a as mastraCache, i as mastraStorage, n as mastraNativeVectorMutation, r as mastraNativeVectorQuery, t as mastraNativeVectorAction } from "./server-BYI0FabA.js";
2
2
  import { TABLE_BACKGROUND_TASKS, TABLE_CHANNEL_CONFIG, TABLE_CHANNEL_INSTALLATIONS, TABLE_MESSAGES, TABLE_OBSERVATIONAL_MEMORY, TABLE_RESOURCES, TABLE_SCHEDULES, TABLE_SCHEDULE_TRIGGERS, TABLE_SCORERS, TABLE_THREADS, TABLE_WORKFLOW_SNAPSHOT, defineMastraNativeVectorTable, mastraBackgroundTasksTable, mastraCacheListItemsTable, mastraCacheTable, mastraChannelConfigTable, mastraChannelInstallationsTable, mastraDocumentsTable, mastraMessagesTable, mastraObservationalMemoryTable, mastraResourcesTable, mastraScheduleTriggersTable, mastraSchedulesTable, mastraScoresTable, mastraThreadsTable, mastraVectorIndexesTable, mastraVectorsTable, mastraWorkflowSnapshotsTable } from "./schema.js";
3
3
  import { MastraServerCache } from "@mastra/core/cache";
4
4
  import { BackgroundTasksStorage, ChannelsStorage, MastraCompositeStore, MemoryStorage, SchedulesStorage, ScoresStorage, TABLE_BACKGROUND_TASKS as TABLE_BACKGROUND_TASKS$1, TABLE_CHANNEL_CONFIG as TABLE_CHANNEL_CONFIG$1, TABLE_CHANNEL_INSTALLATIONS as TABLE_CHANNEL_INSTALLATIONS$1, TABLE_MESSAGES as TABLE_MESSAGES$1, TABLE_RESOURCES as TABLE_RESOURCES$1, TABLE_SCHEDULES as TABLE_SCHEDULES$1, TABLE_SCHEDULE_TRIGGERS as TABLE_SCHEDULE_TRIGGERS$1, TABLE_SCORERS as TABLE_SCORERS$1, TABLE_THREADS as TABLE_THREADS$1, TABLE_WORKFLOW_SNAPSHOT as TABLE_WORKFLOW_SNAPSHOT$1, WorkflowsStorage, calculatePagination, createStorageErrorId, createVectorErrorId, filterByDateRange, normalizePerPage, normalizeScheduleTarget, safelyParseJSON, storageMessageMatchesMetadataFilter, validateStorageMetadataFilter } from "@mastra/core/storage";
@@ -314,12 +314,13 @@ var ConvexDB = class extends MastraBase {
314
314
  records: records.map((record) => this.normalizeRecord(tableName, record))
315
315
  });
316
316
  }
317
- async patch({ tableName, id, record }) {
317
+ async patch({ tableName, id, record, expected }) {
318
318
  return this.client.callStorage({
319
319
  op: "patch",
320
320
  tableName,
321
321
  id,
322
- record: this.normalizePatch(record)
322
+ record: this.normalizePatch(record),
323
+ expected
323
324
  });
324
325
  }
325
326
  async updateThread({ id, title, metadata, updatedAt }) {
@@ -637,13 +638,14 @@ var BackgroundTasksConvex = class extends BackgroundTasksStorage {
637
638
  record: toStored(task)
638
639
  });
639
640
  }
640
- async updateTask(taskId, update) {
641
+ async updateTask(taskId, update, options) {
641
642
  const patch = toStoredPatch(update);
642
- if (Object.keys(patch).length === 0) return;
643
- await this.#db.patch({
643
+ if (Object.keys(patch).length === 0) return false;
644
+ return this.#db.patch({
644
645
  tableName: TABLE_BACKGROUND_TASKS$1,
645
646
  id: taskId,
646
- record: patch
647
+ record: patch,
648
+ expected: options?.expectedStatus ? { status: options.expectedStatus } : void 0
647
649
  });
648
650
  }
649
651
  async getTask(taskId) {