temporalio 0.3.0-x86_64-darwin → 0.5.0-x86_64-darwin
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/.yardopts +1 -1
- data/Gemfile +4 -0
- data/Rakefile +1 -1
- data/lib/temporalio/activity/cancellation_details.rb +58 -0
- data/lib/temporalio/activity/context.rb +23 -1
- data/lib/temporalio/activity/definition.rb +63 -8
- data/lib/temporalio/activity/info.rb +28 -4
- data/lib/temporalio/activity.rb +2 -0
- data/lib/temporalio/api/activity/v1/message.rb +1 -1
- data/lib/temporalio/api/batch/v1/message.rb +9 -2
- data/lib/temporalio/api/cloud/account/v1/message.rb +1 -1
- data/lib/temporalio/api/cloud/cloudservice/v1/request_response.rb +11 -2
- data/lib/temporalio/api/cloud/cloudservice/v1/service.rb +2 -2
- data/lib/temporalio/api/cloud/identity/v1/message.rb +7 -2
- data/lib/temporalio/api/cloud/namespace/v1/message.rb +6 -2
- data/lib/temporalio/api/cloud/nexus/v1/message.rb +3 -2
- data/lib/temporalio/api/cloud/operation/v1/message.rb +1 -1
- data/lib/temporalio/api/cloud/region/v1/message.rb +1 -1
- data/lib/temporalio/api/cloud/resource/v1/message.rb +1 -1
- data/lib/temporalio/api/cloud/sink/v1/message.rb +1 -1
- data/lib/temporalio/api/cloud/usage/v1/message.rb +1 -1
- data/lib/temporalio/api/command/v1/message.rb +2 -2
- data/lib/temporalio/api/common/v1/grpc_status.rb +1 -1
- data/lib/temporalio/api/common/v1/message.rb +4 -2
- data/lib/temporalio/api/deployment/v1/message.rb +39 -0
- data/lib/temporalio/api/enums/v1/batch_operation.rb +2 -2
- data/lib/temporalio/api/enums/v1/command_type.rb +1 -1
- data/lib/temporalio/api/enums/v1/common.rb +5 -2
- data/lib/temporalio/api/enums/v1/deployment.rb +24 -0
- data/lib/temporalio/api/enums/v1/event_type.rb +2 -2
- data/lib/temporalio/api/enums/v1/failed_cause.rb +2 -2
- data/lib/temporalio/api/enums/v1/namespace.rb +1 -1
- data/lib/temporalio/api/enums/v1/nexus.rb +21 -0
- data/lib/temporalio/api/enums/v1/query.rb +1 -1
- data/lib/temporalio/api/enums/v1/reset.rb +2 -2
- data/lib/temporalio/api/enums/v1/schedule.rb +1 -1
- data/lib/temporalio/api/enums/v1/task_queue.rb +1 -1
- data/lib/temporalio/api/enums/v1/update.rb +1 -1
- data/lib/temporalio/api/enums/v1/workflow.rb +3 -2
- data/lib/temporalio/api/errordetails/v1/message.rb +4 -2
- data/lib/temporalio/api/export/v1/message.rb +1 -1
- data/lib/temporalio/api/failure/v1/message.rb +5 -2
- data/lib/temporalio/api/filter/v1/message.rb +1 -1
- data/lib/temporalio/api/history/v1/message.rb +6 -2
- data/lib/temporalio/api/namespace/v1/message.rb +1 -1
- data/lib/temporalio/api/nexus/v1/message.rb +3 -2
- data/lib/temporalio/api/operatorservice/v1/request_response.rb +1 -1
- data/lib/temporalio/api/operatorservice/v1/service.rb +1 -1
- data/lib/temporalio/api/payload_visitor.rb +162 -7
- data/lib/temporalio/api/protocol/v1/message.rb +1 -1
- data/lib/temporalio/api/query/v1/message.rb +3 -2
- data/lib/temporalio/api/replication/v1/message.rb +1 -1
- data/lib/temporalio/api/rules/v1/message.rb +27 -0
- data/lib/temporalio/api/schedule/v1/message.rb +2 -2
- data/lib/temporalio/api/sdk/v1/enhanced_stack_trace.rb +1 -1
- data/lib/temporalio/api/sdk/v1/task_complete_metadata.rb +1 -1
- data/lib/temporalio/api/sdk/v1/user_metadata.rb +1 -1
- data/lib/temporalio/api/sdk/v1/workflow_metadata.rb +1 -1
- data/lib/temporalio/api/taskqueue/v1/message.rb +5 -2
- data/lib/temporalio/api/testservice/v1/request_response.rb +1 -1
- data/lib/temporalio/api/testservice/v1/service.rb +1 -1
- data/lib/temporalio/api/update/v1/message.rb +1 -1
- data/lib/temporalio/api/version/v1/message.rb +1 -1
- data/lib/temporalio/api/worker/v1/message.rb +30 -0
- data/lib/temporalio/api/workflow/v1/message.rb +22 -2
- data/lib/temporalio/api/workflowservice/v1/request_response.rb +58 -12
- data/lib/temporalio/api/workflowservice/v1/service.rb +2 -2
- data/lib/temporalio/api.rb +1 -0
- data/lib/temporalio/client/async_activity_handle.rb +12 -4
- data/lib/temporalio/client/connection/cloud_service.rb +60 -0
- data/lib/temporalio/client/connection/workflow_service.rb +343 -28
- data/lib/temporalio/client/interceptor.rb +64 -7
- data/lib/temporalio/client/schedule.rb +35 -3
- data/lib/temporalio/client/with_start_workflow_operation.rb +123 -0
- data/lib/temporalio/client/workflow_execution.rb +19 -0
- data/lib/temporalio/client/workflow_handle.rb +47 -7
- data/lib/temporalio/client/workflow_update_handle.rb +9 -3
- data/lib/temporalio/client.rb +231 -4
- data/lib/temporalio/common_enums.rb +14 -0
- data/lib/temporalio/contrib/open_telemetry.rb +474 -0
- data/lib/temporalio/converters/data_converter.rb +18 -8
- data/lib/temporalio/converters/failure_converter.rb +6 -3
- data/lib/temporalio/converters/payload_converter/binary_null.rb +2 -2
- data/lib/temporalio/converters/payload_converter/binary_plain.rb +2 -2
- data/lib/temporalio/converters/payload_converter/binary_protobuf.rb +2 -2
- data/lib/temporalio/converters/payload_converter/composite.rb +6 -4
- data/lib/temporalio/converters/payload_converter/encoding.rb +4 -2
- data/lib/temporalio/converters/payload_converter/json_plain.rb +2 -2
- data/lib/temporalio/converters/payload_converter/json_protobuf.rb +2 -2
- data/lib/temporalio/converters/payload_converter.rb +16 -6
- data/lib/temporalio/error/failure.rb +19 -1
- data/lib/temporalio/error.rb +2 -1
- data/lib/temporalio/internal/bridge/3.2/temporalio_bridge.bundle +0 -0
- data/lib/temporalio/internal/bridge/3.3/temporalio_bridge.bundle +0 -0
- data/lib/temporalio/internal/bridge/3.4/temporalio_bridge.bundle +0 -0
- data/lib/temporalio/internal/bridge/api/activity_result/activity_result.rb +1 -1
- data/lib/temporalio/internal/bridge/api/activity_task/activity_task.rb +3 -2
- data/lib/temporalio/internal/bridge/api/child_workflow/child_workflow.rb +1 -1
- data/lib/temporalio/internal/bridge/api/common/common.rb +3 -2
- data/lib/temporalio/internal/bridge/api/core_interface.rb +1 -1
- data/lib/temporalio/internal/bridge/api/external_data/external_data.rb +1 -1
- data/lib/temporalio/internal/bridge/api/nexus/nexus.rb +3 -2
- data/lib/temporalio/internal/bridge/api/workflow_activation/workflow_activation.rb +2 -2
- data/lib/temporalio/internal/bridge/api/workflow_commands/workflow_commands.rb +3 -2
- data/lib/temporalio/internal/bridge/api/workflow_completion/workflow_completion.rb +3 -2
- data/lib/temporalio/internal/bridge/runtime.rb +3 -0
- data/lib/temporalio/internal/bridge/testing.rb +3 -0
- data/lib/temporalio/internal/bridge/worker.rb +28 -4
- data/lib/temporalio/internal/bridge.rb +1 -1
- data/lib/temporalio/internal/client/implementation.rb +281 -51
- data/lib/temporalio/internal/proto_utils.rb +38 -6
- data/lib/temporalio/internal/worker/activity_worker.rb +112 -27
- data/lib/temporalio/internal/worker/multi_runner.rb +2 -2
- data/lib/temporalio/internal/worker/workflow_instance/child_workflow_handle.rb +8 -6
- data/lib/temporalio/internal/worker/workflow_instance/context.rb +100 -5
- data/lib/temporalio/internal/worker/workflow_instance/details.rb +7 -2
- data/lib/temporalio/internal/worker/workflow_instance/external_workflow_handle.rb +2 -2
- data/lib/temporalio/internal/worker/workflow_instance/illegal_call_tracer.rb +64 -18
- data/lib/temporalio/internal/worker/workflow_instance/outbound_implementation.rb +39 -40
- data/lib/temporalio/internal/worker/workflow_instance/scheduler.rb +22 -2
- data/lib/temporalio/internal/worker/workflow_instance.rb +134 -55
- data/lib/temporalio/internal/worker/workflow_worker.rb +74 -21
- data/lib/temporalio/priority.rb +59 -0
- data/lib/temporalio/runtime/metric_buffer.rb +94 -0
- data/lib/temporalio/runtime.rb +48 -10
- data/lib/temporalio/search_attributes.rb +13 -0
- data/lib/temporalio/testing/activity_environment.rb +59 -16
- data/lib/temporalio/testing/workflow_environment.rb +29 -6
- data/lib/temporalio/version.rb +1 -1
- data/lib/temporalio/versioning_override.rb +56 -0
- data/lib/temporalio/worker/deployment_options.rb +45 -0
- data/lib/temporalio/worker/illegal_workflow_call_validator.rb +64 -0
- data/lib/temporalio/worker/interceptor.rb +16 -1
- data/lib/temporalio/worker/poller_behavior.rb +61 -0
- data/lib/temporalio/worker/thread_pool.rb +6 -6
- data/lib/temporalio/worker/tuner.rb +38 -0
- data/lib/temporalio/worker/workflow_executor/thread_pool.rb +14 -8
- data/lib/temporalio/worker/workflow_executor.rb +1 -1
- data/lib/temporalio/worker/workflow_replayer.rb +349 -0
- data/lib/temporalio/worker.rb +117 -75
- data/lib/temporalio/worker_deployment_version.rb +67 -0
- data/lib/temporalio/workflow/child_workflow_handle.rb +10 -2
- data/lib/temporalio/workflow/definition.rb +217 -35
- data/lib/temporalio/workflow/external_workflow_handle.rb +3 -1
- data/lib/temporalio/workflow/future.rb +2 -2
- data/lib/temporalio/workflow/info.rb +26 -1
- data/lib/temporalio/workflow.rb +119 -15
- data/lib/temporalio/workflow_history.rb +26 -1
- data/lib/temporalio.rb +1 -0
- data/temporalio.gemspec +3 -1
- metadata +34 -4
| @@ -1,5 +1,6 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 | 
            +
            require 'temporalio/internal/proto_utils'
         | 
