hatchet-sdk 0.4.0 → 0.5.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 (64) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/lib/hatchet/clients/rest/.openapi-generator/FILES +24 -0
  4. data/lib/hatchet/clients/rest/README.md +31 -1
  5. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/durable_tasks_api.rb +113 -0
  6. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/feature_flags_api.rb +107 -0
  7. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/log_api.rb +156 -52
  8. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/observability_api.rb +114 -0
  9. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/rate_limits_api.rb +78 -0
  10. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/task_api.rb +71 -0
  11. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/tenant_api.rb +3 -0
  12. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/worker_api.rb +9 -0
  13. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/workflow_api.rb +170 -0
  14. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/workflow_runs_api.rb +94 -0
  15. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api_model_base.rb +88 -0
  16. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/api_meta.rb +44 -4
  17. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/feature_flag_evaluation_result.rb +238 -0
  18. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/feature_flag_id.rb +41 -0
  19. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/otel_span.rb +525 -0
  20. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/otel_span_kind.rb +44 -0
  21. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/otel_span_list.rb +242 -0
  22. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/otel_status_code.rb +41 -0
  23. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/task_status_stat.rb +13 -4
  24. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant.rb +24 -4
  25. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_member.rb +14 -4
  26. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/trigger_run_result.rb +256 -0
  27. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_additional_metadata_operator.rb +40 -0
  28. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_branch_durable_task_request.rb +310 -0
  29. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_branch_durable_task_response.rb +310 -0
  30. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_create_webhook_request_api_key.rb +14 -4
  31. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_create_webhook_request_base.rb +14 -4
  32. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_create_webhook_request_basic_auth.rb +14 -4
  33. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_create_webhook_request_hmac.rb +14 -4
  34. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_durable_event_log_entry.rb +470 -0
  35. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_durable_event_log_kind.rb +41 -0
  36. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_durable_wait_condition.rb +286 -0
  37. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_durable_wait_condition_kind.rb +41 -0
  38. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_log_line.rb +49 -1
  39. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_logs_point_metric.rb +341 -0
  40. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_logs_point_metrics.rb +222 -0
  41. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_restore_task_response.rb +237 -0
  42. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_running_detail_count.rb +265 -0
  43. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_running_filter.rb +41 -0
  44. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_task_event_type.rb +3 -1
  45. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_task_run_metric.rb +13 -4
  46. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_task_summary.rb +34 -4
  47. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_task_timing.rb +11 -1
  48. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_trigger_workflow_run_request.rb +14 -4
  49. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_update_webhook_request.rb +14 -4
  50. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_wait_item.rb +280 -0
  51. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_webhook.rb +14 -4
  52. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/worker.rb +1 -13
  53. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/worker_status.rb +41 -0
  54. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_version_idempotency.rb +265 -0
  55. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_version_task.rb +393 -0
  56. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_version_task_desired_worker_label.rb +288 -0
  57. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_version_task_rate_limit.rb +271 -0
  58. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest.rb +24 -0
  59. data/lib/hatchet/contracts/v1/workflows_pb.rb +3 -1
  60. data/lib/hatchet/idempotency.rb +35 -1
  61. data/lib/hatchet/version.rb +1 -1
  62. data/lib/hatchet/workflow.rb +2 -2
  63. data/sig/hatchet/idempotency.rbs +8 -0
  64. metadata +31 -2
