MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / deleteManyImpl

Function deleteManyImpl

packages/core/sdk/src/executor.ts:1614–1640  ·  view source on GitHub ↗
(
    owner: Owner,
    subject: string,
    entries: readonly { readonly collection: string; readonly key: string }[],
  )

Source from the content-addressed store, hash-verified

1612 };
1613
1614 const deleteManyImpl = (
1615 owner: Owner,
1616 subject: string,
1617 entries: readonly { readonly collection: string; readonly key: string }[],
1618 ) =>
1619 Effect.gen(function* () {
1620 for (const [collection, keys] of keysByCollection(entries)) {
1621 const uniqueKeys = [...keys];
1622 for (
1623 let offset = 0;
1624 offset < uniqueKeys.length;
1625 offset += PLUGIN_STORAGE_DELETE_KEY_BATCH_SIZE
1626 ) {
1627 const batchKeys = uniqueKeys.slice(offset, offset + PLUGIN_STORAGE_DELETE_KEY_BATCH_SIZE);
1628 yield* input.core.deleteMany("plugin_storage", {
1629 where: (b) =>
1630 b.and(
1631 b("plugin_id", "=", input.pluginId),
1632 b("collection", "=", collection),
1633 b("key", "in", batchKeys),
1634 b("owner", "=", owner),
1635 b("subject", "=", subject),
1636 ),
1637 });
1638 }
1639 }
1640 });
1641
1642 const putManyImpl = (
1643 owner: Owner,

Callers 1

removeManyImplFunction · 0.85

Calls 1

keysByCollectionFunction · 0.85

Tested by

no test coverage detected