(
component: Component.Mountable.Any,
shared: Component.SharedRecord | undefined
)
| 1517 | } |
| 1518 | } |
| 1519 | const encodeShared = ( |
| 1520 | component: Component.Mountable.Any, |
| 1521 | shared: Component.SharedRecord | undefined |
| 1522 | ): { readonly shared?: Schema.Json } => { |
| 1523 | if (shared === undefined) return {} |
| 1524 | const out: Record<string, Schema.Json> = {} |
| 1525 | for (const read of sharedReads.readsOf(component.definition)) { |
| 1526 | const value = shared[read.name] |
| 1527 | if (value === undefined) continue |
| 1528 | const schema = read.key.sharesSchema |
| 1529 | out[read.name] = schema === undefined |
| 1530 | ? structural(value) |
| 1531 | : encodeWith( |
| 1532 | schema, |
| 1533 | `${read.key.name}.shares`, |
| 1534 | value |
| 1535 | ) as Schema.Json |
| 1536 | } |
| 1537 | return { shared: cap(out) } |
| 1538 | } |
| 1539 | const encodeCollected = ( |
| 1540 | component: Component.Mountable.Any, |
| 1541 | collected: ReadonlyArray<unknown> | undefined |
no test coverage detected