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