@hatchet-dev/typescript-sdk 1.16.0 → 1.17.1

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.
Files changed (97) hide show
  1. package/README.md +14 -2
  2. package/clients/admin/admin-client.d.ts +2 -2
  3. package/clients/dispatcher/action-listener.d.ts +3 -6
  4. package/clients/dispatcher/action-listener.js +12 -17
  5. package/clients/listeners/durable-listener/durable-listener-client.d.ts +116 -15
  6. package/clients/listeners/durable-listener/durable-listener-client.js +770 -19
  7. package/clients/listeners/durable-listener/pooled-durable-listener-client.js +1 -14
  8. package/clients/listeners/run-listener/pooled-child-listener-client.js +1 -14
  9. package/clients/rest/generated/Api.d.ts +5 -1
  10. package/clients/rest/generated/data-contracts.d.ts +16 -2
  11. package/clients/rest/generated/data-contracts.js +7 -3
  12. package/legacy/examples/affinity-workers.js +2 -2
  13. package/legacy/legacy-client.js +1 -1
  14. package/legacy/step.d.ts +2 -2
  15. package/legacy/step.js +3 -2
  16. package/legacy/workflow.d.ts +25 -25
  17. package/package.json +1 -1
  18. package/protoc/dispatcher/dispatcher.d.ts +20 -0
  19. package/protoc/dispatcher/dispatcher.js +535 -100
  20. package/protoc/events/events.js +54 -14
  21. package/protoc/google/protobuf/timestamp.js +1 -1
  22. package/protoc/v1/dispatcher.d.ts +169 -0
  23. package/protoc/v1/dispatcher.js +2096 -8
  24. package/protoc/v1/shared/condition.js +37 -11
  25. package/protoc/v1/shared/trigger.d.ts +89 -0
  26. package/protoc/v1/shared/trigger.js +524 -0
  27. package/protoc/v1/workflows.d.ts +34 -34
  28. package/protoc/v1/workflows.js +452 -254
  29. package/protoc/workflows/workflows.d.ts +2 -75
  30. package/protoc/workflows/workflows.js +157 -529
  31. package/util/abort-error.d.ts +10 -0
  32. package/util/abort-error.js +15 -0
  33. package/util/errors/eviction-not-supported-error.d.ts +5 -0
  34. package/util/errors/eviction-not-supported-error.js +18 -0
  35. package/util/errors/non-determinism-error.d.ts +7 -0
  36. package/util/errors/non-determinism-error.js +21 -0
  37. package/util/errors/task-run-terminated-error.d.ts +6 -0
  38. package/util/errors/task-run-terminated-error.js +15 -0
  39. package/util/hatchet-promise/hatchet-promise.d.ts +2 -1
  40. package/util/hatchet-promise/hatchet-promise.js +10 -1
  41. package/util/sleep.d.ts +3 -2
  42. package/util/sleep.js +6 -4
  43. package/v1/client/admin.d.ts +2 -2
  44. package/v1/client/client.js +1 -1
  45. package/v1/client/duration.d.ts +11 -1
  46. package/v1/client/duration.js +44 -0
  47. package/v1/client/features/runs.d.ts +16 -3
  48. package/v1/client/features/runs.js +38 -3
  49. package/v1/client/worker/context.d.ts +101 -6
  50. package/v1/client/worker/context.js +247 -21
  51. package/v1/client/worker/deprecated/index.d.ts +1 -1
  52. package/v1/client/worker/deprecated/index.js +2 -1
  53. package/v1/client/worker/deprecated/legacy-worker.d.ts +5 -0
  54. package/v1/client/worker/deprecated/legacy-worker.js +32 -23
  55. package/v1/client/worker/deprecated/pre-eviction.d.ts +12 -0
  56. package/v1/client/worker/deprecated/pre-eviction.js +37 -0
  57. package/v1/client/worker/engine-version.d.ts +5 -0
  58. package/v1/client/worker/engine-version.js +14 -0
  59. package/v1/client/worker/eviction/eviction-cache.d.ts +33 -0
  60. package/v1/client/worker/eviction/eviction-cache.js +139 -0
  61. package/v1/client/worker/eviction/eviction-manager.d.ts +42 -0
  62. package/v1/client/worker/eviction/eviction-manager.js +132 -0
  63. package/v1/client/worker/eviction/eviction-policy.d.ts +19 -0
  64. package/v1/client/worker/eviction/eviction-policy.js +8 -0
  65. package/v1/client/worker/eviction/index.d.ts +3 -0
  66. package/v1/client/worker/eviction/index.js +11 -0
  67. package/v1/client/worker/worker-internal.d.ts +23 -4
  68. package/v1/client/worker/worker-internal.js +177 -138
  69. package/v1/client/worker/worker.d.ts +1 -0
  70. package/v1/client/worker/worker.js +34 -1
  71. package/v1/conditions/sleep-condition.js +2 -1
  72. package/v1/conditions/transformer.js +2 -1
  73. package/v1/declaration.d.ts +5 -3
  74. package/v1/declaration.js +8 -0
  75. package/v1/examples/__e2e__/harness.d.ts +5 -0
  76. package/v1/examples/__e2e__/harness.js +13 -0
  77. package/v1/examples/concurrency_workflow_level/workflow.d.ts +1 -1
  78. package/v1/examples/concurrency_workflow_level/workflow.js +1 -1
  79. package/v1/examples/durable/workflow.d.ts +57 -0
  80. package/v1/examples/durable/workflow.js +162 -7
  81. package/v1/examples/durable-event/workflow.js +2 -7
  82. package/v1/examples/durable_event/workflow.d.ts +1 -0
  83. package/v1/examples/durable_event/workflow.js +4 -9
  84. package/v1/examples/durable_eviction/capacity-worker.d.ts +1 -0
  85. package/v1/examples/durable_eviction/capacity-worker.js +31 -0
  86. package/v1/examples/durable_eviction/worker.d.ts +1 -0
  87. package/v1/examples/durable_eviction/worker.js +34 -0
  88. package/v1/examples/durable_eviction/workflow.d.ts +44 -0
  89. package/v1/examples/durable_eviction/workflow.js +129 -0
  90. package/v1/examples/e2e-worker.js +42 -19
  91. package/v1/index.d.ts +5 -0
  92. package/v1/index.js +10 -0
  93. package/v1/parent-run-context-vars.d.ts +6 -0
  94. package/v1/task.d.ts +10 -2
  95. package/v1/task.js +2 -1
  96. package/version.d.ts +1 -1
  97. package/version.js +1 -1
