unifi-protect 5.2.0 → 5.3.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.
Files changed (174) hide show
  1. package/README.md +5 -5
  2. package/dist/client/client.d.ts +11 -4
  3. package/dist/client/client.d.ts.map +1 -1
  4. package/dist/client/client.js +18 -14
  5. package/dist/client/client.js.map +1 -1
  6. package/dist/client/connection.d.ts +2 -2
  7. package/dist/client/connection.d.ts.map +1 -1
  8. package/dist/client/connection.js +11 -14
  9. package/dist/client/connection.js.map +1 -1
  10. package/dist/client/livestream-pool.d.ts +11 -9
  11. package/dist/client/livestream-pool.d.ts.map +1 -1
  12. package/dist/client/livestream-pool.js +26 -19
  13. package/dist/client/livestream-pool.js.map +1 -1
  14. package/dist/devices/chime.d.ts +3 -3
  15. package/dist/devices/context.d.ts +1 -1
  16. package/dist/devices/device.d.ts +5 -6
  17. package/dist/devices/device.d.ts.map +1 -1
  18. package/dist/devices/device.js +5 -6
  19. package/dist/devices/device.js.map +1 -1
  20. package/dist/devices/fob.d.ts +2 -2
  21. package/dist/devices/fob.js +2 -2
  22. package/dist/devices/light.d.ts +2 -2
  23. package/dist/devices/light.js +2 -2
  24. package/dist/devices/relay.d.ts +2 -2
  25. package/dist/devices/relay.js +2 -2
  26. package/dist/diagnostics.d.ts +92 -36
  27. package/dist/diagnostics.d.ts.map +1 -1
  28. package/dist/diagnostics.js +55 -32
  29. package/dist/diagnostics.js.map +1 -1
  30. package/dist/errors.d.ts +25 -20
  31. package/dist/errors.d.ts.map +1 -1
  32. package/dist/errors.js +24 -19
  33. package/dist/errors.js.map +1 -1
  34. package/dist/event-bus.d.ts +3 -3
  35. package/dist/event-bus.d.ts.map +1 -1
  36. package/dist/event-bus.js +5 -4
  37. package/dist/event-bus.js.map +1 -1
  38. package/dist/index.d.ts +3 -3
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +8 -6
  41. package/dist/index.js.map +1 -1
  42. package/dist/protocol/events.d.ts +30 -16
  43. package/dist/protocol/events.d.ts.map +1 -1
  44. package/dist/protocol/events.js +51 -27
  45. package/dist/protocol/events.js.map +1 -1
  46. package/dist/protocol/packet.d.ts +3 -0
  47. package/dist/protocol/packet.d.ts.map +1 -1
  48. package/dist/protocol/packet.js +3 -0
  49. package/dist/protocol/packet.js.map +1 -1
  50. package/dist/protocol/reducer.d.ts +26 -3
  51. package/dist/protocol/reducer.d.ts.map +1 -1
  52. package/dist/protocol/reducer.js +19 -7
  53. package/dist/protocol/reducer.js.map +1 -1
  54. package/dist/schema-manifest.json +1 -0
  55. package/dist/settings.d.ts +1 -0
  56. package/dist/settings.d.ts.map +1 -1
  57. package/dist/settings.js +4 -0
  58. package/dist/settings.js.map +1 -1
  59. package/dist/state/selectors.d.ts +3 -3
  60. package/dist/state/selectors.d.ts.map +1 -1
  61. package/dist/state/selectors.js +10 -6
  62. package/dist/state/selectors.js.map +1 -1
  63. package/dist/state/store.d.ts +7 -5
  64. package/dist/state/store.d.ts.map +1 -1
  65. package/dist/state/store.js +29 -5
  66. package/dist/state/store.js.map +1 -1
  67. package/dist/transport/auth.d.ts +12 -8
  68. package/dist/transport/auth.d.ts.map +1 -1
  69. package/dist/transport/auth.js +69 -16
  70. package/dist/transport/auth.js.map +1 -1
  71. package/dist/transport/events-stream.d.ts +5 -2
  72. package/dist/transport/events-stream.d.ts.map +1 -1
  73. package/dist/transport/events-stream.js +17 -15
  74. package/dist/transport/events-stream.js.map +1 -1
  75. package/dist/transport/http.d.ts +14 -8
  76. package/dist/transport/http.d.ts.map +1 -1
  77. package/dist/transport/http.js +25 -15
  78. package/dist/transport/http.js.map +1 -1
  79. package/dist/transport/livestream-session.d.ts +19 -10
  80. package/dist/transport/livestream-session.d.ts.map +1 -1
  81. package/dist/transport/livestream-session.js +19 -13
  82. package/dist/transport/livestream-session.js.map +1 -1
  83. package/dist/transport/talkback-session.d.ts +12 -7
  84. package/dist/transport/talkback-session.d.ts.map +1 -1
  85. package/dist/transport/talkback-session.js +16 -10
  86. package/dist/transport/talkback-session.js.map +1 -1
  87. package/dist/transport/ws.d.ts +6 -6
  88. package/dist/transport/ws.js +1 -1
  89. package/dist/util/cli/client.d.ts +23 -2
  90. package/dist/util/cli/client.d.ts.map +1 -1
  91. package/dist/util/cli/client.js +35 -5
  92. package/dist/util/cli/client.js.map +1 -1
  93. package/dist/util/cli/commands/camera.d.ts.map +1 -1
  94. package/dist/util/cli/commands/camera.js +5 -4
  95. package/dist/util/cli/commands/camera.js.map +1 -1
  96. package/dist/util/cli/commands/capture.d.ts +27 -0
  97. package/dist/util/cli/commands/capture.d.ts.map +1 -0
  98. package/dist/util/cli/commands/capture.js +397 -0
  99. package/dist/util/cli/commands/capture.js.map +1 -0
  100. package/dist/util/cli/commands/doctor.d.ts.map +1 -1
  101. package/dist/util/cli/commands/doctor.js +96 -96
  102. package/dist/util/cli/commands/doctor.js.map +1 -1
  103. package/dist/util/cli/commands/watch-events.d.ts +5 -0
  104. package/dist/util/cli/commands/watch-events.d.ts.map +1 -1
  105. package/dist/util/cli/commands/watch-events.js +8 -4
  106. package/dist/util/cli/commands/watch-events.js.map +1 -1
  107. package/dist/util/cli/commands/watch-state.d.ts.map +1 -1
  108. package/dist/util/cli/commands/watch-state.js +1 -0
  109. package/dist/util/cli/commands/watch-state.js.map +1 -1
  110. package/dist/util/cli/credentials.d.ts +30 -2
  111. package/dist/util/cli/credentials.d.ts.map +1 -1
  112. package/dist/util/cli/credentials.js +146 -4
  113. package/dist/util/cli/credentials.js.map +1 -1
  114. package/dist/util/cli/diagnostics-feed.d.ts +2 -2
  115. package/dist/util/cli/diagnostics-feed.d.ts.map +1 -1
  116. package/dist/util/cli/diagnostics-feed.js +8 -10
  117. package/dist/util/cli/diagnostics-feed.js.map +1 -1
  118. package/dist/util/cli/index.js +5 -13
  119. package/dist/util/cli/index.js.map +1 -1
  120. package/dist/util/cli/manifest.d.ts +253 -0
  121. package/dist/util/cli/manifest.d.ts.map +1 -0
  122. package/dist/util/cli/manifest.js +405 -0
  123. package/dist/util/cli/manifest.js.map +1 -0
  124. package/dist/util/cli/output/format.d.ts +29 -0
  125. package/dist/util/cli/output/format.d.ts.map +1 -1
  126. package/dist/util/cli/output/format.js +34 -2
  127. package/dist/util/cli/output/format.js.map +1 -1
  128. package/dist/util/cli/scrub.d.ts +54 -0
  129. package/dist/util/cli/scrub.d.ts.map +1 -0
  130. package/dist/util/cli/scrub.js +218 -0
  131. package/dist/util/cli/scrub.js.map +1 -0
  132. package/dist/util/cli/shared.d.ts +57 -10
  133. package/dist/util/cli/shared.d.ts.map +1 -1
  134. package/dist/util/cli/shared.js +53 -9
  135. package/dist/util/cli/shared.js.map +1 -1
  136. package/package.json +8 -8
  137. package/src/client/client.ts +29 -18
  138. package/src/client/connection.ts +15 -18
  139. package/src/client/livestream-pool.ts +36 -27
  140. package/src/devices/chime.ts +3 -3
  141. package/src/devices/context.ts +1 -1
  142. package/src/devices/device.ts +5 -6
  143. package/src/devices/fob.ts +2 -2
  144. package/src/devices/light.ts +2 -2
  145. package/src/devices/relay.ts +2 -2
  146. package/src/diagnostics.ts +118 -35
  147. package/src/errors.ts +28 -22
  148. package/src/event-bus.ts +5 -4
  149. package/src/index.ts +16 -12
  150. package/src/protocol/events.ts +58 -32
  151. package/src/protocol/packet.ts +3 -0
  152. package/src/protocol/reducer.ts +31 -14
  153. package/src/settings.ts +5 -0
  154. package/src/state/selectors.ts +10 -6
  155. package/src/state/store.ts +37 -8
  156. package/src/transport/auth.ts +85 -17
  157. package/src/transport/events-stream.ts +22 -17
  158. package/src/transport/http.ts +37 -21
  159. package/src/transport/livestream-session.ts +38 -23
  160. package/src/transport/talkback-session.ts +21 -12
  161. package/src/transport/ws.ts +7 -7
  162. package/src/util/cli/client.ts +42 -5
  163. package/src/util/cli/commands/camera.ts +5 -4
  164. package/src/util/cli/commands/capture.ts +490 -0
  165. package/src/util/cli/commands/doctor.ts +16 -33
  166. package/src/util/cli/commands/watch-events.ts +8 -4
  167. package/src/util/cli/commands/watch-state.ts +3 -2
  168. package/src/util/cli/credentials.ts +253 -5
  169. package/src/util/cli/diagnostics-feed.ts +10 -15
  170. package/src/util/cli/index.ts +5 -17
  171. package/src/util/cli/manifest.ts +764 -0
  172. package/src/util/cli/output/format.ts +39 -2
  173. package/src/util/cli/scrub.ts +352 -0
  174. package/src/util/cli/shared.ts +70 -17
