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

Function deleteManyImpl

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

Source from the content-addressed store, hash-verified

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

Callers 2

putManyImplFunction · 0.85
removeManyImplFunction · 0.85

Calls 1

keysByCollectionFunction · 0.85

Tested by

no test coverage detected