hatchet-sdk 0.1.0.pre.alpha → 0.1.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 (377) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +145 -0
  3. data/CHANGELOG.md +24 -3
  4. data/CLAUDE.md +4 -5
  5. data/INTEGRATION_TESTING.md +2 -2
  6. data/README.md +1 -1
  7. data/REST_API_GENERATION.md +1 -1
  8. data/Rakefile +2 -2
  9. data/Rakefile.rest +15 -99
  10. data/config/openapi_generator_config.json +1 -1
  11. data/lib/hatchet/clients/grpc/admin.rb +264 -0
  12. data/lib/hatchet/clients/grpc/dispatcher.rb +253 -0
  13. data/lib/hatchet/clients/grpc/event_client.rb +181 -0
  14. data/lib/hatchet/clients/rest/.gitlab-ci.yml +0 -1
  15. data/lib/hatchet/clients/rest/.openapi-generator/FILES +40 -203
  16. data/lib/hatchet/clients/rest/README.md +61 -6
  17. data/lib/hatchet/clients/rest/hatchet-sdk-rest.gemspec +2 -2
  18. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/api_token_api.rb +2 -2
  19. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/cel_api.rb +104 -0
  20. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/default_api.rb +2 -2
  21. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/event_api.rb +170 -0
  22. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/healthcheck_api.rb +4 -0
  23. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/log_api.rb +21 -0
  24. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/sns_api.rb +2 -2
  25. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/task_api.rb +3 -0
  26. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/tenant_api.rb +171 -4
  27. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/user_api.rb +6 -6
  28. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/webhook_api.rb +504 -0
  29. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/workflow_api.rb +356 -0
  30. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/workflow_runs_api.rb +90 -0
  31. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api_client.rb +3 -1
  32. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/configuration.rb +8 -1
  33. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/{tenant_ui_version.rb → concurrency_scope.rb} +6 -6
  34. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/concurrency_setting.rb +351 -0
  35. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/concurrency_stat.rb +240 -0
  36. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/create_tenant_request.rb +26 -14
  37. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/registered_workflow.rb +265 -0
  38. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/scheduled_workflows_bulk_delete_filter.rb +334 -0
  39. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/scheduled_workflows_bulk_delete_request.rb +259 -0
  40. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/scheduled_workflows_bulk_delete_response.rb +267 -0
  41. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/scheduled_workflows_bulk_error.rb +274 -0
  42. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/scheduled_workflows_bulk_update_item.rb +281 -0
  43. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/scheduled_workflows_bulk_update_request.rb +257 -0
  44. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/scheduled_workflows_bulk_update_response.rb +267 -0
  45. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/step.rb +23 -1
  46. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/task_stat.rb +229 -0
  47. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/task_status_stat.rb +251 -0
  48. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant.rb +8 -8
  49. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_environment.rb +41 -0
  50. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_resource.rb +2 -2
  51. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/update_cron_workflow_trigger_request.rb +220 -0
  52. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/update_scheduled_workflow_run_request.rb +237 -0
  53. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/update_tenant_member_request.rb +260 -0
  54. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/update_tenant_request.rb +4 -14
  55. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_cel_debug_request.rb +285 -0
  56. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_cel_debug_response.rb +279 -0
  57. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_cel_debug_response_status.rb +40 -0
  58. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_create_webhook_request.rb +106 -0
  59. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_create_webhook_request_api_key.rb +396 -0
  60. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_create_webhook_request_base.rb +334 -0
  61. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_create_webhook_request_basic_auth.rb +396 -0
  62. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_create_webhook_request_hmac.rb +396 -0
  63. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_event.rb +14 -4
  64. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_filter.rb +14 -4
  65. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_log_line_order_by_direction.rb +40 -0
  66. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_task_event_type.rb +2 -1
  67. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_update_webhook_request.rb +258 -0
  68. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_webhook.rb +414 -0
  69. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_webhook_api_key_auth.rb +265 -0
  70. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_webhook_auth_type.rb +41 -0
  71. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_webhook_basic_auth.rb +265 -0
  72. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_webhook_hmac_algorithm.rb +42 -0
  73. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_webhook_hmac_auth.rb +341 -0
  74. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_webhook_hmac_encoding.rb +41 -0
  75. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_webhook_list.rb +231 -0
  76. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_webhook_source_name.rb +44 -0
  77. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/worker.rb +22 -18
  78. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/worker_runtime_sdks.rb +2 -1
  79. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/worker_slot_config.rb +249 -0
  80. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_version.rb +25 -4
  81. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest.rb +39 -1
  82. data/lib/hatchet/clients/rest.rb +23 -40
  83. data/lib/hatchet/clients.rb +4 -7
  84. data/lib/hatchet/concurrency.rb +76 -0
  85. data/lib/hatchet/condition_converter.rb +122 -0
  86. data/lib/hatchet/conditions.rb +110 -0
  87. data/lib/hatchet/config.rb +33 -113
  88. data/lib/hatchet/connection.rb +59 -0
  89. data/lib/hatchet/context.rb +203 -0
  90. data/lib/hatchet/context_vars.rb +119 -0
  91. data/lib/hatchet/contracts/dispatcher/dispatcher_pb.rb +47 -0
  92. data/lib/hatchet/contracts/dispatcher/dispatcher_services_pb.rb +35 -0
  93. data/lib/hatchet/contracts/events/events_pb.rb +23 -0
  94. data/lib/hatchet/contracts/events/events_services_pb.rb +24 -0
  95. data/lib/hatchet/contracts/v1/dispatcher_pb.rb +20 -0
  96. data/lib/hatchet/contracts/v1/dispatcher_services_pb.rb +23 -0
  97. data/lib/hatchet/contracts/v1/shared/condition_pb.rb +21 -0
  98. data/lib/hatchet/contracts/v1/workflows_pb.rb +39 -0
  99. data/lib/hatchet/contracts/v1/workflows_services_pb.rb +27 -0
  100. data/lib/hatchet/contracts/workflows/workflows_pb.rb +38 -0
  101. data/lib/hatchet/contracts/workflows/workflows_services_pb.rb +25 -0
  102. data/lib/hatchet/default_filter.rb +49 -0
  103. data/lib/hatchet/durable_context.rb +208 -0
  104. data/lib/hatchet/exceptions.rb +56 -0
  105. data/lib/hatchet/features/cel.rb +89 -0
  106. data/lib/hatchet/features/cron.rb +164 -0
  107. data/lib/hatchet/features/events.rb +35 -48
  108. data/lib/hatchet/features/filters.rb +117 -0
  109. data/lib/hatchet/features/logs.rb +51 -0
  110. data/lib/hatchet/features/metrics.rb +115 -0
  111. data/lib/hatchet/features/rate_limits.rb +40 -0
  112. data/lib/hatchet/features/runs.rb +259 -57
  113. data/lib/hatchet/features/scheduled.rb +216 -0
  114. data/lib/hatchet/features/tenant.rb +38 -0
  115. data/lib/hatchet/features/workers.rb +65 -0
  116. data/lib/hatchet/features/workflows.rb +87 -0
  117. data/lib/hatchet/labels.rb +61 -0
  118. data/lib/hatchet/rate_limit.rb +69 -0
  119. data/lib/hatchet/task.rb +411 -0
  120. data/lib/hatchet/trigger_options.rb +82 -0
  121. data/lib/hatchet/version.rb +1 -1
  122. data/lib/hatchet/worker/action_listener.rb +169 -0
  123. data/lib/hatchet/worker/health_check.rb +88 -0
  124. data/lib/hatchet/worker/runner.rb +255 -0
  125. data/lib/hatchet/worker/workflow_run_listener.rb +227 -0
  126. data/lib/hatchet/worker_obj.rb +252 -0
  127. data/lib/hatchet/workflow.rb +312 -0
  128. data/lib/hatchet/workflow_run.rb +129 -0
  129. data/lib/hatchet-sdk.rb +386 -35
  130. data/lib/rubocop/cop/hatchet/rbs_signature_exists.rb +54 -0
  131. data/sig/_dependencies.rbs +8 -0
  132. data/sig/hatchet/clients/grpc/admin.rbs +35 -0
  133. data/sig/hatchet/clients/grpc/dispatcher.rbs +35 -0
  134. data/sig/hatchet/clients/grpc/event_client.rbs +29 -0
  135. data/sig/hatchet/clients/rest.rbs +2 -0
  136. data/sig/hatchet/clients.rbs +7 -0
  137. data/sig/hatchet/concurrency.rbs +20 -0
  138. data/sig/hatchet/condition_converter.rbs +38 -0
  139. data/sig/hatchet/conditions.rbs +31 -0
  140. data/sig/hatchet/config.rbs +82 -0
  141. data/sig/hatchet/connection.rbs +8 -0
  142. data/sig/hatchet/context.rbs +40 -0
  143. data/sig/hatchet/context_vars.rbs +28 -0
  144. data/sig/hatchet/default_filter.rbs +11 -0
  145. data/sig/hatchet/durable_context.rbs +13 -0
  146. data/sig/hatchet/exceptions.rbs +26 -0
  147. data/sig/hatchet/features/cel.rbs +34 -0
  148. data/sig/hatchet/features/cron.rbs +33 -0
  149. data/sig/hatchet/features/events.rbs +60 -0
  150. data/sig/hatchet/features/filters.rbs +12 -0
  151. data/sig/hatchet/features/logs.rbs +8 -0
  152. data/sig/hatchet/features/metrics.rbs +34 -0
  153. data/sig/hatchet/features/rate_limits.rbs +8 -0
  154. data/sig/hatchet/features/runs.rbs +117 -0
  155. data/sig/hatchet/features/scheduled.rbs +41 -0
  156. data/sig/hatchet/features/tenant.rbs +8 -0
  157. data/sig/hatchet/features/workers.rbs +10 -0
  158. data/sig/hatchet/features/workflows.rbs +11 -0
  159. data/sig/hatchet/labels.rbs +25 -0
  160. data/sig/hatchet/rate_limit.rbs +22 -0
  161. data/sig/hatchet/task.rbs +50 -0
  162. data/sig/hatchet/trigger_options.rbs +28 -0
  163. data/sig/hatchet/version.rbs +3 -0
  164. data/sig/hatchet/worker/action_listener.rbs +21 -0
  165. data/sig/hatchet/worker/health_check.rbs +10 -0
  166. data/sig/hatchet/worker/runner.rbs +17 -0
  167. data/sig/hatchet/worker/workflow_run_listener.rbs +11 -0
  168. data/sig/hatchet/worker_obj.rbs +29 -0
  169. data/sig/hatchet/workflow.rbs +42 -0
  170. data/sig/hatchet/workflow_run.rbs +15 -0
  171. data/sig/hatchet-sdk.rbs +66 -505
  172. data/sig/hatchet_sdk_rest.rbs +225 -0
  173. metadata +191 -211
  174. data/lib/hatchet/clients/rest/docs/APIError.md +0 -24
  175. data/lib/hatchet/clients/rest/docs/APIErrors.md +0 -18
  176. data/lib/hatchet/clients/rest/docs/APIMeta.md +0 -30
  177. data/lib/hatchet/clients/rest/docs/APIMetaAuth.md +0 -18
  178. data/lib/hatchet/clients/rest/docs/APIMetaIntegration.md +0 -20
  179. data/lib/hatchet/clients/rest/docs/APIMetaPosthog.md +0 -20
  180. data/lib/hatchet/clients/rest/docs/APIResourceMeta.md +0 -22
  181. data/lib/hatchet/clients/rest/docs/APIToken.md +0 -22
  182. data/lib/hatchet/clients/rest/docs/APITokenApi.md +0 -235
  183. data/lib/hatchet/clients/rest/docs/AcceptInviteRequest.md +0 -18
  184. data/lib/hatchet/clients/rest/docs/BulkCreateEventRequest.md +0 -18
  185. data/lib/hatchet/clients/rest/docs/CancelEventRequest.md +0 -18
  186. data/lib/hatchet/clients/rest/docs/ConcurrencyLimitStrategy.md +0 -15
  187. data/lib/hatchet/clients/rest/docs/CreateAPITokenRequest.md +0 -20
  188. data/lib/hatchet/clients/rest/docs/CreateAPITokenResponse.md +0 -18
  189. data/lib/hatchet/clients/rest/docs/CreateCronWorkflowTriggerRequest.md +0 -26
  190. data/lib/hatchet/clients/rest/docs/CreateEventRequest.md +0 -26
  191. data/lib/hatchet/clients/rest/docs/CreatePullRequestFromStepRun.md +0 -18
  192. data/lib/hatchet/clients/rest/docs/CreateSNSIntegrationRequest.md +0 -18
  193. data/lib/hatchet/clients/rest/docs/CreateTenantAlertEmailGroupRequest.md +0 -18
  194. data/lib/hatchet/clients/rest/docs/CreateTenantInviteRequest.md +0 -20
  195. data/lib/hatchet/clients/rest/docs/CreateTenantRequest.md +0 -24
  196. data/lib/hatchet/clients/rest/docs/CronWorkflows.md +0 -40
  197. data/lib/hatchet/clients/rest/docs/CronWorkflowsList.md +0 -20
  198. data/lib/hatchet/clients/rest/docs/CronWorkflowsMethod.md +0 -15
  199. data/lib/hatchet/clients/rest/docs/CronWorkflowsOrderByField.md +0 -15
  200. data/lib/hatchet/clients/rest/docs/DefaultApi.md +0 -602
  201. data/lib/hatchet/clients/rest/docs/Event.md +0 -28
  202. data/lib/hatchet/clients/rest/docs/EventApi.md +0 -809
  203. data/lib/hatchet/clients/rest/docs/EventData.md +0 -18
  204. data/lib/hatchet/clients/rest/docs/EventKeyList.md +0 -20
  205. data/lib/hatchet/clients/rest/docs/EventList.md +0 -20
  206. data/lib/hatchet/clients/rest/docs/EventOrderByDirection.md +0 -15
  207. data/lib/hatchet/clients/rest/docs/EventOrderByField.md +0 -15
  208. data/lib/hatchet/clients/rest/docs/EventUpdateCancel200Response.md +0 -18
  209. data/lib/hatchet/clients/rest/docs/EventWorkflowRunSummary.md +0 -28
  210. data/lib/hatchet/clients/rest/docs/Events.md +0 -20
  211. data/lib/hatchet/clients/rest/docs/FilterApi.md +0 -402
  212. data/lib/hatchet/clients/rest/docs/GetStepRunDiffResponse.md +0 -18
  213. data/lib/hatchet/clients/rest/docs/GithubApi.md +0 -73
  214. data/lib/hatchet/clients/rest/docs/HealthcheckApi.md +0 -129
  215. data/lib/hatchet/clients/rest/docs/InfoGetVersion200Response.md +0 -18
  216. data/lib/hatchet/clients/rest/docs/Job.md +0 -30
  217. data/lib/hatchet/clients/rest/docs/JobRun.md +0 -48
  218. data/lib/hatchet/clients/rest/docs/JobRunStatus.md +0 -15
  219. data/lib/hatchet/clients/rest/docs/ListAPITokensResponse.md +0 -20
  220. data/lib/hatchet/clients/rest/docs/ListPullRequestsResponse.md +0 -18
  221. data/lib/hatchet/clients/rest/docs/ListSNSIntegrations.md +0 -20
  222. data/lib/hatchet/clients/rest/docs/ListSlackWebhooks.md +0 -20
  223. data/lib/hatchet/clients/rest/docs/LogApi.md +0 -171
  224. data/lib/hatchet/clients/rest/docs/LogLine.md +0 -22
  225. data/lib/hatchet/clients/rest/docs/LogLineLevel.md +0 -15
  226. data/lib/hatchet/clients/rest/docs/LogLineList.md +0 -20
  227. data/lib/hatchet/clients/rest/docs/LogLineOrderByDirection.md +0 -15
  228. data/lib/hatchet/clients/rest/docs/LogLineOrderByField.md +0 -15
  229. data/lib/hatchet/clients/rest/docs/MetadataApi.md +0 -203
  230. data/lib/hatchet/clients/rest/docs/PaginationResponse.md +0 -22
  231. data/lib/hatchet/clients/rest/docs/PullRequest.md +0 -32
  232. data/lib/hatchet/clients/rest/docs/PullRequestState.md +0 -15
  233. data/lib/hatchet/clients/rest/docs/QueueMetrics.md +0 -22
  234. data/lib/hatchet/clients/rest/docs/RateLimit.md +0 -28
  235. data/lib/hatchet/clients/rest/docs/RateLimitList.md +0 -20
  236. data/lib/hatchet/clients/rest/docs/RateLimitOrderByDirection.md +0 -15
  237. data/lib/hatchet/clients/rest/docs/RateLimitOrderByField.md +0 -15
  238. data/lib/hatchet/clients/rest/docs/RateLimitsApi.md +0 -94
  239. data/lib/hatchet/clients/rest/docs/RecentStepRuns.md +0 -30
  240. data/lib/hatchet/clients/rest/docs/RejectInviteRequest.md +0 -18
  241. data/lib/hatchet/clients/rest/docs/ReplayEventRequest.md +0 -18
  242. data/lib/hatchet/clients/rest/docs/ReplayWorkflowRunsRequest.md +0 -18
  243. data/lib/hatchet/clients/rest/docs/ReplayWorkflowRunsResponse.md +0 -18
  244. data/lib/hatchet/clients/rest/docs/RerunStepRunRequest.md +0 -18
  245. data/lib/hatchet/clients/rest/docs/SNSApi.md +0 -235
  246. data/lib/hatchet/clients/rest/docs/SNSIntegration.md +0 -24
  247. data/lib/hatchet/clients/rest/docs/ScheduleWorkflowRunRequest.md +0 -24
  248. data/lib/hatchet/clients/rest/docs/ScheduledRunStatus.md +0 -15
  249. data/lib/hatchet/clients/rest/docs/ScheduledWorkflows.md +0 -44
  250. data/lib/hatchet/clients/rest/docs/ScheduledWorkflowsList.md +0 -20
  251. data/lib/hatchet/clients/rest/docs/ScheduledWorkflowsMethod.md +0 -15
  252. data/lib/hatchet/clients/rest/docs/ScheduledWorkflowsOrderByField.md +0 -15
  253. data/lib/hatchet/clients/rest/docs/SemaphoreSlots.md +0 -28
  254. data/lib/hatchet/clients/rest/docs/SlackApi.md +0 -156
  255. data/lib/hatchet/clients/rest/docs/SlackWebhook.md +0 -28
  256. data/lib/hatchet/clients/rest/docs/Step.md +0 -32
  257. data/lib/hatchet/clients/rest/docs/StepRun.md +0 -68
  258. data/lib/hatchet/clients/rest/docs/StepRunApi.md +0 -560
  259. data/lib/hatchet/clients/rest/docs/StepRunArchive.md +0 -50
  260. data/lib/hatchet/clients/rest/docs/StepRunArchiveList.md +0 -20
  261. data/lib/hatchet/clients/rest/docs/StepRunDiff.md +0 -22
  262. data/lib/hatchet/clients/rest/docs/StepRunEvent.md +0 -36
  263. data/lib/hatchet/clients/rest/docs/StepRunEventList.md +0 -20
  264. data/lib/hatchet/clients/rest/docs/StepRunEventReason.md +0 -15
  265. data/lib/hatchet/clients/rest/docs/StepRunEventSeverity.md +0 -15
  266. data/lib/hatchet/clients/rest/docs/StepRunStatus.md +0 -15
  267. data/lib/hatchet/clients/rest/docs/TaskApi.md +0 -566
  268. data/lib/hatchet/clients/rest/docs/Tenant.md +0 -30
  269. data/lib/hatchet/clients/rest/docs/TenantAlertEmailGroup.md +0 -20
  270. data/lib/hatchet/clients/rest/docs/TenantAlertEmailGroupList.md +0 -20
  271. data/lib/hatchet/clients/rest/docs/TenantAlertingSettings.md +0 -30
  272. data/lib/hatchet/clients/rest/docs/TenantApi.md +0 -1362
  273. data/lib/hatchet/clients/rest/docs/TenantInvite.md +0 -28
  274. data/lib/hatchet/clients/rest/docs/TenantInviteList.md +0 -20
  275. data/lib/hatchet/clients/rest/docs/TenantList.md +0 -20
  276. data/lib/hatchet/clients/rest/docs/TenantMember.md +0 -24
  277. data/lib/hatchet/clients/rest/docs/TenantMemberList.md +0 -20
  278. data/lib/hatchet/clients/rest/docs/TenantMemberRole.md +0 -15
  279. data/lib/hatchet/clients/rest/docs/TenantQueueMetrics.md +0 -22
  280. data/lib/hatchet/clients/rest/docs/TenantResource.md +0 -15
  281. data/lib/hatchet/clients/rest/docs/TenantResourceLimit.md +0 -30
  282. data/lib/hatchet/clients/rest/docs/TenantResourcePolicy.md +0 -18
  283. data/lib/hatchet/clients/rest/docs/TenantStepRunQueueMetrics.md +0 -18
  284. data/lib/hatchet/clients/rest/docs/TenantUIVersion.md +0 -15
  285. data/lib/hatchet/clients/rest/docs/TenantVersion.md +0 -15
  286. data/lib/hatchet/clients/rest/docs/TriggerWorkflowRunRequest.md +0 -20
  287. data/lib/hatchet/clients/rest/docs/UpdateTenantAlertEmailGroupRequest.md +0 -18
  288. data/lib/hatchet/clients/rest/docs/UpdateTenantInviteRequest.md +0 -18
  289. data/lib/hatchet/clients/rest/docs/UpdateTenantRequest.md +0 -34
  290. data/lib/hatchet/clients/rest/docs/UpdateWorkerRequest.md +0 -18
  291. data/lib/hatchet/clients/rest/docs/User.md +0 -28
  292. data/lib/hatchet/clients/rest/docs/UserApi.md +0 -805
  293. data/lib/hatchet/clients/rest/docs/UserChangePasswordRequest.md +0 -20
  294. data/lib/hatchet/clients/rest/docs/UserLoginRequest.md +0 -20
  295. data/lib/hatchet/clients/rest/docs/UserRegisterRequest.md +0 -22
  296. data/lib/hatchet/clients/rest/docs/UserTenantMembershipsList.md +0 -20
  297. data/lib/hatchet/clients/rest/docs/UserTenantPublic.md +0 -20
  298. data/lib/hatchet/clients/rest/docs/V1CancelTaskRequest.md +0 -20
  299. data/lib/hatchet/clients/rest/docs/V1CancelledTasks.md +0 -18
  300. data/lib/hatchet/clients/rest/docs/V1CreateFilterRequest.md +0 -24
  301. data/lib/hatchet/clients/rest/docs/V1DagChildren.md +0 -20
  302. data/lib/hatchet/clients/rest/docs/V1Event.md +0 -36
  303. data/lib/hatchet/clients/rest/docs/V1EventList.md +0 -20
  304. data/lib/hatchet/clients/rest/docs/V1EventTriggeredRun.md +0 -20
  305. data/lib/hatchet/clients/rest/docs/V1EventWorkflowRunSummary.md +0 -26
  306. data/lib/hatchet/clients/rest/docs/V1Filter.md +0 -28
  307. data/lib/hatchet/clients/rest/docs/V1FilterList.md +0 -20
  308. data/lib/hatchet/clients/rest/docs/V1LogLine.md +0 -28
  309. data/lib/hatchet/clients/rest/docs/V1LogLineLevel.md +0 -15
  310. data/lib/hatchet/clients/rest/docs/V1LogLineList.md +0 -20
  311. data/lib/hatchet/clients/rest/docs/V1ReplayTaskRequest.md +0 -20
  312. data/lib/hatchet/clients/rest/docs/V1ReplayedTasks.md +0 -18
  313. data/lib/hatchet/clients/rest/docs/V1TaskEvent.md +0 -38
  314. data/lib/hatchet/clients/rest/docs/V1TaskEventList.md +0 -20
  315. data/lib/hatchet/clients/rest/docs/V1TaskEventType.md +0 -15
  316. data/lib/hatchet/clients/rest/docs/V1TaskFilter.md +0 -26
  317. data/lib/hatchet/clients/rest/docs/V1TaskPointMetric.md +0 -22
  318. data/lib/hatchet/clients/rest/docs/V1TaskPointMetrics.md +0 -18
  319. data/lib/hatchet/clients/rest/docs/V1TaskRunMetric.md +0 -20
  320. data/lib/hatchet/clients/rest/docs/V1TaskRunStatus.md +0 -15
  321. data/lib/hatchet/clients/rest/docs/V1TaskStatus.md +0 -15
  322. data/lib/hatchet/clients/rest/docs/V1TaskSummary.md +0 -72
  323. data/lib/hatchet/clients/rest/docs/V1TaskSummaryList.md +0 -20
  324. data/lib/hatchet/clients/rest/docs/V1TaskTiming.md +0 -46
  325. data/lib/hatchet/clients/rest/docs/V1TaskTimingList.md +0 -20
  326. data/lib/hatchet/clients/rest/docs/V1TriggerWorkflowRunRequest.md +0 -24
  327. data/lib/hatchet/clients/rest/docs/V1UpdateFilterRequest.md +0 -22
  328. data/lib/hatchet/clients/rest/docs/V1WorkflowRun.md +0 -46
  329. data/lib/hatchet/clients/rest/docs/V1WorkflowRunDetails.md +0 -26
  330. data/lib/hatchet/clients/rest/docs/V1WorkflowRunDisplayName.md +0 -20
  331. data/lib/hatchet/clients/rest/docs/V1WorkflowRunDisplayNameList.md +0 -20
  332. data/lib/hatchet/clients/rest/docs/V1WorkflowType.md +0 -15
  333. data/lib/hatchet/clients/rest/docs/WebhookWorker.md +0 -22
  334. data/lib/hatchet/clients/rest/docs/WebhookWorkerCreateRequest.md +0 -22
  335. data/lib/hatchet/clients/rest/docs/WebhookWorkerCreateResponse.md +0 -18
  336. data/lib/hatchet/clients/rest/docs/WebhookWorkerCreated.md +0 -24
  337. data/lib/hatchet/clients/rest/docs/WebhookWorkerListResponse.md +0 -20
  338. data/lib/hatchet/clients/rest/docs/WebhookWorkerRequest.md +0 -22
  339. data/lib/hatchet/clients/rest/docs/WebhookWorkerRequestListResponse.md +0 -18
  340. data/lib/hatchet/clients/rest/docs/WebhookWorkerRequestMethod.md +0 -15
  341. data/lib/hatchet/clients/rest/docs/Worker.md +0 -48
  342. data/lib/hatchet/clients/rest/docs/WorkerApi.md +0 -234
  343. data/lib/hatchet/clients/rest/docs/WorkerLabel.md +0 -22
  344. data/lib/hatchet/clients/rest/docs/WorkerList.md +0 -20
  345. data/lib/hatchet/clients/rest/docs/WorkerRuntimeInfo.md +0 -26
  346. data/lib/hatchet/clients/rest/docs/WorkerRuntimeSDKs.md +0 -15
  347. data/lib/hatchet/clients/rest/docs/WorkerType.md +0 -15
  348. data/lib/hatchet/clients/rest/docs/Workflow.md +0 -32
  349. data/lib/hatchet/clients/rest/docs/WorkflowApi.md +0 -1480
  350. data/lib/hatchet/clients/rest/docs/WorkflowConcurrency.md +0 -22
  351. data/lib/hatchet/clients/rest/docs/WorkflowKind.md +0 -15
  352. data/lib/hatchet/clients/rest/docs/WorkflowList.md +0 -22
  353. data/lib/hatchet/clients/rest/docs/WorkflowMetrics.md +0 -20
  354. data/lib/hatchet/clients/rest/docs/WorkflowRun.md +0 -48
  355. data/lib/hatchet/clients/rest/docs/WorkflowRunApi.md +0 -477
  356. data/lib/hatchet/clients/rest/docs/WorkflowRunList.md +0 -20
  357. data/lib/hatchet/clients/rest/docs/WorkflowRunOrderByDirection.md +0 -15
  358. data/lib/hatchet/clients/rest/docs/WorkflowRunOrderByField.md +0 -15
  359. data/lib/hatchet/clients/rest/docs/WorkflowRunShape.md +0 -50
  360. data/lib/hatchet/clients/rest/docs/WorkflowRunShapeItemForWorkflowRunDetails.md +0 -24
  361. data/lib/hatchet/clients/rest/docs/WorkflowRunStatus.md +0 -15
  362. data/lib/hatchet/clients/rest/docs/WorkflowRunTriggeredBy.md +0 -26
  363. data/lib/hatchet/clients/rest/docs/WorkflowRunsApi.md +0 -572
  364. data/lib/hatchet/clients/rest/docs/WorkflowRunsCancelRequest.md +0 -18
  365. data/lib/hatchet/clients/rest/docs/WorkflowRunsMetrics.md +0 -18
  366. data/lib/hatchet/clients/rest/docs/WorkflowRunsMetricsCounts.md +0 -28
  367. data/lib/hatchet/clients/rest/docs/WorkflowTag.md +0 -20
  368. data/lib/hatchet/clients/rest/docs/WorkflowTriggerCronRef.md +0 -20
  369. data/lib/hatchet/clients/rest/docs/WorkflowTriggerEventRef.md +0 -20
  370. data/lib/hatchet/clients/rest/docs/WorkflowTriggers.md +0 -26
  371. data/lib/hatchet/clients/rest/docs/WorkflowUpdateRequest.md +0 -18
  372. data/lib/hatchet/clients/rest/docs/WorkflowVersion.md +0 -40
  373. data/lib/hatchet/clients/rest/docs/WorkflowVersionDefinition.md +0 -18
  374. data/lib/hatchet/clients/rest/docs/WorkflowVersionMeta.md +0 -26
  375. data/lib/hatchet/clients/rest/docs/WorkflowWorkersCount.md +0 -22
  376. data/scripts/generate.sh +0 -167
  377. data/scripts/generate_api.rb +0 -174
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39266ae76d015db9cfae9ab50c45b45772a71a6e83196a8f50d696427df1188f
4
- data.tar.gz: '0989914579fb062642a4ffb31242632a0bfc5fd4bc510fbfac1c8b91a256de74'
3
+ metadata.gz: '00528f759273d232b37cc2427e1afb1c70fdb95eeaf9ef8251353bfe3a0af224'
4
+ data.tar.gz: fa24d7738b08f554d9e8b7f0579a81fb866d968590f18549415bea5b9472ab1d
5
5
  SHA512:
