Examples
Examples and checks
Section titled “Examples and checks”Revoke a Release
Section titled “Revoke a Release”Continuing the quick start, revoke the Release. The route stops serving it and it can no longer be promoted:
await catalog.transition({ kind: "revocation", releaseId, idempotencyKey: parseIdempotencyKey("idem_hello-revoke-1"),});
await catalog.resolvePublicWebsite(route);// throws AppReleasePublicWebsiteUnavailableError
await catalog.transition({ kind: "promotion", publicSurfaceId, releaseId, idempotencyKey: parseIdempotencyKey("idem_hello-promote-2"),});// throws AppReleaseTransitionReleaseRevokedErrorA route with no Surface throws AppReleasePublicWebsiteNotFoundError.
Run on Workers
Section titled “Run on Workers”import { createAppReleaseCatalog } from "@fungi.computer/app-release";import { createD1AppReleaseStore, createR2ArtifactReader, type AppReleaseD1Database, type AppReleaseR2Bucket,} from "@fungi.computer/app-release/cloudflare";
type Env = { DB: AppReleaseD1Database; ARTIFACTS: AppReleaseR2Bucket };
export function catalogFor(env: Env) { return createAppReleaseCatalog({ store: createD1AppReleaseStore(env.DB), artifactReader: createR2ArtifactReader(env.ARTIFACTS), });}The R2 reader uses the artifact reference as the object key and the object’s
contentType as its media type.
Local website demo
Section titled “Local website demo”From a checkout, a self-checking demo serves a fixture App over loopback HTTP, checks that cold and warm reads return the same bytes, then revokes the Release and checks that it stops serving. It needs no provider credentials:
pnpm --filter @fungi.computer/app-release demo:a1.2:self-checkdemo:a1.2 runs it interactively: open the printed /orchid URL, press r to
revoke and q or Ctrl-C to quit. The demo’s Fetch adapter serves the canonical
GET path, returns 404 for malformed or unselected routes, 503 for unsafe
delivery and 405 for other methods. Those statuses belong to the demo, not to
every host’s HTTP contract.
The test suite covers create and replay, transitions, idempotency conflicts and public website delivery, plus native Cloudflare proofs for reconstruction, storage and receipt conflicts, and lifecycle races:
pnpm --filter @fungi.computer/app-release test