@temporalio/core-bridge 0.14.0 → 0.16.4

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 (75) hide show
  1. package/Cargo.lock +162 -38
  2. package/Cargo.toml +3 -3
  3. package/index.d.ts +14 -1
  4. package/index.node +0 -0
  5. package/package.json +8 -5
  6. package/releases/aarch64-apple-darwin/index.node +0 -0
  7. package/releases/{x86_64-pc-windows-gnu → aarch64-unknown-linux-gnu}/index.node +0 -0
  8. package/releases/x86_64-apple-darwin/index.node +0 -0
  9. package/releases/x86_64-pc-windows-msvc/index.node +0 -0
  10. package/releases/x86_64-unknown-linux-gnu/index.node +0 -0
  11. package/scripts/build.js +77 -34
  12. package/sdk-core/.buildkite/docker/Dockerfile +1 -1
  13. package/sdk-core/Cargo.toml +6 -5
  14. package/sdk-core/fsm/Cargo.toml +1 -1
  15. package/sdk-core/fsm/rustfsm_procmacro/Cargo.toml +2 -2
  16. package/sdk-core/fsm/rustfsm_procmacro/src/lib.rs +8 -9
  17. package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +13 -7
  18. package/sdk-core/fsm/rustfsm_trait/Cargo.toml +2 -2
  19. package/sdk-core/fsm/rustfsm_trait/src/lib.rs +1 -1
  20. package/sdk-core/protos/local/workflow_activation.proto +6 -3
  21. package/sdk-core/sdk-core-protos/Cargo.toml +4 -4
  22. package/sdk-core/sdk-core-protos/src/lib.rs +38 -50
  23. package/sdk-core/src/core_tests/activity_tasks.rs +5 -5
  24. package/sdk-core/src/core_tests/child_workflows.rs +55 -29
  25. package/sdk-core/src/core_tests/determinism.rs +19 -9
  26. package/sdk-core/src/core_tests/mod.rs +3 -3
  27. package/sdk-core/src/core_tests/retry.rs +14 -8
  28. package/sdk-core/src/core_tests/workers.rs +1 -1
  29. package/sdk-core/src/core_tests/workflow_tasks.rs +347 -4
  30. package/sdk-core/src/errors.rs +27 -44
  31. package/sdk-core/src/lib.rs +13 -3
  32. package/sdk-core/src/machines/activity_state_machine.rs +44 -5
  33. package/sdk-core/src/machines/child_workflow_state_machine.rs +31 -11
  34. package/sdk-core/src/machines/complete_workflow_state_machine.rs +1 -1
  35. package/sdk-core/src/machines/continue_as_new_workflow_state_machine.rs +1 -1
  36. package/sdk-core/src/machines/mod.rs +18 -23
  37. package/sdk-core/src/machines/patch_state_machine.rs +8 -8
  38. package/sdk-core/src/machines/signal_external_state_machine.rs +22 -1
  39. package/sdk-core/src/machines/timer_state_machine.rs +21 -3
  40. package/sdk-core/src/machines/transition_coverage.rs +3 -3
  41. package/sdk-core/src/machines/workflow_machines.rs +11 -11
  42. package/sdk-core/src/pending_activations.rs +27 -22
  43. package/sdk-core/src/pollers/gateway.rs +15 -7
  44. package/sdk-core/src/pollers/poll_buffer.rs +6 -5
  45. package/sdk-core/src/pollers/retry.rs +153 -120
  46. package/sdk-core/src/prototype_rust_sdk/workflow_context.rs +61 -46
  47. package/sdk-core/src/prototype_rust_sdk/workflow_future.rs +13 -12
  48. package/sdk-core/src/prototype_rust_sdk.rs +17 -23
  49. package/sdk-core/src/telemetry/metrics.rs +2 -4
  50. package/sdk-core/src/telemetry/mod.rs +6 -7
  51. package/sdk-core/src/test_help/canned_histories.rs +17 -93
  52. package/sdk-core/src/test_help/history_builder.rs +61 -2
  53. package/sdk-core/src/test_help/history_info.rs +21 -2
  54. package/sdk-core/src/test_help/mod.rs +26 -34
  55. package/sdk-core/src/worker/activities/activity_heartbeat_manager.rs +246 -138
  56. package/sdk-core/src/worker/activities.rs +46 -45
  57. package/sdk-core/src/worker/config.rs +11 -0
  58. package/sdk-core/src/worker/dispatcher.rs +5 -5
  59. package/sdk-core/src/worker/mod.rs +86 -56
  60. package/sdk-core/src/workflow/driven_workflow.rs +3 -3
  61. package/sdk-core/src/workflow/history_update.rs +1 -1
  62. package/sdk-core/src/workflow/mod.rs +2 -1
  63. package/sdk-core/src/workflow/workflow_tasks/cache_manager.rs +13 -17
  64. package/sdk-core/src/workflow/workflow_tasks/concurrency_manager.rs +10 -18
  65. package/sdk-core/src/workflow/workflow_tasks/mod.rs +72 -57
  66. package/sdk-core/test_utils/Cargo.toml +1 -1
  67. package/sdk-core/test_utils/src/lib.rs +2 -2
  68. package/sdk-core/tests/integ_tests/workflow_tests/activities.rs +61 -1
  69. package/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +2 -2
  70. package/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +49 -0
  71. package/sdk-core/tests/integ_tests/workflow_tests/signals.rs +2 -2
  72. package/sdk-core/tests/integ_tests/workflow_tests.rs +1 -0
  73. package/src/conversions.rs +17 -0
  74. package/src/errors.rs +0 -7
  75. package/src/lib.rs +0 -20
