@temporalio/core-bridge 1.14.2-canary-release-testing.0 → 1.16.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 (233) hide show
  1. package/Cargo.lock +794 -650
  2. package/bridge-macros/src/derive_tryintojs.rs +40 -0
  3. package/lib/native.d.ts +24 -3
  4. package/package.json +4 -4
  5. package/releases/aarch64-apple-darwin/index.node +0 -0
  6. package/releases/aarch64-unknown-linux-gnu/index.node +0 -0
  7. package/releases/x86_64-apple-darwin/index.node +0 -0
  8. package/releases/x86_64-pc-windows-msvc/index.node +0 -0
  9. package/releases/x86_64-unknown-linux-gnu/index.node +0 -0
  10. package/sdk-core/.github/workflows/per-pr.yml +6 -6
  11. package/sdk-core/AGENTS.md +42 -31
  12. package/sdk-core/Cargo.toml +4 -1
  13. package/sdk-core/README.md +19 -13
  14. package/sdk-core/crates/client/Cargo.toml +4 -0
  15. package/sdk-core/crates/client/README.md +139 -0
  16. package/sdk-core/crates/client/src/async_activity_handle.rs +297 -0
  17. package/sdk-core/crates/client/src/callback_based.rs +7 -0
  18. package/sdk-core/crates/client/src/errors.rs +294 -0
  19. package/sdk-core/crates/client/src/{raw.rs → grpc.rs} +370 -159
  20. package/sdk-core/crates/client/src/lib.rs +920 -1326
  21. package/sdk-core/crates/client/src/metrics.rs +24 -33
  22. package/sdk-core/crates/client/src/options_structs.rs +457 -0
  23. package/sdk-core/crates/client/src/replaceable.rs +5 -4
  24. package/sdk-core/crates/client/src/request_extensions.rs +8 -9
  25. package/sdk-core/crates/client/src/retry.rs +99 -54
  26. package/sdk-core/crates/client/src/{worker/mod.rs → worker.rs} +104 -29
  27. package/sdk-core/crates/client/src/workflow_handle.rs +826 -0
  28. package/sdk-core/crates/common/Cargo.toml +62 -3
  29. package/sdk-core/crates/common/build.rs +742 -12
  30. package/sdk-core/crates/common/protos/api_upstream/.github/workflows/ci.yml +2 -0
  31. package/sdk-core/crates/common/protos/api_upstream/.github/workflows/create-release.yml +0 -5
  32. package/sdk-core/crates/common/protos/api_upstream/Makefile +2 -1
  33. package/sdk-core/crates/common/protos/api_upstream/README.md +8 -0
  34. package/sdk-core/crates/common/protos/api_upstream/cmd/check-path-conflicts/main.go +137 -0
  35. package/sdk-core/crates/common/protos/api_upstream/openapi/openapiv2.json +3329 -2647
  36. package/sdk-core/crates/common/protos/api_upstream/openapi/openapiv3.yaml +2734 -708
  37. package/sdk-core/crates/common/protos/api_upstream/temporal/api/activity/v1/message.proto +155 -3
  38. package/sdk-core/crates/common/protos/api_upstream/temporal/api/command/v1/message.proto +26 -0
  39. package/sdk-core/crates/common/protos/api_upstream/temporal/api/common/v1/message.proto +8 -1
  40. package/sdk-core/crates/common/protos/api_upstream/temporal/api/deployment/v1/message.proto +27 -1
  41. package/sdk-core/crates/common/protos/api_upstream/temporal/api/enums/v1/activity.proto +81 -0
  42. package/sdk-core/crates/common/protos/api_upstream/temporal/api/enums/v1/event_type.proto +4 -0
  43. package/sdk-core/crates/common/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +4 -0
  44. package/sdk-core/crates/common/protos/api_upstream/temporal/api/enums/v1/task_queue.proto +15 -0
  45. package/sdk-core/crates/common/protos/api_upstream/temporal/api/enums/v1/workflow.proto +63 -15
  46. package/sdk-core/crates/common/protos/api_upstream/temporal/api/errordetails/v1/message.proto +8 -0
  47. package/sdk-core/crates/common/protos/api_upstream/temporal/api/failure/v1/message.proto +1 -0
  48. package/sdk-core/crates/common/protos/api_upstream/temporal/api/history/v1/message.proto +111 -17
  49. package/sdk-core/crates/common/protos/api_upstream/temporal/api/namespace/v1/message.proto +21 -0
  50. package/sdk-core/crates/common/protos/api_upstream/temporal/api/nexus/v1/message.proto +20 -1
  51. package/sdk-core/crates/common/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +4 -0
  52. package/sdk-core/crates/common/protos/api_upstream/temporal/api/schedule/v1/message.proto +2 -2
  53. package/sdk-core/crates/common/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +2 -0
  54. package/sdk-core/crates/common/protos/api_upstream/temporal/api/worker/v1/message.proto +4 -7
  55. package/sdk-core/crates/common/protos/api_upstream/temporal/api/workflow/v1/message.proto +80 -22
  56. package/sdk-core/crates/common/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +347 -23
  57. package/sdk-core/crates/common/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +242 -43
  58. package/sdk-core/crates/common/protos/local/temporal/sdk/core/core_interface.proto +15 -0
  59. package/sdk-core/crates/common/protos/local/temporal/sdk/core/nexus/nexus.proto +9 -2
  60. package/sdk-core/crates/common/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +8 -0
  61. package/sdk-core/crates/common/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +22 -5
  62. package/sdk-core/crates/common/src/activity_definition.rs +20 -0
  63. package/sdk-core/crates/common/src/data_converters.rs +770 -0
  64. package/sdk-core/crates/common/src/envconfig.rs +5 -0
  65. package/sdk-core/crates/common/src/lib.rs +15 -211
  66. package/sdk-core/crates/common/src/payload_visitor.rs +648 -0
  67. package/sdk-core/crates/common/src/priority.rs +110 -0
  68. package/sdk-core/crates/common/src/protos/canned_histories.rs +19 -0
  69. package/sdk-core/crates/common/src/protos/history_builder.rs +45 -0
  70. package/sdk-core/crates/common/src/protos/history_info.rs +2 -0
  71. package/sdk-core/crates/common/src/protos/mod.rs +134 -27
  72. package/sdk-core/crates/common/src/protos/task_token.rs +3 -3
  73. package/sdk-core/crates/common/src/protos/utilities.rs +11 -0
  74. package/sdk-core/crates/{sdk-core → common}/src/telemetry/log_export.rs +11 -16
  75. package/sdk-core/crates/common/src/telemetry/metrics/core.rs +125 -0
  76. package/sdk-core/crates/common/src/telemetry/metrics.rs +272 -225
  77. package/sdk-core/crates/{sdk-core → common}/src/telemetry/otel.rs +8 -13
  78. package/sdk-core/crates/{sdk-core → common}/src/telemetry/prometheus_meter.rs +49 -50
  79. package/sdk-core/crates/{sdk-core → common}/src/telemetry/prometheus_server.rs +2 -3
  80. package/sdk-core/crates/common/src/telemetry.rs +278 -19
  81. package/sdk-core/crates/common/src/worker.rs +68 -636
  82. package/sdk-core/crates/common/src/workflow_definition.rs +60 -0
  83. package/sdk-core/crates/macros/Cargo.toml +5 -1
  84. package/sdk-core/crates/macros/src/activities_definitions.rs +585 -0
  85. package/sdk-core/crates/macros/src/fsm_impl.rs +507 -0
  86. package/sdk-core/crates/macros/src/lib.rs +138 -512
  87. package/sdk-core/crates/macros/src/macro_utils.rs +106 -0
  88. package/sdk-core/crates/macros/src/workflow_definitions.rs +1224 -0
  89. package/sdk-core/crates/sdk/Cargo.toml +19 -6
  90. package/sdk-core/crates/sdk/README.md +415 -0
  91. package/sdk-core/crates/sdk/src/activities.rs +417 -0
  92. package/sdk-core/crates/sdk/src/interceptors.rs +1 -1
  93. package/sdk-core/crates/sdk/src/lib.rs +759 -442
  94. package/sdk-core/crates/sdk/src/workflow_context/options.rs +64 -35
  95. package/sdk-core/crates/sdk/src/workflow_context.rs +1033 -289
  96. package/sdk-core/crates/sdk/src/workflow_future.rs +277 -213
  97. package/sdk-core/crates/sdk/src/workflows.rs +711 -0
  98. package/sdk-core/crates/sdk-core/Cargo.toml +59 -65
  99. package/sdk-core/crates/sdk-core/benches/workflow_replay_bench.rs +45 -54
  100. package/sdk-core/crates/sdk-core/machine_coverage/ActivityMachine_Coverage.puml +1 -1
  101. package/sdk-core/crates/sdk-core/src/abstractions.rs +6 -10
  102. package/sdk-core/crates/sdk-core/src/core_tests/activity_tasks.rs +6 -5
  103. package/sdk-core/crates/sdk-core/src/core_tests/mod.rs +22 -21
  104. package/sdk-core/crates/sdk-core/src/core_tests/queries.rs +21 -25
  105. package/sdk-core/crates/sdk-core/src/core_tests/replay_flag.rs +7 -10
  106. package/sdk-core/crates/sdk-core/src/core_tests/updates.rs +14 -17
  107. package/sdk-core/crates/sdk-core/src/core_tests/workers.rs +647 -27
  108. package/sdk-core/crates/sdk-core/src/core_tests/workflow_tasks.rs +46 -41
  109. package/sdk-core/crates/sdk-core/src/ephemeral_server/mod.rs +13 -16
  110. package/sdk-core/crates/sdk-core/src/histfetch.rs +20 -10
  111. package/sdk-core/crates/sdk-core/src/lib.rs +60 -123
  112. package/sdk-core/crates/sdk-core/src/pollers/mod.rs +4 -9
  113. package/sdk-core/crates/sdk-core/src/pollers/poll_buffer.rs +411 -32
  114. package/sdk-core/crates/sdk-core/src/protosext/mod.rs +2 -2
  115. package/sdk-core/crates/sdk-core/src/replay/mod.rs +14 -5
  116. package/sdk-core/crates/sdk-core/src/telemetry/metrics.rs +183 -198
  117. package/sdk-core/crates/sdk-core/src/telemetry/mod.rs +3 -281
  118. package/sdk-core/crates/sdk-core/src/test_help/integ_helpers.rs +35 -16
  119. package/sdk-core/crates/sdk-core/src/test_help/unit_helpers.rs +3 -6
  120. package/sdk-core/crates/sdk-core/src/worker/activities/activity_heartbeat_manager.rs +1 -0
  121. package/sdk-core/crates/sdk-core/src/worker/activities/local_activities.rs +11 -14
  122. package/sdk-core/crates/sdk-core/src/worker/activities.rs +16 -19
  123. package/sdk-core/crates/sdk-core/src/worker/client/mocks.rs +11 -5
  124. package/sdk-core/crates/sdk-core/src/worker/client.rs +104 -86
  125. package/sdk-core/crates/sdk-core/src/worker/heartbeat.rs +10 -14
  126. package/sdk-core/crates/sdk-core/src/worker/mod.rs +1175 -241
  127. package/sdk-core/crates/sdk-core/src/worker/nexus.rs +150 -23
  128. package/sdk-core/crates/sdk-core/src/worker/slot_provider.rs +2 -2
  129. package/sdk-core/crates/sdk-core/src/worker/tuner/fixed_size.rs +2 -2
  130. package/sdk-core/crates/sdk-core/src/worker/tuner/resource_based.rs +25 -27
  131. package/sdk-core/crates/sdk-core/src/worker/tuner.rs +64 -44
  132. package/sdk-core/crates/sdk-core/src/worker/workflow/driven_workflow.rs +9 -3
  133. package/sdk-core/crates/sdk-core/src/worker/workflow/machines/patch_state_machine.rs +5 -8
  134. package/sdk-core/crates/sdk-core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +21 -22
  135. package/sdk-core/crates/sdk-core/src/worker/workflow/machines/workflow_machines.rs +28 -4
  136. package/sdk-core/crates/sdk-core/src/worker/workflow/managed_run.rs +20 -41
  137. package/sdk-core/crates/sdk-core/src/worker/workflow/mod.rs +50 -9
  138. package/sdk-core/crates/sdk-core/src/worker/workflow/run_cache.rs +4 -7
  139. package/sdk-core/crates/sdk-core/src/worker/workflow/wft_extraction.rs +2 -4
  140. package/sdk-core/crates/sdk-core/src/worker/workflow/wft_poller.rs +8 -9
  141. package/sdk-core/crates/sdk-core/src/worker/workflow/workflow_stream.rs +1 -3
  142. package/sdk-core/crates/sdk-core/tests/activities_procmacro.rs +6 -0
  143. package/sdk-core/crates/sdk-core/tests/activities_trybuild/basic_pass.rs +54 -0
  144. package/sdk-core/crates/sdk-core/tests/activities_trybuild/invalid_self_type_fail.rs +18 -0
  145. package/sdk-core/crates/sdk-core/tests/activities_trybuild/invalid_self_type_fail.stderr +5 -0
  146. package/sdk-core/crates/sdk-core/tests/activities_trybuild/missing_context_fail.rs +14 -0
  147. package/sdk-core/crates/sdk-core/tests/activities_trybuild/missing_context_fail.stderr +5 -0
  148. package/sdk-core/crates/sdk-core/tests/activities_trybuild/multi_arg_pass.rs +48 -0
  149. package/sdk-core/crates/sdk-core/tests/activities_trybuild/no_input_pass.rs +14 -0
  150. package/sdk-core/crates/sdk-core/tests/activities_trybuild/no_return_type_pass.rs +19 -0
  151. package/sdk-core/crates/sdk-core/tests/cloud_tests.rs +14 -5
  152. package/sdk-core/crates/sdk-core/tests/common/activity_functions.rs +55 -0
  153. package/sdk-core/crates/sdk-core/tests/common/mod.rs +281 -236
  154. package/sdk-core/crates/sdk-core/tests/common/workflows.rs +41 -28
  155. package/sdk-core/crates/sdk-core/tests/global_metric_tests.rs +9 -14
  156. package/sdk-core/crates/sdk-core/tests/heavy_tests/fuzzy_workflow.rs +73 -66
  157. package/sdk-core/crates/sdk-core/tests/heavy_tests.rs +306 -268
  158. package/sdk-core/crates/sdk-core/tests/integ_tests/async_activity_client_tests.rs +230 -0
  159. package/sdk-core/crates/sdk-core/tests/integ_tests/client_tests.rs +94 -57
  160. package/sdk-core/crates/sdk-core/tests/integ_tests/data_converter_tests.rs +381 -0
  161. package/sdk-core/crates/sdk-core/tests/integ_tests/ephemeral_server_tests.rs +37 -38
  162. package/sdk-core/crates/sdk-core/tests/integ_tests/heartbeat_tests.rs +49 -40
  163. package/sdk-core/crates/sdk-core/tests/integ_tests/metrics_tests.rs +447 -300
  164. package/sdk-core/crates/sdk-core/tests/integ_tests/pagination_tests.rs +50 -45
  165. package/sdk-core/crates/sdk-core/tests/integ_tests/polling_tests.rs +157 -157
  166. package/sdk-core/crates/sdk-core/tests/integ_tests/queries_tests.rs +103 -89
  167. package/sdk-core/crates/sdk-core/tests/integ_tests/update_tests.rs +609 -463
  168. package/sdk-core/crates/sdk-core/tests/integ_tests/visibility_tests.rs +80 -62
  169. package/sdk-core/crates/sdk-core/tests/integ_tests/worker_heartbeat_tests.rs +389 -265
  170. package/sdk-core/crates/sdk-core/tests/integ_tests/worker_tests.rs +250 -185
  171. package/sdk-core/crates/sdk-core/tests/integ_tests/worker_versioning_tests.rs +52 -49
  172. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_client_tests.rs +180 -0
  173. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/activities.rs +437 -327
  174. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +82 -58
  175. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +56 -30
  176. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +364 -251
  177. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/client_interactions.rs +552 -0
  178. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +110 -46
  179. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +243 -149
  180. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/eager.rs +98 -32
  181. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +1475 -1040
  182. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/modify_wf_properties.rs +73 -43
  183. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/nexus.rs +402 -245
  184. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/patches.rs +343 -207
  185. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/queries.rs +415 -0
  186. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/replay.rs +96 -36
  187. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/resets.rs +155 -140
  188. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/signals.rs +183 -113
  189. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/stickyness.rs +85 -44
  190. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/timers.rs +142 -48
  191. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/upsert_search_attrs.rs +73 -56
  192. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests.rs +365 -242
  193. package/sdk-core/crates/sdk-core/tests/main.rs +22 -16
  194. package/sdk-core/crates/sdk-core/tests/manual_tests.rs +233 -187
  195. package/sdk-core/crates/sdk-core/tests/runner.rs +4 -6
  196. package/sdk-core/crates/sdk-core/tests/shared_tests/mod.rs +73 -27
  197. package/sdk-core/crates/sdk-core/tests/shared_tests/priority.rs +107 -84
  198. package/sdk-core/crates/sdk-core/tests/workflows_procmacro.rs +6 -0
  199. package/sdk-core/crates/sdk-core/tests/workflows_trybuild/async_query_fail.rs +26 -0
  200. package/sdk-core/crates/sdk-core/tests/workflows_trybuild/async_query_fail.stderr +5 -0
  201. package/sdk-core/crates/sdk-core/tests/workflows_trybuild/basic_pass.rs +49 -0
  202. package/sdk-core/crates/sdk-core/tests/workflows_trybuild/minimal_pass.rs +21 -0
  203. package/sdk-core/crates/sdk-core/tests/workflows_trybuild/mut_query_fail.rs +26 -0
  204. package/sdk-core/crates/sdk-core/tests/workflows_trybuild/mut_query_fail.stderr +5 -0
  205. package/sdk-core/crates/sdk-core/tests/workflows_trybuild/sync_run_fail.rs +21 -0
  206. package/sdk-core/crates/sdk-core/tests/workflows_trybuild/sync_run_fail.stderr +5 -0
  207. package/sdk-core/crates/sdk-core-c-bridge/Cargo.toml +8 -1
  208. package/sdk-core/crates/sdk-core-c-bridge/include/temporal-sdk-core-c-bridge.h +37 -26
  209. package/sdk-core/crates/sdk-core-c-bridge/src/client.rs +180 -87
  210. package/sdk-core/crates/sdk-core-c-bridge/src/lib.rs +89 -5
  211. package/sdk-core/crates/sdk-core-c-bridge/src/metric.rs +10 -16
  212. package/sdk-core/crates/sdk-core-c-bridge/src/runtime.rs +59 -67
  213. package/sdk-core/crates/sdk-core-c-bridge/src/testing.rs +10 -10
  214. package/sdk-core/crates/sdk-core-c-bridge/src/tests/context.rs +57 -22
  215. package/sdk-core/crates/sdk-core-c-bridge/src/tests/mod.rs +108 -12
  216. package/sdk-core/crates/sdk-core-c-bridge/src/tests/utils.rs +9 -52
  217. package/sdk-core/crates/sdk-core-c-bridge/src/worker.rs +74 -91
  218. package/sdk-core/rustfmt.toml +2 -1
  219. package/src/client.rs +206 -289
  220. package/src/helpers/try_into_js.rs +88 -2
  221. package/src/metrics.rs +277 -35
  222. package/src/runtime.rs +94 -45
  223. package/src/testing.rs +9 -16
  224. package/src/worker.rs +86 -68
  225. package/ts/native.ts +39 -3
  226. package/sdk-core/crates/client/src/workflow_handle/mod.rs +0 -212
  227. package/sdk-core/crates/common/src/errors.rs +0 -85
  228. package/sdk-core/crates/common/tests/worker_task_types_test.rs +0 -129
  229. package/sdk-core/crates/macros/LICENSE.txt +0 -21
  230. package/sdk-core/crates/sdk/src/activity_context.rs +0 -238
  231. package/sdk-core/crates/sdk/src/app_data.rs +0 -37
  232. package/sdk-core/crates/sdk-core/tests/integ_tests/activity_functions.rs +0 -5
  233. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/appdata_propagation.rs +0 -61
