@mbakgun/n8n-nodes-slack-socket-mode
Version:
Slack Socket Mode Node for n8n that allows you to use +100 Slack events in your n8n instance with proxy mode
25 lines • 955 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
async function processMiddleware(middleware, initialArgs, context, client, logger, last) {
let lastCalledMiddlewareIndex = -1;
async function invokeMiddleware(toCallMiddlewareIndex) {
if (lastCalledMiddlewareIndex >= toCallMiddlewareIndex) {
// TODO: use a coded error
throw Error('next() called multiple times');
}
if (toCallMiddlewareIndex < middleware.length) {
lastCalledMiddlewareIndex = toCallMiddlewareIndex;
return middleware[toCallMiddlewareIndex]({
...initialArgs,
next: () => invokeMiddleware(toCallMiddlewareIndex + 1),
context,
client,
logger,
});
}
return last();
}
return invokeMiddleware(0);
}
exports.default = processMiddleware;
//# sourceMappingURL=process.js.map