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

Function deleteManyImpl

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

Source from the content-addressed store, hash-verified

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

Callers 2

putManyImplFunction · 0.85
removeManyImplFunction · 0.85

Calls 1

keysByCollectionFunction · 0.85

Tested by

no test coverage detected