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

Function deleteManyImpl

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

Source from the content-addressed store, hash-verified

1631 };
1632
1633 const deleteManyImpl = (
1634 owner: Owner,
1635 subject: string,
1636 entries: readonly { readonly collection: string; readonly key: string }[],
1637 ) =>
1638 Effect.gen(function* () {
1639 for (const [collection, keys] of keysByCollection(entries)) {
1640 const uniqueKeys = [...keys];
1641 for (
1642 let offset = 0;
1643 offset < uniqueKeys.length;
1644 offset += PLUGIN_STORAGE_DELETE_KEY_BATCH_SIZE
1645 ) {
1646 const batchKeys = uniqueKeys.slice(offset, offset + PLUGIN_STORAGE_DELETE_KEY_BATCH_SIZE);
1647 yield* input.core.deleteMany("plugin_storage", {
1648 where: (b) =>
1649 b.and(
1650 b("plugin_id", "=", input.pluginId),
1651 b("collection", "=", collection),
1652 b("key", "in", batchKeys),
1653 b("owner", "=", owner),
1654 b("subject", "=", subject),
1655 ),
1656 });
1657 }
1658 }
1659 });
1660
1661 const putManyImpl = (
1662 owner: Owner,

Callers 1

removeManyImplFunction · 0.85

Calls 1

keysByCollectionFunction · 0.85

Tested by

no test coverage detected