@lionweb/core 0.7.0-beta.22 → 0.7.0-beta.23
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 +1 -0
- package/dist/references.d.ts +6 -1
- package/dist/references.d.ts.map +1 -1
- package/dist/references.js +5 -1
- package/dist/references.js.map +1 -1
- package/package.json +3 -3
- package/src/references.ts +9 -1
package/CHANGELOG.md
CHANGED
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
* Expose feature resolution, through the `featureResolversFor` function (and associated types), which performs proper checking.
|
|
35
35
|
This avoids undebuggable `undefined` dereferencing at runtime in `deltaDeserializer` and `eventToDeltaTranslator` functions.
|
|
36
36
|
* Package `src/` again (— i.e., don't ignore for NPM packaging.)
|
|
37
|
+
* Add `serializedRef` function that serializes a single reference target.
|
|
37
38
|
|
|
38
39
|
|
|
39
40
|
## 0.6.12
|
package/dist/references.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LionWebId } from "@lionweb/json";
|
|
2
|
+
import { Node } from "./types.js";
|
|
2
3
|
/**
|
|
3
4
|
* The `unresolved` symbol indicates a reference value which hasn't been resolved yet.
|
|
4
5
|
* It differs from an unset (`undefined`) value.
|
|
@@ -9,7 +10,7 @@ export declare const unresolved: null;
|
|
|
9
10
|
*/
|
|
10
11
|
export type SingleRef<T> = typeof unresolved | T;
|
|
11
12
|
/**
|
|
12
|
-
*
|
|
13
|
+
* @return whether a given (at most) single-valued reference actually refers to something.
|
|
13
14
|
*/
|
|
14
15
|
export declare const isRef: <T>(ref?: SingleRef<T>) => ref is T;
|
|
15
16
|
/**
|
|
@@ -20,4 +21,8 @@ export type MultiRef<T> = T[];
|
|
|
20
21
|
* A type that expresses a value is either an {@link LionWebId} or a value to indicate that resolution to a node previously failed.
|
|
21
22
|
*/
|
|
22
23
|
export type IdOrUnresolved = LionWebId | typeof unresolved;
|
|
24
|
+
/**
|
|
25
|
+
* @return the serialization of the given {@link SingleRef single reference target}, as a {@link LionWebId LionWeb ID}.
|
|
26
|
+
*/
|
|
27
|
+
export declare const serializedRef: <NT extends Node>(ref: SingleRef<NT>) => LionWebId | typeof unresolved;
|
|
23
28
|
//# 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,SAAS,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../src/references.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAGjC;;;GAGG;AACH,eAAO,MAAM,UAAU,MAAO,CAAA;AAE9B;;GAEG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,OAAO,UAAU,GAAG,CAAC,CAAA;AAEhD;;GAEG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,EAAE,MAAM,SAAS,CAAC,CAAC,CAAC,KAAG,GAAG,IAAI,CACV,CAAA;AAE3C;;GAEG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,EAAE,CAAA;AAG7B;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,OAAO,UAAU,CAAC;AAG3D;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,EAAE,SAAS,IAAI,EAAE,KAAK,SAAS,CAAC,EAAE,CAAC,KAAG,SAAS,GAAG,OAAO,UAC3C,CAAA"}
|
package/dist/references.js
CHANGED
|
@@ -4,7 +4,11 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export const unresolved = null;
|
|
6
6
|
/**
|
|
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;
|
|
10
14
|
//# 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":"AAIA;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAA;AAO9B;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAI,GAAkB,EAAY,EAAE,CACrD,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,UAAU,CAAA;AAc3C;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAkB,GAAkB,EAAiC,EAAE,CAChG,GAAG,KAAK,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,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.23",
|
|
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.7.0-beta.
|
|
31
|
-
"@lionweb/ts-utils": "0.7.0-beta.
|
|
30
|
+
"@lionweb/json": "0.7.0-beta.23",
|
|
31
|
+
"@lionweb/ts-utils": "0.7.0-beta.23"
|
|
32
32
|
}
|
|
33
33
|
}
|
package/src/references.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LionWebId } from "@lionweb/json"
|
|
2
|
+
import { Node } from "./types.js"
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -13,7 +14,7 @@ export const unresolved = null
|
|
|
13
14
|
export type SingleRef<T> = typeof unresolved | T
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
|
-
*
|
|
17
|
+
* @return whether a given (at most) single-valued reference actually refers to something.
|
|
17
18
|
*/
|
|
18
19
|
export const isRef = <T>(ref?: SingleRef<T>): ref is T =>
|
|
19
20
|
ref !== undefined && ref !== unresolved
|
|
@@ -29,3 +30,10 @@ export type MultiRef<T> = T[]
|
|
|
29
30
|
*/
|
|
30
31
|
export type IdOrUnresolved = LionWebId | typeof unresolved;
|
|
31
32
|
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @return the serialization of the given {@link SingleRef single reference target}, as a {@link LionWebId LionWeb ID}.
|
|
36
|
+
*/
|
|
37
|
+
export const serializedRef = <NT extends Node>(ref: SingleRef<NT>): LionWebId | typeof unresolved =>
|
|
38
|
+
ref === unresolved ? unresolved : ref.id
|
|
39
|
+
|