temporalio 1.10.1 → 1.11.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 (109) hide show
  1. checksums.yaml +4 -4
  2. data/Cargo.lock +760 -767
  3. data/Gemfile +3 -2
  4. data/ext/Cargo.toml +3 -3
  5. data/lib/temporalio/api/activity/v1/message.rb +1 -1
  6. data/lib/temporalio/api/common/v1/message.rb +2 -1
  7. data/lib/temporalio/api/schedule/v1/message.rb +1 -1
  8. data/lib/temporalio/api/taskqueue/v1/message.rb +2 -1
  9. data/lib/temporalio/api/worker/v1/message.rb +1 -1
  10. data/lib/temporalio/api/workflowservice/v1/request_response.rb +1 -1
  11. data/lib/temporalio/client/connection.rb +4 -4
  12. data/lib/temporalio/contrib/aws/s3_driver/aws_sdk_s3_storage_driver_client.rb +52 -0
  13. data/lib/temporalio/contrib/aws/s3_driver/s3_storage_driver.rb +211 -0
  14. data/lib/temporalio/contrib/aws/s3_driver/s3_storage_driver_client.rb +56 -0
  15. data/lib/temporalio/contrib/aws/s3_driver.rb +22 -0
  16. data/lib/temporalio/contrib/open_telemetry.rb +1 -1
  17. data/lib/temporalio/converters/external_storage_concurrency.rb +4 -6
  18. data/lib/temporalio/converters/payload_converter/binary_protobuf.rb +1 -1
  19. data/lib/temporalio/converters/payload_converter/json_protobuf.rb +1 -1
  20. data/lib/temporalio/converters/storage_driver_limiter.rb +6 -8
  21. data/lib/temporalio/converters/storage_driver_retrieve_context.rb +1 -2
  22. data/lib/temporalio/converters/storage_driver_store_context.rb +1 -2
  23. data/lib/temporalio/env_config.rb +89 -8
  24. data/lib/temporalio/internal/bridge/api/activity_result/activity_result.rb +2 -2
  25. data/lib/temporalio/internal/bridge/api/activity_task/activity_task.rb +3 -1
  26. data/lib/temporalio/internal/bridge/api/workflow_activation/workflow_activation.rb +2 -1
  27. data/lib/temporalio/internal/bridge/testing.rb +4 -2
  28. data/lib/temporalio/internal/worker/workflow_instance/child_workflow_handle.rb +2 -2
  29. data/lib/temporalio/internal/worker/workflow_instance/context.rb +35 -24
  30. data/lib/temporalio/internal/worker/workflow_instance/external_workflow_handle.rb +6 -4
  31. data/lib/temporalio/internal/worker/workflow_instance/nexus_client.rb +3 -2
  32. data/lib/temporalio/internal/worker/workflow_instance/outbound_implementation.rb +52 -19
  33. data/lib/temporalio/internal/worker/workflow_instance/scheduler.rb +8 -2
  34. data/lib/temporalio/internal/worker/workflow_instance.rb +47 -26
  35. data/lib/temporalio/internal/worker/workflow_worker.rb +1 -2
  36. data/lib/temporalio/search_attributes.rb +4 -2
  37. data/lib/temporalio/testing/workflow_environment.rb +10 -2
  38. data/lib/temporalio/version.rb +1 -1
  39. data/lib/temporalio/worker/interceptor.rb +16 -8
  40. data/lib/temporalio/worker/workflow_replayer.rb +1 -1
  41. data/lib/temporalio/worker.rb +19 -12
  42. data/lib/temporalio/workflow/child_workflow_handle.rb +4 -1
  43. data/lib/temporalio/workflow/event_group.rb +157 -0
  44. data/lib/temporalio/workflow/external_workflow_handle.rb +9 -2
  45. data/lib/temporalio/workflow/future.rb +1 -1
  46. data/lib/temporalio/workflow/info.rb +4 -0
  47. data/lib/temporalio/workflow/nexus_client.rb +11 -3
  48. data/lib/temporalio/workflow.rb +114 -22
  49. data/rbi/temporalio/api/activity/v1/message.rbi +71 -2
  50. data/rbi/temporalio/api/common/v1/message.rbi +95 -0
  51. data/rbi/temporalio/api/schedule/v1/message.rbi +44 -4
  52. data/rbi/temporalio/api/taskqueue/v1/message.rbi +67 -0
  53. data/rbi/temporalio/api/worker/v1/message.rbi +22 -2
  54. data/rbi/temporalio/api/workflowservice/v1/request_response.rbi +126 -12
  55. data/rbi/temporalio/contrib/aws/s3_driver/aws_sdk_s3_storage_driver_client.rbi +8 -0
  56. data/rbi/temporalio/contrib/aws/s3_driver/s3_storage_driver.rbi +27 -0
  57. data/rbi/temporalio/contrib/aws/s3_driver/s3_storage_driver_client.rbi +17 -0
  58. data/rbi/temporalio/contrib/aws/s3_driver.rbi +5 -0
  59. data/rbi/temporalio/env_config.rbi +39 -4
  60. data/rbi/temporalio/internal/bridge/api/activity_result/activity_result.rbi +0 -19
  61. data/rbi/temporalio/internal/bridge/api/activity_task/activity_task.rbi +213 -2
  62. data/rbi/temporalio/internal/bridge/api/workflow_activation/workflow_activation.rbi +50 -4
  63. data/rbi/temporalio/internal/bridge/testing.rbi +17 -4
  64. data/rbi/temporalio/internal/bridge/worker.rbi +4 -4
  65. data/rbi/temporalio/internal/worker/workflow_instance/context.rbi +33 -24
  66. data/rbi/temporalio/internal/worker/workflow_instance/nexus_client.rbi +4 -2
  67. data/rbi/temporalio/internal/worker/workflow_instance/outbound_implementation.rbi +17 -6
  68. data/rbi/temporalio/internal/worker/workflow_instance/scheduler.rbi +1 -1
  69. data/rbi/temporalio/internal/worker/workflow_instance.rbi +5 -2
  70. data/rbi/temporalio/testing/workflow_environment.rbi +4 -0
  71. data/rbi/temporalio/worker/interceptor.rbi +24 -0
  72. data/rbi/temporalio/worker.rbi +8 -8
  73. data/rbi/temporalio/workflow/child_workflow_handle.rbi +3 -2
  74. data/rbi/temporalio/workflow/event_group.rbi +104 -0
  75. data/rbi/temporalio/workflow/external_workflow_handle.rbi +5 -4
  76. data/rbi/temporalio/workflow/info.rbi +3 -0
  77. data/rbi/temporalio/workflow/nexus_client.rbi +8 -4
  78. data/rbi/temporalio/workflow.rbi +70 -21
  79. data/sig/temporalio/api/activity/v1/message.rbs +31 -0
  80. data/sig/temporalio/api/common/v1/message.rbs +35 -0
  81. data/sig/temporalio/api/schedule/v1/message.rbs +20 -0
  82. data/sig/temporalio/api/taskqueue/v1/message.rbs +24 -0
  83. data/sig/temporalio/api/worker/v1/message.rbs +10 -0
  84. data/sig/temporalio/api/workflowservice/v1/request_response.rbs +58 -0
  85. data/sig/temporalio/contrib/aws/s3_driver/aws_sdk_s3_storage_driver_client.rbs +13 -0
  86. data/sig/temporalio/contrib/aws/s3_driver/s3_storage_driver.rbs +68 -0
  87. data/sig/temporalio/contrib/aws/s3_driver/s3_storage_driver_client.rbs +14 -0
  88. data/sig/temporalio/contrib/aws/s3_driver.rbs +8 -0
  89. data/sig/temporalio/env_config.rbs +20 -2
  90. data/sig/temporalio/internal/bridge/api/activity_result/activity_result.rbs +6 -41
  91. data/sig/temporalio/internal/bridge/api/activity_task/activity_task.rbs +99 -0
  92. data/sig/temporalio/internal/bridge/api/workflow_activation/workflow_activation.rbs +22 -0
  93. data/sig/temporalio/internal/bridge/testing.rbs +7 -3
  94. data/sig/temporalio/internal/bridge/worker.rbs +4 -4
  95. data/sig/temporalio/internal/worker/workflow_instance/context.rbs +19 -13
  96. data/sig/temporalio/internal/worker/workflow_instance/nexus_client.rbs +2 -1
  97. data/sig/temporalio/internal/worker/workflow_instance/outbound_implementation.rbs +8 -5
  98. data/sig/temporalio/internal/worker/workflow_instance/scheduler.rbs +1 -1
  99. data/sig/temporalio/internal/worker/workflow_instance.rbs +2 -1
  100. data/sig/temporalio/testing/workflow_environment.rbs +8 -4
  101. data/sig/temporalio/worker/interceptor.rbs +24 -8
  102. data/sig/temporalio/worker.rbs +12 -12
  103. data/sig/temporalio/workflow/child_workflow_handle.rbs +2 -1
  104. data/sig/temporalio/workflow/event_group.rbs +37 -0
  105. data/sig/temporalio/workflow/external_workflow_handle.rbs +3 -2
  106. data/sig/temporalio/workflow/info.rbs +2 -0
  107. data/sig/temporalio/workflow/nexus_client.rbs +4 -2
  108. data/sig/temporalio/workflow.rbs +27 -11
  109. metadata +16 -1
