File tree Expand file tree Collapse file tree 6 files changed +76
-7
lines changed
Expand file tree Collapse file tree 6 files changed +76
-7
lines changed Original file line number Diff line number Diff line change 1- import { $ } from "bun"
1+ import { $ } from "bun" ;
22
3- await $ `tsc`
4- await $ `cp types/index.d.ts dist/index.d.ts`
3+ await $ `tsc` ;
4+ await $ `mkdir -p dist/types` ;
5+ await $ `cp types/*.d.ts dist/types/` ;
56
67console . log ( "Build completed successfully!" ) ;
Original file line number Diff line number Diff line change 2929 "dependencies" : {
3030 "jsonwebtoken" : " ^9.0.2" ,
3131 "next" : " ^15.3.2"
32+ },
33+ "exports" : {
34+ "." : {
35+ "import" : " ./dist/index.js" ,
36+ "require" : " ./dist/index.js" ,
37+ "types" : " ./dist/types/index.d.ts"
38+ },
39+ "./redirect" : {
40+ "import" : " ./dist/redirect.js" ,
41+ "require" : " ./dist/redirect.js" ,
42+ "types" : " ./dist/types/redirect.d.ts"
43+ },
44+ "./server-actions" : {
45+ "import" : " ./dist/server-actions.js" ,
46+ "require" : " ./dist/server-actions.js" ,
47+ "types" : " ./dist/types/server-actions.d.ts"
48+ }
49+ },
50+ "typesVersions" : {
51+ "*" : {
52+ "redirect" : [" dist/types/redirect.d.ts" ],
53+ "server-actions" : [" dist/types/server-actions.d.ts" ]
54+ }
3255 }
3356}
Original file line number Diff line number Diff line change @@ -33,11 +33,23 @@ export function setup(config: Config) {
3333 }
3434 }
3535 if ( globalConfig ) {
36- console . warn ( "Global config is already set. Overwriting existing config." ) ;
36+ console . warn (
37+ "Global config is already set. Overwriting existing config." ,
38+ ) ;
3739 }
3840 globalConfig = {
39- clientId : config . clientId ?? process . env . AUTH_DISCORD_ID ?? ( ( ) => { throw new Error ( "clientId is required" ) ; } ) ( ) ,
40- clientSecret : config . clientSecret ?? process . env . AUTH_DISCORD_SECRET ?? ( ( ) => { throw new Error ( "clientSecret is required" ) ; } ) ( ) ,
41+ clientId :
42+ config . clientId ??
43+ process . env . AUTH_DISCORD_ID ??
44+ ( ( ) => {
45+ throw new Error ( "clientId is required" ) ;
46+ } ) ( ) ,
47+ clientSecret :
48+ config . clientSecret ??
49+ process . env . AUTH_DISCORD_SECRET ??
50+ ( ( ) => {
51+ throw new Error ( "clientSecret is required" ) ;
52+ } ) ( ) ,
4153 scopes : config . scopes ?? [ "identify" , "email" ] ,
4254 redirectUri : config . redirectUri ,
4355 jwtSecret : config . jwtSecret ,
Original file line number Diff line number Diff line change 1- declare module '@mikandev/next-discord-auth' ;
1+ export interface Session {
2+ user : {
3+ id : string ;
4+ name : string ;
5+ email ?: string ;
6+ avatar : string ;
7+ } ;
8+ expires : string ;
9+ accessToken ?: string ;
10+ }
11+
12+ export interface Config {
13+ clientId : string ;
14+ clientSecret : string ;
15+ scopes : string [ ] ;
16+ redirectUri : string ;
17+ jwtSecret : string ;
18+ }
19+
20+ export function setup ( config : Config ) : void ;
21+ export function getGlobalConfig ( ) : Config ;
Original file line number Diff line number Diff line change 1+ import type { NextRequest , NextResponse } from "next/server" ;
2+
3+ export declare function handleRedirect (
4+ req : NextRequest ,
5+ ) : Promise < NextResponse | void > ;
Original file line number Diff line number Diff line change 1+ import type { NextRequest , NextResponse } from "next/server" ;
2+ import type { Session } from "./index" ;
3+
4+ export declare function getSession ( req : NextRequest ) : Promise < Session | null > ;
5+
6+ export declare function signIn ( req : NextRequest ) : Promise < NextResponse > ;
7+
8+ export declare function signOut ( req : NextRequest ) : Promise < NextResponse > ;
You can’t perform that action at this time.
0 commit comments