import type { Connection, ConnectOptions, Database, DatabaseConfig, DatahikeUuid, Datom, GcOptions, IndexLookupArgs, IndexRangeArgs, Keyword, Metrics, PullOptions, QueryArgs, Schema, Transaction, TransactionReport, UuidValue, VersionRef, WithArgs } from "./core.js"; /** * Returns database state at given time point (Date or transaction ID). */ export declare function asOf(arg0: Database, arg1: number | Date): Promise; /** * Create a new branch from an existing branch or commit. Secondary indices are CoW-branched automatically. */ export declare function branch(conn: Connection, from: VersionRef, newBranch: Keyword): Promise; /** * Load the database at a branch head. First argument can be a connection, db value, or raw store. */ export declare function branchAsDb(source: Connection | Database, branch: Keyword): Promise; /** * List all known branch names. Returns set of keywords. */ export declare function branches(conn: Connection): Promise>; /** * Load the database at a specific commit. First argument can be a connection, db value, or raw store. */ export declare function commitAsDb(source: Connection | Database, commit: DatahikeUuid): Promise; /** * Retrieve the commit-id for this database value. */ export declare function commitId(db: Database): Promise; /** * Connects to a Datahike database via configuration map. */ export declare function connect(config: DatabaseConfig): Promise; export declare function connect(config: DatabaseConfig, opts: ConnectOptions): Promise; export declare function connect(): Promise; /** * Creates a database via configuration map. */ export declare function createDatabase(arg0: DatabaseConfig): Promise; export declare function createDatabase(): Promise; /** * Checks if a database exists via configuration map. */ export declare function databaseExists(arg0: DatabaseConfig): Promise; export declare function databaseExists(): Promise; /** * Index lookup. Returns sequence of datoms matching index components. */ export declare function datoms(db: Database, indexOrOptions: ":eavt" | ":aevt" | ":avet" | IndexLookupArgs): Promise; export declare function datoms(db: Database, indexOrOptions: ":eavt" | ":aevt" | ":avet", ...components: Array): Promise; /** * Returns the underlying immutable database value from a connection. Prefer using @conn directly. */ export declare function db(conn: Connection): Promise; /** * Remove a branch. The branch data remains accessible until the next GC. */ export declare function deleteBranch(conn: Connection, branch: Keyword): Promise; /** * Deletes a database given via configuration map. */ export declare function deleteDatabase(arg0: DatabaseConfig): Promise; export declare function deleteDatabase(): Promise; /** * Retrieves an entity by its id. Returns lazy map-like structure. */ export declare function entity(db: Database, eid: number | [string, any] | string | any): Promise; /** * Returns database that entity was created from. */ export declare function entityDb(arg0: any): Promise; /** * Invokes garbage collection on connection's store. Removes old snapshots before given time point. `:min-age-ms` spares anything written more recently than that, which is what makes collecting from outside the writer process possible — it must exceed the longest values-then-pointer window any writer can have. When omitted it defaults to 0 under an exclusive local writer (`:writer {:backend :self :writer-ownership :exclusive}`) and to 15 minutes under a shared or remote writer, where another process's commit in flight is invisible to this collector. The default is a bound on one awaited request, not a guarantee: size an explicit value above your longest in-flight window plus the largest clock difference between your processes (the stamps it compares against are each writer's own). Pass `{:min-age-ms 0}` explicitly to sweep without a floor. */ export declare function gcStorage(conn: Connection, removeBefore: number | Date, options: GcOptions): Promise; export declare function gcStorage(conn: Connection, removeBefore: number | Date): Promise; export declare function gcStorage(conn: Connection): Promise; /** * Returns full historical state of database including all assertions and retractions. */ export declare function history(arg0: Database): Promise; /** * Returns part of :avet index between start and end values. */ export declare function indexRange(db: Database, options: IndexRangeArgs): Promise; /** * Load entities directly (bulk load). */ export declare function loadEntities(arg0: Connection, arg1: Transaction[]): Promise; /** * Create a merge commit combining the current branch with parent branches/commits. The caller provides the merged tx-data. Routed through the writer for serialization. Blocks until committed. WARNING: Do not call from listener callbacks — use merge-db! instead to avoid deadlocks. */ export declare function mergeDb(arg0: Connection, arg1: Array, arg2: Transaction[]): Promise; export declare function mergeDb(arg0: Connection, arg1: Array, arg2: Transaction[], arg3: any): Promise; /** * Returns database metrics: datom counts overall, per attribute and for the indexed (AVET) attributes, plus the same for history when kept. Computed from the indices' subtree counts — O(#attributes · log n) — so it is cheap on a large database. `{:per-entity-counts? true}` adds `:per-entity-counts`, a walk over every datom with one map entry per entity. */ export declare function metrics(arg0: Database): Promise; export declare function metrics(arg0: Database, arg1: Record): Promise; /** * Retrieve parent commit ids from this database value. */ export declare function parentCommitIds(db: Database): Promise; /** * Fetches data using recursive declarative pull pattern. */ export declare function pull = Record>(db: Database, patternOrOptions: PullOptions): Promise; export declare function pull = Record>(db: Database, patternOrOptions: Array, eid: number | [string, any] | string): Promise; /** * Same as pull, but accepts sequence of ids and returns sequence of maps. */ export declare function pullMany = Record>(db: Database, patternOrOptions: PullOptions): Promise; export declare function pullMany = Record>(db: Database, patternOrOptions: Array, eids: Array): Promise; /** * Executes a datalog query. */ export declare function q(query: QueryArgs): Promise; export declare function q(query: Array | Record | string, ...inputs: Array): Promise; /** * Executes query and returns execution statistics. */ export declare function queryStats(query: QueryArgs): Promise>; export declare function queryStats(query: Array | Record, ...inputs: Array): Promise>; /** * Releases a database connection. */ export declare function release(conn: Connection): Promise; export declare function release(conn: Connection, releaseAll: any): Promise; /** * Returns reverse schema definition (attribute id to ident mapping). */ export declare function reverseSchema(arg0: Database): Promise>; /** * Like seek-datoms, but iterates BACKWARDS: datoms <= the given components, descending to the beginning of the index. Lazy on the persistent-sorted-set index — the primitive for windowed backwards pagination (latest-N, N-before-cursor). */ export declare function rseekDatoms(db: Database, indexOrOptions: ":eavt" | ":aevt" | ":avet" | IndexLookupArgs): Promise; export declare function rseekDatoms(db: Database, indexOrOptions: ":eavt" | ":aevt" | ":avet", ...components: Array): Promise; /** * Returns current schema definition. */ export declare function schema(arg0: Database): Promise; /** * Like datoms, but returns datoms starting from specified components through end of index. */ export declare function seekDatoms(db: Database, indexOrOptions: ":eavt" | ":aevt" | ":avet" | IndexLookupArgs): Promise; export declare function seekDatoms(db: Database, indexOrOptions: ":eavt" | ":aevt" | ":avet", ...components: Array): Promise; /** * Returns database state since given time point (Date or transaction ID). Contains only datoms added since that point. */ export declare function since(arg0: Database, arg1: number | Date): Promise; /** * Applies transaction to the database and updates connection. Blocks until committed. The map form accepts :tx-options {:allow-index-backfill? true} to permit index/uniqueness backfill for this transaction only; it does not change the database config. :track-dependencies enrolls snapshot-local dependency selectors; see datahike.dependency-tracking. WARNING: Do not call from listener callbacks or transaction functions — use transact! instead to avoid deadlocks. */ export declare function transact(arg0: Connection, arg1: Transaction[] | WithArgs): Promise; /** * Strip any valid-time markers from `db` so the full vt-history is * visible. Idempotent. Does not unwrap an existing FilteredDB; to * drop an active filter, start from the unwrapped db. */ export declare function validAll(arg0: Database): Promise; /** * Tag `db` with a `:datahike/valid-at` marker so vt-aware secondary * indices push the filter through `-search-at-vt`. Valid-time is a * secondary-index axis; regular datalog patterns still require the * built-in `(valid-at ?tx ?at)` rule to filter by vt explicitly. */ export declare function validAt(arg0: Database, arg1: any): Promise; /** * Filter `db` to datoms whose asserting tx's vt-window overlaps the * half-open interval `[from, to)`. SQL:2011 `FOR VALID_TIME BETWEEN * from AND to` maps to this. Carries * `:datahike/valid-between [from to]` on the result for vt-aware * secondary-index pushdown. */ export declare function validBetween(arg0: Database, arg1: any, arg2: any): Promise; /** * Filter `db` to datoms whose tx's vt-window is *fully contained* * in `[from, to)`. Stricter than `valid-between` — overlapping * windows that extend past either endpoint are excluded. Useful * for 'corrections wholly within Q2' style queries. */ export declare function validDuring(arg0: Database, arg1: any, arg2: any): Promise;