( directory: AdminUserDirectory, email: string, options: AdminUsersListOptions, read: (externalId: string) => Effect.Effect<T | null, AdminUsersError>, )
| 295 | * "absent" the single-user path reports, not a storage fault. |
| 296 | */ |
| 297 | const selectByEmail = <T>( |
| 298 | directory: AdminUserDirectory, |
| 299 | email: string, |
| 300 | options: AdminUsersListOptions, |
| 301 | read: (externalId: string) => Effect.Effect<T | null, AdminUsersError>, |
| 302 | ): Effect.Effect<readonly T[], AdminUsersError> => |
| 303 | Effect.gen(function* () { |
| 304 | // An email no directory can resolve matches nothing, and costs no read. |
| 305 | const wanted = yield* resolveEmailFilter(directory, email); |
| 306 | if (wanted === null) return []; |
| 307 | const row = yield* read(wanted); |
| 308 | return row === null ? [] : pageOf([row], options); |
| 309 | }); |
| 310 | |
| 311 | /** |
| 312 | * The `?search=` read: FILTER by the directory, then PAGE through storage. |
no test coverage detected