6
- metadata.gz: 610bc9c45ce11f4615d9858e66348c4fcae1f0af0f85be8763d6e5b43d6eba26b2ad3af7b521b6b058357b39cd4e386c9c13f3046043f0d056dcf86d52232387
7
- data.tar.gz: 53f3136c6ff7f902df3e71b8626391ef02294c21d0333f24c6de2ae924e2d12a04754340b2b9b8f9b3d3046bc5fe438e917b8799b79e849259023d3b0cf2d14e
6
+ metadata.gz: 3501969e6906c6a9cd84c4120d6cd2eb3f63c3204df8d673ac04754ae2152bd25a806cf23f2d84e9f219aa8f9a9bf9c09b4050b9b6959163c1a00618370128be
7
+ data.tar.gz: f81aed6b15226d78bdff0b1176263514153da55e13c81778c18a598f6a6e4181ef7b4cca01fb2f63c08b462520d95465d9e3b83d53a3e58b2b00d98db8d44664
data/.rubocop.yml CHANGED
@@ -1,8 +1,153 @@
1
+ # frozen_string_literal: true
2
+
3
+ require:
4
+ - ./lib/rubocop/cop/hatchet/rbs_signature_exists
5
+
1
6
  AllCops:
2
7
  TargetRubyVersion: 3.1
