@lionweb/core 0.8.0-beta.5 → 0.8.0-beta.6

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 (118) hide show
  1. package/CHANGELOG.md +27 -5
  2. package/dist/deserializer.d.ts +10 -2
  3. package/dist/deserializer.d.ts.map +1 -1
  4. package/dist/deserializer.js +8 -7
  5. package/dist/deserializer.js.map +1 -1
  6. package/dist/dynamic-facade.d.ts +1 -1
  7. package/dist/dynamic-facade.d.ts.map +1 -1
  8. package/dist/dynamic-facade.js +3 -3
  9. package/dist/dynamic-facade.js.map +1 -1
  10. package/dist/index.d.ts +0 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +0 -1
  13. package/dist/index.js.map +1 -1
  14. package/dist/m3/builtins-common.d.ts +70 -0
  15. package/dist/m3/builtins-common.d.ts.map +1 -0
  16. package/dist/m3/builtins-common.js +88 -0
  17. package/dist/m3/builtins-common.js.map +1 -0
  18. package/dist/m3/builtins-function.d.ts +9 -0
  19. package/dist/m3/builtins-function.d.ts.map +1 -0
  20. package/dist/m3/builtins-function.js +19 -0
  21. package/dist/m3/builtins-function.js.map +1 -0
  22. package/dist/m3/deserializer.d.ts +25 -0
  23. package/dist/m3/deserializer.d.ts.map +1 -1
  24. package/dist/m3/deserializer.js +18 -11
  25. package/dist/m3/deserializer.js.map +1 -1
  26. package/dist/m3/index.d.ts +7 -3
  27. package/dist/m3/index.d.ts.map +1 -1
  28. package/dist/m3/index.js +6 -3
  29. package/dist/m3/index.js.map +1 -1
  30. package/dist/m3/lioncore-common.d.ts +37 -0
  31. package/dist/m3/lioncore-common.d.ts.map +1 -0
  32. package/dist/m3/lioncore-common.js +10 -0
  33. package/dist/m3/lioncore-common.js.map +1 -0
  34. package/dist/m3/reading-writing.d.ts +41 -0
  35. package/dist/m3/reading-writing.d.ts.map +1 -0
  36. package/dist/m3/reading-writing.js +84 -0
  37. package/dist/m3/reading-writing.js.map +1 -0
  38. package/dist/m3/serializer.d.ts +17 -0
  39. package/dist/m3/serializer.d.ts.map +1 -1
  40. package/dist/m3/serializer.js +11 -2
  41. package/dist/m3/serializer.js.map +1 -1
  42. package/dist/m3/types.d.ts +9 -13
  43. package/dist/m3/types.d.ts.map +1 -1
  44. package/dist/m3/types.js +1 -5
  45. package/dist/m3/types.js.map +1 -1
  46. package/dist/m3/version.d.ts +19 -0
  47. package/dist/m3/version.d.ts.map +1 -0
  48. package/dist/m3/version.js +19 -0
  49. package/dist/m3/version.js.map +1 -0
  50. package/dist/m3/versions/v2023_1/builtins-legacy.d.ts +44 -0
  51. package/dist/m3/versions/v2023_1/builtins-legacy.d.ts.map +1 -0
  52. package/dist/m3/{builtins.js → versions/v2023_1/builtins-legacy.js} +24 -79
  53. package/dist/m3/versions/v2023_1/builtins-legacy.js.map +1 -0
  54. package/dist/m3/versions/v2023_1/builtins.d.ts +34 -0
  55. package/dist/m3/versions/v2023_1/builtins.d.ts.map +1 -0
  56. package/dist/m3/versions/v2023_1/builtins.js +75 -0
  57. package/dist/m3/versions/v2023_1/builtins.js.map +1 -0
  58. package/dist/m3/versions/v2023_1/lioncore.d.ts +34 -0
  59. package/dist/m3/versions/v2023_1/lioncore.d.ts.map +1 -0
  60. package/dist/m3/versions/v2023_1/lioncore.js +86 -0
  61. package/dist/m3/versions/v2023_1/lioncore.js.map +1 -0
  62. package/dist/m3/versions/v2023_1/version.d.ts +6 -0
  63. package/dist/m3/versions/v2023_1/version.d.ts.map +1 -0
  64. package/dist/m3/versions/v2023_1/version.js +8 -0
  65. package/dist/m3/versions/v2023_1/version.js.map +1 -0
  66. package/dist/m3/versions.d.ts +27 -0
  67. package/dist/m3/versions.d.ts.map +1 -0
  68. package/dist/m3/versions.js +28 -0
  69. package/dist/m3/versions.js.map +1 -0
  70. package/dist/reading.d.ts +2 -0
  71. package/dist/reading.d.ts.map +1 -1
  72. package/dist/serializer.d.ts +12 -1
  73. package/dist/serializer.d.ts.map +1 -1
  74. package/dist/serializer.js +4 -4
  75. package/dist/serializer.js.map +1 -1
  76. package/dist/writing.d.ts +2 -0
  77. package/dist/writing.d.ts.map +1 -1
  78. package/dist/writing.js.map +1 -1
  79. package/package.json +3 -3
  80. package/src/deserializer.ts +18 -14
  81. package/src/dynamic-facade.ts +3 -4
  82. package/src/index.ts +0 -1
  83. package/src/m3/README.md +1 -1
  84. package/src/m3/builtins-common.ts +143 -0
  85. package/src/m3/builtins-function.ts +22 -0
  86. package/src/m3/deserializer.ts +43 -14
  87. package/src/m3/index.ts +7 -3
  88. package/src/m3/lioncore-common.ts +42 -0
  89. package/src/m3/reading-writing.ts +160 -0
  90. package/src/m3/serializer.ts +25 -2
  91. package/src/m3/types.ts +10 -16
  92. package/src/m3/version.ts +23 -0
  93. package/src/m3/versions/v2023_1/builtins-legacy.ts +126 -0
  94. package/src/m3/versions/v2023_1/builtins.ts +102 -0
  95. package/src/m3/{lioncore.ts → versions/v2023_1/lioncore.ts} +53 -76
  96. package/src/m3/versions/v2023_1/version.ts +9 -0
  97. package/src/m3/versions.ts +37 -0
  98. package/src/reading.ts +2 -0
  99. package/src/serializer.ts +18 -5
  100. package/src/writing.ts +2 -0
  101. package/dist/m3/builtins.d.ts +0 -82
  102. package/dist/m3/builtins.d.ts.map +0 -1
  103. package/dist/m3/builtins.js.map +0 -1
  104. package/dist/m3/facade.d.ts +0 -17
  105. package/dist/m3/facade.d.ts.map +0 -1
  106. package/dist/m3/facade.js +0 -58
  107. package/dist/m3/facade.js.map +0 -1
  108. package/dist/m3/lioncore.d.ts +0 -41
  109. package/dist/m3/lioncore.d.ts.map +0 -1
  110. package/dist/m3/lioncore.js +0 -90
  111. package/dist/m3/lioncore.js.map +0 -1
  112. package/dist/version.d.ts +0 -5
  113. package/dist/version.d.ts.map +0 -1
  114. package/dist/version.js +0 -5
  115. package/dist/version.js.map +0 -1
  116. package/src/m3/builtins.ts +0 -198
  117. package/src/m3/facade.ts +0 -130
  118. package/src/version.ts +0 -5
package/src/serializer.ts CHANGED
@@ -1,9 +1,8 @@
1
- import { currentSerializationFormatVersion, LionWebId, LionWebJsonChunk, LionWebJsonNode } from "@lionweb/json"
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 { defaultLionWebVersion } 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 builtinPropertyValueSerializer}.
62
+ * Default = the value of the `propertyValueSerializer` property of the {@link LionWebVersion version} of the LionWeb serialization format,
63
+ * configured through {@code SerializerConfiguration.lionWebVersion} (which itself defaults to {@link defaultLionWebVersion}).
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
 
@@ -80,6 +86,12 @@ export type SerializerConfiguration<NT extends Node> = {
80
86
  * An interface with functions to “read” – i.e., introspect – nodes.
81
87
  */
82
88
  reader: Reader<NT>
89
+
90
+ /**
91
+ * The version of the LionWeb serialization format to serialize in.
92
+ * Default = {@link defaultLionWebVersion}.
93
+ */
94
+ lionWebVersion?: LionWebVersion
83
95
  } & SerializationOptions
84
96
 
85
97
 
@@ -100,8 +112,9 @@ export const nodeSerializer = <NT extends Node>(reader: Reader<NT>, serializatio
100
112
  */
101
113
  export const serializerWith = <NT extends Node>(configuration: SerializerConfiguration<NT>): Serializer<NT> => {
102
114
  const { reader } = configuration
115
+ const lionWebVersion = configuration?.lionWebVersion ?? defaultLionWebVersion
103
116
  const propertyValueSerializer =
104
- configuration.propertyValueSerializer ?? configuration.primitiveTypeSerializer ?? builtinPropertyValueSerializer
117
+ configuration.propertyValueSerializer ?? configuration.primitiveTypeSerializer ?? lionWebVersion.builtinsFacade.propertyValueSerializer
105
118
  const serializeEmptyFeatures = configuration.serializeEmptyFeatures ?? true
106
119
 
107
120
  const languageKey2version2classifierKey2allFeatures: Nested3Map<Feature[]> = {}
@@ -233,7 +246,7 @@ export const serializerWith = <NT extends Node>(configuration: SerializerConfigu
233
246
  nodes.forEach(node => visit(node, undefined))
234
247
 
235
248
  return {
236
- serializationFormatVersion: currentSerializationFormatVersion,
249
+ serializationFormatVersion: lionWebVersion.serializationFormatVersion,
237
250
  languages: languagesUsed.map(({ key, version }) => ({ key, version })),
238
251
  nodes: serializedNodes
239
252
  }
package/src/writing.ts CHANGED
@@ -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
 
@@ -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,iB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GAAG,IAAI,8BAA8B,EAAE,CAAC,MAAM,EAAE,CAAA;AAE3F;;GAEG;AACH,MAAM,OAAO,8BAA+B,SAAQ,8BAA8B;CAAG;AAErF,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,eAAe,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,CAAA"}
@@ -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
@@ -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
@@ -1 +0,0 @@
1
- {"version":3,"file":"facade.js","sourceRoot":"","sources":["../../src/m3/facade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,kCAAkC,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACpF,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEpE,OAAO,EACH,UAAU,EAEV,OAAO,EACP,WAAW,EACX,WAAW,EACX,kBAAkB,EAClB,SAAS,EACT,QAAQ,EAER,aAAa,EACb,QAAQ,EACR,SAAS,EACZ,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,uBAAuB,EAAU,MAAM,eAAe,CAAA;AAE/D,MAAM,EAAE,WAAW,EAAE,GAAG,eAAe,CAAA;AACvC,MAAM,EAAE,UAAU,EAAE,GAAG,YAAY,CAAA;AAEnC,MAAM,CAAC,MAAM,cAAc,GAAsB;IAC7C,YAAY,EAAE,kCAAkC,CAAC,QAAQ,CAAC;IAC1D,eAAe,EAAE,CAAC,IAAI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AW,EAC1C,EAAE,CACL,CAAA;YACL;gBACI,MAAM,IAAI,KAAK,CACX,gCAAgC,eAAe,CAAC,UAAU,CAAC,aAAa,UAAU,CAAC,GAAG,4BAA4B,CACrH,CAAA;QACT,CAAC;IACL,CAAC;IACD,eAAe,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE;QACtC,uBAAuB,CAAC,IAA0C,EAAE,OAAO,EAAE,KAAK,CAAC,CAAA;IACvF,CAAC;IACD,UAAU,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO;CACjC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,cAAc,CAAA"}
@@ -1,41 +0,0 @@
1
- declare const lioncoreKey = "LionCore-M3";
2
- /**
3
- * Definition of LionCore in terms of itself.
4
- */
5
- export declare const lioncore: import("./types.js").Language;
6
- export declare const metaConcepts: {
7
- annotation: import("./types.js").Concept;
8
- classifier: import("./types.js").Concept;
9
- concept: import("./types.js").Concept;
10
- interface: import("./types.js").Concept;
11
- containment: import("./types.js").Concept;
12
- enumeration: import("./types.js").Concept;
13
- enumerationLiteral: import("./types.js").Concept;
14
- ikeyed: import("./types.js").Interface;
15
- language: import("./types.js").Concept;
16
- primitiveType: import("./types.js").Concept;
17
- property: import("./types.js").Concept;
18
- reference: import("./types.js").Concept;
19
- };
20
- export declare const metaFeatures: {
21
- annotation_annotates: import("./types.js").Reference;
22
- annotation_extends: import("./types.js").Reference;
23
- annotation_implements: import("./types.js").Reference;
24
- classifier_features: import("./types.js").Containment;
25
- concept_abstract: import("./types.js").Property;
26
- concept_partition: import("./types.js").Property;
27
- concept_extends: import("./types.js").Reference;
28
- concept_implements: import("./types.js").Reference;
29
- interface_extends: import("./types.js").Reference;
30
- enumeration_literals: import("./types.js").Containment;
31
- feature_optional: import("./types.js").Property;
32
- ikeyed_key: import("./types.js").Property;
33
- language_dependsOn: import("./types.js").Reference;
34
- language_entities: import("./types.js").Containment;
35
- language_version: import("./types.js").Property;
36
- link_multiple: import("./types.js").Property;
37
- link_type: import("./types.js").Reference;
38
- property_type: import("./types.js").Reference;
39
- };
40
- export { lioncoreKey };
41
- //# sourceMappingURL=lioncore.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lioncore.d.ts","sourceRoot":"","sources":["../../src/m3/lioncore.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,WAAW,gBAAgB,CAAA;AAajC;;GAEG;AACH,eAAO,MAAM,QAAQ,+BAA4C,CAAA;AAkFjE,eAAO,MAAM,YAAY;;;;;;;;;;;;;CAaxB,CAAA;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;CAmBxB,CAAA;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
@@ -1,90 +0,0 @@
1
- import { currentReleaseVersion } from "../version.js";
2
- import { builtinClassifiers, builtinPrimitives } from "./builtins.js";
3
- import { LanguageFactory } from "./factory.js";
4
- const lioncoreKey = "LionCore-M3";
5
- const factory = new LanguageFactory("LionCore_M3", currentReleaseVersion, (...names) => "-id-" + (names.length === 1 ? lioncoreKey : names.slice(1).join("-")), (...names) => names.slice(1).join("-"));
6
- /*
7
- * ID: `-id-${key}`
8
- * key: qualified name _without_ "LionCore_M3", dash-separated
9
- */
10
- /**
11
- * Definition of LionCore in terms of itself.
12
- */
13
- export const lioncore = factory.language.havingKey("LionCore-M3");
14
- const { inamed } = builtinClassifiers;
15
- const { booleanDataType, stringDataType } = builtinPrimitives;
16
- const ikeyed = factory.interface("IKeyed").extending(inamed);
17
- const ikeyed_key = factory.property(ikeyed, "key").ofType(stringDataType);
18
- const feature = factory.concept("Feature", true).implementing(ikeyed);
19
- const feature_optional = factory.property(feature, "optional").ofType(booleanDataType);
20
- const property = factory.concept("Property", false, feature);
21
- const property_type = factory.reference(property, "type");
22
- const link = factory.concept("Link", true, feature);
23
- const link_multiple = factory.property(link, "multiple").ofType(booleanDataType);
24
- const link_type = factory.reference(link, "type");
25
- const containment = factory.concept("Containment", false, link);
26
- const reference = factory.concept("Reference", false, link);
27
- const languageEntity = factory.concept("LanguageEntity", true).implementing(ikeyed);
28
- const classifier = factory.concept("Classifier", true, languageEntity);
29
- const classifier_features = factory.containment(classifier, "features").isOptional().isMultiple().ofType(feature);
30
- link_type.ofType(classifier);
31
- const annotation = factory.concept("Annotation", false, classifier);
32
- const annotation_annotates = factory.reference(annotation, "annotates").isOptional().ofType(classifier);
33
- const annotation_extends = factory.reference(annotation, "extends").isOptional().ofType(annotation);
34
- const annotation_implements = factory.reference(annotation, "implements").isMultiple().isOptional();
35
- const concept = factory.concept("Concept", false, classifier);
36
- const concept_abstract = factory.property(concept, "abstract").ofType(booleanDataType);
37
- const concept_partition = factory.property(concept, "partition").ofType(booleanDataType);
38
- const concept_extends = factory.reference(concept, "extends").isOptional().ofType(concept);
39
- const concept_implements = factory.reference(concept, "implements").isOptional().isMultiple();
40
- const interface_ = factory.concept("Interface", false, classifier);
41
- const interface_extends = factory.reference(interface_, "extends").isOptional().isMultiple().ofType(interface_);
42
- annotation_implements.ofType(interface_);
43
- concept_implements.ofType(interface_);
44
- const dataType = factory.concept("DataType", true, languageEntity);
45
- property_type.ofType(dataType);
46
- const primitiveType = factory.concept("PrimitiveType", false, dataType);
47
- const enumeration = factory.concept("Enumeration", false, dataType);
48
- const enumeration_literals = factory.containment(enumeration, "literals").isMultiple().isOptional();
49
- const enumerationLiteral = factory.concept("EnumerationLiteral", false).implementing(ikeyed);
50
- enumeration_literals.ofType(enumerationLiteral);
51
- const language = factory.concept("Language", false).implementing(ikeyed).isPartition();
52
- const language_version = factory.property(language, "version").ofType(stringDataType);
53
- const language_entities = factory.containment(language, "entities").isOptional().isMultiple().ofType(languageEntity);
54
- const language_dependsOn = factory.reference(language, "dependsOn").isOptional().isMultiple().ofType(language);
55
- export const metaConcepts = {
56
- annotation,
57
- classifier,
58
- concept,
59
- interface: interface_,
60
- containment,
61
- enumeration,
62
- enumerationLiteral,
63
- ikeyed,
64
- language,
65
- primitiveType,
66
- property,
67
- reference
68
- };
69
- export const metaFeatures = {
70
- annotation_annotates,
71
- annotation_extends,
72
- annotation_implements,
73
- classifier_features,
74
- concept_abstract,
75
- concept_partition,
76
- concept_extends,
77
- concept_implements,
78
- interface_extends,
79
- enumeration_literals,
80
- feature_optional,
81
- ikeyed_key,
82
- language_dependsOn,
83
- language_entities,
84
- language_version,
85
- link_multiple,
86
- link_type,
87
- property_type
88
- };
89
- export { lioncoreKey };
90
- //# sourceMappingURL=lioncore.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lioncore.js","sourceRoot":"","sources":["../../src/m3/lioncore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE9C,MAAM,WAAW,GAAG,aAAa,CAAA;AAEjC,MAAM,OAAO,GAAG,IAAI,eAAe,CAC/B,aAAa,EACb,qBAAqB,EACrB,CAAC,GAAG,KAAK,EAAE,EAAE,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EACpF,CAAC,GAAG,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CACzC,CAAA;AACD;;;GAGG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,aAAa,CAAC,CAAA;AAEjE,MAAM,EAAE,MAAM,EAAE,GAAG,kBAAkB,CAAA;AACrC,MAAM,EAAE,eAAe,EAAE,cAAc,EAAE,GAAG,iBAAiB,CAAA;AAE7D,MA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M,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,UAAU,EAAE,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,CAAA;AAEpH,MAAM,kBAAkB,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,UAAU,EAAE,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;AAE9G,MAAM,CAAC,MAAM,YAAY,GAAG;IACxB,UAAU;IACV,UAAU;IACV,OAAO;IACP,SAAS,EAAE,UAAU;IACrB,WAAW;IACX,WAAW;IACX,kBAAkB;IAClB,MAAM;IACN,QAAQ;IACR,aAAa;IACb,QAAQ;IACR,SAAS;CACZ,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAAG;IACxB,oBAAoB;IACpB,kBAAkB;IAClB,qBAAqB;IACrB,mBAAmB;IACnB,gBAAgB;IAChB,iBAAiB;IACjB,eAAe;IACf,kBAAkB;IAClB,iBAAiB;IACjB,oBAAoB;IACpB,gBAAgB;IAChB,UAAU;IACV,kBAAkB;IAClB,iBAAiB;IACjB,gBAAgB;IAChB,aAAa;IACb,SAAS;IACT,aAAa;CAChB,CAAA;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
package/dist/version.d.ts DELETED
@@ -1,5 +0,0 @@
1
- /**
2
- * The *current* release(d) version.
3
- */
4
- export declare const currentReleaseVersion = "2023.1";
5
- //# sourceMappingURL=version.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,qBAAqB,WAAW,CAAA"}
package/dist/version.js DELETED
@@ -1,5 +0,0 @@
1
- /**
2
- * The *current* release(d) version.
3
- */
4
- export const currentReleaseVersion = "2023.1";
5
- //# sourceMappingURL=version.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,QAAQ,CAAA"}
@@ -1,198 +0,0 @@
1
- import { asMinimalJsonString, StringsMapper } from "@lionweb/ts-utils"
2
- import { PropertyValueDeserializer } from "../deserializer.js"
3
- import { PropertyValueSerializer } from "../serializer.js"
4
- import { currentReleaseVersion } from "../version.js"
5
- import { LanguageFactory } from "./factory.js"
6
- import { Classifier, Concept, DataType, lioncoreBuiltinsKey, Property } from "./types.js"
7
- import { isUnresolvedReference } from "../references.js"
8
-
9
- const lioncoreBuiltinsIdAndKeyGenerator: StringsMapper = (...names) => [lioncoreBuiltinsKey, ...names.slice(1)].join("-")
10
-
11
- const factory = new LanguageFactory(
12
- "LionCore_builtins",
13
- currentReleaseVersion,
14
- lioncoreBuiltinsIdAndKeyGenerator,
15
- lioncoreBuiltinsIdAndKeyGenerator
16
- )
17
- /*
18
- * ID == key: `LionCore-builtins-${qualified name _without_ "LionCore-builtins", dash-separated}`
19
- */
20
-
21
- /**
22
- * Definition of a LionCore language that serves as a standard library of built-in primitive types.
23
- */
24
- const lioncoreBuiltins = factory.language
25
-
26
- const stringDataType = factory.primitiveType("String")
27
- const booleanDataType = factory.primitiveType("Boolean")
28
- const integerDataType = factory.primitiveType("Integer")
29
- const jsonDataType = factory.primitiveType("JSON")
30
-
31
- const node = factory.concept("Node", true)
32
-
33
- const isBuiltinNodeConcept = (classifier: Classifier) =>
34
- classifier instanceof Concept &&
35
- classifier.language.key === lioncoreBuiltinsKey &&
36
- classifier.language.version === currentReleaseVersion &&
37
- classifier.key === builtinClassifiers.node.key &&
38
- (classifier as Concept).abstract
39
-
40
- const inamed = factory.interface("INamed")
41
-
42
- const inamed_name = factory.property(inamed, "name").ofType(stringDataType)
43
-
44
- const builtinPrimitives = {
45
- stringDataType,
46
- booleanDataType,
47
- integerDataType,
48
- jsonDataType,
49
- /**
50
- * Misspelled alias of {@link stringDataType}, kept for backward compatibility, and to be deprecated and removed later.
51
- */
52
- stringDatatype: stringDataType,
53
- /**
54
- * Misspelled alias of {@link booleanDataType}, kept for backward compatibility, and to be deprecated and removed later.
55
- */
56
- booleanDatatype: booleanDataType,
57
- /**
58
- * Misspelled alias of {@link integerDataType}, kept for backward compatibility, and to be deprecated and removed later.
59
- */
60
- integerDatatype: integerDataType,
61
- /**
62
- * Misspelled alias of {@link jsonDataType}, kept for backward compatibility, and to be deprecated and removed later.
63
- */
64
- jsonDatatype: jsonDataType
65
- }
66
-
67
- const builtinClassifiers = {
68
- node,
69
- inamed
70
- }
71
-
72
- const builtinFeatures = {
73
- inamed_name
74
- }
75
-
76
- /**
77
- * Determines whether two data types should be structurally equal based on equality of: meta type, key, and language's key.
78
- */
79
- const shouldBeIdentical = (left: DataType, right: DataType): boolean =>
80
- left.key === right.key && left.language.key === right.language.key && left.metaType() === right.metaType()
81
-
82
- abstract class DataTypeRegister<T> {
83
- private map = new Map<DataType, T>()
84
-
85
- private _sealed = false
86
-
87
- sealed() {
88
- this._sealed = true
89
- return this
90
- }
91
-
92
- public register(dataType: DataType, t: T) {
93
- if (this._sealed) {
94
- throw new Error(`can't register a data type with a register that has been sealed`)
95
- }
96
- this.map.set(dataType, t)
97
- }
98
-
99
- protected byType(targetDataType: DataType): T | undefined {
100
- for (const [dataType, t] of this.map.entries()) {
101
- if (shouldBeIdentical(targetDataType, dataType)) {
102
- return t
103
- }
104
- }
105
- return undefined
106
- }
107
- }
108
-
109
- /**
110
- * An implementation of {@link PropertyValueDeserializer} that knows how to deserialize serialized values of all the built-in primitive types.
111
- */
112
- export class BuiltinPropertyValueDeserializer
113
- extends DataTypeRegister<(value: string) => unknown>
114
- implements PropertyValueDeserializer
115
- {
116
- constructor() {
117
- super()
118
- this.register(stringDataType, value => value)
119
- this.register(booleanDataType, value => JSON.parse(value))
120
- this.register(integerDataType, value => Number(value))
121
- this.register(jsonDataType, value => JSON.parse(value as string))
122
- }
123
-
124
- deserializeValue(value: string | undefined, property: Property): unknown | undefined {
125
- if (value === undefined) {
126
- if (property.optional) {
127
- return undefined
128
- }
129
- throw new Error(`can't deserialize undefined as the value of required property "${property.name}" (on classifier "${property.classifier.name}" in language "${property.classifier.language.name}")`)
130
- }
131
- const { type } = property
132
- if (isUnresolvedReference(type)) {
133
- throw new Error(`can't deserialize property "${property.name}" (on classifier "${property.classifier.name}" in language "${property.classifier.language.name}") with unspecified type`)
134
- }
135
- const specificDeserializer = this.byType(type)
136
- if (specificDeserializer != undefined) {
137
- return specificDeserializer(value)
138
- } else {
139
- throw new Error(`can't deserialize value of property "${property.name}" (on classifier "${property.classifier.name}" in language "${property.classifier.language.name}") of type "${type!.name}": ${value}`)
140
- }
141
- }
142
- }
143
-
144
- /**
145
- * Singleton instance of {@link BuiltinPropertyValueDeserializer}.
146
- */
147
- export const builtinPropertyValueDeserializer = new BuiltinPropertyValueDeserializer().sealed()
148
-
149
- /**
150
- * Misspelled alias of {@link BuiltinPropertyValueDeserializer}, kept for backward compatibility, and to be deprecated and removed later.
151
- */
152
- export class DefaultPrimitiveTypeDeserializer extends BuiltinPropertyValueDeserializer {}
153
-
154
-
155
- /**
156
- * An implementation of {@link PropertyValueSerializer} that knows how to serialize values of all the built-in primitive types.
157
- */
158
- export class BuiltinPropertyValueSerializer extends DataTypeRegister<(value: unknown) => string> implements PropertyValueSerializer {
159
- constructor() {
160
- super()
161
- this.register(stringDataType, value => value as string)
162
- this.register(booleanDataType, value => `${value as boolean}`)
163
- this.register(integerDataType, value => `${value as number}`)
164
- this.register(jsonDataType, value => asMinimalJsonString(value))
165
- }
166
-
167
- serializeValue(value: unknown | undefined, property: Property): string | null {
168
- if (value === undefined) {
169
- if (property.optional) {
170
- return null
171
- }
172
- throw new Error(`can't serialize undefined as the value of required property "${property.name}" (on classifier "${property.classifier.name}" in language "${property.classifier.language.name}")`)
173
- }
174
- const { type } = property
175
- if (isUnresolvedReference(type)) {
176
- throw new Error(`can't serialize property "${property.name}" (on classifier "${property.classifier.name}" in language "${property.classifier.language.name}") with unspecified type`)
177
- }
178
- const specificSerializer = this.byType(type)
179
- if (specificSerializer != undefined) {
180
- return specificSerializer(value)
181
- } else {
182
- throw new Error(`can't serialize value of property "${property.name}" (on classifier "${property.classifier.name}" in language "${property.classifier.language.name}") of type "${type!.name}": ${value}`)
183
- }
184
- }
185
- }
186
-
187
- /**
188
- * Singleton instance of {@link BuiltinPropertyValueSerializer}.
189
- */
190
- export const builtinPropertyValueSerializer = new BuiltinPropertyValueSerializer().sealed()
191
-
192
- /**
193
- * Misspelled alias of {@link BuiltinPropertyValueSerializer}, kept for backward compatibility, and to be deprecated and removed later.
194
- */
195
- export class DefaultPrimitiveTypeSerializer extends BuiltinPropertyValueSerializer {}
196
-
197
- export { builtinPrimitives, builtinClassifiers, builtinFeatures, isBuiltinNodeConcept, lioncoreBuiltins, shouldBeIdentical }
198
-