@temporalio/core-bridge 0.22.0 → 1.0.0-rc.1
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 +120 -15
- package/Cargo.toml +3 -1
- package/README.md +1 -1
- package/index.d.ts +137 -33
- package/package.json +6 -6
- package/releases/aarch64-apple-darwin/index.node +0 -0
- package/releases/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/sdk-core/.buildkite/docker/docker-compose.yaml +4 -2
- package/sdk-core/ARCHITECTURE.md +9 -7
- package/sdk-core/README.md +5 -1
- package/sdk-core/arch_docs/diagrams/workflow_internals.svg +1 -0
- package/sdk-core/bridge-ffi/src/lib.rs +1 -1
- package/sdk-core/bridge-ffi/src/wrappers.rs +60 -37
- package/sdk-core/client/Cargo.toml +1 -0
- package/sdk-core/client/src/lib.rs +50 -15
- package/sdk-core/client/src/raw.rs +167 -55
- package/sdk-core/client/src/retry.rs +9 -4
- package/sdk-core/client/src/workflow_handle/mod.rs +4 -2
- package/sdk-core/core/Cargo.toml +2 -0
- package/sdk-core/core/benches/workflow_replay.rs +1 -7
- package/sdk-core/core/src/abstractions.rs +137 -16
- package/sdk-core/core/src/core_tests/activity_tasks.rs +258 -63
- package/sdk-core/core/src/core_tests/child_workflows.rs +1 -2
- package/sdk-core/core/src/core_tests/determinism.rs +2 -2
- package/sdk-core/core/src/core_tests/local_activities.rs +8 -7
- package/sdk-core/core/src/core_tests/queries.rs +146 -60
- package/sdk-core/core/src/core_tests/replay_flag.rs +1 -1
- package/sdk-core/core/src/core_tests/workers.rs +39 -23
- package/sdk-core/core/src/core_tests/workflow_cancels.rs +1 -1
- package/sdk-core/core/src/core_tests/workflow_tasks.rs +387 -280
- package/sdk-core/core/src/lib.rs +8 -5
- package/sdk-core/core/src/pollers/poll_buffer.rs +16 -10
- package/sdk-core/core/src/protosext/mod.rs +7 -9
- package/sdk-core/core/src/retry_logic.rs +73 -16
- package/sdk-core/core/src/telemetry/metrics.rs +21 -7
- package/sdk-core/core/src/telemetry/mod.rs +182 -110
- package/sdk-core/core/src/test_help/mod.rs +341 -109
- package/sdk-core/core/src/worker/activities/activity_heartbeat_manager.rs +18 -9
- package/sdk-core/core/src/worker/activities/local_activities.rs +22 -25
- package/sdk-core/core/src/worker/activities.rs +156 -29
- package/sdk-core/core/src/worker/client.rs +1 -0
- package/sdk-core/core/src/worker/mod.rs +132 -659
- package/sdk-core/core/src/{workflow → worker/workflow}/bridge.rs +1 -1
- package/sdk-core/core/src/{workflow → worker/workflow}/driven_workflow.rs +1 -1
- package/sdk-core/core/src/{workflow → worker/workflow}/history_update.rs +16 -2
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/activity_state_machine.rs +39 -4
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/cancel_external_state_machine.rs +5 -2
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/cancel_workflow_state_machine.rs +1 -1
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/child_workflow_state_machine.rs +2 -4
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/complete_workflow_state_machine.rs +0 -0
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/continue_as_new_workflow_state_machine.rs +1 -1
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/fail_workflow_state_machine.rs +0 -0
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/local_activity_state_machine.rs +2 -5
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/mod.rs +1 -1
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/mutable_side_effect_state_machine.rs +0 -0
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/patch_state_machine.rs +1 -1
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/side_effect_state_machine.rs +0 -0
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/signal_external_state_machine.rs +4 -2
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/timer_state_machine.rs +1 -2
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/transition_coverage.rs +1 -1
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/upsert_search_attributes_state_machine.rs +5 -7
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/workflow_machines/local_acts.rs +2 -2
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/workflow_machines.rs +40 -16
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/workflow_task_state_machine.rs +0 -0
- package/sdk-core/core/src/worker/workflow/managed_run/managed_wf_test.rs +198 -0
- package/sdk-core/core/src/worker/workflow/managed_run.rs +627 -0
- package/sdk-core/core/src/worker/workflow/mod.rs +1115 -0
- package/sdk-core/core/src/worker/workflow/run_cache.rs +143 -0
- package/sdk-core/core/src/worker/workflow/wft_poller.rs +88 -0
- package/sdk-core/core/src/worker/workflow/workflow_stream.rs +936 -0
- package/sdk-core/core-api/src/errors.rs +3 -10
- package/sdk-core/core-api/src/lib.rs +2 -1
- package/sdk-core/core-api/src/worker.rs +26 -2
- package/sdk-core/etc/dynamic-config.yaml +2 -0
- package/sdk-core/integ-with-otel.sh +1 -1
- package/sdk-core/protos/api_upstream/Makefile +4 -4
- package/sdk-core/protos/api_upstream/api-linter.yaml +2 -0
- package/sdk-core/protos/api_upstream/buf.yaml +8 -9
- package/sdk-core/protos/api_upstream/temporal/api/cluster/v1/message.proto +83 -0
- package/sdk-core/protos/api_upstream/temporal/api/command/v1/message.proto +7 -1
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/cluster.proto +40 -0
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +3 -0
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/reset.proto +3 -1
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/schedule.proto +60 -0
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/workflow.proto +3 -0
- package/sdk-core/protos/api_upstream/temporal/api/errordetails/v1/message.proto +32 -4
- package/sdk-core/protos/api_upstream/temporal/api/history/v1/message.proto +69 -19
- package/sdk-core/protos/api_upstream/temporal/api/namespace/v1/message.proto +13 -0
- package/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +163 -0
- package/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/service.proto +97 -0
- package/sdk-core/protos/api_upstream/temporal/api/schedule/v1/message.proto +300 -0
- package/sdk-core/protos/api_upstream/temporal/api/workflow/v1/message.proto +25 -0
- package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +180 -3
- package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +53 -3
- package/sdk-core/protos/local/temporal/sdk/core/activity_result/activity_result.proto +2 -2
- package/sdk-core/protos/local/temporal/sdk/core/activity_task/activity_task.proto +6 -5
- package/sdk-core/protos/local/temporal/sdk/core/bridge/bridge.proto +27 -6
- package/sdk-core/protos/local/temporal/sdk/core/child_workflow/child_workflow.proto +2 -1
- package/sdk-core/protos/local/temporal/sdk/core/common/common.proto +0 -64
- package/sdk-core/protos/local/temporal/sdk/core/core_interface.proto +2 -1
- package/sdk-core/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +11 -8
- package/sdk-core/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +30 -25
- package/sdk-core/sdk/src/activity_context.rs +12 -5
- package/sdk-core/sdk/src/app_data.rs +37 -0
- package/sdk-core/sdk/src/lib.rs +76 -43
- package/sdk-core/sdk/src/workflow_context/options.rs +8 -6
- package/sdk-core/sdk/src/workflow_context.rs +14 -19
- package/sdk-core/sdk/src/workflow_future.rs +11 -6
- package/sdk-core/sdk-core-protos/src/history_builder.rs +19 -5
- package/sdk-core/sdk-core-protos/src/history_info.rs +11 -6
- package/sdk-core/sdk-core-protos/src/lib.rs +87 -176
- package/sdk-core/test-utils/src/histfetch.rs +1 -1
- package/sdk-core/test-utils/src/lib.rs +93 -77
- package/sdk-core/tests/integ_tests/client_tests.rs +2 -2
- package/sdk-core/tests/integ_tests/heartbeat_tests.rs +11 -9
- package/sdk-core/tests/integ_tests/polling_tests.rs +12 -0
- package/sdk-core/tests/integ_tests/queries_tests.rs +39 -22
- package/sdk-core/tests/integ_tests/workflow_tests/activities.rs +49 -4
- package/sdk-core/tests/integ_tests/workflow_tests/appdata_propagation.rs +61 -0
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +1 -1
- package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +74 -13
- package/sdk-core/tests/integ_tests/workflow_tests/replay.rs +19 -0
- package/sdk-core/tests/integ_tests/workflow_tests/resets.rs +1 -1
- package/sdk-core/tests/integ_tests/workflow_tests/upsert_search_attrs.rs +6 -3
- package/sdk-core/tests/integ_tests/workflow_tests.rs +10 -23
- package/sdk-core/tests/load_tests.rs +8 -3
- package/sdk-core/tests/main.rs +7 -3
- package/src/conversions.rs +149 -70
- package/src/errors.rs +10 -21
- package/src/lib.rs +400 -319
- package/sdk-core/core/src/pending_activations.rs +0 -173
- package/sdk-core/core/src/worker/wft_delivery.rs +0 -81
- package/sdk-core/core/src/workflow/mod.rs +0 -478
- package/sdk-core/core/src/workflow/workflow_tasks/cache_manager.rs +0 -194
- package/sdk-core/core/src/workflow/workflow_tasks/concurrency_manager.rs +0 -418
- package/sdk-core/core/src/workflow/workflow_tasks/mod.rs +0 -989
package/src/errors.rs
CHANGED
|
@@ -6,8 +6,6 @@ pub static TRANSPORT_ERROR: OnceCell<Root<JsFunction>> = OnceCell::new();
|
|
|
6
6
|
/// Thrown after shutdown was requested as a response to a poll function, JS should stop polling
|
|
7
7
|
/// once this error is encountered
|
|
8
8
|
pub static SHUTDOWN_ERROR: OnceCell<Root<JsFunction>> = OnceCell::new();
|
|
9
|
-
/// Thrown when using a method for a worker that does not exist (never registered or already shut down)
|
|
10
|
-
pub static NO_WORKER_ERROR: OnceCell<Root<JsFunction>> = OnceCell::new();
|
|
11
9
|
/// Something unexpected happened, considered fatal
|
|
12
10
|
pub static UNEXPECTED_ERROR: OnceCell<Root<JsFunction>> = OnceCell::new();
|
|
13
11
|
/// Used in different parts of the project to signal that something unexpected has happened
|
|
@@ -22,14 +20,14 @@ pub trait CustomError {
|
|
|
22
20
|
where
|
|
23
21
|
C: Context<'a>;
|
|
24
22
|
|
|
25
|
-
fn from_string<'a, C>(&self, cx: &mut C, message: String) -> JsResult<'a, JsObject>
|
|
23
|
+
fn from_string<'a, C>(&self, cx: &mut C, message: impl Into<String>) -> JsResult<'a, JsObject>
|
|
26
24
|
where
|
|
27
25
|
C: Context<'a>;
|
|
28
26
|
|
|
29
27
|
fn from_error<'a, C, E>(&self, cx: &mut C, err: E) -> JsResult<'a, JsObject>
|
|
30
28
|
where
|
|
31
29
|
C: Context<'a>,
|
|
32
|
-
E: std::
|
|
30
|
+
E: std::error::Error;
|
|
33
31
|
}
|
|
34
32
|
|
|
35
33
|
// Implement `CustomError` for ALL errors in a `OnceCell`. This only needs to be
|
|
@@ -48,20 +46,20 @@ impl CustomError for OnceCell<Root<JsFunction>> {
|
|
|
48
46
|
error.construct(cx, args)
|
|
49
47
|
}
|
|
50
48
|
|
|
51
|
-
fn from_string<'a, C>(&self, cx: &mut C, message: String) -> JsResult<'a, JsObject>
|
|
49
|
+
fn from_string<'a, C>(&self, cx: &mut C, message: impl Into<String>) -> JsResult<'a, JsObject>
|
|
52
50
|
where
|
|
53
51
|
C: Context<'a>,
|
|
54
52
|
{
|
|
55
|
-
let args = vec![cx.string(message).upcast()];
|
|
53
|
+
let args = vec![cx.string(message.into()).upcast()];
|
|
56
54
|
self.construct(cx, args)
|
|
57
55
|
}
|
|
58
56
|
|
|
59
57
|
fn from_error<'a, C, E>(&self, cx: &mut C, err: E) -> JsResult<'a, JsObject>
|
|
60
58
|
where
|
|
61
59
|
C: Context<'a>,
|
|
62
|
-
E: std::
|
|
60
|
+
E: std::error::Error,
|
|
63
61
|
{
|
|
64
|
-
self.from_string(cx, format!("{}", err))
|
|
62
|
+
self.from_string(cx, format!("{:?}", err))
|
|
65
63
|
}
|
|
66
64
|
}
|
|
67
65
|
|
|
@@ -77,29 +75,20 @@ pub fn register_errors(mut cx: FunctionContext) -> JsResult<JsUndefined> {
|
|
|
77
75
|
|
|
78
76
|
let mapping = cx.argument::<JsObject>(0)?;
|
|
79
77
|
let shutdown_error = mapping
|
|
80
|
-
.get(&mut cx, "ShutdownError")?
|
|
81
|
-
.downcast_or_throw::<JsFunction, FunctionContext>(&mut cx)?
|
|
82
|
-
.root(&mut cx);
|
|
83
|
-
let no_worker_error = mapping
|
|
84
|
-
.get(&mut cx, "NoWorkerRegisteredError")?
|
|
85
|
-
.downcast_or_throw::<JsFunction, FunctionContext>(&mut cx)?
|
|
78
|
+
.get::<JsFunction, _, _>(&mut cx, "ShutdownError")?
|
|
86
79
|
.root(&mut cx);
|
|
87
80
|
let transport_error = mapping
|
|
88
|
-
.get(&mut cx, "TransportError")?
|
|
89
|
-
.downcast_or_throw::<JsFunction, FunctionContext>(&mut cx)?
|
|
81
|
+
.get::<JsFunction, _, _>(&mut cx, "TransportError")?
|
|
90
82
|
.root(&mut cx);
|
|
91
83
|
let unexpected_error = mapping
|
|
92
|
-
.get(&mut cx, "UnexpectedError")?
|
|
93
|
-
.downcast_or_throw::<JsFunction, FunctionContext>(&mut cx)?
|
|
84
|
+
.get::<JsFunction, _, _>(&mut cx, "UnexpectedError")?
|
|
94
85
|
.root(&mut cx);
|
|
95
86
|
let illegal_state_error = mapping
|
|
96
|
-
.get(&mut cx, "IllegalStateError")?
|
|
97
|
-
.downcast_or_throw::<JsFunction, FunctionContext>(&mut cx)?
|
|
87
|
+
.get::<JsFunction, _, _>(&mut cx, "IllegalStateError")?
|
|
98
88
|
.root(&mut cx);
|
|
99
89
|
|
|
100
90
|
TRANSPORT_ERROR.get_or_try_init(|| Ok(transport_error))?;
|
|
101
91
|
SHUTDOWN_ERROR.get_or_try_init(|| Ok(shutdown_error))?;
|
|
102
|
-
NO_WORKER_ERROR.get_or_try_init(|| Ok(no_worker_error))?;
|
|
103
92
|
UNEXPECTED_ERROR.get_or_try_init(|| Ok(unexpected_error))?;
|
|
104
93
|
ILLEGAL_STATE_ERROR.get_or_try_init(|| Ok(illegal_state_error))?;
|
|
105
94
|
|