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

Function batchSet

packages/infra/src/Store/Memory.ts:351–373  ·  view source on GitHub ↗
(items: NonEmptyReadonlyArray<PM>)

Source from the content-addressed store, hash-verified

349 const all = Effect.map(values, Array.fromIterable)
350
351 const batchSet = (items: NonEmptyReadonlyArray<PM>) =>
352 Effect
353 .forEach(items, (i) => Effect.flatMap(s.find(i[idKey]), (current) => updateETag(i, idKey, current)))
354 .pipe(
355 Effect
356 .tap((items) =>
357 Ref
358 .get(store)
359 .pipe(
360 Effect
361 .map((m) => {
362 const mut = m as Map<Encoded[IdKey], PM>
363 items.forEach((e) => mut.set(e[idKey], e))
364 return mut
365 }),
366 Effect
367 .flatMap((_) => Ref.set(store, _))
368 )
369 ),
370 Effect
371 .map((_) => _),
372 withPermit
373 )
374
375 const batchRemove = (items: NonEmptyReadonlyArray<Encoded[IdKey]>) =>
376 Ref

Callers

nothing calls this directly

Calls 5

pipeMethod · 0.65
forEachMethod · 0.65
getMethod · 0.65
mapMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…