hatchet-sdk 0.6.0 → 0.7.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.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/lib/hatchet/clients/rest/.openapi-generator/FILES +9 -0
  4. data/lib/hatchet/clients/rest/README.md +16 -3
  5. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/filter_api.rb +4 -0
  6. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/operator_api.rb +405 -0
  7. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/webhook_api.rb +2 -0
  8. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/api_meta.rb +14 -4
  9. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/create_tenant_invite_request.rb +14 -4
  10. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/pause_workflow_request.rb +105 -0
  11. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/pause_workflow_request_pause.rb +343 -0
  12. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/pause_workflow_request_unpause.rb +262 -0
  13. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_invite.rb +11 -1
  14. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_member.rb +11 -1
  15. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_member_role.rb +2 -1
  16. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/update_tenant_invite_request.rb +14 -4
  17. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/update_tenant_member_request.rb +14 -4
  18. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_create_http_operator_request.rb +346 -0
  19. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_event.rb +14 -4
  20. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_http_operator.rb +372 -0
  21. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_http_operator_list.rb +231 -0
  22. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_task_summary.rb +14 -4
  23. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_update_http_operator_request.rb +252 -0
  24. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_workflow_run.rb +14 -4
  25. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow.rb +43 -1
  26. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_pause_scheduled_cron_run_queue_behavior.rb +40 -0
  27. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_update_request.rb +7 -8
  28. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest.rb +9 -0
  29. data/lib/hatchet/concurrency.rb +5 -1
  30. data/lib/hatchet/context.rb +5 -2
  31. data/lib/hatchet/contracts/v1/workflows_pb.rb +1 -1
  32. data/lib/hatchet/durable_context.rb +5 -12
  33. data/lib/hatchet/features/cel.rb +2 -2
  34. data/lib/hatchet/features/cron.rb +5 -5
  35. data/lib/hatchet/features/events.rb +7 -7
  36. data/lib/hatchet/features/filters.rb +7 -7
  37. data/lib/hatchet/features/logs.rb +2 -2
  38. data/lib/hatchet/features/metrics.rb +6 -6
  39. data/lib/hatchet/features/rate_limits.rb +2 -2
  40. data/lib/hatchet/features/runs.rb +4 -5
  41. data/lib/hatchet/features/scheduled.rb +7 -7
  42. data/lib/hatchet/features/tenant.rb +2 -2
  43. data/lib/hatchet/features/workers.rb +5 -5
  44. data/lib/hatchet/features/workflows.rb +6 -6
  45. data/lib/hatchet/version.rb +1 -1
  46. data/lib/hatchet/workflow.rb +58 -33
  47. data/lib/hatchet-sdk.rb +65 -32
  48. metadata +11 -2
data/lib/hatchet-sdk.rb CHANGED
@@ -113,83 +113,103 @@ module Hatchet
113
113
  @rest_client ||= Hatchet::Clients.rest_client(@config)
114
114
  end
115
115
 
116
- # Feature Client for interacting with Hatchet events
116
+ # The events client, which you can use to push events to Hatchet to trigger
117
+ # event-driven workflows.
117
118
  # @return [Hatchet::Features::Events]
118
119
  def events
119
120
  @events ||= Hatchet::Features::Events.new(rest_client, event_grpc, @config)
120
121
  end
121
122
 
122
- # Feature Client for interacting with Hatchet workflow runs
123
+ # The runs client is a client for interacting with task and workflow runs
124
+ # within Hatchet.
123
125
  # @return [Hatchet::Features::Runs]
124
126
  def runs
125
127
  @runs ||= Hatchet::Features::Runs.new(rest_client, @config, client: self)
126
128
  end
127
129
 
128
- # Feature Client for interacting with the current tenant
130
+ # The tenant client is a client for reading information about the tenant
131
+ # you're operating in.
129
132
  # @return [Hatchet::Features::Tenant]
130
133
  def tenant
131
134
  @tenant ||= Hatchet::Features::Tenant.new(rest_client, @config)
132
135
  end
133
136
 
134
- # Feature Client for interacting with Hatchet logs
137
+ # The logs client is a client for interacting with Hatchet's logs API.
135
138
  # @return [Hatchet::Features::Logs]
136
139
  def logs
