@@ -7,9 +7,9 @@ import * as schema from '@codebuff/common/db/schema'
77import { DEFAULT_FREE_CREDITS_GRANT } from '@codebuff/common/old-constants'
88import { getNextQuotaReset } from '@codebuff/common/util/dates'
99import { generateCompactId } from '@codebuff/common/util/string'
10- import { stripeServer } from '@codebuff/common/util/stripe'
1110import { logSyncFailure } from '@codebuff/common/util/sync-failure'
1211import { loops , env } from '@codebuff/internal'
12+ import { stripeServer } from '@codebuff/internal/util/stripe'
1313import { eq } from 'drizzle-orm'
1414import GitHubProvider from 'next-auth/providers/github'
1515
@@ -29,7 +29,7 @@ async function createAndLinkStripeCustomer(params: {
2929 if ( ! email || ! name ) {
3030 logger . warn (
3131 { userId } ,
32- 'User email or name missing, cannot create Stripe customer.'
32+ 'User email or name missing, cannot create Stripe customer.' ,
3333 )
3434 return null
3535 }
@@ -58,7 +58,7 @@ async function createAndLinkStripeCustomer(params: {
5858
5959 logger . info (
6060 { userId, customerId : customer . id } ,
61- 'Stripe customer created with usage subscription and linked to user.'
61+ 'Stripe customer created with usage subscription and linked to user.' ,
6262 )
6363 return customer . id
6464 } catch ( error ) {
@@ -68,7 +68,7 @@ async function createAndLinkStripeCustomer(params: {
6868 : 'Unknown error creating Stripe customer'
6969 logger . error (
7070 { userId, error } ,
71- 'Failed to create Stripe customer or update user record.'
71+ 'Failed to create Stripe customer or update user record.' ,
7272 )
7373 await logSyncFailure ( {
7474 id : userId ,
@@ -107,7 +107,7 @@ async function createInitialCreditGrant(params: {
107107 creditsGranted : DEFAULT_FREE_CREDITS_GRANT ,
108108 expiresAt : nextQuotaReset ,
109109 } ,
110- 'Initial free credit grant created.'
110+ 'Initial free credit grant created.' ,
111111 )
112112 } catch ( grantError ) {
113113 const errorMessage =
@@ -116,7 +116,7 @@ async function createInitialCreditGrant(params: {
116116 : 'Unknown error creating initial credit grant'
117117 logger . error (
118118 { userId, error : grantError } ,
119- 'Failed to create initial credit grant.'
119+ 'Failed to create initial credit grant.' ,
120120 )
121121 await logSyncFailure ( {
122122 id : userId ,
@@ -167,7 +167,7 @@ export const authOptions: NextAuthOptions = {
167167 authCode : ! ! authCode ,
168168 referralCode,
169169 allParams : Object . fromEntries (
170- potentialRedirectUrl . searchParams . entries ( )
170+ potentialRedirectUrl . searchParams . entries ( ) ,
171171 ) ,
172172 } )
173173
@@ -179,30 +179,30 @@ export const authOptions: NextAuthOptions = {
179179 console . log ( '🟡 NextAuth CLI flow redirect to:' , onboardUrl . toString ( ) )
180180 logger . info (
181181 { url, authCode, redirectTarget : onboardUrl . toString ( ) } ,
182- 'Redirecting CLI flow to /onboard'
182+ 'Redirecting CLI flow to /onboard' ,
183183 )
184184 return onboardUrl . toString ( )
185185 }
186186
187187 if ( url . startsWith ( '/' ) || potentialRedirectUrl . origin === baseUrl ) {
188188 console . log (
189189 '🟡 NextAuth web flow redirect to:' ,
190- potentialRedirectUrl . toString ( )
190+ potentialRedirectUrl . toString ( ) ,
191191 )
192192 logger . info (
193193 { url, redirectTarget : potentialRedirectUrl . toString ( ) } ,
194- 'Redirecting web flow to callbackUrl'
194+ 'Redirecting web flow to callbackUrl' ,
195195 )
196196 return potentialRedirectUrl . toString ( )
197197 }
198198
199199 console . log (
200200 '🟡 NextAuth external/invalid URL, redirect to baseUrl:' ,
201- baseUrl
201+ baseUrl ,
202202 )
203203 logger . info (
204204 { url, baseUrl, redirectTarget : baseUrl } ,
205- 'Callback URL is external or invalid, redirecting to baseUrl'
205+ 'Callback URL is external or invalid, redirecting to baseUrl' ,
206206 )
207207 return baseUrl
208208 } ,
@@ -211,7 +211,7 @@ export const authOptions: NextAuthOptions = {
211211 createUser : async ( { user } ) => {
212212 logger . info (
213213 { userId : user . id , email : user . email } ,
214- 'createUser event triggered'
214+ 'createUser event triggered' ,
215215 )
216216
217217 // Get all user data we need upfront
0 commit comments