@@ -276,6 +276,21 @@ impl ObjectHandleConversionsExt for Handle<'_, JsObject> {
276
276
  ) as u64);
277
277
  let max_cached_workflows =
278
278
  js_value_getter!(cx, self, "maxCachedWorkflows", JsNumber) as usize;
279
+
280
+ let max_heartbeat_throttle_interval = Duration::from_millis(js_value_getter!(
281
+ cx,
282
+ self,
283
+ "maxHeartbeatThrottleIntervalMs",
284
+ JsNumber
285
+ ) as u64);
286
+
287
+ let default_heartbeat_throttle_interval = Duration::from_millis(js_value_getter!(
288
+ cx,
289
+ self,
290
+ "defaultHeartbeatThrottleIntervalMs",
291
+ JsNumber
292
+ ) as u64);
293
+
279
294
  Ok(WorkerConfig {
280
295
  no_remote_activities: false, // TODO: make this configurable once Core implements local activities
281
296
  max_concurrent_at_polls,
@@ -286,6 +301,8 @@ impl ObjectHandleConversionsExt for Handle<'_, JsObject> {
286
301
  nonsticky_to_sticky_poll_ratio,
287
302
  sticky_queue_schedule_to_start_timeout,
288
303
  task_queue,
304
+ max_heartbeat_throttle_interval,
305
+ default_heartbeat_throttle_interval,
289
306
  })
290
307
  }
291
308
  }
package/src/errors.rs CHANGED
@@ -8,8 +8,6 @@ pub static TRANSPORT_ERROR: OnceCell<Root<JsFunction>> = OnceCell::new();
8
8
  pub static SHUTDOWN_ERROR: OnceCell<Root<JsFunction>> = OnceCell::new();
9
9
  /// Thrown when using a method for a worker that does not exist (never registered or already shut down)
10
10
  pub static NO_WORKER_ERROR: OnceCell<Root<JsFunction>> = OnceCell::new();
11
- /// Workflow did something Core did not expect, it should be immediately deleted from the cache
12
- pub static WORKFLOW_ERROR: OnceCell<Root<JsFunction>> = OnceCell::new();
13
11
  /// Something unexpected happened, considered fatal
14
12
  pub static UNEXPECTED_ERROR: OnceCell<Root<JsFunction>> = OnceCell::new();
15
13
 
@@ -80,10 +78,6 @@ pub fn register_errors(mut cx: FunctionContext) -> JsResult<JsUndefined> {
80
78
  .get(&mut cx, "TransportError")?
81
79
  .downcast_or_throw::<JsFunction, FunctionContext>(&mut cx)?
82
80
  .root(&mut cx);
83
- let workflow_error = mapping
84
- .get(&mut cx, "WorkflowError")?
85
- .downcast_or_throw::<JsFunction, FunctionContext>(&mut cx)?
86
- .root(&mut cx);
87
81
  let unexpected_error = mapping
88
82
  .get(&mut cx, "UnexpectedError")?
89
83
  .downcast_or_throw::<JsFunction, FunctionContext>(&mut cx)?
@@ -92,7 +86,6 @@ pub fn register_errors(mut cx: FunctionContext) -> JsResult<JsUndefined> {
92
86
  TRANSPORT_ERROR.get_or_try_init(|| Ok(transport_error))?;
93
87
  SHUTDOWN_ERROR.get_or_try_init(|| Ok(shutdown_error))?;
94
88
  NO_WORKER_ERROR.get_or_try_init(|| Ok(no_worker_error))?;
95
- WORKFLOW_ERROR.get_or_try_init(|| Ok(workflow_error))?;
96
89
  UNEXPECTED_ERROR.get_or_try_init(|| Ok(unexpected_error))?;
97
90
 
98
91
  Ok(cx.undefined())
package/src/lib.rs CHANGED
@@ -353,14 +353,6 @@ fn start_bridge_loop(
353
353
  .await
354
354
  },
355
355
  |cx, err| match err {
356
- CompleteWfError::WorkflowUpdateError { run_id, source } => {
357
- let args = vec![
358
- cx.string("Workflow update error").upcast(),
359
- cx.string(run_id).upcast(),
360
- cx.string(format!("{}", source)).upcast(),
361
- ];
362
- WORKFLOW_ERROR.construct(cx, args)
363
- }
364
356
  CompleteWfError::NoWorkerForQueue(queue_name) => {
365
357
  let args = vec![cx.string(queue_name).upcast()];
366
358
  NO_WORKER_ERROR.construct(cx, args)
@@ -445,18 +437,6 @@ async fn handle_poll_workflow_activation_request(
445
437
  Err(err) => {
446
438
  send_error(event_queue, callback, move |cx| match err {
447
439
  PollWfError::ShutDown => SHUTDOWN_ERROR.from_error(cx, err),
448
- PollWfError::AutocompleteError(CompleteWfError::WorkflowUpdateError {
449
- run_id,
450
- source,
451
- })
452
- | PollWfError::WorkflowUpdateError { run_id, source } => {
453
- let args = vec![
454
- cx.string("Workflow update error").upcast(),
455
- cx.string(run_id).upcast(),
456
- cx.string(format!("{}", source)).upcast(),
457
- ];
458
- WORKFLOW_ERROR.construct(cx, args)
459
- }
460
440
  PollWfError::AutocompleteError(CompleteWfError::NoWorkerForQueue(_)) => {
461
441
  UNEXPECTED_ERROR
462
442
  .from_error(cx, format!("No worker registered for queue {}", queue_name))