waymaker-client/ts/src/index.ts

84 lines
2.3 KiB
TypeScript

/**
* @waymaker/client — Official TypeScript client for waymaker.
*
* Import the client and subsystem modules you need:
*
* ```ts
* import { WaymakerClient, Scope } from "@waymaker/client";
*
* const client = WaymakerClient.connect("localhost:8818");
* const lock = await client.acquireLock("leader:myjob", {
* maxWaitMs: 0,
* leaseTtlMs: 60_000,
* scope: Scope.Local,
* });
* const renewal = lock.spawnRenewal(30_000);
* // ... do work
* await renewal.stop();
* await lock.unlock();
* ```
*/
// Core
export { WaymakerClient } from "./client";
export type { ConnectOptions, WaymakerError } from "./client";
export { isServerError, isWaymakerError, serverError, rpcError, invalidError } from "./client";
// Locks — import the module to register the extension methods
import "./lock";
export { Lock, RenewalHandle, Scope } from "./lock";
export type { LockConfig, Lease, LockState, AcquiredLock } from "./lock";
// Streams — import the module to register the extension methods
import "./stream";
export { Stream, Consumer, Message } from "./stream";
export type {
StreamConfig,
StreamUpdate,
ConsumerConfig,
PublishAck,
SourceStatus,
StreamSource,
SubjectTransform,
RetentionPolicy,
DeliverPolicy,
OnDropPolicy,
} from "./stream";
// KV — import the module to register the extension methods
import "./kv";
export { KvBucket } from "./kv";
export type { KvConfig, HistoryEntry, KvEvent } from "./kv";
// Collections — import the module to register the extension methods
import "./collections";
export { HashStore, Hash, SetStore, SetHandle, Queue } from "./collections";
export type { HashStoreConfig, SetStoreConfig, QueueConfig } from "./collections";
// Sketches — import the module to register the extension methods
import "./sketches";
export { Bloom, Hll, Cms, TopK, TDigest } from "./sketches";
export type {
BloomConfig,
BloomInfo,
HllConfig,
CmsConfig,
TopKConfig,
TopKListEntry,
TDigestConfig,
} from "./sketches";
// Object store — import the module to register the extension methods
import "./object";
export { ObjectStore } from "./object";
export type {
ObjectStoreConfig,
ObjectInfo,
ObjectEntry,
ObjectRevision,
PutOptions,
} from "./object";
// Cache — import the module to register the extension methods
import "./cache";