videomail-client 10.2.23 → 10.2.25

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.
@@ -10214,6 +10214,19 @@ var __webpack_exports__ = {};
10214
10214
  constructor
10215
10215
  ]);
10216
10216
  const errorConstructors = new Map(list);
10217
+ class NonError extends Error {
10218
+ name = 'NonError';
10219
+ constructor(message){
10220
+ super(NonError._prepareSuperMessage(message));
10221
+ }
10222
+ static _prepareSuperMessage(message) {
10223
+ try {
10224
+ return JSON.stringify(message);
10225
+ } catch {
10226
+ return String(message);
10227
+ }
10228
+ }
10229
+ }
10217
10230
  const errorProperties = [
10218
10231
  {
10219
10232
  property: 'name',
@@ -10315,9 +10328,25 @@ var __webpack_exports__ = {};
10315
10328
  if ('function' == typeof value) return `[Function: ${value.name || 'anonymous'}]`;
10316
10329
  return value;
10317
10330
  }
10331
+ function deserializeError(value, options = {}) {
10332
+ const { maxDepth = Number.POSITIVE_INFINITY } = options;
10333
+ if (value instanceof Error) return value;
10334
+ if (isMinimumViableSerializedError(value)) return destroyCircular({
10335
+ from: value,
10336
+ seen: [],
10337
+ to: newError(value.name),
10338
+ maxDepth,
10339
+ depth: 0,
10340
+ serialize: false
10341
+ });
10342
+ return new NonError(value);
10343
+ }
10318
10344
  function isErrorLike(value) {
10319
10345
  return Boolean(value) && 'object' == typeof value && 'string' == typeof value.name && 'string' == typeof value.message && 'string' == typeof value.stack;
10320
10346
  }
10347
+ function isMinimumViableSerializedError(value) {
10348
+ return Boolean(value) && 'object' == typeof value && 'string' == typeof value.message && !Array.isArray(value);
10349
+ }
10321
10350
  var util = __webpack_require__("./node_modules/util/util.js");
10322
10351
  var util_default = /*#__PURE__*/ __webpack_require__.n(util);
10323
10352
  function inspect(element) {
@@ -14099,7 +14128,7 @@ var __webpack_exports__ = {};
14099
14128
  }
14100
14129
  const wrappers_form = Form;
14101
14130
  var package_namespaceObject = {
14102
- i8: "10.2.23"
14131
+ i8: "10.2.25"
14103
14132
  };
14104
14133
  function resource_define_property(obj, key, value) {
14105
14134
  if (key in obj) Object.defineProperty(obj, key, {
@@ -16293,16 +16322,38 @@ var __webpack_exports__ = {};
16293
16322
  });
16294
16323
  }
16295
16324
  updateFrameProgress(args) {
16325
+ if (args) {
16326
+ if (!args.frame) throw createError({
16327
+ message: "The frame number is missing",
16328
+ options: this.options
16329
+ });
16330
+ } else throw createError({
16331
+ message: "Arguments are missing for updating the frame progress",
16332
+ options: this.options
16333
+ });
16296
16334
  this.confirmedFrameNumber = args.frame;
16297
16335
  this.frameProgress = this.calculateFrameProgress();
16298
16336
  this.updateOverallProgress();
16299
16337
  }
16300
16338
  updateSampleProgress(args) {
16339
+ if (args) {
16340
+ if (!args.sample) throw createError({
16341
+ message: "The audio sample number is missing",
16342
+ options: this.options
16343
+ });
16344
+ } else throw createError({
16345
+ message: "Arguments are missing for updating the audio sample progress",
16346
+ options: this.options
16347
+ });
16301
16348
  this.confirmedSampleNumber = args.sample;
16302
16349
  this.sampleProgress = this.calculateSampleProgress();
16303
16350
  this.updateOverallProgress();
16304
16351
  }
16305
16352
  preview(args) {
16353
+ if (!args) throw createError({
16354
+ message: "Preview arguments are missing.",
16355
+ options: this.options
16356
+ });
16306
16357
  const hasAudio = this.samplesCount > 0;
16307
16358
  this.confirmedFrameNumber = this.confirmedSampleNumber = this.samplesCount = this.framesCount = 0;
16308
16359
  this.sampleProgress = this.frameProgress = void 0;
@@ -16567,11 +16618,13 @@ var __webpack_exports__ = {};
16567
16618
  break;
16568
16619
  case "error":
16569
16620
  {
16570
- var _command_args_err_message;
16621
+ var _command_args_err, _command_args, _command_args1;
16622
+ let explanation = "(No explanation given)";
16623
+ if (null == (_command_args = command.args) ? void 0 : null == (_command_args_err = _command_args.err) ? void 0 : _command_args_err.message) explanation = command.args.err.message;
16571
16624
  const err = createError({
16572
16625
  message: "Oh no, server error!",
16573
- explanation: null != (_command_args_err_message = command.args.err.message) ? _command_args_err_message : "(No message given)",
16574
- err: command.args.err,
16626
+ explanation,
16627
+ err: deserializeError(null == (_command_args1 = command.args) ? void 0 : _command_args1.err),
16575
16628
  options: this.options
16576
16629
  });
16577
16630
  this.emit("ERROR", {
@@ -5,9 +5,11 @@ import { VideomailClientOptions } from "./types/options";
5
5
  import RecordingStats from "./types/RecordingStats";
6
6
  import Videomail from "./types/Videomail";
7
7
  import { VideoType } from "./types/VideoType";
8
+ import { Command } from "./types/command";
8
9
  export type { Videomail };
9
10
  export type { VideomailEvents };
10
11
  export type { RecordingStats };
11
12
  export type { VideomailClientOptions };
12
13
  export { VideoType, VideomailClient };
13
14
  export type { VideomailErrorData, FullVideomailErrorData };
15
+ export type { Command };
package/dist/esm/index.js CHANGED
@@ -4075,7 +4075,7 @@ class Form extends util_Despot {
4075
4075
  }
4076
4076
  const wrappers_form = Form;
4077
4077
  var package_namespaceObject = {
4078
- i8: "10.2.23"
4078
+ i8: "10.2.25"
4079
4079
  };
4080
4080
  function findOriginalExc(exc) {
4081
4081
  if (exc instanceof Error && "response" in exc) {
@@ -6069,16 +6069,38 @@ class Recorder extends util_Despot {
6069
6069
  });
6070
6070
  }
6071
6071
  updateFrameProgress(args) {
6072
+ if (args) {
6073
+ if (!args.frame) throw error_createError({
6074
+ message: "The frame number is missing",
6075
+ options: this.options
6076
+ });
6077
+ } else throw error_createError({
6078
+ message: "Arguments are missing for updating the frame progress",
6079
+ options: this.options
6080
+ });
6072
6081
  this.confirmedFrameNumber = args.frame;
6073
6082
  this.frameProgress = this.calculateFrameProgress();
6074
6083
  this.updateOverallProgress();
6075
6084
  }
6076
6085
  updateSampleProgress(args) {
6086
+ if (args) {
6087
+ if (!args.sample) throw error_createError({
6088
+ message: "The audio sample number is missing",
6089
+ options: this.options
6090
+ });
6091
+ } else throw error_createError({
6092
+ message: "Arguments are missing for updating the audio sample progress",
6093
+ options: this.options
6094
+ });
6077
6095
  this.confirmedSampleNumber = args.sample;
6078
6096
  this.sampleProgress = this.calculateSampleProgress();
6079
6097
  this.updateOverallProgress();
6080
6098
  }
6081
6099
  preview(args) {
6100
+ if (!args) throw error_createError({
6101
+ message: "Preview arguments are missing.",
6102
+ options: this.options
6103
+ });
6082
6104
  const hasAudio = this.samplesCount > 0;
6083
6105
  this.confirmedFrameNumber = this.confirmedSampleNumber = this.samplesCount = this.framesCount = 0;
6084
6106
  this.sampleProgress = this.frameProgress = void 0;
@@ -6341,10 +6363,12 @@ class Recorder extends util_Despot {
6341
6363
  break;
6342
6364
  case "error":
6343
6365
  {
6366
+ let explanation = "(No explanation given)";
6367
+ if (command.args?.err?.message) explanation = command.args.err.message;
6344
6368
  const err = error_createError({
6345
6369
  message: "Oh no, server error!",
6346
- explanation: command.args.err.message ?? "(No message given)",
6347
- err: command.args.err,
6370
+ explanation,
6371
+ err: (0, __WEBPACK_EXTERNAL_MODULE_serialize_error_ecb1f3fc__.deserializeError)(command.args?.err),
6348
6372
  options: this.options
6349
6373
  });
6350
6374
  this.emit("ERROR", {
@@ -0,0 +1,13 @@
1
+ import { ErrorObject } from "serialize-error";
2
+ export interface CommandArgs {
3
+ frame?: number;
4
+ key?: string | undefined;
5
+ err?: ErrorObject;
6
+ sample?: number;
7
+ mp4?: string;
8
+ webm?: string;
9
+ }
10
+ export interface Command {
11
+ command: string;
12
+ args?: CommandArgs;
13
+ }
@@ -23,7 +23,7 @@ export interface ProgressParams {
23
23
  sampleProgress?: string | undefined;
24
24
  }
25
25
  export interface PreviewParams {
26
- key?: string;
26
+ key?: string | undefined;
27
27
  width?: number | undefined;
28
28
  height?: number | undefined;
29
29
  hasAudio: boolean;
package/dist/umd/index.js CHANGED
@@ -10220,6 +10220,19 @@
10220
10220
  constructor
10221
10221
  ]);
10222
10222
  const errorConstructors = new Map(list);
10223
+ class NonError extends Error {
10224
+ name = 'NonError';
10225
+ constructor(message){
10226
+ super(NonError._prepareSuperMessage(message));
10227
+ }
10228
+ static _prepareSuperMessage(message) {
10229
+ try {
10230
+ return JSON.stringify(message);
10231
+ } catch {
10232
+ return String(message);
10233
+ }
10234
+ }
10235
+ }
10223
10236
  const errorProperties = [
10224
10237
  {
10225
10238
  property: 'name',
@@ -10321,9 +10334,25 @@
10321
10334
  if ('function' == typeof value) return `[Function: ${value.name || 'anonymous'}]`;
10322
10335
  return value;
10323
10336
  }
10337
+ function deserializeError(value, options = {}) {
10338
+ const { maxDepth = Number.POSITIVE_INFINITY } = options;
10339
+ if (value instanceof Error) return value;
10340
+ if (isMinimumViableSerializedError(value)) return destroyCircular({
10341
+ from: value,
10342
+ seen: [],
10343
+ to: newError(value.name),
10344
+ maxDepth,
10345
+ depth: 0,
10346
+ serialize: false
10347
+ });
10348
+ return new NonError(value);
10349
+ }
10324
10350
  function isErrorLike(value) {
10325
10351
  return Boolean(value) && 'object' == typeof value && 'string' == typeof value.name && 'string' == typeof value.message && 'string' == typeof value.stack;
10326
10352
  }
10353
+ function isMinimumViableSerializedError(value) {
10354
+ return Boolean(value) && 'object' == typeof value && 'string' == typeof value.message && !Array.isArray(value);
10355
+ }
10327
10356
  var util = __webpack_require__("./node_modules/util/util.js");
10328
10357
  var util_default = /*#__PURE__*/ __webpack_require__.n(util);
10329
10358
  function inspect(element) {
@@ -14066,7 +14095,7 @@
14066
14095
  }
14067
14096
  const wrappers_form = Form;
14068
14097
  var package_namespaceObject = {
14069
- i8: "10.2.23"
14098
+ i8: "10.2.25"
14070
14099
  };
14071
14100
  function findOriginalExc(exc) {
14072
14101
  if (exc instanceof Error && "response" in exc) {
@@ -16138,16 +16167,38 @@
16138
16167
  });
16139
16168
  }
16140
16169
  updateFrameProgress(args) {
16170
+ if (args) {
16171
+ if (!args.frame) throw error_createError({
16172
+ message: "The frame number is missing",
16173
+ options: this.options
16174
+ });
16175
+ } else throw error_createError({
16176
+ message: "Arguments are missing for updating the frame progress",
16177
+ options: this.options
16178
+ });
16141
16179
  this.confirmedFrameNumber = args.frame;
16142
16180
  this.frameProgress = this.calculateFrameProgress();
16143
16181
  this.updateOverallProgress();
16144
16182
  }
16145
16183
  updateSampleProgress(args) {
16184
+ if (args) {
16185
+ if (!args.sample) throw error_createError({
16186
+ message: "The audio sample number is missing",
16187
+ options: this.options
16188
+ });
16189
+ } else throw error_createError({
16190
+ message: "Arguments are missing for updating the audio sample progress",
16191
+ options: this.options
16192
+ });
16146
16193
  this.confirmedSampleNumber = args.sample;
16147
16194
  this.sampleProgress = this.calculateSampleProgress();
16148
16195
  this.updateOverallProgress();
16149
16196
  }
16150
16197
  preview(args) {
16198
+ if (!args) throw error_createError({
16199
+ message: "Preview arguments are missing.",
16200
+ options: this.options
16201
+ });
16151
16202
  const hasAudio = this.samplesCount > 0;
16152
16203
  this.confirmedFrameNumber = this.confirmedSampleNumber = this.samplesCount = this.framesCount = 0;
16153
16204
  this.sampleProgress = this.frameProgress = void 0;
@@ -16410,10 +16461,12 @@
16410
16461
  break;
16411
16462
  case "error":
16412
16463
  {
16464
+ let explanation = "(No explanation given)";
16465
+ if (command.args?.err?.message) explanation = command.args.err.message;
16413
16466
  const err = error_createError({
16414
16467
  message: "Oh no, server error!",
16415
- explanation: command.args.err.message ?? "(No message given)",
16416
- err: command.args.err,
16468
+ explanation,
16469
+ err: deserializeError(command.args?.err),
16417
16470
  options: this.options
16418
16471
  });
16419
16472
  this.emit("ERROR", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "videomail-client",
3
- "version": "10.2.23",
3
+ "version": "10.2.25",
4
4
  "description": "A wicked npm package to record videos directly in the browser, wohooo!",
5
5
  "keywords": [
6
6
  "webcam",
@@ -74,11 +74,11 @@
74
74
  },
75
75
  "devDependencies": {
76
76
  "@chromatic-com/storybook": "3.2.6",
77
- "@eslint/js": "9.24.0",
77
+ "@eslint/js": "9.25.0",
78
78
  "@rsbuild/plugin-node-polyfill": "1.3.0",
79
79
  "@rsbuild/plugin-stylus": "1.1.1",
80
80
  "@rsdoctor/rspack-plugin": "1.0.2",
81
- "@rslib/core": "0.6.4",
81
+ "@rslib/core": "0.6.5",
82
82
  "@storybook/addon-a11y": "8.6.12",
83
83
  "@storybook/addon-console": "3.0.0",
84
84
  "@storybook/addon-essentials": "8.6.12",
@@ -97,23 +97,23 @@
97
97
  "audit-ci": "7.1.0",
98
98
  "chromatic": "11.28.2",
99
99
  "cross-env": "7.0.3",
100
- "eslint": "9.24.0",
101
- "eslint-import-resolver-typescript": "4.3.2",
100
+ "eslint": "9.25.0",
101
+ "eslint-import-resolver-typescript": "4.3.3",
102
102
  "eslint-plugin-depend": "1.0.0",
103
- "eslint-plugin-import-x": "4.10.5",
103
+ "eslint-plugin-import-x": "4.10.6",
104
104
  "eslint-plugin-promise": "7.2.1",
105
105
  "eslint-plugin-regexp": "2.7.0",
106
106
  "eslint-plugin-security": "3.0.1",
107
107
  "eslint-plugin-storybook": "0.12.0",
108
108
  "globals": "16.0.0",
109
109
  "jsdom": "26.1.0",
110
- "msw": "2.7.4",
110
+ "msw": "2.7.5",
111
111
  "msw-storybook-addon": "2.0.4",
112
112
  "prettier": "3.5.3",
113
113
  "prettier-plugin-curly": "0.3.2",
114
114
  "prettier-plugin-packagejson": "2.5.10",
115
115
  "prettier-plugin-sh": "0.17.2",
116
- "release-it": "18.1.2",
116
+ "release-it": "19.0.1",
117
117
  "storybook": "8.6.12",
118
118
  "storybook-html-rsbuild": "1.0.1",
119
119
  "type-fest": "4.40.0",