@@ -37,6 +37,9 @@ module Temporalio
37
37
  # @param cancellation [Cancellation] Cancellation for the operation.
38
38
  # @param arg_hint [Object, nil] Converter hint for the argument.
39
39
  # @param result_hint [Object, nil] Converter hint for the result.
40
+ # @param event_groups [Array<EventGroup>, nil] Event Groups to attach to the schedule command, in
41
+ # addition to any groups from enclosing {Workflow.with_event_groups} scopes.
42
+ # WARNING: This option is experimental.
40
43
  # @return [NexusOperationHandle] Handle to the started operation.
41
44
  def start_operation(
42
45
  operation,
@@ -48,7 +51,8 @@ module Temporalio
48
51
  summary: nil,
49
52
  cancellation: Workflow.cancellation,
50
53
  arg_hint: nil,
51
- result_hint: nil
54
+ result_hint: nil,
55
+ event_groups: nil
52
56
  )
53
57
  raise NotImplementedError
54
58
  end
@@ -69,6 +73,9 @@ module Temporalio
69
73
  # @param cancellation [Cancellation] Cancellation for the operation.
70
74
  # @param arg_hint [Object, nil] Converter hint for the argument.
71
75
  # @param result_hint [Object, nil] Converter hint for the result.
76
+ # @param event_groups [Array<EventGroup>, nil] Event Groups to attach to the schedule command, in
77
+ # addition to any groups from enclosing {Workflow.with_event_groups} scopes.
78
+ # WARNING: This option is experimental.
72
79
  # @return [Object] Result of the operation.