137
140
  @logs ||= Hatchet::Features::Logs.new(rest_client, @config)
138
141
  end
139
142
 
140
- # Feature Client for managing workers
143
+ # The workers client is a client for managing workers programmatically
144
+ # within Hatchet.
141
145
  # @return [Hatchet::Features::Workers]
142
146
  def workers
143
147
  @workers ||= Hatchet::Features::Workers.new(rest_client, @config)
144
148
  end
145
149
 
146
- # Feature Client for debugging CEL expressions
150
+ # The CEL client is a client for debugging CEL expressions within Hatchet.
147
151
  # @return [Hatchet::Features::CEL]
148
152
  def cel
149
153
  @cel ||= Hatchet::Features::CEL.new(rest_client, @config)
150
154
  end
151
155
 
152
- # Feature Client for managing workflow definitions
156
+ # The workflows client is a client for managing workflow declarations
157
+ # programmatically within Hatchet. Note that workflows are the declaration,
158
+ # _not_ the individual runs; if you're looking for runs, use the runs
159
+ # client instead.
153
160
  # @return [Hatchet::Features::Workflows]
154
161
  def workflows
155
162
  @workflows ||= Hatchet::Features::Workflows.new(rest_client, @config)
156
163
  end
157
164
 
158
- # Feature Client for managing filters
165
+ # The filters client is a client for managing filters within Hatchet, which
166
+ # scope event triggers to workflows using CEL expressions.
159
167
  # @return [Hatchet::Features::Filters]
160
168
  def filters
161
169
  @filters ||= Hatchet::Features::Filters.new(rest_client, @config)
162
170
  end
163
171
 
164
- # Feature Client for reading metrics
172
+ # The metrics client is a client for reading metrics out of Hatchet's
173
+ # metrics API.
165
174
  # @return [Hatchet::Features::Metrics]
166
175
  def metrics
167
176
  @metrics ||= Hatchet::Features::Metrics.new(rest_client, @config)
168
177
  end
169
178
 
170
- # Feature Client for managing rate limits
179
+ # The rate limits client is a wrapper for Hatchet's gRPC API that makes it
180
+ # easier to work with rate limits in Hatchet.
171
181
  # @return [Hatchet::Features::RateLimits]
172
182
  def rate_limits
173
183
  @rate_limits ||= Hatchet::Features::RateLimits.new(admin_grpc, @config)
174
184
  end
175
185
 
176
- # Feature Client for managing cron workflows
186
+ # The cron client is a client for managing cron workflow triggers within
187
+ # Hatchet.
177
188
  # @return [Hatchet::Features::Cron]
178
189
  def cron
179
190
  @cron ||= Hatchet::Features::Cron.new(rest_client, @config)
180
191
  end
181
192
 
182
- # Feature Client for managing scheduled workflows
193
+ # The scheduled client is a client for managing scheduled workflow runs
194
+ # within Hatchet.
183
195
  # @return [Hatchet::Features::Scheduled]
184
196
  def scheduled
185
197
  @scheduled ||= Hatchet::Features::Scheduled.new(rest_client, @config)
186
198
  end
187
199
 
188
- # Create a new workflow definition
200
+ # Define a Hatchet workflow, which can then declare tasks and be run,
201
+ # scheduled, and so on.
189
202
  #
190
- # @param name [String] Workflow name
191
- # @param opts [Hash] Workflow options (on_events:, concurrency:, idempotency:, etc.)
192
- # @return [Hatchet::Workflow]
203
+ # @param name [String] The name of the workflow
204
+ # @option opts [Array<String>] :on_events ([]) A list of event triggers for the workflow - events which cause the workflow to be run
205
+ # @option opts [Array<String>] :on_crons ([]) A list of cron triggers for the workflow
206
+ # @option opts [ConcurrencyExpression, Array<ConcurrencyExpression>, nil] :concurrency (nil) A concurrency object (or list of them) controlling the concurrency settings for this workflow
207
+ # @option opts [Integer, nil] :default_priority (nil) The default priority of the workflow. Higher values will cause runs of this workflow to have priority in scheduling over other, lower priority ones
208
+ # @option opts [Hash, nil] :task_defaults (nil) Default task settings for this workflow
209
+ # @option opts [Array<DefaultFilter>] :default_filters ([]) A list of filters to create when the workflow is created
210
+ # @option opts [Symbol, nil] :sticky (nil) A sticky strategy for the workflow, either +:soft+ or +:hard+
211
+ # @option opts [TTLBasedIdempotencyConfig, StatusBasedIdempotencyConfig, nil] :idempotency (nil) An idempotency configuration for the workflow
212
+ # @return [Hatchet::Workflow] The created workflow object, which can be used to declare tasks, run the workflow, and so on
193
213
  #
