Hyperlinkv0.8.0-beta.28

Lookup

Source src/Lookup.ts:81824 lines
export const client = (
  node: AnyNode & { readonly path?: string },
): Layer.Layer<Services, LookupUnaddressed> => {
  if (node.path === undefined) {
    return lookupUnaddressedLayer(
      "key" in node && typeof node.key === "string" ? node.key : "lookup",
    );
  }
  const path = node.path;
  // Path overload of connectIpc — no UnaddressedNode on the error channel.
  // Opt out of default-on client verify: Lookup.client is often composed before (or
  // beside) the Lookup listen, and bind-or-dial ({@link layerOptions}) builds the
  // dial side without a guaranteed live peer at Layer.build. Connectivity fails on
  // the first Identity/Directory call instead.
  const clients: any = Layer.mergeAll(
    Hyperlink.client(Identity, node) as any,
    Hyperlink.client(Directory, node) as any,
    Hyperlink.client(Advice, node) as any,
  ) as any;
  return clients.pipe(
    Layer.provide(node.pipe(connectIpc(path))),
    Layer.provide(Hyperlink.clientVerify(false)),
  ) as any;
};
Referenced by 1 symbols