73
80
  # @raise [Error::NexusOperationError] Operation failed.
74
81
  def execute_operation(
@@ -81,11 +88,12 @@ module Temporalio
81
88
  summary: nil,
82
89
  cancellation: Workflow.cancellation,
83
90
  arg_hint: nil,
84
- result_hint: nil
91
+ result_hint: nil,
92
+ event_groups: nil
85
93
  )
86
94
  start_operation(
87
95
  operation, arg, schedule_to_close_timeout:, schedule_to_start_timeout:, start_to_close_timeout:,
88
- cancellation_type:, summary:, cancellation:, arg_hint:, result_hint:
96
+ cancellation_type:, summary:, cancellation:, arg_hint:, result_hint:, event_groups:
89
97
  ).result
90
98
  end
91
99
  end
@@ -9,6 +9,7 @@ require 'temporalio/workflow/activity_cancellation_type'
9
9
  require 'temporalio/workflow/child_workflow_cancellation_type'
10
10
  require 'temporalio/workflow/child_workflow_handle'
11
11
  require 'temporalio/workflow/definition'
12
+ require 'temporalio/workflow/event_group'
12
13
  require 'temporalio/workflow/external_workflow_handle'
13
14
  require 'temporalio/workflow/future'
14
15
  require 'temporalio/workflow/handler_unfinished_policy'
@@ -55,6 +56,43 @@ module Temporalio
55
56
  _current.create_nexus_client(endpoint:, service:)
56
57
  end
57
58
 
59
+ # Create an Event Group that can be attached to commands scheduled by this workflow.
60
+ #
61
+ # Attach the returned group via command `event_groups:` options, or via {with_event_groups}.
62
+ #
63
+ # WARNING: Event Groups support is experimental.
64
+ #
65
+ # @param id [String] Non-empty group identity. Commands with the same `id` belong to the same group. The
66
+ # user-provided ID is stored as plain text in the workflow history and should therefore not contain sensitive
67
+ # information.
68
+ # @param label [String, nil] Optional non-empty display text for the UI / CLI. If provided, it is persisted to
69
+ # history as a codec-encoded Payload.
70
+ # @return [EventGroup] Created Event Group.
71
+ def self.create_event_group(id, label: nil)
72
+ _current
73
+ raise ArgumentError, 'Event group id cannot be empty' if !id.is_a?(String) || id.empty?
74
+ raise ArgumentError, 'Event group label cannot be empty' if !label.nil? && (!label.is_a?(String) || label.empty?)
75
+
76
+ EventGroup::Label.new(id, label)
77
+ end
78
+
79
+ # Run the given block with one or more Event Groups attached to every command produced inside it.
80
+ #
81
+ # Nested scopes compose: a command produced inside an inner scope carries the Event Groups of all enclosing scopes.
82
+ # Fibers started within a scope inherit it, since they capture Fiber storage at creation.
83
+ #
84
+ # WARNING: Event Groups support is experimental.
85
+ #
86
+ # @param groups [Array<EventGroup>] Event Groups created via {create_event_group}.
87
+ # @yield Block to run with the given Event Groups in scope.
88
+ # @return [Object] Result of the block.
89
+ def self.with_event_groups(*groups, &)
90
+ raise ArgumentError, 'Block required' unless block_given?
91
+
92
+ _current
93
+ EventGroup._with_event_groups(*groups, &)
94
+ end
95
+
58
96
  # @return [Array<SuggestContinueAsNewReason::enum>] Reasons the server suggests continue-as-new. Empty if no
59
97
  # suggestion. This is currently experimental.
60
98
  def self.suggest_continue_as_new_reasons
@@ -122,8 +160,10 @@ module Temporalio
122
160
  # removed as well.
123
161
  #
124
162
  # @param patch_id [Symbol, String] Patch ID.
125
- def self.deprecate_patch(patch_id)
126
- _current.deprecate_patch(patch_id)
163
+ # @param event_groups [Array<EventGroup>, nil] Event Groups to attach to the patch marker command.
164
+ # WARNING: This option is experimental.
165
+ def self.deprecate_patch(patch_id, event_groups: nil)
166
+ _current.deprecate_patch(patch_id, event_groups:)
127
167
  end
128
168
 
129
169
  # Execute an activity and return its result. Either `start_to_close_timeout` or `schedule_to_close_timeout` _must_
@@ -164,6 +204,9 @@ module Temporalio
164
204
  # activity definition has arg hints, those are used by default.
165
205
  # @param result_hint [Object, nil] Overrides converter hint for result if any. If unset/nil and the activity
166
206
  # definition has result hint, it is used by default.
