vinextauth 0.1.0 → 0.2.0
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/adapters/cloudflare-kv.d.ts +1 -1
- package/dist/index.d.ts +41 -6
- package/dist/index.js +378 -68
- package/dist/index.js.map +1 -1
- package/dist/middleware/index.d.ts +1 -1
- package/dist/providers/credentials.d.ts +38 -0
- package/dist/providers/credentials.js +15 -0
- package/dist/providers/credentials.js.map +1 -0
- package/dist/providers/github.d.ts +1 -1
- package/dist/providers/google.d.ts +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/server/index.d.ts +32 -12
- package/dist/server/index.js +136 -8
- package/dist/server/index.js.map +1 -1
- package/dist/types-Bsno2U1C.d.ts +270 -0
- package/package.json +5 -1
- package/dist/types-G_m6Z3Iz.d.ts +0 -180
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,50 @@
|
|
|
1
|
-
import { V as VinextAuthConfig, a as VinextAuthHandlers } from './types-
|
|
2
|
-
export { A as
|
|
1
|
+
import { V as VinextAuthConfig, a as VinextAuthHandlers, R as RateLimiter } from './types-Bsno2U1C.js';
|
|
2
|
+
export { A as AccountLinkingConfig, b as AdapterInterface, c as AdapterSession, C as CallbacksConfig, d as CredentialsConfig, e as CredentialsProvider, D as DefaultJWT, f as DefaultSession, g as DefaultUser, J as JWT, h as JWTCallbackParams, i as JWTConfig, O as OAuthProvider, P as PagesConfig, j as Provider, k as RefreshTokenCallbackParams, l as RefreshTokenCallbackResult, S as Session, m as SessionCallbackParams, n as SessionConfig, o as SessionContextValue, p as SessionStatus, q as SignInCallbackParams, r as SignInOptions, s as SignOutOptions, U as User, t as VinextAuthError, u as VinextAuthErrorCode, W as WithAuthOptions } from './types-Bsno2U1C.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* VinextAuth — main factory function.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* Generics let you type your custom session and token fields without
|
|
8
|
+
* module augmentation (unlike NextAuth).
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
8
11
|
* ```ts
|
|
9
|
-
*
|
|
12
|
+
* // With custom types — no module augmentation needed
|
|
13
|
+
* const handler = VinextAuth<{ role: "admin" | "user" }, { role: string }>({
|
|
14
|
+
* providers: [GoogleProvider({ clientId, clientSecret })],
|
|
15
|
+
* callbacks: {
|
|
16
|
+
* jwt({ token, user }) {
|
|
17
|
+
* if (user) token.role = user.role // TypeScript knows this!
|
|
18
|
+
* return token
|
|
19
|
+
* },
|
|
20
|
+
* session({ session, token }) {
|
|
21
|
+
* session.user.role = token.role // Fully typed
|
|
22
|
+
* return session
|
|
23
|
+
* }
|
|
24
|
+
* }
|
|
25
|
+
* })
|
|
10
26
|
* export { handler as GET, handler as POST }
|
|
11
27
|
* ```
|
|
12
28
|
*/
|
|
13
|
-
declare function VinextAuth(config: VinextAuthConfig): VinextAuthHandlers;
|
|
29
|
+
declare function VinextAuth<TSession = {}, TToken = {}, TUser = {}>(config: VinextAuthConfig<TSession, TToken, TUser>): VinextAuthHandlers;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* In-memory rate limiter.
|
|
33
|
+
* For production, use a Redis or KV-backed store via the `store` option.
|
|
34
|
+
*
|
|
35
|
+
* Automatically cleans up expired entries every 5 minutes.
|
|
36
|
+
*/
|
|
37
|
+
declare class InMemoryRateLimiter implements RateLimiter {
|
|
38
|
+
private store;
|
|
39
|
+
private maxAttempts;
|
|
40
|
+
private windowMs;
|
|
41
|
+
constructor(maxAttempts?: number, windowMs?: number);
|
|
42
|
+
check(key: string): Promise<{
|
|
43
|
+
allowed: boolean;
|
|
44
|
+
retryAfter?: number;
|
|
45
|
+
}>;
|
|
46
|
+
reset(key: string): Promise<void>;
|
|
47
|
+
private cleanup;
|
|
48
|
+
}
|
|
14
49
|
|
|
15
|
-
export { VinextAuth, VinextAuthConfig, VinextAuthHandlers, VinextAuth as default };
|
|
50
|
+
export { InMemoryRateLimiter, RateLimiter, VinextAuth, VinextAuthConfig, VinextAuthHandlers, VinextAuth as default };
|