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

Function deleteManyImpl

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

Source from the content-addressed store, hash-verified

1645 };
1646
1647 const deleteManyImpl = (
1648 owner: Owner,
1649 subject: string,
1650 entries: readonly { readonly collection: string; readonly key: string }[],
1651 ) =>
1652 Effect.gen(function* () {
1653 for (const [collection, keys] of keysByCollection(entries)) {
1654 const uniqueKeys = [...keys];
1655 for (
1656 let offset = 0;
1657 offset < uniqueKeys.length;
1658 offset += PLUGIN_STORAGE_DELETE_KEY_BATCH_SIZE
1659 ) {
1660 const batchKeys = uniqueKeys.slice(offset, offset + PLUGIN_STORAGE_DELETE_KEY_BATCH_SIZE);
1661 yield* input.core.deleteMany("plugin_storage", {
1662 where: (b) =>
1663 b.and(
1664 b("plugin_id", "=", input.pluginId),
1665 b("collection", "=", collection),
1666 b("key", "in", batchKeys),
1667 b("owner", "=", owner),
1668 b("subject", "=", subject),
1669 ),
1670 });
1671 }
1672 }
1673 });
1674
1675 const putManyImpl = (
1676 owner: Owner,

Callers 1

removeManyImplFunction · 0.85

Calls 1

keysByCollectionFunction · 0.85

Tested by

no test coverage detected