Skip to main content

Interface: Artifact

Defined in: packages/core/src/artifact.types.ts:71

One route's page, compiled and ready to render or store. Nothing mutates it — publishing a change compiles a new artifact and moves the route's pointer at it, so a hash that resolves once resolves to the same bytes forever.

Example

const { artifact } = compile(version, catalog, registry, "/pricing");
await store.write(artifact);
await store.publish(artifact.route, artifact.hash);

Properties

blockVersions

blockVersions: Record<string, number>

Defined in: packages/core/src/artifact.types.ts:93

Block name → the version registered when this compiled, for the blocks the document uses and no others. checkRollback and checkCompatibility compare it against a live registry.


compiledWith

compiledWith: string

Defined in: packages/core/src/artifact.types.ts:99

The @nubbin/core version that compiled it.


documentId

documentId: string

Defined in: packages/core/src/artifact.types.ts:85

The document this is a compilation of.


documentVersion

documentVersion: number

Defined in: packages/core/src/artifact.types.ts:87

Which version of that document — the number on the DocumentVersion that was compiled.


hash

hash: string

Defined in: packages/core/src/artifact.types.ts:78

The content address, and the name to read it back by. It is computed over every other field with object keys sorted first, so identical content lands at the same address however the compile happened to order it.


meta

meta: DocumentMeta

Defined in: packages/core/src/artifact.types.ts:97

The document's metadata, carried through unchanged — the head a renderer emits.


route

route: string

Defined in: packages/core/src/artifact.types.ts:83

The route this was compiled for. The CLI refuses to roll a route back to an artifact carrying a different one, however plausible the hash looks.


tree

tree: ArtifactNode[]

Defined in: packages/core/src/artifact.types.ts:95

One tree per entry element, in the order the document version's roots names them.