seroval 1.6.0 → 1.6.1
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/dev/index.cjs +2954 -0
- package/dist/dev/index.d.cts +761 -0
- package/dist/dev/index.d.ts +761 -0
- package/dist/dev/index.js +2917 -0
- package/dist/index.cjs +2947 -0
- package/dist/index.d.cts +761 -0
- package/dist/index.js +11 -29
- package/package.json +14 -3
package/dist/index.js
CHANGED
|
@@ -379,20 +379,6 @@ function createSequenceNode(id, sequence, throwAt, doneAt) {
|
|
|
379
379
|
//#endregion
|
|
380
380
|
//#region src/core/errors.ts
|
|
381
381
|
const { toString: objectToString } = Object.prototype;
|
|
382
|
-
function getErrorMessageDev(type, cause) {
|
|
383
|
-
if (cause instanceof Error) return `Seroval caught an error during the ${type} process.
|
|
384
|
-
|
|
385
|
-
${cause.name}
|
|
386
|
-
${cause.message}
|
|
387
|
-
|
|
388
|
-
- For more information, please check the "cause" property of this error.
|
|
389
|
-
- If you believe this is an error in Seroval, please submit an issue at https://github.com/lxsmnsyc/seroval/issues/new`;
|
|
390
|
-
return `Seroval caught an error during the ${type} process.
|
|
391
|
-
|
|
392
|
-
"${objectToString.call(cause)}"
|
|
393
|
-
|
|
394
|
-
For more information, please check the "cause" property of this error.`;
|
|
395
|
-
}
|
|
396
382
|
const STEP_ERROR_CODES = {
|
|
397
383
|
parsing: 1,
|
|
398
384
|
serialization: 2,
|
|
@@ -401,7 +387,7 @@ const STEP_ERROR_CODES = {
|
|
|
401
387
|
function getErrorMessageProd(type) {
|
|
402
388
|
return `Seroval Error (step: ${STEP_ERROR_CODES[type]})`;
|
|
403
389
|
}
|
|
404
|
-
const getErrorMessage = (type, cause) =>
|
|
390
|
+
const getErrorMessage = (type, cause) => getErrorMessageProd(type);
|
|
405
391
|
var SerovalError = class extends Error {
|
|
406
392
|
constructor(type, cause) {
|
|
407
393
|
super(getErrorMessage(type, cause));
|
|
@@ -428,58 +414,54 @@ function getSpecificErrorMessage(code) {
|
|
|
428
414
|
}
|
|
429
415
|
var SerovalUnsupportedTypeError = class extends Error {
|
|
430
416
|
constructor(value) {
|
|
431
|
-
super(
|
|
432
|
-
|
|
433
|
-
There are few workarounds for this problem:
|
|
434
|
-
- Transform the value in a way that it can be serialized.
|
|
435
|
-
- If the reference is present on multiple runtimes (isomorphic), you can use the Reference API to map the references.`);
|
|
417
|
+
super(getSpecificErrorMessage(1));
|
|
436
418
|
this.value = value;
|
|
437
419
|
}
|
|
438
420
|
};
|
|
439
421
|
var SerovalUnsupportedNodeError = class extends Error {
|
|
440
422
|
constructor(node) {
|
|
441
|
-
super(
|
|
423
|
+
super(getSpecificErrorMessage(2));
|
|
442
424
|
}
|
|
443
425
|
};
|
|
444
426
|
var SerovalMissingPluginError = class extends Error {
|
|
445
427
|
constructor(tag) {
|
|
446
|
-
super(
|
|
428
|
+
super(getSpecificErrorMessage(3));
|
|
447
429
|
}
|
|
448
430
|
};
|
|
449
431
|
var SerovalMissingInstanceError = class extends Error {
|
|
450
432
|
constructor(tag) {
|
|
451
|
-
super(
|
|
433
|
+
super(getSpecificErrorMessage(4));
|
|
452
434
|
}
|
|
453
435
|
};
|
|
454
436
|
var SerovalMissingReferenceError = class extends Error {
|
|
455
437
|
constructor(value) {
|
|
456
|
-
super(
|
|
438
|
+
super(getSpecificErrorMessage(5));
|
|
457
439
|
this.value = value;
|
|
458
440
|
}
|
|
459
441
|
};
|
|
460
442
|
var SerovalMissingReferenceForIdError = class extends Error {
|
|
461
443
|
constructor(id) {
|
|
462
|
-
super(
|
|
444
|
+
super(getSpecificErrorMessage(6));
|
|
463
445
|
}
|
|
464
446
|
};
|
|
465
447
|
var SerovalUnknownTypedArrayError = class extends Error {
|
|
466
448
|
constructor(name) {
|
|
467
|
-
super(
|
|
449
|
+
super(getSpecificErrorMessage(7));
|
|
468
450
|
}
|
|
469
451
|
};
|
|
470
452
|
var SerovalMalformedNodeError = class extends Error {
|
|
471
453
|
constructor(node) {
|
|
472
|
-
super(
|
|
454
|
+
super(getSpecificErrorMessage(8));
|
|
473
455
|
}
|
|
474
456
|
};
|
|
475
457
|
var SerovalConflictedNodeIdError = class extends Error {
|
|
476
458
|
constructor(node) {
|
|
477
|
-
super(
|
|
459
|
+
super(getSpecificErrorMessage(9));
|
|
478
460
|
}
|
|
479
461
|
};
|
|
480
462
|
var SerovalDepthLimitError = class extends Error {
|
|
481
463
|
constructor(limit) {
|
|
482
|
-
super(
|
|
464
|
+
super(getSpecificErrorMessage(9));
|
|
483
465
|
}
|
|
484
466
|
};
|
|
485
467
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "seroval",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.6.
|
|
4
|
+
"version": "1.6.1",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
7
7
|
],
|
|
@@ -40,14 +40,25 @@
|
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
42
|
"author": "Alexis Munsayac",
|
|
43
|
-
"types": "./dist/
|
|
43
|
+
"types": "./dist/index.d.cts",
|
|
44
44
|
"exports": {
|
|
45
|
-
".":
|
|
45
|
+
".": {
|
|
46
|
+
"development": {
|
|
47
|
+
"import": "./dist/dev/index.js",
|
|
48
|
+
"require": "./dist/dev/index.cjs",
|
|
49
|
+
"default": "./dist/dev/index.js"
|
|
50
|
+
},
|
|
51
|
+
"import": "./dist/index.js",
|
|
52
|
+
"require": "./dist/index.cjs",
|
|
53
|
+
"default": "./dist/index.js"
|
|
54
|
+
},
|
|
46
55
|
"./package.json": "./package.json"
|
|
47
56
|
},
|
|
48
57
|
"typesVersions": {
|
|
49
58
|
"*": {}
|
|
50
59
|
},
|
|
60
|
+
"main": "./dist/index.cjs",
|
|
61
|
+
"module": "./dist/index.js",
|
|
51
62
|
"scripts": {
|
|
52
63
|
"build": "tsdown",
|
|
53
64
|
"watch": "tsdown --watch",
|