207
+ # @param event_groups [Array<EventGroup>, nil] Event Groups to attach to the activity command, in
208
+ # addition to any groups from enclosing {with_event_groups} scopes.
209
+ # WARNING: This option is experimental.
167
210
  #
168
211
  # @return [Object] Result of the activity.
169
212
  # @raise [Error::ActivityError] Activity failed (and retry was disabled or exhausted).
@@ -185,13 +228,14 @@ module Temporalio
185
228
  disable_eager_execution: false,
186
229
  priority: Priority.default,
187
230
  arg_hints: nil,
188
- result_hint: nil
231
+ result_hint: nil,
232
+ event_groups: nil
189
233
  )
190
234
  _current.execute_activity(
191
235
  activity, *args,
192
236
  task_queue:, summary:, schedule_to_close_timeout:, schedule_to_start_timeout:, start_to_close_timeout:,
193
237
  heartbeat_timeout:, retry_policy:, cancellation:, cancellation_type:, activity_id:, disable_eager_execution:,
194
- priority:, arg_hints:, result_hint:
238
+ priority:, arg_hints:, result_hint:, event_groups:
195
239
  )
196
240
  end
197
241
 
@@ -217,14 +261,15 @@ module Temporalio
217
261
  priority: Priority.default,
218
262
  versioning_override: nil,
219
263
  arg_hints: nil,
220
- result_hint: nil
264
+ result_hint: nil,
265
+ event_groups: nil
221
266
  )
222
267
  start_child_workflow(
223
268
  workflow, *args,
224
269
  id:, task_queue:, static_summary:, static_details:, cancellation:, cancellation_type:,
225
270
  parent_close_policy:, execution_timeout:, run_timeout:, task_timeout:, id_reuse_policy:,
226
271
  retry_policy:, cron_schedule:, memo:, search_attributes:, priority:, versioning_override:,
227
- arg_hints:, result_hint:
272
+ arg_hints:, result_hint:, event_groups:
228
273
  ).result
229
274
  end
230
275
 
@@ -261,6 +306,9 @@ module Temporalio
261
306
  # activity definition has arg hints, those are used by default.
262
307
  # @param result_hint [Object, nil] Overrides converter hint for result if any. If unset/nil and the activity
263
308
  # definition has result hint, it is used by default.
309
+ # @param event_groups [Array<EventGroup>, nil] Event Groups to attach to the activity command, in
310
+ # addition to any groups from enclosing {with_event_groups} scopes.
311
+ # WARNING: This option is experimental.
264
312
  #
265
313
  # @return [Object] Result of the activity.
266
314
  # @raise [Error::ActivityError] Activity failed (and retry was disabled or exhausted).
@@ -279,13 +327,14 @@ module Temporalio
279
327
  cancellation_type: ActivityCancellationType::TRY_CANCEL,
280
328
  activity_id: nil,
281
329
  arg_hints: nil,
282
- result_hint: nil
330
+ result_hint: nil,
331
+ event_groups: nil
283
332
  )
284
333
  _current.execute_local_activity(
285
334
  activity, *args,
286
335
  summary:, schedule_to_close_timeout:, schedule_to_start_timeout:, start_to_close_timeout:,
287
336
  retry_policy:, local_retry_threshold:, cancellation:, cancellation_type:,
288
- activity_id:, arg_hints:, result_hint:
337
+ activity_id:, arg_hints:, result_hint:, event_groups:
289
338
  )
290
339
  end
291
340
 
@@ -351,9 +400,11 @@ module Temporalio
351
400
  # deployments. That callback is only used when the patch marker would otherwise be created for the first time.
352
401
  #
353
402
  # @param patch_id [Symbol, String] Patch ID.
403
+ # @param event_groups [Array<EventGroup>, nil] Event Groups to attach to the patch marker command.
404
+ # WARNING: This option is experimental.
354
405
  # @return [Boolean] True if this should take the newer patch, false if it should take the old path.
355
- def self.patched(patch_id)
356
- _current.patched(patch_id)
406
+ def self.patched(patch_id, event_groups: nil)
407
+ _current.patched(patch_id, event_groups:)
357
408
  end
358
409
 
359
410
  # @return [Converters::PayloadConverter] Payload converter for the workflow.
@@ -398,9 +449,12 @@ module Temporalio
398
449
  # @param summary [String, nil] A simple string identifying this timer that may be visible in UI/CLI. While it can be
399
450
  # normal text, it is best to treat as a timer ID.
400
451
  # @param cancellation [Cancellation] Cancellation for this timer.
452
+ # @param event_groups [Array<EventGroup>, nil] Event Groups to attach to the timer command, in addition
453
+ # to any groups from enclosing {with_event_groups} scopes.
454
+ # WARNING: This option is experimental.
401
455
  # @raise [Error::CanceledError] Sleep canceled.
402
- def self.sleep(duration, summary: nil, cancellation: Workflow.cancellation)
403
- _current.sleep(duration, summary:, cancellation:)
456
+ def self.sleep(duration, summary: nil, cancellation: Workflow.cancellation, event_groups: nil)
457
+ _current.sleep(duration, summary:, cancellation:, event_groups:)
404
458
  end
405
459
 
406
460
  # Start a child workflow and return the handle.
