MCPcopy Create free account
hub / github.com/Effect-TS/effect / fromStepWithMetadata

Function fromStepWithMetadata

packages/effect/src/Schedule.ts:319–329  ·  view source on GitHub ↗
(
  step: Effect<
    (options: InputMetadata<Input>) => Pull.Pull<[Output, Duration.Duration], ErrorX, Output, EnvX>,
    Error,
    Env
  >
)

Source from the content-addressed store, hash-verified

317 * @since 4.0.0
318 */
319export const fromStepWithMetadata = <Input, Output, EnvX, ErrorX, Error, Env>(
320 step: Effect<
321 (options: InputMetadata<Input>) => Pull.Pull<[Output, Duration.Duration], ErrorX, Output, EnvX>,
322 Error,
323 Env
324 >
325): Schedule<Output, Input, Error | Pull.ExcludeDone<ErrorX>, Env | EnvX> =>
326 fromStep(effect.map(step, (f) => {
327 const meta = metadataFn()
328 return (now, input) => f(meta(now, input))
329 }))
330
331/**
332 * Extracts the step function from a Schedule.

Callers 6

durationFunction · 0.85
duringFunction · 0.85
exponentialFunction · 0.85
fixedFunction · 0.85
spacedFunction · 0.85
windowedFunction · 0.85

Calls 5

fromStepFunction · 0.85
metadataFnFunction · 0.85
fFunction · 0.50
metaFunction · 0.50
mapMethod · 0.45

Tested by

no test coverage detected