コンテンツにスキップ

Cloudflare Manifest API

[FUNCTION] parseCloudflareSnapshotManifest

Section titled “[FUNCTION] parseCloudflareSnapshotManifest”

Parses the structural fields of a snapshot manifest.

import type { SiteSnapshotManifest } from '@alneas/sitekit';
declare function parseCloudflareSnapshotManifest(value: unknown): SiteSnapshotManifest;
Parameter Type Required Description
value unknown Yes Object to parse.
value.schemaVersion, value.siteId, value.revision string Yes Nonempty strings.
value.generatedAt, value.contentVersion, value.mediaVersion, value.checksum string Yes Nonempty strings; date and checksum formats are not checked here.
value.locales string[] Yes Array of nonempty strings; an empty array is accepted.
value.signature { algorithm: “hmac-sha256” | “ed25519”; keyId: string; value: string } No Algorithm plus nonempty key identifier and signature value.

SiteSnapshotManifest — a new object containing recognized fields. Unrecognized fields are omitted.

Throws Error for invalid required fields or signature structure. This parser does not verify payload checksums, cryptographic signatures, supported schema versions or revision equality. Projection staging performs payload integrity checks separately. The example checksum is a structural placeholder and must not be used for staging.

import { parseCloudflareSnapshotManifest } from '@alneas/sitekit-cloudflare';
const manifest = parseCloudflareSnapshotManifest({
schemaVersion: '1', siteId: 'example', revision: 'cms-1',
generatedAt: '2026-01-01T00:00:00Z',
contentVersion: 'cms-1', mediaVersion: 'cms-1',
checksum: 'example-checksum', locales: ['en', 'ja'],
});
console.log(manifest.revision); // cms-1