Skip to content

ExtensionRegistry

Defined in: packages/core/src/extensions/registry.ts:91

A registry of x-* extension namespaces.

Deliberately an instance rather than a module singleton: a host embedding two documents from different trust domains may want different registries, and a test wants a fresh one. The library ships no global registrations.

new ExtensionRegistry(): ExtensionRegistry

ExtensionRegistry

extract(document): ExtractResult

Defined in: packages/core/src/extensions/registry.ts:139

Extract every extension block from a parsed document.

ParameterType
documentunknown

ExtractResult

Walks schema-known object nodes — the document root, layers, sources — and never descends into an opaque data payload, so a GeoJSON feature property named x-anything is author data, not an extension block. This mirrors the boundary the emitter’s projection uses; the two agree on where document structure ends.

Every extension key is accounted for: a registered one is validated, normalized, and returned; an unregistered one is dropped with a warning; an invalid one is dropped with a warning naming the failure. Nothing is partially delivered.


has(namespace): boolean

Defined in: packages/core/src/extensions/registry.ts:120

Whether a namespace has a registered schema.

ParameterType
namespacestring

boolean


register<T>(namespace, definition): void

Defined in: packages/core/src/extensions/registry.ts:103

Register a namespace.

Type Parameter
T
ParameterType
namespacestring
definitionExtensionDefinition<T>

void

if the namespace is already registered — a silent last-wins would let one registration quietly shadow another, and the whole point is that the trust contract for a namespace is unambiguous.

if the namespace does not begin with x-, since only x-* keys are passthrough; a non-x- namespace names a key the schema would reject.