@mastra/upstash 1.0.0-beta.0 → 1.0.0-beta.10
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 +463 -0
- package/README.md +12 -0
- package/dist/docs/README.md +34 -0
- package/dist/docs/SKILL.md +35 -0
- package/dist/docs/SOURCE_MAP.json +6 -0
- package/dist/docs/memory/01-working-memory.md +386 -0
- package/dist/docs/rag/01-vector-databases.md +638 -0
- package/dist/docs/rag/02-retrieval.md +549 -0
- package/dist/docs/storage/01-reference.md +143 -0
- package/dist/docs/vectors/01-reference.md +233 -0
- package/dist/index.cjs +797 -522
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +788 -516
- package/dist/index.js.map +1 -1
- package/dist/storage/db/index.d.ts +47 -0
- package/dist/storage/db/index.d.ts.map +1 -0
- package/dist/storage/domains/memory/index.d.ts +10 -8
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/scores/index.d.ts +6 -9
- package/dist/storage/domains/scores/index.d.ts.map +1 -1
- package/dist/storage/domains/utils.d.ts +0 -2
- package/dist/storage/domains/utils.d.ts.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts +16 -19
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +76 -167
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/vector/index.d.ts +18 -9
- package/dist/vector/index.d.ts.map +1 -1
- package/dist/vector/types.d.ts +15 -3
- package/dist/vector/types.d.ts.map +1 -1
- package/package.json +11 -9
- package/dist/storage/domains/operations/index.d.ts +0 -40
- package/dist/storage/domains/operations/index.d.ts.map +0 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { TABLE_NAMES } from '@mastra/core/storage';
|
|
2
|
+
import { Redis } from '@upstash/redis';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for standalone domain usage.
|
|
5
|
+
* Accepts either:
|
|
6
|
+
* 1. An existing Redis client
|
|
7
|
+
* 2. Config to create a new client internally
|
|
8
|
+
*/
|
|
9
|
+
export type UpstashDomainConfig = UpstashDomainClientConfig | UpstashDomainRestConfig;
|
|
10
|
+
/**
|
|
11
|
+
* Pass an existing Redis client
|
|
12
|
+
*/
|
|
13
|
+
export interface UpstashDomainClientConfig {
|
|
14
|
+
client: Redis;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Pass config to create a new Redis client internally
|
|
18
|
+
*/
|
|
19
|
+
export interface UpstashDomainRestConfig {
|
|
20
|
+
url: string;
|
|
21
|
+
token: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Resolves UpstashDomainConfig to a Redis client.
|
|
25
|
+
* Handles creating a new Redis client if url/token are provided.
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolveUpstashConfig(config: UpstashDomainConfig): Redis;
|
|
28
|
+
export declare class UpstashDB {
|
|
29
|
+
private client;
|
|
30
|
+
constructor({ client }: {
|
|
31
|
+
client: Redis;
|
|
32
|
+
});
|
|
33
|
+
insert({ tableName, record }: {
|
|
34
|
+
tableName: TABLE_NAMES;
|
|
35
|
+
record: Record<string, any>;
|
|
36
|
+
}): Promise<void>;
|
|
37
|
+
get<R>({ tableName, keys }: {
|
|
38
|
+
tableName: TABLE_NAMES;
|
|
39
|
+
keys: Record<string, string>;
|
|
40
|
+
}): Promise<R | null>;
|
|
41
|
+
scanAndDelete(pattern: string, batchSize?: number): Promise<number>;
|
|
42
|
+
scanKeys(pattern: string, batchSize?: number): Promise<string[]>;
|
|
43
|
+
deleteData({ tableName }: {
|
|
44
|
+
tableName: TABLE_NAMES;
|
|
45
|
+
}): Promise<void>;
|
|
46
|
+
}
|
|
47
|
+
//# 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,KAAK,EAAE,WAAW,EAAE,MAA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@
|
|
|
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 { StorageResourceType, StorageListMessagesInput, StorageListMessagesOutput, StorageListThreadsByResourceIdInput, StorageListThreadsByResourceIdOutput } from '@mastra/core/storage';
|
|
5
|
-
import type {
|
|
6
|
-
import type { StoreOperationsUpstash } from '../operations/index.js';
|
|
4
|
+
import type { StorageResourceType, StorageListMessagesInput, StorageListMessagesOutput, StorageListThreadsByResourceIdInput, StorageListThreadsByResourceIdOutput, StorageCloneThreadInput, StorageCloneThreadOutput } from '@mastra/core/storage';
|
|
5
|
+
import type { UpstashDomainConfig } from '../../db/index.js';
|
|
7
6
|
export declare class StoreMemoryUpstash extends MemoryStorage {
|
|
7
|
+
#private;
|
|
8
8
|
private client;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
client: Redis;
|
|
12
|
-
operations: StoreOperationsUpstash;
|
|
13
|
-
});
|
|
9
|
+
constructor(config: UpstashDomainConfig);
|
|
10
|
+
dangerouslyClearAll(): Promise<void>;
|
|
14
11
|
getThreadById({ threadId }: {
|
|
15
12
|
threadId: string;
|
|
16
13
|
}): Promise<StorageThreadType | null>;
|
|
@@ -31,6 +28,10 @@ export declare class StoreMemoryUpstash extends MemoryStorage {
|
|
|
31
28
|
}): Promise<{
|
|
32
29
|
messages: MastraDBMessage[];
|
|
33
30
|
}>;
|
|
31
|
+
/**
|
|
32
|
+
* Lookup threadId for a message - tries index first (O(1)), falls back to scan (backwards compatible)
|
|
33
|
+
*/
|
|
34
|
+
private _getThreadIdForMessage;
|
|
34
35
|
private _getIncludedMessages;
|
|
35
36
|
private parseStoredMessage;
|
|
36
37
|
listMessagesById({ messageIds }: {
|
|
@@ -61,5 +62,6 @@ export declare class StoreMemoryUpstash extends MemoryStorage {
|
|
|
61
62
|
}): Promise<MastraDBMessage[]>;
|
|
62
63
|
deleteMessages(messageIds: string[]): Promise<void>;
|
|
63
64
|
private sortThreads;
|
|
65
|
+
cloneThread(args: StorageCloneThreadInput): Promise<StorageCloneThreadOutput>;
|
|
64
66
|
}
|
|
65
67
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +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,EACL,aAAa,
|
|
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,EACL,aAAa,EASd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,mCAAmC,EACnC,oCAAoC,EAGpC,uBAAuB,EACvB,wBAAwB,EAEzB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAiBpD,qBAAa,kBAAmB,SAAQ,aAAa;;IACnD,OAAO,CAAC,MAAM,CAAQ;gBAEV,MAAM,EAAE,mBAAmB;IAOjC,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAMpC,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IA8B7E,uBAAuB,CAClC,IAAI,EAAE,mCAAmC,GACxC,OAAO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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;IAkC1B,cAAc,CAAC,IAAI,EAAE;QACzB,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC,GAAG;YACvD,EAAE,EAAE,MAAM,CAAC;YACX,OAAO,CAAC,EAAE;gBAAE,QAAQ,CAAC,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;IA6JxB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAqGzD,OAAO,CAAC,WAAW;IAiBb,WAAW,CAAC,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,wBAAwB,CAAC;CA+JpF"}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import type { ScoreRowData, ScoringSource } from '@mastra/core/evals';
|
|
1
|
+
import type { SaveScorePayload, ScoreRowData, ScoringSource } from '@mastra/core/evals';
|
|
2
2
|
import { ScoresStorage } from '@mastra/core/storage';
|
|
3
3
|
import type { PaginationInfo, StoragePagination } from '@mastra/core/storage';
|
|
4
|
-
import type {
|
|
5
|
-
import type { StoreOperationsUpstash } from '../operations/index.js';
|
|
4
|
+
import type { UpstashDomainConfig } from '../../db/index.js';
|
|
6
5
|
export declare class ScoresUpstash extends ScoresStorage {
|
|
6
|
+
#private;
|
|
7
7
|
private client;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
client: Redis;
|
|
11
|
-
operations: StoreOperationsUpstash;
|
|
12
|
-
});
|
|
8
|
+
constructor(config: UpstashDomainConfig);
|
|
9
|
+
dangerouslyClearAll(): Promise<void>;
|
|
13
10
|
getScoreById({ id }: {
|
|
14
11
|
id: string;
|
|
15
12
|
}): Promise<ScoreRowData | null>;
|
|
@@ -23,7 +20,7 @@ export declare class ScoresUpstash extends ScoresStorage {
|
|
|
23
20
|
scores: ScoreRowData[];
|
|
24
21
|
pagination: PaginationInfo;
|
|
25
22
|
}>;
|
|
26
|
-
saveScore(score:
|
|
23
|
+
saveScore(score: SaveScorePayload): Promise<{
|
|
27
24
|
score: ScoreRowData;
|
|
28
25
|
}>;
|
|
29
26
|
listScoresByRunId({ runId, pagination, }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/scores/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/scores/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExF,OAAO,EAGL,aAAa,EAId,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAG9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAWpD,qBAAa,aAAc,SAAQ,aAAa;;IAC9C,OAAO,CAAC,MAAM,CAAQ;gBAGV,MAAM,EAAE,mBAAmB;IAOjC,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;IAuBlE,oBAAoB,CAAC,EACzB,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,MAAM,EACN,UAAqC,G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ra/core/storage';
|
|
2
|
-
export declare function ensureDate(value: any): Date | null;
|
|
3
|
-
export declare function parseJSON(value: any): any;
|
|
4
2
|
export declare function getKey(tableName: TABLE_NAMES, keys: Record<string, any>): string;
|
|
5
3
|
export declare function processRecord(tableName: TABLE_NAMES, record: Record<string, any>): {
|
|
6
4
|
key: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/storage/domains/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,wBAAgB,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/storage/domains/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,wBAAgB,MAAM,CAAC,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAKhF;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;;;;;;EA2BhF"}
|
|
@@ -1,39 +1,32 @@
|
|
|
1
1
|
import { WorkflowsStorage } from '@mastra/core/storage';
|
|
2
|
-
import type { StorageListWorkflowRunsInput, WorkflowRun, WorkflowRuns } from '@mastra/core/storage';
|
|
2
|
+
import type { StorageListWorkflowRunsInput, WorkflowRun, WorkflowRuns, UpdateWorkflowStateOptions } from '@mastra/core/storage';
|
|
3
3
|
import type { StepResult, WorkflowRunState } from '@mastra/core/workflows';
|
|
4
|
-
import type {
|
|
5
|
-
import type { StoreOperationsUpstash } from '../operations/index.js';
|
|
4
|
+
import type { UpstashDomainConfig } from '../../db/index.js';
|
|
6
5
|
export declare class WorkflowsUpstash extends WorkflowsStorage {
|
|
6
|
+
#private;
|
|
7
7
|
private client;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
operations: StoreOperationsUpstash;
|
|
12
|
-
});
|
|
13
|
-
updateWorkflowResults({}: {
|
|
8
|
+
constructor(config: UpstashDomainConfig);
|
|
9
|
+
dangerouslyClearAll(): Promise<void>;
|
|
10
|
+
updateWorkflowResults({ workflowName, runId, stepId, result, requestContext, }: {
|
|
14
11
|
workflowName: string;
|
|
15
12
|
runId: string;
|
|
16
13
|
stepId: string;
|
|
17
14
|
result: StepResult<any, any, any, any>;
|
|
18
15
|
requestContext: Record<string, any>;
|
|
19
16
|
}): Promise<Record<string, StepResult<any, any, any, any>>>;
|
|
20
|
-
updateWorkflowState({}: {
|
|
17
|
+
updateWorkflowState({ workflowName, runId, opts, }: {
|
|
21
18
|
workflowName: string;
|
|
22
19
|
runId: string;
|
|
23
|
-
opts:
|
|
24
|
-
status: string;
|
|
25
|
-
result?: StepResult<any, any, any, any>;
|
|
26
|
-
error?: string;
|
|
27
|
-
suspendedPaths?: Record<string, number[]>;
|
|
28
|
-
waitingPaths?: Record<string, number[]>;
|
|
29
|
-
};
|
|
20
|
+
opts: UpdateWorkflowStateOptions;
|
|
30
21
|
}): Promise<WorkflowRunState | undefined>;
|
|
31
22
|
persistWorkflowSnapshot(params: {
|
|
32
|
-
namespace
|
|
23
|
+
namespace?: string;
|
|
33
24
|
workflowName: string;
|
|
34
25
|
runId: string;
|
|
35
26
|
resourceId?: string;
|
|
36
27
|
snapshot: WorkflowRunState;
|
|
28
|
+
createdAt?: Date;
|
|
29
|
+
updatedAt?: Date;
|
|
37
30
|
}): Promise<void>;
|
|
38
31
|
loadWorkflowSnapshot(params: {
|
|
39
32
|
namespace: string;
|
|
@@ -44,6 +37,10 @@ export declare class WorkflowsUpstash extends WorkflowsStorage {
|
|
|
44
37
|
runId: string;
|
|
45
38
|
workflowName?: string;
|
|
46
39
|
}): Promise<WorkflowRun | null>;
|
|
47
|
-
|
|
40
|
+
deleteWorkflowRunById({ runId, workflowName }: {
|
|
41
|
+
runId: string;
|
|
42
|
+
workflowName: string;
|
|
43
|
+
}): Promise<void>;
|
|
44
|
+
listWorkflowRuns({ workflowName, fromDate, toDate, perPage, page, resourceId, status, }?: StorageListWorkflowRunsInput): Promise<WorkflowRuns>;
|
|
48
45
|
}
|
|
49
46
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/workflows/index.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/workflows/index.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,gBAAgB,EAEjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,4BAA4B,EAC5B,WAAW,EACX,YAAY,EACZ,0BAA0B,EAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAuBpD,qBAAa,gBAAiB,SAAQ,gBAAgB;;IACpD,OAAO,CAAC,MAAM,CAAQ;gBAGV,MAAM,EAAE,mBAAmB;IAOjC,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAIpC,qBAAqB,CAAC,EAC1B,YAAY,EACZ,KAAK,EACL,MAAM,EACN,MAAM,EACN,cAAc,GACf,EAAE;QACD,YAAY,EAAE,MAAM,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QACvC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KACrC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,EAAE,GAAG,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/index.d.ts
CHANGED
|
@@ -1,178 +1,87 @@
|
|
|
1
|
-
import type { MastraMessageContentV2, MastraDBMessage } from '@mastra/core/agent';
|
|
2
|
-
import type { ScoreRowData, ScoringSource } from '@mastra/core/evals';
|
|
3
|
-
import type { StorageThreadType } from '@mastra/core/memory';
|
|
4
1
|
import { MastraStorage } from '@mastra/core/storage';
|
|
5
|
-
import type {
|
|
6
|
-
import
|
|
7
|
-
|
|
2
|
+
import type { StorageDomains } from '@mastra/core/storage';
|
|
3
|
+
import { Redis } from '@upstash/redis';
|
|
4
|
+
import { StoreMemoryUpstash } from './domains/memory/index.js';
|
|
5
|
+
import { ScoresUpstash } from './domains/scores/index.js';
|
|
6
|
+
import { WorkflowsUpstash } from './domains/workflows/index.js';
|
|
7
|
+
export { StoreMemoryUpstash, ScoresUpstash, WorkflowsUpstash };
|
|
8
|
+
export type { UpstashDomainConfig } from './db/index.js';
|
|
9
|
+
/**
|
|
10
|
+
* Upstash configuration type.
|
|
11
|
+
*
|
|
12
|
+
* Accepts either:
|
|
13
|
+
* - A pre-configured Redis client: `{ id, client }`
|
|
14
|
+
* - URL/token config: `{ id, url, token }`
|
|
15
|
+
*/
|
|
16
|
+
export type UpstashConfig = {
|
|
8
17
|
id: string;
|
|
18
|
+
/**
|
|
19
|
+
* When true, automatic initialization (table creation/migrations) is disabled.
|
|
20
|
+
* This is useful for CI/CD pipelines where you want to:
|
|
21
|
+
* 1. Run migrations explicitly during deployment (not at runtime)
|
|
22
|
+
* 2. Use different credentials for schema changes vs runtime operations
|
|
23
|
+
*
|
|
24
|
+
* When disableInit is true:
|
|
25
|
+
* - The storage will not automatically create/alter tables on first use
|
|
26
|
+
* - You must call `storage.init()` explicitly in your CI/CD scripts
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* // In CI/CD script:
|
|
30
|
+
* const storage = new UpstashStore({ ...config, disableInit: false });
|
|
31
|
+
* await storage.init(); // Explicitly run migrations
|
|
32
|
+
*
|
|
33
|
+
* // In runtime application:
|
|
34
|
+
* const storage = new UpstashStore({ ...config, disableInit: true });
|
|
35
|
+
* // No auto-init, tables must already exist
|
|
36
|
+
*/
|
|
37
|
+
disableInit?: boolean;
|
|
38
|
+
} & ({
|
|
39
|
+
/**
|
|
40
|
+
* Pre-configured Upstash Redis client.
|
|
41
|
+
* Use this when you need to configure the client before initialization,
|
|
42
|
+
* e.g., to set custom retry strategies or interceptors.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* import { Redis } from '@upstash/redis';
|
|
47
|
+
*
|
|
48
|
+
* const client = new Redis({
|
|
49
|
+
* url: 'https://...',
|
|
50
|
+
* token: '...',
|
|
51
|
+
* // Custom settings
|
|
52
|
+
* retry: { retries: 5, backoff: (retryCount) => Math.exp(retryCount) * 50 },
|
|
53
|
+
* });
|
|
54
|
+
*
|
|
55
|
+
* const store = new UpstashStore({ id: 'my-store', client });
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
client: Redis;
|
|
59
|
+
} | {
|
|
9
60
|
url: string;
|
|
10
61
|
token: string;
|
|
11
|
-
}
|
|
62
|
+
});
|
|
63
|
+
/**
|
|
64
|
+
* Upstash Redis storage adapter for Mastra.
|
|
65
|
+
*
|
|
66
|
+
* Access domain-specific storage via `getStore()`:
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* const storage = new UpstashStore({ id: 'my-store', url: '...', token: '...' });
|
|
71
|
+
*
|
|
72
|
+
* // Access memory domain
|
|
73
|
+
* const memory = await storage.getStore('memory');
|
|
74
|
+
* await memory?.saveThread({ thread });
|
|
75
|
+
*
|
|
76
|
+
* // Access workflows domain
|
|
77
|
+
* const workflows = await storage.getStore('workflows');
|
|
78
|
+
* await workflows?.persistWorkflowSnapshot({ workflowName, runId, snapshot });
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
12
81
|
export declare class UpstashStore extends MastraStorage {
|
|
13
82
|
private redis;
|
|
14
83
|
stores: StorageDomains;
|
|
15
84
|
constructor(config: UpstashConfig);
|
|
16
|
-
get supports(): {
|
|
17
|
-
selectByIncludeResourceScope: boolean;
|
|
18
|
-
resourceWorkingMemory: boolean;
|
|
19
|
-
hasColumn: boolean;
|
|
20
|
-
createTable: boolean;
|
|
21
|
-
deleteMessages: boolean;
|
|
22
|
-
listScoresBySpan: boolean;
|
|
23
|
-
};
|
|
24
|
-
createTable({ tableName, schema, }: {
|
|
25
|
-
tableName: TABLE_NAMES;
|
|
26
|
-
schema: Record<string, StorageColumn>;
|
|
27
|
-
}): Promise<void>;
|
|
28
|
-
/**
|
|
29
|
-
* No-op: This backend is schemaless and does not require schema changes.
|
|
30
|
-
* @param tableName Name of the table
|
|
31
|
-
* @param schema Schema of the table
|
|
32
|
-
* @param ifNotExists Array of column names to add if they don't exist
|
|
33
|
-
*/
|
|
34
|
-
alterTable(args: {
|
|
35
|
-
tableName: TABLE_NAMES;
|
|
36
|
-
schema: Record<string, StorageColumn>;
|
|
37
|
-
ifNotExists: string[];
|
|
38
|
-
}): Promise<void>;
|
|
39
|
-
clearTable({ tableName }: {
|
|
40
|
-
tableName: TABLE_NAMES;
|
|
41
|
-
}): Promise<void>;
|
|
42
|
-
dropTable({ tableName }: {
|
|
43
|
-
tableName: TABLE_NAMES;
|
|
44
|
-
}): Promise<void>;
|
|
45
|
-
insert({ tableName, record }: {
|
|
46
|
-
tableName: TABLE_NAMES;
|
|
47
|
-
record: Record<string, any>;
|
|
48
|
-
}): Promise<void>;
|
|
49
|
-
batchInsert(input: {
|
|
50
|
-
tableName: TABLE_NAMES;
|
|
51
|
-
records: Record<string, any>[];
|
|
52
|
-
}): Promise<void>;
|
|
53
|
-
load<R>({ tableName, keys }: {
|
|
54
|
-
tableName: TABLE_NAMES;
|
|
55
|
-
keys: Record<string, string>;
|
|
56
|
-
}): Promise<R | null>;
|
|
57
|
-
getThreadById({ threadId }: {
|
|
58
|
-
threadId: string;
|
|
59
|
-
}): Promise<StorageThreadType | null>;
|
|
60
|
-
saveThread({ thread }: {
|
|
61
|
-
thread: StorageThreadType;
|
|
62
|
-
}): Promise<StorageThreadType>;
|
|
63
|
-
updateThread({ id, title, metadata, }: {
|
|
64
|
-
id: string;
|
|
65
|
-
title: string;
|
|
66
|
-
metadata: Record<string, unknown>;
|
|
67
|
-
}): Promise<StorageThreadType>;
|
|
68
|
-
deleteThread({ threadId }: {
|
|
69
|
-
threadId: string;
|
|
70
|
-
}): Promise<void>;
|
|
71
|
-
saveMessages(args: {
|
|
72
|
-
messages: MastraDBMessage[];
|
|
73
|
-
}): Promise<{
|
|
74
|
-
messages: MastraDBMessage[];
|
|
75
|
-
}>;
|
|
76
|
-
listMessagesById({ messageIds }: {
|
|
77
|
-
messageIds: string[];
|
|
78
|
-
}): Promise<{
|
|
79
|
-
messages: MastraDBMessage[];
|
|
80
|
-
}>;
|
|
81
|
-
updateWorkflowResults({ workflowName, runId, stepId, result, requestContext, }: {
|
|
82
|
-
workflowName: string;
|
|
83
|
-
runId: string;
|
|
84
|
-
stepId: string;
|
|
85
|
-
result: StepResult<any, any, any, any>;
|
|
86
|
-
requestContext: Record<string, any>;
|
|
87
|
-
}): Promise<Record<string, StepResult<any, any, any, any>>>;
|
|
88
|
-
updateWorkflowState({ workflowName, runId, opts, }: {
|
|
89
|
-
workflowName: string;
|
|
90
|
-
runId: string;
|
|
91
|
-
opts: {
|
|
92
|
-
status: string;
|
|
93
|
-
result?: StepResult<any, any, any, any>;
|
|
94
|
-
error?: string;
|
|
95
|
-
suspendedPaths?: Record<string, number[]>;
|
|
96
|
-
waitingPaths?: Record<string, number[]>;
|
|
97
|
-
};
|
|
98
|
-
}): Promise<WorkflowRunState | undefined>;
|
|
99
|
-
persistWorkflowSnapshot(params: {
|
|
100
|
-
namespace: string;
|
|
101
|
-
workflowName: string;
|
|
102
|
-
runId: string;
|
|
103
|
-
resourceId?: string;
|
|
104
|
-
snapshot: WorkflowRunState;
|
|
105
|
-
}): Promise<void>;
|
|
106
|
-
loadWorkflowSnapshot(params: {
|
|
107
|
-
namespace: string;
|
|
108
|
-
workflowName: string;
|
|
109
|
-
runId: string;
|
|
110
|
-
}): Promise<WorkflowRunState | null>;
|
|
111
|
-
listWorkflowRuns({ workflowName, fromDate, toDate, perPage, page, resourceId, }?: StorageListWorkflowRunsInput): Promise<WorkflowRuns>;
|
|
112
|
-
getWorkflowRunById({ runId, workflowName, }: {
|
|
113
|
-
runId: string;
|
|
114
|
-
workflowName?: string;
|
|
115
|
-
}): Promise<WorkflowRun | null>;
|
|
116
85
|
close(): Promise<void>;
|
|
117
|
-
updateMessages(args: {
|
|
118
|
-
messages: (Partial<Omit<MastraDBMessage, 'createdAt'>> & {
|
|
119
|
-
id: string;
|
|
120
|
-
content?: {
|
|
121
|
-
metadata?: MastraMessageContentV2['metadata'];
|
|
122
|
-
content?: MastraMessageContentV2['content'];
|
|
123
|
-
};
|
|
124
|
-
})[];
|
|
125
|
-
}): Promise<MastraDBMessage[]>;
|
|
126
|
-
deleteMessages(messageIds: string[]): Promise<void>;
|
|
127
|
-
getResourceById({ resourceId }: {
|
|
128
|
-
resourceId: string;
|
|
129
|
-
}): Promise<StorageResourceType | null>;
|
|
130
|
-
saveResource({ resource }: {
|
|
131
|
-
resource: StorageResourceType;
|
|
132
|
-
}): Promise<StorageResourceType>;
|
|
133
|
-
updateResource({ resourceId, workingMemory, metadata, }: {
|
|
134
|
-
resourceId: string;
|
|
135
|
-
workingMemory?: string;
|
|
136
|
-
metadata?: Record<string, unknown>;
|
|
137
|
-
}): Promise<StorageResourceType>;
|
|
138
|
-
getScoreById({ id: _id }: {
|
|
139
|
-
id: string;
|
|
140
|
-
}): Promise<ScoreRowData | null>;
|
|
141
|
-
saveScore(score: ScoreRowData): Promise<{
|
|
142
|
-
score: ScoreRowData;
|
|
143
|
-
}>;
|
|
144
|
-
listScoresByRunId({ runId, pagination, }: {
|
|
145
|
-
runId: string;
|
|
146
|
-
pagination: StoragePagination;
|
|
147
|
-
}): Promise<{
|
|
148
|
-
pagination: PaginationInfo;
|
|
149
|
-
scores: ScoreRowData[];
|
|
150
|
-
}>;
|
|
151
|
-
listScoresByEntityId({ entityId, entityType, pagination, }: {
|
|
152
|
-
pagination: StoragePagination;
|
|
153
|
-
entityId: string;
|
|
154
|
-
entityType: string;
|
|
155
|
-
}): Promise<{
|
|
156
|
-
pagination: PaginationInfo;
|
|
157
|
-
scores: ScoreRowData[];
|
|
158
|
-
}>;
|
|
159
|
-
listScoresByScorerId({ scorerId, pagination, entityId, entityType, source, }: {
|
|
160
|
-
scorerId: string;
|
|
161
|
-
pagination: StoragePagination;
|
|
162
|
-
entityId?: string;
|
|
163
|
-
entityType?: string;
|
|
164
|
-
source?: ScoringSource;
|
|
165
|
-
}): Promise<{
|
|
166
|
-
pagination: PaginationInfo;
|
|
167
|
-
scores: ScoreRowData[];
|
|
168
|
-
}>;
|
|
169
|
-
listScoresBySpan({ traceId, spanId, pagination, }: {
|
|
170
|
-
traceId: string;
|
|
171
|
-
spanId: string;
|
|
172
|
-
pagination: StoragePagination;
|
|
173
|
-
}): Promise<{
|
|
174
|
-
pagination: PaginationInfo;
|
|
175
|
-
scores: ScoreRowData[];
|
|
176
|
-
}>;
|
|
177
86
|
}
|
|
178
87
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAGvD,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,gBAAgB,EAAE,CAAC;AAC/D,YAAY,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAEhD;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX;;;;;;;;;;;;;;;;;;OAkBG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GAAG,CACA;IACE;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAAM,EAAE,KAAK,CAAC;CACf,GACD;IACE,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CACJ,CAAC;AASF;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,YAAa,SAAQ,aAAa;IAC7C,OAAO,CAAC,KAAK,CAAQ;IACrB,MAAM,EAAE,cAAc,CAAC;gBAEX,MAAM,EAAE,aAAa;IAiC3B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
|
package/dist/vector/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MastraVector } from '@mastra/core/vector';
|
|
2
|
-
import type { CreateIndexParams, DeleteIndexParams, DeleteVectorParams, DescribeIndexParams, IndexStats, QueryResult } from '@mastra/core/vector';
|
|
2
|
+
import type { CreateIndexParams, DeleteIndexParams, DeleteVectorParams, DescribeIndexParams, IndexStats, QueryResult, DeleteVectorsParams, UpdateVectorParams } from '@mastra/core/vector';
|
|
3
3
|
import type { UpstashVectorFilter } from './filter.js';
|
|
4
|
-
import type { UpstashUpsertVectorParams, UpstashQueryVectorParams
|
|
4
|
+
import type { UpstashUpsertVectorParams, UpstashQueryVectorParams } from './types.js';
|
|
5
5
|
export declare class UpstashVector extends MastraVector<UpstashVectorFilter> {
|
|
6
6
|
private client;
|
|
7
7
|
/**
|
|
@@ -60,16 +60,16 @@ export declare class UpstashVector extends MastraVector<UpstashVectorFilter> {
|
|
|
60
60
|
*/
|
|
61
61
|
deleteIndex({ indexName: namespace }: DeleteIndexParams): Promise<void>;
|
|
62
62
|
/**
|
|
63
|
-
* Updates a vector by its ID
|
|
64
|
-
* @param
|
|
65
|
-
* @param
|
|
66
|
-
* @param
|
|
67
|
-
* @param
|
|
68
|
-
* @param update
|
|
63
|
+
* Updates a vector by its ID or multiple vectors matching a filter.
|
|
64
|
+
* @param params - Parameters containing the id or filter for targeting the vector(s) to update
|
|
65
|
+
* @param params.indexName - The name of the namespace containing the vector.
|
|
66
|
+
* @param params.id - The ID of the vector to update (mutually exclusive with filter).
|
|
67
|
+
* @param params.filter - Filter to match multiple vectors to update (mutually exclusive with id).
|
|
68
|
+
* @param params.update - An object containing the vector and/or metadata to update.
|
|
69
69
|
* @returns A promise that resolves when the update is complete.
|
|
70
70
|
* @throws Will throw an error if no updates are provided or if the update operation fails.
|
|
71
71
|
*/
|
|
72
|
-
updateVector(
|
|
72
|
+
updateVector(params: UpdateVectorParams<UpstashVectorFilter>): Promise<void>;
|
|
73
73
|
/**
|
|
74
74
|
* Deletes a vector by its ID.
|
|
75
75
|
* @param indexName - The name of the namespace containing the vector.
|
|
@@ -78,5 +78,14 @@ export declare class UpstashVector extends MastraVector<UpstashVectorFilter> {
|
|
|
78
78
|
* @throws Will throw an error if the deletion operation fails.
|
|
79
79
|
*/
|
|
80
80
|
deleteVector({ indexName: namespace, id }: DeleteVectorParams): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Deletes multiple vectors by IDs or filter.
|
|
83
|
+
* @param indexName - The name of the namespace containing the vectors.
|
|
84
|
+
* @param ids - Array of vector IDs to delete (mutually exclusive with filter).
|
|
85
|
+
* @param filter - Filter to match vectors to delete (mutually exclusive with ids).
|
|
86
|
+
* @returns A promise that resolves when the deletion is complete.
|
|
87
|
+
* @throws Will throw an error if both ids and filter are provided, or if neither is provided.
|
|
88
|
+
*/
|
|
89
|
+
deleteVectors({ indexName: namespace, filter, ids }: DeleteVectorsParams<UpstashVectorFilter>): Promise<void>;
|
|
81
90
|
}
|
|
82
91
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vector/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vector/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,qBAAqB,CAAC;AAI7B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,EAAE,yBAAyB,EAAE,wBAAwB,EAA6B,MAAM,SAAS,CAAC;AAE9G,qBAAa,aAAc,SAAQ,YAAY,CAAC,mBAAmB,CAAC;IAClE,OAAO,CAAC,MAAM,CAAQ;IAEtB;;;;;;OAMG;gBACS,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE;IAQ/E;;;;OAIG;IACG,MAAM,CAAC,EACX,SAAS,EAAE,SAAS,EACpB,OAAO,EACP,QAAQ,EACR,GAAG,EACH,aAAa,GACd,EAAE,yBAAyB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IA4BhD;;;;OAIG;IACH,eAAe,CAAC,MAAM,CAAC,EAAE,mBAAmB;IAK5C;;;;OAIG;IACG,WAAW,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAI5D;;;;OAIG;IACG,KAAK,CAAC,EACV,SAAS,EAAE,SAAS,EACpB,WAAW,EACX,IAAS,EACT,MAAM,EACN,aAAqB,EACrB,YAAY,EACZ,eAAe,EACf,SAAS,GACV,EAAE,wBAAwB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAoCpD;;;OAGG;IACG,WAAW,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAgBtC;;;;;OAKG;IACG,aAAa,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC;IAsBvF;;;;OAIG;IACG,WAAW,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAsB7E;;;;;;;;;OASG;IACG,YAAY,CAAC,MAAM,EAAE,kBAAkB,CAAC,mBAAmB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAsJlF;;;;;;OAMG;IACG,YAAY,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBnF;;;;;;;OAOG;IACG,aAAa,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,mBAAmB,CAAC,mBAAmB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CA6FpH"}
|
package/dist/vector/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UpsertVectorParams, QueryVectorParams
|
|
1
|
+
import type { UpsertVectorParams, QueryVectorParams } from '@mastra/core/vector';
|
|
2
2
|
import type { FusionAlgorithm, QueryMode } from '@upstash/vector';
|
|
3
3
|
import type { UpstashVectorFilter } from './filter.js';
|
|
4
4
|
export interface UpstashSparseVector {
|
|
@@ -13,11 +13,23 @@ export interface UpstashQueryVectorParams extends QueryVectorParams<UpstashVecto
|
|
|
13
13
|
fusionAlgorithm?: FusionAlgorithm;
|
|
14
14
|
queryMode?: QueryMode;
|
|
15
15
|
}
|
|
16
|
-
export
|
|
16
|
+
export type UpstashUpdateVectorParams = {
|
|
17
|
+
indexName: string;
|
|
18
|
+
id: string;
|
|
19
|
+
filter?: never;
|
|
17
20
|
update: {
|
|
18
21
|
vector?: number[];
|
|
19
22
|
metadata?: Record<string, any>;
|
|
20
23
|
sparseVector?: UpstashSparseVector;
|
|
21
24
|
};
|
|
22
|
-
}
|
|
25
|
+
} | {
|
|
26
|
+
indexName: string;
|
|
27
|
+
id?: never;
|
|
28
|
+
filter: UpstashVectorFilter;
|
|
29
|
+
update: {
|
|
30
|
+
vector?: number[];
|
|
31
|
+
metadata?: Record<string, any>;
|
|
32
|
+
sparseVector?: UpstashSparseVector;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
23
35
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/vector/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/vector/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,yBAA0B,SAAQ,kBAAkB;IACnE,aAAa,CAAC,EAAE,mBAAmB,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB,CAAC,mBAAmB,CAAC;IACt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