MCPcopy Create free account
hub / github.com/effect-app/libs / createExec

Function createExec

packages/infra/src/WorkflowEngineSqlite.ts:322–343  ·  view source on GitHub ↗
(initial: ExecState)

Source from the content-addressed store, hash-verified

320 .pipe(annotate("replaceExec", state.executionId))
321
322 const createExec = (initial: ExecState): Effect.Effect<boolean> =>
323 exec(
324 `INSERT INTO "${execTable}"
325 (execution_id, workflow_name, payload, parent, status, suspended, interrupted, etag)
326 VALUES (?, ?, ?, ?, ?, ?, ?, ?)
327 ON CONFLICT DO NOTHING
328 RETURNING execution_id`,
329 [
330 initial.executionId,
331 initial.workflowName,
332 initial.payload,
333 initial.parent ?? null,
334 initial.status,
335 initial.suspended ? 1 : 0,
336 initial.interrupted ? 1 : 0,
337 initial.etag
338 ]
339 )
340 .pipe(
341 Effect.map((rows) => (rows as ReadonlyArray<unknown>).length > 0),
342 annotate("createExec", initial.executionId)
343 )
344
345 // First-writer-wins persistence of an activity result; returns true if this
346 // call won, false if another writer beat us to the (exec, name, attempt) row.

Callers 1

Calls 4

execFunction · 0.70
annotateFunction · 0.70
pipeMethod · 0.65
mapMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…