-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathTask04a_states.js
More file actions
37 lines (29 loc) · 992 Bytes
/
Copy pathTask04a_states.js
File metadata and controls
37 lines (29 loc) · 992 Bytes
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
const states = require("./handson/states");
const { log } = require("./logger.js");
const orderPackedStateDraft = {
key: "ff-order-packed",
type: "OrderState",
name: {
"de": "FF Order Packed ",
"en": "FF Order Packed ",
},
initial: true,
};
const orderCompletedStateDraft = {
key: "ff-order-completed",
type: "OrderState",
name: {
"de": "FF Order Completed ",
"en": "FF Order Completed ",
},
initial: false,
};
const createStatesWithTransitions = async () => {
let orderPackedState = await states.createNewState(orderPackedStateDraft)
let orderCompletedState = await states.createNewState(orderCompletedStateDraft)
orderPackedState = states.addTransition(orderPackedState.body.id, [orderCompletedState.body.id])
orderCompletedState = states.addTransition(orderCompletedState.body.id, [])
return orderPackedState;
};
createStatesWithTransitions().then(log).catch(log)
//states.getStateByKey(orderPackedStateDraft.key).then(log).catch(log)