UNPKG

@compas/store

Version:

Postgres & S3-compatible wrappers for common things

52 lines (51 loc) 1.95 kB
/** * @template T * @typedef {import("@compas/stdlib").Either<T, AppError>} Either */ /** * @typedef {object} SessionTransportSettings * @property {import("./session-store.js").SessionStoreSettings} sessionStoreSettings JWT * generation settings * @property {boolean} [enableHeaderTransport] Defaults to true, can be used to disable * reading the `Authorization` header * @property {object} [headerOptions] Object containing options to configure reading from * the 'Authorization' header. */ /** * Load the session from the authorization header. * * @param {import("@compas/stdlib").InsightEvent} event * @param {import("postgres").Sql<{}>} sql * @param {import("koa").Context} ctx * @param {SessionTransportSettings} settings * @returns {Promise<Either<{session: * import("./generated/common/types.d.ts").QueryResultStoreSessionStore}>>} */ export function sessionTransportLoadFromContext(event: import("@compas/stdlib").InsightEvent, sql: import("postgres").Sql<{}>, ctx: import("koa").Context, settings: SessionTransportSettings): Promise<Either<{ session: import("./generated/common/types.d.ts").QueryResultStoreSessionStore; }>>; /** * * @param {SessionTransportSettings} opts * @returns {SessionTransportSettings} */ export function validateSessionTransportSettings(opts: SessionTransportSettings): SessionTransportSettings; export type Either<T> = import("@compas/stdlib").Either<T, AppError>; export type SessionTransportSettings = { /** * JWT * generation settings */ sessionStoreSettings: import("./session-store.js").SessionStoreSettings; /** * Defaults to true, can be used to disable * reading the `Authorization` header */ enableHeaderTransport?: boolean | undefined; /** * Object containing options to configure reading from * the 'Authorization' header. */ headerOptions?: object; }; import { AppError } from "@compas/stdlib";