@jsii/kernel 1.77.0 → 1.78.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/lib/serialization.d.ts +3 -1
- package/lib/serialization.js +13 -10
- package/package.json +5 -5
package/lib/serialization.d.ts
CHANGED
|
@@ -72,7 +72,9 @@ export interface SerializerHost {
|
|
|
72
72
|
}
|
|
73
73
|
interface Serializer {
|
|
74
74
|
serialize(value: unknown, type: OptionalValueOrVoid, host: SerializerHost): any;
|
|
75
|
-
deserialize(value: unknown, type: OptionalValueOrVoid, host: SerializerHost
|
|
75
|
+
deserialize(value: unknown, type: OptionalValueOrVoid, host: SerializerHost, options?: {
|
|
76
|
+
allowNullishMapValue?: boolean;
|
|
77
|
+
}): any;
|
|
76
78
|
}
|
|
77
79
|
export declare const SERIALIZERS: {
|
|
78
80
|
[k: string]: Serializer;
|
package/lib/serialization.js
CHANGED
|
@@ -130,14 +130,13 @@ exports.SERIALIZERS = {
|
|
|
130
130
|
// Map<string, JSON> in order to obtain the correct output behavior here!
|
|
131
131
|
if ((0, api_1.isWireMap)(value)) {
|
|
132
132
|
return exports.SERIALIZERS["Map" /* SerializationClass.Map */].deserialize(value, {
|
|
133
|
-
optional: false,
|
|
134
133
|
type: {
|
|
135
134
|
collection: {
|
|
136
135
|
kind: spec.CollectionKind.Map,
|
|
137
136
|
elementtype: { primitive: spec.PrimitiveType.Json },
|
|
138
137
|
},
|
|
139
138
|
},
|
|
140
|
-
}, host);
|
|
139
|
+
}, host, { allowNullishMapValue: true });
|
|
141
140
|
}
|
|
142
141
|
if (typeof value !== 'object') {
|
|
143
142
|
return value;
|
|
@@ -150,9 +149,7 @@ exports.SERIALIZERS = {
|
|
|
150
149
|
if (toMap == null) {
|
|
151
150
|
return toMap;
|
|
152
151
|
}
|
|
153
|
-
return process(host, 'deserialize', toMap, {
|
|
154
|
-
type: { primitive: spec.PrimitiveType.Json },
|
|
155
|
-
}, typeof key === 'string' ? `key ${(0, util_1.inspect)(key)}` : `index ${key}`);
|
|
152
|
+
return process(host, 'deserialize', toMap, { type: { primitive: spec.PrimitiveType.Json } }, typeof key === 'string' ? `key ${(0, util_1.inspect)(key)}` : `index ${key}`);
|
|
156
153
|
}
|
|
157
154
|
},
|
|
158
155
|
},
|
|
@@ -222,7 +219,7 @@ exports.SERIALIZERS = {
|
|
|
222
219
|
[api_1.TOKEN_MAP]: mapValues(value, (v, key) => process(host, 'serialize', v, { type: mapType.collection.elementtype }, `key ${(0, util_1.inspect)(key)}`)),
|
|
223
220
|
};
|
|
224
221
|
},
|
|
225
|
-
deserialize(value, optionalValue, host) {
|
|
222
|
+
deserialize(value, optionalValue, host, { allowNullishMapValue = false } = {}) {
|
|
226
223
|
if (nullAndOk(value, optionalValue)) {
|
|
227
224
|
return undefined;
|
|
228
225
|
}
|
|
@@ -230,9 +227,15 @@ exports.SERIALIZERS = {
|
|
|
230
227
|
const mapType = optionalValue.type;
|
|
231
228
|
if (!(0, api_1.isWireMap)(value)) {
|
|
232
229
|
// Compatibility mode with older versions that didn't wrap in [TOKEN_MAP]
|
|
233
|
-
return mapValues(value, (v, key) => process(host, 'deserialize', v, {
|
|
234
|
-
|
|
235
|
-
|
|
230
|
+
return mapValues(value, (v, key) => process(host, 'deserialize', v, {
|
|
231
|
+
optional: allowNullishMapValue,
|
|
232
|
+
type: mapType.collection.elementtype,
|
|
233
|
+
}, `key ${(0, util_1.inspect)(key)}`));
|
|
234
|
+
}
|
|
235
|
+
const result = mapValues(value[api_1.TOKEN_MAP], (v, key) => process(host, 'deserialize', v, {
|
|
236
|
+
optional: allowNullishMapValue,
|
|
237
|
+
type: mapType.collection.elementtype,
|
|
238
|
+
}, `key ${(0, util_1.inspect)(key)}`));
|
|
236
239
|
Object.defineProperty(result, exports.SYMBOL_WIRE_TYPE, {
|
|
237
240
|
configurable: false,
|
|
238
241
|
enumerable: false,
|
|
@@ -703,7 +706,7 @@ function isByReferenceOnly(obj) {
|
|
|
703
706
|
}
|
|
704
707
|
function process(host, serde, value, type, context) {
|
|
705
708
|
const wireTypes = serializationType(type, host.lookupType);
|
|
706
|
-
host.debug(serde, value, wireTypes);
|
|
709
|
+
host.debug(serde, value, ...wireTypes);
|
|
707
710
|
const errors = new Array();
|
|
708
711
|
for (const { serializationClass, typeRef } of wireTypes) {
|
|
709
712
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsii/kernel",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.78.1",
|
|
4
4
|
"description": "kernel for jsii execution environment",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -31,19 +31,19 @@
|
|
|
31
31
|
"package": "package-js"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@jsii/spec": "^1.
|
|
34
|
+
"@jsii/spec": "^1.78.1",
|
|
35
35
|
"fs-extra": "^10.1.0",
|
|
36
36
|
"lockfile": "^1.0.4",
|
|
37
37
|
"tar": "^6.1.13"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@scope/jsii-calc-base": "^1.
|
|
41
|
-
"@scope/jsii-calc-lib": "^1.
|
|
40
|
+
"@scope/jsii-calc-base": "^1.78.1",
|
|
41
|
+
"@scope/jsii-calc-lib": "^1.78.1",
|
|
42
42
|
"@types/fs-extra": "^9.0.13",
|
|
43
43
|
"@types/lockfile": "^1.0.2",
|
|
44
44
|
"@types/tar": "^6.1.4",
|
|
45
45
|
"jest-expect-message": "^1.1.3",
|
|
46
|
-
"jsii-build-tools": "^1.
|
|
46
|
+
"jsii-build-tools": "^1.78.1",
|
|
47
47
|
"jsii-calc": "^3.20.120"
|
|
48
48
|
}
|
|
49
49
|
}
|