@zerotal/broadcasting 1.9.0 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/api-surface.md CHANGED
@@ -198,11 +198,11 @@ function presenceChannel = (name: string) => string
198
198
  function privateChannel = (name: string) => string
199
199
 
200
200
  interface BroadcastConfigShape = {
201
- channels?: string
201
+ channels?: string | undefined
202
202
  driver: 'null' | 'ws' | 'redis' | 'pusher'
203
203
  path: string
204
- pusher?: { appKey: string; appSecret: string;}
205
- redis?: { url: string;}
204
+ pusher?: { appKey: string; appSecret: string;} | undefined
205
+ redis?: { url: string;} | undefined
206
206
  }
207
207
 
208
208
  interface BroadcastEvent = {
@@ -218,10 +218,10 @@ interface BroadcastRecord = {
218
218
  }
219
219
 
220
220
  interface BroadcastsModelEventsOptions = {
221
- as?: (modelName: string, event: ModelBroadcastEventName) => string
221
+ as?: ((modelName: string, event: ModelBroadcastEventName) => string) | undefined
222
222
  channels: (model: M, event: ModelBroadcastEventName) => string | string[]
223
- events?: ModelBroadcastEventName[]
224
- with?: (model: M, event: ModelBroadcastEventName) => object
223
+ events?: ModelBroadcastEventName[] | undefined
224
+ with?: ((model: M, event: ModelBroadcastEventName) => object) | undefined
225
225
  }
226
226
 
227
227
  interface PresenceMember = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zerotal/broadcasting",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
4
4
  "license": "MIT",
5
5
  "maturity": "stable",
6
6
  "private": false,
@@ -30,7 +30,7 @@
30
30
  "typecheck": "tsc --noEmit"
31
31
  },
32
32
  "dependencies": {
33
- "@zerotal/core": "1.9.0"
33
+ "@zerotal/core": "1.10.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "typescript": "^5.8.0"
@@ -6,13 +6,13 @@ export type ModelBroadcastEventName = "created" | "updated" | "deleted";
6
6
 
7
7
  export interface BroadcastsModelEventsOptions<M> {
8
8
  /** Which lifecycle events to broadcast. Default: `created`, `updated`, `deleted`. */
9
- events?: ModelBroadcastEventName[];
9
+ events?: ModelBroadcastEventName[] | undefined;
10
10
  /** The channel(s) to broadcast on for a given model instance + event. */
11
11
  channels: (model: M, event: ModelBroadcastEventName) => string | string[];
12
12
  /** The wire event name. Default: `${ModelName}${Event}`, e.g. `OrderUpdated`. */
13
- as?: (modelName: string, event: ModelBroadcastEventName) => string;
13
+ as?: ((modelName: string, event: ModelBroadcastEventName) => string) | undefined;
14
14
  /** The wire payload. Default: `{ [camelModelName]: model }`, e.g. `{ order }`. */
15
- with?: (model: M, event: ModelBroadcastEventName) => object;
15
+ with?: ((model: M, event: ModelBroadcastEventName) => object) | undefined;
16
16
  }
17
17
 
18
18
  /** Minimal shape of an ORM model class with the `dispatchesEvents` bridge. */
package/src/config.ts CHANGED
@@ -17,7 +17,7 @@ export interface BroadcastConfigShape {
17
17
  * @example
18
18
  * redis: { url: Bun.env.REDIS_URL ?? 'redis://localhost:6379' }
19
19
  */
20
- redis?: { url: string };
20
+ redis?: { url: string } | undefined;
21
21
  /**
22
22
  * Pusher credentials - required when driver is `'pusher'`.
23
23
  * Configure a Pusher-compatible client to connect to ws://host/app/{appKey}.
@@ -27,10 +27,12 @@ export interface BroadcastConfigShape {
27
27
  * appSecret: Bun.env.PUSHER_APP_SECRET!,
28
28
  * }
29
29
  */
30
- pusher?: {
31
- appKey: string;
32
- appSecret: string;
33
- };
30
+ pusher?:
31
+ | {
32
+ appKey: string;
33
+ appSecret: string;
34
+ }
35
+ | undefined;
34
36
  /**
35
37
  * Where the `Broadcast.channel(...)` authorization rules live, relative to the
36
38
  * project root (or absolute).
@@ -43,7 +45,7 @@ export interface BroadcastConfigShape {
43
45
  * @example
44
46
  * channels: "app/routes/channels.ts"
45
47
  */
46
- channels?: string;
48
+ channels?: string | undefined;
47
49
  }
48
50
 
49
51
  const defaults: BroadcastConfigShape = {