/** Selected generated native adapters: constants and compiled predicates, never a manifest interpreter. */ import { type Caller, type Row } from "@aotter/mantle/contracts"; import { type Recipe, type Step, type Bound, type Values } from "@aotter/mantle/binds"; import { type CursorKind } from "@aotter/mantle/paging"; import type { EntryPageQuery } from "./entries.js"; export interface NativeAdapter { readonly read: (db: Database, sql: string, values: unknown[]) => PromiseLike | Row[]; readonly values: Values; readonly param: (n: number) => string; readonly escapeLike: (s: string) => string; readonly sqlite: boolean; } export declare function nativeStatistics(specs: Readonly>, adapter: NativeAdapter, db: Database, caller: Caller, collection: string, args: { from: number; to: number; bucketMs: number; }): Promise<{ total: number; buckets: { bucket: number; subtype: string | null; count: number; }[]; }>; export declare function nativeText(value: unknown): void; export declare function scalarNumber(raw: string, integer: boolean, path: string): number; export type NativePageMode = { marker: string; binds: readonly Recipe[]; keys: number; first: { prefix: string; extra: readonly number[]; }; next?: { prefix: string; extra: readonly number[]; }; tail: string; eq: Readonly>; search?: string; }; export declare function nativePage(spec: { path: string; cap: number; cursorKinds: readonly CursorKind[]; caller: NativePageMode; trusted: NativePageMode; }, adapter: NativeAdapter, db: Database, caller: Caller, input: Record, options: { limit?: number; cursor?: string; match?: Record; }): Promise<{ rows: Row[]; nextCursor?: string; }>; /** An OCC value must retain the exact native int8; a rounded number is never a lock. */ export declare const exactVersion: (value: unknown) => value is number | string; /** Per `x-mantle-ref` field to a scoped Schema, Core's check of a written value: each hole token takes a written field's value or a bind. */ export type RefChecks = Readonly>; /** Constant procedure fragments and recipes are printed by Core; the app supplies only checked values. */ export interface NativeEntryMode { readonly projection: string; readonly from: string; readonly policy: string; readonly binds: readonly Recipe[]; readonly fields: Readonly>; readonly create: { readonly prefix: string; readonly between: string; readonly suffix: string; readonly binds: readonly Recipe[]; readonly columns: readonly string[]; readonly values: readonly string[]; readonly returning: string; readonly refs?: RefChecks; }; readonly patch: { readonly prefix: string; readonly binds: readonly Recipe[]; readonly sets: readonly string[]; readonly where: string; readonly returning: string; readonly refs?: RefChecks; }; readonly remove: Step; } export interface NativeEntryProcedures { readonly userScopes?: readonly { readonly column: string; readonly field: string; readonly type: "string" | "number"; }[]; readonly path: string; readonly marker: string; readonly scoped?: boolean; readonly caller: NativeEntryMode; readonly trusted: NativeEntryMode; } export interface NativeProcedureAdapter extends NativeAdapter { readonly procedure: (db: Database, steps: readonly Bound[], path: string) => Promise; } export interface NativeCollection extends NativeEntryProcedures { readonly id: string; readonly cursorAliases: readonly [{ readonly name: string; readonly sql: string; }, { readonly name: string; readonly sql: string; }]; readonly fields: Readonly>; readonly orderFields: readonly string[]; readonly search?: string; readonly statistics?: { readonly column?: string; readonly time: string; readonly subtype: string; readonly rowsAlias: { readonly name: string; readonly sql: string; }; }; } export declare function nativeEntryGet(spec: NativeCollection, adapter: NativeAdapter, db: Database, caller: Caller, id: string): Promise; /** Prepare and execution admit only writable fields; inserts fill the caller's scope values. */ export declare function nativeEntryData(spec: NativeEntryProcedures, values: Values, caller: Caller, verb: "create" | "patch", data: Row): Row; export declare function nativeEntryProcedure(spec: NativeEntryProcedures, adapter: NativeProcedureAdapter, db: Database, caller: Caller, verb: "create", data: Row, id?: string, version?: number | string): Promise; export declare function nativeEntryProcedure(spec: NativeEntryProcedures, adapter: NativeProcedureAdapter, db: Database, caller: Caller, verb: "patch", data: Row, id: string, version: number | string): Promise; export declare function nativeEntryProcedure(spec: NativeEntryProcedures, adapter: NativeProcedureAdapter, db: Database, caller: Caller, verb: "remove", data: Row, id: string, version: number | string): Promise; /** Fixed indexed keyset templates bind values; identifiers and Core policy come only from the compiled whitelist. */ export declare function nativeEntryPage(spec: NativeCollection, adapter: NativeAdapter, getDb: () => Database, caller: Caller, query: EntryPageQuery): Promise<{ nextCursor?: string | undefined; rows: Row[]; }>; /** Shared URL assembly; each field's coercion and checks are compiled application callbacks. */ export declare function entriesQuery(params: URLSearchParams, options: { path: string; orderFields: Readonly>; publishing: boolean; sqlite: boolean; field: (name: string, raw: string) => { column: string; value: string | number | boolean; }; }): EntryPageQuery | null;