nestjs-profiler 1.0.12 → 1.0.13

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 (61) hide show
  1. package/analyzers/explain-analyzer.d.ts +5 -0
  2. package/analyzers/explain-analyzer.js +41 -0
  3. package/analyzers/explain-analyzer.js.map +1 -0
  4. package/collectors/cache-collector.d.ts +18 -0
  5. package/collectors/cache-collector.js +175 -0
  6. package/collectors/cache-collector.js.map +1 -0
  7. package/collectors/log-collector.d.ts +12 -0
  8. package/collectors/log-collector.js +66 -0
  9. package/collectors/log-collector.js.map +1 -0
  10. package/collectors/mongo-collector.d.ts +19 -0
  11. package/collectors/mongo-collector.js +200 -0
  12. package/collectors/mongo-collector.js.map +1 -0
  13. package/collectors/mysql-collector.d.ts +12 -0
  14. package/collectors/mysql-collector.js +128 -0
  15. package/collectors/mysql-collector.js.map +1 -0
  16. package/collectors/postgres-collector.d.ts +15 -0
  17. package/collectors/postgres-collector.js +201 -0
  18. package/collectors/postgres-collector.js.map +1 -0
  19. package/common/profiler-options.interface.d.ts +20 -0
  20. package/common/profiler-options.interface.js +3 -0
  21. package/common/profiler-options.interface.js.map +1 -0
  22. package/common/profiler.model.d.ts +67 -0
  23. package/common/profiler.model.js +3 -0
  24. package/common/profiler.model.js.map +1 -0
  25. package/controllers/profiler.controller.d.ts +34 -0
  26. package/controllers/profiler.controller.js +254 -0
  27. package/controllers/profiler.controller.js.map +1 -0
  28. package/interceptors/request-profiler.interceptor.d.ts +11 -0
  29. package/interceptors/request-profiler.interceptor.js +103 -0
  30. package/interceptors/request-profiler.interceptor.js.map +1 -0
  31. package/middleware/profiler.middleware.d.ts +4 -0
  32. package/middleware/profiler.middleware.js +21 -0
  33. package/middleware/profiler.middleware.js.map +1 -0
  34. package/package.json +5 -4
  35. package/profiler-logger.d.ts +12 -0
  36. package/profiler-logger.js +59 -0
  37. package/profiler-logger.js.map +1 -0
  38. package/profiler.module.d.ts +7 -0
  39. package/profiler.module.js +105 -0
  40. package/profiler.module.js.map +1 -0
  41. package/services/entity-explorer.service.d.ts +19 -0
  42. package/services/entity-explorer.service.js +111 -0
  43. package/services/entity-explorer.service.js.map +1 -0
  44. package/services/profiler.service.d.ts +31 -0
  45. package/services/profiler.service.js +216 -0
  46. package/services/profiler.service.js.map +1 -0
  47. package/services/route-explorer.service.d.ts +15 -0
  48. package/services/route-explorer.service.js +94 -0
  49. package/services/route-explorer.service.js.map +1 -0
  50. package/services/template-builder.service.d.ts +27 -0
  51. package/services/template-builder.service.js +348 -0
  52. package/services/template-builder.service.js.map +1 -0
  53. package/services/view.service.d.ts +17 -0
  54. package/services/view.service.js +196 -0
  55. package/services/view.service.js.map +1 -0
  56. package/storage/in-memory-profiler-storage.d.ts +9 -0
  57. package/storage/in-memory-profiler-storage.js +29 -0
  58. package/storage/in-memory-profiler-storage.js.map +1 -0
  59. package/storage/profiler-storage.interface.d.ts +6 -0
  60. package/storage/profiler-storage.interface.js +3 -0
  61. package/storage/profiler-storage.interface.js.map +1 -0
