n8n
Version:
n8n Workflow Automation Tool
27 lines • 1.12 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.canStubNotFoundFailure = canStubNotFoundFailure;
exports.credentialBlockingFailures = credentialBlockingFailures;
exports.workflowsBlockedFromPublish = workflowsBlockedFromPublish;
function canStubNotFoundFailure(failure) {
return failure.kind === 'not_found' && failure.targetId === undefined;
}
const BLOCKING_FAILURES = {
'must-preexist': (resolution) => resolution.failures,
'create-stub': (resolution) => resolution.failures.filter((failure) => !canStubNotFoundFailure(failure)),
};
function credentialBlockingFailures(mode, resolution) {
return BLOCKING_FAILURES[mode](resolution);
}
function workflowsBlockedFromPublish(requirements, stubbedSourceIds) {
const blocked = new Set();
for (const requirement of requirements ?? []) {
if (!stubbedSourceIds.has(requirement.id))
continue;
for (const sourceWorkflowId of requirement.usedByWorkflows) {
blocked.add(sourceWorkflowId);
}
}
return blocked;
}
//# sourceMappingURL=credential-missing-mode.js.map