8
+ NewCops: enable
9
+ SuggestExtensions: false
10
+ Exclude:
11
+ - "lib/hatchet/clients/rest/**/*"
12
+ - "lib/hatchet/contracts/**/*"
13
+ - "vendor/**/*"
14
+ - "bin/**/*"
15
+ - "scripts/**/*"
16
+
17
+ # ─── Style ───────────────────────────────────────────────────────────
3
18
 
4
19
  Style/StringLiterals:
5
20
  EnforcedStyle: double_quotes
6
21
 
7
22
  Style/StringLiteralsInInterpolation:
8
23
  EnforcedStyle: double_quotes
24
+
25
+ Style/FrozenStringLiteralComment:
26
+ EnforcedStyle: always
27
+
28
+ Style/Documentation:
29
+ Enabled: false
30
+
31
+ Style/TrailingCommaInArguments:
32
+ EnforcedStyleForMultiline: consistent_comma
33
+
34
+ Style/TrailingCommaInArrayLiteral:
35
+ EnforcedStyleForMultiline: consistent_comma
36
+
37
+ Style/TrailingCommaInHashLiteral:
38
+ EnforcedStyleForMultiline: consistent_comma
39
+
40
+ # ─── Metrics ─────────────────────────────────────────────────────────
41
+
42
+ Metrics/MethodLength:
43
+ Max: 55
44
+ CountAsOne:
45
+ - array
46
+ - hash
47
+ - heredoc
48
+ - method_call
49
+
50
+ Metrics/ClassLength:
51
+ Max: 300
52
+ CountAsOne:
53
+ - array
54
+ - hash
55
+ - heredoc
56
+ - method_call
57
+
58
+ Metrics/ModuleLength:
59
+ Max: 300
60
+ CountAsOne:
61
+ - array
62
+ - hash
63
+ - heredoc
64
+ - method_call
65
+
66
+ Metrics/BlockLength:
67
+ Max: 35
68
+ Exclude:
69
+ - "spec/**/*"
70
+ - "Rakefile"
71
+ - "*.gemspec"
72
+
73
+ Metrics/AbcSize:
74
+ Max: 65
75
+
76
+ Metrics/CyclomaticComplexity:
77
+ Max: 35
78
+
79
+ Metrics/PerceivedComplexity:
80
+ Max: 35
81
+
82
+ Metrics/ParameterLists:
83
+ Max: 10
84
+ CountKeywordArgs: false
85
+
86
+ # ─── Layout ──────────────────────────────────────────────────────────
87
+
88
+ Layout/LineLength:
89
+ Max: 140
90
+ AllowedPatterns:
91
+ - "^\\s*#"
92
+ Exclude:
93
+ - "*.gemspec"
94
+
95
+ Layout/MultilineMethodCallIndentation:
96
+ EnforcedStyle: indented
97
+
98
+ Layout/FirstHashElementIndentation:
99
+ EnforcedStyle: consistent
100
+
101
+ Layout/FirstArrayElementIndentation:
102
+ EnforcedStyle: consistent
103
+
104
+ # ─── Naming ──────────────────────────────────────────────────────────
105
+
106
+ Naming/FileName:
107
+ Exclude:
108
+ - "lib/hatchet-sdk.rb"
109
+
110
+ Naming/MethodParameterName:
111
+ AllowedNames:
112
+ - id
113
+ - ip
114
+ - to
115
+ - by
116
+ - on
117
+ - in
118
+ - at
119
+ - fn
120
+
121
+ Naming/PredicatePrefix:
122
+ Enabled: false
123
+
124
+ Naming/AccessorMethodName:
125
+ Enabled: false
126
+
127
+ Naming/VariableNumber:
128
+ Enabled: false
129
+
130
+ # ─── Gemspec ─────────────────────────────────────────────────────────
131
+
132
+ Gemspec/DevelopmentDependencies:
133
+ Enabled: false
134
+
135
+ # ─── Lint ────────────────────────────────────────────────────────────
136
+
137
+ Lint/UnusedMethodArgument:
138
+ AllowUnusedKeywordArguments: true
139
+
140
+ Lint/MissingSuper:
141
+ Enabled: false
142
+
143
+ Lint/DuplicateBranch:
144
+ Enabled: false
145
+
146
+ # ─── Custom ─────────────────────────────────────────────────────────
147
+
148
+ Hatchet/RbsSignatureExists:
149
+ Enabled: true
150
+ Exclude:
151
+ - "lib/hatchet/clients/rest/**/*"
152
+ - "lib/hatchet/contracts/**/*"
153
+ - "lib/rubocop/**/*"
data/CHANGELOG.md CHANGED
@@ -1,6 +1,27 @@
1
1
  ## Hatchet SDK Changelog