| 3 4 | 
             
            require 'temporalio/workflow'
         | 
| 4 5 | 
             
            require 'temporalio/workflow/handler_unfinished_policy'
         | 
| 5 6 |  | 
| @@ -46,6 +47,21 @@ module Temporalio | |
| 46 47 | 
             
                      @workflow_raw_args = value
         | 
| 47 48 | 
             
                    end
         | 
| 48 49 |  | 
| 50 | 
            +
                    # Add workflow hints to be passed to converter for workflow args.
         | 
| 51 | 
            +
                    #
         | 
| 52 | 
            +
                    # @param hints [Array<Object>] Hints to add.
         | 
| 53 | 
            +
                    def workflow_arg_hint(*hints)
         | 
| 54 | 
            +
                      @workflow_arg_hints ||= []
         | 
| 55 | 
            +
                      @workflow_arg_hints.concat(hints)
         | 
| 56 | 
            +
                    end
         | 
| 57 | 
            +
             | 
| 58 | 
            +
                    # Set workflow result hint to be passed to converter for workflow result.
         | 
| 59 | 
            +
                    #
         | 
| 60 | 
            +
                    # @param hint [Object] Hint to set.
         | 
| 61 | 
            +
                    def workflow_result_hint(hint)
         | 
| 62 | 
            +
                      @workflow_result_hint = hint
         | 
| 63 | 
            +
                    end
         | 
| 64 | 
            +
             | 
| 49 65 | 
             
                    # Configure workflow failure exception types. This sets the types of exceptions that, if a
         | 
| 50 66 | 
             
                    # workflow-thrown exception extends, will cause the workflow/update to fail instead of suspending the workflow
         | 
| 51 67 | 
             
                    # via task failure. These are applied in addition to the worker option. If {::Exception} is set, it effectively
         | 
| @@ -54,7 +70,7 @@ module Temporalio | |
| 54 70 | 
             
                    # @param types [Array<Class<Exception>>] Exception types to turn into workflow failures.
         | 
| 55 71 | 
             
                    def workflow_failure_exception_type(*types)
         | 
| 56 72 | 
             
                      types.each do |t|
         | 
| 57 | 
            -
                        raise ArgumentError, 'All types must classes inheriting Exception' unless t.is_a?(Class) && t  | 
| 73 | 
            +
                        raise ArgumentError, 'All types must classes inheriting Exception' unless t.is_a?(Class) && t <= Exception
         | 
| 58 74 | 
             
                      end
         | 
| 59 75 | 
             
                      @workflow_failure_exception_types ||= []
         | 
| 60 76 | 
             
                      @workflow_failure_exception_types.concat(types)
         | 
| @@ -71,7 +87,9 @@ module Temporalio | |
| 71 87 | 
             
                    # `attr_accessor`. If a writer is needed alongside this, use `attr_writer`.
         | 
| 72 88 | 
             
                    #
         | 
| 73 89 | 
             
                    # @param attr_names [Array<Symbol>] Attributes to expose.
         | 
| 74 | 
            -
                     | 
| 90 | 
            +
                    # @param description [String, nil] Description that may appear in CLI/UI, applied to each query handler
         | 
| 91 | 
            +
                    #   implicitly created. This is currently experimental.
         | 
