@code0-tech/tucana 0.0.57 → 0.0.58
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.
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {Value} from "../pb/shared.struct_pb.js";
|
|
2
2
|
|
|
3
|
-
type
|
|
3
|
+
export type PlainValue = null | number | string | boolean | Array<PlainValue> | object;
|
|
4
4
|
|
|
5
|
-
export function toAllowedValue(value: Value):
|
|
5
|
+
export function toAllowedValue(value: Value): PlainValue {
|
|
6
6
|
switch (value.kind.oneofKind) {
|
|
7
7
|
case "nullValue":
|
|
8
8
|
return null;
|
|
@@ -15,7 +15,7 @@ export function toAllowedValue(value: Value): AllowedValue {
|
|
|
15
15
|
case "listValue":
|
|
16
16
|
return value.kind.listValue.values.map(toAllowedValue);
|
|
17
17
|
case "structValue":
|
|
18
|
-
const obj: {[key: string]:
|
|
18
|
+
const obj: {[key: string]: PlainValue} = {};
|
|
19
19
|
for (const [k, v] of Object.entries(value.kind.structValue.fields)) {
|
|
20
20
|
obj[k] = toAllowedValue(v);
|
|
21
21
|
}
|
|
@@ -26,7 +26,7 @@ export function toAllowedValue(value: Value): AllowedValue {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
export function constructValue(value:
|
|
29
|
+
export function constructValue(value: PlainValue): Value {
|
|
30
30
|
if (value === null) {
|
|
31
31
|
return {kind: {oneofKind: "nullValue", nullValue: 0}};
|
|
32
32
|
}
|