@@ -0,0 +1,19 @@
1
+ export interface EntityDefinition {
2
+ name: string;
3
+ type: string;
4
+ database: string;
5
+ connection: string;
6
+ tableName?: string;
7
+ columns?: string[];
8
+ }
9
+ export declare class EntityExplorerService {
10
+ private entities;
11
+ constructor();
12
+ initialize(modulesContainer: any): void;
13
+ getEntities(): EntityDefinition[];
14
+ private scan;
15
+ private isTypeOrmDataSource;
16
+ private extractTypeOrmEntities;
17
+ private isMongooseConnection;
18
+ private extractMongooseModels;
19
+ }
@@ -0,0 +1,111 @@
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 __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.EntityExplorerService = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ let EntityExplorerService = class EntityExplorerService {
15
+ constructor() {
16
+ this.entities = [];
17
+ }
18
+ initialize(modulesContainer) {
19
+ try {
20
+ this.scan(modulesContainer);
21
+ }
22
+ catch (e) {
23
+ console.error('Profiler: Entity discovery failed', e);
24
+ }
25
+ }
26
+ getEntities() {
27
+ return this.entities;
28
+ }
29
+ scan(modulesContainer) {
30
+ if (!modulesContainer)
31
+ return;
32
+ const definitions = [];
33
+ const modules = [...modulesContainer.values()];
34
+ for (const module of modules) {
35
+ const providers = [...module.providers.values()];
36
+ for (const provider of providers) {
37
+ if (!provider.instance)
38
+ continue;
39
+ if (this.isTypeOrmDataSource(provider.instance)) {
40
+ definitions.push(...this.extractTypeOrmEntities(provider.instance));
41
+ }
42
+ if (this.isMongooseConnection(provider.instance)) {
43
+ definitions.push(...this.extractMongooseModels(provider.instance));
44
+ }
45
+ }
46
+ }
47
+ const unique = new Map();
48
+ definitions.forEach(d => {
49
+ const key = `${d.connection}:${d.name}`;
50
+ unique.set(key, d);
51
+ });
52
+ this.entities = Array.from(unique.values()).sort((a, b) => a.name.localeCompare(b.name));
53
+ }
54
+ isTypeOrmDataSource(instance) {
55
+ return (instance &&
56
+ typeof instance === 'object' &&
57
+ instance.entityMetadatas &&
58
+ Array.isArray(instance.entityMetadatas) &&
59
+ instance.driver &&
60
+ typeof instance.driver === 'object');
61
+ }
62
+ extractTypeOrmEntities(dataSource) {
63
+ const entities = [];
64
+ const connectionName = dataSource.name || 'default';
65
+ const dbType = dataSource.options?.type || 'sql';
66
+ const databaseName = dataSource.options?.database || 'unknown';
67
+ for (const metadata of dataSource.entityMetadatas) {
68
+ entities.push({
69
+ name: metadata.name,
70
+ type: dbType,
71
+ database: databaseName,
72
+ connection: connectionName,
73
+ tableName: metadata.tableName,
74
+ columns: metadata.columns?.map((c) => c.propertyName) || [],
75
+ });
76
+ }
77
+ return entities;
78
+ }
79
+ isMongooseConnection(instance) {
80
+ return (instance &&
81
+ typeof instance === 'object' &&
82
+ instance.models &&
83
+ typeof instance.models === 'object' &&
84
+ instance.base &&
85
+ typeof instance.base === 'object');
86
+ }
87
+ extractMongooseModels(connection) {
88
+ const entities = [];
89
+ const connectionName = connection.name || 'default';
90
+ const databaseName = connection.db?.databaseName || 'unknown';
91
+ for (const [name, model] of Object.entries(connection.models)) {
92
+ const schema = model.schema;
93
+ const columns = schema && schema.paths ? Object.keys(schema.paths) : [];
94
+ entities.push({
95
+ name: name,
96
+ type: 'mongodb',
97
+ database: databaseName,
98
+ connection: connectionName,
99
+ tableName: model.collection?.name,
100
+ columns: columns
101
+ });
102
+ }
103
+ return entities;
104
+ }
105
+ };
106
+ exports.EntityExplorerService = EntityExplorerService;
107
+ exports.EntityExplorerService = EntityExplorerService = __decorate([
108
+ (0, common_1.Injectable)(),
109
+ __metadata("design:paramtypes", [])
110
+ ], EntityExplorerService);
111
+ //# sourceMappingURL=entity-explorer.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-explorer.service.js","sourceRoot":"","sources":["../../../libs/nestjs-profiler/src/services/entity-explorer.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAYrC,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAG9B;QAFQ,aAAQ,GAAuB,EAAE,CAAC;IAE1B,CAAC;IAKjB,UAAU,CAAC,gBAAqB;QAC5B,IAAI,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAChC,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,OAAO,CAAC,KAAK,CAA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R,OAAO,QAAQ,KAAK,QAAQ;YAC5B,QAAQ,CAAC,MAAM;YACf,OAAO,QAAQ,CAAC,MAAM,KAAK,QAAQ;YACnC,QAAQ,CAAC,IAAI;YACb,OAAO,QAAQ,CAAC,IAAI,KAAK,QAAQ,CACpC,CAAC;IACN,CAAC;IAGO,qBAAqB,CAAC,UAAe;QACzC,MAAM,QAAQ,GAAuB,EAAE,CAAC;QACxC,MAAM,cAAc,GAAG,UAAU,CAAC,IAAI,IAAI,SAAS,CAAC;QACpD,MAAM,YAAY,GAAG,UAAU,CAAC,EAAE,EAAE,YAAY,IAAI,SAAS,CAAC;QAE9D,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;YAE5D,MAAM,MAAM,GAAS,KAAa,CAAC,MAAM,CAAC;YAC1C,MAAM,OAAO,GAAG,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAExE,QAAQ,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,IAAI;gBACV,IAAI,EAAE,SAAS;gBACf,QAAQ,EAAE,YAAY;gBACtB,UAAU,EAAE,cAAc;gBAC1B,SAAS,EAAG,KAAa,CAAC,UAAU,EAAE,IAAI;gBAC1C,OAAO,EAAE,OAAO;aACnB,CAAC,CAAC;QACP,CAAC;QAED,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ,CAAA;AA7HY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,mBAAU,GAAE;;GACA,qBAAqB,CA6HjC"}
@@ -0,0 +1,31 @@
1
+ import { RequestProfile, QueryProfile, LogProfile } from '../common/profiler.model';
2
+ import type { ProfilerOptions } from '../common/profiler-options.interface';
3
+ import type { ProfilerStorage } from '../storage/profiler-storage.interface';
4
+ export declare class ProfilerService {
5
+ private options;
6
+ private storage;
7
+ private readonly als;
8
+ private readonly logger;
9
+ constructor(options: ProfilerOptions, storage: ProfilerStorage);
10
+ isEnabled(): boolean;
11
+ startRequest(): RequestProfile | null;
12
+ endRequest(profile: RequestProfile): void;
13
+ private analyzeRequest;
14
+ private addTag;
15
+ addQuery(query: QueryProfile): void;
16
+ addLog(log: LogProfile): void;
17
+ addCache(cacheProfile: import('../common/profiler.model').CacheProfile): void;
18
+ getCurrentProfile(): RequestProfile | undefined;
19
+ getDashboardData(): Promise<RequestProfile[]>;
20
+ getProfileDetail(id: string): Promise<RequestProfile | null>;
21
+ getQueriesList(): Promise<any[]>;
22
+ getLogsList(page?: number, pageSize?: number): Promise<{
23
+ logs: any[];
24
+ currentPage: number;
25
+ totalPages: number;
26
+ totalLogs: number;
27
+ }>;
28
+ getAllProfilesJson(): Promise<RequestProfile[]>;
29
+ getProfileJson(id: string): Promise<RequestProfile | null>;
30
+ getCacheList(): Promise<any[]>;
31
+ }
@@ -0,0 +1,216 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ 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;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ var __metadata = (this && this.__metadata) || function (k, v) {
42
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
43
+ };
44
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
45
+ return function (target, key) { decorator(target, key, paramIndex); }
46
+ };
47
+ var ProfilerService_1;
48
+ Object.defineProperty(exports, "__esModule", { value: true });
49
+ exports.ProfilerService = void 0;
50
+ const common_1 = require("@nestjs/common");
51
+ const async_hooks_1 = require("async_hooks");
52
+ const crypto = __importStar(require("crypto"));
53
+ let ProfilerService = ProfilerService_1 = class ProfilerService {
54
+ constructor(options, storage) {
55
+ this.options = options;
56
+ this.storage = storage;
57
+ this.als = new async_hooks_1.AsyncLocalStorage();
58
+ this.logger = new common_1.Logger(ProfilerService_1.name);
59
+ }
60
+ isEnabled() {
61
+ return this.options.enabled !== false;
62
+ }
63
+ startRequest() {
64
+ if (!this.isEnabled())
65
+ return null;
66
+ if (this.als.getStore()) {
67
+ return null;
68
+ }
69
+ const profile = {
70
+ id: crypto.randomUUID(),
71
+ method: '',
72
+ url: '',
73
+ startTime: Date.now(),
74
+ queries: [],
75
+ logs: [],
76
+ cache: [],
77
+ timestamp: Date.now(),
78
+ };
79
+ this.als.enterWith(profile);
80
+ return profile;
81
+ }
82
+ endRequest(profile) {
83
+ if (!profile)
84
+ return;
85
+ profile.endTime = Date.now();
86
+ profile.duration = profile.endTime - profile.startTime;
87
+ profile.memory = process.memoryUsage();
88
+ this.analyzeRequest(profile);
89
+ this.storage.save(profile);
90
+ }
91
+ analyzeRequest(profile) {
92
+ if (!profile.queries || profile.queries.length === 0)
93
+ return;
94
+ const queryGroups = new Map();
95
+ profile.queries.forEach((q, index) => {
96
+ const fingerprint = q.sql || q.query || 'unknown';
97
+ if (!queryGroups.has(fingerprint)) {
98
+ queryGroups.set(fingerprint, { count: 0, indices: [] });
99
+ }
100
+ const group = queryGroups.get(fingerprint);
101
+ group.count++;
102
+ group.indices.push(index);
103
+ if (q.duration > 100) {
104
+ this.addTag(q, 'slow');
105
+ }
106
+ });
107
+ queryGroups.forEach((group) => {
108
+ if (group.count > 1) {
109
+ group.indices.forEach(index => {
110
+ const q = profile.queries[index];
111
+ q.duplicatedCount = group.count;
112
+ this.addTag(q, 'n+1');
113
+ });
114
+ }
115
+ });
116
+ }
117
+ addTag(query, tag) {
118
+ if (!query.tags)
119
+ query.tags = [];
120
+ if (!query.tags.includes(tag)) {
121
+ query.tags.push(tag);
122
+ }
123
+ }
124
+ addQuery(query) {
125
+ const profile = this.als.getStore();
126
+ if (profile) {
127
+ profile.queries.push(query);
128
+ this.storage.save(profile);
129
+ }
130
+ }
131
+ addLog(log) {
132
+ const profile = this.als.getStore();
133
+ if (profile) {
134
+ profile.logs.push(log);
135
+ this.storage.save(profile);
136
+ }
137
+ }
138
+ addCache(cacheProfile) {
139
+ const profile = this.als.getStore();
140
+ if (profile) {
141
+ if (!profile.cache)
142
+ profile.cache = [];
143
+ profile.cache.push(cacheProfile);
144
+ this.storage.save(profile);
145
+ }
146
+ else {
147
+ this.logger.debug(`Profiler: Skipping cache capture for ${cacheProfile.key} - No active request context (ALS is empty).`);
148
+ }
149
+ }
150
+ getCurrentProfile() {
151
+ return this.als.getStore();
152
+ }
153
+ async getDashboardData() {
154
+ return Promise.resolve(this.storage.all());
155
+ }
156
+ async getProfileDetail(id) {
157
+ return Promise.resolve(this.storage.get(id));
158
+ }
159
+ async getQueriesList() {
160
+ const profiles = await Promise.resolve(this.storage.all());
161
+ const allQueries = profiles.flatMap(p => (p.queries || []).map(q => ({
162
+ ...q,
163
+ requestId: p.id,
164
+ requestUrl: p.url,
165
+ requestMethod: p.method
166
+ })));
167
+ allQueries.sort((a, b) => b.duration - a.duration);
168
+ return allQueries;
169
+ }
170
+ async getLogsList(page = 1, pageSize = 50) {
171
+ const pageNum = Math.max(1, Number(page) || 1);
172
+ const profiles = await Promise.resolve(this.storage.all());
173
+ const allLogs = profiles.flatMap(p => (p.logs || []).map(l => ({
174
+ ...l,
175
+ requestId: p.id,
176
+ requestUrl: p.url,
177
+ requestMethod: p.method
178
+ })));
179
+ allLogs.sort((a, b) => b.timestamp - a.timestamp);
180
+ const totalLogs = allLogs.length;
181
+ const totalPages = Math.ceil(totalLogs / pageSize);
182
+ const startIndex = (pageNum - 1) * pageSize;
183
+ const pagedLogs = allLogs.slice(startIndex, startIndex + pageSize);
184
+ return {
185
+ logs: pagedLogs,
186
+ currentPage: pageNum,
187
+ totalPages,
188
+ totalLogs
189
+ };
190
+ }
191
+ async getAllProfilesJson() {
192
+ return this.storage.all();
193
+ }
194
+ async getProfileJson(id) {
195
+ return Promise.resolve(this.storage.get(id));
196
+ }
197
+ async getCacheList() {
198
+ const profiles = await Promise.resolve(this.storage.all());
199
+ const allOps = profiles.flatMap(p => (p.cache || []).map(c => ({
200
+ ...c,
201
+ requestId: p.id,
202
+ requestUrl: p.url,
203
+ requestMethod: p.method
204
+ })));
205
+ allOps.sort((a, b) => b.startTime - a.startTime);
206
+ return allOps;
207
+ }
208
+ };
209
+ exports.ProfilerService = ProfilerService;
210
+ exports.ProfilerService = ProfilerService = ProfilerService_1 = __decorate([
211
+ (0, common_1.Injectable)(),
212
+ __param(0, (0, common_1.Inject)('PROFILER_OPTIONS')),
213
+ __param(1, (0, common_1.Inject)('PROFILER_STORAGE')),
214
+ __metadata("design:paramtypes", [Object, Object])
215
+ ], ProfilerService);
216
+ //# sourceMappingURL=profiler.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profiler.service.js","sourceRoot":"","sources":["../../../libs/nestjs-profiler/src/services/profiler.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4D;AAC5D,6CAAgD;AAIhD,+CAAiC;AAG1B,IAAM,eAAe,uBAArB,MAAM,eAAe;IAIxB,YACgC,OAAgC,EAChC,OAAgC;QADxB,YAAO,GAAP,OAAO,CAAiB;QACxB,YAAO,GAAP,OAAO,CAAiB;QAL/C,QAAG,GAAG,IAAI,+BAAiB,EAAkB,CAAC;QAC9C,WAAM,GAAG,IAAI,eAAM,CAAC,iBAAe,CAAC,IAAI,CAAC,CAAC;IAKvD,CAAC;IAEL,SAAS;QACL,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,KAAK,KAAK,CAAC;IAC1C,CAAC;IAED,YAAY;QACR,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YAAE,OAAO,IAAI,CAAC;QAGnC,IAAI,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC;YACtB,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,MAAM,OAAO,GAAmB;YAC5B,EAAE,EAAE,MAAM,CAAC,UAAU,EAAE;YACvB,MAAM,EAAE,EAAE;YACV,GAAG,EAAE,EAAE;YACP,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,OAAO,EAAE,EAAE;YACX,IAAI,EAAE,EAAE;YACR,KAAK,EAAE,EAAE;YACT,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;SACxB,CAAC;QAE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0 +1,15 @@
1
+ export interface RouteDefinition {
2
+ path: string;
3
+ method: string;
4
+ controller: string;
5
+ handler: string;
6
+ }
7
+ export declare class RouteExplorerService {
8
+ private routes;
9
+ constructor();
10
+ initialize(modulesContainer: any, globalPrefix?: string): void;
11
+ getRoutes(): RouteDefinition[];
12
+ private scan;
13
+ private normalizePath;
14
+ private getRequestMethodName;
15
+ }
@@ -0,0 +1,94 @@
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 __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.RouteExplorerService = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const constants_1 = require("@nestjs/common/constants");
15
+ let RouteExplorerService = class RouteExplorerService {
16
+ constructor() {
17
+ this.routes = [];
18
+ }
19
+ initialize(modulesContainer, globalPrefix = '') {
20
+ try {
21
+ this.scan(modulesContainer, globalPrefix);
22
+ }
23
+ catch (e) {
24
+ console.error('Profiler: Route discovery failed', e);
25
+ }
26
+ }
27
+ getRoutes() {
28
+ return this.routes;
29
+ }
30
+ scan(modulesContainer, globalPrefix) {
31
+ if (!modulesContainer)
32
+ return;
33
+ const routes = [];
34
+ const modules = [...modulesContainer.values()];
35
+ for (const module of modules) {
36
+ const controllers = [...module.controllers.values()];
37
+ for (const controllerWrapper of controllers) {
38
+ const controller = controllerWrapper.instance;
39
+ const metadata = controllerWrapper.metatype;
40
+ if (!controller || !metadata)
41
+ continue;
42
+ const controllerPath = Reflect.getMetadata(constants_1.PATH_METADATA, metadata) || '';
43
+ const prototype = Object.getPrototypeOf(controller);
44
+ Object.getOwnPropertyNames(prototype).forEach(methodName => {
45
+ if (methodName === 'constructor')
46
+ return;
47
+ const handler = prototype[methodName];
48
+ const methodPath = Reflect.getMetadata(constants_1.PATH_METADATA, handler);
49
+ const requestMethod = Reflect.getMetadata(constants_1.METHOD_METADATA, handler);
50
+ if (requestMethod !== undefined) {
51
+ const fullPath = this.normalizePath(globalPrefix, controllerPath, methodPath);
52
+ routes.push({
53
+ path: fullPath,
54
+ method: this.getRequestMethodName(requestMethod),
55
+ controller: metadata.name,
56
+ handler: methodName
57
+ });
58
+ }
59
+ });
60
+ }
61
+ }
62
+ const unique = new Map();
63
+ routes.forEach(r => unique.set(`${r.method}:${r.path}`, r));
64
+ this.routes = Array.from(unique.values()).sort((a, b) => a.path.localeCompare(b.path));
65
+ }
66
+ normalizePath(globalPrefix, controllerPath, methodPath) {
67
+ const parts = [globalPrefix, controllerPath, methodPath].map(p => {
68
+ if (typeof p !== 'string')
69
+ return '';
70
+ return p.startsWith('/') ? p.substring(1) : p;
71
+ }).filter(p => !!p);
72
+ let path = '/' + parts.join('/');
73
+ return path.replace(/\/+/g, '/');
74
+ }
75
+ getRequestMethodName(method) {
76
+ switch (method) {
77
+ case common_1.RequestMethod.GET: return 'GET';
78
+ case common_1.RequestMethod.POST: return 'POST';
79
+ case common_1.RequestMethod.PUT: return 'PUT';
80
+ case common_1.RequestMethod.DELETE: return 'DELETE';
81
+ case common_1.RequestMethod.PATCH: return 'PATCH';
82
+ case common_1.RequestMethod.OPTIONS: return 'OPTIONS';
83
+ case common_1.RequestMethod.HEAD: return 'HEAD';
84
+ case common_1.RequestMethod.ALL: return 'ALL';
85
+ default: return 'UNKNOWN';
86
+ }
87
+ }
88
+ };
89
+ exports.RouteExplorerService = RouteExplorerService;
90
+ exports.RouteExplorerService = RouteExplorerService = __decorate([
91
+ (0, common_1.Injectable)(),
92
+ __metadata("design:paramtypes", [])
93
+ ], RouteExplorerService);
94
+ //# sourceMappingURL=route-explorer.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-explorer.service.js","sourceRoot":"","sources":["../../../libs/nestjs-profiler/src/services/route-explorer.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA2D;AAC3D,wDAA0E;AAUnE,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAG7B;QAFQ,WAAM,GAAsB,EAAE,CAAC;IAEvB,CAAC;IAKjB,UAAU,CAAC,gBAAqB,EAAE,eAAuB,EAAE;QACvD,IAAI,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;QAC9C,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,CAAC,CAAC,CAAC;QACzD,CAAC;IACL,CAAC;IAKD,SAAS;QACL,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAEO,IAAI,CAAC,gBAA+B,EAAE,YAAoB;QAC9D,IAAI,CAAC,gBAAgB;YAAE,OAAO;QAE9B,MAAM,MAAM,GAAsB,EAAE,CAAC;QACrC,MAAM,OAAO,GAAG,CAAC,GAAG,gBAAgB,CAAC,MAAM,EAAE,CAAC,CAAC;QAE/C,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC3B,MAAM,WAAW,GAAG,CAAC,GAAI,MAAc,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;YAE9D,KAAK,MAAM,iBAAiB,IAAI,WAAW,EAAE,CAAC;gBAC1C,MAAM,UAAU,GAAG,iBAAiB,CAAC,QAAQ,CAAC;gBAC9C,MAAM,QAAQ,GAAG,iBAAiB,CAAC,QAAQ,CAAC;gBAE5C,IAAI,CAAC,UAAU,IAAI,CAAC,QAAQ;oBAAE,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,GAAG,CAAC,CAAC,OAAO,KAAK,CAAC;YACrC,OAAO,CAAC,CAAC,OAAO,SAAS,CAAC;QAC9B,CAAC;IACL,CAAC;CACJ,CAAA;AA7FY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,mBAAU,GAAE;;GACA,oBAAoB,CA6FhC"}
@@ -0,0 +1,27 @@
1
+ import { RequestProfile } from '../common/profiler.model';
2
+ import { ViewService } from './view.service';
3
+ export declare class TemplateBuilderService {
4
+ private readonly viewService;
5
+ constructor(viewService: ViewService);
6
+ buildDashboard(profiles: RequestProfile[]): string;
7
+ buildDetail(profile: RequestProfile): string;
8
+ private buildHeadersTable;
9
+ private buildBodyView;
10
+ private buildExceptionView;
11
+ private buildTimingBar;
12
+ buildQueriesList(queries: any[]): string;
13
+ buildLogsList(logs: any[], currentPage: number, totalPages: number, totalLogs: number): string;
14
+ buildEntitiesList(entities: any[]): string;
15
+ buildNotFound(id: string): string;
16
+ buildRoutesList(routes: any[]): string;
17
+ buildCacheList(cacheOps: any[]): string;
18
+ private buildRequestRow;
19
+ private buildQueryDetail;
20
+ private getTagBadge;
21
+ private getDurationClass;
22
+ private buildMetadataSidebar;
23
+ private buildLogRow;
24
+ private buildPagination;
25
+ private getStatusColor;
26
+ private buildCacheSection;
27
+ }