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

Function deleteManyImpl

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

Source from the content-addressed store, hash-verified

1551 };
1552
1553 const deleteManyImpl = (
1554 owner: Owner,
1555 subject: string,
1556 entries: readonly { readonly collection: string; readonly key: string }[],
1557 ) =>
1558 Effect.gen(function* () {
1559 for (const [collection, keys] of keysByCollection(entries)) {
1560 const uniqueKeys = [...keys];
1561 for (
1562 let offset = 0;
1563 offset < uniqueKeys.length;
1564 offset += PLUGIN_STORAGE_DELETE_KEY_BATCH_SIZE
1565 ) {
1566 const batchKeys = uniqueKeys.slice(offset, offset + PLUGIN_STORAGE_DELETE_KEY_BATCH_SIZE);
1567 yield* input.core.deleteMany("plugin_storage", {
1568 where: (b) =>
1569 b.and(
1570 b("plugin_id", "=", input.pluginId),
1571 b("collection", "=", collection),
1572 b("key", "in", batchKeys),
1573 b("owner", "=", owner),
1574 b("subject", "=", subject),
1575 ),
1576 });
1577 }
1578 }
1579 });
1580
1581 const putManyImpl = (
1582 owner: Owner,

Callers 1

removeManyImplFunction · 0.85

Calls 1

keysByCollectionFunction · 0.85

Tested by

no test coverage detected