@miragon/team-topologies-schema-model 0.11.2 → 0.12.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.
package/README.md CHANGED
@@ -171,14 +171,19 @@ console.log(SAMPLE_DOCUMENT.title);
171
171
  `"x-vendor"` on the root or on an element) pass `parseDocument()` untouched and are written after
172
172
  the known fields, sorted by name (nested keys too), so another tool's data survives a save.
173
173
  - **Ids** — `parseDocument()` rejects a document whose ids would collide on the canvas: an id used
174
- twice, the diagram's own id `tt-root` (`DIAGRAM_ROOT_ID`), ids starting with `__implicitroot`, and
175
- `assoc_<annotation id>` (`associationId()`), the id of that annotation's connector.
176
- `documentIdProblems()` lists them with their path.
174
+ twice, the diagram's own id `tt-root` (`DIAGRAM_ROOT_ID`), ids starting with `__implicitroot`,
175
+ `assoc_<annotation id>` (`associationId()`), the id of that annotation's connector, and the names
176
+ of JavaScript's built-in object properties (`constructor`, `toString`, `__proto__`, …), which the
177
+ canvas's element registry, a plain object, already resolves. `documentIdProblems()` lists them
178
+ with their path.
177
179
  - **Migrations** — `parseDocument()` upgrades older documents before validating (keyed by `version`).
178
180
  The `1 → 2` step drops the legacy `showFlowOfChange` flag and the old edge-based interactions,
179
- keeping only interactions that carry geometry (the placed-shape model). The `2 → 3` step adds an
180
- empty `annotations` list — and because an empty list is not written back, re-saving a v2 file
181
- changes nothing but its `version`.
181
+ keeping only interactions that carry geometry (the placed-shape model). Only a version 1 file
182
+ loses interactions this way: from version 2 on, an interaction without `position` or `size` is
183
+ refused at its path like any other missing field, so it never vanishes on the next save. The
184
+ `2 → 3` step adds an empty `annotations` list — and because an empty list is not written back,
185
+ re-saving a v2 file changes nothing but its `version`. Issue paths always count in the input: an
186
+ invalid interaction after a dropped one is reported at its index in the file.
182
187
 
183
188
  ## Development
184
189
 
package/dist/index.cjs CHANGED
@@ -148,6 +148,9 @@ function associationId(annotationId) {
148
148
  return `assoc_${annotationId}`;
149
149
  }
150
150
  var COLLECTIONS = ["nodes", "interactions", "flows", "annotations"];
151
+ function isBuiltInPropertyId(id) {
152
+ return Object.hasOwn(Object.prototype, id);
153
+ }
151
154
  function documentIdProblems(doc) {
152
155
  const problems = [];
153
156
  const connectorIds = new Map(
@@ -172,6 +175,11 @@ function documentIdProblems(doc) {
172
175
  path,
173
176
  message: `ids starting with "${ENGINE_ROOT_ID_PREFIX}" are reserved`
174
177
  });
178
+ } else if (isBuiltInPropertyId(id)) {
179
+ problems.push({
180
+ path,
181
+ message: `"${id}" is reserved: it names a built-in property of JavaScript objects`
182
+ });
175
183
  }
176
184
  const annotationId = connectorIds.get(id);
177
185
  if (annotationId !== void 0) {
@@ -242,11 +250,14 @@ var documentSchema = zod.z.looseObject({
242
250
  }
243
251
  });
