UNPKG

n8n

Version:

n8n Workflow Automation Tool

36 lines 1.36 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.packageManifestSchema = exports.manifestEntrySchema = void 0; const zod_1 = require("zod"); const constants_1 = require("./constants"); const requirements_schema_1 = require("./requirements.schema"); exports.manifestEntrySchema = zod_1.z.object({ id: zod_1.z.string().min(1), name: zod_1.z.string(), target: zod_1.z.string().min(1), }); exports.packageManifestSchema = zod_1.z .object({ packageFormatVersion: zod_1.z.literal(constants_1.FORMAT_VERSION), exportedAt: zod_1.z.string().datetime(), sourceN8nVersion: zod_1.z.string().min(1), sourceId: zod_1.z.string().min(1), workflows: zod_1.z.array(exports.manifestEntrySchema).optional(), credentials: zod_1.z.array(exports.manifestEntrySchema).optional(), requirements: requirements_schema_1.packageRequirementsSchema.optional(), }) .superRefine((manifest, ctx) => { if (!manifest.workflows) return; const seen = new Set(); for (const entry of manifest.workflows) { if (seen.has(entry.id)) { ctx.addIssue({ code: zod_1.z.ZodIssueCode.custom, message: `Duplicate workflow id in manifest: ${entry.id}`, }); } seen.add(entry.id); } }); //# sourceMappingURL=manifest.schema.js.map