194
214
  # @example
195
215
  # wf = hatchet.workflow(name: "MyWorkflow")
@@ -198,12 +218,18 @@ module Hatchet
198
218
  Workflow.new(name: name, client: self, **opts)
199
219
  end
200
220
 
201
- # Create a standalone task (auto-wraps in a single-task workflow)
221
+ # Create a standalone Hatchet task. The task is automatically wrapped in a
222
+ # single-task workflow, so it can be run, scheduled, and registered on a
223
+ # worker just like a workflow. The block receives the run's input and a
224
+ # {Context} object.
202
225
  #
203
- # @param name [String] Task name
204
- # @param opts [Hash] Task options (on_events:, idempotency:, retries:, etc.)
226
+ # @param name [String] The name of the task
227
+ # @option opts [Array<String>] :on_events ([]) A list of event triggers for the task - events which cause the task to be run
228
+ # @option opts [Array<DefaultFilter>] :default_filters ([]) A list of filters to create when the task is created
229
+ # @option opts [TTLBasedIdempotencyConfig, StatusBasedIdempotencyConfig, nil] :idempotency (nil) An idempotency configuration for the task
230
+ # @param opts [Hash] Any other keyword arguments (+retries:+, +execution_timeout:+, +concurrency:+, and so on) are forwarded to the task declaration - see {Workflow#task} for the full list
205
231
  # @yield [input, ctx] The task execution block
206
- # @return [Hatchet::Task]
232
+ # @return [Hatchet::Task] The created task object, which can be run, scheduled, and registered on a worker
207
233
  #
208
234
  # @example
209
235
  # my_task = hatchet.task(name: "my_task") { |input, ctx| { "result" => "done" } }
@@ -225,11 +251,11 @@ module Hatchet
225
251
  #
226
252
  # Preview: batch tasks are in beta and may change in future releases.
227
253
  #
228
- # @param name [String] Task name
229
- # @param batch [Hatchet::BatchTaskConfig] Batch configuration
230
- # @param opts [Hash] Task options (on_events:, idempotency:, etc.)
254
+ # @param name [String] The name of the task
255
+ # @param batch [Hatchet::BatchTaskConfig] The batch configuration (+max_size+, flush interval, +broadcast_output+)
256
+ # @param opts [Hash] Any other keyword arguments (+on_events:+, +idempotency:+, and so on) are forwarded to {#task}
231
257
  # @yield [inputs, ctx] The batch execution block, receiving a Hash of task-run external id => input
232
- # @return [Hatchet::Task]
258
+ # @return [Hatchet::Task] The created batch task object
233
259
  #
234
260
  # @example
235
261
  # batch = hatchet.batch_task(name: "my_batch", batch: Hatchet::BatchTaskConfig.new(max_size: 3)) do |inputs, ctx|
@@ -239,16 +265,18 @@ module Hatchet
239
265
  task(name: name, batch: batch, **opts, &block)
240
266
  end
241
267
 
242
- # Create a standalone durable task.
268
+ # Create a standalone _durable_ Hatchet task, which works using Hatchet's
269
+ # durable execution capabilities. Durable tasks receive a {DurableContext}
270
+ # with additional methods like +sleep_for+ and +wait_for+.
243
271
  #
244
- # @param name [String] Task name
272
+ # @param name [String] The name of the task
245
273
  # @param eviction_policy [Hatchet::EvictionPolicy, nil] Eviction policy for this
246
274
  # durable task. Defaults to {Hatchet::DEFAULT_DURABLE_TASK_EVICTION_POLICY}
247
275
  # (15-minute TTL, capacity-eviction enabled). Pass ``nil`` to disable
248
276
  # eviction entirely for this task.
