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

Function eventsApi

apps/cloud/src/auth/workos-events-sync.node.test.ts:884–906  ·  view source on GitHub ↗
(
    pages: readonly Page[],
    requests: WorkOSListEventsOptions[],
    onPage: (index: number) => Effect.Effect<void, unknown, WorkOsMirror> = () => Effect.void,
    methods: Partial<WorkOSClientService> = {},
  )

Source from the content-addressed store, hash-verified

882 * WorkOS call the run under test is allowed to make.
883 */
884 const eventsApi = (
885 pages: readonly Page[],
886 requests: WorkOSListEventsOptions[],
887 onPage: (index: number) => Effect.Effect<void, unknown, WorkOsMirror> = () => Effect.void,
888 methods: Partial<WorkOSClientService> = {},
889 ) =>
890 Effect.map(WorkOsMirror.asEffect(), (mirror) =>
891 stubWorkOS({
892 ...methods,
893 listEvents: (options) =>
894 Effect.gen(function* () {
895 const index = requests.length;
896 requests.push(options);
897 yield* onPage(index).pipe(Effect.provideService(WorkOsMirror, mirror), Effect.orDie);
898 const page = pages[index] ?? { data: [], after: null };
899 return {
900 object: "list" as const,
901 data: [...page.data],
902 listMetadata: { before: null, after: page.after },
903 };
904 }),
905 }),
906 );
907
908 const sync = (
909 workos: Layer.Layer<WorkOSClient>,

Callers 1

Calls 2

pushMethod · 0.80
stubWorkOSFunction · 0.70

Tested by

no test coverage detected