kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
pull/715/head
rodzic
832862367d
commit
0c5df27270
|
@ -59,7 +59,8 @@ export const authRouter = issuer({
|
|||
console.log('Auth success', provider, ctx, JSON.stringify(value, null, 2))
|
||||
|
||||
function getPartialOAuthAccount() {
|
||||
assert(provider === 'github', `Unsupported provider "${provider}"`)
|
||||
assert(provider === 'github', `Unsupported OAuth provider "${provider}"`)
|
||||
const now = Date.now()
|
||||
|
||||
return {
|
||||
provider,
|
||||
|
@ -67,19 +68,17 @@ export const authRouter = issuer({
|
|||
refreshToken: value.tokenset.refresh,
|
||||
// `expires_in` and `refresh_token_expires_in` are given in seconds
|
||||
accessTokenExpiresAt: new Date(
|
||||
Date.now() + value.tokenset.raw.expires_in * 1000
|
||||
now + value.tokenset.raw.expires_in * 1000
|
||||
),
|
||||
refreshTokenExpiresAt: new Date(
|
||||
Date.now() + value.tokenset.raw.refresh_token_expires_in * 1000
|
||||
now + value.tokenset.raw.refresh_token_expires_in * 1000
|
||||
),
|
||||
scope: (value.tokenset.raw.scope as string) || undefined
|
||||
}
|
||||
}
|
||||
|
||||
if (provider === 'github') {
|
||||
const client = getGitHubClient({
|
||||
accessToken: value.tokenset.access
|
||||
})
|
||||
const client = getGitHubClient({ accessToken: value.tokenset.access })
|
||||
const { data: ghUser } = await client.rest.users.getAuthenticated()
|
||||
|
||||
if (!ghUser.email) {
|
||||
|
@ -125,14 +124,14 @@ export const authRouter = issuer({
|
|||
assert(
|
||||
user,
|
||||
400,
|
||||
`Authentication error: unsupported provider "${provider}"`
|
||||
`Authentication error: unsupported auth provider "${provider}"`
|
||||
)
|
||||
}
|
||||
|
||||
assert(
|
||||
user,
|
||||
500,
|
||||
`Authentication error for provider "${provider}": Unexpected error initializing user`
|
||||
`Authentication error for auth provider "${provider}": Unexpected error initializing user`
|
||||
)
|
||||
return ctx.subject('user', pick(user, 'id', 'username'))
|
||||
}
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
import { defineConfig } from 'tsup'
|
||||
|
||||
export default defineConfig([
|
||||
{
|
||||
entry: ['src/server.ts'],
|
||||
outDir: 'dist',
|
||||
target: 'node18',
|
||||
platform: 'node',
|
||||
format: ['esm'],
|
||||
splitting: false,
|
||||
sourcemap: true,
|
||||
minify: false,
|
||||
shims: true,
|
||||
dts: true
|
||||
}
|
||||
])
|
|
@ -1,8 +1,6 @@
|
|||
import tsconfigPaths from 'vite-tsconfig-paths'
|
||||
import { defineConfig } from 'vitest/config'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [tsconfigPaths()],
|
||||
test: {
|
||||
environment: 'node',
|
||||
globals: true,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@agentic/platform-types",
|
||||
"version": "0.0.1",
|
||||
"description": "Core zod schemas and types shared across the Agentic platform.",
|
||||
"description": "Core schemas and types shared across the Agentic platform.",
|
||||
"author": "Travis Fischer <travis@transitivebullsh.it>",
|
||||
"license": "UNLICENSED",
|
||||
"repository": {
|
||||
|
|
|
@ -26,10 +26,3 @@ export type AdminDeployment = Simplify<
|
|||
pricingPlans: PricingPlan[]
|
||||
}
|
||||
>
|
||||
|
||||
export type ProjectIdentifier = components['schemas']['ProjectIdentifier']
|
||||
export type DeploymentIdentifier = components['schemas']['DeploymentIdentifier']
|
||||
|
||||
// export type PricingPlanName = components['schemas']['name']
|
||||
// export type PricingPlanSlug = components['schemas']['slug']
|
||||
// export type PricingPlanLabel = components['schemas']['label']
|
||||
|
|
Ładowanie…
Reference in New Issue