@lionweb/utilities 0.6.10 → 0.6.11-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +114 -0
- package/README.md +0 -84
- package/dist/m1/reference-utils.d.ts +2 -53
- package/dist/m1/reference-utils.d.ts.map +1 -1
- package/dist/m1/reference-utils.js +1 -77
- package/dist/m1/reference-utils.js.map +1 -1
- package/dist/m3/diagrams/Mermaid-generator.js.map +1 -1
- package/dist/m3/textualizer.js.map +1 -1
- package/dist/m3/ts-generation/textgen.d.ts +2 -0
- package/dist/m3/ts-generation/textgen.d.ts.map +1 -0
- package/dist/m3/ts-generation/textgen.js +3 -0
- package/dist/m3/ts-generation/textgen.js.map +1 -0
- package/dist/m3/ts-generation/ts-types-generator.d.ts.map +1 -1
- package/dist/m3/ts-generation/ts-types-generator.js +7 -7
- package/dist/m3/ts-generation/ts-types-generator.js.map +1 -1
- package/dist/m3/ts-generation/type-def.d.ts +2 -2
- package/dist/m3/ts-generation/type-def.d.ts.map +1 -1
- package/dist/m3/ts-generation/type-def.js +5 -4
- package/dist/m3/ts-generation/type-def.js.map +1 -1
- package/dist/serialization/textualizer.js +1 -1
- package/dist/serialization/textualizer.js.map +1 -1
- package/package.json +4 -4
- package/dist/m3/ts-generation/text-generation-utils.d.ts +0 -7
- package/dist/m3/ts-generation/text-generation-utils.d.ts.map +0 -1
- package/dist/m3/ts-generation/text-generation-utils.js +0 -7
- package/dist/m3/ts-generation/text-generation-utils.js.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.6.11 - not officially released yet
|
|
4
|
+
|
|
5
|
+
* Upgrade to `littoral-templates` version 0.3.0.
|
|
6
|
+
* (Depend on `@lionweb/core` version 0.6.11.)
|
|
7
|
+
* Move the reference util functions (`referenceValues`, `incomingReferences`, `referencesToOutOfScopeNodes`) and type (class `ReferenceValue`) from the `utilities` package to `core`.
|
|
8
|
+
Aliases (as re-exports) are left in its place to avoid code breaking.
|
|
9
|
+
The move is necessary because not all clients of `@lionweb/utilities` can install the Node.js-specific dependencies of the dependencies that package (such as `crypto`).
|
|
10
|
+
* Upgraded version of `nanoid` dependency to a recent one, which doesn't have a reported security vulnerability.
|
|
11
|
+
* Separate CHANGELOG from README.
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### 0.6.10
|
|
15
|
+
|
|
16
|
+
* (Depend on `@lionweb/core` version 0.6.10.)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## 0.6.9
|
|
20
|
+
|
|
21
|
+
* Make `withoutAnnotations` _not_ modify the original serialization chunk.
|
|
22
|
+
* (Use the `littoral-templates` package for textualization — of M2s, so far. This is a technical change, not a functional one, except for maybe some extra whitespace.)
|
|
23
|
+
* Add reference utilities that all return `ReferenceValue` objects:
|
|
24
|
+
* `referenceValues(<source node>, <extraction facade>)`: all references within the given scope.
|
|
25
|
+
* `incomingReferences(<target node(s)>, <search scope>, <extraction facade>)`: all (unique) references coming into the given target node(s) from the search scope.
|
|
26
|
+
* `referencesToOutOfScopeNodes(<scope>, <extraction facade>)` all reference targets that are not in the given scope.
|
|
27
|
+
* (Depend on `@lionweb/core` version 0.6.9.)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## 0.6.8
|
|
31
|
+
|
|
32
|
+
* Add a `withoutAnnotations` function that removes all annotations, and all their descendants, from a serialization chunk.
|
|
33
|
+
* The `inferLanguagesFromSerializationChunk` function now detects whether a property is optional from `null` values in the serialization.
|
|
34
|
+
* (Depend on `@lionweb/core` version 0.6.8.)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
## 0.6.7
|
|
38
|
+
|
|
39
|
+
* (Depend on `@lionweb/core` version 0.6.7.)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## 0.6.6
|
|
43
|
+
|
|
44
|
+
* (Depend on `@lionweb/core` version 0.6.6.)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
## 0.6.5
|
|
48
|
+
|
|
49
|
+
* TS types generator now generates 1 file per language.
|
|
50
|
+
The generator also has several fixes, and assumes that the generated code will be embedded in an ES6 module.
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
## 0.6.4
|
|
54
|
+
|
|
55
|
+
* Rename `inferLanguagesFromChunk` → `inferLanguagesFromSerializationChunk` (for consistency).
|
|
56
|
+
* Extend the functionality of the `measure` metrics function.
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
## 0.6.3
|
|
60
|
+
|
|
61
|
+
* Add a `inferLanguagesFromChunk` function that infers a language from a serialization chunk.
|
|
62
|
+
* Renaming for consistency and clarity:
|
|
63
|
+
* `readChunk` → `readSerializationChunk`
|
|
64
|
+
* `tryLoad[All]AsLanguages` → `tryRead[All]AsLanguages`
|
|
65
|
+
* `tryReadAllAsLanguages` combines all serialization chunks (that are the result of serializing `Language`s) into one before attempting to deserialize, in order to have cross-language references resolve.
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
## 0.6.2
|
|
69
|
+
|
|
70
|
+
* Add a function `measure` that computes metrics on a serialization chunk.
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
## 0.6.1
|
|
74
|
+
|
|
75
|
+
* Improve PlantUML and Mermaid diagram generation:
|
|
76
|
+
* Primitive types now rendered as classes marked as "<<primitive type>>".
|
|
77
|
+
* Concepts or Annotations that extend the "Node" concept built into LionCore don't show that.
|
|
78
|
+
* Optional (single-valued) features are now shown with a question mark (`?`) directly after the type, instead of being marked as "<<optional>>".
|
|
79
|
+
* Fix/add support for annotations.
|
|
80
|
+
* **Remove** all Ecore functionality (=[issue #121](https://github.com/LionWeb-io/lionweb-typescript/issues/121))
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
## 0.6.0
|
|
84
|
+
|
|
85
|
+
* Add support for annotations in diagram generation (PlantUML and Mermaid), and textualization.
|
|
86
|
+
* **Remove** the `shortenedSerializationChunk` function, as it isn't used, nor very useful compared to the sorting and textualization.
|
|
87
|
+
* _Breaking name changes_: rename `asText` → `languageAsText`, `shortenedSerialization` → `shortenedSerializationChunk`, `sortedSerialization` → `sortedSerializationChunk`.
|
|
88
|
+
* Expose an `isSerializedLanguages` function.
|
|
89
|
+
* Expose an `orderedSerializationChunk` function that aligns the JSON key-value pairs in a serialization chunk according to the specification of the serialization format.
|
|
90
|
+
That means that key-value pairs appear in precisely the same order as they do in the specification, and that missing key-value pairs are put in and get their default values.
|
|
91
|
+
* Expose a generic textual syntax for serialization chunks, through the `genericTreeAsText` function.
|
|
92
|
+
This function is optionally language-aware: by providing an array of `Language`s as its second argument, it will try and look up `LanguageEntity` and `Feature` names instead of rendering their keys.
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
## 0.5.0
|
|
96
|
+
|
|
97
|
+
This is the first version corresponding to a release of LionWeb (version: 2023.1) as a whole.
|
|
98
|
+
|
|
99
|
+
* Update for the presence of annotations on a(ny) `Node`.
|
|
100
|
+
* Move the `readChunk` function from `@lionweb/cli` to `@lionweb/utilities`.
|
|
101
|
+
* Also generate TypeScript type definitions for `Annotation`s.
|
|
102
|
+
* Sort _everything_ in `sortedSerialization`.
|
|
103
|
+
* Extend textual syntax for "multi-linguality".
|
|
104
|
+
* Implement textual syntax for `Annotation`s.
|
|
105
|
+
* _Breaking change:_ Change ID generation to hashing (`hasher` function).
|
|
106
|
+
* (Make small, cosmetic fix in `asText` function.)
|
|
107
|
+
* Add a function `tsTypesForLanguage` that generates TypeScript types.
|
|
108
|
+
* Receive `asText` and ID checking from `@lionweb/core`.
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
## Prior to 0.5.0
|
|
112
|
+
|
|
113
|
+
No changelog has been kept for previous versions, regardless of whether these were published or not.
|
|
114
|
+
|
package/README.md
CHANGED
|
@@ -22,90 +22,6 @@ It contains utilities on top of the `core` package, such as:
|
|
|
22
22
|
* Generation of TypeScript type definitions from an M2.
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
## Changelog
|
|
26
|
-
|
|
27
|
-
### 0.6.9
|
|
28
|
-
|
|
29
|
-
* Make `withoutAnnotations` _not_ modify the original serialization chunk.
|
|
30
|
-
* (Use the `littoral-templates` package for textualization — of M2s, so far. This is a technical change, not a functional one, except for maybe some extra whitespace.)
|
|
31
|
-
* Add reference utilities that all return `ReferenceValue` objects:
|
|
32
|
-
* `referenceValues(<source node>, <extraction facade>)`: all references within the given scope.
|
|
33
|
-
* `incomingReferences(<target node(s)>, <search scope>, <extraction facade>)`: all (unique) references coming into the given target node(s) from the search scope.
|
|
34
|
-
* `referencesToOutOfScopeNodes(<scope>, <extraction facade>)` all reference targets that are not in the given scope.
|
|
35
|
-
|
|
36
|
-
### 0.6.8
|
|
37
|
-
|
|
38
|
-
* Add a `withoutAnnotations` function that removes all annotations, and all their descendants, from a serialization chunk.
|
|
39
|
-
* The `inferLanguagesFromSerializationChunk` function now detects whether a property is optional from `null` values in the serialization.
|
|
40
|
-
|
|
41
|
-
### 0.6.7
|
|
42
|
-
|
|
43
|
-
* (Depend on `@lionweb/core` version 0.6.7.)
|
|
44
|
-
|
|
45
|
-
### 0.6.6
|
|
46
|
-
|
|
47
|
-
* (Depend on `@lionweb/core` version 0.6.6.)
|
|
48
|
-
|
|
49
|
-
### 0.6.5
|
|
50
|
-
|
|
51
|
-
* TS types generator now generates 1 file per language.
|
|
52
|
-
The generator also has several fixes, and assumes that the generated code will be embedded in an ES6 module.
|
|
53
|
-
|
|
54
|
-
### 0.6.4
|
|
55
|
-
|
|
56
|
-
* Rename `inferLanguagesFromChunk` → `inferLanguagesFromSerializationChunk` (for consistency).
|
|
57
|
-
* Extend the functionality of the `measure` metrics function.
|
|
58
|
-
|
|
59
|
-
### 0.6.3
|
|
60
|
-
|
|
61
|
-
* Add a `inferLanguagesFromChunk` function that infers a language from a serialization chunk.
|
|
62
|
-
* Renaming for consistency and clarity:
|
|
63
|
-
* `readChunk` → `readSerializationChunk`
|
|
64
|
-
* `tryLoad[All]AsLanguages` → `tryRead[All]AsLanguages`
|
|
65
|
-
* `tryReadAllAsLanguages` combines all serialization chunks (that are the result of serializing `Language`s) into one before attempting to deserialize, in order to have cross-language references resolve.
|
|
66
|
-
|
|
67
|
-
### 0.6.2
|
|
68
|
-
|
|
69
|
-
* Add a function `measure` that computes metrics on a serialization chunk.
|
|
70
|
-
|
|
71
|
-
### 0.6.1
|
|
72
|
-
|
|
73
|
-
* Improve PlantUML and Mermaid diagram generation:
|
|
74
|
-
* Primitive types now rendered as classes marked as "<<primitive type>>".
|
|
75
|
-
* Concepts or Annotations that extend the "Node" concept built into LionCore don't show that.
|
|
76
|
-
* Optional (single-valued) features are now shown with a question mark (`?`) directly after the type, instead of being marked as "<<optional>>".
|
|
77
|
-
* Fix/add support for annotations.
|
|
78
|
-
* **Remove** all Ecore functionality (=[issue #121](https://github.com/LionWeb-io/lionweb-typescript/issues/121))
|
|
79
|
-
|
|
80
|
-
### 0.6.0
|
|
81
|
-
|
|
82
|
-
* Add support for annotations in diagram generation (PlantUML and Mermaid), and textualization.
|
|
83
|
-
* **Remove** the `shortenedSerializationChunk` function, as it isn't used, nor very useful compared to the sorting and textualization.
|
|
84
|
-
* _Breaking name changes_: rename `asText` → `languageAsText`, `shortenedSerialization` → `shortenedSerializationChunk`, `sortedSerialization` → `sortedSerializationChunk`.
|
|
85
|
-
* Expose an `isSerializedLanguages` function.
|
|
86
|
-
* Expose an `orderedSerializationChunk` function that aligns the JSON key-value pairs in a serialization chunk according to the specification of the serialization format.
|
|
87
|
-
That means that key-value pairs appear in precisely the same order as they do in the specification, and that missing key-value pairs are put in and get their default values.
|
|
88
|
-
* Expose a generic textual syntax for serialization chunks, through the `genericTreeAsText` function.
|
|
89
|
-
This function is optionally language-aware: by providing an array of `Language`s as its second argument, it will try and look up `LanguageEntity` and `Feature` names instead of rendering their keys.
|
|
90
|
-
|
|
91
|
-
### 0.5.0
|
|
92
|
-
|
|
93
|
-
This is the first version corresponding to a release of LionWeb (version: 2023.1) as a whole.
|
|
94
|
-
|
|
95
|
-
* Update for the presence of annotations on a(ny) `Node`.
|
|
96
|
-
* Move the `readChunk` function from `@lionweb/cli` to `@lionweb/utilities`.
|
|
97
|
-
* Also generate TypeScript type definitions for `Annotation`s.
|
|
98
|
-
* Sort _everything_ in `sortedSerialization`.
|
|
99
|
-
* Extend textual syntax for "multi-linguality".
|
|
100
|
-
* Implement textual syntax for `Annotation`s.
|
|
101
|
-
* _Breaking change:_ Change ID generation to hashing (`hasher` function).
|
|
102
|
-
* (Make small, cosmetic fix in `asText` function.)
|
|
103
|
-
* Add a function `tsTypesForLanguage` that generates TypeScript types.
|
|
104
|
-
* Receive `asText` and ID checking from `@lionweb/core`.
|
|
105
|
-
|
|
106
|
-
No changelog has been kept for previous versions, regardless of whether these were published or not.
|
|
107
|
-
|
|
108
|
-
|
|
109
25
|
## Development
|
|
110
26
|
|
|
111
27
|
Build it from source as follows:
|
|
@@ -1,54 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Represents information about a source and target node related through a {@link Reference}.
|
|
4
|
-
* An index of `null` means that the reference is (at most) single-valued.
|
|
5
|
-
*/
|
|
6
|
-
export declare class ReferenceValue<NT extends Node> {
|
|
7
|
-
readonly sourceNode: NT;
|
|
8
|
-
readonly targetNode: NT;
|
|
9
|
-
readonly reference: Reference;
|
|
10
|
-
readonly index: number | null;
|
|
11
|
-
constructor(sourceNode: NT, targetNode: NT, reference: Reference, index: number | null);
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Finds all references within the given scope, as {@link ReferenceValue reference values}.
|
|
15
|
-
* To search within all nodes under a collection of root nodes,
|
|
16
|
-
* use _child extraction_ to compute all nodes in the forest hanging off of those root nodes as scope.
|
|
17
|
-
* Note that any reference is found uniquely,
|
|
18
|
-
* i.e. the returned {@link ReferenceValue reference values} are pairwise distinct,
|
|
19
|
-
* even if the scope passed contains duplicate nodes.
|
|
20
|
-
*
|
|
21
|
-
* @param scope - the {@link Node nodes} that are searched for references
|
|
22
|
-
* @param extractionFacade - an {@link ExtractionFacade} to reflect on nodes.
|
|
23
|
-
* _Note_ that it's assumed that its {@link getFeatureValue} function doesn't throw.
|
|
24
|
-
*/
|
|
25
|
-
export declare const referenceValues: <NT extends Node>(scope: NT[], extractionFacade: ExtractionFacade<NT>) => ReferenceValue<NT>[];
|
|
26
|
-
/**
|
|
27
|
-
* Finds all references coming into the given target node or any of the given target nodes,
|
|
28
|
-
* within the given scope, as {@link ReferenceValue reference values}.
|
|
29
|
-
* To search within all nodes under a collection of root nodes,
|
|
30
|
-
* use _child extraction_ to compute all nodes in the forest hanging off of those root nodes as scope.
|
|
31
|
-
* Note that any reference is found uniquely,
|
|
32
|
-
* i.e. the returned {@link ReferenceValue reference values} are pairwise distinct,
|
|
33
|
-
* even if the given target nodes or scope contain duplicate nodes.
|
|
34
|
-
*
|
|
35
|
-
* @param targetNodeOrNodes - one or more target {@link Node nodes} for which the incoming references are searched
|
|
36
|
-
* @param scope - the {@link Node nodes} that are searched for references
|
|
37
|
-
* @param extractionFacade - an {@link ExtractionFacade} to reflect on nodes.
|
|
38
|
-
* _Note_ that it's assumed that its {@link getFeatureValue} function doesn't throw.
|
|
39
|
-
*/
|
|
40
|
-
export declare const incomingReferences: <NT extends Node>(targetNodeOrNodes: NT | NT[], scope: NT[], extractionFacade: ExtractionFacade<NT>) => ReferenceValue<NT>[];
|
|
41
|
-
/**
|
|
42
|
-
* Finds all references to nodes that are not in the given scope, as {@link ReferenceValue reference values}.
|
|
43
|
-
* To search within all nodes under a collection of root nodes,
|
|
44
|
-
* use _child extraction_ to compute all nodes in the forest hanging off of those root nodes as scope.
|
|
45
|
-
* Note that any reference is found uniquely,
|
|
46
|
-
* i.e. the returned {@link ReferenceValue reference values} are pairwise distinct,
|
|
47
|
-
* even if the given scope contains duplicate nodes.
|
|
48
|
-
*
|
|
49
|
-
* @param scope - the {@link Node nodes} that form the scope of “reachable” nodes
|
|
50
|
-
* @param extractionFacade - an {@link ExtractionFacade} to reflect on nodes.
|
|
51
|
-
* _Note_ that it's assumed that its {@link getFeatureValue} function doesn't throw.
|
|
52
|
-
*/
|
|
53
|
-
export declare const referencesToOutOfScopeNodes: <NT extends Node>(scope: NT[], extractionFacade: ExtractionFacade<NT>) => ReferenceValue<NT>[];
|
|
1
|
+
export { referenceValues, incomingReferences, referencesToOutOfScopeNodes } from "@lionweb/core";
|
|
2
|
+
export type { ReferenceValue } from "@lionweb/core";
|
|
54
3
|
//# sourceMappingURL=reference-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reference-utils.d.ts","sourceRoot":"","sources":["../../src/m1/reference-utils.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"reference-utils.d.ts","sourceRoot":"","sources":["../../src/m1/reference-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAE,kBAAkB,EAAE,2BAA2B,EAAC,MAAM,eAAe,CAAA;AAC9F,YAAY,EAAC,cAAc,EAAC,MAAM,eAAe,CAAA"}
|
|
@@ -1,78 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Represents information about a source and target node related through a {@link Reference}.
|
|
4
|
-
* An index of `null` means that the reference is (at most) single-valued.
|
|
5
|
-
*/
|
|
6
|
-
export class ReferenceValue {
|
|
7
|
-
constructor(sourceNode, targetNode, reference, index) {
|
|
8
|
-
this.sourceNode = sourceNode;
|
|
9
|
-
this.targetNode = targetNode;
|
|
10
|
-
this.reference = reference;
|
|
11
|
-
this.index = index;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Finds all references within the given scope, as {@link ReferenceValue reference values}.
|
|
16
|
-
* To search within all nodes under a collection of root nodes,
|
|
17
|
-
* use _child extraction_ to compute all nodes in the forest hanging off of those root nodes as scope.
|
|
18
|
-
* Note that any reference is found uniquely,
|
|
19
|
-
* i.e. the returned {@link ReferenceValue reference values} are pairwise distinct,
|
|
20
|
-
* even if the scope passed contains duplicate nodes.
|
|
21
|
-
*
|
|
22
|
-
* @param scope - the {@link Node nodes} that are searched for references
|
|
23
|
-
* @param extractionFacade - an {@link ExtractionFacade} to reflect on nodes.
|
|
24
|
-
* _Note_ that it's assumed that its {@link getFeatureValue} function doesn't throw.
|
|
25
|
-
*/
|
|
26
|
-
export const referenceValues = (scope, extractionFacade) => {
|
|
27
|
-
const visit = (sourceNode, reference) => {
|
|
28
|
-
if (reference.multiple) {
|
|
29
|
-
const targetNodes = extractionFacade.getFeatureValue(sourceNode, reference) ?? [];
|
|
30
|
-
return targetNodes
|
|
31
|
-
.map((targetNode, index) => new ReferenceValue(sourceNode, targetNode, reference, index));
|
|
32
|
-
}
|
|
33
|
-
const targetNode = extractionFacade.getFeatureValue(sourceNode, reference);
|
|
34
|
-
if (targetNode !== undefined) {
|
|
35
|
-
return [new ReferenceValue(sourceNode, targetNode, reference, null)];
|
|
36
|
-
}
|
|
37
|
-
return [];
|
|
38
|
-
};
|
|
39
|
-
return [...new Set(scope)] // ~ .distinct()
|
|
40
|
-
.flatMap((sourceNode) => allFeaturesOf(extractionFacade.classifierOf(sourceNode))
|
|
41
|
-
.filter((feature) => feature instanceof Reference)
|
|
42
|
-
.map((feature) => feature)
|
|
43
|
-
.flatMap((reference) => visit(sourceNode, reference)));
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* Finds all references coming into the given target node or any of the given target nodes,
|
|
47
|
-
* within the given scope, as {@link ReferenceValue reference values}.
|
|
48
|
-
* To search within all nodes under a collection of root nodes,
|
|
49
|
-
* use _child extraction_ to compute all nodes in the forest hanging off of those root nodes as scope.
|
|
50
|
-
* Note that any reference is found uniquely,
|
|
51
|
-
* i.e. the returned {@link ReferenceValue reference values} are pairwise distinct,
|
|
52
|
-
* even if the given target nodes or scope contain duplicate nodes.
|
|
53
|
-
*
|
|
54
|
-
* @param targetNodeOrNodes - one or more target {@link Node nodes} for which the incoming references are searched
|
|
55
|
-
* @param scope - the {@link Node nodes} that are searched for references
|
|
56
|
-
* @param extractionFacade - an {@link ExtractionFacade} to reflect on nodes.
|
|
57
|
-
* _Note_ that it's assumed that its {@link getFeatureValue} function doesn't throw.
|
|
58
|
-
*/
|
|
59
|
-
export const incomingReferences = (targetNodeOrNodes, scope, extractionFacade) => {
|
|
60
|
-
const targetNodes = Array.isArray(targetNodeOrNodes) ? targetNodeOrNodes : [targetNodeOrNodes];
|
|
61
|
-
return referenceValues(scope, extractionFacade)
|
|
62
|
-
.filter((referenceValue) => targetNodes.indexOf(referenceValue.targetNode) > -1);
|
|
63
|
-
};
|
|
64
|
-
/**
|
|
65
|
-
* Finds all references to nodes that are not in the given scope, as {@link ReferenceValue reference values}.
|
|
66
|
-
* To search within all nodes under a collection of root nodes,
|
|
67
|
-
* use _child extraction_ to compute all nodes in the forest hanging off of those root nodes as scope.
|
|
68
|
-
* Note that any reference is found uniquely,
|
|
69
|
-
* i.e. the returned {@link ReferenceValue reference values} are pairwise distinct,
|
|
70
|
-
* even if the given scope contains duplicate nodes.
|
|
71
|
-
*
|
|
72
|
-
* @param scope - the {@link Node nodes} that form the scope of “reachable” nodes
|
|
73
|
-
* @param extractionFacade - an {@link ExtractionFacade} to reflect on nodes.
|
|
74
|
-
* _Note_ that it's assumed that its {@link getFeatureValue} function doesn't throw.
|
|
75
|
-
*/
|
|
76
|
-
export const referencesToOutOfScopeNodes = (scope, extractionFacade) => referenceValues(scope, extractionFacade)
|
|
77
|
-
.filter((referenceValue) => scope.indexOf(referenceValue.targetNode) === -1);
|
|
1
|
+
export { referenceValues, incomingReferences, referencesToOutOfScopeNodes } from "@lionweb/core";
|
|
78
2
|
//# sourceMappingURL=reference-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reference-utils.js","sourceRoot":"","sources":["../../src/m1/reference-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"reference-utils.js","sourceRoot":"","sources":["../../src/m1/reference-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAE,kBAAkB,EAAE,2BAA2B,EAAC,MAAM,eAAe,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Mermaid-generator.js","sourceRoot":"","sources":["../../../src/m3/diagrams/Mermaid-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"Mermaid-generator.js","sourceRoot":"","sources":["../../../src/m3/diagrams/Mermaid-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,UAAU,EAAW,MAAM,oBAAoB,CAAA;AACjE,OAAO,EACH,UAAU,EACV,OAAO,EACP,WAAW,EACX,oBAAoB,EACpB,WAAW,EAEX,SAAS,EACT,oBAAoB,EACpB,KAAK,EAGL,IAAI,EACJ,qBAAqB,EACrB,aAAa,EACb,WAAW,EACX,IAAI,EACJ,UAAU,EACb,MAAM,eAAe,CAAA;AACtB,OAAO,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAA;AAG5C,iDAAiD;AAEjD,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;AAEpC,MAAM,KAAK,GAAG,CAAC,MAAgB,EAAE,QAAkB,EAAY,EAAE,CAC7D,QAAQ,CAAC,MAAM,KAAK,CAAC;IACjB,CAAC,CAAC,MAAM;IACR,CAAC,CAAC;QACE,GAAG,MAAM,IAAI;QACb,QAAQ,CAAC,QAAQ,CAAC;QAClB,GAAG;KACN,CAAA;AAET,MAAM,WAAW,GAAG,CAAC,OAAiB,EAAY,EAAE,CAChD;IACI,OAAO;IACP,EAAE;CACL,CAAA;AAGL;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,EAAC,QAAQ,EAAW,EAAE,EAAE,CAC/D,QAAQ,CAAC;IACL,YAAY;IACZ;;CAEP;IACO,QAAQ,CAAC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,"file":"textgen.js","sourceRoot":"","sources":["../../../src/m3/ts-generation/textgen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAA;AAG7C,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ts-types-generator.d.ts","sourceRoot":"","sources":["../../../src/m3/ts-generation/ts-types-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAiBH,QAAQ,EAWX,MAAM,eAAe,CAAA;AA2FtB,oBAAY,iBAAiB;IACzB,YAAY,IAAA;CACf;AAGD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,aAAc,QAAQ,wBAAwB,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"ts-types-generator.d.ts","sourceRoot":"","sources":["../../../src/m3/ts-generation/ts-types-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAiBH,QAAQ,EAWX,MAAM,eAAe,CAAA;AA2FtB,oBAAY,iBAAiB;IACzB,YAAY,IAAA;CACf;AAGD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,aAAc,QAAQ,wBAAwB,iBAAiB,EAAE,WAwI/F,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { allFeaturesOf, Annotation, builtinClassifiers, builtinPrimitives, Classifier, Concept, conceptsOf, Enumeration, groupBy, inheritsFrom, Interface, isConcrete,
|
|
2
|
-
import { asString } from "littoral-templates";
|
|
3
|
-
import {
|
|
1
|
+
import { allFeaturesOf, Annotation, builtinClassifiers, builtinPrimitives, Classifier, Concept, conceptsOf, Enumeration, groupBy, inheritsFrom, Interface, isConcrete, Link, lioncoreBuiltins, mapValues, nameOf, nameSorted, PrimitiveType, Property, unresolved } from "@lionweb/core";
|
|
2
|
+
import { asString, when } from "littoral-templates";
|
|
3
|
+
import { indent } from "./textgen.js";
|
|
4
4
|
import { tsFromTypeDef, TypeDefModifier } from "./type-def.js";
|
|
5
5
|
import { uniquesAmong } from "../../utils/array.js";
|
|
6
6
|
import { picker } from "../../utils/object.js";
|
|
@@ -148,8 +148,8 @@ export const tsTypesForLanguage = (language, ...generationOptions) => {
|
|
|
148
148
|
.map((classifier) => classifier)
|
|
149
149
|
];
|
|
150
150
|
const coreImports = [
|
|
151
|
-
...
|
|
152
|
-
...
|
|
151
|
+
...when(!language.entities.every(usesINamedDirectly))([`DynamicNode`]),
|
|
152
|
+
...when(language.entities.some(usesINamedDirectly))([`INamed`])
|
|
153
153
|
];
|
|
154
154
|
const generatedDependencies = uniquesAmong(language.entities
|
|
155
155
|
.filter((entity) => entity instanceof Classifier)
|
|
@@ -167,14 +167,14 @@ export const tsTypesForLanguage = (language, ...generationOptions) => {
|
|
|
167
167
|
* version: ${language.version}
|
|
168
168
|
*/`,
|
|
169
169
|
``,
|
|
170
|
-
|
|
170
|
+
when(coreImports.length > 0)(`import {${coreImports.join(`, `)}} from "@lionweb/core";`),
|
|
171
171
|
Object.keys(importsPerPackage)
|
|
172
172
|
.sort()
|
|
173
173
|
.map((packageName) => `import {${nameSorted(importsPerPackage[packageName]).map(nameOf).join(", ")}} from "./${packageName}.js";`),
|
|
174
174
|
``,
|
|
175
175
|
``,
|
|
176
176
|
nameSorted(language.entities).map(typeForLanguageEntity),
|
|
177
|
-
|
|
177
|
+
when(concreteClassifiers.length > 0)([
|
|
178
178
|
``,
|
|
179
179
|
`/** sum type of all types for all concrete classifiers of ${language.name}: */`,
|
|
180
180
|
`export type Nodes = ${nameSorted(concreteClassifiers).map(nameOf).join(` | `)};`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ts-types-generator.js","sourceRoot":"","sources":["../../../src/m3/ts-generation/ts-types-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,EACV,OAAO,EACP,UAAU,EAIV,WAAW,EAEX,OAAO,EACP,YAAY,EACZ,SAAS,EACT,UAAU,EAGV,gBAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"ts-types-generator.js","sourceRoot":"","sources":["../../../src/m3/ts-generation/ts-types-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,EACV,OAAO,EACP,UAAU,EAIV,WAAW,EAEX,OAAO,EACP,YAAY,EACZ,SAAS,EACT,UAAU,EAGV,IAAI,EACJ,gBAAgB,EAChB,SAAS,EACT,MAAM,EACN,UAAU,EACV,aAAa,EACb,QAAQ,EAER,UAAU,EACb,MAAM,eAAe,CAAA;AACtB,OAAO,EAAC,QAAQ,EAAY,IAAI,EAAC,MAAM,oBAAoB,CAAA;AAC3D,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAA;AACnC,OAAO,EAAQ,aAAa,EAAE,eAAe,EAAC,MAAM,eAAe,CAAA;AACnE,OAAO,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAA;AACjD,OAAO,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAA;AAG5C,MAAM,eAAe,GAAG,CAAC,OAAgB,EAAE,EAAE;IACzC,IAAI,OAAO,YAAY,IAAI,EAAE,CAAC;QAC1B,OAAO,YAAY,CAAC,OAAO,CAAC,CAAA;IAChC,CAAC;IACD,IAAI,OAAO,YAAY,QAAQ,EAAE,CAAC;QAC9B,OAAO,gBAAgB,CAAC,OAAO,CAAC,CAAA;IACpC,CAAC;IACD,OAAO;QACH,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,SAAS;KAClB,CAAA;AACL,CAAC,CAAA;AAGD,MAAM,YAAY,GAAG,CAAC,EAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAO,EAAS,EAAE,CACnE,CAAC;IACG,IAAI;IACJ,QAAQ,EAAE,QAAQ,IAAI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GAAG,CAAC,qBAAqB,CAAC;QACxD,IAAI,CAAC,mBAAmB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YACjC,EAAE;YACF,6DAA6D,QAAQ,CAAC,IAAI,MAAM;YAChF,uBAAuB,UAAU,CAAC,mBAAmB,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG;YACjF,EAAE;SACL,CAAC;KACL,CACJ,CAAA;AACL,CAAC,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Template } from "littoral-templates";
|
|
2
2
|
export declare enum TypeDefModifier {
|
|
3
3
|
none = 0,
|
|
4
4
|
abstract = 1,
|
|
@@ -16,5 +16,5 @@ export type Field = {
|
|
|
16
16
|
optional: boolean;
|
|
17
17
|
type: string;
|
|
18
18
|
};
|
|
19
|
-
export declare const tsFromTypeDef: ({ modifier, name, mixinNames, bodyComment, fields }: TypeDef) =>
|
|
19
|
+
export declare const tsFromTypeDef: ({ modifier, name, mixinNames, bodyComment, fields }: TypeDef) => Template;
|
|
20
20
|
//# sourceMappingURL=type-def.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-def.d.ts","sourceRoot":"","sources":["../../../src/m3/ts-generation/type-def.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"type-def.d.ts","sourceRoot":"","sources":["../../../src/m3/ts-generation/type-def.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAO,MAAM,oBAAoB,CAAA;AAIjD,oBAAY,eAAe;IACvB,IAAI,IAAA;IACJ,QAAQ,IAAA;IACR,SAAS,IAAA;CACZ;AAED,MAAM,MAAM,OAAO,GAAG;IAClB,QAAQ,EAAE,eAAe,CAAA;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,KAAK,EAAE,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,KAAK,GAAG;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,OAAO,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;CACf,CAAA;AAOD,eAAO,MAAM,aAAa,wDAAuD,OAAO,KAAG,QAiB1F,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { when } from "littoral-templates";
|
|
2
|
+
import { indent } from "./textgen.js";
|
|
2
3
|
export var TypeDefModifier;
|
|
3
4
|
(function (TypeDefModifier) {
|
|
4
5
|
TypeDefModifier[TypeDefModifier["none"] = 0] = "none";
|
|
@@ -10,10 +11,10 @@ export const tsFromTypeDef = ({ modifier, name, mixinNames, bodyComment, fields
|
|
|
10
11
|
const hasBody = !!bodyComment || fields.length > 0;
|
|
11
12
|
return [
|
|
12
13
|
`${modifier === TypeDefModifier.none ? `` : `/** ${TypeDefModifier[modifier]} */ `}export type ${name} = ${mixinNames.join(` & `)}${!hasBody ? `;` : ` & {`}`,
|
|
13
|
-
|
|
14
|
+
when(hasBody)([
|
|
14
15
|
indent([
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
when(!!bodyComment)(`// ${bodyComment}`),
|
|
17
|
+
when(fields.length > 0)([
|
|
17
18
|
`settings: {`,
|
|
18
19
|
indent(fields.map(tsFromField)),
|
|
19
20
|
`};`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-def.js","sourceRoot":"","sources":["../../../src/m3/ts-generation/type-def.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"type-def.js","sourceRoot":"","sources":["../../../src/m3/ts-generation/type-def.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,IAAI,EAAC,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAA;AAGnC,MAAM,CAAN,IAAY,eAIX;AAJ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Table, Property } from "@lionweb/core";
|
|
2
2
|
import { asString, indentWith } from "littoral-templates";
|
|
3
3
|
const indent = indentWith(" ")(1);
|
|
4
|
-
const prependWith = (
|
|
4
|
+
const prependWith = (template, prefix) => prefix + asString(template);
|
|
5
5
|
export const genericAsTreeText = ({ nodes }, languages = []) => {
|
|
6
6
|
const nodesById = byIdMap(nodes);
|
|
7
7
|
const symbolTable = new MemoisingSymbolTable(languages);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textualizer.js","sourceRoot":"","sources":["../../src/serialization/textualizer.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,OAAO,EACP,WAAW,EAGX,oBAAoB,EAEpB,QAAQ,EAOX,MAAM,eAAe,CAAA;AACtB,OAAO,EAAC,QAAQ,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"textualizer.js","sourceRoot":"","sources":["../../src/serialization/textualizer.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,OAAO,EACP,WAAW,EAGX,oBAAoB,EAEpB,QAAQ,EAOX,MAAM,eAAe,CAAA;AACtB,OAAO,EAAC,QAAQ,EAAE,UAAU,EAAW,MAAM,oBAAoB,CAAA;AAGjE,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;AAEpC,MAAM,WAAW,GAAG,CAAC,QAAkB,EAAE,MAAc,EAAY,EAAE,CACjE,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAA;AAE/B,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,EAAC,KAAK,EAAqB,EAAE,YAAwB,EAAE,EAAE,EAAE;IAEzF,MAAM,SAAS,GAAiC,OAAO,CAAC,KAAK,CAAC,CAAA;IAC9D,MAAM,WAAW,GAAG,IAAI,oBAAoB,CAAC,SAAS,CAAC,CAAA;IAEvD,MAAM,SAAS,GAAG,CAAC,UAAuB,EAAE,OAAoB,EAAU,EAAE,CACxE,WAAW,CAAC,eAAe,CAAC,UAAU,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AAqB,CAAC,GAAG,GAAG,SAAS,EAAE,KAAK;QAC9G,MAAM,CAAC;YACH,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,cAAc,EAAE,qBAAqB,CAAC,CAAC;YAC7D,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,eAAe,EAAE,qBAAqB,CAAC,CAAC;YAC9D,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,iBAAiB,EAAE,qBAAqB,CAAC,CAAC;YAClE,WAAW,CAAC,GAAG,CAAC,gBAAgB,CAAC;SACpC,CAAC;QACF,GAAG;KACN,CAAA;IAEL,OAAO,QAAQ,CACX,KAAK;SACA,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,aAAa;SACpD,GAAG,CAAC,MAAM,CAAC,CACnB,CAAA;AACL,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lionweb/utilities",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.11-beta.1",
|
|
4
4
|
"description": "LionWeb utilities",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"url": "https://github.com/LionWeb-io/lionweb-typescript/issues"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@lionweb/core": "0.6.
|
|
19
|
-
"littoral-templates": "0.
|
|
20
|
-
"nanoid": "
|
|
18
|
+
"@lionweb/core": "0.6.11-beta.1",
|
|
19
|
+
"littoral-templates": "0.3.0",
|
|
20
|
+
"nanoid": "5.0.9"
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
23
|
"clean": "rm -rf dist/ lionweb-utilities-*.tgz",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { NestedString } from "littoral-templates";
|
|
2
|
-
export declare const indent: (_: NestedString) => string[];
|
|
3
|
-
/**
|
|
4
|
-
* Include the given `result` only when the `expr` is `true`.
|
|
5
|
-
*/
|
|
6
|
-
export declare const cond: (expr: boolean, result: NestedString) => NestedString[];
|
|
7
|
-
//# sourceMappingURL=text-generation-utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"text-generation-utils.d.ts","sourceRoot":"","sources":["../../../src/m3/ts-generation/text-generation-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,YAAY,EAAC,MAAM,oBAAoB,CAAA;AAG3D,eAAO,MAAM,MAAM,+BAAwB,CAAA;AAG3C;;GAEG;AACH,eAAO,MAAM,IAAI,SAAU,OAAO,UAAU,YAAY,mBAChC,CAAA"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { indentWith } from "littoral-templates";
|
|
2
|
-
export const indent = indentWith(" ")(1);
|
|
3
|
-
/**
|
|
4
|
-
* Include the given `result` only when the `expr` is `true`.
|
|
5
|
-
*/
|
|
6
|
-
export const cond = (expr, result) => expr ? [result] : [];
|
|
7
|
-
//# sourceMappingURL=text-generation-utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"text-generation-utils.js","sourceRoot":"","sources":["../../../src/m3/ts-generation/text-generation-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAe,MAAM,oBAAoB,CAAA;AAG3D,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;AAG3C;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,IAAa,EAAE,MAAoB,EAAE,EAAE,CACxD,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA"}
|