2
2
 
3
- ## [0.1.0] - 2025-08-05
3
+ ## [0.1.0] - 2025-02-15
4
4
 
5
- - Initial release
6
- - Events and Runs Rest Clients
5
+ - Initial release of the Ruby SDK for Hatchet
6
+ - Task orchestration with simple tasks, DAGs, and child/fanout workflows
7
+ - Durable execution with durable tasks, durable events, and durable sleep
8
+ - Concurrency control (limit, round-robin, cancel in progress, cancel newest, multiple keys, workflow-level)
9
+ - Rate limiting
10
+ - Event-driven workflows
11
+ - Cron and scheduled workflows
12
+ - Retries with configurable backoff strategies
13
+ - Timeout management with refresh support
14
+ - On-failure and on-success callbacks
15
+ - Streaming support
16
+ - Webhook integration
17
+ - Bulk operations (fanout, replay)
18
+ - Priority scheduling
19
+ - Sticky and affinity worker assignment
20
+ - Deduplication
21
+ - Manual slot release
22
+ - Dependency injection
23
+ - Unit testing helpers
24
+ - Logging integration
25
+ - Run detail inspection
26
+ - RBS type signatures for IDE support
27
+ - REST and gRPC client support
data/CLAUDE.md CHANGED
@@ -33,7 +33,7 @@ The SDK includes comprehensive documentation and type signatures for excellent I
33
33
 
