@tahminator/sapling 2.0.5-beta.30231b0a → 2.0.5-beta.662f05c0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -381,19 +381,6 @@ var Sapling = class Sapling {
381
381
  static setSwaggerPath(path) {
382
382
  _settings.doc.swaggerPath = path;
383
383
  }
384
- static chainHandlers(handlers, request, response, next, index = 0) {
385
- if (index >= handlers.length) {
386
- next();
387
- return;
388
- }
389
- handlers[index]?.(request, response, (err) => {
390
- if (err) {
391
- next(err);
392
- return;
393
- }
394
- Sapling.chainHandlers(handlers, request, response, next, index + 1);
395
- });
396
- }
397
384
  };
398
385
  //#endregion
399
386
  //#region src/annotation/request.ts
@@ -975,7 +962,20 @@ let Serve = class Serve {
975
962
  this.handlers = swagger_ui_express.default.serve;
976
963
  }
977
964
  handle(request, response, next) {
978
- return Sapling.chainHandlers(this.handlers, request, response, next);
965
+ this.runNext(0, request, response, next);
966
+ }
967
+ runNext(i, req, res, next) {
968
+ if (i >= this.handlers.length) {
969
+ next();
970
+ return;
971
+ }
972
+ this.handlers[i]?.(req, res, (err) => {
973
+ if (err) {
974
+ next(err);
975
+ return;
976
+ }
977
+ this.runNext(i + 1, req, res, next);
978
+ });
979
979
  }
980
980
  };
981
981
  __decorate([Middleware(_settings.doc.swaggerPath)], Serve.prototype, "handle", null);
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import e, { ErrorRequestHandler, NextFunction, Request, RequestHandler, Response as Response$1, Router } from "express";
1
+ import e, { ErrorRequestHandler, NextFunction, Request, Response as Response$1, Router } from "express";
2
2
 
3
3
  //#region src/html/404.d.ts
4
4
  /**
@@ -531,7 +531,6 @@ declare class Sapling {
531
531
  static setDeserializeFn(this: void, fn: (value: string) => any): void;
532
532
  static setOpenApiPath(this: void, path: string): void;
533
533
  static setSwaggerPath(this: void, path: string): void;
534
- static chainHandlers(this: void, handlers: RequestHandler[], request: Request, response: Response$1, next: NextFunction, index?: number): void;
535
534
  }
536
535
  //#endregion
537
536
  //#region node_modules/.pnpm/openapi-types@12.1.3/node_modules/openapi-types/dist/index.d.ts
@@ -994,6 +993,7 @@ declare class DefaultOpenApiMiddleware {
994
993
  declare class Serve {
995
994
  private readonly handlers;
996
995
  handle(request: Request, response: Response$1, next: NextFunction): void;
996
+ private runNext;
997
997
  }
998
998
  declare class Setup {
999
999
  private readonly handler;
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import e, { ErrorRequestHandler, NextFunction, Request, RequestHandler, Response as Response$1, Router } from "express";
1
+ import e, { ErrorRequestHandler, NextFunction, Request, Response as Response$1, Router } from "express";
2
2
 
3
3
  //#region src/html/404.d.ts
4
4
  /**
@@ -531,7 +531,6 @@ declare class Sapling {
531
531
  static setDeserializeFn(this: void, fn: (value: string) => any): void;
532
532
  static setOpenApiPath(this: void, path: string): void;
533
533
  static setSwaggerPath(this: void, path: string): void;
534
- static chainHandlers(this: void, handlers: RequestHandler[], request: Request, response: Response$1, next: NextFunction, index?: number): void;
535
534
  }
536
535
  //#endregion
537
536
  //#region node_modules/.pnpm/openapi-types@12.1.3/node_modules/openapi-types/dist/index.d.ts
@@ -994,6 +993,7 @@ declare class DefaultOpenApiMiddleware {
994
993
  declare class Serve {
995
994
  private readonly handlers;
996
995
  handle(request: Request, response: Response$1, next: NextFunction): void;
996
+ private runNext;
997
997
  }
998
998
  declare class Setup {
999
999
  private readonly handler;
package/dist/index.mjs CHANGED
@@ -356,19 +356,6 @@ var Sapling = class Sapling {
356
356
  static setSwaggerPath(path) {
357
357
  _settings.doc.swaggerPath = path;
358
358
  }
359
- static chainHandlers(handlers, request, response, next, index = 0) {
360
- if (index >= handlers.length) {
361
- next();
362
- return;
363
- }
364
- handlers[index]?.(request, response, (err) => {
365
- if (err) {
366
- next(err);
367
- return;
368
- }
369
- Sapling.chainHandlers(handlers, request, response, next, index + 1);
370
- });
371
- }
372
359
  };
373
360
  //#endregion
374
361
  //#region src/annotation/request.ts
@@ -950,7 +937,20 @@ let Serve = class Serve {
950
937
  this.handlers = swagger.serve;
951
938
  }
952
939
  handle(request, response, next) {
953
- return Sapling.chainHandlers(this.handlers, request, response, next);
940
+ this.runNext(0, request, response, next);
941
+ }
942
+ runNext(i, req, res, next) {
943
+ if (i >= this.handlers.length) {
944
+ next();
945
+ return;
946
+ }
947
+ this.handlers[i]?.(req, res, (err) => {
948
+ if (err) {
949
+ next(err);
950
+ return;
951
+ }
952
+ this.runNext(i + 1, req, res, next);
953
+ });
954
954
  }
955
955
  };
956
956
  __decorate([Middleware(_settings.doc.swaggerPath)], Serve.prototype, "handle", null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tahminator/sapling",
3
- "version": "2.0.5-beta.30231b0a",
3
+ "version": "2.0.5-beta.662f05c0",
4
4
  "author": "Tahmid Ahmed",
5
5
  "description": "A library to help you write cleaner Express.js code",
6
6
  "repository": {