@djangocfg/api 2.1.563 → 2.1.566
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.cjs +22 -15
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.mjs +22 -15
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +13 -6
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.mjs +13 -6
- package/dist/clients.mjs.map +1 -1
- package/dist/hooks.cjs +13 -6
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.mjs +13 -6
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.cjs +13 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.mjs +13 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/_api/generated/_cfg_accounts/schemas/OAuthAuthorizeRequestRequest.ts +2 -2
- package/src/_api/generated/_cfg_accounts/schemas/OAuthAuthorizeResponse.ts +1 -1
- package/src/_api/generated/_cfg_accounts/schemas/OAuthCallbackRequestRequest.ts +1 -1
- package/src/_api/generated/_cfg_accounts/schemas/OAuthConnection.ts +1 -1
- package/src/_api/generated/_cfg_accounts/schemas/OTPRequestRequest.ts +1 -1
- package/src/_api/generated/_cfg_accounts/schemas/OTPVerifyRequest.ts +1 -1
- package/src/_api/generated/_cfg_accounts/schemas/User.ts +1 -1
- package/src/_api/generated/_cfg_accounts/schemas/WebmailLink.ts +1 -1
- package/src/_api/generated/_cfg_totp/schemas/TotpVerifyUser.ts +1 -1
- package/src/_api/generated/helpers/auth.ts +47 -6
package/dist/index.d.cts
CHANGED
|
@@ -23,6 +23,22 @@ type SessionSnapshot = {
|
|
|
23
23
|
* Terminal-401 subscribers. Unlike the single `onUnauthorized` slot these
|
|
24
24
|
* compose: each registration returns its own unsubscribe, so StrictMode
|
|
25
25
|
* double-mounts and multiple packages can't clobber each other.
|
|
26
|
+
*
|
|
27
|
+
* THE SET LIVES ON `globalThis`, and it has to.
|
|
28
|
+
*
|
|
29
|
+
* An app that generates its own SDK gets its own compiled copy of this file,
|
|
30
|
+
* while `AuthProvider` comes from `@djangocfg/api/dist` — a second copy, with
|
|
31
|
+
* its own module scope. Tokens survive that split because both copies read the
|
|
32
|
+
* same storage keys and wake each other through `SESSION_SYNC_EVENT`; a plain
|
|
33
|
+
* module-level `Set` does not. So the app's copy raised the terminal 401 into
|
|
34
|
+
* an empty set while the provider sat subscribed to the other one, and the
|
|
35
|
+
* redirect `AuthContext` calls "the ONE exit" never fired: the cabinet kept
|
|
36
|
+
* polling a dead session and the customer watched the console fill with 401s
|
|
37
|
+
* instead of being sent to sign in. Carapis reported ten of them.
|
|
38
|
+
*
|
|
39
|
+
* Keyed by `ACCESS_KEY` for the same reason `SESSION_SYNC_EVENT` is: two
|
|
40
|
+
* stores configured against different token keys are different sessions and
|
|
41
|
+
* must not share subscribers.
|
|
26
42
|
*/
|
|
27
43
|
type SessionExpiredHandler = (response: Response) => void;
|
|
28
44
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -23,6 +23,22 @@ type SessionSnapshot = {
|
|
|
23
23
|
* Terminal-401 subscribers. Unlike the single `onUnauthorized` slot these
|
|
24
24
|
* compose: each registration returns its own unsubscribe, so StrictMode
|
|
25
25
|
* double-mounts and multiple packages can't clobber each other.
|
|
26
|
+
*
|
|
27
|
+
* THE SET LIVES ON `globalThis`, and it has to.
|
|
28
|
+
*
|
|
29
|
+
* An app that generates its own SDK gets its own compiled copy of this file,
|
|
30
|
+
* while `AuthProvider` comes from `@djangocfg/api/dist` — a second copy, with
|
|
31
|
+
* its own module scope. Tokens survive that split because both copies read the
|
|
32
|
+
* same storage keys and wake each other through `SESSION_SYNC_EVENT`; a plain
|
|
33
|
+
* module-level `Set` does not. So the app's copy raised the terminal 401 into
|
|
34
|
+
* an empty set while the provider sat subscribed to the other one, and the
|
|
35
|
+
* redirect `AuthContext` calls "the ONE exit" never fired: the cabinet kept
|
|
36
|
+
* polling a dead session and the customer watched the console fill with 401s
|
|
37
|
+
* instead of being sent to sign in. Carapis reported ten of them.
|
|
38
|
+
*
|
|
39
|
+
* Keyed by `ACCESS_KEY` for the same reason `SESSION_SYNC_EVENT` is: two
|
|
40
|
+
* stores configured against different token keys are different sessions and
|
|
41
|
+
* must not share subscribers.
|
|
26
42
|
*/
|
|
27
43
|
type SessionExpiredHandler = (response: Response) => void;
|
|
28
44
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -155,11 +155,10 @@ var _storageMode = "localStorage";
|
|
|
155
155
|
var _storage = backendFor(_storageMode);
|
|
156
156
|
function detectLocale() {
|
|
157
157
|
try {
|
|
158
|
-
if (typeof document
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
158
|
+
if (typeof document === "undefined") return null;
|
|
159
|
+
const m = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
|
|
160
|
+
const locale = m?.[1];
|
|
161
|
+
if (locale !== void 0) return decodeURIComponent(locale);
|
|
163
162
|
if (typeof navigator !== "undefined" && navigator.language) {
|
|
164
163
|
return navigator.language;
|
|
165
164
|
}
|
|
@@ -291,7 +290,15 @@ function ensureStorageSync() {
|
|
|
291
290
|
window.addEventListener(SESSION_SYNC_EVENT, () => notifySessionChanged());
|
|
292
291
|
}
|
|
293
292
|
__name(ensureStorageSync, "ensureStorageSync");
|
|
294
|
-
var
|
|
293
|
+
var SESSION_EXPIRED_REGISTRY = `cfg-auth:expired-handlers:${ACCESS_KEY}`;
|
|
294
|
+
var _sessionExpiredHandlers = (() => {
|
|
295
|
+
const g = globalThis;
|
|
296
|
+
const existing = g[SESSION_EXPIRED_REGISTRY];
|
|
297
|
+
if (existing instanceof Set) return existing;
|
|
298
|
+
const created = /* @__PURE__ */ new Set();
|
|
299
|
+
g[SESSION_EXPIRED_REGISTRY] = created;
|
|
300
|
+
return created;
|
|
301
|
+
})();
|
|
295
302
|
var _client = null;
|
|
296
303
|
function pushClientConfig() {
|
|
297
304
|
if (!_client) return;
|