@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/CHANGELOG.md +493 -3
- package/dist/chunk-H5QJE733.cjs +104 -0
- package/dist/chunk-H5QJE733.cjs.map +1 -0
- package/dist/chunk-HXB4DWFE.js +73 -0
- package/dist/chunk-HXB4DWFE.js.map +1 -0
- package/dist/docs/README.md +32 -0
- package/dist/docs/SKILL.md +46 -0
- package/dist/docs/SOURCE_MAP.json +63 -0
- package/dist/docs/storage/01-reference.md +140 -0
- package/dist/docs/vectors/01-reference.md +240 -0
- package/dist/index.cjs +26 -153
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -141
- package/dist/index.js.map +1 -1
- package/dist/schema.cjs +17 -17
- package/dist/schema.d.ts +52 -75
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +1 -1
- package/dist/server/index.cjs +14 -14
- package/dist/server/index.js +1 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/scores/index.d.ts +5 -14
- package/dist/storage/domains/scores/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +54 -123
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +9 -8
- package/dist/chunk-PKUUSREO.js +0 -76
- package/dist/chunk-PKUUSREO.js.map +0 -1
- package/dist/chunk-ZBUP3DS6.cjs +0 -93
- package/dist/chunk-ZBUP3DS6.cjs.map +0 -1
- package/dist/server/schema.d.ts +0 -115
- package/dist/server/schema.d.ts.map +0 -1
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-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
865
|
-
|
|
866
|
-
|
|
857
|
+
const memory = new MemoryConvex(domainConfig);
|
|
858
|
+
const workflows = new WorkflowsConvex(domainConfig);
|
|
859
|
+
const scores = new ScoresConvex(domainConfig);
|
|
867
860
|
this.stores = {
|
|
868
|
-
memory
|
|
869
|
-
workflows
|
|
870
|
-
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 {
|