@cognigy/rest-api-client
Version:
Cognigy REST-Client
38 lines • 2.22 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createExtension = exports.createNodeDescriptor = void 0;
const createNodeDescriptor = (params) => {
var _a, _b, _c, _d;
const { _id, appearance, behavior, constraints, defaultLabel, dependencies, fields, sections, form, parentType, preview, summary, tags, tokens, type, } = params;
return {
_id,
type: type,
parentType: parentType || null,
defaultLabel: defaultLabel !== null && defaultLabel !== void 0 ? defaultLabel : type,
summary: summary !== null && summary !== void 0 ? summary : "",
appearance: Object.assign({ showIcon: true, color: "#3D9FFF", textColor: "black", variant: "regular" }, appearance),
behavior: Object.assign({ stopping: false, entrypoint: false }, behavior),
constraints: Object.assign(Object.assign({ creatable: true, deletable: true, editable: true, collapsable: false, childFlowCreatable: false, movable: true }, constraints), { placement: {
predecessor: Object.assign({}, (_a = constraints === null || constraints === void 0 ? void 0 : constraints.placement) === null || _a === void 0 ? void 0 : _a.predecessor),
successor: Object.assign({}, (_b = constraints === null || constraints === void 0 ? void 0 : constraints.placement) === null || _b === void 0 ? void 0 : _b.successor),
children: Object.assign({}, ((_d = (_c = constraints === null || constraints === void 0 ? void 0 : constraints.placement) === null || _c === void 0 ? void 0 : _c.children) !== null && _d !== void 0 ? _d : { whitelist: [] })),
} }),
dependencies: Object.assign({ children: [] }, dependencies),
fields: fields || [],
sections: sections || [],
form: form || [],
preview,
tags: tags || [],
tokens: tokens || [],
function: params.function || null,
};
};
exports.createNodeDescriptor = createNodeDescriptor;
const createExtension = (params) => {
return {
nodes: params.nodes,
connections: params.connections,
};
};
exports.createExtension = createExtension;
//# sourceMappingURL=createNodeDescriptor.js.map