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

Function userRows

apps/host-selfhost/src/auth/member-directory.ts:106–121  ·  view source on GitHub ↗
(op: string, userIds: readonly string[])

Source from the content-addressed store, hash-verified

104 });
105
106 const userRows = (op: string, userIds: readonly string[]) =>
107 Effect.gen(function* () {
108 const users = new Map<string, (typeof UserRow)["Type"]>();
109 for (let start = 0; start < userIds.length; start += IN_CHUNK) {
110 const ids = userIds.slice(start, start + IN_CHUNK);
111 const page = yield* read(op, () =>
112 adapter.findMany({
113 model: "user",
114 where: [{ field: "id", operator: "in", value: [...ids] }],
115 limit: ids.length,
116 }),
117 ).pipe(Effect.flatMap(decodeUserRows), Effect.mapError(undecodable(op)));
118 for (const user of page) users.set(user.id, user);
119 }
120 return users;
121 });
122
123 // Every read: the member rows matching `where`, joined to their users. A
124 // member whose user row is gone is not reported — there is no principal

Callers 1

loadFunction · 0.85

Calls 3

undecodableFunction · 0.85
readFunction · 0.70
setMethod · 0.65

Tested by

no test coverage detected