(value: unknown)
| 114 | } |
| 115 | |
| 116 | function state(value: unknown): ModelState { |
| 117 | if (!isRecord(value)) { |
| 118 | return {} |
| 119 | } |
| 120 | |
| 121 | const variant = isRecord(value.variant) |
| 122 | ? Object.fromEntries( |
| 123 | Object.entries(value.variant).flatMap(([key, item]) => { |
| 124 | if (typeof item !== "string") { |
| 125 | return [] |
| 126 | } |
| 127 | |
| 128 | return [[key, item] as const] |
| 129 | }), |
| 130 | ) |
| 131 | : undefined |
| 132 | |
| 133 | return { |
| 134 | ...value, |
| 135 | variant, |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | function createLayer(fs = AppNodeBuilder.build(FSUtil.node)) { |
| 140 | return Layer.fresh( |
no test coverage detected