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

Function countingProvider

packages/core/sdk/src/executor.test.ts:983–1000  ·  view source on GitHub ↗
(
  calls: { count: number },
  wrapGet?: <A>(run: () => Promise<A>) => Promise<A>,
)

Source from the content-addressed store, hash-verified

981};
982
983const countingProvider = (
984 calls: { count: number },
985 wrapGet?: <A>(run: () => Promise<A>) => Promise<A>,
986) => {
987 const store = new Map<string, string>();
988 const provider: CredentialProvider = {
989 key: ProviderKey.make("memory"),
990 writable: true,
991 get: (id) =>
992 Effect.promise(() => {
993 calls.count++;
994 const run = async () => store.get(String(id)) ?? null;
995 return wrapGet ? wrapGet(run) : run();
996 }),
997 set: (id, value) => Effect.sync(() => void store.set(String(id), value)),
998 };
999 return provider;
1000};
1001
1002const invokeConcurrencyPlugin = (provider: CredentialProvider) =>
1003 definePlugin(() => ({

Callers 2

recordCredentialLaunchFunction · 0.85
executor.test.tsFile · 0.85

Calls 3

runFunction · 0.70
syncMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected