(
directory: AdminUserDirectory,
options: AdminUsersListOptions,
reads: {
readonly page: (
paging: AdminListSubjectsOptions,
) => Effect.Effect<readonly T[], AdminUsersError>;
readonly one: (externalId: string) => Effect.Effect<T | null, AdminUsersError>;
},
)
| 347 | * a search term beside an exact address has nothing left to narrow. |
| 348 | */ |
| 349 | const selectSubjects = <T>( |
| 350 | directory: AdminUserDirectory, |
| 351 | options: AdminUsersListOptions, |
| 352 | reads: { |
| 353 | readonly page: ( |
| 354 | paging: AdminListSubjectsOptions, |
| 355 | ) => Effect.Effect<readonly T[], AdminUsersError>; |
| 356 | readonly one: (externalId: string) => Effect.Effect<T | null, AdminUsersError>; |
| 357 | }, |
| 358 | ): Effect.Effect<readonly T[], AdminUsersError> => { |
| 359 | if (options.email !== undefined) { |
| 360 | return selectByEmail(directory, options.email, options, reads.one); |
| 361 | } |
| 362 | if (options.search !== undefined) { |
| 363 | return selectBySearch(directory, options.search, (externalIds) => |
| 364 | reads.page({ ...pagingOf(options), externalIds }), |
| 365 | ); |
| 366 | } |
| 367 | return reads.page(pagingOf(options)); |
| 368 | }; |
| 369 | |
| 370 | /** Only the paging window — never the filters — reaches the SDK: the filters |
| 371 | * are resolved here, and the SDK's own `externalIds` is set by this file. */ |
no test coverage detected