34
34
  **REST API Generation:**
35
35
  - `rake api:generate` - Generate REST API client from OpenAPI specification
36
- - `rake api:clean` - Remove generated REST API client files
36
+ - `rake api:clean` - Remove generated REST API client files
37
37
  - `rake api:regenerate` - Clean and regenerate REST API client
38
38
  - `rake api:validate` - Validate OpenAPI specification
39
39
  - `rake api:info` - Show OpenAPI specification information
@@ -57,8 +57,7 @@ The SDK includes comprehensive documentation and type signatures for excellent I
57
57
  - `Hatchet::Clients` - Factory for creating REST and other protocol clients
58
58
  - `Hatchet::Clients::Rest::*` - Generated REST API clients (WorkflowApi, EventApi, etc.)
59
59
  - `Hatchet::TLSConfig` - TLS configuration for secure connections
60
- - `Hatchet::HealthcheckConfig` - Worker health monitoring configuration
61
- - `Hatchet::OpenTelemetryConfig` - Observability configuration
60
+ - `Hatchet::HealthcheckConfig` - Worker health monitoring configuration
62
61
  - `Hatchet::Error` - Base error class for gem-specific exceptions
63
62
 
64
63
  **Configuration Sources (priority order):**
@@ -79,7 +78,7 @@ The codebase uses frozen string literals and follows Ruby 3.1+ requirements.
79
78
 
