@temporalio/core-bridge 0.16.0 → 0.16.3

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 (57) hide show
  1. package/Cargo.lock +1 -0
  2. package/index.d.ts +14 -0
  3. package/index.node +0 -0
  4. package/package.json +2 -2
  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/Cargo.toml +1 -0
  11. package/sdk-core/fsm/rustfsm_procmacro/Cargo.toml +1 -1
  12. package/sdk-core/fsm/rustfsm_procmacro/src/lib.rs +8 -9
  13. package/sdk-core/fsm/rustfsm_trait/Cargo.toml +1 -1
  14. package/sdk-core/fsm/rustfsm_trait/src/lib.rs +1 -1
  15. package/sdk-core/sdk-core-protos/src/lib.rs +36 -48
  16. package/sdk-core/src/core_tests/activity_tasks.rs +5 -5
  17. package/sdk-core/src/core_tests/mod.rs +2 -2
  18. package/sdk-core/src/core_tests/workflow_tasks.rs +2 -2
  19. package/sdk-core/src/errors.rs +11 -9
  20. package/sdk-core/src/lib.rs +2 -2
  21. package/sdk-core/src/machines/activity_state_machine.rs +3 -3
  22. package/sdk-core/src/machines/child_workflow_state_machine.rs +5 -5
  23. package/sdk-core/src/machines/complete_workflow_state_machine.rs +1 -1
  24. package/sdk-core/src/machines/continue_as_new_workflow_state_machine.rs +1 -1
  25. package/sdk-core/src/machines/mod.rs +16 -22
  26. package/sdk-core/src/machines/patch_state_machine.rs +8 -8
  27. package/sdk-core/src/machines/signal_external_state_machine.rs +2 -2
  28. package/sdk-core/src/machines/timer_state_machine.rs +4 -4
  29. package/sdk-core/src/machines/transition_coverage.rs +3 -3
  30. package/sdk-core/src/machines/workflow_machines.rs +9 -9
  31. package/sdk-core/src/pending_activations.rs +19 -20
  32. package/sdk-core/src/pollers/gateway.rs +3 -3
  33. package/sdk-core/src/pollers/poll_buffer.rs +2 -2
  34. package/sdk-core/src/pollers/retry.rs +4 -4
  35. package/sdk-core/src/prototype_rust_sdk/workflow_context.rs +3 -3
  36. package/sdk-core/src/prototype_rust_sdk/workflow_future.rs +4 -4
  37. package/sdk-core/src/prototype_rust_sdk.rs +3 -11
  38. package/sdk-core/src/telemetry/metrics.rs +2 -4
  39. package/sdk-core/src/telemetry/mod.rs +6 -7
  40. package/sdk-core/src/test_help/canned_histories.rs +8 -5
  41. package/sdk-core/src/test_help/history_builder.rs +2 -2
  42. package/sdk-core/src/test_help/history_info.rs +2 -2
  43. package/sdk-core/src/test_help/mod.rs +18 -30
  44. package/sdk-core/src/worker/activities/activity_heartbeat_manager.rs +246 -138
  45. package/sdk-core/src/worker/activities.rs +46 -45
  46. package/sdk-core/src/worker/config.rs +11 -0
  47. package/sdk-core/src/worker/dispatcher.rs +5 -5
  48. package/sdk-core/src/worker/mod.rs +8 -6
  49. package/sdk-core/src/workflow/driven_workflow.rs +3 -3
  50. package/sdk-core/src/workflow/history_update.rs +1 -1
  51. package/sdk-core/src/workflow/mod.rs +1 -1
  52. package/sdk-core/src/workflow/workflow_tasks/cache_manager.rs +13 -17
  53. package/sdk-core/src/workflow/workflow_tasks/concurrency_manager.rs +4 -8
  54. package/sdk-core/src/workflow/workflow_tasks/mod.rs +14 -19
  55. package/sdk-core/test_utils/src/lib.rs +2 -2
  56. package/sdk-core/tests/integ_tests/workflow_tests/activities.rs +61 -1
  57. package/src/conversions.rs +17 -0
