@ddd-ts/shape 0.0.0-eventviz.12 → 0.0.0-eventviz.13
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/deserialization-error.d.ts +32 -0
- package/dist/deserialization-error.d.ts.map +1 -0
- package/dist/deserialization-error.js +43 -0
- package/dist/deserialization-error.mjs +43 -0
- package/dist/deserialization-error.spec.d.ts +2 -0
- package/dist/deserialization-error.spec.d.ts.map +1 -0
- package/dist/dict.d.ts.map +1 -1
- package/dist/dict.js +7 -1
- package/dist/dict.mjs +7 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.mjs +2 -1
- package/dist/multiple.d.ts.map +1 -1
- package/dist/multiple.js +9 -1
- package/dist/multiple.mjs +9 -1
- package/package.json +4 -4
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type DeserializationErrorContext = {
|
|
2
|
+
expected?: string;
|
|
3
|
+
rejectedValue?: unknown;
|
|
4
|
+
registryEntry?: {
|
|
5
|
+
name: string;
|
|
6
|
+
version?: number;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export declare class DeserializationError extends Error {
|
|
10
|
+
readonly path: string[];
|
|
11
|
+
readonly rejectedValue: unknown;
|
|
12
|
+
readonly expected?: string;
|
|
13
|
+
registryEntry?: {
|
|
14
|
+
name: string;
|
|
15
|
+
version?: number;
|
|
16
|
+
};
|
|
17
|
+
readonly cause?: unknown;
|
|
18
|
+
constructor(message: string, options?: {
|
|
19
|
+
path?: string[];
|
|
20
|
+
rejectedValue?: unknown;
|
|
21
|
+
expected?: string;
|
|
22
|
+
registryEntry?: {
|
|
23
|
+
name: string;
|
|
24
|
+
version?: number;
|
|
25
|
+
};
|
|
26
|
+
cause?: unknown;
|
|
27
|
+
});
|
|
28
|
+
prependPath(segment: string): DeserializationError;
|
|
29
|
+
private unprefixedMessage;
|
|
30
|
+
static wrap(error: unknown, segment: string, rejectedValue?: unknown): DeserializationError;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=deserialization-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deserialization-error.d.ts","sourceRoot":"","sources":["../src/deserialization-error.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,2BAA2B,GAAG;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACpD,CAAC;AAEF,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IACxB,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACnD,SAAkB,KAAK,CAAC,EAAE,OAAO,CAAC;gBAGhC,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;QACP,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,aAAa,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,OAAO,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QACnD,KAAK,CAAC,EAAE,OAAO,CAAC;KACZ;IAeR,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,oBAAoB;IAUlD,OAAO,CAAC,iBAAiB;IAKzB,MAAM,CAAC,IAAI,CACT,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,MAAM,EACf,aAAa,CAAC,EAAE,OAAO,GACtB,oBAAoB;CAYxB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
//#region src/deserialization-error.ts
|
|
2
|
+
var DeserializationError = class DeserializationError extends Error {
|
|
3
|
+
path;
|
|
4
|
+
rejectedValue;
|
|
5
|
+
expected;
|
|
6
|
+
registryEntry;
|
|
7
|
+
cause;
|
|
8
|
+
constructor(message, options = {}) {
|
|
9
|
+
const { path = [], rejectedValue, expected, registryEntry, cause } = options;
|
|
10
|
+
const formattedPath = path.length ? `/${path.join("/")}` : "";
|
|
11
|
+
super(`${message}${formattedPath ? ` (at ${formattedPath})` : ""}`);
|
|
12
|
+
this.name = "DeserializationError";
|
|
13
|
+
this.path = path;
|
|
14
|
+
this.rejectedValue = rejectedValue;
|
|
15
|
+
this.expected = expected;
|
|
16
|
+
this.registryEntry = registryEntry;
|
|
17
|
+
this.cause = cause;
|
|
18
|
+
}
|
|
19
|
+
prependPath(segment) {
|
|
20
|
+
return new DeserializationError(this.unprefixedMessage(), {
|
|
21
|
+
path: [segment, ...this.path],
|
|
22
|
+
rejectedValue: this.rejectedValue,
|
|
23
|
+
expected: this.expected,
|
|
24
|
+
registryEntry: this.registryEntry,
|
|
25
|
+
cause: this.cause ?? this
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
unprefixedMessage() {
|
|
29
|
+
const idx = this.message.lastIndexOf(" (at /");
|
|
30
|
+
return idx >= 0 ? this.message.slice(0, idx) : this.message;
|
|
31
|
+
}
|
|
32
|
+
static wrap(error, segment, rejectedValue) {
|
|
33
|
+
if (error instanceof DeserializationError) return error.prependPath(segment);
|
|
34
|
+
const cause = error instanceof Error ? error : void 0;
|
|
35
|
+
return new DeserializationError(cause?.message ?? String(error), {
|
|
36
|
+
path: [segment],
|
|
37
|
+
rejectedValue,
|
|
38
|
+
cause: cause ?? error
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
//#endregion
|
|
43
|
+
exports.DeserializationError = DeserializationError;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
//#region src/deserialization-error.ts
|
|
2
|
+
var DeserializationError = class DeserializationError extends Error {
|
|
3
|
+
path;
|
|
4
|
+
rejectedValue;
|
|
5
|
+
expected;
|
|
6
|
+
registryEntry;
|
|
7
|
+
cause;
|
|
8
|
+
constructor(message, options = {}) {
|
|
9
|
+
const { path = [], rejectedValue, expected, registryEntry, cause } = options;
|
|
10
|
+
const formattedPath = path.length ? `/${path.join("/")}` : "";
|
|
11
|
+
super(`${message}${formattedPath ? ` (at ${formattedPath})` : ""}`);
|
|
12
|
+
this.name = "DeserializationError";
|
|
13
|
+
this.path = path;
|
|
14
|
+
this.rejectedValue = rejectedValue;
|
|
15
|
+
this.expected = expected;
|
|
16
|
+
this.registryEntry = registryEntry;
|
|
17
|
+
this.cause = cause;
|
|
18
|
+
}
|
|
19
|
+
prependPath(segment) {
|
|
20
|
+
return new DeserializationError(this.unprefixedMessage(), {
|
|
21
|
+
path: [segment, ...this.path],
|
|
22
|
+
rejectedValue: this.rejectedValue,
|
|
23
|
+
expected: this.expected,
|
|
24
|
+
registryEntry: this.registryEntry,
|
|
25
|
+
cause: this.cause ?? this
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
unprefixedMessage() {
|
|
29
|
+
const idx = this.message.lastIndexOf(" (at /");
|
|
30
|
+
return idx >= 0 ? this.message.slice(0, idx) : this.message;
|
|
31
|
+
}
|
|
32
|
+
static wrap(error, segment, rejectedValue) {
|
|
33
|
+
if (error instanceof DeserializationError) return error.prependPath(segment);
|
|
34
|
+
const cause = error instanceof Error ? error : void 0;
|
|
35
|
+
return new DeserializationError(cause?.message ?? String(error), {
|
|
36
|
+
path: [segment],
|
|
37
|
+
rejectedValue,
|
|
38
|
+
cause: cause ?? error
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
//#endregion
|
|
43
|
+
export { DeserializationError };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deserialization-error.spec.d.ts","sourceRoot":"","sources":["../src/deserialization-error.spec.ts"],"names":[],"mappings":""}
|
package/dist/dict.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dict.d.ts","sourceRoot":"","sources":["../src/dict.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,SAAS,EAEd,KAAK,MAAM,EACX,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,KAAK,EACN,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"dict.d.ts","sourceRoot":"","sources":["../src/dict.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,SAAS,EAEd,KAAK,MAAM,EACX,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,KAAK,EACN,MAAM,KAAK,CAAC;AAGb,MAAM,MAAM,aAAa,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAEzD,KAAK,QAAQ,CAAC,CAAC,SAAS,aAAa,EAAE,CAAC,SAAS,mBAAmB,CAAC,EAAE,CAAC,IAAI;IAC1E,UAAU,EAAE;QAAE,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAAE,CAAC;IAC7D,UAAU,EAAE,CAAC,CAAC,SAAS;QAAE,KAAK,EAAE,MAAM,CAAC,CAAA;KAAE,GAAG;QAAE,KAAK,EAAE,CAAC,CAAA;KAAE,GAAG,EAAE,CAAC,GAAG;QAC/D,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;KACvE,CAAC;IACF,aAAa,EAAE,CAAC,CAAC,SAAS;QAAE,KAAK,EAAE,MAAM,CAAC,CAAA;KAAE,GAAG;QAAE,KAAK,EAAE,CAAC,CAA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9B,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,GACrB,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;IAChC,OAAO,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;CACnC,GAAG,CAAC,QAAQ,MACT,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,KACpC,YAAY,CAAC,CAAC,CAAC,GAAG;IACrB,SAAS,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;CACnD,GAAG,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC"}
|
package/dist/dict.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const require_deserialization_error = require("./deserialization-error.js");
|
|
1
2
|
const require__ = require("./_.js");
|
|
2
3
|
//#region src/dict.ts
|
|
3
4
|
const Dict = (of, base = require__.Empty) => {
|
|
@@ -17,7 +18,12 @@ const Dict = (of, base = require__.Empty) => {
|
|
|
17
18
|
}
|
|
18
19
|
static $deserialize(value) {
|
|
19
20
|
const transform = Object.entries(of).map(([key, child]) => {
|
|
20
|
-
|
|
21
|
+
const longhand = require__.Shape(child);
|
|
22
|
+
try {
|
|
23
|
+
return [key, longhand.$deserialize(value?.[key])];
|
|
24
|
+
} catch (err) {
|
|
25
|
+
throw require_deserialization_error.DeserializationError.wrap(err, key, value?.[key]);
|
|
26
|
+
}
|
|
21
27
|
});
|
|
22
28
|
return Object.fromEntries(transform);
|
|
23
29
|
}
|
package/dist/dict.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DeserializationError } from "./deserialization-error.mjs";
|
|
1
2
|
import { Empty, Shape } from "./_.mjs";
|
|
2
3
|
//#region src/dict.ts
|
|
3
4
|
const Dict = (of, base = Empty) => {
|
|
@@ -17,7 +18,12 @@ const Dict = (of, base = Empty) => {
|
|
|
17
18
|
}
|
|
18
19
|
static $deserialize(value) {
|
|
19
20
|
const transform = Object.entries(of).map(([key, child]) => {
|
|
20
|
-
|
|
21
|
+
const longhand = Shape(child);
|
|
22
|
+
try {
|
|
23
|
+
return [key, longhand.$deserialize(value?.[key])];
|
|
24
|
+
} catch (err) {
|
|
25
|
+
throw DeserializationError.wrap(err, key, value?.[key]);
|
|
26
|
+
}
|
|
21
27
|
});
|
|
22
28
|
return Object.fromEntries(transform);
|
|
23
29
|
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,KAAK,CAAC;AACpB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,gCAAgC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,KAAK,CAAC;AACpB,cAAc,yBAAyB,CAAC;AACxC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,gCAAgC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_class = require("./class.js");
|
|
3
|
+
const require_deserialization_error = require("./deserialization-error.js");
|
|
3
4
|
const require_dict = require("./dict.js");
|
|
4
5
|
const require_primitive = require("./primitive.js");
|
|
5
6
|
const require_multiple = require("./multiple.js");
|
|
@@ -14,6 +15,7 @@ const require_optional = require("./optional.js");
|
|
|
14
15
|
const require_microsecond_timestamp = require("./addons/microsecond-timestamp.js");
|
|
15
16
|
exports.Choice = require_choice.Choice;
|
|
16
17
|
exports.Class = require_class.Class;
|
|
18
|
+
exports.DeserializationError = require_deserialization_error.DeserializationError;
|
|
17
19
|
exports.Dict = require_dict.Dict;
|
|
18
20
|
exports.DiscriminatedUnion = require_discriminated_union.DiscriminatedUnion;
|
|
19
21
|
exports.Either = require_either.Either;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Class } from "./class.mjs";
|
|
2
|
+
import { DeserializationError } from "./deserialization-error.mjs";
|
|
2
3
|
import { Dict } from "./dict.mjs";
|
|
3
4
|
import { Primitive } from "./primitive.mjs";
|
|
4
5
|
import { Multiple } from "./multiple.mjs";
|
|
@@ -11,4 +12,4 @@ import { DiscriminatedUnion, findBestKey, prepareShapeMap } from "./discriminate
|
|
|
11
12
|
import { Mapping } from "./mapping.mjs";
|
|
12
13
|
import { Optional } from "./optional.mjs";
|
|
13
14
|
import { MicrosecondTimestamp } from "./addons/microsecond-timestamp.mjs";
|
|
14
|
-
export { Choice, Class, Dict, DiscriminatedUnion, Either, Empty, Literal, Mapping, MicrosecondTimestamp, Multiple, Nothing, Optional, Primitive, Shape, findBestKey, forward, prepareShapeMap };
|
|
15
|
+
export { Choice, Class, DeserializationError, Dict, DiscriminatedUnion, Either, Empty, Literal, Mapping, MicrosecondTimestamp, Multiple, Nothing, Optional, Primitive, Shape, findBestKey, forward, prepareShapeMap };
|
package/dist/multiple.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiple.d.ts","sourceRoot":"","sources":["../src/multiple.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,MAAM,EACX,KAAK,SAAS,EACd,KAAK,YAAY,EAEjB,KAAK,mBAAmB,EACxB,KAAK,EACL,KAAK,WAAW,EACjB,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"multiple.d.ts","sourceRoot":"","sources":["../src/multiple.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,MAAM,EACX,KAAK,SAAS,EACd,KAAK,YAAY,EAEjB,KAAK,mBAAmB,EACxB,KAAK,EACL,KAAK,WAAW,EACjB,MAAM,KAAK,CAAC;AAGb,MAAM,MAAM,qBAAqB,GAAG,UAAU,GAAG,SAAS,CAAC;AAC3D,MAAM,MAAM,iBAAiB,GAAG,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;AAEvD,KAAK,QAAQ,CAAC,CAAC,SAAS,qBAAqB,IAAI;IAC/C,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC;IACxD,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC;CACtC,CAAC;AAEF,eAAO,MAAM,QAAQ,SACb,CAAC,SAAS,qBAAqB,EACrC,CAAC,SAAS,mBAAmB,CAAC,EAAE,CAAC,qBAE7B,CAAC,SACC,CAAC,KACN,SAAS,CAAC,CAAC,EAAE,CAAC,CA0JhB,CAAC;AAEF,MAAM,MAAM,SAAS,CACnB,CAAC,SAAS,qBAAqB,EAC/B,CAAC,SAAS,mBAAmB,CAAC,EAAE,CAAC,GAAG,OAA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,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;IACpE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;CAChC,CAAC"}
|
package/dist/multiple.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const require_deserialization_error = require("./deserialization-error.js");
|
|
1
2
|
const require__ = require("./_.js");
|
|
2
3
|
//#region src/multiple.ts
|
|
3
4
|
const Multiple = (of, base = require__.Empty) => {
|
|
@@ -16,7 +17,14 @@ const Multiple = (of, base = require__.Empty) => {
|
|
|
16
17
|
return new this($Multiple.$deserialize(value));
|
|
17
18
|
}
|
|
18
19
|
static $deserialize(value) {
|
|
19
|
-
|
|
20
|
+
const deserialize = longhand.$deserialize;
|
|
21
|
+
return value.map((item, index) => {
|
|
22
|
+
try {
|
|
23
|
+
return deserialize(item);
|
|
24
|
+
} catch (err) {
|
|
25
|
+
throw require_deserialization_error.DeserializationError.wrap(err, String(index), item);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
20
28
|
}
|
|
21
29
|
static $serialize(value) {
|
|
22
30
|
return value.map(longhand.$serialize);
|
package/dist/multiple.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DeserializationError } from "./deserialization-error.mjs";
|
|
1
2
|
import { Empty, Shape } from "./_.mjs";
|
|
2
3
|
//#region src/multiple.ts
|
|
3
4
|
const Multiple = (of, base = Empty) => {
|
|
@@ -16,7 +17,14 @@ const Multiple = (of, base = Empty) => {
|
|
|
16
17
|
return new this($Multiple.$deserialize(value));
|
|
17
18
|
}
|
|
18
19
|
static $deserialize(value) {
|
|
19
|
-
|
|
20
|
+
const deserialize = longhand.$deserialize;
|
|
21
|
+
return value.map((item, index) => {
|
|
22
|
+
try {
|
|
23
|
+
return deserialize(item);
|
|
24
|
+
} catch (err) {
|
|
25
|
+
throw DeserializationError.wrap(err, String(index), item);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
20
28
|
}
|
|
21
29
|
static $serialize(value) {
|
|
22
30
|
return value.map(longhand.$serialize);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ddd-ts/shape",
|
|
3
|
-
"version": "0.0.0-eventviz.
|
|
3
|
+
"version": "0.0.0-eventviz.13",
|
|
4
4
|
"types": "dist/index.d.ts",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"dist"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@ddd-ts/traits": "0.0.0-eventviz.
|
|
13
|
+
"@ddd-ts/traits": "0.0.0-eventviz.13"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@ddd-ts/tools": "0.0.0-eventviz.
|
|
17
|
-
"@ddd-ts/types": "0.0.0-eventviz.
|
|
16
|
+
"@ddd-ts/tools": "0.0.0-eventviz.13",
|
|
17
|
+
"@ddd-ts/types": "0.0.0-eventviz.13",
|
|
18
18
|
"@types/jest": "^29.5.1"
|
|
19
19
|
},
|
|
20
20
|
"exports": {
|