n8n
Version:
n8n Workflow Automation Tool
99 lines • 4.92 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.workflowDetailsOutputSchema = exports.successMessageOutputSchema = exports.columnNameSchema = exports.dataTableProjectIdSchema = exports.createLimitSchema = exports.dataTableSchema = exports.dataTableColumnSchema = exports.dataTableColumnTypeSchema = exports.workflowMetaSchema = exports.workflowSettingsSchema = exports.tagSchema = exports.nodeSchema = void 0;
const zod_1 = __importDefault(require("zod"));
exports.nodeSchema = zod_1.default
.object({
name: zod_1.default.string(),
type: zod_1.default.string(),
})
.passthrough();
exports.tagSchema = zod_1.default.object({ id: zod_1.default.string(), name: zod_1.default.string() }).passthrough();
exports.workflowSettingsSchema = zod_1.default
.custom((_value) => true)
.nullable();
exports.workflowMetaSchema = zod_1.default
.custom((_value) => true)
.nullable();
exports.dataTableColumnTypeSchema = zod_1.default
.enum(['string', 'number', 'boolean', 'date'])
.describe('The data type of the column');
exports.dataTableColumnSchema = zod_1.default.object({
id: zod_1.default.string().describe('The unique identifier of the column'),
name: zod_1.default.string().describe('The name of the column'),
type: exports.dataTableColumnTypeSchema,
index: zod_1.default.number().int().describe('The position of the column in the table'),
});
exports.dataTableSchema = zod_1.default.object({
id: zod_1.default.string().describe('Autogenerated unique identifier of the data table.'),
name: zod_1.default.string().describe('The name of the data table'),
projectId: zod_1.default.string().describe('The project this data table belongs to'),
createdAt: zod_1.default.string().describe('Autogenerated ISO timestamp when the data table was created'),
updatedAt: zod_1.default
.string()
.describe('Autogenerated ISO timestamp when the data table was last updated'),
columns: zod_1.default.array(exports.dataTableColumnSchema).describe('The columns defined in this data table'),
});
const createLimitSchema = (max) => zod_1.default
.number()
.int()
.positive()
.max(max)
.optional()
.describe(`Limit the number of results (max ${max})`);
exports.createLimitSchema = createLimitSchema;
exports.dataTableProjectIdSchema = zod_1.default
.string()
.describe('The project ID the data table belongs to');
exports.columnNameSchema = zod_1.default
.string()
.min(1)
.max(63)
.regex(/^[a-zA-Z][a-zA-Z0-9_]*$/)
.describe('Column name. Must start with a letter, contain only letters, numbers, and underscores (max 63 chars)');
exports.successMessageOutputSchema = {
success: zod_1.default.boolean().describe('Whether the operation succeeded'),
message: zod_1.default.string().describe('Description of the result'),
};
exports.workflowDetailsOutputSchema = zod_1.default.object({
workflow: zod_1.default
.object({
id: zod_1.default.string(),
name: zod_1.default.string().nullable(),
active: zod_1.default.boolean(),
isArchived: zod_1.default.boolean(),
versionId: zod_1.default.string().describe('The current workflow version ID'),
activeVersionId: zod_1.default
.string()
.nullable()
.describe('The active workflow version ID, if available'),
triggerCount: zod_1.default.number(),
createdAt: zod_1.default.string().nullable(),
updatedAt: zod_1.default.string().nullable(),
settings: exports.workflowSettingsSchema,
connections: zod_1.default.record(zod_1.default.unknown()),
nodes: zod_1.default.array(exports.nodeSchema),
activeVersion: zod_1.default
.object({
nodes: zod_1.default.array(exports.nodeSchema),
connections: zod_1.default.record(zod_1.default.unknown()),
})
.nullable()
.describe('Active workflow graph, if available'),
tags: zod_1.default.array(exports.tagSchema),
meta: exports.workflowMetaSchema,
parentFolderId: zod_1.default.string().nullable(),
description: zod_1.default.string().optional().describe('The description of the workflow'),
scopes: zod_1.default.array(zod_1.default.string()).describe('User permissions for this workflow'),
canExecute: zod_1.default.boolean().describe('Whether the user has permission to execute this workflow'),
})
.passthrough()
.describe('Sanitized workflow data safe for MCP consumption'),
triggerInfo: zod_1.default
.string()
.describe('Human-readable instructions describing how to trigger the workflow'),
});
//# sourceMappingURL=schemas.js.map