@dunx/create-app 2.3.1 → 2.5.0
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/{chunk-yzz4z6jv.js → chunk-nn9ekg83.js} +110 -16
- package/dist/cli.js +1 -4
- package/dist/index.js +1 -4
- package/package.json +2 -2
- package/templates/features/assets/assets.demo.ts +41 -0
- package/templates/features/assets/assets.module.ts +37 -0
- package/templates/features/assets/public/app.a1b2c3d4.js +1 -0
- package/templates/features/assets/public/index.html +9 -0
- package/templates/features/assets/public/site.css +3 -0
- package/templates/features/auth/auth.module.ts +15 -4
- package/templates/features/cache/cache.controller.ts +5 -2
- package/templates/features/database/ledger.controller.ts +7 -4
- package/templates/features/guards/reports.controller.ts +11 -2
- package/templates/features/health/health.demo.ts +72 -0
- package/templates/features/health/health.module.ts +70 -9
- package/templates/features/health/indicators.ts +98 -0
- package/templates/features/http/compression.demo.ts +88 -0
- package/templates/features/http/http.demo.ts +6 -4
- package/templates/features/http/http.module.ts +31 -3
- package/templates/features/http/{request-log.ts → request-trail.ts} +10 -11
- package/templates/features/http/trace.controller.ts +30 -0
- package/templates/features/http/trace.demo.ts +58 -0
- package/templates/features/jobs/jobs.controller.ts +7 -2
- package/templates/features/jobs/thumbnail.jobs.ts +7 -1
- package/templates/features/notes/notes.controller.ts +1 -1
- package/templates/features/pictures/images.controller.ts +5 -2
- package/templates/features/schedule/maintenance.service.ts +71 -0
- package/templates/features/schedule/schedule.demo.ts +56 -0
- package/templates/features/schedule/schedule.module.ts +31 -0
- package/templates/features/storage/files.controller.ts +5 -4
- package/templates/features/throttle/limits.controller.ts +35 -0
- package/templates/features/throttle/throttle.demo.ts +74 -0
- package/templates/features/throttle/throttle.module.ts +88 -0
- package/templates/features/upstream/flaky.controller.ts +48 -0
- package/templates/features/upstream/upstream.demo.ts +83 -0
- package/templates/features/upstream/upstream.module.ts +42 -0
- package/templates/features/users/users.controller.ts +8 -0
- package/templates/features/users/users.schemas.ts +30 -11
- package/dist/chunk-yzz4z6jv.js.map +0 -12
- package/dist/cli.js.map +0 -10
- package/dist/index.js.map +0 -9
- package/templates/features/health/health.controller.ts +0 -65
package/dist/index.js.map
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { Controller, Get, Public } from '@dunx/http';
|
|
2
|
-
import { Storage } from '@dunx/infra/files';
|
|
3
|
-
import { Sessions } from '../cache/sessions.service.js';
|
|
4
|
-
import { AppConfigService } from '../config.js';
|
|
5
|
-
import { Ledger } from '../database/ledger.service.js';
|
|
6
|
-
|
|
7
|
-
export interface AreaStatus {
|
|
8
|
-
readonly name: string;
|
|
9
|
-
readonly state: 'live' | 'degraded';
|
|
10
|
-
readonly detail: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* What is actually working right now. Redis is the only area that can be down
|
|
15
|
-
* without stopping the app, so it is the only one that ever reports `degraded` -
|
|
16
|
-
* everything else is in-process and either booted or the app did not.
|
|
17
|
-
*/
|
|
18
|
-
@Controller('health')
|
|
19
|
-
export class HealthController {
|
|
20
|
-
constructor(
|
|
21
|
-
private readonly config: AppConfigService,
|
|
22
|
-
private readonly ledger: Ledger,
|
|
23
|
-
private readonly storage: Storage,
|
|
24
|
-
private readonly sessions: Sessions,
|
|
25
|
-
) {}
|
|
26
|
-
|
|
27
|
-
@Public()
|
|
28
|
-
@Get('/', {})
|
|
29
|
-
async status(): Promise<{
|
|
30
|
-
ok: boolean;
|
|
31
|
-
app: string;
|
|
32
|
-
areas: readonly AreaStatus[];
|
|
33
|
-
}> {
|
|
34
|
-
const areas = await this.areas();
|
|
35
|
-
return {
|
|
36
|
-
ok: true,
|
|
37
|
-
app: this.config.get('appName'),
|
|
38
|
-
areas,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
async areas(): Promise<readonly AreaStatus[]> {
|
|
43
|
-
const cache = await this.sessions.status();
|
|
44
|
-
return [
|
|
45
|
-
{
|
|
46
|
-
name: '@dunx/infra/db',
|
|
47
|
-
state: 'live',
|
|
48
|
-
detail: `${this.ledger.rows()} ledger rows, balance ${this.ledger.balance()}`,
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
name: '@dunx/infra/files',
|
|
52
|
-
state: 'live',
|
|
53
|
-
detail: `${this.storage.constructor.name} ready`,
|
|
54
|
-
},
|
|
55
|
-
{ name: '@dunx/infra/images', state: 'live', detail: 'Bun.Image ready' },
|
|
56
|
-
{
|
|
57
|
-
name: '@dunx/infra/redis',
|
|
58
|
-
state: cache.reachable ? 'live' : 'degraded',
|
|
59
|
-
detail: cache.reachable
|
|
60
|
-
? `reachable at ${cache.url}`
|
|
61
|
-
: (cache.note ?? `unreachable at ${cache.url}`),
|
|
62
|
-
},
|
|
63
|
-
];
|
|
64
|
-
}
|
|
65
|
-
}
|