-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathobelisk_webhook@5.3.0.wit
More file actions
144 lines (127 loc) · 6.09 KB
/
Copy pathobelisk_webhook@5.3.0.wit
File metadata and controls
144 lines (127 loc) · 6.09 KB
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
package obelisk:webhook@5.3.0;
@since(version = 5.0.0)
interface webhook-support {
use obelisk:types/time@4.2.0.{schedule-at, datetime};
use obelisk:types/execution@4.2.0.{execution-id, function, submit-config, schedule-json-error};
use obelisk:types/backtrace@4.2.0.{wasm-backtrace};
/// Error variants that may occur when calling `get-status`.
@since(version = 5.0.0)
variant get-status-error {
/// Cannot parse the execution ID.
execution-id-parsing-error(string),
/// The execution was not found.
not-found,
}
/// Error variants that may occur when calling `get`.
@since(version = 5.0.0)
variant get-error {
/// Cannot parse the execution ID.
execution-id-parsing-error(string),
/// The execution was not found.
not-found,
}
/// Error variants that may occur when calling `try-get`.
@since(version = 5.0.0)
variant try-get-error {
/// Cannot parse the execution ID.
execution-id-parsing-error(string),
/// The execution was not found.
not-found,
/// The execution has not finished yet.
not-finished-yet,
}
/// The status of an execution.
///
/// Superseded by `execution-status-v2`, which additionally reports the
/// `cancelling` state. Kept unchanged for backwards compatibility.
@since(version = 5.0.0)
variant execution-status {
/// Execution is scheduled to run at a specific time.
pending-at(datetime),
/// Execution is currently being processed.
locked,
/// Execution is currently paused.
paused,
/// Execution is waiting for child executions to complete (workflows only).
blocked-by-join-set,
/// Execution has finished.
finished(execution-status-finished),
}
/// The status of an execution, including cancellation.
@since(version = 5.3.0)
variant execution-status-v2 {
/// Execution is scheduled to run at a specific time.
pending-at(datetime),
/// Execution is currently being processed.
locked,
/// Execution is currently paused.
paused,
/// Execution is waiting for child executions to complete (workflows only).
blocked-by-join-set,
/// Cancellation has been requested; the execution is being torn down.
cancelling,
/// Execution has finished.
finished(execution-status-finished),
}
/// The finished status of an execution.
@since(version = 5.0.0)
variant execution-status-finished {
/// Execution has finished with a successful result.
ok,
/// Execution has finished with an error result (user-level error).
err,
/// Execution has terminated due to an execution failure (system-level error).
execution-failure,
}
/// Generate a new top-level execution ID.
@since(version = 5.0.0)
execution-id-generate: func() -> execution-id;
/// Use `execution-id-get`
@since(version = 5.1.0)
@deprecated(version = 5.2.0)
current-execution-id: func() -> execution-id;
/// Get the execution ID of the current webhook handler invocation.
/// Returns the ID assigned to this webhook execution by the engine.
@since(version = 5.2.0)
execution-id-current: func() -> execution-id;
/// Call a function and wait for the result.
/// Creates a child execution, waits for it to complete, and returns the result.
/// Parameters are serialized as a JSON array.
/// Returns Ok(Some(json)) for successful result with value,
/// Ok(None) for successful result with no value,
/// Err(Some(json)) for error result with value,
/// Err(None) for error result with no value.
@since(version = 5.0.0)
call-json: func(function: function, params: string, config: option<submit-config>, backtrace: option<wasm-backtrace>) -> result<result<option<string>, option<string>>, schedule-json-error>;
/// Schedule a new top-level execution with its parameters serialized as JSON array.
/// Use the execution ID returned by `execution-id-generate`.
@since(version = 5.0.0)
schedule-json: func(execution-id: execution-id, schedule-at: schedule-at, function: function, params: string, config: option<submit-config>, backtrace: option<wasm-backtrace>) -> result<_, schedule-json-error>;
/// Use `get-status-v2`, which additionally reports the `cancelling` state.
// TODO: Remove this deprecated function (and `execution-status`) on the next
// major version bump of this package.
@since(version = 5.0.0)
@deprecated(version = 5.3.0)
get-status: func(execution-id: execution-id, backtrace: option<wasm-backtrace>) -> result<execution-status, get-status-error>;
/// Get the current status of an execution.
/// Additionally reports the `cancelling` state for cancellable workflows.
@since(version = 5.3.0)
get-status-v2: func(execution-id: execution-id, backtrace: option<wasm-backtrace>) -> result<execution-status-v2, get-status-error>;
/// Get the result of an execution, blocking until it finishes.
/// Returns Ok(Some(json)) for successful result with value,
/// Ok(None) for successful result with no value,
/// Err(Some(json)) for error result with value,
/// Err(None) for error result with no value.
/// Outer result indicates lookup success/failure.
@since(version = 5.0.0)
get: func(execution-id: execution-id, backtrace: option<wasm-backtrace>) -> result<result<option<string>, option<string>>, get-error>;
/// Try to get the result of an execution without blocking.
/// Returns immediately if the execution has finished, or `not-finished-yet` error otherwise.
/// Returns Ok(Some(json)) for successful result with value,
/// Ok(None) for successful result with no value,
/// Err(Some(json)) for error result with value,
/// Err(None) for error result with no value.
/// Outer result indicates lookup success/failure.
@since(version = 5.0.0)
try-get: func(execution-id: execution-id, backtrace: option<wasm-backtrace>) -> result<result<option<string>, option<string>>, try-get-error>;
}