unifi-protect 4.23.0 → 4.25.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/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  /** @internal */
2
- export { FetchError } from "@adobe/fetch";
3
2
  export * from "./protect-api.js";
4
3
  export type { ProtectLivestream } from "./protect-api-livestream.js";
5
4
  export { ProtectApiEvents, ProtectEventPacket } from "./protect-api-events.js";
package/dist/index.js CHANGED
@@ -3,8 +3,6 @@
3
3
  * index.ts: UniFi Protect API registration.
4
4
  */
5
5
  /** @internal */
6
- // Export our support types.
7
- export { FetchError } from "@adobe/fetch";
8
6
  // Export our API.
9
7
  export * from "./protect-api.js";
10
8
  export { ProtectApiEvents } from "./protect-api-events.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,gBAAgB;AAEhB,4BAA4B;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,kBAAkB;AAClB,cAAc,kBAAkB,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAsB,MAAM,yBAAyB,CAAC;AAC/E,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,gBAAgB;AAEhB,kBAAkB;AAClB,cAAc,kBAAkB,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAsB,MAAM,yBAAyB,CAAC;AAC/E,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC"}
@@ -6,6 +6,7 @@ import { Readable } from "node:stream";
6
6
  /**
7
7
  * Options for configuring a livestream session.
8
8
  *
9
+ * @property emitTimestamps - Optionally emit the decode timestamps of frames as timestamp events. This is the same information that appears in `tfdt` boxes.
9
10
  * @property lens - Optionally specify alternate cameras on a Protect device, such as a package camera.
10
11
  * @property segmentLength - Optionally specify the segment length, in milliseconds, of each fMP4 segment. Defaults to 100ms.
11
12
  * @property requestId - Optionally specify a request ID to the Protect controller. This is primarily used for logging purposes.
@@ -13,6 +14,7 @@ import { Readable } from "node:stream";
13
14
  * Defaults to false.
14
15
  */
