IF Commons GitHub

governance/methods

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0002-anyfs-serve-governance FR-001

The methods the server answers, as a closed union: the twelve of WebDAV class 1 and 2 that an object store can carry. A method that is not one of them is answered 405 with the list in Allow.

import { parseMethod } from "./methods.ts";
parseMethod("PROPFIND"); // "PROPFIND"
parseMethod("PATCH"); // undefined

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

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

DAV_METHODSconst
const DAV_METHODS: readonly ["OPTIONS", "GET", "HEAD", "PUT", "DELETE", "MKCOL", "COPY", "MOVE", "PROPFIND", "PROPPATCH", "LOCK", "UNLOCK"]

The methods, in the order of the Allow header.

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

DavMethodtypeno test imports it
type DavMethod = (typeof DAV_METHODS)[number];

One method.

parseMethodfunction
function parseMethod(text: string): "COPY" | "DELETE" | "GET" | "HEAD" | "LOCK" | "MKCOL" | "MOVE" | "OPTIONS" | "PROPFIND" | "PROPPATCH" | "PUT" | "UNLOCK" | undefined

The method a text names, or nothing: method names are upper case and exact.

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

changesStorefunction
function changesStore(method: "COPY" | "DELETE" | "GET" | "HEAD" | "LOCK" | "MKCOL" | "MOVE" | "OPTIONS" | "PROPFIND" | "PROPPATCH" | "PUT" | "UNLOCK"): boolean

Whether a method changes the store: these need the capability to write and a lock the caller holds.

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

allowedMethodsfunction
function allowedMethods(writable: boolean, locks: boolean): readonly ("COPY" | "DELETE" | "GET" | "HEAD" | "LOCK" | "MKCOL" | "MOVE" | "OPTIONS" | "PROPFIND" | "PROPPATCH" | "PUT" | "UNLOCK")[]

The value of the Allow header for a store that can write or one that cannot.

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

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