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

Function countingProvider

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

Source from the content-addressed store, hash-verified

871};
872
873const countingProvider = (
874 calls: { count: number },
875 wrapGet?: <A>(run: () => Promise<A>) => Promise<A>,
876) => {
877 const store = new Map<string, string>();
878 const provider: CredentialProvider = {
879 key: ProviderKey.make("memory"),
880 writable: true,
881 get: (id) =>
882 Effect.promise(() => {
883 calls.count++;
884 const run = async () => store.get(String(id)) ?? null;
885 return wrapGet ? wrapGet(run) : run();
886 }),
887 set: (id, value) => Effect.sync(() => void store.set(String(id), value)),
888 };
889 return provider;
890};
891
892const invokeConcurrencyPlugin = (provider: CredentialProvider) =>
893 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