import type { EndpointOutput } from "@sveltejs/kit"; import type { ServerRequest } from "@sveltejs/kit/types/endpoint"; import type { CallbackResult } from "../types"; export interface ProviderConfig { id?: string; profile?: (profile: any, account: any) => any | Promise; } export abstract class Provider { id: string; constructor(protected readonly config: T) { this.id = config.id!; } getUri(host: string, path: string) { return `http://${host}${path}`; } getCallbackUri(host: string) { return this.getUri(host, `${"/api/auth/callback/"}${this.id}`); } abstract signin = Record, Body = unknown>( request: ServerRequest, ): EndpointOutput | Promise; abstract callback = Record, Body = unknown>( request: ServerRequest, ): CallbackResult | Promise; }