MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / effectStep

Function effectStep

src/ui-server/api/steps.ts:819–866  ·  view source on GitHub ↗
(by: Node, ref: { referenceName: string; line: number }, effect: Effect, depth: number, status: number | null = null)

Source from the content-addressed store, hash-verified

817 const effectSub = (e: NonNullable<WireStep['effect']>, by: Node): string =>
818 [e.category, e.model, e.access, by.name].filter((x): x is string => !!x).join(' · ');
819 const effectStep = (by: Node, ref: { referenceName: string; line: number }, effect: Effect, depth: number, status: number | null = null): StepRecord | null => {
820 const category = effect.category;
821 const id = status !== null ? `effect:${by.id}:${category}:${status}` : `effect:${by.id}:${category}`;
822 const existing = steps.get(id);
823 if (existing) {
824 const e = existing.effect!;
825 if (!e.apis.includes(ref.referenceName)) {
826 e.apis.push(ref.referenceName);
827 existing.label = `${e.apis[0]} +${e.apis.length - 1}`;
828 }
829 // Several models behind one box: list them; several accesses: say both.
830 if (effect.model && e.model !== effect.model) {
831 const models = new Set((e.model ?? '').split(', ').filter(Boolean));
832 models.add(effect.model);
833 e.model = [...models].slice(0, 3).join(', ') + (models.size > 3 ? ', …' : '');
834 }
835 if (effect.access && e.access && e.access !== effect.access) e.access = undefined;
836 existing.sub = effectSub(e, by);
837 return existing;
838 }
839 if (steps.size >= limit) {
840 truncated.steps++;
841 return null;
842 }
843 const e: NonNullable<WireStep['effect']> = {
844 api: ref.referenceName,
845 apis: [ref.referenceName],
846 category,
847 by: toNodeRef(by),
848 line: ref.line,
849 ...(effect.model ? { model: effect.model } : {}),
850 ...(effect.access ? { access: effect.access } : {}),
851 };
852 const record: StepRecord = {
853 id,
854 kind: 'effect',
855 anchor: false,
856 node: null,
857 label: ref.referenceName,
858 sub: effectSub(e, by),
859 depth,
860 cut: null,
861 effect: e,
862 root: null,
863 };
864 steps.set(id, record);
865 return record;
866 };
867
868 /**
869 * How a Spring MVC handler answers: each `return` of a view name — a string,

Callers 1

effectLinkFunction · 0.85

Calls 7

toNodeRefFunction · 0.90
effectSubFunction · 0.85
pushMethod · 0.80
getMethod · 0.65
addMethod · 0.45
joinMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected