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

Function execute

packages/effect/src/unstable/workflow/Workflow.ts:343–371  ·  view source on GitHub ↗
(
    this: AnyWithProps,
    fields: any,
    opts?: { readonly discard?: Discard } | undefined
  )

Source from the content-addressed store, hash-verified

341 })
342 },
343 execute<const Discard extends boolean = false>(
344 this: AnyWithProps,
345 fields: any,
346 opts?: { readonly discard?: Discard } | undefined
347 ) {
348 return Effect.suspend(() => {
349 const payload = this.payloadSchema.make(fields)
350 return Effect.flatMap(
351 EngineTag,
352 (engine) =>
353 Effect.flatMap(makeExecutionIdFromPayload(this, payload), (executionId) =>
354 Effect.andThen(
355 Effect.annotateCurrentSpan({ executionId }),
356 engine.execute(this as any, {
357 executionId,
358 payload,
359 discard: opts?.discard,
360 suspendedRetrySchedule: this.suspendedRetrySchedule
361 })
362 ))
363 )
364 }).pipe(
365 Effect.withSpan(
366 `${this._tag}.execute`,
367 {},
368 { captureStackTrace: false }
369 )
370 ) as any
371 },
372 poll(this: Workflow<string, AnyStructSchema, Schema.Top, Schema.Top>, executionId: string) {
373 return Effect.flatMap(EngineTag, (engine) => engine.poll(this, executionId)).pipe(
374 Effect.withSpan(`${this._tag}.poll`, { attributes: { executionId } }, { captureStackTrace: false })

Callers 3

makeUnsafeFunction · 0.70

Calls 4

pipeMethod · 0.65
makeMethod · 0.65
executeMethod · 0.45

Tested by

no test coverage detected