Hyperlinkv0.8.0-beta.28

Hyperlink

Source src/Hyperlink.ts:422617 lines
export const protocolIpc = (
  path: string,
  serialization: Layer.Layer<RpcSerialization.RpcSerialization> = defaultSerialization,
): Layer.Layer<RpcClient.Protocol> =>
  Layer.unwrap(
    // guard BEFORE the node-only dynamic import, so a browser gets the clear die (not the import error).
    dieIfIpcInBrowser.pipe(
      Effect.andThen(Effect.promise(() => import("@effect/platform-node"))),
      Effect.map(({ NodeSocket }) =>
        RpcClient.layerProtocolSocket().pipe(
          Layer.provide(serialization),
          Layer.provide(NodeSocket.layerNet({ path })),
          Layer.orDie,
        ),
      ),
    ),
  );
Referenced by 2 symbols