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

Function report

apps/cloud/src/auth/mirror-feeders.node.test.ts:1537–1569  ·  view source on GitHub ↗
(
    org: string,
    backfilledAt: Date | null,
    active: number,
    workos: Partial<WorkOSClientService> = {},
  )

Source from the content-addressed store, hash-verified

1535 });
1536
1537 const report = (
1538 org: string,
1539 backfilledAt: Date | null,
1540 active: number,
1541 workos: Partial<WorkOSClientService> = {},
1542 ) =>
1543 Effect.gen(function* () {
1544 const reported: { organizationId: string; seats: number }[] = [];
1545 const writes: string[] = [];
1546 const recording = Layer.succeed(AutumnService)({
1547 use: () => Effect.die("the seat reporter sets seats, it does not read"),
1548 ensureCustomer: () => Effect.void,
1549 findCustomer: () => Effect.die("feeders do not read billing"),
1550 checkExecutionBalance: () => Effect.die("the seat reporter does not check balances"),
1551 trackExecution: () => Effect.void,
1552 setMemberSeats: (organizationId, seats) =>
1553 Effect.sync(() => {
1554 reported.push({ organizationId, seats });
1555 }),
1556 });
1557 yield* forkReportMemberSeats(org).pipe(
1558 Effect.provide(
1559 Layer.mergeAll(
1560 recordingMirror(backfilledAt, writes),
1561 directoryWith(org, active),
1562 recording,
1563 stubWorkOS(workos),
1564 ),
1565 ),
1566 );
1567 // The Autumn call is forked; it is synchronous here, so it has landed.
1568 return { reported, writes };
1569 });
1570
1571 it.effect(
1572 "sets the active member count of a scanned organization without touching WorkOS",

Callers 1

Calls 6

forkReportMemberSeatsFunction · 0.90
recordingMirrorFunction · 0.85
directoryWithFunction · 0.85
pushMethod · 0.80
stubWorkOSFunction · 0.70
syncMethod · 0.65

Tested by

no test coverage detected