@dudousxd/nestjs-durable-dashboard 0.22.1 → 0.22.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.
Files changed (38) hide show
  1. package/LICENSE +21 -0
  2. package/dist/client/durable-client.d.ts +3 -3
  3. package/dist/client/durable-client.d.ts.map +1 -1
  4. package/dist/client/durable-client.js.map +1 -1
  5. package/dist/client/group-subprocesses.d.ts +5 -5
  6. package/dist/client/group-subprocesses.d.ts.map +1 -1
  7. package/dist/server/index.cjs +695 -0
  8. package/dist/server/index.cjs.map +1 -0
  9. package/dist/server/index.d.cts +160 -0
  10. package/dist/server/index.d.ts +160 -5
  11. package/dist/server/index.js +662 -4
  12. package/dist/server/index.js.map +1 -1
  13. package/dist/spa/assets/{index-2MKVc5AZ.css → index-BaCR0uUG.css} +1 -1
  14. package/dist/spa/assets/index-D8irnyfw.js +62 -0
  15. package/dist/spa/index.html +2 -2
  16. package/package.json +14 -7
  17. package/dist/server/attr-filter.d.ts +0 -8
  18. package/dist/server/attr-filter.d.ts.map +0 -1
  19. package/dist/server/attr-filter.js +0 -30
  20. package/dist/server/attr-filter.js.map +0 -1
  21. package/dist/server/dashboard.service.d.ts +0 -70
  22. package/dist/server/dashboard.service.d.ts.map +0 -1
  23. package/dist/server/dashboard.service.js +0 -157
  24. package/dist/server/dashboard.service.js.map +0 -1
  25. package/dist/server/durable-api.controller.d.ts +0 -44
  26. package/dist/server/durable-api.controller.d.ts.map +0 -1
  27. package/dist/server/durable-api.controller.js +0 -197
  28. package/dist/server/durable-api.controller.js.map +0 -1
  29. package/dist/server/durable-dashboard.module.d.ts +0 -26
  30. package/dist/server/durable-dashboard.module.d.ts.map +0 -1
  31. package/dist/server/durable-dashboard.module.js +0 -60
  32. package/dist/server/durable-dashboard.module.js.map +0 -1
  33. package/dist/server/durable-ui.controller.d.ts +0 -19
  34. package/dist/server/durable-ui.controller.d.ts.map +0 -1
  35. package/dist/server/durable-ui.controller.js +0 -99
  36. package/dist/server/durable-ui.controller.js.map +0 -1
  37. package/dist/server/index.d.ts.map +0 -1
  38. package/dist/spa/assets/index-CAZ66zlb.js +0 -62
