hatchet-sdk 0.12.1 → 0.12.2
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 +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/hatchet/clients/rest/.openapi-generator/FILES +1 -0
- data/lib/hatchet/clients/rest/README.md +2 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/tenant_api.rb +82 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/update_tenant_entitlements_request.rb +241 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest.rb +1 -0
- data/lib/hatchet/condition_converter.rb +42 -2
- data/lib/hatchet/context.rb +2 -1
- data/lib/hatchet/task.rb +8 -4
- data/lib/hatchet/version.rb +1 -1
- data/sig/hatchet/condition_converter.rbs +8 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3d53f368854f3ff93c819ef0b59c24f0ad4d89567c725a50ba28620d1e3af379
|
|
4
|
+
data.tar.gz: 5779175393abc526f7a03568fce444b7a6da13f928769431224bdb1b5650ad34
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: eef1ba0e103e16593582cb1890d8844578c8197d8cd51387bb5ae12827273d0607e6c8721d6024e02b3357dbcde42cdfac401bb34ea439528f4b377c3937b5ef
|
|
7
|
+
data.tar.gz: 697d77bdb6d5c54b3febfb315a556d56b15c9a3e8b89bff96761da2b8c97f23a66da32b11fff12979f7e72be2f1f631ea4458e258757d0ed80206597314f8416
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,13 @@ 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.12.2] - 2026-11-10
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- Task `wait_for` and `skip_if` conditions grouped with `Hatchet.or_`, and `Hatchet::ParentCondition`s, were silently dropped at workflow registration, so those tasks ran without waiting or skipping. They are now registered with the engine.
|
|
13
|
+
- `Context#was_skipped?` returns true only for a parent the engine marked as skipped, instead of for any parent whose output is missing.
|
|
14
|
+
|
|
8
15
|
## [0.12.1] - 2026-11-02
|
|
9
16
|
|
|
10
17
|
### Added
|
|
@@ -165,6 +165,7 @@ lib/hatchet-sdk-rest/models/trigger_workflow_run_request.rb
|
|
|
165
165
|
lib/hatchet-sdk-rest/models/update_cron_workflow_trigger_request.rb
|
|
166
166
|
lib/hatchet-sdk-rest/models/update_scheduled_workflow_run_request.rb
|
|
167
167
|
lib/hatchet-sdk-rest/models/update_tenant_alert_email_group_request.rb
|
|
168
|
+
lib/hatchet-sdk-rest/models/update_tenant_entitlements_request.rb
|
|
168
169
|
lib/hatchet-sdk-rest/models/update_tenant_invite_request.rb
|
|
169
170
|
lib/hatchet-sdk-rest/models/update_tenant_member_request.rb
|
|
170
171
|
lib/hatchet-sdk-rest/models/update_tenant_request.rb
|
|
@@ -177,6 +177,7 @@ Class | Method | HTTP request | Description
|
|
|
177
177
|
*HatchetSdkRest::TenantApi* | [**tenant_alerting_settings_get**](docs/TenantApi.md#tenant_alerting_settings_get) | **GET** /api/v1/tenants/{tenant}/alerting/settings | Get tenant alerting settings
|
|
178
178
|
*HatchetSdkRest::TenantApi* | [**tenant_create**](docs/TenantApi.md#tenant_create) | **POST** /api/v1/tenants | Create tenant
|
|
179
179
|
*HatchetSdkRest::TenantApi* | [**tenant_entitlements_get**](docs/TenantApi.md#tenant_entitlements_get) | **GET** /api/v1/tenants/{tenant}/entitlements | Get tenant entitlements
|
|
180
|
+
*HatchetSdkRest::TenantApi* | [**tenant_entitlements_update**](docs/TenantApi.md#tenant_entitlements_update) | **PATCH** /api/v1/tenants/{tenant}/entitlements | Update tenant entitlements
|
|
180
181
|
*HatchetSdkRest::TenantApi* | [**tenant_get**](docs/TenantApi.md#tenant_get) | **GET** /api/v1/tenants/{tenant} | Get tenant
|
|
181
182
|
*HatchetSdkRest::TenantApi* | [**tenant_get_prometheus_metrics**](docs/TenantApi.md#tenant_get_prometheus_metrics) | **GET** /api/v1/tenants/{tenant}/prometheus-metrics | Get prometheus metrics
|
|
182
183
|
*HatchetSdkRest::TenantApi* | [**tenant_get_step_run_queue_metrics**](docs/TenantApi.md#tenant_get_step_run_queue_metrics) | **GET** /api/v1/tenants/{tenant}/step-run-queue-metrics | Get step run metrics
|
|
@@ -382,6 +383,7 @@ Class | Method | HTTP request | Description
|
|
|
382
383
|
- [HatchetSdkRest::UpdateCronWorkflowTriggerRequest](docs/UpdateCronWorkflowTriggerRequest.md)
|
|
383
384
|
- [HatchetSdkRest::UpdateScheduledWorkflowRunRequest](docs/UpdateScheduledWorkflowRunRequest.md)
|
|
384
385
|
- [HatchetSdkRest::UpdateTenantAlertEmailGroupRequest](docs/UpdateTenantAlertEmailGroupRequest.md)
|
|
386
|
+
- [HatchetSdkRest::UpdateTenantEntitlementsRequest](docs/UpdateTenantEntitlementsRequest.md)
|
|
385
387
|
- [HatchetSdkRest::UpdateTenantInviteRequest](docs/UpdateTenantInviteRequest.md)
|
|
386
388
|
- [HatchetSdkRest::UpdateTenantMemberRequest](docs/UpdateTenantMemberRequest.md)
|
|
387
389
|
- [HatchetSdkRest::UpdateTenantRequest](docs/UpdateTenantRequest.md)
|
|
@@ -535,6 +535,88 @@ module HatchetSdkRest
|
|
|
535
535
|
return data, status_code, headers
|
|
536
536
|
end
|
|
537
537
|
|
|
538
|
+
# Update tenant entitlements
|
|
539
|
+
# Updates the tenant's Labs preview opt-ins. Omitted fields are left unchanged. Only tenant owners and admins can call this, and API tokens cannot.
|
|
540
|
+
# @param tenant [String] The tenant id
|
|
541
|
+
# @param update_tenant_entitlements_request [UpdateTenantEntitlementsRequest] The Labs preview flags to update
|
|
542
|
+
# @param [Hash] opts the optional parameters
|
|
543
|
+
# @return [TenantEntitlements]
|
|
544
|
+
def tenant_entitlements_update(tenant, update_tenant_entitlements_request, opts = {})
|
|
545
|
+
data, _status_code, _headers = tenant_entitlements_update_with_http_info(tenant, update_tenant_entitlements_request, opts)
|
|
546
|
+
data
|
|
547
|
+
end
|
|
548
|
+
|
|
549
|
+
# Update tenant entitlements
|
|
550
|
+
# Updates the tenant's Labs preview opt-ins. Omitted fields are left unchanged. Only tenant owners and admins can call this, and API tokens cannot.
|
|
551
|
+
# @param tenant [String] The tenant id
|
|
552
|
+
# @param update_tenant_entitlements_request [UpdateTenantEntitlementsRequest] The Labs preview flags to update
|
|
553
|
+
# @param [Hash] opts the optional parameters
|
|
554
|
+
# @return [Array<(TenantEntitlements, Integer, Hash)>] TenantEntitlements data, response status code and response headers
|
|
555
|
+
def tenant_entitlements_update_with_http_info(tenant, update_tenant_entitlements_request, opts = {})
|
|
556
|
+
if @api_client.config.debugging
|
|
557
|
+
@api_client.config.logger.debug 'Calling API: TenantApi.tenant_entitlements_update ...'
|
|
558
|
+
end
|
|
559
|
+
# verify the required parameter 'tenant' is set
|
|
560
|
+
if @api_client.config.client_side_validation && tenant.nil?
|
|
561
|
+
fail ArgumentError, "Missing the required parameter 'tenant' when calling TenantApi.tenant_entitlements_update"
|
|
562
|
+
end
|
|
563
|
+
if @api_client.config.client_side_validation && tenant.to_s.length > 36
|
|
564
|
+
fail ArgumentError, 'invalid value for "tenant" when calling TenantApi.tenant_entitlements_update, the character length must be smaller than or equal to 36.'
|
|
565
|
+
end
|
|
566
|
+
|
|
567
|
+
if @api_client.config.client_side_validation && tenant.to_s.length < 36
|
|
568
|
+
fail ArgumentError, 'invalid value for "tenant" when calling TenantApi.tenant_entitlements_update, the character length must be greater than or equal to 36.'
|
|
569
|
+
end
|
|
570
|
+
|
|
571
|
+
# verify the required parameter 'update_tenant_entitlements_request' is set
|
|
572
|
+
if @api_client.config.client_side_validation && update_tenant_entitlements_request.nil?
|
|
573
|
+
fail ArgumentError, "Missing the required parameter 'update_tenant_entitlements_request' when calling TenantApi.tenant_entitlements_update"
|
|
574
|
+
end
|
|
575
|
+
# resource path
|
|
576
|
+
local_var_path = '/api/v1/tenants/{tenant}/entitlements'.sub('{' + 'tenant' + '}', CGI.escape(tenant.to_s))
|
|
577
|
+
|
|
578
|
+
# query parameters
|
|
579
|
+
query_params = opts[:query_params] || {}
|
|
580
|
+
|
|
581
|
+
# header parameters
|
|
582
|
+
header_params = opts[:header_params] || {}
|
|
583
|
+
# HTTP header 'Accept' (if needed)
|
|
584
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
585
|
+
# HTTP header 'Content-Type'
|
|
586
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
587
|
+
if !content_type.nil?
|
|
588
|
+
header_params['Content-Type'] = content_type
|
|
589
|
+
end
|
|
590
|
+
|
|
591
|
+
# form parameters
|
|
592
|
+
form_params = opts[:form_params] || {}
|
|
593
|
+
|
|
594
|
+
# http body (model)
|
|
595
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(update_tenant_entitlements_request)
|
|
596
|
+
|
|
597
|
+
# return_type
|
|
598
|
+
return_type = opts[:debug_return_type] || 'TenantEntitlements'
|
|
599
|
+
|
|
600
|
+
# auth_names
|
|
601
|
+
auth_names = opts[:debug_auth_names] || ['cookieAuth', 'bearerAuth']
|
|
602
|
+
|
|
603
|
+
new_options = opts.merge(
|
|
604
|
+
:operation => :"TenantApi.tenant_entitlements_update",
|
|
605
|
+
:header_params => header_params,
|
|
606
|
+
:query_params => query_params,
|
|
607
|
+
:form_params => form_params,
|
|
608
|
+
:body => post_body,
|
|
609
|
+
:auth_names => auth_names,
|
|
610
|
+
:return_type => return_type
|
|
611
|
+
)
|
|
612
|
+
|
|
613
|
+
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
|
|
614
|
+
if @api_client.config.debugging
|
|
615
|
+
@api_client.config.logger.debug "API called: TenantApi#tenant_entitlements_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
616
|
+
end
|
|
617
|
+
return data, status_code, headers
|
|
618
|
+
end
|
|
619
|
+
|
|
538
620
|
# Get tenant
|
|
539
621
|
# Get the details of a tenant
|
|
540
622
|
# @param tenant [String] The tenant id to get details for
|
data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/update_tenant_entitlements_request.rb
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
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 UpdateTenantEntitlementsRequest
|
|
18
|
+
# Whether the tenant has opted into durable streams.
|
|
19
|
+
attr_accessor :durable_streams
|
|
20
|
+
|
|
21
|
+
# Whether the tenant has opted into the serverless operator.
|
|
22
|
+
attr_accessor :serverless_operator
|
|
23
|
+
|
|
24
|
+
# Whether the tenant has opted into the sandbox operator.
|
|
25
|
+
attr_accessor :sandbox_operator
|
|
26
|
+
|
|
27
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
28
|
+
def self.attribute_map
|
|
29
|
+
{
|
|
30
|
+
:'durable_streams' => :'durableStreams',
|
|
31
|
+
:'serverless_operator' => :'serverlessOperator',
|
|
32
|
+
:'sandbox_operator' => :'sandboxOperator'
|
|
33
|
+
}
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Returns attribute mapping this model knows about
|
|
37
|
+
def self.acceptable_attribute_map
|
|
38
|
+
attribute_map
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Returns all the JSON keys this model knows about
|
|
42
|
+
def self.acceptable_attributes
|
|
43
|
+
acceptable_attribute_map.values
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Attribute type mapping.
|
|
47
|
+
def self.openapi_types
|
|
48
|
+
{
|
|
49
|
+
:'durable_streams' => :'Boolean',
|
|
50
|
+
:'serverless_operator' => :'Boolean',
|
|
51
|
+
:'sandbox_operator' => :'Boolean'
|
|
52
|
+
}
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# List of attributes with nullable: true
|
|
56
|
+
def self.openapi_nullable
|
|
57
|
+
Set.new([
|
|
58
|
+
])
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Initializes the object
|
|
62
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
63
|
+
def initialize(attributes = {})
|
|
64
|
+
if (!attributes.is_a?(Hash))
|
|
65
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `HatchetSdkRest::UpdateTenantEntitlementsRequest` initialize method"
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
69
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
70
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
71
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
72
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `HatchetSdkRest::UpdateTenantEntitlementsRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
73
|
+
end
|
|
74
|
+
h[k.to_sym] = v
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if attributes.key?(:'durable_streams')
|
|
78
|
+
self.durable_streams = attributes[:'durable_streams']
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
if attributes.key?(:'serverless_operator')
|
|
82
|
+
self.serverless_operator = attributes[:'serverless_operator']
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
if attributes.key?(:'sandbox_operator')
|
|
86
|
+
self.sandbox_operator = attributes[:'sandbox_operator']
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
91
|
+
# @return Array for valid properties with the reasons
|
|
92
|
+
def list_invalid_properties
|
|
93
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
94
|
+
invalid_properties = Array.new
|
|
95
|
+
invalid_properties
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Check to see if the all the properties in the model are valid
|
|
99
|
+
# @return true if the model is valid
|
|
100
|
+
def valid?
|
|
101
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
102
|
+
true
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# Checks equality by comparing each attribute.
|
|
106
|
+
# @param [Object] Object to be compared
|
|
107
|
+
def ==(o)
|
|
108
|
+
return true if self.equal?(o)
|
|
109
|
+
self.class == o.class &&
|
|
110
|
+
durable_streams == o.durable_streams &&
|
|
111
|
+
serverless_operator == o.serverless_operator &&
|
|
112
|
+
sandbox_operator == o.sandbox_operator
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# @see the `==` method
|
|
116
|
+
# @param [Object] Object to be compared
|
|
117
|
+
def eql?(o)
|
|
118
|
+
self == o
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Calculates hash code according to all attributes.
|
|
122
|
+
# @return [Integer] Hash code
|
|
123
|
+
def hash
|
|
124
|
+
[durable_streams, serverless_operator, sandbox_operator].hash
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# Builds the object from hash
|
|
128
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
129
|
+
# @return [Object] Returns the model itself
|
|
130
|
+
def self.build_from_hash(attributes)
|
|
131
|
+
return nil unless attributes.is_a?(Hash)
|
|
132
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
133
|
+
transformed_hash = {}
|
|
134
|
+
openapi_types.each_pair do |key, type|
|
|
135
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
136
|
+
transformed_hash["#{key}"] = nil
|
|
137
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
138
|
+
# check to ensure the input is an array given that the attribute
|
|
139
|
+
# is documented as an array but the input is not
|
|
140
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
141
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
142
|
+
end
|
|
143
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
144
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
new(transformed_hash)
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Deserializes the data based on type
|
|
151
|
+
# @param string type Data type
|
|
152
|
+
# @param string value Value to be deserialized
|
|
153
|
+
# @return [Object] Deserialized data
|
|
154
|
+
def self._deserialize(type, value)
|
|
155
|
+
case type.to_sym
|
|
156
|
+
when :Time
|
|
157
|
+
Time.parse(value)
|
|
158
|
+
when :Date
|
|
159
|
+
Date.parse(value)
|
|
160
|
+
when :String
|
|
161
|
+
value.to_s
|
|
162
|
+
when :Integer
|
|
163
|
+
value.to_i
|
|
164
|
+
when :Float
|
|
165
|
+
value.to_f
|
|
166
|
+
when :Boolean
|
|
167
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
168
|
+
true
|
|
169
|
+
else
|
|
170
|
+
false
|
|
171
|
+
end
|
|
172
|
+
when :Object
|
|
173
|
+
# generic object (usually a Hash), return directly
|
|
174
|
+
value
|
|
175
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
176
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
177
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
178
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
179
|
+
k_type = Regexp.last_match[:k_type]
|
|
180
|
+
v_type = Regexp.last_match[:v_type]
|
|
181
|
+
{}.tap do |hash|
|
|
182
|
+
value.each do |k, v|
|
|
183
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
else # model
|
|
187
|
+
# models (e.g. Pet) or oneOf
|
|
188
|
+
klass = HatchetSdkRest.const_get(type)
|
|
189
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
# Returns the string representation of the object
|
|
194
|
+
# @return [String] String presentation of the object
|
|
195
|
+
def to_s
|
|
196
|
+
to_hash.to_s
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
200
|
+
# @return [Hash] Returns the object in the form of hash
|
|
201
|
+
def to_body
|
|
202
|
+
to_hash
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
# Returns the object in the form of hash
|
|
206
|
+
# @return [Hash] Returns the object in the form of hash
|
|
207
|
+
def to_hash
|
|
208
|
+
hash = {}
|
|
209
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
210
|
+
value = self.send(attr)
|
|
211
|
+
if value.nil?
|
|
212
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
213
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
hash[param] = _to_hash(value)
|
|
217
|
+
end
|
|
218
|
+
hash
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
# Outputs non-array value in the form of hash
|
|
222
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
223
|
+
# @param [Object] value Any valid value
|
|
224
|
+
# @return [Hash] Returns the value in the form of hash
|
|
225
|
+
def _to_hash(value)
|
|
226
|
+
if value.is_a?(Array)
|
|
227
|
+
value.compact.map { |v| _to_hash(v) }
|
|
228
|
+
elsif value.is_a?(Hash)
|
|
229
|
+
{}.tap do |hash|
|
|
230
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
231
|
+
end
|
|
232
|
+
elsif value.respond_to? :to_hash
|
|
233
|
+
value.to_hash
|
|
234
|
+
else
|
|
235
|
+
value
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
end
|
|
@@ -143,6 +143,7 @@ HatchetSdkRest.autoload :TriggerWorkflowRunRequest, 'hatchet-sdk-rest/models/tri
|
|
|
143
143
|
HatchetSdkRest.autoload :UpdateCronWorkflowTriggerRequest, 'hatchet-sdk-rest/models/update_cron_workflow_trigger_request'
|
|
144
144
|
HatchetSdkRest.autoload :UpdateScheduledWorkflowRunRequest, 'hatchet-sdk-rest/models/update_scheduled_workflow_run_request'
|
|
145
145
|
HatchetSdkRest.autoload :UpdateTenantAlertEmailGroupRequest, 'hatchet-sdk-rest/models/update_tenant_alert_email_group_request'
|
|
146
|
+
HatchetSdkRest.autoload :UpdateTenantEntitlementsRequest, 'hatchet-sdk-rest/models/update_tenant_entitlements_request'
|
|
146
147
|
HatchetSdkRest.autoload :UpdateTenantInviteRequest, 'hatchet-sdk-rest/models/update_tenant_invite_request'
|
|
147
148
|
HatchetSdkRest.autoload :UpdateTenantMemberRequest, 'hatchet-sdk-rest/models/update_tenant_member_request'
|
|
148
149
|
HatchetSdkRest.autoload :UpdateTenantRequest, 'hatchet-sdk-rest/models/update_tenant_request'
|
|
@@ -14,7 +14,7 @@ module Hatchet
|
|
|
14
14
|
# Convert a single condition into the appropriate protobuf message and
|
|
15
15
|
# append it to the provided accumulator arrays.
|
|
16
16
|
#
|
|
17
|
-
# @param cond [Object] The condition (SleepCondition, UserEventCondition, Hash, or duck-typed)
|
|
17
|
+
# @param cond [Object] The condition (SleepCondition, UserEventCondition, ParentCondition, OrCondition, Hash, or duck-typed)
|
|
18
18
|
# @param action [Symbol] Proto action (:QUEUE or :SKIP)
|
|
19
19
|
# @param sleep_conditions [Array] Accumulator for sleep condition protos
|
|
20
20
|
# @param user_event_conditions [Array] Accumulator for user event condition protos
|
|
@@ -22,12 +22,34 @@ module Hatchet
|
|
|
22
22
|
# @param readable_data_key [String, nil] Override for Hash readable_data_key (used by durable context)
|
|
23
23
|
# @param proto_method [Symbol] Method to check for self-converting conditions (:to_proto or :to_durable_proto)
|
|
24
24
|
# @param proto_arg [Object, nil] Argument to pass to proto_method (action for :to_proto, key for :to_durable_proto)
|
|
25
|
+
# @param parent_override_conditions [Array, nil] Accumulator for parent override condition protos;
|
|
26
|
+
# nil where parent conditions are not supported (durable waits)
|
|
25
27
|
def convert_condition(cond, action:, sleep_conditions:, user_event_conditions:,
|
|
28
|
+
parent_override_conditions: nil,
|
|
26
29
|
or_group_id: nil, readable_data_key: nil,
|
|
27
30
|
proto_method: :to_proto, proto_arg: nil, config: nil)
|
|
31
|
+
if cond.is_a?(Hatchet::OrCondition)
|
|
32
|
+
# A nested or_ joins the group it sits in; the engine ANDs separate groups.
|
|
33
|
+
group_id = or_group_id || SecureRandom.uuid
|
|
34
|
+
cond.conditions.each do |inner|
|
|
35
|
+
convert_condition(inner, action: action, sleep_conditions: sleep_conditions,
|
|
36
|
+
user_event_conditions: user_event_conditions,
|
|
37
|
+
parent_override_conditions: parent_override_conditions,
|
|
38
|
+
or_group_id: group_id, readable_data_key: readable_data_key,
|
|
39
|
+
proto_method: proto_method, proto_arg: proto_arg, config: config,)
|
|
40
|
+
end
|
|
41
|
+
return
|
|
42
|
+
end
|
|
43
|
+
|
|
28
44
|
or_group_id ||= SecureRandom.uuid
|
|
29
45
|
|
|
30
|
-
if cond.
|
|
46
|
+
if cond.is_a?(Hatchet::ParentCondition)
|
|
47
|
+
msg = "ParentCondition is only supported in a task's wait_for or skip_if"
|
|
48
|
+
raise ArgumentError, msg if parent_override_conditions.nil?
|
|
49
|
+
|
|
50
|
+
convert_parent_condition(cond, action: action, or_group_id: or_group_id,
|
|
51
|
+
parent_override_conditions: parent_override_conditions,)
|
|
52
|
+
elsif cond.respond_to?(proto_method)
|
|
31
53
|
# Condition object knows how to convert itself
|
|
32
54
|
proto = cond.public_send(proto_method, proto_arg || action)
|
|
33
55
|
case proto
|
|
@@ -62,6 +84,24 @@ module Hatchet
|
|
|
62
84
|
end
|
|
63
85
|
end
|
|
64
86
|
|
|
87
|
+
# @param cond [Hatchet::ParentCondition]
|
|
88
|
+
def convert_parent_condition(cond, action:, or_group_id:, parent_override_conditions:)
|
|
89
|
+
parent = cond.parent
|
|
90
|
+
parent_name = parent.respond_to?(:name) ? parent.name.to_s : parent.to_s
|
|
91
|
+
|
|
92
|
+
base_args = {
|
|
93
|
+
readable_data_key: "#{parent_name}:#{cond.expression}",
|
|
94
|
+
or_group_id: or_group_id,
|
|
95
|
+
expression: cond.expression || "",
|
|
96
|
+
}
|
|
97
|
+
base_args[:action] = action if action
|
|
98
|
+
|
|
99
|
+
parent_override_conditions << ::V1::ParentOverrideMatchCondition.new(
|
|
100
|
+
base: ::V1::BaseMatchCondition.new(base_args),
|
|
101
|
+
parent_readable_id: parent_name,
|
|
102
|
+
)
|
|
103
|
+
end
|
|
104
|
+
|
|
65
105
|
# @param duration [Integer, String] Sleep duration (seconds as Integer, or Go duration string like "15s")
|
|
66
106
|
def convert_sleep_condition(duration, action:, or_group_id:, sleep_conditions:)
|
|
67
107
|
sleep_for = duration.is_a?(String) ? duration : "#{duration}s"
|
data/lib/hatchet/context.rb
CHANGED
|
@@ -108,7 +108,8 @@ module Hatchet
|
|
|
108
108
|
# @param task_ref [Task, Symbol, String] Reference to the parent task
|
|
109
109
|
# @return [Boolean] true if the task was skipped
|
|
110
110
|
def was_skipped?(task_ref)
|
|
111
|
-
task_output(task_ref)
|
|
111
|
+
output = task_output(task_ref)
|
|
112
|
+
output.is_a?(Hash) && (output["skipped"] == true || output[:skipped] == true)
|
|
112
113
|
end
|
|
113
114
|
|
|
114
115
|
# Log a message via the Hatchet logging system.
|
data/lib/hatchet/task.rb
CHANGED
|
@@ -395,33 +395,37 @@ module Hatchet
|
|
|
395
395
|
|
|
396
396
|
sleep_conditions = []
|
|
397
397
|
user_event_conditions = []
|
|
398
|
+
parent_override_conditions = []
|
|
399
|
+
accumulators = [sleep_conditions, user_event_conditions, parent_override_conditions]
|
|
398
400
|
|
|
399
401
|
# Process wait_for conditions (action = QUEUE)
|
|
400
402
|
(@wait_for || []).each do |cond|
|
|
401
|
-
process_condition(cond, :QUEUE,
|
|
403
|
+
process_condition(cond, :QUEUE, *accumulators, config)
|
|
402
404
|
end
|
|
403
405
|
|
|
404
406
|
# Process skip_if conditions (action = SKIP)
|
|
405
407
|
(@skip_if || []).each do |cond|
|
|
406
|
-
process_condition(cond, :SKIP,
|
|
408
|
+
process_condition(cond, :SKIP, *accumulators, config)
|
|
407
409
|
end
|
|
408
410
|
|
|
409
|
-
return nil if
|
|
411
|
+
return nil if accumulators.all?(&:empty?)
|
|
410
412
|
|
|
411
413
|
::V1::TaskConditions.new(
|
|
412
414
|
sleep_conditions: sleep_conditions,
|
|
413
415
|
user_event_conditions: user_event_conditions,
|
|
416
|
+
parent_override_conditions: parent_override_conditions,
|
|
414
417
|
)
|
|
415
418
|
end
|
|
416
419
|
|
|
417
420
|
# Process a single condition into the appropriate proto list.
|
|
418
421
|
# Delegates to ConditionConverter for shared logic.
|
|
419
|
-
def process_condition(cond, action, sleep_conditions, user_event_conditions, config = nil)
|
|
422
|
+
def process_condition(cond, action, sleep_conditions, user_event_conditions, parent_override_conditions, config = nil)
|
|
420
423
|
ConditionConverter.convert_condition(
|
|
421
424
|
cond,
|
|
422
425
|
action: action,
|
|
423
426
|
sleep_conditions: sleep_conditions,
|
|
424
427
|
user_event_conditions: user_event_conditions,
|
|
428
|
+
parent_override_conditions: parent_override_conditions,
|
|
425
429
|
proto_method: :to_proto,
|
|
426
430
|
proto_arg: action,
|
|
427
431
|
config: config,
|
data/lib/hatchet/version.rb
CHANGED
|
@@ -5,12 +5,20 @@ module Hatchet
|
|
|
5
5
|
action: Symbol,
|
|
6
6
|
sleep_conditions: Array[untyped],
|
|
7
7
|
user_event_conditions: Array[untyped],
|
|
8
|
+
?parent_override_conditions: Array[untyped]?,
|
|
8
9
|
?or_group_id: String?,
|
|
9
10
|
?readable_data_key: String?,
|
|
10
11
|
?proto_method: Symbol,
|
|
11
12
|
?proto_arg: untyped
|
|
12
13
|
) -> void
|
|
13
14
|
|
|
15
|
+
def self.convert_parent_condition: (
|
|
16
|
+
ParentCondition cond,
|
|
17
|
+
action: Symbol?,
|
|
18
|
+
or_group_id: String,
|
|
19
|
+
parent_override_conditions: Array[untyped]
|
|
20
|
+
) -> void
|
|
21
|
+
|
|
14
22
|
def self.convert_sleep_condition: (
|
|
15
23
|
Integer | String duration,
|
|
16
24
|
action: Symbol,
|
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.12.
|
|
4
|
+
version: 0.12.2
|
|
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-11-
|
|
11
|
+
date: 2026-11-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -362,6 +362,7 @@ files:
|
|
|
362
362
|
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/update_cron_workflow_trigger_request.rb
|
|
363
363
|
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/update_scheduled_workflow_run_request.rb
|
|
364
364
|
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/update_tenant_alert_email_group_request.rb
|
|
365
|
+
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/update_tenant_entitlements_request.rb
|
|
365
366
|
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/update_tenant_invite_request.rb
|
|
366
367
|
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/update_tenant_member_request.rb
|
|
367
368
|
- lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/update_tenant_request.rb
|