casOfconstno test imports itconst casOf: (f: Facts) => booleanWhether the endpoint keeps what compare-and-write needs: every condition.
What an endpoint keeps, found by asking it and never by assuming: S3-compatible services differ in whether they honour a condition on a write (If-None-Match: *, If-Match) and on a delete (If-Match), and a store that claimed compare-and-write on one that ignores the condition would let two writers both win. The probe writes an object of its own below the prefix of the store (a name that begins with .anyfs-probe- and a random text, which the store never shows), asks each question with the object in a state that decides it, and removes the object whatever the answers were. An answer that is not the one that proves the condition honoured (a 200 where a 412 was due, or any other failure) is a condition not kept: the store is then made without cas. A key the credentials may not write is a store that can only read.
import { casOf } from "./probe.ts";
casOf({ writable: true, ifNoneMatch: true, ifMatch: true, conditionalDelete: true, checksum: false }); // truecasOfconstno test imports itconst casOf: (f: Facts) => booleanWhether the endpoint keeps what compare-and-write needs: every condition.
createBucketfunctionno test imports itfunction createBucket(client: S3Client, region: string): Promise<Result<void, string>>Makes the bucket of a client where it is not there (the endpoint of a test, or a first run); it is a no-op where the bucket is already the caller's.
describeCallErrorfunctionno test imports itfunction describeCallError(e: CallError): stringThe sentence a call error is, for the person who opens a store.
Factstypeno test imports ittype Facts = {
/** Whether the credentials may write. Where they may not, nothing else is known. */
readonly writabl… (629 characters)type Facts = {
/** Whether the credentials may write. Where they may not, nothing else is known. */
readonly writable: boolean;
/** Whether a write with `If-None-Match: *` fails where an object is. */
readonly ifNoneMatch: boolean;
/** Whether a write with `If-Match` fails where the entity tag is another and succeeds where it is the same. */
readonly ifMatch: boolean;
/** Whether a delete with `If-Match` fails where the entity tag is another and keeps the object. */
readonly conditionalDelete: boolean;
/** Whether the service checks and returns `x-amz-checksum-sha256`. */
readonly checksum: boolean;
};What an endpoint was found to keep.
probeEndpointfunctionno test imports itfunction probeEndpoint(client: S3Client, base: string, random?: () => string): Promise<Result<Facts, string>>The probe of an endpoint below the key prefix of a store: the facts, or why the bucket cannot be used at all.