@mastra/convex 0.0.0-new-button-export-20251219130424 → 0.0.0-remove-ai-peer-dep-from-evals-20260105220639

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,6 +1,6 @@
1
1
  export { mastraStorage } from './chunk-KSAPIIEJ.js';
2
- export { TABLE_MESSAGES, TABLE_RESOURCES, TABLE_SCORERS, TABLE_THREADS, TABLE_WORKFLOW_SNAPSHOT, mastraDocumentsTable, mastraMessagesTable, mastraResourcesTable, mastraScoresTable, mastraThreadsTable, mastraVectorIndexesTable, mastraVectorsTable, mastraWorkflowSnapshotsTable } from './chunk-PKUUSREO.js';
3
- import { MastraStorage, MemoryStorage, TABLE_THREADS, TABLE_MESSAGES, TABLE_RESOURCES, createStorageErrorId, normalizePerPage, calculatePagination, safelyParseJSON, WorkflowsStorage, TABLE_WORKFLOW_SNAPSHOT, ScoresStorage, TABLE_SCORERS } from '@mastra/core/storage';
2
+ export { TABLE_MESSAGES, TABLE_RESOURCES, TABLE_SCORERS, TABLE_THREADS, TABLE_WORKFLOW_SNAPSHOT, mastraDocumentsTable, mastraMessagesTable, mastraResourcesTable, mastraScoresTable, mastraThreadsTable, mastraVectorIndexesTable, mastraVectorsTable, mastraWorkflowSnapshotsTable } from './chunk-HXB4DWFE.js';
3
+ import { MastraStorage, MemoryStorage, TABLE_THREADS, TABLE_MESSAGES, TABLE_RESOURCES, createStorageErrorId, normalizePerPage, calculatePagination, filterByDateRange, safelyParseJSON, WorkflowsStorage, TABLE_WORKFLOW_SNAPSHOT, ScoresStorage, TABLE_SCORERS } from '@mastra/core/storage';
4
4
  import { MessageList } from '@mastra/core/agent';
5
5
  import { MastraError, ErrorCategory, ErrorDomain } from '@mastra/core/error';
6
6
  import crypto from 'crypto';