@@ -435,6 +489,9 @@ module Temporalio
435
489
  # workflow definition has arg hints, those are used by default.
436
490
  # @param result_hint [Object, nil] Overrides converter hint for result if any. If unset/nil and the workflow
437
491
  # definition has result hint, it is used by default.
492
+ # @param event_groups [Array<EventGroup>, nil] Event Groups to attach to the start-child command, in
493
+ # addition to any groups from enclosing {with_event_groups} scopes.
494
+ # WARNING: This option is experimental.
438
495
  #
439
496
  # @return [ChildWorkflowHandle] Workflow handle to the started workflow.
440
497
  # @raise [Error::WorkflowAlreadyStartedError] Workflow already exists for the ID.
@@ -462,14 +519,15 @@ module Temporalio
462
519
  priority: Priority.default,
463
520
  versioning_override: nil,
464
521
  arg_hints: nil,
465
- result_hint: nil
522
+ result_hint: nil,
523
+ event_groups: nil
466
524
  )
467
525
  _current.start_child_workflow(
468
526
  workflow, *args,
469
527
  id:, task_queue:, static_summary:, static_details:, cancellation:, cancellation_type:,
470
528
  parent_close_policy:, execution_timeout:, run_timeout:, task_timeout:, id_reuse_policy:,
471
529
  retry_policy:, cron_schedule:, memo:, search_attributes:, priority:, versioning_override:,
472
- arg_hints:, result_hint:
530
+ arg_hints:, result_hint:, event_groups:
473
531
  )
474
532
  end
475
533
 
@@ -490,6 +548,10 @@ module Temporalio
490
548
  # {::Timeout.timeout}.
491
549
  # @param summary [String] Timer summary for the timer created by this timeout. This is backed by {sleep} so see that
492
550
  # method for details.
551
+ # @param event_groups [Array<EventGroup>, nil] Event Groups to attach to the timeout timer, in addition
552
+ # to any groups from enclosing {with_event_groups} scopes. Prefer this over {wait_condition} for
553
+ # wait-with-timeout.
554
+ # WARNING: This option is experimental.
493
555
  #
494
556
  # @yield Block to run with a timeout.
495
557
  # @return [Object] The result of the block.
@@ -499,9 +561,10 @@ module Temporalio
499
561
  exception_class = Timeout::Error,
500
562
  message = 'execution expired',
501
563
  summary: 'Timeout timer',
564
+ event_groups: nil,
502
565
  &
503
566
  )
504
- _current.timeout(duration, exception_class, message, summary:, &)
567
+ _current.timeout(duration, exception_class, message, summary:, event_groups:, &)
505
568
  end
506
569
 
507
570
  # @return [Hash<String, Definition::Update>] Update handlers for this workflow. This hash is mostly immutable except
@@ -513,18 +576,37 @@ module Temporalio
513
576
 
514
577
  # Issue updates to the workflow memo.
515
578
  #
516
- # @param hash [Hash{String, Symbol => Object, nil}] Updates to apply. Value can be `nil` to effectively remove the
517
- # memo value.
518
- def self.upsert_memo(hash)
519
- _current.upsert_memo(hash)
579
+ # @overload upsert_memo(hash, event_groups: nil)
580
+ # @param hash [Hash{String, Symbol => Object, nil}] Updates to apply. Value can be `nil` to effectively remove the
581
+ # memo value.
582
+ # @param event_groups [Array<EventGroup>, nil] Event Groups to attach to the modify-properties command.
583
+ # WARNING: This option is experimental.
584
+ # @overload upsert_memo(event_groups: nil, **memo)
585
+ # @param memo [Hash{String, Symbol => Object, nil}] Updates to apply. Value can be `nil` to effectively remove the
586
+ # memo value.
587
+ # @param event_groups [Array<EventGroup>, nil] Event Groups to attach to the modify-properties command.
588
+ # WARNING: This option is experimental.
589
+ def self.upsert_memo(hash = nil, event_groups: nil, **memo)
590
+ if hash
591
+ unless memo.empty?
592
+ raise ArgumentError, 'Memo updates must be passed either as a hash or as keyword arguments, not both'
593
+ end
594
+ else
595
+ hash = memo
596
+ end
597
+
598
+ _current.upsert_memo(hash, event_groups:)
520
599
  end
521
600
 
522
601
  # Issue updates to the workflow search attributes.
523
602
  #
524
603
  # @param updates [Array<SearchAttributes::Update>] Updates to apply. Note these are {SearchAttributes::Update}
525
604
  # objects which are created via {SearchAttributes::Key.value_set} and {SearchAttributes::Key.value_unset} methods.
526
- def self.upsert_search_attributes(*updates)
527
- _current.upsert_search_attributes(*updates)
605
+ # @param event_groups [Array<EventGroup>, nil] Event Groups to attach to the upsert-search-attributes
606
+ # command.
607
+ # WARNING: This option is experimental.
608
+ def self.upsert_search_attributes(*updates, event_groups: nil)
609
+ _current.upsert_search_attributes(*updates, event_groups:)
528
610
  end
529
611
 
530
612
  # Wait for the given block to return a "truthy" value (i.e. any value other than `false` or `nil`). The block must
