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

Function deleteManyImpl

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

Source from the content-addressed store, hash-verified

1251 };
1252
1253 const deleteManyImpl = (
1254 owner: Owner,
1255 subject: string,
1256 entries: readonly { readonly collection: string; readonly key: string }[],
1257 ) =>
1258 Effect.gen(function* () {
1259 for (const [collection, keys] of keysByCollection(entries)) {
1260 const uniqueKeys = [...keys];
1261 for (
1262 let offset = 0;
1263 offset < uniqueKeys.length;
1264 offset += PLUGIN_STORAGE_DELETE_KEY_BATCH_SIZE
1265 ) {
1266 const batchKeys = uniqueKeys.slice(offset, offset + PLUGIN_STORAGE_DELETE_KEY_BATCH_SIZE);
1267 yield* input.core.deleteMany("plugin_storage", {
1268 where: (b) =>
1269 b.and(
1270 b("plugin_id", "=", input.pluginId),
1271 b("collection", "=", collection),
1272 b("key", "in", batchKeys),
1273 b("owner", "=", owner),
1274 b("subject", "=", subject),
1275 ),
1276 });
1277 }
1278 }
1279 });
1280
1281 const putManyImpl = (
1282 owner: Owner,

Callers 2

putManyImplFunction · 0.85
removeManyImplFunction · 0.85

Calls 1

keysByCollectionFunction · 0.85

Tested by

no test coverage detected