244
252
  function parseDocument(input) {
245
- const migrated = migrate(input);
253
+ const { document: migrated, interactionFileIndexes } = migrate(input);
246
254
  const result = documentSchema.safeParse(migrated);
247
255
  if (!result.success) {
248
256
  const issues = result.error.issues.map((issue) => ({
249
- path: issue.path.filter((key) => typeof key !== "symbol"),
257
+ path: pathInFile(
258
+ issue.path.filter((key) => typeof key !== "symbol"),
259
+ interactionFileIndexes
260
+ ),
250
261
  message: issue.message
251
262
  }));
252
263
  return {
@@ -257,20 +268,35 @@ function parseDocument(input) {
257
268
  }
258
269
  return { ok: true, document: result.data };
259
270
  }
271
+ var EDGE_INTERACTIONS_VERSION = 1;
260
272
  function migrate(input) {
261
- if (input == null || typeof input !== "object") return input;
273
+ if (input == null || typeof input !== "object") {
274
+ return { document: input, interactionFileIndexes: [] };
275
+ }
262
276
  const doc = input;
263
277
  const next = { ...doc };
264
278
  delete next.showFlowOfChange;
265
279
  next.version = DOCUMENT_VERSION;
266
280
  if (typeof next.title !== "string") next.title = "Untitled team topology";
267
281
  if (!Array.isArray(next.nodes)) next.nodes = [];
268
- next.interactions = Array.isArray(next.interactions) ? next.interactions.filter(
269
- (e) => e != null && typeof e === "object" && "position" in e && "size" in e
270
- ) : [];
282
+ const dropsEdgeInteractions = doc.version === EDGE_INTERACTIONS_VERSION;
283
+ const keptInteractions = Array.isArray(next.interactions) ? next.interactions.map((interaction, fileIndex) => ({ interaction, fileIndex })).filter(({ interaction }) => !dropsEdgeInteractions || isPlacedShape(interaction)) : [];
284
+ next.interactions = keptInteractions.map(({ interaction }) => interaction);
271
285
  if (!Array.isArray(next.flows)) next.flows = [];
272
286
  if (!Array.isArray(next.annotations)) next.annotations = [];
273
- return next;
287
+ return {
288
+ document: next,
289
+ interactionFileIndexes: keptInteractions.map(({ fileIndex }) => fileIndex)
290
+ };
291
+ }
292
+ function isPlacedShape(value) {
293
+ return value != null && typeof value === "object" && "position" in value && "size" in value;
294
+ }
295
+ function pathInFile(path, interactionFileIndexes) {
296
+ const [collection, index, ...rest] = path;
297
+ if (collection !== "interactions" || typeof index !== "number") return path;
298
+ const fileIndex = interactionFileIndexes[index];
299
+ return fileIndex === void 0 ? path : [collection, fileIndex, ...rest];
274
300
  }
275
301
 
276
302
  // src/foreign.ts
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types.ts","../src/notation.ts","../src/ids.ts","../src/schema.ts","../src/foreign.ts","../src/serialize.ts","../src/factory.ts","../src/sample.ts"],"names":["z","i","s","nanoid"],"mappings":";;;;;;AASO,IAAM,QAAA,GAAW;AAKjB,IAAM,UAAA,GAAkC;AAAA,EAC7C,gBAAA;AAAA,EACA,UAAA;AAAA,EACA,uBAAA;AAAA,EACA;AACF;AAKO,IAAM,iBAAA,GAAgD;AAAA,EAC3D,eAAA;AAAA,EACA,gBAAA;AAAA,EACA;AACF;AAuEO,IAAM,gBAAA,GAAmB;;;AC5BzB,IAAM,eAAA,GAAkD;AAAA,EAC7D,gBAAA,EAAkB;AAAA,IAChB,IAAA,EAAM,gBAAA;AAAA,IACN,KAAA,EAAO,gBAAA;AAAA,IACP,WAAA,EAAa,mEAAA;AAAA,IACb,KAAA,EAAO,yBAAA;AAAA,IACP,IAAA,EAAM,SAAA;AAAA,IACN,MAAA,EAA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AAA,EAAY;AAAA;AACd;AAEJ","file":"index.cjs","sourcesContent":["/**\n * Pure (DOM-free) domain types for the Team Topologies model.\n *\n * This module is the canonical representation of a diagram and must never\n * import from the rendering layer (`@xyflow/react`) or touch the DOM, so it\n * can be unit-tested in isolation and reused across views / exporters.\n */\n\n/** MIME type used when dragging a team type from the palette onto the canvas. */\nexport const DND_MIME = \"application/x-tt-team-type\";\n\n/** The four fundamental team types in Team Topologies. */\nexport type TeamType = \"stream-aligned\" | \"enabling\" | \"complicated-subsystem\" | \"platform\";\n\nexport const TEAM_TYPES: readonly TeamType[] = [\n \"stream-aligned\",\n \"enabling\",\n \"complicated-subsystem\",\n \"platform\",\n] as const;\n\n/** The three core team interaction modes in Team Topologies. */\nexport type InteractionMode = \"collaboration\" | \"x-as-a-service\" | \"facilitating\";\n\nexport const INTERACTION_MODES: readonly InteractionMode[] = [\n \"collaboration\",\n \"x-as-a-service\",\n \"facilitating\",\n] as const;\n\n/** Geometric size of a node in canvas units (px). Encodes cognitive load. */\nexport interface Size {\n width: number;\n height: number;\n}\n\n/** Position of a node on the canvas in canvas units (px). */\nexport interface Position {\n x: number;\n y: number;\n}\n\n/** A team node in the canonical document model. */\nexport interface TeamNode {\n id: string;\n type: TeamType;\n label: string;\n description?: string;\n position: Position;\n size: Size;\n fill?: string;\n stroke?: string;\n}\n\n/**\n * An interaction in the canonical document model.\n *\n * Per the official Team Topologies notation, an interaction is a placed,\n * resizable SHAPE (parallelogram / triangle / circle) overlaid on the boundary\n * between the teams it relates to — not a connecting line. The relationship is\n * therefore spatial (overlap), so there is no source/target reference.\n */\nexport interface InteractionShape {\n id: string;\n mode: InteractionMode;\n label?: string;\n position: Position;\n size: Size;\n fill?: string;\n stroke?: string;\n}\n\n/**\n * A \"flow of change\" guide: a placed, resizable arrow element. Lets you anchor\n * the implied left-to-right flow, and visualise several team groupings on one\n * canvas.\n */\nexport interface FlowShape {\n id: string;\n label?: string;\n position: Position;\n size: Size;\n}\n\n/**\n * A free-text note beside the diagram (like a BPMN text annotation). It either\n * stands alone or is attached to exactly one team, interaction or flow, which\n * its dashed connector points at.\n */\nexport interface TextAnnotation {\n id: string;\n text: string;\n position: Position;\n size: Size;\n /** Id of the team, interaction or flow this annotation is attached to. */\n attachedTo?: string;\n}\n\n/** Current document schema version. Bump + add a migration when shape changes. */\nexport const DOCUMENT_VERSION = 3 as const;\n\n/**\n * A complete Team Topologies diagram. This is what gets serialised to JSON,\n * embedded into exported images, and encoded into share URLs.\n */\nexport interface TtDocument {\n version: typeof DOCUMENT_VERSION;\n title: string;\n nodes: TeamNode[];\n interactions: InteractionShape[];\n flows: FlowShape[];\n annotations: TextAnnotation[];\n}\n","/**\n * The Team Topologies visual notation, encoded as data.\n *\n * Colours, shapes and stroke styles follow the official\n * \"Team-Shape-Templates\" specification published by Team Topologies\n * (https://github.com/TeamTopologies/Team-Shape-Templates):\n *\n * - Team shapes are SOLID outlines (long-lived structures).\n * - Interaction-mode shapes are 50% transparent with DASHED outlines\n * (short-lived interactions).\n * - Each element is distinguished by SHAPE as well as colour, so the\n * notation stays readable for people with colour-vision deficiency.\n *\n * This module is pure data — it must not import the rendering layer.\n */\n\nimport type { InteractionMode, Size, TeamType } from \"./types\";\n\nexport type TeamShape = \"rounded-rect-horizontal\" | \"rounded-rect-vertical\" | \"octagon\" | \"rect\";\n\nexport type InteractionGlyph = \"parallelogram\" | \"triangle\" | \"circle\";\n\nexport type StrokeStyle = \"solid\" | \"dashed\" | \"dotted\";\n\nexport interface TeamTypeSpec {\n type: TeamType;\n /** Short display name. */\n label: string;\n /** One-line purpose, shown in the palette and inspector. */\n description: string;\n shape: TeamShape;\n fill: string;\n stroke: string;\n strokeStyle: StrokeStyle;\n strokeWidth: number;\n /** Default size when a node of this type is created. */\n defaultSize: Size;\n /** Minimum size enforced by the resizer. */\n minSize: Size;\n}\n\nexport interface InteractionModeSpec {\n mode: InteractionMode;\n label: string;\n description: string;\n shape: InteractionGlyph;\n fill: string;\n stroke: string;\n strokeStyle: StrokeStyle;\n strokeWidth: number;\n /** Opacity for the interaction shape (short-lived → translucent). */\n opacity: number;\n /** Whether direction is semantically meaningful (the X-as-a-Service triangle). */\n directional: boolean;\n /** Default size when a shape of this mode is created. */\n defaultSize: Size;\n /** Minimum size enforced by the resizer. */\n minSize: Size;\n}\n\n/** The left-to-right \"flow of change\" guide, a placeable annotation element. */\nexport interface FlowSpec {\n label: string;\n fill: string;\n stroke: string;\n strokeStyle: StrokeStyle;\n strokeWidth: number;\n defaultSize: Size;\n minSize: Size;\n}\n\nexport const TEAM_TYPE_SPECS: Record<TeamType, TeamTypeSpec> = {\n \"stream-aligned\": {\n type: \"stream-aligned\",\n label: \"Stream-aligned\",\n description: \"Aligned to a single, valuable stream of work; owns it end-to-end.\",\n shape: \"rounded-rect-horizontal\",\n fill: \"#FFEDB8\",\n stroke: \"#FFD966\",\n strokeStyle: \"solid\",\n strokeWidth: 2,\n defaultSize: { width: 240, height: 96 },\n minSize: { width: 140, height: 64 },\n },\n enabling: {\n type: \"enabling\",\n label: \"Enabling\",\n description:\n \"Helps stream-aligned teams acquire missing capabilities; coaches, then steps back.\",\n shape: \"rounded-rect-vertical\",\n fill: \"#DFBDCF\",\n stroke: \"#D09CB7\",\n strokeStyle: \"solid\",\n strokeWidth: 2,\n defaultSize: { width: 120, height: 200 },\n minSize: { width: 80, height: 120 },\n },\n \"complicated-subsystem\": {\n type: \"complicated-subsystem\",\n label: \"Complicated Subsystem\",\n description:\n \"Owns a part of the system needing deep specialist knowledge, reducing others' cognitive load.\",\n shape: \"octagon\",\n fill: \"#FFC08B\",\n stroke: \"#E88814\",\n strokeStyle: \"solid\",\n strokeWidth: 2,\n defaultSize: { width: 170, height: 150 },\n minSize: { width: 110, height: 100 },\n },\n platform: {\n type: \"platform\",\n label: \"Platform\",\n description:\n \"Provides internal self-service capabilities to reduce cognitive load for stream-aligned teams.\",\n shape: \"rect\",\n fill: \"#B7CDF1\",\n stroke: \"#6D9EEB\",\n strokeStyle: \"solid\",\n strokeWidth: 2,\n defaultSize: { width: 380, height: 130 },\n minSize: { width: 200, height: 90 },\n },\n};\n\nexport const INTERACTION_MODE_SPECS: Record<InteractionMode, InteractionModeSpec> = {\n collaboration: {\n mode: \"collaboration\",\n label: \"Collaboration\",\n description:\n \"Two teams work closely together for a defined period; high overhead, high discovery.\",\n shape: \"parallelogram\",\n fill: \"#C6BEDF\",\n stroke: \"#967EE2\",\n strokeStyle: \"dashed\",\n strokeWidth: 2,\n opacity: 0.5,\n directional: false,\n defaultSize: { width: 112, height: 72 },\n minSize: { width: 60, height: 44 },\n },\n \"x-as-a-service\": {\n mode: \"x-as-a-service\",\n label: \"X-as-a-Service\",\n description:\n \"One team consumes something the other provides 'as a service'; minimal collaboration.\",\n shape: \"triangle\",\n fill: \"#B4B4B4\",\n stroke: \"#999696\",\n strokeStyle: \"dashed\",\n strokeWidth: 2,\n opacity: 0.5,\n directional: true,\n defaultSize: { width: 88, height: 78 },\n minSize: { width: 54, height: 48 },\n },\n facilitating: {\n mode: \"facilitating\",\n label: \"Facilitating\",\n description:\n \"One team helps/coaches another to clear impediments and learn; sensing and discovery.\",\n shape: \"circle\",\n fill: \"#C9DFBE\",\n stroke: \"#78996B\",\n strokeStyle: \"dashed\",\n strokeWidth: 2,\n opacity: 0.5,\n directional: false,\n defaultSize: { width: 84, height: 84 },\n minSize: { width: 48, height: 48 },\n },\n};\n\n/**\n * The \"flow of change\" guide — a placeable dashed arrow (left-to-right).\n * Not a team or interaction: a standalone annotation element.\n */\nexport const FLOW_SPEC: FlowSpec = {\n label: \"Flow of change\",\n fill: \"transparent\",\n stroke: \"#6b6459\",\n strokeStyle: \"dashed\",\n strokeWidth: 2,\n defaultSize: { width: 520, height: 64 },\n minSize: { width: 160, height: 36 },\n};\n\n/**\n * A text annotation — not part of the Team Topologies notation, so it carries\n * no colours here; the renderer draws it in the neutral brand ink.\n */\nexport interface AnnotationSpec {\n label: string;\n defaultSize: Size;\n minSize: Size;\n}\n\nexport const ANNOTATION_SPEC: AnnotationSpec = {\n label: \"Annotation\",\n defaultSize: { width: 200, height: 64 },\n minSize: { width: 60, height: 30 },\n};\n\n/** Maps a stroke style to an SVG/CSS dash array (empty string = solid). */\nexport function dashArray(style: StrokeStyle, strokeWidth = 2): string {\n switch (style) {\n case \"dashed\":\n return `${strokeWidth * 3} ${strokeWidth * 2}`;\n case \"dotted\":\n return `${strokeWidth} ${strokeWidth * 1.5}`;\n case \"solid\":\n default:\n return \"\";\n }\n}\n\nexport const ALL_TEAM_SPECS: readonly TeamTypeSpec[] = Object.values(TEAM_TYPE_SPECS);\nexport const ALL_INTERACTION_SPECS: readonly InteractionModeSpec[] =\n Object.values(INTERACTION_MODE_SPECS);\n","/**\n * The id rules of a Team Topologies document. Besides the elements a document lists, a diagram\n * holds parts it never writes down: the diagram itself and the connector of every annotation. They\n * take ids of their own, so no element may use one of them; otherwise opening the file would fail\n * halfway, with the previous diagram already gone.\n */\n\n/** The id of the diagram itself (the canvas root of the renderer). */\nexport const DIAGRAM_ROOT_ID = \"tt-root\";\n\n/** diagram-js names the roots it creates on its own `__implicitroot_<n>`. */\nconst ENGINE_ROOT_ID_PREFIX = \"__implicitroot\";\n\n/** Connectors are not stored: an annotation's connector derives its id from the annotation. */\nexport function associationId(annotationId: string): string {\n return `assoc_${annotationId}`;\n}\n\nexport interface DocumentIdProblem {\n /** Where the offending id sits, e.g. `[\"nodes\", 2, \"id\"]`. */\n path: (string | number)[];\n message: string;\n}\n\nconst COLLECTIONS = [\"nodes\", \"interactions\", \"flows\", \"annotations\"] as const;\n\ntype DocumentElements = Record<(typeof COLLECTIONS)[number], readonly { id: string }[]>;\n\n/**\n * Every id of the document that would collide on the canvas: a duplicate, the diagram's own id, a\n * diagram-js root id, or the id of an annotation's connector.\n */\nexport function documentIdProblems(doc: DocumentElements): DocumentIdProblem[] {\n const problems: DocumentIdProblem[] = [];\n const connectorIds = new Map(\n doc.annotations.map((annotation) => [associationId(annotation.id), annotation.id]),\n );\n const seen = new Set<string>();\n for (const collection of COLLECTIONS) {\n doc[collection].forEach((element, index) => {\n const path = [collection, index, \"id\"];\n const { id } = element;\n if (seen.has(id)) {\n problems.push({\n path,\n message: `duplicate id \"${id}\"; ids must be unique across nodes, interactions, flows and annotations`,\n });\n }\n seen.add(id);\n if (id === DIAGRAM_ROOT_ID) {\n problems.push({ path, message: `\"${id}\" is reserved for the diagram itself` });\n } else if (id.startsWith(ENGINE_ROOT_ID_PREFIX)) {\n problems.push({\n path,\n message: `ids starting with \"${ENGINE_ROOT_ID_PREFIX}\" are reserved`,\n });\n }\n const annotationId = connectorIds.get(id);\n if (annotationId !== undefined) {\n problems.push({\n path,\n message: `\"${id}\" is reserved for the connector of annotation \"${annotationId}\"`,\n });\n }\n });\n }\n return problems;\n}\n","/**\n * Runtime validation for the document model using Zod.\n *\n * Anything entering the app from the outside world (imported files, share\n * URLs, localStorage) is parsed through {@link parseDocument} so malformed or\n * tampered data can never corrupt the editor state. Fields the schema does not\n * know pass through untouched (see `foreign.ts`), so another tool's data\n * survives a save.\n */\n\nimport { z } from \"zod\";\nimport { documentIdProblems } from \"./ids\";\nimport { DOCUMENT_VERSION, INTERACTION_MODES, TEAM_TYPES } from \"./types\";\nimport type { TtDocument } from \"./types\";\n\nconst teamTypeSchema = z.enum(TEAM_TYPES as unknown as [string, ...string[]]);\nconst interactionModeSchema = z.enum(INTERACTION_MODES as unknown as [string, ...string[]]);\n\nconst sizeSchema = z.object({\n width: z.number().finite().positive(),\n height: z.number().finite().positive(),\n});\n\nconst positionSchema = z.object({\n x: z.number().finite(),\n y: z.number().finite(),\n});\n\nconst hexColor = z.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/, \"expected a hex colour\");\n\nexport const teamNodeSchema = z.looseObject({\n id: z.string().min(1),\n type: teamTypeSchema,\n label: z.string(),\n description: z.string().optional(),\n position: positionSchema,\n size: sizeSchema,\n fill: hexColor.optional(),\n stroke: hexColor.optional(),\n});\n\nexport const interactionSchema = z.looseObject({\n id: z.string().min(1),\n mode: interactionModeSchema,\n label: z.string().optional(),\n position: positionSchema,\n size: sizeSchema,\n fill: hexColor.optional(),\n stroke: hexColor.optional(),\n});\n\nexport const flowSchema = z.looseObject({\n id: z.string().min(1),\n label: z.string().optional(),\n position: positionSchema,\n size: sizeSchema,\n});\n\nexport const annotationSchema = z.looseObject({\n id: z.string().min(1),\n text: z.string(),\n position: positionSchema,\n size: sizeSchema,\n attachedTo: z.string().min(1).optional(),\n});\n\nexport const documentSchema = z\n .looseObject({\n version: z.literal(DOCUMENT_VERSION),\n title: z.string(),\n nodes: z.array(teamNodeSchema),\n interactions: z.array(interactionSchema),\n flows: z.array(flowSchema),\n annotations: z.array(annotationSchema),\n })\n .superRefine((document, context) => {\n for (const { path, message } of documentIdProblems(document)) {\n context.addIssue({ code: \"custom\", path, message });\n }\n });\n\n/** One reason a document is invalid, at the path of the offending value. */\nexport interface DocumentIssue {\n path: (string | number)[];\n message: string;\n}\n\nexport type ParseResult =\n { ok: true; document: TtDocument } | { ok: false; error: string; issues: DocumentIssue[] };\n\n/**\n * Validates and (if necessary) migrates unknown data into a {@link TtDocument}.\n * Returns a discriminated result rather than throwing so callers can show a\n * friendly message, or point at each offending value (`issues`).\n */\nexport function parseDocument(input: unknown): ParseResult {\n const migrated = migrate(input);\n const result = documentSchema.safeParse(migrated);\n if (!result.success) {\n const issues = result.error.issues.map((issue) => ({\n path: issue.path.filter((key): key is string | number => typeof key !== \"symbol\"),\n message: issue.message,\n }));\n return {\n ok: false,\n error: issues.map((i) => `${i.path.join(\".\") || \"(root)\"}: ${i.message}`).join(\"; \"),\n issues,\n };\n }\n return { ok: true, document: result.data as TtDocument };\n}\n\n/**\n * Forward-migrates older document shapes to the current version. v1 modelled\n * interactions as edges (source/target, no geometry) and carried a\n * `showFlowOfChange` flag; v2 makes interactions placed shapes and adds `flows`;\n * v3 adds `annotations`. Legacy edge-interactions can't be placed meaningfully,\n * so they're dropped.\n */\nfunction migrate(input: unknown): unknown {\n if (input == null || typeof input !== \"object\") return input;\n const doc = input as Record<string, unknown>;\n const next: Record<string, unknown> = { ...doc };\n delete next.showFlowOfChange; // v1 flag, gone in v2\n next.version = DOCUMENT_VERSION;\n if (typeof next.title !== \"string\") next.title = \"Untitled team topology\";\n if (!Array.isArray(next.nodes)) next.nodes = [];\n // Keep only placed interaction shapes; drop legacy edges (no position/size).\n next.interactions = Array.isArray(next.interactions)\n ? next.interactions.filter(\n (e) => e != null && typeof e === \"object\" && \"position\" in e && \"size\" in e,\n )\n : [];\n if (!Array.isArray(next.flows)) next.flows = [];\n if (!Array.isArray(next.annotations)) next.annotations = [];\n return next;\n}\n","/**\n * Fields a document carries that this modeler does not know, such as a vendor's `\"x-vendor\"` on a\n * team. They are kept through open and save, written after the known fields and sorted, so another\n * tool's data survives an edit in the modeler and the output stays deterministic.\n */\n\nexport const DOCUMENT_FIELDS = [\n \"version\",\n \"title\",\n \"nodes\",\n \"interactions\",\n \"flows\",\n \"annotations\",\n] as const;\nexport const TEAM_NODE_FIELDS = [\n \"id\",\n \"type\",\n \"label\",\n \"description\",\n \"position\",\n \"size\",\n \"fill\",\n \"stroke\",\n] as const;\nexport const INTERACTION_FIELDS = [\n \"id\",\n \"mode\",\n \"label\",\n \"position\",\n \"size\",\n \"fill\",\n \"stroke\",\n] as const;\nexport const FLOW_FIELDS = [\"id\", \"label\", \"position\", \"size\"] as const;\nexport const ANNOTATION_FIELDS = [\"id\", \"text\", \"position\", \"size\", \"attachedTo\"] as const;\n\n/** Unknown fields by name, sorted, with their values in canonical form. */\nexport type ForeignFields = Readonly<Record<string, unknown>>;\n\n/** JSON objects have no key order, so nested keys are sorted too: equal data, equal bytes. */\nfunction canonicalValue(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(canonicalValue);\n if (value === null || typeof value !== \"object\") return value;\n const record = value as Record<string, unknown>;\n return Object.fromEntries(\n Object.keys(record)\n .filter((key) => record[key] !== undefined)\n .sort()\n .map((key) => [key, canonicalValue(record[key])]),\n );\n}\n\n/** The fields of `value` outside `knownFields`, or undefined when there are none. */\nexport function foreignFields(\n value: object,\n knownFields: readonly string[],\n): ForeignFields | undefined {\n const record = value as Record<string, unknown>;\n const names = Object.keys(record)\n .filter((name) => !knownFields.includes(name) && record[name] !== undefined)\n .sort();\n if (names.length === 0) return undefined;\n return Object.fromEntries(names.map((name) => [name, canonicalValue(record[name])]));\n}\n\n/**\n * `known` followed by the foreign fields of `source`. Built from entries, never by assignment, so\n * a field named `__proto__` stays a field instead of replacing the prototype.\n */\nexport function withForeignFields<T extends object>(\n known: T,\n source: object | undefined,\n knownFields: readonly string[],\n): T {\n const foreign = source ? foreignFields(source, knownFields) : undefined;\n if (!foreign) return known;\n return Object.fromEntries([...Object.entries(known), ...Object.entries(foreign)]) as T;\n}\n","/**\n * Deterministic serialisation of the document model.\n *\n * Producing byte-stable JSON (sorted arrays, fixed key order, rounded\n * coordinates) makes diagrams diff-friendly in version control and gives\n * stable share URLs / embedded payloads.\n */\n\nimport {\n ANNOTATION_FIELDS,\n DOCUMENT_FIELDS,\n FLOW_FIELDS,\n INTERACTION_FIELDS,\n TEAM_NODE_FIELDS,\n withForeignFields,\n} from \"./foreign\";\nimport { DOCUMENT_VERSION } from \"./types\";\nimport type {\n FlowShape,\n InteractionShape,\n Position,\n Size,\n TeamNode,\n TextAnnotation,\n TtDocument,\n} from \"./types\";\n\n/** Round to 2 decimals to strip floating-point drift from drag operations. */\nfunction round(n: number): number {\n return Math.round(n * 100) / 100;\n}\n\nfunction normPosition(p: Position): Position {\n return { x: round(p.x), y: round(p.y) };\n}\n\nfunction normSize(s: Size): Size {\n return { width: round(s.width), height: round(s.height) };\n}\n\n/** Drops undefined fields and applies a fixed key order to a node. */\nfunction normNode(n: TeamNode): TeamNode {\n const out: TeamNode = {\n id: n.id,\n type: n.type,\n label: n.label,\n position: normPosition(n.position),\n size: normSize(n.size),\n };\n if (n.description) out.description = n.description;\n if (n.fill) out.fill = n.fill;\n if (n.stroke) out.stroke = n.stroke;\n return withForeignFields(out, n, TEAM_NODE_FIELDS);\n}\n\nfunction normInteraction(e: InteractionShape): InteractionShape {\n const out: InteractionShape = {\n id: e.id,\n mode: e.mode,\n position: normPosition(e.position),\n size: normSize(e.size),\n };\n if (e.label) out.label = e.label;\n if (e.fill) out.fill = e.fill;\n if (e.stroke) out.stroke = e.stroke;\n return withForeignFields(out, e, INTERACTION_FIELDS);\n}\n\nfunction normFlow(f: FlowShape): FlowShape {\n const out: FlowShape = {\n id: f.id,\n position: normPosition(f.position),\n size: normSize(f.size),\n };\n if (f.label) out.label = f.label;\n return withForeignFields(out, f, FLOW_FIELDS);\n}\n\nfunction normAnnotation(a: TextAnnotation): TextAnnotation {\n const out: TextAnnotation = {\n id: a.id,\n text: a.text,\n position: normPosition(a.position),\n size: normSize(a.size),\n };\n if (a.attachedTo) out.attachedTo = a.attachedTo;\n return withForeignFields(out, a, ANNOTATION_FIELDS);\n}\n\nconst byId = (a: { id: string }, b: { id: string }): number =>\n a.id < b.id ? -1 : a.id > b.id ? 1 : 0;\n\n/**\n * Returns a canonicalised copy of a document (sorted, rounded, version-stamped). Fields the\n * modeler does not know follow the known ones, sorted by name.\n */\nexport function canonicalize(doc: TtDocument): TtDocument {\n return withForeignFields(\n {\n version: DOCUMENT_VERSION,\n title: doc.title,\n nodes: [...doc.nodes].map(normNode).sort(byId),\n interactions: [...doc.interactions].map(normInteraction).sort(byId),\n flows: [...doc.flows].map(normFlow).sort(byId),\n annotations: [...doc.annotations].map(normAnnotation).sort(byId),\n },\n doc,\n DOCUMENT_FIELDS,\n );\n}\n\n/**\n * Serialises a document to deterministic JSON. An empty `annotations` list is left out, so\n * re-saving a model that has no annotations changes nothing but its version stamp. The pretty\n * form is the file on disk and ends with a line break, like the files editors and Git expect;\n * the compact form (share links, local storage) has none.\n */\nexport function serializeDocument(doc: TtDocument, pretty = true): string {\n const canonical = canonicalize(doc);\n const output =\n canonical.annotations.length > 0\n ? canonical\n : Object.fromEntries(Object.entries(canonical).filter(([key]) => key !== \"annotations\"));\n return pretty ? `${JSON.stringify(output, null, 2)}\\n` : JSON.stringify(output);\n}\n","/**\n * Factory helpers for constructing well-formed model objects with the correct\n * notation defaults (sizes, labels). Kept DOM-free.\n */\n\nimport { nanoid } from \"nanoid\";\nimport { ANNOTATION_SPEC, FLOW_SPEC, INTERACTION_MODE_SPECS, TEAM_TYPE_SPECS } from \"./notation\";\nimport type {\n FlowShape,\n InteractionMode,\n InteractionShape,\n Position,\n TeamNode,\n TeamType,\n TextAnnotation,\n TtDocument,\n} from \"./types\";\nimport { DOCUMENT_VERSION } from \"./types\";\n\nexport function newId(prefix: string): string {\n return `${prefix}_${nanoid(8)}`;\n}\n\n/** Creates a team node of the given type at a position, with notation defaults. */\nexport function createTeamNode(\n type: TeamType,\n position: Position,\n overrides: Partial<Omit<TeamNode, \"id\" | \"type\">> = {},\n): TeamNode {\n const spec = TEAM_TYPE_SPECS[type];\n return {\n id: newId(\"team\"),\n type,\n label: overrides.label ?? spec.label,\n description: overrides.description,\n position,\n size: overrides.size ?? { ...spec.defaultSize },\n fill: overrides.fill,\n stroke: overrides.stroke,\n };\n}\n\n/** Creates a placed interaction shape of the given mode, with notation defaults. */\nexport function createInteractionShape(\n mode: InteractionMode,\n position: Position,\n overrides: Partial<Omit<InteractionShape, \"id\" | \"mode\" | \"position\">> = {},\n): InteractionShape {\n const spec = INTERACTION_MODE_SPECS[mode];\n return {\n id: newId(\"int\"),\n mode,\n position,\n size: overrides.size ?? { ...spec.defaultSize },\n label: overrides.label,\n fill: overrides.fill,\n stroke: overrides.stroke,\n };\n}\n\n/** Creates a placed \"flow of change\" arrow, with notation defaults. */\nexport function createFlowShape(\n position: Position,\n overrides: Partial<Omit<FlowShape, \"id\" | \"position\">> = {},\n): FlowShape {\n return {\n id: newId(\"flow\"),\n position,\n size: overrides.size ?? { ...FLOW_SPEC.defaultSize },\n label: overrides.label ?? FLOW_SPEC.label,\n };\n}\n\n/** Creates a text annotation, optionally attached to a team, interaction or flow. */\nexport function createTextAnnotation(\n position: Position,\n overrides: Partial<Omit<TextAnnotation, \"id\" | \"position\">> = {},\n): TextAnnotation {\n return {\n id: newId(\"ann\"),\n text: overrides.text ?? \"\",\n position,\n size: overrides.size ?? { ...ANNOTATION_SPEC.defaultSize },\n attachedTo: overrides.attachedTo,\n };\n}\n\n/** An empty document with sensible defaults. */\nexport function emptyDocument(title = \"Untitled team topology\"): TtDocument {\n return {\n version: DOCUMENT_VERSION,\n title,\n nodes: [],\n interactions: [],\n flows: [],\n annotations: [],\n };\n}\n","/**\n * A small but complete example diagram exercising all four team types, all three\n * interaction modes (as placed shapes overlaying the team boundaries), a\n * flow-of-change element and an attached annotation. The stream-aligned teams\n * are stacked as parallel lanes along the flow of change, as in the Team\n * Topologies book: side by side on the flow they would read as hand-offs. Ids are\n * fixed so the fixture serialises stably.\n */\n\nimport { DOCUMENT_VERSION } from \"./types\";\nimport type { TtDocument } from \"./types\";\nimport { ANNOTATION_SPEC, INTERACTION_MODE_SPECS, TEAM_TYPE_SPECS } from \"./notation\";\n\nconst s = TEAM_TYPE_SPECS;\nconst i = INTERACTION_MODE_SPECS;\n\nconst LANE_WIDTH = 600;\n\nexport const SAMPLE_DOCUMENT: TtDocument = {\n version: DOCUMENT_VERSION,\n title: \"Online shop team topology\",\n nodes: [\n {\n id: \"team_test_automation\",\n type: \"enabling\",\n label: \"Test Automation\",\n description: \"Coaches stream-aligned teams in test automation, then steps back.\",\n position: { x: 40, y: 150 },\n size: { width: s.enabling.defaultSize.width, height: 222 },\n },\n {\n id: \"team_discovery\",\n type: \"stream-aligned\",\n label: \"Product Discovery\",\n description: \"Owns search, browsing and product pages end-to-end.\",\n position: { x: 220, y: 150 },\n size: { width: LANE_WIDTH, height: s[\"stream-aligned\"].defaultSize.height },\n },\n {\n id: \"team_checkout\",\n type: \"stream-aligned\",\n label: \"Checkout & Payments\",\n description: \"Owns the checkout and payment journey end-to-end.\",\n position: { x: 220, y: 276 },\n size: { width: LANE_WIDTH, height: s[\"stream-aligned\"].defaultSize.height },\n },\n {\n id: \"team_fulfilment\",\n type: \"stream-aligned\",\n label: \"Order Fulfilment\",\n description: \"Owns delivery, tracking and returns end-to-end.\",\n position: { x: 220, y: 402 },\n size: { width: LANE_WIDTH, height: s[\"stream-aligned\"].defaultSize.height },\n },\n {\n id: \"team_fraud\",\n type: \"complicated-subsystem\",\n label: \"Fraud Detection\",\n description: \"Specialists for the real-time fraud scoring model.\",\n position: { x: 880, y: 249 },\n size: { ...s[\"complicated-subsystem\"].defaultSize },\n },\n {\n id: \"team_platform\",\n type: \"platform\",\n label: \"Cloud Platform\",\n description: \"Self-service CI/CD, runtime and observability for all teams.\",\n position: { x: 220, y: 552 },\n size: { width: LANE_WIDTH, height: 110 },\n },\n ],\n interactions: [\n {\n id: \"int_testing_discovery\",\n mode: \"facilitating\",\n position: { x: 148, y: 156 },\n size: { ...i.facilitating.defaultSize },\n },\n {\n id: \"int_testing_checkout\",\n mode: \"facilitating\",\n position: { x: 148, y: 282 },\n size: { ...i.facilitating.defaultSize },\n },\n {\n id: \"int_checkout_fraud\",\n mode: \"collaboration\",\n label: \"fraud rules\",\n position: { x: 794, y: 288 },\n size: { ...i.collaboration.defaultSize },\n },\n {\n id: \"int_platform_fulfilment\",\n mode: \"x-as-a-service\",\n position: { x: 476, y: 486 },\n size: { ...i[\"x-as-a-service\"].defaultSize },\n },\n ],\n flows: [\n {\n id: \"flow_main\",\n label: \"Flow of change\",\n position: { x: 40, y: 40 },\n size: { width: 1010, height: 56 },\n },\n ],\n annotations: [\n {\n id: \"ann_fraud_handover\",\n text: \"Collaboration until the fraud rules are stable (Q3), then X-as-a-Service\",\n position: { x: 880, y: 423 },\n size: { ...ANNOTATION_SPEC.defaultSize },\n attachedTo: \"int_checkout_fraud\",\n },\n ],\n};\n"]}
1
+ {"version":3,"sources":["../src/types.ts","../src/notation.ts","../src/ids.ts","../src/schema.ts","../src/foreign.ts","../src/serialize.ts","../src/factory.ts","../src/sample.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,EAAI;AAAA,MAC3B,MAAM,EAAE,GAAG,CAAA,CAAE,gBAAgB,EAAE,WAAA;AAAY;AAC7C,GACF;AAAA,EACA,KAAA,EAAO;AAAA,IACL;AAAA,MACE,EAAA,EAAI,WAAA;AAAA,MACJ,KAAA,EAAO,gBAAA;AAAA,MACP,QAAA,EAAU,EAAE,CAAA,EAAG,EAAA,EAAI,GAAG,EAAA,EAAG;AAAA,MACzB,IAAA,EAAM,EAAE,KAAA,EAAO,IAAA,EAAM,QAAQ,EAAA;AAAG;AAClC,GACF;AAAA,EACA,WAAA,EAAa;AAAA,IACX;AAAA,MACE,EAAA,EAAI,oBAAA;AAAA,MACJ,IAAA,EAAM,0EAAA;AAAA,MACN,QAAA,EAAU,EAAE,CAAA,EAAG,GAAA,EAAK,GAAG,GAAA,EAAI;AAAA,MAC3B,IAAA,EAAM,EAAE,GAAG,eAAA,CAAgB,WAAA,EAAY;AAAA,MACvC,UAAA,EAAY;AAAA;AACd;AAEJ","file":"index.cjs","sourcesContent":["/**\n * Pure (DOM-free) domain types for the Team Topologies model.\n *\n * This module is the canonical representation of a diagram and must never\n * import from the rendering layer (`@xyflow/react`) or touch the DOM, so it\n * can be unit-tested in isolation and reused across views / exporters.\n */\n\n/** MIME type used when dragging a team type from the palette onto the canvas. */\nexport const DND_MIME = \"application/x-tt-team-type\";\n\n/** The four fundamental team types in Team Topologies. */\nexport type TeamType = \"stream-aligned\" | \"enabling\" | \"complicated-subsystem\" | \"platform\";\n\nexport const TEAM_TYPES: readonly TeamType[] = [\n \"stream-aligned\",\n \"enabling\",\n \"complicated-subsystem\",\n \"platform\",\n] as const;\n\n/** The three core team interaction modes in Team Topologies. */\nexport type InteractionMode = \"collaboration\" | \"x-as-a-service\" | \"facilitating\";\n\nexport const INTERACTION_MODES: readonly InteractionMode[] = [\n \"collaboration\",\n \"x-as-a-service\",\n \"facilitating\",\n] as const;\n\n/** Geometric size of a node in canvas units (px). Encodes cognitive load. */\nexport interface Size {\n width: number;\n height: number;\n}\n\n/** Position of a node on the canvas in canvas units (px). */\nexport interface Position {\n x: number;\n y: number;\n}\n\n/** A team node in the canonical document model. */\nexport interface TeamNode {\n id: string;\n type: TeamType;\n label: string;\n description?: string;\n position: Position;\n size: Size;\n fill?: string;\n stroke?: string;\n}\n\n/**\n * An interaction in the canonical document model.\n *\n * Per the official Team Topologies notation, an interaction is a placed,\n * resizable SHAPE (parallelogram / triangle / circle) overlaid on the boundary\n * between the teams it relates to — not a connecting line. The relationship is\n * therefore spatial (overlap), so there is no source/target reference.\n */\nexport interface InteractionShape {\n id: string;\n mode: InteractionMode;\n label?: string;\n position: Position;\n size: Size;\n fill?: string;\n stroke?: string;\n}\n\n/**\n * A \"flow of change\" guide: a placed, resizable arrow element. Lets you anchor\n * the implied left-to-right flow, and visualise several team groupings on one\n * canvas.\n */\nexport interface FlowShape {\n id: string;\n label?: string;\n position: Position;\n size: Size;\n}\n\n/**\n * A free-text note beside the diagram (like a BPMN text annotation). It either\n * stands alone or is attached to exactly one team, interaction or flow, which\n * its dashed connector points at.\n */\nexport interface TextAnnotation {\n id: string;\n text: string;\n position: Position;\n size: Size;\n /** Id of the team, interaction or flow this annotation is attached to. */\n attachedTo?: string;\n}\n\n/** Current document schema version. Bump + add a migration when shape changes. */\nexport const DOCUMENT_VERSION = 3 as const;\n\n/**\n * A complete Team Topologies diagram. This is what gets serialised to JSON,\n * embedded into exported images, and encoded into share URLs.\n */\nexport interface TtDocument {\n version: typeof DOCUMENT_VERSION;\n title: string;\n nodes: TeamNode[];\n interactions: InteractionShape[];\n flows: FlowShape[];\n annotations: TextAnnotation[];\n}\n","/**\n * The Team Topologies visual notation, encoded as data.\n *\n * Colours, shapes and stroke styles follow the official\n * \"Team-Shape-Templates\" specification published by Team Topologies\n * (https://github.com/TeamTopologies/Team-Shape-Templates):\n *\n * - Team shapes are SOLID outlines (long-lived structures).\n * - Interaction-mode shapes are 50% transparent with DASHED outlines\n * (short-lived interactions).\n * - Each element is distinguished by SHAPE as well as colour, so the\n * notation stays readable for people with colour-vision deficiency.\n *\n * This module is pure data — it must not import the rendering layer.\n */\n\nimport type { InteractionMode, Size, TeamType } from \"./types\";\n\nexport type TeamShape = \"rounded-rect-horizontal\" | \"rounded-rect-vertical\" | \"octagon\" | \"rect\";\n\nexport type InteractionGlyph = \"parallelogram\" | \"triangle\" | \"circle\";\n\nexport type StrokeStyle = \"solid\" | \"dashed\" | \"dotted\";\n\nexport interface TeamTypeSpec {\n type: TeamType;\n /** Short display name. */\n label: string;\n /** One-line purpose, shown in the palette and inspector. */\n description: string;\n shape: TeamShape;\n fill: string;\n stroke: string;\n strokeStyle: StrokeStyle;\n strokeWidth: number;\n /** Default size when a node of this type is created. */\n defaultSize: Size;\n /** Minimum size enforced by the resizer. */\n minSize: Size;\n}\n\nexport interface InteractionModeSpec {\n mode: InteractionMode;\n label: string;\n description: string;\n shape: InteractionGlyph;\n fill: string;\n stroke: string;\n strokeStyle: StrokeStyle;\n strokeWidth: number;\n /** Opacity for the interaction shape (short-lived → translucent). */\n opacity: number;\n /** Whether direction is semantically meaningful (the X-as-a-Service triangle). */\n directional: boolean;\n /** Default size when a shape of this mode is created. */\n defaultSize: Size;\n /** Minimum size enforced by the resizer. */\n minSize: Size;\n}\n\n/** The left-to-right \"flow of change\" guide, a placeable annotation element. */\nexport interface FlowSpec {\n label: string;\n fill: string;\n stroke: string;\n strokeStyle: StrokeStyle;\n strokeWidth: number;\n defaultSize: Size;\n minSize: Size;\n}\n\nexport const TEAM_TYPE_SPECS: Record<TeamType, TeamTypeSpec> = {\n \"stream-aligned\": {\n type: \"stream-aligned\",\n label: \"Stream-aligned\",\n description: \"Aligned to a single, valuable stream of work; owns it end-to-end.\",\n shape: \"rounded-rect-horizontal\",\n fill: \"#FFEDB8\",\n stroke: \"#FFD966\",\n strokeStyle: \"solid\",\n strokeWidth: 2,\n defaultSize: { width: 240, height: 96 },\n minSize: { width: 140, height: 64 },\n },\n enabling: {\n type: \"enabling\",\n label: \"Enabling\",\n description:\n \"Helps stream-aligned teams acquire missing capabilities; coaches, then steps back.\",\n shape: \"rounded-rect-vertical\",\n fill: \"#DFBDCF\",\n stroke: \"#D09CB7\",\n strokeStyle: \"solid\",\n strokeWidth: 2,\n defaultSize: { width: 120, height: 200 },\n minSize: { width: 80, height: 120 },\n },\n \"complicated-subsystem\": {\n type: \"complicated-subsystem\",\n label: \"Complicated Subsystem\",\n description:\n \"Owns a part of the system needing deep specialist knowledge, reducing others' cognitive load.\",\n shape: \"octagon\",\n fill: \"#FFC08B\",\n stroke: \"#E88814\",\n strokeStyle: \"solid\",\n strokeWidth: 2,\n defaultSize: { width: 170, height: 150 },\n minSize: { width: 110, height: 100 },\n },\n platform: {\n type: \"platform\",\n label: \"Platform\",\n description:\n \"Provides internal self-service capabilities to reduce cognitive load for stream-aligned teams.\",\n shape: \"rect\",\n fill: \"#B7CDF1\",\n stroke: \"#6D9EEB\",\n strokeStyle: \"solid\",\n strokeWidth: 2,\n defaultSize: { width: 380, height: 130 },\n minSize: { width: 200, height: 90 },\n },\n};\n\nexport const INTERACTION_MODE_SPECS: Record<InteractionMode, InteractionModeSpec> = {\n collaboration: {\n mode: \"collaboration\",\n label: \"Collaboration\",\n description:\n \"Two teams work closely together for a defined period; high overhead, high discovery.\",\n shape: \"parallelogram\",\n fill: \"#C6BEDF\",\n stroke: \"#967EE2\",\n strokeStyle: \"dashed\",\n strokeWidth: 2,\n opacity: 0.5,\n directional: false,\n defaultSize: { width: 112, height: 72 },\n minSize: { width: 60, height: 44 },\n },\n \"x-as-a-service\": {\n mode: \"x-as-a-service\",\n label: \"X-as-a-Service\",\n description:\n \"One team consumes something the other provides 'as a service'; minimal collaboration.\",\n shape: \"triangle\",\n fill: \"#B4B4B4\",\n stroke: \"#999696\",\n strokeStyle: \"dashed\",\n strokeWidth: 2,\n opacity: 0.5,\n directional: true,\n defaultSize: { width: 88, height: 78 },\n minSize: { width: 54, height: 48 },\n },\n facilitating: {\n mode: \"facilitating\",\n label: \"Facilitating\",\n description:\n \"One team helps/coaches another to clear impediments and learn; sensing and discovery.\",\n shape: \"circle\",\n fill: \"#C9DFBE\",\n stroke: \"#78996B\",\n strokeStyle: \"dashed\",\n strokeWidth: 2,\n opacity: 0.5,\n directional: false,\n defaultSize: { width: 84, height: 84 },\n minSize: { width: 48, height: 48 },\n },\n};\n\n/**\n * The \"flow of change\" guide — a placeable dashed arrow (left-to-right).\n * Not a team or interaction: a standalone annotation element.\n */\nexport const FLOW_SPEC: FlowSpec = {\n label: \"Flow of change\",\n fill: \"transparent\",\n stroke: \"#6b6459\",\n strokeStyle: \"dashed\",\n strokeWidth: 2,\n defaultSize: { width: 520, height: 64 },\n minSize: { width: 160, height: 36 },\n};\n\n/**\n * A text annotation — not part of the Team Topologies notation, so it carries\n * no colours here; the renderer draws it in the neutral brand ink.\n */\nexport interface AnnotationSpec {\n label: string;\n defaultSize: Size;\n minSize: Size;\n}\n\nexport const ANNOTATION_SPEC: AnnotationSpec = {\n label: \"Annotation\",\n defaultSize: { width: 200, height: 64 },\n minSize: { width: 60, height: 30 },\n};\n\n/** Maps a stroke style to an SVG/CSS dash array (empty string = solid). */\nexport function dashArray(style: StrokeStyle, strokeWidth = 2): string {\n switch (style) {\n case \"dashed\":\n return `${strokeWidth * 3} ${strokeWidth * 2}`;\n case \"dotted\":\n return `${strokeWidth} ${strokeWidth * 1.5}`;\n case \"solid\":\n default:\n return \"\";\n }\n}\n\nexport const ALL_TEAM_SPECS: readonly TeamTypeSpec[] = Object.values(TEAM_TYPE_SPECS);\nexport const ALL_INTERACTION_SPECS: readonly InteractionModeSpec[] =\n Object.values(INTERACTION_MODE_SPECS);\n","/**\n * The id rules of a Team Topologies document. Besides the elements a document lists, a diagram\n * holds parts it never writes down: the diagram itself and the connector of every annotation. They\n * take ids of their own, so no element may use one of them; otherwise opening the file would fail\n * halfway, with the previous diagram already gone. The canvas also keeps its elements in a plain\n * object, where the names of JavaScript's built-in object properties already resolve.\n */\n\n/** The id of the diagram itself (the canvas root of the renderer). */\nexport const DIAGRAM_ROOT_ID = \"tt-root\";\n\n/** diagram-js names the roots it creates on its own `__implicitroot_<n>`. */\nconst ENGINE_ROOT_ID_PREFIX = \"__implicitroot\";\n\n/** Connectors are not stored: an annotation's connector derives its id from the annotation. */\nexport function associationId(annotationId: string): string {\n return `assoc_${annotationId}`;\n}\n\nexport interface DocumentIdProblem {\n /** Where the offending id sits, e.g. `[\"nodes\", 2, \"id\"]`. */\n path: (string | number)[];\n message: string;\n}\n\nconst COLLECTIONS = [\"nodes\", \"interactions\", \"flows\", \"annotations\"] as const;\n\ntype DocumentElements = Record<(typeof COLLECTIONS)[number], readonly { id: string }[]>;\n\n/** Ids such as `constructor`, `toString` or `__proto__`, which every plain object already has. */\nfunction isBuiltInPropertyId(id: string): boolean {\n return Object.hasOwn(Object.prototype, id);\n}\n\n/**\n * Every id of the document that would collide on the canvas: a duplicate, the diagram's own id, a\n * diagram-js root id, the name of a built-in object property, or the id of an annotation's\n * connector.\n */\nexport function documentIdProblems(doc: DocumentElements): DocumentIdProblem[] {\n const problems: DocumentIdProblem[] = [];\n const connectorIds = new Map(\n doc.annotations.map((annotation) => [associationId(annotation.id), annotation.id]),\n );\n const seen = new Set<string>();\n for (const collection of COLLECTIONS) {\n doc[collection].forEach((element, index) => {\n const path = [collection, index, \"id\"];\n const { id } = element;\n if (seen.has(id)) {\n problems.push({\n path,\n message: `duplicate id \"${id}\"; ids must be unique across nodes, interactions, flows and annotations`,\n });\n }\n seen.add(id);\n if (id === DIAGRAM_ROOT_ID) {\n problems.push({ path, message: `\"${id}\" is reserved for the diagram itself` });\n } else if (id.startsWith(ENGINE_ROOT_ID_PREFIX)) {\n problems.push({\n path,\n message: `ids starting with \"${ENGINE_ROOT_ID_PREFIX}\" are reserved`,\n });\n } else if (isBuiltInPropertyId(id)) {\n problems.push({\n path,\n message: `\"${id}\" is reserved: it names a built-in property of JavaScript objects`,\n });\n }\n const annotationId = connectorIds.get(id);\n if (annotationId !== undefined) {\n problems.push({\n path,\n message: `\"${id}\" is reserved for the connector of annotation \"${annotationId}\"`,\n });\n }\n });\n }\n return problems;\n}\n","/**\n * Runtime validation for the document model using Zod.\n *\n * Anything entering the app from the outside world (imported files, share\n * URLs, localStorage) is parsed through {@link parseDocument} so malformed or\n * tampered data can never corrupt the editor state. Fields the schema does not\n * know pass through untouched (see `foreign.ts`), so another tool's data\n * survives a save.\n */\n\nimport { z } from \"zod\";\nimport { documentIdProblems } from \"./ids\";\nimport { DOCUMENT_VERSION, INTERACTION_MODES, TEAM_TYPES } from \"./types\";\nimport type { TtDocument } from \"./types\";\n\nconst teamTypeSchema = z.enum(TEAM_TYPES as unknown as [string, ...string[]]);\nconst interactionModeSchema = z.enum(INTERACTION_MODES as unknown as [string, ...string[]]);\n\nconst sizeSchema = z.object({\n width: z.number().finite().positive(),\n height: z.number().finite().positive(),\n});\n\nconst positionSchema = z.object({\n x: z.number().finite(),\n y: z.number().finite(),\n});\n\nconst hexColor = z.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/, \"expected a hex colour\");\n\nexport const teamNodeSchema = z.looseObject({\n id: z.string().min(1),\n type: teamTypeSchema,\n label: z.string(),\n description: z.string().optional(),\n position: positionSchema,\n size: sizeSchema,\n fill: hexColor.optional(),\n stroke: hexColor.optional(),\n});\n\nexport const interactionSchema = z.looseObject({\n id: z.string().min(1),\n mode: interactionModeSchema,\n label: z.string().optional(),\n position: positionSchema,\n size: sizeSchema,\n fill: hexColor.optional(),\n stroke: hexColor.optional(),\n});\n\nexport const flowSchema = z.looseObject({\n id: z.string().min(1),\n label: z.string().optional(),\n position: positionSchema,\n size: sizeSchema,\n});\n\nexport const annotationSchema = z.looseObject({\n id: z.string().min(1),\n text: z.string(),\n position: positionSchema,\n size: sizeSchema,\n attachedTo: z.string().min(1).optional(),\n});\n\nexport const documentSchema = z\n .looseObject({\n version: z.literal(DOCUMENT_VERSION),\n title: z.string(),\n nodes: z.array(teamNodeSchema),\n interactions: z.array(interactionSchema),\n flows: z.array(flowSchema),\n annotations: z.array(annotationSchema),\n })\n .superRefine((document, context) => {\n for (const { path, message } of documentIdProblems(document)) {\n context.addIssue({ code: \"custom\", path, message });\n }\n });\n\n/** One reason a document is invalid, at the path of the offending value. */\nexport interface DocumentIssue {\n path: (string | number)[];\n message: string;\n}\n\nexport type ParseResult =\n { ok: true; document: TtDocument } | { ok: false; error: string; issues: DocumentIssue[] };\n\n/**\n * Validates and (if necessary) migrates unknown data into a {@link TtDocument}.\n * Returns a discriminated result rather than throwing so callers can show a\n * friendly message, or point at each offending value (`issues`).\n */\nexport function parseDocument(input: unknown): ParseResult {\n const { document: migrated, interactionFileIndexes } = migrate(input);\n const result = documentSchema.safeParse(migrated);\n if (!result.success) {\n const issues = result.error.issues.map((issue) => ({\n path: pathInFile(\n issue.path.filter((key): key is string | number => typeof key !== \"symbol\"),\n interactionFileIndexes,\n ),\n message: issue.message,\n }));\n return {\n ok: false,\n error: issues.map((i) => `${i.path.join(\".\") || \"(root)\"}: ${i.message}`).join(\"; \"),\n issues,\n };\n }\n return { ok: true, document: result.data as TtDocument };\n}\n\n/** The last document version that modelled interactions as edges without geometry. */\nconst EDGE_INTERACTIONS_VERSION = 1;\n\ninterface Migration {\n document: unknown;\n /** For each interaction the migrated document keeps, its index in the input. */\n interactionFileIndexes: readonly number[];\n}\n\n/**\n * Forward-migrates older document shapes to the current version. v1 modelled\n * interactions as edges (source/target, no geometry) and carried a\n * `showFlowOfChange` flag; v2 makes interactions placed shapes and adds `flows`;\n * v3 adds `annotations`. The edge-interactions of a v1 file can't be placed\n * meaningfully, so they're dropped. From v2 on, an interaction without position\n * or size is refused like any other missing field: dropped, it would vanish from\n * the file on the next save without a word.\n */\nfunction migrate(input: unknown): Migration {\n if (input == null || typeof input !== \"object\") {\n return { document: input, interactionFileIndexes: [] };\n }\n const doc = input as Record<string, unknown>;\n const next: Record<string, unknown> = { ...doc };\n delete next.showFlowOfChange; // v1 flag, gone in v2\n next.version = DOCUMENT_VERSION;\n if (typeof next.title !== \"string\") next.title = \"Untitled team topology\";\n if (!Array.isArray(next.nodes)) next.nodes = [];\n const dropsEdgeInteractions = doc.version === EDGE_INTERACTIONS_VERSION;\n const keptInteractions = Array.isArray(next.interactions)\n ? next.interactions\n .map((interaction: unknown, fileIndex) => ({ interaction, fileIndex }))\n .filter(({ interaction }) => !dropsEdgeInteractions || isPlacedShape(interaction))\n : [];\n next.interactions = keptInteractions.map(({ interaction }) => interaction);\n if (!Array.isArray(next.flows)) next.flows = [];\n if (!Array.isArray(next.annotations)) next.annotations = [];\n return {\n document: next,\n interactionFileIndexes: keptInteractions.map(({ fileIndex }) => fileIndex),\n };\n}\n\nfunction isPlacedShape(value: unknown): boolean {\n return value != null && typeof value === \"object\" && \"position\" in value && \"size\" in value;\n}\n\n/**\n * An issue's path in the input rather than in the migrated document: an editor points at the\n * file, and every legacy interaction dropped before an invalid one would shift its index.\n */\nfunction pathInFile(\n path: (string | number)[],\n interactionFileIndexes: readonly number[],\n): (string | number)[] {\n const [collection, index, ...rest] = path;\n if (collection !== \"interactions\" || typeof index !== \"number\") return path;\n const fileIndex = interactionFileIndexes[index];\n return fileIndex === undefined ? path : [collection, fileIndex, ...rest];\n}\n","/**\n * Fields a document carries that this modeler does not know, such as a vendor's `\"x-vendor\"` on a\n * team. They are kept through open and save, written after the known fields and sorted, so another\n * tool's data survives an edit in the modeler and the output stays deterministic.\n */\n\nexport const DOCUMENT_FIELDS = [\n \"version\",\n \"title\",\n \"nodes\",\n \"interactions\",\n \"flows\",\n \"annotations\",\n] as const;\nexport const TEAM_NODE_FIELDS = [\n \"id\",\n \"type\",\n \"label\",\n \"description\",\n \"position\",\n \"size\",\n \"fill\",\n \"stroke\",\n] as const;\nexport const INTERACTION_FIELDS = [\n \"id\",\n \"mode\",\n \"label\",\n \"position\",\n \"size\",\n \"fill\",\n \"stroke\",\n] as const;\nexport const FLOW_FIELDS = [\"id\", \"label\", \"position\", \"size\"] as const;\nexport const ANNOTATION_FIELDS = [\"id\", \"text\", \"position\", \"size\", \"attachedTo\"] as const;\n\n/** Unknown fields by name, sorted, with their values in canonical form. */\nexport type ForeignFields = Readonly<Record<string, unknown>>;\n\n/** JSON objects have no key order, so nested keys are sorted too: equal data, equal bytes. */\nfunction canonicalValue(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(canonicalValue);\n if (value === null || typeof value !== \"object\") return value;\n const record = value as Record<string, unknown>;\n return Object.fromEntries(\n Object.keys(record)\n .filter((key) => record[key] !== undefined)\n .sort()\n .map((key) => [key, canonicalValue(record[key])]),\n );\n}\n\n/** The fields of `value` outside `knownFields`, or undefined when there are none. */\nexport function foreignFields(\n value: object,\n knownFields: readonly string[],\n): ForeignFields | undefined {\n const record = value as Record<string, unknown>;\n const names = Object.keys(record)\n .filter((name) => !knownFields.includes(name) && record[name] !== undefined)\n .sort();\n if (names.length === 0) return undefined;\n return Object.fromEntries(names.map((name) => [name, canonicalValue(record[name])]));\n}\n\n/**\n * `known` followed by the foreign fields of `source`. Built from entries, never by assignment, so\n * a field named `__proto__` stays a field instead of replacing the prototype.\n */\nexport function withForeignFields<T extends object>(\n known: T,\n source: object | undefined,\n knownFields: readonly string[],\n): T {\n const foreign = source ? foreignFields(source, knownFields) : undefined;\n if (!foreign) return known;\n return Object.fromEntries([...Object.entries(known), ...Object.entries(foreign)]) as T;\n}\n","/**\n * Deterministic serialisation of the document model.\n *\n * Producing byte-stable JSON (sorted arrays, fixed key order, rounded\n * coordinates) makes diagrams diff-friendly in version control and gives\n * stable share URLs / embedded payloads.\n */\n\nimport {\n ANNOTATION_FIELDS,\n DOCUMENT_FIELDS,\n FLOW_FIELDS,\n INTERACTION_FIELDS,\n TEAM_NODE_FIELDS,\n withForeignFields,\n} from \"./foreign\";\nimport { DOCUMENT_VERSION } from \"./types\";\nimport type {\n FlowShape,\n InteractionShape,\n Position,\n Size,\n TeamNode,\n TextAnnotation,\n TtDocument,\n} from \"./types\";\n\n/** Round to 2 decimals to strip floating-point drift from drag operations. */\nfunction round(n: number): number {\n return Math.round(n * 100) / 100;\n}\n\nfunction normPosition(p: Position): Position {\n return { x: round(p.x), y: round(p.y) };\n}\n\nfunction normSize(s: Size): Size {\n return { width: round(s.width), height: round(s.height) };\n}\n\n/** Drops undefined fields and applies a fixed key order to a node. */\nfunction normNode(n: TeamNode): TeamNode {\n const out: TeamNode = {\n id: n.id,\n type: n.type,\n label: n.label,\n position: normPosition(n.position),\n size: normSize(n.size),\n };\n if (n.description) out.description = n.description;\n if (n.fill) out.fill = n.fill;\n if (n.stroke) out.stroke = n.stroke;\n return withForeignFields(out, n, TEAM_NODE_FIELDS);\n}\n\nfunction normInteraction(e: InteractionShape): InteractionShape {\n const out: InteractionShape = {\n id: e.id,\n mode: e.mode,\n position: normPosition(e.position),\n size: normSize(e.size),\n };\n if (e.label) out.label = e.label;\n if (e.fill) out.fill = e.fill;\n if (e.stroke) out.stroke = e.stroke;\n return withForeignFields(out, e, INTERACTION_FIELDS);\n}\n\nfunction normFlow(f: FlowShape): FlowShape {\n const out: FlowShape = {\n id: f.id,\n position: normPosition(f.position),\n size: normSize(f.size),\n };\n if (f.label) out.label = f.label;\n return withForeignFields(out, f, FLOW_FIELDS);\n}\n\nfunction normAnnotation(a: TextAnnotation): TextAnnotation {\n const out: TextAnnotation = {\n id: a.id,\n text: a.text,\n position: normPosition(a.position),\n size: normSize(a.size),\n };\n if (a.attachedTo) out.attachedTo = a.attachedTo;\n return withForeignFields(out, a, ANNOTATION_FIELDS);\n}\n\nconst byId = (a: { id: string }, b: { id: string }): number =>\n a.id < b.id ? -1 : a.id > b.id ? 1 : 0;\n\n/**\n * Returns a canonicalised copy of a document (sorted, rounded, version-stamped). Fields the\n * modeler does not know follow the known ones, sorted by name.\n */\nexport function canonicalize(doc: TtDocument): TtDocument {\n return withForeignFields(\n {\n version: DOCUMENT_VERSION,\n title: doc.title,\n nodes: [...doc.nodes].map(normNode).sort(byId),\n interactions: [...doc.interactions].map(normInteraction).sort(byId),\n flows: [...doc.flows].map(normFlow).sort(byId),\n annotations: [...doc.annotations].map(normAnnotation).sort(byId),\n },\n doc,\n DOCUMENT_FIELDS,\n );\n}\n\n/**\n * Serialises a document to deterministic JSON. An empty `annotations` list is left out, so\n * re-saving a model that has no annotations changes nothing but its version stamp. The pretty\n * form is the file on disk and ends with a line break, like the files editors and Git expect;\n * the compact form (share links, local storage) has none.\n */\nexport function serializeDocument(doc: TtDocument, pretty = true): string {\n const canonical = canonicalize(doc);\n const output =\n canonical.annotations.length > 0\n ? canonical\n : Object.fromEntries(Object.entries(canonical).filter(([key]) => key !== \"annotations\"));\n return pretty ? `${JSON.stringify(output, null, 2)}\\n` : JSON.stringify(output);\n}\n","/**\n * Factory helpers for constructing well-formed model objects with the correct\n * notation defaults (sizes, labels). Kept DOM-free.\n */\n\nimport { nanoid } from \"nanoid\";\nimport { ANNOTATION_SPEC, FLOW_SPEC, INTERACTION_MODE_SPECS, TEAM_TYPE_SPECS } from \"./notation\";\nimport type {\n FlowShape,\n InteractionMode,\n InteractionShape,\n Position,\n TeamNode,\n TeamType,\n TextAnnotation,\n TtDocument,\n} from \"./types\";\nimport { DOCUMENT_VERSION } from \"./types\";\n\nexport function newId(prefix: string): string {\n return `${prefix}_${nanoid(8)}`;\n}\n\n/** Creates a team node of the given type at a position, with notation defaults. */\nexport function createTeamNode(\n type: TeamType,\n position: Position,\n overrides: Partial<Omit<TeamNode, \"id\" | \"type\">> = {},\n): TeamNode {\n const spec = TEAM_TYPE_SPECS[type];\n return {\n id: newId(\"team\"),\n type,\n label: overrides.label ?? spec.label,\n description: overrides.description,\n position,\n size: overrides.size ?? { ...spec.defaultSize },\n fill: overrides.fill,\n stroke: overrides.stroke,\n };\n}\n\n/** Creates a placed interaction shape of the given mode, with notation defaults. */\nexport function createInteractionShape(\n mode: InteractionMode,\n position: Position,\n overrides: Partial<Omit<InteractionShape, \"id\" | \"mode\" | \"position\">> = {},\n): InteractionShape {\n const spec = INTERACTION_MODE_SPECS[mode];\n return {\n id: newId(\"int\"),\n mode,\n position,\n size: overrides.size ?? { ...spec.defaultSize },\n label: overrides.label,\n fill: overrides.fill,\n stroke: overrides.stroke,\n };\n}\n\n/** Creates a placed \"flow of change\" arrow, with notation defaults. */\nexport function createFlowShape(\n position: Position,\n overrides: Partial<Omit<FlowShape, \"id\" | \"position\">> = {},\n): FlowShape {\n return {\n id: newId(\"flow\"),\n position,\n size: overrides.size ?? { ...FLOW_SPEC.defaultSize },\n label: overrides.label ?? FLOW_SPEC.label,\n };\n}\n\n/** Creates a text annotation, optionally attached to a team, interaction or flow. */\nexport function createTextAnnotation(\n position: Position,\n overrides: Partial<Omit<TextAnnotation, \"id\" | \"position\">> = {},\n): TextAnnotation {\n return {\n id: newId(\"ann\"),\n text: overrides.text ?? \"\",\n position,\n size: overrides.size ?? { ...ANNOTATION_SPEC.defaultSize },\n attachedTo: overrides.attachedTo,\n };\n}\n\n/** An empty document with sensible defaults. */\nexport function emptyDocument(title = \"Untitled team topology\"): TtDocument {\n return {\n version: DOCUMENT_VERSION,\n title,\n nodes: [],\n interactions: [],\n flows: [],\n annotations: [],\n };\n}\n","/**\n * A small but complete example diagram exercising all four team types, all three\n * interaction modes (as placed shapes overlaying the team boundaries), a\n * flow-of-change element and an attached annotation. The stream-aligned teams\n * are stacked as parallel lanes along the flow of change, as in the Team\n * Topologies book: side by side on the flow they would read as hand-offs. Ids are\n * fixed so the fixture serialises stably.\n */\n\nimport { DOCUMENT_VERSION } from \"./types\";\nimport type { TtDocument } from \"./types\";\nimport { ANNOTATION_SPEC, INTERACTION_MODE_SPECS, TEAM_TYPE_SPECS } from \"./notation\";\n\nconst s = TEAM_TYPE_SPECS;\nconst i = INTERACTION_MODE_SPECS;\n\nconst LANE_WIDTH = 600;\n\nexport const SAMPLE_DOCUMENT: TtDocument = {\n version: DOCUMENT_VERSION,\n title: \"Online shop team topology\",\n nodes: [\n {\n id: \"team_test_automation\",\n type: \"enabling\",\n label: \"Test Automation\",\n description: \"Coaches stream-aligned teams in test automation, then steps back.\",\n position: { x: 40, y: 150 },\n size: { width: s.enabling.defaultSize.width, height: 222 },\n },\n {\n id: \"team_discovery\",\n type: \"stream-aligned\",\n label: \"Product Discovery\",\n description: \"Owns search, browsing and product pages end-to-end.\",\n position: { x: 220, y: 150 },\n size: { width: LANE_WIDTH, height: s[\"stream-aligned\"].defaultSize.height },\n },\n {\n id: \"team_checkout\",\n type: \"stream-aligned\",\n label: \"Checkout & Payments\",\n description: \"Owns the checkout and payment journey end-to-end.\",\n position: { x: 220, y: 276 },\n size: { width: LANE_WIDTH, height: s[\"stream-aligned\"].defaultSize.height },\n },\n {\n id: \"team_fulfilment\",\n type: \"stream-aligned\",\n label: \"Order Fulfilment\",\n description: \"Owns delivery, tracking and returns end-to-end.\",\n position: { x: 220, y: 402 },\n size: { width: LANE_WIDTH, height: s[\"stream-aligned\"].defaultSize.height },\n },\n {\n id: \"team_fraud\",\n type: \"complicated-subsystem\",\n label: \"Fraud Detection\",\n description: \"Specialists for the real-time fraud scoring model.\",\n position: { x: 880, y: 249 },\n size: { ...s[\"complicated-subsystem\"].defaultSize },\n },\n {\n id: \"team_platform\",\n type: \"platform\",\n label: \"Cloud Platform\",\n description: \"Self-service CI/CD, runtime and observability for all teams.\",\n position: { x: 220, y: 552 },\n size: { width: LANE_WIDTH, height: 110 },\n },\n ],\n interactions: [\n {\n id: \"int_testing_discovery\",\n mode: \"facilitating\",\n position: { x: 148, y: 156 },\n size: { ...i.facilitating.defaultSize },\n },\n {\n id: \"int_testing_checkout\",\n mode: \"facilitating\",\n position: { x: 148, y: 282 },\n size: { ...i.facilitating.defaultSize },\n },\n {\n id: \"int_checkout_fraud\",\n mode: \"collaboration\",\n label: \"fraud rules\",\n position: { x: 794, y: 288 },\n size: { ...i.collaboration.defaultSize },\n },\n {\n id: \"int_platform_fulfilment\",\n mode: \"x-as-a-service\",\n position: { x: 476, y: 486 },\n size: { ...i[\"x-as-a-service\"].defaultSize },\n },\n ],\n flows: [\n {\n id: \"flow_main\",\n label: \"Flow of change\",\n position: { x: 40, y: 40 },\n size: { width: 1010, height: 56 },\n },\n ],\n annotations: [\n {\n id: \"ann_fraud_handover\",\n text: \"Collaboration until the fraud rules are stable (Q3), then X-as-a-Service\",\n position: { x: 880, y: 423 },\n size: { ...ANNOTATION_SPEC.defaultSize },\n attachedTo: \"int_checkout_fraud\",\n },\n ],\n};\n"]}
package/dist/index.d.cts CHANGED
@@ -376,7 +376,8 @@ declare function withForeignFields<T extends object>(known: T, source: object |
376
376
  * The id rules of a Team Topologies document. Besides the elements a document lists, a diagram
377
377
  * holds parts it never writes down: the diagram itself and the connector of every annotation. They
378
378
  * take ids of their own, so no element may use one of them; otherwise opening the file would fail
379
- * halfway, with the previous diagram already gone.
379
+ * halfway, with the previous diagram already gone. The canvas also keeps its elements in a plain
380
+ * object, where the names of JavaScript's built-in object properties already resolve.
380
381
  */
381
382
  /** The id of the diagram itself (the canvas root of the renderer). */
382
383
  declare const DIAGRAM_ROOT_ID = "tt-root";
@@ -393,7 +394,8 @@ type DocumentElements = Record<(typeof COLLECTIONS)[number], readonly {
393
394
  }[]>;
394
395
  /**
395
396
  * Every id of the document that would collide on the canvas: a duplicate, the diagram's own id, a
396
- * diagram-js root id, or the id of an annotation's connector.
397
+ * diagram-js root id, the name of a built-in object property, or the id of an annotation's
398
+ * connector.
397
399
  */
398
400
  declare function documentIdProblems(doc: DocumentElements): DocumentIdProblem[];
399
401
 
package/dist/index.d.ts CHANGED
@@ -376,7 +376,8 @@ declare function withForeignFields<T extends object>(known: T, source: object |
376
376
  * The id rules of a Team Topologies document. Besides the elements a document lists, a diagram
377
377
  * holds parts it never writes down: the diagram itself and the connector of every annotation. They
378
378
  * take ids of their own, so no element may use one of them; otherwise opening the file would fail
379
- * halfway, with the previous diagram already gone.
379
+ * halfway, with the previous diagram already gone. The canvas also keeps its elements in a plain
380
+ * object, where the names of JavaScript's built-in object properties already resolve.
380
381
  */
381
382
  /** The id of the diagram itself (the canvas root of the renderer). */
382
383
  declare const DIAGRAM_ROOT_ID = "tt-root";
@@ -393,7 +394,8 @@ type DocumentElements = Record<(typeof COLLECTIONS)[number], readonly {
393
394
  }[]>;
394
395
  /**
395
396
  * Every id of the document that would collide on the canvas: a duplicate, the diagram's own id, a
396
- * diagram-js root id, or the id of an annotation's connector.
397
+ * diagram-js root id, the name of a built-in object property, or the id of an annotation's
398
+ * connector.
397
399
  */
398
400
  declare function documentIdProblems(doc: DocumentElements): DocumentIdProblem[];
399
401
 
package/dist/index.js CHANGED
@@ -146,6 +146,9 @@ function associationId(annotationId) {
146
146
  return `assoc_${annotationId}`;
147
147
  }
148
148
  var COLLECTIONS = ["nodes", "interactions", "flows", "annotations"];
149
+ function isBuiltInPropertyId(id) {
150
+ return Object.hasOwn(Object.prototype, id);
151
+ }
149
152
  function documentIdProblems(doc) {
150
153
  const problems = [];
151
154
  const connectorIds = new Map(
@@ -170,6 +173,11 @@ function documentIdProblems(doc) {
170
173
  path,
171
174
  message: `ids starting with "${ENGINE_ROOT_ID_PREFIX}" are reserved`
172
175
  });
176
+ } else if (isBuiltInPropertyId(id)) {
177
+ problems.push({
178
+ path,
179
+ message: `"${id}" is reserved: it names a built-in property of JavaScript objects`
180
+ });
173
181
  }
174
182
  const annotationId = connectorIds.get(id);
175
183
  if (annotationId !== void 0) {
@@ -240,11 +248,14 @@ var documentSchema = z.looseObject({
240
248
  }
241
249
  });
242
250
  function parseDocument(input) {
243
- const migrated = migrate(input);
251
+ const { document: migrated, interactionFileIndexes } = migrate(input);
244
252
  const result = documentSchema.safeParse(migrated);
245
253
  if (!result.success) {
246
254
  const issues = result.error.issues.map((issue) => ({
247
- path: issue.path.filter((key) => typeof key !== "symbol"),
255
+ path: pathInFile(
256
+ issue.path.filter((key) => typeof key !== "symbol"),
257
+ interactionFileIndexes
258
+ ),
248
259
  message: issue.message
249
260
  }));
250
261
  return {
@@ -255,20 +266,35 @@ function parseDocument(input) {
255
266
  }
256
267
  return { ok: true, document: result.data };
257
268
  }
269
+ var EDGE_INTERACTIONS_VERSION = 1;
258
270
  function migrate(input) {
259
- if (input == null || typeof input !== "object") return input;
271
+ if (input == null || typeof input !== "object") {
272
+ return { document: input, interactionFileIndexes: [] };
273
+ }
260
274
  const doc = input;
261
275
  const next = { ...doc };
262
276
  delete next.showFlowOfChange;
263
277
  next.version = DOCUMENT_VERSION;
264
278
  if (typeof next.title !== "string") next.title = "Untitled team topology";
265
279
  if (!Array.isArray(next.nodes)) next.nodes = [];
266
- next.interactions = Array.isArray(next.interactions) ? next.interactions.filter(
267
- (e) => e != null && typeof e === "object" && "position" in e && "size" in e
268
- ) : [];
280
+ const dropsEdgeInteractions = doc.version === EDGE_INTERACTIONS_VERSION;
281
+ const keptInteractions = Array.isArray(next.interactions) ? next.interactions.map((interaction, fileIndex) => ({ interaction, fileIndex })).filter(({ interaction }) => !dropsEdgeInteractions || isPlacedShape(interaction)) : [];
282
+ next.interactions = keptInteractions.map(({ interaction }) => interaction);
269
283
  if (!Array.isArray(next.flows)) next.flows = [];
270
284
  if (!Array.isArray(next.annotations)) next.annotations = [];
271
- return next;
285
+ return {
286
+ document: next,
287
+ interactionFileIndexes: keptInteractions.map(({ fileIndex }) => fileIndex)
288
+ };
289
+ }
290
+ function isPlacedShape(value) {
291
+ return value != null && typeof value === "object" && "position" in value && "size" in value;
292
+ }
293
+ function pathInFile(path, interactionFileIndexes) {
294
+ const [collection, index, ...rest] = path;
295
+ if (collection !== "interactions" || typeof index !== "number") return path;
296
+ const fileIndex = interactionFileIndexes[index];
297
+ return fileIndex === void 0 ? path : [collection, fileIndex, ...rest];
272
298
  }
273
299
 
274
300
  // src/foreign.ts
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types.ts","../src/notation.ts","../src/ids.ts","../src/schema.ts","../src/foreign.ts","../src/serialize.ts","../src/factory.ts","../src/sample.ts"],"names":["i","s"],"mappings":";;;;AASO,IAAM,QAAA,GAAW;AAKjB,IAAM,UAAA,GA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U,EAAE,CAAA,EAAG,EAAA,EAAI,GAAG,EAAA,EAAG;AAAA,MACzB,IAAA,EAAM,EAAE,KAAA,EAAO,IAAA,EAAM,QAAQ,EAAA;AAAG;AAClC,GACF;AAAA,EACA,WAAA,EAAa;AAAA,IACX;AAAA,MACE,EAAA,EAAI,oBAAA;AAAA,MACJ,IAAA,EAAM,0EAAA;AAAA,MACN,QAAA,EAAU,EAAE,CAAA,EAAG,GAAA,EAAK,GAAG,GAAA,EAAI;AAAA,MAC3B,IAAA,EAAM,EAAE,GAAG,eAAA,CAAgB,WAAA,EAAY;AAAA,MACvC,UAAA,EAAY;AAAA;AACd;AAEJ","file":"index.js","sourcesContent":["/**\n * Pure (DOM-free) domain types for the Team Topologies model.\n *\n * This module is the canonical representation of a diagram and must never\n * import from the rendering layer (`@xyflow/react`) or touch the DOM, so it\n * can be unit-tested in isolation and reused across views / exporters.\n */\n\n/** MIME type used when dragging a team type from the palette onto the canvas. */\nexport const DND_MIME = \"application/x-tt-team-type\";\n\n/** The four fundamental team types in Team Topologies. */\nexport type TeamType = \"stream-aligned\" | \"enabling\" | \"complicated-subsystem\" | \"platform\";\n\nexport const TEAM_TYPES: readonly TeamType[] = [\n \"stream-aligned\",\n \"enabling\",\n \"complicated-subsystem\",\n \"platform\",\n] as const;\n\n/** The three core team interaction modes in Team Topologies. */\nexport type InteractionMode = \"collaboration\" | \"x-as-a-service\" | \"facilitating\";\n\nexport const INTERACTION_MODES: readonly InteractionMode[] = [\n \"collaboration\",\n \"x-as-a-service\",\n \"facilitating\",\n] as const;\n\n/** Geometric size of a node in canvas units (px). Encodes cognitive load. */\nexport interface Size {\n width: number;\n height: number;\n}\n\n/** Position of a node on the canvas in canvas units (px). */\nexport interface Position {\n x: number;\n y: number;\n}\n\n/** A team node in the canonical document model. */\nexport interface TeamNode {\n id: string;\n type: TeamType;\n label: string;\n description?: string;\n position: Position;\n size: Size;\n fill?: string;\n stroke?: string;\n}\n\n/**\n * An interaction in the canonical document model.\n *\n * Per the official Team Topologies notation, an interaction is a placed,\n * resizable SHAPE (parallelogram / triangle / circle) overlaid on the boundary\n * between the teams it relates to — not a connecting line. The relationship is\n * therefore spatial (overlap), so there is no source/target reference.\n */\nexport interface InteractionShape {\n id: string;\n mode: InteractionMode;\n label?: string;\n position: Position;\n size: Size;\n fill?: string;\n stroke?: string;\n}\n\n/**\n * A \"flow of change\" guide: a placed, resizable arrow element. Lets you anchor\n * the implied left-to-right flow, and visualise several team groupings on one\n * canvas.\n */\nexport interface FlowShape {\n id: string;\n label?: string;\n position: Position;\n size: Size;\n}\n\n/**\n * A free-text note beside the diagram (like a BPMN text annotation). It either\n * stands alone or is attached to exactly one team, interaction or flow, which\n * its dashed connector points at.\n */\nexport interface TextAnnotation {\n id: string;\n text: string;\n position: Position;\n size: Size;\n /** Id of the team, interaction or flow this annotation is attached to. */\n attachedTo?: string;\n}\n\n/** Current document schema version. Bump + add a migration when shape changes. */\nexport const DOCUMENT_VERSION = 3 as const;\n\n/**\n * A complete Team Topologies diagram. This is what gets serialised to JSON,\n * embedded into exported images, and encoded into share URLs.\n */\nexport interface TtDocument {\n version: typeof DOCUMENT_VERSION;\n title: string;\n nodes: TeamNode[];\n interactions: InteractionShape[];\n flows: FlowShape[];\n annotations: TextAnnotation[];\n}\n","/**\n * The Team Topologies visual notation, encoded as data.\n *\n * Colours, shapes and stroke styles follow the official\n * \"Team-Shape-Templates\" specification published by Team Topologies\n * (https://github.com/TeamTopologies/Team-Shape-Templates):\n *\n * - Team shapes are SOLID outlines (long-lived structures).\n * - Interaction-mode shapes are 50% transparent with DASHED outlines\n * (short-lived interactions).\n * - Each element is distinguished by SHAPE as well as colour, so the\n * notation stays readable for people with colour-vision deficiency.\n *\n * This module is pure data — it must not import the rendering layer.\n */\n\nimport type { InteractionMode, Size, TeamType } from \"./types\";\n\nexport type TeamShape = \"rounded-rect-horizontal\" | \"rounded-rect-vertical\" | \"octagon\" | \"rect\";\n\nexport type InteractionGlyph = \"parallelogram\" | \"triangle\" | \"circle\";\n\nexport type StrokeStyle = \"solid\" | \"dashed\" | \"dotted\";\n\nexport interface TeamTypeSpec {\n type: TeamType;\n /** Short display name. */\n label: string;\n /** One-line purpose, shown in the palette and inspector. */\n description: string;\n shape: TeamShape;\n fill: string;\n stroke: string;\n strokeStyle: StrokeStyle;\n strokeWidth: number;\n /** Default size when a node of this type is created. */\n defaultSize: Size;\n /** Minimum size enforced by the resizer. */\n minSize: Size;\n}\n\nexport interface InteractionModeSpec {\n mode: InteractionMode;\n label: string;\n description: string;\n shape: InteractionGlyph;\n fill: string;\n stroke: string;\n strokeStyle: StrokeStyle;\n strokeWidth: number;\n /** Opacity for the interaction shape (short-lived → translucent). */\n opacity: number;\n /** Whether direction is semantically meaningful (the X-as-a-Service triangle). */\n directional: boolean;\n /** Default size when a shape of this mode is created. */\n defaultSize: Size;\n /** Minimum size enforced by the resizer. */\n minSize: Size;\n}\n\n/** The left-to-right \"flow of change\" guide, a placeable annotation element. */\nexport interface FlowSpec {\n label: string;\n fill: string;\n stroke: string;\n strokeStyle: StrokeStyle;\n strokeWidth: number;\n defaultSize: Size;\n minSize: Size;\n}\n\nexport const TEAM_TYPE_SPECS: Record<TeamType, TeamTypeSpec> = {\n \"stream-aligned\": {\n type: \"stream-aligned\",\n label: \"Stream-aligned\",\n description: \"Aligned to a single, valuable stream of work; owns it end-to-end.\",\n shape: \"rounded-rect-horizontal\",\n fill: \"#FFEDB8\",\n stroke: \"#FFD966\",\n strokeStyle: \"solid\",\n strokeWidth: 2,\n defaultSize: { width: 240, height: 96 },\n minSize: { width: 140, height: 64 },\n },\n enabling: {\n type: \"enabling\",\n label: \"Enabling\",\n description:\n \"Helps stream-aligned teams acquire missing capabilities; coaches, then steps back.\",\n shape: \"rounded-rect-vertical\",\n fill: \"#DFBDCF\",\n stroke: \"#D09CB7\",\n strokeStyle: \"solid\",\n strokeWidth: 2,\n defaultSize: { width: 120, height: 200 },\n minSize: { width: 80, height: 120 },\n },\n \"complicated-subsystem\": {\n type: \"complicated-subsystem\",\n label: \"Complicated Subsystem\",\n description:\n \"Owns a part of the system needing deep specialist knowledge, reducing others' cognitive load.\",\n shape: \"octagon\",\n fill: \"#FFC08B\",\n stroke: \"#E88814\",\n strokeStyle: \"solid\",\n strokeWidth: 2,\n defaultSize: { width: 170, height: 150 },\n minSize: { width: 110, height: 100 },\n },\n platform: {\n type: \"platform\",\n label: \"Platform\",\n description:\n \"Provides internal self-service capabilities to reduce cognitive load for stream-aligned teams.\",\n shape: \"rect\",\n fill: \"#B7CDF1\",\n stroke: \"#6D9EEB\",\n strokeStyle: \"solid\",\n strokeWidth: 2,\n defaultSize: { width: 380, height: 130 },\n minSize: { width: 200, height: 90 },\n },\n};\n\nexport const INTERACTION_MODE_SPECS: Record<InteractionMode, InteractionModeSpec> = {\n collaboration: {\n mode: \"collaboration\",\n label: \"Collaboration\",\n description:\n \"Two teams work closely together for a defined period; high overhead, high discovery.\",\n shape: \"parallelogram\",\n fill: \"#C6BEDF\",\n stroke: \"#967EE2\",\n strokeStyle: \"dashed\",\n strokeWidth: 2,\n opacity: 0.5,\n directional: false,\n defaultSize: { width: 112, height: 72 },\n minSize: { width: 60, height: 44 },\n },\n \"x-as-a-service\": {\n mode: \"x-as-a-service\",\n label: \"X-as-a-Service\",\n description:\n \"One team consumes something the other provides 'as a service'; minimal collaboration.\",\n shape: \"triangle\",\n fill: \"#B4B4B4\",\n stroke: \"#999696\",\n strokeStyle: \"dashed\",\n strokeWidth: 2,\n opacity: 0.5,\n directional: true,\n defaultSize: { width: 88, height: 78 },\n minSize: { width: 54, height: 48 },\n },\n facilitating: {\n mode: \"facilitating\",\n label: \"Facilitating\",\n description:\n \"One team helps/coaches another to clear impediments and learn; sensing and discovery.\",\n shape: \"circle\",\n fill: \"#C9DFBE\",\n stroke: \"#78996B\",\n strokeStyle: \"dashed\",\n strokeWidth: 2,\n opacity: 0.5,\n directional: false,\n defaultSize: { width: 84, height: 84 },\n minSize: { width: 48, height: 48 },\n },\n};\n\n/**\n * The \"flow of change\" guide — a placeable dashed arrow (left-to-right).\n * Not a team or interaction: a standalone annotation element.\n */\nexport const FLOW_SPEC: FlowSpec = {\n label: \"Flow of change\",\n fill: \"transparent\",\n stroke: \"#6b6459\",\n strokeStyle: \"dashed\",\n strokeWidth: 2,\n defaultSize: { width: 520, height: 64 },\n minSize: { width: 160, height: 36 },\n};\n\n/**\n * A text annotation — not part of the Team Topologies notation, so it carries\n * no colours here; the renderer draws it in the neutral brand ink.\n */\nexport interface AnnotationSpec {\n label: string;\n defaultSize: Size;\n minSize: Size;\n}\n\nexport const ANNOTATION_SPEC: AnnotationSpec = {\n label: \"Annotation\",\n defaultSize: { width: 200, height: 64 },\n minSize: { width: 60, height: 30 },\n};\n\n/** Maps a stroke style to an SVG/CSS dash array (empty string = solid). */\nexport function dashArray(style: StrokeStyle, strokeWidth = 2): string {\n switch (style) {\n case \"dashed\":\n return `${strokeWidth * 3} ${strokeWidth * 2}`;\n case \"dotted\":\n return `${strokeWidth} ${strokeWidth * 1.5}`;\n case \"solid\":\n default:\n return \"\";\n }\n}\n\nexport const ALL_TEAM_SPECS: readonly TeamTypeSpec[] = Object.values(TEAM_TYPE_SPECS);\nexport const ALL_INTERACTION_SPECS: readonly InteractionModeSpec[] =\n Object.values(INTERACTION_MODE_SPECS);\n","/**\n * The id rules of a Team Topologies document. Besides the elements a document lists, a diagram\n * holds parts it never writes down: the diagram itself and the connector of every annotation. They\n * take ids of their own, so no element may use one of them; otherwise opening the file would fail\n * halfway, with the previous diagram already gone.\n */\n\n/** The id of the diagram itself (the canvas root of the renderer). */\nexport const DIAGRAM_ROOT_ID = \"tt-root\";\n\n/** diagram-js names the roots it creates on its own `__implicitroot_<n>`. */\nconst ENGINE_ROOT_ID_PREFIX = \"__implicitroot\";\n\n/** Connectors are not stored: an annotation's connector derives its id from the annotation. */\nexport function associationId(annotationId: string): string {\n return `assoc_${annotationId}`;\n}\n\nexport interface DocumentIdProblem {\n /** Where the offending id sits, e.g. `[\"nodes\", 2, \"id\"]`. */\n path: (string | number)[];\n message: string;\n}\n\nconst COLLECTIONS = [\"nodes\", \"interactions\", \"flows\", \"annotations\"] as const;\n\ntype DocumentElements = Record<(typeof COLLECTIONS)[number], readonly { id: string }[]>;\n\n/**\n * Every id of the document that would collide on the canvas: a duplicate, the diagram's own id, a\n * diagram-js root id, or the id of an annotation's connector.\n */\nexport function documentIdProblems(doc: DocumentElements): DocumentIdProblem[] {\n const problems: DocumentIdProblem[] = [];\n const connectorIds = new Map(\n doc.annotations.map((annotation) => [associationId(annotation.id), annotation.id]),\n );\n const seen = new Set<string>();\n for (const collection of COLLECTIONS) {\n doc[collection].forEach((element, index) => {\n const path = [collection, index, \"id\"];\n const { id } = element;\n if (seen.has(id)) {\n problems.push({\n path,\n message: `duplicate id \"${id}\"; ids must be unique across nodes, interactions, flows and annotations`,\n });\n }\n seen.add(id);\n if (id === DIAGRAM_ROOT_ID) {\n problems.push({ path, message: `\"${id}\" is reserved for the diagram itself` });\n } else if (id.startsWith(ENGINE_ROOT_ID_PREFIX)) {\n problems.push({\n path,\n message: `ids starting with \"${ENGINE_ROOT_ID_PREFIX}\" are reserved`,\n });\n }\n const annotationId = connectorIds.get(id);\n if (annotationId !== undefined) {\n problems.push({\n path,\n message: `\"${id}\" is reserved for the connector of annotation \"${annotationId}\"`,\n });\n }\n });\n }\n return problems;\n}\n","/**\n * Runtime validation for the document model using Zod.\n *\n * Anything entering the app from the outside world (imported files, share\n * URLs, localStorage) is parsed through {@link parseDocument} so malformed or\n * tampered data can never corrupt the editor state. Fields the schema does not\n * know pass through untouched (see `foreign.ts`), so another tool's data\n * survives a save.\n */\n\nimport { z } from \"zod\";\nimport { documentIdProblems } from \"./ids\";\nimport { DOCUMENT_VERSION, INTERACTION_MODES, TEAM_TYPES } from \"./types\";\nimport type { TtDocument } from \"./types\";\n\nconst teamTypeSchema = z.enum(TEAM_TYPES as unknown as [string, ...string[]]);\nconst interactionModeSchema = z.enum(INTERACTION_MODES as unknown as [string, ...string[]]);\n\nconst sizeSchema = z.object({\n width: z.number().finite().positive(),\n height: z.number().finite().positive(),\n});\n\nconst positionSchema = z.object({\n x: z.number().finite(),\n y: z.number().finite(),\n});\n\nconst hexColor = z.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/, \"expected a hex colour\");\n\nexport const teamNodeSchema = z.looseObject({\n id: z.string().min(1),\n type: teamTypeSchema,\n label: z.string(),\n description: z.string().optional(),\n position: positionSchema,\n size: sizeSchema,\n fill: hexColor.optional(),\n stroke: hexColor.optional(),\n});\n\nexport const interactionSchema = z.looseObject({\n id: z.string().min(1),\n mode: interactionModeSchema,\n label: z.string().optional(),\n position: positionSchema,\n size: sizeSchema,\n fill: hexColor.optional(),\n stroke: hexColor.optional(),\n});\n\nexport const flowSchema = z.looseObject({\n id: z.string().min(1),\n label: z.string().optional(),\n position: positionSchema,\n size: sizeSchema,\n});\n\nexport const annotationSchema = z.looseObject({\n id: z.string().min(1),\n text: z.string(),\n position: positionSchema,\n size: sizeSchema,\n attachedTo: z.string().min(1).optional(),\n});\n\nexport const documentSchema = z\n .looseObject({\n version: z.literal(DOCUMENT_VERSION),\n title: z.string(),\n nodes: z.array(teamNodeSchema),\n interactions: z.array(interactionSchema),\n flows: z.array(flowSchema),\n annotations: z.array(annotationSchema),\n })\n .superRefine((document, context) => {\n for (const { path, message } of documentIdProblems(document)) {\n context.addIssue({ code: \"custom\", path, message });\n }\n });\n\n/** One reason a document is invalid, at the path of the offending value. */\nexport interface DocumentIssue {\n path: (string | number)[];\n message: string;\n}\n\nexport type ParseResult =\n { ok: true; document: TtDocument } | { ok: false; error: string; issues: DocumentIssue[] };\n\n/**\n * Validates and (if necessary) migrates unknown data into a {@link TtDocument}.\n * Returns a discriminated result rather than throwing so callers can show a\n * friendly message, or point at each offending value (`issues`).\n */\nexport function parseDocument(input: unknown): ParseResult {\n const migrated = migrate(input);\n const result = documentSchema.safeParse(migrated);\n if (!result.success) {\n const issues = result.error.issues.map((issue) => ({\n path: issue.path.filter((key): key is string | number => typeof key !== \"symbol\"),\n message: issue.message,\n }));\n return {\n ok: false,\n error: issues.map((i) => `${i.path.join(\".\") || \"(root)\"}: ${i.message}`).join(\"; \"),\n issues,\n };\n }\n return { ok: true, document: result.data as TtDocument };\n}\n\n/**\n * Forward-migrates older document shapes to the current version. v1 modelled\n * interactions as edges (source/target, no geometry) and carried a\n * `showFlowOfChange` flag; v2 makes interactions placed shapes and adds `flows`;\n * v3 adds `annotations`. Legacy edge-interactions can't be placed meaningfully,\n * so they're dropped.\n */\nfunction migrate(input: unknown): unknown {\n if (input == null || typeof input !== \"object\") return input;\n const doc = input as Record<string, unknown>;\n const next: Record<string, unknown> = { ...doc };\n delete next.showFlowOfChange; // v1 flag, gone in v2\n next.version = DOCUMENT_VERSION;\n if (typeof next.title !== \"string\") next.title = \"Untitled team topology\";\n if (!Array.isArray(next.nodes)) next.nodes = [];\n // Keep only placed interaction shapes; drop legacy edges (no position/size).\n next.interactions = Array.isArray(next.interactions)\n ? next.interactions.filter(\n (e) => e != null && typeof e === \"object\" && \"position\" in e && \"size\" in e,\n )\n : [];\n if (!Array.isArray(next.flows)) next.flows = [];\n if (!Array.isArray(next.annotations)) next.annotations = [];\n return next;\n}\n","/**\n * Fields a document carries that this modeler does not know, such as a vendor's `\"x-vendor\"` on a\n * team. They are kept through open and save, written after the known fields and sorted, so another\n * tool's data survives an edit in the modeler and the output stays deterministic.\n */\n\nexport const DOCUMENT_FIELDS = [\n \"version\",\n \"title\",\n \"nodes\",\n \"interactions\",\n \"flows\",\n \"annotations\",\n] as const;\nexport const TEAM_NODE_FIELDS = [\n \"id\",\n \"type\",\n \"label\",\n \"description\",\n \"position\",\n \"size\",\n \"fill\",\n \"stroke\",\n] as const;\nexport const INTERACTION_FIELDS = [\n \"id\",\n \"mode\",\n \"label\",\n \"position\",\n \"size\",\n \"fill\",\n \"stroke\",\n] as const;\nexport const FLOW_FIELDS = [\"id\", \"label\", \"position\", \"size\"] as const;\nexport const ANNOTATION_FIELDS = [\"id\", \"text\", \"position\", \"size\", \"attachedTo\"] as const;\n\n/** Unknown fields by name, sorted, with their values in canonical form. */\nexport type ForeignFields = Readonly<Record<string, unknown>>;\n\n/** JSON objects have no key order, so nested keys are sorted too: equal data, equal bytes. */\nfunction canonicalValue(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(canonicalValue);\n if (value === null || typeof value !== \"object\") return value;\n const record = value as Record<string, unknown>;\n return Object.fromEntries(\n Object.keys(record)\n .filter((key) => record[key] !== undefined)\n .sort()\n .map((key) => [key, canonicalValue(record[key])]),\n );\n}\n\n/** The fields of `value` outside `knownFields`, or undefined when there are none. */\nexport function foreignFields(\n value: object,\n knownFields: readonly string[],\n): ForeignFields | undefined {\n const record = value as Record<string, unknown>;\n const names = Object.keys(record)\n .filter((name) => !knownFields.includes(name) && record[name] !== undefined)\n .sort();\n if (names.length === 0) return undefined;\n return Object.fromEntries(names.map((name) => [name, canonicalValue(record[name])]));\n}\n\n/**\n * `known` followed by the foreign fields of `source`. Built from entries, never by assignment, so\n * a field named `__proto__` stays a field instead of replacing the prototype.\n */\nexport function withForeignFields<T extends object>(\n known: T,\n source: object | undefined,\n knownFields: readonly string[],\n): T {\n const foreign = source ? foreignFields(source, knownFields) : undefined;\n if (!foreign) return known;\n return Object.fromEntries([...Object.entries(known), ...Object.entries(foreign)]) as T;\n}\n","/**\n * Deterministic serialisation of the document model.\n *\n * Producing byte-stable JSON (sorted arrays, fixed key order, rounded\n * coordinates) makes diagrams diff-friendly in version control and gives\n * stable share URLs / embedded payloads.\n */\n\nimport {\n ANNOTATION_FIELDS,\n DOCUMENT_FIELDS,\n FLOW_FIELDS,\n INTERACTION_FIELDS,\n TEAM_NODE_FIELDS,\n withForeignFields,\n} from \"./foreign\";\nimport { DOCUMENT_VERSION } from \"./types\";\nimport type {\n FlowShape,\n InteractionShape,\n Position,\n Size,\n TeamNode,\n TextAnnotation,\n TtDocument,\n} from \"./types\";\n\n/** Round to 2 decimals to strip floating-point drift from drag operations. */\nfunction round(n: number): number {\n return Math.round(n * 100) / 100;\n}\n\nfunction normPosition(p: Position): Position {\n return { x: round(p.x), y: round(p.y) };\n}\n\nfunction normSize(s: Size): Size {\n return { width: round(s.width), height: round(s.height) };\n}\n\n/** Drops undefined fields and applies a fixed key order to a node. */\nfunction normNode(n: TeamNode): TeamNode {\n const out: TeamNode = {\n id: n.id,\n type: n.type,\n label: n.label,\n position: normPosition(n.position),\n size: normSize(n.size),\n };\n if (n.description) out.description = n.description;\n if (n.fill) out.fill = n.fill;\n if (n.stroke) out.stroke = n.stroke;\n return withForeignFields(out, n, TEAM_NODE_FIELDS);\n}\n\nfunction normInteraction(e: InteractionShape): InteractionShape {\n const out: InteractionShape = {\n id: e.id,\n mode: e.mode,\n position: normPosition(e.position),\n size: normSize(e.size),\n };\n if (e.label) out.label = e.label;\n if (e.fill) out.fill = e.fill;\n if (e.stroke) out.stroke = e.stroke;\n return withForeignFields(out, e, INTERACTION_FIELDS);\n}\n\nfunction normFlow(f: FlowShape): FlowShape {\n const out: FlowShape = {\n id: f.id,\n position: normPosition(f.position),\n size: normSize(f.size),\n };\n if (f.label) out.label = f.label;\n return withForeignFields(out, f, FLOW_FIELDS);\n}\n\nfunction normAnnotation(a: TextAnnotation): TextAnnotation {\n const out: TextAnnotation = {\n id: a.id,\n text: a.text,\n position: normPosition(a.position),\n size: normSize(a.size),\n };\n if (a.attachedTo) out.attachedTo = a.attachedTo;\n return withForeignFields(out, a, ANNOTATION_FIELDS);\n}\n\nconst byId = (a: { id: string }, b: { id: string }): number =>\n a.id < b.id ? -1 : a.id > b.id ? 1 : 0;\n\n/**\n * Returns a canonicalised copy of a document (sorted, rounded, version-stamped). Fields the\n * modeler does not know follow the known ones, sorted by name.\n */\nexport function canonicalize(doc: TtDocument): TtDocument {\n return withForeignFields(\n {\n version: DOCUMENT_VERSION,\n title: doc.title,\n nodes: [...doc.nodes].map(normNode).sort(byId),\n interactions: [...doc.interactions].map(normInteraction).sort(byId),\n flows: [...doc.flows].map(normFlow).sort(byId),\n annotations: [...doc.annotations].map(normAnnotation).sort(byId),\n },\n doc,\n DOCUMENT_FIELDS,\n );\n}\n\n/**\n * Serialises a document to deterministic JSON. An empty `annotations` list is left out, so\n * re-saving a model that has no annotations changes nothing but its version stamp. The pretty\n * form is the file on disk and ends with a line break, like the files editors and Git expect;\n * the compact form (share links, local storage) has none.\n */\nexport function serializeDocument(doc: TtDocument, pretty = true): string {\n const canonical = canonicalize(doc);\n const output =\n canonical.annotations.length > 0\n ? canonical\n : Object.fromEntries(Object.entries(canonical).filter(([key]) => key !== \"annotations\"));\n return pretty ? `${JSON.stringify(output, null, 2)}\\n` : JSON.stringify(output);\n}\n","/**\n * Factory helpers for constructing well-formed model objects with the correct\n * notation defaults (sizes, labels). Kept DOM-free.\n */\n\nimport { nanoid } from \"nanoid\";\nimport { ANNOTATION_SPEC, FLOW_SPEC, INTERACTION_MODE_SPECS, TEAM_TYPE_SPECS } from \"./notation\";\nimport type {\n FlowShape,\n InteractionMode,\n InteractionShape,\n Position,\n TeamNode,\n TeamType,\n TextAnnotation,\n TtDocument,\n} from \"./types\";\nimport { DOCUMENT_VERSION } from \"./types\";\n\nexport function newId(prefix: string): string {\n return `${prefix}_${nanoid(8)}`;\n}\n\n/** Creates a team node of the given type at a position, with notation defaults. */\nexport function createTeamNode(\n type: TeamType,\n position: Position,\n overrides: Partial<Omit<TeamNode, \"id\" | \"type\">> = {},\n): TeamNode {\n const spec = TEAM_TYPE_SPECS[type];\n return {\n id: newId(\"team\"),\n type,\n label: overrides.label ?? spec.label,\n description: overrides.description,\n position,\n size: overrides.size ?? { ...spec.defaultSize },\n fill: overrides.fill,\n stroke: overrides.stroke,\n };\n}\n\n/** Creates a placed interaction shape of the given mode, with notation defaults. */\nexport function createInteractionShape(\n mode: InteractionMode,\n position: Position,\n overrides: Partial<Omit<InteractionShape, \"id\" | \"mode\" | \"position\">> = {},\n): InteractionShape {\n const spec = INTERACTION_MODE_SPECS[mode];\n return {\n id: newId(\"int\"),\n mode,\n position,\n size: overrides.size ?? { ...spec.defaultSize },\n label: overrides.label,\n fill: overrides.fill,\n stroke: overrides.stroke,\n };\n}\n\n/** Creates a placed \"flow of change\" arrow, with notation defaults. */\nexport function createFlowShape(\n position: Position,\n overrides: Partial<Omit<FlowShape, \"id\" | \"position\">> = {},\n): FlowShape {\n return {\n id: newId(\"flow\"),\n position,\n size: overrides.size ?? { ...FLOW_SPEC.defaultSize },\n label: overrides.label ?? FLOW_SPEC.label,\n };\n}\n\n/** Creates a text annotation, optionally attached to a team, interaction or flow. */\nexport function createTextAnnotation(\n position: Position,\n overrides: Partial<Omit<TextAnnotation, \"id\" | \"position\">> = {},\n): TextAnnotation {\n return {\n id: newId(\"ann\"),\n text: overrides.text ?? \"\",\n position,\n size: overrides.size ?? { ...ANNOTATION_SPEC.defaultSize },\n attachedTo: overrides.attachedTo,\n };\n}\n\n/** An empty document with sensible defaults. */\nexport function emptyDocument(title = \"Untitled team topology\"): TtDocument {\n return {\n version: DOCUMENT_VERSION,\n title,\n nodes: [],\n interactions: [],\n flows: [],\n annotations: [],\n };\n}\n","/**\n * A small but complete example diagram exercising all four team types, all three\n * interaction modes (as placed shapes overlaying the team boundaries), a\n * flow-of-change element and an attached annotation. The stream-aligned teams\n * are stacked as parallel lanes along the flow of change, as in the Team\n * Topologies book: side by side on the flow they would read as hand-offs. Ids are\n * fixed so the fixture serialises stably.\n */\n\nimport { DOCUMENT_VERSION } from \"./types\";\nimport type { TtDocument } from \"./types\";\nimport { ANNOTATION_SPEC, INTERACTION_MODE_SPECS, TEAM_TYPE_SPECS } from \"./notation\";\n\nconst s = TEAM_TYPE_SPECS;\nconst i = INTERACTION_MODE_SPECS;\n\nconst LANE_WIDTH = 600;\n\nexport const SAMPLE_DOCUMENT: TtDocument = {\n version: DOCUMENT_VERSION,\n title: \"Online shop team topology\",\n nodes: [\n {\n id: \"team_test_automation\",\n type: \"enabling\",\n label: \"Test Automation\",\n description: \"Coaches stream-aligned teams in test automation, then steps back.\",\n position: { x: 40, y: 150 },\n size: { width: s.enabling.defaultSize.width, height: 222 },\n },\n {\n id: \"team_discovery\",\n type: \"stream-aligned\",\n label: \"Product Discovery\",\n description: \"Owns search, browsing and product pages end-to-end.\",\n position: { x: 220, y: 150 },\n size: { width: LANE_WIDTH, height: s[\"stream-aligned\"].defaultSize.height },\n },\n {\n id: \"team_checkout\",\n type: \"stream-aligned\",\n label: \"Checkout & Payments\",\n description: \"Owns the checkout and payment journey end-to-end.\",\n position: { x: 220, y: 276 },\n size: { width: LANE_WIDTH, height: s[\"stream-aligned\"].defaultSize.height },\n },\n {\n id: \"team_fulfilment\",\n type: \"stream-aligned\",\n label: \"Order Fulfilment\",\n description: \"Owns delivery, tracking and returns end-to-end.\",\n position: { x: 220, y: 402 },\n size: { width: LANE_WIDTH, height: s[\"stream-aligned\"].defaultSize.height },\n },\n {\n id: \"team_fraud\",\n type: \"complicated-subsystem\",\n label: \"Fraud Detection\",\n description: \"Specialists for the real-time fraud scoring model.\",\n position: { x: 880, y: 249 },\n size: { ...s[\"complicated-subsystem\"].defaultSize },\n },\n {\n id: \"team_platform\",\n type: \"platform\",\n label: \"Cloud Platform\",\n description: \"Self-service CI/CD, runtime and observability for all teams.\",\n position: { x: 220, y: 552 },\n size: { width: LANE_WIDTH, height: 110 },\n },\n ],\n interactions: [\n {\n id: \"int_testing_discovery\",\n mode: \"facilitating\",\n position: { x: 148, y: 156 },\n size: { ...i.facilitating.defaultSize },\n },\n {\n id: \"int_testing_checkout\",\n mode: \"facilitating\",\n position: { x: 148, y: 282 },\n size: { ...i.facilitating.defaultSize },\n },\n {\n id: \"int_checkout_fraud\",\n mode: \"collaboration\",\n label: \"fraud rules\",\n position: { x: 794, y: 288 },\n size: { ...i.collaboration.defaultSize },\n },\n {\n id: \"int_platform_fulfilment\",\n mode: \"x-as-a-service\",\n position: { x: 476, y: 486 },\n size: { ...i[\"x-as-a-service\"].defaultSize },\n },\n ],\n flows: [\n {\n id: \"flow_main\",\n label: \"Flow of change\",\n position: { x: 40, y: 40 },\n size: { width: 1010, height: 56 },\n },\n ],\n annotations: [\n {\n id: \"ann_fraud_handover\",\n text: \"Collaboration until the fraud rules are stable (Q3), then X-as-a-Service\",\n position: { x: 880, y: 423 },\n size: { ...ANNOTATION_SPEC.defaultSize },\n attachedTo: \"int_checkout_fraud\",\n },\n ],\n};\n"]}
1
+ {"version":3,"sources":["../src/types.ts","../src/notation.ts","../src/ids.ts","../src/schema.ts","../src/foreign.ts","../src/serialize.ts","../src/factory.ts","../src/sample.ts"],"names":["i","s"],"mappings":";;;;AASO,IAAM,QAAA,GAAW;AAKjB,IAAM,UAAA,GAAkC;AAAA,EAC7C,gBAAA;AAAA,EACA,UAAA;AAAA,EACA,uBAAA;AAAA,EACA;AACF;AAKO,IAAM,iBAAA,GAAgD;AAAA,EAC3D,eAAA;AAAA,EACA,gBAAA;AAAA,EACA;AACF;AAuEO,IAAM,gBAAA,GAAmB;;;AC5BzB,IAAM,eAAA,GAAkD;AAAA,EAC7D,gBAAA,EAAkB;AAAA,IAChB,IAAA,EAAM,gBAAA;AAAA,IACN,KAAA,EAAO,gBAAA;AAAA,IACP,WAAA,EAAa,mEAAA;AAAA,IACb,KAAA,EAAO,yBAAA;AAAA,IACP,IAAA,EAAM,SAAA;AAAA,IACN,MAAA,EAAQ,SAAA;AAAA,IACR,WAAA,EAAa,OAAA;AAAA,IACb,WAAA,EAAa,CAAA;AAAA,IACb,WAAA,EAAa,EAAE,KAAA,EAAO,GAAA,EAAK,QAAQ,EAAA,EAAG;AAAA,IACtC,OAAA,EAAS,EAAE,KAAA,EAAO,GAAA,EAAK,QAAQ,EAAA;AAAG,GACpC;AAAA,EACA,QAAA,EAAU;AAAA,IACR,IAAA,EAAM,UAAA;AAAA,IACN,KAAA,EAAO,UAAA;AAAA,IACP,WAAA,EACE,oFAAA;AAAA,IACF,KAAA,EAAO,uBAAA;AAAA,IACP,IAAA,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,IAAA,EAAM,eAAA;AAAA,MACN,KAAA,EAAO,aAAA;AAAA,MACP,QAAA,EAAU,EAAE,CAAA,EAAG,GAAA,EAAK,GAAG,GAAA,EAAI;AAAA,MAC3B,IAAA,EAAM,EAAE,GAAG,CAAA,CAAE,cAAc,WAAA;AAAY,KACzC;AAAA,IACA;AAAA,MACE,EAAA,EAAI,yBAAA;AAAA,MACJ,IAAA,EAAM,gBAAA;AAAA,MACN,QAAA,EAAU,EAAE,CAAA,EAAG,GAAA,EAAK,GAAG,GAAA,EAAI;AAAA,MAC3B,MAAM,EAAE,GAAG,CAAA,CAAE,gBAAgB,EAAE,WAAA;AAAY;AAC7C,GACF;AAAA,EACA,KAAA,EAAO;AAAA,IACL;AAAA,MACE,EAAA,EAAI,WAAA;AAAA,MACJ,KAAA,EAAO,gBAAA;AAAA,MACP,QAAA,EAAU,EAAE,CAAA,EAAG,EAAA,EAAI,GAAG,EAAA,EAAG;AAAA,MACzB,IAAA,EAAM,EAAE,KAAA,EAAO,IAAA,EAAM,QAAQ,EAAA;AAAG;AAClC,GACF;AAAA,EACA,WAAA,EAAa;AAAA,IACX;AAAA,MACE,EAAA,EAAI,oBAAA;AAAA,MACJ,IAAA,EAAM,0EAAA;AAAA,MACN,QAAA,EAAU,EAAE,CAAA,EAAG,GAAA,EAAK,GAAG,GAAA,EAAI;AAAA,MAC3B,IAAA,EAAM,EAAE,GAAG,eAAA,CAAgB,WAAA,EAAY;AAAA,MACvC,UAAA,EAAY;AAAA;AACd;AAEJ","file":"index.js","sourcesContent":["/**\n * Pure (DOM-free) domain types for the Team Topologies model.\n *\n * This module is the canonical representation of a diagram and must never\n * import from the rendering layer (`@xyflow/react`) or touch the DOM, so it\n * can be unit-tested in isolation and reused across views / exporters.\n */\n\n/** MIME type used when dragging a team type from the palette onto the canvas. */\nexport const DND_MIME = \"application/x-tt-team-type\";\n\n/** The four fundamental team types in Team Topologies. */\nexport type TeamType = \"stream-aligned\" | \"enabling\" | \"complicated-subsystem\" | \"platform\";\n\nexport const TEAM_TYPES: readonly TeamType[] = [\n \"stream-aligned\",\n \"enabling\",\n \"complicated-subsystem\",\n \"platform\",\n] as const;\n\n/** The three core team interaction modes in Team Topologies. */\nexport type InteractionMode = \"collaboration\" | \"x-as-a-service\" | \"facilitating\";\n\nexport const INTERACTION_MODES: readonly InteractionMode[] = [\n \"collaboration\",\n \"x-as-a-service\",\n \"facilitating\",\n] as const;\n\n/** Geometric size of a node in canvas units (px). Encodes cognitive load. */\nexport interface Size {\n width: number;\n height: number;\n}\n\n/** Position of a node on the canvas in canvas units (px). */\nexport interface Position {\n x: number;\n y: number;\n}\n\n/** A team node in the canonical document model. */\nexport interface TeamNode {\n id: string;\n type: TeamType;\n label: string;\n description?: string;\n position: Position;\n size: Size;\n fill?: string;\n stroke?: string;\n}\n\n/**\n * An interaction in the canonical document model.\n *\n * Per the official Team Topologies notation, an interaction is a placed,\n * resizable SHAPE (parallelogram / triangle / circle) overlaid on the boundary\n * between the teams it relates to — not a connecting line. The relationship is\n * therefore spatial (overlap), so there is no source/target reference.\n */\nexport interface InteractionShape {\n id: string;\n mode: InteractionMode;\n label?: string;\n position: Position;\n size: Size;\n fill?: string;\n stroke?: string;\n}\n\n/**\n * A \"flow of change\" guide: a placed, resizable arrow element. Lets you anchor\n * the implied left-to-right flow, and visualise several team groupings on one\n * canvas.\n */\nexport interface FlowShape {\n id: string;\n label?: string;\n position: Position;\n size: Size;\n}\n\n/**\n * A free-text note beside the diagram (like a BPMN text annotation). It either\n * stands alone or is attached to exactly one team, interaction or flow, which\n * its dashed connector points at.\n */\nexport interface TextAnnotation {\n id: string;\n text: string;\n position: Position;\n size: Size;\n /** Id of the team, interaction or flow this annotation is attached to. */\n attachedTo?: string;\n}\n\n/** Current document schema version. Bump + add a migration when shape changes. */\nexport const DOCUMENT_VERSION = 3 as const;\n\n/**\n * A complete Team Topologies diagram. This is what gets serialised to JSON,\n * embedded into exported images, and encoded into share URLs.\n */\nexport interface TtDocument {\n version: typeof DOCUMENT_VERSION;\n title: string;\n nodes: TeamNode[];\n interactions: InteractionShape[];\n flows: FlowShape[];\n annotations: TextAnnotation[];\n}\n","/**\n * The Team Topologies visual notation, encoded as data.\n *\n * Colours, shapes and stroke styles follow the official\n * \"Team-Shape-Templates\" specification published by Team Topologies\n * (https://github.com/TeamTopologies/Team-Shape-Templates):\n *\n * - Team shapes are SOLID outlines (long-lived structures).\n * - Interaction-mode shapes are 50% transparent with DASHED outlines\n * (short-lived interactions).\n * - Each element is distinguished by SHAPE as well as colour, so the\n * notation stays readable for people with colour-vision deficiency.\n *\n * This module is pure data — it must not import the rendering layer.\n */\n\nimport type { InteractionMode, Size, TeamType } from \"./types\";\n\nexport type TeamShape = \"rounded-rect-horizontal\" | \"rounded-rect-vertical\" | \"octagon\" | \"rect\";\n\nexport type InteractionGlyph = \"parallelogram\" | \"triangle\" | \"circle\";\n\nexport type StrokeStyle = \"solid\" | \"dashed\" | \"dotted\";\n\nexport interface TeamTypeSpec {\n type: TeamType;\n /** Short display name. */\n label: string;\n /** One-line purpose, shown in the palette and inspector. */\n description: string;\n shape: TeamShape;\n fill: string;\n stroke: string;\n strokeStyle: StrokeStyle;\n strokeWidth: number;\n /** Default size when a node of this type is created. */\n defaultSize: Size;\n /** Minimum size enforced by the resizer. */\n minSize: Size;\n}\n\nexport interface InteractionModeSpec {\n mode: InteractionMode;\n label: string;\n description: string;\n shape: InteractionGlyph;\n fill: string;\n stroke: string;\n strokeStyle: StrokeStyle;\n strokeWidth: number;\n /** Opacity for the interaction shape (short-lived → translucent). */\n opacity: number;\n /** Whether direction is semantically meaningful (the X-as-a-Service triangle). */\n directional: boolean;\n /** Default size when a shape of this mode is created. */\n defaultSize: Size;\n /** Minimum size enforced by the resizer. */\n minSize: Size;\n}\n\n/** The left-to-right \"flow of change\" guide, a placeable annotation element. */\nexport interface FlowSpec {\n label: string;\n fill: string;\n stroke: string;\n strokeStyle: StrokeStyle;\n strokeWidth: number;\n defaultSize: Size;\n minSize: Size;\n}\n\nexport const TEAM_TYPE_SPECS: Record<TeamType, TeamTypeSpec> = {\n \"stream-aligned\": {\n type: \"stream-aligned\",\n label: \"Stream-aligned\",\n description: \"Aligned to a single, valuable stream of work; owns it end-to-end.\",\n shape: \"rounded-rect-horizontal\",\n fill: \"#FFEDB8\",\n stroke: \"#FFD966\",\n strokeStyle: \"solid\",\n strokeWidth: 2,\n defaultSize: { width: 240, height: 96 },\n minSize: { width: 140, height: 64 },\n },\n enabling: {\n type: \"enabling\",\n label: \"Enabling\",\n description:\n \"Helps stream-aligned teams acquire missing capabilities; coaches, then steps back.\",\n shape: \"rounded-rect-vertical\",\n fill: \"#DFBDCF\",\n stroke: \"#D09CB7\",\n strokeStyle: \"solid\",\n strokeWidth: 2,\n defaultSize: { width: 120, height: 200 },\n minSize: { width: 80, height: 120 },\n },\n \"complicated-subsystem\": {\n type: \"complicated-subsystem\",\n label: \"Complicated Subsystem\",\n description:\n \"Owns a part of the system needing deep specialist knowledge, reducing others' cognitive load.\",\n shape: \"octagon\",\n fill: \"#FFC08B\",\n stroke: \"#E88814\",\n strokeStyle: \"solid\",\n strokeWidth: 2,\n defaultSize: { width: 170, height: 150 },\n minSize: { width: 110, height: 100 },\n },\n platform: {\n type: \"platform\",\n label: \"Platform\",\n description:\n \"Provides internal self-service capabilities to reduce cognitive load for stream-aligned teams.\",\n shape: \"rect\",\n fill: \"#B7CDF1\",\n stroke: \"#6D9EEB\",\n strokeStyle: \"solid\",\n strokeWidth: 2,\n defaultSize: { width: 380, height: 130 },\n minSize: { width: 200, height: 90 },\n },\n};\n\nexport const INTERACTION_MODE_SPECS: Record<InteractionMode, InteractionModeSpec> = {\n collaboration: {\n mode: \"collaboration\",\n label: \"Collaboration\",\n description:\n \"Two teams work closely together for a defined period; high overhead, high discovery.\",\n shape: \"parallelogram\",\n fill: \"#C6BEDF\",\n stroke: \"#967EE2\",\n strokeStyle: \"dashed\",\n strokeWidth: 2,\n opacity: 0.5,\n directional: false,\n defaultSize: { width: 112, height: 72 },\n minSize: { width: 60, height: 44 },\n },\n \"x-as-a-service\": {\n mode: \"x-as-a-service\",\n label: \"X-as-a-Service\",\n description:\n \"One team consumes something the other provides 'as a service'; minimal collaboration.\",\n shape: \"triangle\",\n fill: \"#B4B4B4\",\n stroke: \"#999696\",\n strokeStyle: \"dashed\",\n strokeWidth: 2,\n opacity: 0.5,\n directional: true,\n defaultSize: { width: 88, height: 78 },\n minSize: { width: 54, height: 48 },\n },\n facilitating: {\n mode: \"facilitating\",\n label: \"Facilitating\",\n description:\n \"One team helps/coaches another to clear impediments and learn; sensing and discovery.\",\n shape: \"circle\",\n fill: \"#C9DFBE\",\n stroke: \"#78996B\",\n strokeStyle: \"dashed\",\n strokeWidth: 2,\n opacity: 0.5,\n directional: false,\n defaultSize: { width: 84, height: 84 },\n minSize: { width: 48, height: 48 },\n },\n};\n\n/**\n * The \"flow of change\" guide — a placeable dashed arrow (left-to-right).\n * Not a team or interaction: a standalone annotation element.\n */\nexport const FLOW_SPEC: FlowSpec = {\n label: \"Flow of change\",\n fill: \"transparent\",\n stroke: \"#6b6459\",\n strokeStyle: \"dashed\",\n strokeWidth: 2,\n defaultSize: { width: 520, height: 64 },\n minSize: { width: 160, height: 36 },\n};\n\n/**\n * A text annotation — not part of the Team Topologies notation, so it carries\n * no colours here; the renderer draws it in the neutral brand ink.\n */\nexport interface AnnotationSpec {\n label: string;\n defaultSize: Size;\n minSize: Size;\n}\n\nexport const ANNOTATION_SPEC: AnnotationSpec = {\n label: \"Annotation\",\n defaultSize: { width: 200, height: 64 },\n minSize: { width: 60, height: 30 },\n};\n\n/** Maps a stroke style to an SVG/CSS dash array (empty string = solid). */\nexport function dashArray(style: StrokeStyle, strokeWidth = 2): string {\n switch (style) {\n case \"dashed\":\n return `${strokeWidth * 3} ${strokeWidth * 2}`;\n case \"dotted\":\n return `${strokeWidth} ${strokeWidth * 1.5}`;\n case \"solid\":\n default:\n return \"\";\n }\n}\n\nexport const ALL_TEAM_SPECS: readonly TeamTypeSpec[] = Object.values(TEAM_TYPE_SPECS);\nexport const ALL_INTERACTION_SPECS: readonly InteractionModeSpec[] =\n Object.values(INTERACTION_MODE_SPECS);\n","/**\n * The id rules of a Team Topologies document. Besides the elements a document lists, a diagram\n * holds parts it never writes down: the diagram itself and the connector of every annotation. They\n * take ids of their own, so no element may use one of them; otherwise opening the file would fail\n * halfway, with the previous diagram already gone. The canvas also keeps its elements in a plain\n * object, where the names of JavaScript's built-in object properties already resolve.\n */\n\n/** The id of the diagram itself (the canvas root of the renderer). */\nexport const DIAGRAM_ROOT_ID = \"tt-root\";\n\n/** diagram-js names the roots it creates on its own `__implicitroot_<n>`. */\nconst ENGINE_ROOT_ID_PREFIX = \"__implicitroot\";\n\n/** Connectors are not stored: an annotation's connector derives its id from the annotation. */\nexport function associationId(annotationId: string): string {\n return `assoc_${annotationId}`;\n}\n\nexport interface DocumentIdProblem {\n /** Where the offending id sits, e.g. `[\"nodes\", 2, \"id\"]`. */\n path: (string | number)[];\n message: string;\n}\n\nconst COLLECTIONS = [\"nodes\", \"interactions\", \"flows\", \"annotations\"] as const;\n\ntype DocumentElements = Record<(typeof COLLECTIONS)[number], readonly { id: string }[]>;\n\n/** Ids such as `constructor`, `toString` or `__proto__`, which every plain object already has. */\nfunction isBuiltInPropertyId(id: string): boolean {\n return Object.hasOwn(Object.prototype, id);\n}\n\n/**\n * Every id of the document that would collide on the canvas: a duplicate, the diagram's own id, a\n * diagram-js root id, the name of a built-in object property, or the id of an annotation's\n * connector.\n */\nexport function documentIdProblems(doc: DocumentElements): DocumentIdProblem[] {\n const problems: DocumentIdProblem[] = [];\n const connectorIds = new Map(\n doc.annotations.map((annotation) => [associationId(annotation.id), annotation.id]),\n );\n const seen = new Set<string>();\n for (const collection of COLLECTIONS) {\n doc[collection].forEach((element, index) => {\n const path = [collection, index, \"id\"];\n const { id } = element;\n if (seen.has(id)) {\n problems.push({\n path,\n message: `duplicate id \"${id}\"; ids must be unique across nodes, interactions, flows and annotations`,\n });\n }\n seen.add(id);\n if (id === DIAGRAM_ROOT_ID) {\n problems.push({ path, message: `\"${id}\" is reserved for the diagram itself` });\n } else if (id.startsWith(ENGINE_ROOT_ID_PREFIX)) {\n problems.push({\n path,\n message: `ids starting with \"${ENGINE_ROOT_ID_PREFIX}\" are reserved`,\n });\n } else if (isBuiltInPropertyId(id)) {\n problems.push({\n path,\n message: `\"${id}\" is reserved: it names a built-in property of JavaScript objects`,\n });\n }\n const annotationId = connectorIds.get(id);\n if (annotationId !== undefined) {\n problems.push({\n path,\n message: `\"${id}\" is reserved for the connector of annotation \"${annotationId}\"`,\n });\n }\n });\n }\n return problems;\n}\n","/**\n * Runtime validation for the document model using Zod.\n *\n * Anything entering the app from the outside world (imported files, share\n * URLs, localStorage) is parsed through {@link parseDocument} so malformed or\n * tampered data can never corrupt the editor state. Fields the schema does not\n * know pass through untouched (see `foreign.ts`), so another tool's data\n * survives a save.\n */\n\nimport { z } from \"zod\";\nimport { documentIdProblems } from \"./ids\";\nimport { DOCUMENT_VERSION, INTERACTION_MODES, TEAM_TYPES } from \"./types\";\nimport type { TtDocument } from \"./types\";\n\nconst teamTypeSchema = z.enum(TEAM_TYPES as unknown as [string, ...string[]]);\nconst interactionModeSchema = z.enum(INTERACTION_MODES as unknown as [string, ...string[]]);\n\nconst sizeSchema = z.object({\n width: z.number().finite().positive(),\n height: z.number().finite().positive(),\n});\n\nconst positionSchema = z.object({\n x: z.number().finite(),\n y: z.number().finite(),\n});\n\nconst hexColor = z.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/, \"expected a hex colour\");\n\nexport const teamNodeSchema = z.looseObject({\n id: z.string().min(1),\n type: teamTypeSchema,\n label: z.string(),\n description: z.string().optional(),\n position: positionSchema,\n size: sizeSchema,\n fill: hexColor.optional(),\n stroke: hexColor.optional(),\n});\n\nexport const interactionSchema = z.looseObject({\n id: z.string().min(1),\n mode: interactionModeSchema,\n label: z.string().optional(),\n position: positionSchema,\n size: sizeSchema,\n fill: hexColor.optional(),\n stroke: hexColor.optional(),\n});\n\nexport const flowSchema = z.looseObject({\n id: z.string().min(1),\n label: z.string().optional(),\n position: positionSchema,\n size: sizeSchema,\n});\n\nexport const annotationSchema = z.looseObject({\n id: z.string().min(1),\n text: z.string(),\n position: positionSchema,\n size: sizeSchema,\n attachedTo: z.string().min(1).optional(),\n});\n\nexport const documentSchema = z\n .looseObject({\n version: z.literal(DOCUMENT_VERSION),\n title: z.string(),\n nodes: z.array(teamNodeSchema),\n interactions: z.array(interactionSchema),\n flows: z.array(flowSchema),\n annotations: z.array(annotationSchema),\n })\n .superRefine((document, context) => {\n for (const { path, message } of documentIdProblems(document)) {\n context.addIssue({ code: \"custom\", path, message });\n }\n });\n\n/** One reason a document is invalid, at the path of the offending value. */\nexport interface DocumentIssue {\n path: (string | number)[];\n message: string;\n}\n\nexport type ParseResult =\n { ok: true; document: TtDocument } | { ok: false; error: string; issues: DocumentIssue[] };\n\n/**\n * Validates and (if necessary) migrates unknown data into a {@link TtDocument}.\n * Returns a discriminated result rather than throwing so callers can show a\n * friendly message, or point at each offending value (`issues`).\n */\nexport function parseDocument(input: unknown): ParseResult {\n const { document: migrated, interactionFileIndexes } = migrate(input);\n const result = documentSchema.safeParse(migrated);\n if (!result.success) {\n const issues = result.error.issues.map((issue) => ({\n path: pathInFile(\n issue.path.filter((key): key is string | number => typeof key !== \"symbol\"),\n interactionFileIndexes,\n ),\n message: issue.message,\n }));\n return {\n ok: false,\n error: issues.map((i) => `${i.path.join(\".\") || \"(root)\"}: ${i.message}`).join(\"; \"),\n issues,\n };\n }\n return { ok: true, document: result.data as TtDocument };\n}\n\n/** The last document version that modelled interactions as edges without geometry. */\nconst EDGE_INTERACTIONS_VERSION = 1;\n\ninterface Migration {\n document: unknown;\n /** For each interaction the migrated document keeps, its index in the input. */\n interactionFileIndexes: readonly number[];\n}\n\n/**\n * Forward-migrates older document shapes to the current version. v1 modelled\n * interactions as edges (source/target, no geometry) and carried a\n * `showFlowOfChange` flag; v2 makes interactions placed shapes and adds `flows`;\n * v3 adds `annotations`. The edge-interactions of a v1 file can't be placed\n * meaningfully, so they're dropped. From v2 on, an interaction without position\n * or size is refused like any other missing field: dropped, it would vanish from\n * the file on the next save without a word.\n */\nfunction migrate(input: unknown): Migration {\n if (input == null || typeof input !== \"object\") {\n return { document: input, interactionFileIndexes: [] };\n }\n const doc = input as Record<string, unknown>;\n const next: Record<string, unknown> = { ...doc };\n delete next.showFlowOfChange; // v1 flag, gone in v2\n next.version = DOCUMENT_VERSION;\n if (typeof next.title !== \"string\") next.title = \"Untitled team topology\";\n if (!Array.isArray(next.nodes)) next.nodes = [];\n const dropsEdgeInteractions = doc.version === EDGE_INTERACTIONS_VERSION;\n const keptInteractions = Array.isArray(next.interactions)\n ? next.interactions\n .map((interaction: unknown, fileIndex) => ({ interaction, fileIndex }))\n .filter(({ interaction }) => !dropsEdgeInteractions || isPlacedShape(interaction))\n : [];\n next.interactions = keptInteractions.map(({ interaction }) => interaction);\n if (!Array.isArray(next.flows)) next.flows = [];\n if (!Array.isArray(next.annotations)) next.annotations = [];\n return {\n document: next,\n interactionFileIndexes: keptInteractions.map(({ fileIndex }) => fileIndex),\n };\n}\n\nfunction isPlacedShape(value: unknown): boolean {\n return value != null && typeof value === \"object\" && \"position\" in value && \"size\" in value;\n}\n\n/**\n * An issue's path in the input rather than in the migrated document: an editor points at the\n * file, and every legacy interaction dropped before an invalid one would shift its index.\n */\nfunction pathInFile(\n path: (string | number)[],\n interactionFileIndexes: readonly number[],\n): (string | number)[] {\n const [collection, index, ...rest] = path;\n if (collection !== \"interactions\" || typeof index !== \"number\") return path;\n const fileIndex = interactionFileIndexes[index];\n return fileIndex === undefined ? path : [collection, fileIndex, ...rest];\n}\n","/**\n * Fields a document carries that this modeler does not know, such as a vendor's `\"x-vendor\"` on a\n * team. They are kept through open and save, written after the known fields and sorted, so another\n * tool's data survives an edit in the modeler and the output stays deterministic.\n */\n\nexport const DOCUMENT_FIELDS = [\n \"version\",\n \"title\",\n \"nodes\",\n \"interactions\",\n \"flows\",\n \"annotations\",\n] as const;\nexport const TEAM_NODE_FIELDS = [\n \"id\",\n \"type\",\n \"label\",\n \"description\",\n \"position\",\n \"size\",\n \"fill\",\n \"stroke\",\n] as const;\nexport const INTERACTION_FIELDS = [\n \"id\",\n \"mode\",\n \"label\",\n \"position\",\n \"size\",\n \"fill\",\n \"stroke\",\n] as const;\nexport const FLOW_FIELDS = [\"id\", \"label\", \"position\", \"size\"] as const;\nexport const ANNOTATION_FIELDS = [\"id\", \"text\", \"position\", \"size\", \"attachedTo\"] as const;\n\n/** Unknown fields by name, sorted, with their values in canonical form. */\nexport type ForeignFields = Readonly<Record<string, unknown>>;\n\n/** JSON objects have no key order, so nested keys are sorted too: equal data, equal bytes. */\nfunction canonicalValue(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(canonicalValue);\n if (value === null || typeof value !== \"object\") return value;\n const record = value as Record<string, unknown>;\n return Object.fromEntries(\n Object.keys(record)\n .filter((key) => record[key] !== undefined)\n .sort()\n .map((key) => [key, canonicalValue(record[key])]),\n );\n}\n\n/** The fields of `value` outside `knownFields`, or undefined when there are none. */\nexport function foreignFields(\n value: object,\n knownFields: readonly string[],\n): ForeignFields | undefined {\n const record = value as Record<string, unknown>;\n const names = Object.keys(record)\n .filter((name) => !knownFields.includes(name) && record[name] !== undefined)\n .sort();\n if (names.length === 0) return undefined;\n return Object.fromEntries(names.map((name) => [name, canonicalValue(record[name])]));\n}\n\n/**\n * `known` followed by the foreign fields of `source`. Built from entries, never by assignment, so\n * a field named `__proto__` stays a field instead of replacing the prototype.\n */\nexport function withForeignFields<T extends object>(\n known: T,\n source: object | undefined,\n knownFields: readonly string[],\n): T {\n const foreign = source ? foreignFields(source, knownFields) : undefined;\n if (!foreign) return known;\n return Object.fromEntries([...Object.entries(known), ...Object.entries(foreign)]) as T;\n}\n","/**\n * Deterministic serialisation of the document model.\n *\n * Producing byte-stable JSON (sorted arrays, fixed key order, rounded\n * coordinates) makes diagrams diff-friendly in version control and gives\n * stable share URLs / embedded payloads.\n */\n\nimport {\n ANNOTATION_FIELDS,\n DOCUMENT_FIELDS,\n FLOW_FIELDS,\n INTERACTION_FIELDS,\n TEAM_NODE_FIELDS,\n withForeignFields,\n} from \"./foreign\";\nimport { DOCUMENT_VERSION } from \"./types\";\nimport type {\n FlowShape,\n InteractionShape,\n Position,\n Size,\n TeamNode,\n TextAnnotation,\n TtDocument,\n} from \"./types\";\n\n/** Round to 2 decimals to strip floating-point drift from drag operations. */\nfunction round(n: number): number {\n return Math.round(n * 100) / 100;\n}\n\nfunction normPosition(p: Position): Position {\n return { x: round(p.x), y: round(p.y) };\n}\n\nfunction normSize(s: Size): Size {\n return { width: round(s.width), height: round(s.height) };\n}\n\n/** Drops undefined fields and applies a fixed key order to a node. */\nfunction normNode(n: TeamNode): TeamNode {\n const out: TeamNode = {\n id: n.id,\n type: n.type,\n label: n.label,\n position: normPosition(n.position),\n size: normSize(n.size),\n };\n if (n.description) out.description = n.description;\n if (n.fill) out.fill = n.fill;\n if (n.stroke) out.stroke = n.stroke;\n return withForeignFields(out, n, TEAM_NODE_FIELDS);\n}\n\nfunction normInteraction(e: InteractionShape): InteractionShape {\n const out: InteractionShape = {\n id: e.id,\n mode: e.mode,\n position: normPosition(e.position),\n size: normSize(e.size),\n };\n if (e.label) out.label = e.label;\n if (e.fill) out.fill = e.fill;\n if (e.stroke) out.stroke = e.stroke;\n return withForeignFields(out, e, INTERACTION_FIELDS);\n}\n\nfunction normFlow(f: FlowShape): FlowShape {\n const out: FlowShape = {\n id: f.id,\n position: normPosition(f.position),\n size: normSize(f.size),\n };\n if (f.label) out.label = f.label;\n return withForeignFields(out, f, FLOW_FIELDS);\n}\n\nfunction normAnnotation(a: TextAnnotation): TextAnnotation {\n const out: TextAnnotation = {\n id: a.id,\n text: a.text,\n position: normPosition(a.position),\n size: normSize(a.size),\n };\n if (a.attachedTo) out.attachedTo = a.attachedTo;\n return withForeignFields(out, a, ANNOTATION_FIELDS);\n}\n\nconst byId = (a: { id: string }, b: { id: string }): number =>\n a.id < b.id ? -1 : a.id > b.id ? 1 : 0;\n\n/**\n * Returns a canonicalised copy of a document (sorted, rounded, version-stamped). Fields the\n * modeler does not know follow the known ones, sorted by name.\n */\nexport function canonicalize(doc: TtDocument): TtDocument {\n return withForeignFields(\n {\n version: DOCUMENT_VERSION,\n title: doc.title,\n nodes: [...doc.nodes].map(normNode).sort(byId),\n interactions: [...doc.interactions].map(normInteraction).sort(byId),\n flows: [...doc.flows].map(normFlow).sort(byId),\n annotations: [...doc.annotations].map(normAnnotation).sort(byId),\n },\n doc,\n DOCUMENT_FIELDS,\n );\n}\n\n/**\n * Serialises a document to deterministic JSON. An empty `annotations` list is left out, so\n * re-saving a model that has no annotations changes nothing but its version stamp. The pretty\n * form is the file on disk and ends with a line break, like the files editors and Git expect;\n * the compact form (share links, local storage) has none.\n */\nexport function serializeDocument(doc: TtDocument, pretty = true): string {\n const canonical = canonicalize(doc);\n const output =\n canonical.annotations.length > 0\n ? canonical\n : Object.fromEntries(Object.entries(canonical).filter(([key]) => key !== \"annotations\"));\n return pretty ? `${JSON.stringify(output, null, 2)}\\n` : JSON.stringify(output);\n}\n","/**\n * Factory helpers for constructing well-formed model objects with the correct\n * notation defaults (sizes, labels). Kept DOM-free.\n */\n\nimport { nanoid } from \"nanoid\";\nimport { ANNOTATION_SPEC, FLOW_SPEC, INTERACTION_MODE_SPECS, TEAM_TYPE_SPECS } from \"./notation\";\nimport type {\n FlowShape,\n InteractionMode,\n InteractionShape,\n Position,\n TeamNode,\n TeamType,\n TextAnnotation,\n TtDocument,\n} from \"./types\";\nimport { DOCUMENT_VERSION } from \"./types\";\n\nexport function newId(prefix: string): string {\n return `${prefix}_${nanoid(8)}`;\n}\n\n/** Creates a team node of the given type at a position, with notation defaults. */\nexport function createTeamNode(\n type: TeamType,\n position: Position,\n overrides: Partial<Omit<TeamNode, \"id\" | \"type\">> = {},\n): TeamNode {\n const spec = TEAM_TYPE_SPECS[type];\n return {\n id: newId(\"team\"),\n type,\n label: overrides.label ?? spec.label,\n description: overrides.description,\n position,\n size: overrides.size ?? { ...spec.defaultSize },\n fill: overrides.fill,\n stroke: overrides.stroke,\n };\n}\n\n/** Creates a placed interaction shape of the given mode, with notation defaults. */\nexport function createInteractionShape(\n mode: InteractionMode,\n position: Position,\n overrides: Partial<Omit<InteractionShape, \"id\" | \"mode\" | \"position\">> = {},\n): InteractionShape {\n const spec = INTERACTION_MODE_SPECS[mode];\n return {\n id: newId(\"int\"),\n mode,\n position,\n size: overrides.size ?? { ...spec.defaultSize },\n label: overrides.label,\n fill: overrides.fill,\n stroke: overrides.stroke,\n };\n}\n\n/** Creates a placed \"flow of change\" arrow, with notation defaults. */\nexport function createFlowShape(\n position: Position,\n overrides: Partial<Omit<FlowShape, \"id\" | \"position\">> = {},\n): FlowShape {\n return {\n id: newId(\"flow\"),\n position,\n size: overrides.size ?? { ...FLOW_SPEC.defaultSize },\n label: overrides.label ?? FLOW_SPEC.label,\n };\n}\n\n/** Creates a text annotation, optionally attached to a team, interaction or flow. */\nexport function createTextAnnotation(\n position: Position,\n overrides: Partial<Omit<TextAnnotation, \"id\" | \"position\">> = {},\n): TextAnnotation {\n return {\n id: newId(\"ann\"),\n text: overrides.text ?? \"\",\n position,\n size: overrides.size ?? { ...ANNOTATION_SPEC.defaultSize },\n attachedTo: overrides.attachedTo,\n };\n}\n\n/** An empty document with sensible defaults. */\nexport function emptyDocument(title = \"Untitled team topology\"): TtDocument {\n return {\n version: DOCUMENT_VERSION,\n title,\n nodes: [],\n interactions: [],\n flows: [],\n annotations: [],\n };\n}\n","/**\n * A small but complete example diagram exercising all four team types, all three\n * interaction modes (as placed shapes overlaying the team boundaries), a\n * flow-of-change element and an attached annotation. The stream-aligned teams\n * are stacked as parallel lanes along the flow of change, as in the Team\n * Topologies book: side by side on the flow they would read as hand-offs. Ids are\n * fixed so the fixture serialises stably.\n */\n\nimport { DOCUMENT_VERSION } from \"./types\";\nimport type { TtDocument } from \"./types\";\nimport { ANNOTATION_SPEC, INTERACTION_MODE_SPECS, TEAM_TYPE_SPECS } from \"./notation\";\n\nconst s = TEAM_TYPE_SPECS;\nconst i = INTERACTION_MODE_SPECS;\n\nconst LANE_WIDTH = 600;\n\nexport const SAMPLE_DOCUMENT: TtDocument = {\n version: DOCUMENT_VERSION,\n title: \"Online shop team topology\",\n nodes: [\n {\n id: \"team_test_automation\",\n type: \"enabling\",\n label: \"Test Automation\",\n description: \"Coaches stream-aligned teams in test automation, then steps back.\",\n position: { x: 40, y: 150 },\n size: { width: s.enabling.defaultSize.width, height: 222 },\n },\n {\n id: \"team_discovery\",\n type: \"stream-aligned\",\n label: \"Product Discovery\",\n description: \"Owns search, browsing and product pages end-to-end.\",\n position: { x: 220, y: 150 },\n size: { width: LANE_WIDTH, height: s[\"stream-aligned\"].defaultSize.height },\n },\n {\n id: \"team_checkout\",\n type: \"stream-aligned\",\n label: \"Checkout & Payments\",\n description: \"Owns the checkout and payment journey end-to-end.\",\n position: { x: 220, y: 276 },\n size: { width: LANE_WIDTH, height: s[\"stream-aligned\"].defaultSize.height },\n },\n {\n id: \"team_fulfilment\",\n type: \"stream-aligned\",\n label: \"Order Fulfilment\",\n description: \"Owns delivery, tracking and returns end-to-end.\",\n position: { x: 220, y: 402 },\n size: { width: LANE_WIDTH, height: s[\"stream-aligned\"].defaultSize.height },\n },\n {\n id: \"team_fraud\",\n type: \"complicated-subsystem\",\n label: \"Fraud Detection\",\n description: \"Specialists for the real-time fraud scoring model.\",\n position: { x: 880, y: 249 },\n size: { ...s[\"complicated-subsystem\"].defaultSize },\n },\n {\n id: \"team_platform\",\n type: \"platform\",\n label: \"Cloud Platform\",\n description: \"Self-service CI/CD, runtime and observability for all teams.\",\n position: { x: 220, y: 552 },\n size: { width: LANE_WIDTH, height: 110 },\n },\n ],\n interactions: [\n {\n id: \"int_testing_discovery\",\n mode: \"facilitating\",\n position: { x: 148, y: 156 },\n size: { ...i.facilitating.defaultSize },\n },\n {\n id: \"int_testing_checkout\",\n mode: \"facilitating\",\n position: { x: 148, y: 282 },\n size: { ...i.facilitating.defaultSize },\n },\n {\n id: \"int_checkout_fraud\",\n mode: \"collaboration\",\n label: \"fraud rules\",\n position: { x: 794, y: 288 },\n size: { ...i.collaboration.defaultSize },\n },\n {\n id: \"int_platform_fulfilment\",\n mode: \"x-as-a-service\",\n position: { x: 476, y: 486 },\n size: { ...i[\"x-as-a-service\"].defaultSize },\n },\n ],\n flows: [\n {\n id: \"flow_main\",\n label: \"Flow of change\",\n position: { x: 40, y: 40 },\n size: { width: 1010, height: 56 },\n },\n ],\n annotations: [\n {\n id: \"ann_fraud_handover\",\n text: \"Collaboration until the fraud rules are stable (Q3), then X-as-a-Service\",\n position: { x: 880, y: 423 },\n size: { ...ANNOTATION_SPEC.defaultSize },\n attachedTo: \"int_checkout_fraud\",\n },\n ],\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miragon/team-topologies-schema-model",
3
- "version": "0.11.2",
3
+ "version": "0.12.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": {