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

Function load

apps/host-selfhost/src/auth/member-directory.ts:126–150  ·  view source on GitHub ↗
(op: string, where: AdapterWhere)

Source from the content-addressed store, hash-verified

124 // member whose user row is gone is not reported — there is no principal
125 // behind it to name.
126 const load = (op: string, where: AdapterWhere) =>
127 Effect.gen(function* () {
128 const rows = yield* memberRows(op, where);
129 const users = yield* userRows(
130 op,
131 rows.map((row) => row.userId),
132 );
133 const members: DirectoryMember[] = [];
134 for (const row of rows) {
135 const user = users.get(row.userId);
136 if (user === undefined) continue;
137 members.push({
138 accountId: row.userId,
139 membershipId: row.id,
140 organizationId: row.organizationId,
141 email: user.email,
142 name: user.name ?? null,
143 avatarUrl: user.image ?? null,
144 role: row.role,
145 status: "active",
146 lastActiveAt: null,
147 });
148 }
149 return members;
150 });
151
152 const orgWhere = (organizationId: string): AdapterWhere => [
153 { field: "organizationId", value: organizationId },

Callers 1

makeServiceFunction · 0.70

Calls 4

memberRowsFunction · 0.85
userRowsFunction · 0.85
pushMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected