@securitydept/client 0.3.0-beta.2 → 0.3.0-beta.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.
- package/dist/auth-coordination/index.d.mts +1 -1
- package/dist/auth-coordination/index.mjs +1 -1
- package/dist/auth-coordination/index.mjs.map +1 -1
- package/dist/{fetch-transport-DtnSRWAH.mjs → client-environment-CaumNmir.mjs} +187 -6
- package/dist/client-environment-CaumNmir.mjs.map +1 -0
- package/dist/{fetch-transport-Bd5RyWj2.d.mts → client-environment-CdHtVxKW.d.mts} +70 -8
- package/dist/events/index.d.mts +1 -1
- package/dist/events-BUlfsRfl.mjs.map +1 -1
- package/dist/{index-C_wgl6dW.d.mts → index-C4xlKhG7.d.mts} +2 -2
- package/dist/{index-DbYSFHDe.d.mts → index-COUt5x9Z.d.mts} +2 -2
- package/dist/index.d.mts +10 -10
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/persistence/index.d.mts +2 -2
- package/dist/persistence/web/index.d.mts +1 -1
- package/dist/persistence/web/index.mjs +1 -50
- package/dist/persistence-CSB8770k.mjs.map +1 -1
- package/dist/{planner-host-CV38bMSn.mjs → planner-host-BTWie0lo.mjs} +3 -1
- package/dist/{planner-host-CV38bMSn.mjs.map → planner-host-BTWie0lo.mjs.map} +1 -1
- package/dist/{planner-host-CPyGNyQV.d.mts → planner-host-DN9dRsQx.d.mts} +1 -1
- package/dist/{types-DQc088ZP.d.mts → types-BJqUdH2e.d.mts} +1 -1
- package/dist/{types-C59fcM5W.d.mts → types-BwcnUGNl.d.mts} +1 -1
- package/dist/web/index.d.mts +40 -12
- package/dist/web/index.mjs +104 -14
- package/dist/web/index.mjs.map +1 -1
- package/dist/web-DQmMqZnR.mjs +51 -0
- package/dist/web-DQmMqZnR.mjs.map +1 -0
- package/dist/web-router/index.d.mts +1 -1
- package/dist/web-router/index.mjs +1 -1
- package/dist/web-router/index.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/fetch-transport-DtnSRWAH.mjs.map +0 -1
- package/dist/persistence/web/index.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as PlannerHostResult, c as ScopedRequirementsClientSet, i as PlannerHost, l as createPlannerHost, n as CandidateSelector, o as RequirementsClientSet, r as CreatePlannerHostOptions, s as RequirementsClientSetComposition, t as AuthGuardClientOption, u as resolveEffectiveClientSet } from "../planner-host-
|
|
1
|
+
import { a as PlannerHostResult, c as ScopedRequirementsClientSet, i as PlannerHost, l as createPlannerHost, n as CandidateSelector, o as RequirementsClientSet, r as CreatePlannerHostOptions, s as RequirementsClientSetComposition, t as AuthGuardClientOption, u as resolveEffectiveClientSet } from "../planner-host-DN9dRsQx.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/auth-coordination/requirement-planner.d.ts
|
|
4
4
|
/** A single auth requirement within an orchestration plan. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as RequirementPlannerError, i as PlanStatus, n as createPlannerHost, o as ResolutionStatus, r as resolveEffectiveClientSet, s as createRequirementPlanner, t as RequirementsClientSetComposition } from "../planner-host-
|
|
1
|
+
import { a as RequirementPlannerError, i as PlanStatus, n as createPlannerHost, o as ResolutionStatus, r as resolveEffectiveClientSet, s as createRequirementPlanner, t as RequirementsClientSetComposition } from "../planner-host-BTWie0lo.mjs";
|
|
2
2
|
//#region src/auth-coordination/route-orchestrator.ts
|
|
3
3
|
/** Merge a matched route chain into a flat requirement list (parent-first). */
|
|
4
4
|
function mergeChainRequirements(chain) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/auth-coordination/route-orchestrator.ts"],"sourcesContent":["// Shared auth route orchestrator — headless router integration baseline\n//\n// Canonical location: @securitydept/client/auth-coordination\n//\n// Provides a minimal, framework-agnostic glue layer between route-level auth\n// requirements and the RequirementPlanner, driven by a matched route chain\n// (not a single flat routeId).\n//\n// Core design choices (absorbing Angular Router + TanStack Router patterns):\n// - Input is a **matched route chain** (parent → child → grandchild),\n// mirroring Angular's `ActivatedRouteSnapshot[]` and TanStack's matched route tree.\n// - Parent requirements are **inherited** by children by default.\n// - Children can **append** additional requirements.\n// - The orchestrator merges the full chain into a single effective requirement plan.\n// - Route transitions diff the chain: shared prefix requirements/decisions\n// are preserved; diverging suffix requirements/decisions are discarded.\n//\n// Architecture boundary:\n// - This module does NOT own the router, render UI, or manage navigation.\n// - It provides the headless orchestration contract that the router calls into.\n// - The adopter is responsible for translating \"pending requirement\" into\n// the appropriate auth action (redirect, popup, etc.) and calling back\n// with the resolution.\n//\n// Owner rationale: This orchestrator depends only on RouteMatchNode[] (a shared\n// contract) and RequirementPlanner (also in this module). It does not depend on\n// token-set material, OIDC protocol details, or any framework specifics.\n// Canonical owner is @securitydept/client.\n\nimport type {\n\tAuthRequirement,\n\tPlanSnapshot,\n\tRequirementPlanner,\n\tRequirementResolution,\n} from \"./requirement-planner\";\nimport { createRequirementPlanner, PlanStatus } from \"./requirement-planner\";\n\n// ---------------------------------------------------------------------------\n// Route match node types\n// ---------------------------------------------------------------------------\n\n/**\n * A single node in a matched route chain.\n *\n * The adopter maps their framework's route match result into this contract:\n * - Angular: `ActivatedRouteSnapshot` → `RouteMatchNode`\n * - TanStack Router: matched route entry → `RouteMatchNode`\n * - Any other: route guard / middleware context → `RouteMatchNode`\n */\nexport interface RouteMatchNode {\n\t/** Route segment identifier (e.g. route name or path pattern). */\n\trouteId: string;\n\t/** Auth requirements declared on this route segment. */\n\trequirements: readonly AuthRequirement[];\n}\n\n/** Chooser decision: which provider/action to use for a pending requirement. */\nexport interface ChooserDecision {\n\t/** The requirement ID this decision applies to. */\n\trequirementId: string;\n\t/** The chosen provider or action identifier. */\n\tproviderId: string;\n\t/** Optional metadata for the chosen action. */\n\tmetadata?: Record<string, unknown>;\n}\n\n/** Snapshot of the current route orchestration state. */\nexport interface RouteOrchestrationSnapshot {\n\t/** The matched route chain, or empty if no route is active. */\n\tmatchedRoutes: readonly RouteMatchNode[];\n\t/** The leaf route ID (last in chain), or null if no route is active. */\n\tactiveRouteId: string | null;\n\t/** The planner snapshot for the merged requirements, or null if no route. */\n\tplan: PlanSnapshot | null;\n\t/** Whether all merged requirements are fully settled. */\n\tsettled: boolean;\n\t/** The pending requirement that needs a chooser decision, or null. */\n\tpendingRequirement: AuthRequirement | null;\n}\n\n// ---------------------------------------------------------------------------\n// Route requirement orchestrator\n// ---------------------------------------------------------------------------\n\n/** Options for {@link createRouteRequirementOrchestrator}. */\nexport interface CreateRouteRequirementOrchestratorOptions {\n\t/**\n\t * Optional callback fired when the orchestrator needs the adopter to\n\t * act on a pending requirement (e.g. show a chooser UI or auto-redirect).\n\t */\n\tonPendingRequirement?: (requirement: AuthRequirement) => void;\n\n\t/**\n\t * Optional callback fired when all requirements for the active route\n\t * are settled.\n\t */\n\tonSettled?: (\n\t\trouteId: string,\n\t\tresolutions: readonly RequirementResolution[],\n\t) => void;\n}\n\n/**\n * Headless route requirement orchestrator.\n *\n * Driven by a matched route chain: the adopter maps their framework's\n * route match result into `RouteMatchNode[]` and calls `activateMatchedRoutes`.\n * Parent requirements are inherited; children append.\n */\nexport interface RouteRequirementOrchestrator {\n\t/** Get a snapshot of the current route orchestration state. */\n\tsnapshot(): RouteOrchestrationSnapshot;\n\n\t/**\n\t * Activate a matched route chain.\n\t *\n\t * Requirements are inherited: parent requirements come first, children append.\n\t * On route transition, shared-prefix requirements and their resolutions\n\t * are preserved; diverging requirements are re-planned.\n\t */\n\tactivateMatchedRoutes(matchedRoutes: readonly RouteMatchNode[]): void;\n\n\t/**\n\t * Resolve the current pending requirement.\n\t * Advances to the next requirement or settles the plan.\n\t */\n\tresolve(resolution: RequirementResolution): void;\n\n\t/**\n\t * Record a chooser decision for the current pending requirement.\n\t */\n\tapplyChooserDecision(decision: ChooserDecision): void;\n\n\t/**\n\t * Reset the active route (e.g. on navigation away or logout).\n\t */\n\tdeactivateRoute(): void;\n\n\t/** All chooser decisions made during the current route activation. */\n\treadonly decisions: readonly ChooserDecision[];\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\n/** Merge a matched route chain into a flat requirement list (parent-first). */\nfunction mergeChainRequirements(\n\tchain: readonly RouteMatchNode[],\n): AuthRequirement[] {\n\tconst merged: AuthRequirement[] = [];\n\tconst seenIds = new Set<string>();\n\tfor (const node of chain) {\n\t\tfor (const req of node.requirements) {\n\t\t\t// Deduplicate by requirement ID — later (child) definitions win.\n\t\t\tif (seenIds.has(req.id)) continue;\n\t\t\tseenIds.add(req.id);\n\t\t\tmerged.push(req);\n\t\t}\n\t}\n\treturn merged;\n}\n\n/**\n * Find the length of the shared requirement prefix between old and new chains.\n * Used to determine which resolutions can be preserved on route transition.\n */\nfunction sharedPrefixLength(\n\toldReqs: readonly AuthRequirement[],\n\tnewReqs: readonly AuthRequirement[],\n): number {\n\tconst limit = Math.min(oldReqs.length, newReqs.length);\n\tfor (let i = 0; i < limit; i++) {\n\t\tif (oldReqs[i].id !== newReqs[i].id || oldReqs[i].kind !== newReqs[i].kind)\n\t\t\treturn i;\n\t}\n\treturn limit;\n}\n\n// ---------------------------------------------------------------------------\n// Factory\n// ---------------------------------------------------------------------------\n\nexport function createRouteRequirementOrchestrator(\n\toptions: CreateRouteRequirementOrchestratorOptions = {},\n): RouteRequirementOrchestrator {\n\tlet matchedRoutes: RouteMatchNode[] = [];\n\tlet activeRouteId: string | null = null;\n\tlet planner: RequirementPlanner | null = null;\n\tlet decisions: ChooserDecision[] = [];\n\tlet currentMergedReqs: AuthRequirement[] = [];\n\n\tfunction emitPendingIfNeeded(): void {\n\t\tif (!planner || !options.onPendingRequirement) return;\n\t\tconst snap = planner.snapshot();\n\t\tif (snap.nextPending) {\n\t\t\toptions.onPendingRequirement(snap.nextPending);\n\t\t}\n\t}\n\n\tfunction emitSettledIfNeeded(): void {\n\t\tif (!planner || !activeRouteId || !options.onSettled) return;\n\t\tconst snap = planner.snapshot();\n\t\tif (snap.status === PlanStatus.Settled) {\n\t\t\toptions.onSettled(activeRouteId, snap.resolutions);\n\t\t}\n\t}\n\n\tfunction activateWithChain(chain: readonly RouteMatchNode[]): void {\n\t\tconst newMerged = mergeChainRequirements(chain);\n\t\tif (newMerged.length === 0) {\n\t\t\t// No requirements — treat as deactivation.\n\t\t\tmatchedRoutes = [...chain];\n\t\t\tactiveRouteId = chain.length > 0 ? chain[chain.length - 1].routeId : null;\n\t\t\tplanner = null;\n\t\t\tcurrentMergedReqs = [];\n\t\t\tdecisions = [];\n\t\t\treturn;\n\t\t}\n\n\t\t// Determine shared prefix to preserve existing resolutions.\n\t\tconst shared = sharedPrefixLength(currentMergedReqs, newMerged);\n\n\t\t// Collect resolutions from the current planner that can be preserved.\n\t\tlet preservedResolutions: RequirementResolution[] = [];\n\t\tif (planner && shared > 0) {\n\t\t\tconst oldSnap = planner.snapshot();\n\t\t\tpreservedResolutions = oldSnap.resolutions.slice(0, shared);\n\t\t}\n\n\t\t// Preserve decisions whose requirementIds are in the shared prefix.\n\t\tconst sharedReqIds = new Set(newMerged.slice(0, shared).map((r) => r.id));\n\t\tdecisions = decisions.filter((d) => sharedReqIds.has(d.requirementId));\n\n\t\t// Create new planner with full merged requirements.\n\t\tmatchedRoutes = [...chain];\n\t\tactiveRouteId = chain[chain.length - 1].routeId;\n\t\tcurrentMergedReqs = newMerged;\n\t\tplanner = createRequirementPlanner({ requirements: newMerged });\n\n\t\t// Re-apply preserved resolutions.\n\t\tfor (const res of preservedResolutions) {\n\t\t\tplanner.resolve(res);\n\t\t}\n\n\t\temitPendingIfNeeded();\n\t\temitSettledIfNeeded();\n\t}\n\n\treturn {\n\t\tsnapshot(): RouteOrchestrationSnapshot {\n\t\t\tif (!planner || !activeRouteId) {\n\t\t\t\treturn {\n\t\t\t\t\tmatchedRoutes: [...matchedRoutes],\n\t\t\t\t\tactiveRouteId,\n\t\t\t\t\tplan: null,\n\t\t\t\t\tsettled: matchedRoutes.length > 0 && currentMergedReqs.length === 0,\n\t\t\t\t\tpendingRequirement: null,\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst plan = planner.snapshot();\n\t\t\treturn {\n\t\t\t\tmatchedRoutes: [...matchedRoutes],\n\t\t\t\tactiveRouteId,\n\t\t\t\tplan,\n\t\t\t\tsettled: plan.status === PlanStatus.Settled,\n\t\t\t\tpendingRequirement: plan.nextPending,\n\t\t\t};\n\t\t},\n\n\t\tactivateMatchedRoutes(chain: readonly RouteMatchNode[]): void {\n\t\t\tactivateWithChain(chain);\n\t\t},\n\n\t\tresolve(resolution: RequirementResolution): void {\n\t\t\tif (!planner) {\n\t\t\t\tthrow new Error(\"Cannot resolve: no active route\");\n\t\t\t}\n\t\t\tplanner.resolve(resolution);\n\t\t\temitSettledIfNeeded();\n\t\t\tif (planner.snapshot().status === PlanStatus.Pending) {\n\t\t\t\temitPendingIfNeeded();\n\t\t\t}\n\t\t},\n\n\t\tapplyChooserDecision(decision: ChooserDecision): void {\n\t\t\tdecisions.push(decision);\n\t\t},\n\n\t\tdeactivateRoute(): void {\n\t\t\tactiveRouteId = null;\n\t\t\tplanner = null;\n\t\t\tmatchedRoutes = [];\n\t\t\tdecisions = [];\n\t\t\tcurrentMergedReqs = [];\n\t\t},\n\n\t\tget decisions(): readonly ChooserDecision[] {\n\t\t\treturn decisions;\n\t\t},\n\t};\n}\n"],"mappings":";;;AAmJA,SAAS,uBACR,OACoB;CACpB,MAAM,SAA4B,EAAE;CACpC,MAAM,0BAAU,IAAI,KAAa;AACjC,MAAK,MAAM,QAAQ,MAClB,MAAK,MAAM,OAAO,KAAK,cAAc;AAEpC,MAAI,QAAQ,IAAI,IAAI,GAAG,CAAE;AACzB,UAAQ,IAAI,IAAI,GAAG;AACnB,SAAO,KAAK,IAAI;;AAGlB,QAAO;;;;;;AAOR,SAAS,mBACR,SACA,SACS;CACT,MAAM,QAAQ,KAAK,IAAI,QAAQ,QAAQ,QAAQ,OAAO;AACtD,MAAK,IAAI,IAAI,GAAG,IAAI,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sBAAoB;AACpB,YAAU,yBAAyB,EAAE,cAAc,WAAW,CAAC;AAG/D,OAAK,MAAM,OAAO,qBACjB,SAAQ,QAAQ,IAAI;AAGrB,uBAAqB;AACrB,uBAAqB;;AAGtB,QAAO;EACN,WAAuC;AACtC,OAAI,CAAC,WAAW,CAAC,cAChB,QAAO;IACN,eAAe,CAAC,GAAG,cAAc;IACjC;IACA,MAAM;IACN,SAAS,cAAc,SAAS,KAAK,kBAAkB,WAAW;IAClE,oBAAoB;IACpB;GAEF,MAAM,OAAO,QAAQ,UAAU;AAC/B,UAAO;IACN,eAAe,CAAC,GAAG,cAAc;IACjC;IACA;IACA,SAAS,KAAK,WAAW,WAAW;IACpC,oBAAoB,KAAK;IACzB;;EAGF,sBAAsB,OAAwC;AAC7D,qBAAkB,MAAM;;EAGzB,QAAQ,YAAyC;AAChD,OAAI,CAAC,QACJ,OAAM,IAAI,MAAM,kCAAkC;AAEnD,WAAQ,QAAQ,WAAW;AAC3B,wBAAqB;AACrB,OAAI,QAAQ,UAAU,CAAC,WAAW,WAAW,QAC5C,sBAAqB;;EAIvB,qBAAqB,UAAiC;AACrD,aAAU,KAAK,SAAS;;EAGzB,kBAAwB;AACvB,mBAAgB;AAChB,aAAU;AACV,mBAAgB,EAAE;AAClB,eAAY,EAAE;AACd,uBAAoB,EAAE;;EAGvB,IAAI,YAAwC;AAC3C,UAAO;;EAER"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/auth-coordination/route-orchestrator.ts"],"sourcesContent":["// Shared auth route orchestrator — headless router integration baseline\n//\n// Canonical location: @securitydept/client/auth-coordination\n//\n// Provides a minimal, framework-agnostic glue layer between route-level auth\n// requirements and the RequirementPlanner, driven by a matched route chain\n// (not a single flat routeId).\n//\n// Core design choices (absorbing Angular Router + TanStack Router patterns):\n// - Input is a **matched route chain** (parent → child → grandchild),\n// mirroring Angular's `ActivatedRouteSnapshot[]` and TanStack's matched route tree.\n// - Parent requirements are **inherited** by children by default.\n// - Children can **append** additional requirements.\n// - The orchestrator merges the full chain into a single effective requirement plan.\n// - Route transitions diff the chain: shared prefix requirements/decisions\n// are preserved; diverging suffix requirements/decisions are discarded.\n//\n// Architecture boundary:\n// - This module does NOT own the router, render UI, or manage navigation.\n// - It provides the headless orchestration contract that the router calls into.\n// - The adopter is responsible for translating \"pending requirement\" into\n// the appropriate auth action (redirect, popup, etc.) and calling back\n// with the resolution.\n//\n// Owner rationale: This orchestrator depends only on RouteMatchNode[] (a shared\n// contract) and RequirementPlanner (also in this module). It does not depend on\n// token-set material, OIDC protocol details, or any framework specifics.\n// Canonical owner is @securitydept/client.\n\nimport type {\n\tAuthRequirement,\n\tPlanSnapshot,\n\tRequirementPlanner,\n\tRequirementResolution,\n} from \"./requirement-planner\";\nimport { createRequirementPlanner, PlanStatus } from \"./requirement-planner\";\n\n// ---------------------------------------------------------------------------\n// Route match node types\n// ---------------------------------------------------------------------------\n\n/**\n * A single node in a matched route chain.\n *\n * The adopter maps their framework's route match result into this contract:\n * - Angular: `ActivatedRouteSnapshot` → `RouteMatchNode`\n * - TanStack Router: matched route entry → `RouteMatchNode`\n * - Any other: route guard / middleware context → `RouteMatchNode`\n */\nexport interface RouteMatchNode {\n\t/** Route segment identifier (e.g. route name or path pattern). */\n\trouteId: string;\n\t/** Auth requirements declared on this route segment. */\n\trequirements: readonly AuthRequirement[];\n}\n\n/** Chooser decision: which provider/action to use for a pending requirement. */\nexport interface ChooserDecision {\n\t/** The requirement ID this decision applies to. */\n\trequirementId: string;\n\t/** The chosen provider or action identifier. */\n\tproviderId: string;\n\t/** Optional metadata for the chosen action. */\n\tmetadata?: Record<string, unknown>;\n}\n\n/** Snapshot of the current route orchestration state. */\nexport interface RouteOrchestrationSnapshot {\n\t/** The matched route chain, or empty if no route is active. */\n\tmatchedRoutes: readonly RouteMatchNode[];\n\t/** The leaf route ID (last in chain), or null if no route is active. */\n\tactiveRouteId: string | null;\n\t/** The planner snapshot for the merged requirements, or null if no route. */\n\tplan: PlanSnapshot | null;\n\t/** Whether all merged requirements are fully settled. */\n\tsettled: boolean;\n\t/** The pending requirement that needs a chooser decision, or null. */\n\tpendingRequirement: AuthRequirement | null;\n}\n\n// ---------------------------------------------------------------------------\n// Route requirement orchestrator\n// ---------------------------------------------------------------------------\n\n/** Options for {@link createRouteRequirementOrchestrator}. */\nexport interface CreateRouteRequirementOrchestratorOptions {\n\t/**\n\t * Optional callback fired when the orchestrator needs the adopter to\n\t * act on a pending requirement (e.g. show a chooser UI or auto-redirect).\n\t */\n\tonPendingRequirement?: (requirement: AuthRequirement) => void;\n\n\t/**\n\t * Optional callback fired when all requirements for the active route\n\t * are settled.\n\t */\n\tonSettled?: (\n\t\trouteId: string,\n\t\tresolutions: readonly RequirementResolution[],\n\t) => void;\n}\n\n/**\n * Headless route requirement orchestrator.\n *\n * Driven by a matched route chain: the adopter maps their framework's\n * route match result into `RouteMatchNode[]` and calls `activateMatchedRoutes`.\n * Parent requirements are inherited; children append.\n */\nexport interface RouteRequirementOrchestrator {\n\t/** Get a snapshot of the current route orchestration state. */\n\tsnapshot(): RouteOrchestrationSnapshot;\n\n\t/**\n\t * Activate a matched route chain.\n\t *\n\t * Requirements are inherited: parent requirements come first, children append.\n\t * On route transition, shared-prefix requirements and their resolutions\n\t * are preserved; diverging requirements are re-planned.\n\t */\n\tactivateMatchedRoutes(matchedRoutes: readonly RouteMatchNode[]): void;\n\n\t/**\n\t * Resolve the current pending requirement.\n\t * Advances to the next requirement or settles the plan.\n\t */\n\tresolve(resolution: RequirementResolution): void;\n\n\t/**\n\t * Record a chooser decision for the current pending requirement.\n\t */\n\tapplyChooserDecision(decision: ChooserDecision): void;\n\n\t/**\n\t * Reset the active route (e.g. on navigation away or logout).\n\t */\n\tdeactivateRoute(): void;\n\n\t/** All chooser decisions made during the current route activation. */\n\treadonly decisions: readonly ChooserDecision[];\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\n/** Merge a matched route chain into a flat requirement list (parent-first). */\nfunction mergeChainRequirements(\n\tchain: readonly RouteMatchNode[],\n): AuthRequirement[] {\n\tconst merged: AuthRequirement[] = [];\n\tconst seenIds = new Set<string>();\n\tfor (const node of chain) {\n\t\tfor (const req of node.requirements) {\n\t\t\t// Deduplicate by requirement ID — later (child) definitions win.\n\t\t\tif (seenIds.has(req.id)) continue;\n\t\t\tseenIds.add(req.id);\n\t\t\tmerged.push(req);\n\t\t}\n\t}\n\treturn merged;\n}\n\n/**\n * Find the length of the shared requirement prefix between old and new chains.\n * Used to determine which resolutions can be preserved on route transition.\n */\nfunction sharedPrefixLength(\n\toldReqs: readonly AuthRequirement[],\n\tnewReqs: readonly AuthRequirement[],\n): number {\n\tconst limit = Math.min(oldReqs.length, newReqs.length);\n\tfor (let i = 0; i < limit; i++) {\n\t\tif (oldReqs[i].id !== newReqs[i].id || oldReqs[i].kind !== newReqs[i].kind)\n\t\t\treturn i;\n\t}\n\treturn limit;\n}\n\n// ---------------------------------------------------------------------------\n// Factory\n// ---------------------------------------------------------------------------\n\nexport function createRouteRequirementOrchestrator(\n\toptions: CreateRouteRequirementOrchestratorOptions = {},\n): RouteRequirementOrchestrator {\n\tlet matchedRoutes: RouteMatchNode[] = [];\n\tlet activeRouteId: string | null = null;\n\tlet planner: RequirementPlanner | null = null;\n\tlet decisions: ChooserDecision[] = [];\n\tlet currentMergedReqs: AuthRequirement[] = [];\n\n\tfunction emitPendingIfNeeded(): void {\n\t\tif (!planner || !options.onPendingRequirement) return;\n\t\tconst snap = planner.snapshot();\n\t\tif (snap.nextPending) {\n\t\t\toptions.onPendingRequirement(snap.nextPending);\n\t\t}\n\t}\n\n\tfunction emitSettledIfNeeded(): void {\n\t\tif (!planner || !activeRouteId || !options.onSettled) return;\n\t\tconst snap = planner.snapshot();\n\t\tif (snap.status === PlanStatus.Settled) {\n\t\t\toptions.onSettled(activeRouteId, snap.resolutions);\n\t\t}\n\t}\n\n\tfunction activateWithChain(chain: readonly RouteMatchNode[]): void {\n\t\tconst newMerged = mergeChainRequirements(chain);\n\t\tif (newMerged.length === 0) {\n\t\t\t// No requirements — treat as deactivation.\n\t\t\tmatchedRoutes = [...chain];\n\t\t\tactiveRouteId = chain.length > 0 ? chain[chain.length - 1].routeId : null;\n\t\t\tplanner = null;\n\t\t\tcurrentMergedReqs = [];\n\t\t\tdecisions = [];\n\t\t\treturn;\n\t\t}\n\n\t\t// Determine shared prefix to preserve existing resolutions.\n\t\tconst shared = sharedPrefixLength(currentMergedReqs, newMerged);\n\n\t\t// Collect resolutions from the current planner that can be preserved.\n\t\tlet preservedResolutions: RequirementResolution[] = [];\n\t\tif (planner && shared > 0) {\n\t\t\tconst oldSnap = planner.snapshot();\n\t\t\tpreservedResolutions = oldSnap.resolutions.slice(0, shared);\n\t\t}\n\n\t\t// Preserve decisions whose requirementIds are in the shared prefix.\n\t\tconst sharedReqIds = new Set(newMerged.slice(0, shared).map((r) => r.id));\n\t\tdecisions = decisions.filter((d) => sharedReqIds.has(d.requirementId));\n\n\t\t// Create new planner with full merged requirements.\n\t\tmatchedRoutes = [...chain];\n\t\tactiveRouteId = chain[chain.length - 1].routeId;\n\t\tcurrentMergedReqs = newMerged;\n\t\tplanner = createRequirementPlanner({ requirements: newMerged });\n\n\t\t// Re-apply preserved resolutions.\n\t\tfor (const res of preservedResolutions) {\n\t\t\tplanner.resolve(res);\n\t\t}\n\n\t\temitPendingIfNeeded();\n\t\temitSettledIfNeeded();\n\t}\n\n\treturn {\n\t\tsnapshot(): RouteOrchestrationSnapshot {\n\t\t\tif (!planner || !activeRouteId) {\n\t\t\t\treturn {\n\t\t\t\t\tmatchedRoutes: [...matchedRoutes],\n\t\t\t\t\tactiveRouteId,\n\t\t\t\t\tplan: null,\n\t\t\t\t\tsettled: matchedRoutes.length > 0 && currentMergedReqs.length === 0,\n\t\t\t\t\tpendingRequirement: null,\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst plan = planner.snapshot();\n\t\t\treturn {\n\t\t\t\tmatchedRoutes: [...matchedRoutes],\n\t\t\t\tactiveRouteId,\n\t\t\t\tplan,\n\t\t\t\tsettled: plan.status === PlanStatus.Settled,\n\t\t\t\tpendingRequirement: plan.nextPending,\n\t\t\t};\n\t\t},\n\n\t\tactivateMatchedRoutes(chain: readonly RouteMatchNode[]): void {\n\t\t\tactivateWithChain(chain);\n\t\t},\n\n\t\tresolve(resolution: RequirementResolution): void {\n\t\t\tif (!planner) {\n\t\t\t\tthrow new Error(\"Cannot resolve: no active route\");\n\t\t\t}\n\t\t\tplanner.resolve(resolution);\n\t\t\temitSettledIfNeeded();\n\t\t\tif (planner.snapshot().status === PlanStatus.Pending) {\n\t\t\t\temitPendingIfNeeded();\n\t\t\t}\n\t\t},\n\n\t\tapplyChooserDecision(decision: ChooserDecision): void {\n\t\t\tdecisions.push(decision);\n\t\t},\n\n\t\tdeactivateRoute(): void {\n\t\t\tactiveRouteId = null;\n\t\t\tplanner = null;\n\t\t\tmatchedRoutes = [];\n\t\t\tdecisions = [];\n\t\t\tcurrentMergedReqs = [];\n\t\t},\n\n\t\tget decisions(): readonly ChooserDecision[] {\n\t\t\treturn decisions;\n\t\t},\n\t};\n}\n"],"mappings":";;;AAmJA,SAAS,uBACR,OACoB;CACpB,MAAM,SAA4B,EAAE;CACpC,MAAM,0BAAU,IAAI,KAAa;CACjC,KAAK,MAAM,QAAQ,OAClB,KAAK,MAAM,OAAO,KAAK,cAAc;EAEpC,IAAI,QAAQ,IAAI,IAAI,GAAG,EAAE;EACzB,QAAQ,IAAI,IAAI,GAAG;EACnB,OAAO,KAAK,IAAI;;CAGlB,OAAO;;;;;;AAOR,SAAS,mBACR,SACA,SACS;CACT,MAAM,QAAQ,KAAK,IAAI,QAAQ,QAAQ,QAAQ,OAAO;CACtD,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,KAC1B,IAAI,QAAQ,GAAG,OAAO,QAAQ,GAAG,MAAM,QAAQ,GAAG,SAAS,QAAQ,GAAG,MACrE,OAAO;CAET,OAAO;;AAOR,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;EACrB,qBAAqB;;CAGtB,OAAO;EACN,WAAuC;GACtC,IAAI,CAAC,WAAW,CAAC,eAChB,OAAO;IACN,eAAe,CAAC,GAAG,cAAc;IACjC;IACA,MAAM;IACN,SAAS,cAAc,SAAS,KAAK,kBAAkB,WAAW;IAClE,oBAAoB;IACpB;GAEF,MAAM,OAAO,QAAQ,UAAU;GAC/B,OAAO;IACN,eAAe,CAAC,GAAG,cAAc;IACjC;IACA;IACA,SAAS,KAAK,WAAW,WAAW;IACpC,oBAAoB,KAAK;IACzB;;EAGF,sBAAsB,OAAwC;GAC7D,kBAAkB,MAAM;;EAGzB,QAAQ,YAAyC;GAChD,IAAI,CAAC,SACJ,MAAM,IAAI,MAAM,kCAAkC;GAEnD,QAAQ,QAAQ,WAAW;GAC3B,qBAAqB;GACrB,IAAI,QAAQ,UAAU,CAAC,WAAW,WAAW,SAC5C,qBAAqB;;EAIvB,qBAAqB,UAAiC;GACrD,UAAU,KAAK,SAAS;;EAGzB,kBAAwB;GACvB,gBAAgB;GAChB,UAAU;GACV,gBAAgB,EAAE;GAClB,YAAY,EAAE;GACd,oBAAoB,EAAE;;EAGvB,IAAI,YAAwC;GAC3C,OAAO;;EAER"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { n as createSessionStorageStore, t as createLocalStorageStore } from "./web-DQmMqZnR.mjs";
|
|
1
2
|
//#region src/errors/types.ts
|
|
2
3
|
/** Recovery actions the user might take. Aligned with server-side `UserRecovery`. */
|
|
3
4
|
const UserRecovery = {
|
|
@@ -34,7 +35,7 @@ const ClientErrorKind = {
|
|
|
34
35
|
const ClientErrorSource = {
|
|
35
36
|
Transport: "transport",
|
|
36
37
|
Server: "server",
|
|
37
|
-
|
|
38
|
+
ClientEnvironment: "client_environment"
|
|
38
39
|
};
|
|
39
40
|
//#endregion
|
|
40
41
|
//#region src/errors/client-error.ts
|
|
@@ -120,7 +121,7 @@ var ClientError = class ClientError extends Error {
|
|
|
120
121
|
static fromHttpResponse(status, body) {
|
|
121
122
|
const serverBody = readServerErrorBody(body);
|
|
122
123
|
const kind = mapServerErrorKind(serverBody?.kind, status);
|
|
123
|
-
const source = status >= 500 ? ClientErrorSource.Server : ClientErrorSource.
|
|
124
|
+
const source = status >= 500 ? ClientErrorSource.Server : ClientErrorSource.ClientEnvironment;
|
|
124
125
|
if (serverBody?.code && serverBody?.message) return ClientError.fromServerError(serverBody, {
|
|
125
126
|
kind,
|
|
126
127
|
source
|
|
@@ -157,6 +158,12 @@ function createDefaultOperationId() {
|
|
|
157
158
|
return `op_${Math.random().toString(36).slice(2, 10)}`;
|
|
158
159
|
}
|
|
159
160
|
var DefaultOperationScope = class {
|
|
161
|
+
_name;
|
|
162
|
+
_clock;
|
|
163
|
+
_traceSink;
|
|
164
|
+
_logger;
|
|
165
|
+
_scope;
|
|
166
|
+
_source;
|
|
160
167
|
id;
|
|
161
168
|
_attributes;
|
|
162
169
|
_ended = false;
|
|
@@ -267,14 +274,14 @@ function createDefaultScheduler() {
|
|
|
267
274
|
//#endregion
|
|
268
275
|
//#region src/runtime/create-runtime.ts
|
|
269
276
|
/**
|
|
270
|
-
* Create a `
|
|
277
|
+
* Create a `ClientEnvironment` with non-host-specific defaults filled in for
|
|
271
278
|
* convenience.
|
|
272
279
|
*
|
|
273
280
|
* Host-specific capabilities such as browser `fetch` should be supplied
|
|
274
281
|
* explicitly or composed via adapter-specific helpers such as
|
|
275
282
|
* `@securitydept/client/web`.
|
|
276
283
|
*/
|
|
277
|
-
function
|
|
284
|
+
function createClientEnvironment(overrides) {
|
|
278
285
|
const clock = overrides.clock ?? createDefaultClock();
|
|
279
286
|
const traceSink = overrides.traceSink;
|
|
280
287
|
const logger = overrides.logger;
|
|
@@ -626,6 +633,180 @@ function createFetchTransport(options = {}) {
|
|
|
626
633
|
} };
|
|
627
634
|
}
|
|
628
635
|
//#endregion
|
|
629
|
-
|
|
636
|
+
//#region src/web/runtime.ts
|
|
637
|
+
/**
|
|
638
|
+
* Create a `ClientEnvironment` for browser/Web-capable environments.
|
|
639
|
+
*/
|
|
640
|
+
function createWebClientEnvironmentDependencies(overrides = {}) {
|
|
641
|
+
const { fetchTransport, transport, ...environment } = overrides;
|
|
642
|
+
return createClientEnvironment({
|
|
643
|
+
...environment,
|
|
644
|
+
transport: transport ?? createFetchTransport(fetchTransport)
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
//#endregion
|
|
648
|
+
//#region src/web/client-environment.ts
|
|
649
|
+
const ClientEnvironmentPreset = {
|
|
650
|
+
BrowserPage: "browser_page",
|
|
651
|
+
BrowserWorker: "browser_worker",
|
|
652
|
+
ServiceWorker: "service_worker",
|
|
653
|
+
BrowserExtensionBackground: "browser_extension_background"
|
|
654
|
+
};
|
|
655
|
+
const PAGE_LOCATION_ERROR_MESSAGE = "browser redirect helpers require a page-like window.location.\nFor extension background or service worker hosts, keep redirects in a real page context or pass explicit location capability.";
|
|
656
|
+
const PAGE_LOCATION_HISTORY_ERROR_MESSAGE = "backend-oidc page callback bootstrap requires a page-like window.location and window.history.\nFor extension background or service worker hosts, use restore-only flow or pass explicit location/history/store capabilities.";
|
|
657
|
+
const EXPLICIT_PAGE_ENVIRONMENT_ERROR_MESSAGE = "page helpers require an explicit page environment.\nCreate one in your composition root with createBrowserPageClientEnvironment(...).\nFor worker, service worker, or extension background hosts, keep page-only redirects and callbacks in a real page context.";
|
|
658
|
+
const EXPLICIT_PAGE_LOCATION_HISTORY_CAPABILITY_ERROR_MESSAGE = "page helpers require an explicit page environment with location and history.\nCreate one in your composition root with createBrowserPageClientEnvironment(...), or pass an explicit pageCapability override.";
|
|
659
|
+
const BROWSER_PERSISTENT_PREFIX = "securitydept.web.client:";
|
|
660
|
+
const BROWSER_SESSION_PREFIX = "securitydept.web.client:";
|
|
661
|
+
function createWebClientEnvironment(options = {}) {
|
|
662
|
+
const { preset, ...environmentOptions } = options;
|
|
663
|
+
return {
|
|
664
|
+
...createWebClientEnvironmentDependencies(environmentOptions),
|
|
665
|
+
preset
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
function deriveClientEnvironment(environment) {
|
|
669
|
+
return {
|
|
670
|
+
transport: environment.transport,
|
|
671
|
+
scheduler: environment.scheduler,
|
|
672
|
+
clock: environment.clock,
|
|
673
|
+
logger: environment.logger,
|
|
674
|
+
traceSink: environment.traceSink,
|
|
675
|
+
operationTracer: environment.operationTracer,
|
|
676
|
+
persistentStore: environment.persistentStore,
|
|
677
|
+
sessionStore: environment.sessionStore
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
function createBrowserPageClientEnvironment(options = {}) {
|
|
681
|
+
const pageCapability = options.pageCapability ? assertPageLocationHistoryCapability(options.pageCapability) : requireDefaultPageLocationHistoryCapability();
|
|
682
|
+
return {
|
|
683
|
+
...createWebClientEnvironment({
|
|
684
|
+
...withDefaultBrowserStores(options),
|
|
685
|
+
preset: ClientEnvironmentPreset.BrowserPage
|
|
686
|
+
}),
|
|
687
|
+
...pageCapability
|
|
688
|
+
};
|
|
689
|
+
}
|
|
690
|
+
function readDefaultPageLocationCapability() {
|
|
691
|
+
const windowLike = globalThis.window;
|
|
692
|
+
if (!isObject(windowLike)) return null;
|
|
693
|
+
const location = windowLike.location;
|
|
694
|
+
return readPageLocationCapability({ location });
|
|
695
|
+
}
|
|
696
|
+
function requireDefaultPageLocationCapability() {
|
|
697
|
+
const pageCapability = readDefaultPageLocationCapability();
|
|
698
|
+
if (!pageCapability) throw new Error(PAGE_LOCATION_ERROR_MESSAGE);
|
|
699
|
+
return pageCapability;
|
|
700
|
+
}
|
|
701
|
+
function createBrowserWorkerClientEnvironment(options = {}) {
|
|
702
|
+
return createWebClientEnvironment({
|
|
703
|
+
...options,
|
|
704
|
+
preset: ClientEnvironmentPreset.BrowserWorker
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
function createServiceWorkerClientEnvironment(options = {}) {
|
|
708
|
+
return createWebClientEnvironment({
|
|
709
|
+
...options,
|
|
710
|
+
preset: ClientEnvironmentPreset.ServiceWorker
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
function createBrowserExtensionBackgroundClientEnvironment(options = {}) {
|
|
714
|
+
return createWebClientEnvironment({
|
|
715
|
+
...options,
|
|
716
|
+
preset: ClientEnvironmentPreset.BrowserExtensionBackground
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
function assertResolveEnvironment(environment, onResolvingEnvironmentFail) {
|
|
720
|
+
if (environment === null || environment === void 0) return onResolvingEnvironmentFail();
|
|
721
|
+
return environment;
|
|
722
|
+
}
|
|
723
|
+
function assertResolveFromEnvironment(environment, select, onResolvingCapabilityFail) {
|
|
724
|
+
const resolvedValue = select(assertResolveEnvironment(environment, onResolvingCapabilityFail));
|
|
725
|
+
if (resolvedValue === null || resolvedValue === void 0) return onResolvingCapabilityFail();
|
|
726
|
+
return resolvedValue;
|
|
727
|
+
}
|
|
728
|
+
function requirePageClientEnvironment(environmentOrOptions) {
|
|
729
|
+
const options = normalizeRequirePageClientEnvironmentOptions(environmentOrOptions);
|
|
730
|
+
const environment = assertResolveEnvironment(options.environment, failMissingPageEnvironment);
|
|
731
|
+
const pageCapability = resolvePageLocationHistoryCapability(options, environment);
|
|
732
|
+
return {
|
|
733
|
+
...environment,
|
|
734
|
+
...pageCapability
|
|
735
|
+
};
|
|
736
|
+
}
|
|
737
|
+
function readDefaultPageLocationHistoryCapability() {
|
|
738
|
+
const windowLike = globalThis.window;
|
|
739
|
+
if (!isObject(windowLike)) return null;
|
|
740
|
+
const location = windowLike.location;
|
|
741
|
+
const history = windowLike.history;
|
|
742
|
+
return readPageLocationHistoryCapability({
|
|
743
|
+
location,
|
|
744
|
+
history
|
|
745
|
+
});
|
|
746
|
+
}
|
|
747
|
+
function requireDefaultPageLocationHistoryCapability() {
|
|
748
|
+
const pageCapability = readDefaultPageLocationHistoryCapability();
|
|
749
|
+
if (!pageCapability) throw new Error(PAGE_LOCATION_HISTORY_ERROR_MESSAGE);
|
|
750
|
+
return pageCapability;
|
|
751
|
+
}
|
|
752
|
+
function readPageLocationCapability(input) {
|
|
753
|
+
const location = input.location;
|
|
754
|
+
if (!isPageLocationLike(location)) return null;
|
|
755
|
+
return { location };
|
|
756
|
+
}
|
|
757
|
+
function readPageLocationHistoryCapability(input) {
|
|
758
|
+
const pageCapability = readPageLocationCapability(input);
|
|
759
|
+
const history = input.history;
|
|
760
|
+
if (!pageCapability || !isPageHistoryLike(history)) return null;
|
|
761
|
+
return {
|
|
762
|
+
...pageCapability,
|
|
763
|
+
history
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
function assertPageLocationCapability(pageCapability, fieldName = "environment") {
|
|
767
|
+
if (!isObject(pageCapability)) throw new Error(`${fieldName} must include location.href and location.hash.\n${PAGE_LOCATION_ERROR_MESSAGE}`);
|
|
768
|
+
const normalized = readPageLocationCapability(pageCapability);
|
|
769
|
+
if (!normalized) throw new Error(`${fieldName} must include location.href and location.hash.\n${PAGE_LOCATION_ERROR_MESSAGE}`);
|
|
770
|
+
return normalized;
|
|
771
|
+
}
|
|
772
|
+
function assertPageLocationHistoryCapability(pageCapability, fieldName = "pageCapability") {
|
|
773
|
+
if (!isObject(pageCapability)) throw new Error(`${fieldName} must include location.href, location.hash, and history.replaceState.\n${PAGE_LOCATION_HISTORY_ERROR_MESSAGE}`);
|
|
774
|
+
const normalized = readPageLocationHistoryCapability(pageCapability);
|
|
775
|
+
if (!normalized) throw new Error(`${fieldName} must include location.href, location.hash, and history.replaceState.\n${PAGE_LOCATION_HISTORY_ERROR_MESSAGE}`);
|
|
776
|
+
return normalized;
|
|
777
|
+
}
|
|
778
|
+
function normalizeRequirePageClientEnvironmentOptions(environmentOrOptions) {
|
|
779
|
+
if (!environmentOrOptions) return {};
|
|
780
|
+
if ("transport" in environmentOrOptions) return { environment: environmentOrOptions };
|
|
781
|
+
return environmentOrOptions;
|
|
782
|
+
}
|
|
783
|
+
function resolvePageLocationHistoryCapability(options, environment) {
|
|
784
|
+
if (options.pageCapability !== void 0) return assertPageLocationHistoryCapability(options.pageCapability, "pageCapability");
|
|
785
|
+
return assertResolveFromEnvironment(environment, (candidateEnvironment) => readPageLocationHistoryCapability(candidateEnvironment), failMissingPageLocationHistoryCapability);
|
|
786
|
+
}
|
|
787
|
+
function failMissingPageEnvironment() {
|
|
788
|
+
throw new Error(EXPLICIT_PAGE_ENVIRONMENT_ERROR_MESSAGE);
|
|
789
|
+
}
|
|
790
|
+
function failMissingPageLocationHistoryCapability() {
|
|
791
|
+
throw new Error(EXPLICIT_PAGE_LOCATION_HISTORY_CAPABILITY_ERROR_MESSAGE);
|
|
792
|
+
}
|
|
793
|
+
function withDefaultBrowserStores(options) {
|
|
794
|
+
return {
|
|
795
|
+
...options,
|
|
796
|
+
persistentStore: options.persistentStore ?? createLocalStorageStore(BROWSER_PERSISTENT_PREFIX),
|
|
797
|
+
sessionStore: options.sessionStore ?? createSessionStorageStore(BROWSER_SESSION_PREFIX)
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
function isObject(value) {
|
|
801
|
+
return typeof value === "object" && value !== null;
|
|
802
|
+
}
|
|
803
|
+
function isPageLocationLike(value) {
|
|
804
|
+
return isObject(value) && typeof value.href === "string" && typeof value.hash === "string";
|
|
805
|
+
}
|
|
806
|
+
function isPageHistoryLike(value) {
|
|
807
|
+
return isObject(value) && typeof value.replaceState === "function";
|
|
808
|
+
}
|
|
809
|
+
//#endregion
|
|
810
|
+
export { interval as A, ClientErrorKind as B, normalizeAbortError as C, fromEventPattern as D, PromiseSettlementKind as E, createDefaultClock as F, ErrorPresentationTone as H, createOperationTracer as I, LogLevel as L, timer as M, createClientEnvironment as N, fromPromise as O, createDefaultScheduler as P, OperationTraceEventType as R, createCancellationTokenFromAbortSignal as S, fromStorageEvent as T, UserRecovery as U, ClientErrorSource as V, requireDefaultPageLocationHistoryCapability as _, assertResolveFromEnvironment as a, createFetchTransport as b, createBrowserWorkerClientEnvironment as c, deriveClientEnvironment as d, readDefaultPageLocationCapability as f, requireDefaultPageLocationCapability as g, readPageLocationHistoryCapability as h, assertResolveEnvironment as i, scheduleAt as j, fromSignal as k, createServiceWorkerClientEnvironment as l, readPageLocationCapability as m, assertPageLocationCapability as n, createBrowserExtensionBackgroundClientEnvironment as o, readDefaultPageLocationHistoryCapability as p, assertPageLocationHistoryCapability as r, createBrowserPageClientEnvironment as s, ClientEnvironmentPreset as t, createWebClientEnvironment as u, requirePageClientEnvironment as v, fromAbortSignal as w, createAbortSignalBridge as x, FetchTransportRedirectKind as y, ClientError as z };
|
|
630
811
|
|
|
631
|
-
//# sourceMappingURL=
|
|
812
|
+
//# sourceMappingURL=client-environment-CaumNmir.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-environment-CaumNmir.mjs","names":[],"sources":["../src/errors/types.ts","../src/errors/client-error.ts","../src/logging/types.ts","../src/logging/operation-tracer.ts","../src/scheduling/default-clock.ts","../src/scheduling/default-scheduler.ts","../src/runtime/create-runtime.ts","../src/scheduling/helpers.ts","../src/web/input-sources.ts","../src/web/cancellation.ts","../src/transport/fetch-transport.ts","../src/web/runtime.ts","../src/web/client-environment.ts"],"sourcesContent":["// --- Error model ---\n// Dual-layer: machine-facing runtime error + user-facing presentation / recovery hint.\n\n/** Recovery actions the user might take. Aligned with server-side `UserRecovery`. */\nexport const UserRecovery = {\n\tNone: \"none\",\n\tRetry: \"retry\",\n\tRestartFlow: \"restart_flow\",\n\tReauthenticate: \"reauthenticate\",\n\tContactSupport: \"contact_support\",\n} as const;\n\nexport type UserRecovery = (typeof UserRecovery)[keyof typeof UserRecovery];\n\n/** User-facing error presentation. `code` is the cross-platform stable contract. */\nexport interface ErrorPresentation {\n\tcode: string;\n\tmessage: string;\n\trecovery: UserRecovery;\n}\n\nexport const ErrorPresentationTone = {\n\tNeutral: \"neutral\",\n\tWarning: \"warning\",\n\tDanger: \"danger\",\n} as const;\n\nexport type ErrorPresentationTone =\n\t(typeof ErrorPresentationTone)[keyof typeof ErrorPresentationTone];\n\nexport interface ErrorPresentationActionDescriptor {\n\trecovery: UserRecovery;\n\tlabel: string;\n\thref: string | null;\n}\n\nexport interface ErrorPresentationDescriptor {\n\tcode: string | null;\n\tkind: ClientErrorKind | null;\n\tsource?: string;\n\ttitle: string;\n\tdescription: string;\n\trecovery: UserRecovery;\n\tretryable: boolean;\n\ttone: ErrorPresentationTone;\n\tprimaryAction: ErrorPresentationActionDescriptor | null;\n}\n\nexport interface ReadErrorPresentationDescriptorOptions {\n\tfallbackTitle?: string;\n\tfallbackDescription?: string;\n\trecoveryLinks?: Partial<Record<UserRecovery, string>>;\n\trecoveryLabels?: Partial<Record<UserRecovery, string>>;\n}\n\n/** Machine-facing error kind discriminator. */\nexport const ClientErrorKind = {\n\tAuthorization: \"authorization\",\n\tTransport: \"transport\",\n\tServer: \"server\",\n\tProtocol: \"protocol\",\n\tPresentation: \"presentation\",\n\tValidation: \"validation\",\n\tStorage: \"storage\",\n\tScheduler: \"scheduler\",\n\tConfiguration: \"configuration\",\n\tUnauthenticated: \"unauthenticated\",\n\tUnauthorized: \"unauthorized\",\n\tRedirectRequired: \"redirect_required\",\n\tCancelled: \"cancelled\",\n\tTimeout: \"timeout\",\n\tInternal: \"internal\",\n} as const;\n\nexport type ClientErrorKind =\n\t(typeof ClientErrorKind)[keyof typeof ClientErrorKind];\n\n/** Stable source vocabulary for common client error producers. */\nexport const ClientErrorSource = {\n\tTransport: \"transport\",\n\tServer: \"server\",\n\tClientEnvironment: \"client_environment\",\n} as const;\n\nexport type ClientErrorSource =\n\t(typeof ClientErrorSource)[keyof typeof ClientErrorSource];\n","import {\n\tClientErrorKind,\n\tClientErrorSource,\n\ttype ErrorPresentation,\n\tUserRecovery,\n\ttype UserRecovery as UserRecoveryType,\n} from \"./types\";\n\ntype ServerErrorBody = {\n\tkind?: string;\n\tcode?: string;\n\tmessage?: string;\n\trecovery?: string;\n\tpresentation?: {\n\t\tcode?: string;\n\t\tmessage?: string;\n\t\trecovery?: string;\n\t};\n};\n\nfunction mapServerErrorKind(\n\tkind: string | undefined,\n\tstatus: number,\n): ClientErrorKind {\n\tswitch (kind) {\n\t\tcase \"unauthenticated\":\n\t\t\treturn ClientErrorKind.Unauthenticated;\n\t\tcase \"unauthorized\":\n\t\t\treturn ClientErrorKind.Unauthorized;\n\t\tcase \"unavailable\":\n\t\tcase \"internal\":\n\t\t\treturn ClientErrorKind.Server;\n\t\tcase \"invalid_request\":\n\t\tcase \"conflict\":\n\t\t\treturn ClientErrorKind.Protocol;\n\t\tdefault:\n\t\t\treturn status === 401\n\t\t\t\t? ClientErrorKind.Unauthenticated\n\t\t\t\t: status === 403\n\t\t\t\t\t? ClientErrorKind.Unauthorized\n\t\t\t\t\t: status >= 500\n\t\t\t\t\t\t? ClientErrorKind.Server\n\t\t\t\t\t\t: ClientErrorKind.Protocol;\n\t}\n}\n\nfunction readServerErrorBody(body: unknown): ServerErrorBody | undefined {\n\tif (!body || typeof body !== \"object\") return undefined;\n\tconst record = body as Record<string, unknown>;\n\tconst error =\n\t\trecord.error && typeof record.error === \"object\"\n\t\t\t? (record.error as Record<string, unknown>)\n\t\t\t: record;\n\n\treturn {\n\t\tkind: typeof error.kind === \"string\" ? error.kind : undefined,\n\t\tcode: typeof error.code === \"string\" ? error.code : undefined,\n\t\tmessage: typeof error.message === \"string\" ? error.message : undefined,\n\t\trecovery: typeof error.recovery === \"string\" ? error.recovery : undefined,\n\t\tpresentation:\n\t\t\terror.presentation && typeof error.presentation === \"object\"\n\t\t\t\t? {\n\t\t\t\t\t\tcode:\n\t\t\t\t\t\t\ttypeof (error.presentation as Record<string, unknown>).code ===\n\t\t\t\t\t\t\t\"string\"\n\t\t\t\t\t\t\t\t? ((error.presentation as Record<string, unknown>)\n\t\t\t\t\t\t\t\t\t\t.code as string)\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\ttypeof (error.presentation as Record<string, unknown>).message ===\n\t\t\t\t\t\t\t\"string\"\n\t\t\t\t\t\t\t\t? ((error.presentation as Record<string, unknown>)\n\t\t\t\t\t\t\t\t\t\t.message as string)\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\trecovery:\n\t\t\t\t\t\t\ttypeof (error.presentation as Record<string, unknown>)\n\t\t\t\t\t\t\t\t.recovery === \"string\"\n\t\t\t\t\t\t\t\t? ((error.presentation as Record<string, unknown>)\n\t\t\t\t\t\t\t\t\t\t.recovery as string)\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t}\n\t\t\t\t: undefined,\n\t};\n}\n\n/**\n * Base client error carrying both machine-facing context and an optional\n * user-facing presentation layer.\n *\n * Top-level `code` and `recovery` provide stable machine contracts for\n * policy decisions without requiring callers to unwrap `presentation`.\n */\nexport class ClientError extends Error {\n\treadonly kind: ClientErrorKind;\n\n\t/**\n\t * Stable machine-readable error code.\n\t * Matches `presentation.code` when present, otherwise a default\n\t * derived from `kind`.\n\t */\n\treadonly code: string;\n\n\t/** Recovery hint at the machine level. */\n\treadonly recovery: UserRecoveryType;\n\n\t/** Whether this error is safe to retry. */\n\treadonly retryable: boolean;\n\n\t/** Structured user-facing error presentation from the server. */\n\treadonly presentation?: ErrorPresentation;\n\n\t/** Source subsystem or component that produced the error. */\n\treadonly source?: string;\n\n\tconstructor(options: {\n\t\tkind: ClientErrorKind;\n\t\tmessage: string;\n\t\tcode?: string;\n\t\trecovery?: UserRecoveryType;\n\t\tretryable?: boolean;\n\t\tpresentation?: ErrorPresentation;\n\t\tsource?: string;\n\t\tcause?: unknown;\n\t}) {\n\t\tsuper(options.message, { cause: options.cause });\n\t\tthis.name = \"ClientError\";\n\t\tthis.kind = options.kind;\n\t\tthis.code =\n\t\t\toptions.code ?? options.presentation?.code ?? `client.${options.kind}`;\n\t\tthis.recovery =\n\t\t\toptions.recovery ?? options.presentation?.recovery ?? UserRecovery.None;\n\t\tthis.retryable = options.retryable ?? this.recovery === UserRecovery.Retry;\n\t\tthis.presentation = options.presentation;\n\t\tthis.source = options.source;\n\t}\n\n\t/** Create a `ClientError` from a server error response body. */\n\tstatic fromServerError(\n\t\tbody: {\n\t\t\tkind?: string;\n\t\t\tcode?: string;\n\t\t\tmessage?: string;\n\t\t\trecovery?: string;\n\t\t\tpresentation?: {\n\t\t\t\tcode?: string;\n\t\t\t\tmessage?: string;\n\t\t\t\trecovery?: string;\n\t\t\t};\n\t\t},\n\t\toverrides?: { kind?: ClientErrorKind; source?: string },\n\t): ClientError {\n\t\tconst rawPresentation = body.presentation;\n\t\tconst presentation: ErrorPresentation | undefined =\n\t\t\t(rawPresentation?.code ?? body.code) &&\n\t\t\t(rawPresentation?.message ?? body.message)\n\t\t\t\t? {\n\t\t\t\t\t\tcode: rawPresentation?.code ?? body.code ?? \"unknown_server_error\",\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\trawPresentation?.message ??\n\t\t\t\t\t\t\tbody.message ??\n\t\t\t\t\t\t\t\"Unknown server error\",\n\t\t\t\t\t\trecovery:\n\t\t\t\t\t\t\t(rawPresentation?.recovery as ErrorPresentation[\"recovery\"]) ??\n\t\t\t\t\t\t\t(body.recovery as ErrorPresentation[\"recovery\"]) ??\n\t\t\t\t\t\t\tUserRecovery.None,\n\t\t\t\t\t}\n\t\t\t\t: undefined;\n\n\t\treturn new ClientError({\n\t\t\tkind: overrides?.kind ?? mapServerErrorKind(body.kind, 400),\n\t\t\tmessage: presentation?.message ?? body.message ?? \"Unknown server error\",\n\t\t\tpresentation,\n\t\t\tsource: overrides?.source,\n\t\t});\n\t}\n\n\t/**\n\t * Create a `ClientError` from an HTTP response status and optional body.\n\t * Used when a non-success status is unexpected.\n\t */\n\tstatic fromHttpResponse(status: number, body?: unknown): ClientError {\n\t\tconst serverBody = readServerErrorBody(body);\n\n\t\t// Derive kind and source from HTTP status first — these apply\n\t\t// whether or not the response carries a structured error body.\n\t\tconst kind = mapServerErrorKind(serverBody?.kind, status);\n\n\t\tconst source =\n\t\t\tstatus >= 500\n\t\t\t\t? ClientErrorSource.Server\n\t\t\t\t: ClientErrorSource.ClientEnvironment;\n\n\t\t// If the server returned a structured error body, preserve it\n\t\t// but keep the status-derived kind/source.\n\t\tif (serverBody?.code && serverBody?.message) {\n\t\t\treturn ClientError.fromServerError(serverBody, { kind, source });\n\t\t}\n\n\t\tconst recovery: UserRecoveryType =\n\t\t\tkind === ClientErrorKind.Unauthenticated\n\t\t\t\t? UserRecovery.Reauthenticate\n\t\t\t\t: status >= 500\n\t\t\t\t\t? UserRecovery.Retry\n\t\t\t\t\t: UserRecovery.None;\n\n\t\treturn new ClientError({\n\t\t\tkind,\n\t\t\tmessage: serverBody?.message ?? `HTTP ${status}`,\n\t\t\tcode: serverBody?.code ?? `http.${status}`,\n\t\t\trecovery,\n\t\t\tretryable: status >= 500,\n\t\t\tsource,\n\t\t});\n\t}\n}\n","// --- Logging and observability ---\n\nexport const LogLevel = {\n\tDebug: \"debug\",\n\tInfo: \"info\",\n\tWarn: \"warn\",\n\tError: \"error\",\n} as const;\n\nexport type LogLevel = (typeof LogLevel)[keyof typeof LogLevel];\n\nexport interface LogEntry {\n\tlevel: LogLevel;\n\tmessage: string;\n\tscope?: string;\n\tcode?: string;\n\tattributes?: Record<string, unknown>;\n\terror?: unknown;\n\tat?: number;\n}\n\nexport interface LoggerTrait {\n\tlog(entry: LogEntry): void;\n}\n\nexport const OperationTraceEventType = {\n\tStarted: \"operation.started\",\n\tEvent: \"operation.event\",\n\tError: \"operation.error\",\n\tEnded: \"operation.ended\",\n} as const;\n\nexport type OperationTraceEventType =\n\t(typeof OperationTraceEventType)[keyof typeof OperationTraceEventType];\n\nexport interface TraceEvent {\n\ttype: string;\n\tat: number;\n\tscope?: string;\n\toperationId?: string;\n\tsource?: string;\n\tattributes?: Record<string, unknown>;\n}\n\nexport interface TraceEventSinkTrait {\n\trecord(event: TraceEvent): void;\n}\n\nexport interface OperationScope {\n\tid: string;\n\taddEvent(type: string, attributes?: Record<string, unknown>): void;\n\tsetAttribute(key: string, value: unknown): void;\n\trecordError(error: unknown, attributes?: Record<string, unknown>): void;\n\tend(attributes?: Record<string, unknown>): void;\n}\n\nexport interface OperationTracerTrait {\n\tstartOperation(\n\t\tname: string,\n\t\tattributes?: Record<string, unknown>,\n\t): OperationScope;\n}\n","import type { Clock } from \"../scheduling/types\";\nimport type {\n\tLoggerTrait,\n\tOperationScope,\n\tOperationTracerTrait,\n\tTraceEventSinkTrait,\n} from \"./types\";\nimport { LogLevel, OperationTraceEventType } from \"./types\";\n\nexport interface CreateOperationTracerOptions {\n\ttraceSink?: TraceEventSinkTrait;\n\tlogger?: LoggerTrait;\n\tclock?: Clock;\n\tscope?: string;\n\tsource?: string;\n\tidFactory?: () => string;\n}\n\nconst defaultClock: Clock = {\n\tnow: () => Date.now(),\n};\n\nfunction createDefaultOperationId(): string {\n\treturn `op_${Math.random().toString(36).slice(2, 10)}`;\n}\n\nclass DefaultOperationScope implements OperationScope {\n\treadonly id: string;\n\n\tprivate readonly _attributes: Record<string, unknown>;\n\tprivate _ended = false;\n\n\tconstructor(\n\t\tprivate readonly _name: string,\n\t\tprivate readonly _clock: Clock,\n\t\tprivate readonly _traceSink: TraceEventSinkTrait | undefined,\n\t\tprivate readonly _logger: LoggerTrait | undefined,\n\t\tprivate readonly _scope: string | undefined,\n\t\tprivate readonly _source: string | undefined,\n\t\tidFactory: () => string,\n\t\tattributes?: Record<string, unknown>,\n\t) {\n\t\tthis.id = idFactory();\n\t\tthis._attributes = { ...(attributes ?? {}) };\n\t\tthis._recordTrace(OperationTraceEventType.Started, {\n\t\t\toperationName: this._name,\n\t\t\t...this._attributes,\n\t\t});\n\t}\n\n\taddEvent(type: string, attributes?: Record<string, unknown>): void {\n\t\tthis._recordTrace(OperationTraceEventType.Event, {\n\t\t\toperationName: this._name,\n\t\t\teventType: type,\n\t\t\t...this._attributes,\n\t\t\t...(attributes ?? {}),\n\t\t});\n\t}\n\n\tsetAttribute(key: string, value: unknown): void {\n\t\tthis._attributes[key] = value;\n\t}\n\n\trecordError(error: unknown, attributes?: Record<string, unknown>): void {\n\t\tconst errorAttributes = describeError(error);\n\t\tthis._recordTrace(OperationTraceEventType.Error, {\n\t\t\toperationName: this._name,\n\t\t\t...this._attributes,\n\t\t\t...errorAttributes,\n\t\t\t...(attributes ?? {}),\n\t\t});\n\t\tthis._logger?.log({\n\t\t\tlevel: LogLevel.Error,\n\t\t\tmessage: `Operation failed: ${this._name}`,\n\t\t\tscope: this._scope,\n\t\t\tattributes: {\n\t\t\t\toperationId: this.id,\n\t\t\t\toperationName: this._name,\n\t\t\t\t...this._attributes,\n\t\t\t\t...errorAttributes,\n\t\t\t\t...(attributes ?? {}),\n\t\t\t},\n\t\t\terror,\n\t\t\tat: this._clock.now(),\n\t\t});\n\t}\n\n\tend(attributes?: Record<string, unknown>): void {\n\t\tif (this._ended) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._ended = true;\n\t\tthis._recordTrace(OperationTraceEventType.Ended, {\n\t\t\toperationName: this._name,\n\t\t\t...this._attributes,\n\t\t\t...(attributes ?? {}),\n\t\t});\n\t}\n\n\tprivate _recordTrace(\n\t\ttype: string,\n\t\tattributes?: Record<string, unknown>,\n\t): void {\n\t\tthis._traceSink?.record({\n\t\t\ttype,\n\t\t\tat: this._clock.now(),\n\t\t\tscope: this._scope,\n\t\t\tsource: this._source,\n\t\t\toperationId: this.id,\n\t\t\tattributes,\n\t\t});\n\t}\n}\n\nexport function createOperationTracer(\n\toptions: CreateOperationTracerOptions = {},\n): OperationTracerTrait {\n\tconst clock = options.clock ?? defaultClock;\n\tconst idFactory = options.idFactory ?? createDefaultOperationId;\n\n\treturn {\n\t\tstartOperation(name, attributes) {\n\t\t\treturn new DefaultOperationScope(\n\t\t\t\tname,\n\t\t\t\tclock,\n\t\t\t\toptions.traceSink,\n\t\t\t\toptions.logger,\n\t\t\t\toptions.scope,\n\t\t\t\toptions.source,\n\t\t\t\tidFactory,\n\t\t\t\tattributes,\n\t\t\t);\n\t\t},\n\t};\n}\n\nfunction describeError(error: unknown): Record<string, unknown> {\n\tif (\n\t\ttypeof error === \"object\" &&\n\t\terror !== null &&\n\t\t\"name\" in error &&\n\t\t\"message\" in error\n\t) {\n\t\tconst genericError = error as Pick<Error, \"name\" | \"message\">;\n\t\treturn {\n\t\t\terrorName: genericError.name,\n\t\t\terrorMessage: genericError.message,\n\t\t};\n\t}\n\n\treturn { errorValue: String(error) };\n}\n","import type { Clock } from \"./types\";\n\n/** Default clock backed by `Date.now()`. */\nexport function createDefaultClock(): Clock {\n\treturn {\n\t\tnow() {\n\t\t\treturn Date.now();\n\t\t},\n\t};\n}\n","import type { CancelableHandle, Scheduler } from \"./types\";\n\n/** Default scheduler backed by platform `setTimeout`. */\nexport function createDefaultScheduler(): Scheduler {\n\treturn {\n\t\tsetTimeout(delayMs: number, fn: () => void): CancelableHandle {\n\t\t\tconst id = globalThis.setTimeout(fn, delayMs);\n\t\t\treturn {\n\t\t\t\tcancel() {\n\t\t\t\t\tglobalThis.clearTimeout(id);\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t};\n}\n","import { createOperationTracer } from \"../logging/operation-tracer\";\nimport { createDefaultClock } from \"../scheduling/default-clock\";\nimport { createDefaultScheduler } from \"../scheduling/default-scheduler\";\nimport type { HttpTransport } from \"../transport/types\";\nimport type { ClientEnvironment } from \"./types\";\n\nexport interface CreateClientEnvironmentOptions\n\textends Partial<Omit<ClientEnvironment, \"transport\">> {\n\ttransport: HttpTransport;\n}\n\n/**\n * Create a `ClientEnvironment` with non-host-specific defaults filled in for\n * convenience.\n *\n * Host-specific capabilities such as browser `fetch` should be supplied\n * explicitly or composed via adapter-specific helpers such as\n * `@securitydept/client/web`.\n */\nexport function createClientEnvironment(\n\toverrides: CreateClientEnvironmentOptions,\n): ClientEnvironment {\n\tconst clock = overrides.clock ?? createDefaultClock();\n\tconst traceSink = overrides.traceSink;\n\tconst logger = overrides.logger;\n\n\treturn {\n\t\ttransport: overrides.transport,\n\t\tscheduler: overrides.scheduler ?? createDefaultScheduler(),\n\t\tclock,\n\t\tlogger,\n\t\ttraceSink,\n\t\toperationTracer:\n\t\t\toverrides.operationTracer ??\n\t\t\tcreateOperationTracer({\n\t\t\t\tclock,\n\t\t\t\tlogger,\n\t\t\t\ttraceSink,\n\t\t\t}),\n\t\tpersistentStore: overrides.persistentStore,\n\t\tsessionStore: overrides.sessionStore,\n\t};\n}\n","// Scheduling helpers — foundation-owned convenience over raw Scheduler.\n//\n// These helpers sit above the injectable Scheduler / Clock and provide\n// reusable, cancelable wrappers for common scheduling patterns.\n\nimport type { ReadableSignalTrait } from \"../signals/types\";\nimport type { CancelableHandle, Clock, Scheduler } from \"./types\";\n\n// ---------------------------------------------------------------------------\n// Shared types\n// ---------------------------------------------------------------------------\n\n/** Subscription handle returned by input-source adapters. */\nexport interface Subscription {\n\t/** Unsubscribe and release resources. */\n\tunsubscribe(): void;\n}\n\nexport interface FromSignalOptions<T> {\n\t/** Signal to observe. */\n\tsignal: ReadableSignalTrait<T>;\n\t/** Callback invoked when the signal value changes. */\n\tcallback: (value: T) => void;\n\t/**\n\t * Emit the current snapshot immediately after subscription.\n\t * Defaults to `false`.\n\t */\n\temitInitialValue?: boolean;\n}\n\nexport const PromiseSettlementKind = {\n\tFulfilled: \"fulfilled\",\n\tRejected: \"rejected\",\n} as const;\n\nexport type PromiseSettlementKind =\n\t(typeof PromiseSettlementKind)[keyof typeof PromiseSettlementKind];\n\nexport type PromiseSettlement<T> =\n\t| {\n\t\t\tkind: typeof PromiseSettlementKind.Fulfilled;\n\t\t\tvalue: T;\n\t }\n\t| {\n\t\t\tkind: typeof PromiseSettlementKind.Rejected;\n\t\t\treason: unknown;\n\t };\n\nexport interface FromPromiseOptions<T> {\n\t/** Promise-like source to observe. */\n\tpromise: PromiseLike<T>;\n\t/** Callback invoked when the promise settles. */\n\tcallback: (settlement: PromiseSettlement<T>) => void;\n}\n\n// ---------------------------------------------------------------------------\n// timer\n// ---------------------------------------------------------------------------\n\n/** Options for {@link timer}. */\nexport interface TimerOptions {\n\t/** Scheduler to use (platform default if omitted). */\n\tscheduler: Scheduler;\n\t/** Delay in milliseconds. */\n\tdelayMs: number;\n\t/** Callback to invoke after the delay. */\n\tcallback: () => void;\n}\n\n/**\n * Schedule a one-shot callback after a delay.\n *\n * Returns a {@link CancelableHandle} that can cancel the pending timer.\n *\n * @example\n * ```ts\n * const handle = timer({\n * scheduler: runtime.scheduler,\n * delayMs: 5000,\n * callback: () => console.log(\"fired\"),\n * });\n * // Cancel before it fires:\n * handle.cancel();\n * ```\n */\nexport function timer(options: TimerOptions): CancelableHandle {\n\treturn options.scheduler.setTimeout(options.delayMs, options.callback);\n}\n\n// ---------------------------------------------------------------------------\n// interval\n// ---------------------------------------------------------------------------\n\n/** Options for {@link interval}. */\nexport interface IntervalOptions {\n\t/** Scheduler to use. */\n\tscheduler: Scheduler;\n\t/** Interval period in milliseconds. */\n\tperiodMs: number;\n\t/** Callback to invoke on each tick. */\n\tcallback: () => void;\n}\n\n/**\n * Schedule a repeating callback at a fixed interval.\n *\n * Built on top of `Scheduler.setTimeout` so it works with deterministic\n * test schedulers. Returns a {@link CancelableHandle} to stop the interval.\n *\n * @example\n * ```ts\n * const handle = interval({\n * scheduler: runtime.scheduler,\n * periodMs: 30_000,\n * callback: () => refreshTokens(),\n * });\n * // Stop:\n * handle.cancel();\n * ```\n */\nexport function interval(options: IntervalOptions): CancelableHandle {\n\tlet canceled = false;\n\tlet currentHandle: CancelableHandle | null = null;\n\n\tfunction tick(): void {\n\t\tif (canceled) return;\n\t\toptions.callback();\n\t\tscheduleNext();\n\t}\n\n\tfunction scheduleNext(): void {\n\t\tif (canceled) return;\n\t\tcurrentHandle = options.scheduler.setTimeout(options.periodMs, tick);\n\t}\n\n\t// Start the first tick.\n\tscheduleNext();\n\n\treturn {\n\t\tcancel() {\n\t\t\tcanceled = true;\n\t\t\tcurrentHandle?.cancel();\n\t\t\tcurrentHandle = null;\n\t\t},\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// scheduleAt\n// ---------------------------------------------------------------------------\n\n/** Options for {@link scheduleAt}. */\nexport interface ScheduleAtOptions {\n\t/** Scheduler to use. */\n\tscheduler: Scheduler;\n\t/** Clock to use for computing the delay. */\n\tclock: Clock;\n\t/** Target epoch milliseconds at which the callback should fire. */\n\tatMs: number;\n\t/** Callback to invoke at (or after) the target time. */\n\tcallback: () => void;\n}\n\n/**\n * Schedule a callback at a specific wall-clock time.\n *\n * Computes the delay from `clock.now()` to `atMs` and delegates to\n * `Scheduler.setTimeout`. If the target time is already in the past,\n * the callback fires on the next scheduler tick (delay 0).\n *\n * @example\n * ```ts\n * const handle = scheduleAt({\n * scheduler: runtime.scheduler,\n * clock: runtime.clock,\n * atMs: tokenExpiresAtMs - 30_000,\n * callback: () => refreshToken(),\n * });\n * ```\n */\nexport function scheduleAt(options: ScheduleAtOptions): CancelableHandle {\n\tconst delay = Math.max(0, options.atMs - options.clock.now());\n\treturn options.scheduler.setTimeout(delay, options.callback);\n}\n\n// ---------------------------------------------------------------------------\n// fromSignal\n// ---------------------------------------------------------------------------\n\n/**\n * Adapt an SDK signal into the shared {@link Subscription} callback model.\n *\n * @example\n * ```ts\n * const sub = fromSignal({\n * signal: authState,\n * callback: (snapshot) => console.log(snapshot),\n * });\n * sub.unsubscribe();\n * ```\n */\nexport function fromSignal<T>(options: FromSignalOptions<T>): Subscription {\n\tif (options.emitInitialValue) {\n\t\toptions.callback(options.signal.get());\n\t}\n\n\tconst unsubscribe = options.signal.subscribe(() => {\n\t\toptions.callback(options.signal.get());\n\t});\n\n\treturn {\n\t\tunsubscribe() {\n\t\t\tunsubscribe();\n\t\t},\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// fromPromise\n// ---------------------------------------------------------------------------\n\n/**\n * Adapt a promise settlement into the shared {@link Subscription} callback model.\n *\n * This helper is intentionally thin: it reports one settlement and lets the\n * consumer decide how to model pending/fulfilled/error state.\n *\n * @example\n * ```ts\n * const sub = fromPromise({\n * promise: fetchConfig(),\n * callback: (settlement) => {\n * if (settlement.kind === PromiseSettlementKind.Fulfilled) {\n * console.log(settlement.value);\n * }\n * },\n * });\n * sub.unsubscribe();\n * ```\n */\nexport function fromPromise<T>(options: FromPromiseOptions<T>): Subscription {\n\tlet active = true;\n\n\tvoid Promise.resolve(options.promise).then(\n\t\t(value) => {\n\t\t\tif (!active) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\toptions.callback({\n\t\t\t\tkind: PromiseSettlementKind.Fulfilled,\n\t\t\t\tvalue,\n\t\t\t});\n\t\t},\n\t\t(reason) => {\n\t\t\tif (!active) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\toptions.callback({\n\t\t\t\tkind: PromiseSettlementKind.Rejected,\n\t\t\t\treason,\n\t\t\t});\n\t\t},\n\t);\n\n\treturn {\n\t\tunsubscribe() {\n\t\t\tactive = false;\n\t\t},\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// fromEventPattern\n// ---------------------------------------------------------------------------\n\n/** Options for {@link fromEventPattern}. */\nexport interface FromEventPatternOptions<T> {\n\t/**\n\t * Called to install the event listener. Should return whatever handle\n\t * is needed by `removeHandler` to unsubscribe.\n\t */\n\taddHandler: (handler: (value: T) => void) => void;\n\t/**\n\t * Called to uninstall the event listener.\n\t */\n\tremoveHandler: (handler: (value: T) => void) => void;\n\t/** Callback invoked each time the event fires. */\n\tcallback: (value: T) => void;\n}\n\n/**\n * Adapt an arbitrary add/remove event pattern into a {@link Subscription}.\n *\n * This is a thin bridge between imperative event APIs (e.g. `addEventListener`\n * / `removeEventListener`) and the SDK's subscription model.\n *\n * @example\n * ```ts\n * const sub = fromEventPattern<Event>({\n * addHandler: (h) => document.addEventListener(\"visibilitychange\", h),\n * removeHandler: (h) => document.removeEventListener(\"visibilitychange\", h),\n * callback: () => onVisibilityChange(),\n * });\n * // Cleanup:\n * sub.unsubscribe();\n * ```\n */\nexport function fromEventPattern<T>(\n\toptions: FromEventPatternOptions<T>,\n): Subscription {\n\tconst handler = (value: T): void => {\n\t\toptions.callback(value);\n\t};\n\toptions.addHandler(handler);\n\treturn {\n\t\tunsubscribe() {\n\t\t\toptions.removeHandler(handler);\n\t\t},\n\t};\n}\n","import { fromEventPattern, type Subscription } from \"../scheduling/helpers\";\n\nexport interface AbortSignalSource {\n\taborted: boolean;\n\treason: unknown;\n\taddEventListener(type: string, listener: EventListener): void;\n\tremoveEventListener(type: string, listener: EventListener): void;\n}\n\nexport interface FromAbortSignalOptions {\n\t/** AbortSignal to observe. */\n\tsignal?: AbortSignalSource;\n\t/** Callback invoked when the signal aborts. */\n\tcallback: (reason: unknown) => void;\n\t/**\n\t * Emit immediately when the signal is already aborted at subscribe time.\n\t * Defaults to `false`.\n\t */\n\temitIfAborted?: boolean;\n}\n\nexport interface StorageEventTarget {\n\taddEventListener(type: string, listener: EventListener): void;\n\tremoveEventListener(type: string, listener: EventListener): void;\n}\n\nexport interface FromStorageEventOptions {\n\t/**\n\t * Storage-event target. Defaults to `globalThis`, which is appropriate for\n\t * browser hosts and jsdom-based tests.\n\t */\n\ttarget?: StorageEventTarget;\n\t/** Callback invoked for each browser `storage` event. */\n\tcallback: (event: StorageEvent) => void;\n}\n\n/**\n * Adapt a browser AbortSignal into the shared Subscription model.\n */\nexport function fromAbortSignal(options: FromAbortSignalOptions): Subscription {\n\tconst signal = options.signal;\n\tif (!signal) {\n\t\treturn {\n\t\t\tunsubscribe() {},\n\t\t};\n\t}\n\n\tif (options.emitIfAborted && signal.aborted) {\n\t\toptions.callback(signal.reason);\n\t}\n\n\treturn fromEventPattern<Event>({\n\t\taddHandler: (handler) => {\n\t\t\tsignal.addEventListener(\"abort\", handler);\n\t\t},\n\t\tremoveHandler: (handler) => {\n\t\t\tsignal.removeEventListener(\"abort\", handler);\n\t\t},\n\t\tcallback: () => {\n\t\t\toptions.callback(signal.reason);\n\t\t},\n\t});\n}\n\n/**\n * Adapt browser `storage` events into the shared Subscription model.\n */\nexport function fromStorageEvent(\n\toptions: FromStorageEventOptions,\n): Subscription {\n\tconst target = options.target ?? (globalThis as StorageEventTarget);\n\n\treturn fromEventPattern<Event>({\n\t\taddHandler: (handler) => {\n\t\t\ttarget.addEventListener(\"storage\", handler);\n\t\t},\n\t\tremoveHandler: (handler) => {\n\t\t\ttarget.removeEventListener(\"storage\", handler);\n\t\t},\n\t\tcallback: (event) => {\n\t\t\toptions.callback(event as StorageEvent);\n\t\t},\n\t});\n}\n","import type {\n\tCancellationTokenTrait,\n\tDisposableTrait,\n} from \"../cancellation/types\";\nimport { ClientError } from \"../errors/client-error\";\nimport { ClientErrorKind, ClientErrorSource } from \"../errors/types\";\nimport { fromAbortSignal } from \"./input-sources\";\n\nexport interface AbortSignalBridge {\n\tsignal?: AbortSignal;\n\tdispose(): void;\n}\n\n/**\n * Bridge a web `AbortSignal` back into the foundation cancellation contract.\n *\n * This is the canonical consumer-side path for browser hosts that receive an\n * `AbortSignal` from framework/runtime APIs (for example React Query queryFns)\n * but need to call SDK surfaces that accept `CancellationTokenTrait`.\n */\nexport function createCancellationTokenFromAbortSignal(\n\tsignal?: AbortSignal,\n): CancellationTokenTrait | undefined {\n\tif (!signal) {\n\t\treturn undefined;\n\t}\n\n\treturn {\n\t\tget isCancellationRequested() {\n\t\t\treturn signal.aborted;\n\t\t},\n\t\tget reason() {\n\t\t\treturn signal.reason;\n\t\t},\n\t\tonCancellationRequested(listener: (reason: unknown) => void) {\n\t\t\tconst subscription = fromAbortSignal({\n\t\t\t\tsignal,\n\t\t\t\tcallback: listener,\n\t\t\t\temitIfAborted: true,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tdispose() {\n\t\t\t\t\tsubscription.unsubscribe();\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t\tthrowIfCancellationRequested() {\n\t\t\tif (signal.aborted) {\n\t\t\t\tthrow new ClientError({\n\t\t\t\t\tkind: ClientErrorKind.Cancelled,\n\t\t\t\t\tmessage: \"Request was cancelled via AbortSignal\",\n\t\t\t\t\tcode: \"client.cancelled\",\n\t\t\t\t\tsource: ClientErrorSource.Transport,\n\t\t\t\t\tcause: signal.reason,\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t};\n}\n\n/**\n * Bridge foundation cancellation to web `AbortSignal` without exposing\n * `AbortSignal` in core contracts.\n */\nexport function createAbortSignalBridge(\n\ttoken?: CancellationTokenTrait,\n): AbortSignalBridge {\n\tif (!token) {\n\t\treturn {\n\t\t\tsignal: undefined,\n\t\t\tdispose() {},\n\t\t};\n\t}\n\n\tconst controller = new AbortController();\n\tlet subscription: DisposableTrait | null = token.onCancellationRequested(\n\t\t(reason) => {\n\t\t\tcontroller.abort(reason);\n\t\t},\n\t);\n\n\tif (token.isCancellationRequested) {\n\t\tcontroller.abort(token.reason);\n\t}\n\n\treturn {\n\t\tsignal: controller.signal,\n\t\tdispose() {\n\t\t\tsubscription?.dispose();\n\t\t\tsubscription = null;\n\t\t},\n\t};\n}\n\nexport function normalizeAbortError(\n\ttoken: CancellationTokenTrait | undefined,\n\terror: unknown,\n): unknown {\n\tif (!isAbortError(error) && !token?.isCancellationRequested) {\n\t\treturn error;\n\t}\n\n\tconst reason = token?.reason;\n\tif (reason instanceof ClientError) {\n\t\treturn reason;\n\t}\n\n\tif (reason instanceof Error) {\n\t\treturn new ClientError({\n\t\t\tkind: ClientErrorKind.Cancelled,\n\t\t\tmessage: reason.message,\n\t\t\tcode: \"client.cancelled\",\n\t\t\tsource: ClientErrorSource.Transport,\n\t\t\tcause: reason,\n\t\t});\n\t}\n\n\treturn new ClientError({\n\t\tkind: ClientErrorKind.Cancelled,\n\t\tmessage: \"HTTP request was cancelled\",\n\t\tcode: \"client.cancelled\",\n\t\tsource: ClientErrorSource.Transport,\n\t\tcause: reason ?? error,\n\t});\n}\n\nfunction isAbortError(error: unknown): boolean {\n\treturn (\n\t\ttypeof error === \"object\" &&\n\t\terror !== null &&\n\t\t\"name\" in error &&\n\t\terror.name === \"AbortError\"\n\t);\n}\n","import {\n\tcreateAbortSignalBridge,\n\tnormalizeAbortError,\n} from \"../web/cancellation\";\nimport type { HttpRequest, HttpResponse, HttpTransport } from \"./types\";\n\nexport const FetchTransportRedirectKind = {\n\tFollow: \"follow\",\n\tManual: \"manual\",\n} as const;\n\nexport type FetchTransportRedirectKind =\n\t(typeof FetchTransportRedirectKind)[keyof typeof FetchTransportRedirectKind];\n\nexport interface FetchTransportOptions {\n\t/**\n\t * How to handle HTTP redirects.\n\t * - `\"follow\"`: automatically follow redirects (default fetch behavior)\n\t * - `\"manual\"`: capture redirect responses as-is (needed for fragment-based protocols)\n\t */\n\tredirect?: FetchTransportRedirectKind;\n}\n\n/**\n * Default `HttpTransport` backed by the global `fetch` API.\n *\n * The caller is responsible for ensuring `fetch` is available in the runtime.\n * No polyfill is injected — see the polyfill strategy in the design guide.\n */\nexport function createFetchTransport(\n\toptions: FetchTransportOptions = {},\n): HttpTransport {\n\tconst redirect = options.redirect ?? FetchTransportRedirectKind.Manual;\n\n\treturn {\n\t\tasync execute(request: HttpRequest): Promise<HttpResponse> {\n\t\t\tconst abortBridge = createAbortSignalBridge(request.cancellationToken);\n\t\t\tconst init: RequestInit = {\n\t\t\t\tmethod: request.method,\n\t\t\t\theaders: request.headers,\n\t\t\t\tredirect,\n\t\t\t\tsignal: abortBridge.signal,\n\t\t\t};\n\n\t\t\tif (\n\t\t\t\trequest.body !== undefined &&\n\t\t\t\trequest.method !== \"GET\" &&\n\t\t\t\trequest.method !== \"HEAD\"\n\t\t\t) {\n\t\t\t\tinit.body =\n\t\t\t\t\ttypeof request.body === \"string\"\n\t\t\t\t\t\t? request.body\n\t\t\t\t\t\t: JSON.stringify(request.body);\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tconst res = await fetch(request.url, init);\n\n\t\t\t\tconst responseHeaders: Record<string, string> = {};\n\t\t\t\tres.headers.forEach((value, key) => {\n\t\t\t\t\tresponseHeaders[key] = value;\n\t\t\t\t});\n\n\t\t\t\tlet body: unknown;\n\t\t\t\tconst contentType = res.headers.get(\"content-type\");\n\t\t\t\tif (contentType?.includes(\"application/json\")) {\n\t\t\t\t\tbody = await res.json();\n\t\t\t\t} else if (\n\t\t\t\t\tres.status !== 302 &&\n\t\t\t\t\tres.status !== 303 &&\n\t\t\t\t\tres.status !== 301\n\t\t\t\t) {\n\t\t\t\t\tbody = await res.text();\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tstatus: res.status,\n\t\t\t\t\theaders: responseHeaders,\n\t\t\t\t\tbody,\n\t\t\t\t};\n\t\t\t} catch (error) {\n\t\t\t\tthrow normalizeAbortError(request.cancellationToken, error);\n\t\t\t} finally {\n\t\t\t\tabortBridge.dispose();\n\t\t\t}\n\t\t},\n\t};\n}\n","import { createClientEnvironment } from \"../runtime/create-runtime\";\nimport type { ClientEnvironment } from \"../runtime/types\";\nimport {\n\tcreateFetchTransport,\n\ttype FetchTransportOptions,\n} from \"../transport/fetch-transport\";\n\nexport interface CreateWebClientEnvironmentDependenciesOptions\n\textends Partial<Omit<ClientEnvironment, \"transport\">> {\n\ttransport?: ClientEnvironment[\"transport\"];\n\tfetchTransport?: FetchTransportOptions;\n}\n\n/**\n * Create a `ClientEnvironment` for browser/Web-capable environments.\n */\nexport function createWebClientEnvironmentDependencies(\n\toverrides: CreateWebClientEnvironmentDependenciesOptions = {},\n): ClientEnvironment {\n\tconst { fetchTransport, transport, ...environment } = overrides;\n\treturn createClientEnvironment({\n\t\t...environment,\n\t\ttransport: transport ?? createFetchTransport(fetchTransport),\n\t});\n}\n","import {\n\tcreateLocalStorageStore,\n\tcreateSessionStorageStore,\n} from \"../persistence/web\";\nimport type { ClientEnvironment as FoundationClientEnvironment } from \"../runtime/types\";\nimport type { FetchTransportOptions } from \"../transport/fetch-transport\";\nimport { createWebClientEnvironmentDependencies } from \"./runtime\";\n\nexport type { ClientEnvironment } from \"../runtime/types\";\n\nexport const ClientEnvironmentPreset = {\n\tBrowserPage: \"browser_page\",\n\tBrowserWorker: \"browser_worker\",\n\tServiceWorker: \"service_worker\",\n\tBrowserExtensionBackground: \"browser_extension_background\",\n} as const;\nexport type ClientEnvironmentPreset =\n\t(typeof ClientEnvironmentPreset)[keyof typeof ClientEnvironmentPreset];\n\nexport interface WebClientEnvironment extends FoundationClientEnvironment {\n\tpreset?: ClientEnvironmentPreset;\n}\n\nexport interface PageLocationLike {\n\thref: string;\n\thash: string;\n\tpathname?: string;\n\tsearch?: string;\n}\n\nexport interface PageHistoryLike {\n\treplaceState(data: unknown, unused: string, url?: string | URL | null): void;\n}\n\nexport interface PageLocationCapability {\n\tlocation: PageLocationLike;\n}\n\nexport interface PageLocationHistoryCapability extends PageLocationCapability {\n\thistory: PageHistoryLike;\n}\n\nexport interface PageClientEnvironment\n\textends WebClientEnvironment,\n\t\tPageLocationHistoryCapability {}\n\nexport interface CreateWebClientEnvironmentOptions\n\textends Partial<Omit<FoundationClientEnvironment, \"transport\">> {\n\ttransport?: FoundationClientEnvironment[\"transport\"];\n\tfetchTransport?: FetchTransportOptions;\n\tpreset?: ClientEnvironmentPreset;\n}\n\nexport interface CreateBrowserPageClientEnvironmentOptions\n\textends CreateWebClientEnvironmentOptions {\n\tpageCapability?: PageLocationHistoryCapability;\n}\n\nexport interface RequirePageClientEnvironmentOptions {\n\tenvironment?: WebClientEnvironment | PageClientEnvironment;\n\tpageCapability?: PageLocationHistoryCapability;\n}\n\nconst PAGE_LOCATION_ERROR_MESSAGE =\n\t\"browser redirect helpers require a page-like window.location.\\n\" +\n\t\"For extension background or service worker hosts, keep redirects in a real page context or pass explicit location capability.\";\n\nconst PAGE_LOCATION_HISTORY_ERROR_MESSAGE =\n\t\"backend-oidc page callback bootstrap requires a page-like window.location and window.history.\\n\" +\n\t\"For extension background or service worker hosts, use restore-only flow or pass explicit location/history/store capabilities.\";\n\nconst EXPLICIT_PAGE_ENVIRONMENT_ERROR_MESSAGE =\n\t\"page helpers require an explicit page environment.\\n\" +\n\t\"Create one in your composition root with createBrowserPageClientEnvironment(...).\\n\" +\n\t\"For worker, service worker, or extension background hosts, keep page-only redirects and callbacks in a real page context.\";\n\nconst EXPLICIT_PAGE_LOCATION_HISTORY_CAPABILITY_ERROR_MESSAGE =\n\t\"page helpers require an explicit page environment with location and history.\\n\" +\n\t\"Create one in your composition root with createBrowserPageClientEnvironment(...), or pass an explicit pageCapability override.\";\n\nconst BROWSER_PERSISTENT_PREFIX = \"securitydept.web.client:\";\nconst BROWSER_SESSION_PREFIX = \"securitydept.web.client:\";\n\nexport function createWebClientEnvironment(\n\toptions: CreateWebClientEnvironmentOptions = {},\n): WebClientEnvironment {\n\tconst { preset, ...environmentOptions } = options;\n\tconst resolvedEnvironment =\n\t\tcreateWebClientEnvironmentDependencies(environmentOptions);\n\treturn {\n\t\t...resolvedEnvironment,\n\t\tpreset,\n\t};\n}\n\nexport function deriveClientEnvironment(\n\tenvironment: FoundationClientEnvironment,\n): FoundationClientEnvironment {\n\treturn {\n\t\ttransport: environment.transport,\n\t\tscheduler: environment.scheduler,\n\t\tclock: environment.clock,\n\t\tlogger: environment.logger,\n\t\ttraceSink: environment.traceSink,\n\t\toperationTracer: environment.operationTracer,\n\t\tpersistentStore: environment.persistentStore,\n\t\tsessionStore: environment.sessionStore,\n\t};\n}\n\nexport function createBrowserPageClientEnvironment(\n\toptions: CreateBrowserPageClientEnvironmentOptions = {},\n): PageClientEnvironment {\n\tconst pageCapability = options.pageCapability\n\t\t? assertPageLocationHistoryCapability(options.pageCapability)\n\t\t: requireDefaultPageLocationHistoryCapability();\n\n\treturn {\n\t\t...createWebClientEnvironment({\n\t\t\t...withDefaultBrowserStores(options),\n\t\t\tpreset: ClientEnvironmentPreset.BrowserPage,\n\t\t}),\n\t\t...pageCapability,\n\t};\n}\n\nexport function readDefaultPageLocationCapability(): PageLocationCapability | null {\n\tconst windowLike = (globalThis as unknown as { window?: unknown }).window;\n\tif (!isObject(windowLike)) {\n\t\treturn null;\n\t}\n\n\tconst location = (windowLike as { location?: unknown }).location;\n\treturn readPageLocationCapability({ location });\n}\n\nexport function requireDefaultPageLocationCapability(): PageLocationCapability {\n\tconst pageCapability = readDefaultPageLocationCapability();\n\tif (!pageCapability) {\n\t\tthrow new Error(PAGE_LOCATION_ERROR_MESSAGE);\n\t}\n\n\treturn pageCapability;\n}\n\nexport function createBrowserWorkerClientEnvironment(\n\toptions: CreateWebClientEnvironmentOptions = {},\n): WebClientEnvironment {\n\treturn createWebClientEnvironment({\n\t\t...options,\n\t\tpreset: ClientEnvironmentPreset.BrowserWorker,\n\t});\n}\n\nexport function createServiceWorkerClientEnvironment(\n\toptions: CreateWebClientEnvironmentOptions = {},\n): WebClientEnvironment {\n\treturn createWebClientEnvironment({\n\t\t...options,\n\t\tpreset: ClientEnvironmentPreset.ServiceWorker,\n\t});\n}\n\nexport function createBrowserExtensionBackgroundClientEnvironment(\n\toptions: CreateWebClientEnvironmentOptions = {},\n): WebClientEnvironment {\n\treturn createWebClientEnvironment({\n\t\t...options,\n\t\tpreset: ClientEnvironmentPreset.BrowserExtensionBackground,\n\t});\n}\n\nexport function assertResolveEnvironment<T>(\n\tenvironment: T | null | undefined,\n\tonResolvingEnvironmentFail: () => never,\n): Exclude<T, null | undefined> {\n\tif (environment === null || environment === undefined) {\n\t\treturn onResolvingEnvironmentFail();\n\t}\n\n\treturn environment as Exclude<T, null | undefined>;\n}\n\nexport function assertResolveFromEnvironment<TEnvironment, TValue>(\n\tenvironment: TEnvironment | null | undefined,\n\tselect: (environment: TEnvironment) => TValue | null | undefined,\n\tonResolvingCapabilityFail: () => never,\n): Exclude<TValue, null | undefined> {\n\tconst resolvedEnvironment = assertResolveEnvironment(\n\t\tenvironment,\n\t\tonResolvingCapabilityFail,\n\t);\n\tconst resolvedValue = select(resolvedEnvironment);\n\tif (resolvedValue === null || resolvedValue === undefined) {\n\t\treturn onResolvingCapabilityFail();\n\t}\n\n\treturn resolvedValue as Exclude<TValue, null | undefined>;\n}\n\nexport function requirePageClientEnvironment(\n\tenvironmentOrOptions?:\n\t\t| PageClientEnvironment\n\t\t| RequirePageClientEnvironmentOptions,\n): PageClientEnvironment {\n\tconst options =\n\t\tnormalizeRequirePageClientEnvironmentOptions(environmentOrOptions);\n\tconst environment = assertResolveEnvironment(\n\t\toptions.environment,\n\t\tfailMissingPageEnvironment,\n\t);\n\tconst pageCapability = resolvePageLocationHistoryCapability(\n\t\toptions,\n\t\tenvironment,\n\t);\n\n\treturn {\n\t\t...environment,\n\t\t...pageCapability,\n\t};\n}\n\nexport function readDefaultPageLocationHistoryCapability(): PageLocationHistoryCapability | null {\n\tconst windowLike = (globalThis as unknown as { window?: unknown }).window;\n\tif (!isObject(windowLike)) {\n\t\treturn null;\n\t}\n\n\tconst location = (windowLike as { location?: unknown }).location;\n\tconst history = (windowLike as { history?: unknown }).history;\n\treturn readPageLocationHistoryCapability({ location, history });\n}\n\nexport function requireDefaultPageLocationHistoryCapability(): PageLocationHistoryCapability {\n\tconst pageCapability = readDefaultPageLocationHistoryCapability();\n\tif (!pageCapability) {\n\t\tthrow new Error(PAGE_LOCATION_HISTORY_ERROR_MESSAGE);\n\t}\n\n\treturn pageCapability;\n}\n\nexport function readPageLocationCapability(input: {\n\tlocation?: unknown;\n}): PageLocationCapability | null {\n\tconst location = input.location;\n\tif (!isPageLocationLike(location)) {\n\t\treturn null;\n\t}\n\n\treturn { location };\n}\n\nexport function readPageLocationHistoryCapability(input: {\n\tlocation?: unknown;\n\thistory?: unknown;\n}): PageLocationHistoryCapability | null {\n\tconst pageCapability = readPageLocationCapability(input);\n\tconst history = input.history;\n\tif (!pageCapability || !isPageHistoryLike(history)) {\n\t\treturn null;\n\t}\n\n\treturn {\n\t\t...pageCapability,\n\t\thistory,\n\t};\n}\n\nexport function assertPageLocationCapability(\n\tpageCapability: unknown,\n\tfieldName = \"environment\",\n): PageLocationCapability {\n\tif (!isObject(pageCapability)) {\n\t\tthrow new Error(\n\t\t\t`${fieldName} must include location.href and location.hash.\\n${PAGE_LOCATION_ERROR_MESSAGE}`,\n\t\t);\n\t}\n\n\tconst normalized = readPageLocationCapability(\n\t\tpageCapability as { location?: unknown },\n\t);\n\tif (!normalized) {\n\t\tthrow new Error(\n\t\t\t`${fieldName} must include location.href and location.hash.\\n${PAGE_LOCATION_ERROR_MESSAGE}`,\n\t\t);\n\t}\n\n\treturn normalized;\n}\n\nexport function assertPageLocationHistoryCapability(\n\tpageCapability: unknown,\n\tfieldName = \"pageCapability\",\n): PageLocationHistoryCapability {\n\tif (!isObject(pageCapability)) {\n\t\tthrow new Error(\n\t\t\t`${fieldName} must include location.href, location.hash, and history.replaceState.\\n${PAGE_LOCATION_HISTORY_ERROR_MESSAGE}`,\n\t\t);\n\t}\n\n\tconst normalized = readPageLocationHistoryCapability(\n\t\tpageCapability as { location?: unknown; history?: unknown },\n\t);\n\tif (!normalized) {\n\t\tthrow new Error(\n\t\t\t`${fieldName} must include location.href, location.hash, and history.replaceState.\\n${PAGE_LOCATION_HISTORY_ERROR_MESSAGE}`,\n\t\t);\n\t}\n\n\treturn normalized;\n}\n\nfunction normalizeRequirePageClientEnvironmentOptions(\n\tenvironmentOrOptions?:\n\t\t| PageClientEnvironment\n\t\t| RequirePageClientEnvironmentOptions,\n): RequirePageClientEnvironmentOptions {\n\tif (!environmentOrOptions) {\n\t\treturn {};\n\t}\n\n\tif (\"transport\" in environmentOrOptions) {\n\t\treturn { environment: environmentOrOptions };\n\t}\n\n\treturn environmentOrOptions;\n}\n\nfunction resolvePageLocationHistoryCapability(\n\toptions: RequirePageClientEnvironmentOptions,\n\tenvironment: WebClientEnvironment | PageClientEnvironment,\n): PageLocationHistoryCapability {\n\tif (options.pageCapability !== undefined) {\n\t\treturn assertPageLocationHistoryCapability(\n\t\t\toptions.pageCapability,\n\t\t\t\"pageCapability\",\n\t\t);\n\t}\n\n\treturn assertResolveFromEnvironment(\n\t\tenvironment,\n\t\t(candidateEnvironment) =>\n\t\t\treadPageLocationHistoryCapability(\n\t\t\t\tcandidateEnvironment as { location?: unknown; history?: unknown },\n\t\t\t),\n\t\tfailMissingPageLocationHistoryCapability,\n\t);\n}\n\nfunction failMissingPageEnvironment(): never {\n\tthrow new Error(EXPLICIT_PAGE_ENVIRONMENT_ERROR_MESSAGE);\n}\n\nfunction failMissingPageLocationHistoryCapability(): never {\n\tthrow new Error(EXPLICIT_PAGE_LOCATION_HISTORY_CAPABILITY_ERROR_MESSAGE);\n}\n\nfunction withDefaultBrowserStores<\n\tTOptions extends CreateWebClientEnvironmentOptions,\n>(options: TOptions): TOptions {\n\treturn {\n\t\t...options,\n\t\tpersistentStore:\n\t\t\toptions.persistentStore ??\n\t\t\tcreateLocalStorageStore(BROWSER_PERSISTENT_PREFIX),\n\t\tsessionStore:\n\t\t\toptions.sessionStore ?? createSessionStorageStore(BROWSER_SESSION_PREFIX),\n\t};\n}\n\nfunction isObject(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null;\n}\n\nfunction isPageLocationLike(value: unknown): value is PageLocationLike {\n\treturn (\n\t\tisObject(value) &&\n\t\ttypeof value.href === \"string\" &&\n\t\ttypeof value.hash === \"string\"\n\t);\n}\n\nfunction isPageHistoryLike(value: unknown): value is PageHistoryLike {\n\treturn isObject(value) && typeof value.replaceState === \"function\";\n}\n"],"mappings":";;;AAIA,MAAa,eAAe;CAC3B,MAAM;CACN,OAAO;CACP,aAAa;CACb,gBAAgB;CAChB,gBAAgB;CAChB;AAWD,MAAa,wBAAwB;CACpC,SAAS;CACT,SAAS;CACT,QAAQ;CACR;;AA+BD,MAAa,kBAAkB;CAC9B,eAAe;CACf,WAAW;CACX,QAAQ;CACR,UAAU;CACV,cAAc;CACd,YAAY;CACZ,SAAS;CACT,WAAW;CACX,eAAe;CACf,iBAAiB;CACjB,cAAc;CACd,kBAAkB;CAClB,WAAW;CACX,SAAS;CACT,UAAU;CACV;;AAMD,MAAa,oBAAoB;CAChC,WAAW;CACX,QAAQ;CACR,mBAAmB;CACnB;;;AC9DD,SAAS,mBACR,MACA,QACkB;CAClB,QAAQ,MAAR;EACC,KAAK,mBACJ,OAAO,gBAAgB;EACxB,KAAK,gBACJ,OAAO,gBAAgB;EAC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N,cACC,yBACA,kCACC,qBACA,EACF,yCACA;;AAGF,SAAS,6BAAoC;CAC5C,MAAM,IAAI,MAAM,wCAAwC;;AAGzD,SAAS,2CAAkD;CAC1D,MAAM,IAAI,MAAM,wDAAwD;;AAGzE,SAAS,yBAEP,SAA6B;CAC9B,OAAO;EACN,GAAG;EACH,iBACC,QAAQ,mBACR,wBAAwB,0BAA0B;EACnD,cACC,QAAQ,gBAAgB,0BAA0B,uBAAuB;EAC1E;;AAGF,SAAS,SAAS,OAAkD;CACnE,OAAO,OAAO,UAAU,YAAY,UAAU;;AAG/C,SAAS,mBAAmB,OAA2C;CACtE,OACC,SAAS,MAAM,IACf,OAAO,MAAM,SAAS,YACtB,OAAO,MAAM,SAAS;;AAIxB,SAAS,kBAAkB,OAA0C;CACpE,OAAO,SAAS,MAAM,IAAI,OAAO,MAAM,iBAAiB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as ReadableSignalTrait } from "./types-
|
|
2
|
-
import { a as RecordStore } from "./types-
|
|
1
|
+
import { n as ReadableSignalTrait } from "./types-BJqUdH2e.mjs";
|
|
2
|
+
import { a as RecordStore } from "./types-BwcnUGNl.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/cancellation/types.d.ts
|
|
5
5
|
/** Disposable resource handle. */
|
|
@@ -109,15 +109,15 @@ interface HttpTransport {
|
|
|
109
109
|
//#endregion
|
|
110
110
|
//#region src/runtime/types.d.ts
|
|
111
111
|
/**
|
|
112
|
-
*
|
|
113
|
-
* via explicit wiring at composition root.
|
|
112
|
+
* Client dependency environment injected into auth context clients
|
|
113
|
+
* via explicit wiring at the composition root.
|
|
114
114
|
*
|
|
115
115
|
* All capabilities are optional except `transport`.
|
|
116
116
|
* Missing capabilities use no-op defaults where applicable.
|
|
117
|
-
* `
|
|
117
|
+
* `createClientEnvironment()` is a convenience helper for common setups;
|
|
118
118
|
* callers can also wire this interface directly.
|
|
119
119
|
*/
|
|
120
|
-
interface
|
|
120
|
+
interface ClientEnvironment {
|
|
121
121
|
transport: HttpTransport;
|
|
122
122
|
scheduler: Scheduler;
|
|
123
123
|
clock: Clock;
|
|
@@ -335,5 +335,67 @@ interface FetchTransportOptions {
|
|
|
335
335
|
*/
|
|
336
336
|
declare function createFetchTransport(options?: FetchTransportOptions): HttpTransport;
|
|
337
337
|
//#endregion
|
|
338
|
-
|
|
339
|
-
|
|
338
|
+
//#region src/web/client-environment.d.ts
|
|
339
|
+
declare const ClientEnvironmentPreset: {
|
|
340
|
+
readonly BrowserPage: "browser_page";
|
|
341
|
+
readonly BrowserWorker: "browser_worker";
|
|
342
|
+
readonly ServiceWorker: "service_worker";
|
|
343
|
+
readonly BrowserExtensionBackground: "browser_extension_background";
|
|
344
|
+
};
|
|
345
|
+
type ClientEnvironmentPreset = (typeof ClientEnvironmentPreset)[keyof typeof ClientEnvironmentPreset];
|
|
346
|
+
interface WebClientEnvironment extends ClientEnvironment {
|
|
347
|
+
preset?: ClientEnvironmentPreset;
|
|
348
|
+
}
|
|
349
|
+
interface PageLocationLike {
|
|
350
|
+
href: string;
|
|
351
|
+
hash: string;
|
|
352
|
+
pathname?: string;
|
|
353
|
+
search?: string;
|
|
354
|
+
}
|
|
355
|
+
interface PageHistoryLike {
|
|
356
|
+
replaceState(data: unknown, unused: string, url?: string | URL | null): void;
|
|
357
|
+
}
|
|
358
|
+
interface PageLocationCapability {
|
|
359
|
+
location: PageLocationLike;
|
|
360
|
+
}
|
|
361
|
+
interface PageLocationHistoryCapability extends PageLocationCapability {
|
|
362
|
+
history: PageHistoryLike;
|
|
363
|
+
}
|
|
364
|
+
interface PageClientEnvironment extends WebClientEnvironment, PageLocationHistoryCapability {}
|
|
365
|
+
interface CreateWebClientEnvironmentOptions extends Partial<Omit<ClientEnvironment, "transport">> {
|
|
366
|
+
transport?: ClientEnvironment["transport"];
|
|
367
|
+
fetchTransport?: FetchTransportOptions;
|
|
368
|
+
preset?: ClientEnvironmentPreset;
|
|
369
|
+
}
|
|
370
|
+
interface CreateBrowserPageClientEnvironmentOptions extends CreateWebClientEnvironmentOptions {
|
|
371
|
+
pageCapability?: PageLocationHistoryCapability;
|
|
372
|
+
}
|
|
373
|
+
interface RequirePageClientEnvironmentOptions {
|
|
374
|
+
environment?: WebClientEnvironment | PageClientEnvironment;
|
|
375
|
+
pageCapability?: PageLocationHistoryCapability;
|
|
376
|
+
}
|
|
377
|
+
declare function createWebClientEnvironment(options?: CreateWebClientEnvironmentOptions): WebClientEnvironment;
|
|
378
|
+
declare function deriveClientEnvironment(environment: ClientEnvironment): ClientEnvironment;
|
|
379
|
+
declare function createBrowserPageClientEnvironment(options?: CreateBrowserPageClientEnvironmentOptions): PageClientEnvironment;
|
|
380
|
+
declare function readDefaultPageLocationCapability(): PageLocationCapability | null;
|
|
381
|
+
declare function requireDefaultPageLocationCapability(): PageLocationCapability;
|
|
382
|
+
declare function createBrowserWorkerClientEnvironment(options?: CreateWebClientEnvironmentOptions): WebClientEnvironment;
|
|
383
|
+
declare function createServiceWorkerClientEnvironment(options?: CreateWebClientEnvironmentOptions): WebClientEnvironment;
|
|
384
|
+
declare function createBrowserExtensionBackgroundClientEnvironment(options?: CreateWebClientEnvironmentOptions): WebClientEnvironment;
|
|
385
|
+
declare function assertResolveEnvironment<T>(environment: T | null | undefined, onResolvingEnvironmentFail: () => never): Exclude<T, null | undefined>;
|
|
386
|
+
declare function assertResolveFromEnvironment<TEnvironment, TValue>(environment: TEnvironment | null | undefined, select: (environment: TEnvironment) => TValue | null | undefined, onResolvingCapabilityFail: () => never): Exclude<TValue, null | undefined>;
|
|
387
|
+
declare function requirePageClientEnvironment(environmentOrOptions?: PageClientEnvironment | RequirePageClientEnvironmentOptions): PageClientEnvironment;
|
|
388
|
+
declare function readDefaultPageLocationHistoryCapability(): PageLocationHistoryCapability | null;
|
|
389
|
+
declare function requireDefaultPageLocationHistoryCapability(): PageLocationHistoryCapability;
|
|
390
|
+
declare function readPageLocationCapability(input: {
|
|
391
|
+
location?: unknown;
|
|
392
|
+
}): PageLocationCapability | null;
|
|
393
|
+
declare function readPageLocationHistoryCapability(input: {
|
|
394
|
+
location?: unknown;
|
|
395
|
+
history?: unknown;
|
|
396
|
+
}): PageLocationHistoryCapability | null;
|
|
397
|
+
declare function assertPageLocationCapability(pageCapability: unknown, fieldName?: string): PageLocationCapability;
|
|
398
|
+
declare function assertPageLocationHistoryCapability(pageCapability: unknown, fieldName?: string): PageLocationHistoryCapability;
|
|
399
|
+
//#endregion
|
|
400
|
+
export { LogEntry as $, createFetchTransport as A, fromEventPattern as B, readPageLocationCapability as C, requirePageClientEnvironment as D, requireDefaultPageLocationHistoryCapability as E, PromiseSettlement as F, timer as G, fromSignal as H, PromiseSettlementKind as I, HttpResponse as J, ClientEnvironment as K, ScheduleAtOptions as L, FromPromiseOptions as M, FromSignalOptions as N, FetchTransportOptions as O, IntervalOptions as P, Scheduler as Q, Subscription as R, readDefaultPageLocationHistoryCapability as S, requireDefaultPageLocationCapability as T, interval as U, fromPromise as V, scheduleAt as W, CancelableHandle as X, HttpTransport as Y, Clock as Z, createBrowserWorkerClientEnvironment as _, PageHistoryLike as a, TraceEvent as at, deriveClientEnvironment as b, PageLocationLike as c, CancellationTokenSourceTrait as ct, assertPageLocationCapability as d, LogLevel as et, assertPageLocationHistoryCapability as f, createBrowserPageClientEnvironment as g, createBrowserExtensionBackgroundClientEnvironment as h, PageClientEnvironment as i, OperationTracerTrait as it, FromEventPatternOptions as j, FetchTransportRedirectKind as k, RequirePageClientEnvironmentOptions as l, CancellationTokenTrait as lt, assertResolveFromEnvironment as m, CreateBrowserPageClientEnvironmentOptions as n, OperationScope as nt, PageLocationCapability as o, TraceEventSinkTrait as ot, assertResolveEnvironment as p, HttpRequest as q, CreateWebClientEnvironmentOptions as r, OperationTraceEventType as rt, PageLocationHistoryCapability as s, CancelableHandle$1 as st, ClientEnvironmentPreset as t, LoggerTrait as tt, WebClientEnvironment as u, DisposableTrait as ut, createServiceWorkerClientEnvironment as v, readPageLocationHistoryCapability as w, readDefaultPageLocationCapability as x, createWebClientEnvironment as y, TimerOptions as z };
|
|
401
|
+
//# sourceMappingURL=client-environment-CdHtVxKW.d.mts.map
|
package/dist/events/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as EventSource, D as ReplaySubjectTrait, E as EventSubscriptionTrait, O as RuntimeEventEnvelope, S as EventObserver, T as EventStreamTrait, _ as createEventStream, a as filter, b as fromRxObservable, c as merge, d as shareReplay, f as switchMap, g as withLatestFromSignal, h as throttleTime, i as exhaustMap, k as SubjectTrait, l as pipe, m as tap, n as concatMap, o as finalize, p as takeUntil, r as debounceTime, s as map, t as EventOperator, u as share, v as createReplaySubject, w as EventSourceKind, x as toRxObservable, y as createSubject } from "../index-
|
|
1
|
+
import { C as EventSource, D as ReplaySubjectTrait, E as EventSubscriptionTrait, O as RuntimeEventEnvelope, S as EventObserver, T as EventStreamTrait, _ as createEventStream, a as filter, b as fromRxObservable, c as merge, d as shareReplay, f as switchMap, g as withLatestFromSignal, h as throttleTime, i as exhaustMap, k as SubjectTrait, l as pipe, m as tap, n as concatMap, o as finalize, p as takeUntil, r as debounceTime, s as map, t as EventOperator, u as share, v as createReplaySubject, w as EventSourceKind, x as toRxObservable, y as createSubject } from "../index-C4xlKhG7.mjs";
|
|
2
2
|
export { EventObserver, EventOperator, EventSource, EventSourceKind, EventStreamTrait, EventSubscriptionTrait, ReplaySubjectTrait, RuntimeEventEnvelope, SubjectTrait, concatMap, createEventStream, createReplaySubject, createSubject, debounceTime, exhaustMap, filter, finalize, fromRxObservable, map, merge, pipe, share, shareReplay, switchMap, takeUntil, tap, throttleTime, toRxObservable, withLatestFromSignal };
|