@@ -1,5 +1,23 @@
1
1
  import type { LivestreamSubscriptionStats } from "./client/livestream-pool.ts";
2
- import diagnosticsChannel from "node:diagnostics_channel";
2
+ /**
3
+ * A diagnostics publisher bound to the payload shape it carries - the typed view of one `node:diagnostics_channel` channel.
4
+ *
5
+ * The platform's own channel is payload-agnostic: `publish` accepts anything and a subscriber's handler receives `unknown`. Binding the payload type to the channel
6
+ * instead makes the rail typed from end to end - a publisher cannot send the wrong shape, and a subscriber's handler parameter arrives fully typed, with no cast and no
7
+ * runtime narrowing to recover what the library already knows. `subscribe` and `unsubscribe` are the primitive pair beneath {@link subscribeToChannel}, which is how a
8
+ * consumer normally attaches: it returns a `Disposable` and so composes with `using`.
9
+ *
10
+ * A payload-less channel is declared as `ProtectDiagnosticsChannel<void>`: it publishes with no argument and its handlers take none.
11
+ *
12
+ * @category Diagnostics
13
+ */
14
+ export interface ProtectDiagnosticsChannel<T> {
15
+ readonly hasSubscribers: boolean;
16
+ readonly name: string | symbol;
17
+ publish(payload: T): void;
18
+ subscribe(handler: (payload: T) => void): void;
19
+ unsubscribe(handler: (payload: T) => void): void;
20
+ }
3
21
  /**
4
22
  * The library's observability surface, expressed as `node:diagnostics_channel` publishers.
5
23
  *
@@ -9,12 +27,15 @@ import diagnosticsChannel from "node:diagnostics_channel";
9
27
  * listening (publishers gate on `channel.hasSubscribers` before building a payload), and adaptable to any backend - a consumer can bridge any channel to OpenTelemetry,
10
28
  * Pino, a metrics counter, or the `ufp diagnostics` CLI command.
11
29
  *
12
- * Channel names follow a stable `unifi-protect:<subsystem>:<event>:<phase>` taxonomy. This module declares every channel exactly once; subsystems import the publisher
13
- * they need from here rather than re-deriving the channel name string, so a rename is a single edit and a typo is impossible at the call site.
30
+ * Channel names follow a `unifi-protect:<subsystem>:<event>[:<phase>]` taxonomy; the phase segment is present only when the event name doesn't already carry a
31
+ * terminal state of its own. This module declares every channel exactly once; subsystems import the publisher they need from here rather than re-deriving the
32
+ * channel name string, so a rename is a single edit and a typo is impossible at the call site.
14
33
  *
15
- * This module is the single source of truth for the channel set. Each channel is declared with its payload type, so a consumer's `subscribe` handler is typed and the
16
- * generated reference `docs/variables/channels.md` (via `npm run build-docs`) links each channel to its payload. Adding a channel touches both: the typed, doc-commented
17
- * entry here and its payload interface below.
34
+ * This module is the single source of truth for the channel set. Each channel is a {@link ProtectDiagnosticsChannel} bound to its payload type, so both directions of
35
+ * the rail are typed - a publish is checked against the payload shape, and a subscriber's handler receives it already narrowed - and the generated reference
36
+ * `docs/variables/channels.md` (via `npm run build-docs`) links each channel to its payload. {@link subscribeToChannel} is the subscription path a consumer reaches for:
37
+ * it returns a `Disposable`, so a handler's lifetime is scoped by `using` rather than tracked by hand. Adding a channel touches both: the typed, doc-commented entry
38
+ * here and its payload interface below.
18
39
  *
19
40
  * @category Diagnostics
20
41
  */
