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

Function claimMessageRead

packages/infra/src/ClusterCosmos.ts:416–428  ·  view source on GitHub ↗
(doc: MessageDoc, now: number)

Source from the content-addressed store, hash-verified

414 )
415
416 const claimMessageRead = (doc: MessageDoc, now: number) =>
417 Effect
418 .tryPromise(() =>
419 container.item(doc.id, doc._partitionKey).patch<MessageDoc>(
420 [{ op: "set", path: "/lastRead", value: now }],
421 { accessCondition: { type: "IfMatch", condition: doc._etag ?? "" } }
422 )
423 )
424 .pipe(
425 Effect.tap(annotateItem),
426 Effect.as(true),
427 Effect.catchIf(isPreconditionFailed, () => Effect.succeed(false))
428 )
429
430 const batchDocs = <A extends { readonly id: string; readonly _partitionKey: string }>(
431 docs: ReadonlyArray<A>,

Callers 1

collectUnprocessedFunction · 0.85

Calls 4

patchMethod · 0.80
itemMethod · 0.80
pipeMethod · 0.65
succeedMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…