@cognigy/rest-api-client
Version:
Cognigy REST-Client
48 lines • 1.53 kB
JavaScript
import { __awaiter } from "tslib";
/** Custom Modules */
import { createNodeDescriptor } from "../../../createNodeDescriptor";
import { sendMetadata } from "../../../descriptors/voice/mappers/sendMetadata.mapper";
/** Helper Modules */
import { nodeColor } from "../utils/design";
export const sendMetadataNode = createNodeDescriptor({
type: "sendMetadata",
defaultLabel: "Send Metadata",
summary: "UI__NODE_EDITOR__VOICEGATEWAY2__SEND_METADATA__SUMMARY",
tags: ["voice"],
fields: [
{
key: "metadata",
label: "UI__NODE_EDITOR__VOICEGATEWAY2__SEND_METADATA__FIELDS__METADATA__LABEL",
type: "json",
defaultValue: { myParamName: "myParamValue" },
params: {
require: true,
},
description: "UI__NODE_EDITOR__VOICEGATEWAY2__SEND_METADATA__FIELDS__METADATA__DESCRIPTION"
},
],
appearance: {
color: nodeColor,
},
form: [
{
type: "field",
key: "metadata",
},
],
function: ({ cognigy, config }) => __awaiter(void 0, void 0, void 0, function* () {
const { api } = cognigy;
if (!config.metadata)
return;
try {
yield api.say(null, {
_cognigy: sendMetadata.handleInput("voiceGateway2", config.metadata)
});
}
catch (error) {
api.log("error", error.message);
}
;
}),
});
//# sourceMappingURL=sendMetadata.js.map