@likec4/core 1.25.1 → 1.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/builder/index.d.mts +4 -4
  2. package/dist/builder/index.d.ts +4 -4
  3. package/dist/builder/index.mjs +4 -4
  4. package/dist/compute-view/index.d.mts +5 -5
  5. package/dist/compute-view/index.d.ts +5 -5
  6. package/dist/compute-view/index.mjs +6 -6
  7. package/dist/index.d.mts +9 -8
  8. package/dist/index.d.ts +9 -8
  9. package/dist/index.mjs +6 -6
  10. package/dist/model/index.d.mts +7 -148
  11. package/dist/model/index.d.ts +7 -148
  12. package/dist/model/index.mjs +1 -1
  13. package/dist/shared/core.-qjOvsEL.d.ts +146 -0
  14. package/dist/shared/{core.Bhx0OGK8.d.mts → core.30yYKXcZ.d.mts} +2 -1
  15. package/dist/shared/{core.Bhx0OGK8.d.ts → core.30yYKXcZ.d.ts} +2 -1
  16. package/dist/shared/{core.DmBjVt1u.mjs → core.BBJd-FqJ.mjs} +1 -1
  17. package/dist/shared/{core.B4wY1NqR.d.mts → core.BH59D8Ji.d.ts} +8 -8
  18. package/dist/shared/{core.DQMSDiu8.mjs → core.BqezHsjR.mjs} +96 -96
  19. package/dist/shared/{core.D1_bU4dO.d.mts → core.Brmu7VBL.d.mts} +12 -12
  20. package/dist/shared/{core.BsAIrb_r.d.ts → core.CIbWBWW3.d.ts} +1 -1
  21. package/dist/shared/{core.CVZbbLy6.mjs → core.CcjDE4j7.mjs} +4 -4
  22. package/dist/shared/{core.B4fHpdUJ.d.ts → core.Cpd5mZgF.d.ts} +12 -12
  23. package/dist/shared/{core.Btj1m6H6.mjs → core.DRxv3HIl.mjs} +2 -1
  24. package/dist/shared/{core.C4dHhcrI.d.mts → core.Dd1nCiNx.d.mts} +2 -2
  25. package/dist/shared/{core.RiWsY3jz.d.mts → core.HKn0jlo_.d.mts} +1 -1
  26. package/dist/shared/{core.Dw2eQBtz.d.ts → core.mD0TIdz_.d.ts} +2 -2
  27. package/dist/shared/core.oI7caxVx.d.mts +146 -0
  28. package/dist/shared/{core.DCetokL7.mjs → core.yND74qFI.mjs} +1 -1
  29. package/dist/shared/{core.CWZqfEHX.d.ts → core.z6g06scf.d.mts} +8 -8
  30. package/dist/types/index.d.mts +4 -4
  31. package/dist/types/index.d.ts +4 -4
  32. package/dist/types/index.mjs +1 -1
  33. package/dist/utils/index.d.mts +56 -3
  34. package/dist/utils/index.d.ts +56 -3
  35. package/dist/utils/index.mjs +212 -4
  36. package/package.json +4 -4
  37. package/src/builder/_types.ts +2 -2
  38. package/src/compute-view/compute-view.ts +10 -10
  39. package/src/compute-view/utils/with-readable-edges.ts +2 -2
  40. package/src/errors/index.ts +4 -3
  41. package/src/index.ts +11 -1
  42. package/src/model/DeploymentModel.ts +2 -2
  43. package/src/model/LikeC4Model.ts +4 -4
  44. package/src/model/types.ts +7 -8
  45. package/src/types/_common.ts +2 -0
  46. package/src/types/index.ts +7 -6
  47. package/src/types/{model.ts → model-data.ts} +14 -14
  48. package/src/utils/index.ts +1 -0
  49. package/src/utils/mnemonist.ts +1 -0
