/** * @license * Copyright 2026 Steven Roussey * SPDX-License-Identifier: Apache-2.0 */ import { DataPortSchemaObject, FromSchema, TypedArraySchemaOptions } from "@workglow/util/schema"; import { BaseTabularStorage, ClientProvidedKeysOption } from "./BaseTabularStorage"; import type { AnyTabularStorage, AutoGeneratedKeys, CoveringIndexQueryOptions, DeleteSearchCriteria, InsertEntity, Page, PageRequest, QueryOptions, SearchCriteria, SimplifyPrimaryKey, TabularChangePayload, TabularSubscribeOptions } from "./ITabularStorage"; export declare const HTTP_TABULAR_PROXY_REPOSITORY: import("@workglow/util").ServiceToken; /** * Fetch-shaped function used to forward operations to the server. The signature * matches the DOM `fetch` so a real browser fetch, an in-process Hono `app.fetch`, * or the Electron `window.desktop.api` shim all work without adaptation. */ export type HttpTabularProxyFetch = (path: string, init?: RequestInit) => Promise; export interface HttpTabularProxyOptions> { readonly fetch: HttpTabularProxyFetch; readonly table: string; readonly schema: Schema; readonly primaryKey: PrimaryKeyNames; readonly indexes?: readonly (keyof Schema["properties"] | readonly (keyof Schema["properties"])[])[]; /** Optional base path. Defaults to `/api/storage`. Trailing slashes are stripped. */ readonly basePath?: string; /** Forwarded to BaseTabularStorage. Defaults to "if-missing". */ readonly clientProvidedKeys?: ClientProvidedKeysOption; } /** * Storage adapter that forwards every {@link ITabularStorage} operation as * `POST {basePath}/{table}/{op}` through an injected fetch impl. * * Transport is the fetch impl's concern — this class doesn't know whether the * request crosses a socket (dev), a `MessageChannelMain` port (Electron prod), * or runs in-process against `app.fetch` (tests / web mode). * * Wire format is JSON: values must be JSON-serialisable. Schemas using * `Uint8Array` (blob) or `bigint` columns are NOT supported through this * proxy — those types don't round-trip through `JSON.stringify`/`res.json()`. * Add a field-aware (de)serializer here if a binary-valued schema ever needs * to go over the proxy. */ export declare class HttpTabularProxyStorage, Entity = FromSchema, PrimaryKey = SimplifyPrimaryKey, Value = Omit, InsertType = InsertEntity>> extends BaseTabularStorage { protected readonly fetchImpl: HttpTabularProxyFetch; protected readonly table: string; protected readonly basePath: string; private pollingManager; constructor(opts: HttpTabularProxyOptions); protected url(op: string): string; /** Throws on non-2xx, propagating the server's `{ error }` body when present. */ protected call(op: string, body: unknown): Promise; put(value: InsertType): Promise; putBulk(values: InsertType[]): Promise; get(key: PrimaryKey): Promise; delete(key: PrimaryKey | Entity): Promise; getBulk(keys: readonly PrimaryKey[]): Promise; query(criteria: SearchCriteria, options?: QueryOptions): Promise; getAll(options?: QueryOptions): Promise; size(): Promise; count(criteria?: SearchCriteria): Promise; deleteAll(): Promise; deleteSearch(criteria: DeleteSearchCriteria): Promise; getOffsetPage(offset: number, limit: number): Promise; getPage(request?: PageRequest): Promise>; queryPage(criteria: SearchCriteria, request?: PageRequest): Promise>; queryIndex(criteria: SearchCriteria, options: CoveringIndexQueryOptions): Promise[]>; subscribeToChanges(callback: (change: TabularChangePayload) => void, options?: TabularSubscribeOptions): () => void; destroy(): void; } //# sourceMappingURL=HttpTabularProxyStorage.d.ts.map