249
- # @param opts [Hash] Task options
277
+ # @param opts [Hash] Any other keyword arguments (+retries:+, +execution_timeout:+, and so on) are forwarded to the task declaration - see {Workflow#task} for the full list
250
278
  # @yield [input, ctx] The task execution block
251
- # @return [Hatchet::Task]
279
+ # @return [Hatchet::Task] The created durable task object
252
280
  def durable_task(name:, eviction_policy: Hatchet::DEFAULT_DURABLE_TASK_EVICTION_POLICY, **opts, &block)
253
281
  wf = Workflow.new(name: name, client: self,
254
282
  on_events: opts.delete(:on_events) || [],
@@ -256,11 +284,16 @@ module Hatchet
256
284
  wf.durable_task(name, eviction_policy: eviction_policy, **opts, &block)
257
285
  end
258
286
 
259
- # Create a new worker
287
+ # Create a Hatchet worker on which to run workflows.
260
288
  #
261
- # @param name [String] Worker name
262
- # @param opts [Hash] Worker options (workflows:, slots:, labels:)
263
- # @return [Hatchet::Worker]
289
+ # @param name [String] The name of the worker
290
+ # @option opts [Array<Workflow, Task>] :workflows ([]) A list of workflows (or standalone tasks) to register on the worker
291
+ # @option opts [Integer] :slots (10) Slot count for standard tasks, i.e. the number of tasks the worker can run concurrently
292
+ # @option opts [Integer, nil] :durable_slots (nil) Slot count for durable tasks; defaults to +slots+ if not provided
293
+ # @option opts [Hash] :labels ({}) A hash of labels to assign to the worker, for use with worker affinity; merged with the client's +worker_preset_labels+
294
+ # @return [Hatchet::Worker] The created worker object, which exposes an instance
295
+ # method +start+ which can be called to start the worker (blocking until
296
+ # shutdown), and +stop+ to request a graceful shutdown
264
297
  #
265
298
  # @example
266
299
  # worker = hatchet.worker("my-worker", workflows: [wf], slots: 10)
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.6.0
4
+ version: 0.7.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-07-23 00:00:00.000000000 Z
11
+ date: 2026-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -217,6 +217,7 @@ files:
217
217
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/log_api.rb
218
218
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/metadata_api.rb
219
219
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/observability_api.rb
220
+ - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/operator_api.rb
220
221
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/rate_limits_api.rb
221
222
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/slack_api.rb
222
223
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/sns_api.rb
@@ -291,6 +292,9 @@ files:
291
292
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/otel_span_list.rb
292
293
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/otel_status_code.rb
293
294
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/pagination_response.rb
295
+ - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/pause_workflow_request.rb
296
+ - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/pause_workflow_request_pause.rb
297
+ - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/pause_workflow_request_unpause.rb
294
298
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/pull_request.rb
295
299
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/pull_request_state.rb
296
300
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/queue_metrics.rb
@@ -374,6 +378,7 @@ files:
374
378
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_cel_debug_response.rb
375
379
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_cel_debug_response_status.rb
376
380
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_create_filter_request.rb
381
+ - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_create_http_operator_request.rb
377
382
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_create_webhook_request.rb
378
383
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_create_webhook_request_api_key.rb
379
384
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_create_webhook_request_base.rb
@@ -390,6 +395,8 @@ files:
390
395
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_event_workflow_run_summary.rb
391
396
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_filter.rb
392
397
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_filter_list.rb
398
+ - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_http_operator.rb
399
+ - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_http_operator_list.rb
393
400
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_log_line.rb
394
401
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_log_line_level.rb
395
402
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_log_line_list.rb
@@ -416,6 +423,7 @@ files:
416
423
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_task_timing_list.rb
417
424
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_trigger_workflow_run_request.rb
418
425
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_update_filter_request.rb
426
+ - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_update_http_operator_request.rb
419
427
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_update_webhook_request.rb
420
428
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_wait_item.rb
421
429
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_webhook.rb
@@ -454,6 +462,7 @@ files:
454
462
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_kind.rb
455
463
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_list.rb
456
464
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_metrics.rb
465
+ - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_pause_scheduled_cron_run_queue_behavior.rb
457
466
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_run.rb
458
467
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_run_list.rb
459
468
  - lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_run_order_by_direction.rb