@aikirun/types 0.18.0 → 0.20.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/dist/client.d.ts +11 -26
- package/dist/workflow-api.d.ts +1 -0
- package/dist/workflow-run-api.d.ts +24 -2
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ import './state-transition.js';
|
|
|
17
17
|
interface ClientParams<AppContext = unknown> {
|
|
18
18
|
url: string;
|
|
19
19
|
apiKey?: string;
|
|
20
|
-
redis
|
|
20
|
+
redis?: RedisConfig;
|
|
21
21
|
logger?: Logger;
|
|
22
22
|
createContext?: (run: Readonly<WorkflowRun>) => AppContext | Promise<AppContext>;
|
|
23
23
|
}
|
|
@@ -66,16 +66,10 @@ interface RedisConnection {
|
|
|
66
66
|
getConnection: () => RedisClient;
|
|
67
67
|
closeConnection: () => Promise<void>;
|
|
68
68
|
}
|
|
69
|
-
interface SubscriberMessageMeta {
|
|
70
|
-
stream: string;
|
|
71
|
-
messageId: string;
|
|
72
|
-
consumerGroup: string;
|
|
73
|
-
}
|
|
74
69
|
interface WorkflowRunBatch {
|
|
75
70
|
data: {
|
|
76
71
|
workflowRunId: WorkflowRunId;
|
|
77
72
|
};
|
|
78
|
-
meta?: SubscriberMessageMeta;
|
|
79
73
|
}
|
|
80
74
|
type SubscriberDelayParams = {
|
|
81
75
|
type: "polled";
|
|
@@ -92,34 +86,25 @@ interface ResolvedSubscriberStrategy {
|
|
|
92
86
|
type: string;
|
|
93
87
|
getNextDelay: (context: SubscriberDelayParams) => number;
|
|
94
88
|
getNextBatch: (size: number) => Promise<WorkflowRunBatch[]>;
|
|
95
|
-
heartbeat?: (workflowRunId: WorkflowRunId
|
|
96
|
-
acknowledge?: (
|
|
89
|
+
heartbeat?: (workflowRunId: WorkflowRunId) => Promise<void>;
|
|
90
|
+
acknowledge?: (workflowRunId: WorkflowRunId) => Promise<void>;
|
|
97
91
|
}
|
|
98
|
-
interface
|
|
99
|
-
type: "
|
|
92
|
+
interface RedisStreamsSubscriberStrategy {
|
|
93
|
+
type: "redis";
|
|
100
94
|
intervalMs?: number;
|
|
101
95
|
maxRetryIntervalMs?: number;
|
|
102
96
|
atCapacityIntervalMs?: number;
|
|
97
|
+
blockTimeMs?: number;
|
|
98
|
+
claimMinIdleTimeMs?: number;
|
|
103
99
|
}
|
|
104
|
-
interface
|
|
105
|
-
type: "
|
|
106
|
-
minPollIntervalMs?: number;
|
|
107
|
-
maxPollIntervalMs?: number;
|
|
108
|
-
backoffMultiplier?: number;
|
|
109
|
-
emptyPollThreshold?: number;
|
|
110
|
-
jitterFactor?: number;
|
|
111
|
-
successResetThreshold?: number;
|
|
112
|
-
atCapacityIntervalMs?: number;
|
|
113
|
-
}
|
|
114
|
-
interface RedisStreamsSubscriberStrategy {
|
|
115
|
-
type: "redis";
|
|
100
|
+
interface DbSubscriberStrategy {
|
|
101
|
+
type: "db";
|
|
116
102
|
intervalMs?: number;
|
|
117
103
|
maxRetryIntervalMs?: number;
|
|
118
104
|
atCapacityIntervalMs?: number;
|
|
119
|
-
blockTimeMs?: number;
|
|
120
105
|
claimMinIdleTimeMs?: number;
|
|
121
106
|
}
|
|
122
|
-
type SubscriberStrategy = RedisStreamsSubscriberStrategy;
|
|
107
|
+
type SubscriberStrategy = RedisStreamsSubscriberStrategy | DbSubscriberStrategy;
|
|
123
108
|
interface SubscriberStrategyBuilder {
|
|
124
109
|
init: (workerId: string, callbacks: StrategyCallbacks) => Promise<ResolvedSubscriberStrategy>;
|
|
125
110
|
}
|
|
@@ -128,4 +113,4 @@ interface StrategyCallbacks {
|
|
|
128
113
|
onStop?: () => Promise<void>;
|
|
129
114
|
}
|
|
130
115
|
|
|
131
|
-
export type {
|
|
116
|
+
export type { ApiClient, Client, ClientParams, DbSubscriberStrategy, Logger, RedisClient, RedisConfig, RedisConnection, RedisStreamsSubscriberStrategy, ResolvedSubscriberStrategy, StrategyCallbacks, SubscriberDelayParams, SubscriberStrategy, SubscriberStrategyBuilder, WorkflowRunBatch };
|
package/dist/workflow-api.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventSendOptions } from './event.js';
|
|
2
2
|
import { StateTransition } from './state-transition.js';
|
|
3
|
-
import { TransitionTaskStateToRunningCreate, TransitionTaskStateToRunningRetry, TransitionTaskStateToCompleted, TransitionTaskStateToFailed, TransitionTaskStateToAwaitingRetry, TaskInfo, TaskStateCompleted, TaskStateFailed } from './task.js';
|
|
3
|
+
import { TaskStatus, TransitionTaskStateToRunningCreate, TransitionTaskStateToRunningRetry, TransitionTaskStateToCompleted, TransitionTaskStateToFailed, TransitionTaskStateToAwaitingRetry, TaskInfo, TaskStateCompleted, TaskStateFailed } from './task.js';
|
|
4
4
|
import { DistributiveOmit, OptionalProp } from './utils.js';
|
|
5
5
|
import { WorkflowSource } from './workflow.js';
|
|
6
6
|
import { WorkflowRunStatus, WorkflowRun, WorkflowRunState, WorkflowStartOptions, WorkflowRunStateScheduled, WorkflowRunStateSleeping, WorkflowRunStateAwaitingEvent, WorkflowRunStateAwaitingRetry, WorkflowRunStateAwaitingChildWorkflow, WorkflowRunStateCompleted, WorkflowRunStatePaused, WorkflowRunStateCancelled } from './workflow-run.js';
|
|
@@ -25,12 +25,15 @@ interface WorkflowRunApi {
|
|
|
25
25
|
multicastEventByReferenceV1: (_: WorkflowRunMulticastEventByReferenceRequestV1) => Promise<void>;
|
|
26
26
|
listChildRunsV1: (_: WorkflowRunListChildRunsRequestV1) => Promise<WorkflowRunListChildRunsResponseV1>;
|
|
27
27
|
cancelByIdsV1: (_: WorkflowRunCancelByIdsRequestV1) => Promise<WorkflowRunCancelByIdsResponseV1>;
|
|
28
|
+
claimReadyV1: (_: WorkflowRunClaimReadyRequestV1) => Promise<WorkflowRunClaimReadyResponseV1>;
|
|
29
|
+
heartbeatV1: (_: WorkflowRunHeartbeatRequestV1) => Promise<void>;
|
|
28
30
|
}
|
|
29
31
|
interface WorkflowRunListRequestV1 {
|
|
30
32
|
limit?: number;
|
|
31
33
|
offset?: number;
|
|
32
34
|
filters?: {
|
|
33
35
|
id?: string;
|
|
36
|
+
scheduleId?: string;
|
|
34
37
|
status?: WorkflowRunStatus[];
|
|
35
38
|
workflow?: WorkflowFilter;
|
|
36
39
|
};
|
|
@@ -58,6 +61,7 @@ interface WorkflowRunListItem {
|
|
|
58
61
|
createdAt: number;
|
|
59
62
|
status: WorkflowRunStatus;
|
|
60
63
|
referenceId?: string;
|
|
64
|
+
taskCounts?: Record<TaskStatus, number>;
|
|
61
65
|
}
|
|
62
66
|
interface WorkflowRunListResponseV1 {
|
|
63
67
|
runs: WorkflowRunListItem[];
|
|
@@ -208,5 +212,23 @@ interface WorkflowRunCancelByIdsRequestV1 {
|
|
|
208
212
|
interface WorkflowRunCancelByIdsResponseV1 {
|
|
209
213
|
cancelledIds: string[];
|
|
210
214
|
}
|
|
215
|
+
interface WorkflowRunClaimReadyRequestV1 {
|
|
216
|
+
workerId: string;
|
|
217
|
+
workflows: Array<{
|
|
218
|
+
name: string;
|
|
219
|
+
versionId: string;
|
|
220
|
+
shard?: string;
|
|
221
|
+
}>;
|
|
222
|
+
limit: number;
|
|
223
|
+
claimMinIdleTimeMs: number;
|
|
224
|
+
}
|
|
225
|
+
interface WorkflowRunClaimReadyResponseV1 {
|
|
226
|
+
runs: Array<{
|
|
227
|
+
id: string;
|
|
228
|
+
}>;
|
|
229
|
+
}
|
|
230
|
+
interface WorkflowRunHeartbeatRequestV1 {
|
|
231
|
+
id: string;
|
|
232
|
+
}
|
|
211
233
|
|
|
212
|
-
export type { TransitionTaskStateToRunning, WorkflowFilter, WorkflowRunApi, WorkflowRunCancelByIdsRequestV1, WorkflowRunCancelByIdsResponseV1, WorkflowRunCreateRequestV1, WorkflowRunCreateResponseV1, WorkflowRunGetByIdRequestV1, WorkflowRunGetByIdResponseV1, WorkflowRunGetByReferenceIdRequestV1, WorkflowRunGetByReferenceIdResponseV1, WorkflowRunGetStateRequestV1, WorkflowRunGetStateResponseV1, WorkflowRunListChildRunsRequestV1, WorkflowRunListChildRunsResponseV1, WorkflowRunListItem, WorkflowRunListRequestV1, WorkflowRunListResponseV1, WorkflowRunListTransitionsRequestV1, WorkflowRunListTransitionsResponseV1, WorkflowRunMulticastEventByReferenceRequestV1, WorkflowRunMulticastEventRequestV1, WorkflowRunReference, WorkflowRunSendEventRequestV1, WorkflowRunSetTaskStateRequestExisting, WorkflowRunSetTaskStateRequestNew, WorkflowRunSetTaskStateRequestV1, WorkflowRunStateAwaitingChildWorkflowRequest, WorkflowRunStateAwaitingEventRequest, WorkflowRunStateAwaitingRetryRequest, WorkflowRunStateCompletedRequest, WorkflowRunStateRequest, WorkflowRunStateScheduledRequest, WorkflowRunStateScheduledRequestOptimistic, WorkflowRunStateScheduledRequestPessimistic, WorkflowRunStateSleepingRequest, WorkflowRunTransitionStateRequestOptimistic, WorkflowRunTransitionStateRequestPessimistic, WorkflowRunTransitionStateRequestV1, WorkflowRunTransitionStateResponseV1, WorkflowRunTransitionTaskStateRequestV1, WorkflowRunTransitionTaskStateResponseV1 };
|
|
234
|
+
export type { TransitionTaskStateToRunning, WorkflowFilter, WorkflowRunApi, WorkflowRunCancelByIdsRequestV1, WorkflowRunCancelByIdsResponseV1, WorkflowRunClaimReadyRequestV1, WorkflowRunClaimReadyResponseV1, WorkflowRunCreateRequestV1, WorkflowRunCreateResponseV1, WorkflowRunGetByIdRequestV1, WorkflowRunGetByIdResponseV1, WorkflowRunGetByReferenceIdRequestV1, WorkflowRunGetByReferenceIdResponseV1, WorkflowRunGetStateRequestV1, WorkflowRunGetStateResponseV1, WorkflowRunHeartbeatRequestV1, WorkflowRunListChildRunsRequestV1, WorkflowRunListChildRunsResponseV1, WorkflowRunListItem, WorkflowRunListRequestV1, WorkflowRunListResponseV1, WorkflowRunListTransitionsRequestV1, WorkflowRunListTransitionsResponseV1, WorkflowRunMulticastEventByReferenceRequestV1, WorkflowRunMulticastEventRequestV1, WorkflowRunReference, WorkflowRunSendEventRequestV1, WorkflowRunSetTaskStateRequestExisting, WorkflowRunSetTaskStateRequestNew, WorkflowRunSetTaskStateRequestV1, WorkflowRunStateAwaitingChildWorkflowRequest, WorkflowRunStateAwaitingEventRequest, WorkflowRunStateAwaitingRetryRequest, WorkflowRunStateCompletedRequest, WorkflowRunStateRequest, WorkflowRunStateScheduledRequest, WorkflowRunStateScheduledRequestOptimistic, WorkflowRunStateScheduledRequestPessimistic, WorkflowRunStateSleepingRequest, WorkflowRunTransitionStateRequestOptimistic, WorkflowRunTransitionStateRequestPessimistic, WorkflowRunTransitionStateRequestV1, WorkflowRunTransitionStateResponseV1, WorkflowRunTransitionTaskStateRequestV1, WorkflowRunTransitionTaskStateResponseV1 };
|