create-forgeon 0.3.15 → 0.3.16
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/package.json +4 -2
- package/src/core/docs.test.mjs +79 -40
- package/src/core/scaffold.test.mjs +99 -0
- package/src/modules/db-prisma.mjs +23 -55
- package/src/modules/executor.test.mjs +132 -36
- package/src/modules/files-access.mjs +27 -98
- package/src/modules/files-image.mjs +26 -100
- package/src/modules/files-quotas.mjs +67 -87
- package/src/modules/files.mjs +35 -104
- package/src/modules/i18n.mjs +17 -121
- package/src/modules/idempotency.test.mjs +174 -0
- package/src/modules/jwt-auth.mjs +90 -209
- package/src/modules/logger.mjs +0 -9
- package/src/modules/probes.test.mjs +202 -0
- package/src/modules/queue.mjs +325 -443
- package/src/modules/rate-limit.mjs +22 -66
- package/src/modules/rbac.mjs +27 -67
- package/src/modules/scheduler.mjs +44 -167
- package/src/modules/shared/nest-runtime-wiring.mjs +110 -0
- package/src/modules/shared/probes.mjs +235 -0
- package/src/modules/sync-integrations.mjs +54 -21
- package/src/modules/sync-integrations.test.mjs +220 -0
- package/src/run-add-module.test.mjs +153 -0
- package/templates/base/README.md +7 -55
- package/templates/base/apps/web/src/App.tsx +70 -42
- package/templates/base/apps/web/src/probes.ts +61 -0
- package/templates/base/apps/web/src/styles.css +86 -25
- package/templates/base/package.json +21 -15
- package/templates/base/scripts/forgeon-sync-integrations.mjs +55 -11
- package/templates/module-presets/files-quotas/packages/files-quotas/src/forgeon-files-quotas.module.ts +12 -4
- package/templates/module-presets/i18n/apps/web/src/App.tsx +68 -41
- package/templates/module-presets/logger/packages/logger/src/index.ts +0 -1
- package/templates/base/docs/AI/ARCHITECTURE.md +0 -85
- package/templates/base/docs/AI/MODULE_CHECKS.md +0 -28
- package/templates/base/docs/AI/MODULE_SPEC.md +0 -77
- package/templates/base/docs/AI/PROJECT.md +0 -43
- package/templates/base/docs/AI/ROADMAP.md +0 -171
- package/templates/base/docs/AI/TASKS.md +0 -60
- package/templates/base/docs/AI/VALIDATION.md +0 -31
- package/templates/base/docs/README.md +0 -18
- package/templates/module-presets/logger/packages/logger/src/http-logging.interceptor.ts +0 -94
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# Documentation Index
|
|
2
|
-
|
|
3
|
-
- `AI/PROJECT.md` - project overview and run modes
|
|
4
|
-
- `AI/ARCHITECTURE.md` - monorepo design and extension model
|
|
5
|
-
- `AI/ROADMAP.md` - implementation roadmap and feature priorities
|
|
6
|
-
- `AI/MODULE_SPEC.md` - fullstack module contract (`contracts/api/web`)
|
|
7
|
-
- `AI/MODULE_CHECKS.md` - required runtime probe hooks for modules
|
|
8
|
-
- `AI/VALIDATION.md` - DTO/env validation standards
|
|
9
|
-
- `AI/TASKS.md` - ready-to-use Codex prompts
|
|
10
|
-
|
|
11
|
-
## i18n Language Workflow
|
|
12
|
-
|
|
13
|
-
Add a new language from existing namespaces:
|
|
14
|
-
- `pnpm i18n:add uk`
|
|
15
|
-
|
|
16
|
-
Useful follow-up commands:
|
|
17
|
-
- `pnpm i18n:sync`
|
|
18
|
-
- `pnpm i18n:check`
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { CallHandler, ExecutionContext, Injectable, NestInterceptor } from '@nestjs/common';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { ForgeonLoggerService } from './forgeon-logger.service';
|
|
4
|
-
import { LoggerConfigService } from './logger-config.service';
|
|
5
|
-
|
|
6
|
-
type HeaderValue = string | string[] | undefined;
|
|
7
|
-
type HeadersRecord = Record<string, HeaderValue>;
|
|
8
|
-
|
|
9
|
-
interface RequestLike {
|
|
10
|
-
method?: string;
|
|
11
|
-
originalUrl?: string;
|
|
12
|
-
url?: string;
|
|
13
|
-
ip?: string;
|
|
14
|
-
requestId?: string;
|
|
15
|
-
headers?: HeadersRecord;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface ResponseLike {
|
|
19
|
-
statusCode?: number;
|
|
20
|
-
once?: (event: string, listener: () => void) => void;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
@Injectable()
|
|
24
|
-
export class ForgeonHttpLoggingInterceptor implements NestInterceptor {
|
|
25
|
-
constructor(
|
|
26
|
-
private readonly logger: ForgeonLoggerService,
|
|
27
|
-
private readonly loggerConfig: LoggerConfigService,
|
|
28
|
-
) {}
|
|
29
|
-
|
|
30
|
-
intercept(context: ExecutionContext, next: CallHandler): Observable<unknown> {
|
|
31
|
-
if (context.getType<'http'>() !== 'http') {
|
|
32
|
-
return next.handle();
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (!this.loggerConfig.httpEnabled) {
|
|
36
|
-
return next.handle();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const http = context.switchToHttp();
|
|
40
|
-
const request = http.getRequest<RequestLike>();
|
|
41
|
-
const response = http.getResponse<ResponseLike>();
|
|
42
|
-
|
|
43
|
-
const method = request.method ?? 'UNKNOWN';
|
|
44
|
-
const path = request.originalUrl ?? request.url ?? '/';
|
|
45
|
-
const ip = request.ip;
|
|
46
|
-
const requestId =
|
|
47
|
-
request.requestId ?? this.readHeader(request.headers, this.loggerConfig.requestIdHeader);
|
|
48
|
-
const startedAt = Date.now();
|
|
49
|
-
|
|
50
|
-
if (typeof response.once === 'function') {
|
|
51
|
-
response.once('finish', () => {
|
|
52
|
-
this.logger.logHttpRequest({
|
|
53
|
-
method,
|
|
54
|
-
path,
|
|
55
|
-
statusCode: response.statusCode ?? 200,
|
|
56
|
-
durationMs: Date.now() - startedAt,
|
|
57
|
-
requestId,
|
|
58
|
-
ip,
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
} else {
|
|
62
|
-
// Fallback for non-standard response mocks.
|
|
63
|
-
try {
|
|
64
|
-
this.logger.logHttpRequest({
|
|
65
|
-
method,
|
|
66
|
-
path,
|
|
67
|
-
statusCode: response.statusCode ?? 200,
|
|
68
|
-
durationMs: Date.now() - startedAt,
|
|
69
|
-
requestId,
|
|
70
|
-
ip,
|
|
71
|
-
});
|
|
72
|
-
} catch {
|
|
73
|
-
// no-op
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return next.handle();
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
private readHeader(headers: HeadersRecord | undefined, name: string): string | undefined {
|
|
81
|
-
if (!headers) {
|
|
82
|
-
return undefined;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const value = headers[name.toLowerCase()];
|
|
86
|
-
if (typeof value === 'string' && value.trim().length > 0) {
|
|
87
|
-
return value;
|
|
88
|
-
}
|
|
89
|
-
if (Array.isArray(value) && typeof value[0] === 'string' && value[0].trim().length > 0) {
|
|
90
|
-
return value[0];
|
|
91
|
-
}
|
|
92
|
-
return undefined;
|
|
93
|
-
}
|
|
94
|
-
}
|