Project

EarthSciAST

The EarthSciML Abstract Syntax Tree format: schema, operators, coupling, and five language bindings.

Contents

This is the documentation for the older version v0.15.1. For the latest release, see v0.17.0.

TypeScript API index

Every stable name TypeScript exports, and its extension seams.

Package: @earthsciml/ast 0.15.1

Documentation extracted with typescript 6.0.3 compiler API.

Capability profiles: core, classification.

Extension-tier names are on the TypeScript extension page .

Stable names

TypeScriptCanonicalKindSummary
addContinuousEventadd_continuous_eventfunctionAdd a continuous event to a model
addCouplingadd_couplingfunctionAdd a coupling entry to an ESM file
addDiscreteEventadd_discrete_eventfunctionAdd a discrete event to a model
addEquationadd_equationfunctionAdd a new equation to a model
addReactionadd_reactionfunctionAdd a new reaction to a reaction system
addSpeciesadd_speciesfunctionAdd a new species to a reaction system
addVariableadd_variablefunctionAdd a new variable to a model
algebraicUnknownsalgebraic_unknownsfunctionUnknowns constrained only implicitly — no equation names them on its LHS (H*H*SO4 ~ Ksp).
applyScopeInjectionsapply_scope_injectionsfunctionesm-spec §9.7.10 forms A + B: if raw needs a scope-directed injection (a non-empty subsystem-ref edge list injected, or a coupling entry carrying an injection map), return a…
brownianParametersbrownian_parametersfunctionParameters whose update.kind is wiener — the SDE noise sources.
buildReferenceGraphbuild_reference_graphfunctionResolve the reference edges of ONE model into a ReferenceGraph.
canMigratecan_migratefunctionCheck if migration is possible from the source version to target version.
canonicalizecanonicalizefunctionCanonicalize an expression tree per RFC §5.4.
canonicalizeDocumentcanonicalize_documentfunctionThe document-level canonical step: every units string of a document takes the canonical unit spelling (esm-spec §4.8.2, Lean Esm.Units.canon).
CanonicalizeErrorcanonicalize_errorerrorCanonical-form error carrying a stable RFC §5.4.6 / §5.4.7 code string (E_CANONICAL_NONFINITE, E_CANONICAL_DIVBY_ZERO).
canonicalJsoncanonical_jsonfunctionEmit canonical on-wire JSON per §5.4.6 (sorted keys, no whitespace).
CircularReferenceErrorcircular_reference_errorerrorError thrown when a circular reference is detected during subsystem resolution.
componentExistscomponent_existsfunctionUtility to check if a component exists in the ESM file
ComponentGraphcomponent_graphtypeSystem graph representation with components and couplings
componentGraphcomponent_graphfunctionExtract the system graph from an ESM file.
ComponentNodecomponent_nodetypeGraph node representing a component in the system
composecomposefunctionCompose two systems using a coupling entry
ConflictingDerivativeErrorconflicting_derivative_errorerrorTwo systems define non-additive equations for the same dependent variable — the §4.7.5 over-determination check.
constantParametersconstant_parametersfunctionParameters with neither a distribution nor an update — plain constants.
containscontainsfunctionCheck if an expression contains a specific variable
ContributioncontributiontypeOne summand of a flattened equation’s right-hand side, with its authors.
convertUnitsconvert_unitsfunctionConvert a numeric value from one unit string to another.
CoupleMultiplicativeNoTendencyErrorcouple_multiplicative_no_tendency_errorerrorA couple connector equation with transform: "multiplicative" targets something with no tendency to multiply.
CouplingEdgecoupling_edgetypeGraph edge representing a coupling relationship
CouplingImportOptionscoupling_import_optionstypeOptions controlling how coupling_import refs are resolved at flatten.
declaredSystemKinddeclared_system_kindfunctionThe model’s explicit system_kind field, or null when absent.
DEFAULT_ABSTOLdefault_abstolconstantBinding default absolute tolerance (API_SPEC §5.8) — the bottom of the §2.2.2 chain, used when neither the caller nor solver.abstol sets one.
DEFAULT_RELTOLdefault_reltolconstantBinding default relative tolerance (API_SPEC §5.8) — the bottom of the §2.2.2 chain, used when neither the caller nor solver.reltol sets one.
DependencyEdgedependency_edgetypeGraph edge representing a dependency between variables.
deprecatedRecordsPerSampleSitesdeprecated_records_per_sample_sitesfunctionThe sorted JSON pointers at which the deprecated records_per_sample is written in esmFile (esm-spec §8.3, §8.5.1): /data_sources/<S>/temporal/records_per_sample and…
deriveODEsderive_odesfunction—
deriveOdesderive_odesfunctionDerive ODEs from a reaction system using mass action kinetics
DimensionPromotionErrordimension_promotion_errorerrorA variable or equation cannot be promoted onto the target grid — raised by the §10.5 pointwise spatial lift when a species’ operator makearrays yield no full-rank…
discreteParametersdiscrete_parametersfunctionParameters carrying any OTHER update — piecewise-constant between refreshes.
DocumentFormatdocument_formattypeWhich source format a document is written in.
DomainUnitMismatchErrordomain_unit_mismatch_errorerrorAn identity-transform variable_map bridges two variables whose declared, non-empty units differ (esm-libraries-spec §4.7.6).
EdgeKindedge_kindtypeThe three kinds of reference edge (RFC §6.1 “Propagation”).
effectiveSystemKindeffective_system_kindfunctionThe kind a caller choosing a solver actually asks for: the DECLARED system_kind when the document states one, otherwise the DERIVED kind.
emitDocumentemit_documentfunctionProduce the reference-preserving, self-contained emitted document (esm-spec §9.6.4 rule 5, RFC out-of-line-expression-templates §7.5) from a source document rawSource (a…
emitEsmStringemit_esm_stringfunctionCanonical byte serialization of an emitted document (esm-spec §9.6.4 rule 5): 2-space indent, object keys sorted lexicographically (UTF-8 byte order) EXCEPT the entries of an…
EntityNotFoundErrorentity_not_found_errorerrorError thrown when attempting an operation on a non-existent entity
EnumLoweringErrorenum_lowering_errorerrorError thrown by lowerEnums (and so by loading) when an enum op cannot be lowered.
ephemeralInjectedFileephemeral_injected_filefunctionesm-spec §9.7.10 form C: build a throwaway EsmFile in which component mname has the run’s imports (raw §9.7.2 entries) appended to its own operator_imports, so the…
ERROR_CODESerror_codesconstantCentral registry of the diagnostic code STRINGS emitted by this binding, plus a neutral diagnostic base class.
expandCouplingImportsexpand_coupling_importsfunctionExpand every coupling_import entry in file.coupling into concrete edges, splicing them in the position of the import entry (esm-spec §10.10.3).
expandDocumentexpand_documentfunctionFully expand every surviving apply_operator reference in a document loaded by lowerExpressionTemplates (Option B), producing the Option-A image: every reference replaced by…
expressionGraphexpression_graphfunctionExtract a variable-level dependency graph from an ESM file, model, reaction system, equation, reaction, or expression.
expressionNamesexpression_namesfunctionThe variable names an expression or an equation uses, in order of first use: its string leaves under lhs, rhs and args.
ExpressionTemplateErrorexpression_template_errorerrorinstanceof ExpressionTemplateError and instanceof EsmMachineryError are identical.
extractextractfunctionExtract a specific component from an ESM file into a new file
flattenflattenfunctionFlatten a coupled multi-system ESM file into a single unified system (esm-libraries-spec §4.7.5).
FlattenedEquationflattened_equationtypeA single equation of the flattened system, with dot-namespaced Expression TREES.
FlattenedSystemflattened_systemtypeA fully flattened representation of a coupled ESM system — the canonical field set of esm-libraries-spec §4.7.5 step 4.
FlattenedVariableflattened_variabletypeOne variable of the flattened system, carrying the COMPLETE declared metadata step 4 requires (“Full metadata, not names”): a consumer must be able to build a solver problem from…
FlattenErrorflatten_errorerrorBase class for every error flatten raises.
FlattenMetadataflatten_metadatatypeMetadata describing the origin of the flattened system.
flattenTemplateRegistriesflatten_template_registriesfunctionThe flatten-time template-registry merge (esm-spec §9.6.4 rule 7, §10.7; esm-libraries-spec §4.7.5 step 4).
formatCanonicalFloatformat_canonical_floatfunctionFormat a finite number as a byte-CANONICAL float token per RFC §5.4.6.
freeParametersfree_parametersfunctionExtract free parameters from an expression within a model context
freeVariablesfree_variablesfunctionExtract all variable references from an expression.
getComponentTypeget_component_typefunctionGet the type of a component by its ID
getSupportedMigrationTargetssupported_migration_targetsfunction—
GraphgraphtypeDirected graph with node/edge lists plus adjacency, predecessor, and successor lookups (ESM Libraries Specification §4.8).
isCouplingLibraryDocis_coupling_library_docfunctionTrue when raw has the coupling-library-file FORM (top-level coupling_roles, esm-spec §10.9).
isOdeStateis_ode_statefunctionMembership test for odeStates.
isTemplateLibraryDocis_template_library_docfunctionTrue when raw has the template-library-file FORM (top-level operators, esm-spec §9.7.1).
LIBRARY_VERSIONlibrary_versionconstantThe package’s OWN version — distinct from SCHEMA_VERSION, which is the .esm FORMAT version this build implements.
loadDocumentload_documentfunctionParse an ESM document that is ALREADY a JavaScript object — the same document a .esm file holds, just already JSON.parsed.
LoaderFieldloader_fieldtypeA data-fed PARAMETER lowered to a flattened array input (esm-spec §8.5).
LoadOptionsload_optionstypeOptions controlling how the load* entry points parse and represent an ESM file.
loadPathload_pathfunctionRead and parse an ESM document from a filesystem path.
loadStringload_stringfunctionParse an ESM document from JSON TEXT.
lowerEnumslower_enumsfunctionResolve every enum op in file against file.enums.
lowerExpressionTemplateslower_expression_templatesfunctionLoad the file under Option B (reference preservation, esm-spec §9.6.4): fire auto-applied match rules to a fixpoint per component (outermost-first, priority-ordered, bounded —…
mapVariablemap_variablefunctionMap a variable from one system to another with optional transformation
MAX_TEMPLATE_EXPANSION_DEPTHmax_template_expansion_depthconstantMaximum template-body reference-chain depth (counted in TEMPLATES along the longest chain, so a 65-template chain is rejected while a 64-template chain is accepted) before a file…
mergemergefunctionMerge two ESM files
migratemigratefunctionMigrate an ESM file from its current schema version to the target version.
MigrationErrormigration_errorerrorError thrown when migration fails.
observedDefinitionsobserved_definitionsfunctionThe DEFINING EXPRESSION of every observed unknown: the RHS of the equation whose LHS names it, bare (y ~ f(…)) or indexed (y[i] ~ f(…)).
observedUnknownsobserved_unknownsfunctionUnknowns an equation DEFINES — its LHS naming them, bare (y ~ f(…)) or indexed (y[i] ~ f(…), which defines the whole array y) — eliminable, materializable (esm-spec §6.3.1).
odeStatesode_statesfunctionUnknowns appearing under D(·, t) on some equation LHS — the integrated states.
OperatorComposeAmbiguousBareNameErroroperator_compose_ambiguous_bare_name_errorerrorThe bare-name fallback would unify two STATE variables and the document has not said which spelling survives (esm-libraries-spec §4.7.1 step 3).
OperatorComposeNoMergeErroroperator_compose_no_merge_errorerrorAn operator_compose entry merged NOTHING (esm-libraries-spec §4.7.1 step 5).
OperatorComposeRequireMatchErroroperator_compose_require_match_errorerrorAn operator_compose entry declared require_match: true and one of systems[1]’s equations found no equation of systems[0] to land on (esm-libraries-spec §4.7.1 step 5).
parametersparametersfunctionNames of every variable declared parameter, sorted.
parseDocumentparse_documentfunctionRead an ESM document written in the given format.
ParseErrorparse_errorerrorParse error - thrown when JSON parsing fails, or when the wire boundary refuses a document before schema validation.
parseMarkdownparse_markdownfunctionRead a Markdown ESM document (Source.Md.parseMd).
parseMathparse_mathfunctionRead one expression, or one equation, written as math under a set of declared names: LaTeX for 'markdown' (Math.parseLatex), Typst math for 'typst' (Math.parseTypst).
parseTypstparse_typstfunctionRead a Typst ESM document (Source.Typ.parseTyp).
parseUnitparse_unitfunctionParse a unit string into canonical SI dimensions plus scale factor.
precisionSourceprecision_sourcefunctionReturn the declared element type or unspecified.
printDocumentprint_documentfunctionPrint an ESM document in the given format.
printMarkdownprint_markdownfunctionPrint an ESM document as Markdown (Source.Md.printMd).
printMathprint_mathfunctionPrint one expression, or one equation, as math under a set of declared names: LaTeX for 'markdown' (Math.printLatex), Typst math for 'typst' (Math.printTypst).
printTypstprint_typstfunctionPrint an ESM document as Typst (Source.Typ.printTyp).
productMatrixproduct_matrixfunctionCompute product stoichiometric matrix from a reaction system
ReferenceEdgereference_edgetypeA directed source → target edge: source references / depends on target.
ReferenceGraphreference_graphtypeThe resolved reference DAG for one model — the partition pass’s input.
ReferenceResolutionErrorreference_resolution_errorerrorA reference could not be resolved, or the reference graph has a cycle.
ReferenceVertexreference_vertextypeA vertex in the reference graph, addressed by a kind-namespaced key.
rejectExpressionTemplatesPreV04reject_expression_templates_pre_v04functionReject apply_operator and operators in files declaring esm < 0.4.0.
rejectSolverExternalPreV13reject_solver_external_pre_v13functionReject solver.external in a file declaring esm < 1.3.0.
rejectSolverPreV11reject_solver_pre_v11functionReject a top-level solver block in a file declaring esm < 1.1.0.
rejectSolverTimeSpanPreV13reject_solver_time_span_pre_v13functionReject solver.time_span in a file declaring esm < 1.3.0.
rejectTemplateImportsPreV08reject_template_imports_pre_v08functionoperator_imports, top-level operators (template-library files), and metaparameters arrive at esm: 0.8.0; files declaring an earlier version that carry any of them are…
removeCouplingremove_couplingfunctionRemove a coupling entry from an ESM file by index
removeEquationremove_equationfunctionRemove an equation from a model
removeEventremove_eventfunctionRemove events from a model by name.
removeReactionremove_reactionfunctionRemove a reaction from a reaction system
removeSpeciesremove_speciesfunctionRemove a species from a reaction system, with reference checking
removeVariableremove_variablefunctionRemove a variable from a model, with reference checking
renameVariablerename_variablefunctionRename a variable throughout a model.
resolveReferencesresolve_referencesfunctionResolve reference edges for EVERY model in document.
resolveSubsystemRefsresolve_subsystem_refsfunctionAsync resolution — the only entry point that can reach a REMOTE (http(s)://) ref, since fetch cannot be awaited synchronously.
resolveTemplateMachineryresolve_template_machineryfunctionResolve every esm-spec §9.7 construct of the ROOT document rawData (relative import refs resolve against basePath): imports recursively with per-edge instantiation,…
resolveTimeSpanresolve_time_spanfunctionThe run interval by the esm-spec §2.2.7 chain: the call-site interval tspan when given (both bounds, always), otherwise the root document’s solver.time_span converted to…
resolveTolerancesresolve_tolerancesfunctionResolve integration tolerances most-specific first (esm-spec §2.2.2):
sampledParameterssampled_parametersfunctionParameters with a distribution and no update — drawn once at setup.
SCHEMA_VERSIONschema_versionconstantThe schema version this library implements, derived from the embedded schema’s $id (https://earthsciml.org/schemas/esm/<version>/esm.schema.json ) so it cannot hand-drift from…
SchemaErrorschema_errortypeSchema validation error with JSON Pointer path
SchemaValidationErrorschema_validation_errorerrorSchema validation error - thrown when schema validation fails
simplifysimplifyfunctionSimplify an expression using basic algebraic rules
solverExternalLocationsolver_external_locationfunctionThe location solver.external names, resolved by esm-spec §2.2.6, or null when the root document’s solver block carries none.
stoichiometricMatrixstoichiometric_matrixfunctionCompute stoichiometric matrix from a reaction system
substitutesubstitutefunctionRecursively substitute variable references in an expression with bound expressions.
substituteInEquationssubstitute_in_equationsfunction(exported from substitute.js) directly.
substituteInModelsubstitute_in_modelfunctionApply substitution across an ENTIRE model, not just its equations.
substituteInReactionSystemsubstitute_in_reaction_systemfunctionApply substitution across all rate expressions in a reaction system.
substrateMatrixsubstrate_matrixfunctionCompute substrate stoichiometric matrix from a reaction system
supportedMigrationTargetssupported_migration_targetsfunctionGet the list of schema versions that a given source version can migrate to.
SystemKindsystem_kindtypeThe MTK system type a model maps to.
systemKindsystem_kindfunctionThe system kind DERIVED from the equations and the parameter updates.
TermOriginterm_origintypeWho authored one contribution to a flattened equation.
toDotto_dotfunctionExport graph as Graphviz DOT format.
toJsonto_jsonfunctionSerialize an EsmFile to wire-form JSON.
toJsonCompactto_json_compactfunctiontoJson with no indentation — the single-line wire form.
toJsonGraphto_json_graphfunctionExport graph as JSON adjacency list format for web consumption.
toMermaidto_mermaidfunctionExport graph as Mermaid flowchart format for Markdown embedding.
UnitConversionErrorunit_conversion_errorerrorError thrown when a unit string cannot be parsed (unknown unit name, malformed number or exponent, unbalanced parentheses, trailing input) or when convertUnits is asked to…
UnitWarningunit_warningtypeDimensional-consistency warning emitted during file-level validation.
unknownsunknownsfunctionNames of every variable declared unknown, sorted.
validatevalidatefunctionValidate a TYPED ESM DOCUMENT and return a structured validation result.
validateSchemavalidate_schemafunctionValidate data against the ESM schema
validateTextvalidate_textfunctionValidate ESM JSON text: parse it, then run validate on the result.
validateUnitsvalidate_unitsfunctionValidate dimensional consistency of equations in an ESM file.
ValidationErrorvalidation_errortypeValidation error with structured details
ValidationResultvalidation_resulttypeStructured validation result
ValidationWarningvalidation_warningtypeAn advisory validation finding that is not about units.
VariableInUseErrorvariable_in_use_errorerrorError thrown when attempting to remove a variable that is still referenced
VariableKindvariable_kindtypeThe kind of a variable node.
VariableNodevariable_nodetypeGraph node representing a variable/parameter/species in the system
VertexKindvertex_kindtypeThe three kinds of vertex in the reference graph.
writePathwrite_pathfunctionWrite an EsmFile to path as wire-form JSON.