@miragon/team-topologies-schema-model 0.17.1 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +19 -43
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -7,12 +7,8 @@ The **DOM-free core** of the [Team Topologies Modeler](../../README.md): the dat
7
7
  specification, runtime validation, version migrations and deterministic JSON serialization for
8
8
  [Team Topologies](https://teamtopologies.com/) diagrams.
9
9
 
10
- This package has **no view, no DOM and no diagram-js**: it is plain TypeScript that runs anywhere
11
- (browser, Node, an edge function, a CLI). The browser renderer
12
- ([`@miragon/team-topologies-renderer`](../renderer)), the web app and the VS Code extension all build
13
- on top of it. The DOM-freedom is enforced in CI (ESLint `no-restricted-imports` /
14
- `no-restricted-globals` **and** `dependency-cruiser`), so a stray `diagram-js`/`window`/`document`
15
- reference fails the build.
10
+ Plain TypeScript with no DOM and no diagram-js, so it runs anywhere (browser, Node, a CLI). The
11
+ [renderer](../renderer), the web app and the VS Code extension build on it.
16
12
 
17
13
  ## Install
18
14
 
@@ -22,18 +18,13 @@ npm install @miragon/team-topologies-schema-model
22
18
 
23
19
  ## What's inside
24
20
 
25
- - **The notation spec:** the four team types and three interaction modes, with their official
26
- shapes, colours and stroke styles as plain data you can read and render against.
27
- - **The document model:** a small, stable shape (`TtDocument`) with `version`, `title`, `nodes`,
28
- `interactions`, `flows` and `annotations`.
29
- - **Runtime validation:** Zod schemas + `parseDocument()` for everything that comes from a file, a
30
- URL or `localStorage`.
31
- - **Forward migrations:** `parseDocument()` migrates older documents up to the current version
32
- before validating, keyed by the document `version`.
33
- - **Deterministic serialization:** sorted, rounded and version-stamped output, so `.tt` /
34
- `.ttm.json` files diff cleanly and share URLs stay stable.
35
- - **Factories & a sample:** helpers that create well-formed elements and documents, plus a complete
36
- example topology.
21
+ - **Notation spec:** the team types and interaction modes with their official shapes, colours and
22
+ strokes, as data.
23
+ - **Document model** `TtDocument`: `version`, `title`, `nodes`, `interactions`, `flows`,
24
+ `annotations`.
25
+ - **Validation and migration:** `parseDocument()` (Zod) upgrades older versions, then validates.
26
+ - **Deterministic serialization** for clean diffs and stable share URLs.
27
+ - **Factories** and a complete example, `SAMPLE_DOCUMENT`.
37
28
 
38
29
  ## The document format
39
30
 
@@ -168,31 +159,16 @@ console.log(SAMPLE_DOCUMENT.title);
168
159
  written in a fixed order. The same logical diagram always produces byte-identical JSON, which is
169
160
  what makes Git diffs small and share URLs stable. The pretty form (the default) is the file on
170
161
  disk and ends with a line break; the compact form (`serializeDocument(doc, false)`) has none.
171
- - **Unknown fields:** fields a document carries that this package does not know (a vendor's
172
- `"x-vendor"` on the root or on an element) pass `parseDocument()` untouched and are written after
173
- the known fields, sorted by name (nested keys too), so another tool's data survives a save. Only
174
- they can nest deeper than the four levels of the known fields, and objects and arrays nest at
175
- most 100 levels deep (`MAX_NESTING_DEPTH`), the document itself counting as the first:
176
- `parseDocument()` refuses a deeper document with an issue at each first level too deep, the
177
- first 100 of them in document order. The check runs without recursion, because the serializer
178
- and JSON tools overflow the stack a few thousand levels down. It builds a path only for an
179
- issue, so its memory grows with the number of containers, not with their number times their
180
- depth, and it walks a container that a caller puts in several places or inside itself no more
181
- than once per level.
182
- - **Ids:** `parseDocument()` rejects a document whose ids would collide on the canvas: an id used
183
- twice, the diagram's own id `tt-root` (`DIAGRAM_ROOT_ID`), ids starting with `__implicitroot`,
184
- `assoc_<annotation id>` (`associationId()`), the id of that annotation's connector, and the names
185
- of JavaScript's built-in object properties (`constructor`, `toString`, `__proto__`, …), which the
186
- canvas's element registry, a plain object, already resolves. `documentIdProblems()` lists them
187
- with their path.
188
- - **Migrations:** `parseDocument()` upgrades older documents before validating (keyed by `version`).
189
- The `1 → 2` step drops the legacy `showFlowOfChange` flag and the old edge-based interactions,
190
- keeping only interactions that carry geometry (the placed-shape model). Only a version 1 file
191
- loses interactions this way: from version 2 on, an interaction without `position` or `size` is
192
- refused at its path like any other missing field, so it never vanishes on the next save. The
193
- `2 → 3` step adds an empty `annotations` list, and because an empty list is not written back,
194
- re-saving a v2 file changes nothing but its `version`. Issue paths always count in the input: an
195
- invalid interaction after a dropped one is reported at its index in the file.
162
+ - **Unknown fields** (e.g. a vendor's `"x-vendor"`) pass `parseDocument()` untouched and are
163
+ written after the known fields, sorted by name, so another tool's data survives a save. Objects
164
+ and arrays nest at most 100 levels (`MAX_NESTING_DEPTH`); deeper documents are refused with an
165
+ issue at each first too-deep level (at most 100).
166
+ - **Ids:** `parseDocument()` rejects ids that would collide on the canvas: duplicates, `tt-root`
167
+ (`DIAGRAM_ROOT_ID`), `__implicitroot…`, `assoc_<annotation id>` (`associationId()`) and built-in
168
+ object property names (`constructor`, `__proto__`, …). `documentIdProblems()` lists them.
169
+ - **Migrations:** `1 → 2` drops the legacy `showFlowOfChange` flag and interactions without
170
+ geometry (from version 2 on, such an interaction is refused instead); `2 → 3` adds an empty
171
+ `annotations` list, which is not written back. Issue paths count in the input.
196
172
 
197
173
  ## Development
198
174
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miragon/team-topologies-schema-model",
3
- "version": "0.17.1",
3
+ "version": "0.18.0",
4
4
  "description": "The Team Topologies data model with types, the notation specification, runtime validation, migrations and deterministic JSON serialization.",
5
5
  "license": "MIT",
6
6
  "repository": {