@mastra/mssql 0.0.0-scorers-api-v2-20250801171841 → 0.0.0-scorers-logs-20251208093427

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.
@@ -0,0 +1,69 @@
1
+ import type { MastraMessageContentV2 } from '@mastra/core/agent';
2
+ import type { MastraDBMessage, StorageThreadType } from '@mastra/core/memory';
3
+ import { MemoryStorage } from '@mastra/core/storage';
4
+ import type { StorageResourceType, StorageListMessagesInput, StorageListMessagesOutput, StorageListThreadsByResourceIdInput, StorageListThreadsByResourceIdOutput } from '@mastra/core/storage';
5
+ import sql from 'mssql';
6
+ import type { StoreOperationsMSSQL } from '../operations/index.js';
7
+ export declare class MemoryMSSQL extends MemoryStorage {
8
+ private pool;
9
+ private schema;
10
+ private operations;
11
+ private _parseAndFormatMessages;
12
+ constructor({ pool, schema, operations, }: {
13
+ pool: sql.ConnectionPool;
14
+ schema: string;
15
+ operations: StoreOperationsMSSQL;
16
+ });
17
+ getThreadById({ threadId }: {
18
+ threadId: string;
19
+ }): Promise<StorageThreadType | null>;
20
+ listThreadsByResourceId(args: StorageListThreadsByResourceIdInput): Promise<StorageListThreadsByResourceIdOutput>;
21
+ saveThread({ thread }: {
22
+ thread: StorageThreadType;
23
+ }): Promise<StorageThreadType>;
24
+ /**
25
+ * Updates a thread's title and metadata, merging with existing metadata. Returns the updated thread.
26
+ */
27
+ updateThread({ id, title, metadata, }: {
28
+ id: string;
29
+ title: string;
30
+ metadata: Record<string, unknown>;
31
+ }): Promise<StorageThreadType>;
32
+ deleteThread({ threadId }: {
33
+ threadId: string;
34
+ }): Promise<void>;
35
+ private _getIncludedMessages;
36
+ listMessagesById({ messageIds }: {
37
+ messageIds: string[];
38
+ }): Promise<{
39
+ messages: MastraDBMessage[];
40
+ }>;
41
+ listMessages(args: StorageListMessagesInput): Promise<StorageListMessagesOutput>;
42
+ saveMessages({ messages }: {
43
+ messages: MastraDBMessage[];
44
+ }): Promise<{
45
+ messages: MastraDBMessage[];
46
+ }>;
47
+ updateMessages({ messages, }: {
48
+ messages: (Partial<Omit<MastraDBMessage, 'createdAt'>> & {
49
+ id: string;
50
+ content?: {
51
+ metadata?: MastraMessageContentV2['metadata'];
52
+ content?: MastraMessageContentV2['content'];
53
+ };
54
+ })[];
55
+ }): Promise<MastraDBMessage[]>;
56
+ deleteMessages(messageIds: string[]): Promise<void>;
57
+ getResourceById({ resourceId }: {
58
+ resourceId: string;
59
+ }): Promise<StorageResourceType | null>;
60
+ saveResource({ resource }: {
61
+ resource: StorageResourceType;
62
+ }): Promise<StorageResourceType>;
63
+ updateResource({ resourceId, workingMemory, metadata, }: {
64
+ resourceId: string;
65
+ workingMemory?: string;
66
+ metadata?: Record<string, unknown>;
67
+ }): Promise<StorageResourceType>;
68
+ }
69
+ //# 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,EAAmB,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC/F,OAAO,EAEL,aAAa,EAOd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,mCAAmC,EACnC,oCAAoC,EACrC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,GAAG,MAAM,OAAO,CAAC;AACxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAG1D,qBAAa,WAAY,SAAQ,aAAa;IAC5C,OAAO,CAAC,IAAI,CAAqB;IACjC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,UAAU,CAAuB;IAEzC,OAAO,CAAC,uBAAuB;gBAsBnB,EACV,IAAI,EACJ,MAAM,EACN,UAAU,GACX,EAAE;QACD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,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC,GAAG;YACvD,EAAE,EAAE,MAAM,CAAC;YACX,OAAO,CAAC,EAAE;gBACR,QAAQ,CAAC,EAAE,sBAAsB,CAAC,UAAU,CAAC,CAAC;gBAC9C,OAAO,CAAC,EAAE,sBAAsB,CAAC,SAAS,CAAC,CAAC;aAC7C,CAAC;SACH,CAAC,EAAE,CAAC;KACN,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IA4GxB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAsEnD,eAAe,CAAC,EAAE,UAAU,EAAE,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAkC5F,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE;QAAE,QAAQ,EAAE,mBAAmB,CAAA;KAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAY3F,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;CA8DjC"}
@@ -0,0 +1,44 @@
1
+ import type { TracingStorageStrategy } from '@mastra/core/observability';
2
+ import { ObservabilityStorage } from '@mastra/core/storage';
3
+ import type { SpanRecord, TraceRecord, TracesPaginatedArg, CreateSpanRecord, PaginationInfo, UpdateSpanRecord } from '@mastra/core/storage';
4
+ import type { ConnectionPool } from 'mssql';
5
+ import type { StoreOperationsMSSQL } from '../operations/index.js';
6
+ export declare class ObservabilityMSSQL extends ObservabilityStorage {
7
+ pool: ConnectionPool;
8
+ private operations;
9
+ private schema?;
10
+ constructor({ pool, operations, schema, }: {
11
+ pool: ConnectionPool;
12
+ operations: StoreOperationsMSSQL;
13
+ schema?: string;
14
+ });
15
+ get tracingStrategy(): {
16
+ preferred: TracingStorageStrategy;
17
+ supported: TracingStorageStrategy[];
18
+ };
19
+ createSpan(span: CreateSpanRecord): Promise<void>;
20
+ getTrace(traceId: string): Promise<TraceRecord | null>;
21
+ updateSpan({ spanId, traceId, updates, }: {
22
+ spanId: string;
23
+ traceId: string;
24
+ updates: Partial<UpdateSpanRecord>;
25
+ }): Promise<void>;
26
+ getTracesPaginated({ filters, pagination, }: TracesPaginatedArg): Promise<{
27
+ pagination: PaginationInfo;
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>;
43
+ }
44
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/observability/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAqC,oBAAoB,EAAe,MAAM,sBAAsB,CAAC;AAC5G,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAG1D,qBAAa,kBAAmB,SAAQ,oBAAoB;IACnD,IAAI,EAAE,cAAc,CAAC;IAC5B,OAAO,CAAC,UAAU,CAAuB;IACzC,OAAO,CAAC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C;CA0BrE"}
@@ -0,0 +1,114 @@
1
+ import { StoreOperations } from '@mastra/core/storage';
2
+ import type { StorageColumn, TABLE_NAMES, CreateIndexOptions, IndexInfo, StorageIndexStats } from '@mastra/core/storage';
3
+ import sql from 'mssql';
4
+ export type { CreateIndexOptions, IndexInfo, StorageIndexStats };
5
+ export declare class StoreOperationsMSSQL extends StoreOperations {
6
+ pool: sql.ConnectionPool;
7
+ schemaName?: string;
8
+ private setupSchemaPromise;
9
+ private schemaSetupComplete;
10
+ protected getSqlType(type: StorageColumn['type'], isPrimaryKey?: boolean, useLargeStorage?: boolean): string;
11
+ constructor({ pool, schemaName }: {
12
+ pool: sql.ConnectionPool;
13
+ schemaName?: string;
14
+ });
15
+ hasColumn(table: string, column: string): Promise<boolean>;
16
+ private setupSchema;
17
+ insert({ tableName, record, transaction, }: {
18
+ tableName: TABLE_NAMES;
19
+ record: Record<string, any>;
20
+ transaction?: sql.Transaction;
21
+ }): Promise<void>;
22
+ clearTable({ tableName }: {
23
+ tableName: TABLE_NAMES;
24
+ }): Promise<void>;
25
+ protected getDefaultValue(type: StorageColumn['type']): string;
26
+ createTable({ tableName, schema, }: {
27
+ tableName: TABLE_NAMES;
28
+ schema: Record<string, StorageColumn>;
29
+ }): Promise<void>;
30
+ /**
31
+ * Alters table schema to add columns if they don't exist
32
+ * @param tableName Name of the table
33
+ * @param schema Schema of the table
34
+ * @param ifNotExists Array of column names to add if they don't exist
35
+ */
36
+ alterTable({ tableName, schema, ifNotExists, }: {
37
+ tableName: TABLE_NAMES;
38
+ schema: Record<string, StorageColumn>;
39
+ ifNotExists: string[];
40
+ }): Promise<void>;
41
+ load<R>({ tableName, keys }: {
42
+ tableName: TABLE_NAMES;
43
+ keys: Record<string, any>;
44
+ }): Promise<R | null>;
45
+ batchInsert({ tableName, records }: {
46
+ tableName: TABLE_NAMES;
47
+ records: Record<string, any>[];
48
+ }): Promise<void>;
49
+ dropTable({ tableName }: {
50
+ tableName: TABLE_NAMES;
51
+ }): Promise<void>;
52
+ /**
53
+ * Prepares a value for database operations, handling Date objects and JSON serialization
54
+ */
55
+ private prepareValue;
56
+ /**
57
+ * Maps TABLE_SCHEMAS types to mssql param types (used when value is null)
58
+ */
59
+ private getMssqlType;
60
+ /**
61
+ * Update a single record in the database
62
+ */
63
+ update({ tableName, keys, data, transaction, }: {
64
+ tableName: TABLE_NAMES;
65
+ keys: Record<string, any>;
66
+ data: Record<string, any>;
67
+ transaction?: sql.Transaction;
68
+ }): Promise<void>;
69
+ /**
70
+ * Update multiple records in a single batch transaction
71
+ */
72
+ batchUpdate({ tableName, updates, }: {
73
+ tableName: TABLE_NAMES;
74
+ updates: Array<{
75
+ keys: Record<string, any>;
76
+ data: Record<string, any>;
77
+ }>;
78
+ }): Promise<void>;
79
+ /**
80
+ * Delete multiple records by keys
81
+ */
82
+ batchDelete({ tableName, keys }: {
83
+ tableName: TABLE_NAMES;
84
+ keys: Record<string, any>[];
85
+ }): Promise<void>;
86
+ /**
87
+ * Create a new index on a table
88
+ */
89
+ createIndex(options: CreateIndexOptions): Promise<void>;
90
+ /**
91
+ * Drop an existing index
92
+ */
93
+ dropIndex(indexName: string): Promise<void>;
94
+ /**
95
+ * List indexes for a specific table or all tables
96
+ */
97
+ listIndexes(tableName?: string): Promise<IndexInfo[]>;
98
+ /**
99
+ * Get detailed statistics for a specific index
100
+ */
101
+ describeIndex(indexName: string): Promise<StorageIndexStats>;
102
+ /**
103
+ * Returns definitions for automatic performance indexes
104
+ * IMPORTANT: Uses seq_id DESC instead of createdAt DESC for MSSQL due to millisecond accuracy limitations
105
+ * NOTE: Using NVARCHAR(400) for text columns (800 bytes) leaves room for composite indexes
106
+ */
107
+ protected getAutomaticIndexDefinitions(): CreateIndexOptions[];
108
+ /**
109
+ * Creates automatic indexes for optimal query performance
110
+ * Uses getAutomaticIndexDefinitions() to determine which indexes to create
111
+ */
112
+ createAutomaticIndexes(): Promise<void>;
113
+ }
114
+ //# sourceMappingURL=index.d.ts.map
@@ -0,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import type { PaginationInfo, StoragePagination } from '@mastra/core/storage';
3
+ import { ScoresStorage } from '@mastra/core/storage';
4
+ import type { ConnectionPool } from 'mssql';
5
+ import type { StoreOperationsMSSQL } from '../operations/index.js';
6
+ export declare class ScoresMSSQL extends ScoresStorage {
7
+ pool: ConnectionPool;
8
+ private operations;
9
+ private schema?;
10
+ constructor({ pool, operations, schema, }: {
11
+ pool: ConnectionPool;
12
+ operations: StoreOperationsMSSQL;
13
+ schema?: string;
14
+ });
15
+ getScoreById({ id }: {
16
+ id: string;
17
+ }): Promise<ScoreRowData | null>;
18
+ saveScore(score: SaveScorePayload): Promise<{
19
+ score: ScoreRowData;
20
+ }>;
21
+ listScoresByScorerId({ scorerId, pagination, entityId, entityType, source, }: {
22
+ scorerId: string;
23
+ pagination: StoragePagination;
24
+ entityId?: string;
25
+ entityType?: string;
26
+ source?: ScoringSource;
27
+ }): Promise<{
28
+ pagination: PaginationInfo;
29
+ scores: ScoreRowData[];
30
+ }>;
31
+ listScoresByRunId({ runId, pagination, }: {
32
+ runId: string;
33
+ pagination: StoragePagination;
34
+ }): Promise<{
35
+ pagination: PaginationInfo;
36
+ scores: ScoreRowData[];
37
+ }>;
38
+ listScoresByEntityId({ entityId, entityType, pagination, }: {
39
+ pagination: StoragePagination;
40
+ entityId: string;
41
+ entityType: string;
42
+ }): Promise<{
43
+ pagination: PaginationInfo;
44
+ scores: ScoreRowData[];
45
+ }>;
46
+ listScoresBySpan({ traceId, spanId, pagination, }: {
47
+ traceId: string;
48
+ spanId: string;
49
+ pagination: StoragePagination;
50
+ }): Promise<{
51
+ pagination: PaginationInfo;
52
+ scores: ScoreRowData[];
53
+ }>;
54
+ }
55
+ //# 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":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAA6B,MAAM,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BAAiB,CAAC;KAC/B,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;IA4D7D,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;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;IA6D7D,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;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;CA6DpE"}
@@ -0,0 +1,25 @@
1
+ import type { PaginationArgs, StorageColumn, TABLE_NAMES } from '@mastra/core/storage';
2
+ export declare function getSchemaName(schema?: string): string | undefined;
3
+ export declare function getTableName({ indexName, schemaName }: {
4
+ indexName: string;
5
+ schemaName?: string;
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
+ /**
12
+ * Prepare WHERE clause for MSSQL queries with @param substitution
13
+ */
14
+ export declare function prepareWhereClause(filters: Record<string, any>, _schema?: Record<string, StorageColumn>): {
15
+ sql: string;
16
+ params: Record<string, any>;
17
+ };
18
+ /**
19
+ * Transform SQL row to record format, handling JSON columns
20
+ */
21
+ export declare function transformFromSqlRow<T>({ tableName, sqlRow, }: {
22
+ tableName: TABLE_NAMES;
23
+ sqlRow: Record<string, any>;
24
+ }): T;
25
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/storage/domains/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAIvF,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,oBAAoB,CAAC,SAAS,EAAE,cAAc,CAAC,WAAW,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CASnH;AAWD;;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,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAAE,CAsE9C;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,CA8BJ"}
@@ -0,0 +1,50 @@
1
+ import { WorkflowsStorage } from '@mastra/core/storage';
2
+ import type { StorageListWorkflowRunsInput, WorkflowRun, WorkflowRuns } from '@mastra/core/storage';
3
+ import type { StepResult, WorkflowRunState } from '@mastra/core/workflows';
4
+ import sql from 'mssql';
5
+ import type { StoreOperationsMSSQL } from '../operations/index.js';
6
+ export declare class WorkflowsMSSQL extends WorkflowsStorage {
7
+ pool: sql.ConnectionPool;
8
+ private operations;
9
+ private schema;
10
+ constructor({ pool, operations, schema, }: {
11
+ pool: sql.ConnectionPool;
12
+ operations: StoreOperationsMSSQL;
13
+ schema: string;
14
+ });
15
+ private parseWorkflowRun;
16
+ updateWorkflowResults({ workflowName, runId, stepId, result, requestContext, }: {
17
+ workflowName: string;
18
+ runId: string;
19
+ stepId: string;
20
+ result: StepResult<any, any, any, any>;
21
+ requestContext: Record<string, any>;
22
+ }): Promise<Record<string, StepResult<any, any, any, any>>>;
23
+ updateWorkflowState({ workflowName, runId, opts, }: {
24
+ workflowName: string;
25
+ runId: string;
26
+ opts: {
27
+ status: string;
28
+ result?: StepResult<any, any, any, any>;
29
+ error?: string;
30
+ suspendedPaths?: Record<string, number[]>;
31
+ waitingPaths?: Record<string, number[]>;
32
+ };
33
+ }): Promise<WorkflowRunState | undefined>;
34
+ persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot, }: {
35
+ workflowName: string;
36
+ runId: string;
37
+ resourceId?: string;
38
+ snapshot: WorkflowRunState;
39
+ }): Promise<void>;
40
+ loadWorkflowSnapshot({ workflowName, runId, }: {
41
+ workflowName: string;
42
+ runId: string;
43
+ }): Promise<WorkflowRunState | null>;
44
+ getWorkflowRunById({ runId, workflowName, }: {
45
+ runId: string;
46
+ workflowName?: string;
47
+ }): Promise<WorkflowRun | null>;
48
+ listWorkflowRuns({ workflowName, fromDate, toDate, page, perPage, resourceId, status, }?: StorageListWorkflowRunsInput): Promise<WorkflowRuns>;
49
+ }
50
+ //# 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":"AACA,OAAO,EAEL,gBAAgB,EAGjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,4BAA4B,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,sBAAs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