@unyt/datex 0.0.9 → 0.0.11
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-core/datex_core_js.internal.d.ts +248 -264
- package/esm/datex-core/datex_core_js.internal.d.ts.map +1 -1
- package/esm/datex-core/datex_core_js.internal.js +584 -547
- package/esm/datex-core/datex_core_js.js +7 -3
- package/esm/datex-core/datex_core_js.wasm +0 -0
- package/esm/datex-core/wasm_url.node.js +1 -1
- package/esm/default.d.ts +8 -0
- package/esm/default.d.ts.map +1 -1
- package/esm/default.js +8 -0
- package/esm/deno.json +5 -3
- 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 +125 -34
- package/esm/dif/dif-handler.d.ts.map +1 -1
- package/esm/dif/dif-handler.js +366 -159
- package/esm/dif/display.d.ts +3 -3
- package/esm/dif/display.d.ts.map +1 -1
- package/esm/dif/display.js +5 -5
- 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 +5 -1
- package/esm/dif/mod.d.ts.map +1 -1
- package/esm/dif/mod.js +5 -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} +1 -1
- package/esm/lib/special-core-types/endpoint.d.ts.map +1 -0
- package/esm/mod.d.ts +16 -10
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +16 -10
- package/esm/network/interface-impls/base.d.ts +9 -1
- package/esm/network/interface-impls/base.d.ts.map +1 -1
- package/esm/refs/ref.d.ts.map +1 -1
- package/esm/refs/ref.js +1 -2
- package/esm/runtime/runtime.d.ts +19 -49
- package/esm/runtime/runtime.d.ts.map +1 -1
- package/esm/runtime/runtime.js +32 -7
- 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 +1 -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/runtime/special-core-types.d.ts.map +0 -1
- /package/esm/{runtime/special-core-types.js → lib/special-core-types/endpoint.js} +0 -0
package/esm/runtime/runtime.js
CHANGED
|
@@ -13,8 +13,10 @@ var _Runtime_instances, _Runtime_runtime, _Runtime_comHub, _Runtime_difHandler,
|
|
|
13
13
|
import { create_runtime, execute_internal, } from "../datex-core.js";
|
|
14
14
|
import { ComHub } from "../network/com-hub.js";
|
|
15
15
|
import { DIFHandler } from "../dif/dif-handler.js";
|
|
16
|
+
import { unimplemented } from "../utils/exceptions.js";
|
|
17
|
+
// TODO: move to global.ts
|
|
16
18
|
/** auto-generated version - do not edit: */
|
|
17
|
-
const VERSION = "0.0.
|
|
19
|
+
const VERSION = "0.0.11";
|
|
18
20
|
/**
|
|
19
21
|
* The main Runtime class for executing Datex scripts and managing communication interfaces.
|
|
20
22
|
*/
|
|
@@ -121,24 +123,47 @@ export class Runtime {
|
|
|
121
123
|
* @returns The string representation of the value.
|
|
122
124
|
*/
|
|
123
125
|
valueToString(value, decompileOptions = null) {
|
|
124
|
-
return __classPrivateFieldGet(this, _Runtime_runtime, "f").value_to_string(__classPrivateFieldGet(this, _Runtime_difHandler, "f").
|
|
126
|
+
return __classPrivateFieldGet(this, _Runtime_runtime, "f").value_to_string(__classPrivateFieldGet(this, _Runtime_difHandler, "f").convertJSValueToDIFValueContainer(value), decompileOptions);
|
|
125
127
|
}
|
|
126
128
|
_execute_internal(datexScript) {
|
|
127
129
|
return execute_internal(datexScript);
|
|
128
130
|
}
|
|
129
131
|
/**
|
|
130
|
-
* Creates a new
|
|
131
|
-
*
|
|
132
|
-
*
|
|
132
|
+
* Creates a new reference containg the given JS value.
|
|
133
|
+
* For primitive values, a Ref wrapper is returned.
|
|
134
|
+
* For other values (objects, arrays, maps), the returned value is a proxy object that behaves like the original object.
|
|
135
|
+
*
|
|
133
136
|
* @param value The JS value to store in the pointer.
|
|
134
137
|
* @param allowedType Optional DIF type container to restrict the type of the pointer.
|
|
135
138
|
* @param mutability Optional mutability of the reference (default is Mutable).
|
|
136
139
|
* @returns A proxy object representing the pointer in JS.
|
|
137
140
|
*/
|
|
138
|
-
|
|
141
|
+
createTransparentReference(
|
|
139
142
|
// deno-lint-ignore ban-types
|
|
140
143
|
value, allowedType, mutability) {
|
|
141
|
-
return __classPrivateFieldGet(this, _Runtime_difHandler, "f").
|
|
144
|
+
return __classPrivateFieldGet(this, _Runtime_difHandler, "f").createTransparentReference(value, allowedType, mutability);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Creates or retrieves a wrapped reference for the given value.
|
|
148
|
+
* If the value is already a reference, it returns the existing reference.
|
|
149
|
+
*
|
|
150
|
+
* @param value
|
|
151
|
+
* @param allowedType
|
|
152
|
+
* @param mutability
|
|
153
|
+
* @returns
|
|
154
|
+
*/
|
|
155
|
+
createOrGetWrappedReference(_value, _allowedType, _mutability) {
|
|
156
|
+
unimplemented();
|
|
157
|
+
}
|
|
158
|
+
startLSP(callback) {
|
|
159
|
+
const decoder = new TextDecoder("utf-8");
|
|
160
|
+
const encoder = new TextEncoder();
|
|
161
|
+
const sendToRust = __classPrivateFieldGet(this, _Runtime_runtime, "f").start_lsp((bytes) => {
|
|
162
|
+
callback(decoder.decode(bytes));
|
|
163
|
+
});
|
|
164
|
+
return (data) => {
|
|
165
|
+
sendToRust(encoder.encode(data));
|
|
166
|
+
};
|
|
142
167
|
}
|
|
143
168
|
}
|
|
144
169
|
_Runtime_runtime = new WeakMap(), _Runtime_comHub = new WeakMap(), _Runtime_difHandler = new WeakMap(), _Runtime_instances = new WeakSet(), _Runtime_executeInternal = async function _Runtime_executeInternal(datexScript, values = []) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exceptions.d.ts","sourceRoot":"","sources":["../../src/utils/exceptions.ts"],"names":[],"mappings":"AAAA,wBAAgB,KAAK,CAAC,OAAO,GAAE,MAAkB,GAAG,KAAK,CAExD;AAED,wBAAgB,WAAW,CAAC,OAAO,GAAE,MAAkB,GAAG,KAAK,CAE9D;AAED,wBAAgB,aAAa,CAAC,OAAO,GAAE,MAAkB,GAAG,KAAK,CAEhE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function panic(message = "unknown") {
|
|
2
|
+
throw new Error(`Panic: ${message}`);
|
|
3
|
+
}
|
|
4
|
+
export function unreachable(message = "unknown") {
|
|
5
|
+
throw new Error(`Unreachable code reached: ${message}`);
|
|
6
|
+
}
|
|
7
|
+
export function unimplemented(message = "unknown") {
|
|
8
|
+
throw new Error(`Not implemented: ${message}`);
|
|
9
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"js-runtime.d.ts","sourceRoot":"","sources":["../../../src/utils/js-runtime-compat/js-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EACR,kBAAkB,EAClB,aAAa,EAChB,MAAM,2BAA2B,CAAC;AAInC,wBAAgB,aAAa,IAAI,aAAa,CAU7C;
|
|
1
|
+
{"version":3,"file":"js-runtime.d.ts","sourceRoot":"","sources":["../../../src/utils/js-runtime-compat/js-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EACR,kBAAkB,EAClB,aAAa,EAChB,MAAM,2BAA2B,CAAC;AAInC,wBAAgB,aAAa,IAAI,aAAa,CAU7C;AAkBD,gEAAgE;AAChE,eAAO,MAAM,gBAAgB,EAAE,kBAE9B,CAAC"}
|
package/package.json
CHANGED
package/esm/dif/builders.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module
|
|
3
|
-
* @description
|
|
4
|
-
* This module contains helper functions to create DIFUpdate objects.
|
|
5
|
-
*/
|
|
6
|
-
import { type DIFUpdateData } from "./definitions.js";
|
|
7
|
-
import type { DIFHandler } from "./dif-handler.js";
|
|
8
|
-
/**
|
|
9
|
-
* Creates a DIFUpdate object that describes replacing a pointer's value.
|
|
10
|
-
*/
|
|
11
|
-
export declare function DIF_Replace<T>(difHandler: DIFHandler, value: T): DIFUpdateData;
|
|
12
|
-
/**
|
|
13
|
-
* Creates a DIFUpdate object that describes updating a property of a pointer's value.
|
|
14
|
-
*/
|
|
15
|
-
export declare function DIF_UpdateProperty<K, V>(difHandler: DIFHandler, property: K, value: V): DIFUpdateData;
|
|
16
|
-
//# sourceMappingURL=builders.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module
|
|
3
|
-
* @description
|
|
4
|
-
* This module contains helper functions to create DIFUpdate objects.
|
|
5
|
-
*/
|
|
6
|
-
import { DIFUpdateKind } from "./definitions.js";
|
|
7
|
-
/**
|
|
8
|
-
* Creates a DIFUpdate object that describes replacing a pointer's value.
|
|
9
|
-
*/
|
|
10
|
-
export function DIF_Replace(difHandler, value) {
|
|
11
|
-
const difValue = difHandler.convertJSValueToDIFValue(value);
|
|
12
|
-
return {
|
|
13
|
-
kind: DIFUpdateKind.Replace,
|
|
14
|
-
value: difValue,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Creates a DIFUpdate object that describes updating a property of a pointer's value.
|
|
19
|
-
*/
|
|
20
|
-
export function DIF_UpdateProperty(difHandler, property, value) {
|
|
21
|
-
const difKey = difHandler.convertJSValueToDIFValue(property);
|
|
22
|
-
const difValue = difHandler.convertJSValueToDIFValue(value);
|
|
23
|
-
return {
|
|
24
|
-
kind: DIFUpdateKind.Set,
|
|
25
|
-
key: { kind: "value", value: difKey },
|
|
26
|
-
value: difValue,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"special-core-types.d.ts","sourceRoot":"","sources":["../../src/runtime/special-core-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,QAAQ;;IAIjB,oFAAoF;IACpF,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAa;IAE7D,OAAO;IAKP;;;OAGG;WACW,gBAAgB,CAAC,QAAQ,EAAE,QAAQ;IASjD;;;;OAIG;WACW,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ;IAa7C;;;OAGG;IACI,QAAQ,IAAI,MAAM;CAG5B"}
|
|
File without changes
|