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

Function toGuardResolver

packages/core/sdk/src/hosted-http-client.ts:261–272  ·  view source on GitHub ↗
(resolve: HostedHostnameResolver)

Source from the content-addressed store, hash-verified

259// validateHostedOutboundUrl — from having a second copy of the rule.
260const toGuardResolver =
261 (resolve: HostedHostnameResolver): GuardResolver =>
262 (hostname) =>
263 Effect.tryPromise({
264 try: (signal) => resolve(hostname, signal),
265 catch: () => new HostedHostnameResolutionFailed({ hostname, empty: false }),
266 }).pipe(
267 Effect.flatMap((addresses) =>
268 addresses.length === 0
269 ? Effect.fail(new HostedHostnameResolutionFailed({ hostname, empty: true }))
270 : Effect.succeed(addresses),
271 ),
272 );
273
274const DNS_CACHE_TTL_MILLIS = 60_000;
275const DNS_CACHE_CAPACITY = 256;

Callers 2

makeSharedResolverFunction · 0.85

Calls 1

resolveFunction · 0.50

Tested by

no test coverage detected