@pattern-stack/codegen 0.25.0 → 0.26.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.
Files changed (56) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/{chunk-CKLM57IE.js → chunk-AC6T2JUX.js} +14 -14
  3. package/dist/{chunk-4MVGAMUA.js → chunk-BK5ICA2F.js} +4 -4
  4. package/dist/{chunk-J7JMVS2B.js → chunk-CZQUOIDY.js} +4 -4
  5. package/dist/{chunk-37PILMIT.js → chunk-EEGVDRZE.js} +4 -4
  6. package/dist/chunk-H6QRQUAF.js +54 -0
  7. package/dist/chunk-H6QRQUAF.js.map +1 -0
  8. package/dist/{chunk-ENAR3F5S.js → chunk-HEOISQ6W.js} +6 -6
  9. package/dist/{chunk-CDLWYZVQ.js → chunk-IN3EWFB4.js} +4 -4
  10. package/dist/{chunk-WZOPWQN2.js → chunk-IXAE6BN6.js} +3 -3
  11. package/dist/{chunk-YULGWXCY.js → chunk-MVKW2BCR.js} +4 -4
  12. package/dist/{chunk-KFXXOFDC.js → chunk-N43D57AP.js} +2 -2
  13. package/dist/{chunk-HN5HT5WL.js → chunk-VI2VNA6Y.js} +4 -4
  14. package/dist/runtime/base-classes/index.js +24 -24
  15. package/dist/runtime/shared/logging/compact-console-logger.d.ts +55 -0
  16. package/dist/runtime/shared/logging/compact-console-logger.js +12 -0
  17. package/dist/runtime/shared/logging/compact-console-logger.js.map +1 -0
  18. package/dist/runtime/shared/logging/index.d.ts +2 -0
  19. package/dist/runtime/shared/logging/index.js +12 -0
  20. package/dist/runtime/shared/logging/index.js.map +1 -0
  21. package/dist/runtime/subsystems/analytics/analytics.module.js +2 -2
  22. package/dist/runtime/subsystems/analytics/index.js +4 -4
  23. package/dist/runtime/subsystems/auth/auth.module.js +1 -1
  24. package/dist/runtime/subsystems/auth/index.js +3 -3
  25. package/dist/runtime/subsystems/bridge/bridge-delivery.drizzle-backend.js +2 -2
  26. package/dist/runtime/subsystems/bridge/bridge-outbox-drain-hook.js +1 -1
  27. package/dist/runtime/subsystems/bridge/bridge.module.js +11 -11
  28. package/dist/runtime/subsystems/bridge/index.js +13 -13
  29. package/dist/runtime/subsystems/index.js +49 -49
  30. package/dist/runtime/subsystems/integration/index.js +12 -12
  31. package/dist/runtime/subsystems/integration/integration-run-recorder.drizzle-backend.js +2 -2
  32. package/dist/runtime/subsystems/integration/integration.module.js +3 -3
  33. package/dist/runtime/subsystems/jobs/index.js +24 -24
  34. package/dist/runtime/subsystems/jobs/job-orchestrator.bullmq-backend.js +4 -4
  35. package/dist/runtime/subsystems/jobs/job-run-service.memory-backend.js +2 -2
  36. package/dist/runtime/subsystems/jobs/job-worker.module.js +8 -8
  37. package/dist/runtime/subsystems/jobs/jobs-domain.module.js +7 -7
  38. package/dist/runtime/subsystems/observability/index.js +2 -2
  39. package/dist/runtime/subsystems/observability/observability.module.js +2 -2
  40. package/dist/runtime/subsystems/storage/index.js +4 -4
  41. package/dist/runtime/subsystems/storage/storage.module.js +2 -2
  42. package/dist/src/cli/index.js +4 -4
  43. package/dist/src/index.js +4 -4
  44. package/package.json +5 -1
  45. package/runtime/shared/logging/compact-console-logger.ts +102 -0
  46. package/runtime/shared/logging/index.ts +10 -0
  47. /package/dist/{chunk-CKLM57IE.js.map → chunk-AC6T2JUX.js.map} +0 -0
  48. /package/dist/{chunk-4MVGAMUA.js.map → chunk-BK5ICA2F.js.map} +0 -0
  49. /package/dist/{chunk-J7JMVS2B.js.map → chunk-CZQUOIDY.js.map} +0 -0
  50. /package/dist/{chunk-37PILMIT.js.map → chunk-EEGVDRZE.js.map} +0 -0
  51. /package/dist/{chunk-ENAR3F5S.js.map → chunk-HEOISQ6W.js.map} +0 -0
  52. /package/dist/{chunk-CDLWYZVQ.js.map → chunk-IN3EWFB4.js.map} +0 -0
  53. /package/dist/{chunk-WZOPWQN2.js.map → chunk-IXAE6BN6.js.map} +0 -0
  54. /package/dist/{chunk-YULGWXCY.js.map → chunk-MVKW2BCR.js.map} +0 -0
  55. /package/dist/{chunk-KFXXOFDC.js.map → chunk-N43D57AP.js.map} +0 -0
  56. /package/dist/{chunk-HN5HT5WL.js.map → chunk-VI2VNA6Y.js.map} +0 -0
@@ -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
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Logging shared subsystem — public API.
3
+ *
4
+ * Imported by consumers as `@pattern-stack/codegen/runtime/shared/logging`.
5
+ */
6
+ export {
7
+ CompactConsoleLogger,
8
+ createAppLogger,
9
+ parseLogLevels,
10
+ } from './compact-console-logger';