Constconst MyOp = Operation.make({
input: Schema.Void,
output: Schema.Void,
meta: { key: 'my-op' },
services: [DatabaseService],
});
// Direct call - handler can use DatabaseService
const op = Operation.withHandler(MyOp, (input) =>
Effect.gen(function* () {
const db = yield* DatabaseService;
return {};
}),
);
// Piped call
const op = MyOp.pipe(Operation.withHandler((input) => Effect.succeed({})));
Attaches a handler to an Operation definition. The handler may use any services declared in the operation, plus Operation.Service (always available). Dual API: can be called directly or used in a pipe.