@molecule/api-uptime-fetch

Provider bond · uptime · API (Node) · v1.1.1 · Apache-2.0

In-process uptime provider for molecule.dev — probe a URL with verified public dialing, status assertions and TLS inspection

npm install @molecule/api-uptime-fetch

npm · Source on GitHub · Implements @molecule/api-uptime

How it works

@molecule/api-uptime-fetch is a provider bond on the API (Node) side: it implements the uptime core interface (@molecule/api-uptime) with a concrete vendor or library behind it.

Your code calls the core; you wire this provider once at startup. Swapping vendors later is one line in that wiring, not a rewrite.

Works with: @molecule/api-uptime

Reference

In-process uptime provider for molecule.dev — probe a URL with verified public dialing, status assertions and TLS inspection

Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit src/index.ts JSDoc, not this file.

Type

provider

Installation

npm install @molecule/api-uptime-fetch @molecule/api-uptime

API

Interfaces

UptimeFetchConfig

Options for createProvider().

interface UptimeFetchConfig {
  /**
   * Allow probing hosts that resolve to private, loopback or link-local
   * addresses (default `false`). For pointing the probe at your OWN internal
   * targets during development. NEVER enable this on a path that takes a
   * raw user-supplied URL — a verified-public probe cannot be pointed at
   * your own network; an unverified one is an SSRF primitive.
   */
  allowPrivateTargets?: boolean

  /**
   * The `User-Agent` the probe sends (default `molecule-uptime-probe/1.0`).
   * Some sites answer a health-check agent differently; name yourself
   * honestly.
   */
  userAgent?: string

  /**
   * The host resolver the dial decision asks (default: the core's
   * `resolvePublicAddress`, public unicast only). Injection seam for tests —
   * the same pattern the render machine's guard proxy uses for its
   * upstream-failure arms; production never passes it.
   */
  resolve?: (hostname: string) => Promise<{ address: string; family: number } | null>
}

Functions

createProvider(config)

Creates an in-process uptime provider.

function createProvider(config?: UptimeFetchConfig): UptimeProvider
  • config — Options; see UptimeFetchConfig.

Returns: A UptimeProvider probing from this process.

Constants

provider

The provider implementation (wire with setProvider).

const provider: UptimeProvider

Core Interface

Implements @molecule/api-uptime interface.

Bond Wiring

Setup function to register this provider with the core interface:

import { setProvider } from '@molecule/api-uptime'
import { provider } from '@molecule/api-uptime-fetch'

export function setupUptimeFetch(): void {
  setProvider(provider)
}

Injection Notes

Requirements

Peer dependencies:

  • @molecule/api-uptime >=1.0.0

Runtime Dependencies

  • @molecule/api-uptime