@@ -25,64 +46,99 @@ export declare const channels: {
25
46
  * publishes nothing until the controller retracts it (or the device leaves). A G2-generation controller defect surfaces this on 4-hour anchors and holds until a
26
47
  * reboot; the signal exists so a consumer sees the anomaly explicitly rather than the model silently absorbing it.
27
48
  */
28
- readonly adoptionContradiction: diagnosticsChannel.Channel<AdoptionContradictionPayload, AdoptionContradictionPayload>;
49
+ readonly adoptionContradiction: ProtectDiagnosticsChannel<AdoptionContradictionPayload>;
29
50
  /** The 401-triggered relogin ran. The only visibility into mid-session session recovery, which is otherwise silent (it has no return value a consumer sees); the
30
51
  * payload's `success` reports whether the session was recovered. Connect-time login is deliberately not channelled - the `connect()` result and the `http:request:*`
31
52
  * channels already are its single source.
32
53
  */
33
- readonly authRelogin: diagnosticsChannel.Channel<AuthReloginPayload, AuthReloginPayload>;
54
+ readonly authRelogin: ProtectDiagnosticsChannel<AuthReloginPayload>;
34
55
  /** A controller reboot was detected by comparing the NVR's self-reported boot time (`upSince`) across bootstraps. */
35
- readonly connectionRebootDetected: diagnosticsChannel.Channel<ConnectionRebootDetectedPayload, ConnectionRebootDetectedPayload>;
56
+ readonly connectionRebootDetected: ProtectDiagnosticsChannel<ConnectionRebootDetectedPayload>;
36
57
  /** The connection-state FSM moved between states. */
37
- readonly connectionTransition: diagnosticsChannel.Channel<ConnectionTransitionPayload, ConnectionTransitionPayload>;
58
+ readonly connectionTransition: ProtectDiagnosticsChannel<ConnectionTransitionPayload>;
38
59
  /** The realtime events WebSocket closed. */
39
- readonly eventsClosed: diagnosticsChannel.Channel<EventsClosedPayload, EventsClosedPayload>;
60
+ readonly eventsClosed: ProtectDiagnosticsChannel<EventsClosedPayload>;
40
61
  /** A realtime event packet was classified and dispatched. */
41
- readonly eventsPacket: diagnosticsChannel.Channel<EventsPacketPayload, EventsPacketPayload>;
62
+ readonly eventsPacket: ProtectDiagnosticsChannel<EventsPacketPayload>;
42
63
  /** The realtime events WebSocket is reconnecting. */
43
- readonly eventsReconnecting: diagnosticsChannel.Channel<EventsReconnectingPayload, EventsReconnectingPayload>;
64
+ readonly eventsReconnecting: ProtectDiagnosticsChannel<EventsReconnectingPayload>;
44
65
  /** An HTTP request completed (success or failure). */
45
- readonly httpRequestEnd: diagnosticsChannel.Channel<HttpRequestEndPayload, HttpRequestEndPayload>;
66
+ readonly httpRequestEnd: ProtectDiagnosticsChannel<HttpRequestEndPayload>;
46
67
  /** An HTTP request was dispatched. */
47
- readonly httpRequestStart: diagnosticsChannel.Channel<HttpRequestStartPayload, HttpRequestStartPayload>;
68
+ readonly httpRequestStart: ProtectDiagnosticsChannel<HttpRequestStartPayload>;
48
69
  /** The transport entered its throttle cooldown after crossing the consecutive-failure threshold. */
49
- readonly httpThrottleEntered: diagnosticsChannel.Channel<HttpThrottleEnteredPayload, HttpThrottleEnteredPayload>;
50
- /** The transport left its throttle cooldown and resumed normal operation. */
51
- readonly httpThrottleExited: diagnosticsChannel.Channel<Record<string, never>, Record<string, never>>;
52
- /** A pooled livestream reconnected and the controller negotiated a different codec than the one in flight - the one terminal a recovering stream raises. */
53
- readonly livestreamCodecChanged: diagnosticsChannel.Channel<LivestreamCodecChangedPayload, LivestreamCodecChangedPayload>;
54
- /** A pooled livestream's recovery policy gave up. The seam an opt-in consumer self-heal observer (a user-gated camera reboot) watches; the library reboots nothing. */
55
- readonly livestreamRecoveryExhausted: diagnosticsChannel.Channel<LivestreamRecoveryExhaustedPayload, LivestreamRecoveryExhaustedPayload>;
70
+ readonly httpThrottleEntered: ProtectDiagnosticsChannel<HttpThrottleEnteredPayload>;
71
+ /** The transport left its throttle cooldown and resumed normal operation. The one payload-less channel: the transition itself is the whole signal, so it publishes
72
+ * with no argument and its handlers take none.
73
+ */
74
+ readonly httpThrottleExited: ProtectDiagnosticsChannel<void>;
75
+ /** A pooled livestream reconnected and the controller negotiated a different codec than the one in flight - one of the terminal errors a recovering stream
76
+ * can raise.
77
+ */
78
+ readonly livestreamCodecChanged: ProtectDiagnosticsChannel<LivestreamCodecChangedPayload>;
79
+ /** A pooled livestream's recovery policy gave up. What an opt-in consumer self-heal observer (a user-gated camera reboot) watches; the library reboots nothing. */
80
+ readonly livestreamRecoveryExhausted: ProtectDiagnosticsChannel<LivestreamRecoveryExhaustedPayload>;
56
81
  /** A pooled livestream's recovery episode restored the stream after a fault. */
57
- readonly livestreamRecoveryRecovered: diagnosticsChannel.Channel<LivestreamRecoveryRecoveredPayload, LivestreamRecoveryRecoveredPayload>;
82
+ readonly livestreamRecoveryRecovered: ProtectDiagnosticsChannel<LivestreamRecoveryRecoveredPayload>;
58
83
  /** A pooled livestream began a recovery episode after a previously-live session faulted. */
59
- readonly livestreamRecoveryStarted: diagnosticsChannel.Channel<LivestreamRecoveryStartedPayload, LivestreamRecoveryStartedPayload>;
84
+ readonly livestreamRecoveryStarted: ProtectDiagnosticsChannel<LivestreamRecoveryStartedPayload>;
60
85
  /** A pooled livestream session closed and released its underlying WebSocket. */
61
- readonly livestreamSessionClosed: diagnosticsChannel.Channel<LivestreamSessionClosedPayload, LivestreamSessionClosedPayload>;
86
+ readonly livestreamSessionClosed: ProtectDiagnosticsChannel<LivestreamSessionClosedPayload>;
62
87
  /** A pooled livestream session opened a new underlying WebSocket. */
63
- readonly livestreamSessionOpened: diagnosticsChannel.Channel<LivestreamSessionOpenedPayload, LivestreamSessionOpenedPayload>;
88
+ readonly livestreamSessionOpened: ProtectDiagnosticsChannel<LivestreamSessionOpenedPayload>;
64
89
  /** A livestream session went silent beyond the heartbeat watchdog window. */
65
- readonly livestreamStallDetected: diagnosticsChannel.Channel<LivestreamStallDetectedPayload, LivestreamStallDetectedPayload>;
90
+ readonly livestreamStallDetected: ProtectDiagnosticsChannel<LivestreamStallDetectedPayload>;
66
91
  /** A consumer subscribed to a pooled livestream session. */
67
- readonly livestreamSubscriptionCreated: diagnosticsChannel.Channel<LivestreamSubscriptionCreatedPayload, LivestreamSubscriptionCreatedPayload>;
92
+ readonly livestreamSubscriptionCreated: ProtectDiagnosticsChannel<LivestreamSubscriptionCreatedPayload>;
68
93
  /** A consumer disposed its livestream subscription. */
69
- readonly livestreamSubscriptionDisposed: diagnosticsChannel.Channel<LivestreamSubscriptionDisposedPayload, LivestreamSubscriptionDisposedPayload>;
94
+ readonly livestreamSubscriptionDisposed: ProtectDiagnosticsChannel<LivestreamSubscriptionDisposedPayload>;
70
95
  /** A realtime packet carried a model key the library does not model. Published by the EventStream caller (not the classifier, which stays pure) on the first
71
96
  * occurrence per `(modelKey, action)` per session, so sustained drift does not spam. The signal exists so consumers see schema evolution explicitly rather than
72
97
  * silently absorbing it; the library version that adds support for the category closes the gap.
73
98
  */
74
- readonly schemaUnknownModelKey: diagnosticsChannel.Channel<SchemaUnknownModelKeyPayload, SchemaUnknownModelKeyPayload>;
99
+ readonly schemaUnknownModelKey: ProtectDiagnosticsChannel<SchemaUnknownModelKeyPayload>;
75
100
  /** An applied bootstrap carried a populated, device-shaped collection (a `modelKey`+`mac` record array) the reducer does not model. Published by the StateStore from
76
101
  * its dispatch chokepoint on the first occurrence per `modelKey` per session - the bootstrap-dimension twin of `schema:unknownModelKey`, which is structurally blind to
77
102
  * a quiescent device that lives in the bootstrap but emits no realtime packet. The `known` flag separates a recognized-but-unreduced class (e.g. `aiport`) from genuine
78
103
  * drift the controller introduced; either way the signal exists so consumers see device classes the library does not yet project rather than silently absorbing it.
79
104
  */
80
- readonly schemaUnmodeledCollection: diagnosticsChannel.Channel<SchemaUnmodeledCollectionPayload, SchemaUnmodeledCollectionPayload>;
105
+ readonly schemaUnmodeledCollection: ProtectDiagnosticsChannel<SchemaUnmodeledCollectionPayload>;
81
106
  /** A talkback (two-way audio) session closed and released its WebSocket. */
82
- readonly talkbackSessionClosed: diagnosticsChannel.Channel<TalkbackSessionClosedPayload, TalkbackSessionClosedPayload>;
107
+ readonly talkbackSessionClosed: ProtectDiagnosticsChannel<TalkbackSessionClosedPayload>;
83
108
  /** A talkback (two-way audio) session opened a WebSocket to a camera's speaker. */
84
- readonly talkbackSessionOpened: diagnosticsChannel.Channel<TalkbackSessionOpenedPayload, TalkbackSessionOpenedPayload>;
109
+ readonly talkbackSessionOpened: ProtectDiagnosticsChannel<TalkbackSessionOpenedPayload>;
85
110
  };
