@tahminator/sapling 2.0.5-beta.23c37926 → 2.0.5-beta.30231b0a
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 +16 -3
- package/dist/index.d.cts +2 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.mjs +16 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -381,6 +381,19 @@ 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
|
+
}
|
|
384
397
|
};
|
|
385
398
|
//#endregion
|
|
386
399
|
//#region src/annotation/request.ts
|
|
@@ -961,15 +974,15 @@ let Serve = class Serve {
|
|
|
961
974
|
constructor() {
|
|
962
975
|
this.handlers = swagger_ui_express.default.serve;
|
|
963
976
|
}
|
|
964
|
-
handle(
|
|
965
|
-
return this.handlers;
|
|
977
|
+
handle(request, response, next) {
|
|
978
|
+
return Sapling.chainHandlers(this.handlers, request, response, next);
|
|
966
979
|
}
|
|
967
980
|
};
|
|
968
981
|
__decorate([Middleware(_settings.doc.swaggerPath)], Serve.prototype, "handle", null);
|
|
969
982
|
Serve = __decorate([MiddlewareClass()], Serve);
|
|
970
983
|
let Setup = class Setup {
|
|
971
984
|
constructor() {
|
|
972
|
-
this.handler = swagger_ui_express.default.setup(
|
|
985
|
+
this.handler = swagger_ui_express.default.setup(null, { swaggerOptions: { url: _settings.doc.openApiPath } });
|
|
973
986
|
}
|
|
974
987
|
handle(request, response, next) {
|
|
975
988
|
return this.handler(request, response, next);
|
package/dist/index.d.cts
CHANGED
|
@@ -531,6 +531,7 @@ 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;
|
|
534
535
|
}
|
|
535
536
|
//#endregion
|
|
536
537
|
//#region node_modules/.pnpm/openapi-types@12.1.3/node_modules/openapi-types/dist/index.d.ts
|
|
@@ -992,7 +993,7 @@ declare class DefaultOpenApiMiddleware {
|
|
|
992
993
|
//#region src/middleware/default/swagger/index.d.ts
|
|
993
994
|
declare class Serve {
|
|
994
995
|
private readonly handlers;
|
|
995
|
-
handle(
|
|
996
|
+
handle(request: Request, response: Response$1, next: NextFunction): void;
|
|
996
997
|
}
|
|
997
998
|
declare class Setup {
|
|
998
999
|
private readonly handler;
|
package/dist/index.d.mts
CHANGED
|
@@ -531,6 +531,7 @@ 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;
|
|
534
535
|
}
|
|
535
536
|
//#endregion
|
|
536
537
|
//#region node_modules/.pnpm/openapi-types@12.1.3/node_modules/openapi-types/dist/index.d.ts
|
|
@@ -992,7 +993,7 @@ declare class DefaultOpenApiMiddleware {
|
|
|
992
993
|
//#region src/middleware/default/swagger/index.d.ts
|
|
993
994
|
declare class Serve {
|
|
994
995
|
private readonly handlers;
|
|
995
|
-
handle(
|
|
996
|
+
handle(request: Request, response: Response$1, next: NextFunction): void;
|
|
996
997
|
}
|
|
997
998
|
declare class Setup {
|
|
998
999
|
private readonly handler;
|
package/dist/index.mjs
CHANGED
|
@@ -356,6 +356,19 @@ 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
|
+
}
|
|
359
372
|
};
|
|
360
373
|
//#endregion
|
|
361
374
|
//#region src/annotation/request.ts
|
|
@@ -936,15 +949,15 @@ let Serve = class Serve {
|
|
|
936
949
|
constructor() {
|
|
937
950
|
this.handlers = swagger.serve;
|
|
938
951
|
}
|
|
939
|
-
handle(
|
|
940
|
-
return this.handlers;
|
|
952
|
+
handle(request, response, next) {
|
|
953
|
+
return Sapling.chainHandlers(this.handlers, request, response, next);
|
|
941
954
|
}
|
|
942
955
|
};
|
|
943
956
|
__decorate([Middleware(_settings.doc.swaggerPath)], Serve.prototype, "handle", null);
|
|
944
957
|
Serve = __decorate([MiddlewareClass()], Serve);
|
|
945
958
|
let Setup = class Setup {
|
|
946
959
|
constructor() {
|
|
947
|
-
this.handler = swagger.setup(
|
|
960
|
+
this.handler = swagger.setup(null, { swaggerOptions: { url: _settings.doc.openApiPath } });
|
|
948
961
|
}
|
|
949
962
|
handle(request, response, next) {
|
|
950
963
|
return this.handler(request, response, next);
|