@c1m-public/platform-auth 0.22.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -94,7 +94,7 @@ The resolved snapshot from `GET /api/v1/platform/access`.
94
94
  | `PLATFORM_PERMISSIONS`, `LEADBROKER_PERMISSIONS`, `WORKSPACE_PERMISSIONS`, `WORKSPACE_ROLES` + key types | Generated from the backend catalog — see the drift guard below. |
95
95
  | `parseAccessSnapshot`, `emptySnapshot`, `AccessSnapshot`, `AccessEntry` | Validate and shape the snapshot. |
96
96
  | `hasPermission`, `hasAnyPermission`, `hasAllPermissions`, `hasWorkspacePermission`, `isPlatformOwner`, `appScopes`, `permissionsFor` | Scope-aware predicates. |
97
- | `managedDashes`, `dashRole` | The dashes a subject runs, from the mirrored `dash.owner` / `dash.admin` bundle grants (`snapshot.dash_roles`). Admission only — gate an action with `hasPermission(snapshot, "dash.publish", { dashId })`. Platform managers are not listed; admit them on `platform.tenants.manage`. |
97
+ | `managedDashes`, `dashRole` | The dashes a subject runs, from the mirrored `dash.owner` / `dash.admin` bundle grants (`snapshot.dash_roles`). Admission only — gate an action with `hasPermission(snapshot, "dash.publish", { dashId })`. Platform managers are not listed; admit them on `platform.dashes.manage`. |
98
98
  | `fetchAccessSnapshot` | Framework-neutral fetch. Pass `request` and it forwards client identity for you. |
99
99
  | `AccessSnapshotError`, `isAccessSnapshotError` | `unauthenticated` / `forbidden` / `unavailable` / `invalid_snapshot`. |
100
100
 
@@ -112,7 +112,7 @@ export const access = createAccessLoader({
112
112
  // apply inside node_modules, so wrap the fetch here and tag it yourself.
113
113
  fetchSnapshot: cachedSnapshot,
114
114
  });
