@lionweb/class-core 0.6.13-beta.5 → 0.6.13-beta.7

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 (79) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/README.md +1 -1
  3. package/dist/base-types.d.ts +4 -5
  4. package/dist/base-types.d.ts.map +1 -1
  5. package/dist/base-types.js.map +1 -1
  6. package/dist/convenience.d.ts +3 -4
  7. package/dist/convenience.d.ts.map +1 -1
  8. package/dist/convenience.js.map +1 -1
  9. package/dist/deltas/appliers.d.ts.map +1 -1
  10. package/dist/deltas/appliers.js +1 -1
  11. package/dist/deltas/appliers.js.map +1 -1
  12. package/dist/deltas/handlers.d.ts.map +1 -1
  13. package/dist/deltas/handlers.js.map +1 -1
  14. package/dist/deltas/inverters.d.ts.map +1 -1
  15. package/dist/deltas/inverters.js.map +1 -1
  16. package/dist/deltas/serialization/base.d.ts +1 -1
  17. package/dist/deltas/serialization/base.d.ts.map +1 -1
  18. package/dist/deltas/serialization/serializer-helpers.d.ts.map +1 -1
  19. package/dist/deltas/serialization/serializer-helpers.js.map +1 -1
  20. package/dist/deltas/serialization/types.g.d.ts +57 -58
  21. package/dist/deltas/serialization/types.g.d.ts.map +1 -1
  22. package/dist/deserializer.d.ts +4 -5
  23. package/dist/deserializer.d.ts.map +1 -1
  24. package/dist/deserializer.js +3 -4
  25. package/dist/deserializer.js.map +1 -1
  26. package/dist/duplicator.d.ts.map +1 -1
  27. package/dist/duplicator.js +2 -3
  28. package/dist/duplicator.js.map +1 -1
  29. package/dist/id-mapping.d.ts +5 -5
  30. package/dist/id-mapping.d.ts.map +1 -1
  31. package/dist/id-mapping.js +6 -5
  32. package/dist/id-mapping.js.map +1 -1
  33. package/dist/linking.d.ts +2 -3
  34. package/dist/linking.d.ts.map +1 -1
  35. package/dist/lionCore_builtins.g.d.ts.map +1 -1
  36. package/dist/lionCore_builtins.g.js.map +1 -1
  37. package/dist/serializer.d.ts +2 -2
  38. package/dist/serializer.d.ts.map +1 -1
  39. package/dist/serializer.js +1 -1
  40. package/dist/serializer.js.map +1 -1
  41. package/dist/textualizer.d.ts.map +1 -1
  42. package/dist/textualizer.js +1 -1
  43. package/dist/textualizer.js.map +1 -1
  44. package/dist/value-managers/annotations.d.ts.map +1 -1
  45. package/dist/value-managers/annotations.js +1 -1
  46. package/dist/value-managers/annotations.js.map +1 -1
  47. package/dist/value-managers/base.d.ts.map +1 -1
  48. package/dist/value-managers/base.js.map +1 -1
  49. package/dist/value-managers/containments.d.ts.map +1 -1
  50. package/dist/value-managers/containments.js +1 -1
  51. package/dist/value-managers/containments.js.map +1 -1
  52. package/dist/value-managers/properties.d.ts +1 -1
  53. package/dist/value-managers/properties.d.ts.map +1 -1
  54. package/dist/value-managers/properties.js +1 -1
  55. package/dist/value-managers/properties.js.map +1 -1
  56. package/dist/value-managers/references.d.ts.map +1 -1
  57. package/dist/value-managers/references.js +1 -1
  58. package/dist/value-managers/references.js.map +1 -1
  59. package/package.json +2 -4
  60. package/src/base-types.ts +6 -6
  61. package/src/convenience.ts +9 -6
  62. package/src/deltas/appliers.ts +11 -11
  63. package/src/deltas/handlers.ts +2 -2
  64. package/src/deltas/inverters.ts +2 -2
  65. package/src/deltas/serialization/base.ts +2 -2
  66. package/src/deltas/serialization/serializer-helpers.ts +4 -3
  67. package/src/deltas/serialization/types.g.ts +57 -58
  68. package/src/deserializer.ts +14 -12
  69. package/src/duplicator.ts +6 -8
  70. package/src/id-mapping.ts +12 -8
  71. package/src/linking.ts +3 -4
  72. package/src/lionCore_builtins.g.ts +2 -5
  73. package/src/serializer.ts +3 -3
  74. package/src/textualizer.ts +5 -4
  75. package/src/value-managers/annotations.ts +4 -4
  76. package/src/value-managers/base.ts +3 -3
  77. package/src/value-managers/containments.ts +12 -6
  78. package/src/value-managers/properties.ts +5 -5
  79. package/src/value-managers/references.ts +11 -6
@@ -15,16 +15,6 @@
15
15
  // SPDX-FileCopyrightText: 2025 TRUMPF Laser SE and other contributors
16
16
  // SPDX-License-Identifier: Apache-2.0
17
17
 
18
- import { SingleRef, unresolved } from "@lionweb/core"
19
- import { INodeBase } from "../base-types.js"
20
- import { IdMapping } from "../id-mapping.js"
21
- import {
22
- MultiContainmentValueManager,
23
- MultiReferenceValueManager,
24
- SingleContainmentValueManager,
25
- SingleReferenceValueManager
26
- } from "../value-managers/index.js"
27
- import { IDelta } from "./base.js"
28
18
  import {
29
19
  AnnotationAddedDelta,
30
20
  AnnotationDeletedDelta,
@@ -45,7 +35,17 @@ import {
45
35
  ReferenceMovedDelta,
46
36
  ReferenceMovedInSameReferenceDelta,
47
37
  ReferenceReplacedDelta
48
- } from "./types.g.js"
38
+ } from "./types.g.js";
39
+ import {
40
+ MultiContainmentValueManager,
41
+ MultiReferenceValueManager,
42
+ SingleContainmentValueManager,
43
+ SingleReferenceValueManager
44
+ } from "../value-managers/index.js";
45
+ import {INodeBase} from "../base-types.js";
46
+ import {IdMapping} from "../id-mapping.js";
47
+ import {SingleRef, unresolved} from "@lionweb/core";
48
+ import {IDelta} from "./base.js";
49
49
 
50
50
 
