/** * SDNClient — unified client for Space Data Network nodes. * * Resolves nodes by various identifiers (PeerID, .onion, CID, IPNS, ENS, HTTP URL), * queries their data catalog, fetches/publishes SDS records, and manages channel subscriptions. */ import type { ResolvedNode, ResolveOptions, IdentifierType } from './resolver'; import { SDNTransportError } from './transport/http'; import type { NodeCatalog, SchemaCatalogEntry, DataQueryOptions, DataQueryStreamResult, DataQueryJsonResult, PublishResult, BatchPublishResult, LogHeadResponse, LogHeadsResponse, ChannelAccessOptions, ChannelActionResponse, ChannelGrantRequest, ChannelKeyEnvelopeRequest, ChannelKeyEnvelopeResponse, ChannelListOptions, ChannelMonitor, ChannelSummary } from './transport/http'; import type { AuthProvider } from './transport/auth'; import type { DerivedIdentity } from './crypto/types'; import type { ParsedEPM } from './epm-resolver'; /** Options for creating an SDNClient. */ export interface SDNClientOptions extends ResolveOptions { /** Pre-resolved HTTP base URL (skip resolution). */ baseUrl?: string; /** Auth provider for authenticated requests. */ authProvider?: AuthProvider; } export interface SDNClientChannels { list(options?: ChannelListOptions): Promise; get(channelId: string, options?: ChannelAccessOptions): Promise; subscribe(channelId: string, options?: ChannelAccessOptions): Promise; unsubscribe(channelId: string, options?: ChannelAccessOptions): Promise; publish(channelId: string, stream: Uint8Array, options?: ChannelAccessOptions): Promise; grant(channelId: string, grant: ChannelGrantRequest, options?: ChannelAccessOptions): Promise; issueGrant(channelId: string, grant: ChannelGrantRequest, options?: ChannelAccessOptions): Promise; keyUnwrap(channelId: string, request: ChannelKeyEnvelopeRequest, options?: ChannelAccessOptions): Promise; openStream(channelId: string, options?: ChannelAccessOptions): Promise; moduleFeed(channelId: string, options?: ChannelAccessOptions): Promise; monitor(channelId: string, options?: ChannelAccessOptions): Promise; } /** * SDNClient provides a unified interface to interact with an SDN node: * - Discover the node via various identifier types * - Query its data catalog (what record types it publishes) * - Fetch data by schema, day, NORAD ID, entity ID * - Publish data (with authentication) * * @example * ```ts * // Resolve by domain * const client = await SDNClient.resolve('spaceaware.io'); * const catalog = await client.catalog(); * console.log(catalog.schemas); * * // Discover and monitor OMM channel data * const channels = await client.channels.list({ standardCode: 'OMM' }); * const monitor = await client.channels.monitor(channels[0].channelId); * * // Authenticate and publish * await client.authenticate(identity); * await client.channels.publish('spaceaware-OMM', flatbufferStreamBytes); * ``` */ export declare class SDNClient { /** The resolved node info. */ readonly resolved: ResolvedNode; readonly channels: SDNClientChannels; private transport; private _catalog?; private constructor(); /** * Resolve a node by any supported identifier and return a client. * * Supported identifiers: * - PeerID: `12D3KooW...` * - .onion: `abc...xyz.onion` * - HTTP: `https://spaceaware.io` or `spaceaware.io` * - Multiaddr: `/dns4/spaceaware.io/tcp/443` * - IPFS CID: `bafy...` * - IPNS: `k51...` * - ENS: `mynode.eth` */ static resolve(identifier: string, opts?: SDNClientOptions): Promise; /** Create a client from an explicit HTTP URL. */ static fromUrl(url: string, opts?: SDNClientOptions): SDNClient; /** Create a client from a parsed EPM. */ static fromEPM(epm: ParsedEPM): SDNClient | null; /** The node's HTTP base URL. */ get baseUrl(): string; /** The node's PeerID, if known. */ get peerId(): string | undefined; /** Fetch the node's schema catalog. */ catalog(): Promise; /** Get cached catalog (call catalog() first to populate). */ get cachedCatalog(): NodeCatalog | undefined; /** List schema names this node publishes. Fetches catalog if not cached. */ listSchemas(): Promise; /** * Query data records (flatbuffers-first, loop D.3): ONE request to the * flow-served bulk endpoint; the DEFAULT result carries the aligned * size-prefixed FlatBuffer record stream verbatim (zero-copy `frames()` * iterator). Pass `format: 'json'` for the opt-in JSON edge adapter. */ query(opts: DataQueryOptions & { format: 'json'; }): Promise; query(opts: DataQueryOptions & { format?: 'flatbuffers'; }): Promise; query(opts: DataQueryOptions): Promise; /** Get a single record's raw FlatBuffer bytes by schema and CID. */ get(schema: string, cid: string): Promise; /** Get node info (EPM + runtime metadata). */ nodeInfo(): Promise>; /** * Authenticate with the node using an HD wallet identity. * Required before publishing data. */ authenticate(identity: DerivedIdentity): Promise; /** Publish a FlatBuffer record. Requires prior authenticate() call. */ publish(schema: string, data: Uint8Array): Promise; /** Publish multiple records in a batch. Requires prior authenticate() call. */ publishBatch(schema: string, records: Uint8Array[]): Promise; /** Get the log head for a publisher+schema. */ logHead(schema: string, publisherPeerID: string): Promise; /** Get all publishers' log heads for a schema. */ logHeads(schema: string): Promise; } export type { NodeCatalog, SchemaCatalogEntry, DataQueryOptions, DataQueryStreamResult, DataQueryJsonResult, PublishResult, BatchPublishResult, LogHeadResponse, LogHeadsResponse, ChannelAccessOptions, ChannelActionResponse, ChannelGrantRequest, ChannelKeyEnvelopeRequest, ChannelKeyEnvelopeResponse, ChannelListOptions, ChannelMonitor, ChannelSummary, ResolvedNode, ResolveOptions, IdentifierType, AuthProvider, }; export { SDNTransportError }; //# sourceMappingURL=client.d.ts.map