@pattern-stack/codegen 0.25.0 → 0.26.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 +50 -0
- package/dist/{chunk-KFXXOFDC.js → chunk-7XDB4OMR.js} +3 -3
- package/dist/{chunk-4MVGAMUA.js → chunk-BK5ICA2F.js} +4 -4
- package/dist/{chunk-J7JMVS2B.js → chunk-CZQUOIDY.js} +4 -4
- package/dist/{chunk-37PILMIT.js → chunk-EEGVDRZE.js} +4 -4
- package/dist/chunk-H6QRQUAF.js +54 -0
- package/dist/chunk-H6QRQUAF.js.map +1 -0
- package/dist/{chunk-LLDJS7PJ.js → chunk-HLURWFIT.js} +4 -4
- package/dist/{chunk-YULGWXCY.js → chunk-MVKW2BCR.js} +4 -4
- package/dist/{chunk-YIVQ7KLS.js → chunk-QO35B6BN.js} +4 -4
- package/dist/{chunk-HN5HT5WL.js → chunk-QXYKV4CE.js} +4 -4
- package/dist/{chunk-WZOPWQN2.js → chunk-XNRKZCVH.js} +2 -2
- package/dist/runtime/base-classes/index.js +16 -16
- package/dist/runtime/shared/logging/compact-console-logger.d.ts +55 -0
- package/dist/runtime/shared/logging/compact-console-logger.js +12 -0
- package/dist/runtime/shared/logging/compact-console-logger.js.map +1 -0
- package/dist/runtime/shared/logging/index.d.ts +2 -0
- package/dist/runtime/shared/logging/index.js +12 -0
- package/dist/runtime/shared/logging/index.js.map +1 -0
- package/dist/runtime/subsystems/analytics/analytics.module.js +2 -2
- package/dist/runtime/subsystems/analytics/index.js +4 -4
- package/dist/runtime/subsystems/auth/auth.module.js +1 -1
- package/dist/runtime/subsystems/auth/index.js +3 -3
- package/dist/runtime/subsystems/bridge/bridge-delivery.drizzle-backend.js +2 -2
- package/dist/runtime/subsystems/bridge/bridge-outbox-drain-hook.js +1 -1
- package/dist/runtime/subsystems/bridge/bridge.module.js +3 -3
- package/dist/runtime/subsystems/bridge/index.js +5 -5
- package/dist/runtime/subsystems/cache/cache.module.js +1 -1
- package/dist/runtime/subsystems/cache/index.js +3 -3
- package/dist/runtime/subsystems/index.js +34 -34
- package/dist/runtime/subsystems/integration/execute-integration.use-case.js +2 -2
- package/dist/runtime/subsystems/integration/index.js +12 -12
- package/dist/runtime/subsystems/integration/integration-cursor-store.drizzle-backend.js +2 -2
- package/dist/runtime/subsystems/integration/integration-run-recorder.drizzle-backend.js +2 -2
- package/dist/runtime/subsystems/integration/integration.module.js +4 -4
- package/dist/runtime/subsystems/observability/index.js +2 -2
- package/dist/runtime/subsystems/observability/observability.module.js +2 -2
- package/dist/runtime/subsystems/storage/index.js +4 -4
- package/dist/runtime/subsystems/storage/storage.module.js +2 -2
- package/dist/src/cli/index.js +18 -16
- package/dist/src/cli/index.js.map +1 -1
- package/dist/src/index.js +5 -5
- package/package.json +5 -1
- package/runtime/shared/logging/compact-console-logger.ts +102 -0
- package/runtime/shared/logging/index.ts +10 -0
- /package/dist/{chunk-KFXXOFDC.js.map → chunk-7XDB4OMR.js.map} +0 -0
- /package/dist/{chunk-4MVGAMUA.js.map → chunk-BK5ICA2F.js.map} +0 -0
- /package/dist/{chunk-J7JMVS2B.js.map → chunk-CZQUOIDY.js.map} +0 -0
- /package/dist/{chunk-37PILMIT.js.map → chunk-EEGVDRZE.js.map} +0 -0
- /package/dist/{chunk-LLDJS7PJ.js.map → chunk-HLURWFIT.js.map} +0 -0
- /package/dist/{chunk-YULGWXCY.js.map → chunk-MVKW2BCR.js.map} +0 -0
- /package/dist/{chunk-YIVQ7KLS.js.map → chunk-QO35B6BN.js.map} +0 -0
- /package/dist/{chunk-HN5HT5WL.js.map → chunk-QXYKV4CE.js.map} +0 -0
- /package/dist/{chunk-WZOPWQN2.js.map → chunk-XNRKZCVH.js.map} +0 -0
package/dist/src/index.js
CHANGED
|
@@ -48,10 +48,10 @@ import {
|
|
|
48
48
|
} from "../chunk-K4BQQ2NN.js";
|
|
49
49
|
import "../chunk-KVOWSC5S.js";
|
|
50
50
|
import "../chunk-PRWIX6UW.js";
|
|
51
|
-
import "../chunk-
|
|
52
|
-
import "../chunk-
|
|
51
|
+
import "../chunk-7XDB4OMR.js";
|
|
52
|
+
import "../chunk-QXYKV4CE.js";
|
|
53
53
|
import "../chunk-EO2QPOKH.js";
|
|
54
|
-
import "../chunk-
|
|
54
|
+
import "../chunk-HLURWFIT.js";
|
|
55
55
|
import "../chunk-HNWZFNKP.js";
|
|
56
56
|
import "../chunk-AHV4GDYM.js";
|
|
57
57
|
import "../chunk-SQDOBLBP.js";
|
|
@@ -62,10 +62,10 @@ import "../chunk-JEINYUJH.js";
|
|
|
62
62
|
import "../chunk-5TK7MEN4.js";
|
|
63
63
|
import "../chunk-4KNXX6TI.js";
|
|
64
64
|
import "../chunk-3CJFPU6Q.js";
|
|
65
|
-
import "../chunk-
|
|
66
|
-
import "../chunk-S5G3HO7N.js";
|
|
65
|
+
import "../chunk-QO35B6BN.js";
|
|
67
66
|
import "../chunk-MZ6GV4YF.js";
|
|
68
67
|
import "../chunk-LG57S2SC.js";
|
|
68
|
+
import "../chunk-S5G3HO7N.js";
|
|
69
69
|
import "../chunk-U64T4YZE.js";
|
|
70
70
|
import "../chunk-2E224ZSN.js";
|
|
71
71
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pattern-stack/codegen",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.1",
|
|
4
4
|
"description": "Entity-driven code generation for full-stack TypeScript applications",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -35,6 +35,10 @@
|
|
|
35
35
|
"types": "./dist/runtime/shared/openapi/index.d.ts",
|
|
36
36
|
"default": "./dist/runtime/shared/openapi/index.js"
|
|
37
37
|
},
|
|
38
|
+
"./runtime/shared/logging": {
|
|
39
|
+
"types": "./dist/runtime/shared/logging/index.d.ts",
|
|
40
|
+
"default": "./dist/runtime/shared/logging/index.js"
|
|
41
|
+
},
|
|
38
42
|
"./runtime/*": {
|
|
39
43
|
"types": "./dist/runtime/*.d.ts",
|
|
40
44
|
"default": "./dist/runtime/*.js"
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compact console logger + `LOG_LEVEL` threshold.
|
|
3
|
+
*
|
|
4
|
+
* Nest's default `ConsoleLogger` preamble —
|
|
5
|
+
* `[Nest] <pid> - <full locale date> LEVEL [Context] <message>`
|
|
6
|
+
* — is ~55 chars before the message. In a split-pane dev TUI (process-compose,
|
|
7
|
+
* tmux) every line wraps 2–3×, drowning the actual content. And the generated
|
|
8
|
+
* entrypoints pass no `logger:` option, so consumers have no log-level knob:
|
|
9
|
+
* every subsystem `debug` line (e.g. EventScheduler's per-slot `materialised …`)
|
|
10
|
+
* always prints.
|
|
11
|
+
*
|
|
12
|
+
* This module is the proven swe-brain (second-dogfood) consumer pattern lifted
|
|
13
|
+
* into the runtime so consumers stop rebuilding it by hand:
|
|
14
|
+
*
|
|
15
|
+
* - `CompactConsoleLogger` — drops the `[Nest] <pid> - ` prefix (a supervisor
|
|
16
|
+
* pane header already names the process) and shortens the timestamp to
|
|
17
|
+
* `HH:mm:ss`.
|
|
18
|
+
* - `parseLogLevels` / the `LOG_LEVEL` env convention — a single severity
|
|
19
|
+
* threshold enables that level and everything above it.
|
|
20
|
+
* - `createAppLogger` — the factory the entrypoints hand to `NestFactory`.
|
|
21
|
+
*/
|
|
22
|
+
import { ConsoleLogger, type LogLevel } from '@nestjs/common';
|
|
23
|
+
|
|
24
|
+
/** Severity-ordered (lowest → highest); a threshold enables its suffix. */
|
|
25
|
+
const LEVELS: LogLevel[] = ['verbose', 'debug', 'log', 'warn', 'error', 'fatal'];
|
|
26
|
+
const DEFAULT_THRESHOLD: LogLevel = 'log';
|
|
27
|
+
|
|
28
|
+
const TIME = new Intl.DateTimeFormat('en-GB', {
|
|
29
|
+
hour: '2-digit',
|
|
30
|
+
minute: '2-digit',
|
|
31
|
+
second: '2-digit',
|
|
32
|
+
hour12: false,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Resolve a `LOG_LEVEL` threshold into the enabled-levels array Nest's
|
|
37
|
+
* `logLevels` option expects.
|
|
38
|
+
*
|
|
39
|
+
* `LOG_LEVEL=debug` → `['debug','log','warn','error','fatal']`. Unknown input
|
|
40
|
+
* warns and falls back to the default (`'log'` and above).
|
|
41
|
+
*/
|
|
42
|
+
export function parseLogLevels(threshold = process.env.LOG_LEVEL): LogLevel[] {
|
|
43
|
+
const idx = LEVELS.indexOf(
|
|
44
|
+
(threshold ?? DEFAULT_THRESHOLD).toLowerCase() as LogLevel,
|
|
45
|
+
);
|
|
46
|
+
if (idx === -1) {
|
|
47
|
+
console.warn(
|
|
48
|
+
`[logging] unknown LOG_LEVEL '${threshold}' — defaulting to '${DEFAULT_THRESHOLD}'`,
|
|
49
|
+
);
|
|
50
|
+
return LEVELS.slice(LEVELS.indexOf(DEFAULT_THRESHOLD));
|
|
51
|
+
}
|
|
52
|
+
return LEVELS.slice(idx);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* A `ConsoleLogger` with a compact one-line format tuned for split-pane TUIs.
|
|
57
|
+
*/
|
|
58
|
+
export class CompactConsoleLogger extends ConsoleLogger {
|
|
59
|
+
/** Drop `[Nest] <pid> - ` — a supervisor pane header already identifies the process. */
|
|
60
|
+
protected override formatPid(_pid: number): string {
|
|
61
|
+
return '';
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** `12:48:42`, not `06/07/2026, 12:48:42 PM`. */
|
|
65
|
+
protected override getTimestamp(): string {
|
|
66
|
+
return TIME.format(Date.now());
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
protected override formatMessage(
|
|
70
|
+
logLevel: LogLevel,
|
|
71
|
+
message: unknown,
|
|
72
|
+
_pidMessage: string,
|
|
73
|
+
_formattedLogLevel: string,
|
|
74
|
+
contextMessage: string,
|
|
75
|
+
timestampDiff: string,
|
|
76
|
+
): string {
|
|
77
|
+
const output = this.stringifyMessage(message, logLevel);
|
|
78
|
+
// padStart(5) (vs Nest's 7) aligns LOG/WARN/DEBUG/ERROR; `verbose` may jitter.
|
|
79
|
+
const level = this.colorize(
|
|
80
|
+
logLevel.toUpperCase().padStart(5, ' '),
|
|
81
|
+
logLevel,
|
|
82
|
+
);
|
|
83
|
+
return `${this.getTimestamp()} ${level} ${contextMessage}${output}${timestampDiff}\n`;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Build the app-wide logger that entrypoints hand to `NestFactory`.
|
|
89
|
+
*
|
|
90
|
+
* @param threshold explicit `LOG_LEVEL` override. CLI tools that must stay quiet
|
|
91
|
+
* regardless of the ambient env pass e.g. `'warn'`. When omitted, the
|
|
92
|
+
* `LOG_LEVEL` env var (then the `'log'` default) wins.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* const app = await NestFactory.create(AppModule, { logger: createAppLogger() });
|
|
96
|
+
*/
|
|
97
|
+
export function createAppLogger(threshold?: LogLevel): CompactConsoleLogger {
|
|
98
|
+
return new CompactConsoleLogger('', {
|
|
99
|
+
logLevels: parseLogLevels(threshold ?? process.env.LOG_LEVEL),
|
|
100
|
+
timestamp: true,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|