@@ -1,60 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- 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;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var DurableDashboardModule_1;
8
- import { Module } from '@nestjs/common';
9
- import { RouterModule } from '@nestjs/core';
10
- import { DashboardService } from './dashboard.service.js';
11
- import { DurableApiController } from './durable-api.controller.js';
12
- import { DASHBOARD_API_PATH, DASHBOARD_BASE_PATH, DurableUiController, } from './durable-ui.controller.js';
13
- /** Leading slash, no trailing slash. */
14
- function normalize(path) {
15
- return `/${path.replace(/^\/+|\/+$/g, '')}`;
16
- }
17
- /** Holds the JSON API controller + its read service, mounted on its own path by `forRoot`. */
18
- let DurableApiModule = class DurableApiModule {
19
- };
20
- DurableApiModule = __decorate([
21
- Module({
22
- controllers: [DurableApiController],
23
- providers: [DashboardService],
24
- exports: [DashboardService],
25
- })
26
- ], DurableApiModule);
27
- export { DurableApiModule };
28
- /**
29
- * Mounts the control plane: the bundled React SPA at `basePath` and its JSON API at `apiBasePath`
30
- * (default `<basePath>/api`). Import via `DurableDashboardModule.forRoot(...)` alongside
31
- * `DurableModule` (global), so it resolves the engine and store. Front the routes with a guard.
32
- */
33
- let DurableDashboardModule = DurableDashboardModule_1 = class DurableDashboardModule {
34
- static forRoot(options = {}) {
35
- const basePath = normalize(options.basePath ?? '/durable');
36
- const apiBasePath = normalize(options.apiBasePath ?? `${basePath}/api`);
37
- return {
38
- module: DurableDashboardModule_1,
39
- imports: [
40
- DurableApiModule,
41
- RouterModule.register([
42
- { path: basePath, module: DurableDashboardModule_1 }, // the UI controller below
43
- { path: apiBasePath, module: DurableApiModule },
44
- ]),
45
- ],
46
- controllers: [DurableUiController],
47
- providers: [
48
- { provide: DASHBOARD_BASE_PATH, useValue: basePath },
49
- { provide: DASHBOARD_API_PATH, useValue: apiBasePath },
50
- ],
51
- // Re-export the API module so its DashboardService reaches importers (e.g. flip's own controllers).
52
- exports: [DurableApiModule],
53
- };
54
- }
55
- };
56
- DurableDashboardModule = DurableDashboardModule_1 = __decorate([
57
- Module({})
58
- ], DurableDashboardModule);
59
- export { DurableDashboardModule };
60
- //# sourceMappingURL=durable-dashboard.module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"durable-dashboard.module.js","sourceRoot":"","sources":["../../src/server/durable-dashboard.module.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAsB,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AAgBpC,wCAAwC;AACxC,SAAS,SAAS,CAAC,IAAY;IAC7B,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,EAAE,CAAC;AAC9C,CAAC;AAED,8FAA8F;AAMvF,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAAG,CAAA;AAAnB,gBAAgB;IAL5B,MAAM,CAAC;QACN,WAAW,EAAE,CAAC,oBAAoB,CAAC;QACnC,SAAS,EAAE,CAAC,gBAAgB,CAAC;QAC7B,OAAO,EAAE,CAAC,gBAAgB,CAAC;KAC5B,CAAC;GACW,gBAAgB,CAAG;;AAEhC;;;;GAIG;AAEI,IAAM,sBAAsB,8BAA5B,MAAM,sBAAsB;IACjC,MAAM,CAAC,OAAO,CAAC,UAAmC,EAAE;QAClD,MAAM,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,IAAI,UAAU,CAAC,CAAC;QAC3D,MAAM,WAAW,GAAG,SAAS,CAAC,OAAO,CAAC,WAAW,IAAI,GAAG,QAAQ,MAAM,CAAC,CAAC;QACxE,OAAO;YACL,MAAM,EAAE,wBAAsB;YAC9B,OAAO,EAAE;gBACP,gBAAgB;gBAChB,YAAY,CAAC,QAAQ,CAAC;oBACpB,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,wBAAsB,EAAE,EAAE,0BAA0B;oBAC9E,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,gBAAgB,EAAE;iBAChD,CAAC;aACH;YACD,WAAW,EAAE,CAAC,mBAAmB,CAAC;YAClC,SAAS,EAAE;gBACT,EAAE,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,QAAQ,EAAE;gBACpD,EAAE,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,WAAW,EAAE;aACvD;YACD,oGAAoG;YACpG,OAAO,EAAE,CAAC,gBAAgB,CAAC;SAC5B,CAAC;IACJ,CAAC;CACF,CAAA;AAtBY,sBAAsB;IADlC,MAAM,CAAC,EAAE,CAAC;GACE,sBAAsB,CAsBlC"}
@@ -1,19 +0,0 @@
1
- import { StreamableFile } from '@nestjs/common';
2
- /** DI token carrying the UI mount base (e.g. `/durable`). */
3
- export declare const DASHBOARD_BASE_PATH: unique symbol;
4
- /** DI token carrying the JSON API base the SPA fetches from (e.g. `/api/durable`). */
5
- export declare const DASHBOARD_API_PATH: unique symbol;
6
- /**
7
- * Serves the bundled control-plane SPA at the configured base (+ hashed assets at `<base>/assets`).
8
- * The path comes from `RouterModule` (set by `DurableDashboardModule.forRoot({ basePath })`), so the
9
- * controller routes are relative.
10
- */
11
- export declare class DurableUiController {
12
- private readonly basePath;
13
- private readonly apiBasePath;
14
- private readonly dir;
15
- constructor(basePath: string, apiBasePath: string);
16
- index(): string;
17
- asset(file: string): StreamableFile;
18
- }
19
- //# sourceMappingURL=durable-ui.controller.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"durable-ui.controller.d.ts","sourceRoot":"","sources":["../../src/server/durable-ui.controller.ts"],"names":[],"mappings":"AAGA,OAAO,EAOL,cAAc,EACf,MAAM,gBAAgB,CAAC;AAExB,6DAA6D;AAC7D,eAAO,MAAM,mBAAmB,eAAgC,CAAC;AACjE,sFAAsF;AACtF,eAAO,MAAM,kBAAkB,eAA+B,CAAC;AAoB/D;;;;GAIG;AACH,qBACa,mBAAmB;IAIC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAC1B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAJ1D,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAY;gBAGgB,QAAQ,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM;IAQlE,KAAK,IAAI,MAAM;IAkBf,KAAK,CAAgB,IAAI,EAAE,MAAM,GAAG,cAAc;CAWnD"}
@@ -1,99 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- 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;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var __metadata = (this && this.__metadata) || function (k, v) {
8
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
- };
10
- var __param = (this && this.__param) || function (paramIndex, decorator) {
11
- return function (target, key) { decorator(target, key, paramIndex); }
12
- };
13
- import { existsSync, readFileSync } from 'node:fs';
14
- import { basename, extname, join, resolve, sep } from 'node:path';
15
- import { fileURLToPath } from 'node:url';
16
- import { Controller, Get, Header, Inject, NotFoundException, Param, StreamableFile, } from '@nestjs/common';
17
- /** DI token carrying the UI mount base (e.g. `/durable`). */
18
- export const DASHBOARD_BASE_PATH = Symbol('DASHBOARD_BASE_PATH');
19
- /** DI token carrying the JSON API base the SPA fetches from (e.g. `/api/durable`). */
20
- export const DASHBOARD_API_PATH = Symbol('DASHBOARD_API_PATH');
21
- /** The base the SPA bundle was built with (Vite `base`); rewritten to the configured base at serve time. */
22
- const BUILD_BASE = '/durable';
23
- /** dist/server/durable-ui.controller.js -> ../spa (the Vite build output). */
24
- function spaDir() {
25
- return fileURLToPath(new URL('../spa', import.meta.url));
26
- }
27
- const CONTENT_TYPES = {
28
- '.js': 'text/javascript; charset=utf-8',
29
- '.css': 'text/css; charset=utf-8',
30
- '.map': 'application/json; charset=utf-8',
31
- '.svg': 'image/svg+xml',
32
- '.json': 'application/json; charset=utf-8',
33
- '.woff2': 'font/woff2',
34
- '.ico': 'image/x-icon',
35
- };
36
- /**
37
- * Serves the bundled control-plane SPA at the configured base (+ hashed assets at `<base>/assets`).
38
- * The path comes from `RouterModule` (set by `DurableDashboardModule.forRoot({ basePath })`), so the
39
- * controller routes are relative.
40
- */
41
- let DurableUiController = class DurableUiController {
42
- basePath;
43
- apiBasePath;
44
- dir = spaDir();
45
- constructor(basePath, apiBasePath) {
46
- this.basePath = basePath;
47
- this.apiBasePath = apiBasePath;
48
- }
49
- // index.html references hash-named bundles, so it MUST NOT be cached (stale bundle = the
50
- // classic "stuck loading after a deploy"). The hashed assets below are immutable.
51
- index() {
52
- const indexPath = join(this.dir, 'index.html');
53
- if (!existsSync(indexPath)) {
54
- throw new NotFoundException('Dashboard is not built. Run the package build.');
55
- }
56
- // The bundle was built with Vite base `/durable/`; rewrite asset URLs to the configured base so
57
- // the SPA loads from `<base>/assets` wherever it's mounted, and tell the client its API base.
58
- const html = readFileSync(indexPath, 'utf8').replaceAll(`="${BUILD_BASE}/`, `="${this.basePath}/`);
59
- // __DURABLE_BASE__ = where assets load; __DURABLE_API__ = where the SPA fetches the JSON API.
60
- const inject = `<script>window.__DURABLE_BASE__='${this.basePath}';window.__DURABLE_API__='${this.apiBasePath}';</script>`;
61
- return html.includes('</head>') ? html.replace('</head>', `${inject}</head>`) : inject + html;
62
- }
63
- asset(file) {
64
- const safe = basename(file);
65
- if (safe !== file)
66
- throw new NotFoundException();
67
- const root = resolve(this.dir, 'assets');
68
- const assetPath = resolve(root, safe);
69
- if (!assetPath.startsWith(root + sep) || !existsSync(assetPath)) {
70
- throw new NotFoundException();
71
- }
72
- const type = CONTENT_TYPES[extname(safe)] ?? 'application/octet-stream';
73
- return new StreamableFile(readFileSync(assetPath), { type });
74
- }
75
- };
76
- __decorate([
77
- Get(),
78
- Header('Content-Type', 'text/html; charset=utf-8'),
79
- Header('Cache-Control', 'no-store, must-revalidate'),
80
- __metadata("design:type", Function),
81
- __metadata("design:paramtypes", []),
82
- __metadata("design:returntype", String)
83
- ], DurableUiController.prototype, "index", null);
84
- __decorate([
85
- Get('assets/:file'),
86
- Header('Cache-Control', 'public, max-age=31536000, immutable'),
87
- __param(0, Param('file')),
88
- __metadata("design:type", Function),
89
- __metadata("design:paramtypes", [String]),
90
- __metadata("design:returntype", StreamableFile)
91
- ], DurableUiController.prototype, "asset", null);
92
- DurableUiController = __decorate([
93
- Controller(),
94
- __param(0, Inject(DASHBOARD_BASE_PATH)),
95
- __param(1, Inject(DASHBOARD_API_PATH)),
96
- __metadata("design:paramtypes", [String, String])
97
- ], DurableUiController);
98
- export { DurableUiController };
99
- //# sourceMappingURL=durable-ui.controller.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"durable-ui.controller.js","sourceRoot":"","sources":["../../src/server/durable-ui.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,E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