@iblai/data-layer 1.13.0 → 1.13.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iblai/data-layer",
3
- "version": "1.12.107",
3
+ "version": "1.13.0",
4
4
  "description": "ibl.ai data layer",
5
5
  "main": "dist/index.esm.js",
6
6
  "types": "dist/index.d.ts",
@@ -6,4 +6,10 @@ export default class Config {
6
6
  static mentorIframeUrl: string;
7
7
  static studioUrl: string;
8
8
  static httpErrorHandlers: {};
9
+ /**
10
+ * Optional override for how expired auth tokens are re-minted after a 401.
11
+ * Resolve `true` once fresh tokens are in storage. Left unset, the data
12
+ * layer mints them itself from the edX session.
13
+ */
14
+ static refreshAuthToken: (() => Promise<boolean>) | undefined;
9
15
  }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Refreshes the auth tokens, collapsing concurrent callers onto one request.
3
+ * A page load that fires ten requests in parallel produces ten 401s; without
4
+ * this they would mint ten token sets and race each other into storage.
5
+ *
6
+ * Never rejects — a thrown refresh resolves `false`, which callers read as
7
+ * "give up and run the registered 401 handler" (i.e. log out).
8
+ */
9
+ export declare const refreshAuthTokenOnce: () => Promise<boolean>;
10
+ /** Test hook: drops any in-flight refresh so cases start from a clean slate. */
11
+ export declare const __resetTokenRefreshState: () => void;
@@ -3,4 +3,4 @@ export declare const initializeDataLayer: (dmUrl: string, lmsUrl: string, legacy
3
3
  status: number;
4
4
  data?: unknown;
5
5
  message?: string;
6
- }) => void>, studioUrl?: string) => void;
6
+ }) => void>, studioUrl?: string, refreshAuthToken?: () => Promise<boolean>) => void;