@unyt/datex 0.0.14 → 0.0.15
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/esm/datex-web/datex_web.d.ts +93 -2
- package/esm/datex-web/datex_web.internal.d.ts +215 -197
- package/esm/datex-web/datex_web.internal.d.ts.map +1 -1
- package/esm/datex-web/datex_web.internal.js +437 -407
- package/esm/datex-web/datex_web.wasm +0 -0
- package/esm/datex-web/types/decompiler/options.d.ts +17 -0
- package/esm/datex-web/types/decompiler/options.d.ts.map +1 -0
- package/esm/datex-web/types/decompiler/options.js +4 -0
- package/esm/datex-web/types/disassembler/options.d.ts +6 -0
- package/esm/datex-web/types/disassembler/options.d.ts.map +1 -0
- package/esm/datex-web/types/disassembler/options.js +4 -0
- package/esm/datex-web/types/network/com_hub/managers/socket_manager.d.ts +9 -0
- package/esm/datex-web/types/network/com_hub/managers/socket_manager.d.ts.map +1 -0
- package/esm/datex-web/types/network/com_hub/managers/socket_manager.js +4 -0
- package/esm/datex-web/types/network/com_hub/metadata.d.ts +20 -0
- package/esm/datex-web/types/network/com_hub/metadata.d.ts.map +1 -0
- package/esm/datex-web/types/network/com_hub/metadata.js +4 -0
- package/esm/datex-web/types/network/com_hub/mod.d.ts +6 -0
- package/esm/datex-web/types/network/com_hub/mod.d.ts.map +1 -0
- package/esm/datex-web/types/network/com_hub/mod.js +4 -0
- package/esm/datex-web/types/network/com_hub/network_tracing.d.ts +23 -0
- package/esm/datex-web/types/network/com_hub/network_tracing.d.ts.map +1 -0
- package/esm/datex-web/types/network/com_hub/network_tracing.js +4 -0
- package/esm/datex-web/types/network/com_hub.d.ts +8 -0
- package/esm/datex-web/types/network/com_hub.d.ts.map +1 -0
- package/esm/datex-web/types/network/com_hub.js +4 -0
- package/esm/datex-web/types/network/com_interfaces/com_interface/properties.d.ts +27 -0
- package/esm/datex-web/types/network/com_interfaces/com_interface/properties.d.ts.map +1 -0
- package/esm/datex-web/types/network/com_interfaces/com_interface/properties.js +4 -0
- package/esm/datex-web/types/network/com_interfaces/default_setup_data/http_common.d.ts +10 -0
- package/esm/datex-web/types/network/com_interfaces/default_setup_data/http_common.d.ts.map +1 -0
- package/esm/datex-web/types/network/com_interfaces/default_setup_data/http_common.js +4 -0
- package/esm/datex-web/types/network/com_interfaces/default_setup_data/websocket/websocket_server.d.ts +6 -0
- package/esm/datex-web/types/network/com_interfaces/default_setup_data/websocket/websocket_server.d.ts.map +1 -0
- package/esm/datex-web/types/network/com_interfaces/default_setup_data/websocket/websocket_server.js +4 -0
- package/esm/datex-web/types/runtime/config.d.ts +16 -0
- package/esm/datex-web/types/runtime/config.d.ts.map +1 -0
- package/esm/datex-web/types/runtime/config.js +4 -0
- package/esm/default.d.ts.map +1 -1
- package/esm/default.js +2 -0
- package/esm/deno.json +73 -17
- package/esm/dif/core.d.ts +36 -40
- package/esm/dif/core.d.ts.map +1 -1
- package/esm/dif/core.js +33 -54
- package/esm/dif/dif-handler.d.ts +58 -101
- package/esm/dif/dif-handler.d.ts.map +1 -1
- package/esm/dif/dif-handler.js +411 -365
- package/esm/dif/display.d.ts +14 -5
- package/esm/dif/display.d.ts.map +1 -1
- package/esm/dif/display.js +89 -39
- package/esm/dif/helpers/mod.d.ts +6 -0
- package/esm/dif/helpers/mod.d.ts.map +1 -0
- package/esm/dif/helpers/mod.js +5 -0
- package/esm/dif/helpers/typed-integer.d.ts +14 -0
- package/esm/dif/helpers/typed-integer.d.ts.map +1 -0
- package/esm/dif/helpers/typed-integer.js +37 -0
- package/esm/dif/js-lib.d.ts +14 -1
- package/esm/dif/js-lib.d.ts.map +1 -1
- package/esm/dif/js-lib.js +19 -1
- package/esm/dif/mod.d.ts +2 -2
- package/esm/dif/mod.d.ts.map +1 -1
- package/esm/dif/mod.js +2 -2
- package/esm/dif/type-registry.d.ts +30 -21
- package/esm/dif/type-registry.d.ts.map +1 -1
- package/esm/dif/type-registry.js +45 -33
- package/esm/dif/types/mod.d.ts +9 -0
- package/esm/dif/types/mod.d.ts.map +1 -0
- package/esm/dif/types/mod.js +8 -0
- package/esm/dif/types/type.d.ts +91 -0
- package/esm/dif/types/type.d.ts.map +1 -0
- package/esm/dif/types/type.js +33 -0
- package/esm/dif/types/update.d.ts +63 -0
- package/esm/dif/types/update.d.ts.map +1 -0
- package/esm/dif/types/update.js +16 -0
- package/esm/dif/types/value.d.ts +62 -0
- package/esm/dif/types/value.d.ts.map +1 -0
- package/esm/dif/types/value.js +1 -0
- package/esm/dif/update.d.ts +20 -0
- package/esm/dif/update.d.ts.map +1 -0
- package/esm/dif/update.js +41 -0
- package/esm/dif/utils.d.ts +8 -0
- package/esm/dif/utils.d.ts.map +1 -0
- package/esm/dif/utils.js +67 -0
- package/esm/lib/js-core-types/array.d.ts +3 -0
- package/esm/lib/js-core-types/array.d.ts.map +1 -0
- package/esm/lib/js-core-types/array.js +175 -0
- package/esm/lib/js-core-types/map.d.ts +15 -0
- package/esm/lib/js-core-types/map.d.ts.map +1 -0
- package/esm/lib/js-core-types/map.js +88 -0
- package/esm/lib/js-core-types/mod.d.ts +8 -0
- package/esm/lib/js-core-types/mod.d.ts.map +1 -0
- package/esm/lib/js-core-types/mod.js +7 -0
- package/esm/lib/mod.d.ts +8 -0
- package/esm/lib/mod.d.ts.map +1 -0
- package/esm/lib/mod.js +7 -0
- package/esm/lib/special-core-types/mod.d.ts +9 -0
- package/esm/lib/special-core-types/mod.d.ts.map +1 -0
- package/esm/lib/special-core-types/mod.js +8 -0
- package/esm/lib/special-core-types/tagged.d.ts +17 -0
- package/esm/lib/special-core-types/tagged.d.ts.map +1 -0
- package/esm/lib/special-core-types/tagged.js +37 -0
- package/esm/lib/special-core-types/undefined.d.ts +7 -0
- package/esm/lib/special-core-types/undefined.d.ts.map +1 -0
- package/esm/lib/special-core-types/undefined.js +28 -0
- package/esm/mod.d.ts +2 -3
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +2 -3
- package/esm/network/com-hub.d.ts +28 -1
- package/esm/network/com-hub.d.ts.map +1 -1
- package/esm/network/com-hub.js +6 -2
- package/esm/network/interfaces/websocket-server-base.d.ts +1 -1
- package/esm/network/interfaces/websocket-server-base.d.ts.map +1 -1
- package/esm/network/interfaces/websocket-server-base.js +8 -7
- package/esm/network/interfaces/websocket-server-deno.d.ts +1 -1
- package/esm/network/interfaces/websocket-server-deno.d.ts.map +1 -1
- package/esm/repl/mod.js +1 -1
- package/esm/runtime/runtime.d.ts +43 -18
- package/esm/runtime/runtime.d.ts.map +1 -1
- package/esm/runtime/runtime.js +55 -32
- package/esm/{refs/ref.d.ts → shared-container/base-shared-container.d.ts} +13 -5
- package/esm/shared-container/base-shared-container.d.ts.map +1 -0
- package/esm/shared-container/base-shared-container.js +95 -0
- package/esm/shared-container/mod.d.ts +36 -0
- package/esm/shared-container/mod.d.ts.map +1 -0
- package/esm/shared-container/mod.js +29 -0
- package/esm/shared-container/owned.d.ts +33 -0
- package/esm/shared-container/owned.d.ts.map +1 -0
- package/esm/shared-container/owned.js +60 -0
- package/esm/shared-container/reference.d.ts +31 -0
- package/esm/shared-container/reference.d.ts.map +1 -0
- package/esm/shared-container/reference.js +64 -0
- package/esm/utils/devtools-formatter.js +2 -2
- package/esm/utils/option.d.ts +17 -0
- package/esm/utils/option.d.ts.map +1 -0
- package/esm/utils/option.js +54 -0
- package/package.json +1 -1
- package/esm/dif/definitions.d.ts +0 -134
- package/esm/dif/definitions.d.ts.map +0 -1
- package/esm/dif/definitions.js +0 -38
- package/esm/refs/ref.d.ts.map +0 -1
- package/esm/refs/ref.js +0 -60
package/esm/dif/display.d.ts
CHANGED
|
@@ -3,15 +3,18 @@
|
|
|
3
3
|
* @description
|
|
4
4
|
* This module contains helper functions to convert DIF structures to display strings.
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { SharedContainerMutability } from "../shared-container/mod.js";
|
|
7
|
+
import { CoreLibTypeId } from "./core.js";
|
|
8
|
+
import type { DIFBaseSharedValueContainer, DIFCoreValue, DIFTypeDefinition, DIFValueContainer } from "./types/mod.js";
|
|
9
|
+
import type { PointerAddress } from "../shared-container/mod.js";
|
|
7
10
|
/**
|
|
8
11
|
* Converts a DIF reference mutability to a display string.
|
|
9
12
|
*/
|
|
10
|
-
export declare function mutabilityToDisplayString(mut:
|
|
13
|
+
export declare function mutabilityToDisplayString(mut: SharedContainerMutability): string;
|
|
11
14
|
/**
|
|
12
15
|
* Converts a DIF reference to a display string.
|
|
13
16
|
*/
|
|
14
|
-
export declare function
|
|
17
|
+
export declare function difBaseSharedContainerToDisplayString(reference: DIFBaseSharedValueContainer): string;
|
|
15
18
|
/**
|
|
16
19
|
* Converts a DIF value container to a display string.
|
|
17
20
|
*/
|
|
@@ -19,7 +22,7 @@ export declare function difValueContainerToDisplayString(container: DIFValueCont
|
|
|
19
22
|
/**
|
|
20
23
|
* Converts a DIF representation value to a display string.
|
|
21
24
|
*/
|
|
22
|
-
export declare function
|
|
25
|
+
export declare function difCoreValueToDisplayString(id: CoreLibTypeId, coreValue: DIFCoreValue): string;
|
|
23
26
|
/**
|
|
24
27
|
* Converts a DIF type definition to a display string.
|
|
25
28
|
*/
|
|
@@ -27,5 +30,11 @@ export declare function difTypeDefinitionToDisplayString(difType: DIFTypeDefinit
|
|
|
27
30
|
/**
|
|
28
31
|
* Converts a core type address to a display string.
|
|
29
32
|
*/
|
|
30
|
-
export declare function addressToDisplayString(address:
|
|
33
|
+
export declare function addressToDisplayString(address: PointerAddress): string;
|
|
34
|
+
/**
|
|
35
|
+
* Converts a core lib type id to a display string.
|
|
36
|
+
* @param typeId The core lib type id to convert.
|
|
37
|
+
* @returns The display string for the given core lib type id.
|
|
38
|
+
*/
|
|
39
|
+
export declare function coreLibTypeIdToDisplayString(typeId: CoreLibTypeId): string;
|
|
31
40
|
//# sourceMappingURL=display.d.ts.map
|
package/esm/dif/display.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../src/dif/display.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../src/dif/display.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,EACR,2BAA2B,EAC3B,YAAY,EACZ,iBAAiB,EAGjB,iBAAiB,EACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,yBAAyB,GAAG,MAAM,CAOhF;AAED;;GAEG;AACH,wBAAgB,qCAAqC,CACjD,SAAS,EAAE,2BAA2B,GACvC,MAAM,CAKR;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAC5C,SAAS,EAAE,iBAAiB,GAC7B,MAAM,CAkBR;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACvC,EAAE,EAAE,aAAa,EACjB,SAAS,EAAE,YAAY,GACxB,MAAM,CA4ER;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAC5C,OAAO,EAAE,iBAAiB,GAC3B,MAAM,CAUR;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,CAEtE;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CACxC,MAAM,EAAE,aAAa,GACtB,MAAM,CAIR"}
|
package/esm/dif/display.js
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
* @description
|
|
4
4
|
* This module contains helper functions to convert DIF structures to display strings.
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { SharedContainerMutability } from "../shared-container/mod.js";
|
|
7
|
+
import { CoreLibTypeId } from "./core.js";
|
|
8
8
|
/**
|
|
9
9
|
* Converts a DIF reference mutability to a display string.
|
|
10
10
|
*/
|
|
11
11
|
export function mutabilityToDisplayString(mut) {
|
|
12
|
-
if (mut ===
|
|
12
|
+
if (mut === SharedContainerMutability.Mutable) {
|
|
13
13
|
return "&mut ";
|
|
14
14
|
}
|
|
15
|
-
else if (mut ===
|
|
15
|
+
else if (mut === SharedContainerMutability.Immutable) {
|
|
16
16
|
return "&";
|
|
17
17
|
}
|
|
18
18
|
throw new Error("Unknown mutability: " + mut);
|
|
@@ -20,22 +20,23 @@ export function mutabilityToDisplayString(mut) {
|
|
|
20
20
|
/**
|
|
21
21
|
* Converts a DIF reference to a display string.
|
|
22
22
|
*/
|
|
23
|
-
export function
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
23
|
+
export function difBaseSharedContainerToDisplayString(reference) {
|
|
24
|
+
const valueString = difValueContainerToDisplayString(reference[0]);
|
|
25
|
+
const mutString = mutabilityToDisplayString(reference[1]);
|
|
26
|
+
const typeString = difTypeDefinitionToDisplayString(reference[2]);
|
|
27
27
|
return `${mutString}${valueString} (allowed: ${typeString})`;
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* Converts a DIF value container to a display string.
|
|
31
31
|
*/
|
|
32
32
|
export function difValueContainerToDisplayString(container) {
|
|
33
|
-
if (typeof container === "
|
|
34
|
-
return
|
|
33
|
+
if (typeof container === "object" && container !== null && "$" in container) {
|
|
34
|
+
return container.$;
|
|
35
35
|
}
|
|
36
|
-
else {
|
|
37
|
-
const
|
|
38
|
-
const
|
|
36
|
+
else if (Array.isArray(container)) {
|
|
37
|
+
const [typeId, value, typeDef] = container;
|
|
38
|
+
const typeString = typeDef ? difTypeDefinitionToDisplayString(typeDef) : null;
|
|
39
|
+
const valueString = difCoreValueToDisplayString(typeId, value);
|
|
39
40
|
if (typeString) {
|
|
40
41
|
return `{ type: ${typeString}, value: ${valueString} }`;
|
|
41
42
|
}
|
|
@@ -43,51 +44,100 @@ export function difValueContainerToDisplayString(container) {
|
|
|
43
44
|
return valueString;
|
|
44
45
|
}
|
|
45
46
|
}
|
|
47
|
+
else {
|
|
48
|
+
return JSON.stringify(container);
|
|
49
|
+
}
|
|
46
50
|
}
|
|
47
51
|
/**
|
|
48
52
|
* Converts a DIF representation value to a display string.
|
|
49
53
|
*/
|
|
50
|
-
export function
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
export function difCoreValueToDisplayString(id, coreValue) {
|
|
55
|
+
switch (id) {
|
|
56
|
+
case CoreLibTypeId.boolean:
|
|
57
|
+
case CoreLibTypeId.text:
|
|
58
|
+
case CoreLibTypeId.endpoint:
|
|
59
|
+
case CoreLibTypeId.integer:
|
|
60
|
+
case CoreLibTypeId.integer_i8:
|
|
61
|
+
case CoreLibTypeId.integer_i16:
|
|
62
|
+
case CoreLibTypeId.integer_i32:
|
|
63
|
+
case CoreLibTypeId.integer_i64:
|
|
64
|
+
case CoreLibTypeId.integer_i128:
|
|
65
|
+
case CoreLibTypeId.integer_u8:
|
|
66
|
+
case CoreLibTypeId.integer_u16:
|
|
67
|
+
case CoreLibTypeId.integer_u32:
|
|
68
|
+
case CoreLibTypeId.integer_u64:
|
|
69
|
+
case CoreLibTypeId.integer_u128:
|
|
70
|
+
case CoreLibTypeId.integer_ibig:
|
|
71
|
+
case CoreLibTypeId.decimal_f32:
|
|
72
|
+
case CoreLibTypeId.decimal_f64:
|
|
73
|
+
case CoreLibTypeId.decimal_dbig:
|
|
74
|
+
case CoreLibTypeId.null:
|
|
75
|
+
case CoreLibTypeId.decimal:
|
|
76
|
+
return JSON.stringify(coreValue);
|
|
77
|
+
case CoreLibTypeId.Unit:
|
|
78
|
+
return "()";
|
|
79
|
+
case CoreLibTypeId.Never:
|
|
80
|
+
return "never";
|
|
81
|
+
case CoreLibTypeId.Unknown:
|
|
82
|
+
return "unknown";
|
|
83
|
+
case CoreLibTypeId.Range:
|
|
84
|
+
if (Array.isArray(coreValue)) {
|
|
85
|
+
return `[${difValueContainerToDisplayString(coreValue[0])}, ${difValueContainerToDisplayString(coreValue[1])}]`;
|
|
86
|
+
}
|
|
87
|
+
else if (coreValue && typeof coreValue === "object") {
|
|
88
|
+
return `{ start: ${difValueContainerToDisplayString(coreValue.start)}, end: ${difValueContainerToDisplayString(coreValue.end)} }`;
|
|
56
89
|
}
|
|
57
90
|
else {
|
|
58
|
-
|
|
91
|
+
throw new Error("Invalid range value: " + JSON.stringify(coreValue));
|
|
59
92
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
93
|
+
case CoreLibTypeId.Type:
|
|
94
|
+
return difTypeDefinitionToDisplayString(coreValue);
|
|
95
|
+
case CoreLibTypeId.Map:
|
|
96
|
+
if (Array.isArray(coreValue)) {
|
|
97
|
+
return `[${coreValue
|
|
98
|
+
.map((value) => {
|
|
99
|
+
if (Array.isArray(value)) {
|
|
100
|
+
return `[${value
|
|
101
|
+
.map((item) => difValueContainerToDisplayString(item))
|
|
102
|
+
.join(", ")}]`;
|
|
103
|
+
}
|
|
104
|
+
return difValueContainerToDisplayString(value);
|
|
105
|
+
})
|
|
106
|
+
.join(", ")}]`;
|
|
107
|
+
}
|
|
108
|
+
if (coreValue && typeof coreValue === "object") {
|
|
109
|
+
return `{ ${Object.entries(coreValue)
|
|
110
|
+
.map(([key, value]) => `${key}: ${difValueContainerToDisplayString(value)}`)
|
|
111
|
+
.join(", ")} }`;
|
|
112
|
+
}
|
|
113
|
+
throw new Error("Invalid map value: " + JSON.stringify(coreValue));
|
|
114
|
+
default:
|
|
115
|
+
throw new Error("Unknown core lib type id: " + id);
|
|
67
116
|
}
|
|
68
117
|
}
|
|
69
118
|
/**
|
|
70
119
|
* Converts a DIF type definition to a display string.
|
|
71
120
|
*/
|
|
72
121
|
export function difTypeDefinitionToDisplayString(difType) {
|
|
73
|
-
if (typeof difType === "
|
|
74
|
-
return
|
|
122
|
+
if (typeof difType === "number") {
|
|
123
|
+
return coreLibTypeIdToDisplayString(difType);
|
|
75
124
|
}
|
|
76
125
|
else {
|
|
77
|
-
|
|
126
|
+
const [key, def] = Object.entries(difType)[0];
|
|
127
|
+
return `{ ${key}: ${JSON.stringify(def)} }`;
|
|
78
128
|
}
|
|
79
129
|
}
|
|
80
130
|
/**
|
|
81
131
|
* Converts a core type address to a display string.
|
|
82
132
|
*/
|
|
83
133
|
export function addressToDisplayString(address) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
134
|
+
return `$${address}`;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Converts a core lib type id to a display string.
|
|
138
|
+
* @param typeId The core lib type id to convert.
|
|
139
|
+
* @returns The display string for the given core lib type id.
|
|
140
|
+
*/
|
|
141
|
+
export function coreLibTypeIdToDisplayString(typeId) {
|
|
142
|
+
return Object.entries(CoreLibTypeId).find(([, value]) => value === typeId)?.[0] ?? "Unknown";
|
|
93
143
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/dif/helpers/mod.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DIFValue } from "../types/value.js";
|
|
2
|
+
export declare function i8(value: number): DIFValue;
|
|
3
|
+
export declare function i16(value: number): DIFValue;
|
|
4
|
+
export declare function i32(value: number): DIFValue;
|
|
5
|
+
export declare function i64(value: number): DIFValue;
|
|
6
|
+
export declare function u8(value: number): DIFValue;
|
|
7
|
+
export declare function u16(value: number): DIFValue;
|
|
8
|
+
export declare function u32(value: number): DIFValue;
|
|
9
|
+
export declare function u64(value: bigint): DIFValue;
|
|
10
|
+
export declare function i128(value: bigint): DIFValue;
|
|
11
|
+
export declare function u128(value: bigint): DIFValue;
|
|
12
|
+
export declare function ibig(value: bigint): DIFValue;
|
|
13
|
+
export declare function integer(value: number | bigint): DIFValue;
|
|
14
|
+
//# sourceMappingURL=typed-integer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typed-integer.d.ts","sourceRoot":"","sources":["../../../src/dif/helpers/typed-integer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,wBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,CAE1C;AACD,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,CAE3C;AACD,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,CAE3C;AACD,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,CAE3C;AACD,wBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,CAE1C;AACD,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,CAE3C;AACD,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,CAE3C;AACD,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,CAE3C;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,CAE5C;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,CAE5C;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,CAE5C;AACD,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,CAExD"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { CoreLibTypeId } from "../core.js";
|
|
2
|
+
export function i8(value) {
|
|
3
|
+
return [CoreLibTypeId.integer_i8, value];
|
|
4
|
+
}
|
|
5
|
+
export function i16(value) {
|
|
6
|
+
return [CoreLibTypeId.integer_i16, value];
|
|
7
|
+
}
|
|
8
|
+
export function i32(value) {
|
|
9
|
+
return [CoreLibTypeId.integer_i32, value];
|
|
10
|
+
}
|
|
11
|
+
export function i64(value) {
|
|
12
|
+
return [CoreLibTypeId.integer_i64, value];
|
|
13
|
+
}
|
|
14
|
+
export function u8(value) {
|
|
15
|
+
return [CoreLibTypeId.integer_u8, value];
|
|
16
|
+
}
|
|
17
|
+
export function u16(value) {
|
|
18
|
+
return [CoreLibTypeId.integer_u16, value];
|
|
19
|
+
}
|
|
20
|
+
export function u32(value) {
|
|
21
|
+
return [CoreLibTypeId.integer_u32, value];
|
|
22
|
+
}
|
|
23
|
+
export function u64(value) {
|
|
24
|
+
return [CoreLibTypeId.integer_u64, value.toString()];
|
|
25
|
+
}
|
|
26
|
+
export function i128(value) {
|
|
27
|
+
return [CoreLibTypeId.integer_i128, value.toString()];
|
|
28
|
+
}
|
|
29
|
+
export function u128(value) {
|
|
30
|
+
return [CoreLibTypeId.integer_u128, value.toString()];
|
|
31
|
+
}
|
|
32
|
+
export function ibig(value) {
|
|
33
|
+
return [CoreLibTypeId.integer_ibig, value.toString()];
|
|
34
|
+
}
|
|
35
|
+
export function integer(value) {
|
|
36
|
+
return [CoreLibTypeId.integer, value.toString()];
|
|
37
|
+
}
|
package/esm/dif/js-lib.d.ts
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
|
+
import type { PointerAddress } from "../shared-container/mod.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a reserved pointer address for a js lib type with the given id.
|
|
4
|
+
* The endpoint is the broadcast (reserved) endpoint. This can be used for builtin types.
|
|
5
|
+
* @param id Id of the js lib type. Must be a non-negative integer that fits into 5 bytes.
|
|
6
|
+
* @returns The reserved pointer address for the js lib type with the given id.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createReservedPointerAddress(id: number): PointerAddress;
|
|
9
|
+
/**
|
|
10
|
+
* Mapping of js lib types to their unique reserved internal pointer addresses.
|
|
11
|
+
* These addresses are used to identify impl types dedicated to special js lib types.
|
|
12
|
+
*/
|
|
1
13
|
export declare const JsLibTypeAddress: {
|
|
2
|
-
readonly undefined:
|
|
14
|
+
readonly undefined: PointerAddress;
|
|
15
|
+
readonly map: PointerAddress;
|
|
3
16
|
};
|
|
4
17
|
/**
|
|
5
18
|
* Type representing the unique pointer addresses of js lib types.
|
package/esm/dif/js-lib.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"js-lib.d.ts","sourceRoot":"","sources":["../../src/dif/js-lib.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"js-lib.d.ts","sourceRoot":"","sources":["../../src/dif/js-lib.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc,CAMvE;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;CAGnB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,gBAAgB,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC"}
|
package/esm/dif/js-lib.js
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a reserved pointer address for a js lib type with the given id.
|
|
3
|
+
* The endpoint is the broadcast (reserved) endpoint. This can be used for builtin types.
|
|
4
|
+
* @param id Id of the js lib type. Must be a non-negative integer that fits into 5 bytes.
|
|
5
|
+
* @returns The reserved pointer address for the js lib type with the given id.
|
|
6
|
+
*/
|
|
7
|
+
export function createReservedPointerAddress(id) {
|
|
8
|
+
const idHex = id.toString(16).toLowerCase();
|
|
9
|
+
if (!Number.isInteger(id) || id < 0 || idHex.length > 10) {
|
|
10
|
+
throw new Error("invalid id");
|
|
11
|
+
}
|
|
12
|
+
return "ff".repeat(21) + idHex.padStart(10, "0");
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Mapping of js lib types to their unique reserved internal pointer addresses.
|
|
16
|
+
* These addresses are used to identify impl types dedicated to special js lib types.
|
|
17
|
+
*/
|
|
1
18
|
export const JsLibTypeAddress = {
|
|
2
|
-
undefined:
|
|
19
|
+
undefined: createReservedPointerAddress(0),
|
|
20
|
+
map: createReservedPointerAddress(1),
|
|
3
21
|
};
|
package/esm/dif/mod.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @description
|
|
4
4
|
* This namespace contains all modules related to the DIF (DATEX Interchange Format) interfaces of the DATEX runtime.
|
|
5
5
|
*/
|
|
6
|
-
export * as Definitions from "./definitions.js";
|
|
7
6
|
export * as Display from "./display.js";
|
|
8
|
-
export {
|
|
7
|
+
export { CoreLibTypeId } from "./core.js";
|
|
8
|
+
export * as Definitions from "./types/mod.js";
|
|
9
9
|
//# sourceMappingURL=mod.d.ts.map
|
package/esm/dif/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/dif/mod.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/dif/mod.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC"}
|
package/esm/dif/mod.js
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
* @description
|
|
4
4
|
* This namespace contains all modules related to the DIF (DATEX Interchange Format) interfaces of the DATEX runtime.
|
|
5
5
|
*/
|
|
6
|
-
export * as Definitions from "./definitions.js";
|
|
7
6
|
export * as Display from "./display.js";
|
|
8
|
-
export {
|
|
7
|
+
export { CoreLibTypeId } from "./core.js";
|
|
8
|
+
export * as Definitions from "./types/mod.js";
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* This module implements the TypeRegistry and TypeBinding classes which allow registering custom type definitions and bindings to JS implementations.
|
|
3
|
+
*/
|
|
4
|
+
import type { CoreLibTypeId } from "./core.js";
|
|
5
|
+
import { type DIFTypeDefinition, type DIFUpdateData, DIFUpdateKind } from "./types/mod.js";
|
|
6
|
+
import { type CachedSharedContainer, type CustomReferenceMetadata, type DIFHandler } from "./dif-handler.js";
|
|
7
|
+
import type { PointerAddress, SharedContainerMutability, SharedRef } from "../shared-container/mod.js";
|
|
3
8
|
type ImplMethod = {
|
|
4
9
|
name: string;
|
|
5
10
|
implementation: (...args: unknown[]) => unknown;
|
|
@@ -26,15 +31,16 @@ export type BindResult<T, M extends CustomReferenceMetadata> = {
|
|
|
26
31
|
value: T;
|
|
27
32
|
metadata: M;
|
|
28
33
|
};
|
|
29
|
-
export type TypeBindingDefinition<T, M extends CustomReferenceMetadata = CustomReferenceMetadata> = {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
export type TypeBindingDefinition<T extends object, M extends CustomReferenceMetadata = CustomReferenceMetadata> = {
|
|
35
|
+
coreLibTypeId?: CoreLibTypeId;
|
|
36
|
+
pointerAddress?: PointerAddress;
|
|
37
|
+
bind(this: TypeBindingContext<M>, value: SharedRef<T, SharedContainerMutability>, pointerAddress: PointerAddress): BindResult<T, M>;
|
|
38
|
+
handleSet?(this: TypeBindingContext<M>, target: SharedRef<T, SharedContainerMutability>, key: unknown, value: unknown): void;
|
|
39
|
+
handleAppend?(this: TypeBindingContext<M>, target: SharedRef<T, SharedContainerMutability>, value: unknown): void;
|
|
40
|
+
handleReplace?(this: TypeBindingContext<M>, parent: SharedRef<T, SharedContainerMutability>, newValue: unknown): void;
|
|
41
|
+
handleDelete?(this: TypeBindingContext<M>, target: SharedRef<T, SharedContainerMutability>, key: unknown): void;
|
|
42
|
+
handleClear?(this: TypeBindingContext<M>, target: SharedRef<T, SharedContainerMutability>): void;
|
|
43
|
+
handleListSplice?(this: TypeBindingContext<M>, target: SharedRef<T, SharedContainerMutability>, start: number, deleteCount: number, items: unknown[]): void;
|
|
38
44
|
};
|
|
39
45
|
export declare class TypeRegistry {
|
|
40
46
|
#private;
|
|
@@ -48,33 +54,36 @@ export declare class TypeRegistry {
|
|
|
48
54
|
* Binds an existing nominal type to a JS mirror implementation.
|
|
49
55
|
* @param typePointerAddress The address of the type pointer in the Datex runtime.
|
|
50
56
|
*/
|
|
51
|
-
registerTypeBinding<T>(typeBindingDefinition: TypeBindingDefinition<T>): void;
|
|
57
|
+
registerTypeBinding<T extends object>(typeBindingDefinition: TypeBindingDefinition<T>): void;
|
|
52
58
|
/**
|
|
53
|
-
* @private
|
|
54
59
|
* Gets the type binding for a given type pointer address.
|
|
60
|
+
* @param typePointerAddress The pointer address of the type in the Datex runtime.
|
|
61
|
+
* @returns The corresponding TypeBinding or null if no binding is found for the given pointer address.
|
|
55
62
|
*/
|
|
56
|
-
|
|
63
|
+
getTypeBinding(typePointerAddress: string): TypeBinding | null;
|
|
57
64
|
/**
|
|
58
|
-
* Gets the type binding for a given type
|
|
65
|
+
* Gets the type binding for a given core library type id.
|
|
66
|
+
* @param coreLibTypeId
|
|
67
|
+
* @returns
|
|
59
68
|
*/
|
|
60
|
-
|
|
69
|
+
getTypeBindingByCoreLibTypeId(coreLibTypeId: CoreLibTypeId): TypeBinding | null;
|
|
61
70
|
}
|
|
62
|
-
export declare class TypeBinding<T extends
|
|
71
|
+
export declare class TypeBinding<T extends object = object, M extends CustomReferenceMetadata = CustomReferenceMetadata> {
|
|
63
72
|
#private;
|
|
64
73
|
get difHandler(): DIFHandler;
|
|
65
|
-
getCustomReferenceMetadata(value:
|
|
74
|
+
getCustomReferenceMetadata(value: CachedSharedContainer): M;
|
|
66
75
|
constructor(definition: TypeBindingDefinition<T, M>, difHandler: DIFHandler);
|
|
67
76
|
/**
|
|
68
77
|
* Binds a new JS value to this type binding.
|
|
69
78
|
* @returns
|
|
70
79
|
*/
|
|
71
|
-
bindValue(value: T, pointerAddress:
|
|
80
|
+
bindValue(value: T, pointerAddress: PointerAddress): BindResult<T, M>;
|
|
72
81
|
/**
|
|
73
82
|
* Sets up observers for the given value and pointer address if there are update handlers defined for this type binding.
|
|
74
83
|
*/
|
|
75
|
-
handleDifUpdate(
|
|
84
|
+
handleDifUpdate(val: T, pointerAddress: string, difUpdateData: DIFUpdateData): void;
|
|
76
85
|
getUpdateHandlerTypes(): Set<DIFUpdateKind>;
|
|
77
|
-
allowOriginalValueAccess<R>(target:
|
|
86
|
+
allowOriginalValueAccess<R>(target: CachedSharedContainer, callback: () => R): R;
|
|
78
87
|
}
|
|
79
88
|
export {};
|
|
80
89
|
//# sourceMappingURL=type-registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-registry.d.ts","sourceRoot":"","sources":["../../src/dif/type-registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"type-registry.d.ts","sourceRoot":"","sources":["../../src/dif/type-registry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,aAAa,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EACH,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,UAAU,EAElB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,cAAc,EAAE,yBAAyB,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvG,KAAK,UAAU,GAAG;IACd,IAAI,EAAE,MAAM,CAAC;IACb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