@@ -289,15 +289,7 @@ var MemoryConvex = class extends MemoryStorage {
289
289
  if (resourceId) {
290
290
  rows = rows.filter((row) => row.resourceId === resourceId);
291
291
  }
292
- if (filter?.dateRange) {
293
- const { start, end } = filter.dateRange;
294
- rows = rows.filter((row) => {
295
- const created = new Date(row.createdAt).getTime();
296
- if (start && created < start.getTime()) return false;
297
- if (end && created > end.getTime()) return false;
298
- return true;
299
- });
300
- }
292
+ rows = filterByDateRange(rows, (row) => new Date(row.createdAt), filter?.dateRange);
301
293
  rows.sort((a, b) => {
302
294
  const aValue = field === "createdAt" || field === "updatedAt" ? new Date(a[field]).getTime() : a[field];
303
295
  const bValue = field === "createdAt" || field === "updatedAt" ? new Date(b[field]).getTime() : b[field];
@@ -853,143 +845,24 @@ var WorkflowsConvex = class extends WorkflowsStorage {
853
845
  };
854
846
 
855
847
  // src/storage/index.ts
848
+ var isClientConfig = (config) => {
849
+ return "client" in config;
850
+ };
856
851
  var ConvexStore = class extends MastraStorage {
857
- memory;
858
- workflows;
859
- scores;
852
+ stores = {};
860
853
  constructor(config) {
861
854
  super({ id: config.id, name: config.name ?? "ConvexStore", disableInit: config.disableInit });
862
- const client = new ConvexAdminClient(config);
855
+ const client = isClientConfig(config) ? config.client : new ConvexAdminClient(config);
863
856
  const domainConfig = { client };
864
- this.memory = new MemoryConvex(domainConfig);
865
- this.workflows = new WorkflowsConvex(domainConfig);
866
- this.scores = new ScoresConvex(domainConfig);
857
+ const memory = new MemoryConvex(domainConfig);
858
+ const workflows = new WorkflowsConvex(domainConfig);
859
+ const scores = new ScoresConvex(domainConfig);
867
860
  this.stores = {
868
- memory: this.memory,
869
- workflows: this.workflows,
870
- scores: this.scores
871
- };
872
- }
873
- get supports() {
874
- return {
875
- selectByIncludeResourceScope: true,
876
- resourceWorkingMemory: true,
877
- hasColumn: false,
878
- createTable: false,
879
- deleteMessages: true,
880
- observabilityInstance: false,
881
- listScoresBySpan: false
861
+ memory,
862
+ workflows,
863
+ scores
882
864
  };
883
865
  }
884
- async getThreadById({ threadId }) {
885
- return this.memory.getThreadById({ threadId });
886
- }
887
- async saveThread({ thread }) {
888
- return this.memory.saveThread({ thread });
889
- }
890
- async updateThread({
891
- id,
892
- title,
893
- metadata
894
- }) {
895
- return this.memory.updateThread({ id, title, metadata });
896
- }
897
- async deleteThread({ threadId }) {
898
- await this.memory.deleteThread({ threadId });
899
- }
900
- async listMessages(args) {
901
- return this.memory.listMessages(args);
902
- }
903
- async listMessagesById({ messageIds }) {
904
- return this.memory.listMessagesById({ messageIds });
905
- }
906
- async saveMessages(args) {
907
- return this.memory.saveMessages(args);
908
- }
909
- async updateMessages({
910
- messages
911
- }) {
912
- return this.memory.updateMessages({ messages });
913
- }
914
- async deleteMessages(messageIds) {
915
- await this.memory.deleteMessages(messageIds);
916
- }
917
- async listThreadsByResourceId(args) {
918
- return this.memory.listThreadsByResourceId(args);
919
- }
920
- async getResourceById({ resourceId }) {
921
- return this.memory.getResourceById({ resourceId });
922
- }
923
- async saveResource({ resource }) {
924
- return this.memory.saveResource({ resource });
925
- }
926
- async updateResource({
927
- resourceId,
928
- workingMemory,
929
- metadata
930
- }) {
931
- return this.memory.updateResource({ resourceId, workingMemory, metadata });
932
- }
933
- async updateWorkflowResults(params) {
934
- return this.workflows.updateWorkflowResults(params);
935
- }
936
- async updateWorkflowState(params) {
937
- return this.workflows.updateWorkflowState(params);
938
- }
939
- async persistWorkflowSnapshot({
940
- workflowName,
941
- runId,
942
- resourceId,
943
- snapshot
944
- }) {
945
- await this.workflows.persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot });
946
- }
947
- async loadWorkflowSnapshot({
948
- workflowName,
949
- runId
950
- }) {
951
- return this.workflows.loadWorkflowSnapshot({ workflowName, runId });
952
- }
953
- async listWorkflowRuns(args) {
954
- return this.workflows.listWorkflowRuns(args);
955
- }
956
- async getWorkflowRunById({
957
- runId,
958
- workflowName
959
- }) {
960
- return this.workflows.getWorkflowRunById({ runId, workflowName });
961
- }
962
- async deleteWorkflowRunById({ runId, workflowName }) {
963
- return this.workflows.deleteWorkflowRunById({ runId, workflowName });
964
- }
965
- async getScoreById({ id }) {
966
- return this.scores.getScoreById({ id });
967
- }
968
- async saveScore(score) {
969
- return this.scores.saveScore(score);
970
- }
971
- async listScoresByScorerId({
972
- scorerId,
973
- pagination,
974
- entityId,
975
- entityType,
976
- source
977
- }) {
978
- return this.scores.listScoresByScorerId({ scorerId, pagination, entityId, entityType, source });
979
- }
980
- async listScoresByRunId({
981
- runId,
982
- pagination
983
- }) {
984
- return this.scores.listScoresByRunId({ runId, pagination });
985
- }
986
- async listScoresByEntityId({
987
- entityId,
988
- entityType,
989
- pagination
990
- }) {
991
- return this.scores.listScoresByEntityId({ entityId, entityType, pagination });
992
- }
993
866
  };
994
867
  var INDEX_METADATA_TABLE = "mastra_vector_indexes";
995
868
  var ConvexVector = class extends MastraVector {