@tsed/swagger 8.0.0-alpha.4 → 8.0.0-alpha.6

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.
Files changed (46) hide show
  1. package/lib/esm/constants.js +1 -1
  2. package/package.json +14 -15
  3. package/lib/cjs/SwaggerModule.js +0 -135
  4. package/lib/cjs/SwaggerModule.js.map +0 -1
  5. package/lib/cjs/constants.js +0 -8
  6. package/lib/cjs/constants.js.map +0 -1
  7. package/lib/cjs/decorators/docs.js +0 -18
  8. package/lib/cjs/decorators/docs.js.map +0 -1
  9. package/lib/cjs/decorators/hidden.js +0 -40
  10. package/lib/cjs/decorators/hidden.js.map +0 -1
  11. package/lib/cjs/index.js +0 -20
  12. package/lib/cjs/index.js.map +0 -1
  13. package/lib/cjs/interfaces/SwaggerSettings.js +0 -3
  14. package/lib/cjs/interfaces/SwaggerSettings.js.map +0 -1
  15. package/lib/cjs/interfaces/interfaces.js +0 -3
  16. package/lib/cjs/interfaces/interfaces.js.map +0 -1
  17. package/lib/cjs/middlewares/cssMiddleware.js +0 -23
  18. package/lib/cjs/middlewares/cssMiddleware.js.map +0 -1
  19. package/lib/cjs/middlewares/indexMiddleware.js +0 -24
  20. package/lib/cjs/middlewares/indexMiddleware.js.map +0 -1
  21. package/lib/cjs/middlewares/jsMiddleware.js +0 -18
  22. package/lib/cjs/middlewares/jsMiddleware.js.map +0 -1
  23. package/lib/cjs/middlewares/redirectMiddleware.js +0 -16
  24. package/lib/cjs/middlewares/redirectMiddleware.js.map +0 -1
  25. package/lib/cjs/package.json +0 -3
  26. package/lib/cjs/services/SwaggerService.js +0 -43
  27. package/lib/cjs/services/SwaggerService.js.map +0 -1
  28. package/lib/cjs/utils/includeRoute.js +0 -20
  29. package/lib/cjs/utils/includeRoute.js.map +0 -1
  30. package/lib/cjs/utils/matchPath.js +0 -10
  31. package/lib/cjs/utils/matchPath.js.map +0 -1
  32. package/lib/esm/package.json +0 -3
  33. package/lib/types-esm/SwaggerModule.d.ts +0 -31
  34. package/lib/types-esm/constants.d.ts +0 -2
  35. package/lib/types-esm/decorators/docs.d.ts +0 -10
  36. package/lib/types-esm/decorators/hidden.d.ts +0 -32
  37. package/lib/types-esm/index.d.ts +0 -16
  38. package/lib/types-esm/interfaces/SwaggerSettings.d.ts +0 -96
  39. package/lib/types-esm/interfaces/interfaces.d.ts +0 -8
  40. package/lib/types-esm/middlewares/cssMiddleware.d.ts +0 -6
  41. package/lib/types-esm/middlewares/indexMiddleware.d.ts +0 -10
  42. package/lib/types-esm/middlewares/jsMiddleware.d.ts +0 -6
  43. package/lib/types-esm/middlewares/redirectMiddleware.d.ts +0 -6
  44. package/lib/types-esm/services/SwaggerService.d.ts +0 -17
  45. package/lib/types-esm/utils/includeRoute.d.ts +0 -3
  46. package/lib/types-esm/utils/matchPath.d.ts +0 -1
@@ -1,4 +1,4 @@
1
1
  import getAbsoluteFSPath from "swagger-ui-dist/absolute-path.js";
2
2
  export const SWAGGER_UI_DIST = getAbsoluteFSPath();
3
- export const ROOT_DIR = import.meta.dirname;
3
+ export const ROOT_DIR = __dirname;
4
4
  //# sourceMappingURL=constants.js.map
package/package.json CHANGED
@@ -1,17 +1,16 @@
1
1
  {
2
2
  "name": "@tsed/swagger",
3
3
  "description": "Swagger package for Ts.ED framework",
4
- "type": "commonjs",
5
- "version": "8.0.0-alpha.4",
4
+ "type": "module",
5
+ "version": "8.0.0-alpha.6",
6
6
  "source": "./src/index.ts",
7
- "main": "./lib/cjs/index.js",
7
+ "main": "./lib/esm/index.js",
8
8
  "module": "./lib/esm/index.js",
9
9
  "typings": "./lib/types/index.d.ts",
10
10
  "exports": {
11
11
  ".": {
12
12
  "types": "./lib/types/index.d.ts",
13
13
  "import": "./lib/esm/index.js",
14
- "require": "./lib/cjs/index.js",
15
14
  "default": "./lib/cjs/index.js"
16
15
  }
17
16
  },
@@ -26,23 +25,23 @@
26
25
  "test:ci": "vitest run --coverage.thresholds.autoUpdate=true"
27
26
  },
