Client

codemode-gatewaysourcetypescript
Path: codemode-gateway/src/cf/client.tsRelative: src/cf/client.tsSubproject: codemode-gatewayCategory: codemode-gateway
Lines: 176Bytes: 5,471Imports: 2Exports: 3

Content Preview

  1. import type { CfEnvelope, CfError, Env } from "../types";
  2. import { CloudflareApiError } from "../types";
  3. /**
  4. * Host-side Cloudflare REST API client used by the `cf` namespace.
  5. *
  6. * Network-boundary code: validates the token, applies exponential backoff +
  7. * jitter (3 attempts on 429 / 5xx / network errors), unwraps the standard
  8. * `{success, result, errors}` envelope, and throws typed `CloudflareApiError`
  9. * on `success:false` or non-2xx. No `console.*` in any path.
  10. *
  11. * Per ADR-2026-07-10-c