@devbie/fewbie-cli 1.6.1 → 1.6.3

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.
@@ -41,7 +41,13 @@ async function resolveTemplate(options) {
41
41
  async function copyTemplate(from, to) {
42
42
  await promises_1.default.cp(from, to, {
43
43
  recursive: true,
44
- filter: (src) => !COPY_IGNORE.has(node_path_1.default.basename(src)) || src === from,
44
+ filter: async (src) => {
45
+ if (src === from)
46
+ return true;
47
+ if ((await promises_1.default.lstat(src)).isSymbolicLink())
48
+ return false;
49
+ return !COPY_IGNORE.has(node_path_1.default.basename(src));
50
+ },
45
51
  });
46
52
  }
47
53
  async function runCreate(options) {
@@ -1 +1 @@
1
- {"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":";;;;;;AAqCA,0CAyBC;AASD,8BAmDC;AA1HD,gEAAkC;AAClC,sDAAyB;AACzB,0DAA6B;AAC7B,yCAA8C;AAE9C,6CAAwD;AACxD,sDAAuE;AAG1D,QAAA,uBAAuB,GAAG,gDAAgD,CAAC;AAE3E,QAAA,iBAAiB,GAAG,sBAAsB,CAAC;AAGxD,MAAM,eAAe,GAAG,oDAAoD,CAAC;AAG7E,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAoBxE,KAAK,UAAU,eAAe,CACnC,OAAoE;IAEpE,MAAM,QAAQ,GAAG,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,GAAG,CAAC,yBAAiB,CAAC,CAAC;IACxE,IAAI,QAAQ,EAAE,CAAC;QAIb,MAAM,IAAI,GAAG,mBAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAC;QAClE,MAAM,kBAAE,CAAC,MAAM,CAAC,mBAAI,CAAC,IAAI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,IAAI,OAAO,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;QAC9B,MAAM,IAAA,qBAAW,EAAC,KAAK,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;IACpE,CAAC;IAED,OAAO,CAAC,IAAI,CAAC,IAAA,iBAAK,EAAC,IAAA,gBAAI,EAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC;IACpD,OAAO,CAAC,IAAI,CAAC,qBAAqB,IAAI,kCAAkC,CAAC,CAAC;AAC5E,CAAC"}
@@ -7,4 +7,5 @@ export interface TemplateUpdateOptions {
7
7
  templatePath?: string;
8
8
  templateRef?: string;
9
9
  }
10
+ export declare function listTemplateFiles(root: string): Promise<string[]>;
10
11
  export declare function runTemplateUpdate(options: TemplateUpdateOptions): Promise<void>;
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.listTemplateFiles = listTemplateFiles;
6
7
  exports.runTemplateUpdate = runTemplateUpdate;
7
8
  const promises_1 = __importDefault(require("node:fs/promises"));
8
9
  const node_path_1 = __importDefault(require("node:path"));
@@ -54,6 +55,8 @@ async function listTemplateFiles(root) {
54
55
  const entries = await promises_1.default.readdir(node_path_1.default.join(root, relativeDir), { withFileTypes: true });
55
56
  for (const entry of entries) {
56
57
  const relativePath = relativeDir === "" ? entry.name : `${relativeDir}/${entry.name}`;
58
+ if (entry.isSymbolicLink())
59
+ continue;
57
60
  if (entry.isDirectory()) {
58
61
  if ((0, template_ownership_1.isTemplateScanIgnored)(relativePath))
59
62
  continue;
@@ -1 +1 @@
1
- {"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/commands/template/update.ts"],"names":[],"mappings":";;;;;AAoJA,8CAoHC;AAxQD,gEAAkC;AAClC,0DAA6B;AAC7B,yCAAsD;AAEt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AAM,8CAA8C,UAAU,CAAC,MAAM,kBAAkB;gBAChG,SAAS,OAAO,mCAAmC,CACtD,CAAC;QACJ,CAAC;QAED,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACnB,OAAO,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;YACjD,OAAO;QACT,CAAC;QAED,KAAK,MAAM,MAAM,IAAI,UAAU,EAAE,CAAC;YAChC,IAAI,MAAM,CAAC,WAAW,KAAK,IAAI;gBAAE,SAAS;YAC1C,MAAM,MAAM,GAAG,mBAAI,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACzD,MAAM,kBAAE,CAAC,KAAK,CAAC,mBAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAC1D,MAAM,kBAAE,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;QACjD,CAAC;QACD,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;QACnD,IAAI,OAAO,GAAG,CAAC;YAAE,OAAO,CAAC,IAAI,CAAC,IAAA,kBAAM,EAAC,KAAK,OAAO,6DAA6D,CAAC,CAAC,CAAC;QACjH,OAAO,CAAC,IAAI,CAAC,IAAA,iBAAK,EAAC,IAAA,gBAAI,EAAC,6BAA6B,CAAC,CAAC,CAAC,CAAC;QACzD,OAAO,CAAC,IAAI,CAAC,gEAAgE,CAAC,CAAC;IACjF,CAAC;YAAS,CAAC;QACT,MAAM,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC;IAC7B,CAAC;AACH,CAAC"}
@@ -52,6 +52,7 @@ exports.TEMPLATE_ASSETS = [
52
52
  note: "the framework block lists variables framework-owned files read; host and registry-module variables stay outside it",
53
53
  markers: { start: "# fewbie:framework:start", end: "# fewbie:framework:end" },
54
54
  },
55
+ { path: ".trae/**", ownership: "host", note: "workspace ledger and skill mount; symlinks are never copied" },
55
56
  { path: "src/app/layout.tsx", ownership: "host" },
56
57
  { path: "src/app/page.tsx", ownership: "host" },
57
58
  { path: "src/app/favicon.ico", ownership: "host" },
@@ -100,13 +101,7 @@ const SCAN_IGNORED_DIRECTORIES = new Set([
100
101
  "out",
101
102
  "storybook-static",
102
103
  ]);
103
- const SCAN_IGNORED_FILES = new Set([
104
- ".DS_Store",
105
- ".env",
106
- ".env.local",
107
- "backlog.md",
108
- "package-lock.json",
109
- ]);
104
+ const SCAN_IGNORED_FILES = new Set([".DS_Store", ".env", ".env.local", "package-lock.json"]);
110
105
  const SCAN_IGNORED_SUFFIXES = [".tsbuildinfo"];
111
106
  function isTemplateScanIgnored(filePath) {
112
107
  const segments = filePath.split("/");
@@ -117,6 +112,9 @@ function isTemplateScanIgnored(filePath) {
117
112
  return true;
118
113
  return SCAN_IGNORED_SUFFIXES.some((suffix) => base.endsWith(suffix));
119
114
  }
115
+ function withoutComments(source) {
116
+ return source.replace(/\/\*[\s\S]*?\*\//g, "").replace(/^\s*\/\/.*$/gm, "");
117
+ }
120
118
  function findUnclassifiedTemplateFiles(filePaths) {
121
119
  return [...filePaths].filter((filePath) => !exports.TEMPLATE_ASSETS.some((asset) => assetCoversPath(asset, filePath))).sort();
122
120
  }
@@ -161,7 +159,7 @@ function planTemplateUpdate(projectFiles, templateFiles, assets = exports.SYNCAB
161
159
  }
162
160
  if (asset.ownership === "scaffold") {
163
161
  const snippet = asset.requiredSnippet;
164
- if (snippet && !projectContent.includes(snippet)) {
162
+ if (snippet && !withoutComments(projectContent).includes(snippet)) {
165
163
  changes.push({
166
164
  asset,
167
165
  kind: "scaffold-outdated",
@@ -1 +1 @@
1
- {"version":3,"file":"template-ownership.js","sourceRoot":"","sources":["../../src/lib/template-ownership.ts"],"names":[],"mappings":";;;AAsDA,oCAEC;AAuED,0CAEC;AAkCD,0CAMC;AA6BD,sDAMC;AAOD,sEAEC;AAGD,gDAKC;AAGD,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Aa;iBAClC,CAAC,CAAC;gBACH,SAAS;YACX,CAAC;YACD,IAAI,YAAY,KAAK,aAAa,EAAE,CAAC;gBACnC,OAAO,CAAC,IAAI,CAAC;oBACX,KAAK;oBACL,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,kBAAkB,CAAC,cAAc,EAAE,aAAa,EAAE,OAAO,CAAC;oBACvE,iBAAiB,EAAE,YAAY;oBAC/B,kBAAkB,EAAE,aAAa;iBAClC,CAAC,CAAC;YACL,CAAC;YACD,SAAS;QACX,CAAC;QAED,IAAI,cAAc,KAAK,eAAe,EAAE,CAAC;YACvC,OAAO,CAAC,IAAI,CAAC;gBACX,KAAK;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,eAAe;gBAC5B,iBAAiB,EAAE,cAAc;gBACjC,kBAAkB,EAAE,eAAe;aACpC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
1
+ {"version":3,"file":"template-ownership.js","sourceRoot":"","sources":["../../src/lib/template-ownership.ts"],"names":[],"mappings":";;;AA2DA,oCAEC;AA2ED,0CAEC;AAkCD,0CAMC;AAwBD,sDAMC;AAgBD,sEAEC;AAGD,gDAKC;AAGD,gDAQC;AAgCD,gDAmFC;AAzUY,QAAA,sBAAsB,GAAG,8BAA8B,CAAC;AACxD,QAAA,oBAAoB,GAAG,4BAA4B,CAAC;AAQjE,MAAM,eAAe,GAAoB,EAAE,KAAK,EAAE,8BAAsB,EAAE,GAAG,EAAE,4BAAoB,EAAE,CAAC;AAmBtG,SAAgB,YAAY,CAAC,KAAoB;IAC/C,OAAO,KAAK,CAAC,OAAO,IAAI,eAAe,CAAC;AAC1C,CAAC;AAEY,QAAA,eAAe,GAA6B;IAKvD;QACE,IAAI,EAAE,gBAAgB;QACtB,SAAS,EAAE,UAAU;QACrB,eAAe,EAAE,gCAAgC;QACjD,IAAI,EAAE,0FAA0F;KACjG;IAGD,EAAE,IAAI,EAAE,0BAA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AO,CAAC;oBACvE,iBAAiB,EAAE,YAAY;oBAC/B,kBAAkB,EAAE,aAAa;iBAClC,CAAC,CAAC;YACL,CAAC;YACD,SAAS;QACX,CAAC;QAED,IAAI,cAAc,KAAK,eAAe,EAAE,CAAC;YACvC,OAAO,CAAC,IAAI,CAAC;gBACX,KAAK;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,eAAe;gBAC5B,iBAAiB,EAAE,cAAc;gBACjC,kBAAkB,EAAE,eAAe;aACpC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -3,15 +3,15 @@
3
3
  "name": "api-client",
4
4
  "type": "registry:lib",
5
5
  "title": "API client",
6
- "description": "Envelope-aware axios instance with bearer-token auth, httpOnly refresh-cookie rotation, cross-tab Web Lock single-flight 401 retry, proactive token refresh, and UI-agnostic onError/onSessionExpired hooks.",
6
+ "description": "Envelope-aware axios instance with bearer-token auth in memory (no localStorage), httpOnly refresh-cookie rotation, cold-start session bootstrap that tells a signed-out user, a blocked account and an unreachable backend apart, cross-tab Web Lock single-flight 401 retry, proactive token refresh, ADR-048 coded auth-failure classification (SessionFailureKind / CODE_TO_KIND), and UI-agnostic onError/onSessionExpired hooks.",
7
7
  "dependencies": [
8
8
  "axios@^1.20.0"
9
9
  ],
10
- "postInstall": "Adjust BASE_URL / storage keys / REFRESH_PATH in src/lib/api-client.ts to match your backend contract.",
10
+ "postInstall": "Call bootstrapSession() from your entry route and branch on its status: authenticated -> render the app, anonymous -> send to login, unavailable -> stay on the page with a retry (an unreachable backend is not a logout; fewbie ADR-001 / devbie ADR-040). Adjust BASE_URL / legacy storage keys / REFRESH_PATH / REFRESH_LOCK_NAME in src/lib/api-client.ts to match your backend contract.",
11
11
  "files": [
12
12
  {
13
13
  "path": "src/lib/api-client.ts",
14
- "content": "import axios, { type AxiosRequestConfig, type AxiosResponse, type InternalAxiosRequestConfig } from \"axios\";\n\n/**\n * Per-request opt-out for the framework's default error toast.\n *\n * By default every failed request surfaces the backend error via the\n * `onError` hook (currently wired to `toast.error` in request.ts). Set\n * `enabledDefaultErrorToast: false` when the caller renders its own richer\n * error UX (a confirm dialog, an inline form error, ...) so the same\n * failure is not surfaced twice. Defaults to true for backward safety.\n */\ndeclare module \"axios\" {\n interface AxiosRequestConfig {\n enabledDefaultErrorToast?: boolean;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Project-specific configuration — edit these for your backend contract.\n// ---------------------------------------------------------------------------\n\n/** Base URL of the API; same-origin by default. */\nconst BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL ?? \"\";\n\n/** localStorage key of the short-lived access token. */\nconst ACCESS_TOKEN_KEY = \"access-token\";\n\n/** localStorage key of the access-token expiry epoch in milliseconds. */\nconst ACCESS_TOKEN_EXPIRES_AT_KEY = \"access-token-expires-at\";\n\n/** Endpoint that exchanges the httpOnly refresh cookie for a new access token. */\nconst REFRESH_PATH = \"/auth/refresh-access-token\";\n\n/** Paths that must never trigger a silent refresh (would recurse). */\nconst AUTH_PATH_PATTERN = /^\\/auth\\//;\n\n/**\n * Hard ceiling for every API request, including the refresh exchange. Without\n * it a hung request (or a refresh that never settles) keeps `refreshPromise`\n * locked forever and every later 401 waits on it (R5-P2-13).\n */\nconst API_TIMEOUT_MS = 15_000;\n\n/** Cross-tab Web Lock that serializes refresh calls (see ADR-001). */\nconst REFRESH_LOCK_NAME = \"refresh-token\";\n\n/** Refresh this early so business requests never carry an expired token. */\nconst PROACTIVE_REFRESH_LEAD_MS = 60_000;\n\n/** How often the proactive scheduler checks expiry. */\nconst PROACTIVE_REFRESH_CHECK_INTERVAL_MS = 30_000;\n\n/**\n * Pause before retrying a failed refresh. When another tab rotates the\n * refresh cookie, the Set-Cookie reaches this tab a moment later; the retry\n * then carries the renewed cookie.\n */\nconst REFRESH_RETRY_DELAY_MS = 1_500;\n\n// ---------------------------------------------------------------------------\n// Response envelope (newbie backend contract)\n// ---------------------------------------------------------------------------\n\n/**\n * Standard JSON envelope: success is `{ code: 0, error: null, data }` and\n * failure is a non-2xx status with `{ code, error: { message }, data: null }`.\n */\nexport interface ApiEnvelope<T = unknown> {\n data?: T;\n code?: number;\n error?: { message?: string; description?: string } | null;\n}\n\n/** Whether a response body is a newbie envelope rather than a raw payload. */\nfunction isEnvelope(body: unknown): body is ApiEnvelope {\n if (body === null || typeof body !== \"object\") return false;\n if (Array.isArray(body)) return false;\n const record = body as Record<string, unknown>;\n // Every envelope carries both markers; a domain object that happens to\n // have a `data` field alone is not unwrapped.\n return \"code\" in record && \"data\" in record;\n}\n\n// ---------------------------------------------------------------------------\n// Token storage\n// ---------------------------------------------------------------------------\n\nexport function getAccessToken(): string {\n if (typeof window === \"undefined\") return \"\";\n return window.localStorage.getItem(ACCESS_TOKEN_KEY) ?? \"\";\n}\n\n/** Persist token + expiry after login or refresh. */\nexport function setSession(token: string, expiresInSeconds?: number): void {\n if (typeof window === \"undefined\") return;\n window.localStorage.setItem(ACCESS_TOKEN_KEY, token);\n // A fresh session re-arms the session-expired notification (R22-06).\n sessionExpiredNotified = false;\n if (typeof expiresInSeconds === \"number\" && expiresInSeconds > 0) {\n window.localStorage.setItem(ACCESS_TOKEN_EXPIRES_AT_KEY, String(Date.now() + expiresInSeconds * 1000));\n }\n}\n\n/** Remove all locally stored session data. */\nexport function clearSession(): void {\n if (typeof window === \"undefined\") return;\n window.localStorage.removeItem(ACCESS_TOKEN_KEY);\n window.localStorage.removeItem(ACCESS_TOKEN_EXPIRES_AT_KEY);\n}\n\n// Fires at most once per session: after the first notification the user is on\n// their way to the login page, so repeat calls (concurrent 401s, or the SSE\n// and axios paths racing) must not stack redirects (R22-06). setSession()\n// re-arms it.\nlet sessionExpiredNotified = false;\n\n/**\n * Fire the session-expired handler directly. Used by non-axios transports\n * (raw fetch for SSE streams) that can't go through the response interceptor\n * but still need the same \"refresh cookie gone → bounce to login\" path.\n */\nexport function triggerSessionExpired(): void {\n if (sessionExpiredNotified) return;\n sessionExpiredNotified = true;\n sessionExpiredHandler?.();\n}\n\n/** Normalized error so callers never depend on the axios error shape. */\nexport class ApiError extends Error {\n readonly status: number;\n readonly code?: number;\n readonly data: unknown;\n\n constructor(message: string, status: number, data?: unknown, code?: number) {\n super(message);\n this.name = \"ApiError\";\n this.status = status;\n this.code = code;\n this.data = data;\n }\n}\n\n/**\n * Hook invoked when the refresh cookie is missing/expired. Wire it to your\n * router (e.g. redirect to the login page); the client itself stays\n * router-agnostic.\n */\nlet sessionExpiredHandler: (() => void) | null = null;\nexport function onSessionExpired(handler: () => void): void {\n sessionExpiredHandler = handler;\n}\n\n/**\n * Hook invoked exactly once per failed request, after any 401 refresh/replay\n * attempt has been exhausted. Wire it to your toast layer; the client itself\n * never imports a UI library.\n */\nlet errorHandler: ((error: ApiError) => void) | null = null;\nexport function onError(handler: (error: ApiError) => void): void {\n errorHandler = handler;\n}\n\n// ---------------------------------------------------------------------------\n// Refresh-token rotation\n// ---------------------------------------------------------------------------\n\nfunction isUnauthorized(error: unknown): boolean {\n return axios.isAxiosError(error) && error.response?.status === 401;\n}\n\n/**\n * Whether the access token is still due for a refresh. After acquiring the\n * cross-tab lock, another tab may have already refreshed while we waited;\n * this check lets us skip the network call and reuse the new token.\n */\nfunction isRefreshStillDue(): boolean {\n const expiresAt = Number(window.localStorage.getItem(ACCESS_TOKEN_EXPIRES_AT_KEY) ?? 0);\n if (!expiresAt) return true;\n return Date.now() >= expiresAt - PROACTIVE_REFRESH_LEAD_MS;\n}\n\n/** One refresh round-trip; persists the renewed token and its expiry. */\nasync function requestRefreshOnce(): Promise<string | null> {\n const response = await axios.get(`${BASE_URL}${REFRESH_PATH}`, {\n withCredentials: true,\n timeout: API_TIMEOUT_MS,\n });\n const body = response.data as ApiEnvelope<{\n token?: string;\n tokenExpiresInSeconds?: number;\n }>;\n const token = body?.data?.token ?? \"\";\n if (!token) return null;\n setSession(token, body.data?.tokenExpiresInSeconds);\n return token;\n}\n\n/**\n * Outcome of one refresh attempt: the renewed token plus whether the session\n * is definitively over.\n */\nexport interface RefreshOutcome {\n token: string | null;\n /**\n * True only when the server rejected the refresh exchange (401/400) or a 2xx\n * response carried no token — i.e. the refresh credential is dead. Network\n * errors and 5xx are transient: the session must be kept and the caller\n * surfaces the original failure instead of forcing a logout (R22-05).\n */\n sessionOver: boolean;\n}\n\n/** Send the refresh request with one retry on 401 (cross-tab cookie race). */\nasync function requestRefreshWithRetry(): Promise<RefreshOutcome> {\n const classify = (error: unknown): RefreshOutcome =>\n // Only an auth rejection proves the cookie is dead; anything else\n // (offline, timeout, 5xx) is transient and must not end the session.\n axios.isAxiosError(error) && (error.response?.status === 401 || error.response?.status === 400)\n ? { token: null, sessionOver: true }\n : { token: null, sessionOver: false };\n try {\n const token = await requestRefreshOnce();\n return { token, sessionOver: token === null };\n } catch (firstError) {\n if (isUnauthorized(firstError)) {\n // Possible cross-tab rotation race: retry once with the renewed cookie.\n await new Promise((resolve) => setTimeout(resolve, REFRESH_RETRY_DELAY_MS));\n try {\n const token = await requestRefreshOnce();\n return { token, sessionOver: token === null };\n } catch (secondError) {\n return classify(secondError);\n }\n }\n // Network or other non-auth failure: nothing a retry can fix.\n return classify(firstError);\n }\n}\n\n// Shared in-flight refresh. The backend rotates the refresh cookie on every\n// call, so concurrent 401s must await the same request instead of issuing\n// parallel refreshes that invalidate each other's cookie.\nlet refreshPromise: Promise<RefreshOutcome> | null = null;\n/** Whether the in-flight refresh was started with force=true (R20-12). */\nlet refreshPromiseForced = false;\n\n/**\n * Exchange the httpOnly refresh cookie for a new access token.\n *\n * Two layers of dedup prevent concurrent refresh calls that would trigger\n * the backend's refresh-token-reuse detection and revoke the session:\n * 1. Single-tab: module-level refreshPromise — concurrent 401s in this tab\n * reuse the same promise.\n * 2. Cross-tab: Web Locks (navigator.locks) serialize refreshes across tabs.\n * After acquiring the lock, re-check whether refresh is still needed.\n * Pass force=true from the 401 reactive path: a 401 proves the token is\n * invalid regardless of the stored expiry, so the lock-time re-check must\n * not short-circuit. A forced caller must not ride a non-forced in-flight\n * refresh either — that promise may resolve through the not-due shortcut\n * with a token the server already rejects — so it chains a forced refresh\n * after the in-flight one instead (R20-12). Environments without Web Locks\n * fall back to the single-flight + retry mitigation.\n *\n * Exported so non-axios transports (raw fetch for SSE streams) can also\n * participate in the 401 silent-refresh chain. The outcome distinguishes a\n * dead refresh credential (`sessionOver`) from a transient failure, so\n * callers only end the session on the former (R22-05).\n */\nexport function refreshAccessToken(force = false): Promise<RefreshOutcome> {\n if (refreshPromise) {\n if (!force || refreshPromiseForced) return refreshPromise;\n return refreshPromise.then((outcome) => (outcome.sessionOver ? outcome : refreshAccessToken(true)));\n }\n\n refreshPromiseForced = force;\n refreshPromise = (async (): Promise<RefreshOutcome> => {\n try {\n if (typeof navigator !== \"undefined\" && navigator.locks) {\n return await navigator.locks.request(REFRESH_LOCK_NAME, async () => {\n if (!force && !isRefreshStillDue()) return { token: getAccessToken(), sessionOver: false };\n return requestRefreshWithRetry();\n });\n }\n // The await matters: without it the finally below runs at construction\n // time and refreshPromise would keep the settled outcome forever, so\n // no-locks environments could never refresh again (R20-12).\n return await requestRefreshWithRetry();\n } finally {\n refreshPromise = null;\n refreshPromiseForced = false;\n }\n })();\n\n return refreshPromise;\n}\n\n/**\n * Shared 401 handling for non-axios transports (raw fetch for SSE streams):\n * force a silent refresh and replay once with the renewed token. The session\n * ends only when the refresh credential is dead; a transient refresh failure\n * keeps the session and hands the original 401 back to the caller (R22-05,\n * R23-06).\n */\nexport async function replayOnUnauthorized(\n response: Response,\n replay: (token: string) => Promise<Response>,\n): Promise<Response> {\n if (response.status !== 401) return response;\n const outcome = await refreshAccessToken(true);\n if (outcome.token) return replay(outcome.token);\n if (outcome.sessionOver) {\n // Dead refresh credential: same session-end path as the axios interceptor.\n clearSession();\n triggerSessionExpired();\n }\n return response;\n}\n\n// ---------------------------------------------------------------------------\n// Proactive refresh scheduler (module-level singleton)\n// ---------------------------------------------------------------------------\n\nlet schedulerTimer: ReturnType<typeof setInterval> | null = null;\n\n/**\n * Start the scheduler that renews the token shortly before expiry. Call once\n * on the client (e.g. in the authenticated layout). Reactive 401 refresh\n * stays as a fallback for laptop sleep / scheduler drift.\n */\nexport function initProactiveTokenRefresh(): void {\n if (typeof window === \"undefined\" || schedulerTimer) return;\n\n const refreshIfDue = (): void => {\n const token = getAccessToken();\n if (!token) return;\n const expiresAt = Number(window.localStorage.getItem(ACCESS_TOKEN_EXPIRES_AT_KEY) ?? 0);\n // A session without a stored expiry (legacy login or a provider that\n // omitted expiresIn) still needs renewal: refresh now and persist the\n // expiry the backend returns, instead of never scheduling a refresh.\n if (!expiresAt || Date.now() >= expiresAt - PROACTIVE_REFRESH_LEAD_MS) {\n void refreshAccessToken().then((outcome) => {\n // A dead refresh cookie found proactively bounces to login now\n // instead of waiting for the next business request to 401 (R22-05).\n if (outcome.sessionOver) {\n clearSession();\n triggerSessionExpired();\n }\n });\n }\n };\n\n // Run immediately (tabs reopened after sleep) and then on an interval.\n refreshIfDue();\n schedulerTimer = setInterval(refreshIfDue, PROACTIVE_REFRESH_CHECK_INTERVAL_MS);\n}\n\n// ---------------------------------------------------------------------------\n// Error normalization (the single failure channel)\n// ---------------------------------------------------------------------------\n\n/** Map any thrown value to the normalized ApiError shape. */\nfunction toApiError(error: unknown): ApiError {\n if (error instanceof ApiError) return error;\n if (axios.isAxiosError(error)) {\n const body = error.response?.data as ApiEnvelope | undefined;\n return new ApiError(\n body?.error?.message ?? error.message,\n error.response?.status ?? 0,\n body ?? error.response?.data,\n body?.code,\n );\n }\n if (error instanceof Error) return new ApiError(error.message, 0);\n return new ApiError(\"Request failed\", 0);\n}\n\n// ---------------------------------------------------------------------------\n// Axios instance\n// ---------------------------------------------------------------------------\n\nexport const api = axios.create({\n baseURL: BASE_URL,\n withCredentials: true,\n timeout: API_TIMEOUT_MS,\n});\n\n/**\n * Whether the request resolves to our own origin (the configured baseURL, or\n * the page origin when baseURL is empty). The bearer token must never be\n * attached to an absolute URL pointing at a third party (R23-02).\n */\nfunction isOwnOriginRequest(config: InternalAxiosRequestConfig): boolean {\n const base = config.baseURL ?? BASE_URL;\n const fallbackOrigin = typeof window !== \"undefined\" ? window.location.origin : \"http://localhost\";\n try {\n const resolved = new URL(config.url ?? \"\", base || fallbackOrigin);\n const baseOrigin = new URL(base || fallbackOrigin, fallbackOrigin).origin;\n return resolved.origin === baseOrigin;\n } catch {\n return false;\n }\n}\n\napi.interceptors.request.use((config) => {\n const token = getAccessToken();\n // Within the interceptor chain headers is always an AxiosHeaders instance.\n if (token && isOwnOriginRequest(config)) {\n config.headers.set(\"Authorization\", `Bearer ${token}`);\n }\n return config;\n});\n\n/**\n * Request config fields owned by the response interceptor.\n *\n * `_retriedAfterRefresh` marks a request that already went through the silent\n * refresh + replay chain once, so a second 401 does not recurse.\n */\ntype RotatingRequestConfig = InternalAxiosRequestConfig & {\n _retriedAfterRefresh?: boolean;\n};\n\n// Success channel: only unwrap the envelope; failures never arrive here\n// (they carry non-2xx status — see newbie ADR-001).\napi.interceptors.response.use(\n (response) => {\n if (isEnvelope(response.data)) {\n return { ...response, data: response.data.data };\n }\n return response;\n },\n async (error) => {\n const original = error?.config as RotatingRequestConfig | undefined;\n const url: string = original?.url ?? \"\";\n const canSilentlyRefresh =\n typeof window !== \"undefined\" && !original?._retriedAfterRefresh && !AUTH_PATH_PATTERN.test(url);\n\n if (isUnauthorized(error) && original && canSilentlyRefresh) {\n original._retriedAfterRefresh = true;\n const outcome = await refreshAccessToken(true);\n if (outcome.token) {\n original.headers.set(\"Authorization\", `Bearer ${outcome.token}`);\n // Replay goes through the same interceptor chain; its outcome is\n // returned directly so this failure never reaches the handler.\n return api(original);\n }\n if (outcome.sessionOver) {\n // The server rejected the refresh credential: the session is over.\n clearSession();\n triggerSessionExpired();\n // This request failed because the session was already gone; the user is\n // being bounced to the login page, so its message is noise (R21-01).\n // Suppress it through the public per-request opt-out rather than a\n // private marker — one suppression concept, not two (R22-01).\n original.enabledDefaultErrorToast = false;\n }\n // Transient refresh failure (offline/5xx): keep the session and let the\n // original 401 surface normally (R22-05).\n }\n\n // Single exit for every final failure: normalize once, notify once.\n // Callers that render their own error UX pass enabledDefaultErrorToast:\n // false to suppress the default toast and avoid double notification.\n const normalized = toApiError(error);\n if (error?.config?.enabledDefaultErrorToast !== false) {\n errorHandler?.(normalized);\n }\n throw normalized;\n },\n);\n\n// ---------------------------------------------------------------------------\n// Typed convenience methods — resolve to the unwrapped response body.\n// ---------------------------------------------------------------------------\n\nexport const apiClient = {\n get<T>(url: string, config?: AxiosRequestConfig): Promise<T> {\n return api.get<unknown, AxiosResponse<T>>(url, config).then((r) => r.data);\n },\n post<T>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<T> {\n return api.post<unknown, AxiosResponse<T>>(url, data, config).then((r) => r.data);\n },\n put<T>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<T> {\n return api.put<unknown, AxiosResponse<T>>(url, data, config).then((r) => r.data);\n },\n patch<T>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<T> {\n return api.patch<unknown, AxiosResponse<T>>(url, data, config).then((r) => r.data);\n },\n delete<T>(url: string, config?: AxiosRequestConfig): Promise<T> {\n return api.delete<unknown, AxiosResponse<T>>(url, config).then((r) => r.data);\n },\n // HEAD/OPTIONS responses carry no body; resolve to the full AxiosResponse\n // so callers can still inspect status and headers.\n head<T>(url: string, config?: AxiosRequestConfig): Promise<AxiosResponse<T>> {\n return api.head<unknown, AxiosResponse<T>>(url, config);\n },\n options<T>(url: string, config?: AxiosRequestConfig): Promise<AxiosResponse<T>> {\n return api.options<unknown, AxiosResponse<T>>(url, config);\n },\n};\n",
14
+ "content": "import axios, { type AxiosRequestConfig, type AxiosResponse, type InternalAxiosRequestConfig } from \"axios\";\n\n/**\n * Per-request opt-out for the framework's default error toast.\n *\n * By default every failed request surfaces the backend error via the\n * `onError` hook (currently wired to `toast.error` in request.ts). Set\n * `enabledDefaultErrorToast: false` when the caller renders its own richer\n * error UX (a confirm dialog, an inline form error, ...) so the same\n * failure is not surfaced twice. Defaults to true for backward safety.\n */\ndeclare module \"axios\" {\n interface AxiosRequestConfig {\n enabledDefaultErrorToast?: boolean;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Project-specific configuration — edit these for your backend contract.\n// ---------------------------------------------------------------------------\n\n/** Base URL of the API; same-origin by default. */\nconst BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL ?? \"\";\n\n/**\n * Legacy localStorage keys retired by ADR-040 (access token moved to memory).\n * Still referenced so startup can scrub values left behind by older sessions.\n */\nconst LEGACY_ACCESS_TOKEN_KEY = \"access-token\";\nconst LEGACY_ACCESS_TOKEN_EXPIRES_AT_KEY = \"access-token-expires-at\";\n\n/** Endpoint that exchanges the httpOnly refresh cookie for a new access token. */\nconst REFRESH_PATH = \"/auth/refresh-access-token\";\n\n/** Paths that must never trigger a silent refresh (would recurse). */\nconst AUTH_PATH_PATTERN = /^\\/auth\\//;\n\n/**\n * Hard ceiling for every API request, including the refresh exchange. Without\n * it a hung request (or a refresh that never settles) keeps `refreshPromise`\n * locked forever and every later 401 waits on it (R5-P2-13).\n */\nconst API_TIMEOUT_MS = 15_000;\n\n/** Cross-tab Web Lock that serializes refresh calls (see fewbie ADR-001). */\nconst REFRESH_LOCK_NAME = \"refresh-token\";\n\n/** Refresh this early so business requests never carry an expired token. */\nconst PROACTIVE_REFRESH_LEAD_MS = 60_000;\n\n/** How often the proactive scheduler checks expiry. */\nconst PROACTIVE_REFRESH_CHECK_INTERVAL_MS = 30_000;\n\n/**\n * Pause before retrying a failed refresh. When another tab rotates the\n * refresh cookie, the Set-Cookie reaches this tab a moment later; the retry\n * then carries the renewed cookie.\n */\nconst REFRESH_RETRY_DELAY_MS = 1_500;\n\n/**\n * Pause before the single cold-start retry. A tab that just regained network\n * (wifi rejoin, VPN up, laptop wake) normally succeeds on the second try, and\n * a longer wait would only delay the connection-error screen.\n */\nconst BOOTSTRAP_RETRY_DELAY_MS = 400;\n\n// ---------------------------------------------------------------------------\n// Response envelope (newbie backend contract)\n// ---------------------------------------------------------------------------\n\n/**\n * Standard JSON envelope: success is `{ code: 0, error: null, data }` and\n * failure is a non-2xx status with `{ code, error: { message }, data: null }`.\n */\nexport interface ApiEnvelope<T = unknown> {\n data?: T;\n code?: number;\n error?: { message?: string; description?: string } | null;\n}\n\n/** Whether a response body is a newbie envelope rather than a raw payload. */\nfunction isEnvelope(body: unknown): body is ApiEnvelope {\n if (body === null || typeof body !== \"object\") return false;\n if (Array.isArray(body)) return false;\n const record = body as Record<string, unknown>;\n // Every envelope carries both markers; a domain object that happens to\n // have a `data` field alone is not unwrapped.\n return \"code\" in record && \"data\" in record;\n}\n\n// ---------------------------------------------------------------------------\n// Auth failure classification (devbie ADR-048 §3–§4)\n// ---------------------------------------------------------------------------\n\n/**\n * Wire codes of the auth failure contract (devbie ADR-048 §3). They are\n * duplicated as numeric literals because this module runs in the browser and\n * cannot import the NestJS-side enum. The numbers are the wire contract and\n * never change; the member names here are local and may be renamed freely.\n */\nexport const AUTH_FAILURE_CODES = {\n Credential_Invalid: 1001,\n Credential_NotSet: 1002,\n Login_UserRateLimited: 1003,\n Login_IpRateLimited: 1004,\n ResetPassword_InvalidInput: 1005,\n ResetPassword_InvalidCode: 1006,\n Account_Closed: 1007,\n Account_Disabled: 1008,\n Account_Missing: 1101,\n Session_RefreshRejected: 1102,\n Session_AccessExpired: 1103,\n Session_Revoked: 1104,\n Session_Missing: 1105,\n Request_RateLimited: 2001,\n} as const;\n\nexport type AuthFailureCode = (typeof AUTH_FAILURE_CODES)[keyof typeof AUTH_FAILURE_CODES];\n\n/**\n * What a failed request means for the page and the session (ADR-048 §4).\n * Only `network` may block the whole page; every other kind is a\n * request-level error or an explicit redirect.\n */\nexport type SessionFailureKind =\n | \"network\"\n | \"account-blocked\"\n | \"session-terminated\"\n | \"access-expired\"\n | \"request-error\"\n | \"server-error\"\n | \"permission-denied\"\n | \"unknown\";\n\n/**\n * Explicit many-to-one code → kind map (ADR-048 §4). It cannot be derived\n * from the code list: four codes share `session-terminated` and seven share\n * `request-error` by design. `Record<AuthFailureCode, …>` makes the map\n * exhaustive — adding a code without a kind fails the build.\n */\nexport const CODE_TO_KIND: Record<AuthFailureCode, SessionFailureKind> = {\n [AUTH_FAILURE_CODES.Credential_Invalid]: \"request-error\",\n [AUTH_FAILURE_CODES.Credential_NotSet]: \"request-error\",\n [AUTH_FAILURE_CODES.Login_UserRateLimited]: \"request-error\",\n [AUTH_FAILURE_CODES.Login_IpRateLimited]: \"request-error\",\n [AUTH_FAILURE_CODES.ResetPassword_InvalidInput]: \"request-error\",\n [AUTH_FAILURE_CODES.ResetPassword_InvalidCode]: \"request-error\",\n [AUTH_FAILURE_CODES.Account_Closed]: \"account-blocked\",\n [AUTH_FAILURE_CODES.Account_Disabled]: \"account-blocked\",\n [AUTH_FAILURE_CODES.Account_Missing]: \"session-terminated\",\n [AUTH_FAILURE_CODES.Session_RefreshRejected]: \"session-terminated\",\n [AUTH_FAILURE_CODES.Session_AccessExpired]: \"access-expired\",\n [AUTH_FAILURE_CODES.Session_Revoked]: \"session-terminated\",\n [AUTH_FAILURE_CODES.Session_Missing]: \"session-terminated\",\n [AUTH_FAILURE_CODES.Request_RateLimited]: \"request-error\",\n};\n\nconst AUTH_FAILURE_CODE_SET = new Set<number>(Object.values(AUTH_FAILURE_CODES));\n\nfunction isAuthFailureCode(code: number | undefined): code is AuthFailureCode {\n return typeof code === \"number\" && AUTH_FAILURE_CODE_SET.has(code);\n}\n\n/**\n * Classify a failed request in the order fixed by ADR-048 §4 — the order is\n * part of the contract and the first match wins:\n *\n * 1. no HTTP response → `network`\n * 2. a contract code → its mapped kind\n * 3. 5xx → `server-error`\n * 4. uncoded 403 → `permission-denied`\n * 5. uncoded 401 → `session-terminated` (fail closed: it cannot be\n * refreshed, and calling it `unknown` would revive\n * the refresh → 401 loop this contract removes)\n * 6. any other uncoded 4xx → `unknown`\n */\nexport function classifyFailure(status: number, code?: number): SessionFailureKind {\n if (status === 0) return \"network\";\n if (isAuthFailureCode(code)) return CODE_TO_KIND[code];\n if (status >= 500) return \"server-error\";\n if (status === 403) return \"permission-denied\";\n if (status === 401) return \"session-terminated\";\n return \"unknown\";\n}\n\n/** Whether a silent refresh may be attempted for this 401 (ADR-048 §3). */\nfunction isRefreshable(kind: SessionFailureKind): boolean {\n return kind === \"access-expired\";\n}\n\n// ---------------------------------------------------------------------------\n// Token storage\n// ---------------------------------------------------------------------------\n\n/**\n * ADR-040: the access token lives only in this module's memory, never in\n * localStorage. A same-origin script can still read it for the current page\n * lifetime, but nothing survives a reload or leaves the tab, so one injection\n * no longer equals a durable, off-site reusable session. A cold start (or a\n * new tab) re-establishes the session by exchanging the httpOnly refresh\n * cookie via `bootstrapSession`.\n */\nlet accessToken = \"\";\n/** Expiry epoch of the in-memory token in milliseconds (0 when unknown). */\nlet accessTokenExpiresAt = 0;\nlet legacyKeysCleared = false;\n\n/** Scrub the retired localStorage keys left behind by older sessions. */\nfunction clearLegacyStorage(): void {\n if (typeof window === \"undefined\" || legacyKeysCleared) return;\n legacyKeysCleared = true;\n window.localStorage.removeItem(LEGACY_ACCESS_TOKEN_KEY);\n window.localStorage.removeItem(LEGACY_ACCESS_TOKEN_EXPIRES_AT_KEY);\n}\n\n// Scrub on module init so a stale token does not linger in a browser that\n// never reaches login or bootstrap in this page lifetime.\nif (typeof window !== \"undefined\") clearLegacyStorage();\n\nexport function getAccessToken(): string {\n if (typeof window === \"undefined\") return \"\";\n return accessToken;\n}\n\n/** Persist token + expiry after login or refresh (memory only). */\nexport function setSession(token: string, expiresInSeconds?: number): void {\n if (typeof window === \"undefined\") return;\n clearLegacyStorage();\n accessToken = token;\n // A fresh session re-arms the session-expired notification (R22-06).\n sessionExpiredNotified = false;\n accessTokenExpiresAt =\n typeof expiresInSeconds === \"number\" && expiresInSeconds > 0 ? Date.now() + expiresInSeconds * 1000 : 0;\n}\n\n/** Remove all locally held session data. */\nexport function clearSession(): void {\n if (typeof window === \"undefined\") return;\n accessToken = \"\";\n accessTokenExpiresAt = 0;\n clearLegacyStorage();\n}\n\n// Fires at most once per session: after the first notification the user is on\n// their way to the login page, so repeat calls (concurrent 401s, or the SSE\n// and axios paths racing) must not stack redirects (R22-06). setSession()\n// re-arms it.\nlet sessionExpiredNotified = false;\n\n/**\n * Why the session ended: a dead session goes to the plain login page, while a\n * disabled/closed account must land on the login page's notice banner\n * (ADR-048 §4).\n */\nexport type SessionEndReason = \"session-terminated\" | \"account-blocked\";\n\n/**\n * Fire the session-expired handler directly. Used by non-axios transports\n * (raw fetch for SSE streams) that can't go through the response interceptor\n * but still need the same \"refresh cookie gone → bounce to login\" path.\n */\nexport function triggerSessionExpired(reason: SessionEndReason = \"session-terminated\"): void {\n if (sessionExpiredNotified) return;\n sessionExpiredNotified = true;\n sessionExpiredHandler?.(reason);\n}\n\n/** Normalized error so callers never depend on the axios error shape. */\nexport class ApiError extends Error {\n readonly status: number;\n readonly code?: number;\n /** Page/session consequence of this failure (ADR-048 §4). */\n readonly kind: SessionFailureKind;\n readonly data: unknown;\n\n constructor(message: string, status: number, data?: unknown, code?: number) {\n super(message);\n this.name = \"ApiError\";\n this.status = status;\n this.code = code;\n this.kind = classifyFailure(status, code);\n this.data = data;\n }\n}\n\n/**\n * Hook invoked when the refresh cookie is missing/expired or the account\n * cannot continue. Wire it to your router (e.g. redirect to the login page);\n * the client itself stays router-agnostic.\n */\nlet sessionExpiredHandler: ((reason: SessionEndReason) => void) | null = null;\nexport function onSessionExpired(handler: (reason: SessionEndReason) => void): void {\n sessionExpiredHandler = handler;\n}\n\n/**\n * Hooks invoked exactly once per failed request, after any 401 refresh/replay\n * attempt has been exhausted. Wire them to your toast layer; the client itself\n * never imports a UI library.\n *\n * Subscribers are a Set rather than a single slot: a second mount (Strict Mode,\n * or a nested host) must not silently replace the first listener (R27-01).\n */\nconst errorHandlers = new Set<(error: ApiError) => void>();\n\n/**\n * Failures raised before any subscriber is registered (a request fired during\n * module init, ahead of the toast component's effect). They are replayed to the\n * first subscriber so such failures are not lost; bounded so a permanently\n * subscriber-less client cannot grow without limit.\n */\nconst pendingErrors: ApiError[] = [];\nconst MAX_PENDING_ERRORS = 5;\n\n/**\n * Register an error listener and return the unsubscribe function. Registering\n * flushes any failure buffered before the first listener existed.\n */\nexport function onError(handler: (error: ApiError) => void): () => void {\n errorHandlers.add(handler);\n if (pendingErrors.length > 0) {\n for (const error of pendingErrors.splice(0)) handler(error);\n }\n return () => {\n errorHandlers.delete(handler);\n };\n}\n\n/** Fan a failed request out to every subscriber, or buffer it until one exists. */\nfunction notifyError(error: ApiError): void {\n if (errorHandlers.size === 0) {\n if (pendingErrors.length >= MAX_PENDING_ERRORS) pendingErrors.shift();\n pendingErrors.push(error);\n return;\n }\n for (const handler of errorHandlers) handler(error);\n}\n\n// ---------------------------------------------------------------------------\n// Refresh-token rotation\n// ---------------------------------------------------------------------------\n\nfunction isUnauthorized(error: unknown): boolean {\n return axios.isAxiosError(error) && error.response?.status === 401;\n}\n\n/**\n * Whether the access token is still due for a refresh. After acquiring the\n * cross-tab lock, another tab may have already refreshed while we waited;\n * this check lets us skip the network call and reuse the new token.\n */\nfunction isRefreshStillDue(): boolean {\n if (!accessTokenExpiresAt) return true;\n return Date.now() >= accessTokenExpiresAt - PROACTIVE_REFRESH_LEAD_MS;\n}\n\n/** One refresh round-trip; persists the renewed token and its expiry. */\nasync function requestRefreshOnce(): Promise<string | null> {\n const response = await axios.get(`${BASE_URL}${REFRESH_PATH}`, {\n withCredentials: true,\n timeout: API_TIMEOUT_MS,\n });\n const body = response.data as ApiEnvelope<{\n token?: string;\n tokenExpiresInSeconds?: number;\n }>;\n const token = body?.data?.token ?? \"\";\n if (!token) return null;\n setSession(token, body.data?.tokenExpiresInSeconds);\n return token;\n}\n\n/**\n * Outcome of one refresh attempt: the renewed token plus whether the session\n * is definitively over.\n */\nexport interface RefreshOutcome {\n token: string | null;\n /**\n * True only when the server rejected the refresh exchange (401/400), the\n * account is blocked (coded 403), or a 2xx response carried no token — i.e.\n * the refresh credential can never succeed. Network errors and 5xx are\n * transient: the session must be kept and the caller surfaces the original\n * failure instead of forcing a logout (R22-05).\n */\n sessionOver: boolean;\n /** Why the session ended; undefined while it is still alive (ADR-048). */\n kind?: SessionEndReason;\n}\n\n/** Send the refresh request with one retry on 401 (cross-tab cookie race). */\nasync function requestRefreshWithRetry(): Promise<RefreshOutcome> {\n const classify = (error: unknown): RefreshOutcome => {\n if (!axios.isAxiosError(error)) return { token: null, sessionOver: false };\n const status = error.response?.status ?? 0;\n const body = error.response?.data as ApiEnvelope | undefined;\n const kind = classifyFailure(status, body?.code);\n // A disabled or closed account is a definitive end, but a distinct one:\n // the login page shows the account notice instead of a plain form.\n if (kind === \"account-blocked\") return { token: null, sessionOver: true, kind };\n // Any 401 from the refresh exchange, and a 400 on its input, means the\n // refresh credential can never succeed — a retry cannot fix it.\n if (status === 401 || status === 400) return { token: null, sessionOver: true, kind: \"session-terminated\" };\n // Offline, timeout, 5xx: transient, the session survives (R22-05).\n return { token: null, sessionOver: false };\n };\n try {\n const token = await requestRefreshOnce();\n return { token, sessionOver: token === null };\n } catch (firstError) {\n if (isUnauthorized(firstError)) {\n // Possible cross-tab rotation race: retry once with the renewed cookie.\n await new Promise((resolve) => setTimeout(resolve, REFRESH_RETRY_DELAY_MS));\n try {\n const token = await requestRefreshOnce();\n return { token, sessionOver: token === null };\n } catch (secondError) {\n return classify(secondError);\n }\n }\n // Network or other non-auth failure: nothing a retry can fix.\n return classify(firstError);\n }\n}\n\n// Shared in-flight refresh. The backend rotates the refresh cookie on every\n// call, so concurrent 401s must await the same request instead of issuing\n// parallel refreshes that invalidate each other's cookie.\nlet refreshPromise: Promise<RefreshOutcome> | null = null;\n/** Whether the in-flight refresh was started with force=true (R20-12). */\nlet refreshPromiseForced = false;\n\n/**\n * Exchange the httpOnly refresh cookie for a new access token.\n *\n * Two layers of dedup prevent concurrent refresh calls that would trigger\n * the backend's refresh-token-reuse detection and revoke the session:\n * 1. Single-tab: module-level refreshPromise — concurrent 401s in this tab\n * reuse the same promise.\n * 2. Cross-tab: Web Locks (navigator.locks) serialize refreshes across tabs.\n * After acquiring the lock, re-check whether refresh is still needed.\n * Pass force=true from the 401 reactive path: a 401 proves the token is\n * invalid regardless of the stored expiry, so the lock-time re-check must\n * not short-circuit. A forced caller must not ride a non-forced in-flight\n * refresh either — that promise may resolve through the not-due shortcut\n * with a token the server already rejects — so it chains a forced refresh\n * after the in-flight one instead (R20-12). Environments without Web Locks\n * fall back to the single-flight + retry mitigation.\n *\n * Exported so non-axios transports (raw fetch for SSE streams) can also\n * participate in the 401 silent-refresh chain. The outcome distinguishes a\n * dead refresh credential (`sessionOver`) from a transient failure, so\n * callers only end the session on the former (R22-05).\n */\nexport function refreshAccessToken(force = false): Promise<RefreshOutcome> {\n if (refreshPromise) {\n if (!force || refreshPromiseForced) return refreshPromise;\n return refreshPromise.then((outcome) => (outcome.sessionOver ? outcome : refreshAccessToken(true)));\n }\n\n refreshPromiseForced = force;\n refreshPromise = (async (): Promise<RefreshOutcome> => {\n try {\n if (typeof navigator !== \"undefined\" && navigator.locks) {\n let acquired = false;\n try {\n return await navigator.locks.request(REFRESH_LOCK_NAME, async () => {\n acquired = true;\n if (!force && !isRefreshStillDue()) return { token: getAccessToken(), sessionOver: false };\n return requestRefreshWithRetry();\n });\n } catch (error) {\n // Acquisition can fail for reasons other than contention: a document\n // that is not fully active (prerender, bfcache, unloading) rejects\n // the lock request outright. Every acquisition failure must fall\n // back to the unlocked exchange — otherwise the rejection escapes\n // bootstrapSession, whose callers only handle the outcome states,\n // and the cold start hangs instead of reaching login.\n if (!acquired) return requestRefreshWithRetry();\n throw error;\n }\n }\n // The await matters: without it the finally below runs at construction\n // time and refreshPromise would keep the settled outcome forever, so\n // no-locks environments could never refresh again (R20-12).\n return await requestRefreshWithRetry();\n } finally {\n refreshPromise = null;\n refreshPromiseForced = false;\n }\n })();\n\n return refreshPromise;\n}\n\n/**\n * Result of establishing the in-memory session on a cold start (ADR-040).\n *\n * The states matter because \"the backend said no\" and \"the backend could not\n * be reached\" lead to opposite UI decisions: the first is a real logout, the\n * second must keep the user on the page (R22-05). `blocked` is the third\n * outcome of a real logout: the account itself is disabled or closed, so the\n * login page must show that notice instead of a plain form (ADR-048 §4).\n */\nexport type SessionBootstrapOutcome =\n | { status: \"authenticated\"; token: string }\n | { status: \"anonymous\" }\n | { status: \"blocked\" }\n | { status: \"unavailable\" };\n\n/** Signed out vs. account blocked: both end the session, differently (§4). */\nfunction sessionEndedOutcome(outcome: RefreshOutcome): SessionBootstrapOutcome {\n return outcome.kind === \"account-blocked\" ? { status: \"blocked\" } : { status: \"anonymous\" };\n}\n\n/**\n * Establish the in-memory session on a cold start or a new tab (ADR-040).\n *\n * The access token is no longer persisted, so \"am I signed in?\" can only be\n * answered by exchanging the httpOnly refresh cookie. A forced refresh is\n * used so the lock-time not-due shortcut cannot return an empty token, and it\n * shares the single-flight promise with any 401 refresh already in flight, so\n * a cold start rotates the refresh cookie exactly once.\n *\n * A rejected exchange (401/400 or a 2xx without a token) means anonymous. A\n * transient failure is retried once — that absorbs the \"network just came\n * back\" window — and only then reported as unavailable, so a flaky connection\n * never masquerades as a signed-out user.\n */\nexport async function bootstrapSession(): Promise<SessionBootstrapOutcome> {\n if (typeof window === \"undefined\") return { status: \"unavailable\" };\n const existing = getAccessToken();\n if (existing) return { status: \"authenticated\", token: existing };\n\n const outcome = await refreshAccessToken(true);\n if (outcome.token) return { status: \"authenticated\", token: outcome.token };\n if (outcome.sessionOver) return sessionEndedOutcome(outcome);\n\n await new Promise((resolve) => setTimeout(resolve, BOOTSTRAP_RETRY_DELAY_MS));\n const retried = await refreshAccessToken(true);\n if (retried.token) return { status: \"authenticated\", token: retried.token };\n return retried.sessionOver ? sessionEndedOutcome(retried) : { status: \"unavailable\" };\n}\n\n/** Read the failure kind from a raw fetch response without consuming it. */\nasync function failureKindOfResponse(response: Response): Promise<SessionFailureKind> {\n try {\n const body = (await response.clone().json()) as ApiEnvelope;\n return classifyFailure(response.status, body?.code);\n } catch {\n // Non-JSON body (empty 401, gateway page): classify on the status alone,\n // which keeps an unrecognized 401 failing closed.\n return classifyFailure(response.status);\n }\n}\n\n/**\n * Shared 401 handling for non-axios transports (raw fetch for SSE streams):\n * refresh only an expired access token, then replay once with the renewed\n * token. The session ends when the refresh credential is dead or the 401 is\n * not refreshable; a transient refresh failure keeps the session and hands the\n * original 401 back to the caller (R22-05, R23-06, ADR-048 §4).\n */\nexport async function replayOnUnauthorized(\n response: Response,\n replay: (token: string) => Promise<Response>,\n): Promise<Response> {\n if (response.status !== 401) return response;\n // Only an expired access token may be refreshed (ADR-048 §3); every other\n // 401 — including a code this build does not know — ends the session.\n if (!isRefreshable(await failureKindOfResponse(response))) {\n clearSession();\n triggerSessionExpired(\"session-terminated\");\n return response;\n }\n const outcome = await refreshAccessToken(true);\n if (outcome.token) return replay(outcome.token);\n if (outcome.sessionOver) {\n // Dead refresh credential: same session-end path as the axios interceptor.\n clearSession();\n triggerSessionExpired(outcome.kind ?? \"session-terminated\");\n }\n return response;\n}\n\n// ---------------------------------------------------------------------------\n// Proactive refresh scheduler (module-level singleton)\n// ---------------------------------------------------------------------------\n\nlet schedulerTimer: ReturnType<typeof setInterval> | null = null;\n\n/**\n * Start the scheduler that renews the token shortly before expiry. Call once\n * on the client (e.g. in the authenticated layout). Reactive 401 refresh\n * stays as a fallback for laptop sleep / scheduler drift.\n */\nexport function initProactiveTokenRefresh(): void {\n if (typeof window === \"undefined\" || schedulerTimer) return;\n\n const refreshIfDue = (): void => {\n const token = getAccessToken();\n if (!token) return;\n // A session without a known expiry (a provider that omitted expiresIn)\n // still needs renewal: refresh now and persist the expiry the backend\n // returns, instead of never scheduling a refresh.\n if (!accessTokenExpiresAt || Date.now() >= accessTokenExpiresAt - PROACTIVE_REFRESH_LEAD_MS) {\n void refreshAccessToken().then((outcome) => {\n // A dead refresh cookie found proactively bounces to login now\n // instead of waiting for the next business request to 401 (R22-05).\n if (outcome.sessionOver) {\n clearSession();\n triggerSessionExpired(outcome.kind ?? \"session-terminated\");\n }\n });\n }\n };\n\n // Run immediately (tabs reopened after sleep) and then on an interval.\n refreshIfDue();\n schedulerTimer = setInterval(refreshIfDue, PROACTIVE_REFRESH_CHECK_INTERVAL_MS);\n}\n\n// ---------------------------------------------------------------------------\n// Error normalization (the single failure channel)\n// ---------------------------------------------------------------------------\n\n/** Map any thrown value to the normalized ApiError shape. */\nfunction toApiError(error: unknown): ApiError {\n if (error instanceof ApiError) return error;\n if (axios.isAxiosError(error)) {\n const body = error.response?.data as ApiEnvelope | undefined;\n return new ApiError(\n body?.error?.message ?? error.message,\n error.response?.status ?? 0,\n body ?? error.response?.data,\n body?.code,\n );\n }\n if (error instanceof Error) return new ApiError(error.message, 0);\n return new ApiError(\"Request failed\", 0);\n}\n\n// ---------------------------------------------------------------------------\n// Axios instance\n// ---------------------------------------------------------------------------\n\nexport const api = axios.create({\n baseURL: BASE_URL,\n withCredentials: true,\n timeout: API_TIMEOUT_MS,\n});\n\n/**\n * Absolute URL: either scheme-qualified (`https://host/...`) or protocol-relative\n * (`//host/...`), both of which resolve away from the page origin.\n */\nconst ABSOLUTE_URL_PATTERN = /^(?:[a-z][a-z\\d+\\-.]*:|\\/\\/)/i;\n\nfunction pageOrigin(): string {\n return typeof window !== \"undefined\" ? window.location.origin : \"http://localhost\";\n}\n\n/**\n * Whether a request target resolves to the one origin we may send the bearer\n * token to: the origin of `NEXT_PUBLIC_BASE_URL` when it is absolute, or the\n * page origin when it is relative/empty (the reverse-proxied deployment).\n *\n * Two leaks this closes:\n * - an absolute per-request URL pointing at a third party (R23-02);\n * - a caller-supplied base URL pointing off-site, which the previous check\n * accepted because it compared the target against that same base — so the\n * raw-fetch SSE transports bypassing axios had no working guard at all\n * (R24-04).\n *\n * A relative base such as `/api` must count as our own origin: `new URL(url,\n * \"/api\")` throws, and the old guard swallowed the throw and silently dropped\n * the token on every request.\n *\n * Exported so non-axios transports apply the same judgement instead of a\n * second copy.\n */\nexport function isTrustedApiTarget(url: string | undefined, baseUrl: string | undefined = BASE_URL): boolean {\n const origin = pageOrigin();\n const configured = BASE_URL;\n const base = baseUrl ?? configured;\n const target = ABSOLUTE_URL_PATTERN.test(url ?? \"\") ? (url ?? \"\") : `${base}${url ?? \"\"}`;\n try {\n const trustedOrigin = ABSOLUTE_URL_PATTERN.test(configured) ? new URL(configured).origin : origin;\n return new URL(target, origin).origin === trustedOrigin;\n } catch {\n return false;\n }\n}\n\napi.interceptors.request.use((config) => {\n const token = getAccessToken();\n // Within the interceptor chain headers is always an AxiosHeaders instance.\n if (token && isTrustedApiTarget(config.url, config.baseURL ?? BASE_URL)) {\n config.headers.set(\"Authorization\", `Bearer ${token}`);\n }\n return config;\n});\n\n/**\n * Request config fields owned by the response interceptor.\n *\n * `_retriedAfterRefresh` marks a request that already went through the silent\n * refresh + replay chain once, so a second 401 does not recurse.\n */\ntype RotatingRequestConfig = InternalAxiosRequestConfig & {\n _retriedAfterRefresh?: boolean;\n};\n\n// Success channel: only unwrap the envelope; failures never arrive here\n// (they carry non-2xx status — see newbie ADR-001).\napi.interceptors.response.use(\n (response) => {\n if (isEnvelope(response.data)) {\n return { ...response, data: response.data.data };\n }\n return response;\n },\n async (error) => {\n const original = error?.config as RotatingRequestConfig | undefined;\n const url: string = original?.url ?? \"\";\n const canSilentlyRefresh =\n typeof window !== \"undefined\" && !original?._retriedAfterRefresh && !AUTH_PATH_PATTERN.test(url);\n\n // Single normalization for every final failure: the kind decides both the\n // refresh policy and what the UI shows (ADR-048 §4).\n const normalized = toApiError(error);\n\n if (isUnauthorized(error) && original && canSilentlyRefresh) {\n if (isRefreshable(normalized.kind)) {\n original._retriedAfterRefresh = true;\n const outcome = await refreshAccessToken(true);\n if (outcome.token) {\n original.headers.set(\"Authorization\", `Bearer ${outcome.token}`);\n // Replay goes through the same interceptor chain; its outcome is\n // returned directly so this failure never reaches the handler.\n return api(original);\n }\n if (outcome.sessionOver) {\n // The server rejected the refresh credential: the session is over.\n clearSession();\n triggerSessionExpired(outcome.kind ?? \"session-terminated\");\n // This request failed because the session was already gone; the user\n // is being bounced to the login page, so its message is noise\n // (R21-01). Suppress it through the public per-request opt-out rather\n // than a private marker — one suppression concept, not two (R22-01).\n original.enabledDefaultErrorToast = false;\n }\n // Transient refresh failure (offline/5xx): keep the session and let the\n // original 401 surface normally (R22-05).\n } else {\n // A terminal 401, or a code this build does not recognize: fail closed\n // instead of refreshing into another 401 (ADR-048 INV-4).\n clearSession();\n triggerSessionExpired(\"session-terminated\");\n original.enabledDefaultErrorToast = false;\n }\n } else if (normalized.kind === \"account-blocked\") {\n // A disabled/closed account on any request (including the refresh\n // exchange): same end state, but the login page must show the notice.\n clearSession();\n triggerSessionExpired(\"account-blocked\");\n if (original) original.enabledDefaultErrorToast = false;\n } else if (normalized.kind === \"session-terminated\" && !AUTH_PATH_PATTERN.test(url)) {\n // A terminal 401 from a non-axios-flagged path (e.g. the request already\n // replayed once): the session cannot be revived.\n clearSession();\n triggerSessionExpired(\"session-terminated\");\n if (original) original.enabledDefaultErrorToast = false;\n }\n\n // Callers that render their own error UX pass enabledDefaultErrorToast:\n // false to suppress the default toast and avoid double notification.\n if (error?.config?.enabledDefaultErrorToast !== false) {\n notifyError(normalized);\n }\n throw normalized;\n },\n);\n\n// ---------------------------------------------------------------------------\n// Typed convenience methods — resolve to the unwrapped response body.\n// ---------------------------------------------------------------------------\n\nexport const apiClient = {\n get<T>(url: string, config?: AxiosRequestConfig): Promise<T> {\n return api.get<unknown, AxiosResponse<T>>(url, config).then((r) => r.data);\n },\n post<T>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<T> {\n return api.post<unknown, AxiosResponse<T>>(url, data, config).then((r) => r.data);\n },\n put<T>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<T> {\n return api.put<unknown, AxiosResponse<T>>(url, data, config).then((r) => r.data);\n },\n patch<T>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<T> {\n return api.patch<unknown, AxiosResponse<T>>(url, data, config).then((r) => r.data);\n },\n delete<T>(url: string, config?: AxiosRequestConfig): Promise<T> {\n return api.delete<unknown, AxiosResponse<T>>(url, config).then((r) => r.data);\n },\n // HEAD/OPTIONS responses carry no body; resolve to the full AxiosResponse\n // so callers can still inspect status and headers.\n head<T>(url: string, config?: AxiosRequestConfig): Promise<AxiosResponse<T>> {\n return api.head<unknown, AxiosResponse<T>>(url, config);\n },\n options<T>(url: string, config?: AxiosRequestConfig): Promise<AxiosResponse<T>> {\n return api.options<unknown, AxiosResponse<T>>(url, config);\n },\n};\n",
15
15
  "type": "registry:lib"
16
16
  }
17
17
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devbie/fewbie-cli",
3
- "version": "1.6.1",
3
+ "version": "1.6.3",
4
4
  "description": "fewbie frontend framework CLI",
5
5
  "license": "MIT",
6
6
  "author": "worldzhy",
@@ -24,6 +24,7 @@
24
24
  "test": "node --import tsx --test test/*.test.ts",
25
25
  "check:template-drift": "node --import tsx scripts/check-template-drift.ts",
26
26
  "check:template-deps": "node --import tsx scripts/check-template-deps.ts",
27
+ "check:registry-dist": "node --import tsx scripts/check-registry-dist.ts",
27
28
  "prepublishOnly": "npm run build"
28
29
  },
29
30
  "dependencies": {