@acyclic-labs/stream
v0.1.5
Published
Hierarchical append-only streams with typed clients and provider adapters
Downloads
426
Readme
@acyclic-labs/stream
Typed, hierarchical append-only streams with explicit cursors, conditional appends, forks, and coordinated commits.
npm install @acyclic-labs/streamimport { MemoryStreamProvider, StreamClient } from "@acyclic-labs/stream";
const client = new StreamClient(new MemoryStreamProvider());
const events = client.json<{ type: string }>("runs/example");
await events.append({ type: "started" });
for await (const record of events.read({ from: 0n, limit: 100 })) {
console.log(record.sequence, record.value.type);
}For a service, use new StreamClient(new HttpStreamProvider({ endpoint, token })) or Stream.fromEnv() with ACYCLIC_STREAM_ENDPOINT and ACYCLIC_API_KEY. Service endpoints must be HTTPS. Sequence numbers are bigint; persist the last consumed cursor and resume reads or follow from the appropriate position. Use ifTail for optimistic append concurrency and an idempotency key when retrying mutations.
MemoryStreamProvider is deterministic and process-local, not a durable service. See the full quickstart, API source, and protocol.
