@dudousxd/nestjs-catalog-dashboard 0.3.1 → 0.3.3
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/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Davide Carvalho
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# @dudousxd/nestjs-catalog-dashboard
|
|
2
|
+
|
|
3
|
+
The console for [`@dudousxd/nestjs-catalog`](https://www.npmjs.com/package/@dudousxd/nestjs-catalog):
|
|
4
|
+
Model, Objects, Query, Dashboards, Connectors, Workflows, Lineage, Activity, Access.
|
|
5
|
+
|
|
6
|
+
The screens come from [`@dudousxd/nestjs-catalog-react`](https://www.npmjs.com/package/@dudousxd/nestjs-catalog-react).
|
|
7
|
+
This package is the part a component library cannot do for itself: mounting them, serving their
|
|
8
|
+
assets, and guarding the way in.
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pnpm add @dudousxd/nestjs-catalog-dashboard
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Mount it
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { CatalogDashboardModule } from '@dudousxd/nestjs-catalog-dashboard';
|
|
18
|
+
|
|
19
|
+
CatalogDashboardModule.forRoot({
|
|
20
|
+
path: '/catalog', // where the console is served
|
|
21
|
+
apiPath: '/api/catalog-service', // where its API already lives
|
|
22
|
+
auth: { secret, session, revalidate },
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`forRootAsync` is the same mount with the auth built from DI, for when validating a session means
|
|
27
|
+
asking a user store or a session service.
|
|
28
|
+
|
|
29
|
+
**It does not proxy the API.** `apiPath` only tells the SPA where to call — the catalog's HTTP
|
|
30
|
+
surface is mounted by `CatalogModule` and `CatalogPipelineModule`, and a second copy behind this
|
|
31
|
+
console would be a second set of routes to keep authorised.
|
|
32
|
+
|
|
33
|
+
## Two things a host must get right
|
|
34
|
+
|
|
35
|
+
**Exclude the console from a global API prefix.** A host calling `setGlobalPrefix('api')` otherwise
|
|
36
|
+
moves it to `/api/catalog` while the SPA still asks for `/catalog/assets/…`, and it loads as a blank
|
|
37
|
+
page with 404s — which reads as a broken build rather than a routing mistake.
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
setGlobalPrefix('api', {
|
|
41
|
+
exclude: [...catalogDashboardMountPaths({ path: '/catalog' })],
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The helper derives its paths from the same defaulting `forRoot` mounts with, so the two cannot drift.
|
|
46
|
+
|
|
47
|
+
**Decide whether it is open.** Omit `auth` and the console is open — and it can rewrite a catalog's
|
|
48
|
+
model and run its connectors. A host that would rather be shut than open passes a denying `guards`
|
|
49
|
+
entry, which needs no secret, no DI and no session:
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
guards: process.env.CONSOLE_SECRET ? [] : [DenyEverythingGuard],
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
`auth` and `guards` are separate for exactly this: `auth` describes how a session is *validated*, so
|
|
56
|
+
a host that has not configured it yet has an open console. `guards` is what makes "unconfigured" mean
|
|
57
|
+
shut.
|
|
58
|
+
|
|
59
|
+
## Opening it from your own UI
|
|
60
|
+
|
|
61
|
+
Minting the session is this library's business, so it ships the call rather than documenting an
|
|
62
|
+
endpoint. Three levels:
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
import { openCatalogConsole } from '@dudousxd/nestjs-catalog-dashboard/client';
|
|
66
|
+
import {
|
|
67
|
+
useOpenCatalogConsole,
|
|
68
|
+
OpenCatalogConsoleButton,
|
|
69
|
+
} from '@dudousxd/nestjs-catalog-dashboard/react';
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
- `openCatalogConsole(...)` — no React, you own everything
|
|
73
|
+
- `useOpenCatalogConsole(...)` — state for a launcher, you own the markup
|
|
74
|
+
- `<OpenCatalogConsoleButton />` — drop-in, unstyled
|
|
75
|
+
|
|
76
|
+
`openCatalogConsoleMutationOptions` wires the same call into TanStack Query without this package
|
|
77
|
+
depending on TanStack. React is an optional peer: a host that only mounts the NestJS module never
|
|
78
|
+
pulls it in.
|
|
79
|
+
|
|
80
|
+
When the host authenticates, the SPA skips its own sign-in entirely — a console embedded in an
|
|
81
|
+
application that already knows who you are has no business asking again.
|