@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.
- package/Cargo.lock +162 -38
- package/Cargo.toml +3 -3
- package/index.d.ts +14 -1
- package/index.node +0 -0
- package/package.json +8 -5
- package/releases/aarch64-apple-darwin/index.node +0 -0
- package/releases/{x86_64-pc-windows-gnu → aarch64-unknown-linux-gnu}/index.node +0 -0
- package/releases/x86_64-apple-darwin/index.node +0 -0
- package/releases/x86_64-pc-windows-msvc/index.node +0 -0
- package/releases/x86_64-unknown-linux-gnu/index.node +0 -0
- package/scripts/build.js +77 -34
- package/sdk-core/.buildkite/docker/Dockerfile +1 -1
- package/sdk-core/Cargo.toml +6 -5
- package/sdk-core/fsm/Cargo.toml +1 -1
- package/sdk-core/fsm/rustfsm_procmacro/Cargo.toml +2 -2
- package/sdk-core/fsm/rustfsm_procmacro/src/lib.rs +8 -9
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +13 -7
- package/sdk-core/fsm/rustfsm_trait/Cargo.toml +2 -2
- package/sdk-core/fsm/rustfsm_trait/src/lib.rs +1 -1
- package/sdk-core/protos/local/workflow_activation.proto +6 -3
- package/sdk-core/sdk-core-protos/Cargo.toml +4 -4
- package/sdk-core/sdk-core-protos/src/lib.rs +38 -50
- package/sdk-core/src/core_tests/activity_tasks.rs +5 -5
- package/sdk-core/src/core_tests/child_workflows.rs +55 -29
- package/sdk-core/src/core_tests/determinism.rs +19 -9
- package/sdk-core/src/core_tests/mod.rs +3 -3
- package/sdk-core/src/core_tests/retry.rs +14 -8
- package/sdk-core/src/core_tests/workers.rs +1 -1
- package/sdk-core/src/core_tests/workflow_tasks.rs +347 -4
- package/sdk-core/src/errors.rs +27 -44
- package/sdk-core/src/lib.rs +13 -3
- package/sdk-core/src/machines/activity_state_machine.rs +44 -5
- package/sdk-core/src/machines/child_workflow_state_machine.rs +31 -11
- package/sdk-core/src/machines/complete_workflow_state_machine.rs +1 -1
- package/sdk-core/src/machines/continue_as_new_workflow_state_machine.rs +1 -1
- package/sdk-core/src/machines/mod.rs +18 -23
- package/sdk-core/src/machines/patch_state_machine.rs +8 -8
- package/sdk-core/src/machines/signal_external_state_machine.rs +22 -1
- package/sdk-core/src/machines/timer_state_machine.rs +21 -3
- package/sdk-core/src/machines/transition_coverage.rs +3 -3
- package/sdk-core/src/machines/workflow_machines.rs +11 -11
- package/sdk-core/src/pending_activations.rs +27 -22
- package/sdk-core/src/pollers/gateway.rs +15 -7
- package/sdk-core/src/pollers/poll_buffer.rs +6 -5
- package/sdk-core/src/pollers/retry.rs +153 -120
- package/sdk-core/src/prototype_rust_sdk/workflow_context.rs +61 -46
- package/sdk-core/src/prototype_rust_sdk/workflow_future.rs +13 -12
- package/sdk-core/src/prototype_rust_sdk.rs +17 -23
- package/sdk-core/src/telemetry/metrics.rs +2 -4
- package/sdk-core/src/telemetry/mod.rs +6 -7
- package/sdk-core/src/test_help/canned_histories.rs +17 -93
- package/sdk-core/src/test_help/history_builder.rs +61 -2
- package/sdk-core/src/test_help/history_info.rs +21 -2
- package/sdk-core/src/test_help/mod.rs +26 -34
- package/sdk-core/src/worker/activities/activity_heartbeat_manager.rs +246 -138
- package/sdk-core/src/worker/activities.rs +46 -45
- package/sdk-core/src/worker/config.rs +11 -0
- package/sdk-core/src/worker/dispatcher.rs +5 -5
- package/sdk-core/src/worker/mod.rs +86 -56
- package/sdk-core/src/workflow/driven_workflow.rs +3 -3
- package/sdk-core/src/workflow/history_update.rs +1 -1
- package/sdk-core/src/workflow/mod.rs +2 -1
- package/sdk-core/src/workflow/workflow_tasks/cache_manager.rs +13 -17
- package/sdk-core/src/workflow/workflow_tasks/concurrency_manager.rs +10 -18
- package/sdk-core/src/workflow/workflow_tasks/mod.rs +72 -57
- package/sdk-core/test_utils/Cargo.toml +1 -1
- package/sdk-core/test_utils/src/lib.rs +2 -2
- package/sdk-core/tests/integ_tests/workflow_tests/activities.rs +61 -1
- package/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +2 -2
- package/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +49 -0
- package/sdk-core/tests/integ_tests/workflow_tests/signals.rs +2 -2
- package/sdk-core/tests/integ_tests/workflow_tests.rs +1 -0
- package/src/conversions.rs +17 -0
- package/src/errors.rs +0 -7
- package/src/lib.rs +0 -20
package/src/conversions.rs
CHANGED
|
@@ -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))
|