@mastra/convex 1.0.0 → 1.0.1
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 +18 -0
- package/dist/{chunk-H5QJE733.cjs → chunk-FTVDAP6U.cjs} +12 -3
- package/dist/chunk-FTVDAP6U.cjs.map +1 -0
- package/dist/{chunk-HXB4DWFE.js → chunk-G5FLGAPE.js} +13 -4
- package/dist/chunk-G5FLGAPE.js.map +1 -0
- package/dist/docs/README.md +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/SOURCE_MAP.json +14 -14
- package/dist/docs/storage/01-reference.md +8 -2
- package/dist/docs/vectors/01-reference.md +2 -2
- package/dist/index.cjs +14 -14
- package/dist/index.js +1 -1
- package/dist/schema.cjs +17 -17
- package/dist/schema.d.ts +24 -2
- 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/package.json +8 -8
- package/dist/chunk-H5QJE733.cjs.map +0 -1
- package/dist/chunk-HXB4DWFE.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @mastra/convex
|
|
2
2
|
|
|
3
|
+
## 1.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixed Convex schema validation error where `mastra_workflow_snapshots` index `by_record_id` referenced a missing `id` field. The `id` field is now explicitly defined in the Convex workflow snapshots table schema. This enables successful `npx convex dev` deployments that were previously failing with SchemaDefinitionError. ([#12319](https://github.com/mastra-ai/mastra/pull/12319))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`90fc0e5`](https://github.com/mastra-ai/mastra/commit/90fc0e5717cb280c2d4acf4f0410b510bb4c0a72), [`1cf5d2e`](https://github.com/mastra-ai/mastra/commit/1cf5d2ea1b085be23e34fb506c80c80a4e6d9c2b), [`b99ceac`](https://github.com/mastra-ai/mastra/commit/b99ceace2c830dbdef47c8692d56a91954aefea2), [`deea43e`](https://github.com/mastra-ai/mastra/commit/deea43eb1366d03a864c5e597d16a48592b9893f), [`833ae96`](https://github.com/mastra-ai/mastra/commit/833ae96c3e34370e58a1e979571c41f39a720592), [`943772b`](https://github.com/mastra-ai/mastra/commit/943772b4378f625f0f4e19ea2b7c392bd8e71786), [`b5c711b`](https://github.com/mastra-ai/mastra/commit/b5c711b281dd1fb81a399a766bc9f86c55efc13e), [`3efbe5a`](https://github.com/mastra-ai/mastra/commit/3efbe5ae20864c4f3143457f4f3ee7dc2fa5ca76), [`1e49e7a`](https://github.com/mastra-ai/mastra/commit/1e49e7ab5f173582154cb26b29d424de67d09aef), [`751eaab`](https://github.com/mastra-ai/mastra/commit/751eaab4e0d3820a94e4c3d39a2ff2663ded3d91), [`69d8156`](https://github.com/mastra-ai/mastra/commit/69d81568bcf062557c24471ce26812446bec465d), [`60d9d89`](https://github.com/mastra-ai/mastra/commit/60d9d899e44b35bc43f1bcd967a74e0ce010b1af), [`5c544c8`](https://github.com/mastra-ai/mastra/commit/5c544c8d12b08ab40d64d8f37b3c4215bee95b87), [`771ad96`](https://github.com/mastra-ai/mastra/commit/771ad962441996b5c43549391a3e6a02c6ddedc2), [`2b0936b`](https://github.com/mastra-ai/mastra/commit/2b0936b0c9a43eeed9bef63e614d7e02ee803f7e), [`3b04f30`](https://github.com/mastra-ai/mastra/commit/3b04f3010604f3cdfc8a0674731700ad66471cee), [`97e26de`](https://github.com/mastra-ai/mastra/commit/97e26deaebd9836647a67b96423281d66421ca07), [`ac9ec66`](https://github.com/mastra-ai/mastra/commit/ac9ec6672779b2e6d4344e415481d1a6a7d4911a), [`10523f4`](https://github.com/mastra-ai/mastra/commit/10523f4882d9b874b40ce6e3715f66dbcd4947d2), [`cb72d20`](https://github.com/mastra-ai/mastra/commit/cb72d2069d7339bda8a0e76d4f35615debb07b84), [`42856b1`](https://github.com/mastra-ai/mastra/commit/42856b1c8aeea6371c9ee77ae2f5f5fe34400933), [`66f33ff`](https://github.com/mastra-ai/mastra/commit/66f33ff68620018513e499c394411d1d39b3aa5c), [`ab3c190`](https://github.com/mastra-ai/mastra/commit/ab3c1901980a99910ca9b96a7090c22e24060113), [`d4f06c8`](https://github.com/mastra-ai/mastra/commit/d4f06c85ffa5bb0da38fb82ebf3b040cc6b4ec4e), [`0350626`](https://github.com/mastra-ai/mastra/commit/03506267ec41b67add80d994c0c0fcce93bbc75f), [`bc9fa00`](https://github.com/mastra-ai/mastra/commit/bc9fa00859c5c4a796d53a0a5cae46ab4a3072e4), [`f46a478`](https://github.com/mastra-ai/mastra/commit/f46a4782f595949c696569e891f81c8d26338508), [`90fc0e5`](https://github.com/mastra-ai/mastra/commit/90fc0e5717cb280c2d4acf4f0410b510bb4c0a72), [`f05a3a5`](https://github.com/mastra-ai/mastra/commit/f05a3a5cf2b9a9c2d40c09cb8c762a4b6cd5d565), [`a291da9`](https://github.com/mastra-ai/mastra/commit/a291da9363efd92dafd8775dccb4f2d0511ece7a), [`c5d71da`](https://github.com/mastra-ai/mastra/commit/c5d71da1c680ce5640b1a7f8ca0e024a4ab1cfed), [`07042f9`](https://github.com/mastra-ai/mastra/commit/07042f9f89080f38b8f72713ba1c972d5b1905b8), [`0423442`](https://github.com/mastra-ai/mastra/commit/0423442b7be2dfacba95890bea8f4a810db4d603)]:
|
|
10
|
+
- @mastra/core@1.1.0
|
|
11
|
+
|
|
12
|
+
## 1.0.1-alpha.0
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Fixed Convex schema validation error where `mastra_workflow_snapshots` index `by_record_id` referenced a missing `id` field. The `id` field is now explicitly defined in the Convex workflow snapshots table schema. This enables successful `npx convex dev` deployments that were previously failing with SchemaDefinitionError. ([#12319](https://github.com/mastra-ai/mastra/pull/12319))
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [[`90fc0e5`](https://github.com/mastra-ai/mastra/commit/90fc0e5717cb280c2d4acf4f0410b510bb4c0a72), [`1cf5d2e`](https://github.com/mastra-ai/mastra/commit/1cf5d2ea1b085be23e34fb506c80c80a4e6d9c2b), [`833ae96`](https://github.com/mastra-ai/mastra/commit/833ae96c3e34370e58a1e979571c41f39a720592), [`943772b`](https://github.com/mastra-ai/mastra/commit/943772b4378f625f0f4e19ea2b7c392bd8e71786), [`b5c711b`](https://github.com/mastra-ai/mastra/commit/b5c711b281dd1fb81a399a766bc9f86c55efc13e), [`3efbe5a`](https://github.com/mastra-ai/mastra/commit/3efbe5ae20864c4f3143457f4f3ee7dc2fa5ca76), [`1e49e7a`](https://github.com/mastra-ai/mastra/commit/1e49e7ab5f173582154cb26b29d424de67d09aef), [`751eaab`](https://github.com/mastra-ai/mastra/commit/751eaab4e0d3820a94e4c3d39a2ff2663ded3d91), [`69d8156`](https://github.com/mastra-ai/mastra/commit/69d81568bcf062557c24471ce26812446bec465d), [`60d9d89`](https://github.com/mastra-ai/mastra/commit/60d9d899e44b35bc43f1bcd967a74e0ce010b1af), [`5c544c8`](https://github.com/mastra-ai/mastra/commit/5c544c8d12b08ab40d64d8f37b3c4215bee95b87), [`771ad96`](https://github.com/mastra-ai/mastra/commit/771ad962441996b5c43549391a3e6a02c6ddedc2), [`2b0936b`](https://github.com/mastra-ai/mastra/commit/2b0936b0c9a43eeed9bef63e614d7e02ee803f7e), [`3b04f30`](https://github.com/mastra-ai/mastra/commit/3b04f3010604f3cdfc8a0674731700ad66471cee), [`97e26de`](https://github.com/mastra-ai/mastra/commit/97e26deaebd9836647a67b96423281d66421ca07), [`10523f4`](https://github.com/mastra-ai/mastra/commit/10523f4882d9b874b40ce6e3715f66dbcd4947d2), [`cb72d20`](https://github.com/mastra-ai/mastra/commit/cb72d2069d7339bda8a0e76d4f35615debb07b84), [`42856b1`](https://github.com/mastra-ai/mastra/commit/42856b1c8aeea6371c9ee77ae2f5f5fe34400933), [`66f33ff`](https://github.com/mastra-ai/mastra/commit/66f33ff68620018513e499c394411d1d39b3aa5c), [`ab3c190`](https://github.com/mastra-ai/mastra/commit/ab3c1901980a99910ca9b96a7090c22e24060113), [`d4f06c8`](https://github.com/mastra-ai/mastra/commit/d4f06c85ffa5bb0da38fb82ebf3b040cc6b4ec4e), [`0350626`](https://github.com/mastra-ai/mastra/commit/03506267ec41b67add80d994c0c0fcce93bbc75f), [`bc9fa00`](https://github.com/mastra-ai/mastra/commit/bc9fa00859c5c4a796d53a0a5cae46ab4a3072e4), [`f46a478`](https://github.com/mastra-ai/mastra/commit/f46a4782f595949c696569e891f81c8d26338508), [`90fc0e5`](https://github.com/mastra-ai/mastra/commit/90fc0e5717cb280c2d4acf4f0410b510bb4c0a72), [`f05a3a5`](https://github.com/mastra-ai/mastra/commit/f05a3a5cf2b9a9c2d40c09cb8c762a4b6cd5d565), [`a291da9`](https://github.com/mastra-ai/mastra/commit/a291da9363efd92dafd8775dccb4f2d0511ece7a), [`c5d71da`](https://github.com/mastra-ai/mastra/commit/c5d71da1c680ce5640b1a7f8ca0e024a4ab1cfed), [`07042f9`](https://github.com/mastra-ai/mastra/commit/07042f9f89080f38b8f72713ba1c972d5b1905b8), [`0423442`](https://github.com/mastra-ai/mastra/commit/0423442b7be2dfacba95890bea8f4a810db4d603)]:
|
|
19
|
+
- @mastra/core@1.1.0-alpha.0
|
|
20
|
+
|
|
3
21
|
## 1.0.0
|
|
4
22
|
|
|
5
23
|
### Major Changes
|
|
@@ -43,7 +43,16 @@ function buildTableFromSchema(schema) {
|
|
|
43
43
|
var mastraThreadsTable = server.defineTable(buildTableFromSchema(constants.TABLE_SCHEMAS[constants.TABLE_THREADS])).index("by_record_id", ["id"]).index("by_resource", ["resourceId"]).index("by_created", ["createdAt"]).index("by_updated", ["updatedAt"]);
|
|
44
44
|
var mastraMessagesTable = server.defineTable(buildTableFromSchema(constants.TABLE_SCHEMAS[constants.TABLE_MESSAGES])).index("by_record_id", ["id"]).index("by_thread", ["thread_id"]).index("by_thread_created", ["thread_id", "createdAt"]).index("by_resource", ["resourceId"]);
|
|
45
45
|
var mastraResourcesTable = server.defineTable(buildTableFromSchema(constants.TABLE_SCHEMAS[constants.TABLE_RESOURCES])).index("by_record_id", ["id"]).index("by_updated", ["updatedAt"]);
|
|
46
|
-
var mastraWorkflowSnapshotsTable = server.defineTable(
|
|
46
|
+
var mastraWorkflowSnapshotsTable = server.defineTable({
|
|
47
|
+
id: values.v.optional(values.v.string()),
|
|
48
|
+
// Synthetic ID for Convex index, generated at runtime
|
|
49
|
+
workflow_name: values.v.string(),
|
|
50
|
+
run_id: values.v.string(),
|
|
51
|
+
resourceId: values.v.optional(values.v.string()),
|
|
52
|
+
snapshot: values.v.any(),
|
|
53
|
+
createdAt: values.v.string(),
|
|
54
|
+
updatedAt: values.v.string()
|
|
55
|
+
}).index("by_record_id", ["id"]).index("by_workflow_run", ["workflow_name", "run_id"]).index("by_workflow", ["workflow_name"]).index("by_resource", ["resourceId"]).index("by_created", ["createdAt"]);
|
|
47
56
|
var mastraScoresTable = server.defineTable(buildTableFromSchema(constants.TABLE_SCHEMAS[constants.TABLE_SCORERS])).index("by_record_id", ["id"]).index("by_scorer", ["scorerId"]).index("by_entity", ["entityId", "entityType"]).index("by_run", ["runId"]).index("by_created", ["createdAt"]);
|
|
48
57
|
var mastraVectorIndexesTable = server.defineTable({
|
|
49
58
|
id: values.v.string(),
|
|
@@ -100,5 +109,5 @@ exports.mastraThreadsTable = mastraThreadsTable;
|
|
|
100
109
|
exports.mastraVectorIndexesTable = mastraVectorIndexesTable;
|
|
101
110
|
exports.mastraVectorsTable = mastraVectorsTable;
|
|
102
111
|
exports.mastraWorkflowSnapshotsTable = mastraWorkflowSnapshotsTable;
|
|
103
|
-
//# sourceMappingURL=chunk-
|
|
104
|
-
//# sourceMappingURL=chunk-
|
|
112
|
+
//# sourceMappingURL=chunk-FTVDAP6U.cjs.map
|
|
113
|
+
//# sourceMappingURL=chunk-FTVDAP6U.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/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,CAAC,WAAA,EAAa,IAAI,CAAC,CAAA,CACxC,KAAA,CAAM,UAAA,EAAY,CAAC,WAAW,CAAC;AAS3B,IAAM,uBAAuBC,kBAAA,CAAY;AAAA,EAC9C,KAAA,EAAOD,SAAE,MAAA,EAAO;AAAA,EAChB,UAAA,EAAYA,SAAE,MAAA,EAAO;AAAA,EACrB,MAAA,EAAQA,SAAE,GAAA;AACZ,CAAC,CAAA,CACE,KAAA,CAAM,UAAA,EAAY,CAAC,OAAO,CAAC,CAAA,CAC3B,KAAA,CAAM,kBAAA,EAAoB,CAAC,OAAA,EAAS,YAAY,CAAC;AAS7C,IAAM,oBAAA,GAAuB;AAC7B,IAAM,aAAA,GAAgB;AACtB,IAAM,eAAA,GAAkB","file":"chunk-FTVDAP6U.cjs","sourcesContent":["/**\n * Convex schema definitions for Mastra tables.\n *\n * This file dynamically builds Convex table definitions from the canonical\n * TABLE_SCHEMAS in @mastra/core/storage/constants to ensure they stay in sync.\n *\n * The import path @mastra/core/storage/constants is specifically designed to\n * avoid pulling in Node.js dependencies, making it safe to use in Convex's\n * sandboxed schema evaluation environment.\n */\nimport {\n TABLE_SCHEMAS,\n TABLE_WORKFLOW_SNAPSHOT,\n TABLE_MESSAGES,\n TABLE_THREADS,\n TABLE_RESOURCES,\n TABLE_SCORERS,\n} from '@mastra/core/storage/constants';\nimport { defineTable } from 'convex/server';\nimport { v } from 'convex/values';\n\n/**\n * Helper to convert Mastra StorageColumn type to Convex validator\n */\nfunction columnToValidator(column: { type: string; nullable?: boolean }) {\n let validator;\n switch (column.type) {\n case 'text':\n validator = v.string();\n break;\n case 'integer':\n case 'float':\n validator = v.number();\n break;\n case 'bigint':\n validator = v.int64();\n break;\n case 'boolean':\n validator = v.boolean();\n break;\n case 'timestamp':\n validator = v.string(); // Store as ISO string\n break;\n case 'jsonb':\n case 'json':\n validator = v.any();\n break;\n default:\n validator = v.any();\n }\n return column.nullable ? v.optional(validator) : validator;\n}\n\n/**\n * Build Convex table definition from Mastra schema.\n * Includes the `id` field as a regular field (Convex auto-generates _id).\n */\nfunction buildTableFromSchema(schema: Record<string, { type: string; nullable?: boolean; primaryKey?: boolean }>) {\n const fields: Record<string, any> = {};\n for (const [key, column] of Object.entries(schema)) {\n fields[key] = columnToValidator(column);\n }\n return fields;\n}\n\n// ============================================================================\n// Table Definitions - Built from @mastra/core TABLE_SCHEMAS\n// ============================================================================\n\n/**\n * Threads table - stores conversation threads\n * Schema: TABLE_SCHEMAS[TABLE_THREADS]\n */\nexport const mastraThreadsTable = defineTable(buildTableFromSchema(TABLE_SCHEMAS[TABLE_THREADS]))\n .index('by_record_id', ['id'])\n .index('by_resource', ['resourceId'])\n .index('by_created', ['createdAt'])\n .index('by_updated', ['updatedAt']);\n\n/**\n * Messages table - stores conversation messages\n * Schema: TABLE_SCHEMAS[TABLE_MESSAGES]\n */\nexport const mastraMessagesTable = defineTable(buildTableFromSchema(TABLE_SCHEMAS[TABLE_MESSAGES]))\n .index('by_record_id', ['id'])\n .index('by_thread', ['thread_id'])\n .index('by_thread_created', ['thread_id', 'createdAt'])\n .index('by_resource', ['resourceId']);\n\n/**\n * Resources table - stores resource/user working memory\n * Schema: TABLE_SCHEMAS[TABLE_RESOURCES]\n */\nexport const mastraResourcesTable = defineTable(buildTableFromSchema(TABLE_SCHEMAS[TABLE_RESOURCES]))\n .index('by_record_id', ['id'])\n .index('by_updated', ['updatedAt']);\n\n/**\n * Workflow snapshots table - stores workflow execution state\n * Schema: TABLE_SCHEMAS[TABLE_WORKFLOW_SNAPSHOT]\n *\n * Note: The `id` field is added explicitly for Convex's by_record_id index.\n * The core schema uses (workflow_name, run_id) as a composite key, but Convex\n * requires a single-column index. The id value is generated at runtime as\n * `${workflow_name}-${run_id}` by the Convex storage adapter's normalizeRecord().\n *\n * Fields are defined explicitly (not using buildTableFromSchema) because TypeScript's\n * type inference doesn't work well with spread operators in Convex's defineTable.\n */\nexport const mastraWorkflowSnapshotsTable = defineTable({\n id: v.optional(v.string()), // Synthetic ID for Convex index, generated at runtime\n workflow_name: v.string(),\n run_id: v.string(),\n resourceId: v.optional(v.string()),\n snapshot: v.any(),\n createdAt: v.string(),\n updatedAt: v.string(),\n})\n .index('by_record_id', ['id'])\n .index('by_workflow_run', ['workflow_name', 'run_id'])\n .index('by_workflow', ['workflow_name'])\n .index('by_resource', ['resourceId'])\n .index('by_created', ['createdAt']);\n\n/**\n * Scores table - stores evaluation scores\n * Schema: TABLE_SCHEMAS[TABLE_SCORERS]\n */\nexport const mastraScoresTable = defineTable(buildTableFromSchema(TABLE_SCHEMAS[TABLE_SCORERS]))\n .index('by_record_id', ['id'])\n .index('by_scorer', ['scorerId'])\n .index('by_entity', ['entityId', 'entityType'])\n .index('by_run', ['runId'])\n .index('by_created', ['createdAt']);\n\n// ============================================================================\n// Vector Tables - Not in core schemas (vector-specific)\n// ============================================================================\n\n/**\n * Vector indexes table - stores metadata about vector indexes\n */\nexport const mastraVectorIndexesTable = defineTable({\n id: v.string(), // Mastra record ID (same as indexName)\n indexName: v.string(),\n dimension: v.number(),\n metric: v.string(),\n createdAt: v.string(),\n})\n .index('by_record_id', ['id'])\n .index('by_name', ['indexName']);\n\n/**\n * Vectors table - stores vector embeddings\n * Uses indexName field to support multiple indexes with different dimensions\n */\nexport const mastraVectorsTable = defineTable({\n id: v.string(), // Mastra record ID\n indexName: v.string(),\n embedding: v.array(v.float64()),\n metadata: v.optional(v.any()),\n})\n .index('by_index_id', ['indexName', 'id']) // Composite for scoped lookups per index\n .index('by_index', ['indexName']);\n\n// ============================================================================\n// Fallback Table - For unknown/custom tables\n// ============================================================================\n\n/**\n * Generic documents table - fallback for unknown table types\n */\nexport const mastraDocumentsTable = defineTable({\n table: v.string(),\n primaryKey: v.string(),\n record: v.any(),\n})\n .index('by_table', ['table'])\n .index('by_table_primary', ['table', 'primaryKey']);\n\n// ============================================================================\n// Re-export table name constants for convenience\n// ============================================================================\n\nexport { TABLE_WORKFLOW_SNAPSHOT, TABLE_MESSAGES, TABLE_THREADS, TABLE_RESOURCES, TABLE_SCORERS };\n\n// Additional table name constants for vector tables (not in core)\nexport const TABLE_VECTOR_INDEXES = 'mastra_vector_indexes';\nexport const TABLE_VECTORS = 'mastra_vectors';\nexport const TABLE_DOCUMENTS = 'mastra_documents';\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TABLE_SCHEMAS, TABLE_THREADS, TABLE_MESSAGES, TABLE_RESOURCES,
|
|
1
|
+
import { TABLE_SCHEMAS, TABLE_THREADS, TABLE_MESSAGES, TABLE_RESOURCES, TABLE_SCORERS } from '@mastra/core/storage/constants';
|
|
2
2
|
export { TABLE_MESSAGES, TABLE_RESOURCES, TABLE_SCORERS, TABLE_THREADS, TABLE_WORKFLOW_SNAPSHOT } from '@mastra/core/storage/constants';
|
|
3
3
|
import { defineTable } from 'convex/server';
|
|
4
4
|
import { v } from 'convex/values';
|
|
@@ -42,7 +42,16 @@ function buildTableFromSchema(schema) {
|
|
|
42
42
|
var mastraThreadsTable = defineTable(buildTableFromSchema(TABLE_SCHEMAS[TABLE_THREADS])).index("by_record_id", ["id"]).index("by_resource", ["resourceId"]).index("by_created", ["createdAt"]).index("by_updated", ["updatedAt"]);
|
|
43
43
|
var mastraMessagesTable = defineTable(buildTableFromSchema(TABLE_SCHEMAS[TABLE_MESSAGES])).index("by_record_id", ["id"]).index("by_thread", ["thread_id"]).index("by_thread_created", ["thread_id", "createdAt"]).index("by_resource", ["resourceId"]);
|
|
44
44
|
var mastraResourcesTable = defineTable(buildTableFromSchema(TABLE_SCHEMAS[TABLE_RESOURCES])).index("by_record_id", ["id"]).index("by_updated", ["updatedAt"]);
|
|
45
|
-
var mastraWorkflowSnapshotsTable = defineTable(
|
|
45
|
+
var mastraWorkflowSnapshotsTable = defineTable({
|
|
46
|
+
id: v.optional(v.string()),
|
|
47
|
+
// Synthetic ID for Convex index, generated at runtime
|
|
48
|
+
workflow_name: v.string(),
|
|
49
|
+
run_id: v.string(),
|
|
50
|
+
resourceId: v.optional(v.string()),
|
|
51
|
+
snapshot: v.any(),
|
|
52
|
+
createdAt: v.string(),
|
|
53
|
+
updatedAt: v.string()
|
|
54
|
+
}).index("by_record_id", ["id"]).index("by_workflow_run", ["workflow_name", "run_id"]).index("by_workflow", ["workflow_name"]).index("by_resource", ["resourceId"]).index("by_created", ["createdAt"]);
|
|
46
55
|
var mastraScoresTable = defineTable(buildTableFromSchema(TABLE_SCHEMAS[TABLE_SCORERS])).index("by_record_id", ["id"]).index("by_scorer", ["scorerId"]).index("by_entity", ["entityId", "entityType"]).index("by_run", ["runId"]).index("by_created", ["createdAt"]);
|
|
47
56
|
var mastraVectorIndexesTable = defineTable({
|
|
48
57
|
id: v.string(),
|
|
@@ -69,5 +78,5 @@ var TABLE_VECTORS = "mastra_vectors";
|
|
|
69
78
|
var TABLE_DOCUMENTS = "mastra_documents";
|
|
70
79
|
|
|
71
80
|
export { TABLE_DOCUMENTS, TABLE_VECTORS, TABLE_VECTOR_INDEXES, mastraDocumentsTable, mastraMessagesTable, mastraResourcesTable, mastraScoresTable, mastraThreadsTable, mastraVectorIndexesTable, mastraVectorsTable, mastraWorkflowSnapshotsTable };
|
|
72
|
-
//# sourceMappingURL=chunk-
|
|
73
|
-
//# sourceMappingURL=chunk-
|
|
81
|
+
//# sourceMappingURL=chunk-G5FLGAPE.js.map
|
|
82
|
+
//# sourceMappingURL=chunk-G5FLGAPE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/schema.ts"],"names":[],"mappings":";;;;;;AAwBA,SAAS,kBAAkB,MAAA,EAA8C;AACvE,EAAA,IAAI,SAAA;AACJ,EAAA,QAAQ,OAAO,IAAA;AAAM,IACnB,KAAK,MAAA;AACH,MAAA,SAAA,GAAY,EAAE,MAAA,EAAO;AACrB,MAAA;AAAA,IACF,KAAK,SAAA;AAAA,IACL,KAAK,OAAA;AACH,MAAA,SAAA,GAAY,EAAE,MAAA,EAAO;AACrB,MAAA;AAAA,IACF,KAAK,Q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kB","file":"chunk-G5FLGAPE.js","sourcesContent":["/**\n * Convex schema definitions for Mastra tables.\n *\n * This file dynamically builds Convex table definitions from the canonical\n * TABLE_SCHEMAS in @mastra/core/storage/constants to ensure they stay in sync.\n *\n * The import path @mastra/core/storage/constants is specifically designed to\n * avoid pulling in Node.js dependencies, making it safe to use in Convex's\n * sandboxed schema evaluation environment.\n */\nimport {\n TABLE_SCHEMAS,\n TABLE_WORKFLOW_SNAPSHOT,\n TABLE_MESSAGES,\n TABLE_THREADS,\n TABLE_RESOURCES,\n TABLE_SCORERS,\n} from '@mastra/core/storage/constants';\nimport { defineTable } from 'convex/server';\nimport { v } from 'convex/values';\n\n/**\n * Helper to convert Mastra StorageColumn type to Convex validator\n */\nfunction columnToValidator(column: { type: string; nullable?: boolean }) {\n let validator;\n switch (column.type) {\n case 'text':\n validator = v.string();\n break;\n case 'integer':\n case 'float':\n validator = v.number();\n break;\n case 'bigint':\n validator = v.int64();\n break;\n case 'boolean':\n validator = v.boolean();\n break;\n case 'timestamp':\n validator = v.string(); // Store as ISO string\n break;\n case 'jsonb':\n case 'json':\n validator = v.any();\n break;\n default:\n validator = v.any();\n }\n return column.nullable ? v.optional(validator) : validator;\n}\n\n/**\n * Build Convex table definition from Mastra schema.\n * Includes the `id` field as a regular field (Convex auto-generates _id).\n */\nfunction buildTableFromSchema(schema: Record<string, { type: string; nullable?: boolean; primaryKey?: boolean }>) {\n const fields: Record<string, any> = {};\n for (const [key, column] of Object.entries(schema)) {\n fields[key] = columnToValidator(column);\n }\n return fields;\n}\n\n// ============================================================================\n// Table Definitions - Built from @mastra/core TABLE_SCHEMAS\n// ============================================================================\n\n/**\n * Threads table - stores conversation threads\n * Schema: TABLE_SCHEMAS[TABLE_THREADS]\n */\nexport const mastraThreadsTable = defineTable(buildTableFromSchema(TABLE_SCHEMAS[TABLE_THREADS]))\n .index('by_record_id', ['id'])\n .index('by_resource', ['resourceId'])\n .index('by_created', ['createdAt'])\n .index('by_updated', ['updatedAt']);\n\n/**\n * Messages table - stores conversation messages\n * Schema: TABLE_SCHEMAS[TABLE_MESSAGES]\n */\nexport const mastraMessagesTable = defineTable(buildTableFromSchema(TABLE_SCHEMAS[TABLE_MESSAGES]))\n .index('by_record_id', ['id'])\n .index('by_thread', ['thread_id'])\n .index('by_thread_created', ['thread_id', 'createdAt'])\n .index('by_resource', ['resourceId']);\n\n/**\n * Resources table - stores resource/user working memory\n * Schema: TABLE_SCHEMAS[TABLE_RESOURCES]\n */\nexport const mastraResourcesTable = defineTable(buildTableFromSchema(TABLE_SCHEMAS[TABLE_RESOURCES]))\n .index('by_record_id', ['id'])\n .index('by_updated', ['updatedAt']);\n\n/**\n * Workflow snapshots table - stores workflow execution state\n * Schema: TABLE_SCHEMAS[TABLE_WORKFLOW_SNAPSHOT]\n *\n * Note: The `id` field is added explicitly for Convex's by_record_id index.\n * The core schema uses (workflow_name, run_id) as a composite key, but Convex\n * requires a single-column index. The id value is generated at runtime as\n * `${workflow_name}-${run_id}` by the Convex storage adapter's normalizeRecord().\n *\n * Fields are defined explicitly (not using buildTableFromSchema) because TypeScript's\n * type inference doesn't work well with spread operators in Convex's defineTable.\n */\nexport const mastraWorkflowSnapshotsTable = defineTable({\n id: v.optional(v.string()), // Synthetic ID for Convex index, generated at runtime\n workflow_name: v.string(),\n run_id: v.string(),\n resourceId: v.optional(v.string()),\n snapshot: v.any(),\n createdAt: v.string(),\n updatedAt: v.string(),\n})\n .index('by_record_id', ['id'])\n .index('by_workflow_run', ['workflow_name', 'run_id'])\n .index('by_workflow', ['workflow_name'])\n .index('by_resource', ['resourceId'])\n .index('by_created', ['createdAt']);\n\n/**\n * Scores table - stores evaluation scores\n * Schema: TABLE_SCHEMAS[TABLE_SCORERS]\n */\nexport const mastraScoresTable = defineTable(buildTableFromSchema(TABLE_SCHEMAS[TABLE_SCORERS]))\n .index('by_record_id', ['id'])\n .index('by_scorer', ['scorerId'])\n .index('by_entity', ['entityId', 'entityType'])\n .index('by_run', ['runId'])\n .index('by_created', ['createdAt']);\n\n// ============================================================================\n// Vector Tables - Not in core schemas (vector-specific)\n// ============================================================================\n\n/**\n * Vector indexes table - stores metadata about vector indexes\n */\nexport const mastraVectorIndexesTable = defineTable({\n id: v.string(), // Mastra record ID (same as indexName)\n indexName: v.string(),\n dimension: v.number(),\n metric: v.string(),\n createdAt: v.string(),\n})\n .index('by_record_id', ['id'])\n .index('by_name', ['indexName']);\n\n/**\n * Vectors table - stores vector embeddings\n * Uses indexName field to support multiple indexes with different dimensions\n */\nexport const mastraVectorsTable = defineTable({\n id: v.string(), // Mastra record ID\n indexName: v.string(),\n embedding: v.array(v.float64()),\n metadata: v.optional(v.any()),\n})\n .index('by_index_id', ['indexName', 'id']) // Composite for scoped lookups per index\n .index('by_index', ['indexName']);\n\n// ============================================================================\n// Fallback Table - For unknown/custom tables\n// ============================================================================\n\n/**\n * Generic documents table - fallback for unknown table types\n */\nexport const mastraDocumentsTable = defineTable({\n table: v.string(),\n primaryKey: v.string(),\n record: v.any(),\n})\n .index('by_table', ['table'])\n .index('by_table_primary', ['table', 'primaryKey']);\n\n// ============================================================================\n// Re-export table name constants for convenience\n// ============================================================================\n\nexport { TABLE_WORKFLOW_SNAPSHOT, TABLE_MESSAGES, TABLE_THREADS, TABLE_RESOURCES, TABLE_SCORERS };\n\n// Additional table name constants for vector tables (not in core)\nexport const TABLE_VECTOR_INDEXES = 'mastra_vector_indexes';\nexport const TABLE_VECTORS = 'mastra_vectors';\nexport const TABLE_DOCUMENTS = 'mastra_documents';\n"]}
|
package/dist/docs/README.md
CHANGED
package/dist/docs/SKILL.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.0.
|
|
2
|
+
"version": "1.0.1",
|
|
3
3
|
"package": "@mastra/convex",
|
|
4
4
|
"exports": {
|
|
5
5
|
"mastraStorage": {
|
|
@@ -8,55 +8,55 @@
|
|
|
8
8
|
},
|
|
9
9
|
"TABLE_MESSAGES": {
|
|
10
10
|
"types": "dist/index.d.ts",
|
|
11
|
-
"implementation": "dist/chunk-
|
|
11
|
+
"implementation": "dist/chunk-G5FLGAPE.js"
|
|
12
12
|
},
|
|
13
13
|
"TABLE_RESOURCES": {
|
|
14
14
|
"types": "dist/index.d.ts",
|
|
15
|
-
"implementation": "dist/chunk-
|
|
15
|
+
"implementation": "dist/chunk-G5FLGAPE.js"
|
|
16
16
|
},
|
|
17
17
|
"TABLE_SCORERS": {
|
|
18
18
|
"types": "dist/index.d.ts",
|
|
19
|
-
"implementation": "dist/chunk-
|
|
19
|
+
"implementation": "dist/chunk-G5FLGAPE.js"
|
|
20
20
|
},
|
|
21
21
|
"TABLE_THREADS": {
|
|
22
22
|
"types": "dist/index.d.ts",
|
|
23
|
-
"implementation": "dist/chunk-
|
|
23
|
+
"implementation": "dist/chunk-G5FLGAPE.js"
|
|
24
24
|
},
|
|
25
25
|
"TABLE_WORKFLOW_SNAPSHOT": {
|
|
26
26
|
"types": "dist/index.d.ts",
|
|
27
|
-
"implementation": "dist/chunk-
|
|
27
|
+
"implementation": "dist/chunk-G5FLGAPE.js"
|
|
28
28
|
},
|
|
29
29
|
"mastraDocumentsTable": {
|
|
30
30
|
"types": "dist/index.d.ts",
|
|
31
|
-
"implementation": "dist/chunk-
|
|
31
|
+
"implementation": "dist/chunk-G5FLGAPE.js"
|
|
32
32
|
},
|
|
33
33
|
"mastraMessagesTable": {
|
|
34
34
|
"types": "dist/index.d.ts",
|
|
35
|
-
"implementation": "dist/chunk-
|
|
35
|
+
"implementation": "dist/chunk-G5FLGAPE.js"
|
|
36
36
|
},
|
|
37
37
|
"mastraResourcesTable": {
|
|
38
38
|
"types": "dist/index.d.ts",
|
|
39
|
-
"implementation": "dist/chunk-
|
|
39
|
+
"implementation": "dist/chunk-G5FLGAPE.js"
|
|
40
40
|
},
|
|
41
41
|
"mastraScoresTable": {
|
|
42
42
|
"types": "dist/index.d.ts",
|
|
43
|
-
"implementation": "dist/chunk-
|
|
43
|
+
"implementation": "dist/chunk-G5FLGAPE.js"
|
|
44
44
|
},
|
|
45
45
|
"mastraThreadsTable": {
|
|
46
46
|
"types": "dist/index.d.ts",
|
|
47
|
-
"implementation": "dist/chunk-
|
|
47
|
+
"implementation": "dist/chunk-G5FLGAPE.js"
|
|
48
48
|
},
|
|
49
49
|
"mastraVectorIndexesTable": {
|
|
50
50
|
"types": "dist/index.d.ts",
|
|
51
|
-
"implementation": "dist/chunk-
|
|
51
|
+
"implementation": "dist/chunk-G5FLGAPE.js"
|
|
52
52
|
},
|
|
53
53
|
"mastraVectorsTable": {
|
|
54
54
|
"types": "dist/index.d.ts",
|
|
55
|
-
"implementation": "dist/chunk-
|
|
55
|
+
"implementation": "dist/chunk-G5FLGAPE.js"
|
|
56
56
|
},
|
|
57
57
|
"mastraWorkflowSnapshotsTable": {
|
|
58
58
|
"types": "dist/index.d.ts",
|
|
59
|
-
"implementation": "dist/chunk-
|
|
59
|
+
"implementation": "dist/chunk-G5FLGAPE.js"
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
"modules": {}
|
|
@@ -11,10 +11,16 @@
|
|
|
11
11
|
|
|
12
12
|
The Convex storage implementation provides a serverless storage solution using [Convex](https://convex.dev), a full-stack TypeScript development platform with real-time sync and automatic caching.
|
|
13
13
|
|
|
14
|
+
> **Observability Not Supported**
|
|
15
|
+
Convex storage **does not support the observability domain**. Traces from the `DefaultExporter` cannot be persisted to Convex, and Mastra Studio's observability features won't work with Convex as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite#specialized-storage-for-observability) to route observability data to a supported provider like ClickHouse or PostgreSQL.
|
|
16
|
+
|
|
17
|
+
> **Record Size Limit**
|
|
18
|
+
Convex enforces a **1 MiB maximum record size**. This limit can be exceeded when storing messages with base64-encoded attachments such as images. See [Handling large attachments](https://mastra.ai/docs/memory/storage#handling-large-attachments) for workarounds including uploading attachments to external storage like S3, Cloudflare R2, or [Convex file storage](https://docs.convex.dev/file-storage).
|
|
19
|
+
|
|
14
20
|
## Installation
|
|
15
21
|
|
|
16
|
-
```bash
|
|
17
|
-
npm install @mastra/convex@
|
|
22
|
+
```bash npm2yarn
|
|
23
|
+
npm install @mastra/convex@latest
|
|
18
24
|
```
|
|
19
25
|
|
|
20
26
|
## Convex Setup
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkBKVR7SL7_cjs = require('./chunk-BKVR7SL7.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkFTVDAP6U_cjs = require('./chunk-FTVDAP6U.cjs');
|
|
5
5
|
var storage = require('@mastra/core/storage');
|
|
6
6
|
var agent = require('@mastra/core/agent');
|
|
7
7
|
var error = require('@mastra/core/error');
|
|
@@ -1214,55 +1214,55 @@ Object.defineProperty(exports, "mastraStorage", {
|
|
|
1214
1214
|
});
|
|
1215
1215
|
Object.defineProperty(exports, "TABLE_MESSAGES", {
|
|
1216
1216
|
enumerable: true,
|
|
1217
|
-
get: function () { return
|
|
1217
|
+
get: function () { return chunkFTVDAP6U_cjs.TABLE_MESSAGES; }
|
|
1218
1218
|
});
|
|
1219
1219
|
Object.defineProperty(exports, "TABLE_RESOURCES", {
|
|
1220
1220
|
enumerable: true,
|
|
1221
|
-
get: function () { return
|
|
1221
|
+
get: function () { return chunkFTVDAP6U_cjs.TABLE_RESOURCES; }
|
|
1222
1222
|
});
|
|
1223
1223
|
Object.defineProperty(exports, "TABLE_SCORERS", {
|
|
1224
1224
|
enumerable: true,
|
|
1225
|
-
get: function () { return
|
|
1225
|
+
get: function () { return chunkFTVDAP6U_cjs.TABLE_SCORERS; }
|
|
1226
1226
|
});
|
|
1227
1227
|
Object.defineProperty(exports, "TABLE_THREADS", {
|
|
1228
1228
|
enumerable: true,
|
|
1229
|
-
get: function () { return
|
|
1229
|
+
get: function () { return chunkFTVDAP6U_cjs.TABLE_THREADS; }
|
|
1230
1230
|
});
|
|
1231
1231
|
Object.defineProperty(exports, "TABLE_WORKFLOW_SNAPSHOT", {
|
|
1232
1232
|
enumerable: true,
|
|
1233
|
-
get: function () { return
|
|
1233
|
+
get: function () { return chunkFTVDAP6U_cjs.TABLE_WORKFLOW_SNAPSHOT; }
|
|
1234
1234
|
});
|
|
1235
1235
|
Object.defineProperty(exports, "mastraDocumentsTable", {
|
|
1236
1236
|
enumerable: true,
|
|
1237
|
-
get: function () { return
|
|
1237
|
+
get: function () { return chunkFTVDAP6U_cjs.mastraDocumentsTable; }
|
|
1238
1238
|
});
|
|
1239
1239
|
Object.defineProperty(exports, "mastraMessagesTable", {
|
|
1240
1240
|
enumerable: true,
|
|
1241
|
-
get: function () { return
|
|
1241
|
+
get: function () { return chunkFTVDAP6U_cjs.mastraMessagesTable; }
|
|
1242
1242
|
});
|
|
1243
1243
|
Object.defineProperty(exports, "mastraResourcesTable", {
|
|
1244
1244
|
enumerable: true,
|
|
1245
|
-
get: function () { return
|
|
1245
|
+
get: function () { return chunkFTVDAP6U_cjs.mastraResourcesTable; }
|
|
1246
1246
|
});
|
|
1247
1247
|
Object.defineProperty(exports, "mastraScoresTable", {
|
|
1248
1248
|
enumerable: true,
|
|
1249
|
-
get: function () { return
|
|
1249
|
+
get: function () { return chunkFTVDAP6U_cjs.mastraScoresTable; }
|
|
1250
1250
|
});
|
|
1251
1251
|
Object.defineProperty(exports, "mastraThreadsTable", {
|
|
1252
1252
|
enumerable: true,
|
|
1253
|
-
get: function () { return
|
|
1253
|
+
get: function () { return chunkFTVDAP6U_cjs.mastraThreadsTable; }
|
|
1254
1254
|
});
|
|
1255
1255
|
Object.defineProperty(exports, "mastraVectorIndexesTable", {
|
|
1256
1256
|
enumerable: true,
|
|
1257
|
-
get: function () { return
|
|
1257
|
+
get: function () { return chunkFTVDAP6U_cjs.mastraVectorIndexesTable; }
|
|
1258
1258
|
});
|
|
1259
1259
|
Object.defineProperty(exports, "mastraVectorsTable", {
|
|
1260
1260
|
enumerable: true,
|
|
1261
|
-
get: function () { return
|
|
1261
|
+
get: function () { return chunkFTVDAP6U_cjs.mastraVectorsTable; }
|
|
1262
1262
|
});
|
|
1263
1263
|
Object.defineProperty(exports, "mastraWorkflowSnapshotsTable", {
|
|
1264
1264
|
enumerable: true,
|
|
1265
|
-
get: function () { return
|
|
1265
|
+
get: function () { return chunkFTVDAP6U_cjs.mastraWorkflowSnapshotsTable; }
|
|
1266
1266
|
});
|
|
1267
1267
|
exports.ConvexStore = ConvexStore;
|
|
1268
1268
|
exports.ConvexVector = ConvexVector;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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-
|
|
2
|
+
export { TABLE_MESSAGES, TABLE_RESOURCES, TABLE_SCORERS, TABLE_THREADS, TABLE_WORKFLOW_SNAPSHOT, mastraDocumentsTable, mastraMessagesTable, mastraResourcesTable, mastraScoresTable, mastraThreadsTable, mastraVectorIndexesTable, mastraVectorsTable, mastraWorkflowSnapshotsTable } from './chunk-G5FLGAPE.js';
|
|
3
3
|
import { MastraCompositeStore, 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';
|
package/dist/schema.cjs
CHANGED
|
@@ -1,72 +1,72 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkFTVDAP6U_cjs = require('./chunk-FTVDAP6U.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "TABLE_DOCUMENTS", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkFTVDAP6U_cjs.TABLE_DOCUMENTS; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "TABLE_MESSAGES", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkFTVDAP6U_cjs.TABLE_MESSAGES; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "TABLE_RESOURCES", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkFTVDAP6U_cjs.TABLE_RESOURCES; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "TABLE_SCORERS", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkFTVDAP6U_cjs.TABLE_SCORERS; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "TABLE_THREADS", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkFTVDAP6U_cjs.TABLE_THREADS; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "TABLE_VECTORS", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkFTVDAP6U_cjs.TABLE_VECTORS; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "TABLE_VECTOR_INDEXES", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkFTVDAP6U_cjs.TABLE_VECTOR_INDEXES; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "TABLE_WORKFLOW_SNAPSHOT", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkFTVDAP6U_cjs.TABLE_WORKFLOW_SNAPSHOT; }
|
|
38
38
|
});
|
|
39
39
|
Object.defineProperty(exports, "mastraDocumentsTable", {
|
|
40
40
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunkFTVDAP6U_cjs.mastraDocumentsTable; }
|
|
42
42
|
});
|
|
43
43
|
Object.defineProperty(exports, "mastraMessagesTable", {
|
|
44
44
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
45
|
+
get: function () { return chunkFTVDAP6U_cjs.mastraMessagesTable; }
|
|
46
46
|
});
|
|
47
47
|
Object.defineProperty(exports, "mastraResourcesTable", {
|
|
48
48
|
enumerable: true,
|
|
49
|
-
get: function () { return
|
|
49
|
+
get: function () { return chunkFTVDAP6U_cjs.mastraResourcesTable; }
|
|
50
50
|
});
|
|
51
51
|
Object.defineProperty(exports, "mastraScoresTable", {
|
|
52
52
|
enumerable: true,
|
|
53
|
-
get: function () { return
|
|
53
|
+
get: function () { return chunkFTVDAP6U_cjs.mastraScoresTable; }
|
|
54
54
|
});
|
|
55
55
|
Object.defineProperty(exports, "mastraThreadsTable", {
|
|
56
56
|
enumerable: true,
|
|
57
|
-
get: function () { return
|
|
57
|
+
get: function () { return chunkFTVDAP6U_cjs.mastraThreadsTable; }
|
|
58
58
|
});
|
|
59
59
|
Object.defineProperty(exports, "mastraVectorIndexesTable", {
|
|
60
60
|
enumerable: true,
|
|
61
|
-
get: function () { return
|
|
61
|
+
get: function () { return chunkFTVDAP6U_cjs.mastraVectorIndexesTable; }
|
|
62
62
|
});
|
|
63
63
|
Object.defineProperty(exports, "mastraVectorsTable", {
|
|
64
64
|
enumerable: true,
|
|
65
|
-
get: function () { return
|
|
65
|
+
get: function () { return chunkFTVDAP6U_cjs.mastraVectorsTable; }
|
|
66
66
|
});
|
|
67
67
|
Object.defineProperty(exports, "mastraWorkflowSnapshotsTable", {
|
|
68
68
|
enumerable: true,
|
|
69
|
-
get: function () { return
|
|
69
|
+
get: function () { return chunkFTVDAP6U_cjs.mastraWorkflowSnapshotsTable; }
|
|
70
70
|
});
|
|
71
71
|
//# sourceMappingURL=schema.cjs.map
|
|
72
72
|
//# sourceMappingURL=schema.cjs.map
|
package/dist/schema.d.ts
CHANGED
|
@@ -46,10 +46,32 @@ export declare const mastraResourcesTable: import("convex/server").TableDefiniti
|
|
|
46
46
|
/**
|
|
47
47
|
* Workflow snapshots table - stores workflow execution state
|
|
48
48
|
* Schema: TABLE_SCHEMAS[TABLE_WORKFLOW_SNAPSHOT]
|
|
49
|
+
*
|
|
50
|
+
* Note: The `id` field is added explicitly for Convex's by_record_id index.
|
|
51
|
+
* The core schema uses (workflow_name, run_id) as a composite key, but Convex
|
|
52
|
+
* requires a single-column index. The id value is generated at runtime as
|
|
53
|
+
* `${workflow_name}-${run_id}` by the Convex storage adapter's normalizeRecord().
|
|
54
|
+
*
|
|
55
|
+
* Fields are defined explicitly (not using buildTableFromSchema) because TypeScript's
|
|
56
|
+
* type inference doesn't work well with spread operators in Convex's defineTable.
|
|
49
57
|
*/
|
|
50
58
|
export declare const mastraWorkflowSnapshotsTable: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
51
|
-
|
|
52
|
-
|
|
59
|
+
id?: string;
|
|
60
|
+
resourceId?: string;
|
|
61
|
+
run_id: string;
|
|
62
|
+
workflow_name: string;
|
|
63
|
+
createdAt: string;
|
|
64
|
+
updatedAt: string;
|
|
65
|
+
snapshot: any;
|
|
66
|
+
}, {
|
|
67
|
+
id: import("convex/values").VString<string, "optional">;
|
|
68
|
+
workflow_name: import("convex/values").VString<string, "required">;
|
|
69
|
+
run_id: import("convex/values").VString<string, "required">;
|
|
70
|
+
resourceId: import("convex/values").VString<string, "optional">;
|
|
71
|
+
snapshot: import("convex/values").VAny<any, "required", string>;
|
|
72
|
+
createdAt: import("convex/values").VString<string, "required">;
|
|
73
|
+
updatedAt: import("convex/values").VString<string, "required">;
|
|
74
|
+
}, "required", "id" | "run_id" | "workflow_name" | "createdAt" | "resourceId" | "updatedAt" | "snapshot" | `snapshot.${string}`>, {
|
|
53
75
|
by_record_id: ["id", "_creationTime"];
|
|
54
76
|
by_workflow_run: ["workflow_name", "run_id", "_creationTime"];
|
|
55
77
|
by_workflow: ["workflow_name", "_creationTime"];
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAEL,uBAAuB,EACvB,cAAc,EACd,aAAa,EACb,eAAe,EACf,aAAa,EACd,MAAM,gCAAgC,CAAC;AAoDxC;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;;;UAIM,CAAC;AAEtC;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;;UAIO,CAAC;AAExC;;;GAGG;AACH,eAAO,MAAM,oBAAoB;;;;;UAEI,CAAC;AAEtC
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAEL,uBAAuB,EACvB,cAAc,EACd,aAAa,EACb,eAAe,EACf,aAAa,EACd,MAAM,gCAAgC,CAAC;AAoDxC;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;;;UAIM,CAAC;AAEtC;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;;UAIO,CAAC;AAExC;;;GAGG;AACH,eAAO,MAAM,oBAAoB;;;;;UAEI,CAAC;AAEtC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;UAaJ,CAAC;AAEtC;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;UAKO,CAAC;AAMtC;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;UAQH,CAAC;AAEnC;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;UAOI,CAAC;AAMpC;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;UAMoB,CAAC;AAMtD,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC;AAGlG,eAAO,MAAM,oBAAoB,0BAA0B,CAAC;AAC5D,eAAO,MAAM,aAAa,mBAAmB,CAAC;AAC9C,eAAO,MAAM,eAAe,qBAAqB,CAAC"}
|
package/dist/schema.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { TABLE_DOCUMENTS, TABLE_MESSAGES, TABLE_RESOURCES, TABLE_SCORERS, TABLE_THREADS, TABLE_VECTORS, TABLE_VECTOR_INDEXES, TABLE_WORKFLOW_SNAPSHOT, mastraDocumentsTable, mastraMessagesTable, mastraResourcesTable, mastraScoresTable, mastraThreadsTable, mastraVectorIndexesTable, mastraVectorsTable, mastraWorkflowSnapshotsTable } from './chunk-
|
|
1
|
+
export { TABLE_DOCUMENTS, TABLE_MESSAGES, TABLE_RESOURCES, TABLE_SCORERS, TABLE_THREADS, TABLE_VECTORS, TABLE_VECTOR_INDEXES, TABLE_WORKFLOW_SNAPSHOT, mastraDocumentsTable, mastraMessagesTable, mastraResourcesTable, mastraScoresTable, mastraThreadsTable, mastraVectorIndexesTable, mastraVectorsTable, mastraWorkflowSnapshotsTable } from './chunk-G5FLGAPE.js';
|
|
2
2
|
//# sourceMappingURL=schema.js.map
|
|
3
3
|
//# sourceMappingURL=schema.js.map
|
package/dist/server/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkBKVR7SL7_cjs = require('../chunk-BKVR7SL7.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkFTVDAP6U_cjs = require('../chunk-FTVDAP6U.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
@@ -11,55 +11,55 @@ Object.defineProperty(exports, "mastraStorage", {
|
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "TABLE_MESSAGES", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkFTVDAP6U_cjs.TABLE_MESSAGES; }
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, "TABLE_RESOURCES", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunkFTVDAP6U_cjs.TABLE_RESOURCES; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "TABLE_SCORERS", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkFTVDAP6U_cjs.TABLE_SCORERS; }
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "TABLE_THREADS", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunkFTVDAP6U_cjs.TABLE_THREADS; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, "TABLE_WORKFLOW_SNAPSHOT", {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunkFTVDAP6U_cjs.TABLE_WORKFLOW_SNAPSHOT; }
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "mastraDocumentsTable", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunkFTVDAP6U_cjs.mastraDocumentsTable; }
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "mastraMessagesTable", {
|
|
37
37
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
38
|
+
get: function () { return chunkFTVDAP6U_cjs.mastraMessagesTable; }
|
|
39
39
|
});
|
|
40
40
|
Object.defineProperty(exports, "mastraResourcesTable", {
|
|
41
41
|
enumerable: true,
|
|
42
|
-
get: function () { return
|
|
42
|
+
get: function () { return chunkFTVDAP6U_cjs.mastraResourcesTable; }
|
|
43
43
|
});
|
|
44
44
|
Object.defineProperty(exports, "mastraScoresTable", {
|
|
45
45
|
enumerable: true,
|
|
46
|
-
get: function () { return
|
|
46
|
+
get: function () { return chunkFTVDAP6U_cjs.mastraScoresTable; }
|
|
47
47
|
});
|
|
48
48
|
Object.defineProperty(exports, "mastraThreadsTable", {
|
|
49
49
|
enumerable: true,
|
|
50
|
-
get: function () { return
|
|
50
|
+
get: function () { return chunkFTVDAP6U_cjs.mastraThreadsTable; }
|
|
51
51
|
});
|
|
52
52
|
Object.defineProperty(exports, "mastraVectorIndexesTable", {
|
|
53
53
|
enumerable: true,
|
|
54
|
-
get: function () { return
|
|
54
|
+
get: function () { return chunkFTVDAP6U_cjs.mastraVectorIndexesTable; }
|
|
55
55
|
});
|
|
56
56
|
Object.defineProperty(exports, "mastraVectorsTable", {
|
|
57
57
|
enumerable: true,
|
|
58
|
-
get: function () { return
|
|
58
|
+
get: function () { return chunkFTVDAP6U_cjs.mastraVectorsTable; }
|
|
59
59
|
});
|
|
60
60
|
Object.defineProperty(exports, "mastraWorkflowSnapshotsTable", {
|
|
61
61
|
enumerable: true,
|
|
62
|
-
get: function () { return
|
|
62
|
+
get: function () { return chunkFTVDAP6U_cjs.mastraWorkflowSnapshotsTable; }
|
|
63
63
|
});
|
|
64
64
|
//# sourceMappingURL=index.cjs.map
|
|
65
65
|
//# sourceMappingURL=index.cjs.map
|
package/dist/server/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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-
|
|
2
|
+
export { TABLE_MESSAGES, TABLE_RESOURCES, TABLE_SCORERS, TABLE_THREADS, TABLE_WORKFLOW_SNAPSHOT, mastraDocumentsTable, mastraMessagesTable, mastraResourcesTable, mastraScoresTable, mastraThreadsTable, mastraVectorIndexesTable, mastraVectorsTable, mastraWorkflowSnapshotsTable } from '../chunk-G5FLGAPE.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/convex",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Convex provider for Mastra - includes both storage and vector adapters plus Convex server helpers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -43,18 +43,18 @@
|
|
|
43
43
|
"convex": "^1.29.3"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@types/node": "22.
|
|
46
|
+
"@types/node": "22.19.7",
|
|
47
47
|
"@vitest/coverage-v8": "4.0.12",
|
|
48
48
|
"@vitest/ui": "4.0.12",
|
|
49
|
-
"dotenv": "^17.
|
|
49
|
+
"dotenv": "^17.2.3",
|
|
50
50
|
"eslint": "^9.37.0",
|
|
51
|
-
"tsup": "^8.5.
|
|
51
|
+
"tsup": "^8.5.1",
|
|
52
52
|
"typescript": "^5.9.3",
|
|
53
53
|
"vitest": "4.0.16",
|
|
54
|
-
"@internal/lint": "0.0.
|
|
55
|
-
"@internal/types-builder": "0.0.
|
|
56
|
-
"@internal/storage-test-utils": "0.0.
|
|
57
|
-
"@mastra/core": "1.
|
|
54
|
+
"@internal/lint": "0.0.56",
|
|
55
|
+
"@internal/types-builder": "0.0.31",
|
|
56
|
+
"@internal/storage-test-utils": "0.0.52",
|
|
57
|
+
"@mastra/core": "1.1.0"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"@mastra/core": ">=1.0.0-0 <2.0.0-0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schema.ts"],"names":["v","defineTable","TABLE_SCHEMAS","TABLE_THREADS","TABLE_MESSAGES","TABLE_RESOURCES","TABLE_WORKFLOW_SNAPSHOT","TABLE_SCORERS"],"mappings":";;;;;;;AAwBA,SAAS,kBAAkB,MAAA,EAA8C;AACvE,EAAA,IAAI,SAAA;AACJ,EAAA,QAAQ,OAAO,IAAA;AAAM,IACnB,KAAK,MAAA;AACH,MAAA,SAAA,GAAYA,SAAE,MAAA,EAAO;AACrB,MAAA;AAAA,IACF,KAAK,SAAA;AAAA,IACL,KAAK,OAAA;AACH,MAAA,SAAA,GAAYA,SAAE,MAAA,EAAO;AACrB,MAAA;AAAA,IACF,KAAK,QAAA;AACH,MAAA,SAAA,GAAYA,SAAE,KAAA,EAAM;AACpB,MAAA;AAAA,IACF,KAAK,SAAA;AACH,MAAA,SAAA,GAAYA,SAAE,OAAA,EAAQ;AACtB,MAAA;AAAA,IACF,KAAK,WAAA;AACH,MAAA,SAAA,GAAYA,SAAE,MAAA,EAAO;AACrB,MAAA;AAAA,IACF,KAAK,OAAA;AAAA,IACL,KAAK,MAAA;AACH,MAAA,SAAA,GAAYA,SAAE,GAAA,EAAI;AAClB,MAAA;AAAA,IACF;AACE,MAAA,SAAA,GAAYA,SAAE,GAAA,EAAI;AAAA;AAEtB,EAAA,OAAO,MAAA,CAAO,QAAA,GAAWA,QAAA,CAAE,QAAA,CAAS,SAAS,CAAA,GAAI,SAAA;AACnD;AAMA,SAAS,qBAAqB,MAAA,EAAoF;AAChH,EAAA,MAAM,SAA8B,EAAC;AACrC,EAAA,KAAA,MAAW,CAAC,GAAA,EAAK,MAAM,KAAK,MAAA,CAAO,OAAA,CAAQ,MAAM,CAAA,EAAG;AAClD,IAAA,MAAA,CAA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,EAAO;AAAA,EAChB,UAAA,EAAYA,SAAE,MAAA,EAAO;AAAA,EACrB,MAAA,EAAQA,SAAE,GAAA;AACZ,CAAC,CAAA,CACE,KAAA,CAAM,UAAA,EAAY,CAAC,OAAO,CAAC,CAAA,CAC3B,KAAA,CAAM,kBAAA,EAAoB,CAAC,OAAA,EAAS,YAAY,CAAC;AAS7C,IAAM,oBAAA,GAAuB;AAC7B,IAAM,aAAA,GAAgB;AACtB,IAAM,eAAA,GAAkB","file":"chunk-H5QJE733.cjs","sourcesContent":["/**\n * Convex schema definitions for Mastra tables.\n *\n * This file dynamically builds Convex table definitions from the canonical\n * TABLE_SCHEMAS in @mastra/core/storage/constants to ensure they stay in sync.\n *\n * The import path @mastra/core/storage/constants is specifically designed to\n * avoid pulling in Node.js dependencies, making it safe to use in Convex's\n * sandboxed schema evaluation environment.\n */\nimport {\n TABLE_SCHEMAS,\n TABLE_WORKFLOW_SNAPSHOT,\n TABLE_MESSAGES,\n TABLE_THREADS,\n TABLE_RESOURCES,\n TABLE_SCORERS,\n} from '@mastra/core/storage/constants';\nimport { defineTable } from 'convex/server';\nimport { v } from 'convex/values';\n\n/**\n * Helper to convert Mastra StorageColumn type to Convex validator\n */\nfunction columnToValidator(column: { type: string; nullable?: boolean }) {\n let validator;\n switch (column.type) {\n case 'text':\n validator = v.string();\n break;\n case 'integer':\n case 'float':\n validator = v.number();\n break;\n case 'bigint':\n validator = v.int64();\n break;\n case 'boolean':\n validator = v.boolean();\n break;\n case 'timestamp':\n validator = v.string(); // Store as ISO string\n break;\n case 'jsonb':\n case 'json':\n validator = v.any();\n break;\n default:\n validator = v.any();\n }\n return column.nullable ? v.optional(validator) : validator;\n}\n\n/**\n * Build Convex table definition from Mastra schema.\n * Includes the `id` field as a regular field (Convex auto-generates _id).\n */\nfunction buildTableFromSchema(schema: Record<string, { type: string; nullable?: boolean; primaryKey?: boolean }>) {\n const fields: Record<string, any> = {};\n for (const [key, column] of Object.entries(schema)) {\n fields[key] = columnToValidator(column);\n }\n return fields;\n}\n\n// ============================================================================\n// Table Definitions - Built from @mastra/core TABLE_SCHEMAS\n// ============================================================================\n\n/**\n * Threads table - stores conversation threads\n * Schema: TABLE_SCHEMAS[TABLE_THREADS]\n */\nexport const mastraThreadsTable = defineTable(buildTableFromSchema(TABLE_SCHEMAS[TABLE_THREADS]))\n .index('by_record_id', ['id'])\n .index('by_resource', ['resourceId'])\n .index('by_created', ['createdAt'])\n .index('by_updated', ['updatedAt']);\n\n/**\n * Messages table - stores conversation messages\n * Schema: TABLE_SCHEMAS[TABLE_MESSAGES]\n */\nexport const mastraMessagesTable = defineTable(buildTableFromSchema(TABLE_SCHEMAS[TABLE_MESSAGES]))\n .index('by_record_id', ['id'])\n .index('by_thread', ['thread_id'])\n .index('by_thread_created', ['thread_id', 'createdAt'])\n .index('by_resource', ['resourceId']);\n\n/**\n * Resources table - stores resource/user working memory\n * Schema: TABLE_SCHEMAS[TABLE_RESOURCES]\n */\nexport const mastraResourcesTable = defineTable(buildTableFromSchema(TABLE_SCHEMAS[TABLE_RESOURCES]))\n .index('by_record_id', ['id'])\n .index('by_updated', ['updatedAt']);\n\n/**\n * Workflow snapshots table - stores workflow execution state\n * Schema: TABLE_SCHEMAS[TABLE_WORKFLOW_SNAPSHOT]\n */\nexport const mastraWorkflowSnapshotsTable = defineTable(buildTableFromSchema(TABLE_SCHEMAS[TABLE_WORKFLOW_SNAPSHOT]))\n .index('by_record_id', ['id'])\n .index('by_workflow_run', ['workflow_name', 'run_id'])\n .index('by_workflow', ['workflow_name'])\n .index('by_resource', ['resourceId'])\n .index('by_created', ['createdAt']);\n\n/**\n * Scores table - stores evaluation scores\n * Schema: TABLE_SCHEMAS[TABLE_SCORERS]\n */\nexport const mastraScoresTable = defineTable(buildTableFromSchema(TABLE_SCHEMAS[TABLE_SCORERS]))\n .index('by_record_id', ['id'])\n .index('by_scorer', ['scorerId'])\n .index('by_entity', ['entityId', 'entityType'])\n .index('by_run', ['runId'])\n .index('by_created', ['createdAt']);\n\n// ============================================================================\n// Vector Tables - Not in core schemas (vector-specific)\n// ============================================================================\n\n/**\n * Vector indexes table - stores metadata about vector indexes\n */\nexport const mastraVectorIndexesTable = defineTable({\n id: v.string(), // Mastra record ID (same as indexName)\n indexName: v.string(),\n dimension: v.number(),\n metric: v.string(),\n createdAt: v.string(),\n})\n .index('by_record_id', ['id'])\n .index('by_name', ['indexName']);\n\n/**\n * Vectors table - stores vector embeddings\n * Uses indexName field to support multiple indexes with different dimensions\n */\nexport const mastraVectorsTable = defineTable({\n id: v.string(), // Mastra record ID\n indexName: v.string(),\n embedding: v.array(v.float64()),\n metadata: v.optional(v.any()),\n})\n .index('by_index_id', ['indexName', 'id']) // Composite for scoped lookups per index\n .index('by_index', ['indexName']);\n\n// ============================================================================\n// Fallback Table - For unknown/custom tables\n// ============================================================================\n\n/**\n * Generic documents table - fallback for unknown table types\n */\nexport const mastraDocumentsTable = defineTable({\n table: v.string(),\n primaryKey: v.string(),\n record: v.any(),\n})\n .index('by_table', ['table'])\n .index('by_table_primary', ['table', 'primaryKey']);\n\n// ============================================================================\n// Re-export table name constants for convenience\n// ============================================================================\n\nexport { TABLE_WORKFLOW_SNAPSHOT, TABLE_MESSAGES, TABLE_THREADS, TABLE_RESOURCES, TABLE_SCORERS };\n\n// Additional table name constants for vector tables (not in core)\nexport const TABLE_VECTOR_INDEXES = 'mastra_vector_indexes';\nexport const TABLE_VECTORS = 'mastra_vectors';\nexport const TABLE_DOCUMENTS = 'mastra_documents';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schema.ts"],"names":[],"mappings":";;;;;;AAwBA,SAAS,kBAAkB,MAAA,EAA8C;AACvE,EAAA,IAAI,SAAA;AACJ,EAAA,QAAQ,OAAO,IAAA;AAAM,IACnB,KAAK,MAAA;AACH,MAAA,SAAA,GAAY,EAAE,MAAA,EAAO;AACrB,MAAA;AAAA,IACF,KAAK,SAAA;AAAA,IACL,KAAK,OAAA;A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AAAA,EACpB,MAAA,EAAQ,EAAE,MAAA,EAAO;AAAA,EACjB,SAAA,EAAW,EAAE,MAAA;AACf,CAAC,CAAA,CACE,KAAA,CAAM,cAAA,EAAgB,CAAC,IAAI,CAAC,CAAA,CAC5B,KAAA,CAAM,SAAA,EAAW,CAAC,WAAW,CAAC;AAM1B,IAAM,qBAAqB,WAAA,CAAY;AAAA,EAC5C,EAAA,EAAI,EAAE,MAAA,EAAO;AAAA;AAAA,EACb,SAAA,EAAW,EAAE,MAAA,EAAO;AAAA,EACpB,SAAA,EAAW,CAAA,CAAE,KAAA,CAAM,CAAA,CAAE,SAAS,CAAA;AAAA,EAC9B,QAAA,EAAU,CAAA,CAAE,QAAA,CAAS,CAAA,CAAE,KAAK;AAC9B,CAAC,CAAA,CACE,KAAA,CAAM,aAAA,EAAe,CAAC,WAAA,EAAa,IAAI,CAAC,CAAA,CACxC,KAAA,CAAM,UAAA,EAAY,CAAC,WAAW,CAAC;AAS3B,IAAM,uBAAuB,WAAA,CAAY;AAAA,EAC9C,KAAA,EAAO,EAAE,MAAA,EAAO;AAAA,EAChB,UAAA,EAAY,EAAE,MAAA,EAAO;AAAA,EACrB,MAAA,EAAQ,EAAE,GAAA;AACZ,CAAC,CAAA,CACE,KAAA,CAAM,UAAA,EAAY,CAAC,OAAO,CAAC,CAAA,CAC3B,KAAA,CAAM,kBAAA,EAAoB,CAAC,OAAA,EAAS,YAAY,CAAC;AAS7C,IAAM,oBAAA,GAAuB;AAC7B,IAAM,aAAA,GAAgB;AACtB,IAAM,eAAA,GAAkB","file":"chunk-HXB4DWFE.js","sourcesContent":["/**\n * Convex schema definitions for Mastra tables.\n *\n * This file dynamically builds Convex table definitions from the canonical\n * TABLE_SCHEMAS in @mastra/core/storage/constants to ensure they stay in sync.\n *\n * The import path @mastra/core/storage/constants is specifically designed to\n * avoid pulling in Node.js dependencies, making it safe to use in Convex's\n * sandboxed schema evaluation environment.\n */\nimport {\n TABLE_SCHEMAS,\n TABLE_WORKFLOW_SNAPSHOT,\n TABLE_MESSAGES,\n TABLE_THREADS,\n TABLE_RESOURCES,\n TABLE_SCORERS,\n} from '@mastra/core/storage/constants';\nimport { defineTable } from 'convex/server';\nimport { v } from 'convex/values';\n\n/**\n * Helper to convert Mastra StorageColumn type to Convex validator\n */\nfunction columnToValidator(column: { type: string; nullable?: boolean }) {\n let validator;\n switch (column.type) {\n case 'text':\n validator = v.string();\n break;\n case 'integer':\n case 'float':\n validator = v.number();\n break;\n case 'bigint':\n validator = v.int64();\n break;\n case 'boolean':\n validator = v.boolean();\n break;\n case 'timestamp':\n validator = v.string(); // Store as ISO string\n break;\n case 'jsonb':\n case 'json':\n validator = v.any();\n break;\n default:\n validator = v.any();\n }\n return column.nullable ? v.optional(validator) : validator;\n}\n\n/**\n * Build Convex table definition from Mastra schema.\n * Includes the `id` field as a regular field (Convex auto-generates _id).\n */\nfunction buildTableFromSchema(schema: Record<string, { type: string; nullable?: boolean; primaryKey?: boolean }>) {\n const fields: Record<string, any> = {};\n for (const [key, column] of Object.entries(schema)) {\n fields[key] = columnToValidator(column);\n }\n return fields;\n}\n\n// ============================================================================\n// Table Definitions - Built from @mastra/core TABLE_SCHEMAS\n// ============================================================================\n\n/**\n * Threads table - stores conversation threads\n * Schema: TABLE_SCHEMAS[TABLE_THREADS]\n */\nexport const mastraThreadsTable = defineTable(buildTableFromSchema(TABLE_SCHEMAS[TABLE_THREADS]))\n .index('by_record_id', ['id'])\n .index('by_resource', ['resourceId'])\n .index('by_created', ['createdAt'])\n .index('by_updated', ['updatedAt']);\n\n/**\n * Messages table - stores conversation messages\n * Schema: TABLE_SCHEMAS[TABLE_MESSAGES]\n */\nexport const mastraMessagesTable = defineTable(buildTableFromSchema(TABLE_SCHEMAS[TABLE_MESSAGES]))\n .index('by_record_id', ['id'])\n .index('by_thread', ['thread_id'])\n .index('by_thread_created', ['thread_id', 'createdAt'])\n .index('by_resource', ['resourceId']);\n\n/**\n * Resources table - stores resource/user working memory\n * Schema: TABLE_SCHEMAS[TABLE_RESOURCES]\n */\nexport const mastraResourcesTable = defineTable(buildTableFromSchema(TABLE_SCHEMAS[TABLE_RESOURCES]))\n .index('by_record_id', ['id'])\n .index('by_updated', ['updatedAt']);\n\n/**\n * Workflow snapshots table - stores workflow execution state\n * Schema: TABLE_SCHEMAS[TABLE_WORKFLOW_SNAPSHOT]\n */\nexport const mastraWorkflowSnapshotsTable = defineTable(buildTableFromSchema(TABLE_SCHEMAS[TABLE_WORKFLOW_SNAPSHOT]))\n .index('by_record_id', ['id'])\n .index('by_workflow_run', ['workflow_name', 'run_id'])\n .index('by_workflow', ['workflow_name'])\n .index('by_resource', ['resourceId'])\n .index('by_created', ['createdAt']);\n\n/**\n * Scores table - stores evaluation scores\n * Schema: TABLE_SCHEMAS[TABLE_SCORERS]\n */\nexport const mastraScoresTable = defineTable(buildTableFromSchema(TABLE_SCHEMAS[TABLE_SCORERS]))\n .index('by_record_id', ['id'])\n .index('by_scorer', ['scorerId'])\n .index('by_entity', ['entityId', 'entityType'])\n .index('by_run', ['runId'])\n .index('by_created', ['createdAt']);\n\n// ============================================================================\n// Vector Tables - Not in core schemas (vector-specific)\n// ============================================================================\n\n/**\n * Vector indexes table - stores metadata about vector indexes\n */\nexport const mastraVectorIndexesTable = defineTable({\n id: v.string(), // Mastra record ID (same as indexName)\n indexName: v.string(),\n dimension: v.number(),\n metric: v.string(),\n createdAt: v.string(),\n})\n .index('by_record_id', ['id'])\n .index('by_name', ['indexName']);\n\n/**\n * Vectors table - stores vector embeddings\n * Uses indexName field to support multiple indexes with different dimensions\n */\nexport const mastraVectorsTable = defineTable({\n id: v.string(), // Mastra record ID\n indexName: v.string(),\n embedding: v.array(v.float64()),\n metadata: v.optional(v.any()),\n})\n .index('by_index_id', ['indexName', 'id']) // Composite for scoped lookups per index\n .index('by_index', ['indexName']);\n\n// ============================================================================\n// Fallback Table - For unknown/custom tables\n// ============================================================================\n\n/**\n * Generic documents table - fallback for unknown table types\n */\nexport const mastraDocumentsTable = defineTable({\n table: v.string(),\n primaryKey: v.string(),\n record: v.any(),\n})\n .index('by_table', ['table'])\n .index('by_table_primary', ['table', 'primaryKey']);\n\n// ============================================================================\n// Re-export table name constants for convenience\n// ============================================================================\n\nexport { TABLE_WORKFLOW_SNAPSHOT, TABLE_MESSAGES, TABLE_THREADS, TABLE_RESOURCES, TABLE_SCORERS };\n\n// Additional table name constants for vector tables (not in core)\nexport const TABLE_VECTOR_INDEXES = 'mastra_vector_indexes';\nexport const TABLE_VECTORS = 'mastra_vectors';\nexport const TABLE_DOCUMENTS = 'mastra_documents';\n"]}
|