@smart-byte/leani-sdk 0.1.0-rc.3 → 0.1.0-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,cAAc,EACd,aAAa,EACb,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,WAAW,EACX,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,IAAI,EACJ,YAAY,GACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,cAAc,EAAuB,MAAM,aAAa,CAAC;AAE9E,0EAA0E;AAC1E,MAAM,CAAC,MAAM,WAAW,GAAG,YAAqB,CAAC;AAEjD,+EAA+E;AAC/E,MAAM,oBAAoB,GAAqC,MAAM,CAAC,MAAM,CAAC;IAC3E,iBAAiB,EAAE,GAAG;CACvB,CAAC,CAAC;AAkcH;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAC7B,MAAyB;IAEzB,OAAO,MAAM,CAAC,SAAS,KAAK,WAAW,IAAI,MAAM,CAAC,IAAI,KAAK,qBAAqB,CAAC;AACnF,CAAC;AAuBD,MAAM,OAAO,kBAAmB,SAAQ,UAAU;IACvC,MAAM,CAAiB;IAEhC,YAAY,MAAsB;QAChC,KAAK,CAAC,qDAAqD,EAAE;YAC3D,MAAM,EAAE,GAAG;YACX,IAAI,EAAE,gBAAgB;YACtB,SAAS,EAAE,KAAK;YAChB,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE;SACnC,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAuOD;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC/B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EAAE,MAAc;IAC7C,MAAM,MAAM,GAAG,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,GAAG,CAAC,CAAC;IACvD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC;AACnD,CAAC;AAED,KAAK,UAAU,cAAc,CAC3B,YAAoB,EACpB,MAAoB;IAEpB,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;QACpB,OAAO;IACT,CAAC;IACD,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;QAClC,MAAM,MAAM,GAAG,GAAG,EAAE;YAClB,YAAY,CAAC,OAAO,CAAC,CAAC;YACtB,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAC7C,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC;QACF,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QACjD,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n LeaniError,\n TransportError,\n responseError,\n errorFromBody,\n} from \"./errors.ts\";\nimport {\n concatBytes,\n idleWatchdog,\n readChunks,\n readJson,\n resolveUnder,\n send,\n withDeadline,\n} from \"./transport.ts\";\nexport { LeaniError, TransportError, type LeaniErrorBody } from \"./errors.ts\";\n\n// Kept literal for toolchain compatibility; tests pin it to package.json.\nexport const SDK_VERSION = \"0.1.0-rc.3\" as const;\n\n/** Sent on mutations without a JSON body, which the node otherwise refuses. */\nconst LEANI_REQUEST_HEADER: Readonly<Record<string, string>> = Object.freeze({\n \"x-leani-request\": \"1\",\n});\n\nexport type {\n components as OpenApiComponents,\n operations as OpenApiOperations,\n paths as OpenApiPaths,\n} from \"./openapi.generated.ts\";\n\nexport type Hex = `0x${string}`;\nexport type Finality = \"preview\" | \"included\" | \"finalized\";\nexport type ChangeOperation =\n | \"apply\"\n | \"undo\"\n | \"finalized\"\n | \"reset_required\";\n\nexport interface LeaniClientOptions {\n baseUrl: string | URL;\n token?: string;\n timeoutMs?: number;\n fetch?: FetchLike;\n /**\n * Override typed query-extension mounts with canonical `basePath` values\n * returned by `capabilities()` when an ergonomic alias is unavailable.\n */\n queryBasePaths?: {\n blobs?: string;\n erc20?: string;\n uniswap?: string;\n };\n reconnect?: {\n initialDelayMs?: number;\n maxDelayMs?: number;\n jitter?: number;\n };\n}\n\nexport type FetchLike = (\n input: RequestInfo | URL,\n init?: RequestInit,\n) => Promise<Response>;\n\nexport interface ProcessorSummary {\n id: string;\n instance: string;\n version: string;\n codeHash: Hex;\n configHash: Hex;\n genericApi: \"processor-v1\";\n changeSchema: string;\n queryExtensions: QueryExtensionSummary[];\n subscriptions: boolean;\n artifactRetention: \"none\" | \"window\" | \"full\";\n deliveryOrdering: \"canonical\" | \"block_versioned_idempotent\";\n}\n\nexport interface QueryExtensionSummary {\n id: string;\n basePath: string;\n aliasPath: string | null;\n}\n\nexport interface QueryExtensionCapability extends QueryExtensionSummary {\n processor: string;\n}\n\nexport interface Capabilities {\n chainId: number;\n ethereumRpc: Record<string, unknown>;\n processors: ProcessorSummary[];\n queryExtensions: QueryExtensionCapability[];\n}\n\nexport interface NodeStatus {\n apiVersion: \"1\";\n project: string;\n version: string;\n chainId: number;\n uptimeSeconds: number;\n databaseBytes: number;\n processor: ProcessorSummary;\n processors: ProcessorSummary[];\n readiness: Readiness;\n}\n\nexport interface Readiness {\n liveRequired: boolean;\n liveReady: boolean;\n finalityRequired: boolean;\n finalityReady: boolean;\n ready: boolean;\n}\n\nexport interface Health {\n status: \"live\" | \"ready\" | \"not_ready\" | \"failed\";\n uptimeSeconds: number;\n database: \"available\" | \"unavailable\";\n readiness: Readiness;\n reasons: string[];\n}\n\nexport interface CoverageInterval {\n fromBlock: number;\n toBlock: number;\n finality: Finality;\n}\n\nexport interface ProcessorCoverage {\n chainId: number;\n chainFinalizedHead: {\n number: number;\n hash: string;\n } | null;\n requested?: {\n fromBlock: number;\n toBlock: number;\n } | null;\n available: CoverageInterval[];\n configuredStartBlock: number;\n processedThrough: number | null;\n finalizedThrough: number | null;\n complete: boolean;\n state:\n | \"starting\"\n | \"backfilling\"\n | \"catching_up\"\n | \"live\"\n | \"degraded\"\n | \"paused\"\n | \"failed\";\n}\n\nexport interface Page<T> {\n data: T[];\n nextCursor: string | null;\n coverage: ProcessorCoverage;\n}\n\nexport interface BlobsBlock {\n network: string;\n blockNumber: number;\n blockHash: Hex;\n parentHash: Hex;\n timestamp: number;\n size: string;\n blobCount: number;\n blobGasUsed: string;\n excessBlobGas: string;\n /**\n * Protocol blob base fee in wei per blob gas: the EIP-4844 fee for\n * `excessBlobGas` under the fork active at `timestamp`. EIP-7918 does not\n * change it.\n */\n blobBaseFee: string;\n executionBaseFee: string;\n gasUsed: string;\n gasLimit: string;\n executionEthBurnedWei: string;\n /** `blobBaseFee` times `blobGasUsed`. */\n blobEthBurnedWei: string;\n /**\n * EIP-7918 reserve price in wei per blob gas from Fusaka on, `null` before.\n * It only changes how excess blob gas evolves and is not applied to\n * `blobBaseFee`.\n */\n reserveFeeWei: string | null;\n transactionCount: number;\n targetBlobsPerBlock: number;\n maxBlobsPerBlock: number;\n transformVersion: number;\n finality: Finality;\n}\n\nexport interface BlobTransaction {\n network: string;\n blockNumber: number;\n blockHash: Hex;\n txHash: Hex;\n transactionIndex: number;\n senderAddress: Hex;\n blobVersionedHashes: Hex[];\n blobCount: number;\n totalBurnedWei: string;\n executionBurnedWei: string;\n /** The block's `blobBaseFee` times this transaction's blob gas. */\n blobBurnedWei: string;\n}\n\nexport interface BlobsSnapshotEntry {\n block: BlobsBlock;\n transactions: BlobTransaction[];\n}\n\nexport interface ChangeHead {\n earliestSequence: string | null;\n latestSequence: string | null;\n cursor: string | null;\n}\n\nexport interface GenericOutputEntity<T = unknown> {\n ordinal: string;\n key: Hex;\n schema: string;\n data: T;\n blockNumber: number;\n blockTimestamp: number;\n finality: Finality;\n}\n\nexport interface OutputBounds {\n earliestBlock: number;\n latestBlock: number;\n earliestTimestamp: number;\n latestTimestamp: number;\n}\n\nexport interface GenericSnapshotPage<T = unknown> {\n data: GenericOutputEntity<T>[];\n nextCursor: string | null;\n snapshotId: string;\n boundaryCursor: string | null;\n rowCount: string;\n valueBytes: string;\n expiresAtUnixMs: string;\n retainedBounds: OutputBounds | null;\n coverage: ProcessorCoverage;\n recovery: {\n follow: string | null;\n outsideRetention: \"create_processor_instance_or_source_scan\";\n };\n}\n\nexport interface FollowSnapshotPage<T = unknown> extends GenericSnapshotPage<T> {\n boundaryCursor: string;\n recovery: GenericSnapshotPage<T>[\"recovery\"] & { follow: string };\n}\n\nexport interface OutputQueryOptions {\n fromBlock?: number;\n toBlock?: number;\n fromTimestamp?: number;\n toTimestamp?: number;\n limit?: number;\n cursor?: string;\n signal?: AbortSignal;\n}\n\nexport type ConsumerRole = \"required\" | \"best_effort\";\nexport type ConsumerState = \"active\" | \"reset_required\" | \"revoked\";\nexport type ConsumerStart =\n | { position: \"earliest_retained\" }\n | { position: \"current_head\" }\n | { position: \"cursor\"; cursor: string };\n\nexport interface CreateConsumerOptions {\n id: string;\n role: ConsumerRole;\n start: ConsumerStart;\n leaseTtlSeconds: number;\n credential: string;\n signal?: AbortSignal;\n}\n\nexport interface DurableConsumer {\n id: string;\n processorInstance: string;\n /** The delivery stream this consumer reads. */\n streamId: string;\n role: ConsumerRole;\n state: ConsumerState;\n acknowledgedSequence: string;\n deliveredSequence: string;\n acknowledgedCursor: string;\n deliveredCursor: string;\n /** Stream sessions that have taken the lease; `\"0\"` before the first. */\n leaseGeneration: string;\n leaseTtlMs: string;\n leaseExpiresAtUnixMs: string;\n leaseActive: boolean;\n lagChanges: string;\n lagBlocks: string;\n lagBytes: string;\n lagAgeMs: string;\n createdAtUnixMs: string;\n updatedAtUnixMs: string;\n}\n\nexport interface BlobSchedule {\n name: string;\n /**\n * Block-number label for `atBlock` lookups. For Dencun it is 19426589, the\n * first block the blobs processor covers.\n */\n activationBlock: number;\n /** The fork's parameters apply to blocks from this timestamp on. */\n activationTimestamp: number;\n forkId: Hex;\n targetBlobsPerBlock: number;\n maxBlobsPerBlock: number;\n baseFeeUpdateFraction: string;\n eip7918: boolean;\n source: \"chain_spec\" | \"eth_config\" | \"configured\";\n}\n\nexport interface Erc20Balance {\n token: Hex;\n address: Hex;\n balance: string;\n asOfBlock: number;\n blockHash: Hex;\n finality: Finality;\n coverageFrom: number;\n complete: boolean;\n /**\n * Block whose transfer proved the ledger incomplete for this token and\n * holder. From that block the pair is no longer derived and `balance` keeps\n * its last derived value; `null` while the pair is derived.\n */\n incompleteFrom: number | null;\n method: \"erc20_transfer_ledger\";\n}\n\nexport interface EvmEvent {\n schemaVersion: number;\n contract: Hex;\n event: string;\n signature: string;\n blockNumber: number;\n blockHash: Hex;\n blockTimestamp: number;\n bucketStartTimestamp?: number;\n transactionHash: Hex;\n transactionIndex: number;\n logIndex: number;\n finality: Finality;\n values: Record<string, string>;\n}\n\nexport interface TransactionStats {\n from: Hex;\n to: Hex;\n /** Submitted transactions from `from` to `to`, reverted ones included. */\n count: number;\n /** Submitted value in wei, including the value of reverted transactions. */\n totalValueWei: string;\n asOfBlock: number;\n blockHash: Hex;\n finality: Finality;\n coverageFrom: number;\n complete: boolean;\n}\n\nexport interface UniswapPoolPrice {\n pool: Hex;\n kind: \"v2\" | \"v3\";\n reserve0: string | null;\n reserve1: string | null;\n /** Signed token0 pool delta for a V3 swap, in raw token units. */\n amount0: string | null;\n /** Signed token1 pool delta for a V3 swap, in raw token units. */\n amount1: string | null;\n sqrtPriceX96: string | null;\n blockNumber: number;\n blockHash: Hex;\n logIndex: number;\n finality: Finality;\n}\n\nexport interface LatestUniswapObservation {\n data: UniswapPoolPrice;\n timestamp: number;\n}\n\nexport interface ConfiguredUniswapPool {\n address: Hex;\n kind: \"v2\" | \"v3\";\n}\n\nexport interface ConfiguredUniswapPools {\n data: ConfiguredUniswapPool[];\n}\n\nexport interface BlockSummary {\n chainId: number;\n blockNumber: number;\n blockHash: Hex;\n parentHash: Hex;\n timestamp: number;\n gasLimit: number | null;\n gasUsed: number | null;\n baseFeePerGas: string | null;\n blobGasUsed: number | null;\n excessBlobGas: number | null;\n transactionCount: number | null;\n sizeBytes: number | null;\n finality: Finality;\n}\n\nexport interface LatestBlockSummary {\n data: BlockSummary;\n}\n\nexport interface ChangeMetadata {\n apiVersion: \"1\";\n sequence: string;\n cursor: string;\n originKind:\n | \"live\"\n | \"live_recovery\"\n | \"historical_backfill\"\n | \"recompute\";\n originId: string;\n publicationRevision: string;\n chainId: number;\n block: {\n number: number;\n hash: Hex;\n parentHash: Hex;\n timestamp: number;\n } | null;\n finality: Finality;\n kind: string;\n schema: string;\n key: string | null;\n /** Present only on `reset_required` events, as the current coverage hint. */\n coverage?: ProcessorCoverage;\n /** RFC 3339 UTC emission time with millisecond precision. */\n emittedAt: string;\n}\n\n/** Blocks the live lane skipped, as a `system.live_gap.put` change announces them. */\nexport interface LiveGapChangeData {\n fromBlock: number;\n toBlock: number;\n /** Leani does not fill the range: the processor's history is on demand. */\n reason: \"not_filled\";\n}\n\n/** System transitions never pretend to contain a processor entity payload. */\nexport type ChangeEnvelope<T = unknown> = ChangeMetadata & (\n | { operation: \"apply\" | \"undo\"; data: T | null }\n | { operation: \"finalized\"; data: { throughBlock: number } }\n | { operation: \"finalized\"; data: LiveGapChangeData }\n | { operation: \"reset_required\"; data: {\n earliestAvailableSequence: string;\n latestAvailableSequence: string;\n action: \"query_snapshot_then_resume\";\n } }\n);\n\n/**\n * Whether `change` announces blocks the live lane skipped, as after a\n * restart at a later finalized anchor. Nothing else delivers them: request\n * them as history, for example with `liveGapBackfill` from\n * `@smart-byte/leani-sdk/backfill`.\n */\nexport function isLiveGapChange<T>(\n change: ChangeEnvelope<T>,\n): change is Extract<ChangeEnvelope<T>, { data: LiveGapChangeData }> {\n return change.operation === \"finalized\" && change.kind === \"system.live_gap.put\";\n}\n\nexport interface LiveLaneReset {\n processor: string;\n state: \"paused\";\n reason: \"operator_reset_pending_replay\";\n firstUnappliedBlock: number;\n firstUnappliedHash: Hex;\n requiredDeliveryBytes: string;\n}\n\n/**\n * Connection-scoped stream handshake. Sent as the first frame of every\n * stream connection (including reconnects), synthesized at accept time,\n * never stored, and never acknowledged.\n */\nexport interface StreamHello {\n apiVersion: \"1\";\n chainId: number;\n processor: ProcessorSummary;\n coverage: ProcessorCoverage;\n}\n\nexport class ResetRequiredError extends LeaniError {\n readonly change: ChangeEnvelope;\n\n constructor(change: ChangeEnvelope) {\n super(\"the durable stream cursor requires a snapshot reset\", {\n status: 410,\n code: \"cursor_expired\",\n retryable: false,\n details: { cursor: change.cursor },\n });\n this.name = \"ResetRequiredError\";\n this.change = change;\n }\n}\n\nexport interface ListBlocksOptions {\n fromBlock: number;\n toBlock: number;\n limit?: number;\n cursor?: string;\n allowPartial?: boolean;\n signal?: AbortSignal;\n}\n\nexport interface ListTransactionsOptions {\n blockNumber: number;\n limit?: number;\n cursor?: string;\n signal?: AbortSignal;\n}\n\nexport interface ChangesOptions {\n after?: string;\n limit?: number;\n signal?: AbortSignal;\n}\n\nexport interface SubscribeOptions {\n after?: string;\n signal?: AbortSignal;\n /** Receives the connection handshake frame; called once per (re)connect. */\n onHello?: (hello: StreamHello) => void;\n /**\n * Reconnect when the stream sends nothing, not even the node's 15-second\n * keep-alive comments, for this long while the loop waits for a change.\n * Defaults to 60,000 ms.\n */\n idleTimeoutMs?: number;\n}\n\n/** Select a configured instance when more than one processor has this kind. */\nexport interface ProcessorSubscribeOptions extends SubscribeOptions {\n processor?: string;\n}\n\nexport interface LeaniClient {\n readonly baseUrl: URL;\n request<T>(\n path: string,\n params?: Record<string, QueryValue>,\n options?: { signal?: AbortSignal },\n ): Promise<T>;\n health: {\n live(options?: { signal?: AbortSignal }): Promise<Health>;\n ready(options?: { signal?: AbortSignal }): Promise<Health>;\n };\n status(options?: { signal?: AbortSignal }): Promise<NodeStatus>;\n capabilities(options?: { signal?: AbortSignal }): Promise<Capabilities>;\n processors: {\n list(options?: { signal?: AbortSignal }): Promise<ProcessorSummary[]>;\n status(\n id: string,\n options?: { signal?: AbortSignal },\n ): Promise<ProcessorCoverage>;\n changes<T = unknown>(\n id: string,\n options?: ChangesOptions,\n ): Promise<Page<ChangeEnvelope<T>>>;\n changeHead(\n id: string,\n options?: { signal?: AbortSignal },\n ): Promise<ChangeHead>;\n resetLiveLane(\n id: string,\n options?: { signal?: AbortSignal },\n ): Promise<LiveLaneReset>;\n listCollections(\n id: string,\n options?: { signal?: AbortSignal },\n ): Promise<{\n processor: ProcessorSummary;\n outputMode: \"none\" | \"latest\" | \"window\" | \"full\";\n retained: boolean;\n data: string[];\n }>;\n queryEntities<T = unknown>(\n id: string,\n collection: string,\n options?: OutputQueryOptions,\n ): Promise<GenericSnapshotPage<T>>;\n /** First snapshot page plus an atomic stream boundary. Read all nextCursor pages and releaseSnapshot before following. */\n queryAndFollow<T = unknown>(\n id: string,\n collection: string,\n options?: Omit<OutputQueryOptions, \"cursor\">,\n ): Promise<FollowSnapshotPage<T>>;\n getEntity<T = unknown>(\n id: string,\n collection: string,\n key: Hex,\n options?: { signal?: AbortSignal },\n ): Promise<GenericOutputEntity<T>>;\n releaseSnapshot(\n id: string,\n snapshotId: string,\n options?: { signal?: AbortSignal },\n ): Promise<void>;\n consumers: {\n list(\n id: string,\n options?: { signal?: AbortSignal },\n ): Promise<DurableConsumer[]>;\n create(\n id: string,\n options: CreateConsumerOptions,\n ): Promise<DurableConsumer>;\n inspect(\n id: string,\n consumer: string,\n options?: { signal?: AbortSignal },\n ): Promise<DurableConsumer>;\n revoke(\n id: string,\n consumer: string,\n options?: { signal?: AbortSignal },\n ): Promise<DurableConsumer>;\n renew(\n id: string,\n consumer: string,\n credential: string,\n options?: { signal?: AbortSignal },\n ): Promise<DurableConsumer>;\n changes<T = unknown>(\n id: string,\n consumer: string,\n credential: string,\n options?: { limit?: number; signal?: AbortSignal },\n ): Promise<Page<ChangeEnvelope<T>>>;\n acknowledge(\n id: string,\n consumer: string,\n credential: string,\n cursor: string,\n options?: { signal?: AbortSignal },\n ): Promise<DurableConsumer>;\n };\n subscribe<T = unknown>(\n id: string,\n options?: SubscribeOptions,\n ): AsyncGenerator<ChangeEnvelope<T>>;\n };\n blobs: {\n getBlock(\n number: number,\n options?: { signal?: AbortSignal },\n ): Promise<BlobsBlock>;\n listBlocks(options: ListBlocksOptions): Promise<Page<BlobsBlock>>;\n listSnapshot(\n options: ListBlocksOptions,\n ): Promise<Page<BlobsSnapshotEntry>>;\n getTransaction(\n hash: Hex,\n options?: { signal?: AbortSignal },\n ): Promise<BlobTransaction>;\n listTransactions(\n options: ListTransactionsOptions,\n ): Promise<Page<BlobTransaction>>;\n getSchedule(options?: {\n atBlock?: number;\n signal?: AbortSignal;\n }): Promise<BlobSchedule>;\n subscribe(\n options?: ProcessorSubscribeOptions,\n ): AsyncGenerator<ChangeEnvelope<BlobsSnapshotEntry>>;\n };\n erc20: {\n getBalance(\n token: Hex,\n address: Hex,\n options?: { signal?: AbortSignal },\n ): Promise<Erc20Balance>;\n subscribe(\n options?: ProcessorSubscribeOptions,\n ): AsyncGenerator<ChangeEnvelope<Erc20Balance>>;\n };\n uniswap: {\n getPool(\n address: Hex,\n options?: { signal?: AbortSignal },\n ): Promise<UniswapPoolPrice>;\n getLatestObservation(\n address: Hex,\n options?: { processor?: string; signal?: AbortSignal },\n ): Promise<LatestUniswapObservation>;\n listConfiguredPools(options?: {\n processor?: string;\n signal?: AbortSignal;\n }): Promise<ConfiguredUniswapPools>;\n subscribe(\n options?: ProcessorSubscribeOptions,\n ): AsyncGenerator<ChangeEnvelope<UniswapPoolPrice>>;\n };\n blocks: {\n getLatest(options?: {\n processor?: string;\n signal?: AbortSignal;\n }): Promise<LatestBlockSummary>;\n getByNumber(\n number: number,\n options?: { processor?: string; signal?: AbortSignal },\n ): Promise<LatestBlockSummary>;\n subscribe(\n options?: ProcessorSubscribeOptions,\n ): AsyncGenerator<ChangeEnvelope<BlockSummary>>;\n };\n}\n\ninterface ResolvedOptions {\n baseUrl: URL;\n token?: string;\n timeoutMs: number;\n fetch: FetchLike;\n queryBasePaths: {\n blobs: string;\n erc20: string;\n uniswap: string;\n };\n reconnect: {\n initialDelayMs: number;\n maxDelayMs: number;\n jitter: number;\n };\n}\n\n/**\n * Create a Bun/Node/browser client for the native v1 query and durable change\n * API. Ethereum JSON-RPC remains a separate endpoint used directly by viem,\n * ethers, or another Ethereum library.\n */\nexport function createLeaniClient(\n options: LeaniClientOptions,\n): LeaniClient {\n const resolved = resolveOptions(options);\n\n const get = <T>(\n path: string,\n query?: Record<string, QueryValue>,\n signal?: AbortSignal,\n extraHeaders?: Record<string, string>,\n ): Promise<T> =>\n requestJson<T>(\n resolved,\n \"GET\",\n path,\n query,\n undefined,\n signal,\n extraHeaders,\n );\n\n const post = <T>(\n path: string,\n body?: unknown,\n signal?: AbortSignal,\n extraHeaders?: Record<string, string>,\n ): Promise<T> =>\n requestJson<T>(\n resolved,\n \"POST\",\n path,\n undefined,\n body,\n signal,\n extraHeaders,\n );\n\n const remove = (\n path: string,\n signal?: AbortSignal,\n ): Promise<void> => requestVoid(resolved, \"DELETE\", path, signal);\n\n const removeJson = <T>(\n path: string,\n signal?: AbortSignal,\n ): Promise<T> =>\n requestJson<T>(\n resolved,\n \"DELETE\",\n path,\n undefined,\n undefined,\n signal,\n );\n\n const subscribe = <T>(\n processor: string,\n options: SubscribeOptions = {},\n ): AsyncGenerator<ChangeEnvelope<T>> =>\n subscribeProcessor<T>(resolved, processor, options);\n\n const request = <T>(\n path: string,\n params?: Record<string, QueryValue>,\n requestOptions?: { signal?: AbortSignal },\n ): Promise<T> => get<T>(path, params, requestOptions?.signal);\n\n return Object.freeze({\n baseUrl: resolved.baseUrl,\n request,\n health: Object.freeze({\n live: (options?: { signal?: AbortSignal }) =>\n get<Health>(\"health/live\", undefined, options?.signal),\n ready: (options?: { signal?: AbortSignal }) =>\n get<Health>(\"health/ready\", undefined, options?.signal),\n }),\n status: (options?: { signal?: AbortSignal }) =>\n get<NodeStatus>(\"v1/status\", undefined, options?.signal),\n capabilities: (options?: { signal?: AbortSignal }) =>\n request<Capabilities>(\"v1/capabilities\", undefined, options),\n processors: Object.freeze({\n list: async (options?: { signal?: AbortSignal }) => {\n const response = await get<{ data: ProcessorSummary[] }>(\n \"v1/processors\",\n undefined,\n options?.signal,\n );\n return response.data;\n },\n status: (id: string, options?: { signal?: AbortSignal }) =>\n get<ProcessorCoverage>(\n `v1/processors/${encodeURIComponent(id)}/status`,\n undefined,\n options?.signal,\n ),\n changes: <T = unknown>(\n id: string,\n changesOptions: ChangesOptions = {},\n ) =>\n get<Page<ChangeEnvelope<T>>>(\n `v1/processors/${encodeURIComponent(id)}/changes`,\n {\n after: changesOptions.after,\n limit: changesOptions.limit,\n },\n changesOptions.signal,\n ),\n changeHead: (\n id: string,\n options?: { signal?: AbortSignal },\n ) =>\n get<ChangeHead>(\n `v1/processors/${encodeURIComponent(id)}/changes/head`,\n undefined,\n options?.signal,\n ),\n resetLiveLane: (\n id: string,\n options?: { signal?: AbortSignal },\n ) =>\n post<LiveLaneReset>(\n `admin/v1/processors/${encodeURIComponent(id)}/lanes/live/reset`,\n undefined,\n options?.signal,\n ),\n listCollections: (\n id: string,\n options?: { signal?: AbortSignal },\n ) =>\n get<{\n processor: ProcessorSummary;\n outputMode: \"none\" | \"latest\" | \"window\" | \"full\";\n retained: boolean;\n data: string[];\n }>(\n `v1/processors/${encodeURIComponent(id)}/collections`,\n undefined,\n options?.signal,\n ),\n queryEntities: <T = unknown>(\n id: string,\n collection: string,\n queryOptions: OutputQueryOptions = {},\n ) => {\n const path = `v1/processors/${encodeURIComponent(id)}/collections/${encodeURIComponent(collection)}/entities`;\n // Only POST creates a snapshot; its later pages are read by GET.\n return queryOptions.cursor === undefined\n ? post<GenericSnapshotPage<T>>(\n path,\n outputQueryBody(queryOptions),\n queryOptions.signal,\n )\n : get<GenericSnapshotPage<T>>(\n path,\n outputQueryValues(queryOptions),\n queryOptions.signal,\n );\n },\n queryAndFollow: <T = unknown>(\n id: string,\n collection: string,\n queryOptions: Omit<OutputQueryOptions, \"cursor\"> = {},\n ) =>\n post<FollowSnapshotPage<T>>(\n `v1/processors/${encodeURIComponent(id)}/collections/${encodeURIComponent(collection)}/query-and-follow`,\n outputQueryBody(queryOptions),\n queryOptions.signal,\n ),\n getEntity: <T = unknown>(\n id: string,\n collection: string,\n key: Hex,\n options?: { signal?: AbortSignal },\n ) =>\n get<GenericOutputEntity<T>>(\n `v1/processors/${encodeURIComponent(id)}/collections/${encodeURIComponent(collection)}/entities/${encodeURIComponent(assertEntityKey(key))}`,\n undefined,\n options?.signal,\n ),\n releaseSnapshot: (\n id: string,\n snapshotId: string,\n options?: { signal?: AbortSignal },\n ) =>\n remove(\n `v1/processors/${encodeURIComponent(id)}/query-snapshots/${encodeURIComponent(snapshotId)}`,\n options?.signal,\n ),\n consumers: Object.freeze({\n list: async (\n id: string,\n options?: { signal?: AbortSignal },\n ) => {\n const response = await get<{ data: DurableConsumer[] }>(\n `v1/processors/${encodeURIComponent(id)}/consumers`,\n undefined,\n options?.signal,\n );\n return response.data;\n },\n create: (\n id: string,\n consumerOptions: CreateConsumerOptions,\n ) =>\n post<DurableConsumer>(\n `v1/processors/${encodeURIComponent(id)}/consumers`,\n {\n id: consumerOptions.id,\n role: consumerOptions.role,\n start: consumerOptions.start,\n leaseTtlSeconds: assertPositiveSafeInteger(\n consumerOptions.leaseTtlSeconds,\n \"leaseTtlSeconds\",\n ),\n credential: consumerOptions.credential,\n },\n consumerOptions.signal,\n ),\n inspect: (\n id: string,\n consumer: string,\n options?: { signal?: AbortSignal },\n ) =>\n get<DurableConsumer>(\n consumerPath(id, consumer),\n undefined,\n options?.signal,\n ),\n revoke: (\n id: string,\n consumer: string,\n options?: { signal?: AbortSignal },\n ) =>\n removeJson<DurableConsumer>(\n consumerPath(id, consumer),\n options?.signal,\n ),\n renew: (\n id: string,\n consumer: string,\n credential: string,\n options?: { signal?: AbortSignal },\n ) =>\n post<DurableConsumer>(\n `${consumerPath(id, consumer)}/lease`,\n undefined,\n options?.signal,\n consumerCredentialHeader(credential),\n ),\n changes: <T = unknown>(\n id: string,\n consumer: string,\n credential: string,\n options: { limit?: number; signal?: AbortSignal } = {},\n ) =>\n get<Page<ChangeEnvelope<T>>>(\n `${consumerPath(id, consumer)}/changes`,\n { limit: options.limit },\n options.signal,\n consumerCredentialHeader(credential),\n ),\n acknowledge: (\n id: string,\n consumer: string,\n credential: string,\n cursor: string,\n options?: { signal?: AbortSignal },\n ) =>\n post<DurableConsumer>(\n `${consumerPath(id, consumer)}/ack`,\n { cursor },\n options?.signal,\n consumerCredentialHeader(credential),\n ),\n }),\n subscribe,\n }),\n blobs: Object.freeze({\n getBlock: (number: number, options?: { signal?: AbortSignal }) =>\n request<BlobsBlock>(\n `${resolved.queryBasePaths.blobs}/blocks/${assertSafeInteger(number, \"block number\")}`,\n undefined,\n options,\n ),\n listBlocks: (listOptions: ListBlocksOptions) =>\n request<Page<BlobsBlock>>(\n `${resolved.queryBasePaths.blobs}/blocks`,\n {\n fromBlock: assertSafeInteger(\n listOptions.fromBlock,\n \"fromBlock\",\n ),\n toBlock: assertSafeInteger(listOptions.toBlock, \"toBlock\"),\n limit: listOptions.limit,\n cursor: listOptions.cursor,\n allowPartial: listOptions.allowPartial,\n },\n { signal: listOptions.signal },\n ),\n listSnapshot: (listOptions: ListBlocksOptions) =>\n request<Page<BlobsSnapshotEntry>>(\n `${resolved.queryBasePaths.blobs}/snapshot`,\n {\n fromBlock: assertSafeInteger(\n listOptions.fromBlock,\n \"fromBlock\",\n ),\n toBlock: assertSafeInteger(listOptions.toBlock, \"toBlock\"),\n limit: listOptions.limit,\n cursor: listOptions.cursor,\n allowPartial: listOptions.allowPartial,\n },\n { signal: listOptions.signal },\n ),\n getTransaction: (\n hash: Hex,\n options?: { signal?: AbortSignal },\n ) =>\n request<BlobTransaction>(\n `${resolved.queryBasePaths.blobs}/transactions/${encodeURIComponent(assertHash(hash))}`,\n undefined,\n options,\n ),\n listTransactions: (listOptions: ListTransactionsOptions) =>\n request<Page<BlobTransaction>>(\n `${resolved.queryBasePaths.blobs}/transactions`,\n {\n blockNumber: assertSafeInteger(\n listOptions.blockNumber,\n \"blockNumber\",\n ),\n limit: listOptions.limit,\n cursor: listOptions.cursor,\n },\n { signal: listOptions.signal },\n ),\n getSchedule: (\n scheduleOptions: {\n atBlock?: number;\n signal?: AbortSignal;\n } = {},\n ) =>\n request<BlobSchedule>(\n `${resolved.queryBasePaths.blobs}/schedule`,\n {\n atBlock:\n scheduleOptions.atBlock === undefined\n ? undefined\n : assertSafeInteger(scheduleOptions.atBlock, \"atBlock\"),\n },\n { signal: scheduleOptions.signal },\n ),\n subscribe: (subscribeOptions: ProcessorSubscribeOptions = {}) =>\n subscribe<BlobsSnapshotEntry>(\n subscribeOptions.processor ?? \"blobs-money\",\n subscribeOptions,\n ),\n }),\n erc20: Object.freeze({\n getBalance: (\n token: Hex,\n address: Hex,\n options?: { signal?: AbortSignal },\n ) =>\n request<Erc20Balance>(\n `${resolved.queryBasePaths.erc20}/balances/${encodeURIComponent(assertAddress(token))}/${encodeURIComponent(assertAddress(address))}`,\n undefined,\n options,\n ),\n subscribe: (subscribeOptions: ProcessorSubscribeOptions = {}) =>\n subscribe<Erc20Balance>(subscribeOptions.processor ?? \"erc20-balances\", subscribeOptions),\n }),\n uniswap: Object.freeze({\n getPool: (\n address: Hex,\n options?: { signal?: AbortSignal },\n ) =>\n request<UniswapPoolPrice>(\n `${resolved.queryBasePaths.uniswap}/pools/${encodeURIComponent(assertAddress(address))}`,\n undefined,\n options,\n ),\n getLatestObservation: (\n address: Hex,\n options: { processor?: string; signal?: AbortSignal } = {},\n ) =>\n request<LatestUniswapObservation>(\n `v1/processors/${encodeURIComponent(options.processor ?? \"uniswap-observations\")}/query/pools/${encodeURIComponent(assertAddress(address))}/latest`,\n undefined,\n { signal: options.signal },\n ),\n listConfiguredPools: (\n options: { processor?: string; signal?: AbortSignal } = {},\n ) =>\n request<ConfiguredUniswapPools>(\n `v1/processors/${encodeURIComponent(options.processor ?? \"uniswap-observations\")}/query/pools`,\n undefined,\n { signal: options.signal },\n ),\n subscribe: (subscribeOptions: ProcessorSubscribeOptions = {}) =>\n subscribe<UniswapPoolPrice>(subscribeOptions.processor ?? \"uniswap-observations\", subscribeOptions),\n }),\n blocks: Object.freeze({\n getLatest: (\n options: { processor?: string; signal?: AbortSignal } = {},\n ) =>\n request<LatestBlockSummary>(\n `v1/processors/${encodeURIComponent(options.processor ?? \"block-summary\")}/query/latest`,\n undefined,\n { signal: options.signal },\n ),\n getByNumber: (\n number: number,\n options: { processor?: string; signal?: AbortSignal } = {},\n ) =>\n request<LatestBlockSummary>(\n `v1/processors/${encodeURIComponent(options.processor ?? \"block-summary\")}/query/blocks/${assertSafeInteger(number, \"block number\")}`,\n undefined,\n { signal: options.signal },\n ),\n subscribe: (subscribeOptions: ProcessorSubscribeOptions = {}) =>\n subscribe<BlockSummary>(subscribeOptions.processor ?? \"block-summary\", subscribeOptions),\n }),\n });\n}\n\nfunction resolveOptions(options: LeaniClientOptions): ResolvedOptions {\n const baseUrl = new URL(options.baseUrl);\n baseUrl.pathname = `${baseUrl.pathname.replace(/\\/+$/, \"\")}/`;\n const timeoutMs = options.timeoutMs ?? 15_000;\n if (!Number.isSafeInteger(timeoutMs) || timeoutMs <= 0) {\n throw new TypeError(\"timeoutMs must be a positive safe integer\");\n }\n const jitter = options.reconnect?.jitter ?? 0.2;\n if (!Number.isFinite(jitter) || jitter < 0 || jitter > 1) {\n throw new TypeError(\"reconnect.jitter must be in 0..=1\");\n }\n return {\n baseUrl,\n token: options.token,\n timeoutMs,\n fetch: options.fetch ?? globalThis.fetch.bind(globalThis),\n queryBasePaths: {\n blobs: normalizeQueryBasePath(\n options.queryBasePaths?.blobs,\n \"v1/q/blobs\",\n ),\n erc20: normalizeQueryBasePath(\n options.queryBasePaths?.erc20,\n \"v1/q/erc20\",\n ),\n uniswap: normalizeQueryBasePath(\n options.queryBasePaths?.uniswap,\n \"v1/q/uniswap\",\n ),\n },\n reconnect: {\n initialDelayMs: options.reconnect?.initialDelayMs ?? 250,\n maxDelayMs: options.reconnect?.maxDelayMs ?? 10_000,\n jitter,\n },\n };\n}\n\nfunction normalizeQueryBasePath(\n configured: string | undefined,\n fallback: string,\n): string {\n const path = (configured ?? fallback).replace(/\\/+$/g, \"\");\n if (\n path.length === 0 ||\n /^[a-z][a-z0-9+.-]*:/i.test(path) ||\n path.startsWith(\"//\") ||\n path.includes(\"?\") ||\n path.includes(\"#\")\n ) {\n throw new TypeError(\"query base path must be a non-empty same-origin path\");\n }\n return path;\n}\n\nexport type QueryValue = string | number | boolean | undefined;\n\nfunction buildUrl(\n options: ResolvedOptions,\n path: string,\n query?: Record<string, QueryValue>,\n): URL {\n const url = resolveUnder(options.baseUrl, path);\n if (query) {\n for (const [key, value] of Object.entries(query)) {\n if (value !== undefined) {\n url.searchParams.set(key, String(value));\n }\n }\n }\n return url;\n}\n\nasync function requestJson<T>(\n options: ResolvedOptions,\n method: \"GET\" | \"POST\" | \"DELETE\",\n path: string,\n query?: Record<string, QueryValue>,\n body?: unknown,\n signal?: AbortSignal,\n extraHeaders?: Record<string, string>,\n): Promise<T> {\n const response = await send(options.fetch, buildUrl(options, path, query), {\n method,\n headers: headers(\n options,\n \"application/json\",\n body !== undefined\n ? { \"content-type\": \"application/json\", ...extraHeaders }\n : method === \"GET\"\n ? extraHeaders\n : { ...LEANI_REQUEST_HEADER, ...extraHeaders },\n ),\n body: body === undefined ? undefined : JSON.stringify(body),\n signal: withDeadline(signal, options.timeoutMs),\n }, signal);\n if (!response.ok) {\n throw await responseError(response);\n }\n return readJson<T>(response, signal);\n}\n\nasync function requestVoid(\n options: ResolvedOptions,\n method: \"DELETE\",\n path: string,\n signal?: AbortSignal,\n): Promise<void> {\n const response = await send(options.fetch, buildUrl(options, path), {\n method,\n headers: headers(options, \"application/json\", LEANI_REQUEST_HEADER),\n signal: withDeadline(signal, options.timeoutMs),\n }, signal);\n if (!response.ok) {\n throw await responseError(response);\n }\n}\n\n/** The default `idleTimeoutMs`: four of the node's keep-alive intervals. */\nconst DEFAULT_SSE_IDLE_TIMEOUT_MS = 60_000;\n\n/**\n * Retryable `error` events in a row, with no new change between them, after\n * which a subscription throws the last one instead of reconnecting again.\n */\nconst MAX_ERROR_EVENT_RETRIES = 5;\n\nasync function* subscribeProcessor<T>(\n options: ResolvedOptions,\n processor: string,\n subscribeOptions: SubscribeOptions,\n): AsyncGenerator<ChangeEnvelope<T>> {\n const signal = subscribeOptions.signal;\n const idleTimeoutMs =\n subscribeOptions.idleTimeoutMs ?? DEFAULT_SSE_IDLE_TIMEOUT_MS;\n if (!Number.isSafeInteger(idleTimeoutMs) || idleTimeoutMs <= 0) {\n throw new TypeError(\"idleTimeoutMs must be a positive safe integer\");\n }\n let after = subscribeOptions.after;\n let lastSequence: string | undefined;\n let delayMs = options.reconnect.initialDelayMs;\n let errorEventsWithoutProgress = 0;\n while (!signal?.aborted) {\n const connection = new AbortController();\n const connectionSignal = signal\n ? AbortSignal.any([signal, connection.signal])\n : connection.signal;\n const watchdog = idleWatchdog(idleTimeoutMs, () =>\n connection.abort(\n new TransportError(`SSE stream sent nothing for ${idleTimeoutMs} ms`),\n ));\n try {\n watchdog.arm();\n const response = await send(\n options.fetch,\n buildUrl(\n options,\n `v1/processors/${encodeURIComponent(processor)}/stream`,\n { after },\n ),\n {\n headers: headers(options, \"text/event-stream\"),\n signal: connectionSignal,\n },\n signal,\n );\n if (!response.ok) {\n const error = await responseError(response);\n if (!error.retryable) {\n throw error;\n }\n } else if (!response.body) {\n throw new LeaniError(\"stream response has no body\", {\n status: response.status,\n code: \"internal\",\n retryable: true,\n });\n } else {\n // A stream that opens ends the backoff of earlier failures.\n delayMs = options.reconnect.initialDelayMs;\n const messages = sseMessages(\n readChunks(response.body, connectionSignal, watchdog.arm),\n signal,\n );\n for await (const message of messages) {\n if (!message.data) {\n continue;\n }\n if (message.event === \"hello\") {\n subscribeOptions.onHello?.(JSON.parse(message.data) as StreamHello);\n continue;\n }\n if (message.event === \"error\") {\n const error = errorFromBody(200, JSON.parse(message.data));\n errorEventsWithoutProgress += 1;\n if (\n !error.retryable ||\n errorEventsWithoutProgress > MAX_ERROR_EVENT_RETRIES\n ) {\n throw error;\n }\n // The node ends the stream after an error event. Opening the\n // stream reset the backoff, so it grows with these events.\n delayMs = Math.min(\n options.reconnect.initialDelayMs *\n 2 ** (errorEventsWithoutProgress - 1),\n options.reconnect.maxDelayMs,\n );\n break;\n }\n const change = JSON.parse(message.data) as ChangeEnvelope<T>;\n validateChangeEnvelope(change);\n if (change.operation === \"reset_required\") {\n throw new ResetRequiredError(change as ChangeEnvelope);\n }\n\n if (\n lastSequence !== undefined &&\n compareSequences(change.sequence, lastSequence) <= 0\n ) {\n continue;\n }\n lastSequence = change.sequence;\n after = change.cursor;\n errorEventsWithoutProgress = 0;\n // The time the application spends on a change is not silence.\n watchdog.disarm();\n yield change;\n watchdog.arm();\n }\n }\n } catch (error) {\n if (signal?.aborted) return;\n // Resume only transport failures; malformed events, terminal errors,\n // and user callbacks must fail visibly instead of reconnecting forever.\n if (!(error instanceof TransportError)) throw error;\n } finally {\n watchdog.disarm();\n connection.abort();\n }\n if (signal?.aborted) {\n break;\n }\n await abortableDelay(\n jitter(delayMs, options.reconnect.jitter),\n signal,\n );\n delayMs = Math.min(delayMs * 2, options.reconnect.maxDelayMs);\n }\n}\n\ninterface SseMessage {\n id?: string;\n event?: string;\n data?: string;\n}\n\n/** The largest SSE event the client buffers before it fails the stream. */\nconst MAX_SSE_EVENT_BYTES = 8 * 1024 * 1024;\n\nconst LINE_FEED = 0x0a;\nconst CARRIAGE_RETURN = 0x0d;\n\nexport async function* parseSse(\n body: ReadableStream<Uint8Array>,\n signal?: AbortSignal,\n): AsyncGenerator<SseMessage> {\n yield* sseMessages(readChunks(body, signal), signal);\n}\n\n/**\n * Split SSE events at blank lines, scanning each byte once. Line endings are\n * ASCII, so a scan by byte never splits a UTF-8 character.\n */\nasync function* sseMessages(\n chunks: AsyncIterable<Uint8Array>,\n signal: AbortSignal | undefined,\n): AsyncGenerator<SseMessage> {\n const decoder = new TextDecoder();\n // The bytes received so far of the event in progress.\n let pending: Uint8Array[] = [];\n let pendingBytes = 0;\n let lineEmpty = true;\n let afterCarriageReturn = false;\n for await (const chunk of chunks) {\n let eventStart = 0;\n for (let index = 0; index < chunk.length; index += 1) {\n const byte = chunk[index];\n if (byte === LINE_FEED && afterCarriageReturn) {\n // The second half of a CRLF, which chunks may split.\n afterCarriageReturn = false;\n continue;\n }\n afterCarriageReturn = byte === CARRIAGE_RETURN;\n if (byte !== LINE_FEED && byte !== CARRIAGE_RETURN) {\n lineEmpty = false;\n continue;\n }\n if (!lineEmpty) {\n lineEmpty = true;\n continue;\n }\n // A blank line completes the event.\n const tail = chunk.subarray(eventStart, index);\n eventStart = index + 1;\n if (pendingBytes + tail.length > MAX_SSE_EVENT_BYTES) {\n throw sseEventTooLarge();\n }\n const event = concatBytes(pending, pendingBytes, tail);\n pending = [];\n pendingBytes = 0;\n if (signal?.aborted) return;\n const parsed = parseSseFrame(decoder.decode(event));\n if (parsed) {\n yield parsed;\n }\n }\n const rest = chunk.subarray(eventStart);\n if (rest.length > 0) {\n pendingBytes += rest.length;\n if (pendingBytes > MAX_SSE_EVENT_BYTES) {\n throw sseEventTooLarge();\n }\n pending.push(rest);\n }\n }\n // Only a blank line completes an SSE event. A partial final event is\n // discarded, so a reconnect resumes from the last complete one.\n}\n\nfunction sseEventTooLarge(): LeaniError {\n return new LeaniError(`SSE event exceeds ${MAX_SSE_EVENT_BYTES} bytes`, {\n status: 200,\n code: \"invalid_response\",\n retryable: false,\n });\n}\n\nfunction parseSseFrame(frame: string): SseMessage | undefined {\n const message: SseMessage = {};\n const data: string[] = [];\n for (const line of frame.split(/\\r\\n|\\r|\\n/)) {\n if (line.length === 0 || line.startsWith(\":\")) {\n continue;\n }\n const separator = line.indexOf(\":\");\n const field = separator < 0 ? line : line.slice(0, separator);\n let value = separator < 0 ? \"\" : line.slice(separator + 1);\n if (value.startsWith(\" \")) {\n value = value.slice(1);\n }\n if (field === \"id\") {\n message.id = value;\n } else if (field === \"event\") {\n message.event = value;\n } else if (field === \"data\") {\n data.push(value);\n }\n }\n if (data.length > 0) {\n message.data = data.join(\"\\n\");\n }\n return Object.keys(message).length > 0 ? message : undefined;\n}\n\nfunction headers(\n options: ResolvedOptions,\n accept: string,\n extra?: Record<string, string>,\n): Record<string, string> {\n const result: Record<string, string> = { Accept: accept, ...extra };\n if (options.token) {\n result.Authorization = `Bearer ${options.token}`;\n }\n return result;\n}\n\nfunction validateChangeEnvelope(value: ChangeEnvelope): void {\n if (\n !value ||\n value.apiVersion !== \"1\" ||\n !/^\\d+$/.test(value.sequence) ||\n typeof value.cursor !== \"string\" ||\n value.cursor.length === 0 ||\n ![\"apply\", \"undo\", \"finalized\", \"reset_required\"].includes(value.operation) ||\n typeof value.schema !== \"string\" ||\n value.schema.length === 0\n ) {\n throw new LeaniError(\"invalid change envelope\", {\n status: 200,\n code: \"invalid_response\",\n retryable: false,\n });\n }\n}\n\nexport function compareSequences(left: string, right: string): -1 | 0 | 1 {\n if (!/^\\d+$/.test(left) || !/^\\d+$/.test(right)) {\n throw new TypeError(\"sequences must be unsigned decimal strings\");\n }\n const comparison = BigInt(left) - BigInt(right);\n return comparison < 0n ? -1 : comparison > 0n ? 1 : 0;\n}\n\nexport function isResetRequired(\n change: ChangeEnvelope,\n): change is ChangeEnvelope & { operation: \"reset_required\" } {\n return change.operation === \"reset_required\";\n}\n\nexport interface EntityChangeTarget<T> {\n put(key: string, value: T): void | Promise<void>;\n delete(key: string): void | Promise<void>;\n}\n\nexport async function applyEntityChange<T>(\n target: EntityChangeTarget<T>,\n change: ChangeEnvelope<T>,\n): Promise<void> {\n if ((change.operation !== \"apply\" && change.operation !== \"undo\") || !change.key) {\n return;\n }\n if (change.data === null || change.kind.endsWith(\".delete\")) {\n await target.delete(change.key);\n } else {\n await target.put(change.key, change.data);\n }\n}\n\n/**\n * Commit destination state before constructing the acknowledgement request.\n * If the destination commit rejects, `acknowledge` is never invoked and the\n * durable consumer safely receives the same changes again.\n */\nexport async function commitThenAcknowledge<T>(\n destinationCommit: () => Promise<T>,\n acknowledge: (committed: T) => Promise<unknown>,\n): Promise<T> {\n const committed = await destinationCommit();\n await acknowledge(committed);\n return committed;\n}\n\nexport interface CursorStore {\n get(): string | undefined;\n set(cursor: string): void;\n clear(): void;\n}\n\nexport function createInMemoryCursorStore(initial?: string): CursorStore {\n let cursor = initial;\n return {\n get: () => cursor,\n set: (value: string) => {\n cursor = value;\n },\n clear: () => {\n cursor = undefined;\n },\n };\n}\n\nfunction assertSafeInteger(value: number, field: string): number {\n if (!Number.isSafeInteger(value) || value < 0) {\n throw new TypeError(`${field} must be a non-negative safe integer`);\n }\n return value;\n}\n\nfunction assertPositiveSafeInteger(value: number, field: string): number {\n const result = assertSafeInteger(value, field);\n if (result === 0) {\n throw new TypeError(`${field} must be positive`);\n }\n return result;\n}\n\nfunction optionalSafeInteger(\n value: number | undefined,\n field: string,\n): number | undefined {\n return value === undefined ? undefined : assertSafeInteger(value, field);\n}\n\nfunction outputQueryBody(\n options: Omit<OutputQueryOptions, \"cursor\">,\n): Record<string, number | undefined> {\n return {\n fromBlock: optionalSafeInteger(options.fromBlock, \"fromBlock\"),\n toBlock: optionalSafeInteger(options.toBlock, \"toBlock\"),\n fromTimestamp: optionalSafeInteger(\n options.fromTimestamp,\n \"fromTimestamp\",\n ),\n toTimestamp: optionalSafeInteger(options.toTimestamp, \"toTimestamp\"),\n limit:\n options.limit === undefined\n ? undefined\n : assertPositiveSafeInteger(options.limit, \"limit\"),\n };\n}\n\nfunction outputQueryValues(\n options: OutputQueryOptions,\n): Record<string, QueryValue> {\n return {\n ...outputQueryBody(options),\n cursor: options.cursor,\n };\n}\n\nfunction consumerPath(processor: string, consumer: string): string {\n return `v1/processors/${encodeURIComponent(processor)}/consumers/${encodeURIComponent(consumer)}`;\n}\n\nfunction consumerCredentialHeader(\n credential: string,\n): Record<string, string> {\n if (credential.length === 0) {\n throw new TypeError(\"consumer credential must not be empty\");\n }\n return { \"x-leani-consumer-credential\": credential };\n}\n\nfunction assertEntityKey(value: string): Hex {\n if (!/^0x(?:[0-9a-fA-F]{2})*$/.test(value)) {\n throw new TypeError(\"entity key must contain complete hexadecimal bytes\");\n }\n return value as Hex;\n}\n\nfunction assertHash(value: string): Hex {\n if (!/^0x[0-9a-fA-F]{64}$/.test(value)) {\n throw new TypeError(\"transaction hash must contain exactly 32 bytes\");\n }\n return value as Hex;\n}\n\nfunction assertAddress(value: string): Hex {\n if (!/^0x[0-9a-fA-F]{40}$/.test(value)) {\n throw new TypeError(\"address must contain exactly 20 bytes\");\n }\n return value as Hex;\n}\n\nfunction jitter(delayMs: number, amount: number): number {\n const factor = 1 - amount + Math.random() * amount * 2;\n return Math.max(0, Math.round(delayMs * factor));\n}\n\nasync function abortableDelay(\n milliseconds: number,\n signal?: AbortSignal,\n): Promise<void> {\n if (signal?.aborted) {\n return;\n }\n await new Promise<void>((resolve) => {\n const finish = () => {\n clearTimeout(timeout);\n signal?.removeEventListener(\"abort\", finish);\n resolve();\n };\n const timeout = setTimeout(finish, milliseconds);\n signal?.addEventListener(\"abort\", finish, { once: true });\n });\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,cAAc,EACd,aAAa,EACb,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,WAAW,EACX,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,IAAI,EACJ,YAAY,GACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,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,GAAG,EAAE;YAClB,YAAY,CAAC,OAAO,CAAC,CAAC;YACtB,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAC7C,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC;QACF,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QACjD,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n LeaniError,\n TransportError,\n responseError,\n errorFromBody,\n} from \"./errors.ts\";\nimport {\n concatBytes,\n idleWatchdog,\n readChunks,\n readJson,\n resolveUnder,\n send,\n withDeadline,\n} from \"./transport.ts\";\nexport { LeaniError, TransportError, type LeaniErrorBody } from \"./errors.ts\";\n\n// Kept literal for toolchain compatibility; tests pin it to package.json.\nexport const SDK_VERSION = \"0.1.0-rc.4\" as const;\n\n/** Sent on mutations without a JSON body, which the node otherwise refuses. */\nconst LEANI_REQUEST_HEADER: Readonly<Record<string, string>> = Object.freeze({\n \"x-leani-request\": \"1\",\n});\n\nexport type {\n components as OpenApiComponents,\n operations as OpenApiOperations,\n paths as OpenApiPaths,\n} from \"./openapi.generated.ts\";\n\nexport type Hex = `0x${string}`;\nexport type Finality = \"preview\" | \"included\" | \"finalized\";\nexport type ChangeOperation =\n | \"apply\"\n | \"undo\"\n | \"finalized\"\n | \"reset_required\";\n\nexport interface LeaniClientOptions {\n baseUrl: string | URL;\n token?: string;\n timeoutMs?: number;\n fetch?: FetchLike;\n /**\n * Override typed query-extension mounts with canonical `basePath` values\n * returned by `capabilities()` when an ergonomic alias is unavailable.\n */\n queryBasePaths?: {\n blobs?: string;\n erc20?: string;\n uniswap?: string;\n };\n reconnect?: {\n initialDelayMs?: number;\n maxDelayMs?: number;\n jitter?: number;\n };\n}\n\nexport type FetchLike = (\n input: RequestInfo | URL,\n init?: RequestInit,\n) => Promise<Response>;\n\nexport interface ProcessorSummary {\n id: string;\n instance: string;\n version: string;\n codeHash: Hex;\n configHash: Hex;\n genericApi: \"processor-v1\";\n changeSchema: string;\n queryExtensions: QueryExtensionSummary[];\n subscriptions: boolean;\n artifactRetention: \"none\" | \"window\" | \"full\";\n deliveryOrdering: \"canonical\" | \"block_versioned_idempotent\";\n}\n\nexport interface QueryExtensionSummary {\n id: string;\n basePath: string;\n aliasPath: string | null;\n}\n\nexport interface QueryExtensionCapability extends QueryExtensionSummary {\n processor: string;\n}\n\nexport interface Capabilities {\n chainId: number;\n ethereumRpc: Record<string, unknown>;\n processors: ProcessorSummary[];\n queryExtensions: QueryExtensionCapability[];\n}\n\nexport interface NodeStatus {\n apiVersion: \"1\";\n project: string;\n version: string;\n chainId: number;\n uptimeSeconds: number;\n databaseBytes: number;\n processor: ProcessorSummary;\n processors: ProcessorSummary[];\n readiness: Readiness;\n}\n\nexport interface Readiness {\n liveRequired: boolean;\n liveReady: boolean;\n finalityRequired: boolean;\n finalityReady: boolean;\n ready: boolean;\n}\n\nexport interface Health {\n status: \"live\" | \"ready\" | \"not_ready\" | \"failed\";\n uptimeSeconds: number;\n database: \"available\" | \"unavailable\";\n readiness: Readiness;\n reasons: string[];\n}\n\nexport interface CoverageInterval {\n fromBlock: number;\n toBlock: number;\n finality: Finality;\n}\n\nexport interface ProcessorCoverage {\n chainId: number;\n chainFinalizedHead: {\n number: number;\n hash: string;\n } | null;\n requested?: {\n fromBlock: number;\n toBlock: number;\n } | null;\n available: CoverageInterval[];\n configuredStartBlock: number;\n processedThrough: number | null;\n finalizedThrough: number | null;\n complete: boolean;\n state:\n | \"starting\"\n | \"backfilling\"\n | \"catching_up\"\n | \"live\"\n | \"degraded\"\n | \"paused\"\n | \"failed\";\n}\n\nexport interface Page<T> {\n data: T[];\n nextCursor: string | null;\n coverage: ProcessorCoverage;\n}\n\nexport interface BlobsBlock {\n network: string;\n blockNumber: number;\n blockHash: Hex;\n parentHash: Hex;\n timestamp: number;\n size: string;\n blobCount: number;\n blobGasUsed: string;\n excessBlobGas: string;\n /**\n * Protocol blob base fee in wei per blob gas: the EIP-4844 fee for\n * `excessBlobGas` under the fork active at `timestamp`. EIP-7918 does not\n * change it.\n */\n blobBaseFee: string;\n executionBaseFee: string;\n gasUsed: string;\n gasLimit: string;\n executionEthBurnedWei: string;\n /** `blobBaseFee` times `blobGasUsed`. */\n blobEthBurnedWei: string;\n /**\n * EIP-7918 reserve price in wei per blob gas from Fusaka on, `null` before.\n * It only changes how excess blob gas evolves and is not applied to\n * `blobBaseFee`.\n */\n reserveFeeWei: string | null;\n transactionCount: number;\n targetBlobsPerBlock: number;\n maxBlobsPerBlock: number;\n transformVersion: number;\n finality: Finality;\n}\n\nexport interface BlobTransaction {\n network: string;\n blockNumber: number;\n blockHash: Hex;\n txHash: Hex;\n transactionIndex: number;\n senderAddress: Hex;\n blobVersionedHashes: Hex[];\n blobCount: number;\n totalBurnedWei: string;\n executionBurnedWei: string;\n /** The block's `blobBaseFee` times this transaction's blob gas. */\n blobBurnedWei: string;\n}\n\nexport interface BlobsSnapshotEntry {\n block: BlobsBlock;\n transactions: BlobTransaction[];\n}\n\nexport interface ChangeHead {\n earliestSequence: string | null;\n latestSequence: string | null;\n cursor: string | null;\n}\n\nexport interface GenericOutputEntity<T = unknown> {\n ordinal: string;\n key: Hex;\n schema: string;\n data: T;\n blockNumber: number;\n blockTimestamp: number;\n finality: Finality;\n}\n\nexport interface OutputBounds {\n earliestBlock: number;\n latestBlock: number;\n earliestTimestamp: number;\n latestTimestamp: number;\n}\n\nexport interface GenericSnapshotPage<T = unknown> {\n data: GenericOutputEntity<T>[];\n nextCursor: string | null;\n snapshotId: string;\n boundaryCursor: string | null;\n rowCount: string;\n valueBytes: string;\n expiresAtUnixMs: string;\n retainedBounds: OutputBounds | null;\n coverage: ProcessorCoverage;\n recovery: {\n follow: string | null;\n outsideRetention: \"create_processor_instance_or_source_scan\";\n };\n}\n\nexport interface FollowSnapshotPage<T = unknown> extends GenericSnapshotPage<T> {\n boundaryCursor: string;\n recovery: GenericSnapshotPage<T>[\"recovery\"] & { follow: string };\n}\n\nexport interface OutputQueryOptions {\n fromBlock?: number;\n toBlock?: number;\n fromTimestamp?: number;\n toTimestamp?: number;\n limit?: number;\n cursor?: string;\n signal?: AbortSignal;\n}\n\nexport type ConsumerRole = \"required\" | \"best_effort\";\nexport type ConsumerState = \"active\" | \"reset_required\" | \"revoked\";\nexport type ConsumerStart =\n | { position: \"earliest_retained\" }\n | { position: \"current_head\" }\n | { position: \"cursor\"; cursor: string };\n\nexport interface CreateConsumerOptions {\n id: string;\n role: ConsumerRole;\n start: ConsumerStart;\n leaseTtlSeconds: number;\n credential: string;\n signal?: AbortSignal;\n}\n\nexport interface DurableConsumer {\n id: string;\n processorInstance: string;\n /** The delivery stream this consumer reads. */\n streamId: string;\n role: ConsumerRole;\n state: ConsumerState;\n acknowledgedSequence: string;\n deliveredSequence: string;\n acknowledgedCursor: string;\n deliveredCursor: string;\n /** Stream sessions that have taken the lease; `\"0\"` before the first. */\n leaseGeneration: string;\n leaseTtlMs: string;\n leaseExpiresAtUnixMs: string;\n leaseActive: boolean;\n lagChanges: string;\n lagBlocks: string;\n lagBytes: string;\n lagAgeMs: string;\n createdAtUnixMs: string;\n updatedAtUnixMs: string;\n}\n\nexport interface BlobSchedule {\n name: string;\n /**\n * Block-number label for `atBlock` lookups. For Dencun it is 19426589, the\n * first block the blobs processor covers.\n */\n activationBlock: number;\n /** The fork's parameters apply to blocks from this timestamp on. */\n activationTimestamp: number;\n forkId: Hex;\n targetBlobsPerBlock: number;\n maxBlobsPerBlock: number;\n baseFeeUpdateFraction: string;\n eip7918: boolean;\n source: \"chain_spec\" | \"eth_config\" | \"configured\";\n}\n\nexport interface Erc20Balance {\n token: Hex;\n address: Hex;\n balance: string;\n asOfBlock: number;\n blockHash: Hex;\n finality: Finality;\n coverageFrom: number;\n complete: boolean;\n /**\n * Block whose transfer proved the ledger incomplete for this token and\n * holder. From that block the pair is no longer derived and `balance` keeps\n * its last derived value; `null` while the pair is derived.\n */\n incompleteFrom: number | null;\n method: \"erc20_transfer_ledger\";\n}\n\nexport interface EvmEvent {\n schemaVersion: number;\n contract: Hex;\n event: string;\n signature: string;\n blockNumber: number;\n blockHash: Hex;\n blockTimestamp: number;\n bucketStartTimestamp?: number;\n transactionHash: Hex;\n transactionIndex: number;\n logIndex: number;\n finality: Finality;\n values: Record<string, string>;\n}\n\nexport interface TransactionStats {\n from: Hex;\n to: Hex;\n /** Submitted transactions from `from` to `to`, reverted ones included. */\n count: number;\n /** Submitted value in wei, including the value of reverted transactions. */\n totalValueWei: string;\n asOfBlock: number;\n blockHash: Hex;\n finality: Finality;\n coverageFrom: number;\n complete: boolean;\n}\n\nexport interface UniswapPoolPrice {\n pool: Hex;\n kind: \"v2\" | \"v3\";\n reserve0: string | null;\n reserve1: string | null;\n /** Signed token0 pool delta for a V3 swap, in raw token units. */\n amount0: string | null;\n /** Signed token1 pool delta for a V3 swap, in raw token units. */\n amount1: string | null;\n sqrtPriceX96: string | null;\n blockNumber: number;\n blockHash: Hex;\n logIndex: number;\n finality: Finality;\n}\n\nexport interface LatestUniswapObservation {\n data: UniswapPoolPrice;\n timestamp: number;\n}\n\nexport interface ConfiguredUniswapPool {\n address: Hex;\n kind: \"v2\" | \"v3\";\n}\n\nexport interface ConfiguredUniswapPools {\n data: ConfiguredUniswapPool[];\n}\n\nexport interface BlockSummary {\n chainId: number;\n blockNumber: number;\n blockHash: Hex;\n parentHash: Hex;\n timestamp: number;\n gasLimit: number | null;\n gasUsed: number | null;\n baseFeePerGas: string | null;\n blobGasUsed: number | null;\n excessBlobGas: number | null;\n transactionCount: number | null;\n sizeBytes: number | null;\n finality: Finality;\n}\n\nexport interface LatestBlockSummary {\n data: BlockSummary;\n}\n\nexport interface ChangeMetadata {\n apiVersion: \"1\";\n sequence: string;\n cursor: string;\n originKind:\n | \"live\"\n | \"live_recovery\"\n | \"historical_backfill\"\n | \"recompute\";\n originId: string;\n publicationRevision: string;\n chainId: number;\n block: {\n number: number;\n hash: Hex;\n parentHash: Hex;\n timestamp: number;\n } | null;\n finality: Finality;\n kind: string;\n schema: string;\n key: string | null;\n /** Present only on `reset_required` events, as the current coverage hint. */\n coverage?: ProcessorCoverage;\n /** RFC 3339 UTC emission time with millisecond precision. */\n emittedAt: string;\n}\n\n/** Blocks the live lane skipped, as a `system.live_gap.put` change announces them. */\nexport interface LiveGapChangeData {\n fromBlock: number;\n toBlock: number;\n /**\n * Leani did not fill the range: the processor's history is on demand, and a\n * `live_gap_fill` limit, if it has one, did not cover or complete it.\n */\n reason: \"not_filled\";\n}\n\n/** System transitions never pretend to contain a processor entity payload. */\nexport type ChangeEnvelope<T = unknown> = ChangeMetadata & (\n | { operation: \"apply\" | \"undo\"; data: T | null }\n | { operation: \"finalized\"; data: { throughBlock: number } }\n | { operation: \"finalized\"; data: LiveGapChangeData }\n | { operation: \"reset_required\"; data: {\n earliestAvailableSequence: string;\n latestAvailableSequence: string;\n action: \"query_snapshot_then_resume\";\n } }\n);\n\n/**\n * Whether `change` announces blocks the live lane skipped and did not fill,\n * as after a restart at a later finalized anchor. Request them as history,\n * for example with `liveGapBackfill` from `@smart-byte/leani-sdk/backfill`.\n * A processor with `live_gap_fill` can still deliver some of them later as\n * `live_recovery` batches, when it retries a fill after a hold, a crash, or a\n * restart of its live lane, so write them idempotently.\n */\nexport function isLiveGapChange<T>(\n change: ChangeEnvelope<T>,\n): change is Extract<ChangeEnvelope<T>, { data: LiveGapChangeData }> {\n return change.operation === \"finalized\" && change.kind === \"system.live_gap.put\";\n}\n\nexport interface LiveLaneReset {\n processor: string;\n state: \"paused\";\n reason: \"operator_reset_pending_replay\";\n firstUnappliedBlock: number;\n firstUnappliedHash: Hex;\n requiredDeliveryBytes: string;\n}\n\n/**\n * Connection-scoped stream handshake. Sent as the first frame of every\n * stream connection (including reconnects), synthesized at accept time,\n * never stored, and never acknowledged.\n */\nexport interface StreamHello {\n apiVersion: \"1\";\n chainId: number;\n processor: ProcessorSummary;\n coverage: ProcessorCoverage;\n}\n\nexport class ResetRequiredError extends LeaniError {\n readonly change: ChangeEnvelope;\n\n constructor(change: ChangeEnvelope) {\n super(\"the durable stream cursor requires a snapshot reset\", {\n status: 410,\n code: \"cursor_expired\",\n retryable: false,\n details: { cursor: change.cursor },\n });\n this.name = \"ResetRequiredError\";\n this.change = change;\n }\n}\n\nexport interface ListBlocksOptions {\n fromBlock: number;\n toBlock: number;\n limit?: number;\n cursor?: string;\n allowPartial?: boolean;\n signal?: AbortSignal;\n}\n\nexport interface ListTransactionsOptions {\n blockNumber: number;\n limit?: number;\n cursor?: string;\n signal?: AbortSignal;\n}\n\nexport interface ChangesOptions {\n after?: string;\n limit?: number;\n signal?: AbortSignal;\n}\n\nexport interface SubscribeOptions {\n after?: string;\n signal?: AbortSignal;\n /** Receives the connection handshake frame; called once per (re)connect. */\n onHello?: (hello: StreamHello) => void;\n /**\n * Reconnect when the stream sends nothing, not even the node's 15-second\n * keep-alive comments, for this long while the loop waits for a change.\n * Defaults to 60,000 ms.\n */\n idleTimeoutMs?: number;\n}\n\n/** Select a configured instance when more than one processor has this kind. */\nexport interface ProcessorSubscribeOptions extends SubscribeOptions {\n processor?: string;\n}\n\nexport interface LeaniClient {\n readonly baseUrl: URL;\n request<T>(\n path: string,\n params?: Record<string, QueryValue>,\n options?: { signal?: AbortSignal },\n ): Promise<T>;\n health: {\n live(options?: { signal?: AbortSignal }): Promise<Health>;\n ready(options?: { signal?: AbortSignal }): Promise<Health>;\n };\n status(options?: { signal?: AbortSignal }): Promise<NodeStatus>;\n capabilities(options?: { signal?: AbortSignal }): Promise<Capabilities>;\n processors: {\n list(options?: { signal?: AbortSignal }): Promise<ProcessorSummary[]>;\n status(\n id: string,\n options?: { signal?: AbortSignal },\n ): Promise<ProcessorCoverage>;\n changes<T = unknown>(\n id: string,\n options?: ChangesOptions,\n ): Promise<Page<ChangeEnvelope<T>>>;\n changeHead(\n id: string,\n options?: { signal?: AbortSignal },\n ): Promise<ChangeHead>;\n resetLiveLane(\n id: string,\n options?: { signal?: AbortSignal },\n ): Promise<LiveLaneReset>;\n listCollections(\n id: string,\n options?: { signal?: AbortSignal },\n ): Promise<{\n processor: ProcessorSummary;\n outputMode: \"none\" | \"latest\" | \"window\" | \"full\";\n retained: boolean;\n data: string[];\n }>;\n queryEntities<T = unknown>(\n id: string,\n collection: string,\n options?: OutputQueryOptions,\n ): Promise<GenericSnapshotPage<T>>;\n /** First snapshot page plus an atomic stream boundary. Read all nextCursor pages and releaseSnapshot before following. */\n queryAndFollow<T = unknown>(\n id: string,\n collection: string,\n options?: Omit<OutputQueryOptions, \"cursor\">,\n ): Promise<FollowSnapshotPage<T>>;\n getEntity<T = unknown>(\n id: string,\n collection: string,\n key: Hex,\n options?: { signal?: AbortSignal },\n ): Promise<GenericOutputEntity<T>>;\n releaseSnapshot(\n id: string,\n snapshotId: string,\n options?: { signal?: AbortSignal },\n ): Promise<void>;\n consumers: {\n list(\n id: string,\n options?: { signal?: AbortSignal },\n ): Promise<DurableConsumer[]>;\n create(\n id: string,\n options: CreateConsumerOptions,\n ): Promise<DurableConsumer>;\n inspect(\n id: string,\n consumer: string,\n options?: { signal?: AbortSignal },\n ): Promise<DurableConsumer>;\n revoke(\n id: string,\n consumer: string,\n options?: { signal?: AbortSignal },\n ): Promise<DurableConsumer>;\n renew(\n id: string,\n consumer: string,\n credential: string,\n options?: { signal?: AbortSignal },\n ): Promise<DurableConsumer>;\n changes<T = unknown>(\n id: string,\n consumer: string,\n credential: string,\n options?: { limit?: number; signal?: AbortSignal },\n ): Promise<Page<ChangeEnvelope<T>>>;\n acknowledge(\n id: string,\n consumer: string,\n credential: string,\n cursor: string,\n options?: { signal?: AbortSignal },\n ): Promise<DurableConsumer>;\n };\n subscribe<T = unknown>(\n id: string,\n options?: SubscribeOptions,\n ): AsyncGenerator<ChangeEnvelope<T>>;\n };\n blobs: {\n getBlock(\n number: number,\n options?: { signal?: AbortSignal },\n ): Promise<BlobsBlock>;\n listBlocks(options: ListBlocksOptions): Promise<Page<BlobsBlock>>;\n listSnapshot(\n options: ListBlocksOptions,\n ): Promise<Page<BlobsSnapshotEntry>>;\n getTransaction(\n hash: Hex,\n options?: { signal?: AbortSignal },\n ): Promise<BlobTransaction>;\n listTransactions(\n options: ListTransactionsOptions,\n ): Promise<Page<BlobTransaction>>;\n getSchedule(options?: {\n atBlock?: number;\n signal?: AbortSignal;\n }): Promise<BlobSchedule>;\n subscribe(\n options?: ProcessorSubscribeOptions,\n ): AsyncGenerator<ChangeEnvelope<BlobsSnapshotEntry>>;\n };\n erc20: {\n getBalance(\n token: Hex,\n address: Hex,\n options?: { signal?: AbortSignal },\n ): Promise<Erc20Balance>;\n subscribe(\n options?: ProcessorSubscribeOptions,\n ): AsyncGenerator<ChangeEnvelope<Erc20Balance>>;\n };\n uniswap: {\n getPool(\n address: Hex,\n options?: { signal?: AbortSignal },\n ): Promise<UniswapPoolPrice>;\n getLatestObservation(\n address: Hex,\n options?: { processor?: string; signal?: AbortSignal },\n ): Promise<LatestUniswapObservation>;\n listConfiguredPools(options?: {\n processor?: string;\n signal?: AbortSignal;\n }): Promise<ConfiguredUniswapPools>;\n subscribe(\n options?: ProcessorSubscribeOptions,\n ): AsyncGenerator<ChangeEnvelope<UniswapPoolPrice>>;\n };\n blocks: {\n getLatest(options?: {\n processor?: string;\n signal?: AbortSignal;\n }): Promise<LatestBlockSummary>;\n getByNumber(\n number: number,\n options?: { processor?: string; signal?: AbortSignal },\n ): Promise<LatestBlockSummary>;\n subscribe(\n options?: ProcessorSubscribeOptions,\n ): AsyncGenerator<ChangeEnvelope<BlockSummary>>;\n };\n}\n\ninterface ResolvedOptions {\n baseUrl: URL;\n token?: string;\n timeoutMs: number;\n fetch: FetchLike;\n queryBasePaths: {\n blobs: string;\n erc20: string;\n uniswap: string;\n };\n reconnect: {\n initialDelayMs: number;\n maxDelayMs: number;\n jitter: number;\n };\n}\n\n/**\n * Create a Bun/Node/browser client for the native v1 query and durable change\n * API. Ethereum JSON-RPC remains a separate endpoint used directly by viem,\n * ethers, or another Ethereum library.\n */\nexport function createLeaniClient(\n options: LeaniClientOptions,\n): LeaniClient {\n const resolved = resolveOptions(options);\n\n const get = <T>(\n path: string,\n query?: Record<string, QueryValue>,\n signal?: AbortSignal,\n extraHeaders?: Record<string, string>,\n ): Promise<T> =>\n requestJson<T>(\n resolved,\n \"GET\",\n path,\n query,\n undefined,\n signal,\n extraHeaders,\n );\n\n const post = <T>(\n path: string,\n body?: unknown,\n signal?: AbortSignal,\n extraHeaders?: Record<string, string>,\n ): Promise<T> =>\n requestJson<T>(\n resolved,\n \"POST\",\n path,\n undefined,\n body,\n signal,\n extraHeaders,\n );\n\n const remove = (\n path: string,\n signal?: AbortSignal,\n ): Promise<void> => requestVoid(resolved, \"DELETE\", path, signal);\n\n const removeJson = <T>(\n path: string,\n signal?: AbortSignal,\n ): Promise<T> =>\n requestJson<T>(\n resolved,\n \"DELETE\",\n path,\n undefined,\n undefined,\n signal,\n );\n\n const subscribe = <T>(\n processor: string,\n options: SubscribeOptions = {},\n ): AsyncGenerator<ChangeEnvelope<T>> =>\n subscribeProcessor<T>(resolved, processor, options);\n\n const request = <T>(\n path: string,\n params?: Record<string, QueryValue>,\n requestOptions?: { signal?: AbortSignal },\n ): Promise<T> => get<T>(path, params, requestOptions?.signal);\n\n return Object.freeze({\n baseUrl: resolved.baseUrl,\n request,\n health: Object.freeze({\n live: (options?: { signal?: AbortSignal }) =>\n get<Health>(\"health/live\", undefined, options?.signal),\n ready: (options?: { signal?: AbortSignal }) =>\n get<Health>(\"health/ready\", undefined, options?.signal),\n }),\n status: (options?: { signal?: AbortSignal }) =>\n get<NodeStatus>(\"v1/status\", undefined, options?.signal),\n capabilities: (options?: { signal?: AbortSignal }) =>\n request<Capabilities>(\"v1/capabilities\", undefined, options),\n processors: Object.freeze({\n list: async (options?: { signal?: AbortSignal }) => {\n const response = await get<{ data: ProcessorSummary[] }>(\n \"v1/processors\",\n undefined,\n options?.signal,\n );\n return response.data;\n },\n status: (id: string, options?: { signal?: AbortSignal }) =>\n get<ProcessorCoverage>(\n `v1/processors/${encodeURIComponent(id)}/status`,\n undefined,\n options?.signal,\n ),\n changes: <T = unknown>(\n id: string,\n changesOptions: ChangesOptions = {},\n ) =>\n get<Page<ChangeEnvelope<T>>>(\n `v1/processors/${encodeURIComponent(id)}/changes`,\n {\n after: changesOptions.after,\n limit: changesOptions.limit,\n },\n changesOptions.signal,\n ),\n changeHead: (\n id: string,\n options?: { signal?: AbortSignal },\n ) =>\n get<ChangeHead>(\n `v1/processors/${encodeURIComponent(id)}/changes/head`,\n undefined,\n options?.signal,\n ),\n resetLiveLane: (\n id: string,\n options?: { signal?: AbortSignal },\n ) =>\n post<LiveLaneReset>(\n `admin/v1/processors/${encodeURIComponent(id)}/lanes/live/reset`,\n undefined,\n options?.signal,\n ),\n listCollections: (\n id: string,\n options?: { signal?: AbortSignal },\n ) =>\n get<{\n processor: ProcessorSummary;\n outputMode: \"none\" | \"latest\" | \"window\" | \"full\";\n retained: boolean;\n data: string[];\n }>(\n `v1/processors/${encodeURIComponent(id)}/collections`,\n undefined,\n options?.signal,\n ),\n queryEntities: <T = unknown>(\n id: string,\n collection: string,\n queryOptions: OutputQueryOptions = {},\n ) => {\n const path = `v1/processors/${encodeURIComponent(id)}/collections/${encodeURIComponent(collection)}/entities`;\n // Only POST creates a snapshot; its later pages are read by GET.\n return queryOptions.cursor === undefined\n ? post<GenericSnapshotPage<T>>(\n path,\n outputQueryBody(queryOptions),\n queryOptions.signal,\n )\n : get<GenericSnapshotPage<T>>(\n path,\n outputQueryValues(queryOptions),\n queryOptions.signal,\n );\n },\n queryAndFollow: <T = unknown>(\n id: string,\n collection: string,\n queryOptions: Omit<OutputQueryOptions, \"cursor\"> = {},\n ) =>\n post<FollowSnapshotPage<T>>(\n `v1/processors/${encodeURIComponent(id)}/collections/${encodeURIComponent(collection)}/query-and-follow`,\n outputQueryBody(queryOptions),\n queryOptions.signal,\n ),\n getEntity: <T = unknown>(\n id: string,\n collection: string,\n key: Hex,\n options?: { signal?: AbortSignal },\n ) =>\n get<GenericOutputEntity<T>>(\n `v1/processors/${encodeURIComponent(id)}/collections/${encodeURIComponent(collection)}/entities/${encodeURIComponent(assertEntityKey(key))}`,\n undefined,\n options?.signal,\n ),\n releaseSnapshot: (\n id: string,\n snapshotId: string,\n options?: { signal?: AbortSignal },\n ) =>\n remove(\n `v1/processors/${encodeURIComponent(id)}/query-snapshots/${encodeURIComponent(snapshotId)}`,\n options?.signal,\n ),\n consumers: Object.freeze({\n list: async (\n id: string,\n options?: { signal?: AbortSignal },\n ) => {\n const response = await get<{ data: DurableConsumer[] }>(\n `v1/processors/${encodeURIComponent(id)}/consumers`,\n undefined,\n options?.signal,\n );\n return response.data;\n },\n create: (\n id: string,\n consumerOptions: CreateConsumerOptions,\n ) =>\n post<DurableConsumer>(\n `v1/processors/${encodeURIComponent(id)}/consumers`,\n {\n id: consumerOptions.id,\n role: consumerOptions.role,\n start: consumerOptions.start,\n leaseTtlSeconds: assertPositiveSafeInteger(\n consumerOptions.leaseTtlSeconds,\n \"leaseTtlSeconds\",\n ),\n credential: consumerOptions.credential,\n },\n consumerOptions.signal,\n ),\n inspect: (\n id: string,\n consumer: string,\n options?: { signal?: AbortSignal },\n ) =>\n get<DurableConsumer>(\n consumerPath(id, consumer),\n undefined,\n options?.signal,\n ),\n revoke: (\n id: string,\n consumer: string,\n options?: { signal?: AbortSignal },\n ) =>\n removeJson<DurableConsumer>(\n consumerPath(id, consumer),\n options?.signal,\n ),\n renew: (\n id: string,\n consumer: string,\n credential: string,\n options?: { signal?: AbortSignal },\n ) =>\n post<DurableConsumer>(\n `${consumerPath(id, consumer)}/lease`,\n undefined,\n options?.signal,\n consumerCredentialHeader(credential),\n ),\n changes: <T = unknown>(\n id: string,\n consumer: string,\n credential: string,\n options: { limit?: number; signal?: AbortSignal } = {},\n ) =>\n get<Page<ChangeEnvelope<T>>>(\n `${consumerPath(id, consumer)}/changes`,\n { limit: options.limit },\n options.signal,\n consumerCredentialHeader(credential),\n ),\n acknowledge: (\n id: string,\n consumer: string,\n credential: string,\n cursor: string,\n options?: { signal?: AbortSignal },\n ) =>\n post<DurableConsumer>(\n `${consumerPath(id, consumer)}/ack`,\n { cursor },\n options?.signal,\n consumerCredentialHeader(credential),\n ),\n }),\n subscribe,\n }),\n blobs: Object.freeze({\n getBlock: (number: number, options?: { signal?: AbortSignal }) =>\n request<BlobsBlock>(\n `${resolved.queryBasePaths.blobs}/blocks/${assertSafeInteger(number, \"block number\")}`,\n undefined,\n options,\n ),\n listBlocks: (listOptions: ListBlocksOptions) =>\n request<Page<BlobsBlock>>(\n `${resolved.queryBasePaths.blobs}/blocks`,\n {\n fromBlock: assertSafeInteger(\n listOptions.fromBlock,\n \"fromBlock\",\n ),\n toBlock: assertSafeInteger(listOptions.toBlock, \"toBlock\"),\n limit: listOptions.limit,\n cursor: listOptions.cursor,\n allowPartial: listOptions.allowPartial,\n },\n { signal: listOptions.signal },\n ),\n listSnapshot: (listOptions: ListBlocksOptions) =>\n request<Page<BlobsSnapshotEntry>>(\n `${resolved.queryBasePaths.blobs}/snapshot`,\n {\n fromBlock: assertSafeInteger(\n listOptions.fromBlock,\n \"fromBlock\",\n ),\n toBlock: assertSafeInteger(listOptions.toBlock, \"toBlock\"),\n limit: listOptions.limit,\n cursor: listOptions.cursor,\n allowPartial: listOptions.allowPartial,\n },\n { signal: listOptions.signal },\n ),\n getTransaction: (\n hash: Hex,\n options?: { signal?: AbortSignal },\n ) =>\n request<BlobTransaction>(\n `${resolved.queryBasePaths.blobs}/transactions/${encodeURIComponent(assertHash(hash))}`,\n undefined,\n options,\n ),\n listTransactions: (listOptions: ListTransactionsOptions) =>\n request<Page<BlobTransaction>>(\n `${resolved.queryBasePaths.blobs}/transactions`,\n {\n blockNumber: assertSafeInteger(\n listOptions.blockNumber,\n \"blockNumber\",\n ),\n limit: listOptions.limit,\n cursor: listOptions.cursor,\n },\n { signal: listOptions.signal },\n ),\n getSchedule: (\n scheduleOptions: {\n atBlock?: number;\n signal?: AbortSignal;\n } = {},\n ) =>\n request<BlobSchedule>(\n `${resolved.queryBasePaths.blobs}/schedule`,\n {\n atBlock:\n scheduleOptions.atBlock === undefined\n ? undefined\n : assertSafeInteger(scheduleOptions.atBlock, \"atBlock\"),\n },\n { signal: scheduleOptions.signal },\n ),\n subscribe: (subscribeOptions: ProcessorSubscribeOptions = {}) =>\n subscribe<BlobsSnapshotEntry>(\n subscribeOptions.processor ?? \"blobs-money\",\n subscribeOptions,\n ),\n }),\n erc20: Object.freeze({\n getBalance: (\n token: Hex,\n address: Hex,\n options?: { signal?: AbortSignal },\n ) =>\n request<Erc20Balance>(\n `${resolved.queryBasePaths.erc20}/balances/${encodeURIComponent(assertAddress(token))}/${encodeURIComponent(assertAddress(address))}`,\n undefined,\n options,\n ),\n subscribe: (subscribeOptions: ProcessorSubscribeOptions = {}) =>\n subscribe<Erc20Balance>(subscribeOptions.processor ?? \"erc20-balances\", subscribeOptions),\n }),\n uniswap: Object.freeze({\n getPool: (\n address: Hex,\n options?: { signal?: AbortSignal },\n ) =>\n request<UniswapPoolPrice>(\n `${resolved.queryBasePaths.uniswap}/pools/${encodeURIComponent(assertAddress(address))}`,\n undefined,\n options,\n ),\n getLatestObservation: (\n address: Hex,\n options: { processor?: string; signal?: AbortSignal } = {},\n ) =>\n request<LatestUniswapObservation>(\n `v1/processors/${encodeURIComponent(options.processor ?? \"uniswap-observations\")}/query/pools/${encodeURIComponent(assertAddress(address))}/latest`,\n undefined,\n { signal: options.signal },\n ),\n listConfiguredPools: (\n options: { processor?: string; signal?: AbortSignal } = {},\n ) =>\n request<ConfiguredUniswapPools>(\n `v1/processors/${encodeURIComponent(options.processor ?? \"uniswap-observations\")}/query/pools`,\n undefined,\n { signal: options.signal },\n ),\n subscribe: (subscribeOptions: ProcessorSubscribeOptions = {}) =>\n subscribe<UniswapPoolPrice>(subscribeOptions.processor ?? \"uniswap-observations\", subscribeOptions),\n }),\n blocks: Object.freeze({\n getLatest: (\n options: { processor?: string; signal?: AbortSignal } = {},\n ) =>\n request<LatestBlockSummary>(\n `v1/processors/${encodeURIComponent(options.processor ?? \"block-summary\")}/query/latest`,\n undefined,\n { signal: options.signal },\n ),\n getByNumber: (\n number: number,\n options: { processor?: string; signal?: AbortSignal } = {},\n ) =>\n request<LatestBlockSummary>(\n `v1/processors/${encodeURIComponent(options.processor ?? \"block-summary\")}/query/blocks/${assertSafeInteger(number, \"block number\")}`,\n undefined,\n { signal: options.signal },\n ),\n subscribe: (subscribeOptions: ProcessorSubscribeOptions = {}) =>\n subscribe<BlockSummary>(subscribeOptions.processor ?? \"block-summary\", subscribeOptions),\n }),\n });\n}\n\nfunction resolveOptions(options: LeaniClientOptions): ResolvedOptions {\n const baseUrl = new URL(options.baseUrl);\n baseUrl.pathname = `${baseUrl.pathname.replace(/\\/+$/, \"\")}/`;\n const timeoutMs = options.timeoutMs ?? 15_000;\n if (!Number.isSafeInteger(timeoutMs) || timeoutMs <= 0) {\n throw new TypeError(\"timeoutMs must be a positive safe integer\");\n }\n const jitter = options.reconnect?.jitter ?? 0.2;\n if (!Number.isFinite(jitter) || jitter < 0 || jitter > 1) {\n throw new TypeError(\"reconnect.jitter must be in 0..=1\");\n }\n return {\n baseUrl,\n token: options.token,\n timeoutMs,\n fetch: options.fetch ?? globalThis.fetch.bind(globalThis),\n queryBasePaths: {\n blobs: normalizeQueryBasePath(\n options.queryBasePaths?.blobs,\n \"v1/q/blobs\",\n ),\n erc20: normalizeQueryBasePath(\n options.queryBasePaths?.erc20,\n \"v1/q/erc20\",\n ),\n uniswap: normalizeQueryBasePath(\n options.queryBasePaths?.uniswap,\n \"v1/q/uniswap\",\n ),\n },\n reconnect: {\n initialDelayMs: options.reconnect?.initialDelayMs ?? 250,\n maxDelayMs: options.reconnect?.maxDelayMs ?? 10_000,\n jitter,\n },\n };\n}\n\nfunction normalizeQueryBasePath(\n configured: string | undefined,\n fallback: string,\n): string {\n const path = (configured ?? fallback).replace(/\\/+$/g, \"\");\n if (\n path.length === 0 ||\n /^[a-z][a-z0-9+.-]*:/i.test(path) ||\n path.startsWith(\"//\") ||\n path.includes(\"?\") ||\n path.includes(\"#\")\n ) {\n throw new TypeError(\"query base path must be a non-empty same-origin path\");\n }\n return path;\n}\n\nexport type QueryValue = string | number | boolean | undefined;\n\nfunction buildUrl(\n options: ResolvedOptions,\n path: string,\n query?: Record<string, QueryValue>,\n): URL {\n const url = resolveUnder(options.baseUrl, path);\n if (query) {\n for (const [key, value] of Object.entries(query)) {\n if (value !== undefined) {\n url.searchParams.set(key, String(value));\n }\n }\n }\n return url;\n}\n\nasync function requestJson<T>(\n options: ResolvedOptions,\n method: \"GET\" | \"POST\" | \"DELETE\",\n path: string,\n query?: Record<string, QueryValue>,\n body?: unknown,\n signal?: AbortSignal,\n extraHeaders?: Record<string, string>,\n): Promise<T> {\n const response = await send(options.fetch, buildUrl(options, path, query), {\n method,\n headers: headers(\n options,\n \"application/json\",\n body !== undefined\n ? { \"content-type\": \"application/json\", ...extraHeaders }\n : method === \"GET\"\n ? extraHeaders\n : { ...LEANI_REQUEST_HEADER, ...extraHeaders },\n ),\n body: body === undefined ? undefined : JSON.stringify(body),\n signal: withDeadline(signal, options.timeoutMs),\n }, signal);\n if (!response.ok) {\n throw await responseError(response);\n }\n return readJson<T>(response, signal);\n}\n\nasync function requestVoid(\n options: ResolvedOptions,\n method: \"DELETE\",\n path: string,\n signal?: AbortSignal,\n): Promise<void> {\n const response = await send(options.fetch, buildUrl(options, path), {\n method,\n headers: headers(options, \"application/json\", LEANI_REQUEST_HEADER),\n signal: withDeadline(signal, options.timeoutMs),\n }, signal);\n if (!response.ok) {\n throw await responseError(response);\n }\n}\n\n/** The default `idleTimeoutMs`: four of the node's keep-alive intervals. */\nconst DEFAULT_SSE_IDLE_TIMEOUT_MS = 60_000;\n\n/**\n * Retryable `error` events in a row, with no new change between them, after\n * which a subscription throws the last one instead of reconnecting again.\n */\nconst MAX_ERROR_EVENT_RETRIES = 5;\n\nasync function* subscribeProcessor<T>(\n options: ResolvedOptions,\n processor: string,\n subscribeOptions: SubscribeOptions,\n): AsyncGenerator<ChangeEnvelope<T>> {\n const signal = subscribeOptions.signal;\n const idleTimeoutMs =\n subscribeOptions.idleTimeoutMs ?? DEFAULT_SSE_IDLE_TIMEOUT_MS;\n if (!Number.isSafeInteger(idleTimeoutMs) || idleTimeoutMs <= 0) {\n throw new TypeError(\"idleTimeoutMs must be a positive safe integer\");\n }\n let after = subscribeOptions.after;\n let lastSequence: string | undefined;\n let delayMs = options.reconnect.initialDelayMs;\n let errorEventsWithoutProgress = 0;\n while (!signal?.aborted) {\n const connection = new AbortController();\n const connectionSignal = signal\n ? AbortSignal.any([signal, connection.signal])\n : connection.signal;\n const watchdog = idleWatchdog(idleTimeoutMs, () =>\n connection.abort(\n new TransportError(`SSE stream sent nothing for ${idleTimeoutMs} ms`),\n ));\n try {\n watchdog.arm();\n const response = await send(\n options.fetch,\n buildUrl(\n options,\n `v1/processors/${encodeURIComponent(processor)}/stream`,\n { after },\n ),\n {\n headers: headers(options, \"text/event-stream\"),\n signal: connectionSignal,\n },\n signal,\n );\n if (!response.ok) {\n const error = await responseError(response);\n if (!error.retryable) {\n throw error;\n }\n } else if (!response.body) {\n throw new LeaniError(\"stream response has no body\", {\n status: response.status,\n code: \"internal\",\n retryable: true,\n });\n } else {\n // A stream that opens ends the backoff of earlier failures.\n delayMs = options.reconnect.initialDelayMs;\n const messages = sseMessages(\n readChunks(response.body, connectionSignal, watchdog.arm),\n signal,\n );\n for await (const message of messages) {\n if (!message.data) {\n continue;\n }\n if (message.event === \"hello\") {\n subscribeOptions.onHello?.(JSON.parse(message.data) as StreamHello);\n continue;\n }\n if (message.event === \"error\") {\n const error = errorFromBody(200, JSON.parse(message.data));\n errorEventsWithoutProgress += 1;\n if (\n !error.retryable ||\n errorEventsWithoutProgress > MAX_ERROR_EVENT_RETRIES\n ) {\n throw error;\n }\n // The node ends the stream after an error event. Opening the\n // stream reset the backoff, so it grows with these events.\n delayMs = Math.min(\n options.reconnect.initialDelayMs *\n 2 ** (errorEventsWithoutProgress - 1),\n options.reconnect.maxDelayMs,\n );\n break;\n }\n const change = JSON.parse(message.data) as ChangeEnvelope<T>;\n validateChangeEnvelope(change);\n if (change.operation === \"reset_required\") {\n throw new ResetRequiredError(change as ChangeEnvelope);\n }\n\n if (\n lastSequence !== undefined &&\n compareSequences(change.sequence, lastSequence) <= 0\n ) {\n continue;\n }\n lastSequence = change.sequence;\n after = change.cursor;\n errorEventsWithoutProgress = 0;\n // The time the application spends on a change is not silence.\n watchdog.disarm();\n yield change;\n watchdog.arm();\n }\n }\n } catch (error) {\n if (signal?.aborted) return;\n // Resume only transport failures; malformed events, terminal errors,\n // and user callbacks must fail visibly instead of reconnecting forever.\n if (!(error instanceof TransportError)) throw error;\n } finally {\n watchdog.disarm();\n connection.abort();\n }\n if (signal?.aborted) {\n break;\n }\n await abortableDelay(\n jitter(delayMs, options.reconnect.jitter),\n signal,\n );\n delayMs = Math.min(delayMs * 2, options.reconnect.maxDelayMs);\n }\n}\n\ninterface SseMessage {\n id?: string;\n event?: string;\n data?: string;\n}\n\n/** The largest SSE event the client buffers before it fails the stream. */\nconst MAX_SSE_EVENT_BYTES = 8 * 1024 * 1024;\n\nconst LINE_FEED = 0x0a;\nconst CARRIAGE_RETURN = 0x0d;\n\nexport async function* parseSse(\n body: ReadableStream<Uint8Array>,\n signal?: AbortSignal,\n): AsyncGenerator<SseMessage> {\n yield* sseMessages(readChunks(body, signal), signal);\n}\n\n/**\n * Split SSE events at blank lines, scanning each byte once. Line endings are\n * ASCII, so a scan by byte never splits a UTF-8 character.\n */\nasync function* sseMessages(\n chunks: AsyncIterable<Uint8Array>,\n signal: AbortSignal | undefined,\n): AsyncGenerator<SseMessage> {\n const decoder = new TextDecoder();\n // The bytes received so far of the event in progress.\n let pending: Uint8Array[] = [];\n let pendingBytes = 0;\n let lineEmpty = true;\n let afterCarriageReturn = false;\n for await (const chunk of chunks) {\n let eventStart = 0;\n for (let index = 0; index < chunk.length; index += 1) {\n const byte = chunk[index];\n if (byte === LINE_FEED && afterCarriageReturn) {\n // The second half of a CRLF, which chunks may split.\n afterCarriageReturn = false;\n continue;\n }\n afterCarriageReturn = byte === CARRIAGE_RETURN;\n if (byte !== LINE_FEED && byte !== CARRIAGE_RETURN) {\n lineEmpty = false;\n continue;\n }\n if (!lineEmpty) {\n lineEmpty = true;\n continue;\n }\n // A blank line completes the event.\n const tail = chunk.subarray(eventStart, index);\n eventStart = index + 1;\n if (pendingBytes + tail.length > MAX_SSE_EVENT_BYTES) {\n throw sseEventTooLarge();\n }\n const event = concatBytes(pending, pendingBytes, tail);\n pending = [];\n pendingBytes = 0;\n if (signal?.aborted) return;\n const parsed = parseSseFrame(decoder.decode(event));\n if (parsed) {\n yield parsed;\n }\n }\n const rest = chunk.subarray(eventStart);\n if (rest.length > 0) {\n pendingBytes += rest.length;\n if (pendingBytes > MAX_SSE_EVENT_BYTES) {\n throw sseEventTooLarge();\n }\n pending.push(rest);\n }\n }\n // Only a blank line completes an SSE event. A partial final event is\n // discarded, so a reconnect resumes from the last complete one.\n}\n\nfunction sseEventTooLarge(): LeaniError {\n return new LeaniError(`SSE event exceeds ${MAX_SSE_EVENT_BYTES} bytes`, {\n status: 200,\n code: \"invalid_response\",\n retryable: false,\n });\n}\n\nfunction parseSseFrame(frame: string): SseMessage | undefined {\n const message: SseMessage = {};\n const data: string[] = [];\n for (const line of frame.split(/\\r\\n|\\r|\\n/)) {\n if (line.length === 0 || line.startsWith(\":\")) {\n continue;\n }\n const separator = line.indexOf(\":\");\n const field = separator < 0 ? line : line.slice(0, separator);\n let value = separator < 0 ? \"\" : line.slice(separator + 1);\n if (value.startsWith(\" \")) {\n value = value.slice(1);\n }\n if (field === \"id\") {\n message.id = value;\n } else if (field === \"event\") {\n message.event = value;\n } else if (field === \"data\") {\n data.push(value);\n }\n }\n if (data.length > 0) {\n message.data = data.join(\"\\n\");\n }\n return Object.keys(message).length > 0 ? message : undefined;\n}\n\nfunction headers(\n options: ResolvedOptions,\n accept: string,\n extra?: Record<string, string>,\n): Record<string, string> {\n const result: Record<string, string> = { Accept: accept, ...extra };\n if (options.token) {\n result.Authorization = `Bearer ${options.token}`;\n }\n return result;\n}\n\nfunction validateChangeEnvelope(value: ChangeEnvelope): void {\n if (\n !value ||\n value.apiVersion !== \"1\" ||\n !/^\\d+$/.test(value.sequence) ||\n typeof value.cursor !== \"string\" ||\n value.cursor.length === 0 ||\n ![\"apply\", \"undo\", \"finalized\", \"reset_required\"].includes(value.operation) ||\n typeof value.schema !== \"string\" ||\n value.schema.length === 0\n ) {\n throw new LeaniError(\"invalid change envelope\", {\n status: 200,\n code: \"invalid_response\",\n retryable: false,\n });\n }\n}\n\nexport function compareSequences(left: string, right: string): -1 | 0 | 1 {\n if (!/^\\d+$/.test(left) || !/^\\d+$/.test(right)) {\n throw new TypeError(\"sequences must be unsigned decimal strings\");\n }\n const comparison = BigInt(left) - BigInt(right);\n return comparison < 0n ? -1 : comparison > 0n ? 1 : 0;\n}\n\nexport function isResetRequired(\n change: ChangeEnvelope,\n): change is ChangeEnvelope & { operation: \"reset_required\" } {\n return change.operation === \"reset_required\";\n}\n\nexport interface EntityChangeTarget<T> {\n put(key: string, value: T): void | Promise<void>;\n delete(key: string): void | Promise<void>;\n}\n\nexport async function applyEntityChange<T>(\n target: EntityChangeTarget<T>,\n change: ChangeEnvelope<T>,\n): Promise<void> {\n if ((change.operation !== \"apply\" && change.operation !== \"undo\") || !change.key) {\n return;\n }\n if (change.data === null || change.kind.endsWith(\".delete\")) {\n await target.delete(change.key);\n } else {\n await target.put(change.key, change.data);\n }\n}\n\n/**\n * Commit destination state before constructing the acknowledgement request.\n * If the destination commit rejects, `acknowledge` is never invoked and the\n * durable consumer safely receives the same changes again.\n */\nexport async function commitThenAcknowledge<T>(\n destinationCommit: () => Promise<T>,\n acknowledge: (committed: T) => Promise<unknown>,\n): Promise<T> {\n const committed = await destinationCommit();\n await acknowledge(committed);\n return committed;\n}\n\nexport interface CursorStore {\n get(): string | undefined;\n set(cursor: string): void;\n clear(): void;\n}\n\nexport function createInMemoryCursorStore(initial?: string): CursorStore {\n let cursor = initial;\n return {\n get: () => cursor,\n set: (value: string) => {\n cursor = value;\n },\n clear: () => {\n cursor = undefined;\n },\n };\n}\n\nfunction assertSafeInteger(value: number, field: string): number {\n if (!Number.isSafeInteger(value) || value < 0) {\n throw new TypeError(`${field} must be a non-negative safe integer`);\n }\n return value;\n}\n\nfunction assertPositiveSafeInteger(value: number, field: string): number {\n const result = assertSafeInteger(value, field);\n if (result === 0) {\n throw new TypeError(`${field} must be positive`);\n }\n return result;\n}\n\nfunction optionalSafeInteger(\n value: number | undefined,\n field: string,\n): number | undefined {\n return value === undefined ? undefined : assertSafeInteger(value, field);\n}\n\nfunction outputQueryBody(\n options: Omit<OutputQueryOptions, \"cursor\">,\n): Record<string, number | undefined> {\n return {\n fromBlock: optionalSafeInteger(options.fromBlock, \"fromBlock\"),\n toBlock: optionalSafeInteger(options.toBlock, \"toBlock\"),\n fromTimestamp: optionalSafeInteger(\n options.fromTimestamp,\n \"fromTimestamp\",\n ),\n toTimestamp: optionalSafeInteger(options.toTimestamp, \"toTimestamp\"),\n limit:\n options.limit === undefined\n ? undefined\n : assertPositiveSafeInteger(options.limit, \"limit\"),\n };\n}\n\nfunction outputQueryValues(\n options: OutputQueryOptions,\n): Record<string, QueryValue> {\n return {\n ...outputQueryBody(options),\n cursor: options.cursor,\n };\n}\n\nfunction consumerPath(processor: string, consumer: string): string {\n return `v1/processors/${encodeURIComponent(processor)}/consumers/${encodeURIComponent(consumer)}`;\n}\n\nfunction consumerCredentialHeader(\n credential: string,\n): Record<string, string> {\n if (credential.length === 0) {\n throw new TypeError(\"consumer credential must not be empty\");\n }\n return { \"x-leani-consumer-credential\": credential };\n}\n\nfunction assertEntityKey(value: string): Hex {\n if (!/^0x(?:[0-9a-fA-F]{2})*$/.test(value)) {\n throw new TypeError(\"entity key must contain complete hexadecimal bytes\");\n }\n return value as Hex;\n}\n\nfunction assertHash(value: string): Hex {\n if (!/^0x[0-9a-fA-F]{64}$/.test(value)) {\n throw new TypeError(\"transaction hash must contain exactly 32 bytes\");\n }\n return value as Hex;\n}\n\nfunction assertAddress(value: string): Hex {\n if (!/^0x[0-9a-fA-F]{40}$/.test(value)) {\n throw new TypeError(\"address must contain exactly 20 bytes\");\n }\n return value as Hex;\n}\n\nfunction jitter(delayMs: number, amount: number): number {\n const factor = 1 - amount + Math.random() * amount * 2;\n return Math.max(0, Math.round(delayMs * factor));\n}\n\nasync function abortableDelay(\n milliseconds: number,\n signal?: AbortSignal,\n): Promise<void> {\n if (signal?.aborted) {\n return;\n }\n await new Promise<void>((resolve) => {\n const finish = () => {\n clearTimeout(timeout);\n signal?.removeEventListener(\"abort\", finish);\n resolve();\n };\n const timeout = setTimeout(finish, milliseconds);\n signal?.addEventListener(\"abort\", finish, { once: true });\n });\n}\n"]}
@@ -995,7 +995,9 @@ export interface paths {
995
995
  * progress with the same history stream, consumer, and acknowledgement,
996
996
  * and its error is cleared. A subscription that is still active returns
997
997
  * its status unchanged; a completed or cancelled one gets 409
998
- * `backfill_conflict`.
998
+ * `backfill_conflict`. A failed subscription whose processor instance is
999
+ * not configured (see `processorConfigured`) gets 400 `invalid_request`
1000
+ * and stays failed.
999
1001
  */
1000
1002
  post: operations["retryBackfillSubscription"];
1001
1003
  delete?: never;
@@ -1015,7 +1017,12 @@ export interface paths {
1015
1017
  };
1016
1018
  get?: never;
1017
1019
  put?: never;
1018
- /** Cancel a backfill subscription */
1020
+ /**
1021
+ * Cancel a backfill subscription
1022
+ * @description A draining subscription, whose job finished but whose required
1023
+ * consumer has not acknowledged the completion, becomes `cancelled`,
1024
+ * even when its processor instance is not configured.
1025
+ */
1019
1026
  post: operations["cancelBackfillSubscription"];
1020
1027
  delete?: never;
1021
1028
  options?: never;
@@ -1654,6 +1661,67 @@ export interface components {
1654
1661
  createdAtUnixMs: components["schemas"]["DecimalQuantity"];
1655
1662
  updatedAtUnixMs: components["schemas"]["DecimalQuantity"];
1656
1663
  };
1664
+ /** @description A backfill subscription or materialization job. */
1665
+ BackfillStatus: {
1666
+ /**
1667
+ * @description Opaque; do not parse it. An application finds its own
1668
+ * subscriptions by `consumer`.
1669
+ */
1670
+ id: string;
1671
+ /** @enum {string} */
1672
+ owner: "subscription" | "materialization";
1673
+ /** @description The processor instance that runs the job. */
1674
+ processor: string;
1675
+ /**
1676
+ * @description Whether the node configures the processor instance `processor`
1677
+ * now: exactly that instance, not another instance of its kind.
1678
+ * Without it, the subscription's stream and acknowledgement routes
1679
+ * refuse the subscription. That can be temporary, as when a
1680
+ * restart's configuration leaves the instance out by mistake. If
1681
+ * the instance will not return, cancel the subscription and delete
1682
+ * it with `discardUnacknowledged=true`, which discards its
1683
+ * unacknowledged records.
1684
+ */
1685
+ processorConfigured: boolean;
1686
+ /**
1687
+ * @description The subscription's required consumer, which reads and
1688
+ * acknowledges its history stream; null for a materialization job.
1689
+ */
1690
+ consumer: string | null;
1691
+ /** @description The subscription's history stream. */
1692
+ deliveryStreamId?: string;
1693
+ publicationRevision?: components["schemas"]["DecimalQuantity"];
1694
+ fromBlock: components["schemas"]["SafeInteger"];
1695
+ toBlock: components["schemas"]["SafeInteger"];
1696
+ ranges: components["schemas"]["RequestedRange"][];
1697
+ requestedBlocks: components["schemas"]["SafeInteger"];
1698
+ processedBlocks: components["schemas"]["SafeInteger"];
1699
+ remainingBlocks: components["schemas"]["SafeInteger"];
1700
+ capturedFinalizedTarget?: components["schemas"]["SafeInteger"];
1701
+ /** @enum {string} */
1702
+ mode: "fill_missing" | "recompute";
1703
+ /** @description The subscription's effective history batch limits. */
1704
+ batching?: {
1705
+ targetEncodedBytes: components["schemas"]["SafeInteger"];
1706
+ maximumEncodedBytes: components["schemas"]["SafeInteger"];
1707
+ maximumEvents: components["schemas"]["SafeInteger"];
1708
+ maximumProcessedBlocks: components["schemas"]["SafeInteger"];
1709
+ maximumDelayMs: components["schemas"]["SafeInteger"];
1710
+ maximumBufferedBatches: components["schemas"]["SafeInteger"];
1711
+ maximumBufferedBytes: components["schemas"]["SafeInteger"];
1712
+ /** @enum {string} */
1713
+ compression: "none" | "gzip";
1714
+ };
1715
+ /** @enum {string} */
1716
+ state: "waiting_for_consumer" | "queued" | "running" | "backpressured" | "storage_backpressured" | "draining" | "complete_reclaimable" | "completed" | "failed" | "cancelled";
1717
+ attempts: components["schemas"]["SafeInteger"];
1718
+ updatedAtUnixMs: components["schemas"]["SafeInteger"];
1719
+ /** @description The completed job's source report; null until it completes. */
1720
+ report: {
1721
+ [key: string]: unknown;
1722
+ } | null;
1723
+ lastError: string | null;
1724
+ };
1657
1725
  RecoveryCheckpoint: {
1658
1726
  checkpointId: components["schemas"]["SafeInteger"];
1659
1727
  processorInstance: string;
@@ -1825,8 +1893,10 @@ export interface components {
1825
1893
  * the `system.finality.put` kind carries `{ throughBlock }`, and the
1826
1894
  * `system.live_gap.put` kind carries
1827
1895
  * `{ fromBlock, toBlock, reason: "not_filled" }`: blocks the live
1828
- * lane skipped, such as after a restart at a later finalized anchor.
1829
- * Leani does not fill them; request them as history.
1896
+ * lane skipped and did not fill, such as after a restart at a later
1897
+ * finalized anchor. A processor with `live_gap_fill` delivers a
1898
+ * short range itself as `live_recovery` batches; request what is
1899
+ * announced as history.
1830
1900
  */
1831
1901
  data: unknown;
1832
1902
  /** @description Present only on reset_required events. */
@@ -2971,7 +3041,7 @@ export interface operations {
2971
3041
  * `batch` records and, while idle, `heartbeat` records. An `error`
2972
3042
  * or `reset_required` record ends the stream. A batch of a
2973
3043
  * `system.live_gap.put` change announces blocks the live lane
2974
- * skipped, which no batch delivers.
3044
+ * skipped and did not fill.
2975
3045
  */
2976
3046
  200: {
2977
3047
  headers: {
@@ -3378,7 +3448,11 @@ export interface operations {
3378
3448
  headers: {
3379
3449
  [name: string]: unknown;
3380
3450
  };
3381
- content?: never;
3451
+ content: {
3452
+ "application/json": {
3453
+ data: components["schemas"]["BackfillStatus"][];
3454
+ };
3455
+ };
3382
3456
  };
3383
3457
  default: components["responses"]["Error"];
3384
3458
  };
@@ -3397,7 +3471,9 @@ export interface operations {
3397
3471
  headers: {
3398
3472
  [name: string]: unknown;
3399
3473
  };
3400
- content?: never;
3474
+ content: {
3475
+ "application/json": components["schemas"]["BackfillStatus"];
3476
+ };
3401
3477
  };
3402
3478
  default: components["responses"]["Error"];
3403
3479
  };
@@ -3418,7 +3494,9 @@ export interface operations {
3418
3494
  headers: {
3419
3495
  [name: string]: unknown;
3420
3496
  };
3421
- content?: never;
3497
+ content: {
3498
+ "application/json": components["schemas"]["BackfillStatus"];
3499
+ };
3422
3500
  };
3423
3501
  default: components["responses"]["Error"];
3424
3502
  };
@@ -3481,7 +3559,9 @@ export interface operations {
3481
3559
  headers: {
3482
3560
  [name: string]: unknown;
3483
3561
  };
3484
- content?: never;
3562
+ content: {
3563
+ "application/json": components["schemas"]["BackfillStatus"];
3564
+ };
3485
3565
  };
3486
3566
  default: components["responses"]["Error"];
3487
3567
  };
@@ -3509,7 +3589,9 @@ export interface operations {
3509
3589
  headers: {
3510
3590
  [name: string]: unknown;
3511
3591
  };
3512
- content?: never;
3592
+ content: {
3593
+ "application/json": components["schemas"]["BackfillStatus"];
3594
+ };
3513
3595
  };
3514
3596
  default: components["responses"]["Error"];
3515
3597
  };
@@ -3528,7 +3610,11 @@ export interface operations {
3528
3610
  headers: {
3529
3611
  [name: string]: unknown;
3530
3612
  };
3531
- content?: never;
3613
+ content: {
3614
+ "application/json": {
3615
+ data: components["schemas"]["BackfillStatus"][];
3616
+ };
3617
+ };
3532
3618
  };
3533
3619
  default: components["responses"]["Error"];
3534
3620
  };
@@ -3547,7 +3633,9 @@ export interface operations {
3547
3633
  headers: {
3548
3634
  [name: string]: unknown;
3549
3635
  };
3550
- content?: never;
3636
+ content: {
3637
+ "application/json": components["schemas"]["BackfillStatus"];
3638
+ };
3551
3639
  };
3552
3640
  default: components["responses"]["Error"];
3553
3641
  };
@@ -3568,7 +3656,9 @@ export interface operations {
3568
3656
  headers: {
3569
3657
  [name: string]: unknown;
3570
3658
  };
3571
- content?: never;
3659
+ content: {
3660
+ "application/json": components["schemas"]["BackfillStatus"];
3661
+ };
3572
3662
  };
3573
3663
  default: components["responses"]["Error"];
3574
3664
  };
@@ -3624,7 +3714,9 @@ export interface operations {
3624
3714
  headers: {
3625
3715
  [name: string]: unknown;
3626
3716
  };
3627
- content?: never;
3717
+ content: {
3718
+ "application/json": components["schemas"]["BackfillStatus"];
3719
+ };
3628
3720
  };
3629
3721
  default: components["responses"]["Error"];
3630
3722
  };