@@ -661,6 +743,7 @@ module Temporalio
661
743
  :backoff_start_interval,
662
744
  :retry_policy, :memo, :search_attributes, :arg_hints, :headers,
663
745
  :initial_versioning_behavior
746
+ attr_reader :event_groups
664
747
 
665
748
  # Create a continue as new error.
666
749
  #
@@ -689,6 +772,8 @@ module Temporalio
689
772
  # first task of the new run. Set to {ContinueAsNewVersioningBehavior::AUTO_UPGRADE} to upgrade a pinned workflow
690
773
  # to the latest version on continue-as-new or {ContinueAsNewVersioningBehavior::USE_RAMPING_VERSION} to start on
691
774
  # the task queue's Ramping Version. This is currently experimental.
775
+ # @param event_groups [Array<EventGroup>, nil] Event Groups to attach to the continue-as-new command.
776
+ # WARNING: This option is experimental.
692
777
  def initialize(
693
778
  *args,
694
779
  workflow: nil,
@@ -701,7 +786,8 @@ module Temporalio
701
786
  search_attributes: nil,
702
787
  arg_hints: nil,
703
788
  headers: {},
704
- initial_versioning_behavior: nil
789
+ initial_versioning_behavior: nil,
790
+ event_groups: nil
705
791
  )
706
792
  super('Continue as new')
707
793
  @args = args
@@ -716,8 +802,14 @@ module Temporalio
716
802
  @arg_hints = arg_hints
717
803
  @headers = headers
718
804
  @initial_versioning_behavior = initial_versioning_behavior
805
+ @event_groups = event_groups
719
806
  Workflow._current.initialize_continue_as_new_error(self)
720
807
  end
808
+
809
+ # @!visibility private
810
+ private
811
+
812
+ attr_accessor :_event_group_markers
721
813
  end
722
814
 
723
815
  # Error raised when a workflow does something with a side effect in an improper context. In `initialize`, query
@@ -384,7 +384,10 @@ class Temporalio::Api::Activity::V1::ActivityExecutionInfo
384
384
  start_delay: T.nilable(Google::Protobuf::Duration),
385
385
  execution_time: T.nilable(Google::Protobuf::Timestamp),
386
386
  propagated_nexus_serialization_context: T.nilable(Temporalio::Api::Nexus::V1::PropagatedSerializationContext),
387
- eager_execution_accepted: T.nilable(T::Boolean)
387
+ eager_execution_accepted: T.nilable(T::Boolean),
388
+ started_by_principal: T.nilable(Temporalio::Api::Common::V1::ResolvedPrincipal),
389
+ closed_by_principal: T.nilable(Temporalio::Api::Common::V1::ResolvedPrincipal),
390
+ last_worker_principal: T.nilable(Temporalio::Api::Common::V1::ResolvedPrincipal)
388
391
  ).void
389
392
  end
390
393
  def initialize(
@@ -427,7 +430,10 @@ class Temporalio::Api::Activity::V1::ActivityExecutionInfo
427
430
  start_delay: nil,
428
431
  execution_time: nil,
429
432
  propagated_nexus_serialization_context: nil,
430
- eager_execution_accepted: false
433
+ eager_execution_accepted: false,
434
+ started_by_principal: nil,
435
+ closed_by_principal: nil,
436
+ last_worker_principal: nil
431
437
  )
432
438
  end
433
439
 
@@ -1097,6 +1103,69 @@ class Temporalio::Api::Activity::V1::ActivityExecutionInfo
1097
1103
  def clear_eager_execution_accepted
1098
1104
  end
1099
1105
 
1106
+ # Authenticated principal by which this activity execution was started.
1107
+ #
1108
+ # (-- api-linter: core::0140::prepositions=disabled
1109
+ # aip.dev/not-precedent: "by" identifies the authenticated actor. --)
1110
+ sig { returns(T.nilable(Temporalio::Api::Common::V1::ResolvedPrincipal)) }
1111
+ def started_by_principal
1112
+ end
1113
+
1114
+ # Authenticated principal by which this activity execution was started.
1115
+ #
1116
+ # (-- api-linter: core::0140::prepositions=disabled
1117
+ # aip.dev/not-precedent: "by" identifies the authenticated actor. --)
1118
+ sig { params(value: T.nilable(Temporalio::Api::Common::V1::ResolvedPrincipal)).void }
1119
+ def started_by_principal=(value)
1120
+ end
1121
+
1122
+ # Authenticated principal by which this activity execution was started.
1123
+ #
1124
+ # (-- api-linter: core::0140::prepositions=disabled
1125
+ # aip.dev/not-precedent: "by" identifies the authenticated actor. --)
1126
+ sig { void }
1127
+ def clear_started_by_principal
1128
+ end
1129
+
1130
+ # Authenticated principal by which this activity execution was closed.
1131
+ #
1132
+ # (-- api-linter: core::0140::prepositions=disabled
1133
+ # aip.dev/not-precedent: "by" identifies the authenticated actor. --)
1134
+ sig { returns(T.nilable(Temporalio::Api::Common::V1::ResolvedPrincipal)) }
1135
+ def closed_by_principal
1136
+ end
1137
+
1138
+ # Authenticated principal by which this activity execution was closed.
1139
+ #
1140
+ # (-- api-linter: core::0140::prepositions=disabled
1141
+ # aip.dev/not-precedent: "by" identifies the authenticated actor. --)
1142
+ sig { params(value: T.nilable(Temporalio::Api::Common::V1::ResolvedPrincipal)).void }
1143
+ def closed_by_principal=(value)
1144
+ end
1145
+
1146
+ # Authenticated principal by which this activity execution was closed.
1147
+ #
1148
+ # (-- api-linter: core::0140::prepositions=disabled
1149
+ # aip.dev/not-precedent: "by" identifies the authenticated actor. --)
1150
+ sig { void }
1151
+ def clear_closed_by_principal
1152
+ end
1153
+
1154
+ # Authenticated principal of the worker that most recently interacted with this activity execution.
1155
+ sig { returns(T.nilable(Temporalio::Api::Common::V1::ResolvedPrincipal)) }
1156
+ def last_worker_principal
1157
+ end
1158
+
1159
+ # Authenticated principal of the worker that most recently interacted with this activity execution.
1160
+ sig { params(value: T.nilable(Temporalio::Api::Common::V1::ResolvedPrincipal)).void }
1161
+ def last_worker_principal=(value)
1162
+ end
1163
+
1164
+ # Authenticated principal of the worker that most recently interacted with this activity execution.
1165
+ sig { void }
1166
+ def clear_last_worker_principal
1167
+ end
1168
+
1100
1169
  sig { params(field: String).returns(T.untyped) }
