docstudio/core
Schema, validation, configuration, expressions, binding, registry and compile. API reference in the DocStudio developer reference.
The core is a set of synchronous, pure functions over JSON. It imports nothing, so it runs in Node, browsers and workers. Nothing evaluates JavaScript, touches the network or the DOM, or keeps state between calls.
import { compile, validateTemplate, createEvaluator } from 'docstudio/core';Areas
| Area | Main exports |
|---|---|
| Compile | compile, isRdt, RDT_VERSION and the Rdt* types |
| Templates | TEMPLATE_SCHEMA, NODE_TYPES, validateTemplate, validateTemplateStructure, validateTemplateSemantics, migrate, createMigrationRegistry |
| Configuration | resolveConfig, enterSection, validateApplicationConfig, createStyleResolver, resolvePageDimensions |
| Expressions and binding | parseExpression, createEvaluator, evaluateExpression, rootScope, createBinder, createItemCursor, EXPRESSION_FUNCTIONS |
| Registry | createRegistry, registerComponent, createDefaultRegistry, createFormatterRegistry, registerFormatter |
| Components | expandComponents, extractDependencies, parseComponentRef |
| Schema help | inferDataSchema, listBindingPaths, checkBindings |
| Foundations | DEFAULT_LIMITS, normalizeLimits, canonicalize, hashTemplate, hashValue, createDiagnostic, JSON helpers |
Errors
Core functions do not throw for JSON input. Problems are returned as diagnostics { code, severity, message, path } where path is a JSON Pointer. Programmer mistakes such as passing a wrong type to a typed function are the only thing that can throw.
Reference
The sections below are generated from the exported source. Each entry shows the signature, parameters, return type and, where it helps, a runnable example. Longer discussions: Template schema, Expressions, Data binding, Diagnostics.