IF Commons GitHub

governance/status

Written to: 2 requirements: 2 proved, 0 partly, 0 failing, 0 with no test recorded. 0002-anyfs-serve-governance FR-002, 0002-anyfs-serve-governance FR-003

The statuses the server gives, as a closed list, and the total table from the code of the POSIX view to the status: what a local file system would have said as an errno is said here as the status a WebDAV client expects. A few codes mean something else in a few methods (an existing name is 405 for a new collection and 412 for a copy that may not overwrite), so the table takes the context.

import { statusOfErrno } from "./status.ts";
statusOfErrno("ENOENT", "other"); // 404
statusOfErrno("EEXIST", "mkcol"); // 405

Source: commons/anyfs-serve/src/governance/status.ts

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

STATUSESconst
const STATUSES: readonly [200, 201, 204, 206, 207, 304, 400, 401, 403, 404, 405, 409, 412, 413, 414, 415, 416, 423, 424, 500, 501, 502, 503]

The statuses the server gives.

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

Statustypeno test imports it
type Status = (typeof STATUSES)[number];

One status.

STATUS_TEXTconst
const STATUS_TEXT: Readonly<Record<200 | 201 | 204 | 206 | 207 | 304 | 400 | 401 | 403 | 404 | 405 | 409 | 412 | 413 | 414 | 415 | 416 | 423 | 424 | 500 | 501 | 502 | 503, string>>

The words of a status.

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

statusLinefunctionno test imports it
function statusLine(status: 200 | 201 | 204 | 206 | 207 | 304 | 400 | 401 | 403 | 404 | 405 | 409 | 412 | 413 | 414 | 415 | 416 | 423 | 424 | 500 | 501 | 502 | 503): string

The status line of a multistatus body.

Contexttype
type Context = "mkcol" | "exclusive" | "move-copy" | "other";

What a request was doing when the view said no: the one thing that changes what a code means.

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

statusOfErrnofunction
function statusOfErrno(errno: "EACCES" | "EBADF" | "EEXIST" | "EFBIG" | "EINVAL" | "EIO" | "EISDIR" | "ENAMETOOLONG" | "ENOENT" | "ENOTDIR" | "ENOTEMPTY" | "ENOTSUP" | "EROFS" | "ESTALE" | "EXDEV", context: Context): 200 | 201 | 204 | 206 | 207 | 304 | 400 | 401 | 403 | 404 | 405 | 409 | 412 | 413 | 414 | 415 | 416 | 423 | 424 | 500 | 501 | 502 | 503

The status of a code, in a context: a registry with one entry for each code, which the compiler holds.

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

RETRY_AFTER_SECONDSconstno test imports it
const RETRY_AFTER_SECONDS: 5

Whether the status of a store that is not there now is one a client should try again: 503 with a wait.

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