111
+ /**
112
+ * The element type of a subscription that spans channels carrying different payloads - the union of every channel in {@link channels}.
113
+ *
114
+ * A generic observer (a feed that renders whatever arrives, a census that counts which channels fired) holds channels of mixed payload types in one array and attaches
115
+ * an `unknown`-taking handler to each; this is that array's element type.
116
+ *
117
+ * Subscribing is the supported direction. Publishing through the union is not: a parameter position combines across a union rather than distributing over it, so
118
+ * `publish` there demands a value satisfying every payload shape at once, which no real payload does. Publish through the concrete channel from {@link channels}.
119
+ *
120
+ * @category Diagnostics
121
+ */
122
+ export type AnyProtectDiagnosticsChannel = typeof channels[keyof typeof channels];
123
+ /**
124
+ * Attach `handler` to `channel` and return a `Disposable` that detaches it.
125
+ *
126
+ * This is the subscription path for the diagnostics rails, mirroring how every other long-lived subscription in the library is expressed: `using sub =
127
+ * subscribeToChannel(channels.eventsPacket, (payload) => ...)` detaches the handler when the binding leaves scope, so no observer outlives the code that wanted it.
128
+ * Where a `using` declaration does not fit, call `sub[Symbol.dispose]()` explicitly; disposing twice is safe, because the second detach is a no-op.
129
+ *
130
+ * Passing a concrete channel types the handler's payload from that channel, so the handler reads its fields directly. Passing an
131
+ * {@link AnyProtectDiagnosticsChannel} - an element of a mixed-payload array - hands the handler an `unknown` payload instead, which is what a generic observer wants.
132
+ *
133
+ * @param channel - The channel to observe.
134
+ * @param handler - Invoked with the published payload on every publication until the returned handle is disposed.
135
+ *
136
+ * @returns A `Disposable` that detaches this handler when disposed.
137
+ *
138
+ * @category Diagnostics
139
+ */
140
+ export declare function subscribeToChannel<T>(channel: ProtectDiagnosticsChannel<T>, handler: (payload: T) => void): Disposable;
141
+ export declare function subscribeToChannel(channel: AnyProtectDiagnosticsChannel, handler: (payload: unknown) => void): Disposable;
86
142
  /**
87
143
  * Payload published on {@link channels.adoptionContradiction}. `modelKey` and `id` identify the device whose record was self-contradictory; `mac` is the device's own
88
144
  * hardware address; `nvrMac` is the owning-controller address the record asserted, which equals this controller's own MAC (that equality is what makes the
@@ -106,8 +162,8 @@ export interface AuthReloginPayload {
106
162
  success: boolean;
107
163
  }
108
164
  /**
109
- * Payload published on {@link channels.connectionRebootDetected}. The controller's own self-reported boot times are the wire-level reboot signal; no heuristics are
110
- * involved.
165
+ * Payload published on {@link channels.connectionRebootDetected}. The controller's own self-reported boot time (`upSince`) is the underlying wire-level signal; a
166
+ * threshold-based comparison across bootstraps distinguishes a genuine reboot from measurement jitter in that value.
111
167
  *
112
168
  * @category Diagnostics
113
169
  */