@@ -1,9 +1,217 @@
1
- import { T as getDefaultExportFromCjs, V as requireIterator, U as requireForeach, d as t, Y as n, h as commonAncestor, k as compareFqnHierarchically } from '../shared/core.DQMSDiu8.mjs';
2
- export { D as DefaultMap, S as Stack, g as ancestorsFqn, e as commonHead, j as compareByFqnHierarchically, f as compareNatural, I as difference, J as equalsSet, x as getOrCreate, a as hasAtLeast, o as hierarchyDistance, q as hierarchyLevel, A as ifilter, i as ifind, B as iflat, C as imap, K as intersection, r as isAncestor, s as isDescendantOf, E as isIterable, y as isNonEmptyArray, c as isSameHierarchy, z as isString, F as isome, G as iunique, n as nameFromFqn, O as objectHash, p as parentFqn, u as sortByFqnHierarchically, v as sortNaturalByFqn, w as sortParentsFirst, N as stringHash, L as symmetricDifference, H as toArray, t as toSet, M as union } from '../shared/core.DQMSDiu8.mjs';
3
- import { i as invariant } from '../shared/core.Btj1m6H6.mjs';
1
+ import { U as requireForeach, T as getDefaultExportFromCjs, V as requireIterator, d as t, Y as n, h as commonAncestor, k as compareFqnHierarchically } from '../shared/core.BqezHsjR.mjs';
2
+ export { D as DefaultMap, S as Stack, g as ancestorsFqn, e as commonHead, j as compareByFqnHierarchically, f as compareNatural, I as difference, J as equalsSet, x as getOrCreate, a as hasAtLeast, o as hierarchyDistance, q as hierarchyLevel, A as ifilter, i as ifind, B as iflat, C as imap, K as intersection, r as isAncestor, s as isDescendantOf, E as isIterable, y as isNonEmptyArray, c as isSameHierarchy, z as isString, F as isome, G as iunique, n as nameFromFqn, O as objectHash, p as parentFqn, u as sortByFqnHierarchically, v as sortNaturalByFqn, w as sortParentsFirst, N as stringHash, L as symmetricDifference, H as toArray, t as toSet, M as union } from '../shared/core.BqezHsjR.mjs';
3
+ import { i as invariant } from '../shared/core.DRxv3HIl.mjs';
4
4
 
5
5
  function o(r,n){let e=Math.ceil(r),t=Math.floor(n);if(t<e)throw new RangeError(`randomInteger: The range [${r.toString()},${n.toString()}] contains no integer`);return Math.floor(Math.random()*(t-e+1)+e)}
6
6
 
7
+ /**
8
+ * Mnemonist BiMap
9
+ * ================
10
+ *
11
+ * JavaScript implementation of a BiMap.
12
+ */
13
+
14
+ var biMap$1;
15
+ var hasRequiredBiMap;
16
+
17
+ function requireBiMap () {
18
+ if (hasRequiredBiMap) return biMap$1;
19
+ hasRequiredBiMap = 1;
20
+ var forEach = requireForeach();
21
+
22
+ /**
23
+ * Inverse Map.
24
+ *
25
+ * @constructor
26
+ */
27
+ function InverseMap(original) {
28
+
29
+ this.size = 0;
30
+ this.items = new Map();
31
+ this.inverse = original;
32
+ }
33
+
34
+ /**
35
+ * BiMap.
36
+ *
37
+ * @constructor
38
+ */
39
+ function BiMap() {
40
+
41
+ this.size = 0;
42
+ this.items = new Map();
43
+ this.inverse = new InverseMap(this);
44
+ }
45
+
46
+ /**
47
+ * Method used to clear the map.
48
+ *
49
+ * @return {undefined}
50
+ */
51
+ function clear() {
52
+ this.size = 0;
53
+ this.items.clear();
54
+ this.inverse.items.clear();
55
+ }
56
+
57
+ BiMap.prototype.clear = clear;
58
+ InverseMap.prototype.clear = clear;
59
+
60
+ /**
61
+ * Method used to set a relation.
62
+ *
63
+ * @param {any} key - Key.
64
+ * @param {any} value - Value.
65
+ * @return {BiMap|InverseMap}
66
+ */
67
+ function set(key, value) {
68
+
69
+ // First we need to attempt to see if the relation is not flawed
70
+ if (this.items.has(key)) {
71
+ var currentValue = this.items.get(key);
72
+
73
+ // The relation already exists, we do nothing
74
+ if (currentValue === value)
75
+ return this;
76
+ else
77
+ this.inverse.items.delete(currentValue);
78
+ }
79
+
80
+ if (this.inverse.items.has(value)) {
81
+ var currentKey = this.inverse.items.get(value);
82
+
83
+ if (currentKey === key)
84
+ return this;
85
+ else
86
+ this.items.delete(currentKey);
87
+ }
88
+
89
+ // Here we actually add the relation
90
+ this.items.set(key, value);
91
+ this.inverse.items.set(value, key);
92
+
93
+ // Size
94
+ this.size = this.items.size;
95
+ this.inverse.size = this.inverse.items.size;
96
+
97
+ return this;
98
+ }
99
+
100
+ BiMap.prototype.set = set;
101
+ InverseMap.prototype.set = set;
102
+
103
+ /**
104
+ * Method used to delete a relation.
105
+ *
106
+ * @param {any} key - Key.
107
+ * @return {boolean}
108
+ */
109
+ function del(key) {
110
+ if (this.items.has(key)) {
111
+ var currentValue = this.items.get(key);
112
+
113
+ this.items.delete(key);
114
+ this.inverse.items.delete(currentValue);
115
+
116
+ // Size
117
+ this.size = this.items.size;
118
+ this.inverse.size = this.inverse.items.size;
119
+
120
+ return true;
121
+ }
122
+
123
+ return false;
124
+ }
125
+
126
+ BiMap.prototype.delete = del;
127
+ InverseMap.prototype.delete = del;
128
+
129
+ /**
130
+ * Mapping some Map prototype function unto our two classes.
131
+ */
132
+ var METHODS = ['has', 'get', 'forEach', 'keys', 'values', 'entries'];
133
+
134
+ METHODS.forEach(function(name) {
135
+ BiMap.prototype[name] = InverseMap.prototype[name] = function() {
136
+ return Map.prototype[name].apply(this.items, arguments);
137
+ };
138
+ });
139
+
140
+ /**
141
+ * Attaching the #.values method to Symbol.iterator if possible.
142
+ */
143
+ if (typeof Symbol !== 'undefined') {
144
+ BiMap.prototype[Symbol.iterator] = BiMap.prototype.entries;
145
+ InverseMap.prototype[Symbol.iterator] = InverseMap.prototype.entries;
146
+ }
147
+
148
+ /**
149
+ * Convenience known methods.
150
+ */
151
+ BiMap.prototype.inspect = function() {
152
+ var dummy = {
153
+ left: this.items,
154
+ right: this.inverse.items
155
+ };
156
+
157
+ // Trick so that node displays the name of the constructor
158
+ Object.defineProperty(dummy, 'constructor', {
159
+ value: BiMap,
160
+ enumerable: false
161
+ });
162
+
163
+ return dummy;
164
+ };
165
+
166
+ if (typeof Symbol !== 'undefined')
167
+ BiMap.prototype[Symbol.for('nodejs.util.inspect.custom')] = BiMap.prototype.inspect;
168
+
169
+ InverseMap.prototype.inspect = function() {
170
+ var dummy = {
171
+ left: this.inverse.items,
172
+ right: this.items
173
+ };
174
+
175
+ // Trick so that node displays the name of the constructor
176
+ Object.defineProperty(dummy, 'constructor', {
177
+ value: InverseMap,
178
+ enumerable: false
179
+ });
180
+
181
+ return dummy;
182
+ };
183
+
184
+ if (typeof Symbol !== 'undefined')
185
+ InverseMap.prototype[Symbol.for('nodejs.util.inspect.custom')] = InverseMap.prototype.inspect;
186
+
187
+
188
+ /**
189
+ * Static @.from function taking an arbitrary iterable & converting it into
190
+ * a bimap.
191
+ *
192
+ * @param {Iterable} iterable - Target iterable.
193
+ * @return {BiMap}
194
+ */
195
+ BiMap.from = function(iterable) {
196
+ var bimap = new BiMap();
197
+
198
+ forEach(iterable, function(value, key) {
199
+ bimap.set(key, value);
200
+ });
201
+
202
+ return bimap;
203
+ };
204
+
205
+ /**
206
+ * Exporting.
207
+ */
208
+ biMap$1 = BiMap;
209
+ return biMap$1;
210
+ }
211
+
212
+ var biMapExports = /*@__PURE__*/ requireBiMap();
213
+ const biMap = /*@__PURE__*/getDefaultExportFromCjs(biMapExports);
214
+
7
215
  /**
8
216
  * Mnemonist DefaultWeakMap
9
217
  * =========================
@@ -1096,4 +1304,4 @@ const compareRelations = (a, b) => {
1096
1304
  return compareFqnHierarchically(a.target, b.target);
1097
1305
  };
1098
1306
 
1099
- export { defaultWeakMap as DefaultWeakMap, linkedList as LinkedList, multiMap as MultiMap, queue as Queue, commonAncestor, compareFqnHierarchically, compareRelations, delay, ireduce };
1307
+ export { biMap as BiMap, defaultWeakMap as DefaultWeakMap, linkedList as LinkedList, multiMap as MultiMap, queue as Queue, commonAncestor, compareFqnHierarchically, compareRelations, delay, ireduce };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@likec4/core",
3
- "version": "1.25.1",
3
+ "version": "1.26.1",
4
4
  "license": "MIT",
5
5
  "homepage": "https://likec4.dev",
6
6
  "author": "Denis Davydkov <denis@davydkov.com>",
@@ -87,7 +87,7 @@
87
87
  "graphology": "^0.25.4",
88
88
  "graphology-dag": "^0.4.1",
89
89
  "graphology-types": "^0.24.8",
90
- "mnemonist": "0.40.2",
90
+ "mnemonist": "0.40.3",
91
91
  "natural-compare-lite": "^1.4.0",
92
92
  "object-hash": "^3.0.0",
93
93
  "obliterator": "^2.0.5",
@@ -95,8 +95,8 @@
95
95
  "turbo": "^2.4.4",
96
96
  "typescript": "5.8.2",
97
97
  "unbuild": "^3.3.1",
98
- "vitest": "^3.0.7",
99
- "@likec4/tsconfig": "1.25.1"
98
+ "vitest": "^3.0.8",
99
+ "@likec4/tsconfig": "1.26.1"
100
100
  },
101
101
  "scripts": {
102
102
  "typecheck": "tsc --noEmit",
@@ -8,7 +8,7 @@ import type {
8
8
  ElementShape,
9
9
  KeysOf,
10
10
  NonEmptyArray,
11
- ParsedLikeC4Model,
11
+ ParsedLikeC4ModelData,
12
12
  RelationshipArrowType,
13
13
  RelationshipKindSpecification,
14
14
  RelationshipLineType,
@@ -275,7 +275,7 @@ export namespace Types {
275
275
  >
276
276
  : never
277
277
 
278
- export type ToParsedLikeC4Model<T> = T extends AnyTypes ? ParsedLikeC4Model<
278
+ export type ToParsedLikeC4Model<T> = T extends AnyTypes ? ParsedLikeC4ModelData<
279
279
  T['ElementKind'],
280
280
  T['RelationshipKind'],
281
281
  T['Tag'],
@@ -2,13 +2,13 @@ import { mapValues } from 'remeda'
2
2
  import { nonexhaustive } from '../errors'
3
3
  import { LikeC4Model } from '../model'
4
4
  import {
5
- type ComputedLikeC4Model,
5
+ type ComputedLikeC4ModelData,
6
6
  type ComputedView,
7
+ type LikeC4View,
8
+ type ParsedLikeC4ModelData,
7
9
  isDeploymentView,
8
10
  isDynamicView,
9
11
  isElementView,
10
- type LikeC4View,
11
- type ParsedLikeC4Model
12
12
  } from '../types'
13
13
  import { computeDeploymentView } from './deployment-view/compute'
14
14
  import { computeDynamicView } from './dynamic-view/compute'
@@ -28,7 +28,7 @@ export type ComputeViewResult<V extends ComputedView = ComputedView> =
28
28
 
29
29
  export function unsafeComputeView(
30
30
  viewsource: LikeC4View,
31
- likec4model: LikeC4Model
31
+ likec4model: LikeC4Model,
32
32
  ): ComputedView {
33
33
  switch (true) {
34
34
  case isDeploymentView(viewsource): {
@@ -45,27 +45,27 @@ export function unsafeComputeView(
45
45
 
46
46
  export function computeView<V extends LikeC4View>(
47
47
  viewsource: V,
48
- likec4model: LikeC4Model
48
+ likec4model: LikeC4Model,
49
49
  ): ComputeViewResult {
50
50
  try {
51
51
  return {
52
52
  isSuccess: true,
53
- view: unsafeComputeView(viewsource, likec4model)
53
+ view: unsafeComputeView(viewsource, likec4model),
54
54
  }
55
55
  } catch (e) {
56
56
  return {
57
57
  isSuccess: false,
58
58
  error: e instanceof Error ? e : new Error(`Unknown error: ${e}`),
59
- view: undefined
59
+ view: undefined,
60
60
  }
61
61
  }
62
62
  }
63
63
 
64
- export function computeViews<P extends ParsedLikeC4Model>(parsed: P): ComputedLikeC4Model {
64
+ export function computeViews<P extends ParsedLikeC4ModelData>(parsed: P): ComputedLikeC4ModelData {
65
65
  const { views, ...rest } = parsed as Omit<P, '__'>
66
66
  const likec4model = LikeC4Model.create({
67
67
  ...rest,
68
- views: {}
68
+ views: {},
69
69
  })
70
70
  const compute = (source: LikeC4View): ComputedView => {
71
71
  const result = computeView(source, likec4model)
@@ -78,6 +78,6 @@ export function computeViews<P extends ParsedLikeC4Model>(parsed: P): ComputedLi
78
78
  return {
79
79
  ...rest,
80
80
  __: 'computed',
81
- views: mapValues(parsed.views, compute)
81
+ views: mapValues(parsed.views, compute),
82
82
  }
83
83
  }
@@ -1,5 +1,5 @@
1
1
  import { map, mapToObj, mapValues, omit } from 'remeda'
2
- import type { ComputedLikeC4Model } from '../../types'
2
+ import type { ComputedLikeC4ModelData } from '../../types'
3
3
  import type { ComputedView, EdgeId } from '../../types/view'
4
4
 
5
5
  /**
@@ -28,7 +28,7 @@ export function withReadableEdges<T extends ComputedView>({ edges, nodes, ...vie
28
28
  } as any
29
29
  }
30
30
 
31
- export function viewsWithReadableEdges<M extends ComputedLikeC4Model>({ views, ...model }: M): M {
31
+ export function viewsWithReadableEdges<M extends ComputedLikeC4ModelData>({ views, ...model }: M): M {
32
32
  return {
33
33
  ...model,
34
34
  views: mapValues(views, v => omit(withReadableEdges(v), ['nodeIds', 'edgeIds'])),
@@ -1,9 +1,10 @@
1
1
  // Ensure that the value is NonNullable
2
2
  // Mostly as safer `value!`
3
3
  // eslint-disable-next-line @typescript-eslint/ban-types
4
- export function nonNullable<T>(value: T, message?: string): NonNullable<T> {
4
+ export function nonNullable<T>(value: T, message?: string | (() => string)): NonNullable<T> {
5
5
  if (typeof value === 'undefined' || value == null) {
6
- throw new Error(message ?? `Expected defined value, but received ${value}`)
6
+ const msg = typeof message === 'function' ? message() : message
7
+ throw new Error(msg ?? `Expected defined value, but received ${value}`)
7
8
  }
8
9
  return value
9
10
  }
@@ -15,7 +16,7 @@ export function invariant(
15
16
  condition: any,
16
17
  // Can provide a string, or a function that returns a string for cases where
17
18
  // the message takes a fair amount of effort to compute
18
- message?: string
19
+ message?: string,
19
20
  ): asserts condition {
20
21
  if (condition) {
21
22
  return
package/src/index.ts CHANGED
@@ -14,11 +14,21 @@ export {
14
14
  export {
15
15
  type AnyAux,
16
16
  type Aux,
17
+ Connection,
18
+ ConnectionModel,
19
+ DeployedInstanceModel,
20
+ DeploymentConnectionModel,
21
+ type DeploymentElementModel,
22
+ DeploymentNodeModel,
23
+ DeploymentRelationModel,
24
+ EdgeModel,
25
+ ElementModel,
17
26
  LikeC4DeploymentModel,
18
27
  LikeC4Model,
19
28
  LikeC4ViewModel,
29
+ NodeModel,
30
+ RelationshipModel,
20
31
  } from './model'
21
-
22
32
  export * from './types'
23
33
 
24
34
  export * from './utils'
@@ -5,7 +5,7 @@ import {
5
5
  type ComputedDeploymentView,
6
6
  type DeploymentRef,
7
7
  type DeploymentRelation,
8
- type GenericLikeC4Model,
8
+ type GenericLikeC4ModelData,
9
9
  type IteratorLike,
10
10
  type Tag as C4Tag,
11
11
  DeploymentElement,
@@ -64,7 +64,7 @@ export class LikeC4DeploymentModel<M extends AnyAux = AnyAux> {
64
64
 
65
65
  constructor(
66
66
  public readonly $model: LikeC4Model<M>,
67
- public readonly $deployments: GenericLikeC4Model['deployments'],
67
+ public readonly $deployments: GenericLikeC4ModelData['deployments'],
68
68
  ) {
69
69
  for (const element of sortParentsFirst(values($deployments.elements))) {
70
70
  const el = this.addElement(element)
@@ -6,7 +6,7 @@ import { invariant, nonNullable } from '../errors'
6
6
  import type { ComputedView, DiagramView, IteratorLike, LikeC4View, ModelGlobals } from '../types'
7
7
  import type { Element } from '../types/element'
8
8
  import { type Tag as C4Tag } from '../types/element'
9
- import type { AnyParsedLikeC4Model, GenericLikeC4Model, LikeC4ModelDump } from '../types/model'
9
+ import type { AnyParsedLikeC4ModelData, GenericLikeC4ModelData, LikeC4ModelDump } from '../types/model-data'
10
10
  import type { ModelRelation } from '../types/relation'
11
11
  import { compareNatural } from '../utils'
12
12
  import { ancestorsFqn, commonAncestor, parentFqn } from '../utils/fqn'
@@ -68,7 +68,7 @@ export class LikeC4Model<M extends AnyAux = LikeC4Model.Any> {
68
68
  * @param parsed - The parsed LikeC4 model to compute from
69
69
  * @returns A new LikeC4Model instance with computed relationships and structure
70
70
  */
