@lionweb/core 0.6.13-beta.7 → 0.7.0-alpha.10
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 +29 -7
- package/dist/deserializer.d.ts +18 -9
- package/dist/deserializer.d.ts.map +1 -1
- package/dist/deserializer.js +40 -43
- package/dist/deserializer.js.map +1 -1
- package/dist/dynamic-facade.d.ts +15 -6
- package/dist/dynamic-facade.d.ts.map +1 -1
- package/dist/dynamic-facade.js +13 -5
- package/dist/dynamic-facade.js.map +1 -1
- package/dist/extraction.d.ts +15 -0
- package/dist/extraction.d.ts.map +1 -0
- package/dist/extraction.js +17 -0
- package/dist/extraction.js.map +1 -0
- package/dist/functions.d.ts +4 -3
- package/dist/functions.d.ts.map +1 -1
- package/dist/functions.js +1 -1
- package/dist/functions.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/m1/reference-utils.d.ts +7 -7
- package/dist/m1/reference-utils.d.ts.map +1 -1
- package/dist/m1/reference-utils.js +10 -10
- package/dist/m1/reference-utils.js.map +1 -1
- package/dist/m3/builtins.d.ts +38 -17
- package/dist/m3/builtins.d.ts.map +1 -1
- package/dist/m3/builtins.js +66 -44
- package/dist/m3/builtins.js.map +1 -1
- package/dist/m3/constraints.d.ts.map +1 -1
- package/dist/m3/constraints.js +10 -5
- package/dist/m3/constraints.js.map +1 -1
- package/dist/m3/deserializer.d.ts +3 -3
- package/dist/m3/deserializer.d.ts.map +1 -1
- package/dist/m3/deserializer.js +4 -4
- package/dist/m3/deserializer.js.map +1 -1
- package/dist/m3/facade.d.ts +13 -4
- package/dist/m3/facade.d.ts.map +1 -1
- package/dist/m3/facade.js +17 -9
- package/dist/m3/facade.js.map +1 -1
- package/dist/m3/factory.d.ts +2 -2
- package/dist/m3/factory.d.ts.map +1 -1
- package/dist/m3/factory.js.map +1 -1
- package/dist/m3/functions.d.ts +33 -12
- package/dist/m3/functions.d.ts.map +1 -1
- package/dist/m3/functions.js +32 -14
- package/dist/m3/functions.js.map +1 -1
- package/dist/m3/index.d.ts +1 -0
- package/dist/m3/index.d.ts.map +1 -1
- package/dist/m3/index.js +1 -0
- package/dist/m3/index.js.map +1 -1
- package/dist/m3/lioncore.d.ts +2 -0
- package/dist/m3/lioncore.d.ts.map +1 -1
- package/dist/m3/lioncore.js +25 -60
- package/dist/m3/lioncore.js.map +1 -1
- package/dist/m3/reference-checker.d.ts.map +1 -1
- package/dist/m3/reference-checker.js +2 -2
- package/dist/m3/reference-checker.js.map +1 -1
- package/dist/m3/serializer.d.ts +2 -2
- package/dist/m3/serializer.d.ts.map +1 -1
- package/dist/m3/serializer.js +3 -3
- package/dist/m3/serializer.js.map +1 -1
- package/dist/m3/types.d.ts +26 -21
- package/dist/m3/types.d.ts.map +1 -1
- package/dist/m3/types.js +9 -4
- package/dist/m3/types.js.map +1 -1
- package/dist/reading.d.ts +45 -0
- package/dist/reading.d.ts.map +1 -0
- package/dist/reading.js +2 -0
- package/dist/reading.js.map +1 -0
- package/dist/references.d.ts +3 -3
- package/dist/references.d.ts.map +1 -1
- package/dist/serializer.d.ts +31 -10
- package/dist/serializer.d.ts.map +1 -1
- package/dist/serializer.js +111 -109
- package/dist/serializer.js.map +1 -1
- package/dist/symbol-table.d.ts +15 -15
- package/dist/symbol-table.d.ts.map +1 -1
- package/dist/symbol-table.js +2 -9
- package/dist/symbol-table.js.map +1 -1
- package/dist/types.d.ts +2 -10
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -6
- package/dist/types.js.map +1 -1
- package/dist/writing.d.ts +49 -0
- package/dist/writing.d.ts.map +1 -0
- package/dist/writing.js +30 -0
- package/dist/writing.js.map +1 -0
- package/package.json +13 -7
- package/dist/facade.d.ts +0 -84
- package/dist/facade.d.ts.map +0 -1
- package/dist/facade.js +0 -41
- package/dist/facade.js.map +0 -1
- package/dist/serialization.d.ts +0 -52
- package/dist/serialization.d.ts.map +0 -1
- package/dist/serialization.js +0 -7
- package/dist/serialization.js.map +0 -1
- package/dist/utils/array-helpers.d.ts +0 -14
- package/dist/utils/array-helpers.d.ts.map +0 -1
- package/dist/utils/array-helpers.js +0 -15
- package/dist/utils/array-helpers.js.map +0 -1
- package/dist/utils/cycles.d.ts +0 -8
- package/dist/utils/cycles.d.ts.map +0 -1
- package/dist/utils/cycles.js +0 -26
- package/dist/utils/cycles.js.map +0 -1
- package/dist/utils/index.d.ts +0 -7
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -7
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/map-helpers.d.ts +0 -26
- package/dist/utils/map-helpers.d.ts.map +0 -1
- package/dist/utils/map-helpers.js +0 -41
- package/dist/utils/map-helpers.js.map +0 -1
- package/dist/utils/recursion.d.ts +0 -13
- package/dist/utils/recursion.d.ts.map +0 -1
- package/dist/utils/recursion.js +0 -21
- package/dist/utils/recursion.js.map +0 -1
- package/dist/utils/sorting.d.ts +0 -7
- package/dist/utils/sorting.d.ts.map +0 -1
- package/dist/utils/sorting.js +0 -7
- package/dist/utils/sorting.js.map +0 -1
- package/dist/utils/string-mapping.d.ts +0 -6
- package/dist/utils/string-mapping.d.ts.map +0 -1
- package/dist/utils/string-mapping.js +0 -10
- package/dist/utils/string-mapping.js.map +0 -1
package/dist/serializer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializer.js","sourceRoot":"","sources":["../src/serializer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serializer.js","sourceRoot":"","sources":["../src/serializer.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,iCAAiC,EAKpC,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAGtC,OAAO,EAAE,8BAA8B,EAAE,MA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EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAA;QAE7C,OAAO;YACH,0BAA0B,EAAE,iCAAiC;YAC7D,SAAS,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;YACtE,KAAK,EAAE,eAAe;SACzB,CAAA;IACL,CAAC,CAAA;AACL,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC1B,KAAW,EACX,MAAkB,EAClB,gCAAiF,EACjE,EAAE,CAClB,cAAc,CACV,MAAM,EACN,yBAAyB,CAAC,gCAAgC,CAAC;IACvD,CAAC,CAAC;QACE,uBAAuB,EAAE,gCAAgC;KAC5D;IACD,CAAC,CAAC,gCAAgC,CACzC,CAAC,KAAK,CAAC,CAAA"}
|
package/dist/symbol-table.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LionWebJsonMetaPointer, LionWebKey } from "@lionweb/json";
|
|
2
2
|
import { Feature, Language, LanguageEntity } from "./m3/types.js";
|
|
3
3
|
/**
|
|
4
|
-
* Interface for objects that can look up within languages, based on given {@link
|
|
4
|
+
* Interface for objects that can look up within languages, based on given {@link LionWebJsonMetaPointer meta pointers}.
|
|
5
5
|
* This is meant to be able to properly encapsulate performance optimizations, also outside of the context
|
|
6
6
|
* of deserialization.
|
|
7
7
|
*/
|
|
@@ -9,20 +9,20 @@ interface SymbolTable {
|
|
|
9
9
|
/**
|
|
10
10
|
* Looks up the {@link Language}, as pointed to by the given language key and version.
|
|
11
11
|
*/
|
|
12
|
-
languageMatching(key:
|
|
12
|
+
languageMatching(key: LionWebKey, version: string): Language | undefined;
|
|
13
13
|
/**
|
|
14
|
-
* Looks up the {@link LanguageEntity}, as pointed to by the given {@link
|
|
14
|
+
* Looks up the {@link LanguageEntity}, as pointed to by the given {@link LionWebJsonMetaPointer},
|
|
15
15
|
* or {@code undefined} if it couldn't be found.
|
|
16
16
|
*/
|
|
17
|
-
entityMatching(entityMetaPointer:
|
|
17
|
+
entityMatching(entityMetaPointer: LionWebJsonMetaPointer): LanguageEntity | undefined;
|
|
18
18
|
/**
|
|
19
|
-
* Looks up the {@link Feature}, as pointed to by the {@link
|
|
20
|
-
* as a feature of the {@link Classifier}, as pointed to by the {@link
|
|
19
|
+
* Looks up the {@link Feature}, as pointed to by the {@link LionWebJsonMetaPointer} given second,
|
|
20
|
+
* as a feature of the {@link Classifier}, as pointed to by the {@link LionWebJsonMetaPointer} given first,
|
|
21
21
|
* or {@code undefined} it it couldn't be found.
|
|
22
|
-
* <em>Note</em> that the {@code language} and {@code version} values of both {@link
|
|
22
|
+
* <em>Note</em> that the {@code language} and {@code version} values of both {@link LionWebJsonMetaPointer}-typed arguments should coincide,
|
|
23
23
|
* although this is typically not checked!
|
|
24
24
|
*/
|
|
25
|
-
featureMatching(entityMetaPointer:
|
|
25
|
+
featureMatching(entityMetaPointer: LionWebJsonMetaPointer, featureMetaPointer: LionWebJsonMetaPointer): Feature | undefined;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* Naive, non-performant implementation of {@link SymbolTable}.
|
|
@@ -30,19 +30,19 @@ interface SymbolTable {
|
|
|
30
30
|
declare class NaiveSymbolTable implements SymbolTable {
|
|
31
31
|
private readonly languages;
|
|
32
32
|
constructor(languages: Language[]);
|
|
33
|
-
languageMatching(key:
|
|
34
|
-
entityMatching(entityMetaPointer:
|
|
35
|
-
featureMatching(classifierMetaPointer:
|
|
33
|
+
languageMatching(key: LionWebKey, version: string): Language | undefined;
|
|
34
|
+
entityMatching(entityMetaPointer: LionWebJsonMetaPointer): LanguageEntity | undefined;
|
|
35
|
+
featureMatching(classifierMetaPointer: LionWebJsonMetaPointer, featureMetaPointer: LionWebJsonMetaPointer): Feature | undefined;
|
|
36
36
|
}
|
|
37
37
|
declare class MemoisingSymbolTable implements SymbolTable {
|
|
38
38
|
private readonly languages;
|
|
39
39
|
constructor(languages: Language[]);
|
|
40
40
|
private readonly languageKey2version2language;
|
|
41
|
-
languageMatching(languageKey:
|
|
41
|
+
languageMatching(languageKey: LionWebKey, version: string): Language | undefined;
|
|
42
42
|
private readonly languageKey2version2entityKey2entityInfo;
|
|
43
43
|
private entityInfoMatching;
|
|
44
|
-
entityMatching(entityMetaPointer:
|
|
45
|
-
featureMatching(classifierMetaPointer:
|
|
44
|
+
entityMatching(entityMetaPointer: LionWebJsonMetaPointer): LanguageEntity | undefined;
|
|
45
|
+
featureMatching(classifierMetaPointer: LionWebJsonMetaPointer, featureMetaPointer: LionWebJsonMetaPointer): Feature | undefined;
|
|
46
46
|
}
|
|
47
47
|
export type { SymbolTable };
|
|
48
48
|
export { MemoisingSymbolTable, NaiveSymbolTable };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"symbol-table.d.ts","sourceRoot":"","sources":["../src/symbol-table.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"symbol-table.d.ts","sourceRoot":"","sources":["../src/symbol-table.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAGlE,OAAO,EAAc,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAG7E;;;;GAIG;AACH,UAAU,WAAW;IAEjB;;OAEG;IACH,gBAAgB,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAA;IAExE;;;OAGG;IACH,cAAc,CAAC,iBAAiB,EAAE,sBAAsB,GAAG,cAAc,GAAG,SAAS,CAAA;IAErF;;;;;;OAMG;IACH,eAAe,CAAC,iBAAiB,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,sBAAsB,GAAG,OAAO,GAAG,SAAS,CAAA;CAE9H;AAGD;;GAEG;AACH,cAAM,gBAAiB,YAAW,WAAW;IAEzC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;gBAE1B,SAAS,EAAE,QAAQ,EAAE;IAIjC,gBAAgB,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS;IAOxE,cAAc,CAAC,iBAAiB,EAAE,sBAAsB,GAAG,cAAc,GAAG,SAAS;IAMrF,eAAe,CAAC,qBAAqB,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,sBAAsB,GAAG,OAAO,GAAG,SAAS;CASlI;AASD,cAAM,oBAAqB,YAAW,WAAW;IAE7C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;gBAE1B,SAAS,EAAE,QAAQ,EAAE;IAIjC,OAAO,CAAC,QAAQ,CAAC,4BAA4B,CAAqE;IAElH,gBAAgB,CAAC,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS;IAYhF,OAAO,CAAC,QAAQ,CAAC,wCAAwC,CAAkH;IAE3K,OAAO,CAAC,kBAAkB;IAiB1B,cAAc,CAAC,iBAAiB,EAAE,sBAAsB,GAAG,cAAc,GAAG,SAAS;IAIrF,eAAe,CAAC,qBAAqB,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,sBAAsB,GAAG,OAAO,GAAG,SAAS;CAYlI;AAGD,YAAY,EACR,WAAW,EACd,CAAA;AAED,OAAO,EACH,oBAAoB,EACpB,gBAAgB,EACnB,CAAA"}
|
package/dist/symbol-table.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { lazyMapGet } from "@lionweb/ts-utils";
|
|
2
2
|
import { allFeaturesOf } from "./m3/functions.js";
|
|
3
|
+
import { Classifier } from "./m3/types.js";
|
|
3
4
|
/**
|
|
4
5
|
* Naive, non-performant implementation of {@link SymbolTable}.
|
|
5
6
|
*/
|
|
@@ -25,14 +26,6 @@ class NaiveSymbolTable {
|
|
|
25
26
|
return allFeatures.find((feature) => feature.key === featureMetaPointer.key);
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
|
-
const lazyMapGet = (map, key, createThunk) => {
|
|
29
|
-
if (key in map) {
|
|
30
|
-
return map[key];
|
|
31
|
-
}
|
|
32
|
-
const value = createThunk();
|
|
33
|
-
map[key] = value;
|
|
34
|
-
return value;
|
|
35
|
-
};
|
|
36
29
|
class MemoisingSymbolTable {
|
|
37
30
|
constructor(languages) {
|
|
38
31
|
this.languageKey2version2language = {};
|
package/dist/symbol-table.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"symbol-table.js","sourceRoot":"","sources":["../src/symbol-table.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"symbol-table.js","sourceRoot":"","sources":["../src/symbol-table.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,UAAU,EAAqC,MAAM,eAAe,CAAA;AAiC7E;;GAEG;AACH,MAAM,gBAAgB;IAIlB,YAAY,SAAqB;QAC7B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAC9B,CAAC;IAED,gBAAgB,CAAC,GAAe,EAAE,OAAe;QAC7C,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CACjC,QAAQ,CAAC,GAAG,KAAK,GAAG;eACpB,QAAQ,CAAC,OAAO,KAAK,OAAO,CAClC,CAAA;IACL,CAAC;IAED,cAAc,CAAC,iBAAyC;QACpD,OAAO,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,QAAQ,EAAE,iBAAiB,CAAC,OAAO,CAAC;YAC/E,EAAE,QAAQ;aACT,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,KA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IDs of AST nodes.
|
|
3
|
-
*/
|
|
4
|
-
export type Id = string;
|
|
5
|
-
/**
|
|
6
|
-
* @return whether the given string is a valid identifier according to the LionWeb specification – see [here](https://github.com/LionWeb-io/specification/blob/main/2023.1/metametamodel/metametamodel.adoc#identifiers) for the relevant part.
|
|
7
|
-
* This is essentially whether the given string is a valid, non-empty [Base64url](https://en.wikipedia.org/wiki/Base64#Variants_summary_table) string.
|
|
8
|
-
*/
|
|
9
|
-
export declare const isValidIdentifier: (str: string) => boolean;
|
|
1
|
+
import { LionWebId } from "@lionweb/json";
|
|
10
2
|
/**
|
|
11
3
|
* Type definition for a LionWeb-compliant AST node.
|
|
12
4
|
*/
|
|
13
5
|
export type Node = {
|
|
14
|
-
id:
|
|
6
|
+
id: LionWebId;
|
|
15
7
|
parent?: Node;
|
|
16
8
|
annotations: Node[];
|
|
17
9
|
};
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAEzC;;GAEG;AACH,MAAM,MAAM,IAAI,GAAG;IACf,EAAE,EAAE,SAAS,CAAA;IACb,MAAM,CAAC,EAAE,IAAI,CAAA;IACb,WAAW,EAAE,IAAI,EAAE,CAAA;CACtB,CAAA"}
|
package/dist/types.js
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* @return whether the given string is a valid identifier according to the LionWeb specification – see [here](https://github.com/LionWeb-io/specification/blob/main/2023.1/metametamodel/metametamodel.adoc#identifiers) for the relevant part.
|
|
4
|
-
* This is essentially whether the given string is a valid, non-empty [Base64url](https://en.wikipedia.org/wiki/Base64#Variants_summary_table) string.
|
|
5
|
-
*/
|
|
6
|
-
export const isValidIdentifier = (str) => base64urlRegex.test(str);
|
|
1
|
+
export {};
|
|
7
2
|
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { LionWebId, LionWebKey } from "@lionweb/json";
|
|
2
|
+
import { Classifier, EnumerationLiteral, Feature } from "./m3/types.js";
|
|
3
|
+
import { Node } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* An interface that's used to parametrize generic deserialization of serialization chunks to
|
|
6
|
+
* (in-memory) nodes of the given type (parameter).
|
|
7
|
+
* Implementations of these interfaces {w|c}ould be:
|
|
8
|
+
* - specific to LionCore (so to match m3/types.ts)
|
|
9
|
+
* - generic to deserialize into {@link DynamicNode dynamic nodes}
|
|
10
|
+
*/
|
|
11
|
+
export interface Writer<NT extends Node, PNT extends Node = NT> {
|
|
12
|
+
/**
|
|
13
|
+
* @return An instance of the given concept, also given its parent (or {@link undefined} for root nodes),
|
|
14
|
+
* its ID and the values of the node's properties ("settings").
|
|
15
|
+
* (The latter may be required as arguments for the constructor of a class, whose instances represent nodes.)
|
|
16
|
+
*/
|
|
17
|
+
nodeFor: (parent: PNT | undefined, classifier: Classifier, id: LionWebId, propertySettings: {
|
|
18
|
+
[propertyKey: LionWebKey]: unknown;
|
|
19
|
+
}) => NT;
|
|
20
|
+
/**
|
|
21
|
+
* Sets the *single* given value of the indicated {@link Feature} on the given node.
|
|
22
|
+
* This means adding it in case the feature is multi-valued, meaning it is a {@link Link} with {@code multiple = true}.
|
|
23
|
+
*/
|
|
24
|
+
setFeatureValue: (node: NT, feature: Feature, value: unknown) => void;
|
|
25
|
+
/**
|
|
26
|
+
* @return The runtime encoding of the given {@link EnumerationLiteral}.
|
|
27
|
+
*/
|
|
28
|
+
encodingOf: (literal: EnumerationLiteral) => unknown;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Alias for {@link Writer}, kept for backward compatibility, and to be deprecated and removed later.
|
|
32
|
+
*/
|
|
33
|
+
export interface InstantiationFacade<NT extends Node, PNT extends Node = NT> extends Writer<NT, PNT> {
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Type def. for functions that update features’ values on a settings object.
|
|
37
|
+
*/
|
|
38
|
+
export type SettingsUpdater = (settings: Record<string, unknown>, feature: Feature, value: unknown) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Updates the value of the given {@link Feature feature} on the given "settings" object
|
|
41
|
+
* (either a {@link Node node} or a sub object of it), using the feature's *name*.
|
|
42
|
+
*/
|
|
43
|
+
export declare const updateSettingsNameBased: SettingsUpdater;
|
|
44
|
+
/**
|
|
45
|
+
* Updates the value of the given {@link Feature feature} on the given "settings" object
|
|
46
|
+
* (either a {@link Node node} or a sub object of it), using the feature's *key*.
|
|
47
|
+
*/
|
|
48
|
+
export declare const updateSettingsKeyBased: SettingsUpdater;
|
|
49
|
+
//# sourceMappingURL=writing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writing.d.ts","sourceRoot":"","sources":["../src/writing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAErD,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,OAAO,EAAQ,MAAM,eAAe,CAAA;AAC7E,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAGjC;;;;;;GAMG;AACH,MAAM,WAAW,MAAM,CAAC,EAAE,SAAS,IAAI,EAAE,GAAG,SAAS,IAAI,GAAG,EAAE;IAE1D;;;;OAIG;IACH,OAAO,EAAE,CAAC,MAAM,EAAE,GAAG,GAAG,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE;QAAE,CAAC,WAAW,EAAE,UAAU,GAAG,OAAO,CAAA;KAAE,KAAK,EAAE,CAAA;IAGzI;;;OAGG;IACH,eAAe,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IAGrE;;OAEG;IACH,UAAU,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,OAAO,CAAA;CAEvD;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB,CAAC,EAAE,SAAS,IAAI,EAAE,GAAG,SAAS,IAAI,GAAG,EAAE,CAAE,SAAQ,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC;CAAG;AAGvG;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;AAqB3G;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,eAAyC,CAAA;AAE/E;;;GAGG;AACH,eAAO,MAAM,sBAAsB,iBAAyB,CAAA"}
|
package/dist/writing.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Link } from "./m3/types.js";
|
|
2
|
+
/**
|
|
3
|
+
* @return a {@link SettingsUpdater} that uses the given “meta key” – which is a property/key on the {@link Feature} type –
|
|
4
|
+
* to look up what key to look a feature’s value up on a settings object.
|
|
5
|
+
* <em>Note:</em> for internal use only — use with some care!
|
|
6
|
+
*/
|
|
7
|
+
const settingsUpdater = (metaKey) => (settings, feature, value) => {
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
+
const key = feature[metaKey];
|
|
10
|
+
if (feature instanceof Link && feature.multiple) {
|
|
11
|
+
if (!Array.isArray(settings[key])) {
|
|
12
|
+
settings[key] = [];
|
|
13
|
+
}
|
|
14
|
+
settings[key].push(value);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
settings[key] = value;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Updates the value of the given {@link Feature feature} on the given "settings" object
|
|
22
|
+
* (either a {@link Node node} or a sub object of it), using the feature's *name*.
|
|
23
|
+
*/
|
|
24
|
+
export const updateSettingsNameBased = settingsUpdater("name");
|
|
25
|
+
/**
|
|
26
|
+
* Updates the value of the given {@link Feature feature} on the given "settings" object
|
|
27
|
+
* (either a {@link Node node} or a sub object of it), using the feature's *key*.
|
|
28
|
+
*/
|
|
29
|
+
export const updateSettingsKeyBased = settingsUpdater("key");
|
|
30
|
+
//# sourceMappingURL=writing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writing.js","sourceRoot":"","sources":["../src/writing.ts"],"names":[],"mappings":"AAEA,OAAO,EAA2C,IAAI,EAAE,MAAM,eAAe,CAAA;AA8C7E;;;;GAIG;AACH,MAAM,eAAe,GAAG,CAAC,OAAsB,EAAmB,EAAE,CAChE,CAAC,QAAiC,EAAE,OAAgB,EAAE,KAAc,EAAQ,EAAE;IAClF,8DAA8D;IACtD,MAAM,GAAG,GAAI,OAAe,CAAC,OAAO,CAAW,CAAA;IAC/C,IAAI,OAAO,YAAY,IAAI,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QAC9C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;YAChC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,CAAA;QACtB,CAAC;QACA,QAAQ,CAAC,GAAG,CAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAC5C,CAAC;SAAM,CAAC;QACJ,QAAQ,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;IACzB,CAAC;AACL,CAAC,CAAA;AAEL;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAoB,eAAe,CAAC,MAAM,CAAC,CAAA;AAE/E;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,eAAe,CAAC,KAAK,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lionweb/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0-alpha.10",
|
|
4
4
|
"description": "LionWeb core for {Java|Type}Script",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,13 +15,19 @@
|
|
|
15
15
|
"url": "https://github.com/LionWeb-io/lionweb-typescript/issues"
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
|
-
"clean": "
|
|
18
|
+
"clean": "npx rimraf dist node_modules -g lionweb-core-*.tgz",
|
|
19
19
|
"build": "tsc",
|
|
20
20
|
"lint": "eslint src",
|
|
21
|
-
"pre-release
|
|
22
|
-
"prerelease": "npm run pre-release
|
|
23
|
-
"release": "npm publish",
|
|
24
|
-
"prerelease-beta": "npm run pre-release
|
|
25
|
-
"release-beta": "npm publish --tag beta"
|
|
21
|
+
"prep:pre-release": "npm run clean && npm install && npm run build",
|
|
22
|
+
"prerelease-alpha": "npm run prep:pre-release",
|
|
23
|
+
"release-alpha": "npm publish --tag alpha",
|
|
24
|
+
"prerelease-beta": "npm run prep:pre-release",
|
|
25
|
+
"release-beta": "npm publish --tag beta",
|
|
26
|
+
"prerelease": "npm run prep:pre-release",
|
|
27
|
+
"release": "npm publish"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@lionweb/json": "0.7.0-alpha.10",
|
|
31
|
+
"@lionweb/ts-utils": "0.7.0-alpha.10"
|
|
26
32
|
}
|
|
27
33
|
}
|
package/dist/facade.d.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { Node } from "./types.js";
|
|
2
|
-
import { Classifier, Enumeration, EnumerationLiteral, Feature } from "./m3/types.js";
|
|
3
|
-
/**
|
|
4
|
-
* Type def. for functions that deduce the {@link Classifier classifier} of a given {@link Node node}.
|
|
5
|
-
*/
|
|
6
|
-
type ClassifierDeducer<NT extends Node> = (node: NT) => Classifier;
|
|
7
|
-
/**
|
|
8
|
-
* Type def. for functions that deduce the string value of the `resolveInfo` field of a
|
|
9
|
-
* {@link SerializedReferenceTarget serialized reference target}, or {@code undefined}
|
|
10
|
-
* to indicate that no `resolveInfo` could be derived.
|
|
11
|
-
*/
|
|
12
|
-
type ResolveInfoDeducer<NT extends Node> = (node: NT) => string | undefined;
|
|
13
|
-
/**
|
|
14
|
-
* Two interfaces that defines façades for in-memory models.
|
|
15
|
-
* Instances/implementations of this interface parametrize generic (de-)serialization.
|
|
16
|
-
* Implementations of these interfaces {w|c}ould be:
|
|
17
|
-
* - specific to Lioncore (so to match m3/types.ts)
|
|
18
|
-
* - generic to deserialize into @link DynamicNode}
|
|
19
|
-
*/
|
|
20
|
-
interface ExtractionFacade<NT extends Node> {
|
|
21
|
-
/**
|
|
22
|
-
* @return The {@link Concept concept} of the given node
|
|
23
|
-
*/
|
|
24
|
-
classifierOf: ClassifierDeducer<NT>;
|
|
25
|
-
/**
|
|
26
|
-
* @return The value of the given {@link Feature feature} on the given node.
|
|
27
|
-
*/
|
|
28
|
-
getFeatureValue: (node: NT, feature: Feature) => unknown;
|
|
29
|
-
/**
|
|
30
|
-
* @return The {@link EnumerationLiteral} corresponding to
|
|
31
|
-
* the given {@link Enumeration} and the runtime encoding of a literal of it,
|
|
32
|
-
*/
|
|
33
|
-
enumerationLiteralFrom: (encoding: unknown, enumeration: Enumeration) => EnumerationLiteral | null;
|
|
34
|
-
/**
|
|
35
|
-
* @return The string value of the `resolveInfo` field of a {@link SerializedReferenceTarget serialized reference target},
|
|
36
|
-
* or {@code undefined} to indicate that no `resolveInfo` could be derived.
|
|
37
|
-
*/
|
|
38
|
-
resolveInfoFor?: ResolveInfoDeducer<NT>;
|
|
39
|
-
}
|
|
40
|
-
interface InstantiationFacade<NT extends Node> {
|
|
41
|
-
/**
|
|
42
|
-
* @return An instance of the given concept, also given its parent (or {@link undefined} for root nodes),
|
|
43
|
-
* its ID and the values of the node's properties ("settings").
|
|
44
|
-
* (The latter may be required as arguments for the constructor of a class, whose instances represent nodes.)
|
|
45
|
-
*/
|
|
46
|
-
nodeFor: (parent: NT | undefined, classifier: Classifier, id: string, propertySettings: {
|
|
47
|
-
[propertyKey: string]: unknown;
|
|
48
|
-
}) => NT;
|
|
49
|
-
/**
|
|
50
|
-
* Sets the *single* given value of the indicated {@link Feature} on the given node.
|
|
51
|
-
* This means adding it in case the feature is multi-valued, meaning it is a {@link Link} with {@code multiple = true}.
|
|
52
|
-
*/
|
|
53
|
-
setFeatureValue: (node: NT, feature: Feature, value: unknown) => void;
|
|
54
|
-
/**
|
|
55
|
-
* @return The runtime encoding of the given {@link EnumerationLiteral}.
|
|
56
|
-
*/
|
|
57
|
-
encodingOf: (literal: EnumerationLiteral) => unknown;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Type def. for functions that extract {@link Node nodes} from a given one.
|
|
61
|
-
*/
|
|
62
|
-
type NodesExtractor<NT extends Node> = (node: NT) => NT[];
|
|
63
|
-
/**
|
|
64
|
-
* @return A function that extracts the children from a given node.
|
|
65
|
-
*/
|
|
66
|
-
declare const childrenExtractorUsing: <NT extends Node>(extractionFacade: ExtractionFacade<NT>) => NodesExtractor<NT>;
|
|
67
|
-
/**
|
|
68
|
-
* @return a function that extracts *all* nodes from a given start node - usually a root node.
|
|
69
|
-
*/
|
|
70
|
-
declare const nodesExtractorUsing: <NT extends Node>(extractionFacade: ExtractionFacade<NT>) => NodesExtractor<NT>;
|
|
71
|
-
type SettingsUpdater = (settings: Record<string, unknown>, feature: Feature, value: unknown) => void;
|
|
72
|
-
/**
|
|
73
|
-
* Updates the value of the given {@link Feature feature} on the given "settings" object
|
|
74
|
-
* (either a {@link Node node} or a sub object of it), using the feature's *name*.
|
|
75
|
-
*/
|
|
76
|
-
declare const updateSettingsNameBased: SettingsUpdater;
|
|
77
|
-
/**
|
|
78
|
-
* Updates the value of the given {@link Feature feature} on the given "settings" object
|
|
79
|
-
* (either a {@link Node node} or a sub object of it), using the feature's *key*.
|
|
80
|
-
*/
|
|
81
|
-
declare const updateSettingsKeyBased: SettingsUpdater;
|
|
82
|
-
export type { ClassifierDeducer, ExtractionFacade, InstantiationFacade, NodesExtractor, ResolveInfoDeducer };
|
|
83
|
-
export { childrenExtractorUsing, nodesExtractorUsing, updateSettingsKeyBased, updateSettingsNameBased };
|
|
84
|
-
//# sourceMappingURL=facade.d.ts.map
|
package/dist/facade.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"facade.d.ts","sourceRoot":"","sources":["../src/facade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,YAAY,CAAA;AAC/B,OAAO,EAAC,UAAU,EAAE,WAAW,EAAE,kBAAkB,EAAE,OAAO,EAAO,MAAM,eAAe,CAAA;AAKxF;;GAEG;AACH,KAAK,iBAAiB,CAAC,EAAE,SAAS,IAAI,IAAI,CAAC,IAAI,EAAE,EAAE,KAAK,UAAU,CAAA;AAElE;;;;GAIG;AACH,KAAK,kBAAkB,CAAC,EAAE,SAAS,IAAI,IAAI,CAAC,IAAI,EAAE,EAAE,KAAK,MAAM,GAAG,SAAS,CAAA;AAG3E;;;;;;GAMG;AAGH,UAAU,gBAAgB,CAAC,EAAE,SAAS,IAAI;IAEtC;;OAEG;IACH,YAAY,EAAE,iBAAiB,CAAC,EAAE,CAAC,CAAA;IAEnC;;OAEG;IACH,eAAe,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,KAAK,OAAO,CAAA;IAGxD;;;OAGG;IACH,sBAAsB,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,KAAK,kBAAkB,GAAG,IA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 @@
|
|
|
1
|
-
import { Link } from "./m3/types.js";
|
|
2
|
-
import { flatMapNonCyclingFollowing, trivialFlatMapper } from "./utils/recursion.js";
|
|
3
|
-
import { allFeaturesOf, isContainment } from "./m3/functions.js";
|
|
4
|
-
/**
|
|
5
|
-
* @return A function that extracts the children from a given node.
|
|
6
|
-
*/
|
|
7
|
-
const childrenExtractorUsing = (extractionFacade) => (node) => [
|
|
8
|
-
...(allFeaturesOf(extractionFacade.classifierOf(node))
|
|
9
|
-
.filter(isContainment)
|
|
10
|
-
.flatMap((containment) => extractionFacade.getFeatureValue(node, containment) ?? [])),
|
|
11
|
-
...node.annotations
|
|
12
|
-
];
|
|
13
|
-
/**
|
|
14
|
-
* @return a function that extracts *all* nodes from a given start node - usually a root node.
|
|
15
|
-
*/
|
|
16
|
-
const nodesExtractorUsing = (extractionFacade) => flatMapNonCyclingFollowing(trivialFlatMapper, childrenExtractorUsing(extractionFacade));
|
|
17
|
-
const settingsUpdater = (metaKey) => (settings, feature, value) => {
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
|
-
const key = feature[metaKey];
|
|
20
|
-
if (feature instanceof Link && feature.multiple) {
|
|
21
|
-
if (!Array.isArray(settings[key])) {
|
|
22
|
-
settings[key] = [];
|
|
23
|
-
}
|
|
24
|
-
settings[key].push(value);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
settings[key] = value;
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Updates the value of the given {@link Feature feature} on the given "settings" object
|
|
32
|
-
* (either a {@link Node node} or a sub object of it), using the feature's *name*.
|
|
33
|
-
*/
|
|
34
|
-
const updateSettingsNameBased = settingsUpdater("name");
|
|
35
|
-
/**
|
|
36
|
-
* Updates the value of the given {@link Feature feature} on the given "settings" object
|
|
37
|
-
* (either a {@link Node node} or a sub object of it), using the feature's *key*.
|
|
38
|
-
*/
|
|
39
|
-
const updateSettingsKeyBased = settingsUpdater("key");
|
|
40
|
-
export { childrenExtractorUsing, nodesExtractorUsing, updateSettingsKeyBased, updateSettingsNameBased };
|
|
41
|
-
//# sourceMappingURL=facade.js.map
|
package/dist/facade.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"facade.js","sourceRoot":"","sources":["../src/facade.ts"],"names":[],"mappings":"AACA,OAAO,EAAuD,IAAI,EAAC,MAAM,eAAe,CAAA;AACxF,OAAO,EAAC,0BAA0B,EAAE,iBAAiB,EAAC,MAAM,sBAAsB,CAAA;AAClF,OAAO,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,mBAAmB,CAAA;AAiF9D;;GAEG;AACH,MAAM,sBAAsB,GAAG,CAAkB,gBAAsC,EAAsB,EAAE,CAC3G,CAAC,IAAQ,EAAQ,EAAE,CAAC;IAChB,GAAG,CAAC,aAAa,CAAC,gBAAgB,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;SACjD,MAAM,CAAC,aAAa,CAAC;SACrB,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAAC,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;IACzF,GAAG,IAAI,CAAC,WAAW;CACd,CAAA;AAGb;;GAEG;AACH,MAAM,mBAAmB,GAAG,CAAkB,gBAAsC,EAAsB,EAAE,CACxG,0BAA0B,CAAC,iBAAiB,EAAE,sBAAsB,CAAK,gBAAgB,CAAC,CAAC,CAAA;AAK/F,MAAM,eAAe,GAAG,CAAC,OAAe,EAAmB,EAAE,CACzD,CAAC,QAAiC,EAAE,OAAgB,EAAE,KAAc,EAAQ,EAAE;IAClF,8DAA8D;IACtD,MAAM,GAAG,GAAI,OAAe,CAAC,OAAO,CAAW,CAAA;IAC/C,IAAI,OAAO,YAAY,IAAI,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QAC9C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;YAChC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,CAAA;QACtB,CAAC;QACA,QAAQ,CAAC,GAAG,CAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAC5C,CAAC;SAAM,CAAC;QACJ,QAAQ,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;IACzB,CAAC;AACL,CAAC,CAAA;AAGL;;;GAGG;AACH,MAAM,uBAAuB,GAAoB,eAAe,CAAC,MAAM,CAAC,CAAA;AAExE;;;GAGG;AACH,MAAM,sBAAsB,GAAG,eAAe,CAAC,KAAK,CAAC,CAAA;AAUrD,OAAO,EACH,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EAC1B,CAAA"}
|
package/dist/serialization.d.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { Id } from "./types.js";
|
|
2
|
-
export type MetaPointer = {
|
|
3
|
-
language: string;
|
|
4
|
-
version: string;
|
|
5
|
-
key: string;
|
|
6
|
-
};
|
|
7
|
-
export type SerializedProperty = {
|
|
8
|
-
property: MetaPointer;
|
|
9
|
-
value: (string | null);
|
|
10
|
-
};
|
|
11
|
-
export type SerializedContainment = {
|
|
12
|
-
containment: MetaPointer;
|
|
13
|
-
children: Id[];
|
|
14
|
-
};
|
|
15
|
-
export type SerializedReferenceTarget = {
|
|
16
|
-
reference: Id;
|
|
17
|
-
resolveInfo: string | null;
|
|
18
|
-
};
|
|
19
|
-
export type SerializedReference = {
|
|
20
|
-
reference: MetaPointer;
|
|
21
|
-
targets: SerializedReferenceTarget[];
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Type definition for an AST node serialized to JSON.
|
|
25
|
-
*/
|
|
26
|
-
export type SerializedNode = {
|
|
27
|
-
id: Id;
|
|
28
|
-
classifier: MetaPointer;
|
|
29
|
-
properties: SerializedProperty[];
|
|
30
|
-
containments: SerializedContainment[];
|
|
31
|
-
references: SerializedReference[];
|
|
32
|
-
annotations: Id[];
|
|
33
|
-
parent: (Id | null);
|
|
34
|
-
};
|
|
35
|
-
export type SerializedLanguageReference = {
|
|
36
|
-
key: string;
|
|
37
|
-
version: string;
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* The <em>current</em> version of the serialization format -
|
|
41
|
-
* should fundamentally equal `currentReleaseVersion`.
|
|
42
|
-
*/
|
|
43
|
-
export declare const currentSerializationFormatVersion = "2023.1";
|
|
44
|
-
/**
|
|
45
|
-
* Type definition for a serialization of a whole model to JSON.
|
|
46
|
-
*/
|
|
47
|
-
export type SerializationChunk = {
|
|
48
|
-
serializationFormatVersion: string;
|
|
49
|
-
languages: SerializedLanguageReference[];
|
|
50
|
-
nodes: SerializedNode[];
|
|
51
|
-
};
|
|
52
|
-
//# sourceMappingURL=serialization.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serialization.d.ts","sourceRoot":"","sources":["../src/serialization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,EAAE,EAAC,MAAM,YAAY,CAAA;AAG7B,MAAM,MAAM,WAAW,GAAG;IACtB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,GAAG,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC7B,QAAQ,EAAE,WAAW,CAAA;IACrB,KAAK,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAChC,WAAW,EAAE,WAAW,CAAA;IACxB,QAAQ,EAAE,EAAE,EAAE,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG;IACpC,SAAS,EAAE,EAAE,CAAA;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CAC7B,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAC9B,SAAS,EAAE,WAAW,CAAA;IACtB,OAAO,EAAE,yBAAyB,EAAE,CAAA;CACvC,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IACzB,EAAE,EAAE,EAAE,CAAA;IACN,UAAU,EAAE,WAAW,CAAA;IACvB,UAAU,EAAE,kBAAkB,EAAE,CAAA;IAChC,YAAY,EAAE,qBAAqB,EAAE,CAAA;IACrC,UAAU,EAAE,mBAAmB,EAAE,CAAA;IACjC,WAAW,EAAE,EAAE,EAAE,CAAA;IACjB,MAAM,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,CAAA;CACtB,CAAA;AAGD,MAAM,MAAM,2BAA2B,GAAG;IACtC,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,MAAM,CAAA;CAClB,CAAA;AAGD;;;GAGG;AACH,eAAO,MAAM,iCAAiC,WAAwB,CAAA;AAGtE;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC7B,0BAA0B,EAAE,MAAM,CAAA;IAClC,SAAS,EAAE,2BAA2B,EAAE,CAAA;IACxC,KAAK,EAAE,cAAc,EAAE,CAAA;CAC1B,CAAA"}
|
package/dist/serialization.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { currentReleaseVersion } from "./version.js";
|
|
2
|
-
/**
|
|
3
|
-
* The <em>current</em> version of the serialization format -
|
|
4
|
-
* should fundamentally equal `currentReleaseVersion`.
|
|
5
|
-
*/
|
|
6
|
-
export const currentSerializationFormatVersion = currentReleaseVersion;
|
|
7
|
-
//# sourceMappingURL=serialization.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serialization.js","sourceRoot":"","sources":["../src/serialization.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,qBAAqB,EAAC,MAAM,cAAc,CAAA;AAgDlD;;;GAGG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,qBAAqB,CAAA"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Feature's values are often persisted as either `undefined`, a single object, or an array of objects,
|
|
3
|
-
* regardless of the actual cardinality of that feature.
|
|
4
|
-
* This is e.g. the case when parsing an Ecore XML metamodel file.
|
|
5
|
-
* This type definition captures that phenomenon.
|
|
6
|
-
*/
|
|
7
|
-
export type AnyNumberOf<T> = undefined | T | T[];
|
|
8
|
-
/**
|
|
9
|
-
* Turns a {@link AnyNumberOf feature's value} into an array of objects
|
|
10
|
-
* (possibly empty), regardless of the feature's cardinality and how its
|
|
11
|
-
* value happened to be parsed.
|
|
12
|
-
*/
|
|
13
|
-
export declare const asArray: <T>(thing: AnyNumberOf<T>) => T[];
|
|
14
|
-
//# sourceMappingURL=array-helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"array-helpers.d.ts","sourceRoot":"","sources":["../../src/utils/array-helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,SAAS,GAAG,CAAC,GAAG,CAAC,EAAE,CAAA;AAEhD;;;;GAIG;AACH,eAAO,MAAM,OAAO,mCAQnB,CAAA"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Turns a {@link AnyNumberOf feature's value} into an array of objects
|
|
3
|
-
* (possibly empty), regardless of the feature's cardinality and how its
|
|
4
|
-
* value happened to be parsed.
|
|
5
|
-
*/
|
|
6
|
-
export const asArray = (thing) => {
|
|
7
|
-
if (thing === undefined) {
|
|
8
|
-
return [];
|
|
9
|
-
}
|
|
10
|
-
if (Array.isArray(thing)) {
|
|
11
|
-
return thing;
|
|
12
|
-
}
|
|
13
|
-
return [thing];
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=array-helpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"array-helpers.js","sourceRoot":"","sources":["../../src/utils/array-helpers.ts"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAI,KAAqB,EAAO,EAAE;IACrD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACtB,OAAO,EAAE,CAAA;IACb,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,KAAK,CAAA;IAChB,CAAC;IACD,OAAO,CAAC,KAAK,CAAC,CAAA;AAClB,CAAC,CAAA"}
|
package/dist/utils/cycles.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export type NextsFunction<T> = (t: T) => T[];
|
|
2
|
-
/**
|
|
3
|
-
* Compute whether there's a cycle of dependencies, starting with `thing` and computing "nexts" with the given `nextsFunction`.
|
|
4
|
-
* @return An array with a cycle of "things", starting at the given `thing`.
|
|
5
|
-
* An array of length 0 means: the given `thing` is not part of any cycle.
|
|
6
|
-
*/
|
|
7
|
-
export declare const cycleWith: <T>(thing: T, nextsFunction: NextsFunction<T>) => T[];
|
|
8
|
-
//# sourceMappingURL=cycles.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cycles.d.ts","sourceRoot":"","sources":["../../src/utils/cycles.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAA;AAG5C;;;;GAIG;AACH,eAAO,MAAM,SAAS,uDAMrB,CAAA"}
|
package/dist/utils/cycles.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compute whether there's a cycle of dependencies, starting with `thing` and computing "nexts" with the given `nextsFunction`.
|
|
3
|
-
* @return An array with a cycle of "things", starting at the given `thing`.
|
|
4
|
-
* An array of length 0 means: the given `thing` is not part of any cycle.
|
|
5
|
-
*/
|
|
6
|
-
export const cycleWith = (thing, nextsFunction) => {
|
|
7
|
-
const result = visit(thing, [], nextsFunction);
|
|
8
|
-
return result.length > 0 && result[result.length - 1] === thing
|
|
9
|
-
? result
|
|
10
|
-
: [];
|
|
11
|
-
};
|
|
12
|
-
const visit = (current, chain, nextsFunction) => {
|
|
13
|
-
if (chain.indexOf(current) > -1) {
|
|
14
|
-
// Add current to end, so we know what sub-array constitutes the actual cycle:
|
|
15
|
-
return [...chain, current];
|
|
16
|
-
}
|
|
17
|
-
const extendedChain = [...chain, current];
|
|
18
|
-
for (const dependency of nextsFunction(current)) {
|
|
19
|
-
const recursion = visit(dependency, extendedChain, nextsFunction);
|
|
20
|
-
if (recursion.length > 0) {
|
|
21
|
-
return recursion;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return [];
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=cycles.js.map
|
package/dist/utils/cycles.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cycles.js","sourceRoot":"","sources":["../../src/utils/cycles.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAI,KAAQ,EAAE,aAA+B,EAAO,EAAE;IAE3E,MAAM,MAAM,GAAG,KAAK,CAAI,KAAK,EAAE,EAAE,EAAE,aAAa,CAAC,CAAA;IACjD,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,KAAK;QAC3D,CAAC,CAAC,MAAM;QACR,CAAC,CAAC,EAAE,CAAA;AACZ,CAAC,CAAA;AAED,MAAM,KAAK,GAAG,CAAI,OAAU,EAAE,KAAU,EAAE,aAA+B,EAAO,EAAE;IAC9E,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QAC9B,8EAA8E;QAC9E,OAAO,CAAE,GAAG,KAAK,EAAE,OAAO,CAAE,CAAA;IAChC,CAAC;IACD,MAAM,aAAa,GAAG,CAAE,GAAG,KAAK,EAAE,OAAO,CAAE,CAAA;IAC3C,KA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