@dudousxd/nestjs-telescope-ui 1.26.0 → 2.0.1
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/CHANGELOG.md +27 -0
- package/README.md +31 -0
- package/dist/client/console-url.d.ts +11 -0
- package/dist/client/console-url.d.ts.map +1 -0
- package/dist/client/console-url.js +21 -0
- package/dist/client/console-url.js.map +1 -0
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +3 -3
- package/dist/client/index.js.map +1 -1
- package/dist/client/telescope-client.d.ts +1 -10
- package/dist/client/telescope-client.d.ts.map +1 -1
- package/dist/client/telescope-client.js +3 -63
- package/dist/client/telescope-client.js.map +1 -1
- package/dist/client/types.d.ts +0 -41
- package/dist/client/types.d.ts.map +1 -1
- package/dist/react/components/entries-table.d.ts.map +1 -1
- package/dist/react/components/entries-table.js +7 -0
- package/dist/react/components/entries-table.js.map +1 -1
- package/dist/react/components/entry-detail.d.ts.map +1 -1
- package/dist/react/components/entry-detail.js +2 -1
- package/dist/react/components/entry-detail.js.map +1 -1
- package/dist/react/components/entry-types.d.ts.map +1 -1
- package/dist/react/components/entry-types.js +4 -0
- package/dist/react/components/entry-types.js.map +1 -1
- package/dist/react/components/official-event.d.ts +16 -0
- package/dist/react/components/official-event.d.ts.map +1 -0
- package/dist/react/components/official-event.js +88 -0
- package/dist/react/components/official-event.js.map +1 -0
- package/dist/react/index.d.ts +0 -2
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +0 -2
- package/dist/react/index.js.map +1 -1
- package/dist/server/index.d.ts +2 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +2 -0
- package/dist/server/index.js.map +1 -1
- package/dist/server/telescope-ui.controller.d.ts +1 -20
- package/dist/server/telescope-ui.controller.d.ts.map +1 -1
- package/dist/server/telescope-ui.controller.js +10 -77
- package/dist/server/telescope-ui.controller.js.map +1 -1
- package/dist/server/telescope-ui.module.d.ts +13 -8
- package/dist/server/telescope-ui.module.d.ts.map +1 -1
- package/dist/server/telescope-ui.module.js +17 -37
- package/dist/server/telescope-ui.module.js.map +1 -1
- package/dist/server/telescope-ui.options.d.ts +35 -31
- package/dist/server/telescope-ui.options.d.ts.map +1 -1
- package/dist/server/telescope-ui.options.js.map +1 -1
- package/dist/spa/assets/index-BPSlup7m.js +159 -0
- package/dist/spa/assets/index-DmsmJrlA.css +1 -0
- package/dist/spa/index.html +2 -2
- package/package.json +4 -8
- package/skills/telescope-ui-dashboard/SKILL.md +23 -8
- package/dist/client/console-session.d.ts +0 -66
- package/dist/client/console-session.d.ts.map +0 -1
- package/dist/client/console-session.js +0 -110
- package/dist/client/console-session.js.map +0 -1
- package/dist/react/console.d.ts +0 -4
- package/dist/react/console.d.ts.map +0 -1
- package/dist/react/console.js +0 -14
- package/dist/react/console.js.map +0 -1
- package/dist/react/open-console-button.d.ts +0 -28
- package/dist/react/open-console-button.d.ts.map +0 -1
- package/dist/react/open-console-button.js +0 -28
- package/dist/react/open-console-button.js.map +0 -1
- package/dist/react/use-open-console.d.ts +0 -34
- package/dist/react/use-open-console.d.ts.map +0 -1
- package/dist/react/use-open-console.js +0 -69
- package/dist/react/use-open-console.js.map +0 -1
- package/dist/spa/assets/index-BENKgbaX.css +0 -1
- package/dist/spa/assets/index-DBO3LkDh.js +0 -159
|
@@ -6,59 +6,39 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
var TelescopeUiModule_1;
|
|
8
8
|
import 'reflect-metadata';
|
|
9
|
-
import { dynamicController, normalizeTelescopePath } from '@dudousxd/nestjs-telescope';
|
|
9
|
+
import { CONSOLE_DECORATORS_EXAMPLE, assertConsoleProtected, dynamicController, normalizeTelescopePath, } from '@dudousxd/nestjs-telescope';
|
|
10
10
|
import { Module, } from '@nestjs/common';
|
|
11
11
|
import { TelescopeUiController } from './telescope-ui.controller.js';
|
|
12
12
|
import { TELESCOPE_UI_OPTIONS } from './telescope-ui.options.js';
|
|
13
|
-
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Stamp host guards onto the dashboard's page/asset controller. `TelescopeUiController`
|
|
27
|
-
* carries no guard of its own, so — unlike core's `stampGuards` — there is nothing to
|
|
28
|
-
* preserve: this is a plain REPLACE of whatever (nothing) was there before. A no-op
|
|
29
|
-
* when `guards` is omitted/empty, leaving the controller unguarded exactly as before.
|
|
30
|
-
*/
|
|
31
|
-
function stampGuards(guards, ...controllers) {
|
|
32
|
-
if (guards === undefined || guards.length === 0)
|
|
33
|
-
return;
|
|
34
|
-
for (const controller of controllers) {
|
|
35
|
-
Reflect.defineMetadata(GUARDS_METADATA, guards, controller);
|
|
36
|
-
}
|
|
13
|
+
/** The controller mounted when `routes` is not `false` (none when it is). */
|
|
14
|
+
function uiControllers(options) {
|
|
15
|
+
if (options.routes === false)
|
|
16
|
+
return [];
|
|
17
|
+
const path = normalizeTelescopePath(options.path);
|
|
18
|
+
assertConsoleProtected(options.decorators, {
|
|
19
|
+
module: 'TelescopeUiModule',
|
|
20
|
+
decoratorsExample: `TelescopeUiModule.forRoot({ ${CONSOLE_DECORATORS_EXAMPLE} })`,
|
|
21
|
+
selfMountExample: `TelescopeUiModule.forRoot({ routes: false }) + @Controller('${path}') @Can(ConsolePolicy, 'view') class ConsolePage extends TelescopeUiController {}`,
|
|
22
|
+
});
|
|
23
|
+
return [dynamicController(TelescopeUiController, path, options.decorators)];
|
|
37
24
|
}
|
|
38
25
|
let TelescopeUiModule = TelescopeUiModule_1 = class TelescopeUiModule {
|
|
39
26
|
static forRoot(options = {}) {
|
|
40
|
-
const path = normalizeTelescopePath(options.path);
|
|
41
|
-
const uiController = dynamicController(TelescopeUiController, path);
|
|
42
|
-
stampGuards(options.guards, uiController);
|
|
43
27
|
return {
|
|
44
28
|
module: TelescopeUiModule_1,
|
|
45
29
|
imports: options.imports ?? [],
|
|
46
|
-
controllers:
|
|
47
|
-
providers: [
|
|
48
|
-
|
|
49
|
-
...(options.guards ?? []).filter(isGuardClass),
|
|
50
|
-
],
|
|
30
|
+
controllers: uiControllers(options),
|
|
31
|
+
providers: [{ provide: TELESCOPE_UI_OPTIONS, useValue: options }],
|
|
32
|
+
exports: [TELESCOPE_UI_OPTIONS],
|
|
51
33
|
};
|
|
52
34
|
}
|
|
53
35
|
static forRootAsync(config) {
|
|
54
36
|
const path = normalizeTelescopePath(config.path);
|
|
55
|
-
const uiController = dynamicController(TelescopeUiController, path);
|
|
56
|
-
stampGuards(config.guards, uiController);
|
|
57
37
|
const { useFactory } = config;
|
|
58
38
|
return {
|
|
59
39
|
module: TelescopeUiModule_1,
|
|
60
40
|
imports: config.imports ?? [],
|
|
61
|
-
controllers:
|
|
41
|
+
controllers: uiControllers(config),
|
|
62
42
|
providers: [
|
|
63
43
|
{
|
|
64
44
|
provide: TELESCOPE_UI_OPTIONS,
|
|
@@ -72,8 +52,8 @@ let TelescopeUiModule = TelescopeUiModule_1 = class TelescopeUiModule {
|
|
|
72
52
|
}),
|
|
73
53
|
inject: config.inject ?? [],
|
|
74
54
|
},
|
|
75
|
-
...(config.guards ?? []).filter(isGuardClass),
|
|
76
55
|
],
|
|
56
|
+
exports: [TELESCOPE_UI_OPTIONS],
|
|
77
57
|
};
|
|
78
58
|
}
|
|
79
59
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telescope-ui.module.js","sourceRoot":"","sources":["../../src/server/telescope-ui.module.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,
|
|
1
|
+
{"version":3,"file":"telescope-ui.module.js","sourceRoot":"","sources":["../../src/server/telescope-ui.module.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,kBAAkB,CAAC;A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AM,CAAC;QAC9B,OAAO;YACL,MAAM,EAAE,mBAAiB;YACzB,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,EAAE;YAC7B,WAAW,EAAE,aAAa,CAAC,MAAM,CAAC;YAClC,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,oBAAoB;oBAC7B,wEAAwE;oBACxE,sEAAsE;oBACtE,iEAAiE;oBACjE,+DAA+D;oBAC/D,UAAU,EAAE,KAAK,EAAE,GAAG,IAAe,EAAqC,EAAE,CAAC,CAAC;wBAC5E,GAAG,CAAC,MAAM,UAAU,CAAC,GAAG,IAAI,CAAC,CAAC;wBAC9B,IAAI;qBACL,CAAC;oBACF,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE;iBAC5B;aACF;YACD,OAAO,EAAE,CAAC,oBAAoB,CAAC;SAChC,CAAC;IACJ,CAAC;CACF,CAAA;AA9DY,iBAAiB;IAD7B,MAAM,CAAC,EAAE,CAAC;GACE,iBAAiB,CA8D7B"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { CanActivate, DynamicModule, Type } from '@nestjs/common';
|
|
1
|
+
import type { DynamicModule } from '@nestjs/common';
|
|
3
2
|
export declare const TELESCOPE_UI_OPTIONS: unique symbol;
|
|
4
3
|
export interface TelescopeUiModuleOptions {
|
|
5
4
|
/** Directory of the built SPA (index.html + assets/). Defaults to the bundled dist/spa. */
|
|
@@ -11,44 +10,49 @@ export interface TelescopeUiModuleOptions {
|
|
|
11
10
|
*/
|
|
12
11
|
path?: string;
|
|
13
12
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* `
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* callers if useful). See the "Securing the console" guide.
|
|
13
|
+
* Class decorators applied to the dashboard's page + asset controller
|
|
14
|
+
* (`TelescopeUiController`), the same shape as `@nestjs/mcp`'s `decorators`,
|
|
15
|
+
* e.g. `[UseGuards(AuthenticationGuard), Can(ConsolePolicy, 'view')]` with
|
|
16
|
+
* `@nestjs/authentication` + `@nestjs/authorization`. Pass the same list to
|
|
17
|
+
* `TelescopeModule.forRoot({ decorators })` (core) so the API matches. Full-page
|
|
18
|
+
* navigations carry cookies, not an `Authorization` header, so the
|
|
19
|
+
* authentication strategy here must read a cookie session.
|
|
22
20
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* `
|
|
26
|
-
*
|
|
27
|
-
* page itself (HTML shell + assets) reachable by an anonymous browser.
|
|
21
|
+
* PRODUCTION RULE: with `NODE_ENV === 'production'`, mounting the page with no
|
|
22
|
+
* `decorators` (an empty array counts as none) fails the boot; protect it with
|
|
23
|
+
* `decorators` or mount it yourself with {@link routes}`: false`. Outside
|
|
24
|
+
* production an undecorated page mounts open.
|
|
28
25
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
26
|
+
* The controller is also marked open to `@nestjs/authorization`'s
|
|
27
|
+
* deny-by-default global `AuthorizationGuard` (as `@Can.Anyone()` would), so an
|
|
28
|
+
* undecorated dev page keeps loading when that package is adopted. A
|
|
29
|
+
* `Can(...)` passed here is still enforced. Applied to a fresh subclass per
|
|
30
|
+
* registration, so nothing leaks between `forRoot` calls. With `forRootAsync`,
|
|
31
|
+
* pass it as the static top-level option.
|
|
33
32
|
*/
|
|
34
|
-
|
|
33
|
+
decorators?: ClassDecorator[];
|
|
35
34
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
35
|
+
* `false` mounts NO controller; serve the page from a controller of your own
|
|
36
|
+
* by extending the exported `TelescopeUiController` (its `TELESCOPE_UI_OPTIONS`
|
|
37
|
+
* dependency is exported by the module), protected with ordinary Nest
|
|
38
|
+
* decorators. The base class carries no guard, so yours are the whole gate:
|
|
39
39
|
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
40
|
+
* ```ts
|
|
41
|
+
* @Controller('ops/telescope')
|
|
42
|
+
* @Can(ConsolePolicy, 'view')
|
|
43
|
+
* class ConsolePage extends TelescopeUiController {}
|
|
44
|
+
* ```
|
|
43
45
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
46
|
+
* Named `routes`, not `path: false`, because `path` keeps a job without
|
|
47
|
+
* routes: the page rewrites its asset URLs against it, so set it to where you
|
|
48
|
+
* mount the controller (and to core's `path`). `decorators` only applies to
|
|
49
|
+
* the mounted controller and is ignored here. With `forRootAsync`, pass it as
|
|
50
|
+
* the static top-level `routes`. Default `true`.
|
|
47
51
|
*/
|
|
48
|
-
|
|
52
|
+
routes?: boolean;
|
|
49
53
|
/**
|
|
50
54
|
* Extra `imports` merged into `TelescopeUiModule`'s own dynamic module — the
|
|
51
|
-
* DI resolution path for
|
|
55
|
+
* DI resolution path for whatever the {@link decorators} need.
|
|
52
56
|
*/
|
|
53
57
|
imports?: DynamicModule['imports'];
|
|
54
58
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telescope-ui.options.d.ts","sourceRoot":"","sources":["../../src/server/telescope-ui.options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"telescope-ui.options.d.ts","sourceRoot":"","sources":["../../src/server/telescope-ui.options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,eAAO,MAAM,oBAAoB,eAAiC,CAAC;AAEnE,MAAM,WAAW,wBAAwB;IACvC,2FAA2F;IAC3F,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,UAAU,CAAC,EAAE,cAAc,EAAE,CAAC;IAC9B;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;CACpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telescope-ui.options.js","sourceRoot":"","sources":["../../src/server/telescope-ui.options.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"telescope-ui.options.js","sourceRoot":"","sources":["../../src/server/telescope-ui.options.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC"}
|