| 92 | 
            +
                    def workflow_query_attr_reader(*attr_names, description: nil)
         | 
| 75 93 | 
             
                      @workflow_queries ||= {}
         | 
| 76 94 | 
             
                      attr_names.each do |attr_name|
         | 
| 77 95 | 
             
                        raise 'Expected attr to be a symbol' unless attr_name.is_a?(Symbol)
         | 
| @@ -83,11 +101,20 @@ module Temporalio | |
| 83 101 | 
             
                        end
         | 
| 84 102 |  | 
| 85 103 | 
             
                        # Just run this as if done manually
         | 
| 86 | 
            -
                        workflow_query
         | 
| 104 | 
            +
                        workflow_query(description:)
         | 
| 87 105 | 
             
                        define_method(attr_name) { instance_variable_get("@#{attr_name}") }
         | 
| 88 106 | 
             
                      end
         | 
| 89 107 | 
             
                    end
         | 
| 90 108 |  | 
| 109 | 
            +
                    # Set the versioning behavior of this workflow.
         | 
| 110 | 
            +
                    #
         | 
| 111 | 
            +
                    # WARNING: This method is experimental and may change in future versions.
         | 
| 112 | 
            +
                    #
         | 
| 113 | 
            +
                    # @param behavior [VersioningBehavior] The versioning behavior.
         | 
| 114 | 
            +
                    def workflow_versioning_behavior(behavior)
         | 
| 115 | 
            +
                      @versioning_behavior = behavior
         | 
| 116 | 
            +
                    end
         | 
| 117 | 
            +
             | 
| 91 118 | 
             
                    # Mark an `initialize` as needing the workflow start arguments. Otherwise, `initialize` must accept no required
         | 
| 92 119 | 
             
                    # arguments. This must be placed above the `initialize` method or it will fail.
         | 
| 93 120 | 
             
                    #
         | 
| @@ -100,6 +127,8 @@ module Temporalio | |
| 100 127 | 
             
                    # values.
         | 
| 101 128 | 
             
                    #
         | 
| 102 129 | 
             
                    # @param name [String, Symbol, nil] Override the default name.
         | 
| 130 | 
            +
                    # @param description [String, nil] Description for this handler that may appear in CLI/UI. This is currently
         | 
| 131 | 
            +
                    #   experimental.
         | 
| 103 132 | 
             
                    # @param dynamic [Boolean] If true, make the signal dynamic. This means it receives all other signals without
         | 
| 104 133 | 
             
                    #   handlers. This cannot have a name override since it is nameless. The first parameter will be the name. Often
         | 
| 105 134 | 
             
                    #   it is useful to have the second parameter be `*args` and `raw_args` be true.
         | 
| @@ -107,40 +136,55 @@ module Temporalio | |
| 107 136 | 
             
                    #   {Converters::RawValue} which is a raw payload wrapper, convertible with {Workflow.payload_converter}.
         | 
| 108 137 | 
             
                    # @param unfinished_policy [HandlerUnfinishedPolicy] How to treat unfinished handlers if they are still running
         | 
| 109 138 | 
             
                    #   when the workflow ends. The default warns, but this can be disabled.
         | 
| 139 | 
            +
                    # @param arg_hints [Array<Object>, nil] Argument hint(s) for the signal.
         | 
| 110 140 | 
             
                    def workflow_signal(
         | 
| 111 141 | 
             
                      name: nil,
         | 
| 142 | 
            +
                      description: nil,
         | 
| 112 143 | 
             
                      dynamic: false,
         | 
| 113 144 | 
             
                      raw_args: false,
         | 
| 114 | 
            -
                      unfinished_policy: HandlerUnfinishedPolicy::WARN_AND_ABANDON
         | 
| 145 | 
            +
                      unfinished_policy: HandlerUnfinishedPolicy::WARN_AND_ABANDON,
         | 
| 146 | 
            +
                      arg_hints: nil
         | 
| 115 147 | 
             
                    )
         | 
| 116 148 | 
             
                      raise 'Cannot provide name if dynamic is true' if name && dynamic
         | 
| 117 149 |  | 
| 118 | 
            -
                      self.pending_handler_details = | 
| 150 | 
            +
                      self.pending_handler_details =
         | 
| 151 | 
            +
                        { type: :signal, name:, description:, dynamic:, raw_args:, unfinished_policy:,
         | 
| 152 | 
            +
                          arg_hints: Array(arg_hints) }
         | 
| 119 153 | 
             
                    end
         | 
| 120 154 |  | 
| 121 155 | 
             
                    # Mark the next method as a workflow query with a default name as the name of the method. Queries can not have
         | 
| 122 156 | 
             
                    # any side effects, meaning they should never mutate state or try to wait on anything.
         | 
| 123 157 | 
             
                    #
         | 
| 124 158 | 
             
                    # @param name [String, Symbol, nil] Override the default name.
         | 
| 159 | 
            +
                    # @param description [String, nil] Description for this handler that may appear in CLI/UI. This is currently
         | 
| 160 | 
            +
                    #   experimental.
         | 
| 125 161 | 
             
                    # @param dynamic [Boolean] If true, make the query dynamic. This means it receives all other queries without
         | 
| 126 162 | 
             
                    #   handlers. This cannot have a name override since it is nameless. The first parameter will be the name. Often
         | 
| 127 163 | 
             
                    #   it is useful to have the second parameter be `*args` and `raw_args` be true.
         | 
| 128 164 | 
             
                    # @param raw_args [Boolean] If true, does not convert arguments, but instead provides each argument as
         | 
| 129 165 | 
             
                    #   {Converters::RawValue} which is a raw payload wrapper, convertible with {Workflow.payload_converter}.
         | 
| 166 | 
            +
                    # @param arg_hints [Object, Array<Object>, nil] Argument hint(s) for the query.
         | 
| 167 | 
            +
                    # @param result_hint [Object, nil] Result hint for the query.
         | 
| 130 168 | 
             
                    def workflow_query(
         | 
| 131 169 | 
             
                      name: nil,
         | 
| 170 | 
            +
                      description: nil,
         | 
| 132 171 | 
             
                      dynamic: false,
         | 
| 133 | 
            -
                      raw_args: false
         | 
| 172 | 
            +
                      raw_args: false,
         | 
| 173 | 
            +
                      arg_hints: nil,
         | 
| 174 | 
            +
                      result_hint: nil
         | 
| 134 175 | 
             
                    )
         | 
| 135 176 | 
             
                      raise 'Cannot provide name if dynamic is true' if name && dynamic
         | 
