@vnphu/nestjs-api-explorer 0.1.0 → 0.2.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 +409 -77
- package/dist/api-docs-parser.d.ts +24 -0
- package/dist/api-docs-parser.d.ts.map +1 -0
- package/dist/api-docs-parser.js +234 -0
- package/dist/api-docs-parser.js.map +1 -0
- package/dist/api-explorer.html.d.ts.map +1 -1
- package/dist/api-explorer.html.js +514 -21
- package/dist/api-explorer.html.js.map +1 -1
- package/dist/api-explorer.module.d.ts +27 -4
- package/dist/api-explorer.module.d.ts.map +1 -1
- package/dist/api-explorer.module.js +10 -1
- package/dist/api-explorer.module.js.map +1 -1
- package/dist/api-explorer.service.d.ts +12 -0
- package/dist/api-explorer.service.d.ts.map +1 -1
- package/dist/api-explorer.service.js +44 -26
- package/dist/api-explorer.service.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-explorer.html.js","sourceRoot":"","sources":["../src/api-explorer.html.ts"],"names":[],"mappings":";;AAEA,
|
|
1
|
+
{"version":3,"file":"api-explorer.html.js","sourceRoot":"","sources":["../src/api-explorer.html.ts"],"names":[],"mappings":";;AAEA,0CAmhDC;AAnhDD,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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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAssBf,CAAC;AACT,CAAC"}
|
|
@@ -1,13 +1,36 @@
|
|
|
1
1
|
import { DynamicModule } from '@nestjs/common';
|
|
2
2
|
export interface ApiExplorerOptions {
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* URL path to serve the explorer UI.
|
|
5
|
+
* @default 'api-explorer'
|
|
6
|
+
*/
|
|
4
7
|
path?: string;
|
|
5
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Title shown in browser tab and UI header.
|
|
10
|
+
* @default 'API Explorer'
|
|
11
|
+
*/
|
|
6
12
|
title?: string;
|
|
7
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Path to the markdown docs file that describes your API routes.
|
|
15
|
+
* Can be absolute or relative to process.cwd().
|
|
16
|
+
*
|
|
17
|
+
* @example './api-explorer.md'
|
|
18
|
+
* @example '/app/docs/api.md'
|
|
19
|
+
*/
|
|
20
|
+
docsFile?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Explicitly enable or disable the explorer.
|
|
23
|
+
* The explorer is automatically disabled when NODE_ENV === 'production'.
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
8
26
|
enabled?: boolean;
|
|
9
27
|
}
|
|
10
|
-
export
|
|
28
|
+
export interface ResolvedApiExplorerOptions {
|
|
29
|
+
path: string;
|
|
30
|
+
title: string;
|
|
31
|
+
docsFile: string | null;
|
|
32
|
+
enabled: boolean;
|
|
33
|
+
}
|
|
11
34
|
export declare const API_EXPLORER_OPTIONS = "API_EXPLORER_OPTIONS";
|
|
12
35
|
export declare class ApiExplorerModule {
|
|
13
36
|
static register(options?: ApiExplorerOptions): DynamicModule;
|
|
@@ -1 +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
|
|
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;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,OAAO,CAAC;CAClB;AASD,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAE3D,qBACa,iBAAiB;IAC5B,MAAM,CAAC,QAAQ,CAAC,OAAO,GAAE,kBAAuB,GAAG,aAAa;CA+BjE"}
|
|
@@ -14,13 +14,18 @@ const api_explorer_service_1 = require("./api-explorer.service");
|
|
|
14
14
|
const DEFAULTS = {
|
|
15
15
|
path: 'api-explorer',
|
|
16
16
|
title: 'API Explorer',
|
|
17
|
+
docsFile: null,
|
|
17
18
|
enabled: true,
|
|
18
19
|
};
|
|
19
20
|
exports.API_EXPLORER_OPTIONS = 'API_EXPLORER_OPTIONS';
|
|
20
21
|
let ApiExplorerModule = ApiExplorerModule_1 = class ApiExplorerModule {
|
|
21
22
|
static register(options = {}) {
|
|
22
23
|
const isProduction = process.env.NODE_ENV === 'production';
|
|
23
|
-
const resolved = {
|
|
24
|
+
const resolved = {
|
|
25
|
+
...DEFAULTS,
|
|
26
|
+
...options,
|
|
27
|
+
docsFile: options.docsFile ?? null,
|
|
28
|
+
};
|
|
24
29
|
if (!resolved.enabled || isProduction) {
|
|
25
30
|
return { module: ApiExplorerModule_1 };
|
|
26
31
|
}
|
|
@@ -34,6 +39,10 @@ let ApiExplorerModule = ApiExplorerModule_1 = class ApiExplorerModule {
|
|
|
34
39
|
provide: exports.API_EXPLORER_OPTIONS,
|
|
35
40
|
useValue: resolved,
|
|
36
41
|
},
|
|
42
|
+
{
|
|
43
|
+
provide: api_explorer_service_1.API_EXPLORER_DOCS_FILE,
|
|
44
|
+
useValue: resolved.docsFile,
|
|
45
|
+
},
|
|
37
46
|
],
|
|
38
47
|
exports: [api_explorer_service_1.ApiExplorerService],
|
|
39
48
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-explorer.module.js","sourceRoot":"","sources":["../src/api-explorer.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAuD;AACvD,uEAAwE;AACxE,
|
|
1
|
+
{"version":3,"file":"api-explorer.module.js","sourceRoot":"","sources":["../src/api-explorer.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAuD;AACvD,uEAAwE;AACxE,iEAAoF;AAuCpF,MAAM,QAAQ,GAA+B;IAC3C,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,cAAc;IACrB,QAAQ,EAAE,IAAI;IACd,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;YAC3C,GAAG,QAAQ;YACX,GAAG,OAAO;YACV,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,IAAI;SACnC,CAAC;QAEF,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;gBACD;oBACE,OAAO,EAAE,6CAAsB;oBAC/B,QAAQ,EAAE,QAAQ,CAAC,QAAQ;iBAC5B;aACF;YACD,OAAO,EAAE,CAAC,yCAAkB,CAAC;SAC9B,CAAC;IACJ,CAAC;CACF,CAAA;AAhCY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,iBAAiB,CAgC7B"}
|
|
@@ -1,9 +1,21 @@
|
|
|
1
|
+
import { RouteDoc, DocField } from './api-docs-parser';
|
|
2
|
+
export declare const API_EXPLORER_DOCS_FILE = "API_EXPLORER_DOCS_FILE";
|
|
3
|
+
export { DocField, RouteDoc };
|
|
1
4
|
export interface RouteInfo {
|
|
2
5
|
method: string;
|
|
3
6
|
path: string;
|
|
4
7
|
params: string[];
|
|
8
|
+
group: string;
|
|
9
|
+
description: string;
|
|
10
|
+
body: DocField[];
|
|
11
|
+
query: DocField[];
|
|
12
|
+
headers: DocField[];
|
|
13
|
+
response: DocField[];
|
|
5
14
|
}
|
|
6
15
|
export declare class ApiExplorerService {
|
|
16
|
+
private readonly docsFile;
|
|
17
|
+
private _docsMap;
|
|
18
|
+
constructor(docsFile: string | null);
|
|
7
19
|
getRoutes(expressApp: any): RouteInfo[];
|
|
8
20
|
private scanApp;
|
|
9
21
|
private traverseStack;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-explorer.service.d.ts","sourceRoot":"","sources":["../src/api-explorer.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api-explorer.service.d.ts","sourceRoot":"","sources":["../src/api-explorer.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,QAAQ,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEtE,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAE/D,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;AAE9B,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,OAAO,EAAE,QAAQ,EAAE,CAAC;IACpB,QAAQ,EAAE,QAAQ,EAAE,CAAC;CACtB;AAED,qBACa,kBAAkB;IAK3B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAJ3B,OAAO,CAAC,QAAQ,CAAsC;gBAInC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAG1C,SAAS,CAAC,UAAU,EAAE,GAAG,GAAG,SAAS,EAAE;IAwBvC,OAAO,CAAC,OAAO;IAmBf,OAAO,CAAC,aAAa;IAiBrB,OAAO,CAAC,SAAS;IAOjB,OAAO,CAAC,oBAAoB;IAW5B,OAAO,CAAC,aAAa;CAGtB"}
|
|
@@ -5,13 +5,42 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
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
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
8
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.ApiExplorerService = void 0;
|
|
15
|
+
exports.ApiExplorerService = exports.API_EXPLORER_DOCS_FILE = void 0;
|
|
10
16
|
const common_1 = require("@nestjs/common");
|
|
17
|
+
const api_docs_parser_1 = require("./api-docs-parser");
|
|
18
|
+
exports.API_EXPLORER_DOCS_FILE = 'API_EXPLORER_DOCS_FILE';
|
|
11
19
|
let ApiExplorerService = class ApiExplorerService {
|
|
20
|
+
constructor(docsFile) {
|
|
21
|
+
this.docsFile = docsFile;
|
|
22
|
+
this._docsMap = null;
|
|
23
|
+
}
|
|
12
24
|
getRoutes(expressApp) {
|
|
13
|
-
|
|
25
|
+
// Lazy-load docs file once
|
|
26
|
+
if (this._docsMap === null) {
|
|
27
|
+
this._docsMap = this.docsFile ? (0, api_docs_parser_1.parseDocsFile)(this.docsFile) : new Map();
|
|
28
|
+
}
|
|
29
|
+
const routes = this.scanApp(expressApp);
|
|
30
|
+
return routes.map((r) => {
|
|
31
|
+
const doc = this._docsMap.get(`${r.method}:${r.path}`);
|
|
32
|
+
return {
|
|
33
|
+
...r,
|
|
34
|
+
group: doc?.group ?? '',
|
|
35
|
+
description: doc?.description ?? '',
|
|
36
|
+
body: doc?.body ?? [],
|
|
37
|
+
query: doc?.query ?? [],
|
|
38
|
+
headers: doc?.headers ?? [],
|
|
39
|
+
response: doc?.response ?? [],
|
|
40
|
+
};
|
|
41
|
+
});
|
|
14
42
|
}
|
|
43
|
+
// ── Express route scanning ──────────────────────────────────────
|
|
15
44
|
scanApp(app) {
|
|
16
45
|
if (!app)
|
|
17
46
|
return [];
|
|
@@ -20,31 +49,26 @@ let ApiExplorerService = class ApiExplorerService {
|
|
|
20
49
|
return [];
|
|
21
50
|
const routes = [];
|
|
22
51
|
this.traverseStack(router.stack, '', routes);
|
|
23
|
-
// Deduplicate and sort
|
|
24
52
|
const seen = new Set();
|
|
25
|
-
|
|
53
|
+
return routes
|
|
54
|
+
.filter((r) => {
|
|
26
55
|
const key = `${r.method}:${r.path}`;
|
|
27
56
|
if (seen.has(key))
|
|
28
57
|
return false;
|
|
29
58
|
seen.add(key);
|
|
30
59
|
return true;
|
|
31
|
-
})
|
|
32
|
-
|
|
60
|
+
})
|
|
61
|
+
.sort((a, b) => a.path.localeCompare(b.path) || a.method.localeCompare(b.method));
|
|
33
62
|
}
|
|
34
63
|
traverseStack(stack, prefix, out) {
|
|
35
64
|
for (const layer of stack) {
|
|
36
65
|
if (layer.route) {
|
|
37
|
-
const
|
|
38
|
-
const fullPath = this.joinPaths(prefix, rawPath);
|
|
66
|
+
const fullPath = this.joinPaths(prefix, layer.route.path);
|
|
39
67
|
const methods = Object.keys(layer.route.methods)
|
|
40
68
|
.filter((m) => m !== '_all' && layer.route.methods[m])
|
|
41
69
|
.map((m) => m.toUpperCase());
|
|
42
70
|
for (const method of methods) {
|
|
43
|
-
out.push({
|
|
44
|
-
method,
|
|
45
|
-
path: fullPath,
|
|
46
|
-
params: this.extractParams(fullPath),
|
|
47
|
-
});
|
|
71
|
+
out.push({ method, path: fullPath, params: this.extractParams(fullPath) });
|
|
48
72
|
}
|
|
49
73
|
}
|
|
50
74
|
else if (layer.handle?.stack) {
|
|
@@ -64,20 +88,11 @@ let ApiExplorerService = class ApiExplorerService {
|
|
|
64
88
|
if (!layer.regexp)
|
|
65
89
|
return '';
|
|
66
90
|
const source = layer.regexp.source;
|
|
67
|
-
|
|
68
|
-
if (source === '^\\/(?=\\/|$)' ||
|
|
69
|
-
source === '^\\/?(?=\\/|$)' ||
|
|
70
|
-
source === '^\\/') {
|
|
91
|
+
if (['^\\\/(?=\\\/|$)', '^\\\\/?(?=\\\/|$)', '^\\\\/'].includes(source))
|
|
71
92
|
return '';
|
|
72
|
-
|
|
73
|
-
// ^\/some-path\/?(?=\/|$)i — static path segments
|
|
74
|
-
const match = source.match(/^\^\\\/(.+?)(?:\\\/?)?(?:\(\?=\\\\\|\\$\))?$/i);
|
|
93
|
+
const match = source.match(/^\^\\\/(.+?)(?:\\\/?)?(?:\(\?=\\\/\|\\\$\))?$/i);
|
|
75
94
|
if (match) {
|
|
76
|
-
|
|
77
|
-
.replace(/\\\//g, '/')
|
|
78
|
-
.replace(/\\/g, '')
|
|
79
|
-
.replace(/\?.*$/, '');
|
|
80
|
-
return '/' + raw;
|
|
95
|
+
return '/' + match[1].replace(/\\\//g, '/').replace(/\\/g, '').replace(/\?.*$/, '');
|
|
81
96
|
}
|
|
82
97
|
return '';
|
|
83
98
|
}
|
|
@@ -87,6 +102,9 @@ let ApiExplorerService = class ApiExplorerService {
|
|
|
87
102
|
};
|
|
88
103
|
exports.ApiExplorerService = ApiExplorerService;
|
|
89
104
|
exports.ApiExplorerService = ApiExplorerService = __decorate([
|
|
90
|
-
(0, common_1.Injectable)()
|
|
105
|
+
(0, common_1.Injectable)(),
|
|
106
|
+
__param(0, (0, common_1.Optional)()),
|
|
107
|
+
__param(0, (0, common_1.Inject)(exports.API_EXPLORER_DOCS_FILE)),
|
|
108
|
+
__metadata("design:paramtypes", [Object])
|
|
91
109
|
], ApiExplorerService);
|
|
92
110
|
//# sourceMappingURL=api-explorer.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-explorer.service.js","sourceRoot":"","sources":["../src/api-explorer.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api-explorer.service.js","sourceRoot":"","sources":["../src/api-explorer.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA8D;AAC9D,uDAAsE;AAEzD,QAAA,sBAAsB,GAAG,wBAAwB,CAAC;AAiBxD,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAG7B,YAEE,QAAwC;QAAvB,aAAQ,GAAR,QAAQ,CAAe;QAJlC,aAAQ,GAAiC,IAAI,CAAC;IAKnD,CAAC;IAEJ,SAAS,CAAC,UAAe;QACvB,2BAA2B;QAC3B,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;YAC3B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAA,+BAAa,EAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC;QAC3E,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAExC,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YACtB,MAAM,GAAG,GAAG,IAAI,CAAC,QAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;YACxD,OAAO;gBACL,GAAG,CAAC;gBACJ,KAAK,EAAQ,GAAG,EAAE,KAAK,IAAU,EAAE;gBACnC,WAAW,EAAE,GAAG,EAAE,WAAW,IAAI,EAAE;gBACnC,IAAI,EAAS,GAAG,EAAE,IAAI,IAAW,EAAE;gBACnC,KAAK,EAAQ,GAAG,EAAE,KAAK,IAAU,EAAE;gBACnC,OAAO,EAAM,GAAG,EA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AO,CAAC;QAC5D,OAAO,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;IAEO,oBAAoB,CAAC,KAAU;QACrC,IAAI,CAAC,KAAK,CAAC,MAAM;YAAE,OAAO,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAW,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;QAC3C,IAAI,CAAC,iBAAiB,EAAE,mBAAmB,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE,OAAO,EAAE,CAAC;QACnF,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAC;QAC7E,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACtF,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;IAEO,aAAa,CAAC,IAAY;QAChC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAChE,CAAC;CACF,CAAA;AAzFY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,mBAAU,GAAE;IAKR,WAAA,IAAA,iBAAQ,GAAE,CAAA;IAAE,WAAA,IAAA,eAAM,EAAC,8BAAsB,CAAC,CAAA;;GAJlC,kBAAkB,CAyF9B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { ApiExplorerModule, ApiExplorerOptions, ResolvedApiExplorerOptions, API_EXPLORER_OPTIONS } from './api-explorer.module';
|
|
2
|
-
export { ApiExplorerService, RouteInfo } from './api-explorer.service';
|
|
1
|
+
export { ApiExplorerModule, ApiExplorerOptions, ResolvedApiExplorerOptions, API_EXPLORER_OPTIONS, } from './api-explorer.module';
|
|
2
|
+
export { ApiExplorerService, RouteInfo, DocField, RouteDoc, API_EXPLORER_DOCS_FILE, } from './api-explorer.service';
|
|
3
3
|
export { getExplorerHtml } from './api-explorer.html';
|
|
4
|
+
export { parseDocsFile } from './api-docs-parser';
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,0BAA0B,EAC1B,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,kBAAkB,EAClB,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getExplorerHtml = exports.ApiExplorerService = exports.API_EXPLORER_OPTIONS = exports.ApiExplorerModule = void 0;
|
|
3
|
+
exports.parseDocsFile = exports.getExplorerHtml = exports.API_EXPLORER_DOCS_FILE = exports.ApiExplorerService = exports.API_EXPLORER_OPTIONS = exports.ApiExplorerModule = void 0;
|
|
4
4
|
var api_explorer_module_1 = require("./api-explorer.module");
|
|
5
5
|
Object.defineProperty(exports, "ApiExplorerModule", { enumerable: true, get: function () { return api_explorer_module_1.ApiExplorerModule; } });
|
|
6
6
|
Object.defineProperty(exports, "API_EXPLORER_OPTIONS", { enumerable: true, get: function () { return api_explorer_module_1.API_EXPLORER_OPTIONS; } });
|
|
7
7
|
var api_explorer_service_1 = require("./api-explorer.service");
|
|
8
8
|
Object.defineProperty(exports, "ApiExplorerService", { enumerable: true, get: function () { return api_explorer_service_1.ApiExplorerService; } });
|
|
9
|
+
Object.defineProperty(exports, "API_EXPLORER_DOCS_FILE", { enumerable: true, get: function () { return api_explorer_service_1.API_EXPLORER_DOCS_FILE; } });
|
|
9
10
|
var api_explorer_html_1 = require("./api-explorer.html");
|
|
10
11
|
Object.defineProperty(exports, "getExplorerHtml", { enumerable: true, get: function () { return api_explorer_html_1.getExplorerHtml; } });
|
|
12
|
+
var api_docs_parser_1 = require("./api-docs-parser");
|
|
13
|
+
Object.defineProperty(exports, "parseDocsFile", { enumerable: true, get: function () { return api_docs_parser_1.parseDocsFile; } });
|
|
11
14
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,6DAK+B;AAJ7B,wHAAA,iBAAiB,OAAA;AAGjB,2HAAA,oBAAoB,OAAA;AAGtB,+DAMgC;AAL9B,0HAAA,kBAAkB,OAAA;AAIlB,8HAAA,sBAAsB,OAAA;AAGxB,yDAAsD;AAA7C,oHAAA,eAAe,OAAA;AACxB,qDAAkD;AAAzC,gHAAA,aAAa,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vnphu/nestjs-api-explorer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "An in-app API explorer for NestJS — like Postman, but built right into your app.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"typescript": "^5.3.0"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
+
"@vnphu/nestjs-api-explorer": "^0.1.0",
|
|
44
45
|
"nestjs-api-docs": "file:.."
|
|
45
46
|
}
|
|
46
47
|
}
|