hatchet-sdk 0.9.0 → 0.10.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bf12b2683a7b26125e459a66b28acfa0d0c04cc5a4b148cadcce6a29f69b53ea
4
- data.tar.gz: ea2fc0114f0a8d236d899b1713c85e5383bf83ab19cc0099020d680f35501db0
3
+ metadata.gz: 3aa9e9dfe25de088ac7547122312fcc00785d16fe684d94711c2c9a995a498de
4
+ data.tar.gz: 430f50e3ad3cc881dd286e1fd4aaf13847f6f16afc5955cc88668a910a21832f
5
5
  SHA512:
6
- metadata.gz: fd9e284829bb0ede7127685699cd79e0c5283d693aee9bc5e6e201cd2518e20c08e83e884054a3325bda3c0435e5743ff35137f6ebb44cbeea9383b83617250b
7
- data.tar.gz: 7ac930e2413632481a339e892cbc932fc205d15c6012a2f9e4ea43fe002282c40a24a6f47d555c1fd222c285ee16a2c5155595a2405c89fd3c975ce86e77a32c
6
+ metadata.gz: da3ee8b297a012b0c723333425093137dd546c28295ca4794bfbc9cefda3d986435eb8c5f553b8f4a1872320a758e490c5d1ad63d029b730631ab9554ea6ba9b
7
+ data.tar.gz: 9d8758f0e478e739de77b16a9e1da0a4d50e1c135c7d4365e9bda1f8b3d3621da7f3118c911cad0f3ced9c839d80dc0843b080b35f270eb86ea4ed5236b8bd08
data/CHANGELOG.md CHANGED
@@ -5,6 +5,12 @@ All notable changes to Hatchet's Ruby SDK will be documented in this changelog.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.10.0] - 2026-10-08
9
+
10
+ ### Added
11
+
12
+ - Adds `RetryAfterError`, which allows for custom retry strategies.
13
+
8
14
  ## [0.9.0] - 2026-09-23
9
15
 
10
16
  ### Added
@@ -138,8 +138,10 @@ module Hatchet
138
138
  # @param payload [String] JSON-serialized event payload
139
139
  # @param retry_count [Integer, nil] Current retry count
140
140
  # @param should_not_retry [Boolean, nil] Whether to suppress further retries
141
+ # @param retry_after_ms [Integer, nil] Delay in milliseconds before the next attempt
141
142
  # @return [ActionEventResponse]
142
- def send_step_action_event(action:, event_type:, payload: "{}", retry_count: nil, should_not_retry: nil)
143
+ def send_step_action_event(action:, event_type:, payload: "{}", retry_count: nil, should_not_retry: nil,
144
+ retry_after_ms: nil)
143
145
  ensure_connected!
144
146
 
145
147
  now = Time.now
@@ -162,6 +164,7 @@ module Hatchet
162
164
 
163
165
  event_args[:retry_count] = retry_count unless retry_count.nil?
164
166
  event_args[:should_not_retry] = should_not_retry unless should_not_retry.nil?
167
+ event_args[:retry_after_ms] = retry_after_ms unless retry_after_ms.nil?
165
168
 
166
169
  request = ::StepActionEvent.new(**event_args)
167
170
  @stub.send_step_action_event(request, metadata: @config.auth_metadata)
@@ -173,7 +176,7 @@ module Hatchet
173
176
  # @param action [AssignedAction] The assigned START_BATCH action
174
177
  # @param event_type [Symbol] Protobuf enum value (e.g., :STEP_EVENT_TYPE_COMPLETED)
175
178
  # @param items [Array<Hash>] Per-member items, each with :task_run_external_id, and
176
- # optionally :event_payload, :retry_count, :should_not_retry
179
+ # optionally :event_payload, :retry_count, :should_not_retry, :retry_after_ms
177
180
  # @return [ActionEventResponse]
178
181
  def send_batch_action_event(action:, event_type:, items:)
179
182
  ensure_connected!
@@ -191,6 +194,7 @@ module Hatchet
191
194
  }
192
195
  item_args[:retry_count] = item[:retry_count] unless item[:retry_count].nil?
193
196
  item_args[:should_not_retry] = item[:should_not_retry] unless item[:should_not_retry].nil?
197
+ item_args[:retry_after_ms] = item[:retry_after_ms] unless item[:retry_after_ms].nil?
194
198
 
195
199
  ::BatchActionEventItem.new(**item_args)
196
200
  end
@@ -25,6 +25,7 @@ lib/hatchet-sdk-rest/api/rate_limits_api.rb
25
25
  lib/hatchet-sdk-rest/api/slack_api.rb
26
26
  lib/hatchet-sdk-rest/api/sns_api.rb
27
27
  lib/hatchet-sdk-rest/api/step_run_api.rb
28
+ lib/hatchet-sdk-rest/api/streams_api.rb
28
29
  lib/hatchet-sdk-rest/api/task_api.rb
29
30
  lib/hatchet-sdk-rest/api/tenant_api.rb
30
31
  lib/hatchet-sdk-rest/api/user_api.rb
@@ -207,6 +208,7 @@ lib/hatchet-sdk-rest/models/v1_replayed_tasks.rb
207
208
  lib/hatchet-sdk-rest/models/v1_restore_task_response.rb
208
209
  lib/hatchet-sdk-rest/models/v1_running_detail_count.rb
209
210
  lib/hatchet-sdk-rest/models/v1_running_filter.rb
211
+ lib/hatchet-sdk-rest/models/v1_stream_payload_ref.rb
210
212
  lib/hatchet-sdk-rest/models/v1_task_event.rb
211
213
  lib/hatchet-sdk-rest/models/v1_task_event_list.rb
212
214
  lib/hatchet-sdk-rest/models/v1_task_event_type.rb
@@ -235,6 +237,7 @@ lib/hatchet-sdk-rest/models/v1_webhook_list.rb
235
237
  lib/hatchet-sdk-rest/models/v1_webhook_response.rb
236
238
  lib/hatchet-sdk-rest/models/v1_webhook_source_name.rb
237
239
  lib/hatchet-sdk-rest/models/v1_workflow_run.rb
240
+ lib/hatchet-sdk-rest/models/v1_workflow_run_count.rb
238
241
  lib/hatchet-sdk-rest/models/v1_workflow_run_details.rb
239
242
  lib/hatchet-sdk-rest/models/v1_workflow_run_display_name.rb
240
243
  lib/hatchet-sdk-rest/models/v1_workflow_run_display_name_list.rb
