@mastra/cloudflare 0.0.0-error-handler-fix-20251020202607 → 0.0.0-execa-dynamic-import-20260304221256
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 +1812 -3
- package/LICENSE.md +15 -0
- package/README.md +38 -16
- package/dist/docs/SKILL.md +22 -0
- package/dist/docs/assets/SOURCE_MAP.json +6 -0
- package/dist/docs/references/reference-storage-cloudflare.md +88 -0
- package/dist/index.cjs +1499 -1762
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1468 -1734
- package/dist/index.js.map +1 -1
- package/dist/storage/{domains/operations → db}/index.d.ts +22 -26
- package/dist/storage/db/index.d.ts.map +1 -0
- package/dist/storage/domains/memory/index.d.ts +60 -41
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/scores/index.d.ts +16 -28
- package/dist/storage/domains/scores/index.d.ts.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts +18 -24
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +27 -217
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/test-utils.d.ts.map +1 -1
- package/dist/storage/types.d.ts +94 -8
- package/dist/storage/types.d.ts.map +1 -1
- package/package.json +19 -15
- package/dist/storage/domains/legacy-evals/index.d.ts +0 -21
- package/dist/storage/domains/legacy-evals/index.d.ts.map +0 -1
- package/dist/storage/domains/operations/index.d.ts.map +0 -1
- package/dist/storage/domains/traces/index.d.ts +0 -18
- package/dist/storage/domains/traces/index.d.ts.map +0 -1
|
@@ -1,31 +1,25 @@
|
|
|
1
1
|
import type { KVNamespace } from '@cloudflare/workers-types';
|
|
2
|
-
import {
|
|
2
|
+
import { MastraBase } from '@mastra/core/base';
|
|
3
3
|
import type { StorageColumn, TABLE_NAMES } from '@mastra/core/storage';
|
|
4
|
-
import
|
|
5
|
-
import type { ListOptions, RecordTypes } from '
|
|
6
|
-
export
|
|
4
|
+
import Cloudflare from 'cloudflare';
|
|
5
|
+
import type { CloudflareDomainConfig, ListOptions, RecordTypes } from '../types.js';
|
|
6
|
+
export interface CloudflareKVDBConfig {
|
|
7
|
+
bindings?: Record<TABLE_NAMES, KVNamespace>;
|
|
8
|
+
namespacePrefix?: string;
|
|
9
|
+
client?: Cloudflare;
|
|
10
|
+
accountId?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Resolves CloudflareDomainConfig to CloudflareKVDBConfig.
|
|
14
|
+
* Handles creating a new Cloudflare client if apiToken is provided.
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolveCloudflareConfig(config: CloudflareDomainConfig): CloudflareKVDBConfig;
|
|
17
|
+
export declare class CloudflareKVDB extends MastraBase {
|
|
7
18
|
private bindings?;
|
|
8
19
|
client?: Cloudflare;
|
|
9
20
|
accountId?: string;
|
|
10
21
|
namespacePrefix: string;
|
|
11
|
-
constructor(
|
|
12
|
-
bindings?: Record<TABLE_NAMES, KVNamespace>;
|
|
13
|
-
namespacePrefix: string;
|
|
14
|
-
client?: Cloudflare;
|
|
15
|
-
accountId?: string;
|
|
16
|
-
});
|
|
17
|
-
hasColumn(): Promise<boolean>;
|
|
18
|
-
alterTable(_args: {
|
|
19
|
-
tableName: TABLE_NAMES;
|
|
20
|
-
schema: Record<string, StorageColumn>;
|
|
21
|
-
ifNotExists: string[];
|
|
22
|
-
}): Promise<void>;
|
|
23
|
-
clearTable({ tableName }: {
|
|
24
|
-
tableName: TABLE_NAMES;
|
|
25
|
-
}): Promise<void>;
|
|
26
|
-
dropTable({ tableName }: {
|
|
27
|
-
tableName: TABLE_NAMES;
|
|
28
|
-
}): Promise<void>;
|
|
22
|
+
constructor(config: CloudflareKVDBConfig);
|
|
29
23
|
private getBinding;
|
|
30
24
|
getKey<T extends TABLE_NAMES>(tableName: T, record: Record<string, string>): string;
|
|
31
25
|
private getSchemaKey;
|
|
@@ -49,7 +43,6 @@ export declare class StoreOperationsCloudflare extends StoreOperations {
|
|
|
49
43
|
tableName: TABLE_NAMES;
|
|
50
44
|
record: Record<string, any>;
|
|
51
45
|
}): Promise<void>;
|
|
52
|
-
private ensureMetadata;
|
|
53
46
|
load<R>({ tableName, keys }: {
|
|
54
47
|
tableName: TABLE_NAMES;
|
|
55
48
|
keys: Record<string, string>;
|
|
@@ -58,9 +51,6 @@ export declare class StoreOperationsCloudflare extends StoreOperations {
|
|
|
58
51
|
tableName: T;
|
|
59
52
|
records: Partial<RecordTypes[T]>[];
|
|
60
53
|
}): Promise<void>;
|
|
61
|
-
/**
|
|
62
|
-
* Helper to safely serialize data for KV storage
|
|
63
|
-
*/
|
|
64
54
|
private safeSerialize;
|
|
65
55
|
private putNamespaceValue;
|
|
66
56
|
putKV({ tableName, key, value, metadata, }: {
|
|
@@ -73,6 +63,12 @@ export declare class StoreOperationsCloudflare extends StoreOperations {
|
|
|
73
63
|
tableName: TABLE_NAMES;
|
|
74
64
|
schema: Record<string, StorageColumn>;
|
|
75
65
|
}): Promise<void>;
|
|
66
|
+
clearTable({ tableName }: {
|
|
67
|
+
tableName: TABLE_NAMES;
|
|
68
|
+
}): Promise<void>;
|
|
69
|
+
dropTable({ tableName }: {
|
|
70
|
+
tableName: TABLE_NAMES;
|
|
71
|
+
}): Promise<void>;
|
|
76
72
|
listNamespaceKeys(tableName: TABLE_NAMES, options?: ListOptions): Promise<import("@cloudflare/workers-types").KVNamespaceListKey<unknown, string>[]>;
|
|
77
73
|
private deleteNamespaceValue;
|
|
78
74
|
deleteKV(tableName: TABLE_NAMES, key: string): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/db/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAU/C,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAA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AY5B,QAAQ,CAAC,SAAS,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAS5D,MAAM,CAAC,SAAS,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAQ9F"}
|
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
import type { MastraMessageContentV2 } from '@mastra/core/agent';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
2
|
+
import type { MastraDBMessage, StorageThreadType } from '@mastra/core/memory';
|
|
3
|
+
import type { StorageResourceType, StorageListMessagesInput, StorageListMessagesOutput, StorageListThreadsInput, StorageListThreadsOutput } from '@mastra/core/storage';
|
|
4
4
|
import { MemoryStorage } from '@mastra/core/storage';
|
|
5
|
-
import type {
|
|
5
|
+
import type { CloudflareDomainConfig } from '../../types.js';
|
|
6
6
|
export declare class MemoryStorageCloudflare extends MemoryStorage {
|
|
7
|
-
|
|
8
|
-
constructor(
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
#private;
|
|
8
|
+
constructor(config: CloudflareDomainConfig);
|
|
9
|
+
init(): Promise<void>;
|
|
10
|
+
dangerouslyClearAll(): Promise<void>;
|
|
11
11
|
private ensureMetadata;
|
|
12
|
+
/**
|
|
13
|
+
* Summarizes message content without exposing raw data (for logging).
|
|
14
|
+
* Returns type, length, and keys only to prevent PII leakage.
|
|
15
|
+
*/
|
|
16
|
+
private summarizeMessageContent;
|
|
12
17
|
getThreadById({ threadId }: {
|
|
13
18
|
threadId: string;
|
|
14
19
|
}): Promise<StorageThreadType | null>;
|
|
15
|
-
|
|
16
|
-
resourceId: string;
|
|
17
|
-
}): Promise<StorageThreadType[]>;
|
|
18
|
-
getThreadsByResourceIdPaginated(args: {
|
|
19
|
-
resourceId: string;
|
|
20
|
-
page?: number;
|
|
21
|
-
perPage?: number;
|
|
22
|
-
}): Promise<PaginationInfo & {
|
|
23
|
-
threads: StorageThreadType[];
|
|
24
|
-
}>;
|
|
20
|
+
listThreads(args: StorageListThreadsInput): Promise<StorageListThreadsOutput>;
|
|
25
21
|
saveThread({ thread }: {
|
|
26
22
|
thread: StorageThreadType;
|
|
27
23
|
}): Promise<StorageThreadType>;
|
|
@@ -35,6 +31,17 @@ export declare class MemoryStorageCloudflare extends MemoryStorage {
|
|
|
35
31
|
deleteThread({ threadId }: {
|
|
36
32
|
threadId: string;
|
|
37
33
|
}): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Searches all threads in the KV store to find a message by its ID.
|
|
36
|
+
*
|
|
37
|
+
* **Performance Warning**: This method sequentially scans all threads to locate
|
|
38
|
+
* the message. For stores with many threads, this can result in significant
|
|
39
|
+
* latency and API calls. When possible, callers should provide the `threadId`
|
|
40
|
+
* directly to avoid this full scan.
|
|
41
|
+
*
|
|
42
|
+
* @param messageId - The globally unique message ID to search for
|
|
43
|
+
* @returns The message with its threadId if found, null otherwise
|
|
44
|
+
*/
|
|
38
45
|
private findMessageInAnyThread;
|
|
39
46
|
/**
|
|
40
47
|
* Queue for serializing sorted order updates.
|
|
@@ -51,39 +58,50 @@ export declare class MemoryStorageCloudflare extends MemoryStorage {
|
|
|
51
58
|
private getSortedMessages;
|
|
52
59
|
private migrateMessage;
|
|
53
60
|
saveMessages(args: {
|
|
54
|
-
messages:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
messages: MastraMessageV2[];
|
|
59
|
-
format: 'v2';
|
|
60
|
-
}): Promise<MastraMessageV2[]>;
|
|
61
|
+
messages: MastraDBMessage[];
|
|
62
|
+
}): Promise<{
|
|
63
|
+
messages: MastraDBMessage[];
|
|
64
|
+
}>;
|
|
61
65
|
private getRank;
|
|
62
66
|
private getRange;
|
|
63
67
|
private getLastN;
|
|
64
68
|
private getFullOrder;
|
|
69
|
+
/**
|
|
70
|
+
* Retrieves messages specified in the include array along with their surrounding context.
|
|
71
|
+
*
|
|
72
|
+
* **Performance Note**: When `threadId` is not provided in an include entry, this method
|
|
73
|
+
* must call `findMessageInAnyThread` which sequentially scans all threads in the KV store.
|
|
74
|
+
* For optimal performance, callers should provide `threadId` in include entries when known.
|
|
75
|
+
*
|
|
76
|
+
* @param include - Array of message IDs to include, optionally with context windows
|
|
77
|
+
* @param messageIds - Set to accumulate the message IDs that should be fetched
|
|
78
|
+
*/
|
|
65
79
|
private getIncludedMessagesWithContext;
|
|
66
80
|
private getRecentMessages;
|
|
81
|
+
/**
|
|
82
|
+
* Fetches and parses messages from one or more threads.
|
|
83
|
+
*
|
|
84
|
+
* **Performance Note**: When neither `include` entries with `threadId` nor `targetThreadId`
|
|
85
|
+
* are provided, this method falls back to `findMessageInAnyThread` which scans all threads.
|
|
86
|
+
* For optimal performance, provide `threadId` in include entries or specify `targetThreadId`.
|
|
87
|
+
*/
|
|
67
88
|
private fetchAndParseMessagesFromMultipleThreads;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}): Promise<MastraMessageV1[]>;
|
|
78
|
-
getMessagesById({ messageIds, format, }: {
|
|
89
|
+
/**
|
|
90
|
+
* Retrieves messages by their IDs.
|
|
91
|
+
*
|
|
92
|
+
* **Performance Warning**: This method calls `findMessageInAnyThread` for each message ID,
|
|
93
|
+
* which scans all threads in the KV store. For large numbers of messages or threads,
|
|
94
|
+
* this can result in significant latency. Consider using `listMessages` with specific
|
|
95
|
+
* thread IDs when the thread context is known.
|
|
96
|
+
*/
|
|
97
|
+
listMessagesById({ messageIds }: {
|
|
79
98
|
messageIds: string[];
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
getMessagesPaginated(args: StorageGetMessagesArg): Promise<PaginationInfo & {
|
|
83
|
-
messages: MastraMessageV1[] | MastraMessageV2[];
|
|
99
|
+
}): Promise<{
|
|
100
|
+
messages: MastraDBMessage[];
|
|
84
101
|
}>;
|
|
102
|
+
listMessages(args: StorageListMessagesInput): Promise<StorageListMessagesOutput>;
|
|
85
103
|
updateMessages(args: {
|
|
86
|
-
messages: (Partial<Omit<
|
|
104
|
+
messages: (Partial<Omit<MastraDBMessage, 'createdAt'>> & {
|
|
87
105
|
id: string;
|
|
88
106
|
threadId?: string;
|
|
89
107
|
content?: {
|
|
@@ -91,7 +109,7 @@ export declare class MemoryStorageCloudflare extends MemoryStorage {
|
|
|
91
109
|
content?: MastraMessageContentV2['content'];
|
|
92
110
|
};
|
|
93
111
|
})[];
|
|
94
|
-
}): Promise<
|
|
112
|
+
}): Promise<MastraDBMessage[]>;
|
|
95
113
|
getResourceById({ resourceId }: {
|
|
96
114
|
resourceId: string;
|
|
97
115
|
}): Promise<StorageResourceType | null>;
|
|
@@ -103,5 +121,6 @@ export declare class MemoryStorageCloudflare extends MemoryStorage {
|
|
|
103
121
|
workingMemory?: string;
|
|
104
122
|
metadata?: Record<string, unknown>;
|
|
105
123
|
}): Promise<StorageResourceType>;
|
|
124
|
+
deleteMessages(messageIds: string[]): Promise<void>;
|
|
106
125
|
}
|
|
107
126
|
//# 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,
|
|
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,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,uBAAuB,EACvB,wBA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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;IA6B1B,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CA4D1D"}
|
|
@@ -1,50 +1,38 @@
|
|
|
1
|
-
import type { ScoreRowData, ScoringSource } from '@mastra/core/
|
|
1
|
+
import type { ListScoresResponse, SaveScorePayload, ScoreRowData, ScoringSource } from '@mastra/core/evals';
|
|
2
2
|
import { ScoresStorage } from '@mastra/core/storage';
|
|
3
|
-
import type { StoragePagination
|
|
4
|
-
import type {
|
|
3
|
+
import type { StoragePagination } from '@mastra/core/storage';
|
|
4
|
+
import type { CloudflareDomainConfig } from '../../types.js';
|
|
5
5
|
export declare class ScoresStorageCloudflare extends ScoresStorage {
|
|
6
|
-
private
|
|
7
|
-
constructor(
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
#private;
|
|
7
|
+
constructor(config: CloudflareDomainConfig);
|
|
8
|
+
init(): Promise<void>;
|
|
9
|
+
dangerouslyClearAll(): Promise<void>;
|
|
10
10
|
getScoreById({ id }: {
|
|
11
11
|
id: string;
|
|
12
12
|
}): Promise<ScoreRowData | null>;
|
|
13
|
-
saveScore(score:
|
|
13
|
+
saveScore(score: SaveScorePayload): Promise<{
|
|
14
14
|
score: ScoreRowData;
|
|
15
15
|
}>;
|
|
16
|
-
|
|
16
|
+
listScoresByScorerId({ scorerId, entityId, entityType, source, pagination, }: {
|
|
17
17
|
scorerId: string;
|
|
18
18
|
entityId?: string;
|
|
19
19
|
entityType?: string;
|
|
20
20
|
source?: ScoringSource;
|
|
21
21
|
pagination: StoragePagination;
|
|
22
|
-
}): Promise<
|
|
23
|
-
|
|
24
|
-
scores: ScoreRowData[];
|
|
25
|
-
}>;
|
|
26
|
-
getScoresByRunId({ runId, pagination, }: {
|
|
22
|
+
}): Promise<ListScoresResponse>;
|
|
23
|
+
listScoresByRunId({ runId, pagination, }: {
|
|
27
24
|
runId: string;
|
|
28
25
|
pagination: StoragePagination;
|
|
29
|
-
}): Promise<
|
|
30
|
-
|
|
31
|
-
scores: ScoreRowData[];
|
|
32
|
-
}>;
|
|
33
|
-
getScoresByEntityId({ entityId, entityType, pagination, }: {
|
|
26
|
+
}): Promise<ListScoresResponse>;
|
|
27
|
+
listScoresByEntityId({ entityId, entityType, pagination, }: {
|
|
34
28
|
pagination: StoragePagination;
|
|
35
29
|
entityId: string;
|
|
36
30
|
entityType: string;
|
|
37
|
-
}): Promise<
|
|
38
|
-
|
|
39
|
-
scores: ScoreRowData[];
|
|
40
|
-
}>;
|
|
41
|
-
getScoresBySpan({ traceId, spanId, pagination, }: {
|
|
31
|
+
}): Promise<ListScoresResponse>;
|
|
32
|
+
listScoresBySpan({ traceId, spanId, pagination, }: {
|
|
42
33
|
traceId: string;
|
|
43
34
|
spanId: string;
|
|
44
35
|
pagination: StoragePagination;
|
|
45
|
-
}): Promise<
|
|
46
|
-
pagination: PaginationInfo;
|
|
47
|
-
scores: ScoreRowData[];
|
|
48
|
-
}>;
|
|
36
|
+
}): Promise<ListScoresResponse>;
|
|
49
37
|
}
|
|
50
38
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/scores/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/scores/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC5G,OAAO,EAEL,aAAa,EAKd,MAAM,sBAAsB,CAAC;AAC9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AE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,iBAAiB,CAAC;KAC/B,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAmDhC"}
|
|
@@ -1,36 +1,33 @@
|
|
|
1
1
|
import { WorkflowsStorage } from '@mastra/core/storage';
|
|
2
|
-
import type { WorkflowRun, WorkflowRuns } from '@mastra/core/storage';
|
|
2
|
+
import type { WorkflowRun, WorkflowRuns, StorageListWorkflowRunsInput, UpdateWorkflowStateOptions } from '@mastra/core/storage';
|
|
3
3
|
import type { StepResult, WorkflowRunState } from '@mastra/core/workflows';
|
|
4
|
-
import type {
|
|
4
|
+
import type { CloudflareDomainConfig } from '../../types.js';
|
|
5
5
|
export declare class WorkflowsStorageCloudflare extends WorkflowsStorage {
|
|
6
|
-
private
|
|
7
|
-
constructor(
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
#private;
|
|
7
|
+
constructor(config: CloudflareDomainConfig);
|
|
8
|
+
supportsConcurrentUpdates(): boolean;
|
|
9
|
+
init(): Promise<void>;
|
|
10
|
+
dangerouslyClearAll(): Promise<void>;
|
|
10
11
|
private validateWorkflowParams;
|
|
11
|
-
updateWorkflowResults(
|
|
12
|
+
updateWorkflowResults(_args: {
|
|
12
13
|
workflowName: string;
|
|
13
14
|
runId: string;
|
|
14
15
|
stepId: string;
|
|
15
16
|
result: StepResult<any, any, any, any>;
|
|
16
|
-
|
|
17
|
+
requestContext: Record<string, any>;
|
|
17
18
|
}): Promise<Record<string, StepResult<any, any, any, any>>>;
|
|
18
|
-
updateWorkflowState(
|
|
19
|
+
updateWorkflowState(_args: {
|
|
19
20
|
workflowName: string;
|
|
20
21
|
runId: string;
|
|
21
|
-
opts:
|
|
22
|
-
status: string;
|
|
23
|
-
result?: StepResult<any, any, any, any>;
|
|
24
|
-
error?: string;
|
|
25
|
-
suspendedPaths?: Record<string, number[]>;
|
|
26
|
-
waitingPaths?: Record<string, number[]>;
|
|
27
|
-
};
|
|
22
|
+
opts: UpdateWorkflowStateOptions;
|
|
28
23
|
}): Promise<WorkflowRunState | undefined>;
|
|
29
24
|
persistWorkflowSnapshot(params: {
|
|
30
25
|
workflowName: string;
|
|
31
26
|
runId: string;
|
|
32
27
|
resourceId?: string;
|
|
33
28
|
snapshot: WorkflowRunState;
|
|
29
|
+
createdAt?: Date;
|
|
30
|
+
updatedAt?: Date;
|
|
34
31
|
}): Promise<void>;
|
|
35
32
|
loadWorkflowSnapshot(params: {
|
|
36
33
|
workflowName: string;
|
|
@@ -38,17 +35,14 @@ export declare class WorkflowsStorageCloudflare extends WorkflowsStorage {
|
|
|
38
35
|
}): Promise<WorkflowRunState | null>;
|
|
39
36
|
private parseWorkflowRun;
|
|
40
37
|
private buildWorkflowSnapshotPrefix;
|
|
41
|
-
|
|
42
|
-
workflowName?: string;
|
|
43
|
-
limit?: number;
|
|
44
|
-
offset?: number;
|
|
45
|
-
resourceId?: string;
|
|
46
|
-
fromDate?: Date;
|
|
47
|
-
toDate?: Date;
|
|
48
|
-
}): Promise<WorkflowRuns>;
|
|
38
|
+
listWorkflowRuns({ workflowName, page, perPage, resourceId, fromDate, toDate, status, }?: StorageListWorkflowRunsInput): Promise<WorkflowRuns>;
|
|
49
39
|
getWorkflowRunById({ runId, workflowName, }: {
|
|
50
40
|
runId: string;
|
|
51
41
|
workflowName: string;
|
|
52
42
|
}): Promise<WorkflowRun | null>;
|
|
43
|
+
deleteWorkflowRunById({ runId, workflowName }: {
|
|
44
|
+
runId: string;
|
|
45
|
+
workflowName: string;
|
|
46
|
+
}): Promise<void>;
|
|
53
47
|
}
|
|
54
48
|
//# 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":[],"mapp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