@ngn-net/nestjs-telescope 0.3.16 → 0.3.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/telescope.module.js +35 -4
- package/dist/ui/manifest.json +2 -2
- package/package.json +2 -2
package/dist/telescope.module.js
CHANGED
|
@@ -53,6 +53,39 @@ let TelescopeModule = TelescopeModule_1 = class TelescopeModule {
|
|
|
53
53
|
this.options = options;
|
|
54
54
|
const path = this.options.path || constants_1.DEFAULT_TELESCOPE_PATH;
|
|
55
55
|
Reflect.defineMetadata('path', path, telescope_controller_1.TelescopeController);
|
|
56
|
+
try {
|
|
57
|
+
const appConfig = this.moduleRef.get(core_1.ApplicationConfig, { strict: false });
|
|
58
|
+
if (appConfig) {
|
|
59
|
+
const originalGet = appConfig.getGlobalPrefixOptions.bind(appConfig);
|
|
60
|
+
appConfig.getGlobalPrefixOptions = () => {
|
|
61
|
+
const originalOptions = originalGet() || {};
|
|
62
|
+
const exclude = originalOptions.exclude ? [...originalOptions.exclude] : [];
|
|
63
|
+
const hasBaseExclude = exclude.some((r) => typeof r === 'string' ? r === path : r.path === path);
|
|
64
|
+
const hasWildcardExclude = exclude.some((r) => typeof r === 'string' ? r === `${path}/(.*)` : r.path === `${path}/(.*)`);
|
|
65
|
+
if (!hasBaseExclude) {
|
|
66
|
+
exclude.push({
|
|
67
|
+
path,
|
|
68
|
+
requestMethod: common_1.RequestMethod.ALL,
|
|
69
|
+
pathRegex: new RegExp('^\\/' + path + '\\/?$'),
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
if (!hasWildcardExclude) {
|
|
73
|
+
exclude.push({
|
|
74
|
+
path: `${path}/(.*)`,
|
|
75
|
+
requestMethod: common_1.RequestMethod.ALL,
|
|
76
|
+
pathRegex: new RegExp('^\\/' + path + '\\/(.*)'),
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
...originalOptions,
|
|
81
|
+
exclude,
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
catch (e) {
|
|
87
|
+
common_1.Logger.warn('Telescope was unable to automatically exclude its routes from the global prefix.', e);
|
|
88
|
+
}
|
|
56
89
|
}
|
|
57
90
|
onModuleInit() {
|
|
58
91
|
const hasDependency = (type, packageName) => {
|
|
@@ -106,10 +139,9 @@ let TelescopeModule = TelescopeModule_1 = class TelescopeModule {
|
|
|
106
139
|
if (options.enableDashboard !== false) {
|
|
107
140
|
const staticPath = (0, path_1.join)(__dirname, '..', 'ui');
|
|
108
141
|
const routePath = options.path || constants_1.DEFAULT_TELESCOPE_PATH;
|
|
109
|
-
const globalPrefix = options.globalPrefix ? `/${options.globalPrefix}` : '';
|
|
110
142
|
imports.push(serve_static_1.ServeStaticModule.forRoot({
|
|
111
143
|
rootPath: staticPath,
|
|
112
|
-
serveRoot:
|
|
144
|
+
serveRoot: `/${routePath}`,
|
|
113
145
|
}));
|
|
114
146
|
}
|
|
115
147
|
const providers = [
|
|
@@ -165,11 +197,10 @@ let TelescopeModule = TelescopeModule_1 = class TelescopeModule {
|
|
|
165
197
|
}
|
|
166
198
|
const staticPath = (0, path_1.join)(__dirname, '..', 'ui');
|
|
167
199
|
const routePath = telescopeOpts.path || constants_1.DEFAULT_TELESCOPE_PATH;
|
|
168
|
-
const globalPrefix = telescopeOpts.globalPrefix ? `/${telescopeOpts.globalPrefix}` : '';
|
|
169
200
|
return [
|
|
170
201
|
{
|
|
171
202
|
rootPath: staticPath,
|
|
172
|
-
serveRoot:
|
|
203
|
+
serveRoot: `/${routePath}`,
|
|
173
204
|
},
|
|
174
205
|
];
|
|
175
206
|
},
|
package/dist/ui/manifest.json
CHANGED