@@ -77,20 +77,7 @@ class DurableEventStreamable {
77
77
  }
78
78
  this.responseEmitter.once('response', onResponse);
79
79
  if (signal) {
80
- /**
81
- * Node defaults AbortSignal max listeners to 10, which is easy to exceed with
82
- * legitimate high-concurrency waits (e.g. multiple concurrent `ctx.waitFor(...)`
83
- * calls in the same task).
84
- *
85
- * If the signal is still at the default cap, bump it to a reasonable level
86
- * to avoid noisy `MaxListenersExceededWarning` while still keeping protection
87
- * against true leaks in unusual cases.
88
- */
89
- const max = (0, events_1.getMaxListeners)(signal);
90
- if (max !== 0 && max < 50) {
91
- (0, events_1.setMaxListeners)(50, signal);
92
- }
93
- signal.addEventListener('abort', onAbort, { once: true });
80
+ (0, abort_error_1.bindAbortSignalHandler)(signal, onAbort);
94
81
  }
95
82
  });
96
83
  });
@@ -79,20 +79,7 @@ class Streamable {
79
79
  }
80
80
  this.responseEmitter.once('response', onResponse);
81
81
  if (signal) {
82
- /**
83
- * Node defaults AbortSignal max listeners to 10, which is easy to exceed with
84
- * legitimate high-concurrency waits (e.g. a cancelled parent task fanning out
85
- * to many child `.result()` waits).
86
- *
87
- * If the signal is still at the default cap, bump it to a reasonable level
88
- * to avoid noisy `MaxListenersExceededWarning` while still keeping protection
89
- * against true leaks in unusual cases.
90
- */
91
- const max = (0, events_1.getMaxListeners)(signal);
92
- if (max !== 0 && max < 50) {
93
- (0, events_1.setMaxListeners)(50, signal);
94
- }
95
- signal.addEventListener('abort', onAbort, { once: true });
82
+ (0, abort_error_1.bindAbortSignalHandler)(signal, onAbort);
96
83
  }
97
84
  });
98
85
  });