51
51
  /**
@@ -15,8 +15,8 @@
15
15
  // SPDX-FileCopyrightText: 2025 TRUMPF Laser SE and other contributors
16
16
  // SPDX-License-Identifier: Apache-2.0
17
17
 
18
- import { IDelta } from "./base.js"
19
- import { serializeDelta } from "./serialization/index.js"
18
+ import {IDelta} from "./base.js";
19
+ import {serializeDelta} from "./serialization/index.js";
20
20
 
21
21
 
22
22
  /**
@@ -15,7 +15,6 @@
15
15
  // SPDX-FileCopyrightText: 2025 TRUMPF Laser SE and other contributors
16
16
  // SPDX-License-Identifier: Apache-2.0
17
17
 
18
- import { IDelta } from "./base.js"
19
18
  import {
20
19
  AnnotationAddedDelta,
21
20
  AnnotationDeletedDelta,
@@ -36,7 +35,8 @@ import {
36
35
  ReferenceMovedDelta,
37
36
  ReferenceMovedInSameReferenceDelta,
38
37
  ReferenceReplacedDelta
39
- } from "./types.g.js"
38
+ } from "./types.g.js";
39
+ import {IDelta} from "./base.js";
40
40
 
41
41
 
42
42
  /**
@@ -15,8 +15,8 @@
15
15
  // SPDX-FileCopyrightText: 2025 TRUMPF Laser SE and other contributors
16
16
  // SPDX-License-Identifier: Apache-2.0
17
17
 
18
- import { IDelta } from "../base.js"
19
- import { SerializedDelta } from "./types.g.js"
18
+ import {SerializedDelta} from "./types.g.js";
19
+ import {IDelta} from "../base.js";
20
20
 
21
21
 
22
22
  /**
@@ -15,10 +15,11 @@
15
15
  // SPDX-FileCopyrightText: 2025 TRUMPF Laser SE and other contributors
16
16
  // SPDX-License-Identifier: Apache-2.0
17
17
 
18
- import { DefaultPrimitiveTypeSerializer, IdOrUnresolved, Property, SingleRef, unresolved } from "@lionweb/core"
19
- import { INodeBase } from "../../base-types.js"
18
+ import {DefaultPrimitiveTypeSerializer, IdOrUnresolved, Property, SingleRef, unresolved} from "@lionweb/core";
19
+ import {INodeBase} from "../../base-types.js";
20
20
 
21
- const defaultPrimitiveValueSerializer = new DefaultPrimitiveTypeSerializer() // (suffices because serializeNodeBases also uses this class)
21
+
22
+ const defaultPrimitiveValueSerializer = new DefaultPrimitiveTypeSerializer(); // (suffices because serializeNodeBases also uses this class)
22
23
  /**
23
24
  * A function that serializes the given value of the given {@link Property property},
24
25
  * using (an instance of) the same {@link DefaultPrimitiveTypeSerializer} class as the {@link serializeNodeBases} function.
@@ -18,8 +18,7 @@
18
18
  // Warning: this file is generated!
19
19
  // Modifying it by hand is useless at best, and sabotage at worst.
20
20
 
21
- import {IdOrUnresolved} from "@lionweb/core";
22
- import {LionWebId, LionWebJsonMetaPointer, LionWebJsonChunk} from "@lionweb/json";
21
+ import {Id, IdOrUnresolved, MetaPointer, SerializationChunk} from "@lionweb/core";
23
22
 
24
23
 
25
24
  export type SerializedDelta =
@@ -51,95 +50,95 @@ export type NoOpSerializedDelta = {
51
50
 
52
51
  export type PropertyAddedSerializedDelta = {
53
52
  kind: "PropertyAdded"
54
- container: LionWebId
55
- property: LionWebJsonMetaPointer
53
+ container: Id
54
+ property: MetaPointer
56
55
  value: string
57
56
  }
58
57
 
59
58
  export type PropertyDeletedSerializedDelta = {
60
59
  kind: "PropertyDeleted"
61
- container: LionWebId
62
- property: LionWebJsonMetaPointer
60
+ container: Id
61
+ property: MetaPointer
63
62
  oldValue: string
64
63
  }
65
64
 
66
65
  export type PropertyChangedSerializedDelta = {
67
66
  kind: "PropertyChanged"
68
- container: LionWebId
69
- property: LionWebJsonMetaPointer
67
+ container: Id
68
+ property: MetaPointer
70
69
  oldValue: string
71
70
  newValue: string
72
71
  }
73
72
 
74
73
  export type ChildAddedSerializedDelta = {
75
74
  kind: "ChildAdded"
76
- parent: LionWebId
77
- containment: LionWebJsonMetaPointer
75
+ parent: Id
76
+ containment: MetaPointer
78
77
  index: number
79
- newChild: LionWebId
80
- newNodes: LionWebJsonChunk
78
+ newChild: Id
79
+ newNodes: SerializationChunk
81
80
  }
82
81
 
83
82
  export type ChildDeletedSerializedDelta = {
84
83
  kind: "ChildDeleted"
85
- parent: LionWebId
86
- containment: LionWebJsonMetaPointer
84
+ parent: Id
85
+ containment: MetaPointer
87
86
  index: number
88
- deletedChild: LionWebId
89
- deletedNodes: LionWebJsonChunk
87
+ deletedChild: Id
88
+ deletedNodes: SerializationChunk
90
89
  }
91
90
 
92
91
  export type ChildReplacedSerializedDelta = {
93
92
  kind: "ChildReplaced"
94
- parent: LionWebId
95
- containment: LionWebJsonMetaPointer
93
+ parent: Id
94
+ containment: MetaPointer
96
95
  index: number
97
- replacedChild: LionWebId
98
- replacedNodes: LionWebJsonChunk
99
- newChild: LionWebId
100
- newNodes: LionWebJsonChunk
96
+ replacedChild: Id
97
+ replacedNodes: SerializationChunk
98
+ newChild: Id
99
+ newNodes: SerializationChunk
101
100
  }
102
101
 
103
102
  export type ChildMovedSerializedDelta = {
104
103
  kind: "ChildMoved"
105
- oldParent: LionWebId
106
- oldContainment: LionWebJsonMetaPointer
104
+ oldParent: Id
105
+ oldContainment: MetaPointer
107
106
  oldIndex: number
108
- newParent: LionWebId
109
- newContainment: LionWebJsonMetaPointer
107
+ newParent: Id
108
+ newContainment: MetaPointer
110
109
  newIndex: number
111
- child: LionWebId
110
+ child: Id
112
111
  }
113
112
 
114
113
  export type ChildMovedInSameContainmentSerializedDelta = {
115
114
  kind: "ChildMovedInSameContainment"
116
- parent: LionWebId
117
- containment: LionWebJsonMetaPointer
115
+ parent: Id
116
+ containment: MetaPointer
118
117
  oldIndex: number
119
118
  newIndex: number
120
- child: LionWebId
119
+ child: Id
121
120
  }
122
121
 
123
122
  export type ReferenceAddedSerializedDelta = {
124
123
  kind: "ReferenceAdded"
125
- container: LionWebId
126
- reference: LionWebJsonMetaPointer
124
+ container: Id
125
+ reference: MetaPointer
127
126
  index: number
128
127
  newTarget: IdOrUnresolved
129
128
  }
130
129
 
131
130
  export type ReferenceDeletedSerializedDelta = {
132
131
  kind: "ReferenceDeleted"
133
- container: LionWebId
134
- reference: LionWebJsonMetaPointer
132
+ container: Id
133
+ reference: MetaPointer
135
134
  index: number
136
135
  deletedTarget: IdOrUnresolved
137
136
  }
138
137
 
139
138
  export type ReferenceReplacedSerializedDelta = {
140
139
  kind: "ReferenceReplaced"
141
- container: LionWebId
142
- reference: LionWebJsonMetaPointer
140
+ container: Id
141
+ reference: MetaPointer
143
142
  index: number
144
143
  replacedTarget: IdOrUnresolved
145
144
  newTarget: IdOrUnresolved
@@ -147,19 +146,19 @@ export type ReferenceReplacedSerializedDelta = {
147
146
 
148
147
  export type ReferenceMovedSerializedDelta = {
149
148
  kind: "ReferenceMoved"
150
- oldContainer: LionWebId
151
- oldReference: LionWebJsonMetaPointer
149
+ oldContainer: Id
150
+ oldReference: MetaPointer
152
151
  oldIndex: number
153
- newContainer: LionWebId
154
- newReference: LionWebJsonMetaPointer
152
+ newContainer: Id
153
+ newReference: MetaPointer
155
154
  newIndex: number
156
155
  target: IdOrUnresolved
157
156
  }
158
157
 
159
158
  export type ReferenceMovedInSameReferenceSerializedDelta = {
160
159
  kind: "ReferenceMovedInSameReference"
161
- container: LionWebId
162
- reference: LionWebJsonMetaPointer
160
+ container: Id
161
+ reference: MetaPointer
163
162
  oldIndex: number
164
163
  newIndex: number
165
164
  target: IdOrUnresolved
@@ -167,44 +166,44 @@ export type ReferenceMovedInSameReferenceSerializedDelta = {
167
166
 
168
167
  export type AnnotationAddedSerializedDelta = {
169
168
  kind: "AnnotationAdded"
170
- parent: LionWebId
169
+ parent: Id
171
170
  index: number
172
- newAnnotation: LionWebId
173
- newAnnotationNodes: LionWebJsonChunk
171
+ newAnnotation: Id
172
+ newAnnotationNodes: SerializationChunk
174
173
  }
175
174
 
176
175
  export type AnnotationDeletedSerializedDelta = {
177
176
  kind: "AnnotationDeleted"
178
- parent: LionWebId
177
+ parent: Id
179
178
  index: number
180
- deletedAnnotation: LionWebId
181
- deletedAnnotationNodes: LionWebJsonChunk
179
+ deletedAnnotation: Id
180
+ deletedAnnotationNodes: SerializationChunk
182
181
  }
183
182
 
184
183
  export type AnnotationReplacedSerializedDelta = {
185
184
  kind: "AnnotationReplaced"
186
- parent: LionWebId
185
+ parent: Id
187
186
  index: number
188
- replacedAnnotation: LionWebId
189
- replacedAnnotationNodes: LionWebJsonChunk
190
- newAnnotation: LionWebId
191
- newAnnotationNodes: LionWebJsonChunk
187
+ replacedAnnotation: Id
188
+ replacedAnnotationNodes: SerializationChunk
189
+ newAnnotation: Id
190
+ newAnnotationNodes: SerializationChunk
192
191
  }
193
192
 
194
193
  export type AnnotationMovedFromOtherParentSerializedDelta = {
195
194
  kind: "AnnotationMovedFromOtherParent"
196
- oldParent: LionWebId
195
+ oldParent: Id
197
196
  oldIndex: number
198
- newParent: LionWebId
197
+ newParent: Id
199
198
  newIndex: number
200
- movedAnnotation: LionWebId
199
+ movedAnnotation: Id
201
200
  }
202
201
 
203
202
  export type AnnotationMovedInSameParentSerializedDelta = {
204
203
  kind: "AnnotationMovedInSameParent"
205
- parent: LionWebId
204
+ parent: Id
206
205
  oldIndex: number
207
206
  newIndex: number
208
- movedAnnotation: LionWebId
207
+ movedAnnotation: Id
209
208
  }
210
209
 
@@ -16,32 +16,34 @@
16
16
  // SPDX-License-Identifier: Apache-2.0
17
17
 
18
18
  import {
19
+ byIdMap,
19
20
  Classifier,
20
21
  Containment,
21
22
  DefaultPrimitiveTypeDeserializer,
22
23
  defaultSimplisticHandler,
23
24
  Enumeration,
25
+ Id,
24
26
  Language,
25
27
  MemoisingSymbolTable,
26
28
  PrimitiveType,
27
29
  PrimitiveTypeDeserializer,
28
30
  Property,
29
31
  Reference,
32
+ SerializationChunk,
33
+ SerializedNode,
30
34
  SimplisticHandler,
31
35
  unresolved
32
- } from "@lionweb/core"
33
- import { LionWebId, LionWebJsonChunk, LionWebJsonNode } from "@lionweb/json"
34
- import { byIdMap } from "@lionweb/ts-utils"
36
+ } from "@lionweb/core";
35
37
 
36
- import { DeltaHandler, IdMapping, ILanguageBase, INodeBase } from "./index.js"
37
- import { NodesToInstall } from "./linking.js"
38
+ import {DeltaHandler, IdMapping, ILanguageBase, INodeBase} from "./index.js";
39
+ import {NodesToInstall} from "./linking.js";
38
40
 
39
41
 
40
42
  /**
41
43
  * A type for deserializer functions that are parametrized in their return type.
42
44
  */
