import type { AuthorityScope } from './authority-scope.js'; import type { Collection } from './collection.js'; import type { StateFirstDB } from './db.js'; import type { AtomicTransactionDocument, AtomicTransactionOptions, AtomicTransactionResult, AtomicTransactionScope } from './transaction.js'; import type { CreateWorkloadInput, Workload } from './workload.js'; import type { CausalEvent } from './observe.js'; export declare const FELTDB_PUBLIC_CONTRACT_VERSION: "1.0"; declare const cursorBrand: unique symbol; /** Opaque resume token. No parsing, comparison, or arithmetic is public. */ export type FeltDBEventCursor = string & { readonly [cursorBrand]: true; }; export interface PublicTransactionResult extends AtomicTransactionResult { baseRevision: number; commitRevision: number; revisionId: string; operationIds: string[]; } export interface PublicEvent extends CausalEvent { revision_id: string; operation_ids: string[]; metadata: CausalEvent['metadata'] & { cursor: FeltDBEventCursor; transaction_id: string; revision_id: string; }; } export interface EventReplayPage { contract_version: typeof FELTDB_PUBLIC_CONTRACT_VERSION; cursor_format: 'fh1'; application_id: string; environment: string; events: PublicEvent[]; next_cursor: FeltDBEventCursor; } export interface PublicPrincipal { id: string; tenant_id: string; application_id: string; kind: string; name: string; status: string; capabilities: string[]; [key: string]: unknown; } export interface PublicCapabilityDeclaration { contract: 'feltdb.public.substrate'; contract_version: typeof FELTDB_PUBLIC_CONTRACT_VERSION; cursor_format_version: 'fh1'; stored_state_schema_version: number; migration_version: string; capabilities: Array<{ capability: string; contract_version: string; support: 'supported' | 'unsupported' | 'conditionally_supported'; supported_transport: string[]; scope_requirements: string; durability_semantics: string; authority_owner: 'canonical_feltdb'; }>; } type PublicRequest = (path: string, init?: RequestInit) => Promise; /** * One typed public adapter over the canonical FeltDB authority. * * This class owns no records, versions, cursors, work, provenance, or retry * log. Its fields are routing adapters; destroying this object loses no * durable information. */ export declare class FeltDBPublicContract { private readonly db; private readonly scope; private readonly applicationId; private readonly environment; private readonly request?; readonly version: "1.0"; constructor(db: StateFirstDB, scope: AuthorityScope | undefined, applicationId: string | undefined, environment: string, request?: PublicRequest | undefined); private requireApplicationScope; private authority; readonly state: { collection: (name: string) => Collection; transaction: (build: ((transaction: AtomicTransactionScope) => void | Promise) | AtomicTransactionDocument, options?: AtomicTransactionOptions) => Promise; }; readonly principals: { list: () => Promise; create: (input: { kind: string; name: string; }) => Promise; grant: (principalId: string, capability: string) => Promise; }; readonly work: { create: (input: CreateWorkloadInput) => Promise; inspect: (workId: string) => Promise; history: (workId: string) => Promise; }; readonly events: { replay: (after?: FeltDBEventCursor, options?: { limit?: number; }) => Promise; subscribe: (after: FeltDBEventCursor | undefined, listener: (event: PublicEvent) => void | Promise, options?: { pollIntervalMs?: number; signal?: AbortSignal; }) => (() => void); }; readonly provenance: { record: (collection: string, id: string) => Promise; }; capabilities(): Promise; } export {}; //# sourceMappingURL=public-contract.d.ts.map