Write parseConfig, which turns a raw object (already parsed from JSON or YAML) into a typed service config.
Fields:
host: required, a string that is non-empty after trimming. The returned host is trimmed.port: optional, defaults to8080. If present it must be an integer from 1 to 65535. A numeric string such as"8080"is not accepted.debug: optional boolean, defaults tofalse.timeoutMs: optional. If present it must be a positive integer. If absent the config has no timeout.tags: optional array of strings, defaults to an empty array. Every element must be a string.
A field whose value is null or undefined counts as missing. Unknown fields are ignored.
Errors (report the first problem found, checking fields in the order listed above):
{ kind: "missing", field }whenhostis missing.{ kind: "wrong_type", field }when a present field has the wrong JavaScript type (fortags, also when an element is not a string).{ kind: "out_of_range", field }when a field has the right type but an invalid value (empty host, non-integer or out-of-range port, non-positive or non-integer timeout).