UNPKG

bknd

Version:

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

78 lines (77 loc) 2.49 kB
import { s } from "../../core/object/schema"; import { type WhereQuery } from "../../data"; declare const sortSchema: s.TObject<{ by: s.TString<s.StringSchema>; dir: s.TOptional<s.TString<{ readonly enum: ["asc", "desc"]; }>>; }, s.ObjectSchema>; type SortSchema = s.Static<typeof sortSchema>; export type RepoWithSchema = Record<string, Omit<RepoQueryIn, "with"> & { with?: unknown; }>; export declare const repoQuery: s.TPartialObject<{ limit: s.TNumber<{ readonly default: 10; }>; offset: s.TNumber<{ readonly default: 0; }>; sort: s.TAnyOf<[s.TString<s.StringSchema>, s.TObject<{ by: s.TString<s.StringSchema>; dir: s.TOptional<s.TString<{ readonly enum: ["asc", "desc"]; }>>; }, s.ObjectSchema>], { readonly default: { by: string; dir: string; }; readonly coerce: (v: unknown) => SortSchema; }>; where: s.TAnyOf<[s.TString<s.StringSchema>, s.TObject<{}, s.ObjectSchema>], { readonly default: {}; readonly examples: [{ readonly attribute: { readonly $eq: 1; }; }]; readonly coerce: (value: unknown) => WhereQuery; }>; select: s.TAnyOf<[s.TString<{ readonly pattern: "^(?:[a-zA-Z_$][\\w$]*)(?:,[a-zA-Z_$][\\w$]*)*$"; }>, s.TArray<s.TString<{ readonly pattern: "^(?:[a-zA-Z_$][\\w$]*)(?:,[a-zA-Z_$][\\w$]*)*$"; }>, { readonly uniqueItems: true; }>], { readonly default: readonly []; readonly coerce: (v: unknown) => string[]; }>; join: s.TAnyOf<[s.TString<{ readonly pattern: "^(?:[a-zA-Z_$][\\w$]*)(?:,[a-zA-Z_$][\\w$]*)*$"; }>, s.TArray<s.TString<{ readonly pattern: "^(?:[a-zA-Z_$][\\w$]*)(?:,[a-zA-Z_$][\\w$]*)*$"; }>, { readonly uniqueItems: true; }>], { readonly default: readonly []; readonly coerce: (v: unknown) => string[]; }>; with: s.TSchemaInOut<RepoWithSchema, RepoWithSchema>; }, s.ObjectSchema>; 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>; export {};