( self: ConfigProvider.ConfigProvider.Flat, that: LazyArg<ConfigProvider.ConfigProvider.Flat> )
| 518 | >(2, (self, that) => fromFlat(orElseFlat(self.flattened, () => that().flattened))) |
| 519 | |
| 520 | const orElseFlat = ( |
| 521 | self: ConfigProvider.ConfigProvider.Flat, |
| 522 | that: LazyArg<ConfigProvider.ConfigProvider.Flat> |
| 523 | ): ConfigProvider.ConfigProvider.Flat => |
| 524 | makeFlat({ |
| 525 | load: (path, config, split) => |
| 526 | pipe( |
| 527 | pathPatch.patch(path, self.patch), |
| 528 | core.flatMap((patch) => self.load(patch, config, split)), |
| 529 | core.catchAll((error1) => |
| 530 | pipe( |
| 531 | core.sync(that), |
| 532 | core.flatMap((that) => |
| 533 | pipe( |
| 534 | pathPatch.patch(path, that.patch), |
| 535 | core.flatMap((patch) => that.load(patch, config, split)), |
| 536 | core.catchAll((error2) => core.fail(configError.Or(error1, error2))) |
| 537 | ) |
| 538 | ) |
| 539 | ) |
| 540 | ) |
| 541 | ), |
| 542 | enumerateChildren: (path) => |
| 543 | pipe( |
| 544 | pathPatch.patch(path, self.patch), |
| 545 | core.flatMap((patch) => self.enumerateChildren(patch)), |
| 546 | core.either, |
| 547 | core.flatMap((left) => |
| 548 | pipe( |
| 549 | core.sync(that), |
| 550 | core.flatMap((that) => |
| 551 | pipe( |
| 552 | pathPatch.patch(path, that.patch), |
| 553 | core.flatMap((patch) => that.enumerateChildren(patch)), |
| 554 | core.either, |
| 555 | core.flatMap((right) => { |
| 556 | if (Either.isLeft(left) && Either.isLeft(right)) { |
| 557 | return core.fail(configError.And(left.left, right.left)) |
| 558 | } |
| 559 | if (Either.isLeft(left) && Either.isRight(right)) { |
| 560 | return core.succeed(right.right) |
| 561 | } |
| 562 | if (Either.isRight(left) && Either.isLeft(right)) { |
| 563 | return core.succeed(left.right) |
| 564 | } |
| 565 | if (Either.isRight(left) && Either.isRight(right)) { |
| 566 | return core.succeed(pipe(left.right, HashSet.union(right.right))) |
| 567 | } |
| 568 | throw new Error( |
| 569 | "BUG: ConfigProvider.orElseFlat - please report an issue at https://github.com/Effect-TS/effect/issues" |
| 570 | ) |
| 571 | }) |
| 572 | ) |
| 573 | ) |
| 574 | ) |
| 575 | ) |
| 576 | ), |
| 577 | patch: pathPatch.empty |
no test coverage detected