n8n
Version:
n8n Workflow Automation Tool
14 lines • 567 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateAgentResourceId = generateAgentResourceId;
const utils_1 = require("@n8n/utils");
function generateAgentResourceId(prefix, existingIds = []) {
const existing = new Set(existingIds);
for (let attempt = 0; attempt < 10; attempt++) {
const id = `${prefix}_${(0, utils_1.generateNanoId)()}`;
if (!existing.has(id))
return id;
}
throw new Error(`Could not generate unique ${prefix} id`);
}
//# sourceMappingURL=agent-resource-id.js.map