@djangocfg/api 2.1.448 → 2.1.449
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-server.cjs +1 -2272
- package/dist/auth-server.cjs.map +1 -1
- package/dist/auth-server.d.cts +1 -35
- package/dist/auth-server.d.ts +1 -35
- package/dist/auth-server.mjs +1 -2272
- package/dist/auth-server.mjs.map +1 -1
- package/dist/auth.cjs +207 -128
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +135 -2
- package/dist/auth.d.ts +135 -2
- package/dist/auth.mjs +216 -137
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +35 -0
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +147 -2
- package/dist/clients.d.ts +147 -2
- package/dist/clients.mjs +35 -0
- package/dist/clients.mjs.map +1 -1
- package/dist/hooks.cjs +11 -0
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.mjs +11 -0
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.cjs +35 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +169 -6
- package/dist/index.d.ts +169 -6
- package/dist/index.mjs +35 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -4
- package/src/_api/generated/_cfg_accounts/api.ts +8 -0
- package/src/_api/generated/_cfg_accounts/openapi.json +84 -5
- package/src/_api/generated/_cfg_accounts/schemas/OAuthTokenResponse.ts +2 -2
- package/src/_api/generated/_cfg_accounts/schemas/OTPRequestResponse.ts +2 -0
- package/src/_api/generated/_cfg_accounts/schemas/WebmailLink.ts +15 -0
- package/src/_api/generated/_cfg_accounts/schemas/WebmailLinkProviderEnum.ts +9 -0
- package/src/_api/generated/_cfg_accounts/schemas/index.ts +2 -0
- package/src/_api/generated/_cfg_centrifugo/api.ts +8 -0
- package/src/_api/generated/_cfg_totp/api.ts +8 -0
- package/src/_api/generated/helpers/auth.ts +12 -0
- package/src/_api/generated/openapi.json +84 -5
- package/src/_api/generated/types.gen.ts +131 -2
- package/src/auth/__tests__/refreshRotation.test.ts +119 -0
- package/src/auth/context/AuthContext.tsx +10 -1
- package/src/auth/hooks/useAuthForm.ts +5 -2
- package/src/auth/hooks/useAuthFormState.ts +4 -1
- package/src/auth/hooks/useTokenRefresh.ts +29 -45
- package/src/auth/middlewares/index.ts +7 -7
- package/src/auth/refreshHandler.ts +79 -0
- package/src/auth/types/form.ts +10 -0
- package/src/auth/types/index.ts +1 -0
- package/src/auth/middlewares/tokenRefresh.ts +0 -161
package/dist/index.cjs
CHANGED
|
@@ -340,6 +340,17 @@ var auth = {
|
|
|
340
340
|
*/
|
|
341
341
|
setRefreshHandler(fn) {
|
|
342
342
|
_refreshHandler = fn;
|
|
343
|
+
},
|
|
344
|
+
/**
|
|
345
|
+
* Proactively run the registered refresh handler right now, reusing the
|
|
346
|
+
* SAME single-flight promise as the 401-recovery interceptor. Callers
|
|
347
|
+
* (e.g. an expiry timer / focus / reconnect) get token rotation,
|
|
348
|
+
* de-duplication and rotated-token persistence for free — they must NOT
|
|
349
|
+
* re-implement any of it. Returns the fresh access token, or null if
|
|
350
|
+
* there is no handler / no refresh token / the refresh failed.
|
|
351
|
+
*/
|
|
352
|
+
refreshNow() {
|
|
353
|
+
return tryRefresh();
|
|
343
354
|
}
|
|
344
355
|
};
|
|
345
356
|
async function tryRefresh() {
|
|
@@ -2063,6 +2074,14 @@ var API = class {
|
|
|
2063
2074
|
setRefreshHandler(fn) {
|
|
2064
2075
|
auth.setRefreshHandler(fn);
|
|
2065
2076
|
}
|
|
2077
|
+
/**
|
|
2078
|
+
* Proactively refresh now via the registered handler, sharing the single
|
|
2079
|
+
* 401-recovery flight (rotation + dedup + rotated-token persistence).
|
|
2080
|
+
* See `auth.refreshNow`.
|
|
2081
|
+
*/
|
|
2082
|
+
refreshNow() {
|
|
2083
|
+
return auth.refreshNow();
|
|
2084
|
+
}
|
|
2066
2085
|
};
|
|
2067
2086
|
|
|
2068
2087
|
// src/_api/generated/helpers/storage.ts
|
|
@@ -2254,6 +2273,14 @@ var API2 = class {
|
|
|
2254
2273
|
setRefreshHandler(fn) {
|
|
2255
2274
|
auth.setRefreshHandler(fn);
|
|
2256
2275
|
}
|
|
2276
|
+
/**
|
|
2277
|
+
* Proactively refresh now via the registered handler, sharing the single
|
|
2278
|
+
* 401-recovery flight (rotation + dedup + rotated-token persistence).
|
|
2279
|
+
* See `auth.refreshNow`.
|
|
2280
|
+
*/
|
|
2281
|
+
refreshNow() {
|
|
2282
|
+
return auth.refreshNow();
|
|
2283
|
+
}
|
|
2257
2284
|
};
|
|
2258
2285
|
|
|
2259
2286
|
// src/_api/generated/_cfg_totp/api.ts
|
|
@@ -2321,6 +2348,14 @@ var API3 = class {
|
|
|
2321
2348
|
setRefreshHandler(fn) {
|
|
2322
2349
|
auth.setRefreshHandler(fn);
|
|
2323
2350
|
}
|
|
2351
|
+
/**
|
|
2352
|
+
* Proactively refresh now via the registered handler, sharing the single
|
|
2353
|
+
* 401-recovery flight (rotation + dedup + rotated-token persistence).
|
|
2354
|
+
* See `auth.refreshNow`.
|
|
2355
|
+
*/
|
|
2356
|
+
refreshNow() {
|
|
2357
|
+
return auth.refreshNow();
|
|
2358
|
+
}
|
|
2324
2359
|
};
|
|
2325
2360
|
|
|
2326
2361
|
// src/_api/generated/index.ts
|