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

Function deleteManyImpl

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

Source from the content-addressed store, hash-verified

1026 };
1027
1028 const deleteManyImpl = (
1029 owner: Owner,
1030 subject: string,
1031 entries: readonly { readonly collection: string; readonly key: string }[],
1032 ) =>
1033 Effect.gen(function* () {
1034 for (const [collection, keys] of keysByCollection(entries)) {
1035 const uniqueKeys = [...keys];
1036 for (
1037 let offset = 0;
1038 offset < uniqueKeys.length;
1039 offset += PLUGIN_STORAGE_DELETE_KEY_BATCH_SIZE
1040 ) {
1041 const batchKeys = uniqueKeys.slice(offset, offset + PLUGIN_STORAGE_DELETE_KEY_BATCH_SIZE);
1042 yield* input.core.deleteMany("plugin_storage", {
1043 where: (b) =>
1044 b.and(
1045 b("plugin_id", "=", input.pluginId),
1046 b("collection", "=", collection),
1047 b("key", "in", batchKeys),
1048 b("owner", "=", owner),
1049 b("subject", "=", subject),
1050 ),
1051 });
1052 }
1053 }
1054 });
1055
1056 const putManyImpl = (
1057 owner: Owner,

Callers 2

putManyImplFunction · 0.85
removeManyImplFunction · 0.85

Calls 1

keysByCollectionFunction · 0.85

Tested by

no test coverage detected