@c1m-public/platform-auth 0.22.0 → 0.23.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/dist/access/index.d.ts +1 -1
- package/dist/access/index.js +3 -3
- package/dist/access/next.d.ts +4 -4
- package/dist/access/next.js +5 -5
- package/dist/{index-Bc_E5HWA.d.ts → index-BKUzRIXJ.d.ts} +0 -6
- package/dist/{index-XWID1Fkg.d.ts → index-FoojTvYk.d.ts} +4 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- package/dist/next.d.ts +2 -2
- package/dist/next.js +4 -4
- package/package.json +3 -3
package/dist/access/index.d.ts
CHANGED
|
@@ -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-
|
|
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-FoojTvYk.js';
|
package/dist/access/index.js
CHANGED
|
@@ -306,7 +306,7 @@ function resolveValue(value) {
|
|
|
306
306
|
return typeof value === "function" ? value() : value;
|
|
307
307
|
}
|
|
308
308
|
async function timedFetch(url, options = {}) {
|
|
309
|
-
const doFetch = options.fetch ??
|
|
309
|
+
const doFetch = options.fetch ?? fetch;
|
|
310
310
|
const controller = options.timeoutMs ? new AbortController() : void 0;
|
|
311
311
|
const timer = controller ? setTimeout(() => controller.abort(), options.timeoutMs) : void 0;
|
|
312
312
|
try {
|
|
@@ -331,8 +331,8 @@ async function fetchAccessSnapshot(opts) {
|
|
|
331
331
|
try {
|
|
332
332
|
response = await timedFetch(url, {
|
|
333
333
|
init: { method: "GET", headers },
|
|
334
|
-
timeoutMs: opts.fetchTimeoutMs,
|
|
335
|
-
|
|
334
|
+
timeoutMs: opts.timeoutMs ?? opts.fetchTimeoutMs,
|
|
335
|
+
fetch: opts.fetch ?? opts.fetchImpl
|
|
336
336
|
});
|
|
337
337
|
} catch (error) {
|
|
338
338
|
throw new AccessSnapshotError("unavailable", `access snapshot request failed: ${error.message}`);
|
package/dist/access/next.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AccessSnapshot, P as PermissionCheckOptions, R as Resolvable } from '../index-
|
|
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-
|
|
1
|
+
import { A as AccessSnapshot, P as PermissionCheckOptions, R as Resolvable } from '../index-FoojTvYk.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-FoojTvYk.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
|
-
|
|
18
|
-
|
|
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
|
package/dist/access/next.js
CHANGED
|
@@ -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 ??
|
|
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
|
-
|
|
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}`);
|
|
@@ -404,8 +404,8 @@ function createAccessLoader(options) {
|
|
|
404
404
|
apiUrl: resolveValue(options.apiUrl),
|
|
405
405
|
accessToken,
|
|
406
406
|
endpointPath: options.endpointPath,
|
|
407
|
-
|
|
408
|
-
|
|
407
|
+
timeoutMs: options.timeoutMs,
|
|
408
|
+
fetch: options.fetch,
|
|
409
409
|
headers
|
|
410
410
|
});
|
|
411
411
|
});
|
|
@@ -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
|
/**
|
|
@@ -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-
|
|
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 ??
|
|
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 ??
|
|
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 ??
|
|
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 ??
|
|
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-
|
|
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-
|
|
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 ??
|
|
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 ??
|
|
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 ??
|
|
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 ??
|
|
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.
|
|
3
|
+
"version": "0.23.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/
|
|
59
|
-
"@c1m-public/
|
|
58
|
+
"@c1m-public/transport": "0.0.0",
|
|
59
|
+
"@c1m-public/resilience": "0.1.0"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"next": ">=15",
|