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

Function noneWhenGone

apps/cloud/src/auth/workos-events-sync.ts:45–53  ·  view source on GitHub ↗
(
  read: Effect.Effect<A, WorkOSError>,
)

Source from the content-addressed store, hash-verified

43// A 404 is the deterministic "gone" the replay acts on; everything else
44// fails the run (see the header).
45const noneWhenGone = <A>(
46 read: Effect.Effect<A, WorkOSError>,
47): Effect.Effect<Option.Option<A>, WorkOSError> =>
48 read.pipe(
49 Effect.map(Option.some),
50 Effect.catchTag("WorkOSError", (error) =>
51 error.status === 404 ? Effect.succeed(Option.none<A>()) : Effect.fail(error),
52 ),
53 );
54
55const replayDeps: Effect.Effect<
56 WorkOsEventsReplayDeps<SyncFailure>,

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected