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

Function deleteManyImpl

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

Source from the content-addressed store, hash-verified

1303 };
1304
1305 const deleteManyImpl = (
1306 owner: Owner,
1307 subject: string,
1308 entries: readonly { readonly collection: string; readonly key: string }[],
1309 ) =>
1310 Effect.gen(function* () {
1311 for (const [collection, keys] of keysByCollection(entries)) {
1312 const uniqueKeys = [...keys];
1313 for (
1314 let offset = 0;
1315 offset < uniqueKeys.length;
1316 offset += PLUGIN_STORAGE_DELETE_KEY_BATCH_SIZE
1317 ) {
1318 const batchKeys = uniqueKeys.slice(offset, offset + PLUGIN_STORAGE_DELETE_KEY_BATCH_SIZE);
1319 yield* input.core.deleteMany("plugin_storage", {
1320 where: (b) =>
1321 b.and(
1322 b("plugin_id", "=", input.pluginId),
1323 b("collection", "=", collection),
1324 b("key", "in", batchKeys),
1325 b("owner", "=", owner),
1326 b("subject", "=", subject),
1327 ),
1328 });
1329 }
1330 }
1331 });
1332
1333 const putManyImpl = (
1334 owner: Owner,

Callers 2

putManyImplFunction · 0.85
removeManyImplFunction · 0.85

Calls 1

keysByCollectionFunction · 0.85

Tested by

no test coverage detected