IF Commons GitHub

physical/http/mod

Written to: 3 requirements: 3 proved, 0 partly, 0 failing, 0 with no test recorded. 0001-integrations-layers FR-001, 0001-integrations-layers FR-003, 0001-integrations-layers FR-002

The HTTP adapter of observation (commons integrations 0004-integrations-physical): the read port of the logical layer made on Net's transport, with the read-only guard (only safe methods, and POST only to the declared token endpoints), backoff on 429 and 503, pages by Link or by a cursor of the body, bearer or signed requests, and a digest of what was fetched. It is the physical edge: the only place of observation that reaches a network.

A failure names the path of the request and never its query, its headers or its body, so that no credential or personal datum is said.

Source: commons/integrations/src/physical/http/mod.ts

2 of 6 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

Pagingtypeno test imports it
type Paging =
  | { readonly kind: "link" }
  | { readonly kind: "cursor"; readonly items: (body: Json) => readonly Json[]; readonly next: (body: Json, path: string) => string | undefined };

How a list pages: by the Link header, or by a cursor in the body (items takes a page's items, next the next page's path or undefined).

Authtypeno test imports it
type Auth =
  | { readonly kind: "bearer"; readonly secret: Secret; readonly scheme: string }
  | { readonly kind: "header"; readonly name: string; readonly secret: Secret }
  | { readonly kind: "sigv4"; readonly options: SigV4TransportOptions }
  | { readonly kind: "none" };

How the requests are authorized.

HttpReadOptionstypeno test imports it
type HttpReadOptions = {
  readonly transport: Transport;
  readonly base: string;
  readonly auth: Auth;
  readonly tokenEndpoints?: readonly string[];
  readonly headers?: Readonly<Record<string, string>>;
  readonly paging?: Paging;
  readonly maxPages?: number;
  readonly pause?: (ms: number) => Promise<void>;
};

What the read port of a system is made of.

failureOffunctionno test imports it
function failureOf(e: ReadError): ReadFailure

A failure of the read as the logical layer says it: what was asked and what came, never a payload.

httpReadPortfunction
function httpReadPort(o: HttpReadOptions): ReadPort

The read port of a system over a transport: read-only, backing off, paged, authorized; no write is possible through it.

Imported by 6 tests of the run (6 passed, 0 failed): the library's results

sha256Offunction
function sha256Of(text: string): Promise<Result<Sha256, IdError>>

The SHA-256 of a text, as the library's digest.

Imported by 6 tests of the run (6 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.