nucleus-core-ts 0.9.749 → 0.9.751

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.
@@ -1490,6 +1490,7 @@ export type ResolvedEnvEntry = {
1490
1490
  envName: string;
1491
1491
  resolved: boolean;
1492
1492
  value: string | null;
1493
+ isSecret: boolean;
1493
1494
  };
1494
1495
  export type ConfigGetResponse = StandardReturn<{
1495
1496
  config: Record<string, unknown>;
@@ -1,6 +1,7 @@
1
1
  import type { NucleusConfigOptions } from '@types';
2
2
  import type { ConfigSectionMeta, ResolvedEnvEntry } from './types';
3
3
  export declare const maskUrlCredentials: (value: string) => string;
4
+ export declare const looksSecretValue: (value: string) => boolean;
4
5
  export declare const maskSensitiveFields: (obj: Record<string, unknown>) => Record<string, unknown>;
5
6
  export declare const buildSectionsMeta: (config: NucleusConfigOptions) => ConfigSectionMeta[];
6
7
  export declare const extractSection: (config: NucleusConfigOptions, section: string) => unknown;
@@ -8,6 +9,7 @@ export declare const hasSection: (config: NucleusConfigOptions, section: string)
8
9
  export declare const applySectionUpdate: (config: NucleusConfigOptions, section: string, value: unknown) => void;
9
10
  export declare const isRestartRequired: (section: string) => boolean;
10
11
  export declare const scanEnvVars: (obj: Record<string, unknown>, parentPath?: string) => ResolvedEnvEntry[];
12
+ export declare const scanUndeclaredEnv: (declaredNames: Set<string>) => ResolvedEnvEntry[];
11
13
  export declare const persistConfigToDisk: (configFilePath: string, config: NucleusConfigOptions) => Promise<void>;
12
14
  /**
13
15
  * Persist a single section override to Redis.
@@ -12,13 +12,26 @@ export type ConfigSectionMeta = {
12
12
  restartRequired: boolean;
13
13
  };
14
14
  /**
15
- * A single resolved env var entry found by scanning the config tree.
15
+ * A single env var entry surfaced by GET /env.
16
+ *
17
+ * `recognized` distinguishes the two sources:
18
+ * - `true` — a DECLARED config field (the env var is referenced by the config
19
+ * tree, found by `scanEnvVars`).
20
+ * - `false` — present in `process.env` but NOT declared (orphaned / dead /
21
+ * misconfigured "junk" surfaced by `scanUndeclaredEnv`, minus infra noise).
16
22
  */
17
23
  export type ResolvedEnvEntry = {
18
24
  configPath: string;
19
25
  envName: string;
20
26
  resolved: boolean;
21
27
  value: string | null;
28
+ /**
29
+ * Whether this entry is a secret — set when the KEY name is sensitive OR the
30
+ * VALUE is high-entropy/encoded (base64 SA key, PEM, ...). Drives the key icon
31
+ * in the Config Manager and guarantees the `value` above is masked.
32
+ */
33
+ isSecret: boolean;
34
+ recognized: boolean;
22
35
  };
23
36
  /**
24
37
  * GET / — full config (masked)
@@ -62,6 +75,8 @@ export type ConfigEnvResponse = StandardReturn<{
62
75
  totalCount: number;
63
76
  resolvedCount: number;
64
77
  missingCount: number;
78
+ /** Count of `recognized:false` entries — env vars present but not declared. */
79
+ unrecognizedCount: number;
65
80
  }>;
66
81
  /**
67
82
  * GET /overrides
@@ -0,0 +1 @@
1
+ export {};
@@ -7,7 +7,14 @@ export declare function parseTokenValuesFromHeaders(headers: Headers, tokenNames
7
7
  export declare function initiateRedisManager(config: NucleusConfigOptions): Promise<void>;
8
8
  export declare function getRedisManager(): RedisManager | null;
9
9
  export declare function parseTimeToSeconds(timeString: string | number): number;
10
- export declare function signNewAccessToken({ sessionData, options, refreshTokenId, roles, claims, tenant, claimScopes, }: {
10
+ /**
11
+ * Browsers reject cookies larger than ~4096 bytes (name+value+attributes). We warn well before
12
+ * that so an oversized access-token cookie fails LOUD with actionable guidance instead of being
13
+ * silently dropped by the browser (the classic "logged in but every request is 401" symptom).
14
+ */
15
+ export declare const COOKIE_SAFE_TOKEN_BYTES = 3500;
16
+ export declare function warnIfAccessTokenTooLargeForCookie(token: string, jwtClaimsMode?: string): void;
17
+ export declare function signNewAccessToken({ sessionData, options, refreshTokenId, roles, claims, tenant, claimScopes, resolveMode, }: {
11
18
  sessionData: SessionRecord;
12
19
  options: NucleusConfigOptions;
13
20
  refreshTokenId: string;
@@ -17,6 +24,13 @@ export declare function signNewAccessToken({ sessionData, options, refreshTokenI
17
24
  tenant?: string;
18
25
  /** Per-action ownership scope embedded so embed-mode consumers enforce row-level scope. */
19
26
  claimScopes?: Record<string, Record<string, unknown>>;
27
+ /**
28
+ * When true (authorization.jwtClaimsMode === 'resolve' with a live claims cache), claims and
29
+ * claimScopes are NOT embedded — consumers resolve them from the shared Redis claims cache.
30
+ * This MUST mirror the login-path signAccessToken helper, otherwise the silent proactive
31
+ * refresh re-bloats the access-token cookie with claims even in resolve mode.
32
+ */
33
+ resolveMode?: boolean;
20
34
  }): string;
21
35
  /**
22
36
  * Resolve the shared `pg` Pool options from `database.pool`, applying safe
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nucleus-core-ts",
3
- "version": "0.9.749",
3
+ "version": "0.9.751",
4
4
  "description": "Production-ready, enterprise-grade TypeScript framework for building multi-tenant APIs",
5
5
  "author": "Hidayet Can Özcan <hidayetcan@gmail.com>",
6
6
  "license": "SEE LICENSE IN LICENSE",