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

Function handlerFor

apps/cloud/src/auth/workos-events-sync.node.test.ts:1197–1219  ·  view source on GitHub ↗
(deps: {
    readonly secret: string | undefined;
    readonly detached: Promise<void>[];
    readonly synced: number[];
  })

Source from the content-addressed store, hash-verified

1195 const SECRET = "whsec_placeholder_signing_secret";
1196
1197 const handlerFor = (deps: {
1198 readonly secret: string | undefined;
1199 readonly detached: Promise<void>[];
1200 readonly synced: number[];
1201 }) =>
1202 HttpRouter.toWebHandler(
1203 makeWorkOsWebhookRoute({
1204 secret: deps.secret,
1205 detach: (work) => {
1206 deps.detached.push(work);
1207 },
1208 sync: () => {
1209 deps.synced.push(1);
1210 return Promise.resolve();
1211 },
1212 }).pipe(
1213 // The REAL client: its `webhooks.constructEvent` is the signature check
1214 // under test. The api key / client id it reads are the vitest env's.
1215 Layer.provideMerge(WorkOSClient.Default),
1216 Layer.provideMerge(HttpServer.layerServices),
1217 ),
1218 { disableLogger: true },
1219 ).handler;
1220
1221 const delivery = {
1222 id: "event_placeholder",

Callers 1

Calls 3

makeWorkOsWebhookRouteFunction · 0.90
pushMethod · 0.80
resolveMethod · 0.80

Tested by

no test coverage detected