@unyt/datex 0.0.7 → 0.0.9
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/_dnt.shims.d.ts +1 -27
- package/esm/_dnt.shims.d.ts.map +1 -1
- package/esm/_dnt.shims.js +1 -31
- package/esm/datex-core/datex_core_js.internal.d.ts +49 -40
- package/esm/datex-core/datex_core_js.internal.d.ts.map +1 -1
- package/esm/datex-core/datex_core_js.internal.js +143 -125
- package/esm/datex-core/datex_core_js.js +13 -16
- package/esm/datex-core/datex_core_js.wasm +0 -0
- package/esm/datex-core/wasm_url.node.js +1 -0
- package/esm/datex-core.d.ts +6 -0
- package/esm/datex-core.d.ts.map +1 -1
- package/esm/datex-core.js +6 -0
- package/esm/default.d.ts +11 -0
- package/esm/default.d.ts.map +1 -0
- package/esm/default.js +22 -0
- package/esm/deno.json +22 -6
- package/esm/dif/builders.d.ts +5 -0
- package/esm/dif/builders.d.ts.map +1 -1
- package/esm/dif/builders.js +5 -0
- package/esm/dif/core.d.ts +44 -0
- package/esm/dif/core.d.ts.map +1 -0
- package/esm/dif/core.js +56 -0
- package/esm/dif/definitions.d.ts +43 -36
- package/esm/dif/definitions.d.ts.map +1 -1
- package/esm/dif/definitions.js +14 -51
- package/esm/dif/dif-handler.d.ts +17 -0
- package/esm/dif/dif-handler.d.ts.map +1 -1
- package/esm/dif/dif-handler.js +22 -5
- package/esm/dif/display.d.ts +23 -0
- package/esm/dif/display.d.ts.map +1 -1
- package/esm/dif/display.js +25 -4
- package/esm/dif/mod.d.ts +5 -0
- package/esm/dif/mod.d.ts.map +1 -0
- package/esm/dif/mod.js +4 -0
- package/esm/mod.d.ts +12 -5
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +10 -23
- package/esm/network/com-hub.d.ts +30 -0
- package/esm/network/com-hub.d.ts.map +1 -1
- package/esm/network/com-hub.js +32 -0
- package/esm/network/com-interface.d.ts +18 -0
- package/esm/network/com-interface.d.ts.map +1 -1
- package/esm/network/com-interface.js +13 -0
- package/esm/network/interface-impls/base.d.ts +28 -1
- package/esm/network/interface-impls/base.d.ts.map +1 -1
- package/esm/network/interface-impls/base.js +30 -4
- package/esm/network/interface-impls/websocket-client.d.ts +3 -1
- package/esm/network/interface-impls/websocket-client.d.ts.map +1 -1
- package/esm/network/interface-impls/websocket-client.js +3 -1
- package/esm/network/mod.d.ts +9 -0
- package/esm/network/mod.d.ts.map +1 -0
- package/esm/network/mod.js +8 -0
- package/esm/refs/ref.d.ts +3 -0
- package/esm/refs/ref.d.ts.map +1 -1
- package/esm/refs/ref.js +3 -0
- package/esm/runtime/runtime.d.ts +55 -5
- package/esm/runtime/runtime.d.ts.map +1 -1
- package/esm/runtime/runtime.js +49 -3
- package/esm/runtime/special-core-types.d.ts +18 -2
- package/esm/runtime/special-core-types.d.ts.map +1 -1
- package/esm/runtime/special-core-types.js +19 -3
- package/esm/utils/js-runtime-compat/js-runtime-interface.d.ts +10 -0
- package/esm/utils/js-runtime-compat/js-runtime-interface.d.ts.map +1 -0
- package/esm/utils/js-runtime-compat/js-runtime-interface.js +1 -0
- package/esm/utils/js-runtime-compat/js-runtime.d.ts +18 -0
- package/esm/utils/js-runtime-compat/js-runtime.d.ts.map +1 -0
- package/esm/utils/js-runtime-compat/js-runtime.js +43 -0
- package/esm/utils/js-runtime-compat/runtimes/browser.d.ts +8 -0
- package/esm/utils/js-runtime-compat/runtimes/browser.d.ts.map +1 -0
- package/esm/utils/js-runtime-compat/runtimes/browser.js +22 -0
- package/esm/utils/js-runtime-compat/runtimes/deno.d.ts +8 -0
- package/esm/utils/js-runtime-compat/runtimes/deno.d.ts.map +1 -0
- package/esm/utils/js-runtime-compat/runtimes/deno.js +19 -0
- package/esm/utils/js-runtime-compat/runtimes/node.d.ts +8 -0
- package/esm/utils/js-runtime-compat/runtimes/node.d.ts.map +1 -0
- package/esm/utils/js-runtime-compat/runtimes/node.js +21 -0
- package/package.json +7 -19
- package/esm/_dnt.polyfills.d.ts +0 -101
- package/esm/_dnt.polyfills.d.ts.map +0 -1
- package/esm/_dnt.polyfills.js +0 -127
- package/esm/network/interface-impls/websocket-server-deno.d.ts +0 -9
- package/esm/network/interface-impls/websocket-server-deno.d.ts.map +0 -1
- package/esm/network/interface-impls/websocket-server-deno.js +0 -45
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import * as dntShim from "../_dnt.shims.js";
|
|
2
1
|
import * as imports from "./datex_core_js.internal.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"./datex_core_js.internal.js": imports,
|
|
16
|
-
})).instance;
|
|
2
|
+
import { runtimeInterface, detectRuntime } from "../utils/js-runtime-compat/js-runtime.js";
|
|
3
|
+
|
|
4
|
+
let wasmUrl;
|
|
5
|
+
if (detectRuntime() == "browser") {
|
|
6
|
+
wasmUrl = (await import("./wasm_url.node.js")).default;
|
|
7
|
+
} else {
|
|
8
|
+
wasmUrl = new URL("datex_core_js.wasm", import.meta.url);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const wasm = (await runtimeInterface.instantiateWebAssembly(wasmUrl, {
|
|
12
|
+
"./datex_core_js.internal.js": imports,
|
|
13
|
+
})).instance;
|
|
17
14
|
export * from "./datex_core_js.internal.js";
|
|
18
15
|
import { __wbg_set_wasm } from "./datex_core_js.internal.js";
|
|
19
16
|
__wbg_set_wasm(wasm.exports);
|
|
20
|
-
wasm.exports.__wbindgen_start();
|
|
17
|
+
wasm.exports.__wbindgen_start();
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./datex_core_js.wasm?url";
|
package/esm/datex-core.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module datex-core.ts
|
|
3
|
+
* @description
|
|
4
|
+
* This module serves as the core of the Datex library, re-exporting
|
|
5
|
+
* essential types and functionalities from the Datex core JavaScript implementation.
|
|
6
|
+
*/
|
|
1
7
|
export * from "./datex-core/datex_core_js.js";
|
|
2
8
|
//# sourceMappingURL=datex-core.d.ts.map
|
package/esm/datex-core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datex-core.d.ts","sourceRoot":"","sources":["../src/datex-core.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"datex-core.d.ts","sourceRoot":"","sources":["../src/datex-core.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,+BAA+B,CAAC"}
|
package/esm/datex-core.js
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module datex-core.ts
|
|
3
|
+
* @description
|
|
4
|
+
* This module serves as the core of the Datex library, re-exporting
|
|
5
|
+
* essential types and functionalities from the Datex core JavaScript implementation.
|
|
6
|
+
*/
|
|
1
7
|
/* @ts-types="./datex-core/datex_core_js.d.ts" */
|
|
2
8
|
export * from "./datex-core/datex_core_js.js";
|
package/esm/default.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module default.ts
|
|
3
|
+
* @description
|
|
4
|
+
* This module exports an instance of the DATEX runtime.
|
|
5
|
+
*/
|
|
6
|
+
import { Runtime } from "./runtime/runtime.js";
|
|
7
|
+
/**
|
|
8
|
+
* The default instance of the Datex runtime.
|
|
9
|
+
*/
|
|
10
|
+
export declare const Datex: Runtime;
|
|
11
|
+
//# sourceMappingURL=default.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../src/default.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,qBAAqB,CAAC;AAG7B,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAa/C;;GAEG;AACH,eAAO,MAAM,KAAK,EAAE,OAElB,CAAC"}
|
package/esm/default.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module default.ts
|
|
3
|
+
* @description
|
|
4
|
+
* This module exports an instance of the DATEX runtime.
|
|
5
|
+
*/
|
|
6
|
+
import { Runtime } from "./runtime/runtime.js";
|
|
7
|
+
/**
|
|
8
|
+
* The default configuration for the Datex runtime.
|
|
9
|
+
*/
|
|
10
|
+
const defaultConfig = {
|
|
11
|
+
interfaces: [{
|
|
12
|
+
type: "websocket-client",
|
|
13
|
+
config: { address: "wss://example.unyt.land" },
|
|
14
|
+
}],
|
|
15
|
+
debug: false, // set to true to show info/debug messages
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The default instance of the Datex runtime.
|
|
19
|
+
*/
|
|
20
|
+
export const Datex = await Runtime.create(defaultConfig, {
|
|
21
|
+
allow_unsigned_blocks: true,
|
|
22
|
+
});
|
package/esm/deno.json
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unyt/datex",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"exports":
|
|
5
|
+
"exports": {
|
|
6
|
+
".": "./src/mod.ts",
|
|
7
|
+
"./default": "./src/default.ts",
|
|
8
|
+
"./interface-impls/base": "./src/network/interface-impls/base.ts",
|
|
9
|
+
"./interface-impls/serial": "./src/network/interface-impls/serial.ts",
|
|
10
|
+
"./interface-impls/webrtc": "./src/network/interface-impls/webrtc.ts",
|
|
11
|
+
"./interface-impls/websocket-client": "./src/network/interface-impls/websocket-client.ts",
|
|
12
|
+
"./interface-impls/websocket-server-deno": "./src/network/interface-impls/websocket-server-deno.ts"
|
|
13
|
+
},
|
|
6
14
|
"compilerOptions": {
|
|
7
15
|
"noImplicitOverride": true,
|
|
8
|
-
"lib": [
|
|
16
|
+
"lib": [
|
|
17
|
+
"deno.window",
|
|
18
|
+
"dom"
|
|
19
|
+
]
|
|
9
20
|
},
|
|
10
21
|
"tasks": {
|
|
11
22
|
"build": "deno run -A scripts/build-wasm.ts --profile debug",
|
|
@@ -21,7 +32,9 @@
|
|
|
21
32
|
},
|
|
22
33
|
"fmt": {
|
|
23
34
|
"indentWidth": 4,
|
|
24
|
-
"exclude": [
|
|
35
|
+
"exclude": [
|
|
36
|
+
"./npm"
|
|
37
|
+
]
|
|
25
38
|
},
|
|
26
39
|
"imports": {
|
|
27
40
|
"@david/path": "jsr:@david/path@^0.2.0",
|
|
@@ -32,10 +45,13 @@
|
|
|
32
45
|
"@std/cli": "jsr:@std/cli@^1.0.23",
|
|
33
46
|
"@std/encoding": "jsr:@std/encoding@^1.0.10",
|
|
34
47
|
"@std/fmt": "jsr:@std/fmt@^1.0.8",
|
|
35
|
-
"@std/uuid": "jsr:@std/uuid@^1.0.9"
|
|
48
|
+
"@std/uuid": "jsr:@std/uuid@^1.0.9",
|
|
49
|
+
"@unyt/speck": "jsr:@unyt/speck@^0.0.10"
|
|
36
50
|
},
|
|
37
51
|
"test": {
|
|
38
|
-
"exclude": [
|
|
52
|
+
"exclude": [
|
|
53
|
+
"./npm"
|
|
54
|
+
]
|
|
39
55
|
},
|
|
40
56
|
"publish": {
|
|
41
57
|
"exclude": [
|
package/esm/dif/builders.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../../src/dif/builders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,kBAAkB,CAAC;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,EACzB,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,CAAC,GACT,aAAa,CAMf;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,CAAC,EACnC,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,CAAC,EACX,KAAK,EAAE,CAAC,GACT,aAAa,CAQf"}
|
|
1
|
+
{"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../../src/dif/builders.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,kBAAkB,CAAC;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,EACzB,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,CAAC,GACT,aAAa,CAMf;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,CAAC,EACnC,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,CAAC,EACX,KAAK,EAAE,CAAC,GACT,aAAa,CAQf"}
|
package/esm/dif/builders.js
CHANGED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mapping of core type names to their unique pointer addresses.
|
|
3
|
+
*/
|
|
4
|
+
export declare const CoreTypeAddress: {
|
|
5
|
+
readonly null: "010000";
|
|
6
|
+
readonly type: "020000";
|
|
7
|
+
readonly boolean: "030000";
|
|
8
|
+
readonly endpoint: "070000";
|
|
9
|
+
readonly text: "080000";
|
|
10
|
+
readonly list: "090000";
|
|
11
|
+
readonly unit: "0b0000";
|
|
12
|
+
readonly map: "0c0000";
|
|
13
|
+
readonly decimal: "2c0100";
|
|
14
|
+
readonly decimal_f32: "2d0100";
|
|
15
|
+
readonly decimal_f64: "2e0100";
|
|
16
|
+
readonly decimal_big: "2f0100";
|
|
17
|
+
readonly integer: "640000";
|
|
18
|
+
readonly integer_u8: "650000";
|
|
19
|
+
readonly integer_u16: "660000";
|
|
20
|
+
readonly integer_u32: "670000";
|
|
21
|
+
readonly integer_u64: "680000";
|
|
22
|
+
readonly integer_u128: "690000";
|
|
23
|
+
readonly integer_i8: "6a0000";
|
|
24
|
+
readonly integer_i16: "6b0000";
|
|
25
|
+
readonly integer_i32: "6c0000";
|
|
26
|
+
readonly integer_i64: "6d0000";
|
|
27
|
+
readonly integer_i128: "6e0000";
|
|
28
|
+
readonly integer_big: "6f0000";
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Type representing the unique pointer addresses of core types.
|
|
32
|
+
*/
|
|
33
|
+
export type CoreTypeAddress = typeof CoreTypeAddress[keyof typeof CoreTypeAddress];
|
|
34
|
+
/**
|
|
35
|
+
* Mapping of core type address ranges for categorization.
|
|
36
|
+
*/
|
|
37
|
+
export declare const CoreTypeAddressRanges: {
|
|
38
|
+
readonly small_unsigned_integers: Set<"650000" | "660000" | "670000" | "680000" | "690000">;
|
|
39
|
+
readonly big_unsigned_integers: Set<"6f0000">;
|
|
40
|
+
readonly small_signed_integers: Set<"6a0000" | "6b0000" | "6c0000" | "6d0000" | "6e0000">;
|
|
41
|
+
readonly big_signed_integers: Set<"6f0000">;
|
|
42
|
+
readonly decimals: Set<"2c0100" | "2d0100" | "2e0100" | "2f0100">;
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/dif/core.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;CAyBlB,CAAC;AACX;;GAEG;AACH,MAAM,MAAM,eAAe,GACvB,OAAO,eAAe,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AAEzD;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;CAuBxB,CAAC"}
|
package/esm/dif/core.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mapping of core type names to their unique pointer addresses.
|
|
3
|
+
*/
|
|
4
|
+
export const CoreTypeAddress = {
|
|
5
|
+
null: "010000",
|
|
6
|
+
type: "020000",
|
|
7
|
+
boolean: "030000",
|
|
8
|
+
endpoint: "070000",
|
|
9
|
+
text: "080000",
|
|
10
|
+
list: "090000",
|
|
11
|
+
unit: "0b0000",
|
|
12
|
+
map: "0c0000",
|
|
13
|
+
decimal: "2c0100",
|
|
14
|
+
decimal_f32: "2d0100",
|
|
15
|
+
decimal_f64: "2e0100",
|
|
16
|
+
decimal_big: "2f0100",
|
|
17
|
+
integer: "640000",
|
|
18
|
+
integer_u8: "650000",
|
|
19
|
+
integer_u16: "660000",
|
|
20
|
+
integer_u32: "670000",
|
|
21
|
+
integer_u64: "680000",
|
|
22
|
+
integer_u128: "690000",
|
|
23
|
+
integer_i8: "6a0000",
|
|
24
|
+
integer_i16: "6b0000",
|
|
25
|
+
integer_i32: "6c0000",
|
|
26
|
+
integer_i64: "6d0000",
|
|
27
|
+
integer_i128: "6e0000",
|
|
28
|
+
integer_big: "6f0000",
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Mapping of core type address ranges for categorization.
|
|
32
|
+
*/
|
|
33
|
+
export const CoreTypeAddressRanges = {
|
|
34
|
+
small_unsigned_integers: new Set([
|
|
35
|
+
CoreTypeAddress.integer_u8,
|
|
36
|
+
CoreTypeAddress.integer_u16,
|
|
37
|
+
CoreTypeAddress.integer_u32,
|
|
38
|
+
CoreTypeAddress.integer_u64,
|
|
39
|
+
CoreTypeAddress.integer_u128,
|
|
40
|
+
]),
|
|
41
|
+
big_unsigned_integers: new Set([CoreTypeAddress.integer_big]),
|
|
42
|
+
small_signed_integers: new Set([
|
|
43
|
+
CoreTypeAddress.integer_i8,
|
|
44
|
+
CoreTypeAddress.integer_i16,
|
|
45
|
+
CoreTypeAddress.integer_i32,
|
|
46
|
+
CoreTypeAddress.integer_i64,
|
|
47
|
+
CoreTypeAddress.integer_i128,
|
|
48
|
+
]),
|
|
49
|
+
big_signed_integers: new Set([CoreTypeAddress.integer_big]),
|
|
50
|
+
decimals: new Set([
|
|
51
|
+
CoreTypeAddress.decimal,
|
|
52
|
+
CoreTypeAddress.decimal_f32,
|
|
53
|
+
CoreTypeAddress.decimal_f64,
|
|
54
|
+
CoreTypeAddress.decimal_big,
|
|
55
|
+
]),
|
|
56
|
+
};
|
package/esm/dif/definitions.d.ts
CHANGED
|
@@ -1,44 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
readonly decimal: "2c0100";
|
|
11
|
-
readonly decimal_f32: "2d0100";
|
|
12
|
-
readonly decimal_f64: "2e0100";
|
|
13
|
-
readonly decimal_big: "2f0100";
|
|
14
|
-
readonly integer: "640000";
|
|
15
|
-
readonly integer_u8: "650000";
|
|
16
|
-
readonly integer_u16: "660000";
|
|
17
|
-
readonly integer_u32: "670000";
|
|
18
|
-
readonly integer_u64: "680000";
|
|
19
|
-
readonly integer_u128: "690000";
|
|
20
|
-
readonly integer_i8: "6a0000";
|
|
21
|
-
readonly integer_i16: "6b0000";
|
|
22
|
-
readonly integer_i32: "6c0000";
|
|
23
|
-
readonly integer_i64: "6d0000";
|
|
24
|
-
readonly integer_i128: "6e0000";
|
|
25
|
-
readonly integer_big: "6f0000";
|
|
26
|
-
};
|
|
27
|
-
export type CoreTypeAddress = typeof CoreTypeAddress[keyof typeof CoreTypeAddress];
|
|
28
|
-
export declare const CoreTypeAddressRanges: {
|
|
29
|
-
readonly small_unsigned_integers: Set<"650000" | "660000" | "670000" | "680000" | "690000">;
|
|
30
|
-
readonly big_unsigned_integers: Set<"6f0000">;
|
|
31
|
-
readonly small_signed_integers: Set<"6a0000" | "6b0000" | "6c0000" | "6d0000" | "6e0000">;
|
|
32
|
-
readonly big_signed_integers: Set<"6f0000">;
|
|
33
|
-
readonly decimals: Set<"2c0100" | "2d0100" | "2e0100" | "2f0100">;
|
|
34
|
-
};
|
|
35
|
-
/** 3, 5, or 26 byte hex string */
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* @description
|
|
4
|
+
* This module contains all definitions related to the DIF (DATEX Interchange Format) interfaces of the DATEX runtime.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* A DATEX pointer address representation in the DIF format.
|
|
8
|
+
* (3, 5, or 26 byte hex string)
|
|
9
|
+
*/
|
|
36
10
|
export type DIFPointerAddress = string;
|
|
11
|
+
/**
|
|
12
|
+
* A DATEX value representation in the DIF format,
|
|
13
|
+
* which may optionally include type information.
|
|
14
|
+
*/
|
|
37
15
|
export type DIFValue = {
|
|
38
16
|
type?: DIFTypeContainer;
|
|
39
17
|
value: DIFRepresentationValue;
|
|
40
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* A DATEX value or pointer address representation in the DIF format.
|
|
21
|
+
*/
|
|
41
22
|
export type DIFContainer = DIFValue | DIFPointerAddress;
|
|
23
|
+
/**
|
|
24
|
+
* Mapping of DIF type kinds.
|
|
25
|
+
*/
|
|
42
26
|
export declare const DIFTypeKinds: {
|
|
43
27
|
readonly Structural: 0;
|
|
44
28
|
readonly Reference: 1;
|
|
@@ -47,31 +31,47 @@ export declare const DIFTypeKinds: {
|
|
|
47
31
|
readonly Unit: 4;
|
|
48
32
|
readonly Function: 5;
|
|
49
33
|
};
|
|
34
|
+
/** A DIF type kind. */
|
|
50
35
|
export type DIFTypeKind = typeof DIFTypeKinds[keyof typeof DIFTypeKinds];
|
|
36
|
+
/**
|
|
37
|
+
* Representation of reference mutability (mutable or immutable) in DIF.
|
|
38
|
+
*/
|
|
51
39
|
export declare const DIFReferenceMutability: {
|
|
52
40
|
readonly Mutable: 0;
|
|
53
41
|
readonly Immutable: 1;
|
|
54
|
-
readonly Final: 2;
|
|
55
42
|
};
|
|
43
|
+
/** A DIF reference mutability. */
|
|
56
44
|
export type DIFReferenceMutability = typeof DIFReferenceMutability[keyof typeof DIFReferenceMutability];
|
|
45
|
+
/** A DIF type definition based on its kind. */
|
|
57
46
|
export type DIFTypeDefinition<Kind extends DIFTypeKind = DIFTypeKind> = Kind extends typeof DIFTypeKinds.Structural ? DIFValue : Kind extends typeof DIFTypeKinds.Reference ? DIFPointerAddress : Kind extends typeof DIFTypeKinds.Intersection ? Array<DIFTypeContainer> : Kind extends typeof DIFTypeKinds.Union ? Array<DIFTypeContainer> : Kind extends typeof DIFTypeKinds.Unit ? null : Kind extends typeof DIFTypeKinds.Function ? unknown : never;
|
|
47
|
+
/** A DIF type representation. */
|
|
58
48
|
export type DIFType<Kind extends DIFTypeKind = DIFTypeKind> = {
|
|
59
49
|
name?: string;
|
|
60
50
|
kind: Kind;
|
|
61
51
|
def: DIFTypeDefinition<Kind>;
|
|
62
52
|
mut?: DIFReferenceMutability;
|
|
63
53
|
};
|
|
54
|
+
/** A representation of a reference in DIF. */
|
|
64
55
|
export type DIFReference = {
|
|
65
56
|
value: DIFValueContainer;
|
|
66
57
|
allowed_type: DIFTypeContainer;
|
|
67
58
|
mut: DIFReferenceMutability;
|
|
68
59
|
};
|
|
60
|
+
/** A representation of a value or pointer address in DIF. */
|
|
69
61
|
export type DIFValueContainer = DIFValue | DIFPointerAddress;
|
|
62
|
+
/** A representation of a type or type pointer address in DIF. */
|
|
70
63
|
export type DIFTypeContainer = DIFType | DIFPointerAddress;
|
|
64
|
+
/** A DIF object, mapping string keys to DIF value containers. */
|
|
71
65
|
export type DIFObject = Record<string, DIFValueContainer>;
|
|
66
|
+
/** A DIF array, containing DIF value containers. */
|
|
72
67
|
export type DIFArray = DIFValueContainer[];
|
|
68
|
+
/** A DIF map, containing key-value pairs of DIF value containers. */
|
|
73
69
|
export type DIFMap = [DIFValueContainer, DIFValueContainer][];
|
|
70
|
+
/** Any DIF representation value (JSON-compatible values). */
|
|
74
71
|
export type DIFRepresentationValue = string | number | boolean | null | DIFObject | DIFMap | DIFArray;
|
|
72
|
+
/**
|
|
73
|
+
* Representation of a property in DIF, which can be a text key, an index, or a generic value.
|
|
74
|
+
*/
|
|
75
75
|
export type DIFProperty = {
|
|
76
76
|
kind: "text";
|
|
77
77
|
value: string;
|
|
@@ -82,6 +82,9 @@ export type DIFProperty = {
|
|
|
82
82
|
kind: "value";
|
|
83
83
|
value: DIFValueContainer;
|
|
84
84
|
};
|
|
85
|
+
/**
|
|
86
|
+
* Kinds of updates that can be applied to a DIF value.
|
|
87
|
+
*/
|
|
85
88
|
export declare const DIFUpdateKind: {
|
|
86
89
|
readonly Replace: "replace";
|
|
87
90
|
readonly Push: "push";
|
|
@@ -89,7 +92,9 @@ export declare const DIFUpdateKind: {
|
|
|
89
92
|
readonly Remove: "remove";
|
|
90
93
|
readonly Clear: "clear";
|
|
91
94
|
};
|
|
95
|
+
/** A DIF update kind. */
|
|
92
96
|
export type DIFUpdateKind = typeof DIFUpdateKind[keyof typeof DIFUpdateKind];
|
|
97
|
+
/** Different kinds of updates that can be applied to a DIF value. */
|
|
93
98
|
export type DIFUpdateData = {
|
|
94
99
|
kind: typeof DIFUpdateKind.Replace;
|
|
95
100
|
value: DIFValueContainer;
|
|
@@ -106,10 +111,12 @@ export type DIFUpdateData = {
|
|
|
106
111
|
} | {
|
|
107
112
|
kind: typeof DIFUpdateKind.Clear;
|
|
108
113
|
};
|
|
114
|
+
/** A DIF update struct, associating a source ID with update data. */
|
|
109
115
|
export type DIFUpdate = {
|
|
110
116
|
source_id: number;
|
|
111
117
|
data: DIFUpdateData;
|
|
112
118
|
};
|
|
119
|
+
/** Options for observing DIF pointers. */
|
|
113
120
|
export type ObserveOptions = {
|
|
114
121
|
relay_own_updates: boolean;
|
|
115
122
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/dif/definitions.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/dif/definitions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC;AACvC;;;GAGG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,aAAa,CAAC,IAAI,CAAC;IAAC,KAAK,EAAE,iBAAiB,CAAA;CAAE,GAC7D;IAAE,IAAI,EAAE,OAAO,aAAa,CAAC,MAAM,CAAC;IAAC,GAAG,EAAE,WAAW,CAAA;CAAE,GACvD;IACE,IAAI,EAAE,OAAO,aAAa,CAAC,GAAG,CAAC;IAC/B,GAAG,EAAE,WAAW,CAAC;IACjB,KAAK,EAAE,iBAAiB,CAAC;CAC5B,GACC;IAAE,IAAI,EAAE,OAAO,aAAa,CAAC,KAAK,CAAA;CAAE,CAAC;AAE3C,qEAAqE;AACrE,MAAM,MAAM,SAAS,GAAG;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,aAAa,CAAC;CACvB,CAAC;AAEF,0CAA0C;AAC1C,MAAM,MAAM,cAAc,GAAG;IACzB,iBAAiB,EAAE,OAAO,CAAC;CAC9B,CAAC"}
|
package/esm/dif/definitions.js
CHANGED
|
@@ -1,53 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
map: "0c0000",
|
|
10
|
-
decimal: "2c0100",
|
|
11
|
-
decimal_f32: "2d0100",
|
|
12
|
-
decimal_f64: "2e0100",
|
|
13
|
-
decimal_big: "2f0100",
|
|
14
|
-
integer: "640000",
|
|
15
|
-
integer_u8: "650000",
|
|
16
|
-
integer_u16: "660000",
|
|
17
|
-
integer_u32: "670000",
|
|
18
|
-
integer_u64: "680000",
|
|
19
|
-
integer_u128: "690000",
|
|
20
|
-
integer_i8: "6a0000",
|
|
21
|
-
integer_i16: "6b0000",
|
|
22
|
-
integer_i32: "6c0000",
|
|
23
|
-
integer_i64: "6d0000",
|
|
24
|
-
integer_i128: "6e0000",
|
|
25
|
-
integer_big: "6f0000",
|
|
26
|
-
};
|
|
27
|
-
export const CoreTypeAddressRanges = {
|
|
28
|
-
small_unsigned_integers: new Set([
|
|
29
|
-
CoreTypeAddress.integer_u8,
|
|
30
|
-
CoreTypeAddress.integer_u16,
|
|
31
|
-
CoreTypeAddress.integer_u32,
|
|
32
|
-
CoreTypeAddress.integer_u64,
|
|
33
|
-
CoreTypeAddress.integer_u128,
|
|
34
|
-
]),
|
|
35
|
-
big_unsigned_integers: new Set([CoreTypeAddress.integer_big]),
|
|
36
|
-
small_signed_integers: new Set([
|
|
37
|
-
CoreTypeAddress.integer_i8,
|
|
38
|
-
CoreTypeAddress.integer_i16,
|
|
39
|
-
CoreTypeAddress.integer_i32,
|
|
40
|
-
CoreTypeAddress.integer_i64,
|
|
41
|
-
CoreTypeAddress.integer_i128,
|
|
42
|
-
]),
|
|
43
|
-
big_signed_integers: new Set([CoreTypeAddress.integer_big]),
|
|
44
|
-
decimals: new Set([
|
|
45
|
-
CoreTypeAddress.decimal,
|
|
46
|
-
CoreTypeAddress.decimal_f32,
|
|
47
|
-
CoreTypeAddress.decimal_f64,
|
|
48
|
-
CoreTypeAddress.decimal_big,
|
|
49
|
-
]),
|
|
50
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* @description
|
|
4
|
+
* This module contains all definitions related to the DIF (DATEX Interchange Format) interfaces of the DATEX runtime.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Mapping of DIF type kinds.
|
|
8
|
+
*/
|
|
51
9
|
export const DIFTypeKinds = {
|
|
52
10
|
Structural: 0,
|
|
53
11
|
Reference: 1,
|
|
@@ -56,11 +14,16 @@ export const DIFTypeKinds = {
|
|
|
56
14
|
Unit: 4,
|
|
57
15
|
Function: 5,
|
|
58
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* Representation of reference mutability (mutable or immutable) in DIF.
|
|
19
|
+
*/
|
|
59
20
|
export const DIFReferenceMutability = {
|
|
60
21
|
Mutable: 0,
|
|
61
22
|
Immutable: 1,
|
|
62
|
-
Final: 2,
|
|
63
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* Kinds of updates that can be applied to a DIF value.
|
|
26
|
+
*/
|
|
64
27
|
export const DIFUpdateKind = {
|
|
65
28
|
Replace: "replace",
|
|
66
29
|
Push: "push",
|
package/esm/dif/dif-handler.d.ts
CHANGED
|
@@ -1,10 +1,27 @@
|
|
|
1
1
|
import type { JSRuntime, RuntimeDIFHandle } from "../datex-core.js";
|
|
2
2
|
import { Ref } from "../refs/ref.js";
|
|
3
3
|
import { type DIFContainer, type DIFPointerAddress, DIFReferenceMutability, type DIFTypeContainer, type DIFUpdate, type DIFUpdateData, type DIFValue, type DIFValueContainer, type ObserveOptions } from "./definitions.js";
|
|
4
|
+
/**
|
|
5
|
+
* The DIFHandler class provides methods to interact with the DATEX Core DIF runtime,
|
|
6
|
+
* including executing Datex scripts, creating and managing pointers, and observing changes.
|
|
7
|
+
* It includes a local pointer cache to optimize performance and reduce cross-language calls.
|
|
8
|
+
*/
|
|
4
9
|
export declare class DIFHandler {
|
|
5
10
|
#private;
|
|
11
|
+
/**
|
|
12
|
+
* Internal property
|
|
13
|
+
* @returns The map of observers for each pointer address.
|
|
14
|
+
*/
|
|
6
15
|
get _observers(): Map<string, Map<number, (value: DIFUpdateData) => void>>;
|
|
16
|
+
/**
|
|
17
|
+
* Internal property
|
|
18
|
+
* @returns The RuntimeDIFHandle instance.
|
|
19
|
+
*/
|
|
7
20
|
get _handle(): RuntimeDIFHandle;
|
|
21
|
+
/**
|
|
22
|
+
* Internal property
|
|
23
|
+
* @returns The transceiver ID of the DIF client.
|
|
24
|
+
*/
|
|
8
25
|
get _transceiver_id(): number;
|
|
9
26
|
/**
|
|
10
27
|
* Creates a new DIFHandler instance.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dif-handler.d.ts","sourceRoot":"","sources":["../../src/dif/dif-handler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dif-handler.d.ts","sourceRoot":"","sources":["../../src/dif/dif-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,E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EAAE,MAAM,EACf,KAAK,EAAE,OAAO,EACd,UAAU,EAAE,MAAM,GAAG,IAAI,GAC1B,IAAI;IAqBP,SAAS,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IAWhE;;;;OAIG;IACI,wBAAwB,CAC3B,KAAK,EAAE,OAAO,EACd,WAAW,GAAE,gBAAgB,GAAG,IAAW,EAC3C,UAAU,GAAE,sBAAuD,GACpE,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;IAiBzB,SAAS,CAAC,kBAAkB,CAAC,CAAC,EAC1B,KAAK,EAAE,CAAC,EACR,cAAc,EAAE,MAAM,EACtB,KAAK,GAAE,gBAAgB,GAAG,IAAW,GACtC,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,GAAG,OAAO;IAkB/B,OAAO,CAAC,KAAK;IAIb,OAAO,CAAC,YAAY;IAwDpB,OAAO,CAAC,mBAAmB;IAuCpB,yBAAyB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,GAAG,IAAI;IAU5D;;OAEG;IACI,wBAAwB,CAAC,CAAC,SAAS,OAAO,EAC7C,KAAK,EAAE,CAAC,GACT,QAAQ;CAwDd"}
|
package/esm/dif/dif-handler.js
CHANGED
|
@@ -10,18 +10,35 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
10
10
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
11
|
};
|
|
12
12
|
var _DIFHandler_runtime, _DIFHandler_handle, _DIFHandler_transceiver_id, _DIFHandler_cache, _DIFHandler_observers;
|
|
13
|
-
import * as dntShim from "../_dnt.shims.js";
|
|
14
13
|
import { Ref } from "../refs/ref.js";
|
|
15
14
|
import { Endpoint } from "../runtime/special-core-types.js";
|
|
16
|
-
import {
|
|
15
|
+
import { DIFReferenceMutability, DIFUpdateKind, } from "./definitions.js";
|
|
16
|
+
import { CoreTypeAddress, CoreTypeAddressRanges } from "./core.js";
|
|
17
17
|
import { difValueContainerToDisplayString } from "./display.js";
|
|
18
|
+
/**
|
|
19
|
+
* The DIFHandler class provides methods to interact with the DATEX Core DIF runtime,
|
|
20
|
+
* including executing Datex scripts, creating and managing pointers, and observing changes.
|
|
21
|
+
* It includes a local pointer cache to optimize performance and reduce cross-language calls.
|
|
22
|
+
*/
|
|
18
23
|
export class DIFHandler {
|
|
24
|
+
/**
|
|
25
|
+
* Internal property
|
|
26
|
+
* @returns The map of observers for each pointer address.
|
|
27
|
+
*/
|
|
19
28
|
get _observers() {
|
|
20
29
|
return __classPrivateFieldGet(this, _DIFHandler_observers, "f");
|
|
21
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Internal property
|
|
33
|
+
* @returns The RuntimeDIFHandle instance.
|
|
34
|
+
*/
|
|
22
35
|
get _handle() {
|
|
23
36
|
return __classPrivateFieldGet(this, _DIFHandler_handle, "f");
|
|
24
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Internal property
|
|
40
|
+
* @returns The transceiver ID of the DIF client.
|
|
41
|
+
*/
|
|
25
42
|
get _transceiver_id() {
|
|
26
43
|
return __classPrivateFieldGet(this, _DIFHandler_transceiver_id, "f");
|
|
27
44
|
}
|
|
@@ -415,9 +432,9 @@ export class DIFHandler {
|
|
|
415
432
|
*/
|
|
416
433
|
initPointer(ptrAddress, value, mutability, allowedType = null) {
|
|
417
434
|
const refValue = this.wrapJSValueInProxy(value, ptrAddress, allowedType);
|
|
418
|
-
// if not
|
|
435
|
+
// if not immutable, observe to keep the pointer 'live' and receive updates
|
|
419
436
|
let observerId = null;
|
|
420
|
-
if (mutability !== DIFReferenceMutability.
|
|
437
|
+
if (mutability !== DIFReferenceMutability.Immutable) {
|
|
421
438
|
observerId = this.observePointerBindDirect(ptrAddress, (update) => {
|
|
422
439
|
// if source_id is not own transceiver id, handle pointer update
|
|
423
440
|
if (update.source_id !== __classPrivateFieldGet(this, _DIFHandler_transceiver_id, "f")) {
|
|
@@ -467,7 +484,7 @@ export class DIFHandler {
|
|
|
467
484
|
*/
|
|
468
485
|
cacheWrappedPointerValue(address, value, observerId) {
|
|
469
486
|
__classPrivateFieldGet(this, _DIFHandler_cache, "f").set(address, {
|
|
470
|
-
val: new
|
|
487
|
+
val: new WeakRef(value),
|
|
471
488
|
observerId,
|
|
472
489
|
});
|
|
473
490
|
// register finalizer to clean up the cache and free the pointer in the runtime
|