@ngn-net/nestjs-telescope 0.3.16 → 0.3.17
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 +27 -4
- package/dist/ui/manifest.json +2 -2
- package/package.json +2 -2
package/dist/telescope.module.js
CHANGED
|
@@ -53,6 +53,31 @@ 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({ path, requestMethod: common_1.RequestMethod.ALL });
|
|
67
|
+
}
|
|
68
|
+
if (!hasWildcardExclude) {
|
|
69
|
+
exclude.push({ path: `${path}/(.*)`, requestMethod: common_1.RequestMethod.ALL });
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
...originalOptions,
|
|
73
|
+
exclude,
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch (e) {
|
|
79
|
+
common_1.Logger.warn('Telescope was unable to automatically exclude its routes from the global prefix.', e);
|
|
80
|
+
}
|
|
56
81
|
}
|
|
57
82
|
onModuleInit() {
|
|
58
83
|
const hasDependency = (type, packageName) => {
|
|
@@ -106,10 +131,9 @@ let TelescopeModule = TelescopeModule_1 = class TelescopeModule {
|
|
|
106
131
|
if (options.enableDashboard !== false) {
|
|
107
132
|
const staticPath = (0, path_1.join)(__dirname, '..', 'ui');
|
|
108
133
|
const routePath = options.path || constants_1.DEFAULT_TELESCOPE_PATH;
|
|
109
|
-
const globalPrefix = options.globalPrefix ? `/${options.globalPrefix}` : '';
|
|
110
134
|
imports.push(serve_static_1.ServeStaticModule.forRoot({
|
|
111
135
|
rootPath: staticPath,
|
|
112
|
-
serveRoot:
|
|
136
|
+
serveRoot: `/${routePath}`,
|
|
113
137
|
}));
|
|
114
138
|
}
|
|
115
139
|
const providers = [
|
|
@@ -165,11 +189,10 @@ let TelescopeModule = TelescopeModule_1 = class TelescopeModule {
|
|
|
165
189
|
}
|
|
166
190
|
const staticPath = (0, path_1.join)(__dirname, '..', 'ui');
|
|
167
191
|
const routePath = telescopeOpts.path || constants_1.DEFAULT_TELESCOPE_PATH;
|
|
168
|
-
const globalPrefix = telescopeOpts.globalPrefix ? `/${telescopeOpts.globalPrefix}` : '';
|
|
169
192
|
return [
|
|
170
193
|
{
|
|
171
194
|
rootPath: staticPath,
|
|
172
|
-
serveRoot:
|
|
195
|
+
serveRoot: `/${routePath}`,
|
|
173
196
|
},
|
|
174
197
|
];
|
|
175
198
|
},
|
package/dist/ui/manifest.json
CHANGED