MCPcopy Index your code
hub / github.com/CapSoftware/Cap / provideOptionalAuth

Function provideOptionalAuth

packages/web-backend/src/Auth.ts:107–119  ·  view source on GitHub ↗
(
	app: Effect.Effect<A, E, R>,
)

Source from the content-addressed store, hash-verified

105);
106
107export const provideOptionalAuth = <A, E, R>(
108 app: Effect.Effect<A, E, R>,
109): Effect.Effect<A, E | DatabaseError | Cause.UnknownException, R | Database> =>
110 Effect.gen(function* () {
111 const user = yield* getCurrentUser;
112
113 return yield* user.pipe(
114 Option.match({
115 onNone: () => app,
116 onSome: (user) => app.pipe(Effect.provide(makeCurrentUserLayer(user))),
117 }),
118 );
119 });

Callers

nothing calls this directly

Calls 1

makeCurrentUserLayerFunction · 0.85

Tested by

no test coverage detected