1101
1170
  def [](field)
1102
1171
  end
@@ -1634,6 +1634,101 @@ class Temporalio::Api::Common::V1::Principal
1634
1634
  end
1635
1635
  end
1636
1636
 
1637
+ # ResolvedPrincipal is a principal returned to an API caller.
1638
+ class Temporalio::Api::Common::V1::ResolvedPrincipal
1639
+ include ::Google::Protobuf::MessageExts
1640
+ extend ::Google::Protobuf::MessageExts::ClassMethods
1641
+
1642
+ sig do
1643
+ params(
1644
+ type: T.nilable(String),
1645
+ name_at_write_time: T.nilable(String)
1646
+ ).void
1647
+ end
1648
+ def initialize(
1649
+ type: "",
1650
+ name_at_write_time: ""
1651
+ )
1652
+ end
1653
+
1654
+ # Low-cardinality category of the principal (e.g., "jwt", "users").
1655
+ sig { returns(String) }
1656
+ def type
1657
+ end
1658
+
1659
+ # Low-cardinality category of the principal (e.g., "jwt", "users").
1660
+ sig { params(value: String).void }
1661
+ def type=(value)
1662
+ end
1663
+
1664
+ # Low-cardinality category of the principal (e.g., "jwt", "users").
1665
+ sig { void }
1666
+ def clear_type
1667
+ end
1668
+
1669
+ # Identifier within that category (e.g., sub JWT claim, email address).
1670
+ #
1671
+ # (-- api-linter: core::0140::prepositions=disabled
1672
+ # aip.dev/not-precedent: Identifies the principal name snapshot used for this response. --)
1673
+ # (-- api-linter: core::0142::time-field-type=disabled
1674
+ # aip.dev/not-precedent: This string is a principal name snapshot, not a timestamp. --)
1675
+ sig { returns(String) }
1676
+ def name_at_write_time
1677
+ end
1678
+
1679
+ # Identifier within that category (e.g., sub JWT claim, email address).
1680
+ #
1681
+ # (-- api-linter: core::0140::prepositions=disabled
1682
+ # aip.dev/not-precedent: Identifies the principal name snapshot used for this response. --)
1683
+ # (-- api-linter: core::0142::time-field-type=disabled
1684
+ # aip.dev/not-precedent: This string is a principal name snapshot, not a timestamp. --)
1685
+ sig { params(value: String).void }
1686
+ def name_at_write_time=(value)
1687
+ end
1688
+
1689
+ # Identifier within that category (e.g., sub JWT claim, email address).
1690
+ #
1691
+ # (-- api-linter: core::0140::prepositions=disabled
1692
+ # aip.dev/not-precedent: Identifies the principal name snapshot used for this response. --)
1693
+ # (-- api-linter: core::0142::time-field-type=disabled
1694
+ # aip.dev/not-precedent: This string is a principal name snapshot, not a timestamp. --)
1695
+ sig { void }
1696
+ def clear_name_at_write_time
1697
+ end
1698
+
1699
+ sig { params(field: String).returns(T.untyped) }
1700
+ def [](field)
1701
+ end
1702
+
1703
+ sig { params(field: String, value: T.untyped).void }
1704
+ def []=(field, value)
1705
+ end
1706
+
1707
+ sig { returns(T::Hash[Symbol, T.untyped]) }
1708
+ def to_h
1709
+ end
1710
+
1711
+ sig { params(str: String).returns(Temporalio::Api::Common::V1::ResolvedPrincipal) }
1712
+ def self.decode(str)
1713
+ end
1714
+
1715
+ sig { params(msg: Temporalio::Api::Common::V1::ResolvedPrincipal).returns(String) }
1716
+ def self.encode(msg)
1717
+ end
1718
+
1719
+ sig { params(str: String, kw: T.untyped).returns(Temporalio::Api::Common::V1::ResolvedPrincipal) }
1720
+ def self.decode_json(str, **kw)
1721
+ end
1722
+
1723
+ sig { params(msg: Temporalio::Api::Common::V1::ResolvedPrincipal, kw: T.untyped).returns(String) }
1724
+ def self.encode_json(msg, **kw)
1725
+ end
1726
+
1727
+ sig { returns(::Google::Protobuf::Descriptor) }
1728
+ def self.descriptor
1729
+ end
1730
+ end
1731
+
1637
1732
  # Priority contains metadata that controls relative ordering of task processing
