Integrating tom_som_javascript_v0
tom_som_javascript_v0 is the typed TomSpecs object-model facade for JavaScript. It depends on
tom_som_javascript_runtime. Both are versioned to the TomSpecs model version
(currently 1.3.2) — pin to that version so your document reads and writes match the model the facade was generated from.
Quick start
Add tom_som_javascript_v0 to your project (npm install tom_som_javascript_v0), then:
const m = require('tom_som_javascript_v0');
const { SpecDocument } = require('tom_som_javascript_runtime');
// A typed Solution Blueprint over a fresh document.
const doc = new SpecDocument();
const blueprint = new m.D00SolutionBlueprint(doc);
blueprint.content = 'A platform that unifies our fragmented order systems.';
blueprint.currentLandscape.content =
'Three legacy systems with no shared customer record.';
console.log(blueprint.content);
Dependency routes
From npm
Install the facade (it depends on tom_som_javascript_runtime):
npm install tom_som_javascript_v0
or pin it in your package.json:
"dependencies": {
"tom_som_javascript_v0": "^1.3.2"
}
Git dependency
npm cannot install a sub-directory of a git repository directly, and the facade lives in a sub-directory of the mono-repo — so clone first, then install by path (runtime first):
git clone https://github.com/al-the-bear/tom_ai_build.git
npm install ./tom_ai_build/tom_som_javascript_runtime
npm install ./tom_ai_build/tom_som_javascript_v0
Path / link (monorepo / vendored)
When the SOM projects sit alongside your code, link both the runtime and the facade (runtime first):
npm install ../tom_som_javascript_runtime
npm install ../tom_som_javascript_v0
For a no-install checkout the facade also records the runtime location under tomSom.runtimePath
in its package.json, so it resolves the runtime by relative path without a registered dependency.
Pinning the version
Both tom_som_javascript_runtime and tom_som_javascript_v0 carry version 1.3.2, taken from the TomSpecs model version. When you upgrade the model, regenerate and move to the new matching version so the facade and your stored documents stay in step.
Building from source
Regenerate the facade and dry-run the packages from the workspace:
dart run tom_specs_clitool/bin/generate_som.dart
cd tom_som_javascript_runtime && npm pack --dry-run
cd ../tom_som_javascript_v0 && npm pack --dry-run
Further documentation
| Document | Covers |
|---|---|
| README.md | What this package is, its document roots, and how to use them. |
| doc/tutorial.md |
A JavaScript walkthrough end to end — install, open a document, read and edit a section, validate it, and serialize to
*.docspecs.yaml
and Markdown.
|
| examples/README.md | The runnable samples. |
| tom_specs_model/doc/som_multiplatform_spec_model.md |
The SOM authority: the model, the formats, and
SOM §17
— the packaging rules this guide implements.
|
| tom_specs_model/doc/index.md | The catalogue of every TomSpecs subject-matter document. |
| tom_som_javascript_runtime | The generic runtime this facade depends on. |