@schemavaults/auth-react-provider 0.11.7 → 0.11.9
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.
|
@@ -19,7 +19,12 @@ export function useCurrentUserWithRevalidation() {
|
|
|
19
19
|
const auth = useAuth();
|
|
20
20
|
const app_id = useAppId();
|
|
21
21
|
const clientRef = auth.ready ? auth.client : null;
|
|
22
|
-
|
|
22
|
+
// Don't gate on `inMemoryUser` — when resuming a session whose cached user
|
|
23
|
+
// data has been cleared (or never populated in this tab), the in-memory
|
|
24
|
+
// state is null but the refresh-token cookie may still be valid. The
|
|
25
|
+
// fetcher returns null early when no refresh token exists, so this is safe
|
|
26
|
+
// for unauthenticated users.
|
|
27
|
+
const enabled = !!(auth.ready && clientRef?.current);
|
|
23
28
|
const { data: revalidatedUser } = useSWR(enabled ? `/api/auth/whoami/${app_id}` : null, async () => {
|
|
24
29
|
const authClient = clientRef?.current ?? null;
|
|
25
30
|
if (!authClient) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-current-user-swr.js","sourceRoot":"","sources":["../../src/hooks/use-current-user-swr.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAIb,OAAO,MAAM,MAAM,KAAK,CAAC;AACzB,OAAO,OAAO,MAAM,kBAAkB,CAAC;AACvC,OAAO,QAAQ,MAAM,oBAAoB,CAAC;AAC1C,OAAO,cAAc,MAAM,0BAA0B,CAAC;AAEtD,MAAM,0BAA0B,GAAG,MAAM,CAAC;AAC1C,MAAM,2BAA2B,GAAG,MAAM,CAAC;AAE3C;;;;;;;;GAQG;AACH,MAAM,UAAU,8BAA8B;IAC5C,MAAM,YAAY,GAAG,cAAc,EAAE,CAAC;IACtC,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,MAAM,MAAM,GAAG,QAAQ,EAAE,CAAC;IAE1B,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAA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AU,CAAC,8BAA8B,EAAE,CAAC;IAC3D,CAAC,EACD;QACE,eAAe,EAAE,0BAA0B;QAC3C,gBAAgB,EAAE,2BAA2B;QAC7C,iBAAiB,EAAE,IAAI;QACvB,YAAY,EAAE,YAAY;KAC3B,CACF,CAAC;IAEF,OAAO,YAAY,IAAI,eAAe,IAAI,IAAI,CAAC;AACjD,CAAC;AAED,eAAe,8BAA8B,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { SchemaVaultsAuthProvider, default as AuthProvider, default as default, } from "./auth-provider";
|
|
2
|
-
export type { SchemaVaultsAuthProviderProps
|
|
2
|
+
export type { SchemaVaultsAuthProviderProps } from "./auth-provider";
|
|
3
3
|
export type { SchemaVaultsAppEnvironment } from "@schemavaults/app-definitions";
|
|
4
4
|
export type { ISchemaVaultsAuthClient } from "@schemavaults/auth-client-sdk";
|
|
5
5
|
export * from "./hooks";
|
|
@@ -9,3 +9,5 @@ export type { UserData } from "./types/UserData";
|
|
|
9
9
|
export type * from "./types/client-application";
|
|
10
10
|
export { isValidErrorId, ERROR_MESSAGE_CATALOG, } from "@schemavaults/auth-client-sdk";
|
|
11
11
|
export type { ApiServerId } from "@schemavaults/app-definitions";
|
|
12
|
+
export { AuthMiddleware, defaultAuthMiddlewareRules, } from "@schemavaults/auth-client-sdk";
|
|
13
|
+
export type { AuthMiddlewareRules, AuthMiddlewareResult, AuthMiddlewareOptions, AuthMiddlewareError, } from "@schemavaults/auth-client-sdk";
|
package/dist/index.js
CHANGED
|
@@ -2,4 +2,6 @@ export { SchemaVaultsAuthProvider, default as AuthProvider, default as default,
|
|
|
2
2
|
export * from "./hooks";
|
|
3
3
|
// Auth-Common Error Catalog
|
|
4
4
|
export { isValidErrorId, ERROR_MESSAGE_CATALOG, } from "@schemavaults/auth-client-sdk";
|
|
5
|
+
// Auth Middleware Re-exports
|
|
6
|
+
export { AuthMiddleware, defaultAuthMiddlewareRules, } from "@schemavaults/auth-client-sdk";
|
|
5
7
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,OAAO,IAAI,YAAY,EACvB,OAAO,IAAI,OAAO,GACnB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,OAAO,IAAI,YAAY,EACvB,OAAO,IAAI,OAAO,GACnB,MAAM,iBAAiB,CAAC;AAMzB,cAAc,SAAS,CAAC;AASxB,4BAA4B;AAC5B,OAAO,EACL,cAAc,EACd,qBAAqB,GACtB,MAAM,+BAA+B,CAAC;AAIvC,6BAA6B;AAC7B,OAAO,EACL,cAAc,EACd,0BAA0B,GAC3B,MAAM,+BAA+B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@schemavaults/auth-react-provider",
|
|
3
3
|
"description": "React hooks and components to make using the @schemavaults/auth-client-sdk a breeze",
|
|
4
|
-
"version": "0.11.
|
|
4
|
+
"version": "0.11.9",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"private": false,
|
|
7
7
|
"repository": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"types": "dist/index.d.ts",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"zod": "3.25.8",
|
|
18
|
-
"@schemavaults/auth-client-sdk": "0.10.
|
|
18
|
+
"@schemavaults/auth-client-sdk": "0.10.6",
|
|
19
19
|
"@schemavaults/app-definitions": "0.7.0",
|
|
20
20
|
"@schemavaults/auth-common": "0.12.2",
|
|
21
21
|
"cookies-next": "6.1.1",
|