28
27
  "dependencies": {
29
- "@tsed/normalize-path": "8.0.0-alpha.4",
30
- "@tsed/openspec": "8.0.0-alpha.4",
28
+ "@tsed/normalize-path": "8.0.0-alpha.6",
29
+ "@tsed/openspec": "8.0.0-alpha.6",
31
30
  "fs-extra": "11.2.0",
32
31
  "micromatch": "4.0.8",
33
32
  "swagger-ui-dist": ">=5.17.1",
34
33
  "tslib": "2.6.1"
35
34
  },
36
35
  "devDependencies": {
37
- "@tsed/barrels": "8.0.0-alpha.4",
38
- "@tsed/common": "8.0.0-alpha.4",
39
- "@tsed/core": "8.0.0-alpha.4",
40
- "@tsed/di": "8.0.0-alpha.4",
41
- "@tsed/json-mapper": "8.0.0-alpha.4",
36
+ "@tsed/barrels": "8.0.0-alpha.6",
37
+ "@tsed/common": "8.0.0-alpha.6",
38
+ "@tsed/core": "8.0.0-alpha.6",
39
+ "@tsed/di": "8.0.0-alpha.6",
40
+ "@tsed/json-mapper": "8.0.0-alpha.6",
42
41
  "@tsed/monorepo-utils": "2.3.5",
43
- "@tsed/openspec": "8.0.0-alpha.4",
44
- "@tsed/schema": "8.0.0-alpha.4",
45
- "@tsed/typescript": "8.0.0-alpha.4",
42
+ "@tsed/openspec": "8.0.0-alpha.6",
43
+ "@tsed/schema": "8.0.0-alpha.6",
44
+ "@tsed/typescript": "8.0.0-alpha.6",
46
45
  "@types/swagger-ui-dist": "3.30.4",
47
46
  "eslint": "^8.57.0",
48
47
  "ts-node": "10.9.2",
@@ -50,7 +49,7 @@
50
49
  "vitest": "2.0.4"
51
50
  },
52
51
  "peerDependencies": {
53
- "@tsed/common": "8.0.0-alpha.4"
52
+ "@tsed/common": "8.0.0-alpha.6"
54
53
  },