@@ -1,6 +1,6 @@
1
1
  use std::{collections::HashMap, time::Duration};
2
2
 
3
- use temporalio_client::{Priority, WorkflowOptions};
3
+ use temporalio_client::Priority;
4
4
  use temporalio_common::protos::{
5
5
  coresdk::{
6
6
  AsJsonPayloadExt,
@@ -12,8 +12,8 @@ use temporalio_common::protos::{
12
12
  },
13
13
  },
14
14
  temporal::api::{
15
- common::v1::{Payload, RetryPolicy},
16
- enums::v1::ParentClosePolicy,
15
+ common::v1::{Payload, RetryPolicy, SearchAttributes},
16
+ enums::v1::{ParentClosePolicy, WorkflowIdReusePolicy},
17
17
  sdk::v1::UserMetadata,
18
18
  },
19
19
  };
@@ -33,10 +33,6 @@ pub struct ActivityOptions {
33
33
  ///
34
34
  /// If `None` use the context's sequence number
35
35
  pub activity_id: Option<String>,
36
- /// Type of activity to schedule
37
- pub activity_type: String,
38
- /// Input to the activity
39
- pub input: Payload,
40
36
  /// Task queue to schedule the activity in
41
37
  ///
42
38
  /// If `None`, use the same task queue as the parent workflow.
@@ -76,8 +72,13 @@ pub struct ActivityOptions {
76
72
  pub do_not_eagerly_execute: bool,
77
73
  }
78
74
 
79
- impl IntoWorkflowCommand for ActivityOptions {
80
- fn into_command(self, seq: u32) -> WorkflowCommand {
75
+ impl ActivityOptions {
76
+ pub(crate) fn into_command(
77
+ self,
78
+ activity_type: String,
79
+ arguments: Vec<Payload>,
80
+ seq: u32,
81
+ ) -> WorkflowCommand {
81
82
  WorkflowCommand {
82
83
  variant: Some(
83
84
  ScheduleActivity {
@@ -86,7 +87,7 @@ impl IntoWorkflowCommand for ActivityOptions {
86
87
  None => seq.to_string(),
87
88
  Some(aid) => aid,
88
89
  },
89
- activity_type: self.activity_type,
90
+ activity_type,
90
91
  task_queue: self.task_queue.unwrap_or_default(),
91
92
  schedule_to_close_timeout: self
92
93
  .schedule_to_close_timeout
@@ -99,7 +100,7 @@ impl IntoWorkflowCommand for ActivityOptions {
99
100
  .and_then(|d| d.try_into().ok()),
100
101
  heartbeat_timeout: self.heartbeat_timeout.and_then(|d| d.try_into().ok()),
101
102
  cancellation_type: self.cancellation_type as i32,
102
- arguments: vec![self.input],
103
+ arguments,
103
104
  retry_policy: self.retry_policy,
104
105
  priority: self.priority.map(Into::into),
105
106
  do_not_eagerly_execute: self.do_not_eagerly_execute,
@@ -124,11 +125,6 @@ pub struct LocalActivityOptions {
124
125
  ///
125
126
  /// If `None` use the context's sequence number
126
127
  pub activity_id: Option<String>,
127
- /// Type of activity to schedule
128
- pub activity_type: String,
129
- /// Input to the activity
130
- // TODO: Make optional
131
- pub input: Payload,
132
128
  /// Retry policy
133
129
  pub retry_policy: RetryPolicy,
134
130
  /// Override attempt number rather than using 1.
@@ -160,8 +156,13 @@ pub struct LocalActivityOptions {
160
156
  pub summary: Option<String>,
161
157
  }
162
158
 
163
- impl IntoWorkflowCommand for LocalActivityOptions {
164
- fn into_command(mut self, seq: u32) -> WorkflowCommand {
159
+ impl LocalActivityOptions {
160
+ pub(crate) fn into_command(
161
+ mut self,
162
+ activity_type: String,
163
+ arguments: Vec<Payload>,
164
+ seq: u32,
165
+ ) -> WorkflowCommand {
165
166
  // Allow tests to avoid extra verbosity when they don't care about timeouts
166
167
  // TODO: Builderize LA options
167
168
  self.schedule_to_close_timeout
@@ -177,8 +178,8 @@ impl IntoWorkflowCommand for LocalActivityOptions {
177
178
  None => seq.to_string(),
178
179
  Some(aid) => aid,
179
180
  },
180
- activity_type: self.activity_type,
181
- arguments: vec![self.input],
181
+ activity_type,
182
+ arguments,
182
183
  retry_policy: Some(self.retry_policy),
183
184
  local_retry_threshold: self
184
185
  .timer_backoff_threshold
@@ -223,14 +224,26 @@ pub struct ChildWorkflowOptions {
223
224
  pub input: Vec<Payload>,
224
225
  /// Cancellation strategy for the child workflow
225
226
  pub cancel_type: ChildWorkflowCancellationType,
226
- /// Common options
227
- pub options: WorkflowOptions,
228
227
  /// How to respond to parent workflow ending
229
228
  pub parent_close_policy: ParentClosePolicy,
230
229
  /// Static summary of the child workflow
231
230
  pub static_summary: Option<String>,
232
231
  /// Static details of the child workflow
233
232
  pub static_details: Option<String>,
233
+ /// Set the policy for reusing the workflow id
234
+ pub id_reuse_policy: WorkflowIdReusePolicy,
235
+ /// Optionally set the execution timeout for the workflow
236
+ pub execution_timeout: Option<Duration>,
237
+ /// Optionally indicates the default run timeout for a workflow run
238
+ pub run_timeout: Option<Duration>,
239
+ /// Optionally indicates the default task timeout for a workflow run
240
+ pub task_timeout: Option<Duration>,
241
+ /// Optionally set a cron schedule for the workflow
242
+ pub cron_schedule: Option<String>,
243
+ /// Optionally associate extra search attributes with a workflow
244
+ pub search_attributes: Option<HashMap<String, Payload>>,
245
+ /// Priority for the workflow
246
+ pub priority: Option<Priority>,
234
247
  }
235
248
 
236
249
  impl IntoWorkflowCommand for ChildWorkflowOptions {
@@ -252,23 +265,18 @@ impl IntoWorkflowCommand for ChildWorkflowOptions {
252
265
  task_queue: self.task_queue.unwrap_or_default(),
253
266
  input: self.input,
254
267
  cancellation_type: self.cancel_type as i32,
255
- workflow_id_reuse_policy: self.options.id_reuse_policy as i32,
268
+ workflow_id_reuse_policy: self.id_reuse_policy as i32,
256
269
  workflow_execution_timeout: self
257
- .options
258
- .execution_timeout
259
- .and_then(|d| d.try_into().ok()),
260
- workflow_run_timeout: self
261
- .options
262
270
  .execution_timeout
263
271
  .and_then(|d| d.try_into().ok()),
264
- workflow_task_timeout: self
265
- .options
266
- .task_timeout
267
- .and_then(|d| d.try_into().ok()),
268
- search_attributes: self.options.search_attributes.unwrap_or_default(),
269
- cron_schedule: self.options.cron_schedule.unwrap_or_default(),
272
+ workflow_run_timeout: self.execution_timeout.and_then(|d| d.try_into().ok()),
273
+ workflow_task_timeout: self.task_timeout.and_then(|d| d.try_into().ok()),
274
+ search_attributes: self
275
+ .search_attributes
276
+ .map(|sa| SearchAttributes { indexed_fields: sa }),
277
+ cron_schedule: self.cron_schedule.unwrap_or_default(),
270
278
  parent_close_policy: self.parent_close_policy as i32,
271
- priority: self.options.priority.map(Into::into),
279
+ priority: self.priority.map(Into::into),
272
280
  ..Default::default()
273
281
  }
274
282
  .into(),
@@ -279,6 +287,7 @@ impl IntoWorkflowCommand for ChildWorkflowOptions {
279
287
  }
280
288
 
281
289
  /// Options for sending a signal to an external workflow
290
+ #[derive(Debug)]
282
291
  pub struct SignalWorkflowOptions {
283
292
  /// The workflow's id
284
293
  pub workflow_id: String,
@@ -315,6 +324,7 @@ impl SignalWorkflowOptions {
315
324
  }
316
325
 
317
326
  /// Information needed to send a specific signal
327
+ #[derive(Debug)]
318
328
  pub struct Signal {
319
329
  /// The signal name
320
330
  pub signal_name: String,
@@ -409,6 +419,19 @@ pub struct NexusOperationOptions {
409
419
  pub nexus_header: HashMap<String, String>,
410
420
  /// Cancellation type for the operation
411
421
  pub cancellation_type: Option<NexusOperationCancellationType>,
422
+ /// Schedule-to-start timeout for this operation.
423
+ /// Indicates how long the caller is willing to wait for the operation to be started (or completed if synchronous)
424
+ /// by the handler. If the operation is not started within this timeout, it will fail with
425
+ /// TIMEOUT_TYPE_SCHEDULE_TO_START.
426
+ /// If not set or zero, no schedule-to-start timeout is enforced.
427
+ pub schedule_to_start_timeout: Option<Duration>,
428
+ /// Start-to-close timeout for this operation.
429
+ /// Indicates how long the caller is willing to wait for an asynchronous operation to complete after it has been
430
+ /// started. If the operation does not complete within this timeout after starting, it will fail with
431
+ /// TIMEOUT_TYPE_START_TO_CLOSE.
432
+ /// Only applies to asynchronous operations. Synchronous operations ignore this timeout.
433
+ /// If not set or zero, no start-to-close timeout is enforced.
434
+ pub start_to_close_timeout: Option<Duration>,
412
435
  }
413
436
 
414
437
  impl IntoWorkflowCommand for NexusOperationOptions {
@@ -425,6 +448,12 @@ impl IntoWorkflowCommand for NexusOperationOptions {
425
448
  schedule_to_close_timeout: self
426
449
  .schedule_to_close_timeout
427
450
  .and_then(|t| t.try_into().ok()),
451
+ schedule_to_start_timeout: self
452
+ .schedule_to_start_timeout
453
+ .and_then(|t| t.try_into().ok()),
454
+ start_to_close_timeout: self
455
+ .start_to_close_timeout
456
+ .and_then(|t| t.try_into().ok()),
428
457
  nexus_header: self.nexus_header,
429
458
  cancellation_type: self
430
459
  .cancellation_type