80
79
  **When adding new configuration options:**
81
80
  1. Add the parameter to `Config#initialize` method
82
- 2. Update the `@option` YARD documentation in both `Client` and `Config` classes
81
+ 2. Update the `@option` YARD documentation in both `Client` and `Config` classes
83
82
  3. Add the parameter to RBS type signatures in `sig/hatchet-sdk.rbs`
84
83
  4. Add comprehensive test coverage in `spec/hatchet/config_spec.rb`
85
84
  5. Update this CLAUDE.md file with any architectural changes
@@ -96,4 +95,4 @@ The codebase uses frozen string literals and follows Ruby 3.1+ requirements.
96
95
  - The config extracts tenant_id from the 'sub' field in JWT tokens
97
96
  - Test both explicit tenant_id override and JWT extraction scenarios
98
97
 
99
- Keep the CLAUDE.md instructions up to date as the project continues to develop.
98
+ Keep the CLAUDE.md instructions up to date as the project continues to develop.
@@ -63,7 +63,7 @@ The integration tests for the Runs feature test:
63
63
 
64
64
  #### ✅ Workflow Run Operations
65
65
  - Get workflow run details
66
- - Get workflow run status
66
+ - Get workflow run status
67
67
  - Get workflow run results
68
68
  - Data structure validation
69
69
 
@@ -173,4 +173,4 @@ bundle exec rspec --tag ~integration
173
173
 
174
174
  # Run integration tests with credentials (slower, requires setup)
175
175
  HATCHET_CLIENT_TOKEN=$SECRET_TOKEN bundle exec rspec --tag integration
