1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// Copyright (c) 2026 Super Durable, Inc.
//
// Licensed under the Sustainable Use License 1.0.
// You may not use this file except in compliance with the License.
// See the LICENSE file in the repository root.
//
// SPDX-License-Identifier: LicenseRef-Sustainable-Use-1.0
use std::collections::BTreeMap;
use std::time::SystemTime;
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
/// Describes the current or terminal state of a Flow run.
pub enum FlowStatus {
/// The Flow can still execute Steps or receive RPCs and Channel messages.
Running,
/// The Flow completed successfully.
Completed,
/// The Flow ended because a Step, RPC, or user-code failure was not recovered.
Failed,
/// Reserved for backend hard-timeout reporting. Applications must not depend on this status.
ServerSideTimeoutInternalOnly,
/// An operator terminated the Flow immediately.
Terminated,
/// The Flow completed cooperative cancellation.
Canceled,
/// The run rolled its history into a successor run.
ContinuedAsNew,
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
/// Categorizes the failure recorded for an uncompleted Flow.
pub enum FlowErrorType {
/// A Step returned an invalid or failing decision.
StepDecisionFailed,
/// A client API operation failed the Flow.
ClientApiFailed,
/// A Worker Step or RPC handler failed.
WorkerApiFailed,
/// The registered Flow or Step definition violated an SDK contract.
InvalidUserFlowCode,
/// Dex encountered an internal failure.
Internal,
/// A Dex soft Flow timeout expired under the fail policy.
FlowTimeout,
}
#[derive(Clone, Debug, Eq, PartialEq)]
/// Summarizes one Flow run returned by [`crate::Client::describe_flow`].
pub struct FlowInfo {
/// Application-assigned Flow ID.
pub flow_id: String,
/// Server-assigned run ID for the described execution.
pub run_id: String,
/// Registered Flow type name.
pub flow_type: String,
/// Current or terminal status.
pub status: FlowStatus,
/// Server-recorded start time.
pub started_at: SystemTime,
}
#[derive(Clone, Debug, PartialEq)]
/// Contains one Flow row returned by a search query.
pub struct SearchFlowEntry {
/// Application-assigned Flow ID.
pub flow_id: String,
/// Server-assigned run ID.
pub run_id: String,
/// Registered Flow type name.
pub flow_type: String,
/// Status captured by the search index.
pub status: FlowStatus,
/// Indexed start time, or `None` when unavailable.
pub started_at: Option<SystemTime>,
/// Indexed close time, or `None` while open or unavailable.
pub closed_at: Option<SystemTime>,
/// Values keyed by their physical Indexed Attribute names.
pub indexed_attributes: BTreeMap<String, serde_json::Value>,
}
#[derive(Clone, Debug, PartialEq)]
/// Contains one page of [`crate::Client::search_flows`] results.
pub struct SearchFlowsPage {
/// Flow rows in server-defined query order.
pub flows: Vec<SearchFlowEntry>,
/// Opaque token for [`crate::Client::search_flows_page`], or empty on the last page.
pub next_page_token: String,
}