1638
1733
  # when tasks are backed up in a queue. Initially, Priority will be used in
1639
1734
  # matching (workflow and activity) task queues. Later it may be used in history
@@ -1630,14 +1630,16 @@ class Temporalio::Api::Schedule::V1::SchedulePatch
1630
1630
  trigger_immediately: T.nilable(Temporalio::Api::Schedule::V1::TriggerImmediatelyRequest),
1631
1631
  backfill_request: T.nilable(T::Array[T.nilable(Temporalio::Api::Schedule::V1::BackfillRequest)]),
1632
1632
  pause: T.nilable(String),
1633
- unpause: T.nilable(String)
1633
+ unpause: T.nilable(String),
1634
+ time_skipping_config: T.nilable(Temporalio::Api::Common::V1::TimeSkippingConfig)
1634
1635
  ).void
1635
1636
  end
1636
1637
  def initialize(
1637
1638
  trigger_immediately: nil,
1638
1639
  backfill_request: [],
1639
1640
  pause: "",
1640
- unpause: ""
1641
+ unpause: "",
1642
+ time_skipping_config: nil
1641
1643
  )
1642
1644
  end
1643
1645
 
@@ -1707,6 +1709,24 @@ class Temporalio::Api::Schedule::V1::SchedulePatch
1707
1709
  def clear_unpause
1708
1710
  end
1709
1711
 
1712
+ # If set, applies the specified time-skipping configuration to this schedule,
1713
+ # replacing any existing time-skipping configuration.
1714
+ sig { returns(T.nilable(Temporalio::Api::Common::V1::TimeSkippingConfig)) }
1715
+ def time_skipping_config
1716
+ end
1717
+
1718
+ # If set, applies the specified time-skipping configuration to this schedule,
1719
+ # replacing any existing time-skipping configuration.
1720
+ sig { params(value: T.nilable(Temporalio::Api::Common::V1::TimeSkippingConfig)).void }
1721
+ def time_skipping_config=(value)
1722
+ end
1723
+
1724
+ # If set, applies the specified time-skipping configuration to this schedule,
1725
+ # replacing any existing time-skipping configuration.
1726
+ sig { void }
1727
+ def clear_time_skipping_config
1728
+ end
1729
+
1710
1730
  sig { params(field: String).returns(T.untyped) }
1711
1731
  def [](field)
1712
1732
  end
@@ -1757,7 +1777,8 @@ class Temporalio::Api::Schedule::V1::ScheduleInfo
1757
1777
  create_time: T.nilable(Google::Protobuf::Timestamp),
1758
1778
  update_time: T.nilable(Google::Protobuf::Timestamp),
1759
1779
  invalid_schedule_error: T.nilable(String),
1760
- state_size_bytes: T.nilable(Integer)
1780
+ state_size_bytes: T.nilable(Integer),
1781
+ time_skipping_info: T.nilable(Temporalio::Api::Common::V1::TimeSkippingInfo)
1761
1782
  ).void
1762
1783
  end
1763
1784
  def initialize(
@@ -1772,7 +1793,8 @@ class Temporalio::Api::Schedule::V1::ScheduleInfo
1772
1793
  create_time: nil,
1773
1794
  update_time: nil,
1774
1795
  invalid_schedule_error: "",
1775
- state_size_bytes: 0
1796
+ state_size_bytes: 0,
1797
+ time_skipping_info: nil
1776
1798
  )
1777
1799
  end
1778
1800
 
@@ -1971,6 +1993,24 @@ class Temporalio::Api::Schedule::V1::ScheduleInfo
1971
1993
  def clear_state_size_bytes
1972
1994
  end
1973
1995
 
1996
+ # Information about time skipping for this schedule.
1997
+ # If the schedule has never enabled time skipping, this will be unset.
1998
+ sig { returns(T.nilable(Temporalio::Api::Common::V1::TimeSkippingInfo)) }
1999
+ def time_skipping_info
2000
+ end
2001
+
2002
+ # Information about time skipping for this schedule.
2003
+ # If the schedule has never enabled time skipping, this will be unset.
2004
+ sig { params(value: T.nilable(Temporalio::Api::Common::V1::TimeSkippingInfo)).void }
2005
+ def time_skipping_info=(value)
2006
+ end
2007
+
2008
+ # Information about time skipping for this schedule.
2009
+ # If the schedule has never enabled time skipping, this will be unset.
2010
+ sig { void }
2011
+ def clear_time_skipping_info
2012
+ end
2013
+
1974
2014
  sig { params(field: String).returns(T.untyped) }
1975
2015
  def [](field)
1976
2016
  end