@@ -1,4 +1,4 @@
1
- import { APIErrors, APIMeta, AcceptInviteRequest, BulkCreateEventRequest, CancelEventRequest, CreateAPITokenRequest, CreateAPITokenResponse, CreateCronWorkflowTriggerRequest, CreateEventRequest, CreateSNSIntegrationRequest, CreateTenantAlertEmailGroupRequest, CreateTenantInviteRequest, CreateTenantRequest, CronWorkflows, CronWorkflowsList, CronWorkflowsOrderByField, Event, EventData, EventKey, EventKeyList, EventList, EventOrderByDirection, EventOrderByField, EventSearch, Events, ListAPIMetaIntegration, ListAPITokensResponse, ListSNSIntegrations, ListSlackWebhooks, LogLineLevelField, LogLineList, LogLineOrderByDirection, LogLineOrderByField, LogLineSearch, RateLimitList, RateLimitOrderByDirection, RateLimitOrderByField, RejectInviteRequest, ReplayEventRequest, ReplayWorkflowRunsRequest, ReplayWorkflowRunsResponse, RerunStepRunRequest, SNSIntegration, ScheduleWorkflowRunRequest, ScheduledRunStatus, ScheduledWorkflows, ScheduledWorkflowsBulkDeleteRequest, ScheduledWorkflowsBulkDeleteResponse, ScheduledWorkflowsBulkUpdateRequest, ScheduledWorkflowsBulkUpdateResponse, ScheduledWorkflowsList, ScheduledWorkflowsOrderByField, StepRun, StepRunArchiveList, StepRunEventList, TaskStats, Tenant, TenantAlertEmailGroup, TenantAlertEmailGroupList, TenantAlertingSettings, TenantInvite, TenantInviteList, TenantMember, TenantMemberList, TenantQueueMetrics, TenantResourcePolicy, TenantStepRunQueueMetrics, TriggerWorkflowRunRequest, UpdateCronWorkflowTriggerRequest, UpdateScheduledWorkflowRunRequest, UpdateTenantAlertEmailGroupRequest, UpdateTenantInviteRequest, UpdateTenantMemberRequest, UpdateTenantRequest, UpdateWorkerRequest, User, UserChangePasswordRequest, UserLoginRequest, UserRegisterRequest, UserTenantMembershipsList, V1BranchDurableTaskRequest, V1BranchDurableTaskResponse, V1CELDebugRequest, V1CELDebugResponse, V1CancelTaskRequest, V1CancelledTasks, V1CreateFilterRequest, V1CreateWebhookRequest, V1DagChildren, V1Event, V1EventList, V1Filter, V1FilterList, V1LogLineLevel, V1LogLineList, V1LogLineOrderByDirection, V1ReplayTaskRequest, V1ReplayedTasks, V1RestoreTaskResponse, V1TaskEventList, V1TaskPointMetrics, V1TaskRunMetrics, V1TaskStatus, V1TaskSummary, V1TaskSummaryList, V1TaskTimingList, V1TriggerWorkflowRunRequest, V1UpdateFilterRequest, V1UpdateWebhookRequest, V1Webhook, V1WebhookList, V1WebhookResponse, V1WebhookSourceName, V1WorkflowRunDetails, V1WorkflowRunDisplayNameList, V1WorkflowRunExternalIdList, WebhookWorkerCreateRequest, WebhookWorkerCreated, WebhookWorkerListResponse, WebhookWorkerRequestListResponse, Worker, WorkerList, Workflow, WorkflowID, WorkflowKindList, WorkflowList, WorkflowMetrics, WorkflowRun, WorkflowRunList, WorkflowRunOrderByDirection, WorkflowRunOrderByField, WorkflowRunShape, WorkflowRunStatus, WorkflowRunStatusList, WorkflowRunsCancelRequest, WorkflowRunsMetrics, WorkflowUpdateRequest, WorkflowVersion, WorkflowWorkersCount } from './data-contracts';
1
+ import { APIErrors, APIMeta, AcceptInviteRequest, BulkCreateEventRequest, CancelEventRequest, CreateAPITokenRequest, CreateAPITokenResponse, CreateCronWorkflowTriggerRequest, CreateEventRequest, CreateSNSIntegrationRequest, CreateTenantAlertEmailGroupRequest, CreateTenantInviteRequest, CreateTenantRequest, CronWorkflows, CronWorkflowsList, CronWorkflowsOrderByField, Event, EventData, EventKey, EventKeyList, EventList, EventOrderByDirection, EventOrderByField, EventSearch, Events, ListAPIMetaIntegration, ListAPITokensResponse, ListSNSIntegrations, ListSlackWebhooks, LogLineLevelField, LogLineList, LogLineOrderByDirection, LogLineOrderByField, LogLineSearch, RateLimitList, RateLimitOrderByDirection, RateLimitOrderByField, RejectInviteRequest, ReplayEventRequest, ReplayWorkflowRunsRequest, ReplayWorkflowRunsResponse, RerunStepRunRequest, SNSIntegration, ScheduleWorkflowRunRequest, ScheduledRunStatus, ScheduledWorkflows, ScheduledWorkflowsBulkDeleteRequest, ScheduledWorkflowsBulkDeleteResponse, ScheduledWorkflowsBulkUpdateRequest, ScheduledWorkflowsBulkUpdateResponse, ScheduledWorkflowsList, ScheduledWorkflowsOrderByField, StepRun, StepRunArchiveList, StepRunEventList, TaskStats, Tenant, TenantAlertEmailGroup, TenantAlertEmailGroupList, TenantAlertingSettings, TenantInvite, TenantInviteList, TenantMember, TenantMemberList, TenantQueueMetrics, TenantResourcePolicy, TenantStepRunQueueMetrics, TriggerWorkflowRunRequest, UpdateCronWorkflowTriggerRequest, UpdateScheduledWorkflowRunRequest, UpdateTenantAlertEmailGroupRequest, UpdateTenantInviteRequest, UpdateTenantMemberRequest, UpdateTenantRequest, UpdateWorkerRequest, User, UserChangePasswordRequest, UserLoginRequest, UserRegisterRequest, UserTenantMembershipsList, V1BranchDurableTaskRequest, V1BranchDurableTaskResponse, V1CELDebugRequest, V1CELDebugResponse, V1CancelTaskRequest, V1CancelledTasks, V1CreateFilterRequest, V1CreateWebhookRequest, V1DagChildren, V1Event, V1EventList, V1Filter, V1FilterList, V1LogLineLevel, V1LogLineList, V1LogLineOrderByDirection, V1ReplayTaskRequest, V1ReplayedTasks, V1RestoreTaskResponse, V1RunningFilter, V1TaskEventList, V1TaskPointMetrics, V1TaskRunMetrics, V1TaskStatus, V1TaskSummary, V1TaskSummaryList, V1TaskTimingList, V1TriggerWorkflowRunRequest, V1UpdateFilterRequest, V1UpdateWebhookRequest, V1Webhook, V1WebhookList, V1WebhookResponse, V1WebhookSourceName, V1WorkflowRunDetails, V1WorkflowRunDisplayNameList, V1WorkflowRunExternalIdList, WebhookWorkerCreateRequest, WebhookWorkerCreated, WebhookWorkerListResponse, WebhookWorkerRequestListResponse, Worker, WorkerList, Workflow, WorkflowID, WorkflowKindList, WorkflowList, WorkflowMetrics, WorkflowRun, WorkflowRunList, WorkflowRunOrderByDirection, WorkflowRunOrderByField, WorkflowRunShape, WorkflowRunStatus, WorkflowRunStatusList, WorkflowRunsCancelRequest, WorkflowRunsMetrics, WorkflowUpdateRequest, WorkflowVersion, WorkflowWorkersCount } from './data-contracts';
2
2
  import { HttpClient, RequestParams } from './http-client';
3
3
  export declare class Api<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
4
4
  /**
@@ -180,6 +180,8 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
180
180
  triggering_event_external_id?: string;
181
181
  /** A flag for whether or not to include the input and output payloads in the response. Defaults to `true` if unset. */
182
182
  include_payloads?: boolean;
183
+ /** Filter within the RUNNING status bucket. ALL returns both on-worker and evicted tasks, ON_WORKER returns only tasks running on a worker, EVICTED returns only evicted tasks. Defaults to ALL. */
184
+ running_filter?: V1RunningFilter;
183
185
  }, params?: RequestParams) => Promise<import("axios").AxiosResponse<V1TaskSummaryList, any, {}>>;
