@lionweb/core 0.7.0-beta.0 → 0.7.0-beta.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 +24 -3
- package/dist/deserializer.d.ts +15 -6
- package/dist/deserializer.d.ts.map +1 -1
- package/dist/deserializer.js +13 -13
- package/dist/deserializer.js.map +1 -1
- package/dist/dynamic-facade.d.ts +14 -5
- 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/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- 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 +59 -34
- package/dist/m3/builtins.js.map +1 -1
- package/dist/m3/constraints.js +2 -2
- package/dist/m3/constraints.js.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 +12 -4
- package/dist/m3/facade.js.map +1 -1
- package/dist/m3/functions.d.ts +28 -4
- package/dist/m3/functions.d.ts.map +1 -1
- package/dist/m3/functions.js +29 -5
- 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 +9 -7
- package/dist/m3/lioncore.js.map +1 -1
- 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 +12 -7
- 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/serializer.d.ts +28 -7
- package/dist/serializer.d.ts.map +1 -1
- package/dist/serializer.js +108 -100
- package/dist/serializer.js.map +1 -1
- package/dist/symbol-table.d.ts.map +1 -1
- package/dist/symbol-table.js +1 -8
- package/dist/symbol-table.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 +11 -9
- package/dist/facade.d.ts +0 -85
- package/dist/facade.d.ts.map +0 -1
- package/dist/facade.js +0 -41
- package/dist/facade.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
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;
|
|
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,C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|
1
2
|
import { allFeaturesOf } from "./m3/functions.js";
|
|
2
3
|
import { Classifier } from "./m3/types.js";
|
|
3
4
|
/**
|
|
@@ -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,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,KAAK,iBAAiB,CAAC,GAAG,C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.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.7.0-beta.
|
|
3
|
+
"version": "0.7.0-beta.10",
|
|
4
4
|
"description": "LionWeb core for {Java|Type}Script",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,17 +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"
|
|
26
28
|
},
|
|
27
29
|
"dependencies": {
|
|
28
|
-
"@lionweb/json": "0.7.0-beta.
|
|
29
|
-
"@lionweb/ts-utils": "0.7.0-beta.
|
|
30
|
+
"@lionweb/json": "0.7.0-beta.10",
|
|
31
|
+
"@lionweb/ts-utils": "0.7.0-beta.10"
|
|
30
32
|
}
|
|
31
33
|
}
|
package/dist/facade.d.ts
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { LionWebId, LionWebKey } from "@lionweb/json";
|
|
2
|
-
import { Classifier, Enumeration, EnumerationLiteral, Feature } from "./m3/types.js";
|
|
3
|
-
import { Node } from "./types.js";
|
|
4
|
-
/**
|
|
5
|
-
* Type def. for functions that deduce the {@link Classifier classifier} of a given {@link Node node}.
|
|
6
|
-
*/
|
|
7
|
-
type ClassifierDeducer<NT extends Node> = (node: NT) => Classifier;
|
|
8
|
-
/**
|
|
9
|
-
* Type def. for functions that deduce the string value of the `resolveInfo` field of a
|
|
10
|
-
* {@link LionWebJsonReferenceTarget serialized reference target}, or {@code undefined}
|
|
11
|
-
* to indicate that no `resolveInfo` could be derived.
|
|
12
|
-
*/
|
|
13
|
-
type ResolveInfoDeducer<NT extends Node> = (node: NT) => string | undefined;
|
|
14
|
-
/**
|
|
15
|
-
* Two interfaces that defines façades for in-memory models.
|
|
16
|
-
* Instances/implementations of this interface parametrize generic (de-)serialization.
|
|
17
|
-
* Implementations of these interfaces {w|c}ould be:
|
|
18
|
-
* - specific to Lioncore (so to match m3/types.ts)
|
|
19
|
-
* - generic to deserialize into @link DynamicNode}
|
|
20
|
-
*/
|
|
21
|
-
interface ExtractionFacade<NT extends Node> {
|
|
22
|
-
/**
|
|
23
|
-
* @return The {@link Concept concept} of the given node
|
|
24
|
-
*/
|
|
25
|
-
classifierOf: ClassifierDeducer<NT>;
|
|
26
|
-
/**
|
|
27
|
-
* @return The value of the given {@link Feature feature} on the given node.
|
|
28
|
-
*/
|
|
29
|
-
getFeatureValue: (node: NT, feature: Feature) => unknown;
|
|
30
|
-
/**
|
|
31
|
-
* @return The {@link EnumerationLiteral} corresponding to
|
|
32
|
-
* the given {@link Enumeration} and the runtime encoding of a literal of it,
|
|
33
|
-
*/
|
|
34
|
-
enumerationLiteralFrom: (encoding: unknown, enumeration: Enumeration) => EnumerationLiteral | null;
|
|
35
|
-
/**
|
|
36
|
-
* @return The string value of the `resolveInfo` field of a {@link LionWebJsonReferenceTarget serialized reference target},
|
|
37
|
-
* or {@code undefined} to indicate that no `resolveInfo` could be derived.
|
|
38
|
-
*/
|
|
39
|
-
resolveInfoFor?: ResolveInfoDeducer<NT>;
|
|
40
|
-
}
|
|
41
|
-
interface InstantiationFacade<NT extends Node> {
|
|
42
|
-
/**
|
|
43
|
-
* @return An instance of the given concept, also given its parent (or {@link undefined} for root nodes),
|
|
44
|
-
* its ID and the values of the node's properties ("settings").
|
|
45
|
-
* (The latter may be required as arguments for the constructor of a class, whose instances represent nodes.)
|
|
46
|
-
*/
|
|
47
|
-
nodeFor: (parent: NT | undefined, classifier: Classifier, id: LionWebId, propertySettings: {
|
|
48
|
-
[propertyKey: LionWebKey]: unknown;
|
|
49
|
-
}) => NT;
|
|
50
|
-
/**
|
|
51
|
-
* Sets the *single* given value of the indicated {@link Feature} on the given node.
|
|
52
|
-
* This means adding it in case the feature is multi-valued, meaning it is a {@link Link} with {@code multiple = true}.
|
|
53
|
-
*/
|
|
54
|
-
setFeatureValue: (node: NT, feature: Feature, value: unknown) => void;
|
|
55
|
-
/**
|
|
56
|
-
* @return The runtime encoding of the given {@link EnumerationLiteral}.
|
|
57
|
-
*/
|
|
58
|
-
encodingOf: (literal: EnumerationLiteral) => unknown;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Type def. for functions that extract {@link Node nodes} from a given one.
|
|
62
|
-
*/
|
|
63
|
-
type NodesExtractor<NT extends Node> = (node: NT) => NT[];
|
|
64
|
-
/**
|
|
65
|
-
* @return A function that extracts the children from a given node.
|
|
66
|
-
*/
|
|
67
|
-
declare const childrenExtractorUsing: <NT extends Node>(extractionFacade: ExtractionFacade<NT>) => NodesExtractor<NT>;
|
|
68
|
-
/**
|
|
69
|
-
* @return a function that extracts *all* nodes from a given start node - usually a root node.
|
|
70
|
-
*/
|
|
71
|
-
declare const nodesExtractorUsing: <NT extends Node>(extractionFacade: ExtractionFacade<NT>) => NodesExtractor<NT>;
|
|
72
|
-
type SettingsUpdater = (settings: Record<string, unknown>, feature: Feature, value: unknown) => void;
|
|
73
|
-
/**
|
|
74
|
-
* Updates the value of the given {@link Feature feature} on the given "settings" object
|
|
75
|
-
* (either a {@link Node node} or a sub object of it), using the feature's *name*.
|
|
76
|
-
*/
|
|
77
|
-
declare const updateSettingsNameBased: SettingsUpdater;
|
|
78
|
-
/**
|
|
79
|
-
* Updates the value of the given {@link Feature feature} on the given "settings" object
|
|
80
|
-
* (either a {@link Node node} or a sub object of it), using the feature's *key*.
|
|
81
|
-
*/
|
|
82
|
-
declare const updateSettingsKeyBased: SettingsUpdater;
|
|
83
|
-
export type { ClassifierDeducer, ExtractionFacade, InstantiationFacade, NodesExtractor, ResolveInfoDeducer };
|
|
84
|
-
export { childrenExtractorUsing, nodesExtractorUsing, updateSettingsKeyBased, updateSettingsNameBased };
|
|
85
|
-
//# 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,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAGrD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,kBAAkB,EAAE,OAAO,EAAQ,MAAM,eAAe,CAAA;AAC1F,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAGjC;;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,IAAI,CAAA;IAElG;;;OAGG;IACH,cAAc,CAAC,EAAE,kBAAkB,CAAC,EAAE,CAAC,CAAA;CAE1C;AAED,UAAU,mBAAmB,CAAC,EAAE,SAAS,IAAI;IAEzC;;;;OAIG;IACH,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE,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;IAGxI;;;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,KAAK,cAAc,CAAC,EAAE,SAAS,IAAI,IAAI,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,CAAA;AAEzD;;GAEG;AACH,QAAA,MAAM,sBAAsB,iFAMf,CAAA;AAGb;;GAEG;AACH,QAAA,MAAM,mBAAmB,iFACsE,CAAA;AAG/F,KAAK,eAAe,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;AAiBpG;;;GAGG;AACH,QAAA,MAAM,uBAAuB,EAAE,eAAyC,CAAA;AAExE;;;GAGG;AACH,QAAA,MAAM,sBAAsB,iBAAyB,CAAA;AAErD,YAAY,EACR,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EACrB,CAAA;AAED,OAAO,EACH,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EAC1B,CAAA"}
|
package/dist/facade.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { flatMapNonCyclingFollowing, trivialFlatMapper } from "@lionweb/ts-utils";
|
|
2
|
-
import { allFeaturesOf, isContainment } from "./m3/functions.js";
|
|
3
|
-
import { Link } from "./m3/types.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.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