| 114 | const router = Router(RepoRpcs)({ |
| 115 | dependencies: [RepoItems.Default, OtherItems.Default], |
| 116 | *effect(match) { |
| 117 | const repo = yield* RepoItems |
| 118 | const otherRepo = yield* OtherItems |
| 119 | return match({ |
| 120 | GetRepoCount: () => |
| 121 | Effect |
| 122 | .sync(() => repoCountRuns++) |
| 123 | .pipe(Effect.andThen(repo.all), Effect.map((items) => items.length), Effect.orDie), |
| 124 | GetRepoCountRuns: () => Effect.sync(() => repoCountRuns), |
| 125 | SaveRepoItem: ({ id, label }) => repo.save(new RepoItem({ id, label })).pipe(Effect.orDie), |
| 126 | SaveOtherItem: ({ id, label }) => otherRepo.save(new OtherItem({ id, label })).pipe(Effect.orDie) |
| 127 | }) |
| 128 | } |
| 129 | }) |
| 130 | |
| 131 | const RpcRouterLayer = matchAll({ router }) |