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

Function record

packages/core/sdk/src/executor.test.ts:927–940  ·  view source on GitHub ↗
(key: string, run: () => Promise<A>)

Source from the content-addressed store, hash-verified

925 let targets: ReadonlySet<string> = new Set();
926 const events: string[] = [];
927 const record = <A>(key: string, run: () => Promise<A>): Promise<A> => {
928 if (!targets.has(key)) return run();
929 events.push(`start:${key}`);
930 return run()
931 .then(
932 (result) =>
933 new Promise<A>((resolve) => {
934 setImmediate(() => resolve(result));
935 }),
936 )
937 .finally(() => {
938 events.push(`end:${key}`);
939 });
940 };
941 return {
942 arm: (keys: readonly string[]) => {
943 targets = new Set(keys);

Callers 1

getFunction · 0.70

Calls 3

pushMethod · 0.80
runFunction · 0.70
resolveFunction · 0.50

Tested by

no test coverage detected