videomail-client 10.0.5 → 10.0.6

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 CHANGED
@@ -3848,6 +3848,22 @@ function __webpack_require__(moduleId) {
3848
3848
  return getBrowser_browser;
3849
3849
  }
3850
3850
  /* ESM default export */ const getBrowser = getBrowser_getBrowser;
3851
+ function HTTPError_define_property(obj, key, value) {
3852
+ if (key in obj) Object.defineProperty(obj, key, {
3853
+ value: value,
3854
+ enumerable: true,
3855
+ configurable: true,
3856
+ writable: true
3857
+ });
3858
+ else obj[key] = value;
3859
+ return obj;
3860
+ }
3861
+ class HTTPError_HTTPError extends Error {
3862
+ constructor(...args){
3863
+ super(...args), HTTPError_define_property(this, "code", void 0), HTTPError_define_property(this, "status", void 0);
3864
+ }
3865
+ }
3866
+ /* ESM default export */ const HTTPError = HTTPError_HTTPError;
3851
3867
  function VideomailError_define_property(obj, key, value) {
3852
3868
  if (key in obj) Object.defineProperty(obj, key, {
3853
3869
  value: value,
@@ -3858,7 +3874,7 @@ function __webpack_require__(moduleId) {
3858
3874
  else obj[key] = value;
3859
3875
  return obj;
3860
3876
  }
3861
- class VideomailError extends Error {
3877
+ class VideomailError extends HTTPError {
3862
3878
  hasClass(name) {
3863
3879
  var _this_classList;
3864
3880
  return null === (_this_classList = this.classList) || void 0 === _this_classList ? void 0 : _this_classList.includes(name);
@@ -4044,6 +4060,10 @@ function __webpack_require__(moduleId) {
4044
4060
  err
4045
4061
  };
4046
4062
  const videomailError = new error_VideomailError(null != message ? message : "(undefined message)", options, classList, errData);
4063
+ if (err) {
4064
+ videomailError.status = err.status;
4065
+ videomailError.code = err.code;
4066
+ }
4047
4067
  if (options.reportErrors) {
4048
4068
  const resource = new src_resource(options);
4049
4069
  resource.reportError(videomailError).catch((reason)=>{
@@ -4429,11 +4449,13 @@ function __webpack_require__(moduleId) {
4429
4449
  if ("error" in body) {
4430
4450
  const message = body.error.message;
4431
4451
  const cause = body.error.cause;
4432
- const error = new Error(message, {
4452
+ const error = new HTTPError(message, {
4433
4453
  cause
4434
4454
  });
4435
4455
  if (body.error.name) error.name = body.error.name;
4436
4456
  if (body.error.stack) error.stack = body.error.stack;
4457
+ if (body.error.status) error.status = body.error.status;
4458
+ if (body.error.code) error.code = body.error.code;
4437
4459
  return error;
4438
4460
  }
4439
4461
  }
@@ -5771,7 +5793,7 @@ function __webpack_require__(moduleId) {
5771
5793
  const external_is_power_of_two_namespaceObject = require("is-power-of-two");
5772
5794
  var external_is_power_of_two_default = /*#__PURE__*/ __webpack_require__.n(external_is_power_of_two_namespaceObject);
5773
5795
  var package_namespaceObject = {
5774
- i8: "10.0.4"
5796
+ i8: "10.0.6"
5775
5797
  }; // CONCATENATED MODULE: ./src/types/env.ts
5776
5798
  // ... and these actually define the runtime mode of Node.js and are
5777
5799
  // set either in package.json, via Jest or in the Dockerfile
@@ -8814,7 +8836,7 @@ function __webpack_require__(moduleId) {
8814
8836
  return "test" === isTest_process.env.ENVIRON;
8815
8837
  }
8816
8838
  /* ESM default export */ const isTest = isTest_isTest;
8817
- function mergeWithDefaultOptions() {
8839
+ function mergeWithDefaultOptions_mergeWithDefaultOptions() {
8818
8840
  let options = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
8819
8841
  const newOptions = external_deepmerge_default()(src_options, options, {
8820
8842
  arrayMerge (_destination, source) {
@@ -8827,7 +8849,7 @@ function __webpack_require__(moduleId) {
8827
8849
  if (isTest()) newOptions.verbose = false;
8828
8850
  return newOptions;
8829
8851
  }
8830
- /* ESM default export */ const options_mergeWithDefaultOptions = mergeWithDefaultOptions;
8852
+ /* ESM default export */ const mergeWithDefaultOptions = mergeWithDefaultOptions_mergeWithDefaultOptions;
8831
8853
  function client_define_property(obj, key, value) {
8832
8854
  if (key in obj) Object.defineProperty(obj, key, {
8833
8855
  value: value,
@@ -8924,7 +8946,7 @@ function __webpack_require__(moduleId) {
8924
8946
  if (this.options.logger.getLines) return this.options.logger.getLines();
8925
8947
  }
8926
8948
  constructor(options = {}){
8927
- super("VideomailClient", options_mergeWithDefaultOptions(options)), client_define_property(this, "container", void 0);
8949
+ super("VideomailClient", mergeWithDefaultOptions(options)), client_define_property(this, "container", void 0);
8928
8950
  this.validateOptions();
8929
8951
  util_Despot.removeAllListeners();
8930
8952
  this.container = new wrappers_container(this.options);
package/dist/index.js CHANGED
@@ -3781,7 +3781,12 @@ function getBrowser_getBrowser(localOptions) {
3781
3781
  return getBrowser_browser;
3782
3782
  }
3783
3783
  /* ESM default export */ const getBrowser = getBrowser_getBrowser;
3784
- class VideomailError extends Error {
3784
+ class HTTPError extends Error {
3785
+ code;
3786
+ status;
3787
+ }
3788
+ /* ESM default export */ const error_HTTPError = HTTPError;
3789
+ class VideomailError extends error_HTTPError {
3785
3790
  title = "videomail-client error";
3786
3791
  location = window.location.href;
3787
3792
  explanation;
@@ -3981,6 +3986,10 @@ function createError(errorParams) {
3981
3986
  err
3982
3987
  };
3983
3988
  const videomailError = new error_VideomailError(message ?? "(undefined message)", options, classList, errData);
3989
+ if (err) {
3990
+ videomailError.status = err.status;
3991
+ videomailError.code = err.code;
3992
+ }
3984
3993
  if (options.reportErrors) {
3985
3994
  const resource = new src_resource(options);
3986
3995
  resource.reportError(videomailError).catch((reason)=>{
@@ -4330,11 +4339,13 @@ function findOriginalExc(exc) {
4330
4339
  if ("error" in body) {
4331
4340
  const message = body.error.message;
4332
4341
  const cause = body.error.cause;
4333
- const error = new Error(message, {
4342
+ const error = new error_HTTPError(message, {
4334
4343
  cause
4335
4344
  });
4336
4345
  if (body.error.name) error.name = body.error.name;
4337
4346
  if (body.error.stack) error.stack = body.error.stack;
4347
+ if (body.error.status) error.status = body.error.status;
4348
+ if (body.error.code) error.code = body.error.code;
4338
4349
  return error;
4339
4350
  }
4340
4351
  }
@@ -5555,7 +5566,7 @@ function isPromise_isPromise(anything) {
5555
5566
  }
5556
5567
  /* ESM default export */ const isPromise = isPromise_isPromise;
5557
5568
  var package_namespaceObject = {
5558
- i8: "10.0.4"
5569
+ i8: "10.0.6"
5559
5570
  }; // CONCATENATED MODULE: ./src/types/env.ts
5560
5571
  // ... and these actually define the runtime mode of Node.js and are
5561
5572
  // set either in package.json, via Jest or in the Dockerfile
@@ -8504,7 +8515,7 @@ function isTest_isTest() {
8504
8515
  return "test" === isTest_process.env.ENVIRON;
8505
8516
  }
8506
8517
  /* ESM default export */ const isTest = isTest_isTest;
8507
- function mergeWithDefaultOptions(options = {}) {
8518
+ function mergeWithDefaultOptions_mergeWithDefaultOptions(options = {}) {
8508
8519
  const newOptions = (0, __WEBPACK_EXTERNAL_MODULE_deepmerge__["default"])(src_options, options, {
8509
8520
  arrayMerge (_destination, source) {
8510
8521
  return source;
@@ -8516,13 +8527,13 @@ function mergeWithDefaultOptions(options = {}) {
8516
8527
  if (isTest()) newOptions.verbose = false;
8517
8528
  return newOptions;
8518
8529
  }
8519
- /* ESM default export */ const options_mergeWithDefaultOptions = mergeWithDefaultOptions;
8530
+ /* ESM default export */ const mergeWithDefaultOptions = mergeWithDefaultOptions_mergeWithDefaultOptions;
8520
8531
  class VideomailClient extends util_Despot {
8521
8532
  container;
8522
8533
  static ENC_TYPE_APP_JSON = constants.public.ENC_TYPE_APP_JSON;
8523
8534
  static ENC_TYPE_FORM = constants.public.ENC_TYPE_FORM;
8524
8535
  constructor(options = {}){
8525
- super("VideomailClient", options_mergeWithDefaultOptions(options));
8536
+ super("VideomailClient", mergeWithDefaultOptions(options));
8526
8537
  this.validateOptions();
8527
8538
  util_Despot.removeAllListeners();
8528
8539
  this.container = new wrappers_container(this.options);
@@ -0,0 +1,5 @@
1
+ declare class HTTPError extends Error {
2
+ code?: string | undefined;
3
+ status?: number | undefined;
4
+ }
5
+ export default HTTPError;
@@ -1,11 +1,12 @@
1
1
  import { IBrowser, ICPU, IDevice, IEngine, IOS } from "ua-parser-js";
2
2
  import { VideomailClientOptions } from "../../types/options";
3
+ import HTTPError from "./HTTPError";
3
4
  export interface ErrData extends ErrorOptions {
4
5
  explanation: string | undefined;
5
6
  logLines?: string[] | undefined;
6
7
  err?: Error | undefined;
7
8
  }
8
- declare class VideomailError extends Error {
9
+ declare class VideomailError extends HTTPError {
9
10
  readonly title = "videomail-client error";
10
11
  readonly location: string;
11
12
  explanation: string | undefined;
@@ -1,7 +1,8 @@
1
1
  import VideomailError from "./VideomailError";
2
2
  import { VideomailClientOptions } from "../../types/options";
3
+ import HTTPError from "./HTTPError";
3
4
  interface ErrorParams {
4
- err?: Error;
5
+ err?: HTTPError;
5
6
  exc?: unknown;
6
7
  message?: string;
7
8
  explanation?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "videomail-client",
3
- "version": "10.0.5",
3
+ "version": "10.0.6",
4
4
  "description": "A wicked npm package to record videos directly in the browser, wohooo!",
5
5
  "keywords": [
6
6
  "webcam",
@@ -49,7 +49,7 @@
49
49
  "prettier:fix": "prettier --write ./etc ./src ./.storybook ./*.ts",
50
50
  "release": "release-it --only-version --config ./etc/release-it.ts",
51
51
  "storybook": "cross-env BROWSER=chromium storybook dev -p 8443 --https --ssl-cert ./etc/ssl-certs/localhost.crt --ssl-key ./etc/ssl-certs/localhost.key",
52
- "test": "cross-env ENVIRON=test vitest",
52
+ "test": "cross-env ENVIRON=test vitest --watch=false",
53
53
  "types:check": "tsc --noEmit",
54
54
  "types:config": "tsc --showConfig"
55
55
  },