@@ -151,6 +151,8 @@ Class | Method | HTTP request | Description
151
151
  *HatchetSdkRest::StepRunApi* | [**step_run_update_cancel**](docs/StepRunApi.md#step_run_update_cancel) | **POST** /api/v1/tenants/{tenant}/step-runs/{step-run}/cancel | Attempts to cancel a step run
152
152
  *HatchetSdkRest::StepRunApi* | [**step_run_update_rerun**](docs/StepRunApi.md#step_run_update_rerun) | **POST** /api/v1/tenants/{tenant}/step-runs/{step-run}/rerun | Rerun step run
153
153
  *HatchetSdkRest::StepRunApi* | [**workflow_run_list_step_run_events**](docs/StepRunApi.md#workflow_run_list_step_run_events) | **GET** /api/v1/tenants/{tenant}/workflow-runs/{workflow-run}/step-run-events | List events for all step runs for a workflow run
154
+ *HatchetSdkRest::StreamsApi* | [**v1_stream_payload_get**](docs/StreamsApi.md#v1_stream_payload_get) | **GET** /api/v1/stable/tenants/{tenant}/streams/payloads | Get stream payload
155
+ *HatchetSdkRest::StreamsApi* | [**v1_stream_payload_upload**](docs/StreamsApi.md#v1_stream_payload_upload) | **POST** /api/v1/stable/tenants/{tenant}/streams/payloads | Upload stream payload
154
156
  *HatchetSdkRest::TaskApi* | [**v1_dag_list_tasks**](docs/TaskApi.md#v1_dag_list_tasks) | **GET** /api/v1/stable/dags/tasks | List tasks
155
157
  *HatchetSdkRest::TaskApi* | [**v1_task_cancel**](docs/TaskApi.md#v1_task_cancel) | **POST** /api/v1/stable/tenants/{tenant}/tasks/cancel | Cancel tasks
156
158
  *HatchetSdkRest::TaskApi* | [**v1_task_event_list**](docs/TaskApi.md#v1_task_event_list) | **GET** /api/v1/stable/tasks/{task}/task-events | List events for a task
@@ -231,6 +233,7 @@ Class | Method | HTTP request | Description
231
233
  *HatchetSdkRest::WorkflowRunApi* | [**workflow_run_get_input**](docs/WorkflowRunApi.md#workflow_run_get_input) | **GET** /api/v1/tenants/{tenant}/workflow-runs/{workflow-run}/input | Get workflow run input
232
234
  *HatchetSdkRest::WorkflowRunApi* | [**workflow_run_update_replay**](docs/WorkflowRunApi.md#workflow_run_update_replay) | **POST** /api/v1/tenants/{tenant}/workflow-runs/replay | Replay workflow runs
233
235
  *HatchetSdkRest::WorkflowRunsApi* | [**v1_durable_task_branch**](docs/WorkflowRunsApi.md#v1_durable_task_branch) | **POST** /api/v1/stable/tenants/{tenant}/durable-tasks/branch | Branch durable task
236
+ *HatchetSdkRest::WorkflowRunsApi* | [**v1_workflow_run_count_get**](docs/WorkflowRunsApi.md#v1_workflow_run_count_get) | **GET** /api/v1/stable/tenants/{tenant}/workflow-runs/count | Count workflow runs
234
237
  *HatchetSdkRest::WorkflowRunsApi* | [**v1_workflow_run_create**](docs/WorkflowRunsApi.md#v1_workflow_run_create) | **POST** /api/v1/stable/tenants/{tenant}/workflow-runs/trigger | Create workflow run
235
238
  *HatchetSdkRest::WorkflowRunsApi* | [**v1_workflow_run_display_names_list**](docs/WorkflowRunsApi.md#v1_workflow_run_display_names_list) | **GET** /api/v1/stable/tenants/{tenant}/workflow-runs/display-names | List workflow runs
236
239
  *HatchetSdkRest::WorkflowRunsApi* | [**v1_workflow_run_external_ids_list**](docs/WorkflowRunsApi.md#v1_workflow_run_external_ids_list) | **GET** /api/v1/stable/tenants/{tenant}/workflow-runs/external-ids | List workflow run external ids
@@ -414,6 +417,7 @@ Class | Method | HTTP request | Description
414
417
  - [HatchetSdkRest::V1RestoreTaskResponse](docs/V1RestoreTaskResponse.md)
415
418
  - [HatchetSdkRest::V1RunningDetailCount](docs/V1RunningDetailCount.md)
416
419
  - [HatchetSdkRest::V1RunningFilter](docs/V1RunningFilter.md)
420
+ - [HatchetSdkRest::V1StreamPayloadRef](docs/V1StreamPayloadRef.md)
417
421
  - [HatchetSdkRest::V1TaskEvent](docs/V1TaskEvent.md)
418
422
  - [HatchetSdkRest::V1TaskEventList](docs/V1TaskEventList.md)
419
423
  - [HatchetSdkRest::V1TaskEventType](docs/V1TaskEventType.md)
@@ -442,6 +446,7 @@ Class | Method | HTTP request | Description
442
446
  - [HatchetSdkRest::V1WebhookResponse](docs/V1WebhookResponse.md)
443
447
  - [HatchetSdkRest::V1WebhookSourceName](docs/V1WebhookSourceName.md)
444
448
  - [HatchetSdkRest::V1WorkflowRun](docs/V1WorkflowRun.md)
449
+ - [HatchetSdkRest::V1WorkflowRunCount](docs/V1WorkflowRunCount.md)
445
450
  - [HatchetSdkRest::V1WorkflowRunDetails](docs/V1WorkflowRunDetails.md)
446
451
  - [HatchetSdkRest::V1WorkflowRunDisplayName](docs/V1WorkflowRunDisplayName.md)
447
452
  - [HatchetSdkRest::V1WorkflowRunDisplayNameList](docs/V1WorkflowRunDisplayNameList.md)
@@ -0,0 +1,183 @@
1
+ =begin
2
+ #Hatchet API
3
+
4
+ #The Hatchet API
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module HatchetSdkRest
16
+ class StreamsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Get stream payload
23
+ # Get a durable stream payload uploaded ahead of its publish, by the payload_ref of the message that references it.
24
+ # @param tenant [String] The tenant id
25
+ # @param ref [String] The payload_ref of the stream message
26
+ # @param [Hash] opts the optional parameters
27
+ # @return [File]
28
+ def v1_stream_payload_get(tenant, ref, opts = {})
29
+ data, _status_code, _headers = v1_stream_payload_get_with_http_info(tenant, ref, opts)
30
+ data
31
+ end
32
+
33
+ # Get stream payload
34
+ # Get a durable stream payload uploaded ahead of its publish, by the payload_ref of the message that references it.
35
+ # @param tenant [String] The tenant id
36
+ # @param ref [String] The payload_ref of the stream message
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [Array<(File, Integer, Hash)>] File data, response status code and response headers
39
+ def v1_stream_payload_get_with_http_info(tenant, ref, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: StreamsApi.v1_stream_payload_get ...'
42
+ end
43
+ # verify the required parameter 'tenant' is set
44
+ if @api_client.config.client_side_validation && tenant.nil?
45
+ fail ArgumentError, "Missing the required parameter 'tenant' when calling StreamsApi.v1_stream_payload_get"
46
+ end
47
+ if @api_client.config.client_side_validation && tenant.to_s.length > 36
48
+ fail ArgumentError, 'invalid value for "tenant" when calling StreamsApi.v1_stream_payload_get, the character length must be smaller than or equal to 36.'
49
+ end
50
+
51
+ if @api_client.config.client_side_validation && tenant.to_s.length < 36
52
+ fail ArgumentError, 'invalid value for "tenant" when calling StreamsApi.v1_stream_payload_get, the character length must be greater than or equal to 36.'
53
+ end
54
+
55
+ # verify the required parameter 'ref' is set
56
+ if @api_client.config.client_side_validation && ref.nil?
57
+ fail ArgumentError, "Missing the required parameter 'ref' when calling StreamsApi.v1_stream_payload_get"
58
+ end
59
+ # resource path
60
+ local_var_path = '/api/v1/stable/tenants/{tenant}/streams/payloads'.sub('{' + 'tenant' + '}', CGI.escape(tenant.to_s))
61
+
62
+ # query parameters
63
+ query_params = opts[:query_params] || {}
64
+ query_params[:'ref'] = ref
65
+
66
+ # header parameters
67
+ header_params = opts[:header_params] || {}
68
+ # HTTP header 'Accept' (if needed)
69
+ header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream', 'application/json']) unless header_params['Accept']
70
+
71
+ # form parameters
72
+ form_params = opts[:form_params] || {}
73
+
74
+ # http body (model)
75
+ post_body = opts[:debug_body]
76
+
77
+ # return_type
78
+ return_type = opts[:debug_return_type] || 'File'
79
+
80
+ # auth_names
81
+ auth_names = opts[:debug_auth_names] || ['cookieAuth', 'bearerAuth']
82
+
83
+ new_options = opts.merge(
84
+ :operation => :"StreamsApi.v1_stream_payload_get",
85
+ :header_params => header_params,
86
+ :query_params => query_params,
87
+ :form_params => form_params,
88
+ :body => post_body,
89
+ :auth_names => auth_names,
90
+ :return_type => return_type
91
+ )
92
+
93
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
94
+ if @api_client.config.debugging
95
+ @api_client.config.logger.debug "API called: StreamsApi#v1_stream_payload_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
96
+ end
97
+ return data, status_code, headers
98
+ end
99
+
100
+ # Upload stream payload
101
+ # Upload a payload too large for a gRPC publish, then publish the message with the returned ref as its payload_ref.
102
+ # @param tenant [String] The tenant id
103
+ # @param payload [File]
104
+ # @param [Hash] opts the optional parameters
105
+ # @return [V1StreamPayloadRef]
106
+ def v1_stream_payload_upload(tenant, payload, opts = {})
107
+ data, _status_code, _headers = v1_stream_payload_upload_with_http_info(tenant, payload, opts)
108
+ data
109
+ end
110
+
111
+ # Upload stream payload
112
+ # Upload a payload too large for a gRPC publish, then publish the message with the returned ref as its payload_ref.
113
+ # @param tenant [String] The tenant id
114
+ # @param payload [File]
115
+ # @param [Hash] opts the optional parameters
116
+ # @return [Array<(V1StreamPayloadRef, Integer, Hash)>] V1StreamPayloadRef data, response status code and response headers
117
+ def v1_stream_payload_upload_with_http_info(tenant, payload, opts = {})
118
+ if @api_client.config.debugging
119
+ @api_client.config.logger.debug 'Calling API: StreamsApi.v1_stream_payload_upload ...'
120
+ end
121
+ # verify the required parameter 'tenant' is set
122
+ if @api_client.config.client_side_validation && tenant.nil?
123
+ fail ArgumentError, "Missing the required parameter 'tenant' when calling StreamsApi.v1_stream_payload_upload"
124
+ end
125
+ if @api_client.config.client_side_validation && tenant.to_s.length > 36
126
+ fail ArgumentError, 'invalid value for "tenant" when calling StreamsApi.v1_stream_payload_upload, the character length must be smaller than or equal to 36.'
127
+ end
128
+
129
+ if @api_client.config.client_side_validation && tenant.to_s.length < 36
130
+ fail ArgumentError, 'invalid value for "tenant" when calling StreamsApi.v1_stream_payload_upload, the character length must be greater than or equal to 36.'
131
+ end
132
+
133
+ # verify the required parameter 'payload' is set
134
+ if @api_client.config.client_side_validation && payload.nil?
135
+ fail ArgumentError, "Missing the required parameter 'payload' when calling StreamsApi.v1_stream_payload_upload"
136
+ end
137
+ # resource path
138
+ local_var_path = '/api/v1/stable/tenants/{tenant}/streams/payloads'.sub('{' + 'tenant' + '}', CGI.escape(tenant.to_s))
139
+
140
+ # query parameters
141
+ query_params = opts[:query_params] || {}
142
+
143
+ # header parameters
144
+ header_params = opts[:header_params] || {}
145
+ # HTTP header 'Accept' (if needed)
146
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
147
+ # HTTP header 'Content-Type'
148
+ content_type = @api_client.select_header_content_type(['multipart/form-data'])
149
+ if !content_type.nil?
150
+ header_params['Content-Type'] = content_type
151
+ end
152
+
153
+ # form parameters
154
+ form_params = opts[:form_params] || {}
155
+ form_params['payload'] = payload
156
+
157
+ # http body (model)
158
+ post_body = opts[:debug_body]
159
+
160
+ # return_type
161
+ return_type = opts[:debug_return_type] || 'V1StreamPayloadRef'
162
+
163
+ # auth_names
164
+ auth_names = opts[:debug_auth_names] || ['cookieAuth', 'bearerAuth']
165
+
166
+ new_options = opts.merge(
167
+ :operation => :"StreamsApi.v1_stream_payload_upload",
168
+ :header_params => header_params,
169
+ :query_params => query_params,
170
+ :form_params => form_params,
171
+ :body => post_body,
172
+ :auth_names => auth_names,
173
+ :return_type => return_type
174
+ )
175
+
176
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
177
+ if @api_client.config.debugging
178
+ @api_client.config.logger.debug "API called: StreamsApi#v1_stream_payload_upload\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
179
+ end
180
+ return data, status_code, headers
181
+ end
182
+ end
183
+ end
@@ -101,6 +101,145 @@ module HatchetSdkRest
101
101
  return data, status_code, headers
102
102
  end
103
103
 
104
+ # Count workflow runs
105
+ # Counts the workflow runs for a tenant matching the provided filters. The count is capped, so it is a lower bound when it reaches the cap.
106
+ # @param tenant [String] The tenant id
107
+ # @param since [Time] The earliest date to filter by
108
+ # @param only_tasks [Boolean] Whether to include DAGs or only to include tasks
109
+ # @param [Hash] opts the optional parameters
110
+ # @option opts [Array<V1TaskStatus>] :statuses A list of statuses to filter by
111
+ # @option opts [Time] :_until The latest date to filter by
112
+ # @option opts [Array<String>] :additional_metadata Additional metadata k-v pairs to filter by
113
+ # @option opts [V1AdditionalMetadataOperator] :additional_metadata_operator How to combine multiple additional_metadata pairs. OR matches runs containing any pair, AND matches runs containing all pairs. Defaults to OR.
114
+ # @option opts [Array<String>] :workflow_ids The workflow ids to find runs for
115
+ # @option opts [String] :worker_id The worker id to filter by
116
+ # @option opts [String] :parent_task_external_id The parent task external id to filter by
117
+ # @option opts [String] :triggering_event_external_id The external id of the event that triggered the workflow run
118
+ # @option opts [V1RunningFilter] :running_filter 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.
119
+ # @option opts [Array<String>] :idempotency_keys The idempotency key(s) to filter for
120
+ # @return [V1WorkflowRunCount]
121
+ def v1_workflow_run_count_get(tenant, since, only_tasks, opts = {})
122
+ data, _status_code, _headers = v1_workflow_run_count_get_with_http_info(tenant, since, only_tasks, opts)
123
+ data
124
+ end
125
+
126
+ # Count workflow runs
127
+ # Counts the workflow runs for a tenant matching the provided filters. The count is capped, so it is a lower bound when it reaches the cap.
128
+ # @param tenant [String] The tenant id
129
+ # @param since [Time] The earliest date to filter by
130
+ # @param only_tasks [Boolean] Whether to include DAGs or only to include tasks
131
+ # @param [Hash] opts the optional parameters
132
+ # @option opts [Array<V1TaskStatus>] :statuses A list of statuses to filter by
133
+ # @option opts [Time] :_until The latest date to filter by
134
+ # @option opts [Array<String>] :additional_metadata Additional metadata k-v pairs to filter by
135
+ # @option opts [V1AdditionalMetadataOperator] :additional_metadata_operator How to combine multiple additional_metadata pairs. OR matches runs containing any pair, AND matches runs containing all pairs. Defaults to OR.
136
+ # @option opts [Array<String>] :workflow_ids The workflow ids to find runs for
137
+ # @option opts [String] :worker_id The worker id to filter by
138
+ # @option opts [String] :parent_task_external_id The parent task external id to filter by
139
+ # @option opts [String] :triggering_event_external_id The external id of the event that triggered the workflow run
140
+ # @option opts [V1RunningFilter] :running_filter 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.
141
+ # @option opts [Array<String>] :idempotency_keys The idempotency key(s) to filter for
142
+ # @return [Array<(V1WorkflowRunCount, Integer, Hash)>] V1WorkflowRunCount data, response status code and response headers
143
+ def v1_workflow_run_count_get_with_http_info(tenant, since, only_tasks, opts = {})
144
+ if @api_client.config.debugging
145
+ @api_client.config.logger.debug 'Calling API: WorkflowRunsApi.v1_workflow_run_count_get ...'
146
+ end
147
+ # verify the required parameter 'tenant' is set
148
+ if @api_client.config.client_side_validation && tenant.nil?
149
+ fail ArgumentError, "Missing the required parameter 'tenant' when calling WorkflowRunsApi.v1_workflow_run_count_get"
150
+ end
151
+ if @api_client.config.client_side_validation && tenant.to_s.length > 36
152
+ fail ArgumentError, 'invalid value for "tenant" when calling WorkflowRunsApi.v1_workflow_run_count_get, the character length must be smaller than or equal to 36.'
153
+ end
154
+
155
+ if @api_client.config.client_side_validation && tenant.to_s.length < 36
156
+ fail ArgumentError, 'invalid value for "tenant" when calling WorkflowRunsApi.v1_workflow_run_count_get, the character length must be greater than or equal to 36.'
157
+ end
158
+
159
+ # verify the required parameter 'since' is set
160
+ if @api_client.config.client_side_validation && since.nil?
161
+ fail ArgumentError, "Missing the required parameter 'since' when calling WorkflowRunsApi.v1_workflow_run_count_get"
162
+ end
163
+ # verify the required parameter 'only_tasks' is set
164
+ if @api_client.config.client_side_validation && only_tasks.nil?
165
+ fail ArgumentError, "Missing the required parameter 'only_tasks' when calling WorkflowRunsApi.v1_workflow_run_count_get"
166
+ end
167
+ if @api_client.config.client_side_validation && !opts[:'worker_id'].nil? && opts[:'worker_id'].to_s.length > 36
168
+ fail ArgumentError, 'invalid value for "opts[:"worker_id"]" when calling WorkflowRunsApi.v1_workflow_run_count_get, the character length must be smaller than or equal to 36.'
169
+ end
170
+
171
+ if @api_client.config.client_side_validation && !opts[:'worker_id'].nil? && opts[:'worker_id'].to_s.length < 36
172
+ fail ArgumentError, 'invalid value for "opts[:"worker_id"]" when calling WorkflowRunsApi.v1_workflow_run_count_get, the character length must be greater than or equal to 36.'
173
+ end
174
+
175
+ if @api_client.config.client_side_validation && !opts[:'parent_task_external_id'].nil? && opts[:'parent_task_external_id'].to_s.length > 36
176
+ fail ArgumentError, 'invalid value for "opts[:"parent_task_external_id"]" when calling WorkflowRunsApi.v1_workflow_run_count_get, the character length must be smaller than or equal to 36.'
177
+ end
178
+
179
+ if @api_client.config.client_side_validation && !opts[:'parent_task_external_id'].nil? && opts[:'parent_task_external_id'].to_s.length < 36
180
+ fail ArgumentError, 'invalid value for "opts[:"parent_task_external_id"]" when calling WorkflowRunsApi.v1_workflow_run_count_get, the character length must be greater than or equal to 36.'
181
+ end
182
+
183
+ if @api_client.config.client_side_validation && !opts[:'triggering_event_external_id'].nil? && opts[:'triggering_event_external_id'].to_s.length > 36
184
+ fail ArgumentError, 'invalid value for "opts[:"triggering_event_external_id"]" when calling WorkflowRunsApi.v1_workflow_run_count_get, the character length must be smaller than or equal to 36.'
185
+ end
186
+
187
+ if @api_client.config.client_side_validation && !opts[:'triggering_event_external_id'].nil? && opts[:'triggering_event_external_id'].to_s.length < 36
188
+ fail ArgumentError, 'invalid value for "opts[:"triggering_event_external_id"]" when calling WorkflowRunsApi.v1_workflow_run_count_get, the character length must be greater than or equal to 36.'
189
+ end
190
+
191
+ # resource path
192
+ local_var_path = '/api/v1/stable/tenants/{tenant}/workflow-runs/count'.sub('{' + 'tenant' + '}', CGI.escape(tenant.to_s))
193
+
194
+ # query parameters
195
+ query_params = opts[:query_params] || {}
196
+ query_params[:'since'] = since
197
+ query_params[:'only_tasks'] = only_tasks
198
+ query_params[:'statuses'] = @api_client.build_collection_param(opts[:'statuses'], :multi) if !opts[:'statuses'].nil?
199
+ query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?
200
+ query_params[:'additional_metadata'] = @api_client.build_collection_param(opts[:'additional_metadata'], :multi) if !opts[:'additional_metadata'].nil?
201
+ query_params[:'additional_metadata_operator'] = opts[:'additional_metadata_operator'] if !opts[:'additional_metadata_operator'].nil?
202
+ query_params[:'workflow_ids'] = @api_client.build_collection_param(opts[:'workflow_ids'], :multi) if !opts[:'workflow_ids'].nil?
203
+ query_params[:'worker_id'] = opts[:'worker_id'] if !opts[:'worker_id'].nil?
204
+ query_params[:'parent_task_external_id'] = opts[:'parent_task_external_id'] if !opts[:'parent_task_external_id'].nil?
205
+ query_params[:'triggering_event_external_id'] = opts[:'triggering_event_external_id'] if !opts[:'triggering_event_external_id'].nil?
206
+ query_params[:'running_filter'] = opts[:'running_filter'] if !opts[:'running_filter'].nil?
207
+ query_params[:'idempotency_keys'] = @api_client.build_collection_param(opts[:'idempotency_keys'], :multi) if !opts[:'idempotency_keys'].nil?
208
+
209
+ # header parameters
210
+ header_params = opts[:header_params] || {}
211
+ # HTTP header 'Accept' (if needed)
212
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
213
+
214
+ # form parameters
215
+ form_params = opts[:form_params] || {}
216
+
217
+ # http body (model)
218
+ post_body = opts[:debug_body]
219
+
220
+ # return_type
221
+ return_type = opts[:debug_return_type] || 'V1WorkflowRunCount'
222
+
223
+ # auth_names
224
+ auth_names = opts[:debug_auth_names] || ['cookieAuth', 'bearerAuth']
225
+
226
+ new_options = opts.merge(
227
+ :operation => :"WorkflowRunsApi.v1_workflow_run_count_get",
228
+ :header_params => header_params,
229
+ :query_params => query_params,
230
+ :form_params => form_params,
231
+ :body => post_body,
232
+ :auth_names => auth_names,
233
+ :return_type => return_type
234
+ )
235
+
236
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
237
+ if @api_client.config.debugging
238
+ @api_client.config.logger.debug "API called: WorkflowRunsApi#v1_workflow_run_count_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
239
+ end
240
+ return data, status_code, headers
241
+ end
242
+
104
243
  # Create workflow run
105
244
  # Trigger a new workflow run
106
245
  # @param tenant [String] The tenant id
@@ -592,6 +731,7 @@ module HatchetSdkRest
592
731
  # @option opts [Boolean] :include_payloads A flag for whether or not to include the input and output payloads in the response. Defaults to &#x60;true&#x60; if unset.
593
732
  # @option opts [V1RunningFilter] :running_filter 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.
594
733
  # @option opts [Array<String>] :idempotency_keys The idempotency key(s) to filter for
734
+ # @option opts [Boolean] :include_num_pages A flag for whether or not to count the matching runs in order to populate &#x60;pagination.num_pages&#x60;. Defaults to &#x60;true&#x60; if unset. When &#x60;false&#x60;, &#x60;pagination.num_pages&#x60; is &#x60;0&#x60;, and the count can be fetched separately from the count endpoint.
595
735
  # @return [V1TaskSummaryList]
596
736
  def v1_workflow_run_list(tenant, since, only_tasks, opts = {})
597
737
  data, _status_code, _headers = v1_workflow_run_list_with_http_info(tenant, since, only_tasks, opts)
@@ -617,6 +757,7 @@ module HatchetSdkRest
617
757
  # @option opts [Boolean] :include_payloads A flag for whether or not to include the input and output payloads in the response. Defaults to &#x60;true&#x60; if unset.
618
758
  # @option opts [V1RunningFilter] :running_filter 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.
619
759
  # @option opts [Array<String>] :idempotency_keys The idempotency key(s) to filter for
760
+ # @option opts [Boolean] :include_num_pages A flag for whether or not to count the matching runs in order to populate &#x60;pagination.num_pages&#x60;. Defaults to &#x60;true&#x60; if unset. When &#x60;false&#x60;, &#x60;pagination.num_pages&#x60; is &#x60;0&#x60;, and the count can be fetched separately from the count endpoint.
620
761
  # @return [Array<(V1TaskSummaryList, Integer, Hash)>] V1TaskSummaryList data, response status code and response headers
621
762
  def v1_workflow_run_list_with_http_info(tenant, since, only_tasks, opts = {})
622
763
  if @api_client.config.debugging
@@ -686,6 +827,7 @@ module HatchetSdkRest
686
827
  query_params[:'include_payloads'] = opts[:'include_payloads'] if !opts[:'include_payloads'].nil?
687
828
  query_params[:'running_filter'] = opts[:'running_filter'] if !opts[:'running_filter'].nil?
688
829
  query_params[:'idempotency_keys'] = @api_client.build_collection_param(opts[:'idempotency_keys'], :multi) if !opts[:'idempotency_keys'].nil?
830
+ query_params[:'include_num_pages'] = opts[:'include_num_pages'] if !opts[:'include_num_pages'].nil?
689
831
 
690
832
  # header parameters
691
833
  header_params = opts[:header_params] || {}
@@ -0,0 +1,238 @@
1
+ =begin
2
+ #Hatchet API
3
+
4
+ #The Hatchet API
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module HatchetSdkRest
17
+ class V1StreamPayloadRef
18
+ # Publish the message with this as its payload_ref
19
+ attr_accessor :ref
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'ref' => :'ref'
25
+ }
26
+ end
27
+
28
+ # Returns attribute mapping this model knows about
29
+ def self.acceptable_attribute_map
30
+ attribute_map
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ acceptable_attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'ref' => :'String'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `HatchetSdkRest::V1StreamPayloadRef` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ acceptable_attribute_map = self.class.acceptable_attribute_map
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!acceptable_attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `HatchetSdkRest::V1StreamPayloadRef`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:'ref')
68
+ self.ref = attributes[:'ref']
69
+ else
70
+ self.ref = nil
71
+ end
72
+ end
73
+
74
+ # Show invalid properties with the reasons. Usually used together with valid?
75
+ # @return Array for valid properties with the reasons
76
+ def list_invalid_properties
77
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
78
+ invalid_properties = Array.new
79
+ if @ref.nil?
80
+ invalid_properties.push('invalid value for "ref", ref cannot be nil.')
81
+ end
82
+
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ warn '[DEPRECATED] the `valid?` method is obsolete'
90
+ return false if @ref.nil?
91
+ true
92
+ end
93
+
94
+ # Custom attribute writer method with validation
95
+ # @param [Object] ref Value to be assigned
96
+ def ref=(ref)
97
+ if ref.nil?
98
+ fail ArgumentError, 'ref cannot be nil'
99
+ end
100
+
101
+ @ref = ref
102
+ end
103
+
104
+ # Checks equality by comparing each attribute.
105
+ # @param [Object] Object to be compared
106
+ def ==(o)
107
+ return true if self.equal?(o)
108
+ self.class == o.class &&
109
+ ref == o.ref
110
+ end
111
+
112
+ # @see the `==` method
113
+ # @param [Object] Object to be compared
114
+ def eql?(o)
115
+ self == o
116
+ end
117
+
118
+ # Calculates hash code according to all attributes.
119
+ # @return [Integer] Hash code
120
+ def hash
121
+ [ref].hash
122
+ end
123
+
124
+ # Builds the object from hash
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ # @return [Object] Returns the model itself
127
+ def self.build_from_hash(attributes)
128
+ return nil unless attributes.is_a?(Hash)
129
+ attributes = attributes.transform_keys(&:to_sym)
130
+ transformed_hash = {}
131
+ openapi_types.each_pair do |key, type|
132
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
133
+ transformed_hash["#{key}"] = nil
134
+ elsif type =~ /\AArray<(.*)>/i
135
+ # check to ensure the input is an array given that the attribute
136
+ # is documented as an array but the input is not
137
+ if attributes[attribute_map[key]].is_a?(Array)
138
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
139
+ end
140
+ elsif !attributes[attribute_map[key]].nil?
141
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
142
+ end
143
+ end
144
+ new(transformed_hash)
145
+ end
146
+
147
+ # Deserializes the data based on type
148
+ # @param string type Data type
149
+ # @param string value Value to be deserialized
150
+ # @return [Object] Deserialized data
151
+ def self._deserialize(type, value)
152
+ case type.to_sym
153
+ when :Time
154
+ Time.parse(value)
155
+ when :Date
156
+ Date.parse(value)
157
+ when :String
158
+ value.to_s
159
+ when :Integer
160
+ value.to_i
161
+ when :Float
162
+ value.to_f
163
+ when :Boolean
164
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
165
+ true
166
+ else
167
+ false
168
+ end
169
+ when :Object
170
+ # generic object (usually a Hash), return directly
171
+ value
172
+ when /\AArray<(?<inner_type>.+)>\z/
173
+ inner_type = Regexp.last_match[:inner_type]
174
+ value.map { |v| _deserialize(inner_type, v) }
175
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
176
+ k_type = Regexp.last_match[:k_type]
177
+ v_type = Regexp.last_match[:v_type]
178
+ {}.tap do |hash|
179
+ value.each do |k, v|
180
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
181
+ end
182
+ end
183
+ else # model
184
+ # models (e.g. Pet) or oneOf
185
+ klass = HatchetSdkRest.const_get(type)
186
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
187
+ end
188
+ end
189
+
190
+ # Returns the string representation of the object
191
+ # @return [String] String presentation of the object
192
+ def to_s
193
+ to_hash.to_s
194
+ end
195
+
196
+ # to_body is an alias to to_hash (backward compatibility)
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_body
199
+ to_hash
200
+ end
201
+
202
+ # Returns the object in the form of hash
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_hash
205
+ hash = {}
206
+ self.class.attribute_map.each_pair do |attr, param|
207
+ value = self.send(attr)
208
+ if value.nil?
209
+ is_nullable = self.class.openapi_nullable.include?(attr)
210
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
211
+ end
212
+
213
+ hash[param] = _to_hash(value)
214
+ end
215
+ hash
216
+ end
217
+
218
+ # Outputs non-array value in the form of hash
219
+ # For object, use to_hash. Otherwise, just return the value
220
+ # @param [Object] value Any valid value
221
+ # @return [Hash] Returns the value in the form of hash
222
+ def _to_hash(value)
223
+ if value.is_a?(Array)
224
+ value.compact.map { |v| _to_hash(v) }
225
+ elsif value.is_a?(Hash)
226
+ {}.tap do |hash|
227
+ value.each { |k, v| hash[k] = _to_hash(v) }
228
+ end
229
+ elsif value.respond_to? :to_hash
230
+ value.to_hash
231
+ else
232
+ value
233
+ end
234
+ end
235
+
236
+ end
237
+
238
+ end
@@ -0,0 +1,238 @@
1
+ =begin
2
+ #Hatchet API
3
+
4
+ #The Hatchet API
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module HatchetSdkRest
17
+ class V1WorkflowRunCount
18
+ # The number of workflow runs matching the filters
19
+ attr_accessor :count
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'count' => :'count'
25
+ }
26
+ end
27
+
28
+ # Returns attribute mapping this model knows about
29
+ def self.acceptable_attribute_map
30
+ attribute_map
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ acceptable_attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'count' => :'Integer'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `HatchetSdkRest::V1WorkflowRunCount` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ acceptable_attribute_map = self.class.acceptable_attribute_map
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!acceptable_attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `HatchetSdkRest::V1WorkflowRunCount`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:'count')
68
+ self.count = attributes[:'count']
69
+ else
70
+ self.count = nil
71
+ end
72
+ end
73
+
74
+ # Show invalid properties with the reasons. Usually used together with valid?
75
+ # @return Array for valid properties with the reasons
76
+ def list_invalid_properties
77
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
78
+ invalid_properties = Array.new
79
+ if @count.nil?
80
+ invalid_properties.push('invalid value for "count", count cannot be nil.')
81
+ end
82
+
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ warn '[DEPRECATED] the `valid?` method is obsolete'
90
+ return false if @count.nil?
91
+ true
92
+ end
93
+
94
+ # Custom attribute writer method with validation
95
+ # @param [Object] count Value to be assigned
96
+ def count=(count)
97
+ if count.nil?
98
+ fail ArgumentError, 'count cannot be nil'
99
+ end
100
+
101
+ @count = count
102
+ end
103
+
104
+ # Checks equality by comparing each attribute.
105
+ # @param [Object] Object to be compared
106
+ def ==(o)
107
+ return true if self.equal?(o)
108
+ self.class == o.class &&
109
+ count == o.count
110
+ end
111
+
112
+ # @see the `==` method
113
+ # @param [Object] Object to be compared
114
+ def eql?(o)
115
+ self == o
116
+ end
117
+
118
+ # Calculates hash code according to all attributes.
119
+ # @return [Integer] Hash code
120
+ def hash
121
+ [count].hash
122
+ end
123
+
124
+ # Builds the object from hash
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ # @return [Object] Returns the model itself
127
+ def self.build_from_hash(attributes)
128
+ return nil unless attributes.is_a?(Hash)
129
+ attributes = attributes.transform_keys(&:to_sym)
130
+ transformed_hash = {}
131
+ openapi_types.each_pair do |key, type|
132
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
133
+ transformed_hash["#{key}"] = nil
134
+ elsif type =~ /\AArray<(.*)>/i
135
+ # check to ensure the input is an array given that the attribute
136
+ # is documented as an array but the input is not
137
+ if attributes[attribute_map[key]].is_a?(Array)
138
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
139
+ end
140
+ elsif !attributes[attribute_map[key]].nil?
141
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
142
+ end
143
+ end
144
+ new(transformed_hash)
145
+ end
146
+
147
+ # Deserializes the data based on type
148
+ # @param string type Data type
149
+ # @param string value Value to be deserialized
150
+ # @return [Object] Deserialized data
151
+ def self._deserialize(type, value)
152
+ case type.to_sym
153
+ when :Time
154
+ Time.parse(value)
155
+ when :Date
156
+ Date.parse(value)
157
+ when :String
158
+ value.to_s
159
+ when :Integer
160
+ value.to_i
161
+ when :Float
162
+ value.to_f
163
+ when :Boolean
164
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
165
+ true
166
+ else
167
+ false
168
+ end
169
+ when :Object
170
+ # generic object (usually a Hash), return directly
171
+ value
172
+ when /\AArray<(?<inner_type>.+)>\z/
173
+ inner_type = Regexp.last_match[:inner_type]
174
+ value.map { |v| _deserialize(inner_type, v) }
175
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
176
+ k_type = Regexp.last_match[:k_type]
177
+ v_type = Regexp.last_match[:v_type]
178
+ {}.tap do |hash|
179
+ value.each do |k, v|
180
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
181
+ end
182
+ end
183
+ else # model
184
+ # models (e.g. Pet) or oneOf
185
+ klass = HatchetSdkRest.const_get(type)
186
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
187
+ end
188
+ end
189
+
190
+ # Returns the string representation of the object
191
+ # @return [String] String presentation of the object
192
+ def to_s
193
+ to_hash.to_s
194
+ end
195
+
196
+ # to_body is an alias to to_hash (backward compatibility)
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_body
199
+ to_hash
200
+ end
201
+
202
+ # Returns the object in the form of hash
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_hash
205
+ hash = {}
206
+ self.class.attribute_map.each_pair do |attr, param|
207
+ value = self.send(attr)
208
+ if value.nil?
209
+ is_nullable = self.class.openapi_nullable.include?(attr)
210
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
211
+ end
212
+
213
+ hash[param] = _to_hash(value)
214
+ end
215
+ hash
216
+ end
217
+
218
+ # Outputs non-array value in the form of hash
219
+ # For object, use to_hash. Otherwise, just return the value
220
+ # @param [Object] value Any valid value
221
+ # @return [Hash] Returns the value in the form of hash
222
+ def _to_hash(value)
223
+ if value.is_a?(Array)
224
+ value.compact.map { |v| _to_hash(v) }
225
+ elsif value.is_a?(Hash)
226
+ {}.tap do |hash|
227
+ value.each { |k, v| hash[k] = _to_hash(v) }
228
+ end
229
+ elsif value.respond_to? :to_hash
230
+ value.to_hash
231
+ else
232
+ value
233
+ end
234
+ end
235
+
236
+ end
237
+
238
+ end
@@ -188,6 +188,7 @@ HatchetSdkRest.autoload :V1ReplayedTasks, 'hatchet-sdk-rest/models/v1_replayed_t
188
188
  HatchetSdkRest.autoload :V1RestoreTaskResponse, 'hatchet-sdk-rest/models/v1_restore_task_response'
189
189
  HatchetSdkRest.autoload :V1RunningDetailCount, 'hatchet-sdk-rest/models/v1_running_detail_count'
190
190
  HatchetSdkRest.autoload :V1RunningFilter, 'hatchet-sdk-rest/models/v1_running_filter'
191
+ HatchetSdkRest.autoload :V1StreamPayloadRef, 'hatchet-sdk-rest/models/v1_stream_payload_ref'
191
192
  HatchetSdkRest.autoload :V1TaskEvent, 'hatchet-sdk-rest/models/v1_task_event'
192
193
  HatchetSdkRest.autoload :V1TaskEventList, 'hatchet-sdk-rest/models/v1_task_event_list'
193
194
  HatchetSdkRest.autoload :V1TaskEventType, 'hatchet-sdk-rest/models/v1_task_event_type'
@@ -216,6 +217,7 @@ HatchetSdkRest.autoload :V1WebhookList, 'hatchet-sdk-rest/models/v1_webhook_list
216
217
  HatchetSdkRest.autoload :V1WebhookResponse, 'hatchet-sdk-rest/models/v1_webhook_response'
217
218
  HatchetSdkRest.autoload :V1WebhookSourceName, 'hatchet-sdk-rest/models/v1_webhook_source_name'
218
219
  HatchetSdkRest.autoload :V1WorkflowRun, 'hatchet-sdk-rest/models/v1_workflow_run'
220
+ HatchetSdkRest.autoload :V1WorkflowRunCount, 'hatchet-sdk-rest/models/v1_workflow_run_count'
219
221
  HatchetSdkRest.autoload :V1WorkflowRunDetails, 'hatchet-sdk-rest/models/v1_workflow_run_details'
220
222
  HatchetSdkRest.autoload :V1WorkflowRunDisplayName, 'hatchet-sdk-rest/models/v1_workflow_run_display_name'
221
223
  HatchetSdkRest.autoload :V1WorkflowRunDisplayNameList, 'hatchet-sdk-rest/models/v1_workflow_run_display_name_list'
@@ -280,6 +282,7 @@ HatchetSdkRest.autoload :RateLimitsApi, 'hatchet-sdk-rest/api/rate_limits_api'
280
282
  HatchetSdkRest.autoload :SNSApi, 'hatchet-sdk-rest/api/sns_api'
281
283
  HatchetSdkRest.autoload :SlackApi, 'hatchet-sdk-rest/api/slack_api'
282
284
  HatchetSdkRest.autoload :StepRunApi, 'hatchet-sdk-rest/api/step_run_api'
285
+ HatchetSdkRest.autoload :StreamsApi, 'hatchet-sdk-rest/api/streams_api'
283
286
  HatchetSdkRest.autoload :TaskApi, 'hatchet-sdk-rest/api/task_api'
284
287
  HatchetSdkRest.autoload :TenantApi, 'hatchet-sdk-rest/api/tenant_api'
285
288
  HatchetSdkRest.autoload :UserApi, 'hatchet-sdk-rest/api/user_api'
@@ -7,7 +7,7 @@ require 'google/protobuf'
7
7
  require 'google/protobuf/timestamp_pb'
8
8
 
9
9
 
10
- descriptor_data = "\n\x1b\x64ispatcher/dispatcher.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"Z\n\x0cWorkerLabels\x12\x16\n\tstr_value\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x16\n\tint_value\x18\x02 \x01(\x05H\x01\x88\x01\x01\x42\x0c\n\n_str_valueB\x0c\n\n_int_value\"\xcc\x01\n\x0bRuntimeInfo\x12\x18\n\x0bsdk_version\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1c\n\x08language\x18\x02 \x01(\x0e\x32\x05.SDKSH\x01\x88\x01\x01\x12\x1d\n\x10language_version\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x0f\n\x02os\x18\x04 \x01(\tH\x03\x88\x01\x01\x12\x12\n\x05\x65xtra\x18\x05 \x01(\tH\x04\x88\x01\x01\x42\x0e\n\x0c_sdk_versionB\x0b\n\t_languageB\x13\n\x11_language_versionB\x05\n\x03_osB\x08\n\x06_extra\"\xb1\x03\n\x15WorkerRegisterRequest\x12\x13\n\x0bworker_name\x18\x01 \x01(\t\x12\x0f\n\x07\x61\x63tions\x18\x02 \x03(\t\x12\x10\n\x08services\x18\x03 \x03(\t\x12\x12\n\x05slots\x18\x04 \x01(\x05H\x00\x88\x01\x01\x12\x32\n\x06labels\x18\x05 \x03(\x0b\x32\".WorkerRegisterRequest.LabelsEntry\x12\x17\n\nwebhook_id\x18\x06 \x01(\tH\x01\x88\x01\x01\x12\'\n\x0cruntime_info\x18\x07 \x01(\x0b\x32\x0c.RuntimeInfoH\x02\x88\x01\x01\x12;\n\x0bslot_config\x18\t \x03(\x0b\x32&.WorkerRegisterRequest.SlotConfigEntry\x1a<\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x1c\n\x05value\x18\x02 \x01(\x0b\x32\r.WorkerLabels:\x02\x38\x01\x1a\x31\n\x0fSlotConfigEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\x42\x08\n\x06_slotsB\r\n\x0b_webhook_idB\x0f\n\r_runtime_info\"S\n\x16WorkerRegisterResponse\x12\x11\n\ttenant_id\x18\x01 \x01(\t\x12\x11\n\tworker_id\x18\x02 \x01(\t\x12\x13\n\x0bworker_name\x18\x03 \x01(\t\"\xa4\x01\n\x19UpsertWorkerLabelsRequest\x12\x11\n\tworker_id\x18\x01 \x01(\t\x12\x36\n\x06labels\x18\x02 \x03(\x0b\x32&.UpsertWorkerLabelsRequest.LabelsEntry\x1a<\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x1c\n\x05value\x18\x02 \x01(\x0b\x32\r.WorkerLabels:\x02\x38\x01\"B\n\x1aUpsertWorkerLabelsResponse\x12\x11\n\ttenant_id\x18\x01 \x01(\t\x12\x11\n\tworker_id\x18\x02 \x01(\t\"\x9c\t\n\x0e\x41ssignedAction\x12\x11\n\ttenant_id\x18\x01 \x01(\t\x12\x17\n\x0fworkflow_run_id\x18\x02 \x01(\t\x12\x1c\n\x14get_group_key_run_id\x18\x03 \x01(\t\x12\x0e\n\x06job_id\x18\x04 \x01(\t\x12\x10\n\x08job_name\x18\x05 \x01(\t\x12\x12\n\njob_run_id\x18\x06 \x01(\t\x12\x0f\n\x07task_id\x18\x07 \x01(\t\x12\x1c\n\x14task_run_external_id\x18\x08 \x01(\t\x12\x11\n\taction_id\x18\t \x01(\t\x12 \n\x0b\x61\x63tion_type\x18\n \x01(\x0e\x32\x0b.ActionType\x12\x16\n\x0e\x61\x63tion_payload\x18\x0b \x01(\t\x12\x11\n\ttask_name\x18\x0c \x01(\t\x12\x13\n\x0bretry_count\x18\r \x01(\x05\x12 \n\x13\x61\x64\x64itional_metadata\x18\x0e \x01(\tH\x00\x88\x01\x01\x12!\n\x14\x63hild_workflow_index\x18\x0f \x01(\x05H\x01\x88\x01\x01\x12\x1f\n\x12\x63hild_workflow_key\x18\x10 \x01(\tH\x02\x88\x01\x01\x12#\n\x16parent_workflow_run_id\x18\x11 \x01(\tH\x03\x88\x01\x01\x12\x10\n\x08priority\x18\x12 \x01(\x05\x12\x18\n\x0bworkflow_id\x18\x13 \x01(\tH\x04\x88\x01\x01\x12 \n\x13workflow_version_id\x18\x14 \x01(\tH\x05\x88\x01\x01\x12*\n\x1d\x64urable_task_invocation_count\x18\x15 \x01(\x05H\x06\x88\x01\x01\x12)\n\x1ctriggering_event_external_id\x18\x16 \x01(\tH\x07\x88\x01\x01\x12!\n\x14triggering_event_key\x18\x17 \x01(\tH\x08\x88\x01\x01\x12\x14\n\x07\x62\x61tchId\x18\x18 \x01(\tH\t\x88\x01\x01\x12\x16\n\tbatchSize\x18\x19 \x01(\x05H\n\x88\x01\x01\x12\x17\n\nbatchIndex\x18\x1a \x01(\x05H\x0b\x88\x01\x01\x12\x32\n\x11\x62\x61tchStartPayload\x18\x1b \x01(\x0b\x32\x12.BatchStartPayloadH\x0c\x88\x01\x01\x12\x15\n\x08\x62\x61tchKey\x18\x1c \x01(\tH\r\x88\x01\x01\x12\x39\n\x10task_inserted_at\x18\x1d \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x0e\x88\x01\x01\x42\x16\n\x14_additional_metadataB\x17\n\x15_child_workflow_indexB\x15\n\x13_child_workflow_keyB\x19\n\x17_parent_workflow_run_idB\x0e\n\x0c_workflow_idB\x16\n\x14_workflow_version_idB \n\x1e_durable_task_invocation_countB\x1f\n\x1d_triggering_event_external_idB\x17\n\x15_triggering_event_keyB\n\n\x08_batchIdB\x0c\n\n_batchSizeB\r\n\x0b_batchIndexB\x14\n\x12_batchStartPayloadB\x0b\n\t_batchKeyB\x13\n\x11_task_inserted_at\"q\n\x11\x42\x61tchStartPayload\x12\x15\n\rtriggerReason\x18\x01 \x01(\t\x12/\n\x0btriggerTime\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x14\n\x0c\x65xpectedSize\x18\x03 \x01(\x05\"(\n\x13WorkerListenRequest\x12\x11\n\tworker_id\x18\x01 \x01(\t\"-\n\x18WorkerUnsubscribeRequest\x12\x11\n\tworker_id\x18\x01 \x01(\t\"A\n\x19WorkerUnsubscribeResponse\x12\x11\n\ttenant_id\x18\x01 \x01(\t\x12\x11\n\tworker_id\x18\x02 \x01(\t\"\xec\x01\n\x13GroupKeyActionEvent\x12\x11\n\tworker_id\x18\x01 \x01(\t\x12\x17\n\x0fworkflow_run_id\x18\x02 \x01(\t\x12\x1c\n\x14get_group_key_run_id\x18\x03 \x01(\t\x12\x11\n\taction_id\x18\x04 \x01(\t\x12\x33\n\x0f\x65vent_timestamp\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\nevent_type\x18\x06 \x01(\x0e\x32\x18.GroupKeyActionEventType\x12\x15\n\revent_payload\x18\x07 \x01(\t\"\xde\x02\n\x0fStepActionEvent\x12\x11\n\tworker_id\x18\x01 \x01(\t\x12\x0e\n\x06job_id\x18\x02 \x01(\t\x12\x12\n\njob_run_id\x18\x03 \x01(\t\x12\x0f\n\x07task_id\x18\x04 \x01(\t\x12\x1c\n\x14task_run_external_id\x18\x05 \x01(\t\x12\x11\n\taction_id\x18\x06 \x01(\t\x12\x33\n\x0f\x65vent_timestamp\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12(\n\nevent_type\x18\x08 \x01(\x0e\x32\x14.StepActionEventType\x12\x15\n\revent_payload\x18\t \x01(\t\x12\x18\n\x0bretry_count\x18\n \x01(\x05H\x00\x88\x01\x01\x12\x1d\n\x10should_not_retry\x18\x0b \x01(\x08H\x01\x88\x01\x01\x42\x0e\n\x0c_retry_countB\x13\n\x11_should_not_retry\"\xa9\x01\n\x14\x42\x61tchActionEventItem\x12\x1c\n\x14task_run_external_id\x18\x01 \x01(\t\x12\x15\n\revent_payload\x18\x02 \x01(\t\x12\x18\n\x0bretry_count\x18\x03 \x01(\x05H\x00\x88\x01\x01\x12\x1d\n\x10should_not_retry\x18\x04 \x01(\x08H\x01\x88\x01\x01\x42\x0e\n\x0c_retry_countB\x13\n\x11_should_not_retry\"\xf1\x01\n\x10\x42\x61tchActionEvent\x12\x11\n\tworker_id\x18\x01 \x01(\t\x12\x0e\n\x06job_id\x18\x02 \x01(\t\x12\x11\n\taction_id\x18\x03 \x01(\t\x12\x15\n\x08\x62\x61tch_id\x18\x04 \x01(\tH\x00\x88\x01\x01\x12\x33\n\x0f\x65vent_timestamp\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12(\n\nevent_type\x18\x06 \x01(\x0e\x32\x14.StepActionEventType\x12$\n\x05items\x18\x07 \x03(\x0b\x32\x15.BatchActionEventItemB\x0b\n\t_batch_id\";\n\x13\x41\x63tionEventResponse\x12\x11\n\ttenant_id\x18\x01 \x01(\t\x12\x11\n\tworker_id\x18\x02 \x01(\t\"\xcc\x01\n SubscribeToWorkflowEventsRequest\x12\x1c\n\x0fworkflow_run_id\x18\x01 \x01(\tH\x00\x88\x01\x01\x12 \n\x13\x61\x64\x64itional_meta_key\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\"\n\x15\x61\x64\x64itional_meta_value\x18\x03 \x01(\tH\x02\x88\x01\x01\x42\x12\n\x10_workflow_run_idB\x16\n\x14_additional_meta_keyB\x18\n\x16_additional_meta_value\"9\n\x1eSubscribeToWorkflowRunsRequest\x12\x17\n\x0fworkflow_run_id\x18\x01 \x01(\t\"\xe7\x02\n\rWorkflowEvent\x12\x17\n\x0fworkflow_run_id\x18\x01 \x01(\t\x12$\n\rresource_type\x18\x02 \x01(\x0e\x32\r.ResourceType\x12&\n\nevent_type\x18\x03 \x01(\x0e\x32\x12.ResourceEventType\x12\x13\n\x0bresource_id\x18\x04 \x01(\t\x12\x33\n\x0f\x65vent_timestamp\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x15\n\revent_payload\x18\x06 \x01(\t\x12\x0e\n\x06hangup\x18\x07 \x01(\x08\x12\x19\n\x0ctask_retries\x18\x08 \x01(\x05H\x00\x88\x01\x01\x12\x18\n\x0bretry_count\x18\t \x01(\x05H\x01\x88\x01\x01\x12\x18\n\x0b\x65vent_index\x18\n \x01(\x03H\x02\x88\x01\x01\x42\x0f\n\r_task_retriesB\x0e\n\x0c_retry_countB\x0e\n\x0c_event_index\"\xac\x01\n\x10WorkflowRunEvent\x12\x17\n\x0fworkflow_run_id\x18\x01 \x01(\t\x12)\n\nevent_type\x18\x02 \x01(\x0e\x32\x15.WorkflowRunEventType\x12\x33\n\x0f\x65vent_timestamp\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x1f\n\x07results\x18\x04 \x03(\x0b\x32\x0e.StepRunResult\"\x92\x01\n\rStepRunResult\x12\x1c\n\x14task_run_external_id\x18\x01 \x01(\t\x12\x11\n\ttask_name\x18\x02 \x01(\t\x12\x12\n\njob_run_id\x18\x03 \x01(\t\x12\x12\n\x05\x65rror\x18\x04 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06output\x18\x05 \x01(\tH\x01\x88\x01\x01\x42\x08\n\x06_errorB\t\n\x07_output\"c\n\rOverridesData\x12\x1c\n\x14task_run_external_id\x18\x01 \x01(\t\x12\x0c\n\x04path\x18\x02 \x01(\t\x12\r\n\x05value\x18\x03 \x01(\t\x12\x17\n\x0f\x63\x61ller_filename\x18\x04 \x01(\t\"\x17\n\x15OverridesDataResponse\"W\n\x10HeartbeatRequest\x12\x11\n\tworker_id\x18\x01 \x01(\t\x12\x30\n\x0cheartbeat_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"\x13\n\x11HeartbeatResponse\"S\n\x15RefreshTimeoutRequest\x12\x1c\n\x14task_run_external_id\x18\x01 \x01(\t\x12\x1c\n\x14increment_timeout_by\x18\x02 \x01(\t\"H\n\x16RefreshTimeoutResponse\x12.\n\ntimeout_at\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"2\n\x12ReleaseSlotRequest\x12\x1c\n\x14task_run_external_id\x18\x01 \x01(\t\"\x15\n\x13ReleaseSlotResponse\"9\n\x19RestoreEvictedTaskRequest\x12\x1c\n\x14task_run_external_id\x18\x01 \x01(\t\".\n\x1aRestoreEvictedTaskResponse\x12\x10\n\x08requeued\x18\x01 \x01(\x08\"\x13\n\x11GetVersionRequest\"%\n\x12GetVersionResponse\x12\x0f\n\x07version\x18\x01 \x01(\t*A\n\x04SDKS\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x06\n\x02GO\x10\x01\x12\n\n\x06PYTHON\x10\x02\x12\x0e\n\nTYPESCRIPT\x10\x03\x12\x08\n\x04RUBY\x10\x04*_\n\nActionType\x12\x12\n\x0eSTART_STEP_RUN\x10\x00\x12\x13\n\x0f\x43\x41NCEL_STEP_RUN\x10\x01\x12\x17\n\x13START_GET_GROUP_KEY\x10\x02\x12\x0f\n\x0bSTART_BATCH\x10\x03*\xa2\x01\n\x17GroupKeyActionEventType\x12 \n\x1cGROUP_KEY_EVENT_TYPE_UNKNOWN\x10\x00\x12 \n\x1cGROUP_KEY_EVENT_TYPE_STARTED\x10\x01\x12\"\n\x1eGROUP_KEY_EVENT_TYPE_COMPLETED\x10\x02\x12\x1f\n\x1bGROUP_KEY_EVENT_TYPE_FAILED\x10\x03*\xcb\x01\n\x13StepActionEventType\x12\x1b\n\x17STEP_EVENT_TYPE_UNKNOWN\x10\x00\x12\x1b\n\x17STEP_EVENT_TYPE_STARTED\x10\x01\x12\x1d\n\x19STEP_EVENT_TYPE_COMPLETED\x10\x02\x12\x1a\n\x16STEP_EVENT_TYPE_FAILED\x10\x03\x12 \n\x1cSTEP_EVENT_TYPE_ACKNOWLEDGED\x10\x04\x12\x1d\n\x19STEP_EVENT_TYPE_CANCELLED\x10\x05*e\n\x0cResourceType\x12\x19\n\x15RESOURCE_TYPE_UNKNOWN\x10\x00\x12\x1a\n\x16RESOURCE_TYPE_STEP_RUN\x10\x01\x12\x1e\n\x1aRESOURCE_TYPE_WORKFLOW_RUN\x10\x02*\xfe\x01\n\x11ResourceEventType\x12\x1f\n\x1bRESOURCE_EVENT_TYPE_UNKNOWN\x10\x00\x12\x1f\n\x1bRESOURCE_EVENT_TYPE_STARTED\x10\x01\x12!\n\x1dRESOURCE_EVENT_TYPE_COMPLETED\x10\x02\x12\x1e\n\x1aRESOURCE_EVENT_TYPE_FAILED\x10\x03\x12!\n\x1dRESOURCE_EVENT_TYPE_CANCELLED\x10\x04\x12!\n\x1dRESOURCE_EVENT_TYPE_TIMED_OUT\x10\x05\x12\x1e\n\x1aRESOURCE_EVENT_TYPE_STREAM\x10\x06*<\n\x14WorkflowRunEventType\x12$\n WORKFLOW_RUN_EVENT_TYPE_FINISHED\x10\x00\x32\xc5\x08\n\nDispatcher\x12=\n\x08Register\x12\x16.WorkerRegisterRequest\x1a\x17.WorkerRegisterResponse\"\x00\x12\x33\n\x06Listen\x12\x14.WorkerListenRequest\x1a\x0f.AssignedAction\"\x00\x30\x01\x12\x35\n\x08ListenV2\x12\x14.WorkerListenRequest\x1a\x0f.AssignedAction\"\x00\x30\x01\x12\x34\n\tHeartbeat\x12\x11.HeartbeatRequest\x1a\x12.HeartbeatResponse\"\x00\x12R\n\x19SubscribeToWorkflowEvents\x12!.SubscribeToWorkflowEventsRequest\x1a\x0e.WorkflowEvent\"\x00\x30\x01\x12S\n\x17SubscribeToWorkflowRuns\x12\x1f.SubscribeToWorkflowRunsRequest\x1a\x11.WorkflowRunEvent\"\x00(\x01\x30\x01\x12?\n\x13SendStepActionEvent\x12\x10.StepActionEvent\x1a\x14.ActionEventResponse\"\x00\x12\x41\n\x14SendBatchActionEvent\x12\x11.BatchActionEvent\x1a\x14.ActionEventResponse\"\x00\x12G\n\x17SendGroupKeyActionEvent\x12\x14.GroupKeyActionEvent\x1a\x14.ActionEventResponse\"\x00\x12<\n\x10PutOverridesData\x12\x0e.OverridesData\x1a\x16.OverridesDataResponse\"\x00\x12\x46\n\x0bUnsubscribe\x12\x19.WorkerUnsubscribeRequest\x1a\x1a.WorkerUnsubscribeResponse\"\x00\x12\x43\n\x0eRefreshTimeout\x12\x16.RefreshTimeoutRequest\x1a\x17.RefreshTimeoutResponse\"\x00\x12:\n\x0bReleaseSlot\x12\x13.ReleaseSlotRequest\x1a\x14.ReleaseSlotResponse\"\x00\x12O\n\x12RestoreEvictedTask\x12\x1a.RestoreEvictedTaskRequest\x1a\x1b.RestoreEvictedTaskResponse\"\x00\x12O\n\x12UpsertWorkerLabels\x12\x1a.UpsertWorkerLabelsRequest\x1a\x1b.UpsertWorkerLabelsResponse\"\x00\x12\x37\n\nGetVersion\x12\x12.GetVersionRequest\x1a\x13.GetVersionResponse\"\x00\x42GZEgithub.com/hatchet-dev/hatchet/internal/services/dispatcher/contractsb\x06proto3"
10
+ descriptor_data = "\n\x1b\x64ispatcher/dispatcher.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"Z\n\x0cWorkerLabels\x12\x16\n\tstr_value\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x16\n\tint_value\x18\x02 \x01(\x05H\x01\x88\x01\x01\x42\x0c\n\n_str_valueB\x0c\n\n_int_value\"\xcc\x01\n\x0bRuntimeInfo\x12\x18\n\x0bsdk_version\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1c\n\x08language\x18\x02 \x01(\x0e\x32\x05.SDKSH\x01\x88\x01\x01\x12\x1d\n\x10language_version\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x0f\n\x02os\x18\x04 \x01(\tH\x03\x88\x01\x01\x12\x12\n\x05\x65xtra\x18\x05 \x01(\tH\x04\x88\x01\x01\x42\x0e\n\x0c_sdk_versionB\x0b\n\t_languageB\x13\n\x11_language_versionB\x05\n\x03_osB\x08\n\x06_extra\"\xb1\x03\n\x15WorkerRegisterRequest\x12\x13\n\x0bworker_name\x18\x01 \x01(\t\x12\x0f\n\x07\x61\x63tions\x18\x02 \x03(\t\x12\x10\n\x08services\x18\x03 \x03(\t\x12\x12\n\x05slots\x18\x04 \x01(\x05H\x00\x88\x01\x01\x12\x32\n\x06labels\x18\x05 \x03(\x0b\x32\".WorkerRegisterRequest.LabelsEntry\x12\x17\n\nwebhook_id\x18\x06 \x01(\tH\x01\x88\x01\x01\x12\'\n\x0cruntime_info\x18\x07 \x01(\x0b\x32\x0c.RuntimeInfoH\x02\x88\x01\x01\x12;\n\x0bslot_config\x18\t \x03(\x0b\x32&.WorkerRegisterRequest.SlotConfigEntry\x1a<\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x1c\n\x05value\x18\x02 \x01(\x0b\x32\r.WorkerLabels:\x02\x38\x01\x1a\x31\n\x0fSlotConfigEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\x42\x08\n\x06_slotsB\r\n\x0b_webhook_idB\x0f\n\r_runtime_info\"S\n\x16WorkerRegisterResponse\x12\x11\n\ttenant_id\x18\x01 \x01(\t\x12\x11\n\tworker_id\x18\x02 \x01(\t\x12\x13\n\x0bworker_name\x18\x03 \x01(\t\"\xa4\x01\n\x19UpsertWorkerLabelsRequest\x12\x11\n\tworker_id\x18\x01 \x01(\t\x12\x36\n\x06labels\x18\x02 \x03(\x0b\x32&.UpsertWorkerLabelsRequest.LabelsEntry\x1a<\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x1c\n\x05value\x18\x02 \x01(\x0b\x32\r.WorkerLabels:\x02\x38\x01\"B\n\x1aUpsertWorkerLabelsResponse\x12\x11\n\ttenant_id\x18\x01 \x01(\t\x12\x11\n\tworker_id\x18\x02 \x01(\t\"\x9c\t\n\x0e\x41ssignedAction\x12\x11\n\ttenant_id\x18\x01 \x01(\t\x12\x17\n\x0fworkflow_run_id\x18\x02 \x01(\t\x12\x1c\n\x14get_group_key_run_id\x18\x03 \x01(\t\x12\x0e\n\x06job_id\x18\x04 \x01(\t\x12\x10\n\x08job_name\x18\x05 \x01(\t\x12\x12\n\njob_run_id\x18\x06 \x01(\t\x12\x0f\n\x07task_id\x18\x07 \x01(\t\x12\x1c\n\x14task_run_external_id\x18\x08 \x01(\t\x12\x11\n\taction_id\x18\t \x01(\t\x12 \n\x0b\x61\x63tion_type\x18\n \x01(\x0e\x32\x0b.ActionType\x12\x16\n\x0e\x61\x63tion_payload\x18\x0b \x01(\t\x12\x11\n\ttask_name\x18\x0c \x01(\t\x12\x13\n\x0bretry_count\x18\r \x01(\x05\x12 \n\x13\x61\x64\x64itional_metadata\x18\x0e \x01(\tH\x00\x88\x01\x01\x12!\n\x14\x63hild_workflow_index\x18\x0f \x01(\x05H\x01\x88\x01\x01\x12\x1f\n\x12\x63hild_workflow_key\x18\x10 \x01(\tH\x02\x88\x01\x01\x12#\n\x16parent_workflow_run_id\x18\x11 \x01(\tH\x03\x88\x01\x01\x12\x10\n\x08priority\x18\x12 \x01(\x05\x12\x18\n\x0bworkflow_id\x18\x13 \x01(\tH\x04\x88\x01\x01\x12 \n\x13workflow_version_id\x18\x14 \x01(\tH\x05\x88\x01\x01\x12*\n\x1d\x64urable_task_invocation_count\x18\x15 \x01(\x05H\x06\x88\x01\x01\x12)\n\x1ctriggering_event_external_id\x18\x16 \x01(\tH\x07\x88\x01\x01\x12!\n\x14triggering_event_key\x18\x17 \x01(\tH\x08\x88\x01\x01\x12\x14\n\x07\x62\x61tchId\x18\x18 \x01(\tH\t\x88\x01\x01\x12\x16\n\tbatchSize\x18\x19 \x01(\x05H\n\x88\x01\x01\x12\x17\n\nbatchIndex\x18\x1a \x01(\x05H\x0b\x88\x01\x01\x12\x32\n\x11\x62\x61tchStartPayload\x18\x1b \x01(\x0b\x32\x12.BatchStartPayloadH\x0c\x88\x01\x01\x12\x15\n\x08\x62\x61tchKey\x18\x1c \x01(\tH\r\x88\x01\x01\x12\x39\n\x10task_inserted_at\x18\x1d \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x0e\x88\x01\x01\x42\x16\n\x14_additional_metadataB\x17\n\x15_child_workflow_indexB\x15\n\x13_child_workflow_keyB\x19\n\x17_parent_workflow_run_idB\x0e\n\x0c_workflow_idB\x16\n\x14_workflow_version_idB \n\x1e_durable_task_invocation_countB\x1f\n\x1d_triggering_event_external_idB\x17\n\x15_triggering_event_keyB\n\n\x08_batchIdB\x0c\n\n_batchSizeB\r\n\x0b_batchIndexB\x14\n\x12_batchStartPayloadB\x0b\n\t_batchKeyB\x13\n\x11_task_inserted_at\"q\n\x11\x42\x61tchStartPayload\x12\x15\n\rtriggerReason\x18\x01 \x01(\t\x12/\n\x0btriggerTime\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x14\n\x0c\x65xpectedSize\x18\x03 \x01(\x05\"(\n\x13WorkerListenRequest\x12\x11\n\tworker_id\x18\x01 \x01(\t\"-\n\x18WorkerUnsubscribeRequest\x12\x11\n\tworker_id\x18\x01 \x01(\t\"A\n\x19WorkerUnsubscribeResponse\x12\x11\n\ttenant_id\x18\x01 \x01(\t\x12\x11\n\tworker_id\x18\x02 \x01(\t\"\xec\x01\n\x13GroupKeyActionEvent\x12\x11\n\tworker_id\x18\x01 \x01(\t\x12\x17\n\x0fworkflow_run_id\x18\x02 \x01(\t\x12\x1c\n\x14get_group_key_run_id\x18\x03 \x01(\t\x12\x11\n\taction_id\x18\x04 \x01(\t\x12\x33\n\x0f\x65vent_timestamp\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\nevent_type\x18\x06 \x01(\x0e\x32\x18.GroupKeyActionEventType\x12\x15\n\revent_payload\x18\x07 \x01(\t\"\x8e\x03\n\x0fStepActionEvent\x12\x11\n\tworker_id\x18\x01 \x01(\t\x12\x0e\n\x06job_id\x18\x02 \x01(\t\x12\x12\n\njob_run_id\x18\x03 \x01(\t\x12\x0f\n\x07task_id\x18\x04 \x01(\t\x12\x1c\n\x14task_run_external_id\x18\x05 \x01(\t\x12\x11\n\taction_id\x18\x06 \x01(\t\x12\x33\n\x0f\x65vent_timestamp\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12(\n\nevent_type\x18\x08 \x01(\x0e\x32\x14.StepActionEventType\x12\x15\n\revent_payload\x18\t \x01(\t\x12\x18\n\x0bretry_count\x18\n \x01(\x05H\x00\x88\x01\x01\x12\x1d\n\x10should_not_retry\x18\x0b \x01(\x08H\x01\x88\x01\x01\x12\x1b\n\x0eretry_after_ms\x18\x0c \x01(\x03H\x02\x88\x01\x01\x42\x0e\n\x0c_retry_countB\x13\n\x11_should_not_retryB\x11\n\x0f_retry_after_ms\"\xd9\x01\n\x14\x42\x61tchActionEventItem\x12\x1c\n\x14task_run_external_id\x18\x01 \x01(\t\x12\x15\n\revent_payload\x18\x02 \x01(\t\x12\x18\n\x0bretry_count\x18\x03 \x01(\x05H\x00\x88\x01\x01\x12\x1d\n\x10should_not_retry\x18\x04 \x01(\x08H\x01\x88\x01\x01\x12\x1b\n\x0eretry_after_ms\x18\x05 \x01(\x03H\x02\x88\x01\x01\x42\x0e\n\x0c_retry_countB\x13\n\x11_should_not_retryB\x11\n\x0f_retry_after_ms\"\xf1\x01\n\x10\x42\x61tchActionEvent\x12\x11\n\tworker_id\x18\x01 \x01(\t\x12\x0e\n\x06job_id\x18\x02 \x01(\t\x12\x11\n\taction_id\x18\x03 \x01(\t\x12\x15\n\x08\x62\x61tch_id\x18\x04 \x01(\tH\x00\x88\x01\x01\x12\x33\n\x0f\x65vent_timestamp\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12(\n\nevent_type\x18\x06 \x01(\x0e\x32\x14.StepActionEventType\x12$\n\x05items\x18\x07 \x03(\x0b\x32\x15.BatchActionEventItemB\x0b\n\t_batch_id\";\n\x13\x41\x63tionEventResponse\x12\x11\n\ttenant_id\x18\x01 \x01(\t\x12\x11\n\tworker_id\x18\x02 \x01(\t\"\xcc\x01\n SubscribeToWorkflowEventsRequest\x12\x1c\n\x0fworkflow_run_id\x18\x01 \x01(\tH\x00\x88\x01\x01\x12 \n\x13\x61\x64\x64itional_meta_key\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\"\n\x15\x61\x64\x64itional_meta_value\x18\x03 \x01(\tH\x02\x88\x01\x01\x42\x12\n\x10_workflow_run_idB\x16\n\x14_additional_meta_keyB\x18\n\x16_additional_meta_value\"9\n\x1eSubscribeToWorkflowRunsRequest\x12\x17\n\x0fworkflow_run_id\x18\x01 \x01(\t\"\xe7\x02\n\rWorkflowEvent\x12\x17\n\x0fworkflow_run_id\x18\x01 \x01(\t\x12$\n\rresource_type\x18\x02 \x01(\x0e\x32\r.ResourceType\x12&\n\nevent_type\x18\x03 \x01(\x0e\x32\x12.ResourceEventType\x12\x13\n\x0bresource_id\x18\x04 \x01(\t\x12\x33\n\x0f\x65vent_timestamp\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x15\n\revent_payload\x18\x06 \x01(\t\x12\x0e\n\x06hangup\x18\x07 \x01(\x08\x12\x19\n\x0ctask_retries\x18\x08 \x01(\x05H\x00\x88\x01\x01\x12\x18\n\x0bretry_count\x18\t \x01(\x05H\x01\x88\x01\x01\x12\x18\n\x0b\x65vent_index\x18\n \x01(\x03H\x02\x88\x01\x01\x42\x0f\n\r_task_retriesB\x0e\n\x0c_retry_countB\x0e\n\x0c_event_index\"\xac\x01\n\x10WorkflowRunEvent\x12\x17\n\x0fworkflow_run_id\x18\x01 \x01(\t\x12)\n\nevent_type\x18\x02 \x01(\x0e\x32\x15.WorkflowRunEventType\x12\x33\n\x0f\x65vent_timestamp\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x1f\n\x07results\x18\x04 \x03(\x0b\x32\x0e.StepRunResult\"\x92\x01\n\rStepRunResult\x12\x1c\n\x14task_run_external_id\x18\x01 \x01(\t\x12\x11\n\ttask_name\x18\x02 \x01(\t\x12\x12\n\njob_run_id\x18\x03 \x01(\t\x12\x12\n\x05\x65rror\x18\x04 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06output\x18\x05 \x01(\tH\x01\x88\x01\x01\x42\x08\n\x06_errorB\t\n\x07_output\"c\n\rOverridesData\x12\x1c\n\x14task_run_external_id\x18\x01 \x01(\t\x12\x0c\n\x04path\x18\x02 \x01(\t\x12\r\n\x05value\x18\x03 \x01(\t\x12\x17\n\x0f\x63\x61ller_filename\x18\x04 \x01(\t\"\x17\n\x15OverridesDataResponse\"W\n\x10HeartbeatRequest\x12\x11\n\tworker_id\x18\x01 \x01(\t\x12\x30\n\x0cheartbeat_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"\x13\n\x11HeartbeatResponse\"S\n\x15RefreshTimeoutRequest\x12\x1c\n\x14task_run_external_id\x18\x01 \x01(\t\x12\x1c\n\x14increment_timeout_by\x18\x02 \x01(\t\"H\n\x16RefreshTimeoutResponse\x12.\n\ntimeout_at\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"2\n\x12ReleaseSlotRequest\x12\x1c\n\x14task_run_external_id\x18\x01 \x01(\t\"\x15\n\x13ReleaseSlotResponse\"9\n\x19RestoreEvictedTaskRequest\x12\x1c\n\x14task_run_external_id\x18\x01 \x01(\t\".\n\x1aRestoreEvictedTaskResponse\x12\x10\n\x08requeued\x18\x01 \x01(\x08\"\x13\n\x11GetVersionRequest\"%\n\x12GetVersionResponse\x12\x0f\n\x07version\x18\x01 \x01(\t*A\n\x04SDKS\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x06\n\x02GO\x10\x01\x12\n\n\x06PYTHON\x10\x02\x12\x0e\n\nTYPESCRIPT\x10\x03\x12\x08\n\x04RUBY\x10\x04*_\n\nActionType\x12\x12\n\x0eSTART_STEP_RUN\x10\x00\x12\x13\n\x0f\x43\x41NCEL_STEP_RUN\x10\x01\x12\x17\n\x13START_GET_GROUP_KEY\x10\x02\x12\x0f\n\x0bSTART_BATCH\x10\x03*\xa2\x01\n\x17GroupKeyActionEventType\x12 \n\x1cGROUP_KEY_EVENT_TYPE_UNKNOWN\x10\x00\x12 \n\x1cGROUP_KEY_EVENT_TYPE_STARTED\x10\x01\x12\"\n\x1eGROUP_KEY_EVENT_TYPE_COMPLETED\x10\x02\x12\x1f\n\x1bGROUP_KEY_EVENT_TYPE_FAILED\x10\x03*\xcb\x01\n\x13StepActionEventType\x12\x1b\n\x17STEP_EVENT_TYPE_UNKNOWN\x10\x00\x12\x1b\n\x17STEP_EVENT_TYPE_STARTED\x10\x01\x12\x1d\n\x19STEP_EVENT_TYPE_COMPLETED\x10\x02\x12\x1a\n\x16STEP_EVENT_TYPE_FAILED\x10\x03\x12 \n\x1cSTEP_EVENT_TYPE_ACKNOWLEDGED\x10\x04\x12\x1d\n\x19STEP_EVENT_TYPE_CANCELLED\x10\x05*e\n\x0cResourceType\x12\x19\n\x15RESOURCE_TYPE_UNKNOWN\x10\x00\x12\x1a\n\x16RESOURCE_TYPE_STEP_RUN\x10\x01\x12\x1e\n\x1aRESOURCE_TYPE_WORKFLOW_RUN\x10\x02*\xfe\x01\n\x11ResourceEventType\x12\x1f\n\x1bRESOURCE_EVENT_TYPE_UNKNOWN\x10\x00\x12\x1f\n\x1bRESOURCE_EVENT_TYPE_STARTED\x10\x01\x12!\n\x1dRESOURCE_EVENT_TYPE_COMPLETED\x10\x02\x12\x1e\n\x1aRESOURCE_EVENT_TYPE_FAILED\x10\x03\x12!\n\x1dRESOURCE_EVENT_TYPE_CANCELLED\x10\x04\x12!\n\x1dRESOURCE_EVENT_TYPE_TIMED_OUT\x10\x05\x12\x1e\n\x1aRESOURCE_EVENT_TYPE_STREAM\x10\x06*<\n\x14WorkflowRunEventType\x12$\n WORKFLOW_RUN_EVENT_TYPE_FINISHED\x10\x00\x32\xc5\x08\n\nDispatcher\x12=\n\x08Register\x12\x16.WorkerRegisterRequest\x1a\x17.WorkerRegisterResponse\"\x00\x12\x33\n\x06Listen\x12\x14.WorkerListenRequest\x1a\x0f.AssignedAction\"\x00\x30\x01\x12\x35\n\x08ListenV2\x12\x14.WorkerListenRequest\x1a\x0f.AssignedAction\"\x00\x30\x01\x12\x34\n\tHeartbeat\x12\x11.HeartbeatRequest\x1a\x12.HeartbeatResponse\"\x00\x12R\n\x19SubscribeToWorkflowEvents\x12!.SubscribeToWorkflowEventsRequest\x1a\x0e.WorkflowEvent\"\x00\x30\x01\x12S\n\x17SubscribeToWorkflowRuns\x12\x1f.SubscribeToWorkflowRunsRequest\x1a\x11.WorkflowRunEvent\"\x00(\x01\x30\x01\x12?\n\x13SendStepActionEvent\x12\x10.StepActionEvent\x1a\x14.ActionEventResponse\"\x00\x12\x41\n\x14SendBatchActionEvent\x12\x11.BatchActionEvent\x1a\x14.ActionEventResponse\"\x00\x12G\n\x17SendGroupKeyActionEvent\x12\x14.GroupKeyActionEvent\x1a\x14.ActionEventResponse\"\x00\x12<\n\x10PutOverridesData\x12\x0e.OverridesData\x1a\x16.OverridesDataResponse\"\x00\x12\x46\n\x0bUnsubscribe\x12\x19.WorkerUnsubscribeRequest\x1a\x1a.WorkerUnsubscribeResponse\"\x00\x12\x43\n\x0eRefreshTimeout\x12\x16.RefreshTimeoutRequest\x1a\x17.RefreshTimeoutResponse\"\x00\x12:\n\x0bReleaseSlot\x12\x13.ReleaseSlotRequest\x1a\x14.ReleaseSlotResponse\"\x00\x12O\n\x12RestoreEvictedTask\x12\x1a.RestoreEvictedTaskRequest\x1a\x1b.RestoreEvictedTaskResponse\"\x00\x12O\n\x12UpsertWorkerLabels\x12\x1a.UpsertWorkerLabelsRequest\x1a\x1b.UpsertWorkerLabelsResponse\"\x00\x12\x37\n\nGetVersion\x12\x12.GetVersionRequest\x1a\x13.GetVersionResponse\"\x00\x42GZEgithub.com/hatchet-dev/hatchet/internal/services/dispatcher/contractsb\x06proto3"
11
11
 
12
12
  pool = ::Google::Protobuf::DescriptorPool.generated_pool
13
13
  pool.add_serialized_file(descriptor_data)
@@ -9,6 +9,7 @@ module Hatchet
9
9
  SLOT_CONFIG = "v0.78.23"
10
10
  DURABLE_EVICTION = "v0.80.0"
11
11
  OBSERVABILITY = "v0.82.0"
12
+ RETRY_AFTER = "v0.111.0"
12
13
  end
13
14
 
14
15
  # Semver parsing + comparison helpers used to gate features by engine version.
@@ -10,6 +10,24 @@ module Hatchet
10
10
  end
11
11
  end
12
12
 
13
+ # Raised to retry a task after a delay of its choosing. The retry counts against the task's retries.
14
+ class RetryAfterError < Error
15
+ # @return [Numeric] Seconds to wait before the next attempt
16
+ attr_reader :after
17
+
18
+ # @param message [String] The error message recorded for this attempt
19
+ # @param after [Numeric] Seconds to wait before the next attempt
20
+ def initialize(message = "This task requested a delayed retry", after:)
21
+ @after = after
22
+ super(message)
23
+ end
24
+
25
+ # @return [Integer] The delay in milliseconds, never negative
26
+ def after_ms
27
+ [(after * 1000).round, 0].max
28
+ end
29
+ end
30
+
13
31
  # Raised when the tenant has exceeded its resource limits (e.g. task run quota)
14
32
  class ResourceExhaustedError < Error
15
33
  def initialize(message = "Resource exhausted: tenant has reached its task runs limit")
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Hatchet
4
- VERSION = "0.9.0"
4
+ VERSION = "0.10.0"
5
5
  end
@@ -247,6 +247,10 @@ module Hatchet
247
247
  rescue NonRetryableError => e
248
248
  @logger.error("Non-retryable error in task #{action.action_id}: #{e.message}")
249
249
  send_failure(action, e, retryable: false)
250
+ rescue RetryAfterError => e
251
+ @logger.info("Task #{action.action_id} requested a retry in #{e.after}s: #{e.message}")
252
+ warn_retry_after_unsupported(action)
253
+ send_failure(action, e, retryable: true, retry_after_ms: e.after_ms)
250
254
  rescue StandardError => e
251
255
  @logger.error("Error in task #{action.action_id}: #{e.message}")
252
256
  send_failure(action, e, retryable: true)
@@ -424,7 +428,14 @@ module Hatchet
424
428
 
425
429
  def send_batch_failure_for_all(action, member_ids, error)
426
430
  payload = JSON.generate({ "error" => error.message })
427
- items = member_ids.map { |id| { task_run_external_id: id, event_payload: payload, should_not_retry: true } }
431
+ failure = { should_not_retry: true }
432
+
433
+ if error.is_a?(RetryAfterError)
434
+ warn_retry_after_unsupported(action)
435
+ failure = { should_not_retry: false, retry_after_ms: error.after_ms }
436
+ end
437
+
438
+ items = member_ids.map { |id| { task_run_external_id: id, event_payload: payload, **failure } }
428
439
  @dispatcher_client.send_batch_action_event(action: action, event_type: :STEP_EVENT_TYPE_FAILED, items: items)
429
440
  end
430
441
 
@@ -527,7 +538,7 @@ module Hatchet
527
538
  )
528
539
  end
529
540
 
530
- def send_failure(action, error, retryable:)
541
+ def send_failure(action, error, retryable:, retry_after_ms: nil)
531
542
  payload = JSON.generate({ "error" => error.message })
532
543
 
533
544
  @dispatcher_client.send_step_action_event(
@@ -536,6 +547,17 @@ module Hatchet
536
547
  payload: payload,
537
548
  retry_count: action.retry_count,
538
549
  should_not_retry: !retryable,
550
+ retry_after_ms: retry_after_ms,
551
+ )
552
+ end
553
+
554
+ def warn_retry_after_unsupported(action)
555
+ return if @engine_version && !EngineVersion.semver_less_than?(@engine_version, MinEngineVersion::RETRY_AFTER)
556
+
557
+ @logger.warn(
558
+ "RetryAfterError requires engine #{MinEngineVersion::RETRY_AFTER} or newer " \
559
+ "(engine reports #{@engine_version || "unknown"}). Task #{action.action_id} raised it, so the engine " \
560
+ "will handle the failure with the task's retry policy instead of the requested delay.",
539
561
  )
540
562
  end
541
563
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hatchet-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - gabriel ruttner
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-10-05 00:00:00.000000000 Z
11
+ date: 2026-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -221,6 +221,7 @@ files:
221
221
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/slack_api.rb
222
222
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/sns_api.rb
223
223
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/step_run_api.rb
224
+ - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/streams_api.rb
224
225
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/task_api.rb
225
226
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/tenant_api.rb
226
227
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/user_api.rb
@@ -404,6 +405,7 @@ files:
404
405
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_restore_task_response.rb
405
406
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_running_detail_count.rb
406
407
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_running_filter.rb
408
+ - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_stream_payload_ref.rb
407
409
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_task_event.rb
408
410
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_task_event_list.rb
409
411
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_task_event_type.rb
@@ -432,6 +434,7 @@ files:
432
434
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_webhook_response.rb
433
435
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_webhook_source_name.rb
434
436
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_workflow_run.rb
437
+ - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_workflow_run_count.rb
435
438
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_workflow_run_details.rb
436
439
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_workflow_run_display_name.rb
437
440
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_workflow_run_display_name_list.rb