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

Function record

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

Source from the content-addressed store, hash-verified

815 let targets: ReadonlySet<string> = new Set();
816 const events: string[] = [];
817 const record = <A>(key: string, run: () => Promise<A>): Promise<A> => {
818 if (!targets.has(key)) return run();
819 events.push(`start:${key}`);
820 return run()
821 .then(
822 (result) =>
823 new Promise<A>((resolve) => {
824 setImmediate(() => resolve(result));
825 }),
826 )
827 .finally(() => {
828 events.push(`end:${key}`);
829 });
830 };
831 return {
832 arm: (keys: readonly string[]) => {
833 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