@aikirun/types 0.18.0 → 0.19.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 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: RedisConfig;
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, meta: SubscriberMessageMeta) => Promise<void>;
96
- acknowledge?: (workerId: string, workflowRunId: WorkflowRunId, meta: SubscriberMessageMeta) => Promise<void>;
89
+ heartbeat?: (workflowRunId: WorkflowRunId) => Promise<void>;
90
+ acknowledge?: (workflowRunId: WorkflowRunId) => Promise<void>;
97
91
  }
98
- interface PollingSubscriberStrategy {
99
- type: "polling";
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 AdaptivePollingSubscriberStrategy {
105
- type: "adaptive_polling";
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 { AdaptivePollingSubscriberStrategy, ApiClient, Client, ClientParams, Logger, PollingSubscriberStrategy, RedisClient, RedisConfig, RedisConnection, RedisStreamsSubscriberStrategy, ResolvedSubscriberStrategy, StrategyCallbacks, SubscriberDelayParams, SubscriberMessageMeta, SubscriberStrategy, SubscriberStrategyBuilder, WorkflowRunBatch };
116
+ export type { ApiClient, Client, ClientParams, DbSubscriberStrategy, Logger, RedisClient, RedisConfig, RedisConnection, RedisStreamsSubscriberStrategy, ResolvedSubscriberStrategy, StrategyCallbacks, SubscriberDelayParams, SubscriberStrategy, SubscriberStrategyBuilder, WorkflowRunBatch };
@@ -25,6 +25,8 @@ 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;
@@ -208,5 +210,23 @@ interface WorkflowRunCancelByIdsRequestV1 {
208
210
  interface WorkflowRunCancelByIdsResponseV1 {
209
211
  cancelledIds: string[];
210
212
  }
213
+ interface WorkflowRunClaimReadyRequestV1 {
214
+ workerId: string;
215
+ workflows: Array<{
216
+ name: string;
217
+ versionId: string;
218
+ shard?: string;
219
+ }>;
220
+ limit: number;
221
+ claimMinIdleTimeMs: number;
222
+ }
223
+ interface WorkflowRunClaimReadyResponseV1 {
224
+ runs: Array<{
225
+ id: string;
226
+ }>;
227
+ }
228
+ interface WorkflowRunHeartbeatRequestV1 {
229
+ id: string;
230
+ }
211
231
 
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 };
232
+ 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aikirun/types",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "description": "Core type definitions for Aiki - including workflow, task, client, and trigger types",
5
5
  "type": "module",
6
6
  "exports": {