everything-dev
Version:
A consolidated product package for building Module Federation apps with oRPC APIs.
118 lines • 5.25 kB
text/typescript
import { Context, Layer } from "effect";
//#region src/services/registry/fastkv.d.ts
type NetworkId = "mainnet" | "testnet";
interface FastKvEntry {
value: unknown;
}
interface FastKvListResponse {
entries?: Array<FastKvEntry | null>;
}
declare function getFastKvBaseUrlForNetwork(network: NetworkId): string;
declare function buildRegistryConfigUrl(accountId: string, gatewayId: string, registry?: string): string;
declare function buildRegistryConfigUrlForNetwork(network: NetworkId, accountId: string, gatewayId: string, registry?: string): string;
declare function getRegistryNamespaceForAccount(accountId: string, registry?: string): string;
declare function getRegistryNamespaceForNetwork(network: NetworkId, registry?: string): string;
declare function parseBosUrl(bosUrl: string): {
accountId: string;
gatewayId: string;
pathSegments: string[];
};
declare function fetchBosConfigFromFastKv<T>(bosUrl: string, registry?: string): Promise<T>;
/**
* Read an arbitrary registry key under `apps/<account>/<gateway>/` — the
* well-known-slot seam (ADR 0034's `platform.json` lives beside the config).
* Absent key (404) → null; a network failure throws so callers can distinguish
* "the slot is empty" from "the slot is unreachable" (a swallowed error here
* would silently tighten a compat floor).
*/
declare function fetchRegistryKey<T>(accountId: string, gatewayId: string, keyPath: string, registry?: string): Promise<T | null>;
/** Tolerant variant of {@link fetchRegistryKey} — any failure collapses to null. */
declare function fetchRegistryKeyOrNull<T>(accountId: string, gatewayId: string, keyPath: string, registry?: string): Promise<T | null>;
/** Read a published config from an already-built registry URL
* (`buildRegistryConfigUrlForNetwork`). Unlike {@link fetchBosConfigFromFastKv}
* this takes the URL directly, so the read key is exactly the one the publish
* writes, and a network failure is reported as such instead of collapsing
* into "No config found" (fetchJsonOrNull swallows errors into null). */
declare function fetchPublishedConfigFromFastKv<T>(url: string): Promise<T>;
declare function parseFastKvConfigValue<T>(payload: FastKvListResponse | null, label: string): T;
interface ConfigHistoryEntry {
blockHeight: number;
blockTimestampNs: string;
txHash?: string;
value: unknown;
}
/**
* Publish history for the registry config key (atomic-deploys 11): the
* exact-key variant of FastData's history endpoint, newest-first. The API
* caps a page at 200 rows; a config key's write history fits well inside
* that, so a single request is the whole story (the limit param is clamped).
*/
declare function fetchConfigHistory(opts: {
accountId: string;
gatewayId: string;
registry?: string;
limit?: number;
}): Promise<ConfigHistoryEntry[]>;
interface DeployManifestEntry {
key: string;
blockHeight: number;
blockTimestampNs: string;
value: unknown;
}
/**
* The per-deploy audit trail (atomic-deploys 03/12): every publish writes
* `apps/<account>/<gateway>/manifests/<ts>.json` atomically with the pointer
* swap — this lists that key family newest-first via the history-by-prefix
* endpoint.
*/
declare function fetchDeployManifests(opts: {
accountId: string;
gatewayId: string;
registry?: string;
limit?: number;
}): Promise<DeployManifestEntry[]>;
interface PluginManifest {
schemaVersion: number;
kind: string;
plugin: {
name: string;
version: string;
};
runtime: {
remoteEntry: string;
};
contract: {
kind: string;
types: {
path: string;
exportName: string;
typeName: string;
sha256: string;
};
};
additionalExports?: Array<{
path: string;
exports: string[];
sha256: string;
}>;
}
declare function fetchRemotePluginManifest(cdnUrl: string): Promise<PluginManifest | null>;
declare const FastKVRegistryService_base: Context.ServiceClass<FastKVRegistryService, "everything-dev/registry/fastkv", {
fetchBosConfigFromFastKv: typeof fetchBosConfigFromFastKv;
fetchPublishedConfigFromFastKv: typeof fetchPublishedConfigFromFastKv;
fetchConfigHistory: typeof fetchConfigHistory;
fetchDeployManifests: typeof fetchDeployManifests;
}>;
/**
* The FastKV registry as a Context.Service (#425): reads (config, published
* config, history, deploy manifests) and the bos:// URL algebra behind one
* tag. The registry WRITE is a signing concern — it rides the signer
* services (#423), not this tag. Callers may keep using the plain
* functions — the module is the implementation; the tag is the seam.
*/
declare class FastKVRegistryService extends FastKVRegistryService_base {
static readonly Live: Layer.Layer<FastKVRegistryService, never, never>;
}
//#endregion
export { ConfigHistoryEntry, DeployManifestEntry, FastKVRegistryService, NetworkId, PluginManifest, buildRegistryConfigUrl, buildRegistryConfigUrlForNetwork, fetchBosConfigFromFastKv, fetchConfigHistory, fetchDeployManifests, fetchPublishedConfigFromFastKv, fetchRegistryKey, fetchRegistryKeyOrNull, fetchRemotePluginManifest, getFastKvBaseUrlForNetwork, getRegistryNamespaceForAccount, getRegistryNamespaceForNetwork, parseBosUrl, parseFastKvConfigValue };
//# sourceMappingURL=fastkv.d.mts.map