@@ -0,0 +1,286 @@
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 V1DurableWaitCondition
18
+ attr_accessor :kind
19
+
20
+ attr_accessor :sleep_duration_ms
21
+
22
+ attr_accessor :event_key
23
+
24
+ attr_accessor :workflow_name
25
+
26
+ class EnumAttributeValidator
27
+ attr_reader :datatype
28
+ attr_reader :allowable_values
29
+
30
+ def initialize(datatype, allowable_values)
31
+ @allowable_values = allowable_values.map do |value|
32
+ case datatype.to_s
33
+ when /Integer/i
34
+ value.to_i
35
+ when /Float/i
36
+ value.to_f
37
+ else
38
+ value
39
+ end
40
+ end
41
+ end
42
+
43
+ def valid?(value)
44
+ !value || allowable_values.include?(value)
45
+ end
46
+ end
47
+
48
+ # Attribute mapping from ruby-style variable name to JSON key.
49
+ def self.attribute_map
50
+ {
51
+ :'kind' => :'kind',
52
+ :'sleep_duration_ms' => :'sleepDurationMs',
53
+ :'event_key' => :'eventKey',
54
+ :'workflow_name' => :'workflowName'
55
+ }
56
+ end
57
+
58
+ # Returns attribute mapping this model knows about
59
+ def self.acceptable_attribute_map
60
+ attribute_map
61
+ end
62
+
63
+ # Returns all the JSON keys this model knows about
64
+ def self.acceptable_attributes
65
+ acceptable_attribute_map.values
66
+ end
67
+
68
+ # Attribute type mapping.
69
+ def self.openapi_types
70
+ {
71
+ :'kind' => :'V1DurableWaitConditionKind',
72
+ :'sleep_duration_ms' => :'Integer',
73
+ :'event_key' => :'String',
74
+ :'workflow_name' => :'String'
75
+ }
76
+ end
77
+
78
+ # List of attributes with nullable: true
79
+ def self.openapi_nullable
80
+ Set.new([
81
+ ])
82
+ end
83
+
84
+ # Initializes the object
85
+ # @param [Hash] attributes Model attributes in the form of hash
86
+ def initialize(attributes = {})
87
+ if (!attributes.is_a?(Hash))
88
+ fail ArgumentError, "The input argument (attributes) must be a hash in `HatchetSdkRest::V1DurableWaitCondition` initialize method"
89
+ end
90
+
91
+ # check to see if the attribute exists and convert string to symbol for hash key
92
+ acceptable_attribute_map = self.class.acceptable_attribute_map
93
+ attributes = attributes.each_with_object({}) { |(k, v), h|
94
+ if (!acceptable_attribute_map.key?(k.to_sym))
95
+ fail ArgumentError, "`#{k}` is not a valid attribute in `HatchetSdkRest::V1DurableWaitCondition`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
96
+ end
97
+ h[k.to_sym] = v
98
+ }
99
+
100
+ if attributes.key?(:'kind')
101
+ self.kind = attributes[:'kind']
102
+ else
103
+ self.kind = nil
104
+ end
105
+
106
+ if attributes.key?(:'sleep_duration_ms')
107
+ self.sleep_duration_ms = attributes[:'sleep_duration_ms']
108
+ end
109
+
110
+ if attributes.key?(:'event_key')
111
+ self.event_key = attributes[:'event_key']
112
+ end
113
+
114
+ if attributes.key?(:'workflow_name')
115
+ self.workflow_name = attributes[:'workflow_name']
116
+ end
117
+ end
118
+
119
+ # Show invalid properties with the reasons. Usually used together with valid?
120
+ # @return Array for valid properties with the reasons
121
+ def list_invalid_properties
122
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
123
+ invalid_properties = Array.new
124
+ if @kind.nil?
125
+ invalid_properties.push('invalid value for "kind", kind cannot be nil.')
126
+ end
127
+
128
+ invalid_properties
129
+ end
130
+
131
+ # Check to see if the all the properties in the model are valid
132
+ # @return true if the model is valid
133
+ def valid?
134
+ warn '[DEPRECATED] the `valid?` method is obsolete'
135
+ return false if @kind.nil?
136
+ true
137
+ end
138
+
139
+ # Custom attribute writer method with validation
140
+ # @param [Object] kind Value to be assigned
141
+ def kind=(kind)
142
+ if kind.nil?
143
+ fail ArgumentError, 'kind cannot be nil'
144
+ end
145
+
146
+ @kind = kind
147
+ end
148
+
149
+ # Checks equality by comparing each attribute.
150
+ # @param [Object] Object to be compared
151
+ def ==(o)
152
+ return true if self.equal?(o)
153
+ self.class == o.class &&
154
+ kind == o.kind &&
155
+ sleep_duration_ms == o.sleep_duration_ms &&
156
+ event_key == o.event_key &&
157
+ workflow_name == o.workflow_name
158
+ end
159
+
160
+ # @see the `==` method
161
+ # @param [Object] Object to be compared
162
+ def eql?(o)
163
+ self == o
164
+ end
165
+
166
+ # Calculates hash code according to all attributes.
167
+ # @return [Integer] Hash code
168
+ def hash
169
+ [kind, sleep_duration_ms, event_key, workflow_name].hash
170
+ end
171
+
172
+ # Builds the object from hash
173
+ # @param [Hash] attributes Model attributes in the form of hash
174
+ # @return [Object] Returns the model itself
175
+ def self.build_from_hash(attributes)
176
+ return nil unless attributes.is_a?(Hash)
177
+ attributes = attributes.transform_keys(&:to_sym)
178
+ transformed_hash = {}
179
+ openapi_types.each_pair do |key, type|
180
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
181
+ transformed_hash["#{key}"] = nil
182
+ elsif type =~ /\AArray<(.*)>/i
183
+ # check to ensure the input is an array given that the attribute
184
+ # is documented as an array but the input is not
185
+ if attributes[attribute_map[key]].is_a?(Array)
186
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
187
+ end
188
+ elsif !attributes[attribute_map[key]].nil?
189
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
190
+ end
191
+ end
192
+ new(transformed_hash)
193
+ end
194
+
195
+ # Deserializes the data based on type
196
+ # @param string type Data type
197
+ # @param string value Value to be deserialized
198
+ # @return [Object] Deserialized data
199
+ def self._deserialize(type, value)
200
+ case type.to_sym
201
+ when :Time
202
+ Time.parse(value)
203
+ when :Date
204
+ Date.parse(value)
205
+ when :String
206
+ value.to_s
207
+ when :Integer
208
+ value.to_i
209
+ when :Float
210
+ value.to_f
211
+ when :Boolean
212
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
213
+ true
214
+ else
215
+ false
216
+ end
217
+ when :Object
218
+ # generic object (usually a Hash), return directly
219
+ value
220
+ when /\AArray<(?<inner_type>.+)>\z/
221
+ inner_type = Regexp.last_match[:inner_type]
222
+ value.map { |v| _deserialize(inner_type, v) }
223
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
224
+ k_type = Regexp.last_match[:k_type]
225
+ v_type = Regexp.last_match[:v_type]
226
+ {}.tap do |hash|
227
+ value.each do |k, v|
228
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
229
+ end
230
+ end
231
+ else # model
232
+ # models (e.g. Pet) or oneOf
233
+ klass = HatchetSdkRest.const_get(type)
234
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
235
+ end
236
+ end
237
+
238
+ # Returns the string representation of the object
239
+ # @return [String] String presentation of the object
240
+ def to_s
241
+ to_hash.to_s
242
+ end
243
+
244
+ # to_body is an alias to to_hash (backward compatibility)
245
+ # @return [Hash] Returns the object in the form of hash
246
+ def to_body
247
+ to_hash
248
+ end
249
+
250
+ # Returns the object in the form of hash
251
+ # @return [Hash] Returns the object in the form of hash
252
+ def to_hash
253
+ hash = {}
254
+ self.class.attribute_map.each_pair do |attr, param|
255
+ value = self.send(attr)
256
+ if value.nil?
257
+ is_nullable = self.class.openapi_nullable.include?(attr)
258
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
259
+ end
260
+
261
+ hash[param] = _to_hash(value)
262
+ end
263
+ hash
264
+ end
265
+
266
+ # Outputs non-array value in the form of hash
267
+ # For object, use to_hash. Otherwise, just return the value
268
+ # @param [Object] value Any valid value
269
+ # @return [Hash] Returns the value in the form of hash
270
+ def _to_hash(value)
271
+ if value.is_a?(Array)
272
+ value.compact.map { |v| _to_hash(v) }
273
+ elsif value.is_a?(Hash)
274
+ {}.tap do |hash|
275
+ value.each { |k, v| hash[k] = _to_hash(v) }
276
+ end
277
+ elsif value.respond_to? :to_hash
278
+ value.to_hash
279
+ else
280
+ value
281
+ end
282
+ end
283
+
284
+ end
285
+
286
+ end
@@ -0,0 +1,41 @@
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 V1DurableWaitConditionKind
18
+ SLEEP = "SLEEP".freeze
19
+ USER_EVENT = "USER_EVENT".freeze
20
+ CHILD_WORKFLOW = "CHILD_WORKFLOW".freeze
21
+
22
+ def self.all_vars
23
+ @all_vars ||= [SLEEP, USER_EVENT, CHILD_WORKFLOW].freeze
24
+ end
25
+
26
+ # Builds the enum from string
27
+ # @param [String] The enum value in the form of the string
28
+ # @return [String] The enum value
29
+ def self.build_from_hash(value)
30
+ new.build_from_hash(value)
31
+ end
32
+
33
+ # Builds the enum from string
34
+ # @param [String] The enum value in the form of the string
35
+ # @return [String] The enum value
36
+ def build_from_hash(value)
37
+ return value if V1DurableWaitConditionKind.all_vars.include?(value)
38
+ raise "Invalid ENUM value #{value} for class #V1DurableWaitConditionKind"
39
+ end
40
+ end
41
+ end
@@ -24,6 +24,12 @@ module HatchetSdkRest
24
24
  # The log metadata.
