UNPKG

n8n

Version:

n8n Workflow Automation Tool

27 lines 1.25 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.foldersInScope = foldersInScope; exports.workflowsInScope = workflowsInScope; exports.deriveParentFolderId = deriveParentFolderId; const n8n_workflow_1 = require("n8n-workflow"); function foldersInScope(entries, basePrefix = '') { return (entries ?? []).filter((entry) => entry.target.startsWith(`${basePrefix}folders/`)); } function workflowsInScope(entries, basePrefix = '') { return (entries ?? []).filter((entry) => entry.target.startsWith(`${basePrefix}workflows/`) || entry.target.startsWith(`${basePrefix}folders/`)); } function deriveParentFolderId(workflowTarget, folderTargetToId) { const idx = workflowTarget.lastIndexOf('/workflows/'); if (idx === -1) return null; const containerTarget = workflowTarget.slice(0, idx); if (!containerTarget.includes('folders/')) return null; const folderId = folderTargetToId.get(containerTarget); if (folderId === undefined) { throw new n8n_workflow_1.UserError(`Package workflow at "${workflowTarget}" is nested under folder "${containerTarget}", which is missing from the manifest.`); } return folderId; } //# sourceMappingURL=package-layout.js.map