115
- await access.requireAccess("platform.tenants.manage");
115
+ await access.requireAccess("platform.dashes.manage");
116
116
  ```
117
117
 
118
118
  Omit `getSubjectId` and the loader derives the cache-tag subject from the access
@@ -1 +1 @@
1
- export { a as AccessEntry, b as AccessErrorCode, c as AccessScopeType, A as AccessSnapshot, d as AccessSnapshotError, D as DASH_PERMISSIONS, e as DASH_ROLES, f as DEFAULT_ACCESS_ENDPOINT_PATH, g as DashPermissionKey, h as DashRole, F as FetchAccessSnapshotOptions, L as LEADBROKER_PERMISSIONS, i as LeadBrokerPermissionKey, j as PIPELINE_STAGES, k as PLATFORM_PERMISSIONS, P as PermissionCheckOptions, l as PermissionKey, m as PipelineStage, n as PlatformPermissionKey, W as WORKSPACE_PERMISSIONS, o as WORKSPACE_ROLES, p as WorkspacePermissionKey, q as WorkspaceRole, r as appScopes, s as dashRole, t as emptySnapshot, u as entryCoversApp, v as fetchAccessSnapshot, w as hasAllPermissions, x as hasAnyPermission, y as hasPermission, z as hasWorkspacePermission, B as isAccessSnapshotError, C as isPipelineStage, E as isPlatformOwner, G as managedDashes, H as parseAccessSnapshot, I as permissionsFor } from '../index-XWID1Fkg.js';
1
+ export { a as AccessEntry, b as AccessErrorCode, c as AccessScopeType, A as AccessSnapshot, d as AccessSnapshotError, D as DASH_PERMISSIONS, e as DASH_ROLES, f as DEFAULT_ACCESS_ENDPOINT_PATH, g as DashPermissionKey, h as DashRole, F as FetchAccessSnapshotOptions, L as LEADBROKER_PERMISSIONS, i as LeadBrokerPermissionKey, j as PIPELINE_STAGES, k as PLATFORM_PERMISSIONS, P as PermissionCheckOptions, l as PermissionKey, m as PipelineStage, n as PlatformPermissionKey, W as WORKSPACE_PERMISSIONS, o as WORKSPACE_ROLES, p as WorkspacePermissionKey, q as WorkspaceRole, r as appScopes, s as dashRole, t as emptySnapshot, u as entryCoversApp, v as fetchAccessSnapshot, w as hasAllPermissions, x as hasAnyPermission, y as hasPermission, z as hasWorkspacePermission, B as isAccessSnapshotError, C as isPipelineStage, E as isPlatformOwner, G as managedDashes, H as parseAccessSnapshot, I as permissionsFor } from '../index-cjvJdaXf.js';
@@ -94,6 +94,9 @@ var LEADBROKER_PERMISSIONS = [
94
94
  "leadbroker.policy.manage"
95
95
  ];
96
96
  var WORKSPACE_PERMISSIONS = [
97
+ "workspace.asset-register.manage",
98
+ "workspace.asset-register.schema.manage",
99
+ "workspace.asset-register.view",
97
100
  "workspace.channels.manage",
98
101
  "workspace.channels.secrets",
99
102
  "workspace.channels.view",
@@ -306,7 +309,7 @@ function resolveValue(value) {
306
309
  return typeof value === "function" ? value() : value;
307
310
  }
308
311
  async function timedFetch(url, options = {}) {
309
- const doFetch = options.fetch ?? options.fetchImpl ?? fetch;
312
+ const doFetch = options.fetch ?? fetch;
310
313
  const controller = options.timeoutMs ? new AbortController() : void 0;
311
314
  const timer = controller ? setTimeout(() => controller.abort(), options.timeoutMs) : void 0;
312
315
  try {
@@ -331,8 +334,8 @@ async function fetchAccessSnapshot(opts) {
331
334
  try {
332
335
  response = await timedFetch(url, {
333
336
  init: { method: "GET", headers },
334
- timeoutMs: opts.fetchTimeoutMs,
335
- fetchImpl: opts.fetchImpl
337
+ timeoutMs: opts.timeoutMs ?? opts.fetchTimeoutMs,
338
+ fetch: opts.fetch ?? opts.fetchImpl
336
339
  });
337
340
  } catch (error) {
338
341
  throw new AccessSnapshotError("unavailable", `access snapshot request failed: ${error.message}`);
@@ -1,5 +1,5 @@
1
- import { A as AccessSnapshot, P as PermissionCheckOptions, R as Resolvable } from '../index-XWID1Fkg.js';
2
- export { a as AccessEntry, b as AccessErrorCode, c as AccessScopeType, d as AccessSnapshotError, D as DASH_PERMISSIONS, e as DASH_ROLES, f as DEFAULT_ACCESS_ENDPOINT_PATH, g as DashPermissionKey, h as DashRole, F as FetchAccessSnapshotOptions, L as LEADBROKER_PERMISSIONS, i as LeadBrokerPermissionKey, j as PIPELINE_STAGES, k as PLATFORM_PERMISSIONS, l as PermissionKey, m as PipelineStage, n as PlatformPermissionKey, W as WORKSPACE_PERMISSIONS, o as WORKSPACE_ROLES, p as WorkspacePermissionKey, q as WorkspaceRole, r as appScopes, s as dashRole, t as emptySnapshot, u as entryCoversApp, v as fetchAccessSnapshot, w as hasAllPermissions, x as hasAnyPermission, y as hasPermission, z as hasWorkspacePermission, B as isAccessSnapshotError, C as isPipelineStage, E as isPlatformOwner, G as managedDashes, H as parseAccessSnapshot, I as permissionsFor } from '../index-XWID1Fkg.js';
1
+ import { A as AccessSnapshot, P as PermissionCheckOptions, R as Resolvable } from '../index-cjvJdaXf.js';
2
+ export { a as AccessEntry, b as AccessErrorCode, c as AccessScopeType, d as AccessSnapshotError, D as DASH_PERMISSIONS, e as DASH_ROLES, f as DEFAULT_ACCESS_ENDPOINT_PATH, g as DashPermissionKey, h as DashRole, F as FetchAccessSnapshotOptions, L as LEADBROKER_PERMISSIONS, i as LeadBrokerPermissionKey, j as PIPELINE_STAGES, k as PLATFORM_PERMISSIONS, l as PermissionKey, m as PipelineStage, n as PlatformPermissionKey, W as WORKSPACE_PERMISSIONS, o as WORKSPACE_ROLES, p as WorkspacePermissionKey, q as WorkspaceRole, r as appScopes, s as dashRole, t as emptySnapshot, u as entryCoversApp, v as fetchAccessSnapshot, w as hasAllPermissions, x as hasAnyPermission, y as hasPermission, z as hasWorkspacePermission, B as isAccessSnapshotError, C as isPipelineStage, E as isPlatformOwner, G as managedDashes, H as parseAccessSnapshot, I as permissionsFor } from '../index-cjvJdaXf.js';
3
3
 
4
4
  /** Default cache tag for one subject's snapshot: `access:<subjectId>`. */
5
5
  declare function accessCacheTag(subjectId: string): string;
@@ -14,8 +14,8 @@ interface CreateAccessLoaderOptions {
14
14
  * per-subject rather than sharing one tag across users.
15
15
  */
16
16
  getSubjectId?: () => Promise<string | null>;
17
- fetchTimeoutMs?: number;
18
- fetchImpl?: typeof fetch;
17
+ timeoutMs?: number;
18
+ fetch?: typeof fetch;
19
19
  headers?: () => Promise<HeadersInit | undefined> | HeadersInit | undefined;
20
20
  /**
21
21
  * Optional cross-request cache seam. When provided, the loader calls this
@@ -10,7 +10,7 @@ function resolveValue(value) {
10
10
  return typeof value === "function" ? value() : value;
11
11
  }
12
12
  async function timedFetch(url, options = {}) {
13
- const doFetch = options.fetch ?? options.fetchImpl ?? fetch;
13
+ const doFetch = options.fetch ?? fetch;
14
14
  const controller = options.timeoutMs ? new AbortController() : void 0;
15
15
  const timer = controller ? setTimeout(() => controller.abort(), options.timeoutMs) : void 0;
16
16
  try {
@@ -180,8 +180,8 @@ async function fetchAccessSnapshot(opts) {
180
180
  try {
181
181
  response = await timedFetch(url, {
182
182
  init: { method: "GET", headers },
183
- timeoutMs: opts.fetchTimeoutMs,
184
- fetchImpl: opts.fetchImpl
183
+ timeoutMs: opts.timeoutMs ?? opts.fetchTimeoutMs,
184
+ fetch: opts.fetch ?? opts.fetchImpl
185
185
  });
186
186
  } catch (error) {
187
187
  throw new AccessSnapshotError("unavailable", `access snapshot request failed: ${error.message}`);
@@ -352,6 +352,9 @@ var LEADBROKER_PERMISSIONS = [
352
352
  "leadbroker.policy.manage"
353
353
  ];
354
354
  var WORKSPACE_PERMISSIONS = [
355
+ "workspace.asset-register.manage",
356
+ "workspace.asset-register.schema.manage",
357
+ "workspace.asset-register.view",
355
358
  "workspace.channels.manage",
356
359
  "workspace.channels.secrets",
357
360
  "workspace.channels.view",
@@ -404,8 +407,8 @@ function createAccessLoader(options) {
404
407
  apiUrl: resolveValue(options.apiUrl),
405
408
  accessToken,
406
409
  endpointPath: options.endpointPath,
407
- fetchTimeoutMs: options.fetchTimeoutMs,
408
- fetchImpl: options.fetchImpl,
410
+ timeoutMs: options.timeoutMs,
411
+ fetch: options.fetch,
409
412
  headers
410
413
  });
411
414
  });
@@ -140,8 +140,6 @@ interface HandoffTargetConfig {
140
140
  establishSession: (session: AuthResponse, response: Response, request: Request) => Promise<Response | void> | Response | void;
141
141
  secureCookies?: boolean;
142
142
  timeoutMs?: number;
143
- /** @deprecated use `timeoutMs`. */
144
- fetchTimeoutMs?: number;
145
143
  fetch?: typeof fetch;
146
144
  }
147
145
  declare function createHandoffTarget(config: HandoffTargetConfig): {
@@ -169,8 +167,6 @@ interface HandoffSourceConfig {
169
167
  getAccessToken: (request: Request) => Promise<string | null> | string | null;
170
168
  loginPath: string;
171
169
  timeoutMs?: number;
172
- /** @deprecated use `timeoutMs`. */
173
- fetchTimeoutMs?: number;
174
170
  fetch?: typeof fetch;
175
171
  }
176
172
  declare function createHandoffSource(config: HandoffSourceConfig): {
@@ -221,8 +217,6 @@ interface SessionRefresherConfig {
221
217
  singleflightTtlMs?: number;
222
218
  maxSingleflights?: number;
223
219
  timeoutMs?: number;
224
- /** @deprecated use `timeoutMs`. */
225
- fetchTimeoutMs?: number;
226
220
  fetch?: typeof fetch;
227
221
  }
228
222
  /**
@@ -11,7 +11,7 @@ type DashRole = (typeof DASH_ROLES)[number];
11
11
  declare const LEADBROKER_PERMISSIONS: readonly ["leadbroker.finance.manage", "leadbroker.leads.dispatch", "leadbroker.leads.review", "leadbroker.leads.view", "leadbroker.policy.manage"];
12
12
  type LeadBrokerPermissionKey = (typeof LEADBROKER_PERMISSIONS)[number];
13
13
  /** Workspace-staff permission keys. */
14
- declare const WORKSPACE_PERMISSIONS: readonly ["workspace.channels.manage", "workspace.channels.secrets", "workspace.channels.view", "workspace.crm.manage", "workspace.crm.view", "workspace.customers.manage", "workspace.customers.view", "workspace.drafts.delete", "workspace.lifecycle.manage", "workspace.orders.manage", "workspace.orders.view", "workspace.payments.record", "workspace.payments.refund", "workspace.site.edit", "workspace.site.view", "workspace.staff.manage"];
14
+ declare const WORKSPACE_PERMISSIONS: readonly ["workspace.asset-register.manage", "workspace.asset-register.schema.manage", "workspace.asset-register.view", "workspace.channels.manage", "workspace.channels.secrets", "workspace.channels.view", "workspace.crm.manage", "workspace.crm.view", "workspace.customers.manage", "workspace.customers.view", "workspace.drafts.delete", "workspace.lifecycle.manage", "workspace.orders.manage", "workspace.orders.view", "workspace.payments.record", "workspace.payments.refund", "workspace.site.edit", "workspace.site.view", "workspace.staff.manage"];
15
15
  type WorkspacePermissionKey = (typeof WORKSPACE_PERMISSIONS)[number];
16
16
  /** Assignable workspace-staff role bundles (grant keys at workspace scope). */
17
17
  declare const WORKSPACE_ROLES: readonly ["workspace.editor", "workspace.frontdesk", "workspace.manager"];
@@ -106,7 +106,7 @@ declare function hasWorkspacePermission(snapshot: AccessSnapshot, workspaceId: s
106
106
  * The dashes this subject runs, from the mirrored dash bundle grants — the
107
107
  * admission list for the Admin Center's dash area. Platform managers are not
108
108
  * listed: their reach is platform-wide, so admit them with
109
- * `hasPermission(snapshot, "platform.tenants.manage")` instead.
109
+ * `hasPermission(snapshot, "platform.dashes.manage")` instead.
110
110
  */
111
111
  declare function managedDashes(snapshot: AccessSnapshot): Array<{
112
112
  dashId: string;
@@ -138,7 +138,11 @@ interface FetchAccessSnapshotOptions {
138
138
  accessToken: string;
139
139
  /** Defaults to /api/v1/platform/access. */
140
140
  endpointPath?: string;
141
+ timeoutMs?: number;
142
+ fetch?: typeof fetch;
143
+ /** @deprecated use `timeoutMs`; kept until platform_fe's access.server.ts renames it. */
141
144
  fetchTimeoutMs?: number;
145
+ /** @deprecated use `fetch`; kept until platform_fe's access.server.ts renames it. */
142
146
  fetchImpl?: typeof fetch;
143
147
  /** Extra headers. Authorization and Accept are always set here. */
144
148
  headers?: HeadersInit;
package/dist/index.d.ts CHANGED
@@ -1 +1 @@
1
- export { a as ADMIN_HOST_ROOT, b as AUTH_ERROR_MESSAGES, c as AuthResponse, C as CookieOptions, D as DeviceIdentity, d as DeviceIdentityConfig, e as DeviceIdentityStore, H as HANDOFF_ERROR_FALLBACK, f as HANDOFF_ERROR_MESSAGES, g as HandoffSource, h as HandoffSourceConfig, i as HandoffSourceTarget, j as HandoffTarget, k as HandoffTargetConfig, l as RefreshOutcome, m as RefreshedSession, n as SIGN_IN_HINT_COOKIE, o as SSO_ERROR_MESSAGES, p as SafeInternalPathOptions, S as SessionData, q as SessionGateDecision, r as SessionGateInput, s as SessionRefresher, t as SessionRefresherConfig, u as SessionUser, v as SignInHintCookieAttributes, w as SignInHintDomainOptions, T as TokenPayload, x as adminSlugFromHost, y as applyForwardedClientHeaders, z as authErrorMessage, B as brandedAdminHost, E as brokerPaths, F as createDeviceIdentity, G as createHandoffSource, I as createHandoffTarget, J as createSessionRefresher, K as decodeBase64Url, L as decodeDefaultSession, M as decodeTokenPayload, N as deleteCookie, O as evaluateSessionGate, P as forwardedRequestHeaders, Q as handoffErrorMessage, U as hasSessionShape, V as hasSignInHint, W as hasTokenAudience, X as isAdminRootHost, Y as isAuthErrorCode, Z as isHandoffErrorCode, _ as isTokenExpired, $ as isTokenExpiringSoon, a0 as parseAuthResponse, a1 as parseRefreshEnvelope, a2 as readCookie, a3 as recoveryAdminOrigin, a4 as safeInternalPath, a5 as serializeCookie, a6 as setCookie, a7 as signInHintCookie, a8 as signInHintDomain, a9 as sourceStartPath, aa as tokenMaxAgeSeconds } from './index-Bc_E5HWA.js';
1
+ export { a as ADMIN_HOST_ROOT, b as AUTH_ERROR_MESSAGES, c as AuthResponse, C as CookieOptions, D as DeviceIdentity, d as DeviceIdentityConfig, e as DeviceIdentityStore, H as HANDOFF_ERROR_FALLBACK, f as HANDOFF_ERROR_MESSAGES, g as HandoffSource, h as HandoffSourceConfig, i as HandoffSourceTarget, j as HandoffTarget, k as HandoffTargetConfig, l as RefreshOutcome, m as RefreshedSession, n as SIGN_IN_HINT_COOKIE, o as SSO_ERROR_MESSAGES, p as SafeInternalPathOptions, S as SessionData, q as SessionGateDecision, r as SessionGateInput, s as SessionRefresher, t as SessionRefresherConfig, u as SessionUser, v as SignInHintCookieAttributes, w as SignInHintDomainOptions, T as TokenPayload, x as adminSlugFromHost, y as applyForwardedClientHeaders, z as authErrorMessage, B as brandedAdminHost, E as brokerPaths, F as createDeviceIdentity, G as createHandoffSource, I as createHandoffTarget, J as createSessionRefresher, K as decodeBase64Url, L as decodeDefaultSession, M as decodeTokenPayload, N as deleteCookie, O as evaluateSessionGate, P as forwardedRequestHeaders, Q as handoffErrorMessage, U as hasSessionShape, V as hasSignInHint, W as hasTokenAudience, X as isAdminRootHost, Y as isAuthErrorCode, Z as isHandoffErrorCode, _ as isTokenExpired, $ as isTokenExpiringSoon, a0 as parseAuthResponse, a1 as parseRefreshEnvelope, a2 as readCookie, a3 as recoveryAdminOrigin, a4 as safeInternalPath, a5 as serializeCookie, a6 as setCookie, a7 as signInHintCookie, a8 as signInHintDomain, a9 as sourceStartPath, aa as tokenMaxAgeSeconds } from './index-BKUzRIXJ.js';
package/dist/index.js CHANGED
@@ -277,7 +277,7 @@ function resolveAll(...values) {
277
277
  }
278
278
  var DEFAULT_FETCH_TIMEOUT_MS = 1e4;
279
279
  async function timedFetch(url, options = {}) {
280
- const doFetch = options.fetch ?? options.fetchImpl ?? fetch;
280
+ const doFetch = options.fetch ?? fetch;
281
281
  const controller = options.timeoutMs ? new AbortController() : void 0;
282
282
  const timer = controller ? setTimeout(() => controller.abort(), options.timeoutMs) : void 0;
283
283
  try {
@@ -341,7 +341,7 @@ function createHandoffTarget(config) {
341
341
  const prefix = `${secure ? "__Host-" : ""}${config.cookiePrefix}_handoff_`;
342
342
  const cookies = { state: `${prefix}state`, verifier: `${prefix}verifier`, from: `${prefix}from` };
343
343
  const cookieOptions = { httpOnly: true, secure, sameSite: "lax", path: "/", maxAge: HANDOFF_COOKIE_TTL_SECONDS };
344
- const timeout = config.timeoutMs ?? config.fetchTimeoutMs ?? DEFAULT_FETCH_TIMEOUT_MS;
344
+ const timeout = config.timeoutMs ?? DEFAULT_FETCH_TIMEOUT_MS;
345
345
  const clearHandoffCookies = (response) => {
346
346
  let result = response;
347
347
  for (const name of Object.values(cookies)) {
@@ -412,7 +412,7 @@ function createHandoffTarget(config) {
412
412
  var DEFAULT_TARGET_CALLBACK = "/api/auth/platform-sso/callback";
413
413
  var DEFAULT_TARGET_LOGIN = "/login";
414
414
  function createHandoffSource(config) {
415
- const timeout = config.timeoutMs ?? config.fetchTimeoutMs ?? DEFAULT_FETCH_TIMEOUT_MS;
415
+ const timeout = config.timeoutMs ?? DEFAULT_FETCH_TIMEOUT_MS;
416
416
  return {
417
417
  /** GET `/api/auth/handoffs/{app}/start?code_challenge=&state=` */
418
418
  async start(request, app) {
@@ -482,7 +482,7 @@ function parseRefreshEnvelope(value) {
482
482
  function createSessionRefresher(config) {
483
483
  const ttl = config.singleflightTtlMs ?? DEFAULT_TTL_MS;
484
484
  const max = config.maxSingleflights ?? DEFAULT_MAX;
485
- const timeoutMs = config.timeoutMs ?? config.fetchTimeoutMs ?? DEFAULT_FETCH_TIMEOUT_MS;
485
+ const timeoutMs = config.timeoutMs ?? DEFAULT_FETCH_TIMEOUT_MS;
486
486
  const inflight = /* @__PURE__ */ new Map();
487
487
  async function perform(refreshToken) {
488
488
  try {
package/dist/next.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { R as Resolvable, A as AsyncResolvable, S as SessionData, C as CookieOptions } from './index-Bc_E5HWA.js';
2
- export { a as ADMIN_HOST_ROOT, b as AUTH_ERROR_MESSAGES, c as AuthResponse, D as DeviceIdentity, d as DeviceIdentityConfig, e as DeviceIdentityStore, H as HANDOFF_ERROR_FALLBACK, f as HANDOFF_ERROR_MESSAGES, g as HandoffSource, h as HandoffSourceConfig, i as HandoffSourceTarget, j as HandoffTarget, k as HandoffTargetConfig, l as RefreshOutcome, m as RefreshedSession, n as SIGN_IN_HINT_COOKIE, o as SSO_ERROR_MESSAGES, p as SafeInternalPathOptions, q as SessionGateDecision, r as SessionGateInput, s as SessionRefresher, t as SessionRefresherConfig, u as SessionUser, v as SignInHintCookieAttributes, w as SignInHintDomainOptions, T as TokenPayload, x as adminSlugFromHost, y as applyForwardedClientHeaders, z as authErrorMessage, B as brandedAdminHost, E as brokerPaths, F as createDeviceIdentity, G as createHandoffSource, I as createHandoffTarget, J as createSessionRefresher, K as decodeBase64Url, L as decodeDefaultSession, M as decodeTokenPayload, N as deleteCookie, O as evaluateSessionGate, P as forwardedRequestHeaders, Q as handoffErrorMessage, U as hasSessionShape, V as hasSignInHint, W as hasTokenAudience, X as isAdminRootHost, Y as isAuthErrorCode, Z as isHandoffErrorCode, _ as isTokenExpired, $ as isTokenExpiringSoon, a0 as parseAuthResponse, a1 as parseRefreshEnvelope, a2 as readCookie, a3 as recoveryAdminOrigin, a4 as safeInternalPath, a5 as serializeCookie, a6 as setCookie, a7 as signInHintCookie, a8 as signInHintDomain, a9 as sourceStartPath, aa as tokenMaxAgeSeconds } from './index-Bc_E5HWA.js';
1
+ import { R as Resolvable, A as AsyncResolvable, S as SessionData, C as CookieOptions } from './index-BKUzRIXJ.js';
2
+ export { a as ADMIN_HOST_ROOT, b as AUTH_ERROR_MESSAGES, c as AuthResponse, D as DeviceIdentity, d as DeviceIdentityConfig, e as DeviceIdentityStore, H as HANDOFF_ERROR_FALLBACK, f as HANDOFF_ERROR_MESSAGES, g as HandoffSource, h as HandoffSourceConfig, i as HandoffSourceTarget, j as HandoffTarget, k as HandoffTargetConfig, l as RefreshOutcome, m as RefreshedSession, n as SIGN_IN_HINT_COOKIE, o as SSO_ERROR_MESSAGES, p as SafeInternalPathOptions, q as SessionGateDecision, r as SessionGateInput, s as SessionRefresher, t as SessionRefresherConfig, u as SessionUser, v as SignInHintCookieAttributes, w as SignInHintDomainOptions, T as TokenPayload, x as adminSlugFromHost, y as applyForwardedClientHeaders, z as authErrorMessage, B as brandedAdminHost, E as brokerPaths, F as createDeviceIdentity, G as createHandoffSource, I as createHandoffTarget, J as createSessionRefresher, K as decodeBase64Url, L as decodeDefaultSession, M as decodeTokenPayload, N as deleteCookie, O as evaluateSessionGate, P as forwardedRequestHeaders, Q as handoffErrorMessage, U as hasSessionShape, V as hasSignInHint, W as hasTokenAudience, X as isAdminRootHost, Y as isAuthErrorCode, Z as isHandoffErrorCode, _ as isTokenExpired, $ as isTokenExpiringSoon, a0 as parseAuthResponse, a1 as parseRefreshEnvelope, a2 as readCookie, a3 as recoveryAdminOrigin, a4 as safeInternalPath, a5 as serializeCookie, a6 as setCookie, a7 as signInHintCookie, a8 as signInHintDomain, a9 as sourceStartPath, aa as tokenMaxAgeSeconds } from './index-BKUzRIXJ.js';
3
3
 
4
4
  /**
5
5
  * The error vocabulary every first-party platform surface uses at its edge,
package/dist/next.js CHANGED
@@ -282,7 +282,7 @@ function resolveAll(...values) {
282
282
  }
283
283
  var DEFAULT_FETCH_TIMEOUT_MS = 1e4;
284
284
  async function timedFetch(url, options = {}) {
285
- const doFetch = options.fetch ?? options.fetchImpl ?? fetch;
285
+ const doFetch = options.fetch ?? fetch;
286
286
  const controller = options.timeoutMs ? new AbortController() : void 0;
287
287
  const timer = controller ? setTimeout(() => controller.abort(), options.timeoutMs) : void 0;
288
288
  try {
@@ -346,7 +346,7 @@ function createHandoffTarget(config) {
346
346
  const prefix = `${secure ? "__Host-" : ""}${config.cookiePrefix}_handoff_`;
347
347
  const cookies = { state: `${prefix}state`, verifier: `${prefix}verifier`, from: `${prefix}from` };
348
348
  const cookieOptions = { httpOnly: true, secure, sameSite: "lax", path: "/", maxAge: HANDOFF_COOKIE_TTL_SECONDS };
349
- const timeout = config.timeoutMs ?? config.fetchTimeoutMs ?? DEFAULT_FETCH_TIMEOUT_MS;
349
+ const timeout = config.timeoutMs ?? DEFAULT_FETCH_TIMEOUT_MS;
350
350
  const clearHandoffCookies = (response) => {
351
351
  let result = response;
352
352
  for (const name of Object.values(cookies)) {
@@ -417,7 +417,7 @@ function createHandoffTarget(config) {
417
417
  var DEFAULT_TARGET_CALLBACK = "/api/auth/platform-sso/callback";
418
418
  var DEFAULT_TARGET_LOGIN = "/login";
419
419
  function createHandoffSource(config) {
420
- const timeout = config.timeoutMs ?? config.fetchTimeoutMs ?? DEFAULT_FETCH_TIMEOUT_MS;
420
+ const timeout = config.timeoutMs ?? DEFAULT_FETCH_TIMEOUT_MS;
421
421
  return {
422
422
  /** GET `/api/auth/handoffs/{app}/start?code_challenge=&state=` */
423
423
  async start(request, app) {
@@ -487,7 +487,7 @@ function parseRefreshEnvelope(value) {
487
487
  function createSessionRefresher(config) {
488
488
  const ttl = config.singleflightTtlMs ?? DEFAULT_TTL_MS;
489
489
  const max = config.maxSingleflights ?? DEFAULT_MAX;
490
- const timeoutMs = config.timeoutMs ?? config.fetchTimeoutMs ?? DEFAULT_FETCH_TIMEOUT_MS;
490
+ const timeoutMs = config.timeoutMs ?? DEFAULT_FETCH_TIMEOUT_MS;
491
491
  const inflight = /* @__PURE__ */ new Map();
492
492
  async function perform(refreshToken) {
493
493
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c1m-public/platform-auth",
3
- "version": "0.22.0",
3
+ "version": "0.24.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Session and authorization helpers for C1M platform surfaces. The root is runtime-neutral (Web Request/Response): token/session reads, the first-party handoff (PKCE target + source), proxy session gate and coalesced refresh; ./next adds the server-only guard; ./access carries the resolved access snapshot, typed permission keys, predicates, a Next loader and React bindings",
@@ -55,8 +55,8 @@
55
55
  "tsup": "^8.5.1",
56
56
  "typescript": "5.9.3",
57
57
  "vitest": "^4.1.4",
58
- "@c1m-public/resilience": "0.1.0",
59
- "@c1m-public/transport": "0.0.0"
58
+ "@c1m-public/transport": "0.0.0",
59
+ "@c1m-public/resilience": "0.1.0"
60
60
  },
61
61
  "peerDependencies": {
62
62
  "next": ">=15",