55
54
  "peerDependenciesMeta": {
56
55
  "@tsed/common": {
@@ -1,135 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SwaggerModule = void 0;
4
- const tslib_1 = require("tslib");
5
- const common_1 = require("@tsed/common");
6
- const core_1 = require("@tsed/core");
7
- const normalize_path_1 = require("@tsed/normalize-path");
8
- const platform_router_1 = require("@tsed/platform-router");
9
- const fs_1 = tslib_1.__importDefault(require("fs"));
10
- const path_1 = require("path");
11
- const constants_js_1 = require("./constants.js");
12
- const cssMiddleware_js_1 = require("./middlewares/cssMiddleware.js");
13
- const indexMiddleware_js_1 = require("./middlewares/indexMiddleware.js");
14
- const jsMiddleware_js_1 = require("./middlewares/jsMiddleware.js");
15
- const redirectMiddleware_js_1 = require("./middlewares/redirectMiddleware.js");
16
- const SwaggerService_js_1 = require("./services/SwaggerService.js");
17
- /**
18
- * @ignore
19
- */
20
- let SwaggerModule = class SwaggerModule {
21
- constructor() {
22
- this.loaded = false;
23
- }
24
- get settings() {
25
- return [].concat(this.configuration.get("swagger")).filter((o) => !!o);
26
- }
27
- /**
28
- *
29
- */
30
- $onRoutesInit() {
31
- if (this.loaded) {
32
- return;
33
- }
34
- const urls = this.getUrls();
35
- this.settings.forEach((conf) => {
36
- const { path = "/" } = conf;
37
- this.app.use(path, (0, platform_router_1.useContextHandler)((0, redirectMiddleware_js_1.redirectMiddleware)(path)));
38
- this.app.use(path, this.createRouter(conf, urls));
39
- });
40
- this.loaded = true;
41
- }
42
- $onReady() {
43
- // istanbul ignore next
44
- if (this.configuration.getBestHost && !this.disableRoutesSummary) {
45
- const host = this.configuration.getBestHost();
46
- const url = host.toString();
47
- const displayLog = (conf) => {
48
- const { path = "/", fileName = "swagger.json", doc } = conf;
49
- this.injector.logger.info(`[${doc || "default"}] Swagger JSON is available on ${url}${(0, normalize_path_1.normalizePath)(path, fileName)}`);
50
- this.injector.logger.info(`[${doc || "default"}] Swagger UI is available on ${url}${path}/`);
51
- };
52
- this.settings.forEach((conf) => {
53
- displayLog(conf);
54
- });
55
- }
56
- this.generateSpecFiles();
57
- }
58
- generateSpecFiles() {
59
- return Promise.all(this.settings.map(async (conf) => {
60
- const { outFile } = conf;
61
- if (this.env === core_1.Env.PROD || outFile) {
62
- const spec = await this.swaggerService.getOpenAPISpec(conf);
63
- if (outFile) {
64
- return fs_1.default.writeFile(outFile, JSON.stringify(spec, null, 2), { encoding: "utf8" }, () => { });
65
- }
66
- }
67
- }));
68
- }
69
- getUrls() {
70
- return this.settings.reduce((acc, conf) => {
71
- const { path = "/", fileName = "swagger.json", doc, hidden } = conf;
72
- if (!hidden) {
73
- acc.push({ url: (0, normalize_path_1.normalizePath)(path, fileName), name: doc || path });
74
- }
75
- return acc;
76
- }, []);
77
- }
78
- /**
79
- *
80
- * @param conf
81
- * @param urls
82
- */
83
- createRouter(conf, urls) {
84
- const { disableSpec = false, fileName = "swagger.json", cssPath, jsPath, viewPath = (0, path_1.join)(constants_js_1.ROOT_DIR, "../views/index.ejs") } = conf;
85
- const router = new platform_router_1.PlatformRouter(this.injector);
86
- if (!disableSpec) {
87
- router.get((0, normalize_path_1.normalizePath)("/", fileName), (0, platform_router_1.useContextHandler)(this.middlewareSwaggerJson(conf)));
88
- }
89
- if (viewPath) {
90
- if (cssPath) {
91
- router.get("/main.css", (0, platform_router_1.useContextHandler)((0, cssMiddleware_js_1.cssMiddleware)(cssPath)));
92
- }
93
- if (jsPath) {
94
- router.get("/main.js", (0, platform_router_1.useContextHandler)((0, jsMiddleware_js_1.jsMiddleware)(jsPath)));
95
- }
96
- router.get("/", (0, platform_router_1.useContextHandler)((0, indexMiddleware_js_1.indexMiddleware)(viewPath, { urls, ...conf })));
97
- router.statics("/", { root: constants_js_1.SWAGGER_UI_DIST });
98
- }
99
- return router;
100
- }
101
- middlewareSwaggerJson(conf) {
102
- return async (ctx) => {
103
- ctx.response.status(200).body(await this.swaggerService.getOpenAPISpec(conf));
104
- };
105
- }
106
- };
107
- tslib_1.__decorate([
108
- (0, common_1.Inject)(),
109
- tslib_1.__metadata("design:type", common_1.InjectorService)
110
- ], SwaggerModule.prototype, "injector", void 0);
111
- tslib_1.__decorate([
112
- (0, common_1.Inject)(),
113
- tslib_1.__metadata("design:type", common_1.PlatformApplication)
114
- ], SwaggerModule.prototype, "app", void 0);
115
- tslib_1.__decorate([
116
- (0, common_1.Configuration)(),
117
- tslib_1.__metadata("design:type", Object)
118
- ], SwaggerModule.prototype, "configuration", void 0);
119
- tslib_1.__decorate([
120
- (0, common_1.Inject)(),
121
- tslib_1.__metadata("design:type", SwaggerService_js_1.SwaggerService)
122
- ], SwaggerModule.prototype, "swaggerService", void 0);
123
- tslib_1.__decorate([
124
- (0, common_1.Constant)("env"),
125
- tslib_1.__metadata("design:type", String)
126
- ], SwaggerModule.prototype, "env", void 0);
127
- tslib_1.__decorate([
128
- (0, common_1.Constant)("logger.disableRoutesSummary"),
129
- tslib_1.__metadata("design:type", Boolean)
130
- ], SwaggerModule.prototype, "disableRoutesSummary", void 0);
131
- SwaggerModule = tslib_1.__decorate([
132
- (0, common_1.Module)()
133
- ], SwaggerModule);
134
- exports.SwaggerModule = SwaggerModule;
135
- //# sourceMappingURL=SwaggerModule.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SwaggerModule.js","sourceRoot":"","sources":["../../src/SwaggerModule.ts"],"names":[],"mappings":";;;;AAAA,yCAUsB;AACtB,qCAA+B;AAC/B,yDAAmD;AACnD,2DAAwE;AACxE,oDAAoB;AACpB,+BAA0B;AAC1B,iDAAyD;AAEzD,qEAA6D;AAC7D,yEAAiE;AACjE,mEAA2D;AAC3D,+EAAuE;AACvE,oEAA4D;AAE5D;;GAEG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAa;IAAnB;QAmBG,WAAM,GAAG,KAAK,CAAC;IA6GzB,CAAC;IA3GC,IAAI,QAAQ;QACV,OAAQ,EAAwB,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAoB,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACnH,CAAC;IAED;;OAEG;IACH,aAAa;QACX,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,OAAO;SACR;QAED,MA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I,CAAC,CAAC,CAAC;QAChF,CAAC,CAAC;IACJ,CAAC;CACF,CAAA;AA/HC;IAAC,IAAA,eAAM,GAAE;sCACC,wBAAe;+CAAC;AAE1B;IAAC,IAAA,eAAM,GAAE;sCACJ,4BAAmB;0CAAC;AAEzB;IAAC,IAAA,sBAAa,GAAE;;oDACa;AAE7B;IAAC,IAAA,eAAM,GAAE;sCACO,kCAAc;qDAAC;AAE/B;IAAC,IAAA,iBAAQ,EAAC,KAAK,CAAC;;0CACP;AAET;IAAC,IAAA,iBAAQ,EAAC,6BAA6B,CAAC;;2DACV;AAjBnB,aAAa;IADzB,IAAA,eAAM,GAAE;GACI,aAAa,CAgIzB;AAhIY,sCAAa"}
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ROOT_DIR = exports.SWAGGER_UI_DIST = void 0;
4
- const tslib_1 = require("tslib");
5
- const absolute_path_js_1 = tslib_1.__importDefault(require("swagger-ui-dist/absolute-path.js"));
6
- exports.SWAGGER_UI_DIST = (0, absolute_path_js_1.default)();
7
- exports.ROOT_DIR = __dirname;
8
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;;AAAA,gGAAiE;AAEpD,QAAA,eAAe,GAAG,IAAA,0BAAiB,GAAE,CAAC;AACtC,QAAA,QAAQ,GAAG,SAAS,CAAC"}
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Docs = void 0;
4
- const core_1 = require("@tsed/core");
5
- /**
6
- * Set the type documentation for this class.
7
- *
8
- * See [swagger documentation](/tutorials/swagger.html)
9
- *
10
- * @decorator
11
- * @swagger
12
- * @param docs
13
- */
14
- function Docs(...docs) {
15
- return (0, core_1.StoreMerge)("docs", docs);
16
- }
17
- exports.Docs = Docs;
18
- //# sourceMappingURL=docs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"docs.js","sourceRoot":"","sources":["../../../src/decorators/docs.ts"],"names":[],"mappings":";;;AAAA,qCAAsC;AAEtC;;;;;;;;GAQG;AACH,SAAgB,IAAI,CAAC,GAAG,IAAc;IACpC,OAAO,IAAA,iBAAU,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAClC,CAAC;AAFD,oBAEC"}
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Hidden = void 0;
4
- const schema_1 = require("@tsed/schema");
5
- /**
6
- * Disable documentation for the class and his endpoint.
7
- *
8
- * ````typescript
9
- * @Controller('/')
10
- * export class Ctrl {
11
- *
12
- * @Get('/')
13
- * @Hidden()
14
- * hiddenRoute(){
15
- *
16
- * }
17
- * }
18
- *
19
- * @Controller('/')
20
- * @Hidden()
21
- * export class Ctrl {
22
- * @Get('/')
23
- * hiddenRoute() {
24
- *
25
- * }
26
- * @Get('/2')
27
- * hiddenRoute2() {
28
- *
29
- * }
30
- * }
31
- * ```
32
- *
33
- * @decorator
34
- * @swagger
35
- */
36
- function Hidden() {
37
- return (0, schema_1.Hidden)();
38
- }
39
- exports.Hidden = Hidden;
40
- //# sourceMappingURL=hidden.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hidden.js","sourceRoot":"","sources":["../../../src/decorators/hidden.ts"],"names":[],"mappings":";;;AAAA,yCAAyC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,SAAgB,MAAM;IACpB,OAAO,IAAA,eAAC,GAAE,CAAC;AACb,CAAC;AAFD,wBAEC"}
package/lib/cjs/index.js DELETED
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- /**
5
- * @file Automatically generated by @tsed/barrels.
6
- */
7
- tslib_1.__exportStar(require("./constants.js"), exports);
8
- tslib_1.__exportStar(require("./decorators/docs.js"), exports);
9
- tslib_1.__exportStar(require("./decorators/hidden.js"), exports);
10
- tslib_1.__exportStar(require("./interfaces/interfaces.js"), exports);
11
- tslib_1.__exportStar(require("./interfaces/SwaggerSettings.js"), exports);
12
- tslib_1.__exportStar(require("./middlewares/cssMiddleware.js"), exports);
13
- tslib_1.__exportStar(require("./middlewares/indexMiddleware.js"), exports);
14
- tslib_1.__exportStar(require("./middlewares/jsMiddleware.js"), exports);
15
- tslib_1.__exportStar(require("./middlewares/redirectMiddleware.js"), exports);
16
- tslib_1.__exportStar(require("./services/SwaggerService.js"), exports);
17
- tslib_1.__exportStar(require("./SwaggerModule.js"), exports);
18
- tslib_1.__exportStar(require("./utils/includeRoute.js"), exports);
19
- tslib_1.__exportStar(require("./utils/matchPath.js"), exports);
20
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,yDAA+B;AAC/B,+DAAqC;AACrC,iEAAuC;AACvC,qEAA2C;AAC3C,0EAAgD;AAChD,yEAA+C;AAC/C,2EAAiD;AACjD,wEAA8C;AAC9C,8EAAoD;AACpD,uEAA6C;AAC7C,6DAAmC;AACnC,kEAAwC;AACxC,+DAAqC"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=SwaggerSettings.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SwaggerSettings.js","sourceRoot":"","sources":["../../../src/interfaces/SwaggerSettings.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=interfaces.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/interfaces/interfaces.ts"],"names":[],"mappings":""}
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cssMiddleware = void 0;
4
- const tslib_1 = require("tslib");
5
- const fs_1 = tslib_1.__importDefault(require("fs"));
6
- const path_1 = require("path");
7
- /**
8
- * @ignore
9
- * @param path
10
- */
11
- function cssMiddleware(path) {
12
- return (ctx) => {
13
- const content = fs_1.default.readFileSync((0, path_1.resolve)(path), { encoding: "utf8" });
14
- ctx.response
15
- .setHeaders({
16
- "Content-Type": "text/css"
17
- })
18
- .status(200)
19
- .body(content);
20
- };
21
- }
22
- exports.cssMiddleware = cssMiddleware;
23
- //# sourceMappingURL=cssMiddleware.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cssMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/cssMiddleware.ts"],"names":[],"mappings":";;;;AACA,oDAAoB;AACpB,+BAA6B;AAE7B;;;GAGG;AACH,SAAgB,aAAa,CAAC,IAAY;IACxC,OAAO,CAAC,GAAoB,EAAE,EAAE;QAC9B,MAAM,OAAO,GAAG,YAAE,CAAC,YAAY,CAAC,IAAA,cAAO,EAAC,IAAI,CAAC,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAC,CAAC,CAAC;QACnE,GAAG,CAAC,QAAQ;aACT,UAAU,CAAC;YACV,cAAc,EAAE,UAAU;SAC3B,CAAC;aACD,MAAM,CAAC,GAAG,CAAC;aACX,IAAI,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC,CAAC;AACJ,CAAC;AAVD,sCAUC"}
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.indexMiddleware = void 0;
4
- /**
5
- * @ignore
6
- * @param viewPath
7
- * @param conf
8
- */
9
- function indexMiddleware(viewPath, conf) {
10
- return async (ctx) => {
11
- const { path = "/", options = {}, showExplorer, cssPath, jsPath, urls } = conf;
12
- ctx.response.body(await ctx.response.render(viewPath, {
13
- spec: {},
14
- url: `${path}/swagger.json`,
15
- urls,
16
- showExplorer,
17
- cssPath,
18
- jsPath,
19
- swaggerOptions: options
20
- }));
21
- };
22
- }
23
- exports.indexMiddleware = indexMiddleware;
24
- //# sourceMappingURL=indexMiddleware.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"indexMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/indexMiddleware.ts"],"names":[],"mappings":";;;AAGA;;;;GAIG;AACH,SAAgB,eAAe,CAAC,QAAgB,EAAE,IAAwC;IACxF,OAAO,KAAK,EAAE,GAAoB,EAAE,EAAE;QACpC,MAAM,EAAC,IAAI,GAAG,GAAG,EAAE,OAAO,GAAG,EAAE,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAC,GAAG,IAAI,CAAC;QAE7E,GAAG,CAAC,QAAQ,CAAC,IAAI,CACf,MAAM,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE;YAClC,IAAI,EAAE,EAAE;YACR,GAAG,EAAE,GAAG,IAAI,eAAe;YAC3B,IAAI;YACJ,YAAY;YACZ,OAAO;YACP,MAAM;YACN,cAAc,EAAE,OAAO;SACxB,CAAC,CACH,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAhBD,0CAgBC"}
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.jsMiddleware = void 0;
4
- const tslib_1 = require("tslib");
5
- const fs_1 = tslib_1.__importDefault(require("fs"));
6
- const path_1 = require("path");
7
- /**
8
- * @ignore
9
- * @param path
10
- */
11
- function jsMiddleware(path) {
12
- return (ctx) => {
13
- const content = fs_1.default.readFileSync((0, path_1.resolve)(path), { encoding: "utf8" });
14
- ctx.response.setHeaders({ "Content-Type": "application/javascript" }).status(200).body(content);
15
- };
16
- }
17
- exports.jsMiddleware = jsMiddleware;
18
- //# sourceMappingURL=jsMiddleware.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jsMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/jsMiddleware.ts"],"names":[],"mappings":";;;;AACA,oDAAoB;AACpB,+BAA6B;AAE7B;;;GAGG;AACH,SAAgB,YAAY,CAAC,IAAY;IACvC,OAAO,CAAC,GAAoB,EAAE,EAAE;QAC9B,MAAM,OAAO,GAAG,YAAE,CAAC,YAAY,CAAC,IAAA,cAAO,EAAC,IAAI,CAAC,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAC,CAAC,CAAC;QACnE,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAC,cAAc,EAAE,wBAAwB,EAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChG,CAAC,CAAC;AACJ,CAAC;AALD,oCAKC"}
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.redirectMiddleware = void 0;
4
- /**
5
- * @ignore
6
- * @param path
7
- */
8
- function redirectMiddleware(path) {
9
- return (ctx) => {
10
- if (ctx.request.method?.toUpperCase() === "GET" && ctx.request.url === path && !ctx.request.url.match(/\/$/)) {
11
- ctx.response.redirect(302, `${path}/`);
12
- }
13
- };
14
- }
15
- exports.redirectMiddleware = redirectMiddleware;
16
- //# sourceMappingURL=redirectMiddleware.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"redirectMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/redirectMiddleware.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,IAAY;IAC7C,OAAO,CAAC,GAAoB,EAAE,EAAE;QAC9B,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YAC5G,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,IAAI,GAAG,CAAC,CAAC;SACxC;IACH,CAAC,CAAC;AACJ,CAAC;AAND,gDAMC"}
@@ -1,3 +0,0 @@
1
- {
2
- "type": "commonjs"
3
- }
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SwaggerService = void 0;
4
- const tslib_1 = require("tslib");
5
- const common_1 = require("@tsed/common");
6
- const schema_1 = require("@tsed/schema");
7
- const includeRoute_js_1 = require("../utils/includeRoute.js");
8
- let SwaggerService = class SwaggerService {
9
- #specs;
10
- constructor(injectorService, platform, configuration) {
11
- this.injectorService = injectorService;
12
- this.platform = platform;
13
- this.configuration = configuration;
14
- this.#specs = new Map();
15
- }
16
- async getOpenAPISpec(conf) {
17
- if (!this.#specs.has(conf.path)) {
18
- const { version = "1.0.0", acceptMimes } = this.configuration;
19
- const specPath = conf.specPath ? this.configuration.resolve(conf.specPath) : conf.specPath;
20
- const tokens = this.platform
21
- .getMountedControllers()
22
- .filter(({ routes, provider }) => [...routes.values()].some((route) => (0, includeRoute_js_1.includeRoute)(route, provider, conf)))
23
- .map(({ route, provider }) => ({ token: provider.token, rootPath: route }));
24
- const spec = await (0, schema_1.generateSpec)({
25
- tokens,
26
- ...conf,
27
- specPath,
28
- version,
29
- acceptMimes
30
- });
31
- this.#specs.set(conf.path, spec);
32
- }
33
- return this.#specs.get(conf.path);
34
- }
35
- };
36
- SwaggerService = tslib_1.__decorate([
37
- (0, common_1.Injectable)(),
38
- tslib_1.__param(2, (0, common_1.Configuration)()),
39
- tslib_1.__metadata("design:paramtypes", [common_1.InjectorService,
40
- common_1.Platform, Object])
41
- ], SwaggerService);
42
- exports.SwaggerService = SwaggerService;
43
- //# sourceMappingURL=SwaggerService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SwaggerService.js","sourceRoot":"","sources":["../../../src/services/SwaggerService.ts"],"names":[],"mappings":";;;;AAAA,yCAAkF;AAGlF,yCAA0C;AAE1C,8DAAsD;AAG/C,IAAM,cAAc,GAApB,MAAM,c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AAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;SAClC;QAED,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;CACF,CAAA;AAvCY,cAAc;IAD1B,IAAA,mBAAU,GAAE;IAOR,mBAAA,IAAA,sBAAa,GAAE,CAAA;6CAFS,wBAAe;QACtB,iBAAQ;GALjB,cAAc,CAuC1B;AAvCY,wCAAc"}
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.includeRoute = void 0;
4
- const matchPath_js_1 = require("./matchPath.js");
5
- function includeRoute(route, provider, conf) {
6
- const hidden = provider.store.get("hidden");
7
- const docs = provider.store.get("docs") || [];
8
- const { doc, pathPatterns } = conf;
9
- const inDoc = doc && docs.indexOf(doc) > -1;
10
- const pathPatternMatch = pathPatterns && (0, matchPath_js_1.matchPath)(route, pathPatterns);
11
- if (hidden) {
12
- return false;
13
- }
14
- if (!doc && !pathPatterns) {
15
- return true;
16
- }
17
- return !!(inDoc || pathPatternMatch);
18
- }
19
- exports.includeRoute = includeRoute;
20
- //# sourceMappingURL=includeRoute.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"includeRoute.js","sourceRoot":"","sources":["../../../src/utils/includeRoute.ts"],"names":[],"mappings":";;;AAEA,iDAAyC;AAEzC,SAAgB,YAAY,CAAC,KAAa,EAAE,QAAkB,EAAE,IAAqB;IACnF,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IAC9C,MAAM,EAAC,GAAG,EAAE,YAAY,EAAC,GAAG,IAAI,CAAC;IACjC,MAAM,KAAK,GAAG,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5C,MAAM,gBAAgB,GAAG,YAAY,IAAI,IAAA,wBAAS,EAAC,KAAK,EAAE,YAAY,CAAC,CAAC;IAExE,IAAI,MAAM,EAAE;QACV,OAAO,KAAK,CAAC;KACd;IAED,IAAI,CAAC,GAAG,IAAI,CAAC,YAAY,EAAE;QACzB,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CAAC,CAAC,CAAC,KAAK,IAAI,gBAAgB,CAAC,CAAC;AACvC,CAAC;AAhBD,oCAgBC"}
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.matchPath = void 0;
4
- const tslib_1 = require("tslib");
5
- const micromatch_1 = tslib_1.__importDefault(require("micromatch"));
6
- function matchPath(path, patterns) {
7
- return patterns && patterns.length ? micromatch_1.default.isMatch(path, patterns) : true;
8
- }
9
- exports.matchPath = matchPath;
10
- //# sourceMappingURL=matchPath.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"matchPath.js","sourceRoot":"","sources":["../../../src/utils/matchPath.ts"],"names":[],"mappings":";;;;AAAA,oEAAoC;AAEpC,SAAgB,SAAS,CAAC,IAAY,EAAE,QAAmB;IACzD,OAAO,QAAQ,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,oBAAU,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACjF,CAAC;AAFD,8BAEC"}
@@ -1,3 +0,0 @@
1
- {
2
- "type": "module"
3
- }
@@ -1,31 +0,0 @@
1
- import { Configuration, InjectorService, OnReady, OnRoutesInit, PlatformApplication } from "@tsed/common";
2
- import { Env } from "@tsed/core";
3
- import { SwaggerSettings } from "./interfaces/SwaggerSettings.js";
4
- import { SwaggerService } from "./services/SwaggerService.js";
5
- /**
6
- * @ignore
7
- */
8
- export declare class SwaggerModule implements OnRoutesInit, OnReady {
9
- injector: InjectorService;
10
- app: PlatformApplication;
11
- configuration: Configuration;
12
- swaggerService: SwaggerService;
13
- env: Env;
14
- disableRoutesSummary: boolean;
15
- private loaded;
16
- get settings(): SwaggerSettings[];
17
- /**
18
- *
19
- */
20
- $onRoutesInit(): void;
21
- $onReady(): void;
22
- generateSpecFiles(): Promise<void[]>;
23
- private getUrls;
24
- /**
25
- *
26
- * @param conf
27
- * @param urls
28
- */
29
- private createRouter;
30
- private middlewareSwaggerJson;
31
- }
@@ -1,2 +0,0 @@
1
- export declare const SWAGGER_UI_DIST: string;
2
- export declare const ROOT_DIR: string;
@@ -1,10 +0,0 @@
1
- /**
2
- * Set the type documentation for this class.
3
- *
4
- * See [swagger documentation](/tutorials/swagger.html)
5
- *
6
- * @decorator
7
- * @swagger
8
- * @param docs
9
- */
10
- export declare function Docs(...docs: string[]): Function;
@@ -1,32 +0,0 @@
1
- /**
2
- * Disable documentation for the class and his endpoint.
3
- *
4
- * ````typescript
5
- * @Controller('/')
6
- * export class Ctrl {
7
- *
8
- * @Get('/')
9
- * @Hidden()
10
- * hiddenRoute(){
11
- *
12
- * }
13
- * }
14
- *
15
- * @Controller('/')
16
- * @Hidden()
17
- * export class Ctrl {
18
- * @Get('/')
19
- * hiddenRoute() {
20
- *
21
- * }
22
- * @Get('/2')
23
- * hiddenRoute2() {
24
- *
25
- * }
26
- * }
27
- * ```
28
- *
29
- * @decorator
30
- * @swagger
31
- */
32
- export declare function Hidden(): Function;
@@ -1,16 +0,0 @@
1
- /**
2
- * @file Automatically generated by @tsed/barrels.
3
- */
4
- export * from "./constants.js";
5
- export * from "./decorators/docs.js";
6
- export * from "./decorators/hidden.js";
7
- export * from "./interfaces/interfaces.js";
8
- export * from "./interfaces/SwaggerSettings.js";
9
- export * from "./middlewares/cssMiddleware.js";
10
- export * from "./middlewares/indexMiddleware.js";
11
- export * from "./middlewares/jsMiddleware.js";
12
- export * from "./middlewares/redirectMiddleware.js";
13
- export * from "./services/SwaggerService.js";
14
- export * from "./SwaggerModule.js";
15
- export * from "./utils/includeRoute.js";
16
- export * from "./utils/matchPath.js";
@@ -1,96 +0,0 @@
1
- import { OpenSpec2, OpenSpec3, OpenSpecVersions, OS2Versions, OS3Versions } from "@tsed/openspec";
2
- export interface SwaggerUIOptions {
3
- configUrl?: string;
4
- url?: string;
5
- urls?: {
6
- url: string;
7
- name: string;
8
- primaryName?: string;
9
- }[];
10
- layout?: string;
11
- validatorUrl?: string;
12
- oauth?: any;
13
- authorize?: any;
14
- [key: string]: any;
15
- }
16
- export interface SwaggerSettingsBase {
17
- /**
18
- * The url subpath to access to the documentation.
19
- */
20
- path: string;
21
- /**
22
- * Specify the spec version you want to generate.
23
- */
24
- specVersion?: OpenSpecVersions;
25
- /**
26
- * Swagger file name. By default swagger.json
27
- */
28
- fileName?: string;
29
- /**
30
- * Hidden documentation. Use this to hide documentation link in the dropdown.
31
- */
32
- hidden?: string;
33
- /**
34
- * The documentation key used by `@Docs` decorator to create several swagger documentations.
35
- */
36
- doc?: string;
37
- /**
38
- * The path to the CSS file.
39
- */
40
- cssPath?: string;
41
- /**
42
- * The path to the JS file.
43
- */
44
- jsPath?: string;
45
- /**
46
- * The path to the ejs file to create html page.
47
- */
48
- viewPath?: string | false;
49
- /**
50
- * SwaggerUI options. See (https://github.com/swagger-api/swagger-ui/blob/HEAD/docs/usage/configuration.md)
51
- */
52
- options?: SwaggerUIOptions;
53
- /**
54
- * Display the search field in the navbar.
55
- */
56
- showExplorer?: boolean;
57
- /**
58
- * Load the base spec documentation from the specified path.
59
- */
60
- specPath?: string;
61
- /**
62
- * Write the `swagger.json` spec documentation on the specified path.
63
- */
64
- outFile?: string;
65
- /**
66
- * A function to generate the operationId.
67
- */
68
- operationIdFormatter?: (name: string, propertyKey: string, path: string) => string;
69
- /**
70
- * A pattern to generate the operationId. Format of operationId field (%c: class name, %m: method name).
71
- */
72
- operationIdPattern?: string;
73
- /**
74
- *
75
- */
76
- disableSpec?: boolean;
77
- /**
78
- * Include only controllers whose paths match the pattern list provided.
79
- */
80
- pathPatterns?: string[];
81
- }
82
- export interface SwaggerOS2Settings extends SwaggerSettingsBase {
83
- specVersion?: OS2Versions;
84
- /**
85
- * OpenSpec 2
86
- */
87
- spec?: Partial<OpenSpec2>;
88
- }
89
- export interface SwaggerOS3Settings extends SwaggerSettingsBase {
90
- specVersion?: OS3Versions;
91
- /**
92
- * OpenSpec 3
93
- */
94
- spec?: Partial<OpenSpec3>;
95
- }
96
- export type SwaggerSettings = SwaggerOS2Settings | SwaggerOS3Settings;
@@ -1,8 +0,0 @@
1
- import { SwaggerSettings } from "./SwaggerSettings.js";
2
- declare global {
3
- namespace TsED {
4
- interface Configuration {
5
- swagger: SwaggerSettings[];
6
- }
7
- }
8
- }
@@ -1,6 +0,0 @@
1
- import { PlatformContext } from "@tsed/common";
2
- /**
3
- * @ignore
4
- * @param path
5
- */
6
- export declare function cssMiddleware(path: string): (ctx: PlatformContext) => void;
@@ -1,10 +0,0 @@
1
- import { PlatformContext } from "@tsed/common";
2
- import { SwaggerSettings } from "../interfaces/SwaggerSettings.js";
3
- /**
4
- * @ignore
5
- * @param viewPath
6
- * @param conf
7
- */
8
- export declare function indexMiddleware(viewPath: string, conf: SwaggerSettings & {
9
- urls: string[];
10
- }): (ctx: PlatformContext) => Promise<void>;
@@ -1,6 +0,0 @@
1
- import { PlatformContext } from "@tsed/common";
2
- /**
3
- * @ignore
4
- * @param path
5
- */
6
- export declare function jsMiddleware(path: string): (ctx: PlatformContext) => void;
@@ -1,6 +0,0 @@
1
- import { PlatformContext } from "@tsed/common";
2
- /**
3
- * @ignore
4
- * @param path
5
- */
6
- export declare function redirectMiddleware(path: string): (ctx: PlatformContext) => void;
@@ -1,17 +0,0 @@
1
- import { Configuration, InjectorService, Platform } from "@tsed/common";
2
- import { OpenSpec2, OpenSpec3 } from "@tsed/openspec";
3
- import { SwaggerOS2Settings, SwaggerOS3Settings, SwaggerSettings } from "../interfaces/SwaggerSettings.js";
4
- export declare class SwaggerService {
5
- #private;
6
- private injectorService;
7
- private platform;
8
- private configuration;
9
- constructor(injectorService: InjectorService, platform: Platform, configuration: Configuration);
10
- /**
11
- * Generate Spec for the given configuration
12
- * @returns {Spec}
13
- */
14
- getOpenAPISpec(conf: SwaggerOS3Settings): Promise<OpenSpec3>;
15
- getOpenAPISpec(conf: SwaggerOS2Settings): Promise<OpenSpec2>;
16
- getOpenAPISpec(conf: SwaggerSettings): Promise<OpenSpec2>;
17
- }
@@ -1,3 +0,0 @@
1
- import { Provider } from "@tsed/di";
2
- import { SwaggerSettings } from "../interfaces/SwaggerSettings.js";
3
- export declare function includeRoute(route: string, provider: Provider, conf: SwaggerSettings): boolean;
@@ -1 +0,0 @@
1
- export declare function matchPath(path: string, patterns?: string[]): boolean;