@seta-labs/nuxt-foundation 0.10.0 → 0.11.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/app/apps.ts CHANGED
@@ -12,6 +12,13 @@ export const foundationApps = [
12
12
  { id: 'immo', name: 'Immo', kind: 'app', url: 'https://immo.setalabs.app' },
13
13
  // SPID accounts and guided OTP token setup (repo seta-spid).
14
14
  { id: 'spid', name: 'SPID', kind: 'app', url: 'https://spid.setalabs.app' },
15
+ // AdE sale deeds: crawl, match and export (repo seta-compravenduto).
16
+ {
17
+ id: 'compravenduto',
18
+ name: 'Compravenduto',
19
+ kind: 'app',
20
+ url: 'https://compravenduto.setalabs.app',
21
+ },
15
22
  // The ops console of the cluster (repo seta-ops), on the design system's
16
23
  // `infra` tile.
17
24
  { id: 'infra', name: 'Ops', kind: 'app', url: 'https://ops.setalabs.app' },
@@ -33,6 +33,11 @@ body {
33
33
  --accent-soft: color-mix(in oklab, var(--app-spid) 14%, transparent);
34
34
  }
35
35
 
36
+ [data-app='compravenduto'] {
37
+ --accent: var(--app-compravenduto);
38
+ --accent-soft: color-mix(in oklab, var(--app-compravenduto) 14%, transparent);
39
+ }
40
+
36
41
  [data-app='infra'] {
37
42
  --accent: var(--app-infra);
38
43
  --accent-soft: color-mix(in oklab, var(--app-infra) 14%, transparent);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seta-labs/nuxt-foundation",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Seta Foundation: the Nuxt layer every internal Seta panel extends — design system mirror (tokens, sf- components, icons, brand) plus the shared shell (bar, app launcher, side menu, status bar)",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -40,11 +40,11 @@
40
40
  },
41
41
  "devDependencies": {
42
42
  "@nuxt/eslint": "^1.17.0",
43
- "nuxt": "^4.6.0",
43
+ "nuxt": "^4.6.3",
44
44
  "typescript": "^6.0.3",
45
- "vitest": "^5.0.3",
46
- "vue": "^3.5.43",
45
+ "vitest": "^5.0.5",
46
+ "vue": "^3.5.44",
47
47
  "vue-router": "^5.4.0",
48
- "vue-tsc": "^3.3.12"
48
+ "vue-tsc": "^3.3.14"
49
49
  }
50
50
  }
@@ -0,0 +1,83 @@
1
+ type LogLevel = 'info' | 'warn' | 'error';
2
+
3
+ type LogFields = Record<string, unknown> & { err?: unknown };
4
+
5
+ type LogWriter = (fields: LogFields, message: string) => void;
6
+
7
+ const LEVEL_RANK: Record<string, number> = {
8
+ trace: 10,
9
+ debug: 20,
10
+ info: 30,
11
+ warn: 40,
12
+ error: 50,
13
+ fatal: 60,
14
+ silent: Infinity,
15
+ };
16
+
17
+ /** The keys `@seta-labs/nestjs-logging` redacts, at any depth here. */
18
+ const SECRET_KEYS = new Set([
19
+ 'password',
20
+ 'token',
21
+ 'secret',
22
+ 'apiKey',
23
+ 'api_key',
24
+ 'authorization',
25
+ 'cookie',
26
+ ]);
27
+
28
+ const CREDENTIALED_URL_REGEX = /([a-z][a-z0-9+.-]*):\/\/[^:/\s@]+:[^@\s]+@/gi;
29
+
30
+ /** `LOG_LEVEL`, defaulting to `silent` under test and `info` elsewhere, as in the API. */
31
+ function threshold(env: NodeJS.ProcessEnv): number {
32
+ const level = env.LOG_LEVEL ?? (env.NODE_ENV === 'test' ? 'silent' : 'info');
33
+ return LEVEL_RANK[level] ?? LEVEL_RANK.info!;
34
+ }
35
+
36
+ /** Type, message, code and stack, down the `cause` chain (a fetch hides `ECONNREFUSED` there). */
37
+ function serializeError(err: unknown): unknown {
38
+ if (!(err instanceof Error)) return err;
39
+ const { code } = err as Error & { code?: unknown };
40
+ return {
41
+ type: err.name,
42
+ message: err.message,
43
+ code,
44
+ stack: err.stack,
45
+ cause: serializeError(err.cause),
46
+ };
47
+ }
48
+
49
+ function redact(key: string, value: unknown): unknown {
50
+ if (SECRET_KEYS.has(key)) return '[REDACTED]';
51
+ return typeof value === 'string'
52
+ ? value.replace(CREDENTIALED_URL_REGEX, '$1://***:***@')
53
+ : value;
54
+ }
55
+
56
+ /**
57
+ * Logger of the panel's server routes: one JSON line per record on stdout,
58
+ * shaped like the API lines (`level`, ISO `time`, `context`, `message`), so
59
+ * the log collector reads the level and the context of both alike. Fields
60
+ * first, constant message second; an `err` keeps its type, message and stack.
61
+ * Secret keys and `user:pass@` in URLs are masked, as in the API.
62
+ */
63
+ export function serverLogger(
64
+ context: string,
65
+ env: NodeJS.ProcessEnv = process.env,
66
+ ): Record<LogLevel, LogWriter> {
67
+ const minimum = threshold(env);
68
+ const writer =
69
+ (level: LogLevel): LogWriter =>
70
+ ({ err, ...fields }, message) => {
71
+ if (LEVEL_RANK[level]! < minimum) return;
72
+ const line = {
73
+ level,
74
+ time: new Date().toISOString(),
75
+ context,
76
+ ...fields,
77
+ err: serializeError(err),
78
+ message,
79
+ };
80
+ process.stdout.write(`${JSON.stringify(line, redact)}\n`);
81
+ };
82
+ return { info: writer('info'), warn: writer('warn'), error: writer('error') };
83
+ }