@cognigy/rest-api-client
Version:
Cognigy REST-Client
94 lines • 4.62 kB
JavaScript
var _a;
import { entityMetaSchema } from "./IEntityMeta";
import { nodeDescriptorSchema } from "./INodeDescriptorSet";
import { knowledgeDescriptorSchema } from "./IKnowledgeDescriptor";
export const extensionNodePackageDataSchema = {
title: "extensionNodePackageDataSchema",
type: "object",
additionalProperties: false,
properties: {
// we are not further specifying a schema for "tools" (which are actually tool descriptors)
// as we are using a new code-design in service-resources which validates the properties
// differently.
tools: { type: "array" },
nodes: { type: "array", items: nodeDescriptorSchema },
knowledge: {
type: "array",
items: knowledgeDescriptorSchema,
maxItems: parseInt((_a = process === null || process === void 0 ? void 0 : process.env) === null || _a === void 0 ? void 0 : _a.EXTENSIONS_KNOWLEDGE_EXTRACTORS_MAX, 10) || 20
},
connections: {
type: "array",
additionalItems: false,
items: {
type: "object",
additionalProperties: false,
required: ["type", "fields"],
properties: {
label: { type: "string", format: "resource-name" },
type: { type: "string", format: "resource-name" },
fields: {
type: "array",
additionalItems: false,
items: {
type: "object",
additionalProperties: false,
required: ["fieldName"],
properties: {
_id: { type: "string", format: "mongo-id" },
fieldName: {
type: "string",
format: "resource-name"
},
label: { type: "string" },
description: { type: "string" },
params: { type: "object" },
required: { type: "boolean", default: true }
}
}
}
}
}
},
appTemplates: {
type: "array",
additionalItems: false,
items: {
type: "object",
additionalProperties: false,
required: ["type", "path"],
properties: {
label: { type: "string", format: "resource-name" },
type: { type: "string", format: "resource-name" },
path: { type: "string" }
}
}
}
}
};
/** 512 KB (1 * 1024 * 1024), Javascript uses 16bit for a single character */
export const EXTENSION_README_SIZE = 1048576;
export const extensionDataSchema = {
title: "extensionDataSchema",
type: "object",
additionalProperties: false,
properties: Object.assign({ name: { type: "string", format: "resource-name" }, label: { type: "string", maxLength: 200 }, version: { type: "string", format: "semver" }, imageUrlToken: { type: "string", format: "alphanum-64" }, description: { type: "string", maxLength: 1000 }, readme: { type: "string", maxLength: EXTENSION_README_SIZE }, tags: { type: "array", items: { type: "string", maxLength: 200 } }, author: { type: "string", maxLength: 200 }, extensionType: { type: "string", enum: ["nodes"] }, pathToPackageExecutable: { type: "string", maxLength: 500 }, storage: {
type: "object",
additionalProperties: false,
required: ["layout", "path"],
properties: {
layout: {
type: "string",
enum: ["old_nfs", "new_nfs", "tenant_scoped"]
},
path: { type: "string" }
},
} }, extensionNodePackageDataSchema.properties)
};
export const extensionSchema = {
title: "extensionSchema",
type: "object",
additionalProperties: false,
properties: Object.assign(Object.assign(Object.assign({}, entityMetaSchema.properties), extensionDataSchema.properties), { subResourceReference: { type: "string", format: "mongo-id" }, knowledge: { type: "array", items: knowledgeDescriptorSchema }, projectReference: { type: "string", format: "mongo-id" }, organisationReference: { type: "string", format: "mongo-id" } })
};
//# sourceMappingURL=IExtension.js.map