otomato-sdk 1.5.6 → 1.5.8
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.
|
@@ -14,6 +14,8 @@ import { SessionKeyPermission } from './SessionKeyPermission.js';
|
|
|
14
14
|
export class Workflow {
|
|
15
15
|
constructor(name = '', nodes = [], edges = []) {
|
|
16
16
|
this.id = null;
|
|
17
|
+
this.dateCreated = null;
|
|
18
|
+
this.dateModified = null;
|
|
17
19
|
this.name = name;
|
|
18
20
|
this.nodes = nodes;
|
|
19
21
|
this.edges = edges;
|
|
@@ -52,6 +54,8 @@ export class Workflow {
|
|
|
52
54
|
id: this.id,
|
|
53
55
|
name: this.name,
|
|
54
56
|
state: this.state,
|
|
57
|
+
dateCreated: this.dateCreated,
|
|
58
|
+
dateModified: this.dateModified,
|
|
55
59
|
nodes: this.nodes.map(node => node.toJSON()),
|
|
56
60
|
edges: this.edges.map(edge => edge.toJSON()),
|
|
57
61
|
};
|
|
@@ -63,6 +67,8 @@ export class Workflow {
|
|
|
63
67
|
const response = yield apiServices.post('/workflows', this.toJSON());
|
|
64
68
|
if (response.status === 201) {
|
|
65
69
|
this.id = response.data.id; // Assign the returned ID to the workflow instance
|
|
70
|
+
this.dateCreated = response.data.dateCreated;
|
|
71
|
+
this.dateModified = response.data.dateModified;
|
|
66
72
|
// Assign IDs to the nodes based on the response
|
|
67
73
|
response.data.nodes.forEach((nodeResponse) => {
|
|
68
74
|
const node = this.nodes.find(n => n.getRef() === nodeResponse.ref);
|
|
@@ -95,6 +101,7 @@ export class Workflow {
|
|
|
95
101
|
try {
|
|
96
102
|
const response = yield apiServices.patch(`/workflows/${this.id}`, this.toJSON());
|
|
97
103
|
if (response.status === 200) {
|
|
104
|
+
this.dateModified = response.data.dateModified;
|
|
98
105
|
// Assign IDs to the nodes based on the response
|
|
99
106
|
response.data.nodes.forEach((nodeResponse) => {
|
|
100
107
|
const node = this.nodes.find(n => n.getRef() === nodeResponse.ref);
|
|
@@ -128,6 +135,8 @@ export class Workflow {
|
|
|
128
135
|
this.id = response.id;
|
|
129
136
|
this.name = response.name;
|
|
130
137
|
this.state = response.state;
|
|
138
|
+
this.dateCreated = response.dateCreated;
|
|
139
|
+
this.dateModified = response.dateModified;
|
|
131
140
|
this.nodes = yield Promise.all(response.nodes.map((nodeData) => __awaiter(this, void 0, void 0, function* () { return yield Node.fromJSON(nodeData); })));
|
|
132
141
|
this.edges = response.edges.map((edgeData) => Edge.fromJSON(edgeData, this.nodes));
|
|
133
142
|
return this;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { Node } from './Node.js';
|
|
2
2
|
import { Edge } from './Edge.js';
|
|
3
3
|
import { SessionKeyPermission } from './SessionKeyPermission.js';
|
|
4
|
-
export type WorkflowState = 'inactive' | 'active' | 'failed' | 'completed';
|
|
4
|
+
export type WorkflowState = 'inactive' | 'active' | 'failed' | 'completed' | 'waiting';
|
|
5
5
|
export declare class Workflow {
|
|
6
6
|
id: string | null;
|
|
7
7
|
name: string;
|
|
8
8
|
nodes: Node[];
|
|
9
9
|
edges: Edge[];
|
|
10
10
|
state: WorkflowState;
|
|
11
|
+
dateCreated: string | null;
|
|
12
|
+
dateModified: string | null;
|
|
11
13
|
constructor(name?: string, nodes?: Node[], edges?: Edge[]);
|
|
12
14
|
setName(name: string): void;
|
|
13
15
|
addNode(node: Node): void;
|
|
@@ -20,6 +22,8 @@ export declare class Workflow {
|
|
|
20
22
|
id: string | null;
|
|
21
23
|
name: string;
|
|
22
24
|
state: WorkflowState;
|
|
25
|
+
dateCreated: string | null;
|
|
26
|
+
dateModified: string | null;
|
|
23
27
|
nodes: {
|
|
24
28
|
[key: string]: any;
|
|
25
29
|
}[];
|