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

Function deleteManyImpl

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

Source from the content-addressed store, hash-verified

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

Callers 2

putManyImplFunction · 0.85
removeManyImplFunction · 0.85

Calls 1

keysByCollectionFunction · 0.85

Tested by

no test coverage detected