@@ -209,7 +265,7 @@ export interface LivestreamCodecChangedPayload {
209
265
  }
210
266
  /**
211
267
  * Payload published on {@link channels.livestreamRecoveryExhausted}. `attempts` is the number of consecutive failed reconnect attempts before the policy gave up. The
212
- * consumer's iterator also receives a {@link ProtectLivestreamUnavailableError}; this channel is the seam an opt-in self-heal observer watches.
268
+ * consumer's iterator also receives a {@link ProtectLivestreamUnavailableError}; this channel is what an opt-in self-heal observer watches.
213
269
  *
214
270
  * @category Diagnostics
215
271
  */
@@ -1 +1 @@
1
- {"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAC/E,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAE1D;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,QAAQ;IAEnB;;;;;OAKG;;IAGH;;;OAGG;;IAGH,qHAAqH;;IAGrH,qDAAqD;;IAGrD,4CAA4C;;IAG5C,6DAA6D;;IAG7D,qDAAqD;;IAGrD,sDAAsD;;IAGtD,sCAAsC;;IAGtC,oGAAoG;;IAGpG,6EAA6E;;IAG7E,4JAA4J;;IAG5J,uKAAuK;;IAGvK,gFAAgF;;IAGhF,4FAA4F;;IAG5F,gFAAgF;;IAGhF,qEAAqE;;IAGrE,6EAA6E;;IAG7E,4DAA4D;;IAG5D,uDAAuD;;IAGvD;;;OAGG;;IAGH;;;;OAIG;;IAGH,4EAA4E;;IAG5E,mFAAmF;;CAE3E,CAAC;AAEX;;;;;;GAMG;AACH,MAAM,WAAW,4BAA4B;IAE3C,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IAEjC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;GAKG;AACH,MAAM,WAAW,+BAA+B;IAE9C,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;CACzB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AAE,MAAM,CAAC;CAClB;AAED;;;;;GAKG;AACH,MAAM,WAAW,4BAA4B;IAE3C,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,MAAM,WAAW,4BAA4B;IAE3C,QAAQ,EAAE,MAAM,CAAC;CAClB"}
@@ -1,4 +1,16 @@
1
1
  import diagnosticsChannel from "node:diagnostics_channel";
2
+ // Bind a channel to the payload it carries. The platform hands back a payload-agnostic channel, so this is the single place in the library that asserts what a given
3
+ // channel publishes...every declaration below is created through it, and no other module casts a channel. The assertion is safe because the two sides of it meet in one
4
+ // place: the name and the payload type are written together on the same line, and the publish sites are typechecked against that same type.
5
+ function typed(name) {
6
+ return diagnosticsChannel.channel(name);
7
+ }
8
+ // Declare a channel whose signal is the transition itself, with nothing to carry: the payload type is `void`, so it publishes with no argument and its handlers take
9
+ // none. It is a named companion to `typed` rather than a `typed<void>(...)` call because the payload type belongs in a return position here, where it reads as what the
10
+ // channel is - a bare signal - instead of as a type argument that happens to be empty.
11
+ function payloadless(name) {
12
+ return typed(name);
13
+ }
2
14
  /**
3
15
  * The library's observability surface, expressed as `node:diagnostics_channel` publishers.
4
16
  *
@@ -8,12 +20,15 @@ import diagnosticsChannel from "node:diagnostics_channel";
8
20
  * listening (publishers gate on `channel.hasSubscribers` before building a payload), and adaptable to any backend - a consumer can bridge any channel to OpenTelemetry,
9
21
  * Pino, a metrics counter, or the `ufp diagnostics` CLI command.
10
22
  *
11
- * Channel names follow a stable `unifi-protect:<subsystem>:<event>:<phase>` taxonomy. This module declares every channel exactly once; subsystems import the publisher
12
- * they need from here rather than re-deriving the channel name string, so a rename is a single edit and a typo is impossible at the call site.
23
+ * Channel names follow a `unifi-protect:<subsystem>:<event>[:<phase>]` taxonomy; the phase segment is present only when the event name doesn't already carry a
24
+ * terminal state of its own. This module declares every channel exactly once; subsystems import the publisher they need from here rather than re-deriving the
25
+ * channel name string, so a rename is a single edit and a typo is impossible at the call site.
13
26
  *
14
- * This module is the single source of truth for the channel set. Each channel is declared with its payload type, so a consumer's `subscribe` handler is typed and the
15
- * generated reference `docs/variables/channels.md` (via `npm run build-docs`) links each channel to its payload. Adding a channel touches both: the typed, doc-commented
16
- * entry here and its payload interface below.
27
+ * This module is the single source of truth for the channel set. Each channel is a {@link ProtectDiagnosticsChannel} bound to its payload type, so both directions of
28
+ * the rail are typed - a publish is checked against the payload shape, and a subscriber's handler receives it already narrowed - and the generated reference
29
+ * `docs/variables/channels.md` (via `npm run build-docs`) links each channel to its payload. {@link subscribeToChannel} is the subscription path a consumer reaches for:
30
+ * it returns a `Disposable`, so a handler's lifetime is scoped by `using` rather than tracked by hand. Adding a channel touches both: the typed, doc-commented entry
31
+ * here and its payload interface below.
17
32
  *
18
33
  * @category Diagnostics
19
34
  */
