This repository has been archived on 2026-03-06. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
openclaw-extensions/wecom/node_modules/@slack/bolt/dist/middleware/process.js
T

25 lines
955 B
JavaScript

"use strict";
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