UNPKG

everything-dev

Version:

A consolidated product package for building Module Federation apps with oRPC APIs.

87 lines • 4.03 kB
import { RegistryKey } from "./keys.cjs"; import { Context, Layer } from "effect"; //#region src/services/registry/client.d.ts /** * The registry transport — the one implementation of FastKV reads. Module is * the implementation, tag is the seam (#425's shape): plain functions for * direct callers, `RegistryClient` for Effect consumers. The WRITE side is a * signing concern (the signer services, #423) and lives elsewhere by design. * * Reads are action-indexed FastKV entries (namespace = the signing account); * on-chain execution of the write may fail without affecting the indexed * value — the read-back here is the authority, which is why `absent` and * `unreachable` are distinct errors and why nothing in this module swallows * them into null silently. */ type NetworkId = "mainnet" | "testnet"; /** The network a signing account publishes on — the account suffix is the * network. One function; nothing else may derive a base URL. */ declare function networkIdForAccount(accountId: string): NetworkId; declare function registryBaseUrlForNetwork(network: NetworkId): string; declare function registryNamespaceForNetwork(network: NetworkId, registry?: string): string; declare const RegistryError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & { readonly _tag: "RegistryError"; } & Readonly<A>; declare class RegistryError extends RegistryError_base<{ readonly key: string; readonly kind: "absent" | "unreachable"; readonly cause?: unknown; }> { get message(): string; } interface RegistryEntry { key: string; value: unknown; blockHeight: number; blockTimestampNs: string; txHash?: string; } interface RegistryHistoryEntry { blockHeight: number; blockTimestampNs: string; txHash?: string; value: unknown; } interface RegistryListInput { /** Defaults to the namespace's whole latest-state listing. */ ref?: RegistryKey["ref"]; keyPrefix?: string; limit?: number; pageToken?: string; includeMetadata?: boolean; } interface RegistryListResult { entries: RegistryEntry[]; pageToken: string | null; } interface ReadOptions { /** A registry override — the namespace contract account. */ registry?: string; /** Direct-read seam for tests. */ fetchImpl?: typeof fetch; } /** The canonical latest-state URL for a key — for display and external * links (the client owns all URL derivation; nothing else builds one). */ declare function latestUrlFor(key: RegistryKey, opts?: { registry?: string; }): string; /** The plain-function seam — module is the implementation, tag is the seam. */ declare const registryClientShape: { read: <T>(key: RegistryKey, opts?: ReadOptions) => Promise<T>; readOrNull: <T>(key: RegistryKey, opts?: ReadOptions) => Promise<T | null>; list: (input: RegistryListInput, opts?: ReadOptions) => Promise<RegistryListResult>; history: (key: RegistryKey, limit?: number, opts?: ReadOptions) => Promise<RegistryHistoryEntry[]>; }; type RegistryClientShape = typeof registryClientShape; declare const RegistryClient_base: Context.ServiceClass<RegistryClient, "everything-dev/registry/client", { read: <T>(key: RegistryKey, opts?: ReadOptions) => Promise<T>; readOrNull: <T>(key: RegistryKey, opts?: ReadOptions) => Promise<T | null>; list: (input: RegistryListInput, opts?: ReadOptions) => Promise<RegistryListResult>; history: (key: RegistryKey, limit?: number, opts?: ReadOptions) => Promise<RegistryHistoryEntry[]>; }>; declare class RegistryClient extends RegistryClient_base { static readonly Live: Layer.Layer<RegistryClient, never, never>; } //#endregion export { NetworkId, RegistryClient, RegistryClientShape, RegistryEntry, RegistryError, RegistryHistoryEntry, RegistryListInput, RegistryListResult, latestUrlFor, networkIdForAccount, registryBaseUrlForNetwork, registryClientShape, registryNamespaceForNetwork }; //# sourceMappingURL=client.d.cts.map