25
25
  attr_accessor :metadata
26
26
 
27
+ # The external ID of the task associated with the log line.
28
+ attr_accessor :task_external_id
29
+
30
+ # The display name of the task associated with the log line.
31
+ attr_accessor :task_display_name
32
+
27
33
  # The retry count of the log line.
28
34
  attr_accessor :retry_count
29
35
 
@@ -61,6 +67,8 @@ module HatchetSdkRest
61
67
  :'created_at' => :'createdAt',
62
68
  :'message' => :'message',
63
69
  :'metadata' => :'metadata',
70
+ :'task_external_id' => :'taskExternalId',
71
+ :'task_display_name' => :'taskDisplayName',
64
72
  :'retry_count' => :'retryCount',
65
73
  :'attempt' => :'attempt',
66
74
  :'level' => :'level'
@@ -83,6 +91,8 @@ module HatchetSdkRest
83
91
  :'created_at' => :'Time',
84
92
  :'message' => :'String',
85
93
  :'metadata' => :'Object',
94
+ :'task_external_id' => :'String',
95
+ :'task_display_name' => :'String',
86
96
  :'retry_count' => :'Integer',
87
97
  :'attempt' => :'Integer',
88
98
  :'level' => :'V1LogLineLevel'
@@ -129,6 +139,14 @@ module HatchetSdkRest
129
139
  self.metadata = nil
