(value: SystemContext)
| 196 | |
| 197 | /** Creates the immutable baseline and durable snapshot for a new generation. */ |
| 198 | export function initialize(value: SystemContext): Effect.Effect<Generation, InitializationBlocked> { |
| 199 | return observe(value).pipe( |
| 200 | Effect.flatMap((entries) => { |
| 201 | const unavailable = entries.flatMap((entry) => (entry._tag === "Unavailable" ? [entry.key] : [])) |
| 202 | if (unavailable.length > 0) return new InitializationBlocked({ keys: unavailable }) |
| 203 | return Effect.succeed(initializeObservation(entries)) |
| 204 | }), |
| 205 | ) |
| 206 | } |
| 207 | |
| 208 | function initializeObservation(entries: ReadonlyArray<Entry>): Generation { |
| 209 | const available = entries.filter((entry): entry is AvailableEntry => entry._tag === "Available") |
nothing calls this directly
no test coverage detected