anbaric-tsapi 1.11.0 → 1.12.0
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/package.json +1 -1
- package/src/api/states/State.ts +3 -1
- package/src/api/states/Terminal.ts +25 -0
- package/src/index.ts +1 -0
package/package.json
CHANGED
package/src/api/states/State.ts
CHANGED
|
@@ -6,11 +6,13 @@ class State {
|
|
|
6
6
|
readonly id : string;
|
|
7
7
|
actions : Array<Action>;
|
|
8
8
|
transitions : Array<Transition>;
|
|
9
|
+
readonly isTerminal : boolean;
|
|
9
10
|
|
|
10
|
-
constructor(id : string, actions : Array<Action> = [], transitions : Array<Transition> = []) {
|
|
11
|
+
constructor(id : string, actions : Array<Action> = [], transitions : Array<Transition> = [], isTerminal : boolean = false) {
|
|
11
12
|
this.id = id;
|
|
12
13
|
this.actions = actions;
|
|
13
14
|
this.transitions = transitions;
|
|
15
|
+
this.isTerminal = isTerminal;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
subscribe(action : Action) : void {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {State} from "./State";
|
|
2
|
+
|
|
3
|
+
/* An end state: a job that reaches a Terminal stops progressing and is never
|
|
4
|
+
re-enqueued. The outcome records whether the workflow succeeded or failed. */
|
|
5
|
+
class Terminal extends State {
|
|
6
|
+
|
|
7
|
+
readonly outcome : Terminal.Outcome;
|
|
8
|
+
|
|
9
|
+
constructor(id : string, outcome : Terminal.Outcome) {
|
|
10
|
+
super(id, [], [], true);
|
|
11
|
+
this.outcome = outcome;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
namespace Terminal {
|
|
17
|
+
|
|
18
|
+
export enum Outcome {
|
|
19
|
+
SUCCESS = "SUCCESS",
|
|
20
|
+
FAILURE = "FAILURE",
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { Terminal }
|
package/src/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from "./api/jobs/JobPersistence"
|
|
|
3
3
|
export * from "./api/jobs/JobSerialization"
|
|
4
4
|
export * from "./api/jobs/PropertyDefinition"
|
|
5
5
|
export * from "./api/states/State"
|
|
6
|
+
export * from "./api/states/Terminal"
|
|
6
7
|
export * from "./api/actions/Action"
|
|
7
8
|
export * from "./api/actions/AgenticAction"
|
|
8
9
|
export * from "./api/actors/agents/AgentMessage"
|