| 136 177 |  | 
| 137 | 
            -
                      self.pending_handler_details = { type: :query, name:, dynamic:, raw_args | 
| 178 | 
            +
                      self.pending_handler_details = { type: :query, name:, description:, dynamic:, raw_args:,
         | 
| 179 | 
            +
                                                       arg_hints: Array(arg_hints), result_hint: }
         | 
| 138 180 | 
             
                    end
         | 
| 139 181 |  | 
| 140 182 | 
             
                    # Mark the next method as a workflow update with a default name as the name of the method. Updates can return
         | 
| 141 183 | 
             
                    # values. Separate validation methods can be provided via {workflow_update_validator}.
         | 
| 142 184 | 
             
                    #
         | 
| 143 185 | 
             
                    # @param name [String, Symbol, nil] Override the default name.
         | 
| 186 | 
            +
                    # @param description [String, nil] Description for this handler that may appear in CLI/UI. This is currently
         | 
| 187 | 
            +
                    #   experimental.
         | 
| 144 188 | 
             
                    # @param dynamic [Boolean] If true, make the update dynamic. This means it receives all other updates without
         | 
| 145 189 | 
             
                    #   handlers. This cannot have a name override since it is nameless. The first parameter will be the name. Often
         | 
| 146 190 | 
             
                    #   it is useful to have the second parameter be `*args` and `raw_args` be true.
         | 
| @@ -148,15 +192,21 @@ module Temporalio | |
| 148 192 | 
             
                    #   {Converters::RawValue} which is a raw payload wrapper, convertible with {Workflow.payload_converter}.
         | 
| 149 193 | 
             
                    # @param unfinished_policy [HandlerUnfinishedPolicy] How to treat unfinished handlers if they are still running
         | 
| 150 194 | 
             
                    #   when the workflow ends. The default warns, but this can be disabled.
         | 
| 195 | 
            +
                    # @param arg_hints [Object, Array<Object>, nil] Argument hint(s) for the update.
         | 
| 196 | 
            +
                    # @param result_hint [Object, nil] Result hint for the update.
         | 
| 151 197 | 
             
                    def workflow_update(
         | 
| 152 198 | 
             
                      name: nil,
         | 
| 199 | 
            +
                      description: nil,
         | 
| 153 200 | 
             
                      dynamic: false,
         | 
| 154 201 | 
             
                      raw_args: false,
         | 
| 155 | 
            -
                      unfinished_policy: HandlerUnfinishedPolicy::WARN_AND_ABANDON
         | 
| 202 | 
            +
                      unfinished_policy: HandlerUnfinishedPolicy::WARN_AND_ABANDON,
         | 
| 203 | 
            +
                      arg_hints: nil,
         | 
| 204 | 
            +
                      result_hint: nil
         | 
| 156 205 | 
             
                    )
         | 
| 157 206 | 
             
                      raise 'Cannot provide name if dynamic is true' if name && dynamic
         | 
| 158 207 |  | 
| 159 | 
            -
                      self.pending_handler_details = { type: :update, name:, dynamic:, raw_args:, unfinished_policy | 
| 208 | 
            +
                      self.pending_handler_details = { type: :update, name:, description:, dynamic:, raw_args:, unfinished_policy:,
         | 
| 209 | 
            +
                                                       arg_hints: Array(arg_hints), result_hint: }
         | 
| 160 210 | 
             
                    end
         | 
| 161 211 |  | 
| 162 212 | 
             
                    # Mark the next method as a workflow update validator to the given update method. The validator is expected to
         | 
| @@ -169,6 +219,24 @@ module Temporalio | |
| 169 219 | 
             
                      self.pending_handler_details = { type: :update_validator, update_method: }
         | 
| 170 220 | 
             
                    end
         | 
| 171 221 |  | 
| 222 | 
            +
                    # Mark the next method as returning some dynamic configuraion.
         | 
| 223 | 
            +
                    #
         | 
| 224 | 
            +
                    # Because dynamic workflows may conceptually represent more than one workflow type, it may
         | 
| 225 | 
            +
                    # be desirable to have different settings for fields that would normally be passed to
         | 
| 226 | 
            +
                    # `workflow_xxx` setters, but vary based on the workflow type name or other information
         | 
| 227 | 
            +
                    # available in the workflow's context. This function will be called after the workflow's
         | 
| 228 | 
            +
                    # `initialize`, if it has one, but before the workflow's `execute` method.
         | 
| 229 | 
            +
                    #
         | 
| 230 | 
            +
                    # The method must only take self as a parameter, and any values set in the class it returns
         | 
| 231 | 
            +
                    # will override those provided to other `workflow_xxx` setters.
         | 
| 232 | 
            +
                    #
         | 
| 233 | 
            +
                    # Cannot be specified on non-dynamic workflows.
         | 
| 234 | 
            +
                    def workflow_dynamic_options
         | 
| 235 | 
            +
                      raise 'Dynamic options method can only be set on workflows using `workflow_dynamic`' unless @workflow_dynamic
         | 
| 236 | 
            +
             | 
| 237 | 
            +
                      self.pending_handler_details = { type: :dynamic_options }
         | 
| 238 | 
            +
                    end
         | 
| 239 | 
            +
             | 
| 172 240 | 
             
                    private
         | 
| 173 241 |  | 
| 174 242 | 
             
                    attr_reader :pending_handler_details
         | 
| @@ -196,6 +264,15 @@ module Temporalio | |
| 196 264 | 
             
                    # Reset details
         | 
| 197 265 | 
             
                    self.pending_handler_details = nil
         | 
| 198 266 |  | 
| 267 | 
            +
                    # Disallow kwargs in parameters
         | 
| 268 | 
            +
                    begin
         | 
| 269 | 
            +
                      if instance_method(method_name).parameters.any? { |t, _| t == :key || t == :keyreq }
         | 
| 270 | 
            +
                        raise "Workflow #{handler[:type]} cannot have keyword arguments"
         | 
| 271 | 
            +
                      end
         | 
| 272 | 
            +
                    rescue NameError
         | 
| 273 | 
            +
                      # Ignore name error
         | 
| 274 | 
            +
                    end
         | 
| 275 | 
            +
             | 
| 199 276 | 
             
                    # Initialize class variables if not done already
         | 
| 200 277 | 
             
                    @workflow_signals ||= {}
         | 
| 201 278 | 
             
                    @workflow_queries ||= {}
         | 
| @@ -225,22 +302,35 @@ module Temporalio | |
| 225 302 | 
             
                        [Signal.new(
         | 
| 226 303 | 
             
                          name: handler[:dynamic] ? nil : (handler[:name] || method_name).to_s,
         | 
| 227 304 | 
             
                          to_invoke: method_name,
         | 
| 305 | 
            +
                          description: handler[:description],
         | 
| 228 306 | 
             
                          raw_args: handler[:raw_args],
         | 
| 229 | 
            -
                          unfinished_policy: handler[:unfinished_policy]
         | 
| 307 | 
            +
                          unfinished_policy: handler[:unfinished_policy],
         | 
| 308 | 
            +
                          arg_hints: handler[:arg_hints]
         | 
| 230 309 | 
             
                        ), @workflow_signals, [@workflow_queries, @workflow_updates]]
         | 
| 231 310 | 
             
                      when :query
         | 
| 232 311 | 
             
                        [Query.new(
         | 
| 233 312 | 
             
                          name: handler[:dynamic] ? nil : (handler[:name] || method_name).to_s,
         | 
| 234 313 | 
             
                          to_invoke: method_name,
         | 
| 235 | 
            -
                           | 
| 314 | 
            +
                          description: handler[:description],
         | 
| 315 | 
            +
                          raw_args: handler[:raw_args],
         | 
| 316 | 
            +
                          arg_hints: handler[:arg_hints],
         | 
| 317 | 
            +
                          result_hint: handler[:result_hint]
         | 
| 236 318 | 
             
                        ), @workflow_queries, [@workflow_signals, @workflow_updates]]
         | 
| 237 319 | 
             
                      when :update
         | 
| 238 320 | 
             
                        [Update.new(
         | 
| 239 321 | 
             
                          name: handler[:dynamic] ? nil : (handler[:name] || method_name).to_s,
         | 
| 240 322 | 
             
                          to_invoke: method_name,
         | 
| 323 | 
            +
                          description: handler[:description],
         | 
| 241 324 | 
             
                          raw_args: handler[:raw_args],
         | 
| 242 | 
            -
                          unfinished_policy: handler[:unfinished_policy]
         | 
| 325 | 
            +
                          unfinished_policy: handler[:unfinished_policy],
         | 
| 326 | 
            +
                          arg_hints: handler[:arg_hints],
         | 
| 327 | 
            +
                          result_hint: handler[:result_hint]
         | 
| 243 328 | 
             
                        ), @workflow_updates, [@workflow_signals, @workflow_queries]]
         | 
| 329 | 
            +
                      when :dynamic_options
         | 
| 330 | 
            +
                        raise 'Dynamic options method already set' if @dynamic_options_method
         | 
| 331 | 
            +
             | 
| 332 | 
            +
                        @dynamic_options_method = method_name
         | 
| 333 | 
            +
                        return
         | 
| 244 334 | 
             
                      else
         | 
| 245 335 | 
             
                        raise "Unrecognized handler type #{handler[:type]}"
         | 
| 246 336 | 
             
                      end
         | 
| @@ -278,7 +368,7 @@ module Temporalio | |
| 278 368 | 
             
                  end
         | 
| 279 369 |  | 
| 280 370 | 
             
                  # @!visibility private
         | 
| 281 | 
            -
                  def self. | 
| 371 | 
            +
                  def self._workflow_type_and_hints_from_workflow_parameter(workflow)
         | 
| 282 372 | 
             
                    case workflow
         | 
| 283 373 | 
             
                    when Class
         | 
| 284 374 | 
             
                      unless workflow < Definition
         | 
| @@ -286,11 +376,15 @@ module Temporalio | |
| 286 376 | 
             
                      end
         | 
| 287 377 |  | 
| 288 378 | 
             
                      info = Info.from_class(workflow)
         | 
| 289 | 
            -
                       | 
| 379 | 
            +
                      raise(ArgumentError, 'Cannot pass dynamic workflow to start') unless info.name
         | 
| 380 | 
            +
             | 
| 381 | 
            +
                      [info.name.to_s, info.arg_hints, info.result_hint]
         | 
| 290 382 | 
             
                    when Info
         | 
| 291 | 
            -
                       | 
| 383 | 
            +
                      raise(ArgumentError, 'Cannot pass dynamic workflow to start') unless workflow.name
         | 
| 384 | 
            +
             | 
| 385 | 
            +
                      [workflow.name.to_s, nil, nil]
         | 
| 292 386 | 
             
                    when String, Symbol
         | 
| 293 | 
            -
                      workflow.to_s
         | 
| 387 | 
            +
                      [workflow.to_s, nil, nil]
         | 
| 294 388 | 
             
                    else
         | 
| 295 389 | 
             
                      raise ArgumentError, 'Workflow is not a workflow class or string/symbol'
         | 
| 296 390 | 
             
                    end
         | 
| @@ -303,6 +397,11 @@ module Temporalio | |
| 303 397 | 
             
                      raise "Leftover #{pending_handler_details&.[](:type)} handler not applied to a method"
         | 
| 304 398 | 
             
                    end
         | 
| 305 399 |  | 
| 400 | 
            +
                    # Disallow kwargs in execute parameters
         | 
| 401 | 
            +
                    if instance_method(:execute).parameters.any? { |t, _| t == :key || t == :keyreq }
         | 
| 402 | 
            +
                      raise 'Workflow execute cannot have keyword arguments'
         | 
| 403 | 
            +
                    end
         | 
| 404 | 
            +
             | 
| 306 405 | 
             
                    # Apply all update validators before merging with super
         | 
| 307 406 | 
             
                    updates = @workflow_updates&.dup || {}
         | 
| 308 407 | 
             
                    @workflow_update_validators&.each_value do |validator|
         | 
| @@ -372,6 +471,10 @@ module Temporalio | |
| 372 471 |  | 
| 373 472 | 
             
                    raise 'Workflow cannot be given a name and be dynamic' if dynamic && override_name
         | 
| 374 473 |  | 
| 474 | 
            +
                    if !dynamic && !@dynamic_options_method.nil?
         | 
| 475 | 
            +
                      raise 'Workflow cannot have a dynamic_options_method unless it is dynamic'
         | 
| 476 | 
            +
                    end
         | 
| 477 | 
            +
             | 
| 375 478 | 
             
                    Info.new(
         | 
| 376 479 | 
             
                      workflow_class: self,
         | 
| 377 480 | 
             
                      override_name:,
         | 
| @@ -381,7 +484,11 @@ module Temporalio | |
| 381 484 | 
             
                      failure_exception_types: @workflow_failure_exception_types || [],
         | 
| 382 485 | 
             
                      signals:,
         | 
| 383 486 | 
             
                      queries:,
         | 
| 384 | 
            -
                      updates | 
| 487 | 
            +
                      updates:,
         | 
| 488 | 
            +
                      versioning_behavior: @versioning_behavior || VersioningBehavior::UNSPECIFIED,
         | 
| 489 | 
            +
                      dynamic_options_method: @dynamic_options_method,
         | 
| 490 | 
            +
                      arg_hints: @workflow_arg_hints,
         | 
| 491 | 
            +
                      result_hint: @workflow_result_hint
         | 
| 385 492 | 
             
                    )
         | 
| 386 493 | 
             
                  end
         | 
| 387 494 |  | 
| @@ -394,7 +501,8 @@ module Temporalio | |
| 394 501 | 
             
                  # Information about the workflow definition. This is usually not used directly.
         | 
| 395 502 | 
             
                  class Info
         | 
| 396 503 | 
             
                    attr_reader :workflow_class, :override_name, :dynamic, :init, :raw_args,
         | 
| 397 | 
            -
                                :failure_exception_types, :signals, :queries, :updates
         | 
| 504 | 
            +
                                :failure_exception_types, :signals, :queries, :updates, :versioning_behavior,
         | 
| 505 | 
            +
                                :dynamic_options_method, :arg_hints, :result_hint
         | 
| 398 506 |  | 
| 399 507 | 
             
                    # Derive the workflow definition info from the class.
         | 
| 400 508 | 
             
                    #
         | 
| @@ -419,7 +527,11 @@ module Temporalio | |
| 419 527 | 
             
                      failure_exception_types: [],
         | 
| 420 528 | 
             
                      signals: {},
         | 
| 421 529 | 
             
                      queries: {},
         | 
| 422 | 
            -
                      updates: {}
         | 
| 530 | 
            +
                      updates: {},
         | 
| 531 | 
            +
                      versioning_behavior: VersioningBehavior::UNSPECIFIED,
         | 
| 532 | 
            +
                      dynamic_options_method: nil,
         | 
| 533 | 
            +
                      arg_hints: nil,
         | 
| 534 | 
            +
                      result_hint: nil
         | 
| 423 535 | 
             
                    )
         | 
| 424 536 | 
             
                      @workflow_class = workflow_class
         | 
| 425 537 | 
             
                      @override_name = override_name
         | 
| @@ -430,6 +542,11 @@ module Temporalio | |
| 430 542 | 
             
                      @signals = signals.dup.freeze
         | 
| 431 543 | 
             
                      @queries = queries.dup.freeze
         | 
| 432 544 | 
             
                      @updates = updates.dup.freeze
         | 
| 545 | 
            +
                      @versioning_behavior = versioning_behavior
         | 
| 546 | 
            +
                      @dynamic_options_method = dynamic_options_method
         | 
| 547 | 
            +
                      @arg_hints = arg_hints
         | 
| 548 | 
            +
                      @result_hint = result_hint
         | 
| 549 | 
            +
                      Internal::ProtoUtils.assert_non_reserved_name(name)
         | 
| 433 550 | 
             
                    end
         | 
| 434 551 |  | 
| 435 552 | 
             
                    # @return [String] Workflow name.
         | 
| @@ -441,15 +558,17 @@ module Temporalio | |
| 441 558 | 
             
                  # A signal definition. This is usually built as a result of a {Definition.workflow_signal} method, but can be
         | 
| 442 559 | 
             
                  # manually created to set at runtime on {Workflow.signal_handlers}.
         | 
| 443 560 | 
             
                  class Signal
         | 
| 444 | 
            -
                    attr_reader :name, :to_invoke, :raw_args, :unfinished_policy
         | 
| 561 | 
            +
                    attr_reader :name, :to_invoke, :description, :raw_args, :unfinished_policy, :arg_hints
         | 
| 445 562 |  | 
| 446 563 | 
             
                    # @!visibility private
         | 
| 447 | 
            -
                    def self. | 
| 564 | 
            +
                    def self._name_and_hints_from_parameter(signal)
         | 
| 448 565 | 
             
                      case signal
         | 
| 449 566 | 
             
                      when Workflow::Definition::Signal
         | 
| 450 | 
            -
                         | 
| 567 | 
            +
                        raise(ArgumentError, 'Cannot call dynamic signal directly') unless signal.name
         | 
| 568 | 
            +
             | 
| 569 | 
            +
                        [signal.name, signal.arg_hints]
         | 
| 451 570 | 
             
                      when String, Symbol
         | 
| 452 | 
            -
                        signal.to_s
         | 
| 571 | 
            +
                        [signal.to_s, nil]
         | 
| 453 572 | 
             
                      else
         | 
| 454 573 | 
             
                        raise ArgumentError, 'Signal is not a definition or string/symbol'
         | 
| 455 574 | 
             
                      end
         | 
| @@ -460,34 +579,44 @@ module Temporalio | |
| 460 579 | 
             
                    #
         | 
| 461 580 | 
             
                    # @param name [String, nil] Name or nil if dynamic.
         | 
| 462 581 | 
             
                    # @param to_invoke [Symbol, Proc] Method name or proc to invoke.
         | 
| 582 | 
            +
                    # @param description [String, nil] Description for this handler that may appear in CLI/UI. This is currently
         | 
| 583 | 
            +
                    #   experimental.
         | 
| 463 584 | 
             
                    # @param raw_args [Boolean] Whether the parameters should be raw values.
         | 
| 464 585 | 
             
                    # @param unfinished_policy [HandlerUnfinishedPolicy] How the workflow reacts when this handler is still running
         | 
| 465 586 | 
             
                    #   on workflow completion.
         | 
| 587 | 
            +
                    # @param arg_hints [Array<Object>, nil] Argument hints for the signal.
         | 
| 466 588 | 
             
                    def initialize(
         | 
| 467 589 | 
             
                      name:,
         | 
| 468 590 | 
             
                      to_invoke:,
         | 
| 591 | 
            +
                      description: nil,
         | 
| 469 592 | 
             
                      raw_args: false,
         | 
| 470 | 
            -
                      unfinished_policy: HandlerUnfinishedPolicy::WARN_AND_ABANDON
         | 
| 593 | 
            +
                      unfinished_policy: HandlerUnfinishedPolicy::WARN_AND_ABANDON,
         | 
| 594 | 
            +
                      arg_hints: nil
         | 
| 471 595 | 
             
                    )
         | 
| 472 596 | 
             
                      @name = name
         | 
| 473 597 | 
             
                      @to_invoke = to_invoke
         | 
| 598 | 
            +
                      @description = description
         | 
| 474 599 | 
             
                      @raw_args = raw_args
         | 
| 475 600 | 
             
                      @unfinished_policy = unfinished_policy
         | 
| 601 | 
            +
                      @arg_hints = arg_hints
         | 
| 602 | 
            +
                      Internal::ProtoUtils.assert_non_reserved_name(name)
         | 
| 476 603 | 
             
                    end
         | 
| 477 604 | 
             
                  end
         | 
| 478 605 |  | 
| 479 606 | 
             
                  # A query definition. This is usually built as a result of a {Definition.workflow_query} method, but can be
         | 
| 480 607 | 
             
                  # manually created to set at runtime on {Workflow.query_handlers}.
         | 
| 481 608 | 
             
                  class Query
         | 
| 482 | 
            -
                    attr_reader :name, :to_invoke, :raw_args
         | 
| 609 | 
            +
                    attr_reader :name, :to_invoke, :description, :raw_args, :arg_hints, :result_hint
         | 
| 483 610 |  | 
| 484 611 | 
             
                    # @!visibility private
         | 
| 485 | 
            -
                    def self. | 
| 612 | 
            +
                    def self._name_and_hints_from_parameter(query)
         | 
| 486 613 | 
             
                      case query
         | 
| 487 614 | 
             
                      when Workflow::Definition::Query
         | 
| 488 | 
            -
                         | 
| 615 | 
            +
                        raise(ArgumentError, 'Cannot call dynamic query directly') unless query.name
         | 
| 616 | 
            +
             | 
| 617 | 
            +
                        [query.name, query.arg_hints, query.result_hint]
         | 
| 489 618 | 
             
                      when String, Symbol
         | 
| 490 | 
            -
                        query.to_s
         | 
| 619 | 
            +
                        [query.to_s, nil, nil]
         | 
| 491 620 | 
             
                      else
         | 
| 492 621 | 
             
                        raise ArgumentError, 'Query is not a definition or string/symbol'
         | 
| 493 622 | 
             
                      end
         | 
| @@ -498,30 +627,44 @@ module Temporalio | |
| 498 627 | 
             
                    #
         | 
| 499 628 | 
             
                    # @param name [String, nil] Name or nil if dynamic.
         | 
| 500 629 | 
             
                    # @param to_invoke [Symbol, Proc] Method name or proc to invoke.
         | 
| 630 | 
            +
                    # @param description [String, nil] Description for this handler that may appear in CLI/UI. This is currently
         | 
| 631 | 
            +
                    #   experimental.
         | 
| 501 632 | 
             
                    # @param raw_args [Boolean] Whether the parameters should be raw values.
         | 
| 633 | 
            +
                    # @param arg_hints [Array<Object>, nil] Argument hints for the query.
         | 
| 634 | 
            +
                    # @param result_hint [Object, nil] Result hints for the query.
         | 
| 502 635 | 
             
                    def initialize(
         | 
| 503 636 | 
             
                      name:,
         | 
| 504 637 | 
             
                      to_invoke:,
         | 
| 505 | 
            -
                       | 
| 638 | 
            +
                      description: nil,
         | 
| 639 | 
            +
                      raw_args: false,
         | 
| 640 | 
            +
                      arg_hints: nil,
         | 
| 641 | 
            +
                      result_hint: nil
         | 
| 506 642 | 
             
                    )
         | 
| 507 643 | 
             
                      @name = name
         | 
| 508 644 | 
             
                      @to_invoke = to_invoke
         | 
| 645 | 
            +
                      @description = description
         | 
| 509 646 | 
             
                      @raw_args = raw_args
         | 
| 647 | 
            +
                      @arg_hints = arg_hints
         | 
| 648 | 
            +
                      @result_hint = result_hint
         | 
| 649 | 
            +
                      Internal::ProtoUtils.assert_non_reserved_name(name)
         | 
| 510 650 | 
             
                    end
         | 
| 511 651 | 
             
                  end
         | 
| 512 652 |  | 
| 513 653 | 
             
                  # An update definition. This is usually built as a result of a {Definition.workflow_update} method, but can be
         | 
| 514 654 | 
             
                  # manually created to set at runtime on {Workflow.update_handlers}.
         | 
| 515 655 | 
             
                  class Update
         | 
| 516 | 
            -
                    attr_reader :name, :to_invoke, :raw_args, :unfinished_policy, :validator_to_invoke
         | 
| 656 | 
            +
                    attr_reader :name, :to_invoke, :description, :raw_args, :unfinished_policy, :validator_to_invoke,
         | 
| 657 | 
            +
                                :arg_hints, :result_hint
         | 
| 517 658 |  | 
| 518 659 | 
             
                    # @!visibility private
         | 
| 519 | 
            -
                    def self. | 
| 660 | 
            +
                    def self._name_and_hints_from_parameter(update)
         | 
| 520 661 | 
             
                      case update
         | 
| 521 662 | 
             
                      when Workflow::Definition::Update
         | 
| 522 | 
            -
                         | 
| 663 | 
            +
                        raise(ArgumentError, 'Cannot call dynamic update directly') unless update.name
         | 
| 664 | 
            +
             | 
| 665 | 
            +
                        [update.name, update.arg_hints, update.result_hint]
         | 
| 523 666 | 
             
                      when String, Symbol
         | 
| 524 | 
            -
                        update.to_s
         | 
| 667 | 
            +
                        [update.to_s, nil, nil]
         | 
| 525 668 | 
             
                      else
         | 
| 526 669 | 
             
                        raise ArgumentError, 'Update is not a definition or string/symbol'
         | 
| 527 670 | 
             
                      end
         | 
| @@ -532,22 +675,33 @@ module Temporalio | |
| 532 675 | 
             
                    #
         | 
| 533 676 | 
             
                    # @param name [String, nil] Name or nil if dynamic.
         | 
| 534 677 | 
             
                    # @param to_invoke [Symbol, Proc] Method name or proc to invoke.
         | 
| 678 | 
            +
                    # @param description [String, nil] Description for this handler that may appear in CLI/UI. This is currently
         | 
| 679 | 
            +
                    #   experimental.
         | 
| 535 680 | 
             
                    # @param raw_args [Boolean] Whether the parameters should be raw values.
         | 
| 536 681 | 
             
                    # @param unfinished_policy [HandlerUnfinishedPolicy] How the workflow reacts when this handler is still running
         | 
| 537 682 | 
             
                    #   on workflow completion.
         | 
| 538 683 | 
             
                    # @param validator_to_invoke [Symbol, Proc, nil] Method name or proc validator to invoke.
         | 
| 684 | 
            +
                    # @param arg_hints [Array<Object>, nil] Argument hints for the update.
         | 
| 685 | 
            +
                    # @param result_hint [Object, nil] Result hints for the update.
         | 
| 539 686 | 
             
                    def initialize(
         | 
| 540 687 | 
             
                      name:,
         | 
| 541 688 | 
             
                      to_invoke:,
         | 
| 689 | 
            +
                      description: nil,
         | 
| 542 690 | 
             
                      raw_args: false,
         | 
| 543 691 | 
             
                      unfinished_policy: HandlerUnfinishedPolicy::WARN_AND_ABANDON,
         | 
| 544 | 
            -
                      validator_to_invoke: nil
         | 
| 692 | 
            +
                      validator_to_invoke: nil,
         | 
| 693 | 
            +
                      arg_hints: nil,
         | 
| 694 | 
            +
                      result_hint: nil
         | 
| 545 695 | 
             
                    )
         | 
| 546 696 | 
             
                      @name = name
         | 
| 547 697 | 
             
                      @to_invoke = to_invoke
         | 
| 698 | 
            +
                      @description = description
         | 
| 548 699 | 
             
                      @raw_args = raw_args
         | 
| 549 700 | 
             
                      @unfinished_policy = unfinished_policy
         | 
| 550 701 | 
             
                      @validator_to_invoke = validator_to_invoke
         | 
| 702 | 
            +
                      @arg_hints = arg_hints
         | 
| 703 | 
            +
                      @result_hint = result_hint
         | 
| 704 | 
            +
                      Internal::ProtoUtils.assert_non_reserved_name(name)
         | 
| 551 705 | 
             
                    end
         | 
| 552 706 |  | 
| 553 707 | 
             
                    # @!visibility private
         | 
| @@ -555,12 +709,40 @@ module Temporalio | |
| 555 709 | 
             
                      Update.new(
         | 
| 556 710 | 
             
                        name:,
         | 
| 557 711 | 
             
                        to_invoke:,
         | 
| 712 | 
            +
                        description:,
         | 
| 558 713 | 
             
                        raw_args:,
         | 
| 559 714 | 
             
                        unfinished_policy:,
         | 
| 560 | 
            -
                        validator_to_invoke | 
| 715 | 
            +
                        validator_to_invoke:,
         | 
| 716 | 
            +
                        arg_hints:,
         | 
| 717 | 
            +
                        result_hint:
         | 
| 561 718 | 
             
                      )
         | 
| 562 719 | 
             
                    end
         | 
| 563 720 | 
             
                  end
         | 
| 564 721 | 
             
                end
         | 
| 722 | 
            +
             | 
| 723 | 
            +
                DefinitionOptions = Struct.new(
         | 
| 724 | 
            +
                  :failure_exception_types,
         | 
| 725 | 
            +
                  :versioning_behavior
         | 
| 726 | 
            +
                )
         | 
| 727 | 
            +
                # @!attribute failure_exception_types
         | 
| 728 | 
            +
                #   Dynamic equivalent of {Definition.workflow_failure_exception_type}.
         | 
| 729 | 
            +
                #   Will override any types set there if set, including if set to an empty array.
         | 
| 730 | 
            +
                #   @return [Array<Class<Exception>>, nil] The failure exception types
         | 
| 731 | 
            +
                #
         | 
| 732 | 
            +
                # @!attribute versioning_behavior
         | 
| 733 | 
            +
                #   Dynamic equivalent of {Definition.workflow_versioning_behavior}.
         | 
| 734 | 
            +
                #   Will override any behavior set there if set.
         | 
| 735 | 
            +
                #   WARNING: Deployment-based versioning is experimental and APIs may change.
         | 
| 736 | 
            +
                #   @return [VersioningBehavior, nil] The versioning behavior
         | 
| 737 | 
            +
                #
         | 
| 738 | 
            +
                # @return [VersioningBehavior, nil] The versioning behavior
         | 
| 739 | 
            +
                class DefinitionOptions
         | 
| 740 | 
            +
                  def initialize(
         | 
| 741 | 
            +
                    failure_exception_types: nil,
         | 
| 742 | 
            +
                    versioning_behavior: nil
         | 
| 743 | 
            +
                  )
         | 
| 744 | 
            +
                    super
         | 
| 745 | 
            +
                  end
         | 
| 746 | 
            +
                end
         | 
| 565 747 | 
             
              end
         | 
| 566 748 | 
             
            end
         | 
| @@ -28,7 +28,9 @@ module Temporalio | |
| 28 28 | 
             
                  # @param signal [Workflow::Definition::Signal, Symbol, String] Signal definition or name.
         | 
| 29 29 | 
             
                  # @param args [Array<Object>] Signal args.
         | 
| 30 30 | 
             
                  # @param cancellation [Cancellation] Cancellation for canceling the signalling.
         | 
| 31 | 
            -
                   | 
| 31 | 
            +
                  # @param arg_hints [Array<Object>, nil] Overrides converter hints for arguments if any. If unset/nil and the
         | 
| 32 | 
            +
                  #   signal definition has arg hints, those are used by default.
         | 
| 33 | 
            +
                  def signal(signal, *args, cancellation: Workflow.cancellation, arg_hints: nil)
         | 
| 32 34 | 
             
                    raise NotImplementedError
         | 
| 33 35 | 
             
                  end
         | 
| 34 36 |  | 
| @@ -8,7 +8,7 @@ module Temporalio | |
| 8 8 | 
             
                # workflows.
         | 
| 9 9 | 
             
                class Future
         | 
| 10 10 | 
             
                  # Return a future that completes when any of the given futures complete. The returned future will return the first
         | 
| 11 | 
            -
                  # completed  | 
| 11 | 
            +
                  # completed future's value or raise the first completed future's exception. To not raise the exception, see
         | 
| 12 12 | 
             
                  # {try_any_of}.
         | 
| 13 13 | 
             
                  #
         | 
| 14 14 | 
             
                  # @param futures [Array<Future<Object>>] Futures to wait for the first to complete.
         | 
| @@ -16,7 +16,7 @@ module Temporalio | |
| 16 16 | 
             
                  def self.any_of(*futures)
         | 
| 17 17 | 
             
                    Future.new do
         | 
| 18 18 | 
             
                      Workflow.wait_condition(cancellation: nil) { futures.any?(&:done?) }
         | 
| 19 | 
            -
                      # We know a future is always returned from find, the  | 
| 19 | 
            +
                      # We know a future is always returned from find, the || just helps type checker
         | 
| 20 20 | 
             
                      (futures.find(&:done?) || raise).wait
         | 
| 21 21 | 
             
                    end
         | 
| 22 22 | 
             
                  end
         | 
| @@ -7,11 +7,14 @@ module Temporalio | |
| 7 7 | 
             
                  :continued_run_id,
         | 
| 8 8 | 
             
                  :cron_schedule,
         | 
| 9 9 | 
             
                  :execution_timeout,
         | 
| 10 | 
            +
                  :headers,
         | 
| 10 11 | 
             
                  :last_failure,
         | 
| 11 12 | 
             
                  :last_result,
         | 
| 12 13 | 
             
                  :namespace,
         | 
| 13 14 | 
             
                  :parent,
         | 
| 15 | 
            +
                  :priority,
         | 
| 14 16 | 
             
                  :retry_policy,
         | 
| 17 | 
            +
                  :root,
         | 
| 15 18 | 
             
                  :run_id,
         | 
| 16 19 | 
             
                  :run_timeout,
         | 
| 17 20 | 
             
                  :start_time,
         | 
| @@ -32,6 +35,8 @@ module Temporalio | |
| 32 35 | 
             
                #   @return [String, nil] Cron schedule if applicable.
         | 
| 33 36 | 
             
                # @!attribute execution_timeout
         | 
| 34 37 | 
             
                #   @return [Float, nil] Execution timeout for the workflow.
         | 
| 38 | 
            +
                # @!attribute headers
         | 
| 39 | 
            +
                #   @return [Hash<String, Api::Common::V1::Payload>] Headers.
         | 
| 35 40 | 
             
                # @!attribute last_failure
         | 
| 36 41 | 
             
                #   @return [Exception, nil] Failure if this workflow run is a continuation of a failure.
         | 
| 37 42 | 
             
                # @!attribute last_result
         | 
| @@ -40,14 +45,19 @@ module Temporalio | |
| 40 45 | 
             
                #   @return [String] Namespace for the workflow.
         | 
| 41 46 | 
             
                # @!attribute parent
         | 
| 42 47 | 
             
                #   @return [ParentInfo, nil] Parent information for the workflow if this is a child.
         | 
| 48 | 
            +
                # @!attribute priority
         | 
| 49 | 
            +
                #   @return [Priority] The priority of this workflow.
         | 
| 43 50 | 
             
                # @!attribute retry_policy
         | 
| 44 51 | 
             
                #   @return [RetryPolicy, nil] Retry policy for the workflow.
         | 
| 52 | 
            +
                # @!attribute root
         | 
| 53 | 
            +
                #   @return [RootInfo, nil] Root information for the workflow. This is nil in pre-1.27.0 server versions or if there
         | 
| 54 | 
            +
                #     is no root (i.e. the root is itself).
         | 
| 45 55 | 
             
                # @!attribute run_id
         | 
| 46 56 | 
             
                #   @return [String] Run ID for the workflow.
         | 
| 47 57 | 
             
                # @!attribute run_timeout
         | 
| 48 58 | 
             
                #   @return [Float, nil] Run timeout for the workflow.
         | 
| 49 59 | 
             
                # @!attribute start_time
         | 
| 50 | 
            -
                #   @return [Time] Time when the workflow started.
         | 
| 60 | 
            +
                #   @return [Time] Time when the workflow started on the server.
         | 
| 51 61 | 
             
                # @!attribute task_queue
         | 
| 52 62 | 
             
                #   @return [String] Task queue for the workflow.
         | 
| 53 63 | 
             
                # @!attribute task_timeout
         | 
| @@ -77,6 +87,21 @@ module Temporalio | |
| 77 87 | 
             
                    :workflow_id,
         | 
| 78 88 | 
             
                    keyword_init: true
         | 
| 79 89 | 
             
                  )
         | 
| 90 | 
            +
             | 
| 91 | 
            +
                  # Information about a root of a workflow.
         | 
| 92 | 
            +
                  #
         | 
| 93 | 
            +
                  # @!attribute run_id
         | 
| 94 | 
            +
                  #   @return [String] Run ID for the root.
         | 
| 95 | 
            +
                  # @!attribute workflow_id
         | 
| 96 | 
            +
                  #   @return [String] Workflow ID for the root.
         | 
| 97 | 
            +
                  #
         | 
| 98 | 
            +
                  # @note WARNING: This class may have required parameters added to its constructor. Users should not instantiate
         | 
| 99 | 
            +
                  #   this class or it may break in incompatible ways.
         | 
| 100 | 
            +
                  RootInfo = Struct.new(
         | 
| 101 | 
            +
                    :run_id,
         | 
| 102 | 
            +
                    :workflow_id,
         | 
| 103 | 
            +
                    keyword_init: true
         | 
| 104 | 
            +
                  )
         | 
| 80 105 | 
             
                end
         | 
| 81 106 | 
             
              end
         | 
| 82 107 | 
             
            end
         |