15
16
  export interface LivestreamOptions {
17
+ emitTimestamps: boolean;
16
18
  lens: number;
17
19
  requestId: string;
18
20
  segmentLength: number;
@@ -38,14 +40,12 @@ export declare class ProtectLivestream extends EventEmitter {
38
40
  private _codec;
39
41
  private _stream;
40
42
  private api;
41
- private dataHandler;
42
43
  private errorHandler;
43
44
  private heartbeat;
44
- private isStopping;
45
45
  private lastMessage;
46
46
  private log;
47
+ private messageHandler;
47
48
  private ws;
48
- private wsStream;
49
49
  constructor(api: ProtectApi, log: ProtectLogging);
50
50
  /**
51
51
  * Start an fMP4 livestream session from the Protect controller.
@@ -66,6 +66,7 @@ export declare class ProtectLivestream extends EventEmitter {
66
66
  * | `initsegment` | An fMP4 initialization segment has been received. The segment will be passed as an argument to any listeners. |
67
67
  * | `message` | An fMP4 segment has been received. No distinction is made between segment types. The segment will be passed as an argument to any listeners. |
68
68
  * | `segment` | A non-initialization fMP4 segment has been received. The segment will be passed as an argument to any listeners. |
69
+ * | `timestamp` | A `BigInt` representing the decode timestamp of frames. It mirrors what is provided in the `tfdt` box in fMP4 segments. |
69
70
  */
70
71
  start(cameraId: string, channel: number, options?: Partial<LivestreamOptions>): Promise<boolean>;
71
72
  /**
@@ -41,14 +41,15 @@
41
41
  * @module ProtectLivestream
42
42
  */
43
43
  /* eslint-enable @stylistic/max-len */
44
- import WebSocket, { createWebSocketStream } from "ws";
44
+ import { Agent, WebSocket } from "undici";
45
45
  import events, { EventEmitter } from "node:events";
46
46
  import { PROTECT_API_TIMEOUT } from "./settings.js";
47
47
  import { Readable } from "node:stream";
48
+ import util from "node:util";
48
49
  // A complete description of the UniFi Protect livestream API websocket API.
49
50
  var ProtectLiveFrame;
50
51
  (function (ProtectLiveFrame) {
51
- ProtectLiveFrame[ProtectLiveFrame["KEYFRAME"] = 247] = "KEYFRAME";
52
+ ProtectLiveFrame[ProtectLiveFrame["TIMESTAMP"] = 247] = "TIMESTAMP";
52
53
  ProtectLiveFrame[ProtectLiveFrame["CODECINFORMATION"] = 248] = "CODECINFORMATION";
53
54
  ProtectLiveFrame[ProtectLiveFrame["BEGINSEGMENT"] = 249] = "BEGINSEGMENT";
54
55
  ProtectLiveFrame[ProtectLiveFrame["INITSEGMENT"] = 250] = "INITSEGMENT";
@@ -78,14 +79,12 @@ export class ProtectLivestream extends EventEmitter {
78
79
  _codec;
79
80
  _stream;
80
81
  api;
81
- dataHandler;
82
82
  errorHandler;
83
83
  heartbeat;
84
- isStopping;
85
84
  lastMessage;
86
85
  log;
86
+ messageHandler;
87
87
  ws;
88
- wsStream;
89
88
  // Create a new instance.
90
89
  constructor(api, log) {
91
90
  // Initialize the event emitter.
@@ -94,14 +93,12 @@ export class ProtectLivestream extends EventEmitter {
94
93
  this._initSegment = null;
95
94
  this._stream = null;
96
95
  this.api = api;
97
- this.dataHandler = null;
98
96
  this.errorHandler = null;
99
- this.isStopping = false;
97
+ this.heartbeat = null;
100
98
  this.lastMessage = 0;
101
99
  this.log = log;
102
- this.heartbeat = null;
100
+ this.messageHandler = null;
103
101
  this.ws = null;
104
- this.wsStream = null;
105
102
  }
106
103
  /**
107
104
  * Start an fMP4 livestream session from the Protect controller.
@@ -122,8 +119,10 @@ export class ProtectLivestream extends EventEmitter {
122
119
  * | `initsegment` | An fMP4 initialization segment has been received. The segment will be passed as an argument to any listeners. |
123
120
  * | `message` | An fMP4 segment has been received. No distinction is made between segment types. The segment will be passed as an argument to any listeners. |
124
121
  * | `segment` | A non-initialization fMP4 segment has been received. The segment will be passed as an argument to any listeners. |
122
+ * | `timestamp` | A `BigInt` representing the decode timestamp of frames. It mirrors what is provided in the `tfdt` box in fMP4 segments. |
125
123
  */
126
124
  async start(cameraId, channel, options = {}) {
125
+ options.emitTimestamps ??= false;
127
126
  options.lens ??= 0;
128
127
  options.requestId ??= cameraId + "-" + channel.toString();
129
128
  options.segmentLength ??= 100;
@@ -132,8 +131,6 @@ export class ProtectLivestream extends EventEmitter {
132
131
  this.stop();
133
132
  // Clear out the initialization segment.
134
133
  this._initSegment = null;
135
- // Clear out our stopping state.
136
- this.isStopping = false;
137
134
  // Launch the livestream.
138
135
  return this.launchLivestream(cameraId, channel, options);
139
136
  }
@@ -142,20 +139,13 @@ export class ProtectLivestream extends EventEmitter {
142
139
  */
143
140
  stop() {
144
141
  // Close the websocket.
145
- if ((this.ws?.readyState === WebSocket.CLOSING) || (this.ws?.readyState === WebSocket.OPEN)) {
146
- this.ws?.terminate();
147
- }
148
- // Destroy the underlying WebSocket stream if it exists.
149
- if (this.wsStream) {
150
- if (this.dataHandler) {
151
- this.wsStream.removeListener("data", this.dataHandler);
152
- this.dataHandler = null;
153
- }
154
- this.wsStream.destroy();
155
- this.wsStream = null;
142
+ this.ws?.close();
143
+ if (this.messageHandler) {
144
+ this.ws?.removeEventListener("message", this.messageHandler);
145
+ this.messageHandler = null;
156
146
  }
157
147
  if (this.errorHandler) {
158
- this.ws?.removeListener("error", this.errorHandler);
148
+ this.ws?.removeEventListener("error", this.errorHandler);
159
149
  this.errorHandler = null;
160
150
  }
161
151
  // If we've created a stream, end it gracefully.
@@ -191,13 +181,15 @@ export class ProtectLivestream extends EventEmitter {
191
181
  allowPartialGOP: "",
192
182
  camera: cameraId,
193
183
  channel: channel.toString(),
194
- extendedVideoMetadata: "", // Try excluding?
184
+ chunkSize: "4096",
185
+ ...(options.emitTimestamps ? { extendedVideoMetadata: "" } : {}),
195
186
  fragmentDurationMillis: options.segmentLength.toString(),
196
187
  lens: options.lens.toString(),
197
188
  progressive: "",
198
189
  rebaseTimestampsToZero: "true",
199
190
  requestId: options.requestId,
200
- type: "fmp4"
191
+ type: "fmp4",
192
+ useWallClock: "false"
201
193
  });
202
194
  // Get the websocket endpoint URL from Protect.
203
195
  const wsUrl = await this.api.getWsEndpoint("livestream", params);
@@ -207,8 +199,9 @@ export class ProtectLivestream extends EventEmitter {
207
199
  return false;
208
200
  }
209
201
  try {
210
- // Open the livestream websocket.
211
- this.ws = new WebSocket(wsUrl, { rejectUnauthorized: false });
202
+ // Open the livestream WebSocket. We create a new dispatcher here because WebSocket upgrades can only happen over HTTP/1.1 and we've asked for HTTP/2 whenever
203
+ // possible in our global pool.
204
+ this.ws = new WebSocket(wsUrl, { dispatcher: new Agent({ connect: { rejectUnauthorized: false } }) });
212
205
  if (!this.ws) {
213
206
  this.ws = null;
214
207
  logError("unable to connect to the livestream websocket API endpoint.");
@@ -222,9 +215,7 @@ export class ProtectLivestream extends EventEmitter {
222
215
  });
223
216
  }
224
217
  // Start our heartbeat once we've opened the connection.
225
- this.ws?.once("open", () => {
226
- // Create a Readable stream from the WebSocket to consume incoming messages as a stream.
227
- this.wsStream = createWebSocketStream(this.ws);
218
+ this.ws?.addEventListener("open", () => {
228
219
  this.lastMessage = Date.now();
229
220
  // Heartbeat the controller. We need this because if we don't heartbeat the controller, it can sometimes just decide not to give us a livestream to work with, or
230
221
  // lockup due to regressions in the controller firmware. This ensures we can never hang waiting on data from the API, especially in a livestream scenario.
@@ -241,45 +232,32 @@ export class ProtectLivestream extends EventEmitter {
241
232
  if ((Date.now() - this.lastMessage) > PROTECT_API_TIMEOUT) {
242
233
  logError("the livestream API is not responding.");
243
234
  if ((this.ws?.readyState === WebSocket.CLOSING) || (this.ws?.readyState === WebSocket.OPEN)) {
244
- this.ws?.terminate();
235
+ this.ws?.close();
245
236
  }
246
237
  }
247
238
  }, PROTECT_API_TIMEOUT);
248
239
  // Process packets coming to our websocket.
249
240
  this.processLivestream();
250
- });
241
+ }, { once: true });
251
242
  // Catch any errors and inform the user, if needed.
252
- this.ws?.once("error", this.errorHandler = (error) => {
243
+ this.ws?.addEventListener("error", this.errorHandler = (event) => {
244
+ const error = event.error;
253
245
  // Ignore timeout errors, but notify the user about anything else.
254
246
  if (error.code !== "ETIMEDOUT") {
255
247
  logError("error while communicating with the livestream websocket API: %s", error);
248
+ logError(util.inspect(error, { colors: true, depth: null, sorted: true }));
256
249
  }
257
250
  this.stop();
258
- });
259
- this.ws?.once("close", (code) => {
251
+ }, { once: true });
252
+ this.ws?.addEventListener("close", () => {
260
253
  // Clear out our heartbeat since we're closing.
261
254
  if (this.heartbeat) {
262
255
  clearInterval(this.heartbeat);
263
256
  this.heartbeat = null;
264
257
  }
265
- switch (code) {
266
- // The websocket has been closed normally. We fire off a close event to inform our listeners and we're done.
267
- case 1005:
268
- this.isStopping = true;
269
- this.stop();
270
- this.emit("close");
271
- break;
272
- // The websocket has been forcibly closed by us. Ignore it.
273
- case 1006:
274
- break;
275
- default:
276
- logError("unknown livestream API websocket error. Error code: %s.", code);
277
- break;
278
- }
279
- if (!this.isStopping) {
280
- this.emit("close");
281
- }
282
- });
258
+ this.stop();
259
+ this.emit("close");
260
+ }, { once: true });
283
261
  }
284
262
  catch (error) {
285
263
  logError("error while connecting to the livestream websocket API: %s", error);
@@ -290,21 +268,49 @@ export class ProtectLivestream extends EventEmitter {
290
268
  // Process fMP4 packets as they arrive over the websocket.
291
269
  processLivestream() {
292
270
  // Check to ensure our websocket is live.
293
- if (!this.wsStream) {
271
+ if (!this.ws) {
294
272
  return;
295
273
  }
274
+ // Track the segment under construction.
296
275
  let currentSegment = {
297
276
  audio: Buffer.alloc(0),
298
- keyframe: Buffer.alloc(0),
299
277
  mdat: Buffer.alloc(0),
300
278
  moof: Buffer.alloc(0),
301
279
  video: Buffer.alloc(0)
302
280
  };
281
+ // Keep any tail bytes that didn't form a full packet yet.
303
282
  let packetRemaining = Buffer.alloc(0);
304
283
  // Process data coming in from the websocket.
305
- this.wsStream.on("data", this.dataHandler = (packet) => {
284
+ this.ws.addEventListener("message", this.messageHandler = async (event) => {
306
285
  // Update our heartbeat.
307
286
  this.lastMessage = Date.now();
287
+ // We need to normalize event.data into an ArrayBuffer so we can process it.
288
+ let ab;
289
+ try {
290
+ if (event.data instanceof Blob) {
291
+ ab = await event.data.arrayBuffer();
292
+ }
293
+ else if (event.data instanceof ArrayBuffer) {
294
+ ab = event.data;
295
+ }
296
+ else if (typeof event.data === "string") {
297
+ ab = new TextEncoder().encode(event.data).buffer;
298
+ }
299
+ else {
300
+ this.log.error("Unsupported WebSocket message type: %s", typeof event.data);
301
+ this.ws?.close();
302
+ return;
303
+ }
304
+ }
305
+ catch (error) {
306
+ this.log.error("Error processing livestream WebSocket message: ", error);
307
+ this.ws?.close();
308
+ }
309
+ if (!ab) {
310
+ return;
311
+ }
312
+ // Prepend any leftover partial packet.
313
+ let packet = Buffer.from(ab);
308
314
  // If we have anything left from the last packet we processed, prepend it to this packet.
309
315
  if (packetRemaining.length > 0) {
310
316
  packet = Buffer.concat([packetRemaining, packet]);
@@ -318,14 +324,14 @@ export class ProtectLivestream extends EventEmitter {
318
324
  packetRemaining = packet.subarray(offset);
319
325
  break;
320
326
  }
321
- // Read the packet header.
327
+ // Read the one-byte packet header.
322
328
  const header = packet.readUInt8(offset);
323
329
  // Validate our header before we do anything else.
324
330
  if (!Object.values(ProtectLiveFrame).includes(header)) {
325
331
  this.log.error("Invalid header found while decoding the livestream: %s", header);
326
332
  break;
327
333
  }
328
- // Protect encodes the length of the entire fMP4 segment in the first three bytes of the header.
334
+ // Protect encodes the length of the entire fMP4 segment in the first three bytes (big-endian) of the header.
329
335
  const length = ((packet.readUInt8(offset + 1) << 8) | packet.readUInt8(offset + 2)) << 8 | packet.readUInt8(offset + 3);
330
336
  // Once we know our length, if we don't have the complete packet, we save it and punt until we see more data come across.
331
337
  if (packet.length < offset + 4 + length) {
@@ -369,7 +375,6 @@ export class ProtectLivestream extends EventEmitter {
369
375
  case ProtectLiveFrame.BEGINSEGMENT:
370
376
  currentSegment = {
371
377
  audio: Buffer.alloc(0),
372
- keyframe: Buffer.alloc(0),
373
378
  mdat: Buffer.alloc(0),
374
379
  moof: Buffer.alloc(0),
375
380
  video: Buffer.alloc(0)
@@ -386,11 +391,10 @@ export class ProtectLivestream extends EventEmitter {
386
391
  this.emit("message", this._initSegment);
387
392
  }
388
393
  break;
389
- // We've got a keyframe. Add it to our current segment.
390
- case ProtectLiveFrame.KEYFRAME:
391
- currentSegment.keyframe = data;
392
- if (!this._stream) {
393
- this.emit("keyframe", data);
394
+ // We've got a timestamp packet. Protect sends over decode timestamps identical to what's in the tfdt box in the segment.
395
+ case ProtectLiveFrame.TIMESTAMP:
396
+ for (let offset = 0; offset < data.length; offset += 8) {
397
+ this.emit("timestamp", data.readBigUInt64BE(offset));
394
398
  }
395
399
  break;
396
400
  // MDAT box. Add it to the MDAT portion of our segment.
@@ -1 +1 @@
1
- {"version":3,"file":"protect-api-livestream.js","sourceRoot":"","sources":["../src/protect-api-livestream.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,uCAAuC;AACvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,sCAAsC;AACtC,OAAO,SAAS,EAAE,EAAE,qBAAqB,EAAE,MAAM,IAAI,CAAC;AACtD,OAAO,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGpD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,4EAA4E;AAC5E,IAAK,gBAWJ;AAXD,WAAK,gBAAgB;IAEnB,iEAAc,CAAA;IACd,iFAAsB,CAAA;IACtB,yEAAkB,CAAA;IAClB,uEAAiB,CAAA;IACjB,yDAAU,CAAA;IACV,2DAAW,CAAA;IACX,2DAAW,CAAA;IACX,yDAAU,CAAA;IACV,qEAAgB,CAAA;AAClB,CAAC,EAXI,gBAAgB,KAAhB,gBAAgB,QAWpB;AAmBD;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,iBAAkB,SAAQ,YAAY;IAEzC,YAAY,CAAmB;IAC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wBAEnE,MAAM;oBAER,uDAAuD;oBACvD,KAAK,gBAAgB,CAAC,KAAK;wBAEzB,cAAc,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAE,cAAc,CAAC,KAAK,EAAE,IAAI,CAAE,CAAC,CAAC;wBAErE,MAAM;oBAER,oEAAoE;oBACpE;wBAEE,MAAM;gBACV,CAAC;gBAED,iEAAiE;gBACjE,MAAM,GAAG,OAAO,CAAC;YACnB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,cAAc;QAEzB,yCAAyC;QACzC,IAAG,IAAI,CAAC,WAAW,EAAE,CAAC;YAEpB,OAAO,IAAI,CAAC,WAAW,CAAC;QAC1B,CAAC;QAED,oEAAoE;QACpE,MAAM,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;QAEvC,OAAO,IAAI,CAAC,cAAc,EAAE,CAAC;IAC/B,CAAC;IAED;;;;OAIG;IACH,IAAW,WAAW;QAEpB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED;;;;;;;;OAQG;IACH,IAAW,KAAK;QAEd,OAAO,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACH,IAAW,MAAM;QAEf,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF"}
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * @module ProtectApi
8
8
  */
9
- import { type RequestOptions, type Response } from "@adobe/fetch";
9
+ import { type Dispatcher } from "undici";
10
10
  import type { Nullable, ProtectCameraConfig, ProtectCameraConfigInterface, ProtectCameraConfigPayload, ProtectChimeConfig, ProtectChimeConfigPayload, ProtectLightConfig, ProtectLightConfigPayload, ProtectNvrBootstrap, ProtectNvrConfig, ProtectNvrConfigPayload, ProtectSensorConfig, ProtectSensorConfigPayload, ProtectViewerConfig, ProtectViewerConfigPayload } from "./protect-types.js";
11
11
  import { EventEmitter } from "node:events";
12
12
  import { ProtectLivestream } from "./protect-api-livestream.js";
@@ -19,6 +19,20 @@ export type ProtectKnownDeviceTypes = ProtectCameraConfig | ProtectChimeConfig |
19
19
  * Define our known Protect device payload types.
20
20
  */
21
21
  export type ProtectKnownDevicePayloads = ProtectCameraConfigPayload | ProtectChimeConfigPayload | ProtectLightConfigPayload | ProtectNvrConfigPayload | ProtectSensorConfigPayload | ProtectViewerConfigPayload;
22
+ /**
23
+ * Configuration options for HTTP requests executed by `retrieve()`.
24
+ *
25
+ * @remarks Extends Undici’s [`Dispatcher.RequestOptions`](https://undici.nodejs.org/#/docs/api/Dispatcher.md?id=parameter-requestoptions), but omits the `origin` and
26
+ * `path` properties, since those are derived from the `url` argument passed to `retrieve()`. You can optionally supply a custom `Dispatcher` instance to control
27
+ * connection pooling, timeouts, etc.
28
+ */
29
+ export type RequestOptions = {
30
+ /**
31
+ * Optional custom Undici `Dispatcher` instance to use for this request. If omitted, the native `unifi-protect` dispatcher is used, which should be suitable for most
32
+ * use cases.
33
+ */
34
+ dispatcher?: Dispatcher;
35
+ } & Omit<Dispatcher.RequestOptions, "origin" | "path">;
22
36
  /**
23
37
  * Options to tailor the behavior of {@link ProtectApi.retrieve}.
24
38
  *
@@ -47,9 +61,10 @@ export declare class ProtectApi extends EventEmitter {
47
61
  private _eventsWs;
48
62
  private apiErrorCount;
49
63
  private apiLastSuccess;
50
- private fetch;
64
+ private dispatcher;
51
65
  private headers;
52
66
  private _isAdminUser;
67
+ private _isThrottled;
53
68
  private log;
54
69
  private nvrAddress;
55
70
  private password;
@@ -299,14 +314,25 @@ export declare class ProtectApi extends EventEmitter {
299
314
  * @returns Returns a promise that will resolve to a Response object successful, and `null` otherwise.
300
315
  *
301
316
  * @remarks This method should be used when direct access to the Protect controller is needed, or when this library doesn't have a needed method to access
302
- * controller capabilities. `options` must be a
303
- * [Fetch API compatible](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) request options object.
317
+ * controller capabilities. `options` must be an
318
+ * [Undici request API compatible](https://undici.nodejs.org/#/docs/api/Dispatcher.md?id=parameter-requestoptions) request options object which itself is an
319
+ * extension of [DispatchOptions](https://undici.nodejs.org/#/docs/api/Dispatcher.md?id=parameter-dispatchoptions).
304
320
  *
305
321
  * @category API Access
306
322
  */
307
- retrieve(url: string, options?: RequestOptions, retrieveOptions?: RetrieveOptions): Promise<Nullable<Response>>;
323
+ retrieve(url: string, options?: RequestOptions, retrieveOptions?: RetrieveOptions): Promise<Nullable<Dispatcher.ResponseData<unknown>>>;
308
324
  private _retrieve;
309
325
  private logRetry;
326
+ /**
327
+ * Determines whether a given HTTP status code represents a successful response.
328
+ *
329
+ * @param code - The HTTP status code returned by a request. If `undefined`, the response is considered not okay.
330
+ *
331
+ * @returns `true` if `code` is between 200 (inclusive) and 300 (exclusive); otherwise returns `false`.
332
+ *
333
+ * @category Utilities
334
+ */
335
+ responseOk(code?: number): boolean;
310
336
  /**
311
337
  * Return a new instance of the Protect livestream API.
312
338
  *