@mastra/convex 0.0.0-top-level-fix-20251211111608 → 0.0.0-unified-workspace-snapshot-20260128233410

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +884 -5
  2. package/README.md +1 -1
  3. package/dist/{chunk-QKN2PWR2.cjs → chunk-BKVR7SL7.cjs} +2 -89
  4. package/dist/chunk-BKVR7SL7.cjs.map +1 -0
  5. package/dist/chunk-FTVDAP6U.cjs +113 -0
  6. package/dist/chunk-FTVDAP6U.cjs.map +1 -0
  7. package/dist/chunk-G5FLGAPE.js +82 -0
  8. package/dist/chunk-G5FLGAPE.js.map +1 -0
  9. package/dist/{chunk-NZCHEPNU.js → chunk-KSAPIIEJ.js} +5 -65
  10. package/dist/chunk-KSAPIIEJ.js.map +1 -0
  11. package/dist/docs/README.md +32 -0
  12. package/dist/docs/SKILL.md +46 -0
  13. package/dist/docs/SOURCE_MAP.json +63 -0
  14. package/dist/docs/storage/01-reference.md +146 -0
  15. package/dist/docs/vectors/01-reference.md +240 -0
  16. package/dist/index.cjs +221 -307
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.js +205 -291
  19. package/dist/index.js.map +1 -1
  20. package/dist/schema.cjs +72 -0
  21. package/dist/schema.cjs.map +1 -0
  22. package/dist/{server/schema.d.ts → schema.d.ts} +38 -3
  23. package/dist/schema.d.ts.map +1 -0
  24. package/dist/schema.js +3 -0
  25. package/dist/schema.js.map +1 -0
  26. package/dist/server/index.cjs +19 -18
  27. package/dist/server/index.d.ts +1 -1
  28. package/dist/server/index.d.ts.map +1 -1
  29. package/dist/server/index.js +2 -1
  30. package/dist/storage/db/index.d.ts +66 -0
  31. package/dist/storage/db/index.d.ts.map +1 -0
  32. package/dist/storage/domains/{memory.d.ts → memory/index.d.ts} +8 -6
  33. package/dist/storage/domains/memory/index.d.ts.map +1 -0
  34. package/dist/storage/domains/{scores.d.ts → scores/index.d.ts} +11 -18
  35. package/dist/storage/domains/scores/index.d.ts.map +1 -0
  36. package/dist/storage/domains/{workflows.d.ts → workflows/index.d.ts} +9 -13
  37. package/dist/storage/domains/workflows/index.d.ts.map +1 -0
  38. package/dist/storage/index.d.ts +56 -159
  39. package/dist/storage/index.d.ts.map +1 -1
  40. package/package.json +23 -13
  41. package/dist/chunk-NZCHEPNU.js.map +0 -1
  42. package/dist/chunk-QKN2PWR2.cjs.map +0 -1
  43. package/dist/server/schema.d.ts.map +0 -1
  44. package/dist/storage/domains/memory.d.ts.map +0 -1
  45. package/dist/storage/domains/scores.d.ts.map +0 -1
  46. package/dist/storage/domains/workflows.d.ts.map +0 -1
  47. package/dist/storage/operations.d.ts +0 -40
  48. package/dist/storage/operations.d.ts.map +0 -1
@@ -1,4 +1,14 @@
1
- import { TABLE_WORKFLOW_SNAPSHOT, TABLE_MESSAGES, TABLE_THREADS, TABLE_RESOURCES, TABLE_SCORERS } from '@mastra/core/storage';
1
+ /**
2
+ * Convex schema definitions for Mastra tables.
3
+ *
4
+ * This file dynamically builds Convex table definitions from the canonical
5
+ * TABLE_SCHEMAS in @mastra/core/storage/constants to ensure they stay in sync.
6
+ *
7
+ * The import path @mastra/core/storage/constants is specifically designed to
8
+ * avoid pulling in Node.js dependencies, making it safe to use in Convex's
9
+ * sandboxed schema evaluation environment.
10
+ */
11
+ import { TABLE_WORKFLOW_SNAPSHOT, TABLE_MESSAGES, TABLE_THREADS, TABLE_RESOURCES, TABLE_SCORERS } from '@mastra/core/storage/constants';
2
12
  /**
3
13
  * Threads table - stores conversation threads
4
14
  * Schema: TABLE_SCHEMAS[TABLE_THREADS]
@@ -36,10 +46,32 @@ export declare const mastraResourcesTable: import("convex/server").TableDefiniti
36
46
  /**
37
47
  * Workflow snapshots table - stores workflow execution state
38
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.
39
57
  */
