@unyt/datex 0.0.13 → 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 +221 -188
- package/esm/datex-web/datex_web.internal.d.ts.map +1 -1
- package/esm/datex-web/datex_web.internal.js +453 -385
- 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 -39
- package/esm/dif/core.d.ts.map +1 -1
- package/esm/dif/core.js +33 -53
- 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 +417 -345
- 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/endpoint.d.ts.map +1 -1
- 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/range.d.ts +26 -0
- package/esm/lib/special-core-types/range.d.ts.map +1 -0
- package/esm/lib/special-core-types/range.js +46 -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 +3 -1
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +3 -1
- 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.d.ts +8 -0
- package/esm/repl/mod.d.ts.map +1 -0
- package/esm/repl/mod.js +31 -0
- 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 +24 -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
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _OwnedSharedContainer_baseSharedContainer;
|
|
13
|
+
import { ReferencedSharedContainer, SharedReferenceMutability } from "./reference.js";
|
|
14
|
+
export class OwnedSharedContainer {
|
|
15
|
+
constructor(baseSharedContainer) {
|
|
16
|
+
_OwnedSharedContainer_baseSharedContainer.set(this, void 0);
|
|
17
|
+
__classPrivateFieldSet(this, _OwnedSharedContainer_baseSharedContainer, baseSharedContainer, "f");
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Gets the address of the pointer storing the reference.
|
|
21
|
+
*/
|
|
22
|
+
get pointerAddress() {
|
|
23
|
+
return __classPrivateFieldGet(this, _OwnedSharedContainer_baseSharedContainer, "f").pointerAddress;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Gets the current value of the reference.
|
|
27
|
+
*/
|
|
28
|
+
get value() {
|
|
29
|
+
return __classPrivateFieldGet(this, _OwnedSharedContainer_baseSharedContainer, "f").value;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Replaces the current value of the reference with a new value.
|
|
33
|
+
* Also notifies all observers of the pointer about the change.
|
|
34
|
+
* @throws If the reference is immutable or the new value is of an incompatible type.
|
|
35
|
+
*/
|
|
36
|
+
set value(newValue) {
|
|
37
|
+
__classPrivateFieldGet(this, _OwnedSharedContainer_baseSharedContainer, "f").value = newValue;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Derives a new mutable reference from the current reference if the current reference is mutable.
|
|
41
|
+
* Otherwise returns an error
|
|
42
|
+
* @returns A new mutable reference derived from the current reference if the current reference is mutable, otherwise throws an error.
|
|
43
|
+
*/
|
|
44
|
+
deriveMutableReference() {
|
|
45
|
+
if (__classPrivateFieldGet(this, _OwnedSharedContainer_baseSharedContainer, "f").isContainerMutable()) {
|
|
46
|
+
return new ReferencedSharedContainer(__classPrivateFieldGet(this, _OwnedSharedContainer_baseSharedContainer, "f"), SharedReferenceMutability.Mutable);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
throw new Error("Cannot derive a mutable reference from an immutable reference.");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Derives a new immutable reference from the current reference. The derived reference will have the same underlying shared container,
|
|
54
|
+
* @returns A new ReferencedSharedContainer instance with immutable reference mutability.
|
|
55
|
+
*/
|
|
56
|
+
deriveImmutableReference() {
|
|
57
|
+
return new ReferencedSharedContainer(__classPrivateFieldGet(this, _OwnedSharedContainer_baseSharedContainer, "f"), SharedReferenceMutability.Immutable);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
_OwnedSharedContainer_baseSharedContainer = new WeakMap();
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { BaseSharedContainer, SharedContainerMutability } from "./base-shared-container.js";
|
|
2
|
+
import type { PointerAddress } from "./mod.js";
|
|
3
|
+
export declare enum SharedReferenceMutability {
|
|
4
|
+
Immutable = 0,
|
|
5
|
+
Mutable = 1
|
|
6
|
+
}
|
|
7
|
+
export declare class ReferencedSharedContainer<T, Mutability extends SharedContainerMutability, ReferenceMutability extends SharedReferenceMutability> {
|
|
8
|
+
#private;
|
|
9
|
+
constructor(baseSharedContainer: BaseSharedContainer<T, Mutability>, referenceMutability: ReferenceMutability);
|
|
10
|
+
/**
|
|
11
|
+
* Gets the address of the pointer storing the reference.
|
|
12
|
+
*/
|
|
13
|
+
get pointerAddress(): PointerAddress;
|
|
14
|
+
/**
|
|
15
|
+
* Gets the current value of the reference.
|
|
16
|
+
*/
|
|
17
|
+
get value(): T;
|
|
18
|
+
/**
|
|
19
|
+
* Replaces the current value of the reference with a new value.
|
|
20
|
+
* Also notifies all observers of the pointer about the change.
|
|
21
|
+
* @throws If the reference is immutable or the new value is of an incompatible type.
|
|
22
|
+
*/
|
|
23
|
+
set value(newValue: Mutability extends SharedContainerMutability.Mutable ? T : never);
|
|
24
|
+
isMutable(): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Derives an immutable reference from the current reference. The derived reference will have the same underlying shared container,
|
|
27
|
+
* @returns A new ReferencedSharedContainer instance with immutable reference mutability.
|
|
28
|
+
*/
|
|
29
|
+
deriveImmutableReference(): ReferencedSharedContainer<T, Mutability, SharedReferenceMutability.Immutable>;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=reference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../src/shared-container/reference.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACjG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,oBAAY,yBAAyB;IACjC,SAAS,IAAI;IACb,OAAO,IAAI;CACd;AACD,qBAAa,yBAAyB,CAClC,CAAC,EACD,UAAU,SAAS,yBAAyB,EAC5C,mBAAmB,SAAS,yBAAyB;;gBAMjD,mBAAmB,EAAE,mBAAmB,CAAC,CAAC,EAAE,UAAU,CAAC,EACvD,mBAAmB,EAAE,mBAAmB;IAM5C;;OAEG;IACH,IAAW,cAAc,IAAI,cAAc,CAE1C;IAED;;OAEG;IACH,IAAW,KAAK,IAAI,CAAC,CAEpB;IAED;;;;OAIG;IACH,IAAI,KAAK,CAAC,QAAQ,EAAE,UAAU,SAAS,yBAAyB,CAAC,OAAO,GAAG,CAAC,GAAG,KAAK,EAEnF;IAEM,SAAS,IAAI,OAAO;IAI3B;;;OAGG;IACI,wBAAwB,IAAI,yBAAyB,CACxD,CAAC,EACD,UAAU,EACV,yBAAyB,CAAC,SAAS,CACtC;CAMJ"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _ReferencedSharedContainer_baseSharedContainer, _ReferencedSharedContainer_referenceMutability;
|
|
13
|
+
export var SharedReferenceMutability;
|
|
14
|
+
(function (SharedReferenceMutability) {
|
|
15
|
+
SharedReferenceMutability[SharedReferenceMutability["Immutable"] = 0] = "Immutable";
|
|
16
|
+
SharedReferenceMutability[SharedReferenceMutability["Mutable"] = 1] = "Mutable";
|
|
17
|
+
})(SharedReferenceMutability || (SharedReferenceMutability = {}));
|
|
18
|
+
export class ReferencedSharedContainer {
|
|
19
|
+
constructor(baseSharedContainer, referenceMutability) {
|
|
20
|
+
_ReferencedSharedContainer_baseSharedContainer.set(this, void 0);
|
|
21
|
+
_ReferencedSharedContainer_referenceMutability.set(this, void 0);
|
|
22
|
+
__classPrivateFieldSet(this, _ReferencedSharedContainer_baseSharedContainer, baseSharedContainer, "f");
|
|
23
|
+
__classPrivateFieldSet(this, _ReferencedSharedContainer_referenceMutability, referenceMutability, "f");
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Gets the address of the pointer storing the reference.
|
|
27
|
+
*/
|
|
28
|
+
get pointerAddress() {
|
|
29
|
+
return __classPrivateFieldGet(this, _ReferencedSharedContainer_baseSharedContainer, "f").pointerAddress;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Gets the current value of the reference.
|
|
33
|
+
*/
|
|
34
|
+
get value() {
|
|
35
|
+
return __classPrivateFieldGet(this, _ReferencedSharedContainer_baseSharedContainer, "f").value;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Replaces the current value of the reference with a new value.
|
|
39
|
+
* Also notifies all observers of the pointer about the change.
|
|
40
|
+
* @throws If the reference is immutable or the new value is of an incompatible type.
|
|
41
|
+
*/
|
|
42
|
+
set value(newValue) {
|
|
43
|
+
__classPrivateFieldGet(this, _ReferencedSharedContainer_baseSharedContainer, "f").value = newValue;
|
|
44
|
+
}
|
|
45
|
+
isMutable() {
|
|
46
|
+
return __classPrivateFieldGet(this, _ReferencedSharedContainer_referenceMutability, "f") === SharedReferenceMutability.Mutable;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Derives an immutable reference from the current reference. The derived reference will have the same underlying shared container,
|
|
50
|
+
* @returns A new ReferencedSharedContainer instance with immutable reference mutability.
|
|
51
|
+
*/
|
|
52
|
+
deriveImmutableReference() {
|
|
53
|
+
return new ReferencedSharedContainer(__classPrivateFieldGet(this, _ReferencedSharedContainer_baseSharedContainer, "f"), SharedReferenceMutability.Immutable);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
_ReferencedSharedContainer_baseSharedContainer = new WeakMap(), _ReferencedSharedContainer_referenceMutability = new WeakMap();
|
|
57
|
+
// export function deriveImmutableReference<
|
|
58
|
+
// T,
|
|
59
|
+
// Mutability extends SharedContainerMutability,
|
|
60
|
+
// >(
|
|
61
|
+
// reference: SharedReferenced<T, Mutability, SharedReferenceMutability>,
|
|
62
|
+
// ): SharedReferenced<T, Mutability, SharedReferenceMutability.Immutable> {
|
|
63
|
+
// return reference as SharedReferenced<T, Mutability, SharedReferenceMutability.Immutable>;
|
|
64
|
+
// }
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Endpoint } from "../lib/special-core-types/endpoint.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Range } from "../lib/special-core-types/range.js";
|
|
3
|
+
import { BaseSharedContainer } from "../shared-container/mod.js";
|
|
3
4
|
// @ts-ignore devtoolsFormatters
|
|
4
5
|
globalThis.devtoolsFormatters = [
|
|
5
6
|
{
|
|
@@ -7,7 +8,7 @@ globalThis.devtoolsFormatters = [
|
|
|
7
8
|
if (obj instanceof Endpoint) {
|
|
8
9
|
return ["span", { style: "color: #58d452" }, obj.toString()];
|
|
9
10
|
}
|
|
10
|
-
else if (obj instanceof
|
|
11
|
+
else if (obj instanceof BaseSharedContainer) {
|
|
11
12
|
return [
|
|
12
13
|
"span",
|
|
13
14
|
{},
|
|
@@ -28,6 +29,27 @@ globalThis.devtoolsFormatters = [
|
|
|
28
29
|
],
|
|
29
30
|
];
|
|
30
31
|
}
|
|
32
|
+
else if (obj instanceof Range) {
|
|
33
|
+
return [
|
|
34
|
+
"span",
|
|
35
|
+
{},
|
|
36
|
+
[
|
|
37
|
+
"span",
|
|
38
|
+
{},
|
|
39
|
+
["span", { style: "color: #d57258" }, `${obj.start}`],
|
|
40
|
+
],
|
|
41
|
+
[
|
|
42
|
+
"span",
|
|
43
|
+
{},
|
|
44
|
+
["span", {}, `..`],
|
|
45
|
+
],
|
|
46
|
+
[
|
|
47
|
+
"span",
|
|
48
|
+
{},
|
|
49
|
+
["span", { style: "color: #d57258" }, `${obj.end}`],
|
|
50
|
+
],
|
|
51
|
+
];
|
|
52
|
+
}
|
|
31
53
|
return null; // fall back to default
|
|
32
54
|
},
|
|
33
55
|
hasBody(_) {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare enum OptionType {
|
|
2
|
+
Some = 0,
|
|
3
|
+
None = 1
|
|
4
|
+
}
|
|
5
|
+
export declare class Option<T, Type extends OptionType = OptionType> {
|
|
6
|
+
private readonly kind;
|
|
7
|
+
private readonly value?;
|
|
8
|
+
constructor(kind: Type, value?: T);
|
|
9
|
+
static Some<T>(value: T): Option<T, OptionType.Some>;
|
|
10
|
+
static None<T>(): Option<T, OptionType.None>;
|
|
11
|
+
unwrap(): Type extends OptionType.Some ? T : never;
|
|
12
|
+
expect(message: string): T;
|
|
13
|
+
isSome(): this is Option<T, OptionType.Some>;
|
|
14
|
+
isNone(): this is Option<T, OptionType.None>;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=option.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"option.d.ts","sourceRoot":"","sources":["../../src/utils/option.ts"],"names":[],"mappings":"AAEA,aAAK,UAAU;IACX,IAAI,IAAA;IACJ,IAAI,IAAA;CACP;AAED,qBAAa,MAAM,CAAC,CAAC,EAAE,IAAI,SAAS,UAAU,GAAG,UAAU;IACvD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAO;IAC5B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAI;gBAEf,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;IAOjC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,UAAU,CAAC,IAAI,CAAC;IAIpD,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,EAAE,UAAU,CAAC,IAAI,CAAC;IAI5C,MAAM,IAAI,IAAI,SAAS,UAAU,CAAC,IAAI,GAAG,CAAC,GAAG,KAAK;IAQlD,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,CAAC;IAQ1B,MAAM,IAAI,IAAI,IAAI,MAAM,CAAC,CAAC,EAAE,UAAU,CAAC,IAAI,CAAC;IAI5C,MAAM,IAAI,IAAI,IAAI,MAAM,CAAC,CAAC,EAAE,UAAU,CAAC,IAAI,CAAC;CAG/C"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { panic } from "./exceptions.js";
|
|
2
|
+
var OptionType;
|
|
3
|
+
(function (OptionType) {
|
|
4
|
+
OptionType[OptionType["Some"] = 0] = "Some";
|
|
5
|
+
OptionType[OptionType["None"] = 1] = "None";
|
|
6
|
+
})(OptionType || (OptionType = {}));
|
|
7
|
+
export class Option {
|
|
8
|
+
constructor(kind, value) {
|
|
9
|
+
Object.defineProperty(this, "kind", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
configurable: true,
|
|
12
|
+
writable: true,
|
|
13
|
+
value: void 0
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(this, "value", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
configurable: true,
|
|
18
|
+
writable: true,
|
|
19
|
+
value: void 0
|
|
20
|
+
});
|
|
21
|
+
this.kind = kind;
|
|
22
|
+
if (kind === OptionType.Some) {
|
|
23
|
+
this.value = value;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
static Some(value) {
|
|
27
|
+
return new Option(OptionType.Some, value);
|
|
28
|
+
}
|
|
29
|
+
static None() {
|
|
30
|
+
return new Option(OptionType.None);
|
|
31
|
+
}
|
|
32
|
+
unwrap() {
|
|
33
|
+
if (this.kind === OptionType.Some) {
|
|
34
|
+
return this.value;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
panic("Called unwrap on a None value");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
expect(message) {
|
|
41
|
+
if (this.kind === OptionType.Some) {
|
|
42
|
+
return this.value;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
panic(message);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
isSome() {
|
|
49
|
+
return this.kind === OptionType.Some;
|
|
50
|
+
}
|
|
51
|
+
isNone() {
|
|
52
|
+
return this.kind === OptionType.None;
|
|
53
|
+
}
|
|
54
|
+
}
|
package/package.json
CHANGED
package/esm/dif/definitions.d.ts
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
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
|
-
*/
|
|
10
|
-
export type DIFPointerAddress = string;
|
|
11
|
-
/**
|
|
12
|
-
* A DATEX value representation in the DIF format,
|
|
13
|
-
* which may optionally include type information.
|
|
14
|
-
*/
|
|
15
|
-
export type DIFValue = {
|
|
16
|
-
type?: DIFTypeDefinition;
|
|
17
|
-
value: DIFRepresentationValue;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Mapping of DIF type kinds.
|
|
21
|
-
*/
|
|
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
|
-
};
|
|
34
|
-
/** A DIF type kind. */
|
|
35
|
-
export type DIFTypeDefinitionKind = typeof DIFTypeDefinitionKind[keyof typeof DIFTypeDefinitionKind];
|
|
36
|
-
/**
|
|
37
|
-
* Representation of reference mutability (mutable or immutable) in DIF.
|
|
38
|
-
*/
|
|
39
|
-
export declare const DIFSharedValueMutability: {
|
|
40
|
-
readonly Mutable: 0;
|
|
41
|
-
readonly Immutable: 1;
|
|
42
|
-
};
|
|
43
|
-
/** A DIF reference mutability. */
|
|
44
|
-
export type DIFSharedValueMutability = typeof DIFSharedValueMutability[keyof typeof DIFSharedValueMutability];
|
|
45
|
-
export type DIFType = DIFPointerAddress | {
|
|
46
|
-
name?: string;
|
|
47
|
-
mut?: DIFSharedValueMutability;
|
|
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>;
|
|
57
|
-
};
|
|
58
|
-
/** A representation of a shared value in DIF. */
|
|
59
|
-
export type DIFSharedValue = {
|
|
60
|
-
value: DIFValueContainer;
|
|
61
|
-
allowed_type: DIFTypeDefinition;
|
|
62
|
-
mut: DIFSharedValueMutability;
|
|
63
|
-
};
|
|
64
|
-
/** A representation of a value or pointer address in DIF. */
|
|
65
|
-
export type DIFValueContainer = DIFValue | DIFPointerAddress;
|
|
66
|
-
/** A DIF object, mapping string keys to DIF value containers. */
|
|
67
|
-
export type DIFObject = Record<string, DIFValueContainer>;
|
|
68
|
-
/** A DIF array, containing DIF value containers. */
|
|
69
|
-
export type DIFArray = DIFValueContainer[];
|
|
70
|
-
/** A DIF map, containing key-value pairs of DIF value containers. */
|
|
71
|
-
export type DIFMap = [DIFValueContainer, DIFValueContainer][];
|
|
72
|
-
/** Any DIF representation value (JSON-compatible values). */
|
|
73
|
-
export type DIFRepresentationValue = string | number | boolean | null | DIFObject | DIFMap | DIFArray;
|
|
74
|
-
/**
|
|
75
|
-
* Representation of a property in DIF, which can be a text key, an index, or a generic value.
|
|
76
|
-
*/
|
|
77
|
-
export type DIFProperty = {
|
|
78
|
-
kind: "text";
|
|
79
|
-
value: string;
|
|
80
|
-
} | {
|
|
81
|
-
kind: "index";
|
|
82
|
-
value: number;
|
|
83
|
-
} | {
|
|
84
|
-
kind: "value";
|
|
85
|
-
value: DIFValueContainer;
|
|
86
|
-
};
|
|
87
|
-
/**
|
|
88
|
-
* Kinds of updates that can be applied to a DIF value.
|
|
89
|
-
*/
|
|
90
|
-
export declare const DIFUpdateKind: {
|
|
91
|
-
readonly Replace: "replace";
|
|
92
|
-
readonly Append: "append";
|
|
93
|
-
readonly Set: "set";
|
|
94
|
-
readonly Delete: "delete";
|
|
95
|
-
readonly Clear: "clear";
|
|
96
|
-
readonly ListSplice: "list_splice";
|
|
97
|
-
};
|
|
98
|
-
/** A DIF update kind. */
|
|
99
|
-
export type DIFUpdateKind = typeof DIFUpdateKind[keyof typeof DIFUpdateKind];
|
|
100
|
-
/** Different kinds of updates that can be applied to a DIF value. */
|
|
101
|
-
export type DIFUpdateBaseData<Kind extends DIFUpdateKind> = {
|
|
102
|
-
kind: Kind;
|
|
103
|
-
};
|
|
104
|
-
export type DIFUpdateDataReplace = DIFUpdateBaseData<typeof DIFUpdateKind.Replace> & {
|
|
105
|
-
value: DIFValueContainer;
|
|
106
|
-
};
|
|
107
|
-
export type DIFUpdateDataPush = DIFUpdateBaseData<typeof DIFUpdateKind.Append> & {
|
|
108
|
-
value: DIFValueContainer;
|
|
109
|
-
};
|
|
110
|
-
export type DIFUpdateDataDelete = DIFUpdateBaseData<typeof DIFUpdateKind.Delete> & {
|
|
111
|
-
key: DIFProperty;
|
|
112
|
-
};
|
|
113
|
-
export type DIFUpdateDataSet = DIFUpdateBaseData<typeof DIFUpdateKind.Set> & {
|
|
114
|
-
key: DIFProperty;
|
|
115
|
-
value: DIFValueContainer;
|
|
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;
|
|
124
|
-
/** A DIF update struct, associating a source ID with update data. */
|
|
125
|
-
export type DIFUpdate = {
|
|
126
|
-
source_id: number;
|
|
127
|
-
data: DIFUpdateData;
|
|
128
|
-
};
|
|
129
|
-
/** Options for observing DIF pointers. */
|
|
130
|
-
export type ObserveOptions = {
|
|
131
|
-
relay_own_updates: boolean;
|
|
132
|
-
};
|
|
133
|
-
export {};
|
|
134
|
-
//# sourceMappingURL=definitions.d.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nB,oBAAoB,GACpB,iBAAiB,GACjB,mBAAmB,GACnB,gBAAgB,GAChB,kBAAkB,GAClB,uBAAuB,CAAC;AAE9B,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
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
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
|
-
*/
|
|
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,
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Representation of reference mutability (mutable or immutable) in DIF.
|
|
23
|
-
*/
|
|
24
|
-
export const DIFSharedValueMutability = {
|
|
25
|
-
Mutable: 0,
|
|
26
|
-
Immutable: 1,
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Kinds of updates that can be applied to a DIF value.
|
|
30
|
-
*/
|
|
31
|
-
export const DIFUpdateKind = {
|
|
32
|
-
Replace: "replace",
|
|
33
|
-
Append: "append",
|
|
34
|
-
Set: "set",
|
|
35
|
-
Delete: "delete",
|
|
36
|
-
Clear: "clear",
|
|
37
|
-
ListSplice: "list_splice",
|
|
38
|
-
};
|
package/esm/refs/ref.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ref.d.ts","sourceRoot":"","sources":["../../src/refs/ref.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD;;;GAGG;AACH,qBAAa,GAAG,CAAC,CAAC;;gBAKF,KAAK,EAAE,CAAC,EAAE,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU;IAMpE;;OAEG;IACH,IAAI,cAAc,IAAI,MAAM,CAE3B;IAED;;;;OAIG;IACH,mBAAmB,CAAC,QAAQ,EAAE,CAAC;IAI/B;;OAEG;IACH,IAAI,KAAK,IAAI,CAAC,CAEb;IAED;;;;OAIG;IACH,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC,EAOpB;CACJ"}
|
package/esm/refs/ref.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
-
};
|
|
7
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
-
};
|
|
12
|
-
var _Ref_value, _Ref_pointerAddress, _Ref_difHandler;
|
|
13
|
-
/**
|
|
14
|
-
* The Ref class is a wrapper around a value that is stored in a pointer.
|
|
15
|
-
* Primitive values (string, number, boolean, null) are always wrapped in a Ref when stored in a pointer.
|
|
16
|
-
*/
|
|
17
|
-
export class Ref {
|
|
18
|
-
constructor(value, pointerAddress, difHandler) {
|
|
19
|
-
_Ref_value.set(this, void 0);
|
|
20
|
-
_Ref_pointerAddress.set(this, void 0);
|
|
21
|
-
_Ref_difHandler.set(this, void 0);
|
|
22
|
-
__classPrivateFieldSet(this, _Ref_value, value, "f");
|
|
23
|
-
__classPrivateFieldSet(this, _Ref_pointerAddress, pointerAddress, "f");
|
|
24
|
-
__classPrivateFieldSet(this, _Ref_difHandler, difHandler, "f");
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Gets the address of the pointer storing the reference.
|
|
28
|
-
*/
|
|
29
|
-
get pointerAddress() {
|
|
30
|
-
return __classPrivateFieldGet(this, _Ref_pointerAddress, "f");
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Silently updates the value of the reference without notifying observers.
|
|
34
|
-
* This should only be used internally.
|
|
35
|
-
* @param newValue - The new value to set.
|
|
36
|
-
*/
|
|
37
|
-
updateValueSilently(newValue) {
|
|
38
|
-
__classPrivateFieldSet(this, _Ref_value, newValue, "f");
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Gets the current value of the reference.
|
|
42
|
-
*/
|
|
43
|
-
get value() {
|
|
44
|
-
return __classPrivateFieldGet(this, _Ref_value, "f");
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Replaces the current value of the reference with a new value.
|
|
48
|
-
* Also notifies all observers of the pointer about the change.
|
|
49
|
-
* @throws If the reference is immutable or the new value is of an incompatible type.
|
|
50
|
-
*/
|
|
51
|
-
set value(newValue) {
|
|
52
|
-
const oldValue = __classPrivateFieldGet(this, _Ref_value, "f");
|
|
53
|
-
if (oldValue === newValue)
|
|
54
|
-
return;
|
|
55
|
-
// Try to update the pointer
|
|
56
|
-
__classPrivateFieldGet(this, _Ref_difHandler, "f").triggerReplace(__classPrivateFieldGet(this, _Ref_pointerAddress, "f"), newValue);
|
|
57
|
-
__classPrivateFieldSet(this, _Ref_value, newValue, "f");
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
_Ref_value = new WeakMap(), _Ref_pointerAddress = new WeakMap(), _Ref_difHandler = new WeakMap();
|