checkDocumentVersion
re-export| Package | @formscript/profile |
|---|---|
| Specification | 5.6, 16 |
| Depends on | errors |
@formscript/profile
Profile pinning, per §5.6 and §16 of the specification.
A profile is not a version label. It is the set of primitives and thresholds that two runtimes must agree on to be interchangeable: the same decimals, the same Unicode tables, the same cost ceilings, the same diagnostic order.
What a profile pins
| Pinned | Value in core-2026.1 |
|---|---|
| Cost ceiling per expression | 100,000 |
| Cost ceiling per document | 1,000,000 |
| Unicode tables for the data plane | 16.0 |
| CLDR data for the presentation plane | 46 |
number |
decimal128, 34 digits, round-half-even, no subnormals |
| Diagnostic order | lexical → syntactic → semantic → type → constraint |
import { CORE_2026_1, profileById } from '@formscript/profile';
CORE_2026_1.maxExprCost; // 100_000
profileById('core-2026.1'); // the same profile
Why the thresholds are not the runtime's to choose
The set of documents a runtime accepts is part of its observable behaviour. Two runtimes that accept different documents are not interchangeable even when they agree on every document they both accept. A runtime that wishes to accept documents beyond a profile's thresholds must publish a new profile.
The same applies to the diagnostic order: the order in which a document's errors are reported is part of the profile, so two runtimes produce the same diagnostic list for the same document, in the same order, with the same codes.
Version compatibility
import { checkDocumentVersion } from '@formscript/profile';
checkDocumentVersion('2.0', { major: 2, minor: 0 });
A document whose MAJOR version the runtime does not implement is rejected with
E-VER-01. So is one whose MINOR version is newer than the runtime's —
ignoring an unknown feature would mean a form silently stops enforcing a rule
its author believed was active.
Public API
8 exported symbols.
CORE_2026_1
re-exportparseVersion
re-exportProfile
interface
A profile pins the primitives and the static-analysis thresholds that a runtime must apply (Spec-5.42, Spec-5.43, Spec-5.44). A profile is immutable once pub…
profileById
re-exportSemanticVersion
interfacesupportedProfiles
re-exportVersionCheck
interface
Whether a document's declared version is implemented by this runtime (Spec-16.2, Spec-16.4). A document whose MAJOR version is not implemented is rejected wi…