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

Function deleteManyImpl

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

Source from the content-addressed store, hash-verified

1273 };
1274
1275 const deleteManyImpl = (
1276 owner: Owner,
1277 subject: string,
1278 entries: readonly { readonly collection: string; readonly key: string }[],
1279 ) =>
1280 Effect.gen(function* () {
1281 for (const [collection, keys] of keysByCollection(entries)) {
1282 const uniqueKeys = [...keys];
1283 for (
1284 let offset = 0;
1285 offset < uniqueKeys.length;
1286 offset += PLUGIN_STORAGE_DELETE_KEY_BATCH_SIZE
1287 ) {
1288 const batchKeys = uniqueKeys.slice(offset, offset + PLUGIN_STORAGE_DELETE_KEY_BATCH_SIZE);
1289 yield* input.core.deleteMany("plugin_storage", {
1290 where: (b) =>
1291 b.and(
1292 b("plugin_id", "=", input.pluginId),
1293 b("collection", "=", collection),
1294 b("key", "in", batchKeys),
1295 b("owner", "=", owner),
1296 b("subject", "=", subject),
1297 ),
1298 });
1299 }
1300 }
1301 });
1302
1303 const putManyImpl = (
1304 owner: Owner,

Callers 2

putManyImplFunction · 0.85
removeManyImplFunction · 0.85

Calls 1

keysByCollectionFunction · 0.85

Tested by

no test coverage detected