@temporalio/core-bridge 1.6.0 → 1.7.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 +520 -456
- package/lib/index.d.ts +8 -6
- package/lib/index.js.map +1 -1
- package/package.json +8 -3
- 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/Dockerfile +2 -2
- package/sdk-core/.buildkite/docker/docker-compose.yaml +1 -1
- package/sdk-core/.buildkite/pipeline.yml +1 -1
- package/sdk-core/.github/workflows/heavy.yml +1 -0
- package/sdk-core/README.md +13 -7
- package/sdk-core/client/src/lib.rs +27 -9
- package/sdk-core/client/src/metrics.rs +17 -8
- package/sdk-core/client/src/raw.rs +3 -3
- package/sdk-core/core/Cargo.toml +3 -4
- package/sdk-core/core/src/abstractions/take_cell.rs +28 -0
- package/sdk-core/core/src/abstractions.rs +197 -18
- package/sdk-core/core/src/core_tests/activity_tasks.rs +137 -45
- package/sdk-core/core/src/core_tests/child_workflows.rs +6 -5
- package/sdk-core/core/src/core_tests/determinism.rs +212 -2
- package/sdk-core/core/src/core_tests/local_activities.rs +183 -36
- package/sdk-core/core/src/core_tests/queries.rs +32 -14
- package/sdk-core/core/src/core_tests/workers.rs +8 -5
- package/sdk-core/core/src/core_tests/workflow_tasks.rs +340 -51
- package/sdk-core/core/src/ephemeral_server/mod.rs +110 -8
- package/sdk-core/core/src/internal_flags.rs +141 -0
- package/sdk-core/core/src/lib.rs +14 -9
- package/sdk-core/core/src/replay/mod.rs +16 -27
- package/sdk-core/core/src/telemetry/metrics.rs +69 -35
- package/sdk-core/core/src/telemetry/mod.rs +38 -14
- package/sdk-core/core/src/telemetry/prometheus_server.rs +19 -13
- package/sdk-core/core/src/test_help/mod.rs +65 -13
- package/sdk-core/core/src/worker/activities/activity_heartbeat_manager.rs +119 -160
- package/sdk-core/core/src/worker/activities/activity_task_poller_stream.rs +89 -0
- package/sdk-core/core/src/worker/activities/local_activities.rs +122 -6
- package/sdk-core/core/src/worker/activities.rs +347 -173
- package/sdk-core/core/src/worker/client/mocks.rs +22 -2
- package/sdk-core/core/src/worker/client.rs +18 -2
- package/sdk-core/core/src/worker/mod.rs +137 -44
- package/sdk-core/core/src/worker/workflow/history_update.rs +132 -51
- package/sdk-core/core/src/worker/workflow/machines/activity_state_machine.rs +207 -166
- package/sdk-core/core/src/worker/workflow/machines/cancel_external_state_machine.rs +6 -7
- package/sdk-core/core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +6 -7
- package/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +157 -82
- package/sdk-core/core/src/worker/workflow/machines/complete_workflow_state_machine.rs +12 -12
- package/sdk-core/core/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +6 -7
- package/sdk-core/core/src/worker/workflow/machines/fail_workflow_state_machine.rs +13 -15
- package/sdk-core/core/src/worker/workflow/machines/local_activity_state_machine.rs +170 -60
- package/sdk-core/core/src/worker/workflow/machines/mod.rs +24 -16
- package/sdk-core/core/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs +6 -8
- package/sdk-core/core/src/worker/workflow/machines/patch_state_machine.rs +320 -204
- package/sdk-core/core/src/worker/workflow/machines/signal_external_state_machine.rs +10 -13
- package/sdk-core/core/src/worker/workflow/machines/timer_state_machine.rs +15 -23
- package/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +187 -46
- package/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +237 -111
- package/sdk-core/core/src/worker/workflow/machines/workflow_task_state_machine.rs +13 -13
- package/sdk-core/core/src/worker/workflow/managed_run/managed_wf_test.rs +10 -6
- package/sdk-core/core/src/worker/workflow/managed_run.rs +81 -62
- package/sdk-core/core/src/worker/workflow/mod.rs +341 -79
- package/sdk-core/core/src/worker/workflow/run_cache.rs +18 -11
- package/sdk-core/core/src/worker/workflow/wft_extraction.rs +15 -3
- package/sdk-core/core/src/worker/workflow/workflow_stream/saved_wf_inputs.rs +2 -0
- package/sdk-core/core/src/worker/workflow/workflow_stream.rs +75 -52
- package/sdk-core/core-api/Cargo.toml +0 -1
- package/sdk-core/core-api/src/lib.rs +13 -7
- package/sdk-core/core-api/src/telemetry.rs +4 -6
- package/sdk-core/core-api/src/worker.rs +5 -0
- package/sdk-core/fsm/rustfsm_procmacro/src/lib.rs +80 -55
- package/sdk-core/fsm/rustfsm_trait/src/lib.rs +22 -68
- package/sdk-core/histories/ends_empty_wft_complete.bin +0 -0
- package/sdk-core/histories/old_change_marker_format.bin +0 -0
- package/sdk-core/protos/api_upstream/.github/CODEOWNERS +2 -1
- package/sdk-core/protos/api_upstream/Makefile +1 -1
- package/sdk-core/protos/api_upstream/temporal/api/command/v1/message.proto +5 -17
- package/sdk-core/protos/api_upstream/temporal/api/common/v1/message.proto +11 -0
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/command_type.proto +1 -6
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/event_type.proto +6 -6
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +5 -0
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/update.proto +22 -6
- package/sdk-core/protos/api_upstream/temporal/api/history/v1/message.proto +48 -19
- package/sdk-core/protos/api_upstream/temporal/api/namespace/v1/message.proto +2 -0
- package/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +3 -0
- package/sdk-core/protos/api_upstream/temporal/api/{enums/v1/interaction_type.proto → protocol/v1/message.proto} +29 -11
- package/sdk-core/protos/api_upstream/temporal/api/sdk/v1/task_complete_metadata.proto +63 -0
- package/sdk-core/protos/api_upstream/temporal/api/update/v1/message.proto +111 -0
- package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +59 -28
- package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +2 -2
- package/sdk-core/protos/local/temporal/sdk/core/activity_result/activity_result.proto +7 -8
- package/sdk-core/protos/local/temporal/sdk/core/activity_task/activity_task.proto +10 -7
- package/sdk-core/protos/local/temporal/sdk/core/child_workflow/child_workflow.proto +19 -30
- package/sdk-core/protos/local/temporal/sdk/core/common/common.proto +1 -0
- package/sdk-core/protos/local/temporal/sdk/core/core_interface.proto +1 -0
- package/sdk-core/protos/local/temporal/sdk/core/external_data/external_data.proto +8 -0
- package/sdk-core/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +65 -60
- package/sdk-core/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +85 -84
- package/sdk-core/protos/local/temporal/sdk/core/workflow_completion/workflow_completion.proto +9 -3
- package/sdk-core/sdk/Cargo.toml +1 -1
- package/sdk-core/sdk/src/lib.rs +21 -5
- package/sdk-core/sdk/src/workflow_context/options.rs +7 -1
- package/sdk-core/sdk/src/workflow_context.rs +24 -17
- package/sdk-core/sdk/src/workflow_future.rs +9 -3
- package/sdk-core/sdk-core-protos/src/history_builder.rs +114 -89
- package/sdk-core/sdk-core-protos/src/history_info.rs +6 -1
- package/sdk-core/sdk-core-protos/src/lib.rs +205 -64
- package/sdk-core/test-utils/src/canned_histories.rs +106 -296
- package/sdk-core/test-utils/src/lib.rs +32 -5
- package/sdk-core/tests/heavy_tests.rs +10 -43
- package/sdk-core/tests/integ_tests/ephemeral_server_tests.rs +25 -3
- package/sdk-core/tests/integ_tests/heartbeat_tests.rs +5 -3
- package/sdk-core/tests/integ_tests/metrics_tests.rs +218 -16
- package/sdk-core/tests/integ_tests/polling_tests.rs +3 -8
- package/sdk-core/tests/integ_tests/queries_tests.rs +4 -2
- package/sdk-core/tests/integ_tests/visibility_tests.rs +34 -23
- package/sdk-core/tests/integ_tests/workflow_tests/activities.rs +97 -81
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +1 -0
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +1 -0
- package/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +80 -3
- package/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +5 -1
- package/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +1 -0
- package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +25 -3
- package/sdk-core/tests/integ_tests/workflow_tests/modify_wf_properties.rs +2 -4
- package/sdk-core/tests/integ_tests/workflow_tests/patches.rs +30 -0
- package/sdk-core/tests/integ_tests/workflow_tests/replay.rs +64 -0
- package/sdk-core/tests/integ_tests/workflow_tests/resets.rs +1 -0
- package/sdk-core/tests/integ_tests/workflow_tests/signals.rs +4 -0
- package/sdk-core/tests/integ_tests/workflow_tests/stickyness.rs +3 -1
- package/sdk-core/tests/integ_tests/workflow_tests/timers.rs +7 -2
- package/sdk-core/tests/integ_tests/workflow_tests/upsert_search_attrs.rs +6 -7
- package/sdk-core/tests/integ_tests/workflow_tests.rs +8 -8
- package/sdk-core/tests/main.rs +16 -25
- package/sdk-core/tests/runner.rs +11 -9
- package/src/conversions.rs +14 -8
- package/src/runtime.rs +9 -8
- package/ts/index.ts +8 -6
- package/sdk-core/protos/api_upstream/temporal/api/interaction/v1/message.proto +0 -87
|
@@ -12,11 +12,18 @@ mod history_info;
|
|
|
12
12
|
mod task_token;
|
|
13
13
|
|
|
14
14
|
#[cfg(feature = "history_builders")]
|
|
15
|
-
pub use history_builder::{
|
|
15
|
+
pub use history_builder::{
|
|
16
|
+
default_act_sched, default_wes_attribs, TestHistoryBuilder, DEFAULT_ACTIVITY_TYPE,
|
|
17
|
+
DEFAULT_WORKFLOW_TYPE,
|
|
18
|
+
};
|
|
16
19
|
#[cfg(feature = "history_builders")]
|
|
17
20
|
pub use history_info::HistoryInfo;
|
|
18
21
|
pub use task_token::TaskToken;
|
|
19
22
|
|
|
23
|
+
pub static ENCODING_PAYLOAD_KEY: &str = "encoding";
|
|
24
|
+
pub static JSON_ENCODING_VAL: &str = "json/plain";
|
|
25
|
+
pub static PATCHED_MARKER_DETAILS_KEY: &str = "patch-data";
|
|
26
|
+
|
|
20
27
|
#[allow(clippy::large_enum_variant, clippy::derive_partial_eq_without_eq)]
|
|
21
28
|
// I'd prefer not to do this, but there are some generated things that just don't need it.
|
|
22
29
|
#[allow(missing_docs)]
|
|
@@ -25,10 +32,14 @@ pub mod coresdk {
|
|
|
25
32
|
|
|
26
33
|
tonic::include_proto!("coresdk");
|
|
27
34
|
|
|
28
|
-
use crate::
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
35
|
+
use crate::{
|
|
36
|
+
temporal::api::{
|
|
37
|
+
common::v1::{Payload, Payloads, WorkflowExecution},
|
|
38
|
+
enums::v1::WorkflowTaskFailedCause,
|
|
39
|
+
failure::v1::{failure::FailureInfo, ApplicationFailureInfo, Failure},
|
|
40
|
+
workflowservice::v1::PollActivityTaskQueueResponse,
|
|
41
|
+
},
|
|
42
|
+
ENCODING_PAYLOAD_KEY, JSON_ENCODING_VAL,
|
|
32
43
|
};
|
|
33
44
|
use activity_task::ActivityTask;
|
|
34
45
|
use serde::{Deserialize, Serialize};
|
|
@@ -82,7 +93,10 @@ pub mod coresdk {
|
|
|
82
93
|
common::v1::Payload,
|
|
83
94
|
failure::v1::{failure, CanceledFailureInfo, Failure as APIFailure},
|
|
84
95
|
};
|
|
85
|
-
use crate::
|
|
96
|
+
use crate::{
|
|
97
|
+
coresdk::activity_result::activity_resolution::Status,
|
|
98
|
+
temporal::api::enums::v1::TimeoutType,
|
|
99
|
+
};
|
|
86
100
|
use activity_execution_result as aer;
|
|
87
101
|
use std::fmt::{Display, Formatter};
|
|
88
102
|
|
|
@@ -185,7 +199,7 @@ pub mod coresdk {
|
|
|
185
199
|
pub fn unwrap_ok_payload(self) -> Payload {
|
|
186
200
|
match self.status.unwrap() {
|
|
187
201
|
activity_resolution::Status::Completed(c) => c.result.unwrap(),
|
|
188
|
-
|
|
202
|
+
e => panic!("Activity was not successful: {e:?}"),
|
|
189
203
|
}
|
|
190
204
|
}
|
|
191
205
|
|
|
@@ -197,7 +211,7 @@ pub mod coresdk {
|
|
|
197
211
|
matches!(self.status, Some(activity_resolution::Status::Failed(_)))
|
|
198
212
|
}
|
|
199
213
|
|
|
200
|
-
pub fn timed_out(&self) -> Option<
|
|
214
|
+
pub fn timed_out(&self) -> Option<TimeoutType> {
|
|
201
215
|
match self.status {
|
|
202
216
|
Some(activity_resolution::Status::Failed(Failure {
|
|
203
217
|
failure: Some(ref f),
|
|
@@ -211,33 +225,28 @@ pub mod coresdk {
|
|
|
211
225
|
pub fn cancelled(&self) -> bool {
|
|
212
226
|
matches!(self.status, Some(activity_resolution::Status::Cancelled(_)))
|
|
213
227
|
}
|
|
228
|
+
|
|
229
|
+
/// If this resolution is any kind of failure, return the inner failure details. Panics
|
|
230
|
+
/// if the activity succeeded, is in backoff, or this resolution is malformed.
|
|
231
|
+
pub fn unwrap_failure(self) -> APIFailure {
|
|
232
|
+
match self.status.unwrap() {
|
|
233
|
+
Status::Failed(f) => f.failure.unwrap(),
|
|
234
|
+
Status::Cancelled(c) => c.failure.unwrap(),
|
|
235
|
+
_ => panic!("Actvity did not fail"),
|
|
236
|
+
}
|
|
237
|
+
}
|
|
214
238
|
}
|
|
215
239
|
|
|
216
240
|
impl Cancellation {
|
|
217
|
-
|
|
241
|
+
/// Create a cancellation result from some payload. This is to be used when telling Core
|
|
242
|
+
/// that an activity completed as cancelled.
|
|
243
|
+
pub fn from_details(details: Option<Payload>) -> Self {
|
|
218
244
|
Cancellation {
|
|
219
245
|
failure: Some(APIFailure {
|
|
220
246
|
message: "Activity cancelled".to_string(),
|
|
221
247
|
failure_info: Some(failure::FailureInfo::CanceledFailureInfo(
|
|
222
248
|
CanceledFailureInfo {
|
|
223
|
-
details:
|
|
224
|
-
},
|
|
225
|
-
)),
|
|
226
|
-
..Default::default()
|
|
227
|
-
}),
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
impl Failure {
|
|
233
|
-
pub fn timeout(timeout_type: TimeoutType) -> Self {
|
|
234
|
-
Failure {
|
|
235
|
-
failure: Some(APIFailure {
|
|
236
|
-
message: "Activity timed out".to_string(),
|
|
237
|
-
failure_info: Some(failure::FailureInfo::TimeoutFailureInfo(
|
|
238
|
-
TimeoutFailureInfo {
|
|
239
|
-
timeout_type: timeout_type as i32,
|
|
240
|
-
last_heartbeat_details: None,
|
|
249
|
+
details: details.map(Into::into),
|
|
241
250
|
},
|
|
242
251
|
)),
|
|
243
252
|
..Default::default()
|
|
@@ -251,28 +260,43 @@ pub mod coresdk {
|
|
|
251
260
|
tonic::include_proto!("coresdk.common");
|
|
252
261
|
use super::external_data::LocalActivityMarkerData;
|
|
253
262
|
use crate::{
|
|
254
|
-
coresdk::{
|
|
263
|
+
coresdk::{
|
|
264
|
+
external_data::PatchedMarkerData, AsJsonPayloadExt, FromJsonPayloadExt,
|
|
265
|
+
IntoPayloadsExt,
|
|
266
|
+
},
|
|
255
267
|
temporal::api::common::v1::{Payload, Payloads},
|
|
268
|
+
PATCHED_MARKER_DETAILS_KEY,
|
|
256
269
|
};
|
|
257
270
|
use std::collections::HashMap;
|
|
258
271
|
|
|
259
272
|
pub fn build_has_change_marker_details(
|
|
260
|
-
patch_id:
|
|
273
|
+
patch_id: impl Into<String>,
|
|
261
274
|
deprecated: bool,
|
|
262
|
-
) -> HashMap<String, Payloads
|
|
275
|
+
) -> anyhow::Result<HashMap<String, Payloads>> {
|
|
263
276
|
let mut hm = HashMap::new();
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
277
|
+
let encoded = PatchedMarkerData {
|
|
278
|
+
id: patch_id.into(),
|
|
279
|
+
deprecated,
|
|
280
|
+
}
|
|
281
|
+
.as_json_payload()?;
|
|
282
|
+
hm.insert(PATCHED_MARKER_DETAILS_KEY.to_string(), encoded.into());
|
|
283
|
+
Ok(hm)
|
|
268
284
|
}
|
|
269
285
|
|
|
270
286
|
pub fn decode_change_marker_details(
|
|
271
287
|
details: &HashMap<String, Payloads>,
|
|
272
288
|
) -> Option<(String, bool)> {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
let
|
|
289
|
+
// We used to write change markers with plain bytes, so try to decode if they are
|
|
290
|
+
// json first, then fall back to that.
|
|
291
|
+
if let Some(cd) = details.get(PATCHED_MARKER_DETAILS_KEY) {
|
|
292
|
+
let decoded = PatchedMarkerData::from_json_payload(cd.payloads.first()?).ok()?;
|
|
293
|
+
return Some((decoded.id, decoded.deprecated));
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
let id_entry = details.get("patch_id")?.payloads.first()?;
|
|
297
|
+
let deprecated_entry = details.get("deprecated")?.payloads.first()?;
|
|
298
|
+
let name = std::str::from_utf8(&id_entry.data).ok()?;
|
|
299
|
+
let deprecated = *deprecated_entry.data.first()? != 0;
|
|
276
300
|
Some((name.to_string(), deprecated))
|
|
277
301
|
}
|
|
278
302
|
|
|
@@ -396,6 +420,7 @@ pub mod coresdk {
|
|
|
396
420
|
},
|
|
397
421
|
temporal::api::{
|
|
398
422
|
common::v1::Header,
|
|
423
|
+
enums::v1::WorkflowTaskFailedCause,
|
|
399
424
|
history::v1::{
|
|
400
425
|
WorkflowExecutionCancelRequestedEventAttributes,
|
|
401
426
|
WorkflowExecutionSignaledEventAttributes,
|
|
@@ -428,6 +453,7 @@ pub mod coresdk {
|
|
|
428
453
|
reason: reason as i32,
|
|
429
454
|
}),
|
|
430
455
|
)],
|
|
456
|
+
available_internal_flags: vec![],
|
|
431
457
|
}
|
|
432
458
|
}
|
|
433
459
|
|
|
@@ -495,6 +521,17 @@ pub mod coresdk {
|
|
|
495
521
|
}
|
|
496
522
|
}
|
|
497
523
|
|
|
524
|
+
impl From<EvictionReason> for WorkflowTaskFailedCause {
|
|
525
|
+
fn from(value: EvictionReason) -> Self {
|
|
526
|
+
match value {
|
|
527
|
+
EvictionReason::Nondeterminism => {
|
|
528
|
+
WorkflowTaskFailedCause::NonDeterministicError
|
|
529
|
+
}
|
|
530
|
+
_ => WorkflowTaskFailedCause::Unspecified,
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
|
|
498
535
|
impl Display for WorkflowActivation {
|
|
499
536
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
|
500
537
|
write!(f, "WorkflowActivation(")?;
|
|
@@ -640,7 +677,7 @@ pub mod coresdk {
|
|
|
640
677
|
}
|
|
641
678
|
|
|
642
679
|
pub mod workflow_completion {
|
|
643
|
-
use crate::temporal::api::failure;
|
|
680
|
+
use crate::temporal::api::{enums::v1::WorkflowTaskFailedCause, failure};
|
|
644
681
|
tonic::include_proto!("coresdk.workflow_completion");
|
|
645
682
|
|
|
646
683
|
impl workflow_activation_completion::Status {
|
|
@@ -654,7 +691,10 @@ pub mod coresdk {
|
|
|
654
691
|
|
|
655
692
|
impl From<failure::v1::Failure> for Failure {
|
|
656
693
|
fn from(f: failure::v1::Failure) -> Self {
|
|
657
|
-
Failure {
|
|
694
|
+
Failure {
|
|
695
|
+
failure: Some(f),
|
|
696
|
+
force_cause: WorkflowTaskFailedCause::Unspecified as i32,
|
|
697
|
+
}
|
|
658
698
|
}
|
|
659
699
|
}
|
|
660
700
|
}
|
|
@@ -853,7 +893,10 @@ pub mod coresdk {
|
|
|
853
893
|
|
|
854
894
|
impl From<Vec<WorkflowCommand>> for workflow_completion::Success {
|
|
855
895
|
fn from(v: Vec<WorkflowCommand>) -> Self {
|
|
856
|
-
Self {
|
|
896
|
+
Self {
|
|
897
|
+
commands: v,
|
|
898
|
+
used_internal_flags: vec![],
|
|
899
|
+
}
|
|
857
900
|
}
|
|
858
901
|
}
|
|
859
902
|
|
|
@@ -907,6 +950,7 @@ pub mod coresdk {
|
|
|
907
950
|
status: Some(workflow_activation_completion::Status::Failed(
|
|
908
951
|
workflow_completion::Failure {
|
|
909
952
|
failure: Some(failure),
|
|
953
|
+
force_cause: WorkflowTaskFailedCause::Unspecified as i32,
|
|
910
954
|
},
|
|
911
955
|
)),
|
|
912
956
|
}
|
|
@@ -990,6 +1034,12 @@ pub mod coresdk {
|
|
|
990
1034
|
}
|
|
991
1035
|
false
|
|
992
1036
|
}
|
|
1037
|
+
|
|
1038
|
+
pub fn add_internal_flags(&mut self, patch: u32) {
|
|
1039
|
+
if let Some(workflow_activation_completion::Status::Successful(s)) = &mut self.status {
|
|
1040
|
+
s.used_internal_flags.push(patch);
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
993
1043
|
}
|
|
994
1044
|
|
|
995
1045
|
/// Makes converting outgoing lang commands into [WorkflowActivationCompletion]s easier
|
|
@@ -1037,7 +1087,7 @@ pub mod coresdk {
|
|
|
1037
1087
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
|
1038
1088
|
match self {
|
|
1039
1089
|
workflow_activation_completion::Status::Successful(
|
|
1040
|
-
workflow_completion::Success { commands },
|
|
1090
|
+
workflow_completion::Success { commands, .. },
|
|
1041
1091
|
) => {
|
|
1042
1092
|
write!(f, "Success(")?;
|
|
1043
1093
|
let mut written = 0;
|
|
@@ -1094,18 +1144,6 @@ pub mod coresdk {
|
|
|
1094
1144
|
}
|
|
1095
1145
|
}
|
|
1096
1146
|
|
|
1097
|
-
impl From<String> for ActivityType {
|
|
1098
|
-
fn from(name: String) -> Self {
|
|
1099
|
-
Self { name }
|
|
1100
|
-
}
|
|
1101
|
-
}
|
|
1102
|
-
|
|
1103
|
-
impl From<ActivityType> for String {
|
|
1104
|
-
fn from(at: ActivityType) -> Self {
|
|
1105
|
-
at.name
|
|
1106
|
-
}
|
|
1107
|
-
}
|
|
1108
|
-
|
|
1109
1147
|
impl Failure {
|
|
1110
1148
|
pub fn is_timeout(&self) -> Option<crate::temporal::api::enums::v1::TimeoutType> {
|
|
1111
1149
|
match &self.failure_info {
|
|
@@ -1294,7 +1332,10 @@ pub mod coresdk {
|
|
|
1294
1332
|
fn as_json_payload(&self) -> anyhow::Result<Payload> {
|
|
1295
1333
|
let as_json = serde_json::to_string(self)?;
|
|
1296
1334
|
let mut metadata = HashMap::new();
|
|
1297
|
-
metadata.insert(
|
|
1335
|
+
metadata.insert(
|
|
1336
|
+
ENCODING_PAYLOAD_KEY.to_string(),
|
|
1337
|
+
JSON_ENCODING_VAL.as_bytes().to_vec(),
|
|
1338
|
+
);
|
|
1298
1339
|
Ok(Payload {
|
|
1299
1340
|
metadata,
|
|
1300
1341
|
data: as_json.into_bytes(),
|
|
@@ -1310,10 +1351,7 @@ pub mod coresdk {
|
|
|
1310
1351
|
T: for<'de> Deserialize<'de>,
|
|
1311
1352
|
{
|
|
1312
1353
|
fn from_json_payload(payload: &Payload) -> Result<Self, PayloadDeserializeErr> {
|
|
1313
|
-
if !
|
|
1314
|
-
payload.metadata.get("encoding").map(|v| v.as_slice()),
|
|
1315
|
-
Some(b"json/plain")
|
|
1316
|
-
) {
|
|
1354
|
+
if !payload.is_json_payload() {
|
|
1317
1355
|
return Err(PayloadDeserializeErr::DeserializerDoesNotHandle);
|
|
1318
1356
|
}
|
|
1319
1357
|
let payload_str = std::str::from_utf8(&payload.data).map_err(anyhow::Error::from)?;
|
|
@@ -1573,6 +1611,7 @@ pub mod temporal {
|
|
|
1573
1611
|
}
|
|
1574
1612
|
pub mod common {
|
|
1575
1613
|
pub mod v1 {
|
|
1614
|
+
use crate::{ENCODING_PAYLOAD_KEY, JSON_ENCODING_VAL};
|
|
1576
1615
|
use base64::{prelude::BASE64_STANDARD, Engine};
|
|
1577
1616
|
use std::{
|
|
1578
1617
|
collections::HashMap,
|
|
@@ -1588,7 +1627,7 @@ pub mod temporal {
|
|
|
1588
1627
|
// TODO: Set better encodings, whole data converter deal. Setting anything
|
|
1589
1628
|
// for now at least makes it show up in the web UI.
|
|
1590
1629
|
let mut metadata = HashMap::new();
|
|
1591
|
-
metadata.insert(
|
|
1630
|
+
metadata.insert(ENCODING_PAYLOAD_KEY.to_string(), b"binary/plain".to_vec());
|
|
1592
1631
|
Self {
|
|
1593
1632
|
metadata,
|
|
1594
1633
|
data: v.as_ref().to_vec(),
|
|
@@ -1601,6 +1640,13 @@ pub mod temporal {
|
|
|
1601
1640
|
pub fn as_slice(&self) -> &[u8] {
|
|
1602
1641
|
self.data.as_slice()
|
|
1603
1642
|
}
|
|
1643
|
+
|
|
1644
|
+
pub fn is_json_payload(&self) -> bool {
|
|
1645
|
+
self.metadata
|
|
1646
|
+
.get(ENCODING_PAYLOAD_KEY)
|
|
1647
|
+
.map(|v| v.as_slice() == JSON_ENCODING_VAL.as_bytes())
|
|
1648
|
+
.unwrap_or_default()
|
|
1649
|
+
}
|
|
1604
1650
|
}
|
|
1605
1651
|
|
|
1606
1652
|
impl Display for Payload {
|
|
@@ -1658,6 +1704,26 @@ pub mod temporal {
|
|
|
1658
1704
|
}
|
|
1659
1705
|
}
|
|
1660
1706
|
}
|
|
1707
|
+
|
|
1708
|
+
impl From<String> for ActivityType {
|
|
1709
|
+
fn from(name: String) -> Self {
|
|
1710
|
+
Self { name }
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
impl From<&str> for ActivityType {
|
|
1715
|
+
fn from(name: &str) -> Self {
|
|
1716
|
+
Self {
|
|
1717
|
+
name: name.to_string(),
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
|
|
1722
|
+
impl From<ActivityType> for String {
|
|
1723
|
+
fn from(at: ActivityType) -> Self {
|
|
1724
|
+
at.name
|
|
1725
|
+
}
|
|
1726
|
+
}
|
|
1661
1727
|
}
|
|
1662
1728
|
}
|
|
1663
1729
|
pub mod enums {
|
|
@@ -1723,6 +1789,7 @@ pub mod temporal {
|
|
|
1723
1789
|
| EventType::TimerCanceled
|
|
1724
1790
|
| EventType::TimerStarted
|
|
1725
1791
|
| EventType::UpsertWorkflowSearchAttributes
|
|
1792
|
+
| EventType::WorkflowPropertiesModified
|
|
1726
1793
|
| EventType::WorkflowExecutionCanceled
|
|
1727
1794
|
| EventType::WorkflowExecutionCompleted
|
|
1728
1795
|
| EventType::WorkflowExecutionContinuedAsNew
|
|
@@ -1781,6 +1848,15 @@ pub mod temporal {
|
|
|
1781
1848
|
_ => false,
|
|
1782
1849
|
}
|
|
1783
1850
|
}
|
|
1851
|
+
|
|
1852
|
+
pub fn is_wft_closed_event(&self) -> bool {
|
|
1853
|
+
match self.event_type() {
|
|
1854
|
+
EventType::WorkflowTaskCompleted => true,
|
|
1855
|
+
EventType::WorkflowTaskFailed => true,
|
|
1856
|
+
EventType::WorkflowTaskTimedOut => true,
|
|
1857
|
+
_ => false,
|
|
1858
|
+
}
|
|
1859
|
+
}
|
|
1784
1860
|
}
|
|
1785
1861
|
|
|
1786
1862
|
impl Display for HistoryEvent {
|
|
@@ -1793,11 +1869,60 @@ pub mod temporal {
|
|
|
1793
1869
|
)
|
|
1794
1870
|
}
|
|
1795
1871
|
}
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1872
|
+
|
|
1873
|
+
impl Attributes {
|
|
1874
|
+
pub fn event_type(&self) -> EventType {
|
|
1875
|
+
// I just absolutely _love_ this
|
|
1876
|
+
match self {
|
|
1877
|
+
Attributes::WorkflowExecutionStartedEventAttributes(_) => {EventType::WorkflowExecutionStarted}
|
|
1878
|
+
Attributes::WorkflowExecutionCompletedEventAttributes(_) => {EventType::WorkflowExecutionCompleted}
|
|
1879
|
+
Attributes::WorkflowExecutionFailedEventAttributes(_) => {EventType::WorkflowExecutionFailed}
|
|
1880
|
+
Attributes::WorkflowExecutionTimedOutEventAttributes(_) => {EventType::WorkflowExecutionTimedOut}
|
|
1881
|
+
Attributes::WorkflowTaskScheduledEventAttributes(_) => {EventType::WorkflowTaskScheduled}
|
|
1882
|
+
Attributes::WorkflowTaskStartedEventAttributes(_) => {EventType::WorkflowTaskStarted}
|
|
1883
|
+
Attributes::WorkflowTaskCompletedEventAttributes(_) => {EventType::WorkflowTaskCompleted}
|
|
1884
|
+
Attributes::WorkflowTaskTimedOutEventAttributes(_) => {EventType::WorkflowTaskTimedOut}
|
|
1885
|
+
Attributes::WorkflowTaskFailedEventAttributes(_) => {EventType::WorkflowTaskFailed}
|
|
1886
|
+
Attributes::ActivityTaskScheduledEventAttributes(_) => {EventType::ActivityTaskScheduled}
|
|
1887
|
+
Attributes::ActivityTaskStartedEventAttributes(_) => {EventType::ActivityTaskStarted}
|
|
1888
|
+
Attributes::ActivityTaskCompletedEventAttributes(_) => {EventType::ActivityTaskCompleted}
|
|
1889
|
+
Attributes::ActivityTaskFailedEventAttributes(_) => {EventType::ActivityTaskFailed}
|
|
1890
|
+
Attributes::ActivityTaskTimedOutEventAttributes(_) => {EventType::ActivityTaskTimedOut}
|
|
1891
|
+
Attributes::TimerStartedEventAttributes(_) => {EventType::TimerStarted}
|
|
1892
|
+
Attributes::TimerFiredEventAttributes(_) => {EventType::TimerFired}
|
|
1893
|
+
Attributes::ActivityTaskCancelRequestedEventAttributes(_) => {EventType::ActivityTaskCancelRequested}
|
|
1894
|
+
Attributes::ActivityTaskCanceledEventAttributes(_) => {EventType::ActivityTaskCanceled}
|
|
1895
|
+
Attributes::TimerCanceledEventAttributes(_) => {EventType::TimerCanceled}
|
|
1896
|
+
Attributes::MarkerRecordedEventAttributes(_) => {EventType::MarkerRecorded}
|
|
1897
|
+
Attributes::WorkflowExecutionSignaledEventAttributes(_) => {EventType::WorkflowExecutionSignaled}
|
|
1898
|
+
Attributes::WorkflowExecutionTerminatedEventAttributes(_) => {EventType::WorkflowExecutionTerminated}
|
|
1899
|
+
Attributes::WorkflowExecutionCancelRequestedEventAttributes(_) => {EventType::WorkflowExecutionCancelRequested}
|
|
1900
|
+
Attributes::WorkflowExecutionCanceledEventAttributes(_) => {EventType::WorkflowExecutionCanceled}
|
|
1901
|
+
Attributes::RequestCancelExternalWorkflowExecutionInitiatedEventAttributes(_) => {EventType::RequestCancelExternalWorkflowExecutionInitiated}
|
|
1902
|
+
Attributes::RequestCancelExternalWorkflowExecutionFailedEventAttributes(_) => {EventType::RequestCancelExternalWorkflowExecutionFailed}
|
|
1903
|
+
Attributes::ExternalWorkflowExecutionCancelRequestedEventAttributes(_) => {EventType::ExternalWorkflowExecutionCancelRequested}
|
|
1904
|
+
Attributes::WorkflowExecutionContinuedAsNewEventAttributes(_) => {EventType::WorkflowExecutionContinuedAsNew}
|
|
1905
|
+
Attributes::StartChildWorkflowExecutionInitiatedEventAttributes(_) => {EventType::StartChildWorkflowExecutionInitiated}
|
|
1906
|
+
Attributes::StartChildWorkflowExecutionFailedEventAttributes(_) => {EventType::StartChildWorkflowExecutionFailed}
|
|
1907
|
+
Attributes::ChildWorkflowExecutionStartedEventAttributes(_) => {EventType::ChildWorkflowExecutionStarted}
|
|
1908
|
+
Attributes::ChildWorkflowExecutionCompletedEventAttributes(_) => {EventType::ChildWorkflowExecutionCompleted}
|
|
1909
|
+
Attributes::ChildWorkflowExecutionFailedEventAttributes(_) => {EventType::ChildWorkflowExecutionFailed}
|
|
1910
|
+
Attributes::ChildWorkflowExecutionCanceledEventAttributes(_) => {EventType::ChildWorkflowExecutionCanceled}
|
|
1911
|
+
Attributes::ChildWorkflowExecutionTimedOutEventAttributes(_) => {EventType::ChildWorkflowExecutionTimedOut}
|
|
1912
|
+
Attributes::ChildWorkflowExecutionTerminatedEventAttributes(_) => {EventType::ChildWorkflowExecutionTerminated}
|
|
1913
|
+
Attributes::SignalExternalWorkflowExecutionInitiatedEventAttributes(_) => {EventType::SignalExternalWorkflowExecutionInitiated}
|
|
1914
|
+
Attributes::SignalExternalWorkflowExecutionFailedEventAttributes(_) => {EventType::SignalExternalWorkflowExecutionFailed}
|
|
1915
|
+
Attributes::ExternalWorkflowExecutionSignaledEventAttributes(_) => {EventType::ExternalWorkflowExecutionSignaled}
|
|
1916
|
+
Attributes::UpsertWorkflowSearchAttributesEventAttributes(_) => {EventType::UpsertWorkflowSearchAttributes}
|
|
1917
|
+
Attributes::WorkflowExecutionUpdateRejectedEventAttributes(_) => {EventType::WorkflowExecutionUpdateRejected}
|
|
1918
|
+
Attributes::WorkflowExecutionUpdateAcceptedEventAttributes(_) => {EventType::WorkflowExecutionUpdateAccepted}
|
|
1919
|
+
Attributes::WorkflowExecutionUpdateCompletedEventAttributes(_) => {EventType::WorkflowExecutionUpdateCompleted}
|
|
1920
|
+
Attributes::WorkflowPropertiesModifiedExternallyEventAttributes(_) => {EventType::WorkflowPropertiesModifiedExternally}
|
|
1921
|
+
Attributes::ActivityPropertiesModifiedExternallyEventAttributes(_) => {EventType::ActivityPropertiesModifiedExternally}
|
|
1922
|
+
Attributes::WorkflowPropertiesModifiedEventAttributes(_) => {EventType::WorkflowPropertiesModified}
|
|
1923
|
+
}
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1801
1926
|
}
|
|
1802
1927
|
}
|
|
1803
1928
|
pub mod namespace {
|
|
@@ -1810,6 +1935,11 @@ pub mod temporal {
|
|
|
1810
1935
|
tonic::include_proto!("temporal.api.operatorservice.v1");
|
|
1811
1936
|
}
|
|
1812
1937
|
}
|
|
1938
|
+
pub mod protocol {
|
|
1939
|
+
pub mod v1 {
|
|
1940
|
+
tonic::include_proto!("temporal.api.protocol.v1");
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1813
1943
|
pub mod query {
|
|
1814
1944
|
pub mod v1 {
|
|
1815
1945
|
tonic::include_proto!("temporal.api.query.v1");
|
|
@@ -1821,10 +1951,16 @@ pub mod temporal {
|
|
|
1821
1951
|
}
|
|
1822
1952
|
}
|
|
1823
1953
|
pub mod schedule {
|
|
1954
|
+
#[allow(rustdoc::invalid_html_tags)]
|
|
1824
1955
|
pub mod v1 {
|
|
1825
1956
|
tonic::include_proto!("temporal.api.schedule.v1");
|
|
1826
1957
|
}
|
|
1827
1958
|
}
|
|
1959
|
+
pub mod sdk {
|
|
1960
|
+
pub mod v1 {
|
|
1961
|
+
tonic::include_proto!("temporal.api.sdk.v1");
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1828
1964
|
pub mod taskqueue {
|
|
1829
1965
|
pub mod v1 {
|
|
1830
1966
|
use crate::temporal::api::enums::v1::TaskQueueKind;
|
|
@@ -1845,6 +1981,11 @@ pub mod temporal {
|
|
|
1845
1981
|
tonic::include_proto!("temporal.api.testservice.v1");
|
|
1846
1982
|
}
|
|
1847
1983
|
}
|
|
1984
|
+
pub mod update {
|
|
1985
|
+
pub mod v1 {
|
|
1986
|
+
tonic::include_proto!("temporal.api.update.v1");
|
|
1987
|
+
}
|
|
1988
|
+
}
|
|
1848
1989
|
pub mod version {
|
|
1849
1990
|
pub mod v1 {
|
|
1850
1991
|
tonic::include_proto!("temporal.api.version.v1");
|