MCPcopy Create free account
hub / github.com/Snowflyt/tinyeffect / defineEffectedFunctions

Function defineEffectedFunctions

test/backend-app.spec.ts:23–36  ·  view source on GitHub ↗
(
  methods: Methods,
)

Source from the content-addressed store, hash-verified

21}>;
22type _Id<T> = T extends infer U ? { [K in keyof U]: U[K] } : never;
23const defineEffectedFunctions = <Methods extends EffectedMethods>(
24 methods: Methods,
25): TransformEffectedMethods<Methods> => {
26 const transform = (methods: any): any =>
27 Object.fromEntries(
28 Object.entries(methods).map(([name, fnOrMethods]) => [
29 name,
30 typeof fnOrMethods === "function" ?
31 (...args: any) => effected(() => fnOrMethods(...args))
32 : transform(fnOrMethods),
33 ]),
34 );
35 return transform(methods);
36};
37
38const defineRepository = defineEffectedFunctions;
39const defineService = defineEffectedFunctions;

Callers

nothing calls this directly

Calls 1

transformFunction · 0.85

Tested by

no test coverage detected