130
140
  end
131
141
 
142
+ if attributes.key?(:'task_external_id')
143
+ self.task_external_id = attributes[:'task_external_id']
144
+ end
145
+
146
+ if attributes.key?(:'task_display_name')
147
+ self.task_display_name = attributes[:'task_display_name']
148
+ end
149
+
132
150
  if attributes.key?(:'retry_count')
133
151
  self.retry_count = attributes[:'retry_count']
134
152
  end
@@ -159,6 +177,14 @@ module HatchetSdkRest
159
177
  invalid_properties.push('invalid value for "metadata", metadata cannot be nil.')
160
178
  end
161
179
 
180
+ if !@task_external_id.nil? && @task_external_id.to_s.length > 36
181
+ invalid_properties.push('invalid value for "task_external_id", the character length must be smaller than or equal to 36.')
182
+ end
183
+
184
+ if !@task_external_id.nil? && @task_external_id.to_s.length < 36
185
+ invalid_properties.push('invalid value for "task_external_id", the character length must be greater than or equal to 36.')
186
+ end
187
+
162
188
  invalid_properties
163
189
  end
164
190
 
@@ -169,6 +195,8 @@ module HatchetSdkRest
169
195
  return false if @created_at.nil?
170
196
  return false if @message.nil?
171
197
  return false if @metadata.nil?
198
+ return false if !@task_external_id.nil? && @task_external_id.to_s.length > 36
199
+ return false if !@task_external_id.nil? && @task_external_id.to_s.length < 36
172
200
  true
173
201
  end
174
202
 
@@ -202,6 +230,24 @@ module HatchetSdkRest
202
230
  @metadata = metadata
203
231
  end
204
232
 
233
+ # Custom attribute writer method with validation
234
+ # @param [Object] task_external_id Value to be assigned
235
+ def task_external_id=(task_external_id)
236
+ if task_external_id.nil?
237
+ fail ArgumentError, 'task_external_id cannot be nil'
238
+ end
239
+
240
+ if task_external_id.to_s.length > 36
241
+ fail ArgumentError, 'invalid value for "task_external_id", the character length must be smaller than or equal to 36.'
242
+ end
243
+
244
+ if task_external_id.to_s.length < 36
245
+ fail ArgumentError, 'invalid value for "task_external_id", the character length must be greater than or equal to 36.'
246
+ end
247
+
248
+ @task_external_id = task_external_id
249
+ end
250
+
205
251
  # Checks equality by comparing each attribute.
206
252
  # @param [Object] Object to be compared
207
253
  def ==(o)
@@ -210,6 +256,8 @@ module HatchetSdkRest
210
256
  created_at == o.created_at &&
211
257
  message == o.message &&
212
258
  metadata == o.metadata &&
259
+ task_external_id == o.task_external_id &&
260
+ task_display_name == o.task_display_name &&
213
261
  retry_count == o.retry_count &&
214
262
  attempt == o.attempt &&
215
263
  level == o.level
@@ -224,7 +272,7 @@ module HatchetSdkRest
224
272
  # Calculates hash code according to all attributes.
225
273
  # @return [Integer] Hash code
226
274
  def hash
227
- [created_at, message, metadata, retry_count, attempt, level].hash
275
+ [created_at, message, metadata, task_external_id, task_display_name, retry_count, attempt, level].hash
228
276
  end
229
277
 
230
278
  # Builds the object from hash