- Add combined MIT + Apache-2.0 LICENSE file (Copyright 2026 alk.dev) - Add README.md with quick start for each adapter, lifecycle/close docs, operators, EventEnvelope, TypeScript, exports table, upstream attribution - Add CHANGELOG.md with 0.1.0 entry - Add SPDX license headers to original source files (WS client, WS server, Worker, index barrel) - Update package.json: add author, repository, homepage, bugs; include CHANGELOG.md in files; update description
1.8 KiB
1.8 KiB
Changelog
0.1.0
Initial release.
Core
createPubSubfactory with type-safepublish/subscribeAPI (adapted from graphql-yoga, MIT)TypedEventTarget,TypedEvent,EventEnvelopetypesRepeaterclass for backpressure-aware async iteration (inlined from @repeaterjs/repeater, MIT)- Operators:
filter,map,pipe,take,reduce,toArray,batch,dedupe,window,flat,groupBy,chain,join
Adapters
- Redis —
createRedisEventTarget(peer dep:ioredis). Pub/sub with optional prefix and custom serializer. - WebSocket Client —
createWebSocketClientEventTarget. Subscribe/publish over a WebSocket connection. - WebSocket Server —
createWebSocketServerEventTarget. Fan-out hub for WebSocket spokes with topic-based routing, backpressure handling, and subscription control protocol (__subscribe/__unsubscribe). - Worker Host —
createWorkerHostEventTarget. Communicate with a Worker thread from the main thread. - Worker Thread —
createWorkerThreadEventTarget. Communicate with the main thread from inside a Worker.
Lifecycle
All transport adapters provide a close() method for graceful teardown:
- Unsubscribes from all channels/topics
- Restores any intercepted
onmessage/onclosehandlers - Removes message listeners
- Clears internal state maps
- Does not destroy the underlying transport (caller-owned)
- Idempotent — safe to call multiple times
Build
- Dual ESM + CJS output via tsup
- Sub-path exports for each adapter (
@alkdev/pubsub/event-target-redis, etc.) - Zero runtime dependencies (Repeater is inlined)
sideEffects: false- TypeScript declarations (
.d.ts+.d.cts)
License
Dual-licensed MIT OR Apache-2.0. Portions adapted from graphql-yoga (MIT) and @repeaterjs/repeater (MIT) retain their upstream attribution.