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

Function compose

packages/effect/src/eventlog/EventRow.ts:688–698  ·  view source on GitHub ↗
(x: Op, y: Op)

Source from the content-addressed store, hash-verified

686 | { readonly _tag: "remove"; readonly key: unknown }
687
688const compose = (x: Op, y: Op): Op => {
689 if (y._tag !== "patch") return y
690 switch (x._tag) {
691 case "set":
692 return { _tag: "set", row: { ...x.row, ...y.fields } }
693 case "patch":
694 return { _tag: "patch", key: y.key, fields: { ...x.fields, ...y.fields } }
695 case "remove":
696 return x
697 }
698}
699
700const resolve = (entry: Op, conflicts: ReadonlyArray<{ readonly payload: Op }>): Op | undefined => {
701 if (conflicts.length === 0) return entry

Callers 3

serveFunction · 0.90
toWebHandlerFunction · 0.90
resolveFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected