import { Effect, Layer, Option } from "effect"; import { HttpClient, HttpClientRequest } from "effect/unstable/http"; import { GraphqlInvocationError } from "./errors"; import { type OperationBinding, InvocationResult } from "./types"; const endpointWithQueryParams = (endpoint: string, queryParams: Record): string => { if (Object.keys(queryParams).length === 0) return endpoint; const url = new URL(endpoint); for (const [name, value] of Object.entries(queryParams)) { url.searchParams.set(name, value); } return url.toString(); }; export const endpointForTelemetry = (endpoint: string): string => { if (!URL.canParse(endpoint)) return endpoint; const url = new URL(endpoint); url.search = ""; url.hash = ""; return url.toString(); }; /** The operation string to send for a call. A caller-supplied `select` overrides * the default scalar-leaf selection: it is spliced into the field's selection * set (`field {