40
58
  export declare const mastraWorkflowSnapshotsTable: import("convex/server").TableDefinition<import("convex/values").VObject<{
41
- [x: string]: any;
42
- }, Record<string, any>, "required", string>, {
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}`>, {
43
75
  by_record_id: ["id", "_creationTime"];
44
76
  by_workflow_run: ["workflow_name", "run_id", "_creationTime"];
45
77
  by_workflow: ["workflow_name", "_creationTime"];
@@ -112,4 +144,7 @@ export declare const mastraDocumentsTable: import("convex/server").TableDefiniti
112
144
  by_table_primary: ["table", "primaryKey", "_creationTime"];
113
145
  }, {}, {}>;
114
146
  export { TABLE_WORKFLOW_SNAPSHOT, TABLE_MESSAGES, TABLE_THREADS, TABLE_RESOURCES, TABLE_SCORERS };
147
+ export declare const TABLE_VECTOR_INDEXES = "mastra_vector_indexes";
148
+ export declare const TABLE_VECTORS = "mastra_vectors";
149
+ export declare const TABLE_DOCUMENTS = "mastra_documents";
115
150
  //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +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;;;;;;;;;;;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 ADDED
@@ -0,0 +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-G5FLGAPE.js';
2
+ //# sourceMappingURL=schema.js.map
3
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"schema.js"}
@@ -1,64 +1,65 @@
1
1
  'use strict';
2
2
 
3
- var chunkQKN2PWR2_cjs = require('../chunk-QKN2PWR2.cjs');
3
+ var chunkBKVR7SL7_cjs = require('../chunk-BKVR7SL7.cjs');
4
+ var chunkFTVDAP6U_cjs = require('../chunk-FTVDAP6U.cjs');
4
5
 
5
6
 
6
7
 
8
+ Object.defineProperty(exports, "mastraStorage", {
9
+ enumerable: true,
10
+ get: function () { return chunkBKVR7SL7_cjs.mastraStorage; }
11
+ });
7
12
  Object.defineProperty(exports, "TABLE_MESSAGES", {
8
13
  enumerable: true,
9
- get: function () { return chunkQKN2PWR2_cjs.TABLE_MESSAGES; }
14
+ get: function () { return chunkFTVDAP6U_cjs.TABLE_MESSAGES; }
10
15
  });
11
16
  Object.defineProperty(exports, "TABLE_RESOURCES", {
12
17
  enumerable: true,
13
- get: function () { return chunkQKN2PWR2_cjs.TABLE_RESOURCES; }
18
+ get: function () { return chunkFTVDAP6U_cjs.TABLE_RESOURCES; }
14
19
  });
15
20
  Object.defineProperty(exports, "TABLE_SCORERS", {
16
21
  enumerable: true,
17
- get: function () { return chunkQKN2PWR2_cjs.TABLE_SCORERS; }
22
+ get: function () { return chunkFTVDAP6U_cjs.TABLE_SCORERS; }
18
23
  });
19
24
  Object.defineProperty(exports, "TABLE_THREADS", {
20
25
  enumerable: true,
21
- get: function () { return chunkQKN2PWR2_cjs.TABLE_THREADS; }
26
+ get: function () { return chunkFTVDAP6U_cjs.TABLE_THREADS; }
22
27
  });
23
28
  Object.defineProperty(exports, "TABLE_WORKFLOW_SNAPSHOT", {
24
29
  enumerable: true,
25
- get: function () { return chunkQKN2PWR2_cjs.TABLE_WORKFLOW_SNAPSHOT; }
30
+ get: function () { return chunkFTVDAP6U_cjs.TABLE_WORKFLOW_SNAPSHOT; }
26
31
  });
27
32
  Object.defineProperty(exports, "mastraDocumentsTable", {
28
33
  enumerable: true,
29
- get: function () { return chunkQKN2PWR2_cjs.mastraDocumentsTable; }
34
+ get: function () { return chunkFTVDAP6U_cjs.mastraDocumentsTable; }
30
35
  });
31
36
  Object.defineProperty(exports, "mastraMessagesTable", {
32
37
  enumerable: true,
33
- get: function () { return chunkQKN2PWR2_cjs.mastraMessagesTable; }
38
+ get: function () { return chunkFTVDAP6U_cjs.mastraMessagesTable; }
34
39
  });
35
40
  Object.defineProperty(exports, "mastraResourcesTable", {
36
41
  enumerable: true,
37
- get: function () { return chunkQKN2PWR2_cjs.mastraResourcesTable; }
42
+ get: function () { return chunkFTVDAP6U_cjs.mastraResourcesTable; }
38
43
  });
39
44
  Object.defineProperty(exports, "mastraScoresTable", {
40
45
  enumerable: true,
41
- get: function () { return chunkQKN2PWR2_cjs.mastraScoresTable; }
42
- });
43
- Object.defineProperty(exports, "mastraStorage", {
44
- enumerable: true,
45
- get: function () { return chunkQKN2PWR2_cjs.mastraStorage; }
46
+ get: function () { return chunkFTVDAP6U_cjs.mastraScoresTable; }
46
47
  });
47
48
  Object.defineProperty(exports, "mastraThreadsTable", {
48
49
  enumerable: true,
49
- get: function () { return chunkQKN2PWR2_cjs.mastraThreadsTable; }
50
+ get: function () { return chunkFTVDAP6U_cjs.mastraThreadsTable; }
50
51
  });
51
52
  Object.defineProperty(exports, "mastraVectorIndexesTable", {
52
53
  enumerable: true,
53
- get: function () { return chunkQKN2PWR2_cjs.mastraVectorIndexesTable; }
54
+ get: function () { return chunkFTVDAP6U_cjs.mastraVectorIndexesTable; }
54
55
  });
55
56
  Object.defineProperty(exports, "mastraVectorsTable", {
56
57
  enumerable: true,
57
- get: function () { return chunkQKN2PWR2_cjs.mastraVectorsTable; }
58
+ get: function () { return chunkFTVDAP6U_cjs.mastraVectorsTable; }
58
59
  });
59
60
  Object.defineProperty(exports, "mastraWorkflowSnapshotsTable", {
60
61
  enumerable: true,
61
- get: function () { return chunkQKN2PWR2_cjs.mastraWorkflowSnapshotsTable; }
62
+ get: function () { return chunkFTVDAP6U_cjs.mastraWorkflowSnapshotsTable; }
62
63
  });
63
64
  //# sourceMappingURL=index.cjs.map
64
65
  //# sourceMappingURL=index.cjs.map
@@ -1,3 +1,3 @@
1
1
  export { mastraStorage } from './storage.js';
2
- export { mastraThreadsTable, mastraMessagesTable, mastraResourcesTable, mastraWorkflowSnapshotsTable, mastraScoresTable, mastraVectorIndexesTable, mastraVectorsTable, mastraDocumentsTable, TABLE_WORKFLOW_SNAPSHOT, TABLE_MESSAGES, TABLE_THREADS, TABLE_RESOURCES, TABLE_SCORERS, } from './schema.js';
2
+ export { mastraThreadsTable, mastraMessagesTable, mastraResourcesTable, mastraWorkflowSnapshotsTable, mastraScoresTable, mastraVectorIndexesTable, mastraVectorsTable, mastraDocumentsTable, TABLE_WORKFLOW_SNAPSHOT, TABLE_MESSAGES, TABLE_THREADS, TABLE_RESOURCES, TABLE_SCORERS, } from '../schema.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAEL,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,4BAA4B,EAC5B,iBAAiB,EACjB,wBAAwB,EACxB,kBAAkB,EAClB,oBAAoB,EAEpB,uBAAuB,EACvB,cAAc,EACd,aAAa,EACb,eAAe,EACf,aAAa,GACd,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAI1C,OAAO,EAEL,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,4BAA4B,EAC5B,iBAAiB,EACjB,wBAAwB,EACxB,kBAAkB,EAClB,oBAAoB,EAEpB,uBAAuB,EACvB,cAAc,EACd,aAAa,EACb,eAAe,EACf,aAAa,GACd,MAAM,WAAW,CAAC"}
@@ -1,3 +1,4 @@
1
- export { TABLE_MESSAGES, TABLE_RESOURCES, TABLE_SCORERS, TABLE_THREADS, TABLE_WORKFLOW_SNAPSHOT, mastraDocumentsTable, mastraMessagesTable, mastraResourcesTable, mastraScoresTable, mastraStorage, mastraThreadsTable, mastraVectorIndexesTable, mastraVectorsTable, mastraWorkflowSnapshotsTable } from '../chunk-NZCHEPNU.js';
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-G5FLGAPE.js';
2
3
  //# sourceMappingURL=index.js.map
3
4
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,66 @@
1
+ import { MastraBase } from '@mastra/core/base';
2
+ import type { StorageColumn, TABLE_NAMES } from '@mastra/core/storage';
3
+ import { ConvexAdminClient } from '../client.js';
4
+ import type { EqualityFilter } from '../types.js';
5
+ /**
6
+ * Configuration for standalone domain usage.
7
+ * Accepts either:
8
+ * 1. An existing ConvexAdminClient
9
+ * 2. Config to create a new client internally
10
+ */
11
+ export type ConvexDomainConfig = ConvexDomainClientConfig | ConvexDomainRestConfig;
12
+ /**
13
+ * Pass an existing ConvexAdminClient
14
+ */
15
+ export interface ConvexDomainClientConfig {
16
+ client: ConvexAdminClient;
17
+ }
18
+ /**
19
+ * Pass config to create a new ConvexAdminClient internally
20
+ */
21
+ export interface ConvexDomainRestConfig {
22
+ deploymentUrl: string;
23
+ adminAuthToken: string;
24
+ storageFunction?: string;
25
+ }
26
+ /**
27
+ * Resolves ConvexDomainConfig to a ConvexAdminClient.
28
+ * Handles creating a new client if config is provided.
29
+ */
30
+ export declare function resolveConvexConfig(config: ConvexDomainConfig): ConvexAdminClient;
31
+ export declare class ConvexDB extends MastraBase {
32
+ private readonly client;
33
+ constructor(client: ConvexAdminClient);
34
+ hasColumn(_table: string, _column: string): Promise<boolean>;
35
+ createTable({ tableName, schema: _schema, }: {
36
+ tableName: TABLE_NAMES;
37
+ schema: Record<string, StorageColumn>;
38
+ }): Promise<void>;
39
+ alterTable({ tableName, schema: _schema, ifNotExists: _ifNotExists, }: {
40
+ tableName: TABLE_NAMES;
41
+ schema: Record<string, StorageColumn>;
42
+ ifNotExists: string[];
43
+ }): Promise<void>;
44
+ clearTable({ tableName }: {
45
+ tableName: TABLE_NAMES;
46
+ }): Promise<void>;
47
+ dropTable({ tableName }: {
48
+ tableName: TABLE_NAMES;
49
+ }): Promise<void>;
50
+ insert({ tableName, record }: {
51
+ tableName: TABLE_NAMES;
52
+ record: Record<string, any>;
53
+ }): Promise<void>;
54
+ batchInsert({ tableName, records }: {
55
+ tableName: TABLE_NAMES;
56
+ records: Record<string, any>[];
57
+ }): Promise<void>;
58
+ load<R>({ tableName, keys }: {
59
+ tableName: TABLE_NAMES;
60
+ keys: Record<string, any>;
61
+ }): Promise<R | null>;
62
+ queryTable<R>(tableName: TABLE_NAMES, filters?: EqualityFilter[]): Promise<R[]>;
63
+ deleteMany(tableName: TABLE_NAMES, ids: string[]): Promise<void>;
64
+ private normalizeRecord;
65
+ }
66
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/db/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,MAAM,kBA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AAE,EAAE;QAAE,SAAS,EAAE,WAAW,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAQrG,WAAW,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;QAAE,SAAS,EAAE,WAAW,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAU9G,IAAI,CAAC,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE;QAAE,SAAS,EAAE,WAAW,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAU/F,UAAU,CAAC,CAAC,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IAQ/E,UAAU,CAAC,SAAS,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAS7E,OAAO,CAAC,eAAe;CAqBxB"}
@@ -1,11 +1,13 @@
1
1
  import type { MastraMessageContentV2 } from '@mastra/core/agent';
2
2
  import type { MastraDBMessage, StorageThreadType } from '@mastra/core/memory';
3
3
  import { MemoryStorage } from '@mastra/core/storage';
4
- import type { StorageListMessagesInput, StorageListMessagesOutput, StorageListThreadsByResourceIdInput, StorageListThreadsByResourceIdOutput, StorageResourceType } from '@mastra/core/storage';
5
- import type { StoreOperationsConvex } from '../operations.js';
4
+ import type { StorageListMessagesInput, StorageListMessagesOutput, StorageListThreadsInput, StorageListThreadsOutput, StorageResourceType } from '@mastra/core/storage';
5
+ import type { ConvexDomainConfig } from '../../db/index.js';
6
6
  export declare class MemoryConvex extends MemoryStorage {
7
- private readonly operations;
8
- constructor(operations: StoreOperationsConvex);
7
+ #private;
8
+ constructor(config: ConvexDomainConfig);
9
+ init(): Promise<void>;
10
+ dangerouslyClearAll(): Promise<void>;
9
11
  getThreadById({ threadId }: {
10
12
  threadId: string;
11
13
  }): Promise<StorageThreadType | null>;
@@ -20,7 +22,7 @@ export declare class MemoryConvex extends MemoryStorage {
20
22
  deleteThread({ threadId }: {
21
23
  threadId: string;
22
24
  }): Promise<void>;
23
- listThreadsByResourceId(args: StorageListThreadsByResourceIdInput): Promise<StorageListThreadsByResourceIdOutput>;
25
+ listThreads(args: StorageListThreadsInput): Promise<StorageListThreadsOutput>;
24
26
  listMessages(args: StorageListMessagesInput): Promise<StorageListMessagesOutput>;
25
27
  listMessagesById({ messageIds }: {
26
28
  messageIds: string[];
@@ -56,4 +58,4 @@ export declare class MemoryConvex extends MemoryStorage {
56
58
  private parseStoredMessage;
57
59
  private addContextMessages;
58
60
  }
59
- //# sourceMappingURL=memory.d.ts.map
61
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/memory/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAEL,aAAa,EAQd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,wBAAwB,EACxB,yBAAyB,EACzB,uBAAuB,EACvB,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAYnD,qBAAa,YAAa,SAAQ,aAAa;;gBAEjC,MAAM,EAAE,kBAAkB;IAMhC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC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AAC,EAAE,sBAAsB,CAAC,UAAU,CAAC,CAAC;gBAAC,OAAO,CAAC,EAAE,sBAAsB,CAAC,SAAS,CAAC,CAAA;aAAE,CAAC;SAC1G,CAAC,EAAE,CAAC;KACN,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAoExB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAInD,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE;QAAE,QAAQ,EAAE,mBAAmB,CAAA;KAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAiB3F,eAAe,CAAC,EAAE,UAAU,EAAE,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAiB5F,cAAc,CAAC,EACnB,UAAU,EACV,aAAa,EACb,QAAQ,GACT,EAAE;QACD,UAAU,EAAE,MAAM,CAAC;QACnB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACpC,GAAG,OAAO,CAAC,mBAAmB,CAAC;IA4BhC,OAAO,CAAC,kBAAkB;YAaZ,kBAAkB;CA0CjC"}
@@ -1,10 +1,12 @@
1
- import type { SaveScorePayload, ScoreRowData, ScoringEntityType, ScoringSource } from '@mastra/core/evals';
1
+ import type { ListScoresResponse, SaveScorePayload, ScoreRowData, ScoringEntityType, ScoringSource } from '@mastra/core/evals';
2
2
  import { ScoresStorage } from '@mastra/core/storage';
3
- import type { PaginationInfo, StoragePagination } from '@mastra/core/storage';
4
- import type { StoreOperationsConvex } from '../operations.js';
3
+ import type { StoragePagination } from '@mastra/core/storage';
4
+ import type { ConvexDomainConfig } from '../../db/index.js';
5
5
  export declare class ScoresConvex extends ScoresStorage {
6
- private readonly operations;
7
- constructor(operations: StoreOperationsConvex);
6
+ #private;
7
+ constructor(config: ConvexDomainConfig);
8
+ init(): Promise<void>;
9
+ dangerouslyClearAll(): Promise<void>;
8
10
  getScoreById({ id }: {
9
11
  id: string;
10
12
  }): Promise<ScoreRowData | null>;
@@ -17,26 +19,17 @@ export declare class ScoresConvex extends ScoresStorage {
17
19
  entityId?: string;
18
20
  entityType?: ScoringEntityType;
19
21
  source?: ScoringSource;
20
- }): Promise<{
21
- pagination: PaginationInfo;
22
- scores: ScoreRowData[];
23
- }>;
22
+ }): Promise<ListScoresResponse>;
24
23
  listScoresByRunId({ runId, pagination, }: {
25
24
  runId: string;
26
25
  pagination: StoragePagination;
27
- }): Promise<{
28
- pagination: PaginationInfo;
29
- scores: ScoreRowData[];
30
- }>;
26
+ }): Promise<ListScoresResponse>;
31
27
  listScoresByEntityId({ entityId, entityType, pagination, }: {
32
28
  entityId: string;
33
29
  entityType: ScoringEntityType;
34
30
  pagination: StoragePagination;
35
- }): Promise<{
36
- pagination: PaginationInfo;
37
- scores: ScoreRowData[];
38
- }>;
31
+ }): Promise<ListScoresResponse>;
39
32
  private listScores;
40
33
  private deserialize;
41
34
  }
42
- //# sourceMappingURL=scores.d.ts.map
35
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/scores/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAiB,aAAa,EAAwB,MAAM,sBAAsB,CAAC;AAC1F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAG9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAOnD,qBAAa,YAAa,SAAQ,aAAa;;gBAEjC,MAAM,EAAE,kBAAkB;IAMhC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAIpC,YAAY,CAAC,EAAE,EAAE,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAQlE,SAAS,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,YAAY,CAAA;KAAE,CAAC;IAiBpE,oBAAoB,CAAC,EACzB,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,UAAU,EACV,MAAM,GACP,EAAE;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,iBAAiB,CAAC;QAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,iBAAiB,CAAC;QAC/B,MAAM,CAAC,EAAE,aAAa,CAAC;KACxB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAOzB,iBAAiB,CAAC,EACtB,KAAK,EACL,UAAU,GACX,EAAE;QACD,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,iBAAiB,CAAC;KAC/B,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAOzB,oBAAoB,CAAC,EACzB,QAAQ,EACR,UAAU,EACV,UAAU,GACX,EAAE;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,iBAAiB,CAAC;QAC9B,UAAU,EAAE,iBAAiB,CAAC;KAC/B,GAAG,OAAO,CAAC,kBAAkB,CAAC;YAOjB,UAAU;IA4CxB,OAAO,CAAC,WAAW;CAOpB"}
@@ -1,10 +1,12 @@
1
1
  import { WorkflowsStorage } from '@mastra/core/storage';
2
- import type { StorageListWorkflowRunsInput, WorkflowRun, WorkflowRuns } from '@mastra/core/storage';
3
- import type { StepResult, WorkflowRunState, WorkflowRunStatus } from '@mastra/core/workflows';
4
- import type { StoreOperationsConvex } from '../operations.js';
2
+ import type { StorageListWorkflowRunsInput, WorkflowRun, WorkflowRuns, UpdateWorkflowStateOptions } from '@mastra/core/storage';
3
+ import type { StepResult, WorkflowRunState } from '@mastra/core/workflows';
4
+ import type { ConvexDomainConfig } from '../../db/index.js';
5
5
  export declare class WorkflowsConvex extends WorkflowsStorage {
6
- private readonly operations;
7
- constructor(operations: StoreOperationsConvex);
6
+ #private;
7
+ constructor(config: ConvexDomainConfig);
8
+ init(): Promise<void>;
9
+ dangerouslyClearAll(): Promise<void>;
8
10
  updateWorkflowResults({ workflowName, runId, stepId, result, requestContext, }: {
9
11
  workflowName: string;
10
12
  runId: string;
@@ -15,13 +17,7 @@ export declare class WorkflowsConvex extends WorkflowsStorage {
15
17
  updateWorkflowState({ workflowName, runId, opts, }: {
16
18
  workflowName: string;
17
19
  runId: string;
18
- opts: {
19
- status: WorkflowRunStatus;
20
- result?: StepResult<any, any, any, any>;
21
- error?: string;
22
- suspendedPaths?: Record<string, number[]>;
23
- waitingPaths?: Record<string, number[]>;
24
- };
20
+ opts: UpdateWorkflowStateOptions;
25
21
  }): Promise<WorkflowRunState | undefined>;
26
22
  persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot, }: {
27
23
  workflowName: string;
@@ -45,4 +41,4 @@ export declare class WorkflowsConvex extends WorkflowsStorage {
45
41
  private getRun;
46
42
  private ensureSnapshot;
47
43
  }
48
- //# sourceMappingURL=workflows.d.ts.map
44
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/workflows/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6C,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACnG,OAAO,KAAK,EACV,4BAA4B,EAE5B,WAAW,EACX,YAAY,EACZ,0BAA0B,EAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAQnD,qBAAa,eAAgB,SA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AiC,GAAG,OAAO,CAAC,YAAY,CAAC;IAqChF,kBAAkB,CAAC,EACvB,KAAK,EACL,YAAY,GACb,EAAE;QACD,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAezB,qBAAqB,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;YAI9F,MAAM;IAOpB,OAAO,CAAC,cAAc;CAuBvB"}
@@ -1,10 +1,20 @@
1
- import type { SaveScorePayload, ScoreRowData, ScoringEntityType, ScoringSource } from '@mastra/core/evals';
2
- import type { MastraDBMessage, StorageThreadType } from '@mastra/core/memory';
3
- import type { StorageColumn, StorageResourceType, PaginationInfo, StorageListMessagesInput, StorageListMessagesOutput, StorageListThreadsByResourceIdInput, StorageListThreadsByResourceIdOutput, StorageListWorkflowRunsInput, StoragePagination, WorkflowRun, WorkflowRuns, TABLE_NAMES } from '@mastra/core/storage';
4
- import { MastraStorage } from '@mastra/core/storage';
5
- import type { StepResult, WorkflowRunState, WorkflowRunStatus } from '@mastra/core/workflows';
1
+ import type { StorageDomains } from '@mastra/core/storage';
2
+ import { MastraCompositeStore } from '@mastra/core/storage';
6
3
  import type { ConvexAdminClientConfig } from './client.js';
7
- export type ConvexStoreConfig = ConvexAdminClientConfig & {
4
+ import { ConvexAdminClient } from './client.js';
5
+ import { MemoryConvex } from './domains/memory/index.js';
6
+ import { ScoresConvex } from './domains/scores/index.js';
7
+ import { WorkflowsConvex } from './domains/workflows/index.js';
8
+ export { MemoryConvex, ScoresConvex, WorkflowsConvex };
9
+ export type { ConvexDomainConfig } from './db/index.js';
10
+ /**
11
+ * Convex configuration type.
12
+ *
13
+ * Accepts either:
14
+ * - A pre-configured ConvexAdminClient: `{ id, client }`
15
+ * - Deployment config: `{ id, deploymentUrl, adminAuthToken, storageFunction? }`
16
+ */
17
+ export type ConvexStoreConfig = {
8
18
  id: string;
9
19
  name?: string;
10
20
  /**
@@ -27,159 +37,46 @@ export type ConvexStoreConfig = ConvexAdminClientConfig & {
27
37
  * // No auto-init, tables must already exist
28
38
  */
29
39
  disableInit?: boolean;
30
- };
31
- export declare class ConvexStore extends MastraStorage {
32
- private readonly operations;
33
- private readonly memory;
34
- private readonly workflows;
35
- private readonly scores;
40
+ } & ({
41
+ /**
42
+ * Pre-configured ConvexAdminClient.
43
+ * Use this when you need to configure the client before initialization.
44
+ *
45
+ * @example
46
+ * ```typescript
47
+ * import { ConvexAdminClient } from '@mastra/convex/storage/client';
48
+ *
49
+ * const client = new ConvexAdminClient({
50
+ * deploymentUrl: 'https://your-deployment.convex.cloud',
51
+ * adminAuthToken: 'your-token',
52
+ * storageFunction: 'custom/storage:handle',
53
+ * });
54
+ *
55
+ * const store = new ConvexStore({ id: 'my-store', client });
56
+ * ```
57
+ */
58
+ client: ConvexAdminClient;
59
+ } | ConvexAdminClientConfig);
60
+ /**
61
+ * Convex storage adapter for Mastra.
62
+ *
63
+ * Access domain-specific storage via `getStore()`:
64
+ *
65
+ * @example
66
+ * ```typescript
67
+ * const storage = new ConvexStore({ id: 'my-store', deploymentUrl: '...', adminAuthToken: '...' });
68
+ *
69
+ * // Access memory domain
70
+ * const memory = await storage.getStore('memory');
71
+ * await memory?.saveThread({ thread });
72
+ *
73
+ * // Access workflows domain
74
+ * const workflows = await storage.getStore('workflows');
75
+ * await workflows?.persistWorkflowSnapshot({ workflowName, runId, snapshot });
76
+ * ```
77
+ */
78
+ export declare class ConvexStore extends MastraCompositeStore {
79
+ stores: StorageDomains;
36
80
  constructor(config: ConvexStoreConfig);
37
- get supports(): {
38
- selectByIncludeResourceScope: boolean;
39
- resourceWorkingMemory: boolean;
40
- hasColumn: boolean;
41
- createTable: boolean;
42
- deleteMessages: boolean;
43
- observabilityInstance: boolean;
44
- listScoresBySpan: boolean;
45
- };
46
- createTable(_args: {
47
- tableName: TABLE_NAMES;
48
- schema: Record<string, StorageColumn>;
49
- }): Promise<void>;
50
- clearTable({ tableName }: {
51
- tableName: TABLE_NAMES;
52
- }): Promise<void>;
53
- dropTable({ tableName }: {
54
- tableName: TABLE_NAMES;
55
- }): Promise<void>;
56
- alterTable(_args: {
57
- tableName: TABLE_NAMES;
58
- schema: Record<string, StorageColumn>;
59
- ifNotExists: string[];
60
- }): Promise<void>;
61
- insert({ tableName, record }: {
62
- tableName: TABLE_NAMES;
63
- record: Record<string, any>;
64
- }): Promise<void>;
65
- batchInsert({ tableName, records }: {
66
- tableName: TABLE_NAMES;
67
- records: Record<string, any>[];
68
- }): Promise<void>;
69
- load<R>({ tableName, keys }: {
70
- tableName: TABLE_NAMES;
71
- keys: Record<string, any>;
72
- }): Promise<R | null>;
73
- getThreadById({ threadId }: {
74
- threadId: string;
75
- }): Promise<StorageThreadType | null>;
76
- saveThread({ thread }: {
77
- thread: StorageThreadType;
78
- }): Promise<StorageThreadType>;
79
- updateThread({ id, title, metadata, }: {
80
- id: string;
81
- title: string;
82
- metadata: Record<string, unknown>;
83
- }): Promise<StorageThreadType>;
84
- deleteThread({ threadId }: {
85
- threadId: string;
86
- }): Promise<void>;
87
- listMessages(args: StorageListMessagesInput): Promise<StorageListMessagesOutput>;
88
- listMessagesById({ messageIds }: {
89
- messageIds: string[];
90
- }): Promise<{
91
- messages: MastraDBMessage[];
92
- }>;
93
- saveMessages(args: {
94
- messages: MastraDBMessage[];
95
- }): Promise<{
96
- messages: MastraDBMessage[];
97
- }>;
98
- updateMessages({ messages, }: {
99
- messages: (Partial<Omit<MastraDBMessage, 'createdAt'>> & {
100
- id: string;
101
- })[];
102
- }): Promise<MastraDBMessage[]>;
103
- deleteMessages(messageIds: string[]): Promise<void>;
104
- listThreadsByResourceId(args: StorageListThreadsByResourceIdInput): Promise<StorageListThreadsByResourceIdOutput>;
105
- getResourceById({ resourceId }: {
106
- resourceId: string;
107
- }): Promise<StorageResourceType | null>;
108
- saveResource({ resource }: {
109
- resource: StorageResourceType;
110
- }): Promise<StorageResourceType>;
111
- updateResource({ resourceId, workingMemory, metadata, }: {
112
- resourceId: string;
113
- workingMemory?: string;
114
- metadata?: Record<string, unknown>;
115
- }): Promise<StorageResourceType>;
116
- updateWorkflowResults(params: {
117
- workflowName: string;
118
- runId: string;
119
- stepId: string;
120
- result: StepResult<any, any, any, any>;
121
- requestContext: Record<string, any>;
122
- }): Promise<Record<string, StepResult<any, any, any, any>>>;
123
- updateWorkflowState(params: {
124
- workflowName: string;
125
- runId: string;
126
- opts: {
127
- status: WorkflowRunStatus;
128
- result?: StepResult<any, any, any, any>;
129
- error?: string;
130
- suspendedPaths?: Record<string, number[]>;
131
- waitingPaths?: Record<string, number[]>;
132
- };
133
- }): Promise<WorkflowRunState | undefined>;
134
- persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot, }: {
135
- workflowName: string;
136
- runId: string;
137
- resourceId?: string | undefined;
138
- snapshot: WorkflowRunState;
139
- }): Promise<void>;
140
- loadWorkflowSnapshot({ workflowName, runId, }: {
141
- workflowName: string;
142
- runId: string;
143
- }): Promise<WorkflowRunState | null>;
144
- listWorkflowRuns(args?: StorageListWorkflowRunsInput): Promise<WorkflowRuns>;
145
- getWorkflowRunById({ runId, workflowName, }: {
146
- runId: string;
147
- workflowName?: string | undefined;
148
- }): Promise<WorkflowRun | null>;
149
- deleteWorkflowRunById({ runId, workflowName }: {
150
- runId: string;
151
- workflowName: string;
152
- }): Promise<void>;
153
- getScoreById({ id }: {
154
- id: string;
155
- }): Promise<ScoreRowData | null>;
156
- saveScore(score: SaveScorePayload): Promise<{
157
- score: ScoreRowData;
158
- }>;
159
- listScoresByScorerId({ scorerId, pagination, entityId, entityType, source, }: {
160
- scorerId: string;
161
- pagination: StoragePagination;
162
- entityId?: string | undefined;
163
- entityType?: ScoringEntityType | undefined;
164
- source?: ScoringSource | undefined;
165
- }): Promise<{
166
- pagination: PaginationInfo;
167
- scores: ScoreRowData[];
168
- }>;
169
- listScoresByRunId({ runId, pagination, }: {
170
- runId: string;
171
- pagination: StoragePagination;
172
- }): Promise<{
173
- pagination: PaginationInfo;
174
- scores: ScoreRowData[];
175
- }>;
176
- listScoresByEntityId({ entityId, entityType, pagination, }: {
177
- pagination: StoragePagination;
178
- entityId: string;
179
- entityType: ScoringEntityType;
180
- }): Promise<{
181
- pagination: PaginationInfo;
182
- scores: ScoreRowData[];
183
- }>;
184
81
  }
185
82
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC3G,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,KAAK,EACV,aAAa,EACb,mBAAmB,EACnB,cAAc,EACd,wBAAwB,EACxB,yBAAyB,EACzB,mCAAmC,EACnC,oCAAoC,EACpC,4BAA4B,EAC5B,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,WAAW,EACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE9F,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAOxD,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,GAAG;IACxD,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;;;;;;;;;;;;;OAkBG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,qBAAa,WAAY,SAAQ,aAAa;IAC5C,OAAO,CAAC,Q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