MCPcopy Create free account
hub / github.com/EvoMap/evolver / makeProxy

Function makeProxy

test/proxyAssetSearchRelief.test.js:12–23  ·  view source on GitHub ↗
(proxyHttpImpl, { nodeId = 'node_test' } = {})

Source from the content-addressed store, hash-verified

10const { EvoMapProxy, parseRetryAfterMs } = require('../src/proxy/index.js');
11
12function makeProxy(proxyHttpImpl, { nodeId = 'node_test' } = {}) {
13 const p = Object.create(EvoMapProxy.prototype);
14 p._searchCache = new Map();
15 p._searchInflight = new Map();
16 p._searchCooldownUntil = 0;
17 p.store = { getState: (k) => (k === 'node_id' ? nodeId : undefined) };
18 p.logger = { warn() {} };
19 let calls = 0;
20 p._proxyHttp = async (...args) => { calls += 1; return proxyHttpImpl(...args); };
21 Object.defineProperty(p, '_calls', { get: () => calls });
22 return p;
23}
24
25test('injects this node_id into the search query for hub attribution', async () => {
26 let seenQuery = null;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected