MCPcopy
hub / github.com/Effect-TS/effect / makeDerive

Function makeDerive

packages/cli/src/internal/command.ts:150–166  ·  view source on GitHub ↗
(
  self: Command.Command<Name, any, any, A>,
  options: {
    readonly descriptor?: Descriptor.Command<A>
    readonly handler?: (_: A) => Effect.Effect<void, E, R>
    readonly transform?: Command.Command.Transform<R, E, A>
  }
)

Source from the content-addressed store, hash-verified

148}
149
150const makeDerive = <Name extends string, R, E, A>(
151 self: Command.Command<Name, any, any, A>,
152 options: {
153 readonly descriptor?: Descriptor.Command<A>
154 readonly handler?: (_: A) => Effect.Effect<void, E, R>
155 readonly transform?: Command.Command.Transform<R, E, A>
156 }
157): Command.Command<Name, R, E, A> => {
158 const command = Object.create(Prototype)
159 command.descriptor = options.descriptor ?? self.descriptor
160 command.handler = options.handler ?? self.handler
161 command.transform = options.transform
162 ? ((effect: Effect.Effect<void, E, R>, opts: A) => options.transform!(self.transform(effect, opts), opts))
163 : self.transform
164 command.tag = self.tag
165 return command
166}
167
168/** @internal */
169export const fromDescriptor = dual<

Callers 1

command.tsFile · 0.85

Calls 1

createMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…