@lionweb/core 0.7.2 → 0.8.0-beta.0
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 +8 -1
- package/dist/m3/builtins.d.ts.map +1 -1
- package/dist/m3/builtins.js +3 -2
- package/dist/m3/builtins.js.map +1 -1
- package/dist/m3/reference-checker.d.ts.map +1 -1
- package/dist/m3/reference-checker.js +5 -5
- package/dist/m3/reference-checker.js.map +1 -1
- package/dist/references.d.ts +3 -12
- package/dist/references.d.ts.map +1 -1
- package/dist/references.js +0 -4
- package/dist/references.js.map +1 -1
- package/package.json +3 -3
- package/src/m3/builtins.ts +4 -2
- package/src/m3/reference-checker.ts +6 -5
- package/src/references.ts +3 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.8.0 — not yet released
|
|
4
|
+
|
|
5
|
+
* The `NT` type parameter of `SingleRef<NT>` now extends the `Node` base type.
|
|
6
|
+
* Move `IdOrUnresolved` type to the `class-core` package, as it was used only there and in `delta-protocol-common`.
|
|
7
|
+
* Remove the `serializedRef` function as it was a duplicate of `idFrom` in `class-core`.
|
|
8
|
+
|
|
9
|
+
|
|
3
10
|
## 0.7.2
|
|
4
11
|
|
|
5
|
-
* Modify the `MultiRef<
|
|
12
|
+
* Modify the `MultiRef<NT>` type to also be able to explicitly contain unresolved references, represented through the `unresolved` type.
|
|
6
13
|
***Note***: this means that values that have this type need to actively deal with `unresolved` values!
|
|
7
14
|
The easiest way to do this, is to just filter the multi-value using `.filter(isRef)`.
|
|
8
15
|
(Previously, a deserialized multi-value could already contain `unresolved` values, but wasn't typed accordingly.)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtins.d.ts","sourceRoot":"","sources":["../../src/m3/builtins.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAA;A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,QAAQ,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS;CAkBvF;AAED;;GAEG;AACH,eAAO,MAAM,gCAAgC,kCAAkD,CAAA;AAE/F;;GAEG;AACH,qBAAa,gCAAiC,SAAQ,gCAAgC;CAAG;AAGzF;;GAEG;AACH,qBAAa,8BAA+B,SAAQ,gBAAgB,CAAC,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,CAAE,YAAW,uBAAuB;;IAS/H,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,EAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,IAAI;CAkBhF;AAED;;GAEG;AACH,eAAO,MAAM,8BAA8B,gCAAgD,CAAA;AAE3F;;GAEG;AACH,qBAAa,8BAA+B,SAAQ,8BAA8B;CAAG;AAErF,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,eAAe,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,CAAA"}
|
package/dist/m3/builtins.js
CHANGED
|
@@ -2,6 +2,7 @@ import { asMinimalJsonString } from "@lionweb/ts-utils";
|
|
|
2
2
|
import { currentReleaseVersion } from "../version.js";
|
|
3
3
|
import { LanguageFactory } from "./factory.js";
|
|
4
4
|
import { Concept, lioncoreBuiltinsKey } from "./types.js";
|
|
5
|
+
import { unresolved } from "../references.js";
|
|
5
6
|
const lioncoreBuiltinsIdAndKeyGenerator = (...names) => [lioncoreBuiltinsKey, ...names.slice(1)].join("-");
|
|
6
7
|
const factory = new LanguageFactory("LionCore_builtins", currentReleaseVersion, lioncoreBuiltinsIdAndKeyGenerator, lioncoreBuiltinsIdAndKeyGenerator);
|
|
7
8
|
/*
|
|
@@ -99,7 +100,7 @@ export class BuiltinPropertyValueDeserializer extends DataTypeRegister {
|
|
|
99
100
|
throw new Error(`can't deserialize undefined as the value of required property "${property.name}" (on classifier "${property.classifier.name}" in language "${property.classifier.language.name}")`);
|
|
100
101
|
}
|
|
101
102
|
const { type } = property;
|
|
102
|
-
if (type
|
|
103
|
+
if (type === unresolved) {
|
|
103
104
|
throw new Error(`can't deserialize property "${property.name}" (on classifier "${property.classifier.name}" in language "${property.classifier.language.name}") with unspecified type`);
|
|
104
105
|
}
|
|
105
106
|
const specificDeserializer = this.byType(type);
|
|
@@ -139,7 +140,7 @@ export class BuiltinPropertyValueSerializer extends DataTypeRegister {
|
|
|
139
140
|
throw new Error(`can't serialize undefined as the value of required property "${property.name}" (on classifier "${property.classifier.name}" in language "${property.classifier.language.name}")`);
|
|
140
141
|
}
|
|
141
142
|
const { type } = property;
|
|
142
|
-
if (type
|
|
143
|
+
if (type === unresolved) {
|
|
143
144
|
throw new Error(`can't serialize property "${property.name}" (on classifier "${property.classifier.name}" in language "${property.classifier.language.name}") with unspecified type`);
|
|
144
145
|
}
|
|
145
146
|
const specificSerializer = this.byType(type);
|
package/dist/m3/builtins.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtins.js","sourceRoot":"","sources":["../../src/m3/builtins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAiB,MAAM,mBAAmB,CAAA;AAGtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAc,OAAO,EAAY,mBAAmB,EAAY,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"builtins.js","sourceRoot":"","sources":["../../src/m3/builtins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAiB,MAAM,mBAAmB,CAAA;AAGtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAc,OAAO,EAAY,mBAAmB,EAAY,MAAM,YAAY,CAAA;AACzF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,MAAM,iC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,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,CAAA;QACtM,CAAC;QACD,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAA;QACzB,IAAI,IAAI,KAAK,UAAU,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,6BAA6B,QAAQ,CAAC,IAAI,qBAAqB,QAAQ,CAAC,UAAU,CAAC,IAAI,kBAAkB,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,0BAA0B,CAAC,CAAA;QACzL,CAAC;QACD,MAAM,kBAAkB,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QAC5C,IAAI,kBAAkB,IAAI,SAAS,EAAE,CAAC;YAClC,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAA;QACpC,CAAC;aAAM,CAAC;YACJ,MAAM,IAAI,KAAK,CAAC,sCAAsC,QAAQ,CAAC,IAAI,qBAAqB,QAAQ,CAAC,UAAU,CAAC,IAAI,kBAAkB,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,eAAe,IAAK,CAAC,IAAI,MAAM,KAAK,EAAE,CAAC,CAAA;QAC9M,CAAC;IACL,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,IAAI,8BAA8B,EAAE,CAAC,MAAM,EAAE,CAAA;AAE3F;;GAEG;AACH,MAAM,OAAO,8BAA+B,SAAQ,8BAA8B;CAAG;AAErF,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,eAAe,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reference-checker.d.ts","sourceRoot":"","sources":["../../src/m3/reference-checker.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwB,QAAQ,EAAuB,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"reference-checker.d.ts","sourceRoot":"","sources":["../../src/m3/reference-checker.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwB,QAAQ,EAAuB,MAAM,YAAY,CAAA;AAIhF;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,UAAU,QAAQ,KAAG,MAAM,EA2BtD,CAAA"}
|
|
@@ -6,22 +6,22 @@ import { Concept, Containment, Property, Reference } from "./types.js";
|
|
|
6
6
|
*/
|
|
7
7
|
export const checkReferences = (language) => flatMap(language, (thing) => {
|
|
8
8
|
const locations = [];
|
|
9
|
-
const check = (
|
|
9
|
+
const check = (location, ref) => {
|
|
10
10
|
if (ref === unresolved) {
|
|
11
11
|
locations.push(location);
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
14
|
if (thing instanceof Concept) {
|
|
15
|
-
check(
|
|
15
|
+
check(`<Concept>${qualifiedNameOf(thing)}#extends`, thing.extends);
|
|
16
16
|
}
|
|
17
17
|
if (thing instanceof Containment) {
|
|
18
|
-
check(
|
|
18
|
+
check(`<Containment>${qualifiedNameOf(thing)}#type`, thing.type);
|
|
19
19
|
}
|
|
20
20
|
if (thing instanceof Property) {
|
|
21
|
-
check(
|
|
21
|
+
check(`<Property>${qualifiedNameOf(thing)}#type`, thing.type);
|
|
22
22
|
}
|
|
23
23
|
if (thing instanceof Reference) {
|
|
24
|
-
check(
|
|
24
|
+
check(`<Reference>${qualifiedNameOf(thing)}#type`, thing.type);
|
|
25
25
|
}
|
|
26
26
|
return locations;
|
|
27
27
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reference-checker.js","sourceRoot":"","sources":["../../src/m3/reference-checker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACzD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAY,QAAQ,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"reference-checker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L,oEAAoE"}
|
package/dist/references.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { LionWebId } from "@lionweb/json";
|
|
2
1
|
import { Node } from "./types.js";
|
|
3
2
|
/**
|
|
4
3
|
* The `unresolved` symbol indicates a reference value which hasn't been resolved yet.
|
|
@@ -10,23 +9,15 @@ export declare const unresolved: null;
|
|
|
10
9
|
* Note: this type is primarily meant to be used to type nodes’ properties,
|
|
11
10
|
* but should be avoided as a return type for “auxiliary” functions.
|
|
12
11
|
*/
|
|
13
|
-
export type SingleRef<
|
|
12
|
+
export type SingleRef<NT extends Node> = typeof unresolved | NT;
|
|
14
13
|
/**
|
|
15
14
|
* @return whether a given (at most) single-valued reference actually refers to something.
|
|
16
15
|
*/
|
|
17
|
-
export declare const isRef: <
|
|
16
|
+
export declare const isRef: <NT extends Node>(ref?: SingleRef<NT>) => ref is NT;
|
|
18
17
|
/**
|
|
19
18
|
* A type alias for a multi-valued reference, to make it look consistent with {@link SingleRef}.
|
|
20
19
|
* Note: this type is primarily meant to be used to type nodes’ properties,
|
|
21
20
|
* but should be avoided as a return type for “auxiliary” functions.
|
|
22
21
|
*/
|
|
23
|
-
export type MultiRef<
|
|
24
|
-
/**
|
|
25
|
-
* A type that expresses a value is either an {@link LionWebId} or a value to indicate that resolution to a node previously failed.
|
|
26
|
-
*/
|
|
27
|
-
export type IdOrUnresolved = LionWebId | typeof unresolved;
|
|
28
|
-
/**
|
|
29
|
-
* @return the serialization of the given {@link SingleRef single reference target}, as a {@link LionWebId LionWeb ID}.
|
|
30
|
-
*/
|
|
31
|
-
export declare const serializedRef: <NT extends Node>(ref: SingleRef<NT>) => LionWebId | typeof unresolved;
|
|
22
|
+
export type MultiRef<NT extends Node> = SingleRef<NT>[];
|
|
32
23
|
//# sourceMappingURL=references.d.ts.map
|
package/dist/references.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../src/references.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../src/references.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAGjC;;;GAGG;AACH,eAAO,MAAM,UAAU,MAAO,CAAA;AAE9B;;;;GAIG;AACH,MAAM,MAAM,SAAS,CAAC,EAAE,SAAS,IAAI,IAAI,OAAO,UAAU,GAAG,EAAE,CAAA;AAE/D;;GAEG;AACH,eAAO,MAAM,KAAK,GAAI,EAAE,SAAS,IAAI,EAAE,MAAM,SAAS,CAAC,EAAE,CAAC,KAAG,GAAG,IAAI,EACzB,CAAA;AAE3C;;;;GAIG;AACH,MAAM,MAAM,QAAQ,CAAC,EAAE,SAAS,IAAI,IAAI,SAAS,CAAC,EAAE,CAAC,EAAE,CAAA"}
|
package/dist/references.js
CHANGED
|
@@ -7,8 +7,4 @@ export const unresolved = null;
|
|
|
7
7
|
* @return whether a given (at most) single-valued reference actually refers to something.
|
|
8
8
|
*/
|
|
9
9
|
export const isRef = (ref) => ref !== undefined && ref !== unresolved;
|
|
10
|
-
/**
|
|
11
|
-
* @return the serialization of the given {@link SingleRef single reference target}, as a {@link LionWebId LionWeb ID}.
|
|
12
|
-
*/
|
|
13
|
-
export const serializedRef = (ref) => ref === unresolved ? unresolved : ref.id;
|
|
14
10
|
//# sourceMappingURL=references.js.map
|
package/dist/references.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"references.js","sourceRoot":"","sources":["../src/references.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"references.js","sourceRoot":"","sources":["../src/references.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAA;AAS9B;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAkB,GAAmB,EAAa,EAAE,CACrE,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,UAAU,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lionweb/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0-beta.0",
|
|
4
4
|
"description": "LionWeb core for {Java|Type}Script",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"release": "npm publish"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@lionweb/json": "0.
|
|
31
|
-
"@lionweb/ts-utils": "0.
|
|
30
|
+
"@lionweb/json": "0.8.0-beta.0",
|
|
31
|
+
"@lionweb/ts-utils": "0.8.0-beta.0"
|
|
32
32
|
}
|
|
33
33
|
}
|
package/src/m3/builtins.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { PropertyValueSerializer } from "../serializer.js"
|
|
|
4
4
|
import { currentReleaseVersion } from "../version.js"
|
|
5
5
|
import { LanguageFactory } from "./factory.js"
|
|
6
6
|
import { Classifier, Concept, DataType, lioncoreBuiltinsKey, Property } from "./types.js"
|
|
7
|
+
import { unresolved } from "../references.js"
|
|
7
8
|
|
|
8
9
|
const lioncoreBuiltinsIdAndKeyGenerator: StringsMapper = (...names) => [lioncoreBuiltinsKey, ...names.slice(1)].join("-")
|
|
9
10
|
|
|
@@ -128,7 +129,7 @@ export class BuiltinPropertyValueDeserializer
|
|
|
128
129
|
throw new Error(`can't deserialize undefined as the value of required property "${property.name}" (on classifier "${property.classifier.name}" in language "${property.classifier.language.name}")`)
|
|
129
130
|
}
|
|
130
131
|
const { type } = property
|
|
131
|
-
if (type
|
|
132
|
+
if (type === unresolved) {
|
|
132
133
|
throw new Error(`can't deserialize property "${property.name}" (on classifier "${property.classifier.name}" in language "${property.classifier.language.name}") with unspecified type`)
|
|
133
134
|
}
|
|
134
135
|
const specificDeserializer = this.byType(type)
|
|
@@ -171,7 +172,7 @@ export class BuiltinPropertyValueSerializer extends DataTypeRegister<(value: unk
|
|
|
171
172
|
throw new Error(`can't serialize undefined as the value of required property "${property.name}" (on classifier "${property.classifier.name}" in language "${property.classifier.language.name}")`)
|
|
172
173
|
}
|
|
173
174
|
const { type } = property
|
|
174
|
-
if (type
|
|
175
|
+
if (type === unresolved) {
|
|
175
176
|
throw new Error(`can't serialize property "${property.name}" (on classifier "${property.classifier.name}" in language "${property.classifier.language.name}") with unspecified type`)
|
|
176
177
|
}
|
|
177
178
|
const specificSerializer = this.byType(type)
|
|
@@ -194,3 +195,4 @@ export const builtinPropertyValueSerializer = new BuiltinPropertyValueSerializer
|
|
|
194
195
|
export class DefaultPrimitiveTypeSerializer extends BuiltinPropertyValueSerializer {}
|
|
195
196
|
|
|
196
197
|
export { builtinPrimitives, builtinClassifiers, builtinFeatures, isBuiltinNodeConcept, lioncoreBuiltins, shouldBeIdentical }
|
|
198
|
+
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SingleRef, unresolved } from "../references.js"
|
|
2
2
|
import { flatMap, qualifiedNameOf } from "./functions.js"
|
|
3
3
|
import { Concept, Containment, Language, Property, Reference } from "./types.js"
|
|
4
|
+
import { Node } from "../types.js"
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -12,23 +13,23 @@ export const checkReferences = (language: Language): string[] =>
|
|
|
12
13
|
(thing) => {
|
|
13
14
|
|
|
14
15
|
const locations: string[] = []
|
|
15
|
-
const check = (
|
|
16
|
+
const check = (location: string, ref?: SingleRef<Node>) => {
|
|
16
17
|
if (ref === unresolved) {
|
|
17
18
|
locations.push(location)
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
if (thing instanceof Concept) {
|
|
22
|
-
check(
|
|
23
|
+
check(`<Concept>${qualifiedNameOf(thing)}#extends`, thing.extends)
|
|
23
24
|
}
|
|
24
25
|
if (thing instanceof Containment) {
|
|
25
|
-
check(
|
|
26
|
+
check(`<Containment>${qualifiedNameOf(thing)}#type`, thing.type)
|
|
26
27
|
}
|
|
27
28
|
if (thing instanceof Property) {
|
|
28
|
-
check(
|
|
29
|
+
check(`<Property>${qualifiedNameOf(thing)}#type`, thing.type)
|
|
29
30
|
}
|
|
30
31
|
if (thing instanceof Reference) {
|
|
31
|
-
check(
|
|
32
|
+
check(`<Reference>${qualifiedNameOf(thing)}#type`, thing.type)
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
return locations
|
package/src/references.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { LionWebId } from "@lionweb/json"
|
|
2
|
-
|
|
3
1
|
import { Node } from "./types.js"
|
|
4
2
|
|
|
5
3
|
|
|
@@ -14,12 +12,12 @@ export const unresolved = null
|
|
|
14
12
|
* Note: this type is primarily meant to be used to type nodes’ properties,
|
|
15
13
|
* but should be avoided as a return type for “auxiliary” functions.
|
|
16
14
|
*/
|
|
17
|
-
export type SingleRef<
|
|
15
|
+
export type SingleRef<NT extends Node> = typeof unresolved | NT
|
|
18
16
|
|
|
19
17
|
/**
|
|
20
18
|
* @return whether a given (at most) single-valued reference actually refers to something.
|
|
21
19
|
*/
|
|
22
|
-
export const isRef = <
|
|
20
|
+
export const isRef = <NT extends Node>(ref?: SingleRef<NT>): ref is NT =>
|
|
23
21
|
ref !== undefined && ref !== unresolved
|
|
24
22
|
|
|
25
23
|
/**
|
|
@@ -27,18 +25,5 @@ export const isRef = <T>(ref?: SingleRef<T>): ref is T =>
|
|
|
27
25
|
* Note: this type is primarily meant to be used to type nodes’ properties,
|
|
28
26
|
* but should be avoided as a return type for “auxiliary” functions.
|
|
29
27
|
*/
|
|
30
|
-
export type MultiRef<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* A type that expresses a value is either an {@link LionWebId} or a value to indicate that resolution to a node previously failed.
|
|
35
|
-
*/
|
|
36
|
-
export type IdOrUnresolved = LionWebId | typeof unresolved;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* @return the serialization of the given {@link SingleRef single reference target}, as a {@link LionWebId LionWeb ID}.
|
|
41
|
-
*/
|
|
42
|
-
export const serializedRef = <NT extends Node>(ref: SingleRef<NT>): LionWebId | typeof unresolved =>
|
|
43
|
-
ref === unresolved ? unresolved : ref.id
|
|
28
|
+
export type MultiRef<NT extends Node> = SingleRef<NT>[]
|
|
44
29
|
|