@cognigy/rest-api-client
Version:
Cognigy REST-Client
448 lines • 13.9 kB
JavaScript
import { chartableResourceTypes, } from "./TResourceType";
import { snippetDataSchema } from "./ISnippet";
const nodeAppearanceSchema = {
title: "nodeAppearanceSchema",
type: "object",
additionalProperties: false,
properties: {
color: { type: "string", format: "color" },
textColor: { type: "string", format: "color" },
contrastTextColor: { type: "string", format: "color" },
showIcon: { type: "boolean" },
variant: { type: "string", enum: ["regular", "mini", "hexagon"] },
},
};
const nodeBehaviorSchema = {
title: "nodeBehaviorSchema",
type: "object",
additionalProperties: false,
properties: {
stopping: { type: "boolean" },
entrypoint: { type: "boolean" },
},
};
export const nodePreviewTypes = [
"text",
"sayNode",
"custom",
"resource",
"image",
"aiAgent"
];
const nodePreviewSchema = {
title: "nodePreviewSchema",
type: "object",
additionalProperties: false,
properties: {
key: { type: "string", minLength: 1, maxLength: 200 },
type: { type: "string", enum: [...nodePreviewTypes] },
},
};
const nodeConstraintSchema = {
title: "nodeConstraintSchema",
type: "object",
additionalProperties: false,
properties: {
blacklist: {
type: "array",
items: { type: "string", minLength: 1, maxLength: 200 },
},
whitelist: {
type: "array",
items: { type: "string", minLength: 1, maxLength: 200 },
},
},
};
const nodeConstraintsSchema = {
title: "nodeConstraintsSchema",
type: "object",
additionalProperties: false,
properties: {
collapsable: { type: "boolean" },
childFlowCreatable: { type: "boolean" },
creatable: { type: "boolean" },
deletable: { type: "boolean" },
editable: { type: "boolean" },
movable: { type: "boolean" },
placement: {
type: "object",
additionalProperties: false,
properties: {
children: nodeConstraintSchema,
predecessor: nodeConstraintSchema,
successor: nodeConstraintSchema,
},
},
},
};
const nodeDependenciesSchema = {
title: "nodeDependenciesSchema",
type: "object",
additionalProperties: false,
properties: {
children: {
type: "array",
items: { type: "string", minLength: 1, maxLength: 200 },
},
},
};
export const nodeFieldTypes = [
"adaptivecard",
"agentAssistConfig",
"aiAgentSelect",
"appTemplate",
"backgroundSelector",
"caseNode",
"checkbox",
"checkAgentAvailabilityProvider",
"checkAgentAvailabilityConfig",
"chipInput",
"code",
"cognigyLLMText",
"cognigyText",
"cognigyTextArray",
"condition",
"connection",
"date",
"daterange",
"datetime",
"description",
"flow",
"flowNode",
"function",
"goalAndStepsSelect",
"handoverProvider",
"handoverProviderConfig",
"json",
"keyValuePairs",
"knowledgeSourceTags",
"knowledgeStore",
"knowledgeStoreSelect",
"lexicon",
"llmSelect",
"localeField",
"node",
"number",
"profileSchemaField",
"rule",
"say",
"select",
"slider",
"slotFillerArray",
"state",
"sttLanguageAzureSelect",
"sttLanguageGoogleSelect",
"sttSelect",
"sttTierModelSelect",
"switchNode",
"text",
"textArray",
"time",
"toggle",
"toolParameters",
"ttsSelect",
"typescript",
"xml"
];
export const searchableNodeFieldTypes = [
"text",
"json",
"typescript",
"xml",
"textArray",
"cognigyText",
"say",
"code",
"caseNode",
"select",
];
export const nodeFieldSingleConditionSchema = {
title: "nodeFieldSingleConditionSchema",
type: "object",
additionalProperties: false,
required: ["key", "value"],
properties: {
key: { type: "string", minLength: 1, maxLength: 200 },
value: {
oneOf: [
{ type: "null" },
{ type: "string" },
{ type: "array", items: { type: "string" } },
{ type: "number" },
{ type: "array", items: { type: "number" } },
{ type: "boolean" },
{ type: "array", items: { type: "boolean" } },
],
},
negate: { type: "boolean" },
},
};
export const nodeFieldANDConditionSchema = {
title: "nodeFieldANDConditionSchema",
type: "object",
additionalProperties: false,
required: ["and"],
properties: {
and: { type: "array", items: { $ref: "nodeFieldConditionSchema" } },
},
};
export const nodeFieldORConditionSchema = {
title: "nodeFieldORConditionSchema",
type: "object",
additionalProperties: false,
required: ["or"],
properties: {
or: { type: "array", items: { $ref: "nodeFieldConditionSchema" } },
},
};
// @ts-ignore
export const nodeFieldConditionSchema = {
title: "nodeFieldConditionSchema",
$id: "nodeFieldConditionSchema",
// @ts-ignore
oneOf: [
// @ts-ignore
nodeFieldSingleConditionSchema,
// @ts-ignore
nodeFieldANDConditionSchema,
// @ts-ignore
nodeFieldORConditionSchema,
],
};
export const nodeOptionsResolverSchema = {
title: "nodeOptionsResolverSchema",
type: "object",
additionalProperties: false,
properties: {
dependencies: {
type: "array",
items: { type: "string", minLength: 1, maxLength: 200 },
},
resolverFunction: {},
},
};
export const nodeFieldSchema = {
title: "nodeFieldSchema",
type: "object",
additionalProperties: false,
properties: {
type: { type: "string", enum: [...nodeFieldTypes] },
key: { type: "string", minLength: 1, maxLength: 200 },
label: {
oneOf: [
{ type: "string", minLength: 1, maxLength: 200 },
{
type: "object",
additionalProperties: false,
properties: {
default: { type: "string", maxLength: 200 },
enUS: { type: "string", maxLength: 200 },
deDE: { type: "string", maxLength: 200 },
jaJP: { type: "string", maxLength: 200 },
esES: { type: "string", maxLength: 200 },
koKR: { type: "string", maxLength: 200 },
},
},
],
},
condition: nodeFieldConditionSchema,
defaultValue: {
oneOf: [
{ type: "array" },
{ type: "boolean" },
{ type: "number" },
{ type: "null" },
{ type: "object" },
{ type: "string" },
],
},
description: {
oneOf: [
{ type: "string", minLength: 1, maxLength: 200 },
{
type: "object",
additionalProperties: false,
properties: {
default: { type: "string", maxLength: 200 },
enUS: { type: "string", maxLength: 200 },
deDE: { type: "string", maxLength: 200 },
jaJP: { type: "string", maxLength: 200 },
esES: { type: "string", maxLength: 200 },
koKR: { type: "string", maxLength: 200 },
},
},
],
},
params: { type: "object" },
optionsResolver: nodeOptionsResolverSchema,
resetOption: {
type: "object",
additionalProperties: false,
properties: {
lookupValue: { type: "string" },
fieldsToReset: {
type: "array",
items: { type: "string" },
},
},
},
},
};
export const nodeSectionSchema = {
title: "nodeSectionSchema",
type: "object",
additionalProperties: false,
properties: {
key: { type: "string", minLength: 1, maxLength: 200 },
label: {
oneOf: [
{ type: "string", minLength: 1, maxLength: 200 },
{
type: "object",
additionalProperties: false,
properties: {
default: { type: "string", maxLength: 200 },
enUS: { type: "string", maxLength: 200 },
deDE: { type: "string", maxLength: 200 },
jaJP: { type: "string", maxLength: 200 },
esES: { type: "string", maxLength: 200 },
koKR: { type: "string", maxLength: 200 },
},
},
],
},
description: {
oneOf: [
{ type: "string", minLength: 1, maxLength: 200 },
{
type: "object",
additionalProperties: false,
properties: {
default: { type: "string", maxLength: 200 },
enUS: { type: "string", maxLength: 200 },
deDE: { type: "string", maxLength: 200 },
jaJP: { type: "string", maxLength: 200 },
esES: { type: "string", maxLength: 200 },
koKR: { type: "string", maxLength: 200 },
},
},
],
},
condition: nodeFieldConditionSchema,
defaultCollapsed: { type: "boolean" },
fields: {
type: "array",
maxItems: 35,
additionalItems: false,
uniqueItems: true,
items: {
type: "string",
minLength: 1,
maxLength: 200,
},
},
},
};
export const nodeFieldAndSectionFormElementSchema = {
title: "nodeFieldAndSectionFormElementSchema",
additionalProperties: false,
required: ["key", "type"],
properties: {
key: { type: "string", minLength: 1, maxLength: 200 },
type: { type: "string", enum: ["field", "section"] },
},
};
export const nodeDescriptorSchema = {
title: "nodeDescriptorSchema",
type: "object",
additionalProperties: false,
properties: {
_id: { type: "string", format: "mongo-id" },
type: { type: "string", minLength: 1, maxLength: 200 },
parentType: { type: ["string", "null"], minLength: 1, maxLength: 200 },
defaultLabel: {
oneOf: [
{ type: "string", minLength: 1, maxLength: 200 },
{
type: "object",
additionalProperties: false,
properties: {
default: { type: "string", maxLength: 200 },
enUS: { type: "string", maxLength: 200 },
deDE: { type: "string", maxLength: 200 },
jaJP: { type: "string", maxLength: 200 },
esES: { type: "string", maxLength: 200 },
koKR: { type: "string", maxLength: 200 },
},
},
],
},
summary: {
oneOf: [
{ type: "string", maxLength: 200 },
{
type: "object",
additionalProperties: false,
properties: {
default: { type: "string", maxLength: 200 },
enUS: { type: "string", maxLength: 200 },
deDE: { type: "string", maxLength: 200 },
jaJP: { type: "string", maxLength: 200 },
esES: { type: "string", maxLength: 200 },
koKR: { type: "string", maxLength: 200 },
},
},
],
},
appearance: nodeAppearanceSchema,
behavior: nodeBehaviorSchema,
constraints: nodeConstraintsSchema,
dependencies: nodeDependenciesSchema,
fields: { type: "array", items: nodeFieldSchema },
function: {},
preview: nodePreviewSchema,
tags: {
type: "array",
items: { type: "string" },
uniqueItems: true,
minItems: 0,
},
tokens: {
type: "array",
items: snippetDataSchema,
uniqueItems: true,
},
sections: {
type: "array",
additionalItems: false,
items: nodeSectionSchema,
},
form: {
type: "array",
additionalItems: false,
maxLength: 25,
items: nodeFieldAndSectionFormElementSchema,
},
},
};
export const nodeDescriptorSetSchema = {
title: "nodeDescriptorSetSchema",
type: "object",
additionalProperties: false,
properties: {
_id: { type: "string", format: "mongo-id" },
isCognigy: { type: "boolean" },
extension: { type: "string", format: "package-name" },
imageUrlToken: { type: "string", format: "alphanum-64" },
projectReference: { type: "string", format: "mongo-id" },
organisationReference: { type: "string", format: "mongo-id" },
descriptors: {
type: "array",
additionalItems: false,
items: nodeDescriptorSchema,
},
resourceType: { type: "string", enum: chartableResourceTypes },
trustedCode: { type: "boolean" },
},
};
//# sourceMappingURL=INodeDescriptorSet.js.map