@hono/auth-js 1.0.16 → 1.0.17

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @hono/auth-js
2
2
 
3
+ ## 1.0.17
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1210](https://github.com/honojs/middleware/pull/1210) [`0758fd0af1f213131d0894299e5bec716d284580`](https://github.com/honojs/middleware/commit/0758fd0af1f213131d0894299e5bec716d284580) Thanks [@BarryThePenguin](https://github.com/BarryThePenguin)! - Add explicit return types
8
+
3
9
  ## 1.0.16
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.cts CHANGED
@@ -25,7 +25,7 @@ interface AuthConfig extends Omit<AuthConfig$1, 'raw'> {
25
25
  }
26
26
  type ConfigHandler = (c: Context) => AuthConfig;
27
27
  declare function setEnvDefaults(env: AuthEnv, config: AuthConfig): void;
28
- declare function reqWithEnvUrl(req: Request, authUrl?: string): Request<unknown, CfProperties<unknown>>;
28
+ declare function reqWithEnvUrl(req: Request, authUrl?: string): Request;
29
29
  declare function getAuthUser(c: Context): Promise<AuthUser | null>;
30
30
  declare function verifyAuth(): MiddlewareHandler;
31
31
  declare function initAuthConfig(cb: ConfigHandler): MiddlewareHandler;
package/dist/index.d.ts CHANGED
@@ -25,7 +25,7 @@ interface AuthConfig extends Omit<AuthConfig$1, 'raw'> {
25
25
  }
26
26
  type ConfigHandler = (c: Context) => AuthConfig;
27
27
  declare function setEnvDefaults(env: AuthEnv, config: AuthConfig): void;
28
- declare function reqWithEnvUrl(req: Request, authUrl?: string): Request<unknown, CfProperties<unknown>>;
28
+ declare function reqWithEnvUrl(req: Request, authUrl?: string): Request;
29
29
  declare function getAuthUser(c: Context): Promise<AuthUser | null>;
30
30
  declare function verifyAuth(): MiddlewareHandler;
31
31
  declare function initAuthConfig(cb: ConfigHandler): MiddlewareHandler;
package/dist/react.d.cts CHANGED
@@ -75,6 +75,10 @@ type WindowProps = {
75
75
  width: number;
76
76
  height: number;
77
77
  };
78
+ type AuthState = {
79
+ status: 'loading' | 'success' | 'errored';
80
+ error?: string;
81
+ };
78
82
 
79
83
  declare class AuthConfigManager {
80
84
  private static instance;
@@ -87,15 +91,7 @@ declare class AuthConfigManager {
87
91
  initializeConfig(hasInitialSession: boolean): void;
88
92
  }
89
93
  declare const authConfigManager: AuthConfigManager;
90
- declare const SessionContext: React$1.Context<{
91
- update: UpdateSession;
92
- data: Session;
93
- status: "authenticated";
94
- } | {
95
- update: UpdateSession;
96
- data: null;
97
- status: "unauthenticated" | "loading";
98
- } | undefined>;
94
+ declare const SessionContext: React$1.Context<SessionContextValue | undefined>;
99
95
  declare function getSession(params?: GetSessionParams): Promise<Session | null>;
100
96
  declare function getCsrfToken(): Promise<string>;
101
97
  declare function SessionProvider(props: SessionProviderProps): React$1.JSX.Element;
@@ -108,10 +104,9 @@ interface PopupLoginOptions extends Partial<Omit<WindowProps, 'url'>> {
108
104
  onSuccess?: () => void;
109
105
  callbackUrl?: string;
110
106
  }
111
- declare const useOauthPopupLogin: (provider: Parameters<typeof signIn>[0], options?: PopupLoginOptions) => {
112
- status: "loading" | "success" | "errored";
113
- error?: string;
107
+ interface LoginState extends AuthState {
114
108
  popUpSignin: () => Promise<void>;
115
- };
109
+ }
110
+ declare const useOauthPopupLogin: (provider: Parameters<typeof signIn>[0], options?: PopupLoginOptions) => LoginState;
116
111
 
117
112
  export { SessionContext, SessionProvider, authConfigManager, getCsrfToken, getProviders, getSession, signIn, signOut, useOauthPopupLogin, useSession };
package/dist/react.d.ts CHANGED
@@ -75,6 +75,10 @@ type WindowProps = {
75
75
  width: number;
76
76
  height: number;
77
77
  };
78
+ type AuthState = {
79
+ status: 'loading' | 'success' | 'errored';
80
+ error?: string;
81
+ };
78
82
 
79
83
  declare class AuthConfigManager {
80
84
  private static instance;
@@ -87,15 +91,7 @@ declare class AuthConfigManager {
87
91
  initializeConfig(hasInitialSession: boolean): void;
88
92
  }
89
93
  declare const authConfigManager: AuthConfigManager;
90
- declare const SessionContext: React$1.Context<{
91
- update: UpdateSession;
92
- data: Session;
93
- status: "authenticated";
94
- } | {
95
- update: UpdateSession;
96
- data: null;
97
- status: "unauthenticated" | "loading";
98
- } | undefined>;
94
+ declare const SessionContext: React$1.Context<SessionContextValue | undefined>;
99
95
  declare function getSession(params?: GetSessionParams): Promise<Session | null>;
100
96
  declare function getCsrfToken(): Promise<string>;
101
97
  declare function SessionProvider(props: SessionProviderProps): React$1.JSX.Element;
@@ -108,10 +104,9 @@ interface PopupLoginOptions extends Partial<Omit<WindowProps, 'url'>> {
108
104
  onSuccess?: () => void;
109
105
  callbackUrl?: string;
110
106
  }
111
- declare const useOauthPopupLogin: (provider: Parameters<typeof signIn>[0], options?: PopupLoginOptions) => {
112
- status: "loading" | "success" | "errored";
113
- error?: string;
107
+ interface LoginState extends AuthState {
114
108
  popUpSignin: () => Promise<void>;
115
- };
109
+ }
110
+ declare const useOauthPopupLogin: (provider: Parameters<typeof signIn>[0], options?: PopupLoginOptions) => LoginState;
116
111
 
117
112
  export { SessionContext, SessionProvider, authConfigManager, getCsrfToken, getProviders, getSession, signIn, signOut, useOauthPopupLogin, useSession };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hono/auth-js",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "A third-party Auth js middleware for Hono",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",