@mastra/pg 1.0.0-beta.8 → 1.0.0
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 +1638 -0
- package/dist/docs/README.md +36 -0
- package/dist/docs/SKILL.md +37 -0
- package/dist/docs/SOURCE_MAP.json +6 -0
- package/dist/docs/memory/01-storage.md +233 -0
- package/dist/docs/memory/02-working-memory.md +390 -0
- package/dist/docs/memory/03-semantic-recall.md +233 -0
- package/dist/docs/memory/04-reference.md +133 -0
- package/dist/docs/processors/01-reference.md +297 -0
- package/dist/docs/rag/01-overview.md +74 -0
- package/dist/docs/rag/02-vector-databases.md +643 -0
- package/dist/docs/rag/03-retrieval.md +548 -0
- package/dist/docs/rag/04-reference.md +369 -0
- package/dist/docs/storage/01-reference.md +828 -0
- package/dist/docs/tools/01-reference.md +440 -0
- package/dist/docs/vectors/01-reference.md +307 -0
- package/dist/index.cjs +3253 -2225
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3250 -2227
- package/dist/index.js.map +1 -1
- package/dist/shared/config.d.ts +102 -32
- package/dist/shared/config.d.ts.map +1 -1
- package/dist/storage/client.d.ts +91 -0
- package/dist/storage/client.d.ts.map +1 -0
- package/dist/storage/db/index.d.ts +216 -0
- package/dist/storage/db/index.d.ts.map +1 -0
- package/dist/storage/domains/agents/index.d.ts +22 -8
- package/dist/storage/domains/agents/index.d.ts.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +32 -12
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/observability/index.d.ts +52 -36
- package/dist/storage/domains/observability/index.d.ts.map +1 -1
- package/dist/storage/domains/scores/index.d.ts +25 -28
- package/dist/storage/domains/scores/index.d.ts.map +1 -1
- package/dist/storage/domains/utils.d.ts +1 -5
- package/dist/storage/domains/utils.d.ts.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts +26 -12
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +52 -195
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/performance-indexes/performance-test.d.ts +3 -1
- package/dist/storage/performance-indexes/performance-test.d.ts.map +1 -1
- package/dist/storage/test-utils.d.ts.map +1 -1
- package/dist/vector/index.d.ts.map +1 -1
- package/dist/vector/sql-builder.d.ts.map +1 -1
- package/package.json +11 -11
- package/dist/storage/domains/operations/index.d.ts +0 -119
- package/dist/storage/domains/operations/index.d.ts.map +0 -1
|
@@ -1,44 +1,60 @@
|
|
|
1
|
-
import type { TracingStorageStrategy } from '@mastra/core/observability';
|
|
2
1
|
import { ObservabilityStorage } from '@mastra/core/storage';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type { StoreOperationsPG } from '../operations/index.js';
|
|
2
|
+
import type { TracingStorageStrategy, ListTracesArgs, UpdateSpanArgs, BatchDeleteTracesArgs, BatchUpdateSpansArgs, BatchCreateSpansArgs, CreateSpanArgs, GetSpanArgs, GetSpanResponse, GetRootSpanArgs, GetRootSpanResponse, GetTraceArgs, GetTraceResponse, ListTracesResponse, CreateIndexOptions } from '@mastra/core/storage';
|
|
3
|
+
import type { PgDomainConfig } from '../../db/index.js';
|
|
6
4
|
export declare class ObservabilityPG extends ObservabilityStorage {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
constructor(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
#private;
|
|
6
|
+
/** Tables managed by this domain */
|
|
7
|
+
static readonly MANAGED_TABLES: readonly ["mastra_ai_spans"];
|
|
8
|
+
constructor(config: PgDomainConfig);
|
|
9
|
+
init(): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* Returns default index definitions for the observability domain tables.
|
|
12
|
+
*/
|
|
13
|
+
getDefaultIndexDefinitions(): CreateIndexOptions[];
|
|
14
|
+
/**
|
|
15
|
+
* Creates default indexes for optimal query performance.
|
|
16
|
+
*/
|
|
17
|
+
createDefaultIndexes(): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Creates custom user-defined indexes for this domain's tables.
|
|
20
|
+
*/
|
|
21
|
+
createCustomIndexes(): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Manually run the spans migration to deduplicate and add the unique constraint.
|
|
24
|
+
* This is intended to be called from the CLI when duplicates are detected.
|
|
25
|
+
*
|
|
26
|
+
* @returns Migration result with status and details
|
|
27
|
+
*/
|
|
28
|
+
migrateSpans(): Promise<{
|
|
29
|
+
success: boolean;
|
|
30
|
+
alreadyMigrated: boolean;
|
|
31
|
+
duplicatesRemoved: number;
|
|
32
|
+
message: string;
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* Check migration status for the spans table.
|
|
36
|
+
* Returns information about whether migration is needed.
|
|
37
|
+
*/
|
|
38
|
+
checkSpansMigrationStatus(): Promise<{
|
|
39
|
+
needsMigration: boolean;
|
|
40
|
+
hasDuplicates: boolean;
|
|
41
|
+
duplicateCount: number;
|
|
42
|
+
constraintExists: boolean;
|
|
43
|
+
tableName: string;
|
|
44
|
+
}>;
|
|
45
|
+
dangerouslyClearAll(): Promise<void>;
|
|
15
46
|
get tracingStrategy(): {
|
|
16
47
|
preferred: TracingStorageStrategy;
|
|
17
48
|
supported: TracingStorageStrategy[];
|
|
18
49
|
};
|
|
19
|
-
createSpan(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
spans: SpanRecord[];
|
|
29
|
-
}>;
|
|
30
|
-
batchCreateSpans(args: {
|
|
31
|
-
records: CreateSpanRecord[];
|
|
32
|
-
}): Promise<void>;
|
|
33
|
-
batchUpdateSpans(args: {
|
|
34
|
-
records: {
|
|
35
|
-
traceId: string;
|
|
36
|
-
spanId: string;
|
|
37
|
-
updates: Partial<UpdateSpanRecord>;
|
|
38
|
-
}[];
|
|
39
|
-
}): Promise<void>;
|
|
40
|
-
batchDeleteTraces(args: {
|
|
41
|
-
traceIds: string[];
|
|
42
|
-
}): Promise<void>;
|
|
50
|
+
createSpan(args: CreateSpanArgs): Promise<void>;
|
|
51
|
+
getSpan(args: GetSpanArgs): Promise<GetSpanResponse | null>;
|
|
52
|
+
getRootSpan(args: GetRootSpanArgs): Promise<GetRootSpanResponse | null>;
|
|
53
|
+
getTrace(args: GetTraceArgs): Promise<GetTraceResponse | null>;
|
|
54
|
+
updateSpan(args: UpdateSpanArgs): Promise<void>;
|
|
55
|
+
listTraces(args: ListTracesArgs): Promise<ListTracesResponse>;
|
|
56
|
+
batchCreateSpans(args: BatchCreateSpansArgs): Promise<void>;
|
|
57
|
+
batchUpdateSpans(args: BatchUpdateSpansArgs): Promise<void>;
|
|
58
|
+
batchDeleteTraces(args: BatchDeleteTracesArgs): Promise<void>;
|
|
43
59
|
}
|
|
44
60
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/observability/index.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/observability/index.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,oBAAoB,EAIrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAEV,sBAAsB,EACtB,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/C,qBAAa,eAAgB,SAAQ,oBAAoB;;IAMvD,oCAAoC;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AAI,EAAE,cAAc,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAsO7D,gBAAgB,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IA+B3D,gBAAgB,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAmC3D,iBAAiB,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;CAoBpE"}
|
|
@@ -1,17 +1,26 @@
|
|
|
1
|
-
import type { SaveScorePayload, ScoreRowData, ScoringSource } from '@mastra/core/evals';
|
|
2
|
-
import type {
|
|
1
|
+
import type { ListScoresResponse, SaveScorePayload, ScoreRowData, ScoringSource } from '@mastra/core/evals';
|
|
2
|
+
import type { StoragePagination, CreateIndexOptions } from '@mastra/core/storage';
|
|
3
3
|
import { ScoresStorage } from '@mastra/core/storage';
|
|
4
|
-
import type {
|
|
5
|
-
import type { StoreOperationsPG } from '../operations/index.js';
|
|
4
|
+
import type { PgDomainConfig } from '../../db/index.js';
|
|
6
5
|
export declare class ScoresPG extends ScoresStorage {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
constructor(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
#private;
|
|
7
|
+
/** Tables managed by this domain */
|
|
8
|
+
static readonly MANAGED_TABLES: readonly ["mastra_scorers"];
|
|
9
|
+
constructor(config: PgDomainConfig);
|
|
10
|
+
init(): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Returns default index definitions for the scores domain tables.
|
|
13
|
+
*/
|
|
14
|
+
getDefaultIndexDefinitions(): CreateIndexOptions[];
|
|
15
|
+
/**
|
|
16
|
+
* Creates default indexes for optimal query performance.
|
|
17
|
+
*/
|
|
18
|
+
createDefaultIndexes(): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Creates custom user-defined indexes for this domain's tables.
|
|
21
|
+
*/
|
|
22
|
+
createCustomIndexes(): Promise<void>;
|
|
23
|
+
dangerouslyClearAll(): Promise<void>;
|
|
15
24
|
getScoreById({ id }: {
|
|
16
25
|
id: string;
|
|
17
26
|
}): Promise<ScoreRowData | null>;
|
|
@@ -21,35 +30,23 @@ export declare class ScoresPG extends ScoresStorage {
|
|
|
21
30
|
entityId?: string;
|
|
22
31
|
entityType?: string;
|
|
23
32
|
source?: ScoringSource;
|
|
24
|
-
}): Promise<
|
|
25
|
-
pagination: PaginationInfo;
|
|
26
|
-
scores: ScoreRowData[];
|
|
27
|
-
}>;
|
|
33
|
+
}): Promise<ListScoresResponse>;
|
|
28
34
|
saveScore(score: SaveScorePayload): Promise<{
|
|
29
35
|
score: ScoreRowData;
|
|
30
36
|
}>;
|
|
31
37
|
listScoresByRunId({ runId, pagination, }: {
|
|
32
38
|
runId: string;
|
|
33
39
|
pagination: StoragePagination;
|
|
34
|
-
}): Promise<
|
|
35
|
-
pagination: PaginationInfo;
|
|
36
|
-
scores: ScoreRowData[];
|
|
37
|
-
}>;
|
|
40
|
+
}): Promise<ListScoresResponse>;
|
|
38
41
|
listScoresByEntityId({ entityId, entityType, pagination, }: {
|
|
39
42
|
pagination: StoragePagination;
|
|
40
43
|
entityId: string;
|
|
41
44
|
entityType: string;
|
|
42
|
-
}): Promise<
|
|
43
|
-
pagination: PaginationInfo;
|
|
44
|
-
scores: ScoreRowData[];
|
|
45
|
-
}>;
|
|
45
|
+
}): Promise<ListScoresResponse>;
|
|
46
46
|
listScoresBySpan({ traceId, spanId, pagination, }: {
|
|
47
47
|
traceId: string;
|
|
48
48
|
spanId: string;
|
|
49
49
|
pagination: StoragePagination;
|
|
50
|
-
}): Promise<
|
|
51
|
-
pagination: PaginationInfo;
|
|
52
|
-
scores: ScoreRowData[];
|
|
53
|
-
}>;
|
|
50
|
+
}): Promise<ListScoresResponse>;
|
|
54
51
|
}
|
|
55
52
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/scores/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE5G,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,EAIL,aAAa,EAId,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAwB/C,qBAAa,QAAS,SAAQ,aAAa;;IAMzC,oCAAoC;IACpC,MAAM,CAAC,QAAQ,CAAC,cAAc,8BAA4B;gBAE9C,MAAM,EAAE,cAAc;IAU5B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAY3B;;OAEG;IACH,0BAA0B,IAAI,kBAAkB,EAAE;IAWlD;;OAEG;IACG,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAe3C;;OAEG;IACG,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAepC,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;IAoBlE,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,MAAM,CAAC;QACpB,MAAM,CAAC,EAAE,aAAa,CAAC;KACxB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAsEzB,SAAS,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,YAAY,CAAA;KAAE,CAAC;IAuEpE,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;IAkDzB,oBAAoB,CAAC,EACzB,QAAQ,EACR,UAAU,EACV,UAAU,GACX,EAAE;QACD,UAAU,EAAE,iBAAiB,CAAC;QAC9B,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAkDzB,gBAAgB,CAAC,EACrB,OAAO,EACP,MAAM,EACN,UAAU,GACX,EAAE;QACD,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,iBAAiB,CAAC;KAC/B,GAAG,OAAO,CAAC,kBAAkB,CAAC;CA0ChC"}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { StorageColumn, TABLE_NAMES } from '@mastra/core/storage';
|
|
2
2
|
export declare function getSchemaName(schema?: string): string | undefined;
|
|
3
3
|
export declare function getTableName({ indexName, schemaName }: {
|
|
4
4
|
indexName: string;
|
|
5
5
|
schemaName?: string;
|
|
6
6
|
}): string;
|
|
7
|
-
/**
|
|
8
|
-
* Build date range filter for queries
|
|
9
|
-
*/
|
|
10
|
-
export declare function buildDateRangeFilter(dateRange: PaginationArgs['dateRange'], fieldName: string): Record<string, any>;
|
|
11
7
|
/**
|
|
12
8
|
* Prepare WHERE clause for PostgreSQL queries
|
|
13
9
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/storage/domains/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/storage/domains/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAIvE,wBAAgB,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,sBAE5C;AAED,wBAAgB,YAAY,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,UAKjG;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC5B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,GACtC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,GAAG,EAAE,CAAA;CAAE,CA6B9B;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,EACrC,SAAS,EACT,MAAM,GACP,EAAE;IACD,SAAS,EAAE,WAAW,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC7B,GAAG,CAAC,CA+BJ"}
|
|
@@ -1,17 +1,29 @@
|
|
|
1
1
|
import { WorkflowsStorage } from '@mastra/core/storage';
|
|
2
|
-
import type { UpdateWorkflowStateOptions, StorageListWorkflowRunsInput, WorkflowRun, WorkflowRuns } from '@mastra/core/storage';
|
|
2
|
+
import type { UpdateWorkflowStateOptions, StorageListWorkflowRunsInput, WorkflowRun, WorkflowRuns, CreateIndexOptions } from '@mastra/core/storage';
|
|
3
3
|
import type { StepResult, WorkflowRunState } from '@mastra/core/workflows';
|
|
4
|
-
import type {
|
|
5
|
-
import type { StoreOperationsPG } from '../operations/index.js';
|
|
4
|
+
import type { PgDomainConfig } from '../../db/index.js';
|
|
6
5
|
export declare class WorkflowsPG extends WorkflowsStorage {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
constructor(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
#private;
|
|
7
|
+
/** Tables managed by this domain */
|
|
8
|
+
static readonly MANAGED_TABLES: readonly ["mastra_workflow_snapshot"];
|
|
9
|
+
constructor(config: PgDomainConfig);
|
|
10
|
+
private parseWorkflowRun;
|
|
11
|
+
/**
|
|
12
|
+
* Returns default index definitions for the workflows domain tables.
|
|
13
|
+
* Currently no default indexes are defined for workflows.
|
|
14
|
+
*/
|
|
15
|
+
getDefaultIndexDefinitions(): CreateIndexOptions[];
|
|
16
|
+
/**
|
|
17
|
+
* Creates default indexes for optimal query performance.
|
|
18
|
+
* Currently no default indexes are defined for workflows.
|
|
19
|
+
*/
|
|
20
|
+
createDefaultIndexes(): Promise<void>;
|
|
21
|
+
init(): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Creates custom user-defined indexes for this domain's tables.
|
|
24
|
+
*/
|
|
25
|
+
createCustomIndexes(): Promise<void>;
|
|
26
|
+
dangerouslyClearAll(): Promise<void>;
|
|
15
27
|
updateWorkflowResults({}: {
|
|
16
28
|
workflowName: string;
|
|
17
29
|
runId: string;
|
|
@@ -24,11 +36,13 @@ export declare class WorkflowsPG extends WorkflowsStorage {
|
|
|
24
36
|
runId: string;
|
|
25
37
|
opts: UpdateWorkflowStateOptions;
|
|
26
38
|
}): Promise<WorkflowRunState | undefined>;
|
|
27
|
-
persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot, }: {
|
|
39
|
+
persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot, createdAt, updatedAt, }: {
|
|
28
40
|
workflowName: string;
|
|
29
41
|
runId: string;
|
|
30
42
|
resourceId?: string;
|
|
31
43
|
snapshot: WorkflowRunState;
|
|
44
|
+
createdAt?: Date;
|
|
45
|
+
updatedAt?: Date;
|
|
32
46
|
}): Promise<void>;
|
|
33
47
|
loadWorkflowSnapshot({ workflowName, runId, }: {
|
|
34
48
|
workflowName: string;
|
|
@@ -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,0BAA0B,EAC1B,4BAA4B,EAC5B,WAAW,EACX,YAAY,EACZ,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAqB/C,qBAAa,WAAY,SAAQ,gBAAgB;;IAM/C,oCAAoC;IACpC,MAAM,CAAC,QAAQ,CAAC,cAAc,wCAAsC;gBAExD,MAAM,EAAE,cAAc;IAUlC,OAAO,CAAC,gBAAgB;IAmBxB;;;OAGG;IACH,0BAA0B,IAAI,kBAAkB,EAAE;IAIlD;;;OAGG;IACG,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAOrC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAW3B;;OAEG;IACG,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAepC,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1C,qBAAqB,CACnB,EAMC,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,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EACP,IAAI,EACJ,UAAU,EACV,MAAM,GACP,GAAE,4BAAiC,GAAG,OAAO,CAAC,YAAY,CAAC;CA6F7D"}
|
package/dist/storage/index.d.ts
CHANGED
|
@@ -1,210 +1,67 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
3
|
-
import
|
|
4
|
-
import { MastraStorage } from '@mastra/core/storage';
|
|
5
|
-
import type { PaginationInfo, StorageColumn, StorageResourceType, TABLE_NAMES, WorkflowRun, WorkflowRuns, StoragePagination, StorageDomains, SpanRecord, TraceRecord, TracesPaginatedArg, StorageListWorkflowRunsInput, UpdateWorkflowStateOptions } from '@mastra/core/storage';
|
|
6
|
-
import type { StepResult, WorkflowRunState } from '@mastra/core/workflows';
|
|
7
|
-
import pgPromise from 'pg-promise';
|
|
1
|
+
import { MastraCompositeStore } from '@mastra/core/storage';
|
|
2
|
+
import type { StorageDomains } from '@mastra/core/storage';
|
|
3
|
+
import { Pool } from 'pg';
|
|
8
4
|
import type { PostgresStoreConfig } from '../shared/config.js';
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
import type { DbClient } from './client.js';
|
|
6
|
+
import { AgentsPG } from './domains/agents/index.js';
|
|
7
|
+
import { MemoryPG } from './domains/memory/index.js';
|
|
8
|
+
import { ObservabilityPG } from './domains/observability/index.js';
|
|
9
|
+
import { ScoresPG } from './domains/scores/index.js';
|
|
10
|
+
import { WorkflowsPG } from './domains/workflows/index.js';
|
|
11
|
+
export { exportSchemas } from './db/index.js';
|
|
12
|
+
export { AgentsPG, MemoryPG, ObservabilityPG, ScoresPG, WorkflowsPG };
|
|
13
|
+
export { PoolAdapter } from './client.js';
|
|
14
|
+
export type { DbClient, TxClient, QueryValues, Pool, PoolClient, QueryResult } from './client.js';
|
|
15
|
+
export type { PgDomainConfig, PgDomainClientConfig, PgDomainPoolConfig, PgDomainRestConfig } from './db/index.js';
|
|
16
|
+
/**
|
|
17
|
+
* PostgreSQL storage adapter for Mastra.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* // Option 1: Connection string
|
|
22
|
+
* const store = new PostgresStore({
|
|
23
|
+
* id: 'my-store',
|
|
24
|
+
* connectionString: 'postgresql://...',
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* // Option 2: Pre-configured pool
|
|
28
|
+
* const pool = new Pool({ connectionString: 'postgresql://...' });
|
|
29
|
+
* const store = new PostgresStore({ id: 'my-store', pool });
|
|
30
|
+
*
|
|
31
|
+
* // Access domain storage
|
|
32
|
+
* const memory = await store.getStore('memory');
|
|
33
|
+
* await memory?.saveThread({ thread });
|
|
34
|
+
*
|
|
35
|
+
* // Execute custom queries
|
|
36
|
+
* const rows = await store.db.any('SELECT * FROM my_table');
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare class PostgresStore extends MastraCompositeStore {
|
|
11
40
|
#private;
|
|
12
41
|
private schema;
|
|
13
42
|
private isInitialized;
|
|
14
43
|
stores: StorageDomains;
|
|
15
44
|
constructor(config: PostgresStoreConfig);
|
|
45
|
+
private createPool;
|
|
16
46
|
init(): Promise<void>;
|
|
17
|
-
get db(): pgPromise.IDatabase<{}, import("pg-promise/typescript/pg-subset").IClient>;
|
|
18
|
-
get pgp(): pgPromise.IMain<{}, import("pg-promise/typescript/pg-subset").IClient>;
|
|
19
|
-
get supports(): {
|
|
20
|
-
selectByIncludeResourceScope: boolean;
|
|
21
|
-
resourceWorkingMemory: boolean;
|
|
22
|
-
hasColumn: boolean;
|
|
23
|
-
createTable: boolean;
|
|
24
|
-
deleteMessages: boolean;
|
|
25
|
-
observabilityInstance: boolean;
|
|
26
|
-
indexManagement: boolean;
|
|
27
|
-
listScoresBySpan: boolean;
|
|
28
|
-
agents: boolean;
|
|
29
|
-
};
|
|
30
|
-
createTable({ tableName, schema, }: {
|
|
31
|
-
tableName: TABLE_NAMES;
|
|
32
|
-
schema: Record<string, StorageColumn>;
|
|
33
|
-
}): Promise<void>;
|
|
34
|
-
alterTable({ tableName, schema, ifNotExists, }: {
|
|
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({ tableName, records }: {
|
|
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
47
|
/**
|
|
58
|
-
*
|
|
48
|
+
* Database client for executing queries.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* const rows = await store.db.any('SELECT * FROM users WHERE active = $1', [true]);
|
|
53
|
+
* const user = await store.db.one('SELECT * FROM users WHERE id = $1', [userId]);
|
|
54
|
+
* ```
|
|
59
55
|
*/
|
|
60
|
-
|
|
61
|
-
threadId: string;
|
|
62
|
-
}): Promise<StorageThreadType | null>;
|
|
63
|
-
saveThread({ thread }: {
|
|
64
|
-
thread: StorageThreadType;
|
|
65
|
-
}): Promise<StorageThreadType>;
|
|
66
|
-
updateThread({ id, title, metadata, }: {
|
|
67
|
-
id: string;
|
|
68
|
-
title: string;
|
|
69
|
-
metadata: Record<string, unknown>;
|
|
70
|
-
}): Promise<StorageThreadType>;
|
|
71
|
-
deleteThread({ threadId }: {
|
|
72
|
-
threadId: string;
|
|
73
|
-
}): Promise<void>;
|
|
74
|
-
listMessagesById({ messageIds }: {
|
|
75
|
-
messageIds: string[];
|
|
76
|
-
}): Promise<{
|
|
77
|
-
messages: MastraDBMessage[];
|
|
78
|
-
}>;
|
|
79
|
-
saveMessages(args: {
|
|
80
|
-
messages: MastraDBMessage[];
|
|
81
|
-
}): Promise<{
|
|
82
|
-
messages: MastraDBMessage[];
|
|
83
|
-
}>;
|
|
84
|
-
updateMessages({ messages, }: {
|
|
85
|
-
messages: (Partial<Omit<MastraDBMessage, 'createdAt'>> & {
|
|
86
|
-
id: string;
|
|
87
|
-
content?: {
|
|
88
|
-
metadata?: MastraMessageContentV2['metadata'];
|
|
89
|
-
content?: MastraMessageContentV2['content'];
|
|
90
|
-
};
|
|
91
|
-
})[];
|
|
92
|
-
}): Promise<MastraDBMessage[]>;
|
|
93
|
-
deleteMessages(messageIds: string[]): Promise<void>;
|
|
94
|
-
getResourceById({ resourceId }: {
|
|
95
|
-
resourceId: string;
|
|
96
|
-
}): Promise<StorageResourceType | null>;
|
|
97
|
-
saveResource({ resource }: {
|
|
98
|
-
resource: StorageResourceType;
|
|
99
|
-
}): Promise<StorageResourceType>;
|
|
100
|
-
updateResource({ resourceId, workingMemory, metadata, }: {
|
|
101
|
-
resourceId: string;
|
|
102
|
-
workingMemory?: string;
|
|
103
|
-
metadata?: Record<string, unknown>;
|
|
104
|
-
}): Promise<StorageResourceType>;
|
|
56
|
+
get db(): DbClient;
|
|
105
57
|
/**
|
|
106
|
-
*
|
|
58
|
+
* The underlying pg.Pool for direct database access or ORM integration.
|
|
107
59
|
*/
|
|
108
|
-
|
|
109
|
-
workflowName: string;
|
|
110
|
-
runId: string;
|
|
111
|
-
stepId: string;
|
|
112
|
-
result: StepResult<any, any, any, any>;
|
|
113
|
-
requestContext: Record<string, any>;
|
|
114
|
-
}): Promise<Record<string, StepResult<any, any, any, any>>>;
|
|
115
|
-
updateWorkflowState({ workflowName, runId, opts, }: {
|
|
116
|
-
workflowName: string;
|
|
117
|
-
runId: string;
|
|
118
|
-
opts: UpdateWorkflowStateOptions;
|
|
119
|
-
}): Promise<WorkflowRunState | undefined>;
|
|
120
|
-
persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot, }: {
|
|
121
|
-
workflowName: string;
|
|
122
|
-
runId: string;
|
|
123
|
-
resourceId?: string;
|
|
124
|
-
snapshot: WorkflowRunState;
|
|
125
|
-
}): Promise<void>;
|
|
126
|
-
loadWorkflowSnapshot({ workflowName, runId, }: {
|
|
127
|
-
workflowName: string;
|
|
128
|
-
runId: string;
|
|
129
|
-
}): Promise<WorkflowRunState | null>;
|
|
130
|
-
listWorkflowRuns(args?: StorageListWorkflowRunsInput): Promise<WorkflowRuns>;
|
|
131
|
-
getWorkflowRunById({ runId, workflowName, }: {
|
|
132
|
-
runId: string;
|
|
133
|
-
workflowName?: string;
|
|
134
|
-
}): Promise<WorkflowRun | null>;
|
|
135
|
-
deleteWorkflowRunById({ runId, workflowName }: {
|
|
136
|
-
runId: string;
|
|
137
|
-
workflowName: string;
|
|
138
|
-
}): Promise<void>;
|
|
139
|
-
close(): Promise<void>;
|
|
140
|
-
/**
|
|
141
|
-
* Tracing / Observability
|
|
142
|
-
*/
|
|
143
|
-
createSpan(span: SpanRecord): Promise<void>;
|
|
144
|
-
updateSpan({ spanId, traceId, updates, }: {
|
|
145
|
-
spanId: string;
|
|
146
|
-
traceId: string;
|
|
147
|
-
updates: Partial<Omit<SpanRecord, 'spanId' | 'traceId'>>;
|
|
148
|
-
}): Promise<void>;
|
|
149
|
-
getTrace(traceId: string): Promise<TraceRecord | null>;
|
|
150
|
-
getTracesPaginated(args: TracesPaginatedArg): Promise<{
|
|
151
|
-
pagination: PaginationInfo;
|
|
152
|
-
spans: SpanRecord[];
|
|
153
|
-
}>;
|
|
154
|
-
batchCreateSpans(args: {
|
|
155
|
-
records: SpanRecord[];
|
|
156
|
-
}): Promise<void>;
|
|
157
|
-
batchUpdateSpans(args: {
|
|
158
|
-
records: {
|
|
159
|
-
traceId: string;
|
|
160
|
-
spanId: string;
|
|
161
|
-
updates: Partial<Omit<SpanRecord, 'spanId' | 'traceId'>>;
|
|
162
|
-
}[];
|
|
163
|
-
}): Promise<void>;
|
|
164
|
-
batchDeleteTraces(args: {
|
|
165
|
-
traceIds: string[];
|
|
166
|
-
}): Promise<void>;
|
|
60
|
+
get pool(): Pool;
|
|
167
61
|
/**
|
|
168
|
-
*
|
|
62
|
+
* Closes the connection pool if it was created by this store.
|
|
63
|
+
* If a pool was passed in via config, it will not be closed.
|
|
169
64
|
*/
|
|
170
|
-
|
|
171
|
-
id: string;
|
|
172
|
-
}): Promise<ScoreRowData | null>;
|
|
173
|
-
listScoresByScorerId({ scorerId, pagination, entityId, entityType, source, }: {
|
|
174
|
-
scorerId: string;
|
|
175
|
-
pagination: StoragePagination;
|
|
176
|
-
entityId?: string;
|
|
177
|
-
entityType?: string;
|
|
178
|
-
source?: ScoringSource;
|
|
179
|
-
}): Promise<{
|
|
180
|
-
pagination: PaginationInfo;
|
|
181
|
-
scores: ScoreRowData[];
|
|
182
|
-
}>;
|
|
183
|
-
saveScore(score: SaveScorePayload): Promise<{
|
|
184
|
-
score: ScoreRowData;
|
|
185
|
-
}>;
|
|
186
|
-
listScoresByRunId({ runId, pagination, }: {
|
|
187
|
-
runId: string;
|
|
188
|
-
pagination: StoragePagination;
|
|
189
|
-
}): Promise<{
|
|
190
|
-
pagination: PaginationInfo;
|
|
191
|
-
scores: ScoreRowData[];
|
|
192
|
-
}>;
|
|
193
|
-
listScoresByEntityId({ entityId, entityType, pagination, }: {
|
|
194
|
-
pagination: StoragePagination;
|
|
195
|
-
entityId: string;
|
|
196
|
-
entityType: string;
|
|
197
|
-
}): Promise<{
|
|
198
|
-
pagination: PaginationInfo;
|
|
199
|
-
scores: ScoreRowData[];
|
|
200
|
-
}>;
|
|
201
|
-
listScoresBySpan({ traceId, spanId, pagination, }: {
|
|
202
|
-
traceId: string;
|
|
203
|
-
spanId: string;
|
|
204
|
-
pagination: StoragePagination;
|
|
205
|
-
}): Promise<{
|
|
206
|
-
pagination: PaginationInfo;
|
|
207
|
-
scores: ScoreRowData[];
|
|
208
|
-
}>;
|
|
65
|
+
close(): Promise<void>;
|
|
209
66
|
}
|
|
210
67
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAQ1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAOlD,OAAO,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAErC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC/F,YAAY,EAAE,cAAc,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAEzG;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,aAAc,SAAQ,oBAAoB;;IAIrD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,aAAa,CAAkB;IAEvC,MAAM,EAAE,cAAc,CAAC;gBAEX,MAAM,EAAE,mBAAmB;IA2CvC,OAAO,CAAC,UAAU;IA8BZ,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAyB3B;;;;;;;;OAQG;IACH,IAAW,EAAE,IAAI,QAAQ,CAExB;IAED;;OAEG;IACH,IAAW,IAAI,IAAI,IAAI,CAEtB;IAED;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAK7B"}
|
|
@@ -26,13 +26,15 @@ interface PerformanceComparison {
|
|
|
26
26
|
}
|
|
27
27
|
export declare class PostgresPerformanceTest {
|
|
28
28
|
private store;
|
|
29
|
+
private memory;
|
|
30
|
+
private dbOps;
|
|
29
31
|
private config;
|
|
30
32
|
constructor(config: PerformanceTestConfig);
|
|
31
33
|
init(): Promise<void>;
|
|
32
34
|
cleanup(): Promise<void>;
|
|
33
35
|
resetDatabase(): Promise<void>;
|
|
34
36
|
dropPerformanceIndexes(): Promise<void>;
|
|
35
|
-
|
|
37
|
+
createDefaultIndexes(): Promise<void>;
|
|
36
38
|
seedTestData(): Promise<void>;
|
|
37
39
|
measureOperation(name: string, operation: () => Promise<any>, scenario: 'without_indexes' | 'with_indexes'): Promise<PerformanceResult>;
|
|
38
40
|
runPerformanceTests(scenario: 'without_indexes' | 'with_indexes'): Promise<PerformanceResult[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"performance-test.d.ts","sourceRoot":"","sources":["../../../src/storage/performance-indexes/performance-test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"performance-test.d.ts","sourceRoot":"","sources":["../../../src/storage/performance-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AAG,cAAc,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IA+B/F,iBAAiB,IAAI,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAoCrD,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;IA+B5C,eAAe,CAAC,WAAW,EAAE,qBAAqB,EAAE,GAAG,IAAI;IAwB3D,YAAY,CAAC,OAAO,EAAE,iBAAiB,EAAE,GAAG,IAAI;IAiB1C,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;CAkBpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../src/storage/test-utils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../src/storage/test-utils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAK5D,eAAO,MAAM,WAAW,EAAE,mBAOF,CAAC;AAEzB,eAAO,MAAM,gBAAgB,QAA0K,CAAC;AAExM,wBAAgB,OAAO,SAgyBtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vector/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vector/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAqC,MAAM,qBAAqB,CAAC;AACtF,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAI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