pull/715/head
Travis Fischer 2025-06-02 00:34:05 +07:00
rodzic 832862367d
commit 0c5df27270
5 zmienionych plików z 8 dodań i 34 usunięć

Wyświetl plik

@ -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'))
}

Wyświetl plik

@ -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
}
])

Wyświetl plik

@ -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,

Wyświetl plik

@ -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": {

Wyświetl plik

@ -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']