UNPKG

bknd

Version:

Lightweight Firebase/Supabase alternative built to run anywhere — incl. Next.js, React Router, Astro, Cloudflare, Bun, Node, AWS Lambda & more.

49 lines (48 loc) 1.93 kB
import { s } from "bknd/utils"; import { type WhereQuery } from "../../data/entities/query/WhereBuilder"; declare const sortSchema: s.ObjectSchema<{ readonly by: s.StringSchema<s.IStringOptions> & s.IStringOptions; readonly dir: { readonly enum: ["asc", "desc"]; } & s.Schema<s.ISchemaOptions, "asc" | "desc" | undefined, "asc" | "desc" | undefined>; }, s.Merge<s.IObjectOptions & { additionalProperties: false; }>>; type SortSchema = s.Static<typeof sortSchema>; export type RepoWithSchema = Record<string, Omit<RepoQueryIn, "with"> & { with?: unknown; }>; export declare const repoQuery: s.ObjectSchema<{ readonly limit: s.Schema<s.ISchemaOptions, number | undefined, number | undefined>; readonly offset: s.Schema<s.ISchemaOptions, number | undefined, number | undefined>; readonly sort: s.Schema<s.ISchemaOptions, string | { dir?: "asc" | "desc" | undefined; by: string; } | undefined, { dir?: "asc" | "desc" | undefined; by: string; } | undefined>; readonly where: s.Schema<s.ISchemaOptions, string | { [x: string]: unknown; } | undefined, WhereQuery | undefined>; readonly select: s.Schema<s.ISchemaOptions, string | string[] | undefined, string[] | undefined>; readonly join: s.Schema<s.ISchemaOptions, string | string[] | undefined, string[] | undefined>; readonly with: s.Schema<{}, RepoWithSchema | undefined, RepoWithSchema | undefined>; }, s.IObjectOptions>; export declare const getRepoQueryTemplate: () => Required<RepoQuery>; export type RepoQueryIn = { limit?: number; offset?: number; sort?: string | { by: string; dir: "asc" | "desc"; }; select?: string[]; with?: string | string[] | Record<string, RepoQueryIn>; join?: string[]; where?: WhereQuery; }; export type RepoQuery = s.StaticCoerced<typeof repoQuery> & { sort: SortSchema; }; export {};