From 6d6c8445b36950780067b0697711174a2b9d1ffb Mon Sep 17 00:00:00 2001 From: Zuri Klaschka Date: Fri, 12 Jan 2024 17:16:47 +0100 Subject: [PATCH] TELESTION-450: Re-export NATS for convenience Exposes various NATS types directly from the `@wuespace/telestion` package itself for convenience. Most things are exported under the `nats` namespace, while selected variables and/or types are even exposed in the global package's scope. --- frontend-react/src/lib/index.ts | 4 ++++ frontend-react/src/lib/nats/index.ts | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 frontend-react/src/lib/nats/index.ts diff --git a/frontend-react/src/lib/index.ts b/frontend-react/src/lib/index.ts index 50ad70b4..6c0792b8 100644 --- a/frontend-react/src/lib/index.ts +++ b/frontend-react/src/lib/index.ts @@ -27,6 +27,7 @@ export * as auth from './auth'; export * as userData from './user-data'; export * as widget from './widget'; export * as utils from './utils.ts'; +export * as nats from './nats'; // application export { initTelestion, useWidgetConfig } from './application'; @@ -41,3 +42,6 @@ export type { UserData } from './user-data'; // auth export { useNats } from './auth'; + +// nats +export { JSONCodec } from './nats'; diff --git a/frontend-react/src/lib/nats/index.ts b/frontend-react/src/lib/nats/index.ts new file mode 100644 index 00000000..eaa20439 --- /dev/null +++ b/frontend-react/src/lib/nats/index.ts @@ -0,0 +1,16 @@ +// re-export NATS utils (for convenience) +export { JSONCodec, StringCodec, headers } from 'nats.ws'; +export type { + NatsError, + NatsConnection, + Codec, + Msg, + MsgHdrs, + Sub, + SubOpts, + Subscription, + SubscriptionOptions, + MsgRequest, + RequestOptions, + PublishOptions +} from 'nats.ws';