@alien-rpc/client
v0.4.1
Published
Client library for alien-rpc
Readme
@alien-rpc/client
Client runtime for generated alien-rpc route manifests.
Installation
npm install @alien-rpc/clientMinimal Use
import { defineClient } from '@alien-rpc/client'
import routes from './client/generated/api.js'
const api = defineClient(routes, {
prefixUrl: '/api/',
})
const result = await api.hello('Ada')The routes object is generated by @alien-rpc/generator or the
alien-rpc CLI. The returned client mirrors that route object and turns each
route entry into a typed call function.
Documentation
- Concepts and selection guidance: docs/context.md
- Runnable example: examples/generated-client.ts
- Exact public signatures: generated
dist/index.d.ts - Source-owned API behavior:
src/client.ts,src/types.ts,src/factory.ts, andsrc/error.ts - Optional response/protocol entrypoints:
@alien-rpc/client/formats/json,@alien-rpc/client/formats/json-seq,@alien-rpc/client/protocols/http, and@alien-rpc/client/protocols/websocket
Public Entry Points
import { defineClient, defineClientFactory } from '@alien-rpc/client'
import type {
Client,
ClientOptions,
Route,
ResponseStream,
} from '@alien-rpc/client'The package also exports error classes, request hook types, route metadata helpers, retry options, and generated-route utility types from its main entry.
