(payload)
| 80 | // closed-vocabulary miss — always an error, never a warning, since there is no |
| 81 | // valid typed object to fall back to. Same nested-union case as build() above. |
| 82 | fromWire(payload) { |
| 83 | if (objectOnly && (typeof payload !== 'object' || payload === null || Array.isArray(payload))) { |
| 84 | throw new ValidationError(`${name}: expected an object on the wire, got ${typeof payload}`) |
| 85 | } |
| 86 | const ref = selectVariant(selector, payload, (d, key) => Object.hasOwn(d, key)) |
| 87 | if (ref === undefined) { |
| 88 | throw new ValidationError(`${name}: received a variant not in this binding's BiDi schema`) |
| 89 | } |
| 90 | const variant = resolve(ref) |
| 91 | if (variant.kind === 'union') { |
| 92 | return variant.fromWire(payload) |
| 93 | } |
| 94 | return variant.RecordClass.fromWire(payload) |
| 95 | }, |
| 96 | } |
| 97 | |
| 98 | register(name, union) |
nothing calls this directly
no test coverage detected