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

Function applyFactory

packages/plugins/openapi/src/sdk/definitions.ts:180–193  ·  view source on GitHub ↗
(items: typeof staged, factory: (d: (typeof staged)[number]) => string)

Source from the content-addressed store, hash-verified

178 const staged = definitions.map((d) => ({ ...d }));
179
180 const applyFactory = (items: typeof staged, factory: (d: (typeof staged)[number]) => string) => {
181 const byPath = new Map<string, typeof staged>();
182 for (const item of items) {
183 const bucket = byPath.get(item.toolPath) ?? [];
184 bucket.push(item);
185 byPath.set(item.toolPath, bucket);
186 }
187 for (const bucket of byPath.values()) {
188 if (bucket.length < 2) continue;
189 for (const d of bucket) {
190 d.toolPath = factory(d);
191 }
192 }
193 };
194
195 // Round 1: add version segment
196 applyFactory(staged, (d) =>

Callers 1

resolveCollisionsFunction · 0.85

Calls 5

factoryFunction · 0.85
pushMethod · 0.80
setMethod · 0.80
valuesMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected