@vnphu/nestjs-api-explorer 0.1.0
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/README.md +136 -0
- package/dist/api-explorer.controller.d.ts +16 -0
- package/dist/api-explorer.controller.d.ts.map +1 -0
- package/dist/api-explorer.controller.js +61 -0
- package/dist/api-explorer.controller.js.map +1 -0
- package/dist/api-explorer.html.d.ts +3 -0
- package/dist/api-explorer.html.d.ts.map +1 -0
- package/dist/api-explorer.html.js +1066 -0
- package/dist/api-explorer.html.js.map +1 -0
- package/dist/api-explorer.module.d.ts +15 -0
- package/dist/api-explorer.module.d.ts.map +1 -0
- package/dist/api-explorer.module.js +46 -0
- package/dist/api-explorer.module.js.map +1 -0
- package/dist/api-explorer.service.d.ts +14 -0
- package/dist/api-explorer.service.d.ts.map +1 -0
- package/dist/api-explorer.service.js +92 -0
- package/dist/api-explorer.service.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/package.json +46 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-explorer.html.js","sourceRoot":"","sources":["../src/api-explorer.html.ts"],"names":[],"mappings":";;AAEA,0CAsiCC;AAtiCD,SAAgB,eAAe,CAAC,OAAmC;IACjE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IAChC,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAE/C,OAAO,UAAU,CAAC;;;;;WAKT,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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: 'api-explorer' */
|
|
4
|
+
path?: string;
|
|
5
|
+
/** Title shown in browser tab and UI header. Default: 'API Explorer' */
|
|
6
|
+
title?: string;
|
|
7
|
+
/** Explicitly enable or disable. Auto-disabled when NODE_ENV === 'production'. */
|
|
8
|
+
enabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export type ResolvedApiExplorerOptions = Required<ApiExplorerOptions>;
|
|
11
|
+
export declare const API_EXPLORER_OPTIONS = "API_EXPLORER_OPTIONS";
|
|
12
|
+
export declare class ApiExplorerModule {
|
|
13
|
+
static register(options?: ApiExplorerOptions): DynamicModule;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=api-explorer.module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-explorer.module.d.ts","sourceRoot":"","sources":["../src/api-explorer.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAU,MAAM,gBAAgB,CAAC;AAIvD,MAAM,WAAW,kBAAkB;IACjC,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kFAAkF;IAClF,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,MAAM,0BAA0B,GAAG,QAAQ,CAAC,kBAAkB,CAAC,CAAC;AAQtE,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAE3D,qBACa,iBAAiB;IAC5B,MAAM,CAAC,QAAQ,CAAC,OAAO,GAAE,kBAAuB,GAAG,aAAa;CAuBjE"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var ApiExplorerModule_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ApiExplorerModule = exports.API_EXPLORER_OPTIONS = void 0;
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
const api_explorer_controller_1 = require("./api-explorer.controller");
|
|
13
|
+
const api_explorer_service_1 = require("./api-explorer.service");
|
|
14
|
+
const DEFAULTS = {
|
|
15
|
+
path: 'api-explorer',
|
|
16
|
+
title: 'API Explorer',
|
|
17
|
+
enabled: true,
|
|
18
|
+
};
|
|
19
|
+
exports.API_EXPLORER_OPTIONS = 'API_EXPLORER_OPTIONS';
|
|
20
|
+
let ApiExplorerModule = ApiExplorerModule_1 = class ApiExplorerModule {
|
|
21
|
+
static register(options = {}) {
|
|
22
|
+
const isProduction = process.env.NODE_ENV === 'production';
|
|
23
|
+
const resolved = { ...DEFAULTS, ...options };
|
|
24
|
+
if (!resolved.enabled || isProduction) {
|
|
25
|
+
return { module: ApiExplorerModule_1 };
|
|
26
|
+
}
|
|
27
|
+
const controller = (0, api_explorer_controller_1.createApiExplorerController)(resolved.path);
|
|
28
|
+
return {
|
|
29
|
+
module: ApiExplorerModule_1,
|
|
30
|
+
controllers: [controller],
|
|
31
|
+
providers: [
|
|
32
|
+
api_explorer_service_1.ApiExplorerService,
|
|
33
|
+
{
|
|
34
|
+
provide: exports.API_EXPLORER_OPTIONS,
|
|
35
|
+
useValue: resolved,
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
exports: [api_explorer_service_1.ApiExplorerService],
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
exports.ApiExplorerModule = ApiExplorerModule;
|
|
43
|
+
exports.ApiExplorerModule = ApiExplorerModule = ApiExplorerModule_1 = __decorate([
|
|
44
|
+
(0, common_1.Module)({})
|
|
45
|
+
], ApiExplorerModule);
|
|
46
|
+
//# sourceMappingURL=api-explorer.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-explorer.module.js","sourceRoot":"","sources":["../src/api-explorer.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAuD;AACvD,uEAAwE;AACxE,iEAA4D;AAa5D,MAAM,QAAQ,GAA+B;IAC3C,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,cAAc;IACrB,OAAO,EAAE,IAAI;CACd,CAAC;AAEW,QAAA,oBAAoB,GAAG,sBAAsB,CAAC;AAGpD,IAAM,iBAAiB,yBAAvB,MAAM,iBAAiB;IAC5B,MAAM,CAAC,QAAQ,CAAC,UAA8B,EAAE;QAC9C,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAC;QAC3D,MAAM,QAAQ,GAA+B,EAAE,GAAG,QAAQ,EAAE,GAAG,OAAO,EAAE,CAAC;QAEzE,IAAI,CAAC,QAAQ,CAAC,OAAO,IAAI,YAAY,EAAE,CAAC;YACtC,OAAO,EAAE,MAAM,EAAE,mBAAiB,EAAE,CAAC;QACvC,CAAC;QAED,MAAM,UAAU,GAAG,IAAA,qDAA2B,EAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAE9D,OAAO;YACL,MAAM,EAAE,mBAAiB;YACzB,WAAW,EAAE,CAAC,UAAU,CAAC;YACzB,SAAS,EAAE;gBACT,yCAAkB;gBAClB;oBACE,OAAO,EAAE,4BAAoB;oBAC7B,QAAQ,EAAE,QAAQ;iBACnB;aACF;YACD,OAAO,EAAE,CAAC,yCAAkB,CAAC;SAC9B,CAAC;IACJ,CAAC;CACF,CAAA;AAxBY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,iBAAiB,CAwB7B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface RouteInfo {
|
|
2
|
+
method: string;
|
|
3
|
+
path: string;
|
|
4
|
+
params: string[];
|
|
5
|
+
}
|
|
6
|
+
export declare class ApiExplorerService {
|
|
7
|
+
getRoutes(expressApp: any): RouteInfo[];
|
|
8
|
+
private scanApp;
|
|
9
|
+
private traverseStack;
|
|
10
|
+
private joinPaths;
|
|
11
|
+
private extractPathFromLayer;
|
|
12
|
+
private extractParams;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=api-explorer.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-explorer.service.d.ts","sourceRoot":"","sources":["../src/api-explorer.service.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,qBACa,kBAAkB;IAC7B,SAAS,CAAC,UAAU,EAAE,GAAG,GAAG,SAAS,EAAE;IAIvC,OAAO,CAAC,OAAO;IAsBf,OAAO,CAAC,aAAa;IAuBrB,OAAO,CAAC,SAAS;IAOjB,OAAO,CAAC,oBAAoB;IA0B5B,OAAO,CAAC,aAAa;CAGtB"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.ApiExplorerService = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
let ApiExplorerService = class ApiExplorerService {
|
|
12
|
+
getRoutes(expressApp) {
|
|
13
|
+
return this.scanApp(expressApp);
|
|
14
|
+
}
|
|
15
|
+
scanApp(app) {
|
|
16
|
+
if (!app)
|
|
17
|
+
return [];
|
|
18
|
+
const router = app._router || app.router;
|
|
19
|
+
if (!router?.stack)
|
|
20
|
+
return [];
|
|
21
|
+
const routes = [];
|
|
22
|
+
this.traverseStack(router.stack, '', routes);
|
|
23
|
+
// Deduplicate and sort
|
|
24
|
+
const seen = new Set();
|
|
25
|
+
const unique = routes.filter((r) => {
|
|
26
|
+
const key = `${r.method}:${r.path}`;
|
|
27
|
+
if (seen.has(key))
|
|
28
|
+
return false;
|
|
29
|
+
seen.add(key);
|
|
30
|
+
return true;
|
|
31
|
+
});
|
|
32
|
+
return unique.sort((a, b) => a.path.localeCompare(b.path) || a.method.localeCompare(b.method));
|
|
33
|
+
}
|
|
34
|
+
traverseStack(stack, prefix, out) {
|
|
35
|
+
for (const layer of stack) {
|
|
36
|
+
if (layer.route) {
|
|
37
|
+
const rawPath = layer.route.path;
|
|
38
|
+
const fullPath = this.joinPaths(prefix, rawPath);
|
|
39
|
+
const methods = Object.keys(layer.route.methods)
|
|
40
|
+
.filter((m) => m !== '_all' && layer.route.methods[m])
|
|
41
|
+
.map((m) => m.toUpperCase());
|
|
42
|
+
for (const method of methods) {
|
|
43
|
+
out.push({
|
|
44
|
+
method,
|
|
45
|
+
path: fullPath,
|
|
46
|
+
params: this.extractParams(fullPath),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else if (layer.handle?.stack) {
|
|
51
|
+
const layerPath = this.extractPathFromLayer(layer);
|
|
52
|
+
this.traverseStack(layer.handle.stack, prefix + layerPath, out);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
joinPaths(base, segment) {
|
|
57
|
+
if (!segment || segment === '/')
|
|
58
|
+
return base || '/';
|
|
59
|
+
const b = base.endsWith('/') ? base.slice(0, -1) : base;
|
|
60
|
+
const s = segment.startsWith('/') ? segment : '/' + segment;
|
|
61
|
+
return b + s;
|
|
62
|
+
}
|
|
63
|
+
extractPathFromLayer(layer) {
|
|
64
|
+
if (!layer.regexp)
|
|
65
|
+
return '';
|
|
66
|
+
const source = layer.regexp.source;
|
|
67
|
+
// Root-level router — no prefix contribution
|
|
68
|
+
if (source === '^\\/(?=\\/|$)' ||
|
|
69
|
+
source === '^\\/?(?=\\/|$)' ||
|
|
70
|
+
source === '^\\/') {
|
|
71
|
+
return '';
|
|
72
|
+
}
|
|
73
|
+
// ^\/some-path\/?(?=\/|$)i — static path segments
|
|
74
|
+
const match = source.match(/^\^\\\/(.+?)(?:\\\/?)?(?:\(\?=\\\\\|\\$\))?$/i);
|
|
75
|
+
if (match) {
|
|
76
|
+
const raw = match[1]
|
|
77
|
+
.replace(/\\\//g, '/')
|
|
78
|
+
.replace(/\\/g, '')
|
|
79
|
+
.replace(/\?.*$/, '');
|
|
80
|
+
return '/' + raw;
|
|
81
|
+
}
|
|
82
|
+
return '';
|
|
83
|
+
}
|
|
84
|
+
extractParams(path) {
|
|
85
|
+
return (path.match(/:([^/]+)/g) ?? []).map((p) => p.slice(1));
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
exports.ApiExplorerService = ApiExplorerService;
|
|
89
|
+
exports.ApiExplorerService = ApiExplorerService = __decorate([
|
|
90
|
+
(0, common_1.Injectable)()
|
|
91
|
+
], ApiExplorerService);
|
|
92
|
+
//# sourceMappingURL=api-explorer.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-explorer.service.js","sourceRoot":"","sources":["../src/api-explorer.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AASrC,IAAM,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-explorer.module';
|
|
2
|
+
export { ApiExplorerService, RouteInfo } from './api-explorer.service';
|
|
3
|
+
export { getExplorerHtml } from './api-explorer.html';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAChI,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getExplorerHtml = exports.ApiExplorerService = exports.API_EXPLORER_OPTIONS = exports.ApiExplorerModule = void 0;
|
|
4
|
+
var api_explorer_module_1 = require("./api-explorer.module");
|
|
5
|
+
Object.defineProperty(exports, "ApiExplorerModule", { enumerable: true, get: function () { return api_explorer_module_1.ApiExplorerModule; } });
|
|
6
|
+
Object.defineProperty(exports, "API_EXPLORER_OPTIONS", { enumerable: true, get: function () { return api_explorer_module_1.API_EXPLORER_OPTIONS; } });
|
|
7
|
+
var api_explorer_service_1 = require("./api-explorer.service");
|
|
8
|
+
Object.defineProperty(exports, "ApiExplorerService", { enumerable: true, get: function () { return api_explorer_service_1.ApiExplorerService; } });
|
|
9
|
+
var api_explorer_html_1 = require("./api-explorer.html");
|
|
10
|
+
Object.defineProperty(exports, "getExplorerHtml", { enumerable: true, get: function () { return api_explorer_html_1.getExplorerHtml; } });
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,6DAAgI;AAAvH,wHAAA,iBAAiB,OAAA;AAAkD,2HAAA,oBAAoB,OAAA;AAChG,+DAAuE;AAA9D,0HAAA,kBAAkB,OAAA;AAC3B,yDAAsD;AAA7C,oHAAA,eAAe,OAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vnphu/nestjs-api-explorer",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "An in-app API explorer for NestJS — like Postman, but built right into your app.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc -p tsconfig.build.json",
|
|
12
|
+
"build:watch": "tsc -p tsconfig.build.json --watch",
|
|
13
|
+
"prepare": "npm run build"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"nestjs",
|
|
17
|
+
"api",
|
|
18
|
+
"explorer",
|
|
19
|
+
"postman",
|
|
20
|
+
"swagger",
|
|
21
|
+
"documentation",
|
|
22
|
+
"rest",
|
|
23
|
+
"http",
|
|
24
|
+
"client"
|
|
25
|
+
],
|
|
26
|
+
"author": "vnphu",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"@nestjs/common": ">=9.0.0",
|
|
30
|
+
"@nestjs/core": ">=9.0.0",
|
|
31
|
+
"reflect-metadata": "^0.1.13 || ^0.2.0",
|
|
32
|
+
"rxjs": "^7.0.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@nestjs/common": "^10.0.0",
|
|
36
|
+
"@nestjs/core": "^10.0.0",
|
|
37
|
+
"@types/express": "^4.17.21",
|
|
38
|
+
"@types/node": "^20.0.0",
|
|
39
|
+
"reflect-metadata": "^0.2.0",
|
|
40
|
+
"rxjs": "^7.8.0",
|
|
41
|
+
"typescript": "^5.3.0"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"nestjs-api-docs": "file:.."
|
|
45
|
+
}
|
|
46
|
+
}
|