@stream-io/video-client 1.22.1 → 1.22.2

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.es.js CHANGED
@@ -299,6 +299,34 @@ const VideoSettingsResponseCameraFacingEnum = {
299
299
  };
300
300
 
301
301
  class ErrorFromResponse extends Error {
302
+ constructor({ message, code, status, response, unrecoverable, }) {
303
+ super(message);
304
+ this.name = 'ErrorFromResponse';
305
+ this.code = code;
306
+ this.response = response;
307
+ this.status = status;
308
+ this.unrecoverable = unrecoverable;
309
+ }
310
+ // Vitest helper (serialized errors are too large to read)
311
+ // https://github.com/vitest-dev/vitest/blob/v3.1.3/packages/utils/src/error.ts#L60-L62
312
+ toJSON() {
313
+ const extra = [
314
+ ['status', this.status],
315
+ ['code', this.code],
316
+ ['unrecoverable', this.unrecoverable],
317
+ ];
318
+ const joinable = [];
319
+ for (const [key, value] of extra) {
320
+ if (typeof value !== 'undefined' && value !== null) {
321
+ joinable.push(`${key}: ${value}`);
322
+ }
323
+ }
324
+ return {
325
+ message: `(${joinable.join(', ')}) - ${this.message}`,
326
+ stack: this.stack,
327
+ name: this.name,
328
+ };
329
+ }
302
330
  }
303
331
 
304
332
  // @generated by protobuf-ts 2.9.6 with parameter long_type_string,client_generic,server_none,eslint_disable,optimize_code_size
@@ -5653,7 +5681,7 @@ const aggregate = (stats) => {
5653
5681
  return report;
5654
5682
  };
5655
5683
 
5656
- const version = "1.22.1";
5684
+ const version = "1.22.2";
5657
5685
  const [major, minor, patch] = version.split('.');
5658
5686
  let sdkInfo = {
5659
5687
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -13694,13 +13722,13 @@ class StreamClient {
13694
13722
  };
13695
13723
  this.errorFromResponse = (response) => {
13696
13724
  const { data, status } = response;
13697
- const err = new ErrorFromResponse();
13698
- err.message = `Stream error code ${data.code}: ${data.message}`;
13699
- err.code = data.code;
13700
- err.unrecoverable = data.unrecoverable;
13701
- err.response = response;
13702
- err.status = status;
13703
- return err;
13725
+ return new ErrorFromResponse({
13726
+ message: `Stream error code ${data.code}: ${data.message}`,
13727
+ code: data.code ?? null,
13728
+ unrecoverable: data.unrecoverable ?? null,
13729
+ response: response,
13730
+ status: status,
13731
+ });
13704
13732
  };
13705
13733
  this.handleResponse = (response) => {
13706
13734
  const data = response.data;
@@ -13741,7 +13769,7 @@ class StreamClient {
13741
13769
  this.getUserAgent = () => {
13742
13770
  if (!this.cachedUserAgent) {
13743
13771
  const { clientAppIdentifier = {} } = this.options;
13744
- const { sdkName = 'js', sdkVersion = "1.22.1", ...extras } = clientAppIdentifier;
13772
+ const { sdkName = 'js', sdkVersion = "1.22.2", ...extras } = clientAppIdentifier;
13745
13773
  this.cachedUserAgent = [
13746
13774
  `stream-video-${sdkName}-v${sdkVersion}`,
13747
13775
  ...Object.entries(extras).map(([key, value]) => `${key}=${value}`),