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

Function upsert

packages/infra/src/WorkflowEngineCosmos.ts:285–291  ·  view source on GitHub ↗
(
    body: T
  )

Source from the content-addressed store, hash-verified

283 // Last-writer-wins upsert — used to overwrite a persisted *suspended* activity
284 // result once it finally completes (create-only ops can't transition it).
285 const upsert = <T extends { readonly id: string; readonly _partitionKey: string }>(
286 body: T
287 ): Effect.Effect<void> =>
288 Effect.gen(function*() {
289 const resp = yield* Effect.promise(() => container.items.upsert<T>(body))
290 yield* annotateCosmosResponse({ requestCharge: resp.requestCharge, statusCode: resp.statusCode })
291 })
292
293 const readPoint = <T extends { id: string }>(id: string, executionId: string) =>
294 Effect.promise(() => container.item(id, executionId).read<T>()).pipe(

Callers 1

Calls 2

annotateCosmosResponseFunction · 0.90
upsertMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…