@@ -24,62 +39,70 @@ export const channels = {
24
39
  * publishes nothing until the controller retracts it (or the device leaves). A G2-generation controller defect surfaces this on 4-hour anchors and holds until a
25
40
  * reboot; the signal exists so a consumer sees the anomaly explicitly rather than the model silently absorbing it.
26
41
  */
27
- adoptionContradiction: diagnosticsChannel.channel("unifi-protect:adoption:contradiction"),
42
+ adoptionContradiction: typed("unifi-protect:adoption:contradiction"),
28
43
  /** The 401-triggered relogin ran. The only visibility into mid-session session recovery, which is otherwise silent (it has no return value a consumer sees); the
29
44
  * payload's `success` reports whether the session was recovered. Connect-time login is deliberately not channelled - the `connect()` result and the `http:request:*`
30
45
  * channels already are its single source.
31
46
  */
32
- authRelogin: diagnosticsChannel.channel("unifi-protect:auth:relogin"),
47
+ authRelogin: typed("unifi-protect:auth:relogin"),
33
48
  /** A controller reboot was detected by comparing the NVR's self-reported boot time (`upSince`) across bootstraps. */
34
- connectionRebootDetected: diagnosticsChannel.channel("unifi-protect:connection:rebootDetected"),
49
+ connectionRebootDetected: typed("unifi-protect:connection:rebootDetected"),
35
50
  /** The connection-state FSM moved between states. */
36
- connectionTransition: diagnosticsChannel.channel("unifi-protect:connection:transition"),
51
+ connectionTransition: typed("unifi-protect:connection:transition"),
37
52
  /** The realtime events WebSocket closed. */
38
- eventsClosed: diagnosticsChannel.channel("unifi-protect:events:closed"),
53
+ eventsClosed: typed("unifi-protect:events:closed"),
39
54
  /** A realtime event packet was classified and dispatched. */
40
- eventsPacket: diagnosticsChannel.channel("unifi-protect:events:packet"),
55
+ eventsPacket: typed("unifi-protect:events:packet"),
41
56
  /** The realtime events WebSocket is reconnecting. */
42
- eventsReconnecting: diagnosticsChannel.channel("unifi-protect:events:reconnecting"),
57
+ eventsReconnecting: typed("unifi-protect:events:reconnecting"),
43
58
  /** An HTTP request completed (success or failure). */
44
- httpRequestEnd: diagnosticsChannel.channel("unifi-protect:http:request:end"),
59
+ httpRequestEnd: typed("unifi-protect:http:request:end"),
45
60
  /** An HTTP request was dispatched. */
46
- httpRequestStart: diagnosticsChannel.channel("unifi-protect:http:request:start"),
61
+ httpRequestStart: typed("unifi-protect:http:request:start"),
47
62
  /** The transport entered its throttle cooldown after crossing the consecutive-failure threshold. */
48
- httpThrottleEntered: diagnosticsChannel.channel("unifi-protect:http:throttle:entered"),
49
- /** The transport left its throttle cooldown and resumed normal operation. */
50
- httpThrottleExited: diagnosticsChannel.channel("unifi-protect:http:throttle:exited"),
51
- /** A pooled livestream reconnected and the controller negotiated a different codec than the one in flight - the one terminal a recovering stream raises. */
52
- livestreamCodecChanged: diagnosticsChannel.channel("unifi-protect:livestream:codec:changed"),
53
- /** A pooled livestream's recovery policy gave up. The seam an opt-in consumer self-heal observer (a user-gated camera reboot) watches; the library reboots nothing. */
54
- livestreamRecoveryExhausted: diagnosticsChannel.channel("unifi-protect:livestream:recovery:exhausted"),
63
+ httpThrottleEntered: typed("unifi-protect:http:throttle:entered"),
64
+ /** The transport left its throttle cooldown and resumed normal operation. The one payload-less channel: the transition itself is the whole signal, so it publishes
65
+ * with no argument and its handlers take none.
66
+ */
67
+ httpThrottleExited: payloadless("unifi-protect:http:throttle:exited"),
68
+ /** A pooled livestream reconnected and the controller negotiated a different codec than the one in flight - one of the terminal errors a recovering stream
69
+ * can raise.
70
+ */
71
+ livestreamCodecChanged: typed("unifi-protect:livestream:codec:changed"),
72
+ /** A pooled livestream's recovery policy gave up. What an opt-in consumer self-heal observer (a user-gated camera reboot) watches; the library reboots nothing. */
73
+ livestreamRecoveryExhausted: typed("unifi-protect:livestream:recovery:exhausted"),
55
74
  /** A pooled livestream's recovery episode restored the stream after a fault. */
56
- livestreamRecoveryRecovered: diagnosticsChannel.channel("unifi-protect:livestream:recovery:recovered"),
75
+ livestreamRecoveryRecovered: typed("unifi-protect:livestream:recovery:recovered"),
57
76
  /** A pooled livestream began a recovery episode after a previously-live session faulted. */
58
- livestreamRecoveryStarted: diagnosticsChannel.channel("unifi-protect:livestream:recovery:started"),
77
+ livestreamRecoveryStarted: typed("unifi-protect:livestream:recovery:started"),
59
78
  /** A pooled livestream session closed and released its underlying WebSocket. */
60
- livestreamSessionClosed: diagnosticsChannel.channel("unifi-protect:livestream:session:closed"),
79
+ livestreamSessionClosed: typed("unifi-protect:livestream:session:closed"),
61
80
  /** A pooled livestream session opened a new underlying WebSocket. */
62
- livestreamSessionOpened: diagnosticsChannel.channel("unifi-protect:livestream:session:opened"),
81
+ livestreamSessionOpened: typed("unifi-protect:livestream:session:opened"),
63
82
  /** A livestream session went silent beyond the heartbeat watchdog window. */
64
- livestreamStallDetected: diagnosticsChannel.channel("unifi-protect:livestream:stall:detected"),
83
+ livestreamStallDetected: typed("unifi-protect:livestream:stall:detected"),
65
84
  /** A consumer subscribed to a pooled livestream session. */
66
- livestreamSubscriptionCreated: diagnosticsChannel.channel("unifi-protect:livestream:subscription:created"),
85
+ livestreamSubscriptionCreated: typed("unifi-protect:livestream:subscription:created"),
67
86
  /** A consumer disposed its livestream subscription. */
68
- livestreamSubscriptionDisposed: diagnosticsChannel.channel("unifi-protect:livestream:subscription:disposed"),
87
+ livestreamSubscriptionDisposed: typed("unifi-protect:livestream:subscription:disposed"),
69
88
  /** A realtime packet carried a model key the library does not model. Published by the EventStream caller (not the classifier, which stays pure) on the first
70
89
  * occurrence per `(modelKey, action)` per session, so sustained drift does not spam. The signal exists so consumers see schema evolution explicitly rather than
71
90
  * silently absorbing it; the library version that adds support for the category closes the gap.
72
91
  */
73
- schemaUnknownModelKey: diagnosticsChannel.channel("unifi-protect:schema:unknownModelKey"),
92
+ schemaUnknownModelKey: typed("unifi-protect:schema:unknownModelKey"),
74
93
  /** An applied bootstrap carried a populated, device-shaped collection (a `modelKey`+`mac` record array) the reducer does not model. Published by the StateStore from
75
94
  * its dispatch chokepoint on the first occurrence per `modelKey` per session - the bootstrap-dimension twin of `schema:unknownModelKey`, which is structurally blind to
76
95
  * a quiescent device that lives in the bootstrap but emits no realtime packet. The `known` flag separates a recognized-but-unreduced class (e.g. `aiport`) from genuine
77
96
  * drift the controller introduced; either way the signal exists so consumers see device classes the library does not yet project rather than silently absorbing it.
78
97
  */
79
- schemaUnmodeledCollection: diagnosticsChannel.channel("unifi-protect:schema:unmodeledCollection"),
98
+ schemaUnmodeledCollection: typed("unifi-protect:schema:unmodeledCollection"),
80
99
  /** A talkback (two-way audio) session closed and released its WebSocket. */
81
- talkbackSessionClosed: diagnosticsChannel.channel("unifi-protect:talkback:session:closed"),
100
+ talkbackSessionClosed: typed("unifi-protect:talkback:session:closed"),
82
101
  /** A talkback (two-way audio) session opened a WebSocket to a camera's speaker. */
83
- talkbackSessionOpened: diagnosticsChannel.channel("unifi-protect:talkback:session:opened")
102
+ talkbackSessionOpened: typed("unifi-protect:talkback:session:opened")
84
103
  };