@@ -58,12 +58,12 @@ pub enum ResponseType {
58
58
 
59
59
  impl From<&usize> for ResponseType {
60
60
  fn from(u: &usize) -> Self {
61
- ResponseType::ToTaskNum(*u)
61
+ Self::ToTaskNum(*u)
62
62
  }
63
63
  }
64
64
  // :shrug:
65
- impl From<&ResponseType> for ResponseType {
66
- fn from(r: &ResponseType) -> Self {
65
+ impl From<&Self> for ResponseType {
66
+ fn from(r: &Self) -> Self {
67
67
  *r
68
68
  }
69
69
  }
@@ -165,7 +165,7 @@ pub struct MockWorker {
165
165
 
166
166
  impl Default for MockWorker {
167
167
  fn default() -> Self {
168
- MockWorker {
168
+ Self {
169
169
  wf_poller: Box::from(mock_poller()),
170
170
  act_poller: None,
171
171
  config: WorkerConfig::default_test_q(),
@@ -175,14 +175,14 @@ impl Default for MockWorker {
175
175
 
176
176
  impl MockWorker {
177
177
  pub fn new(q: &str, wf_poller: BoxedWFPoller) -> Self {
178
- MockWorker {
178
+ Self {
179
179
  wf_poller,
180
180
  act_poller: None,
181
181
  config: WorkerConfig::default(q),
182
182
  }
183
183
  }
184
184
  pub fn for_queue(q: &str) -> Self {
185
- MockWorker {
185
+ Self {
186
186
  wf_poller: Box::from(mock_poller()),
187
187
  act_poller: None,
188
188
  config: WorkerConfig::default(q),
@@ -194,15 +194,12 @@ impl<SG> MocksHolder<SG>
194
194
  where
195
195
  SG: ServerGatewayApis + Send + Sync + 'static,
196
196
  {
197
- pub fn from_mock_workers(
198
- sg: SG,
199
- mock_workers: impl IntoIterator<Item = MockWorker>,
200
- ) -> MocksHolder<SG> {
197
+ pub fn from_mock_workers(sg: SG, mock_workers: impl IntoIterator<Item = MockWorker>) -> Self {
201
198
  let mock_pollers = mock_workers
202
199
  .into_iter()
203
200
  .map(|w| (w.config.task_queue.clone(), w))
204
201
  .collect();
205
- MocksHolder {
202
+ Self {
206
203
  sg,
207
204
  mock_pollers,
208
205
  outstanding_task_map: None,
@@ -210,16 +207,12 @@ where
210
207
  }
211
208
 
212
209
  /// Uses the provided list of tasks to create a mock poller for the `TEST_Q`
213
- pub fn from_gateway_with_responses<WFT, ACT>(
214
- sg: SG,
215
- wf_tasks: WFT,
216
- act_tasks: ACT,
217
- ) -> MocksHolder<SG>
210
+ pub fn from_gateway_with_responses<WFT, ACT>(sg: SG, wf_tasks: WFT, act_tasks: ACT) -> Self
218
211
  where
219
212
  WFT: IntoIterator<Item = PollWorkflowTaskQueueResponse>,
220
213
  ACT: IntoIterator<Item = PollActivityTaskQueueResponse>,
221
- <WFT as IntoIterator>::IntoIter: std::marker::Send + 'static,
222
- <ACT as IntoIterator>::IntoIter: std::marker::Send + 'static,
214
+ <WFT as IntoIterator>::IntoIter: Send + 'static,
215
+ <ACT as IntoIterator>::IntoIter: Send + 'static,
223
216
  {
224
217
  let mut mock_pollers = HashMap::new();
225
218
  let mock_poller = mock_poller_from_resps(wf_tasks);
@@ -235,7 +228,7 @@ where
235
228
  .unwrap(),
236
229
  },
237
230
  );
238
- MocksHolder {
231
+ Self {
239
232
  sg,
240
233
  mock_pollers,
241
234
  outstanding_task_map: None,
@@ -247,7 +240,7 @@ pub fn mock_poller_from_resps<T, I>(tasks: I) -> BoxedPoller<T>
247
240
  where
248
241
  T: Send + Sync + 'static,
249
242
  I: IntoIterator<Item = T>,
250
- <I as IntoIterator>::IntoIter: std::marker::Send + 'static,
243
+ <I as IntoIterator>::IntoIter: Send + 'static,
251
244
  {
252
245
  let mut mock_poller = mock_poller();
253
246
  let mut tasks = tasks.into_iter();
@@ -411,7 +404,7 @@ pub fn build_mock_pollers(mut cfg: MockPollCfg) -> MocksHolder<MockServerGateway
411
404
  let cur_attempt = attempts_at_task_num.entry(to_task_num).or_insert(1);
412
405
  let mut r = hist_to_poll_resp(
413
406
  &hist.hist,
414
- hist.wf_id.to_owned(),
407
+ hist.wf_id.clone(),
415
408
  *to_task_num,
416
409
  hist.task_q.clone(),
417
410
  );
@@ -429,7 +422,7 @@ pub fn build_mock_pollers(mut cfg: MockPollCfg) -> MocksHolder<MockServerGateway
429
422
  }
430
423
 
431
424
  let mut mock_pollers = HashMap::new();
432
- for (task_q, mut queue_tasks) in task_queues_to_resps.into_iter() {
425
+ for (task_q, mut queue_tasks) in task_queues_to_resps {
433
426
  let mut mock_poller = mock_poller();
434
427
 
435
428
  // The poller will return history from any workflow runs that do not have currently
@@ -437,11 +430,7 @@ pub fn build_mock_pollers(mut cfg: MockPollCfg) -> MocksHolder<MockServerGateway
437
430
  let outstanding = outstanding_wf_task_tokens.clone();
438
431
  mock_poller
439
432
  .expect_poll()
440
- .times(
441
- correct_num_polls
442
- .map::<TimesRange, _>(Into::into)
443
- .unwrap_or_else(|| RangeFull.into()),
444
- )
433
+ .times(correct_num_polls.map_or_else(|| RangeFull.into(), Into::<TimesRange>::into))
445
434
  .returning(move || {
446
435
  for (_, tasks) in queue_tasks.iter_mut() {
447
436
  // Must extract run id from a workflow task associated with this workflow
@@ -476,8 +465,7 @@ pub fn build_mock_pollers(mut cfg: MockPollCfg) -> MocksHolder<MockServerGateway
476
465
  .withf(cfg.expect_fail_wft_matcher)
477
466
  .times(
478
467
  cfg.num_expected_fails
479
- .map::<TimesRange, _>(Into::into)
480
- .unwrap_or_else(|| RangeFull.into()),
468
+ .map_or_else(|| RangeFull.into(), Into::<TimesRange>::into),
481
469
  )
482
470
  .returning(move |tt, _, _| {
483
471
  outstanding.write().remove_by_right(&tt);
@@ -556,7 +544,7 @@ pub(crate) async fn poll_and_reply<'a>(
556
544
  eviction_mode: WorkflowCachingPolicy,
557
545
  expect_and_reply: &'a [AsserterWithReply<'a>],
558
546
  ) {
559
- poll_and_reply_clears_outstanding_evicts(core, None, eviction_mode, expect_and_reply).await
547
+ poll_and_reply_clears_outstanding_evicts(core, None, eviction_mode, expect_and_reply).await;
560
548
  }
561
549
 
562
550
  pub(crate) async fn poll_and_reply_clears_outstanding_evicts<'a>(