43
45
  export type Deserializer<T> = (
44
- serializationChunk: LionWebJsonChunk,
46
+ serializationChunk: SerializationChunk,
45
47
  dependentNodes?: INodeBase[],
46
48
  primitiveTypeDeserializer?: PrimitiveTypeDeserializer,
47
49
  problemHandler?: SimplisticHandler
@@ -72,7 +74,7 @@ export type RootsWithIdMapping = { roots: INodeBase[], idMapping: IdMapping };
72
74
 
73
75
  /**
74
76
  * @return a {@link Deserializer} function for the given languages (given as {@link ILanguageBase}s) that returns a {@link RootsWithIdMapping}.
75
- * @param languageBases the {@link ILanguageBase}s for (at least) all the languages used in the {@link LionWebJsonChunk} to deserialize, minus LionCore M3 and built-ins.
77
+ * @param languageBases the {@link ILanguageBase}s for (at least) all the languages used in the {@link SerializationChunk} to deserialize, minus LionCore M3 and built-ins.
76
78
  * @param handleDelta an optional {@link DeltaHandler} that will be injected in all {@link INodeBase nodes} created.
77
79
  */
78
80
  export const nodeBaseDeserializerWithIdMapping = (languageBases: ILanguageBase[], handleDelta?: DeltaHandler): Deserializer<RootsWithIdMapping> => {
@@ -82,7 +84,7 @@ export const nodeBaseDeserializerWithIdMapping = (languageBases: ILanguageBase[]
82
84
  const factoryFor = factoryLookupFor(languageBases, handleDelta);
83
85
 
84
86
  return (
85
- serializationChunk: LionWebJsonChunk,
87
+ serializationChunk: SerializationChunk,
86
88
  dependentNodes: INodeBase[] = [],
87
89
  primitiveTypeDeserializer: PrimitiveTypeDeserializer = new DefaultPrimitiveTypeDeserializer(),
88
90
  problemsHandler: SimplisticHandler = defaultSimplisticHandler
@@ -90,7 +92,7 @@ export const nodeBaseDeserializerWithIdMapping = (languageBases: ILanguageBase[]
90
92
 
91
93
  const nodesToInstall: NodesToInstall[] = [];
92
94
 
93
- const createNode = ({id, classifier: classifierMetaPointer, properties, containments, references, annotations}: LionWebJsonNode) => {
95
+ const createNode = ({id, classifier: classifierMetaPointer, properties, containments, references, annotations}: SerializedNode) => {
94
96
  const languageMessage = `language ${classifierMetaPointer.language} (${classifierMetaPointer.version})`;
95
97
  const classifier = symbolTable.entityMatching(classifierMetaPointer);
96
98
  if (classifier === undefined || !(classifier instanceof Classifier)) {
@@ -159,7 +161,7 @@ export const nodeBaseDeserializerWithIdMapping = (languageBases: ILanguageBase[]
159
161
 
160
162
  const dependentNodesById = byIdMap(dependentNodes)
161
163
 
162
- const lookupNodeById = (id: LionWebId) =>
164
+ const lookupNodeById = (id: Id) =>
163
165
  nodesById[id] ?? dependentNodesById[id];
164
166
 
165
167
  nodesToInstall.forEach(([node, feature, ids]) => {
@@ -216,13 +218,13 @@ export const nodeBaseDeserializerWithIdMapping = (languageBases: ILanguageBase[]
216
218
 
217
219
  /**
218
220
  * @return a {@link Deserializer} function for the languages (given as {@link ILanguageBase}s) that returns the roots (of type {@link INodeBase}) of the deserialized model.
219
- * @param languageBases the {@link ILanguageBase}s for (at least) all the languages used in the {@link LionWebJsonChunk} to deserialize, minus LionCore M3 and built-ins.
221
+ * @param languageBases the {@link ILanguageBase}s for (at least) all the languages used in the {@link SerializationChunk} to deserialize, minus LionCore M3 and built-ins.
220
222
  * @param handleDelta an optional {@link DeltaHandler} that will be injected in all {@link INodeBase nodes} created.
221
223
  */
222
224
  export const nodeBaseDeserializer = (languageBases: ILanguageBase[], handleDelta?: DeltaHandler): Deserializer<INodeBase[]> => {
223
225
  const deserializerWithIdMapping = nodeBaseDeserializerWithIdMapping(languageBases, handleDelta);
224
226
  return (
225
- serializationChunk: LionWebJsonChunk,
227
+ serializationChunk: SerializationChunk,
226
228
  dependentNodes: INodeBase[] = [],
227
229
  primitiveTypeDeserializer: PrimitiveTypeDeserializer = new DefaultPrimitiveTypeDeserializer(),
228
230
  problemsHandler: SimplisticHandler = defaultSimplisticHandler
package/src/duplicator.ts CHANGED
@@ -15,14 +15,12 @@
15
15
  // SPDX-FileCopyrightText: 2025 TRUMPF Laser SE and other contributors
16
16
  // SPDX-License-Identifier: Apache-2.0
17
17
 
18
- import { Containment, Feature, idOf, Link, Property, Reference, SingleRef, unresolved } from "@lionweb/core"
19
- import { LionWebId } from "@lionweb/json"
20
- import { asArray } from "@lionweb/ts-utils"
18
+ import {asArray, Containment, Feature, Id, idOf, Link, Property, Reference, SingleRef, unresolved} from "@lionweb/core";
21
19
 
22
- import { INodeBase } from "./base-types.js"
23
- import { allNodesFrom } from "./convenience.js"
24
- import { NodesToInstall } from "./linking.js"
25
- import { getFeatureValue } from "./serializer.js"
20
+ import {INodeBase} from "./base-types.js";
21
+ import {NodesToInstall} from "./linking.js";
22
+ import {getFeatureValue} from "./serializer.js";
23
+ import {allNodesFrom} from "./convenience.js";
26
24
 
27
25
 
28
26
  /**
@@ -47,7 +45,7 @@ export const deepDuplicateWith = (duplicateNode: NodeDuplicator): Duplicator =>
47
45
 
48
46
  const nodesToInstall: NodesToInstall[] = [];
49
47
 
50
- const visit = (node: INodeBase): [id: LionWebId, duplicatedNode: INodeBase] => {
48
+ const visit = (node: INodeBase): [id: Id, duplicatedNode: INodeBase] => {
51
49
  const [duplicatedNode, featuresToDuplicate] = duplicateNode(node);
52
50
  const duplicateFeatureValue = (feature: Feature) => {
53
51
  const value = getFeatureValue(node, feature);
package/src/id-mapping.ts CHANGED
@@ -15,12 +15,12 @@
15
15
  // SPDX-FileCopyrightText: 2025 TRUMPF Laser SE and other contributors
16
16
  // SPDX-License-Identifier: Apache-2.0
17
17
 
18
- import { IdOrUnresolved, SingleRef, unresolved } from "@lionweb/core"
19
- import { LionWebId } from "@lionweb/json"
18
+ import {Id, IdOrUnresolved, SingleRef, unresolved} from "@lionweb/core";
20
19
 
21
- import { INodeBase } from "./index.js"
20
+ import {INodeBase} from "./index.js";
22
21
 
23
- type NodesById = { [id: LionWebId]: INodeBase }
22
+
23
+ type NodesById = { [id: Id]: INodeBase};
24
24
 
25
25
 
26
26
  /**
@@ -35,18 +35,22 @@ export class IdMapping {
35
35
  this.nodesById = {...nodesById};
36
36
  }
37
37
 
38
- fromId(id: LionWebId): INodeBase {
38
+ fromId(id: Id): INodeBase {
39
39
  if (!(id in this.nodesById)) {
40
40
  throw new Error(`node with id=${id} not in ID mapping`);
41
41
  }
42
42
  return this.nodesById[id];
43
43
  }
44
44
 
45
- fromRefId(idOrUnresolved: IdOrUnresolved): SingleRef<INodeBase> {
46
- return idOrUnresolved === null
45
+ tryFromId = (id: Id): (INodeBase | undefined) =>
46
+ id in this.nodesById
47
+ ? this.nodesById[id]
48
+ : undefined;
49
+
50
+ fromRefId = (idOrUnresolved: IdOrUnresolved): SingleRef<INodeBase> =>
51
+ idOrUnresolved === null
47
52
  ? null
48
53
  : (this.nodesById[idOrUnresolved] ?? unresolved);
49
- }
50
54
 
51
55
  updateWith(node: INodeBase) {
52
56
  this.nodesById[node.id] = node;
package/src/linking.ts CHANGED
@@ -15,9 +15,8 @@
15
15
  // SPDX-FileCopyrightText: 2025 TRUMPF Laser SE and other contributors
16
16
  // SPDX-License-Identifier: Apache-2.0
17
17
 
18
- import { Link } from "@lionweb/core"
19
- import { LionWebId } from "@lionweb/json"
20
- import { INodeBase } from "./index.js"
18
+ import {Id, Link} from "@lionweb/core";
19
+ import {INodeBase} from "./index.js";
21
20
 
22
21
 
23
22
  /**
@@ -36,5 +35,5 @@ import { INodeBase } from "./index.js"
36
35
  * Note: **DON'T** export this types from the package,
37
36
  * as these are only used to align the deserializer and deep-cloner.
38
37
  */
39
- export type NodesToInstall = [ container: INodeBase, feature: Link | null, nodesIds: LionWebId[], originalReferenceTargets?: INodeBase[] ];
38
+ export type NodesToInstall = [ container: INodeBase, feature: Link | null, nodesIds: Id[], originalReferenceTargets?: INodeBase[] ];
40
39
 
@@ -31,16 +31,13 @@ import {
31
31
  Classifier,
32
32
  Concept,
33
33
  EnumerationLiteral,
34
+ Id,
34
35
  Interface,
35
36
  Language,
36
37
  PrimitiveType,
37
38
  Property
38
39
  } from "@lionweb/core";
39
40
 
40
- import {
41
- LionWebId
42
- } from "@lionweb/json";
43
-
44
41
  import {
45
42
  DeltaHandler,
46
43
  ILanguageBase,
@@ -111,7 +108,7 @@ export class LionCore_builtinsBase implements ILanguageBase {
111
108
  }
112
109
 
113
110
  factory(_handleDelta?: DeltaHandler): NodeBaseFactory {
114
- return (classifier: Classifier, _id: LionWebId) => {
111
+ return (classifier: Classifier, _id: Id) => {
115
112
  const {language} = classifier;
116
113
  throw new Error(`can't instantiate ${classifier.name} (key=${classifier.key}): classifier is not known in language ${language.name} (key=${language.key}, version=${language.version})`);
117
114
  }
package/src/serializer.ts CHANGED
@@ -25,9 +25,9 @@ import {
25
25
  Property,
26
26
  Reference,
27
27
  serializeNodes
28
- } from "@lionweb/core"
28
+ } from "@lionweb/core";
29
29
 
30
- import { INodeBase, LionCore_builtinsBase } from "./index.js"
30
+ import {INodeBase, LionCore_builtinsBase} from "./index.js";
31
31
 
32
32
 
33
33
  /**
@@ -79,7 +79,7 @@ export const nodeBaseReader: ExtractionFacade<INodeBase> = {
79
79
  };
80
80
 
81
81
  /**
82
- * @return a serialization of the given nodes (of type {@link INodeBase}) as a {@link LionWebJsonChunk}.
82
+ * @return a serialization of the given nodes (of type {@link INodeBase}) as a {@link SerializationChunk}.
83
83
  */
84
84
  export const serializeNodeBases = (nodes: INodeBase[]) =>
85
85
  serializeNodes(nodes, nodeBaseReader, { serializeEmptyFeatures: false });
@@ -15,11 +15,12 @@
15
15
  // SPDX-FileCopyrightText: 2025 TRUMPF Laser SE and other contributors
16
16
  // SPDX-License-Identifier: Apache-2.0
17
17
 
18
- import { allFeaturesOf, Containment, Feature, Property, Reference, unresolved } from "@lionweb/core"
19
- import { asString, indentWith, Template } from "littoral-templates"
18
+ import {asString, indentWith, Template} from "littoral-templates"
19
+ import {allFeaturesOf, Containment, Feature, Property, Reference, unresolved} from "@lionweb/core"
20
+
21
+ import {INodeBase} from "./base-types.js";
22
+ import {LionCore_builtinsBase} from "./lionCore_builtins.g.js";
20
23
 
21
- import { INodeBase } from "./base-types.js"
22
- import { LionCore_builtinsBase } from "./lionCore_builtins.g.js"
23
24
 
24
25
  const indent = indentWith(" ")(1)
25
26
 
@@ -15,17 +15,17 @@
15
15
  // SPDX-FileCopyrightText: 2025 TRUMPF Laser SE and other contributors
16
16
  // SPDX-License-Identifier: Apache-2.0
17
17
 
18
- import { action, observable } from "mobx"
18
+ import {action, observable} from "mobx";
19
19
 
20
- import { INodeBase, removeFromParent } from "../base-types.js"
20
+ import {INodeBase, removeFromParent} from "../base-types.js";
21
+ import {checkIndex, ValueManager} from "./base.js";
21
22
  import {
22
23
  AnnotationAddedDelta,
23
24
  AnnotationDeletedDelta,
24
25
  AnnotationMovedFromOtherParentDelta,
25
26
  AnnotationMovedInSameParentDelta,
26
27
  AnnotationReplacedDelta
27
- } from "../deltas/index.js"
28
- import { checkIndex, ValueManager } from "./base.js"
28
+ } from "../deltas/index.js";
29
29
 
30
30
 
31
31
  /**
@@ -15,9 +15,9 @@
15
15
  // SPDX-FileCopyrightText: 2025 TRUMPF Laser SE and other contributors
16
16
  // SPDX-License-Identifier: Apache-2.0
17
17
 
18
- import { Feature, featureMetaType, Link } from "@lionweb/core"
19
- import { INodeBase } from "../base-types.js"
20
- import { IDelta } from "../deltas/index.js"
18
+ import {Feature, featureMetaType, Link} from "@lionweb/core";
19
+ import {INodeBase} from "../base-types.js";
20
+ import {IDelta} from "../deltas/index.js";
21
21
 
22
22
 
23
23
  /**
@@ -15,12 +15,18 @@
15
15
  // SPDX-FileCopyrightText: 2025 TRUMPF Laser SE and other contributors
16
16
  // SPDX-License-Identifier: Apache-2.0
17
17
 
18
- import { Containment } from "@lionweb/core"
19
- import { action, observable } from "mobx"
20
-
21
- import { INodeBase, removeFromParent } from "../base-types.js"
22
- import { ChildAddedDelta, ChildDeletedDelta, ChildMovedDelta, ChildMovedInSameContainmentDelta, ChildReplacedDelta } from "../deltas/index.js"
23
- import { checkIndex, FeatureValueManager } from "./base.js"
18
+ import {Containment} from "@lionweb/core";
19
+ import {action, observable} from "mobx";
20
+
21
+ import {INodeBase, removeFromParent} from "../base-types.js";
22
+ import {checkIndex, FeatureValueManager} from "./base.js";
23
+ import {
24
+ ChildAddedDelta,
25
+ ChildDeletedDelta,
26
+ ChildMovedDelta,
27
+ ChildMovedInSameContainmentDelta,
28
+ ChildReplacedDelta
29
+ } from "../deltas/index.js";
24
30
 
25
31
 
26
32
  /**
@@ -15,12 +15,12 @@
15
15
  // SPDX-FileCopyrightText: 2025 TRUMPF Laser SE and other contributors
16
16
  // SPDX-License-Identifier: Apache-2.0
17
17
 
18
- import { Property } from "@lionweb/core"
19
- import { action, IObservableValue, observable } from "mobx"
20
- import { INodeBase } from "../base-types.js"
21
- import { PropertyAddedDelta, PropertyChangedDelta, PropertyDeletedDelta } from "../deltas/index.js"
18
+ import {Property} from "@lionweb/core";
19
+ import {action, IObservableValue, observable} from "mobx";
22
20
 
23
- import { FeatureValueManager } from "./base.js"
21
+ import {FeatureValueManager} from "./base.js";
22
+ import {INodeBase} from "../base-types.js";
23
+ import {PropertyAddedDelta, PropertyChangedDelta, PropertyDeletedDelta} from "../deltas/index.js";
24
24
 
25
25
 
26
26
  /**