104
+ export function subscribeToChannel(channel, handler) {
105
+ channel.subscribe(handler);
106
+ return { [Symbol.dispose]: () => channel.unsubscribe(handler) };
107
+ }
85
108
  //# sourceMappingURL=diagnostics.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAKA,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAE1D;;;;;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,EAAE,KAAK,CAA+B,sCAAsC,CAAC;IAElG;;;;OAIG;IACH,yBAAyB,EAAE,KAAK,CAAmC,0CAA0C,CAAC;IAE9G,4EAA4E;IAC5E,qBAAqB,EAAE,KAAK,CAA+B,uCAAuC,CAAC;IAEnG,mFAAmF;IACnF,qBAAqB,EAAE,KAAK,CAA+B,uCAAuC,CAAC;CAC3F,CAAC;AAkCX,MAAM,UAAU,kBAAkB,CAAC,OAA2C,EAAE,OAAmC;IAEjH,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAE3B,OAAO,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,GAAS,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC;AACxE,CAAC"}
package/dist/errors.d.ts CHANGED
@@ -180,7 +180,8 @@ export declare class ProtectProtocolError extends FatalError {
180
180
  *
181
181
  * @returns Never returns - always throws.
182
182
  *
183
- * @throws {@link ProtectProtocolError} always, naming the unhandled variant's tag.
183
+ * @throws {@link ProtectProtocolError} always, naming the unhandled variant's `kind` when the variant is an object that carries one, or the variant's coerced
184
+ * string form otherwise.
184
185
  *
185
186
  * @category Errors
186
187
  */
@@ -201,18 +202,20 @@ export declare class ProtectBootstrapError extends FatalError {
201
202
  });
202
203
  }
203
204
  /**
204
- * The stages of the `connect()` sequence, used to tag a {@link ProtectBootstrapError}. The sequence authenticates, fetches the bootstrap document, parses it,
205
- * then subscribes to the realtime stream; only the fetch and parse stages are wrapped as a bootstrap error, because a login or reachability failure already propagates as
206
- * its own typed fatal (`ProtectAuthError` / `ProtectNetworkError`).
205
+ * The stages of the `connect()` sequence, used to tag a {@link ProtectBootstrapError}. The sequence authenticates, fetches the bootstrap document, parses it, then
206
+ * subscribes to the realtime stream; only the fetch and parse stages are wrapped as a bootstrap error. A login or reachability failure already propagates as its
207
+ * own typed fatal (`ProtectAuthError` / `ProtectNetworkError`), and a failure to open the realtime subscription propagates unwrapped rather than tagged with any
208
+ * stage, so `"login"` and `"subscribe"` name stages of the sequence without either one being a tag a caller will observe on a thrown `ProtectBootstrapError`.
207
209
  *
208
210
  * @category Errors
209
211
  */
210
212
  export type ProtectBootstrapStage = "fetch" | "login" | "parse" | "subscribe";
211
213
  /**
212
214
  * A pooled livestream reconnected and the controller negotiated a different codec than the one in flight (H.264 to HEVC, or a channel reconfigured mid-stream). Fatal
213
- * because no fixed-codec consumer can adapt in place: an FFmpeg pipe cannot re-initialize, and HKSV tolerates no second init segment. The pool surfaces this as the one
214
- * terminal a recovering stream can raise, after which the consumer re-subscribes for a fresh stream against the new codec. The `from` / `to` descriptors are the RFC 6381
215
- * codec strings the two init segments carried, so a consumer can log precisely what changed.
215
+ * because no fixed-codec consumer can adapt in place: an FFmpeg pipe cannot re-initialize, and HKSV tolerates no second init segment. The pool surfaces this as a
216
+ * terminal a recovering stream can raise - alongside {@link ProtectLivestreamUnavailableError} when the recovery policy gives up instead - after which the consumer
217
+ * re-subscribes for a fresh stream against the new codec. The `from` / `to` descriptors are the RFC 6381 codec strings the two init segments carried, so a consumer
218
+ * can log precisely what changed.
216
219
  *
217
220
  * @category Errors
218
221
  */
