@cognigy/rest-api-client
Version:
Cognigy REST-Client
40 lines • 1.29 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ONCE = void 0;
/* Custom modules */
const createNodeDescriptor_1 = require("../../../createNodeDescriptor");
exports.ONCE = (0, createNodeDescriptor_1.createNodeDescriptor)({
type: "once",
defaultLabel: "Once",
summary: "UI__NODE_EDITOR__ONCE__SUMMARY",
appearance: {
color: '#5c6bc0',
variant: 'hexagon',
textColor: "white",
showIcon: false
},
behavior: {
stopping: false
},
fields: [],
dependencies: {
children: ["onFirstExecution", "afterwards"],
},
constraints: {
collapsable: true,
placement: {},
},
tags: ["logic", "gate"],
function: async ({ cognigy, nodeId, childConfigs }) => {
const { api } = cognigy;
const executionAmount = api.getExecutionAmount(nodeId);
const onFirstExecutionChild = childConfigs.find(child => child.type === "onFirstExecution");
const onAfterwardsChild = childConfigs.find(child => child.type === "afterwards");
if (executionAmount === 1) {
api.setNextNode(onFirstExecutionChild.id);
return;
}
api.setNextNode(onAfterwardsChild.id);
}
});
//# sourceMappingURL=once.js.map