@unyt/datex 0.0.10 → 0.0.12
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/README.md +10 -14
- package/esm/datex-web/datex_web.d.ts +2 -0
- package/esm/datex-web/datex_web.d.ts.map +1 -0
- package/esm/datex-web/datex_web.internal.d.ts +383 -0
- package/esm/datex-web/datex_web.internal.d.ts.map +1 -0
- package/esm/{datex-core/datex_core_js.internal.js → datex-web/datex_web.internal.js} +794 -1141
- package/esm/datex-web/datex_web.js +18 -0
- package/esm/datex-web/datex_web.wasm +0 -0
- package/esm/datex-web/wasm_url.node.js +1 -0
- package/esm/{datex-core.d.ts → datex.d.ts} +3 -3
- package/esm/datex.d.ts.map +1 -0
- package/esm/{datex-core.js → datex.js} +3 -3
- package/esm/default.d.ts.map +1 -1
- package/esm/default.js +2 -3
- package/esm/deno.json +28 -20
- package/esm/dif/core.d.ts +5 -3
- package/esm/dif/core.d.ts.map +1 -1
- package/esm/dif/core.js +7 -5
- package/esm/dif/definitions.d.ts +45 -34
- package/esm/dif/definitions.d.ts.map +1 -1
- package/esm/dif/definitions.js +14 -9
- package/esm/dif/dif-handler.d.ts +135 -35
- package/esm/dif/dif-handler.d.ts.map +1 -1
- package/esm/dif/dif-handler.js +378 -159
- package/esm/dif/display.d.ts +3 -3
- package/esm/dif/display.d.ts.map +1 -1
- package/esm/dif/display.js +5 -7
- package/esm/dif/js-lib.d.ts +8 -0
- package/esm/dif/js-lib.d.ts.map +1 -0
- package/esm/dif/js-lib.js +3 -0
- package/esm/dif/mod.d.ts +0 -1
- package/esm/dif/mod.d.ts.map +1 -1
- package/esm/dif/mod.js +0 -1
- package/esm/dif/type-registry.d.ts +80 -0
- package/esm/dif/type-registry.d.ts.map +1 -0
- package/esm/dif/type-registry.js +166 -0
- package/esm/global.d.ts +2 -0
- package/esm/global.d.ts.map +1 -0
- package/esm/global.js +1 -0
- package/esm/{runtime/special-core-types.d.ts → lib/special-core-types/endpoint.d.ts} +3 -1
- package/esm/lib/special-core-types/endpoint.d.ts.map +1 -0
- package/esm/{runtime/special-core-types.js → lib/special-core-types/endpoint.js} +6 -1
- package/esm/mod.d.ts +3 -1
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +3 -1
- package/esm/network/com-hub.d.ts +20 -22
- package/esm/network/com-hub.d.ts.map +1 -1
- package/esm/network/com-hub.js +30 -49
- package/esm/network/interfaces/websocket-server-base.d.ts +8 -0
- package/esm/network/interfaces/websocket-server-base.d.ts.map +1 -0
- package/esm/network/interfaces/websocket-server-base.js +93 -0
- package/esm/network/interfaces/websocket-server-deno.d.ts +4 -0
- package/esm/network/interfaces/websocket-server-deno.d.ts.map +1 -0
- package/esm/network/interfaces/websocket-server-deno.js +22 -0
- package/esm/network/mod.d.ts +0 -1
- package/esm/network/mod.d.ts.map +1 -1
- package/esm/network/mod.js +0 -1
- package/esm/refs/ref.d.ts.map +1 -1
- package/esm/refs/ref.js +1 -2
- package/esm/runtime/runtime.d.ts +25 -62
- package/esm/runtime/runtime.d.ts.map +1 -1
- package/esm/runtime/runtime.js +42 -26
- package/esm/utils/devtools-formatter.d.ts +2 -0
- package/esm/utils/devtools-formatter.d.ts.map +1 -0
- package/esm/utils/devtools-formatter.js +40 -0
- package/esm/utils/exceptions.d.ts +4 -0
- package/esm/utils/exceptions.d.ts.map +1 -0
- package/esm/utils/exceptions.js +9 -0
- package/esm/utils/js-runtime-compat/js-runtime.d.ts.map +1 -1
- package/package.json +7 -7
- package/esm/datex-core/datex_core_js.d.ts +0 -2
- package/esm/datex-core/datex_core_js.d.ts.map +0 -1
- package/esm/datex-core/datex_core_js.internal.d.ts +0 -512
- package/esm/datex-core/datex_core_js.internal.d.ts.map +0 -1
- package/esm/datex-core/datex_core_js.js +0 -21
- package/esm/datex-core/datex_core_js.wasm +0 -0
- package/esm/datex-core/wasm_url.node.js +0 -1
- package/esm/datex-core.d.ts.map +0 -1
- package/esm/dif/builders.d.ts +0 -16
- package/esm/dif/builders.d.ts.map +0 -1
- package/esm/dif/builders.js +0 -28
- package/esm/network/com-interface.d.ts +0 -35
- package/esm/network/com-interface.d.ts.map +0 -1
- package/esm/network/com-interface.js +0 -75
- package/esm/network/interface-impls/base.d.ts +0 -46
- package/esm/network/interface-impls/base.d.ts.map +0 -1
- package/esm/network/interface-impls/base.js +0 -47
- package/esm/network/interface-impls/websocket-client.d.ts +0 -8
- package/esm/network/interface-impls/websocket-client.d.ts.map +0 -1
- package/esm/network/interface-impls/websocket-client.js +0 -8
- package/esm/runtime/special-core-types.d.ts.map +0 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as imports from "./datex_web.internal.js";
|
|
2
|
+
import { detectRuntime, runtimeInterface } from "../utils/js-runtime-compat/js-runtime.js";
|
|
3
|
+
|
|
4
|
+
let wasmUrl;
|
|
5
|
+
const isVite = !!import.meta.env?.MODE;
|
|
6
|
+
if (detectRuntime() == "browser" && isVite) {
|
|
7
|
+
wasmUrl = (await import("./wasm_url.node.js")).default;
|
|
8
|
+
} else {
|
|
9
|
+
wasmUrl = new URL("datex_web.wasm", import.meta.url);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const wasm = (await runtimeInterface.instantiateWebAssembly(wasmUrl, {
|
|
13
|
+
"./datex_web_bg.js": imports,
|
|
14
|
+
})).instance;
|
|
15
|
+
export * from "./datex_web.internal.js";
|
|
16
|
+
import { __wbg_set_wasm } from "./datex_web.internal.js";
|
|
17
|
+
__wbg_set_wasm(wasm.exports);
|
|
18
|
+
wasm.exports.__wbindgen_start();
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./datex_web.wasm?url";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @module datex
|
|
2
|
+
* @module datex.ts
|
|
3
3
|
* @description
|
|
4
4
|
* This module serves as the core of the Datex library, re-exporting
|
|
5
5
|
* essential types and functionalities from the Datex core JavaScript implementation.
|
|
6
6
|
*/
|
|
7
|
-
export * from "./datex-
|
|
8
|
-
//# sourceMappingURL=datex
|
|
7
|
+
export * from "./datex-web/datex_web.js";
|
|
8
|
+
//# sourceMappingURL=datex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datex.d.ts","sourceRoot":"","sources":["../src/datex.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,0BAA0B,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @module datex
|
|
2
|
+
* @module datex.ts
|
|
3
3
|
* @description
|
|
4
4
|
* This module serves as the core of the Datex library, re-exporting
|
|
5
5
|
* essential types and functionalities from the Datex core JavaScript implementation.
|
|
6
6
|
*/
|
|
7
|
-
/* @ts-types="./datex-
|
|
8
|
-
export * from "./datex-
|
|
7
|
+
/* @ts-types="./datex-web/datex_web.d.ts" */
|
|
8
|
+
export * from "./datex-web/datex_web.js";
|
package/esm/default.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../src/default.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,qBAAqB,CAAC;AAG7B,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../src/default.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,qBAAqB,CAAC;AAG7B,OAAO,EAAE,OAAO,EAAsB,MAAM,sBAAsB,CAAC;AAYnE;;GAEG;AACH,eAAO,MAAM,KAAK,EAAE,OAElB,CAAC"}
|
package/esm/default.js
CHANGED
|
@@ -18,13 +18,12 @@ import { Runtime } from "./runtime/runtime.js";
|
|
|
18
18
|
const defaultConfig = {
|
|
19
19
|
interfaces: [{
|
|
20
20
|
type: "websocket-client",
|
|
21
|
-
config: {
|
|
21
|
+
config: { url: "wss://example.unyt.land" },
|
|
22
22
|
}],
|
|
23
|
-
debug: false, // set to true to show info/debug messages
|
|
24
23
|
};
|
|
25
24
|
/**
|
|
26
25
|
* The default instance of the Datex runtime.
|
|
27
26
|
*/
|
|
28
27
|
export const Datex = await Runtime.create(defaultConfig, {
|
|
29
|
-
|
|
28
|
+
log_level: "warn",
|
|
30
29
|
});
|
package/esm/deno.json
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unyt/datex",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./src/mod.ts",
|
|
7
7
|
"./default": "./src/default.ts",
|
|
8
|
-
"./
|
|
9
|
-
"./
|
|
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"
|
|
8
|
+
"./interfaces/websocket-server-base": "./src/network/interfaces/websocket-server-base.ts",
|
|
9
|
+
"./interfaces/websocket-server-deno": "./src/network/interfaces/websocket-server-deno.ts"
|
|
13
10
|
},
|
|
14
11
|
"compilerOptions": {
|
|
15
12
|
"noImplicitOverride": true,
|
|
@@ -19,38 +16,49 @@
|
|
|
19
16
|
]
|
|
20
17
|
},
|
|
21
18
|
"tasks": {
|
|
22
|
-
"
|
|
19
|
+
"debug": "deno run -A scripts/build-wasm.ts --profile debug --features debug",
|
|
23
20
|
"release": "deno run -A scripts/build-wasm.ts --profile release",
|
|
24
|
-
"debug-
|
|
25
|
-
|
|
21
|
+
"debug-unsecure": "deno run -A scripts/build-wasm.ts --profile debug --features debug,allow_unsigned_blocks",
|
|
22
|
+
|
|
23
|
+
"debug-no-opt": "deno task debug --no-opt",
|
|
24
|
+
"test": "deno task debug-no-opt && deno test -A",
|
|
26
25
|
"test-no-build": "deno test -A",
|
|
26
|
+
|
|
27
27
|
"build-npm": "deno run -A scripts/build-npm.ts",
|
|
28
28
|
"build-bundle": "deno run -A scripts/build-bundle.ts",
|
|
29
|
-
|
|
29
|
+
|
|
30
|
+
"browser-demo": "deno task debug-no-opt && deno task build-npm && cd datex-browser-demo && npm install && npm run dev",
|
|
31
|
+
"browser-demo-no-build": "deno task build-npm && cd datex-browser-demo && npm install && npm run dev",
|
|
32
|
+
|
|
30
33
|
"fmt": "deno fmt && cargo fmt",
|
|
31
34
|
"lint": "deno lint --fix && cargo clippy --fix --features debug"
|
|
32
35
|
},
|
|
33
36
|
"fmt": {
|
|
34
37
|
"indentWidth": 4,
|
|
38
|
+
"lineWidth": 120,
|
|
35
39
|
"exclude": [
|
|
36
40
|
"./npm"
|
|
37
41
|
]
|
|
38
42
|
},
|
|
39
43
|
"imports": {
|
|
40
44
|
"@david/path": "jsr:@david/path@^0.2.0",
|
|
41
|
-
"@
|
|
42
|
-
"@deno/
|
|
45
|
+
"@david/temp": "jsr:@david/temp@^0.1.1",
|
|
46
|
+
"@deno/dnt": "jsr:@deno/dnt@^0.42.3",
|
|
43
47
|
"@qnighy/dedent": "jsr:@qnighy/dedent@^0.1.2",
|
|
44
|
-
"@std/assert": "jsr:@std/assert@^1.0.
|
|
45
|
-
"@std/cli": "jsr:@std/cli@^1.0.
|
|
48
|
+
"@std/assert": "jsr:@std/assert@^1.0.19",
|
|
49
|
+
"@std/cli": "jsr:@std/cli@^1.0.28",
|
|
46
50
|
"@std/encoding": "jsr:@std/encoding@^1.0.10",
|
|
47
|
-
"@std/fmt": "jsr:@std/fmt@^1.0.
|
|
48
|
-
"@std/
|
|
49
|
-
"@
|
|
51
|
+
"@std/fmt": "jsr:@std/fmt@^1.0.9",
|
|
52
|
+
"@std/fs": "jsr:@std/fs@^1.0.23",
|
|
53
|
+
"@std/tar": "jsr:@std/tar@^0.1.10",
|
|
54
|
+
"@std/uuid": "jsr:@std/uuid@^1.1.0",
|
|
55
|
+
"@unyt/speck": "jsr:@unyt/speck@^0.0.10",
|
|
56
|
+
"datex/": "./src/"
|
|
50
57
|
},
|
|
51
58
|
"test": {
|
|
52
59
|
"exclude": [
|
|
53
|
-
"./npm"
|
|
60
|
+
"./npm",
|
|
61
|
+
"./datex-browser-demo"
|
|
54
62
|
]
|
|
55
63
|
},
|
|
56
64
|
"publish": {
|
|
@@ -66,8 +74,8 @@
|
|
|
66
74
|
"scripts",
|
|
67
75
|
"test",
|
|
68
76
|
"rs-lib",
|
|
69
|
-
"!src/datex-
|
|
70
|
-
"!src/datex-
|
|
77
|
+
"!src/datex-web/datex_web.wasm",
|
|
78
|
+
"!src/datex-web/datex_web.internal.js"
|
|
71
79
|
]
|
|
72
80
|
}
|
|
73
81
|
}
|
package/esm/dif/core.d.ts
CHANGED
|
@@ -5,15 +5,18 @@ export declare const CoreTypeAddress: {
|
|
|
5
5
|
readonly null: "010000";
|
|
6
6
|
readonly type: "020000";
|
|
7
7
|
readonly boolean: "030000";
|
|
8
|
+
readonly callable: "050000";
|
|
8
9
|
readonly endpoint: "070000";
|
|
9
10
|
readonly text: "080000";
|
|
10
11
|
readonly list: "090000";
|
|
11
12
|
readonly unit: "0b0000";
|
|
12
13
|
readonly map: "0c0000";
|
|
14
|
+
readonly never: "0d0000";
|
|
15
|
+
readonly unknown: "0e0000";
|
|
13
16
|
readonly decimal: "2c0100";
|
|
14
17
|
readonly decimal_f32: "2d0100";
|
|
15
18
|
readonly decimal_f64: "2e0100";
|
|
16
|
-
readonly
|
|
19
|
+
readonly decimal_dbig: "2f0100";
|
|
17
20
|
readonly integer: "640000";
|
|
18
21
|
readonly integer_u8: "650000";
|
|
19
22
|
readonly integer_u16: "660000";
|
|
@@ -25,7 +28,7 @@ export declare const CoreTypeAddress: {
|
|
|
25
28
|
readonly integer_i32: "6c0000";
|
|
26
29
|
readonly integer_i64: "6d0000";
|
|
27
30
|
readonly integer_i128: "6e0000";
|
|
28
|
-
readonly
|
|
31
|
+
readonly integer_ibig: "6f0000";
|
|
29
32
|
};
|
|
30
33
|
/**
|
|
31
34
|
* Type representing the unique pointer addresses of core types.
|
|
@@ -36,7 +39,6 @@ export type CoreTypeAddress = typeof CoreTypeAddress[keyof typeof CoreTypeAddres
|
|
|
36
39
|
*/
|
|
37
40
|
export declare const CoreTypeAddressRanges: {
|
|
38
41
|
readonly small_unsigned_integers: Set<"650000" | "660000" | "670000" | "680000" | "690000">;
|
|
39
|
-
readonly big_unsigned_integers: Set<"6f0000">;
|
|
40
42
|
readonly small_signed_integers: Set<"6a0000" | "6b0000" | "6c0000" | "6d0000" | "6e0000">;
|
|
41
43
|
readonly big_signed_integers: Set<"6f0000">;
|
|
42
44
|
readonly decimals: Set<"2c0100" | "2d0100" | "2e0100" | "2f0100">;
|
package/esm/dif/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/dif/core.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/dif/core.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BlB,CAAC;AACX;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AAEnF;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;CAsBxB,CAAC"}
|
package/esm/dif/core.js
CHANGED
|
@@ -5,15 +5,18 @@ export const CoreTypeAddress = {
|
|
|
5
5
|
null: "010000",
|
|
6
6
|
type: "020000",
|
|
7
7
|
boolean: "030000",
|
|
8
|
+
callable: "050000",
|
|
8
9
|
endpoint: "070000",
|
|
9
10
|
text: "080000",
|
|
10
11
|
list: "090000",
|
|
11
12
|
unit: "0b0000",
|
|
12
13
|
map: "0c0000",
|
|
14
|
+
never: "0d0000",
|
|
15
|
+
unknown: "0e0000",
|
|
13
16
|
decimal: "2c0100",
|
|
14
17
|
decimal_f32: "2d0100",
|
|
15
18
|
decimal_f64: "2e0100",
|
|
16
|
-
|
|
19
|
+
decimal_dbig: "2f0100",
|
|
17
20
|
integer: "640000",
|
|
18
21
|
integer_u8: "650000",
|
|
19
22
|
integer_u16: "660000",
|
|
@@ -25,7 +28,7 @@ export const CoreTypeAddress = {
|
|
|
25
28
|
integer_i32: "6c0000",
|
|
26
29
|
integer_i64: "6d0000",
|
|
27
30
|
integer_i128: "6e0000",
|
|
28
|
-
|
|
31
|
+
integer_ibig: "6f0000",
|
|
29
32
|
};
|
|
30
33
|
/**
|
|
31
34
|
* Mapping of core type address ranges for categorization.
|
|
@@ -38,7 +41,6 @@ export const CoreTypeAddressRanges = {
|
|
|
38
41
|
CoreTypeAddress.integer_u64,
|
|
39
42
|
CoreTypeAddress.integer_u128,
|
|
40
43
|
]),
|
|
41
|
-
big_unsigned_integers: new Set([CoreTypeAddress.integer_big]),
|
|
42
44
|
small_signed_integers: new Set([
|
|
43
45
|
CoreTypeAddress.integer_i8,
|
|
44
46
|
CoreTypeAddress.integer_i16,
|
|
@@ -46,11 +48,11 @@ export const CoreTypeAddressRanges = {
|
|
|
46
48
|
CoreTypeAddress.integer_i64,
|
|
47
49
|
CoreTypeAddress.integer_i128,
|
|
48
50
|
]),
|
|
49
|
-
big_signed_integers: new Set([CoreTypeAddress.
|
|
51
|
+
big_signed_integers: new Set([CoreTypeAddress.integer_ibig]),
|
|
50
52
|
decimals: new Set([
|
|
51
53
|
CoreTypeAddress.decimal,
|
|
52
54
|
CoreTypeAddress.decimal_f32,
|
|
53
55
|
CoreTypeAddress.decimal_f64,
|
|
54
|
-
CoreTypeAddress.
|
|
56
|
+
CoreTypeAddress.decimal_dbig,
|
|
55
57
|
]),
|
|
56
58
|
};
|
package/esm/dif/definitions.d.ts
CHANGED
|
@@ -13,26 +13,26 @@ export type DIFPointerAddress = string;
|
|
|
13
13
|
* which may optionally include type information.
|
|
14
14
|
*/
|
|
15
15
|
export type DIFValue = {
|
|
16
|
-
type?:
|
|
16
|
+
type?: DIFTypeDefinition;
|
|
17
17
|
value: DIFRepresentationValue;
|
|
18
18
|
};
|
|
19
|
-
/**
|
|
20
|
-
* A DATEX value or pointer address representation in the DIF format.
|
|
21
|
-
*/
|
|
22
|
-
export type DIFContainer = DIFValue | DIFPointerAddress;
|
|
23
19
|
/**
|
|
24
20
|
* Mapping of DIF type kinds.
|
|
25
21
|
*/
|
|
26
|
-
export declare const
|
|
27
|
-
readonly Structural:
|
|
28
|
-
readonly Reference:
|
|
29
|
-
readonly
|
|
30
|
-
readonly
|
|
31
|
-
readonly
|
|
32
|
-
readonly
|
|
22
|
+
export declare const DIFTypeDefinitionKind: {
|
|
23
|
+
readonly Structural: 1;
|
|
24
|
+
readonly Reference: 2;
|
|
25
|
+
readonly Type: 3;
|
|
26
|
+
readonly Intersection: 4;
|
|
27
|
+
readonly Union: 5;
|
|
28
|
+
readonly ImplType: 6;
|
|
29
|
+
readonly Unit: 7;
|
|
30
|
+
readonly Never: 8;
|
|
31
|
+
readonly Unknown: 9;
|
|
32
|
+
readonly Function: 10;
|
|
33
33
|
};
|
|
34
34
|
/** A DIF type kind. */
|
|
35
|
-
export type
|
|
35
|
+
export type DIFTypeDefinitionKind = typeof DIFTypeDefinitionKind[keyof typeof DIFTypeDefinitionKind];
|
|
36
36
|
/**
|
|
37
37
|
* Representation of reference mutability (mutable or immutable) in DIF.
|
|
38
38
|
*/
|
|
@@ -42,25 +42,27 @@ export declare const DIFReferenceMutability: {
|
|
|
42
42
|
};
|
|
43
43
|
/** A DIF reference mutability. */
|
|
44
44
|
export type DIFReferenceMutability = typeof DIFReferenceMutability[keyof typeof DIFReferenceMutability];
|
|
45
|
-
|
|
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. */
|
|
48
|
-
export type DIFType<Kind extends DIFTypeKind = DIFTypeKind> = {
|
|
45
|
+
export type DIFType = DIFPointerAddress | {
|
|
49
46
|
name?: string;
|
|
50
|
-
kind: Kind;
|
|
51
|
-
def: DIFTypeDefinition<Kind>;
|
|
52
47
|
mut?: DIFReferenceMutability;
|
|
48
|
+
def: DIFTypeDefinition;
|
|
49
|
+
};
|
|
50
|
+
/** A DIF type definition based on its kind. */
|
|
51
|
+
export type DIFTypeDefinitionInner<Kind extends DIFTypeDefinitionKind = DIFTypeDefinitionKind> = Kind extends typeof DIFTypeDefinitionKind.Structural ? DIFValue : Kind extends typeof DIFTypeDefinitionKind.Reference ? DIFPointerAddress : Kind extends typeof DIFTypeDefinitionKind.Intersection ? Array<DIFType> : Kind extends typeof DIFTypeDefinitionKind.Union ? Array<DIFType> : Kind extends typeof DIFTypeDefinitionKind.Unit ? null : Kind extends typeof DIFTypeDefinitionKind.Function ? unknown : Kind extends typeof DIFTypeDefinitionKind.ImplType ? [DIFType, Array<DIFPointerAddress>] : never;
|
|
52
|
+
/** A DIF type definition representation. */
|
|
53
|
+
export type DIFTypeDefinition<Kind extends DIFTypeDefinitionKind = DIFTypeDefinitionKind> = Kind extends typeof DIFTypeDefinitionKind.Reference ? DIFPointerAddress : VerboseDIFTypeDefinition<Kind>;
|
|
54
|
+
type VerboseDIFTypeDefinition<Kind extends DIFTypeDefinitionKind = DIFTypeDefinitionKind> = {
|
|
55
|
+
kind: Kind;
|
|
56
|
+
def: DIFTypeDefinitionInner<Kind>;
|
|
53
57
|
};
|
|
54
58
|
/** A representation of a reference in DIF. */
|
|
55
59
|
export type DIFReference = {
|
|
56
60
|
value: DIFValueContainer;
|
|
57
|
-
allowed_type:
|
|
61
|
+
allowed_type: DIFTypeDefinition;
|
|
58
62
|
mut: DIFReferenceMutability;
|
|
59
63
|
};
|
|
60
64
|
/** A representation of a value or pointer address in DIF. */
|
|
61
65
|
export type DIFValueContainer = DIFValue | DIFPointerAddress;
|
|
62
|
-
/** A representation of a type or type pointer address in DIF. */
|
|
63
|
-
export type DIFTypeContainer = DIFType | DIFPointerAddress;
|
|
64
66
|
/** A DIF object, mapping string keys to DIF value containers. */
|
|
65
67
|
export type DIFObject = Record<string, DIFValueContainer>;
|
|
66
68
|
/** A DIF array, containing DIF value containers. */
|
|
@@ -87,30 +89,38 @@ export type DIFProperty = {
|
|
|
87
89
|
*/
|
|
88
90
|
export declare const DIFUpdateKind: {
|
|
89
91
|
readonly Replace: "replace";
|
|
90
|
-
readonly
|
|
92
|
+
readonly Append: "append";
|
|
91
93
|
readonly Set: "set";
|
|
92
|
-
readonly
|
|
94
|
+
readonly Delete: "delete";
|
|
93
95
|
readonly Clear: "clear";
|
|
96
|
+
readonly ListSplice: "list_splice";
|
|
94
97
|
};
|
|
95
98
|
/** A DIF update kind. */
|
|
96
99
|
export type DIFUpdateKind = typeof DIFUpdateKind[keyof typeof DIFUpdateKind];
|
|
97
100
|
/** Different kinds of updates that can be applied to a DIF value. */
|
|
98
|
-
export type
|
|
99
|
-
kind:
|
|
101
|
+
export type DIFUpdateBaseData<Kind extends DIFUpdateKind> = {
|
|
102
|
+
kind: Kind;
|
|
103
|
+
};
|
|
104
|
+
export type DIFUpdateDataReplace = DIFUpdateBaseData<typeof DIFUpdateKind.Replace> & {
|
|
100
105
|
value: DIFValueContainer;
|
|
101
|
-
}
|
|
102
|
-
|
|
106
|
+
};
|
|
107
|
+
export type DIFUpdateDataPush = DIFUpdateBaseData<typeof DIFUpdateKind.Append> & {
|
|
103
108
|
value: DIFValueContainer;
|
|
104
|
-
}
|
|
105
|
-
|
|
109
|
+
};
|
|
110
|
+
export type DIFUpdateDataDelete = DIFUpdateBaseData<typeof DIFUpdateKind.Delete> & {
|
|
106
111
|
key: DIFProperty;
|
|
107
|
-
}
|
|
108
|
-
|
|
112
|
+
};
|
|
113
|
+
export type DIFUpdateDataSet = DIFUpdateBaseData<typeof DIFUpdateKind.Set> & {
|
|
109
114
|
key: DIFProperty;
|
|
110
115
|
value: DIFValueContainer;
|
|
111
|
-
} | {
|
|
112
|
-
kind: typeof DIFUpdateKind.Clear;
|
|
113
116
|
};
|
|
117
|
+
export type DIFUpdateDataClear = DIFUpdateBaseData<typeof DIFUpdateKind.Clear>;
|
|
118
|
+
export type DIFUpdateDataListSplice = DIFUpdateBaseData<typeof DIFUpdateKind.ListSplice> & {
|
|
119
|
+
start: number;
|
|
120
|
+
delete_count: number;
|
|
121
|
+
items: DIFValueContainer[];
|
|
122
|
+
};
|
|
123
|
+
export type DIFUpdateData = DIFUpdateDataReplace | DIFUpdateDataPush | DIFUpdateDataDelete | DIFUpdateDataSet | DIFUpdateDataClear | DIFUpdateDataListSplice;
|
|
114
124
|
/** A DIF update struct, associating a source ID with update data. */
|
|
115
125
|
export type DIFUpdate = {
|
|
116
126
|
source_id: number;
|
|
@@ -120,4 +130,5 @@ export type DIFUpdate = {
|
|
|
120
130
|
export type ObserveOptions = {
|
|
121
131
|
relay_own_updates: boolean;
|
|
122
132
|
};
|
|
133
|
+
export {};
|
|
123
134
|
//# sourceMappingURL=definitions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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;AACH,MAAM,MAAM,QAAQ,GAAG;IACnB,IAAI,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/dif/definitions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,MAAM,i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,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
|
@@ -6,13 +6,17 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* Mapping of DIF type kinds.
|
|
8
8
|
*/
|
|
9
|
-
export const
|
|
10
|
-
Structural:
|
|
11
|
-
Reference:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
export const DIFTypeDefinitionKind = {
|
|
10
|
+
Structural: 1,
|
|
11
|
+
Reference: 2,
|
|
12
|
+
Type: 3,
|
|
13
|
+
Intersection: 4,
|
|
14
|
+
Union: 5,
|
|
15
|
+
ImplType: 6,
|
|
16
|
+
Unit: 7,
|
|
17
|
+
Never: 8,
|
|
18
|
+
Unknown: 9,
|
|
19
|
+
Function: 10,
|
|
16
20
|
};
|
|
17
21
|
/**
|
|
18
22
|
* Representation of reference mutability (mutable or immutable) in DIF.
|
|
@@ -26,8 +30,9 @@ export const DIFReferenceMutability = {
|
|
|
26
30
|
*/
|
|
27
31
|
export const DIFUpdateKind = {
|
|
28
32
|
Replace: "replace",
|
|
29
|
-
|
|
33
|
+
Append: "append",
|
|
30
34
|
Set: "set",
|
|
31
|
-
|
|
35
|
+
Delete: "delete",
|
|
32
36
|
Clear: "clear",
|
|
37
|
+
ListSplice: "list_splice",
|
|
33
38
|
};
|