@bytescale/sdk 3.60.0 → 3.62.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.
@@ -3,10 +3,14 @@ import { BeginAuthSessionParams } from "./BeginAuthSessionParams";
3
3
  import { AuthSessionConfig } from "./AuthSessionConfig";
4
4
  export interface AuthSessionConfigState {
5
5
  accessToken: string | undefined;
6
+ /** The latest AuthManager-owned authentication operation; settled while idle and pending during refresh. */
7
+ authenticationPromise?: Promise<void>;
6
8
  config: AuthSessionConfig;
7
9
  expiresAt: number | undefined;
8
10
  jwt: string | undefined;
9
11
  refreshHandle: number | undefined;
12
+ /** Present only while AuthManager is refreshing, so concurrent manager refresh attempts can be deduplicated. */
13
+ refreshPromise?: Promise<void>;
10
14
  }
11
15
  export interface AuthSession {
12
16
  /** Legacy default-token fields retained for SDK 3.54.0 bundles sharing this global state. */
@@ -9,6 +9,14 @@ export interface AuthSessionConfigBase {
9
9
  enableCookieAuth?: boolean;
10
10
  /** Enables CDN service-worker authentication. Defaults to true. */
11
11
  enableServiceWorkerAuth?: boolean;
12
+ /**
13
+ * Restricts service-worker authentication to original resource URLs, before URL rewriting.
14
+ * Uses case-sensitive startsWith matching against any prefix. Undefined allows all requests; [] allows none.
15
+ * The final destination must still match this configuration's CDN and account.
16
+ * Does not affect API-client or cookie authentication, token acquisition, or refresh.
17
+ * Requires the auth service worker shipped with SDK 3.62.0 or later; older workers skip this config.
18
+ */
19
+ requestUrlPrefixes?: string[];
12
20
  /** Restricts service-worker authentication to matching page or iframe URLs. */
13
21
  sourceUrlPrefixes?: string[];
14
22
  }
@@ -16,17 +16,20 @@ declare class AuthManagerImpl implements AuthManagerInterface {
16
16
  private readonly refreshBeforeExpirySeconds;
17
17
  private readonly scheduler;
18
18
  private readonly sourceScopedUrlPrefixMarker;
19
+ private readonly requestScopedUrlPrefixMarker;
19
20
  constructor(serviceWorkerUtils: ServiceWorkerUtils<AuthSwSetConfigDto>);
20
21
  isAuthSessionActive(): boolean;
21
22
  isAuthSessionReady(): boolean;
22
23
  beginAuthSession(params: BeginAuthSessionParams): Promise<void>;
23
24
  endAuthSession(): Promise<void>;
24
25
  private refreshAuthConfig;
26
+ private performRefreshAuthConfig;
25
27
  private sendCurrentServiceWorkerConfig;
26
28
  private sendServiceWorkerConfig;
27
29
  private getV2Configs;
28
30
  private normalizeV1Config;
29
31
  private validateSessionConfig;
32
+ private validateUrlPrefixes;
30
33
  private validateUrlRewriteRules;
31
34
  private updateSessionState;
32
35
  private isConfigUsable;
@@ -54,10 +54,16 @@ export declare class BytescaleApiClientConfigUtils {
54
54
  static getCdnUrl(config: Pick<BytescaleApiClientConfig, "cdnUrl">): string;
55
55
  static getFetchApi(config: Pick<BytescaleApiClientConfig, "fetchApi">): FetchAPI;
56
56
  static getAccountId(config: Pick<BytescaleApiClientConfig, "apiKey" | "authConfigId">): string;
57
+ static getAccountIdAsync(config: Pick<BytescaleApiClientConfig, "apiKey" | "authConfigId">): Promise<string>;
57
58
  static resolveAuthentication(config: Pick<BytescaleApiClientConfig, "apiKey" | "authConfigId">): {
58
59
  accountId: string;
59
60
  headers: HTTPHeaders;
60
61
  };
62
+ static resolveAuthenticationAsync(config: Pick<BytescaleApiClientConfig, "apiKey" | "authConfigId">): Promise<{
63
+ accountId: string;
64
+ headers: HTTPHeaders;
65
+ }>;
66
+ private static resolveAuthenticationWithAuthConfig;
61
67
  private static getApiKeyAccountId;
62
68
  static validate(config: BytescaleApiClientConfig): void;
63
69
  }