184
186
  /**
185
187
  * @description Lists displayable names of workflow runs for a tenant
@@ -220,6 +222,8 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
220
222
  additional_metadata?: string[];
221
223
  /** The workflow ids to find runs for */
222
224
  workflow_ids?: string[];
225
+ /** Filter within the RUNNING status bucket. ALL returns both on-worker and evicted tasks, ON_WORKER returns only tasks running on a worker, EVICTED returns only evicted tasks. Defaults to ALL. */
226
+ running_filter?: V1RunningFilter;
223
227
  }, params?: RequestParams) => Promise<import("axios").AxiosResponse<V1WorkflowRunExternalIdList, any, {}>>;
224
228
  /**
225
229
  * @description Trigger a new workflow run
@@ -1,7 +1,6 @@
1
1
  export declare enum V1TaskRunStatus {
2
2
  PENDING = "PENDING",
3
3
  RUNNING = "RUNNING",
4
- EVICTED = "EVICTED",
5
4
  COMPLETED = "COMPLETED",
6
5
  FAILED = "FAILED",
7
6
  CANCELLED = "CANCELLED"
@@ -209,6 +208,11 @@ export declare enum TenantVersion {
209
208
  V0 = "V0",
210
209
  V1 = "V1"
211
210
  }
211
+ export declare enum V1RunningFilter {
212
+ ALL = "ALL",
213
+ EVICTED = "EVICTED",
214
+ ON_WORKER = "ON_WORKER"
215
+ }
212
216
  export declare enum V1LogLineOrderByDirection {
213
217
  ASC = "ASC",
214
218
  DESC = "DESC"
@@ -251,7 +255,6 @@ export declare enum V1WorkflowType {
251
255
  export declare enum V1TaskStatus {
252
256
  QUEUED = "QUEUED",
253
257
  RUNNING = "RUNNING",
254
- EVICTED = "EVICTED",
255
258
  COMPLETED = "COMPLETED",
256
259
  CANCELLED = "CANCELLED",
257
260
  FAILED = "FAILED"
@@ -312,6 +315,8 @@ export interface V1TaskSummary {
312
315
  /** The output of the task run (for the latest run) */
313
316
  output: object;
314
317
  status: V1TaskStatus;
318
+ /** Whether the task has been evicted from a worker (still counts as RUNNING). */
319
+ isEvicted?: boolean;
315
320
  /**
316
321
  * The timestamp the task run started.
317
322
  * @format date-time
@@ -637,6 +642,8 @@ export interface V1TaskTiming {
637
642
  /** The depth of the task in the waterfall. */
638
643
  depth: number;
639
644
  status: V1TaskStatus;
645
+ /** Whether the task has been evicted from a worker (still counts as RUNNING). */
646
+ isEvicted?: boolean;
640
647
  /** The display name of the task run. */
641
648
  taskDisplayName: string;
642
649
  /**
@@ -698,9 +705,16 @@ export interface V1TaskTimingList {
698
705
  /** The list of task timings */
699
706
  rows: V1TaskTiming[];
700
707
  }
708
+ export interface V1RunningDetailCount {
709
+ /** The number of evicted tasks within the RUNNING status bucket. */
710
+ evicted: number;
711
+ /** The number of tasks currently on a worker within the RUNNING status bucket. */
712
+ onWorker: number;
713
+ }
701
714
  export interface V1TaskRunMetric {
702
715
  status: V1TaskStatus;
703
716
  count: number;
717
+ runningDetailCount?: V1RunningDetailCount;
704
718
  }
705
719
  export type V1TaskRunMetrics = V1TaskRunMetric[];
