@cognigy/rest-api-client
Version:
Cognigy REST-Client
64 lines • 2.23 kB
JavaScript
/* Custom Modules */
import { createQuerySchema } from "../../helper/createQuerySchema";
import { entityMetaSchema } from "./IEntityMeta";
export const connectionFieldReturnFormat = [
"encrypted",
"decrypted",
"hidden"
];
export const generateConnectionsRedisKey = (data) => {
return [
`organisationId:${data.organisationReference}:${data.projectReference ? `projectId:${data.projectReference}:` : ''}connection:${data.referenceId}`
];
};
export const connectionFieldDataSchema = {
title: "connectionFieldDataSchema",
type: "object",
additionalProperties: false,
required: [
"key",
"value"
],
properties: {
key: { type: "string", maxLength: 200 },
value: { type: "string", maxLength: 10000 },
}
};
export const connectionDataSchema = {
title: "connectionDataSchema",
type: "object",
additionalProperties: false,
required: [
"name",
"fields",
"type",
"extension"
],
properties: {
name: { type: "string", format: "resource-name" },
fields: {
type: "object",
minProperties: 1,
maxProperties: 10,
patternProperties: {
"[a-zA-Z_$][0-9a-zA-Z_$]*": {
type: "string",
minLength: 1,
maxLength: 10000
}
}
},
extension: { type: "string", format: "package-name" },
type: { type: "string", format: "resource-name" },
isDeprecated: { type: "boolean" },
resourceLevel: { type: "string", enum: ["organisation", "project"] }
}
};
export const connectionSchema = {
title: "connectionSchema",
type: "object",
additionalProperties: false,
properties: Object.assign(Object.assign(Object.assign({}, entityMetaSchema.properties), connectionDataSchema.properties), { projectReference: { type: "string", format: "mongo-id" }, organisationReference: { type: "string", format: "mongo-id" }, referenceId: { type: "string", format: "uuid" } }),
};
export const connectionQuerySchema = createQuerySchema("connectionQuerySchema", connectionSchema);
//# sourceMappingURL=IConnection.js.map