71
- static compute<const M extends AnyParsedLikeC4Model>(parsed: M): LikeC4Model<Aux.FromParsed<M>> {
71
+ static compute<const M extends AnyParsedLikeC4ModelData>(parsed: M): LikeC4Model<Aux.FromParsed<M>> {
72
72
  let { views, ...rest } = parsed as Omit<M, '__'>
73
73
  const model = new LikeC4Model({ ...rest, views: {} })
74
74
  return new LikeC4Model({
@@ -84,7 +84,7 @@ export class LikeC4Model<M extends AnyAux = LikeC4Model.Any> {
84
84
  * const compute = LikeC4Model.makeCompute(parsedModel);
85
85
  * const result = compute(viewSource);
86
86
  */
87
- static makeCompute<M extends AnyParsedLikeC4Model>(parsed: M): (viewsource: LikeC4View) => ComputeViewResult {
87
+ static makeCompute<M extends AnyParsedLikeC4ModelData>(parsed: M): (viewsource: LikeC4View) => ComputeViewResult {
88
88
  let { views, ...rest } = parsed as Omit<M, '__'>
89
89
  const model = new LikeC4Model({ ...rest, views: {} })
90
90
  return (viewsource) => computeView(viewsource, model)
@@ -97,7 +97,7 @@ export class LikeC4Model<M extends AnyAux = LikeC4Model.Any> {
97
97
  * @param model - The model data to create a LikeC4Model from
98
98
  * @returns A new LikeC4Model instance with the type derived from the input model
99
99
  */
100
- static create<const M extends GenericLikeC4Model>(model: M): LikeC4Model<Aux.FromModel<M>> {
100
+ static create<const M extends GenericLikeC4ModelData>(model: M): LikeC4Model<Aux.FromModel<M>> {
101
101
  return new LikeC4Model(model as any)
102
102
  }
103
103
 
@@ -4,13 +4,12 @@ import type {
4
4
  DiagramView,
5
5
  EdgeId,
6
6
  Fqn,
7
- GenericLikeC4Model,
8
- IteratorLike,
7
+ GenericLikeC4ModelData,
9
8
  KeysOf,
10
- LayoutedLikeC4Model,
9
+ LayoutedLikeC4ModelData,
11
10
  LikeC4ModelDump,
12
11
  NodeId,
13
- ParsedLikeC4Model,
12
+ ParsedLikeC4ModelData,
14
13
  RelationId,
15
14
  ViewId,
16
15
  } from '../types'
@@ -66,7 +65,7 @@ export interface Aux<
66
65
  NodeOrId: LiteralUnion<this['NodeIdLiteral'], string> | WithId<this['NodeId']>
67
66
  EdgeOrId: LiteralUnion<this['EdgeIdLiteral'], string> | WithId<this['EdgeId']>
68
67
 
69
- Model: Simplify<Omit<GenericLikeC4Model, 'views'> & WithViews<this['ViewId'], ViewType>>
68
+ Model: Simplify<Omit<GenericLikeC4ModelData, 'views'> & WithViews<this['ViewId'], ViewType>>
70
69
  }
71
70
 
72
71
  export type AnyAux = Aux<
@@ -83,7 +82,7 @@ export namespace Strict {
83
82
  }
84
83
 
85
84
  export namespace Aux {
86
- export type FromParsed<M> = M extends ParsedLikeC4Model ? Aux<
85
+ export type FromParsed<M> = M extends ParsedLikeC4ModelData ? Aux<
87
86
  KeysOf<M['elements']>,
88
87
  KeysOf<M['deployments']['elements']>,
89
88
  KeysOf<M['views']>,
@@ -91,11 +90,11 @@ export namespace Aux {
91
90
  >
92
91
  : never
93
92
 
94
- export type FromModel<M> = M extends GenericLikeC4Model ? Aux<
93
+ export type FromModel<M> = M extends GenericLikeC4ModelData ? Aux<
95
94
  KeysOf<M['elements']>,
96
95
  KeysOf<M['deployments']['elements']>,
97
96
  KeysOf<M['views']>,
98
- M extends LayoutedLikeC4Model ? DiagramView<ViewId<KeysOf<M['views']>>, string>
97
+ M extends LayoutedLikeC4ModelData ? DiagramView<ViewId<KeysOf<M['views']>>, string>
99
98
  : ComputedView<ViewId<KeysOf<M['views']>>, string>
100
99
  >
101
100
  : never
@@ -1,5 +1,7 @@
1
1
  import type { Simplify, Tagged, UnionToIntersection } from 'type-fest'
2
2
 
3
+ export type ProjectId = Tagged<string, 'ProjectID'>
4
+
3
5
  export type NonEmptyArray<T> = [T, ...T[]]
4
6
 
5
7
  export type NonEmptyReadonlyArray<T> = readonly [T, ...T[]]
@@ -9,6 +9,7 @@ export type {
9
9
  NTuple,
10
10
  Point,
11
11
  Predicate,
12
+ ProjectId,
12
13
  XYPoint,
13
14
  } from './_common'
14
15
 
@@ -102,13 +103,13 @@ export type {
102
103
  } from './global'
103
104
 
104
105
  export type {
105
- AnyParsedLikeC4Model,
106
- ComputedLikeC4Model,
107
- GenericLikeC4Model,
108
- LayoutedLikeC4Model,
106
+ AnyParsedLikeC4ModelData,
107
+ ComputedLikeC4ModelData,
108
+ GenericLikeC4ModelData,
109
+ LayoutedLikeC4ModelData,
109
110
  LikeC4ModelDump,
110
- ParsedLikeC4Model,
111
- } from './model'
111
+ ParsedLikeC4ModelData,
112
+ } from './model-data'
112
113
 
113
114
  export {
114
115
  isAndOperator,
@@ -2,7 +2,7 @@ import type {
2
2
  DeploymentElement,
3
3
  DeploymentNodeKind,
4
4
  DeploymentNodeKindSpecification,
5
- DeploymentRelation
5
+ DeploymentRelation,
6
6
  } from './deployments'
7
7
  import type { ElementKindSpecification, Tag, TypedElement } from './element'
8
8
  import type { ModelGlobals } from './global'
@@ -23,13 +23,13 @@ import type { ComputedView, DiagramView, LikeC4View } from './view'
23
23
  * @typeParam Views - Types of views in the model (defaults to string)
24
24
  * @typeParam DeploymentFqns - Fully Qualified Names for deployment nodes (defaults to string)
25
25
  */
26
- export interface ParsedLikeC4Model<
26
+ export interface ParsedLikeC4ModelData<
27
27
  ElementKinds extends string = string,
28
28
  RelationKinds extends string = string,
29
29
  Tags extends string = string,
30
30
  Fqns extends string = string,
31
31
  Views extends string = string,
32
- DeploymentFqns extends string = string
32
+ DeploymentFqns extends string = string,
33
33
  > {
34
34
  // To prevent accidental use of this type
35
35
  __?: never
@@ -52,7 +52,7 @@ export interface ParsedLikeC4Model<
52
52
  }
53
53
  }
54
54
 
55
- export type AnyParsedLikeC4Model = ParsedLikeC4Model<any, any, any, any, any, any>
55
+ export type AnyParsedLikeC4ModelData = ParsedLikeC4ModelData<any, any, any, any, any, any>
56
56
  /**
57
57
  * Hook to get types from dump
58
58
  */
@@ -71,34 +71,34 @@ export type LikeC4ModelDump = {
71
71
  }
72
72
 
73
73
  /**
74
- * Same as {@link ParsedLikeC4Model}, but with computed views or layouted views.
74
+ * Same as {@link ParsedLikeC4ModelData}, but with computed views or layouted views.
75
75
  */
76
- export interface GenericLikeC4Model<
76
+ export interface GenericLikeC4ModelData<
77
77
  Fqns extends string = string,
78
78
  DeploymentFqns extends string = string,
79
79
  Views extends string = string,
80
80
  Tags extends string = string,
81
- T = 'computed' | 'layouted'
82
- > extends Omit<ParsedLikeC4Model<string, string, Tags, Fqns, Views, DeploymentFqns>, 'views' | '__'> {
81
+ T = 'computed' | 'layouted',
82
+ > extends Omit<ParsedLikeC4ModelData<string, string, Tags, Fqns, Views, DeploymentFqns>, 'views' | '__'> {
83
83
  __?: T
84
84
  views: Record<Views, ComputedView<Views> | DiagramView<Views>>
85
85
  }
86
86
 
87
- export interface ComputedLikeC4Model<
87
+ export interface ComputedLikeC4ModelData<
88
88
  Fqns extends string = string,
89
89
  DeploymentFqns extends string = string,
90
90
  Views extends string = string,
91
- Tags extends string = string
92
- > extends Omit<GenericLikeC4Model<Fqns, DeploymentFqns, Views, Tags, 'computed'>, 'views'> {
91
+ Tags extends string = string,
92
+ > extends Omit<GenericLikeC4ModelData<Fqns, DeploymentFqns, Views, Tags, 'computed'>, 'views'> {
93
93
  views: Record<Views, ComputedView<Views>>
94
94
  }
95
95
 
96
- export interface LayoutedLikeC4Model<
96
+ export interface LayoutedLikeC4ModelData<
97
97
  Fqns extends string = string,
98
98
  DeploymentFqns extends string = string,
99
99
  Views extends string = string,
100
- Tags extends string = string
101
- > extends Omit<GenericLikeC4Model<Fqns, DeploymentFqns, Views, Tags, 'layouted'>, 'views'> {
100
+ Tags extends string = string,
101
+ > extends Omit<GenericLikeC4ModelData<Fqns, DeploymentFqns, Views, Tags, 'layouted'>, 'views'> {
102
102
  __: 'layouted'
103
103
  views: Record<Views, DiagramView<Views, Tags>>
104
104
  }
@@ -1,4 +1,5 @@
1
1
  export {
2
+ BiMap,
2
3
  DefaultMap,
3
4
  DefaultWeakMap,
4
5
  LinkedList,
@@ -1,4 +1,5 @@
1
1
  export {
2
+ BiMap,
2
3
  DefaultMap,
3
4
  DefaultWeakMap,
4
5
  LinkedList,