Files
pubsub/CHANGELOG.md
glm-5.1 b3f598dffd docs: add LICENSE, README, CHANGELOG, and license headers for npm publish
- 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
2026-05-08 16:48:33 +00:00

1.8 KiB

Changelog

0.1.0

Initial release.

Core

  • createPubSub factory with type-safe publish/subscribe API (adapted from graphql-yoga, MIT)
  • TypedEventTarget, TypedEvent, EventEnvelope types
  • Repeater class 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

  • RediscreateRedisEventTarget (peer dep: ioredis). Pub/sub with optional prefix and custom serializer.
  • WebSocket ClientcreateWebSocketClientEventTarget. Subscribe/publish over a WebSocket connection.
  • WebSocket ServercreateWebSocketServerEventTarget. Fan-out hub for WebSocket spokes with topic-based routing, backpressure handling, and subscription control protocol (__subscribe/__unsubscribe).
  • Worker HostcreateWorkerHostEventTarget. Communicate with a Worker thread from the main thread.
  • Worker ThreadcreateWorkerThreadEventTarget. 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/onclose handlers
  • 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.