176
- ```
176
+ ```
data/README.md CHANGED
@@ -71,4 +71,4 @@ We welcome contributions! Please check out our [contributing guidelines](https:/
71
71
 
72
72
  ## License
73
73
 
74
- This SDK is released under the MIT License. See [LICENSE](https://github.com/hatchet-dev/hatchet/blob/main/LICENSE) for details.
74
+ This SDK is released under the MIT License. See [LICENSE](https://github.com/hatchet-dev/hatchet/blob/main/LICENSE) for details.
@@ -254,4 +254,4 @@ The REST API generation setup requires minimal maintenance:
254
254
  2. **Dependency Updates** - Keep OpenAPI Generator CLI updated
255
255
  3. **Custom Patches** - Update patches when generation patterns change
256
256
 
257
- The generation process is designed to be idempotent and safe to run multiple times.
257
+ The generation process is designed to be idempotent and safe to run multiple times.
data/Rakefile CHANGED
@@ -13,9 +13,9 @@ RuboCop::RakeTask.new
13
13
  load File.expand_path("Rakefile.rest", __dir__)
14
14
 
15
15
  # Generate REST API client before building the gem
16
- task :build => "api:generate"
16
+ task build: "api:generate"
17
17
 
18
18
  # Generate REST API client before running tests (for CI)
19
- task :spec => "api:generate_if_missing"
19
+ task spec: "api:generate_if_missing"
20
20
 
21
21
  task default: %i[spec rubocop]
data/Rakefile.rest CHANGED
@@ -1,44 +1,33 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Additional Rake tasks for REST API client generation
4
+ #
5
+ # All generation goes through sdks/ruby/generate.sh, which is the single
6
+ # entry point for both protobuf and REST generation.
4
7
 
5
8
  require "rake"
6
9
 
7
10
  namespace :api do
11
+ # Path to the unified generate script
12
+ GENERATE_SH = File.expand_path("../../generate.sh", __dir__)
13
+
8
14
  desc "Generate REST API client from OpenAPI specification"
9
15
  task :generate do
10
- puts "Generating REST API client from OpenAPI specification..."
11
-
12
- ruby_script = File.join(__dir__, "scripts", "generate_api.rb")
13
-
14
- unless File.exist?(ruby_script)
15
- puts "❌ Generator script not found at #{ruby_script}"
16
- exit 1
17
- end
18
-
19
- # Make the script executable
20
- File.chmod(0755, ruby_script)
21
-
22
- # Execute the generation script
23
- system("ruby #{ruby_script}") || begin
24
- puts "❌ API generation failed"
25
- exit 1
26
- end
27
-
28
- puts "✅ REST API client generation completed"
16
+ puts "Generating REST API client..."
17
+ system("bash", GENERATE_SH, "rest") || abort("REST API generation failed")
29
18
  end
30
19
 
31
20
  desc "Clean generated REST API client files"
32
21
  task :clean do
33
22
  rest_client_dir = File.join(__dir__, "lib", "hatchet", "clients", "rest")
34
-
23
+
35
24
  if Dir.exist?(rest_client_dir)
36
- puts "🧹 Cleaning generated REST API client files..."
25
+ puts "Cleaning generated REST API client files..."
37
26
  require "fileutils"
38
27
  FileUtils.rm_rf(rest_client_dir)
39
- puts "REST API client files cleaned"
28
+ puts "REST API client files cleaned"
40
29
  else
41
- puts "ℹ️ No REST API client files to clean"
30
+ puts "No REST API client files to clean"
42
31
  end
43
32
  end
44
33
 
@@ -49,85 +38,12 @@ namespace :api do
49
38
  task :generate_if_missing do
50
39
  rest_client_dir = File.join(__dir__, "lib", "hatchet", "clients", "rest")
51
40
  main_client_file = File.join(rest_client_dir, "lib", "hatchet-sdk-rest.rb")
52
-
41
+
53
42
  unless File.exist?(main_client_file)
54
- puts "🔄 REST API client not found, generating..."
43
+ puts "REST API client not found, generating..."
55
44
  Rake::Task["api:generate"].invoke
56
45
  else
57
- puts "REST API client already exists, skipping generation"
58
- end
59
- end
60
-
61
- desc "Validate OpenAPI specification"
62
- task :validate do
63
- openapi_spec = File.join(__dir__, "..", "..", "..", "bin", "oas", "openapi.yaml")
64
-
65
- unless File.exist?(openapi_spec)
66
- puts "❌ OpenAPI specification not found at #{openapi_spec}"
67
- exit 1
68
- end
69
-
70
- puts "🔍 Validating OpenAPI specification..."
71
-
72
- # Use openapi-generator-cli to validate the spec
73
- cmd = ["openapi-generator-cli", "validate", "-i", openapi_spec]
74
-
75
- if system(*cmd)
76
- puts "✅ OpenAPI specification is valid"
77
- else
78
- puts "❌ OpenAPI specification validation failed"
79
- exit 1
80
- end
81
- end
82
-
83
- desc "Install OpenAPI Generator CLI if not present"
84
- task :install_generator do
85
- puts "🔧 Checking OpenAPI Generator CLI installation..."
86
-
87
- if system("which openapi-generator-cli > /dev/null 2>&1")
88
- puts "✅ OpenAPI Generator CLI is already installed"
89
- else
90
- puts "📦 Installing OpenAPI Generator CLI..."
91
-
92
- if system("npm install -g @openapitools/openapi-generator-cli@7.13.0")
93
- puts "✅ OpenAPI Generator CLI installed successfully"
94
- else
95
- puts "❌ Failed to install OpenAPI Generator CLI"
96
- puts "Please install it manually: npm install -g @openapitools/openapi-generator-cli"
97
- exit 1
98
- end
99
- end
100
- end
101
-
102
- desc "Show information about the OpenAPI specification"
103
- task :info do
104
- openapi_spec = File.join(__dir__, "..", "..", "..", "bin", "oas", "openapi.yaml")
105
-
106
- unless File.exist?(openapi_spec)
107
- puts "❌ OpenAPI specification not found at #{openapi_spec}"
108
- exit 1
109
- end
110
-
111
- puts "📊 OpenAPI Specification Information:"
112
- puts " File: #{openapi_spec}"
113
- puts " Size: #{File.size(openapi_spec)} bytes"
114
- puts " Modified: #{File.mtime(openapi_spec)}"
115
-
116
- # Try to parse and show basic info
117
- begin
118
- require "yaml"
119
- spec = YAML.load_file(openapi_spec)
120
-
121
- puts " OpenAPI Version: #{spec.dig('openapi')}"
122
- puts " API Version: #{spec.dig('info', 'version')}"
123
- puts " API Title: #{spec.dig('info', 'title')}"
124
- puts " Paths: #{spec.dig('paths')&.keys&.count || 0}"
125
- puts " Components: #{spec.dig('components', 'schemas')&.keys&.count || 0} schemas"
126
- rescue => e
127
- puts " ⚠️ Could not parse specification: #{e.message}"
46
+ puts "REST API client already exists, skipping generation"
128
47
  end
129
48
  end
130
49
  end
131
-
132
- # Add REST API tasks to the default rake task
133
- task default: ["api:validate"]
@@ -28,4 +28,4 @@
28
28
  "useActiveModel": false,
29
29
  "hideGenerationTimestamp": true,
30
30
  "withDefaultValues": true
31
- }
31
+ }
@@ -0,0 +1,264 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+ require "google/protobuf/timestamp_pb"
5
+
6
+ module Hatchet
7
+ module Clients
8
+ module Grpc
9
+ # gRPC client for the Hatchet Admin service (workflow registration & triggering).
10
+ #
11
+ # Uses two stubs on the shared channel:
12
+ # - V1::AdminService::Stub (v1) for: PutWorkflow, GetRunDetails, CancelTasks, ReplayTasks
13
+ # - WorkflowService::Stub (v0) for: TriggerWorkflow, BulkTriggerWorkflow, ScheduleWorkflow, PutRateLimit
14
+ #
15
+ # The v0 WorkflowService is retained for triggering because it supports
16
+ # parent-child linking fields that the v1 TriggerWorkflowRun does not expose.
17
+ #
18
+ # @example
19
+ # admin = Admin.new(config: hatchet_config, channel: channel)
20
+ # admin.put_workflow(workflow.to_proto(config))
21
+ # ref = admin.trigger_workflow("MyWorkflow", input: { "key" => "value" })
22
+ class Admin
23
+ BULK_TRIGGER_BATCH_SIZE = 1000
24
+
25
+ # @param config [Hatchet::Config] The Hatchet configuration
26
+ # @param channel [GRPC::Core::Channel] Shared gRPC channel
27
+ def initialize(config:, channel:)
28
+ @config = config
29
+ @logger = config.logger
30
+ @channel = channel
31
+ @v0_stub = nil
32
+ @v1_stub = nil
33
+ end
34
+
35
+ # Register a workflow definition with the server via v1 AdminService.
36
+ #
37
+ # @param workflow_proto [V1::CreateWorkflowVersionRequest] The workflow proto
38
+ # @return [V1::CreateWorkflowVersionResponse] Registration response
39
+ def put_workflow(workflow_proto)
40
+ ensure_connected!
41
+
42
+ response = @v1_stub.put_workflow(workflow_proto, metadata: @config.auth_metadata)
43
+ @logger.debug("Registered workflow: #{workflow_proto.name}")
44
+ response
45
+ end
46
+
47
+ # Trigger a workflow run via v0 WorkflowService.
48
+ #
49
+ # @param workflow_name [String] The workflow name (will be namespaced)
50
+ # @param input [Hash] Workflow input
51
+ # @param options [Hash] Trigger options
52
+ # @option options [String] :parent_id Parent workflow run ID
53
+ # @option options [String] :parent_task_run_external_id Parent step run ID
54
+ # @option options [Integer] :child_index Child workflow index
55
+ # @option options [String] :child_key Child workflow key
56
+ # @option options [Hash] :additional_metadata Additional metadata
57
+ # @option options [String] :desired_worker_id Desired worker for sticky dispatch
58
+ # @option options [Integer] :priority Priority value
59
+ # @return [String] The workflow run ID
60
+ # @raise [DedupeViolationError] If a deduplication violation occurs
61
+ def trigger_workflow(workflow_name, input: {}, options: {})
62
+ ensure_connected!
63
+
64
+ name = @config.apply_namespace(workflow_name)
65
+
66
+ request_args = {
67
+ name: name,
68
+ input: JSON.generate(input),
69
+ }
70
+
71
+ request_args[:parent_id] = options[:parent_id] if options[:parent_id]
72
+ request_args[:parent_task_run_external_id] = options[:parent_task_run_external_id] if options[:parent_task_run_external_id]
73
+ request_args[:child_index] = options[:child_index] if options[:child_index]
74
+ request_args[:child_key] = options[:child_key] if options[:child_key]
75
+ request_args[:desired_worker_id] = options[:desired_worker_id] if options[:desired_worker_id]
76
+ request_args[:priority] = options[:priority] if options[:priority]
77
+
78
+ if options[:additional_metadata]
79
+ request_args[:additional_metadata] = if options[:additional_metadata].is_a?(String)
80
+ options[:additional_metadata]
81
+ else
82
+ JSON.generate(options[:additional_metadata])
83
+ end
84
+ end
85
+
86
+ request = ::TriggerWorkflowRequest.new(**request_args)
87
+
88
+ begin
89
+ response = @v0_stub.trigger_workflow(request, metadata: @config.auth_metadata)
90
+ response.workflow_run_id
91
+ rescue ::GRPC::AlreadyExists => e
92
+ raise DedupeViolationError, "Deduplication violation: #{e.message}"
93
+ rescue ::GRPC::ResourceExhausted => e
94
+ raise ResourceExhaustedError, e.message
95
+ rescue ::GRPC::BadStatus => e
96
+ raise Error, "gRPC error triggering workflow: #{e.class}: #{e.message}"
97
+ end
98
+ end
99
+
100
+ # Trigger multiple workflow runs in bulk via v0 WorkflowService.
101
+ #
102
+ # Automatically batches requests in groups of 1000.
103
+ #
104
+ # @param workflow_name [String] The workflow name (will be namespaced)
105
+ # @param items [Array<Hash>] Array of { input:, options: } items
106
+ # @return [Array<String>] Array of workflow run IDs
107
+ def bulk_trigger_workflow(workflow_name, items)
108
+ ensure_connected!
109
+
110
+ name = @config.apply_namespace(workflow_name)
111
+
112
+ requests = items.map do |item|
113
+ input = item[:input] || {}
114
+ opts = item[:options] || {}
115
+
116
+ request_args = {
117
+ name: name,
118
+ input: JSON.generate(input),
119
+ }
120
+
121
+ request_args[:parent_id] = opts[:parent_id] if opts[:parent_id]
122
+ request_args[:parent_task_run_external_id] = opts[:parent_task_run_external_id] if opts[:parent_task_run_external_id]
123
+ request_args[:child_index] = opts[:child_index] if opts[:child_index]
124
+ request_args[:child_key] = opts[:child_key] if opts[:child_key]
125
+ request_args[:desired_worker_id] = opts[:desired_worker_id] if opts[:desired_worker_id]
126
+ request_args[:priority] = opts[:priority] if opts[:priority]
127
+
128
+ if opts[:additional_metadata]
129
+ request_args[:additional_metadata] = if opts[:additional_metadata].is_a?(String)
130
+ opts[:additional_metadata]
131
+ else
132
+ JSON.generate(opts[:additional_metadata])
133
+ end
134
+ end
135
+
136
+ ::TriggerWorkflowRequest.new(**request_args)
137
+ end
138
+
139
+ # Batch in groups of BULK_TRIGGER_BATCH_SIZE
140
+ all_run_ids = []
141
+ begin
142
+ requests.each_slice(BULK_TRIGGER_BATCH_SIZE) do |batch|
143
+ bulk_request = ::BulkTriggerWorkflowRequest.new(workflows: batch)
144
+ response = @v0_stub.bulk_trigger_workflow(bulk_request, metadata: @config.auth_metadata)
145
+ all_run_ids.concat(response.workflow_run_ids.to_a)
146
+ end
147
+ rescue ::GRPC::ResourceExhausted => e
148
+ raise ResourceExhaustedError, e.message
149
+ rescue ::GRPC::BadStatus => e
150
+ raise Error, "gRPC error triggering bulk workflow: #{e.class}: #{e.message}"
151
+ end
152
+
153
+ all_run_ids
154
+ end
155
+
156
+ # Schedule a workflow for future execution via v0 WorkflowService.
157
+ #
158
+ # @param workflow_name [String] The workflow name (will be namespaced)
159
+ # @param run_at [Time] When to run
160
+ # @param input [Hash] Workflow input
161
+ # @param options [Hash] Trigger options
162
+ # @return [WorkflowVersion] Schedule response
163
+ # @raise [DedupeViolationError] If a deduplication violation occurs
164
+ def schedule_workflow(workflow_name, run_at:, input: {}, options: {})
165
+ ensure_connected!
166
+
167
+ name = @config.apply_namespace(workflow_name)
168
+
169
+ schedule_timestamp = Google::Protobuf::Timestamp.new(
170
+ seconds: run_at.to_i,
171
+ nanos: run_at.respond_to?(:nsec) ? run_at.nsec : 0,
172
+ )
173
+
174
+ request_args = {
175
+ name: name,
176
+ schedules: [schedule_timestamp],
177
+ input: JSON.generate(input),
178
+ }
179
+
180
+ request_args[:parent_id] = options[:parent_id] if options[:parent_id]
181
+ request_args[:parent_task_run_external_id] = options[:parent_task_run_external_id] if options[:parent_task_run_external_id]
182
+ request_args[:child_index] = options[:child_index] if options[:child_index]
183
+ request_args[:child_key] = options[:child_key] if options[:child_key]
184
+ request_args[:priority] = options[:priority] if options[:priority]
185
+
186
+ if options[:additional_metadata]
187
+ request_args[:additional_metadata] = if options[:additional_metadata].is_a?(String)
188
+ options[:additional_metadata]
189
+ else
190
+ JSON.generate(options[:additional_metadata])
191
+ end
192
+ end
193
+
194
+ request = ::ScheduleWorkflowRequest.new(**request_args)
195
+
196
+ begin
197
+ @v0_stub.schedule_workflow(request, metadata: @config.auth_metadata)
198
+ rescue ::GRPC::AlreadyExists => e
199
+ raise DedupeViolationError, "Deduplication violation: #{e.message}"
200
+ rescue ::GRPC::ResourceExhausted => e
201
+ raise ResourceExhaustedError, e.message
202
+ rescue ::GRPC::BadStatus => e
203
+ raise Error, "gRPC error scheduling workflow: #{e.class}: #{e.message}"
204
+ end
205
+ end
206
+
207
+ # Get run details via v1 AdminService.
208
+ #
209
+ # @param external_id [String] The workflow run external ID
210
+ # @return [V1::GetRunDetailsResponse]
211
+ def get_run_details(external_id:)
212
+ ensure_connected!
213
+
214
+ request = ::V1::GetRunDetailsRequest.new(external_id: external_id)
215
+ @v1_stub.get_run_details(request, metadata: @config.auth_metadata)
216
+ end
217
+
218
+ # Put a rate limit via v0 WorkflowService.
219
+ #
220
+ # @param key [String] Rate limit key
221
+ # @param limit [Integer] Rate limit value
222
+ # @param duration [Symbol] Rate limit duration enum
223
+ # @return [PutRateLimitResponse]
224
+ def put_rate_limit(key:, limit:, duration:)
225
+ ensure_connected!
226
+
227
+ request = ::PutRateLimitRequest.new(
228
+ key: key,
229
+ limit: limit,
230
+ duration: duration,
231
+ )
232
+
233
+ @v0_stub.put_rate_limit(request, metadata: @config.auth_metadata)
234
+ end
235
+
236
+ # Close the connection.
237
+ def close
238
+ @v0_stub = nil
239
+ @v1_stub = nil
240
+ end
241
+
242
+ private
243
+
244
+ def ensure_connected!
245
+ return if @v0_stub && @v1_stub
246
+
247
+ @v0_stub = ::WorkflowService::Stub.new(
248
+ @config.host_port,
249
+ nil,
250
+ channel_override: @channel,
251
+ )
252
+
253
+ @v1_stub = ::V1::AdminService::Stub.new(
254
+ @config.host_port,
255
+ nil,
256
+ channel_override: @channel,
257
+ )
258
+
259
+ @logger.debug("Admin gRPC stubs (v0 + v1) connected via shared channel")
260
+ end
261
+ end
262
+ end
263
+ end
264
+ end