| 127 | } |
| 128 | |
| 129 | const enumerateChildren = ( |
| 130 | path: ReadonlyArray<string> |
| 131 | ): Effect.Effect<HashSet.HashSet<string>, ConfigError.ConfigError> => |
| 132 | core.sync(() => { |
| 133 | const current = getEnv() |
| 134 | const keys = Object.keys(current) |
| 135 | const keyPaths = keys.map((value) => unmakePathString(value.toUpperCase())) |
| 136 | const filteredKeyPaths = keyPaths.filter((keyPath) => { |
| 137 | for (let i = 0; i < path.length; i++) { |
| 138 | const pathComponent = pipe(path, Arr.unsafeGet(i)) |
| 139 | const currentElement = keyPath[i] |
| 140 | if (currentElement === undefined || pathComponent !== currentElement) { |
| 141 | return false |
| 142 | } |
| 143 | } |
| 144 | return true |
| 145 | }).flatMap((keyPath) => keyPath.slice(path.length, path.length + 1)) |
| 146 | return HashSet.fromIterable(filteredKeyPaths) |
| 147 | }) |
| 148 | |
| 149 | return fromFlat(makeFlat({ load, enumerateChildren, patch: pathPatch.empty })) |
| 150 | } |