Class: Document\<SpecT>¶
Document — unified wrapper for all manifest documents.
1:1 parity with Python dna.v3.kernel.document.
v1.0 — Document<SpecT> generic typing. Consumers can declare
spec type at the call site without a runtime cost:
const doc = mi.documents.find((d) => d.kind === "Asset" && d.name === "x") as Document<AssetSpec>;
doc.spec.summary?.byte_count; // type-checker validated
Bare Document defaults to Record<string, unknown> so existing
untyped code continues working. Purely additive — no API change
for callers that don't opt in.
Type Parameters¶
| Type Parameter | Default type |
|---|---|
SpecT extends Record\<string, unknown> |
Record\<string, unknown> |
Constructors¶
Constructor¶
Parameters¶
| Parameter | Type |
|---|---|
opts |
{ apiVersion: string; kind: string; metadata?: Record\<string, unknown>; name: string; origin?: string; raw?: Record\<string, unknown>; spec?: Record\<string, unknown>; typed?: unknown; } |
opts.apiVersion |
string |
opts.kind |
string |
opts.metadata? |
Record\<string, unknown> |
opts.name |
string |
opts.origin? |
string |
opts.raw? |
Record\<string, unknown> |
opts.spec? |
Record\<string, unknown> |
opts.typed? |
unknown |
Returns¶
Document\<SpecT>
Properties¶
apiVersion¶
kind¶
name¶
origin¶
raw¶
typed¶
Accessors¶
metadata¶
Get Signature¶
Always returns Record
Returns¶
Record\<string, unknown>
spec¶
Get Signature¶
Returns the spec, typed as SpecT when consumers parameterize
the Document. Runtime: still a plain dict.
Returns¶
SpecT
Methods¶
fromRaw()¶
Create a Document from a raw dict.
Parameters¶
| Parameter | Type |
|---|---|
raw |
Record\<string, unknown> |
typed? |
unknown |
origin? |
string |
Returns¶
Document
toString()¶
Returns¶
string