IF Commons GitHub

bucket

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

The name of a bucket, made only by parseBucketName: the rules of the general purpose buckets of S3 that every S3-compatible service also keeps (3 to 63 characters of lower case letters, digits, hyphens and dots, beginning and ending with a letter or a digit, no two dots together, no dot beside a hyphen, not an address of the internet, none of the prefixes and suffixes S3 reserves). A name that passes is safe to put in a URL as it is.

import { parseBucketName } from "./bucket.ts";
parseBucketName("fleet-backup").kind; // "ok"
parseBucketName("Fleet_Backup").kind; // "err"

Source: commons/anyfs-s3/src/bucket.ts

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

BucketNametypeno test imports it
type BucketName = Brand<string, "s3 bucket name">;

The name of a bucket. Made only by parseBucketName.

parseBucketNamefunction
function parseBucketName(text: string): Result<BucketName, string>

A bucket name from text, or the reason it is not one.

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

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