MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / selectByEmail

Function selectByEmail

packages/core/api/src/admin/reads.ts:281–293  ·  view source on GitHub ↗
(
  directory: AdminUserDirectory,
  email: string,
  options: AdminUsersListOptions,
  read: (externalId: string) => Effect.Effect<T | null, AdminUsersError>,
)

Source from the content-addressed store, hash-verified

279 * "absent" the single-user path reports, not a storage fault.
280 */
281const selectByEmail = <T>(
282 directory: AdminUserDirectory,
283 email: string,
284 options: AdminUsersListOptions,
285 read: (externalId: string) => Effect.Effect<T | null, AdminUsersError>,
286): Effect.Effect<readonly T[], AdminUsersError> =>
287 Effect.gen(function* () {
288 // An email no directory can resolve matches nothing, and costs no read.
289 const wanted = yield* resolveEmailFilter(directory, email);
290 if (wanted === null) return [];
291 const row = yield* read(wanted);
292 return row === null ? [] : pageOf([row], options);
293 });
294
295export const listUsers = (
296 admin: ExecutorAdmin,

Callers 2

listUsersFunction · 0.85
listUsersWithConnectionsFunction · 0.85

Calls 3

resolveEmailFilterFunction · 0.85
readFunction · 0.70
pageOfFunction · 0.70

Tested by

no test coverage detected