@lionweb/core 0.8.0-beta.5 → 0.8.0-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.
- package/CHANGELOG.md +31 -5
- package/dist/deserializer.d.ts +10 -2
- package/dist/deserializer.d.ts.map +1 -1
- package/dist/deserializer.js +8 -7
- package/dist/deserializer.js.map +1 -1
- package/dist/dynamic-facade.d.ts +3 -3
- package/dist/dynamic-facade.d.ts.map +1 -1
- package/dist/dynamic-facade.js +4 -3
- package/dist/dynamic-facade.js.map +1 -1
- package/dist/extraction.d.ts +2 -2
- package/dist/extraction.d.ts.map +1 -1
- package/dist/extraction.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/m1/reference-utils.d.ts +3 -3
- package/dist/m1/reference-utils.d.ts.map +1 -1
- package/dist/m1/reference-utils.js.map +1 -1
- package/dist/m3/builtins-common.d.ts +70 -0
- package/dist/m3/builtins-common.d.ts.map +1 -0
- package/dist/m3/builtins-common.js +88 -0
- package/dist/m3/builtins-common.js.map +1 -0
- package/dist/m3/builtins-function.d.ts +9 -0
- package/dist/m3/builtins-function.d.ts.map +1 -0
- package/dist/m3/builtins-function.js +19 -0
- package/dist/m3/builtins-function.js.map +1 -0
- package/dist/m3/deserializer.d.ts +25 -0
- package/dist/m3/deserializer.d.ts.map +1 -1
- package/dist/m3/deserializer.js +18 -11
- package/dist/m3/deserializer.js.map +1 -1
- package/dist/m3/index.d.ts +7 -3
- package/dist/m3/index.d.ts.map +1 -1
- package/dist/m3/index.js +6 -3
- package/dist/m3/index.js.map +1 -1
- package/dist/m3/lioncore-common.d.ts +37 -0
- package/dist/m3/lioncore-common.d.ts.map +1 -0
- package/dist/m3/lioncore-common.js +10 -0
- package/dist/m3/lioncore-common.js.map +1 -0
- package/dist/m3/reading-writing.d.ts +41 -0
- package/dist/m3/reading-writing.d.ts.map +1 -0
- package/dist/m3/reading-writing.js +84 -0
- package/dist/m3/reading-writing.js.map +1 -0
- package/dist/m3/serializer.d.ts +17 -0
- package/dist/m3/serializer.d.ts.map +1 -1
- package/dist/m3/serializer.js +11 -2
- package/dist/m3/serializer.js.map +1 -1
- package/dist/m3/symbol-table.d.ts +3 -3
- package/dist/m3/types.d.ts +11 -15
- package/dist/m3/types.d.ts.map +1 -1
- package/dist/m3/types.js +2 -6
- package/dist/m3/types.js.map +1 -1
- package/dist/m3/version.d.ts +19 -0
- package/dist/m3/version.d.ts.map +1 -0
- package/dist/m3/version.js +19 -0
- package/dist/m3/version.js.map +1 -0
- package/dist/m3/versions/v2023_1/builtins-legacy.d.ts +44 -0
- package/dist/m3/versions/v2023_1/builtins-legacy.d.ts.map +1 -0
- package/dist/m3/{builtins.js → versions/v2023_1/builtins-legacy.js} +24 -79
- package/dist/m3/versions/v2023_1/builtins-legacy.js.map +1 -0
- package/dist/m3/versions/v2023_1/builtins.d.ts +34 -0
- package/dist/m3/versions/v2023_1/builtins.d.ts.map +1 -0
- package/dist/m3/versions/v2023_1/builtins.js +75 -0
- package/dist/m3/versions/v2023_1/builtins.js.map +1 -0
- package/dist/m3/versions/v2023_1/lioncore.d.ts +34 -0
- package/dist/m3/versions/v2023_1/lioncore.d.ts.map +1 -0
- package/dist/m3/versions/v2023_1/lioncore.js +86 -0
- package/dist/m3/versions/v2023_1/lioncore.js.map +1 -0
- package/dist/m3/versions/v2023_1/version.d.ts +6 -0
- package/dist/m3/versions/v2023_1/version.d.ts.map +1 -0
- package/dist/m3/versions/v2023_1/version.js +8 -0
- package/dist/m3/versions/v2023_1/version.js.map +1 -0
- package/dist/m3/versions.d.ts +23 -0
- package/dist/m3/versions.d.ts.map +1 -0
- package/dist/m3/versions.js +24 -0
- package/dist/m3/versions.js.map +1 -0
- package/dist/reading.d.ts +10 -6
- package/dist/reading.d.ts.map +1 -1
- package/dist/serializer.d.ts +17 -6
- package/dist/serializer.d.ts.map +1 -1
- package/dist/serializer.js +4 -5
- package/dist/serializer.js.map +1 -1
- package/dist/writing.d.ts +3 -1
- package/dist/writing.d.ts.map +1 -1
- package/dist/writing.js.map +1 -1
- package/package.json +3 -3
- package/src/deserializer.ts +18 -14
- package/src/dynamic-facade.ts +4 -4
- package/src/extraction.ts +3 -3
- package/src/index.ts +0 -1
- package/src/m1/reference-utils.ts +6 -6
- package/src/m3/README.md +1 -1
- package/src/m3/builtins-common.ts +143 -0
- package/src/m3/builtins-function.ts +22 -0
- package/src/m3/deserializer.ts +43 -14
- package/src/m3/index.ts +7 -3
- package/src/m3/lioncore-common.ts +42 -0
- package/src/m3/reading-writing.ts +160 -0
- package/src/m3/serializer.ts +25 -2
- package/src/m3/symbol-table.ts +3 -3
- package/src/m3/types.ts +12 -18
- package/src/m3/version.ts +23 -0
- package/src/m3/versions/v2023_1/builtins-legacy.ts +126 -0
- package/src/m3/versions/v2023_1/builtins.ts +102 -0
- package/src/m3/{lioncore.ts → versions/v2023_1/lioncore.ts} +53 -76
- package/src/m3/versions/v2023_1/version.ts +9 -0
- package/src/m3/versions.ts +32 -0
- package/src/reading.ts +10 -6
- package/src/serializer.ts +26 -14
- package/src/writing.ts +3 -1
- package/dist/m3/builtins.d.ts +0 -82
- package/dist/m3/builtins.d.ts.map +0 -1
- package/dist/m3/builtins.js.map +0 -1
- package/dist/m3/facade.d.ts +0 -17
- package/dist/m3/facade.d.ts.map +0 -1
- package/dist/m3/facade.js +0 -58
- package/dist/m3/facade.js.map +0 -1
- package/dist/m3/lioncore.d.ts +0 -41
- package/dist/m3/lioncore.d.ts.map +0 -1
- package/dist/m3/lioncore.js +0 -90
- package/dist/m3/lioncore.js.map +0 -1
- package/dist/version.d.ts +0 -5
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js +0 -5
- package/dist/version.js.map +0 -1
- package/src/m3/builtins.ts +0 -198
- package/src/m3/facade.ts +0 -130
- package/src/version.ts +0 -5
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { lioncoreBuiltinsFacade } from "./builtins.js"
|
|
2
|
+
import { LanguageFactory } from "../../factory.js"
|
|
3
|
+
import { generatedLionCoreKeyFrom, LionCoreFacade } from "../../lioncore-common.js"
|
|
4
4
|
|
|
5
|
-
const lioncoreKey = "LionCore-M3"
|
|
6
5
|
|
|
7
6
|
const factory = new LanguageFactory(
|
|
8
7
|
"LionCore_M3",
|
|
9
|
-
|
|
10
|
-
(...names) => "-id-" + (names
|
|
11
|
-
|
|
8
|
+
"2023.1",
|
|
9
|
+
(...names) => "-id-" + generatedLionCoreKeyFrom(...names),
|
|
10
|
+
generatedLionCoreKeyFrom
|
|
12
11
|
)
|
|
13
12
|
/*
|
|
14
13
|
* ID: `-id-${key}`
|
|
@@ -17,28 +16,25 @@ const factory = new LanguageFactory(
|
|
|
17
16
|
|
|
18
17
|
/**
|
|
19
18
|
* Definition of LionCore in terms of itself.
|
|
19
|
+
*
|
|
20
|
+
* @deprecated Use `lioncoreFacade.language` instead.
|
|
20
21
|
*/
|
|
21
22
|
export const lioncore = factory.language.havingKey("LionCore-M3")
|
|
22
23
|
|
|
23
|
-
const { inamed } =
|
|
24
|
-
const { booleanDataType, stringDataType } =
|
|
24
|
+
const { inamed } = lioncoreBuiltinsFacade.classifiers
|
|
25
|
+
const { booleanDataType, stringDataType } = lioncoreBuiltinsFacade.primitiveTypes
|
|
25
26
|
|
|
26
27
|
const ikeyed = factory.interface("IKeyed").extending(inamed)
|
|
27
|
-
|
|
28
28
|
const ikeyed_key = factory.property(ikeyed, "key").ofType(stringDataType)
|
|
29
29
|
|
|
30
30
|
const feature = factory.concept("Feature", true).implementing(ikeyed)
|
|
31
|
-
|
|
32
|
-
const feature_optional = factory.property(feature, "optional").ofType(booleanDataType)
|
|
31
|
+
factory.property(feature, "optional").ofType(booleanDataType)
|
|
33
32
|
|
|
34
33
|
const property = factory.concept("Property", false, feature)
|
|
35
|
-
|
|
36
34
|
const property_type = factory.reference(property, "type")
|
|
37
35
|
|
|
38
36
|
const link = factory.concept("Link", true, feature)
|
|
39
|
-
|
|
40
|
-
const link_multiple = factory.property(link, "multiple").ofType(booleanDataType)
|
|
41
|
-
|
|
37
|
+
factory.property(link, "multiple").ofType(booleanDataType)
|
|
42
38
|
const link_type = factory.reference(link, "type")
|
|
43
39
|
|
|
44
40
|
const containment = factory.concept("Containment", false, link)
|
|
@@ -48,92 +44,73 @@ const reference = factory.concept("Reference", false, link)
|
|
|
48
44
|
const languageEntity = factory.concept("LanguageEntity", true).implementing(ikeyed)
|
|
49
45
|
|
|
50
46
|
const classifier = factory.concept("Classifier", true, languageEntity)
|
|
51
|
-
|
|
52
|
-
const classifier_features = factory.containment(classifier, "features").isOptional().isMultiple().ofType(feature)
|
|
53
|
-
|
|
47
|
+
factory.containment(classifier, "features").isOptional().isMultiple().ofType(feature)
|
|
54
48
|
link_type.ofType(classifier)
|
|
55
49
|
|
|
56
50
|
const annotation = factory.concept("Annotation", false, classifier)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const annotation_extends = factory.reference(annotation, "extends").isOptional().ofType(annotation)
|
|
61
|
-
|
|
51
|
+
factory.reference(annotation, "annotates").isOptional().ofType(classifier)
|
|
52
|
+
factory.reference(annotation, "extends").isOptional().ofType(annotation)
|
|
62
53
|
const annotation_implements = factory.reference(annotation, "implements").isMultiple().isOptional()
|
|
63
54
|
|
|
64
55
|
const concept = factory.concept("Concept", false, classifier)
|
|
65
|
-
|
|
66
56
|
const concept_abstract = factory.property(concept, "abstract").ofType(booleanDataType)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const concept_extends = factory.reference(concept, "extends").isOptional().ofType(concept)
|
|
71
|
-
|
|
57
|
+
factory.property(concept, "partition").ofType(booleanDataType)
|
|
58
|
+
factory.reference(concept, "extends").isOptional().ofType(concept)
|
|
72
59
|
const concept_implements = factory.reference(concept, "implements").isOptional().isMultiple()
|
|
73
60
|
|
|
74
61
|
const interface_ = factory.concept("Interface", false, classifier)
|
|
75
|
-
|
|
76
|
-
const interface_extends = factory.reference(interface_, "extends").isOptional().isMultiple().ofType(interface_)
|
|
62
|
+
factory.reference(interface_, "extends").isOptional().isMultiple().ofType(interface_)
|
|
77
63
|
|
|
78
64
|
annotation_implements.ofType(interface_)
|
|
79
65
|
concept_implements.ofType(interface_)
|
|
80
66
|
|
|
81
67
|
const dataType = factory.concept("DataType", true, languageEntity)
|
|
82
|
-
|
|
83
68
|
property_type.ofType(dataType)
|
|
84
69
|
|
|
85
70
|
const primitiveType = factory.concept("PrimitiveType", false, dataType)
|
|
86
71
|
|
|
87
72
|
const enumeration = factory.concept("Enumeration", false, dataType)
|
|
88
|
-
|
|
89
73
|
const enumeration_literals = factory.containment(enumeration, "literals").isMultiple().isOptional()
|
|
90
|
-
|
|
91
74
|
const enumerationLiteral = factory.concept("EnumerationLiteral", false).implementing(ikeyed)
|
|
92
|
-
|
|
93
75
|
enumeration_literals.ofType(enumerationLiteral)
|
|
94
76
|
|
|
95
77
|
const language = factory.concept("Language", false).implementing(ikeyed).isPartition()
|
|
96
|
-
|
|
97
78
|
const language_version = factory.property(language, "version").ofType(stringDataType)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
79
|
+
factory.containment(language, "entities").isOptional().isMultiple().ofType(languageEntity)
|
|
80
|
+
factory.reference(language, "dependsOn").isOptional().isMultiple().ofType(language)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
export const lioncoreFacade: LionCoreFacade = {
|
|
84
|
+
language: factory.language,
|
|
85
|
+
metaConcepts: {
|
|
86
|
+
annotation,
|
|
87
|
+
classifier,
|
|
88
|
+
concept,
|
|
89
|
+
interface: interface_,
|
|
90
|
+
containment,
|
|
91
|
+
enumeration,
|
|
92
|
+
enumerationLiteral,
|
|
93
|
+
ikeyed,
|
|
94
|
+
language,
|
|
95
|
+
primitiveType,
|
|
96
|
+
property,
|
|
97
|
+
reference
|
|
98
|
+
},
|
|
99
|
+
metaFeatures: {
|
|
100
|
+
concept_abstract,
|
|
101
|
+
ikeyed_key,
|
|
102
|
+
language_version
|
|
103
|
+
}
|
|
116
104
|
}
|
|
117
105
|
|
|
118
|
-
export const metaFeatures = {
|
|
119
|
-
annotation_annotates,
|
|
120
|
-
annotation_extends,
|
|
121
|
-
annotation_implements,
|
|
122
|
-
classifier_features,
|
|
123
|
-
concept_abstract,
|
|
124
|
-
concept_partition,
|
|
125
|
-
concept_extends,
|
|
126
|
-
concept_implements,
|
|
127
|
-
interface_extends,
|
|
128
|
-
enumeration_literals,
|
|
129
|
-
feature_optional,
|
|
130
|
-
ikeyed_key,
|
|
131
|
-
language_dependsOn,
|
|
132
|
-
language_entities,
|
|
133
|
-
language_version,
|
|
134
|
-
link_multiple,
|
|
135
|
-
link_type,
|
|
136
|
-
property_type
|
|
137
|
-
}
|
|
138
106
|
|
|
139
|
-
|
|
107
|
+
/**
|
|
108
|
+
* @deprecated Use `<LionWeb version>.lioncoreFacade.metaConcepts` instead.
|
|
109
|
+
*/
|
|
110
|
+
export const metaConcepts = lioncoreFacade.metaConcepts
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* @deprecated Use `<LionWeb version>.lioncoreFacade.metaFeatures` instead.
|
|
114
|
+
*/
|
|
115
|
+
export const metaFeatures = lioncoreFacade.metaFeatures
|
|
116
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { lioncoreBuiltinsFacade } from "./builtins.js"
|
|
2
|
+
import { lioncoreFacade } from "./lioncore.js"
|
|
3
|
+
import { LionWebVersion } from "../../version.js"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A representation of the 2023.1 LionWeb version.
|
|
7
|
+
*/
|
|
8
|
+
export const v2023_1 = new LionWebVersion("2023.1", lioncoreFacade, lioncoreBuiltinsFacade)
|
|
9
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { v2023_1 } from "./versions/v2023_1/version.js"
|
|
2
|
+
import { LionWebVersion } from "./version.js"
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The *current* release(d) version.
|
|
7
|
+
*
|
|
8
|
+
* @deprecated Use `LionWebVersions.v2023_1.serializationFormatVersion` instead.
|
|
9
|
+
*/
|
|
10
|
+
export const currentReleaseVersion = "2023.1"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* An enumeration (as const object) of all LionWeb versions currently supported by the WIP specification.
|
|
15
|
+
*/
|
|
16
|
+
export const LionWebVersions = {
|
|
17
|
+
// LionWeb standard version 2023.1 — defined at https://lionweb.io/specification/2023.1
|
|
18
|
+
v2023_1
|
|
19
|
+
} as const
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* All LionWeb versions.
|
|
23
|
+
*/
|
|
24
|
+
export const allLionWebVersions = Object.values(LionWebVersions)
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @return the {@link LionWebVersion} matching the given `serializationFormatVersion` string,
|
|
28
|
+
* or {@link undefined} if there’s none.
|
|
29
|
+
*/
|
|
30
|
+
export const lionWebVersionFrom = (serializationFormatVersion: string): LionWebVersion | undefined =>
|
|
31
|
+
allLionWebVersions.find((version) => version.serializationFormatVersion === serializationFormatVersion)
|
|
32
|
+
|
package/src/reading.ts
CHANGED
|
@@ -10,19 +10,21 @@ export type ClassifierDeducer<NT extends Node> = (node: NT) => Classifier
|
|
|
10
10
|
/**
|
|
11
11
|
* Type def. for functions that deduce the string value of the `resolveInfo` field of a
|
|
12
12
|
* {@link LionWebJsonReferenceTarget serialized reference target},
|
|
13
|
-
* or
|
|
13
|
+
* or `undefined` to indicate that no `resolveInfo` could be derived.
|
|
14
14
|
* The function’s arguments are the target {@link Node} and its containing {@link Reference}.
|
|
15
15
|
*/
|
|
16
16
|
export type ResolveInfoDeducer<NT extends Node> = (node: NT, reference: Reference) => string | undefined
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* An interface that's used to parametrize generic serialization of
|
|
20
|
-
* (in-memory) nodes of the given type (parameter)
|
|
20
|
+
* (in-memory) nodes of the given type (parameter) `NT`.
|
|
21
21
|
* Implementations of these interfaces {w|c}ould be:
|
|
22
22
|
* - specific to LionCore (so to match m3/types.ts)
|
|
23
23
|
* - generic to serialize {@link DynamicNode dynamic nodes}
|
|
24
|
+
* The `RT` type (parameter) is the type of any *referenced* node,
|
|
25
|
+
* which could e.g. be wider – most likely – or narrower than `NT`.
|
|
24
26
|
*/
|
|
25
|
-
export interface Reader<NT extends Node> {
|
|
27
|
+
export interface Reader<NT extends Node, RT extends Node = NT> {
|
|
26
28
|
|
|
27
29
|
/**
|
|
28
30
|
* @return The {@link Concept concept} of the given node
|
|
@@ -43,14 +45,16 @@ export interface Reader<NT extends Node> {
|
|
|
43
45
|
|
|
44
46
|
/**
|
|
45
47
|
* @return The string value of the `resolveInfo` field of a {@link LionWebJsonReferenceTarget serialized reference target},
|
|
46
|
-
* or
|
|
48
|
+
* or `undefined` to indicate that no `resolveInfo` could be derived.
|
|
47
49
|
*/
|
|
48
|
-
resolveInfoFor?: ResolveInfoDeducer<
|
|
50
|
+
resolveInfoFor?: ResolveInfoDeducer<RT>
|
|
49
51
|
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
/**
|
|
53
55
|
* Alias for {@link Reader}, kept for backward compatibility, and to be deprecated and removed later.
|
|
56
|
+
*
|
|
57
|
+
* @deprecated Use {@link Reader} instead.
|
|
54
58
|
*/
|
|
55
|
-
export interface ExtractionFacade<NT extends Node> extends Reader<NT> {}
|
|
59
|
+
export interface ExtractionFacade<NT extends Node, RT extends Node> extends Reader<NT, RT> {}
|
|
56
60
|
|
package/src/serializer.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LionWebId, LionWebJsonChunk, LionWebJsonNode } from "@lionweb/json"
|
|
2
2
|
import { asArray, keepDefineds, lazyMapGet, Nested3Map, uniquesAmong } from "@lionweb/ts-utils"
|
|
3
3
|
import { asIds, metaPointerFor } from "./functions.js"
|
|
4
4
|
import { Reader } from "./reading.js"
|
|
5
5
|
import { Node } from "./types.js"
|
|
6
|
-
import { builtinPropertyValueSerializer } from "./m3/builtins.js"
|
|
7
6
|
import { inheritsDirectlyFrom } from "./m3/functions.js"
|
|
8
7
|
import {
|
|
9
8
|
Classifier,
|
|
@@ -16,6 +15,8 @@ import {
|
|
|
16
15
|
Reference,
|
|
17
16
|
simpleNameDeducer
|
|
18
17
|
} from "./m3/types.js"
|
|
18
|
+
import { LionWebVersion } from "./m3/version.js"
|
|
19
|
+
import { LionWebVersions } from "./m3/versions.js"
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
/**
|
|
@@ -33,6 +34,8 @@ export interface PropertyValueSerializer {
|
|
|
33
34
|
|
|
34
35
|
/**
|
|
35
36
|
* Misspelled alias of {@link PropertyValueSerializer}, kept for backward compatibility, and to be deprecated and removed later.
|
|
37
|
+
*
|
|
38
|
+
* @deprecated Use {@link PropertyValueSerializer} instead.
|
|
36
39
|
*/
|
|
37
40
|
export interface PrimitiveTypeSerializer extends PropertyValueSerializer {}
|
|
38
41
|
|
|
@@ -56,12 +59,15 @@ export type SerializationOptions = Partial<{
|
|
|
56
59
|
|
|
57
60
|
/**
|
|
58
61
|
* A {@link PropertyValueSerializer} implementation.
|
|
59
|
-
* Default = {@link
|
|
62
|
+
* Default = the value of the `propertyValueSerializer` property of the {@link LionWebVersion version} of the LionWeb serialization format,
|
|
63
|
+
* configured through `SerializerConfiguration.lionWebVersion` (which itself defaults to `LionWebVersions.v2023_1`).
|
|
60
64
|
*/
|
|
61
65
|
propertyValueSerializer: PropertyValueSerializer
|
|
62
66
|
|
|
63
67
|
/**
|
|
64
68
|
* Misspelled alias of {@link #propertyValueSerializer}, kept for backward compatibility, and to be deprecated and removed later.
|
|
69
|
+
*
|
|
70
|
+
* @deprecated Use {@link propertyValueSerializer} instead.
|
|
65
71
|
*/
|
|
66
72
|
primitiveTypeSerializer: PropertyValueSerializer
|
|
67
73
|
|
|
@@ -75,11 +81,17 @@ export type SerializationOptions = Partial<{
|
|
|
75
81
|
* and `primitiveTypeSerializer` (which is a legacy alias for `propertyValueSerializer`)
|
|
76
82
|
* properties are optional, with defined defaults.
|
|
77
83
|
*/
|
|
78
|
-
export type SerializerConfiguration<NT extends Node> = {
|
|
84
|
+
export type SerializerConfiguration<NT extends Node, RT extends Node = NT> = {
|
|
79
85
|
/**
|
|
80
86
|
* An interface with functions to “read” – i.e., introspect – nodes.
|
|
81
87
|
*/
|
|
82
|
-
reader: Reader<NT>
|
|
88
|
+
reader: Reader<NT, RT>
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* The version of the LionWeb serialization format to serialize in.
|
|
92
|
+
* Default = {@link LionWebVersions.v2023_1}.
|
|
93
|
+
*/
|
|
94
|
+
lionWebVersion?: LionWebVersion
|
|
83
95
|
} & SerializationOptions
|
|
84
96
|
|
|
85
97
|
|
|
@@ -90,7 +102,7 @@ export type SerializerConfiguration<NT extends Node> = {
|
|
|
90
102
|
*
|
|
91
103
|
* This is a legacy version of {@link serializerWith}, kept for backward compatibility, and to be deprecated and removed later.
|
|
92
104
|
*/
|
|
93
|
-
export const nodeSerializer = <NT extends Node>(reader: Reader<NT>, serializationOptions?: SerializationOptions): Serializer<NT> =>
|
|
105
|
+
export const nodeSerializer = <NT extends Node, RT extends Node = NT>(reader: Reader<NT, RT>, serializationOptions?: SerializationOptions): Serializer<NT> =>
|
|
94
106
|
serializerWith({ reader, ...serializationOptions })
|
|
95
107
|
|
|
96
108
|
|
|
@@ -98,10 +110,11 @@ export const nodeSerializer = <NT extends Node>(reader: Reader<NT>, serializatio
|
|
|
98
110
|
* @return a {@link Serializer} function that serializes the {@link Node nodes} passed to it,
|
|
99
111
|
* configured through a `configuration` {@link SerializerConfiguration} object.
|
|
100
112
|
*/
|
|
101
|
-
export const serializerWith = <NT extends Node>(configuration: SerializerConfiguration<NT>): Serializer<NT> => {
|
|
113
|
+
export const serializerWith = <NT extends Node, RT extends Node = NT>(configuration: SerializerConfiguration<NT, RT>): Serializer<NT> => {
|
|
102
114
|
const { reader } = configuration
|
|
115
|
+
const lionWebVersion = configuration?.lionWebVersion ?? LionWebVersions.v2023_1
|
|
103
116
|
const propertyValueSerializer =
|
|
104
|
-
configuration.propertyValueSerializer ?? configuration.primitiveTypeSerializer ??
|
|
117
|
+
configuration.propertyValueSerializer ?? configuration.primitiveTypeSerializer ?? lionWebVersion.builtinsFacade.propertyValueSerializer
|
|
105
118
|
const serializeEmptyFeatures = configuration.serializeEmptyFeatures ?? true
|
|
106
119
|
|
|
107
120
|
const languageKey2version2classifierKey2allFeatures: Nested3Map<Feature[]> = {}
|
|
@@ -205,14 +218,13 @@ export const serializerWith = <NT extends Node>(configuration: SerializerConfigu
|
|
|
205
218
|
}
|
|
206
219
|
if (feature instanceof Reference) {
|
|
207
220
|
// Note: value can be null === typeof unresolved, e.g. on an unset (or previously unresolved) single-valued reference
|
|
208
|
-
const targets = asArray(value) as (
|
|
221
|
+
const targets = asArray(value) as (RT | null)[]
|
|
209
222
|
if (targets.length === 0 && !serializeEmptyFeatures) {
|
|
210
223
|
return
|
|
211
224
|
}
|
|
212
225
|
serializedNode.references.push({
|
|
213
226
|
reference: featureMetaPointer,
|
|
214
227
|
targets: keepDefineds(targets) // (skip "non-connected" targets)
|
|
215
|
-
.map(t => t as NT)
|
|
216
228
|
.map(t => ({
|
|
217
229
|
resolveInfo:
|
|
218
230
|
(reader.resolveInfoFor ? reader.resolveInfoFor(t, feature) : simpleNameDeducer(t, feature)) ?? null,
|
|
@@ -233,7 +245,7 @@ export const serializerWith = <NT extends Node>(configuration: SerializerConfigu
|
|
|
233
245
|
nodes.forEach(node => visit(node, undefined))
|
|
234
246
|
|
|
235
247
|
return {
|
|
236
|
-
serializationFormatVersion:
|
|
248
|
+
serializationFormatVersion: lionWebVersion.serializationFormatVersion,
|
|
237
249
|
languages: languagesUsed.map(({ key, version }) => ({ key, version })),
|
|
238
250
|
nodes: serializedNodes
|
|
239
251
|
}
|
|
@@ -244,12 +256,12 @@ export const serializerWith = <NT extends Node>(configuration: SerializerConfigu
|
|
|
244
256
|
* @return a {@link LionWebJsonChunk} of the given model (i.e., an array of {@link Node nodes} - the first argument) to the LionWeb serialization JSON format.
|
|
245
257
|
* *Note:* this function will be deprecated and removed later — use {@link nodeSerializer} instead.
|
|
246
258
|
*/
|
|
247
|
-
export const serializeNodes = <NT extends Node>(
|
|
259
|
+
export const serializeNodes = <NT extends Node, RT extends Node = NT>(
|
|
248
260
|
nodes: NT[],
|
|
249
|
-
reader: Reader<NT>,
|
|
261
|
+
reader: Reader<NT, RT>,
|
|
250
262
|
propertyValueSerializerOrOptions?: PropertyValueSerializer | SerializationOptions
|
|
251
263
|
): LionWebJsonChunk =>
|
|
252
|
-
nodeSerializer<NT>(
|
|
264
|
+
nodeSerializer<NT, RT>(
|
|
253
265
|
reader,
|
|
254
266
|
isPropertyValueSerializer(propertyValueSerializerOrOptions)
|
|
255
267
|
? {
|
package/src/writing.ts
CHANGED
|
@@ -23,7 +23,7 @@ export interface Writer<NT extends Node, PNT extends Node = NT> {
|
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Sets the *single* given value of the indicated {@link Feature} on the given node.
|
|
26
|
-
* This means adding it in case the feature is multi-valued, meaning it is a {@link Link} with
|
|
26
|
+
* This means adding it in case the feature is multi-valued, meaning it is a {@link Link} with `multiple = true`.
|
|
27
27
|
*/
|
|
28
28
|
setFeatureValue: (node: NT, feature: Feature, value: unknown) => void
|
|
29
29
|
// TODO split to setPropertyValue, &c.?
|
|
@@ -37,6 +37,8 @@ export interface Writer<NT extends Node, PNT extends Node = NT> {
|
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* Alias for {@link Writer}, kept for backward compatibility, and to be deprecated and removed later.
|
|
40
|
+
*
|
|
41
|
+
* @deprecated Use {@link Writer} instead.
|
|
40
42
|
*/
|
|
41
43
|
export interface InstantiationFacade<NT extends Node, PNT extends Node = NT> extends Writer<NT, PNT> {}
|
|
42
44
|
|
package/dist/m3/builtins.d.ts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { PropertyValueDeserializer } from "../deserializer.js";
|
|
2
|
-
import { PropertyValueSerializer } from "../serializer.js";
|
|
3
|
-
import { Classifier, Concept, DataType, Property } from "./types.js";
|
|
4
|
-
/**
|
|
5
|
-
* Definition of a LionCore language that serves as a standard library of built-in primitive types.
|
|
6
|
-
*/
|
|
7
|
-
declare const lioncoreBuiltins: import("./types.js").Language;
|
|
8
|
-
declare const isBuiltinNodeConcept: (classifier: Classifier) => boolean;
|
|
9
|
-
declare const builtinPrimitives: {
|
|
10
|
-
stringDataType: import("./types.js").PrimitiveType;
|
|
11
|
-
booleanDataType: import("./types.js").PrimitiveType;
|
|
12
|
-
integerDataType: import("./types.js").PrimitiveType;
|
|
13
|
-
jsonDataType: import("./types.js").PrimitiveType;
|
|
14
|
-
/**
|
|
15
|
-
* Misspelled alias of {@link stringDataType}, kept for backward compatibility, and to be deprecated and removed later.
|
|
16
|
-
*/
|
|
17
|
-
stringDatatype: import("./types.js").PrimitiveType;
|
|
18
|
-
/**
|
|
19
|
-
* Misspelled alias of {@link booleanDataType}, kept for backward compatibility, and to be deprecated and removed later.
|
|
20
|
-
*/
|
|
21
|
-
booleanDatatype: import("./types.js").PrimitiveType;
|
|
22
|
-
/**
|
|
23
|
-
* Misspelled alias of {@link integerDataType}, kept for backward compatibility, and to be deprecated and removed later.
|
|
24
|
-
*/
|
|
25
|
-
integerDatatype: import("./types.js").PrimitiveType;
|
|
26
|
-
/**
|
|
27
|
-
* Misspelled alias of {@link jsonDataType}, kept for backward compatibility, and to be deprecated and removed later.
|
|
28
|
-
*/
|
|
29
|
-
jsonDatatype: import("./types.js").PrimitiveType;
|
|
30
|
-
};
|
|
31
|
-
declare const builtinClassifiers: {
|
|
32
|
-
node: Concept;
|
|
33
|
-
inamed: import("./types.js").Interface;
|
|
34
|
-
};
|
|
35
|
-
declare const builtinFeatures: {
|
|
36
|
-
inamed_name: Property;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Determines whether two data types should be structurally equal based on equality of: meta type, key, and language's key.
|
|
40
|
-
*/
|
|
41
|
-
declare const shouldBeIdentical: (left: DataType, right: DataType) => boolean;
|
|
42
|
-
declare abstract class DataTypeRegister<T> {
|
|
43
|
-
private map;
|
|
44
|
-
private _sealed;
|
|
45
|
-
sealed(): this;
|
|
46
|
-
register(dataType: DataType, t: T): void;
|
|
47
|
-
protected byType(targetDataType: DataType): T | undefined;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* An implementation of {@link PropertyValueDeserializer} that knows how to deserialize serialized values of all the built-in primitive types.
|
|
51
|
-
*/
|
|
52
|
-
export declare class BuiltinPropertyValueDeserializer extends DataTypeRegister<(value: string) => unknown> implements PropertyValueDeserializer {
|
|
53
|
-
constructor();
|
|
54
|
-
deserializeValue(value: string | undefined, property: Property): unknown | undefined;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Singleton instance of {@link BuiltinPropertyValueDeserializer}.
|
|
58
|
-
*/
|
|
59
|
-
export declare const builtinPropertyValueDeserializer: BuiltinPropertyValueDeserializer;
|
|
60
|
-
/**
|
|
61
|
-
* Misspelled alias of {@link BuiltinPropertyValueDeserializer}, kept for backward compatibility, and to be deprecated and removed later.
|
|
62
|
-
*/
|
|
63
|
-
export declare class DefaultPrimitiveTypeDeserializer extends BuiltinPropertyValueDeserializer {
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* An implementation of {@link PropertyValueSerializer} that knows how to serialize values of all the built-in primitive types.
|
|
67
|
-
*/
|
|
68
|
-
export declare class BuiltinPropertyValueSerializer extends DataTypeRegister<(value: unknown) => string> implements PropertyValueSerializer {
|
|
69
|
-
constructor();
|
|
70
|
-
serializeValue(value: unknown | undefined, property: Property): string | null;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Singleton instance of {@link BuiltinPropertyValueSerializer}.
|
|
74
|
-
*/
|
|
75
|
-
export declare const builtinPropertyValueSerializer: BuiltinPropertyValueSerializer;
|
|
76
|
-
/**
|
|
77
|
-
* Misspelled alias of {@link BuiltinPropertyValueSerializer}, kept for backward compatibility, and to be deprecated and removed later.
|
|
78
|
-
*/
|
|
79
|
-
export declare class DefaultPrimitiveTypeSerializer extends BuiltinPropertyValueSerializer {
|
|
80
|
-
}
|
|
81
|
-
export { builtinPrimitives, builtinClassifiers, builtinFeatures, isBuiltinNodeConcept, lioncoreBuiltins, shouldBeIdentical };
|
|
82
|
-
//# sourceMappingURL=builtins.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"builtins.d.ts","sourceRoot":"","sources":["../../src/m3/builtins.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAA;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAG1D,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAuB,QAAQ,EAAE,MAAM,YAAY,CAAA;AAezF;;GAEG;AACH,QAAA,MAAM,gBAAgB,+BAAmB,CAAA;AASzC,QAAA,MAAM,oBAAoB,GAAI,YAAY,UAAU,YAKhB,CAAA;AAMpC,QAAA,MAAM,iBAAiB;;;;;IAKnB;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;CAEN,CAAA;AAED,QAAA,MAAM,kBAAkB;;;CAGvB,CAAA;AAED,QAAA,MAAM,eAAe;;CAEpB,CAAA;AAED;;GAEG;AACH,QAAA,MAAM,iBAAiB,G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,eAAe,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,CAAA"}
|
package/dist/m3/facade.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Reader } from "../reading.js";
|
|
2
|
-
import { M3Concept } from "./types.js";
|
|
3
|
-
import { Writer } from "../writing.js";
|
|
4
|
-
export declare const lioncoreReader: Reader<M3Concept>;
|
|
5
|
-
/**
|
|
6
|
-
* Alias for {@link lioncoreReader}, kept for backward compatibility, and to be deprecated and removed later.
|
|
7
|
-
*/
|
|
8
|
-
export declare const lioncoreExtractionFacade: Reader<M3Concept>;
|
|
9
|
-
/**
|
|
10
|
-
* @return An implementation of {@link Writer} for instances of the LionCore M3 (so M2s).
|
|
11
|
-
*/
|
|
12
|
-
export declare const lioncoreWriter: Writer<M3Concept>;
|
|
13
|
-
/**
|
|
14
|
-
* Alias for {@link lioncoreWriter}, kept for backward compatibility, and to be deprecated and removed later.
|
|
15
|
-
*/
|
|
16
|
-
export declare const lioncoreInstantationFacade: Writer<M3Concept, M3Concept>;
|
|
17
|
-
//# sourceMappingURL=facade.d.ts.map
|
package/dist/m3/facade.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"facade.d.ts","sourceRoot":"","sources":["../../src/m3/facade.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EASH,SAAS,EAIZ,MAAM,YAAY,CAAA;AACnB,OAAO,EAA2B,MAAM,EAAE,MAAM,eAAe,CAAA;AAK/D,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,SAAS,CAM5C,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB,mBAAiB,CAAA;AAEtD;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,SAAS,CAoF5C,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,0BAA0B,8BAAiB,CAAA"}
|
package/dist/m3/facade.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { builtinFeatures } from "./builtins.js";
|
|
2
|
-
import { metaTypedBasedClassifierDeducerFor, qualifiedNameOf } from "./functions.js";
|
|
3
|
-
import { lioncore, metaConcepts, metaFeatures } from "./lioncore.js";
|
|
4
|
-
import { Annotation, Concept, Containment, Enumeration, EnumerationLiteral, Interface, Language, PrimitiveType, Property, Reference } from "./types.js";
|
|
5
|
-
import { updateSettingsNameBased } from "../writing.js";
|
|
6
|
-
const { inamed_name } = builtinFeatures;
|
|
7
|
-
const { ikeyed_key } = metaFeatures;
|
|
8
|
-
export const lioncoreReader = {
|
|
9
|
-
classifierOf: metaTypedBasedClassifierDeducerFor(lioncore),
|
|
10
|
-
getFeatureValue: (node, feature) =>
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
|
-
node[feature.name], // (mirrors name-based update of settings)
|
|
13
|
-
enumerationLiteralFrom: (value, _) => value
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Alias for {@link lioncoreReader}, kept for backward compatibility, and to be deprecated and removed later.
|
|
17
|
-
*/
|
|
18
|
-
export const lioncoreExtractionFacade = lioncoreReader;
|
|
19
|
-
/**
|
|
20
|
-
* @return An implementation of {@link Writer} for instances of the LionCore M3 (so M2s).
|
|
21
|
-
*/
|
|
22
|
-
export const lioncoreWriter = {
|
|
23
|
-
nodeFor: (parent, classifier, id, propertySettings) => {
|
|
24
|
-
switch (classifier.key) {
|
|
25
|
-
case metaConcepts.annotation.key:
|
|
26
|
-
return new Annotation(parent, propertySettings[inamed_name.key], propertySettings[ikeyed_key.key], id);
|
|
27
|
-
case metaConcepts.concept.key:
|
|
28
|
-
return new Concept(parent, propertySettings[inamed_name.key], propertySettings[ikeyed_key.key], id, propertySettings[metaFeatures.concept_abstract.key]);
|
|
29
|
-
case metaConcepts.interface.key:
|
|
30
|
-
return new Interface(parent, propertySettings[inamed_name.key], propertySettings[ikeyed_key.key], id);
|
|
31
|
-
case metaConcepts.containment.key:
|
|
32
|
-
return new Containment(parent, propertySettings[inamed_name.key], propertySettings[ikeyed_key.key], id);
|
|
33
|
-
case metaConcepts.enumeration.key:
|
|
34
|
-
return new Enumeration(parent, propertySettings[inamed_name.key], propertySettings[ikeyed_key.key], id);
|
|
35
|
-
case metaConcepts.enumerationLiteral.key:
|
|
36
|
-
return new EnumerationLiteral(parent, propertySettings[inamed_name.key], propertySettings[ikeyed_key.key], id);
|
|
37
|
-
case metaConcepts.language.key:
|
|
38
|
-
return new Language(propertySettings[inamed_name.key], propertySettings[metaFeatures.language_version.key], id, propertySettings[metaFeatures.ikeyed_key.key]);
|
|
39
|
-
case metaConcepts.primitiveType.key:
|
|
40
|
-
return new PrimitiveType(parent, propertySettings[inamed_name.key], propertySettings[ikeyed_key.key], id);
|
|
41
|
-
case metaConcepts.property.key:
|
|
42
|
-
return new Property(parent, propertySettings[inamed_name.key], propertySettings[ikeyed_key.key], id);
|
|
43
|
-
case metaConcepts.reference.key:
|
|
44
|
-
return new Reference(parent, propertySettings[inamed_name.key], propertySettings[ikeyed_key.key], id);
|
|
45
|
-
default:
|
|
46
|
-
throw new Error(`don't know a node of concept ${qualifiedNameOf(classifier)} with key ${classifier.key} that's not in LionCore M3`);
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
setFeatureValue: (node, feature, value) => {
|
|
50
|
-
updateSettingsNameBased(node, feature, value);
|
|
51
|
-
},
|
|
52
|
-
encodingOf: literal => literal
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* Alias for {@link lioncoreWriter}, kept for backward compatibility, and to be deprecated and removed later.
|
|
56
|
-
*/
|
|
57
|
-
export const lioncoreInstantationFacade = lioncoreWriter;
|
|
58
|
-
//# sourceMappingURL=facade.js.map
|
package/dist/m3/facade.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"facade.js","sourceRoot":"","sources":["../../src/m3/facade.ts"],"names":[],"mappings":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