better-auth
Version:
The most comprehensive authentication framework for TypeScript.
95 lines • 2.75 kB
text/typescript
import { FieldSchema, OpenAPIModelSchema, OpenAPIParameter, OpenAPISchema, Path, generator } from "./generator.mjs";
import { LiteralString } from "@better-auth/core";
//#region src/plugins/open-api/index.d.ts
declare module "@better-auth/core" {
interface BetterAuthPluginRegistry<AuthOptions, Options> {
"open-api": {
creator: typeof openAPI;
};
}
}
type ScalarTheme = "alternate" | "default" | "moon" | "purple" | "solarized" | "bluePlanet" | "saturn" | "kepler" | "mars" | "deepSpace" | "laserwave" | "none";
interface OpenAPIOptions {
/**
* The path to the OpenAPI reference page
*
* keep in mind that this path will be appended to the base URL `/api/auth` path
* by default, so if you set this to `/reference`, the full path will be `/api/auth/reference`
*
* @default "/reference"
*/
path?: LiteralString | undefined;
/**
* Disable the default reference page that is generated by Scalar
*
* @default false
*/
disableDefaultReference?: boolean | undefined;
/**
* Theme of the OpenAPI reference page.
*
* @default "default"
*/
theme?: ScalarTheme | undefined;
/**
* A 'nonce' string to be attached to inline scripts
* for Content Security Policy (CSP) compliance.
* @default undefined
*/
nonce?: string | undefined;
}
declare const openAPI: <O extends OpenAPIOptions>(options?: O | undefined) => {
id: "open-api";
version: string;
endpoints: {
generateOpenAPISchema: import("better-call").StrictEndpoint<"/open-api/generate-schema", {
method: "GET";
}, {
openapi: string;
info: {
title: string;
description: string;
version: string;
};
components: {
securitySchemes: {
apiKeyCookie: {
type: string;
in: string;
name: string;
description: string;
};
bearerAuth: {
type: string;
scheme: string;
description: string;
};
};
schemas: {
[x: string]: OpenAPIModelSchema;
};
};
security: {
apiKeyCookie: never[];
bearerAuth: never[];
}[];
servers: {
url: string;
}[];
tags: {
name: string;
description: string;
}[];
paths: Record<string, Path>;
}>;
openAPIReference: import("better-call").StrictEndpoint<LiteralString | "/reference", {
method: "GET";
metadata: {
readonly scope: "server";
};
}, Response>;
};
options: NoInfer<O>;
};
//#endregion
export { type FieldSchema, type OpenAPIModelSchema, OpenAPIOptions, type OpenAPIParameter, type OpenAPISchema, type Path, type generator, openAPI };