@@ -228,7 +231,7 @@ export declare class ProtectCodecChangeError extends FatalError {
228
231
  });
229
232
  }
230
233
  /**
231
- * A pooled livestream's recovery policy gave up. The `phase` names which of the two regimes the pool runs: `establishing` means the first segment never arrived within
234
+ * A pooled livestream's recovery policy gave up. The `phase` names which regime the pool gave up in: `establishing` means the first segment never arrived within
232
235
  * the bounded establishment deadline (the stream that never produced media), and `recovering` means a previously-live stream could not be re-established and the policy
233
236
  * elected to stop. Fatal because the policy - the single authority over whether to keep trying - has declared the stream unrecoverable; the consumer re-subscribes if it
234
237
  * still wants the stream. `attempts` carries how many consecutive reconnect attempts the episode made before the policy returned `giveUp`.
@@ -263,24 +266,25 @@ export declare class ProtectUnsupportedError extends FatalError {
263
266
  });
264
267
  }
265
268
  /**
266
- * Project-wide options bag for `util.inspect` calls used in logs, debug dumps, and CLI output. Centralizing the shape here means a future change to the
267
- * diagnostic formatting (disabling colors when stdout isn't a TTY, bounding `depth`, adding `breakLength` for tight log lines) lands in one place rather than
268
- * across every call site.
269
+ * A `util.inspect` options bag for diagnostic formatting - logs, debug dumps, and CLI output: stable colors, unlimited depth, and sorted object keys. A call site
270
+ * that imports this constant instead of writing its own options literal gets a formatting change (disabling colors when stdout isn't a TTY, bounding `depth`,
271
+ * adding `breakLength` for tight log lines) for free the next time this bag is updated.
269
272
  *
270
273
  * @category Utilities
271
274
  */
272
275
  export declare const INSPECT_OPTIONS: InspectOptions;
273
276
  /**
274
- * Predicate for the WebSocket-error-handler suppression rule shared by the realtime events WS and the livestream WS.
277
+ * Predicate for the WebSocket-error-handler suppression rule shared by every WebSocket subsystem in the library - the realtime events WS, the livestream WS, and
278
+ * the talkback WS.
275
279
  *
276
- * Both subsystems classify two error shapes as expected disconnects rather than user-actionable errors:
280
+ * Each subsystem classifies an undici teardown `TypeError` and an `ETIMEDOUT` errno as expected disconnects rather than user-actionable errors:
277
281
  *
278
282
  * 1. A `TypeError` from undici's internal WebSocket teardown - the error class undici raises when the socket closes mid-frame during a disconnect.
279
- * 2. An `ETIMEDOUT` errno on the cause chain - the slow-controller path. Both subsystems run their own silence watchdog (the events WS against
280
- * `PROTECT_EVENTS_WATCHDOG_TIMEOUT`, a livestream session against its heartbeat timeout) that reports prolonged silence separately; this predicate instead classifies
281
- * the socket-level errno, so the two are complementary and logging this disconnect-during-reboot symptom at the error level would be duplicate noise.
283
+ * 2. An `ETIMEDOUT` errno on the cause chain - the slow-controller path. The events and livestream subsystems each run their own silence watchdog (the events WS
284
+ * against `PROTECT_EVENTS_WATCHDOG_TIMEOUT`, a livestream session against its heartbeat timeout) that reports prolonged silence separately; this predicate instead
285
+ * classifies the socket-level errno, so the two are complementary and logging this disconnect-during-reboot symptom at the error level would be duplicate noise.
282
286
  *
283
- * Centralizing the predicate means a future addition (`EPIPE`, `ECONNRESET`, etc.) lands in one place and both WebSocket subsystems pick it up identically.
287
+ * Centralizing the predicate means a future addition (`EPIPE`, `ECONNRESET`, etc.) lands in one place and every WebSocket subsystem picks it up identically.
284
288
  *
285
289
  * @param error - The error value to classify. Typed `unknown` because WebSocket `ErrorEvent.error` is untyped at the contract level.
286
290
  *
@@ -292,7 +296,7 @@ export declare function isExpectedWsDisconnect(error: unknown): boolean;
292
296
  /**
293
297
  * Safely resolve an unknown error to a Node `ErrnoException` shape.
294
298
  *
295
- * Two error shapes are recognized:
299
+ * The following error shapes are recognized:
296
300
  *
297
301
  * 1. An `Error` whose `cause` chain wraps a Node `ErrnoException`. Undici raises this shape from upstream connection errors (DNS, TCP, TLS), where the surface
298
302
  * error is the generic `TypeError("fetch failed")` and the actual errno data lives one hop down the cause chain.
@@ -301,8 +305,9 @@ export declare function isExpectedWsDisconnect(error: unknown): boolean;
301
305
  * Both shapes are validated to require `code` as a string before returning, guarding against the (rare but legal) case where an Error has a `code` property of a
302
306
  * non-string type. A non-string `code` would otherwise satisfy a downstream `code === "ECONNREFUSED"` comparison only by accident of `===` semantics.
303
307
  *
304
- * Anything outside these two shapes (locally thrown TypeErrors with no cause, custom errors without `code`, non-Error throws) returns `undefined`. Callers handle
305
- * that case by logging the unknown error directly via `util.inspect`.
308
+ * Anything outside these shapes (locally thrown TypeErrors with no cause, custom errors without `code`, non-Error throws) returns `undefined`. Internal callers
309
+ * such as `ProtectNetworkError`'s constructor and `isExpectedWsDisconnect` treat that as no matching code and continue past it via optional chaining, rather than
310
+ * treating the absence as an error condition in its own right.
306
311
  *
307
312
  * @param error - The error value to inspect. Typed `unknown` because catch bindings and event handlers receive untyped values.
308
313
  *
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD;;;;;;;;;;;;;;;;GAgBG;AACH,8BAAsB,YAAa,SAAQ,KAAK;IAK9C,SAAS,aA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