706
720
  export interface V1TaskPointMetric {
@@ -11,12 +11,11 @@
11
11
  * ---------------------------------------------------------------
12
12
  */
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.V1TaskStatus = exports.V1WorkflowType = exports.V1TaskEventType = exports.V1LogLineLevel = exports.V1LogLineOrderByDirection = exports.TenantVersion = exports.TenantEnvironment = exports.V1WebhookSourceName = exports.V1WebhookAuthType = exports.V1WebhookHMACAlgorithm = exports.V1WebhookHMACEncoding = exports.V1CELDebugResponseStatus = exports.TenantResource = exports.TenantMemberRole = exports.WorkflowRunStatus = exports.EventOrderByField = exports.EventOrderByDirection = exports.RateLimitOrderByField = exports.RateLimitOrderByDirection = exports.ScheduledWorkflowsMethod = exports.ScheduledWorkflowsOrderByField = exports.WorkflowRunOrderByDirection = exports.ScheduledRunStatus = exports.CronWorkflowsMethod = exports.CronWorkflowsOrderByField = exports.ConcurrencyLimitStrategy = exports.ConcurrencyScope = exports.StepRunStatus = exports.JobRunStatus = exports.LogLineLevel = exports.LogLineOrderByField = exports.LogLineOrderByDirection = exports.StepRunEventReason = exports.StepRunEventSeverity = exports.WorkflowKind = exports.WorkflowRunOrderByField = exports.WorkerType = exports.WorkerRuntimeSDKs = exports.WebhookWorkerRequestMethod = exports.PullRequestState = exports.V1TaskRunStatus = void 0;
14
+ exports.V1TaskStatus = exports.V1WorkflowType = exports.V1TaskEventType = exports.V1LogLineLevel = exports.V1LogLineOrderByDirection = exports.V1RunningFilter = exports.TenantVersion = exports.TenantEnvironment = exports.V1WebhookSourceName = exports.V1WebhookAuthType = exports.V1WebhookHMACAlgorithm = exports.V1WebhookHMACEncoding = exports.V1CELDebugResponseStatus = exports.TenantResource = exports.TenantMemberRole = exports.WorkflowRunStatus = exports.EventOrderByField = exports.EventOrderByDirection = exports.RateLimitOrderByField = exports.RateLimitOrderByDirection = exports.ScheduledWorkflowsMethod = exports.ScheduledWorkflowsOrderByField = exports.WorkflowRunOrderByDirection = exports.ScheduledRunStatus = exports.CronWorkflowsMethod = exports.CronWorkflowsOrderByField = exports.ConcurrencyLimitStrategy = exports.ConcurrencyScope = exports.StepRunStatus = exports.JobRunStatus = exports.LogLineLevel = exports.LogLineOrderByField = exports.LogLineOrderByDirection = exports.StepRunEventReason = exports.StepRunEventSeverity = exports.WorkflowKind = exports.WorkflowRunOrderByField = exports.WorkerType = exports.WorkerRuntimeSDKs = exports.WebhookWorkerRequestMethod = exports.PullRequestState = exports.V1TaskRunStatus = void 0;
15
15
  var V1TaskRunStatus;
16
16
  (function (V1TaskRunStatus) {
17
17
  V1TaskRunStatus["PENDING"] = "PENDING";
18
18
  V1TaskRunStatus["RUNNING"] = "RUNNING";
19
- V1TaskRunStatus["EVICTED"] = "EVICTED";
20
19
  V1TaskRunStatus["COMPLETED"] = "COMPLETED";
21
20
  V1TaskRunStatus["FAILED"] = "FAILED";
22
21
  V1TaskRunStatus["CANCELLED"] = "CANCELLED";
@@ -259,6 +258,12 @@ var TenantVersion;
259
258
  TenantVersion["V0"] = "V0";
260
259
  TenantVersion["V1"] = "V1";
261
260
  })(TenantVersion || (exports.TenantVersion = TenantVersion = {}));
261
+ var V1RunningFilter;
262
+ (function (V1RunningFilter) {
263
+ V1RunningFilter["ALL"] = "ALL";
264
+ V1RunningFilter["EVICTED"] = "EVICTED";
265
+ V1RunningFilter["ON_WORKER"] = "ON_WORKER";
266
+ })(V1RunningFilter || (exports.V1RunningFilter = V1RunningFilter = {}));
262
267
  var V1LogLineOrderByDirection;
263
268
  (function (V1LogLineOrderByDirection) {
264
269
  V1LogLineOrderByDirection["ASC"] = "ASC";
@@ -306,7 +311,6 @@ var V1TaskStatus;
306
311
  (function (V1TaskStatus) {
307
312
  V1TaskStatus["QUEUED"] = "QUEUED";
308
313
  V1TaskStatus["RUNNING"] = "RUNNING";
309
- V1TaskStatus["EVICTED"] = "EVICTED";
310
314
  V1TaskStatus["COMPLETED"] = "COMPLETED";
311
315
  V1TaskStatus["CANCELLED"] = "CANCELLED";
312
316
  V1TaskStatus["FAILED"] = "FAILED";
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- const workflows_1 = require("../../protoc/workflows");
15
+ const v1_1 = require("../../v1");
16
16
  const sdk_1 = __importDefault(require("../../sdk"));
17
17
  const hatchet = sdk_1.default.init();
18
18
  // > AffinityWorkflow
@@ -59,7 +59,7 @@ const childWorkflow = {
59
59
  memory: {
60
60
  value: 512,
61
61
  required: true,
62
- comparator: workflows_1.WorkerLabelComparator.LESS_THAN,
62
+ comparator: v1_1.WorkerLabelComparator.LESS_THAN,
63
63
  },
64
64
  },
65
65
  run: (ctx) => __awaiter(void 0, void 0, void 0, function* () {
@@ -56,7 +56,7 @@ class LegacyHatchetClient {
56
56
  this.admin = new admin_client_1.AdminClient(this.config, (0, grpc_helpers_1.channelFactory)(this.config, this.credentials), clientFactory, this.api, this.tenantId, this.listener, this.runs);
57
57
  this.durableListener =
58
58
  durableListener ||
59
- new durable_listener_client_1.DurableListenerClient(this.config, (0, grpc_helpers_1.channelFactory)(this.config, this.credentials), clientFactory, this.api);
59
+ new durable_listener_client_1.DurableListenerClient(this.config, (0, grpc_helpers_1.channelFactory)(this.config, this.credentials), clientFactory);
60
60
  this.logger = logger || this.config.logger('HatchetClient', this.config.log_level);
61
61
  this.logger.debug(`Initialized HatchetClient`);
62
62
  }
package/legacy/step.d.ts CHANGED
@@ -6,8 +6,8 @@ import { LogLevel } from '../clients/event/event-client';
6
6
  import { Logger } from '../util/logger';
7
7
  import WorkflowRunRef from '../util/workflow-run-ref';
8
8
  import { WorkerLabels } from '../clients/dispatcher/dispatcher-client';
9
- import { CreateStepRateLimit, RateLimitDuration, WorkerLabelComparator } from '../protoc/workflows';
10
- import { CreateWorkflowTaskOpts, Priority } from '../v1';
9
+ import { CreateStepRateLimit, RateLimitDuration } from '../protoc/workflows';
10
+ import { CreateWorkflowTaskOpts, Priority, WorkerLabelComparator } from '../v1';
11
11
  import { RunOpts, TaskWorkflowDeclaration, BaseWorkflowDeclaration as WorkflowV1 } from '../v1/declaration';
12
12
  import { Conditions } from '../v1/conditions';
13
13
  import { Duration } from '../v1/client/duration';
package/legacy/step.js CHANGED
@@ -56,6 +56,7 @@ const declaration_1 = require("../v1/declaration");
56
56
  const conditions_1 = require("../v1/conditions");
57
57
  const condition_1 = require("../protoc/v1/shared/condition");
58
58
  const transformer_1 = require("../v1/conditions/transformer");
59
+ const duration_1 = require("../v1/client/duration");
59
60
  const apply_namespace_1 = require("../util/apply-namespace");
60
61
  exports.CreateRateLimitSchema = z.object({
61
62
  key: z.string().optional(),
@@ -76,7 +77,7 @@ exports.DesiredWorkerLabelSchema = z
76
77
  // (optional) comparator for the label
77
78
  // if not provided, the default is EQUAL
78
79
  // desired COMPARATOR actual (i.e. desired > actual for GREATER_THAN)
79
- comparator: z.nativeEnum(workflows_1.WorkerLabelComparator).optional(),
80
+ comparator: z.nativeEnum(v1_1.WorkerLabelComparator).optional(),
80
81
  }),
81
82
  ])
82
83
  .optional();
@@ -323,7 +324,7 @@ class V0Context {
323
324
  this.logger.warn('cannot refresh timeout from context without stepRunId');
324
325
  return;
325
326
  }
326
- yield this.v0.dispatcher.refreshTimeout(incrementBy, taskRunExternalId);
327
+ yield this.v0.dispatcher.refreshTimeout((0, duration_1.durationToString)(incrementBy), taskRunExternalId);
327
328
  });
328
329
  }
329
330
  /**
@@ -32,16 +32,16 @@ declare const StepsSchema: z.ZodArray<z.ZodObject<{
32
32
  value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
33
33
  required: z.ZodOptional<z.ZodBoolean>;
34
34
  weight: z.ZodOptional<z.ZodNumber>;
35
- comparator: z.ZodOptional<z.ZodNativeEnum<typeof import("../protoc/workflows").WorkerLabelComparator>>;
35
+ comparator: z.ZodOptional<z.ZodNativeEnum<typeof import("..").WorkerLabelComparator>>;
36
36
  }, "strip", z.ZodTypeAny, {
37
37
  value: string | number;
38
38
  required?: boolean | undefined;
39
- comparator?: import("../protoc/workflows").WorkerLabelComparator | undefined;
39
+ comparator?: import("..").WorkerLabelComparator | undefined;
40
40
  weight?: number | undefined;
41
41
  }, {
42
42
  value: string | number;
43
43
  required?: boolean | undefined;
44
- comparator?: import("../protoc/workflows").WorkerLabelComparator | undefined;
44
+ comparator?: import("..").WorkerLabelComparator | undefined;
45
45
  weight?: number | undefined;
46
46
  }>]>>>>>;
47
47
  backoff: z.ZodOptional<z.ZodObject<{
@@ -74,7 +74,7 @@ declare const StepsSchema: z.ZodArray<z.ZodObject<{
74
74
  worker_labels?: Record<string, string | number | {
75
75
  value: string | number;
76
76
  required?: boolean | undefined;
77
- comparator?: import("../protoc/workflows").WorkerLabelComparator | undefined;
77
+ comparator?: import("..").WorkerLabelComparator | undefined;
78
78
  weight?: number | undefined;
79
79
  } | undefined> | undefined;
80
80
  }, {
@@ -97,7 +97,7 @@ declare const StepsSchema: z.ZodArray<z.ZodObject<{
97
97
  worker_labels?: Record<string, string | number | {
98
98
  value: string | number;
99
99
  required?: boolean | undefined;
100
- comparator?: import("../protoc/workflows").WorkerLabelComparator | undefined;
100
+ comparator?: import("..").WorkerLabelComparator | undefined;
101
101
  weight?: number | undefined;
102
102
  } | undefined> | undefined;
103
103
  }>, "many">;
@@ -110,14 +110,14 @@ export declare const WorkflowConcurrency: z.ZodObject<{
110
110
  expression: z.ZodOptional<z.ZodString>;
111
111
  }, "strip", z.ZodTypeAny, {
112
112
  name: string;
113
- expression?: string | undefined;
114
113
  maxRuns?: number | undefined;
115
114
  limitStrategy?: PbConcurrencyLimitStrategy | undefined;
115
+ expression?: string | undefined;
116
116
  }, {
117
117
  name: string;
118
- expression?: string | undefined;
119
118
  maxRuns?: number | undefined;
120
119
  limitStrategy?: PbConcurrencyLimitStrategy | undefined;
120
+ expression?: string | undefined;
121
121
  }>;
122
122
  export declare const HatchetTimeoutSchema: z.ZodString;
123
123
  export declare const StickyStrategy: typeof PbStickyStrategy;
@@ -181,16 +181,16 @@ export declare const CreateWorkflowSchema: z.ZodObject<{
181
181
  value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
182
182
  required: z.ZodOptional<z.ZodBoolean>;
183
183
  weight: z.ZodOptional<z.ZodNumber>;
184
- comparator: z.ZodOptional<z.ZodNativeEnum<typeof import("../protoc/workflows").WorkerLabelComparator>>;
184
+ comparator: z.ZodOptional<z.ZodNativeEnum<typeof import("..").WorkerLabelComparator>>;
185
185
  }, "strip", z.ZodTypeAny, {
186
186
  value: string | number;
187
187
  required?: boolean | undefined;
188
- comparator?: import("../protoc/workflows").WorkerLabelComparator | undefined;
188
+ comparator?: import("..").WorkerLabelComparator | undefined;
189
189
  weight?: number | undefined;
190
190
  }, {
191
191
  value: string | number;
192
192
  required?: boolean | undefined;
193
- comparator?: import("../protoc/workflows").WorkerLabelComparator | undefined;
193
+ comparator?: import("..").WorkerLabelComparator | undefined;
194
194
  weight?: number | undefined;
195
195
  }>]>>>>>;
196
196
  backoff: z.ZodOptional<z.ZodObject<{
@@ -223,7 +223,7 @@ export declare const CreateWorkflowSchema: z.ZodObject<{
223
223
  worker_labels?: Record<string, string | number | {
224
224
  value: string | number;
225
225
  required?: boolean | undefined;
226
- comparator?: import("../protoc/workflows").WorkerLabelComparator | undefined;
226
+ comparator?: import("..").WorkerLabelComparator | undefined;
227
227
  weight?: number | undefined;
228
228
  } | undefined> | undefined;
229
229
  }, {
@@ -246,7 +246,7 @@ export declare const CreateWorkflowSchema: z.ZodObject<{
246
246
  worker_labels?: Record<string, string | number | {
247
247
  value: string | number;
248
248
  required?: boolean | undefined;
249
- comparator?: import("../protoc/workflows").WorkerLabelComparator | undefined;
249
+ comparator?: import("..").WorkerLabelComparator | undefined;
250
250
  weight?: number | undefined;
251
251
  } | undefined> | undefined;
252
252
  }>, "many">;
@@ -281,16 +281,16 @@ export declare const CreateWorkflowSchema: z.ZodObject<{
281
281
  value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
282
282
  required: z.ZodOptional<z.ZodBoolean>;
283
283
  weight: z.ZodOptional<z.ZodNumber>;
284
- comparator: z.ZodOptional<z.ZodNativeEnum<typeof import("../protoc/workflows").WorkerLabelComparator>>;
284
+ comparator: z.ZodOptional<z.ZodNativeEnum<typeof import("..").WorkerLabelComparator>>;
285
285
  }, "strip", z.ZodTypeAny, {
286
286
  value: string | number;
287
287
  required?: boolean | undefined;
288
- comparator?: import("../protoc/workflows").WorkerLabelComparator | undefined;
288
+ comparator?: import("..").WorkerLabelComparator | undefined;
289
289
  weight?: number | undefined;
290
290
  }, {
291
291
  value: string | number;
292
292
  required?: boolean | undefined;
293
- comparator?: import("../protoc/workflows").WorkerLabelComparator | undefined;
293
+ comparator?: import("..").WorkerLabelComparator | undefined;
294
294
  weight?: number | undefined;
295
295
  }>]>>>>>;
296
296
  backoff: z.ZodOptional<z.ZodObject<{
@@ -323,7 +323,7 @@ export declare const CreateWorkflowSchema: z.ZodObject<{
323
323
  worker_labels?: Record<string, string | number | {
324
324
  value: string | number;
325
325
  required?: boolean | undefined;
326
- comparator?: import("../protoc/workflows").WorkerLabelComparator | undefined;
326
+ comparator?: import("..").WorkerLabelComparator | undefined;
327
327
  weight?: number | undefined;
328
328
  } | undefined> | undefined;
329
329
  }, {
@@ -346,13 +346,12 @@ export declare const CreateWorkflowSchema: z.ZodObject<{
346
346
  worker_labels?: Record<string, string | number | {
347
347
  value: string | number;
348
348
  required?: boolean | undefined;
349
- comparator?: import("../protoc/workflows").WorkerLabelComparator | undefined;
349
+ comparator?: import("..").WorkerLabelComparator | undefined;
350
350
  weight?: number | undefined;
351
351
  } | undefined> | undefined;
352
352
  }>>;
353
353
  }, "strip", z.ZodTypeAny, {
354
354
  description: string;
355
- id: string;
356
355
  steps: {
357
356
  name: string;
358
357
  timeout?: string | undefined;
@@ -373,14 +372,15 @@ export declare const CreateWorkflowSchema: z.ZodObject<{
373
372
  worker_labels?: Record<string, string | number | {
374
373
  value: string | number;
375
374
  required?: boolean | undefined;
376
- comparator?: import("../protoc/workflows").WorkerLabelComparator | undefined;
375
+ comparator?: import("..").WorkerLabelComparator | undefined;
377
376
  weight?: number | undefined;
378
377
  } | undefined> | undefined;
379
378
  }[];
379
+ id: string;
380
380
  version?: string | undefined;
381
381
  timeout?: string | undefined;
382
- sticky?: PbStickyStrategy | "soft" | "hard" | undefined;
383
382
  scheduleTimeout?: string | undefined;
383
+ sticky?: PbStickyStrategy | "soft" | "hard" | undefined;
384
384
  on?: {
385
385
  cron: string;
386
386
  event?: undefined;
@@ -408,13 +408,12 @@ export declare const CreateWorkflowSchema: z.ZodObject<{
408
408
  worker_labels?: Record<string, string | number | {
409
409
  value: string | number;
410
410
  required?: boolean | undefined;
411
- comparator?: import("../protoc/workflows").WorkerLabelComparator | undefined;
411
+ comparator?: import("..").WorkerLabelComparator | undefined;
412
412
  weight?: number | undefined;
413
413
  } | undefined> | undefined;
414
414
  } | undefined;
415
415
  }, {
416
416
  description: string;
417
- id: string;
418
417
  steps: {
419
418
  name: string;
420
419
  timeout?: string | undefined;
@@ -435,14 +434,15 @@ export declare const CreateWorkflowSchema: z.ZodObject<{
435
434
  worker_labels?: Record<string, string | number | {
436
435
  value: string | number;
437
436
  required?: boolean | undefined;
438
- comparator?: import("../protoc/workflows").WorkerLabelComparator | undefined;
437
+ comparator?: import("..").WorkerLabelComparator | undefined;
439
438
  weight?: number | undefined;
440
439
  } | undefined> | undefined;
441
440
  }[];
441
+ id: string;
442
442
  version?: string | undefined;
443
443
  timeout?: string | undefined;
444
- sticky?: PbStickyStrategy | "soft" | "hard" | undefined;
445
444
  scheduleTimeout?: string | undefined;
445
+ sticky?: PbStickyStrategy | "soft" | "hard" | undefined;
446
446
  on?: {
447
447
  cron: string;
448
448
  event?: undefined;
@@ -470,7 +470,7 @@ export declare const CreateWorkflowSchema: z.ZodObject<{
470
470
  worker_labels?: Record<string, string | number | {
471
471
  value: string | number;
472
472
  required?: boolean | undefined;
473
- comparator?: import("../protoc/workflows").WorkerLabelComparator | undefined;
473
+ comparator?: import("..").WorkerLabelComparator | undefined;
474
474
  weight?: number | undefined;
475
475
  } | undefined> | undefined;
476
476
  } | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hatchet-dev/typescript-sdk",
3
- "version": "1.16.0",
3
+ "version": "1.17.1",
4
4
  "description": "Background task orchestration & visibility for developers",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -176,6 +176,8 @@ export interface AssignedAction {
176
176
  workflowId?: string | undefined;
177
177
  /** (optional) the workflow version id */
178
178
  workflowVersionId?: string | undefined;
179
+ /** (optional) the invocation count for durable task events (required for durable events, otherwise null) */
180
+ durableTaskInvocationCount?: number | undefined;
179
181
  }
180
182
  export interface WorkerListenRequest {
181
183
  /** the id of the worker */
@@ -314,6 +316,12 @@ export interface ReleaseSlotRequest {
314
316
  }
315
317
  export interface ReleaseSlotResponse {
316
318
  }
319
+ export interface RestoreEvictedTaskRequest {
320
+ taskRunExternalId: string;
321
+ }
322
+ export interface RestoreEvictedTaskResponse {
323
+ requeued: boolean;
324
+ }
317
325
  export interface GetVersionRequest {
318
326
  }
319
327
  export interface GetVersionResponse {
@@ -348,6 +356,8 @@ export declare const RefreshTimeoutRequest: MessageFns<RefreshTimeoutRequest>;
348
356
  export declare const RefreshTimeoutResponse: MessageFns<RefreshTimeoutResponse>;
349
357
  export declare const ReleaseSlotRequest: MessageFns<ReleaseSlotRequest>;
350
358
  export declare const ReleaseSlotResponse: MessageFns<ReleaseSlotResponse>;
359
+ export declare const RestoreEvictedTaskRequest: MessageFns<RestoreEvictedTaskRequest>;
360
+ export declare const RestoreEvictedTaskResponse: MessageFns<RestoreEvictedTaskResponse>;
351
361
  export declare const GetVersionRequest: MessageFns<GetVersionRequest>;
352
362
  export declare const GetVersionResponse: MessageFns<GetVersionResponse>;
353
363
  export type DispatcherDefinition = typeof DispatcherDefinition;
@@ -456,6 +466,14 @@ export declare const DispatcherDefinition: {
456
466
  readonly responseStream: false;
457
467
  readonly options: {};
458
468
  };
469
+ readonly restoreEvictedTask: {
470
+ readonly name: "RestoreEvictedTask";
471
+ readonly requestType: MessageFns<RestoreEvictedTaskRequest>;
472
+ readonly requestStream: false;
473
+ readonly responseType: MessageFns<RestoreEvictedTaskResponse>;
474
+ readonly responseStream: false;
475
+ readonly options: {};
476
+ };
459
477
  readonly upsertWorkerLabels: {
460
478
  readonly name: "UpsertWorkerLabels";
461
479
  readonly requestType: MessageFns<UpsertWorkerLabelsRequest>;
@@ -497,6 +515,7 @@ export interface DispatcherServiceImplementation<CallContextExt = {}> {
497
515
  unsubscribe(request: WorkerUnsubscribeRequest, context: CallContext & CallContextExt): Promise<DeepPartial<WorkerUnsubscribeResponse>>;
498
516
  refreshTimeout(request: RefreshTimeoutRequest, context: CallContext & CallContextExt): Promise<DeepPartial<RefreshTimeoutResponse>>;
499
517
  releaseSlot(request: ReleaseSlotRequest, context: CallContext & CallContextExt): Promise<DeepPartial<ReleaseSlotResponse>>;
518
+ restoreEvictedTask(request: RestoreEvictedTaskRequest, context: CallContext & CallContextExt): Promise<DeepPartial<RestoreEvictedTaskResponse>>;
500
519
  upsertWorkerLabels(request: UpsertWorkerLabelsRequest, context: CallContext & CallContextExt): Promise<DeepPartial<UpsertWorkerLabelsResponse>>;
501
520
  /**
502
521
  * GetVersion returns the dispatcher protocol version as a simple integer.
@@ -523,6 +542,7 @@ export interface DispatcherClient<CallOptionsExt = {}> {
523
542
  unsubscribe(request: DeepPartial<WorkerUnsubscribeRequest>, options?: CallOptions & CallOptionsExt): Promise<WorkerUnsubscribeResponse>;
524
543
  refreshTimeout(request: DeepPartial<RefreshTimeoutRequest>, options?: CallOptions & CallOptionsExt): Promise<RefreshTimeoutResponse>;
525
544
  releaseSlot(request: DeepPartial<ReleaseSlotRequest>, options?: CallOptions & CallOptionsExt): Promise<ReleaseSlotResponse>;
545
+ restoreEvictedTask(request: DeepPartial<RestoreEvictedTaskRequest>, options?: CallOptions & CallOptionsExt): Promise<RestoreEvictedTaskResponse>;
526
546
  upsertWorkerLabels(request: DeepPartial<UpsertWorkerLabelsRequest>, options?: CallOptions & CallOptionsExt): Promise<UpsertWorkerLabelsResponse>;
527
547
  /**
528
548
  * GetVersion returns the dispatcher protocol version as a simple integer.