@unyt/datex 0.0.14 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/esm/datex-web/datex_web.d.ts +93 -2
  2. package/esm/datex-web/datex_web.internal.d.ts +215 -197
  3. package/esm/datex-web/datex_web.internal.d.ts.map +1 -1
  4. package/esm/datex-web/datex_web.internal.js +437 -407
  5. package/esm/datex-web/datex_web.wasm +0 -0
  6. package/esm/datex-web/types/decompiler/options.d.ts +17 -0
  7. package/esm/datex-web/types/decompiler/options.d.ts.map +1 -0
  8. package/esm/datex-web/types/decompiler/options.js +4 -0
  9. package/esm/datex-web/types/disassembler/options.d.ts +6 -0
  10. package/esm/datex-web/types/disassembler/options.d.ts.map +1 -0
  11. package/esm/datex-web/types/disassembler/options.js +4 -0
  12. package/esm/datex-web/types/network/com_hub/managers/socket_manager.d.ts +9 -0
  13. package/esm/datex-web/types/network/com_hub/managers/socket_manager.d.ts.map +1 -0
  14. package/esm/datex-web/types/network/com_hub/managers/socket_manager.js +4 -0
  15. package/esm/datex-web/types/network/com_hub/metadata.d.ts +20 -0
  16. package/esm/datex-web/types/network/com_hub/metadata.d.ts.map +1 -0
  17. package/esm/datex-web/types/network/com_hub/metadata.js +4 -0
  18. package/esm/datex-web/types/network/com_hub/mod.d.ts +6 -0
  19. package/esm/datex-web/types/network/com_hub/mod.d.ts.map +1 -0
  20. package/esm/datex-web/types/network/com_hub/mod.js +4 -0
  21. package/esm/datex-web/types/network/com_hub/network_tracing.d.ts +23 -0
  22. package/esm/datex-web/types/network/com_hub/network_tracing.d.ts.map +1 -0
  23. package/esm/datex-web/types/network/com_hub/network_tracing.js +4 -0
  24. package/esm/datex-web/types/network/com_hub.d.ts +8 -0
  25. package/esm/datex-web/types/network/com_hub.d.ts.map +1 -0
  26. package/esm/datex-web/types/network/com_hub.js +4 -0
  27. package/esm/datex-web/types/network/com_interfaces/com_interface/properties.d.ts +27 -0
  28. package/esm/datex-web/types/network/com_interfaces/com_interface/properties.d.ts.map +1 -0
  29. package/esm/datex-web/types/network/com_interfaces/com_interface/properties.js +4 -0
  30. package/esm/datex-web/types/network/com_interfaces/default_setup_data/http_common.d.ts +10 -0
  31. package/esm/datex-web/types/network/com_interfaces/default_setup_data/http_common.d.ts.map +1 -0
  32. package/esm/datex-web/types/network/com_interfaces/default_setup_data/http_common.js +4 -0
  33. package/esm/datex-web/types/network/com_interfaces/default_setup_data/websocket/websocket_server.d.ts +6 -0
  34. package/esm/datex-web/types/network/com_interfaces/default_setup_data/websocket/websocket_server.d.ts.map +1 -0
  35. package/esm/datex-web/types/network/com_interfaces/default_setup_data/websocket/websocket_server.js +4 -0
  36. package/esm/datex-web/types/runtime/config.d.ts +16 -0
  37. package/esm/datex-web/types/runtime/config.d.ts.map +1 -0
  38. package/esm/datex-web/types/runtime/config.js +4 -0
  39. package/esm/default.d.ts.map +1 -1
  40. package/esm/default.js +2 -0
  41. package/esm/deno.json +73 -17
  42. package/esm/dif/core.d.ts +36 -40
  43. package/esm/dif/core.d.ts.map +1 -1
  44. package/esm/dif/core.js +33 -54
  45. package/esm/dif/dif-handler.d.ts +58 -101
  46. package/esm/dif/dif-handler.d.ts.map +1 -1
  47. package/esm/dif/dif-handler.js +411 -365
  48. package/esm/dif/display.d.ts +14 -5
  49. package/esm/dif/display.d.ts.map +1 -1
  50. package/esm/dif/display.js +89 -39
  51. package/esm/dif/helpers/mod.d.ts +6 -0
  52. package/esm/dif/helpers/mod.d.ts.map +1 -0
  53. package/esm/dif/helpers/mod.js +5 -0
  54. package/esm/dif/helpers/typed-integer.d.ts +14 -0
  55. package/esm/dif/helpers/typed-integer.d.ts.map +1 -0
  56. package/esm/dif/helpers/typed-integer.js +37 -0
  57. package/esm/dif/js-lib.d.ts +14 -1
  58. package/esm/dif/js-lib.d.ts.map +1 -1
  59. package/esm/dif/js-lib.js +19 -1
  60. package/esm/dif/mod.d.ts +2 -2
  61. package/esm/dif/mod.d.ts.map +1 -1
  62. package/esm/dif/mod.js +2 -2
  63. package/esm/dif/type-registry.d.ts +30 -21
  64. package/esm/dif/type-registry.d.ts.map +1 -1
  65. package/esm/dif/type-registry.js +45 -33
  66. package/esm/dif/types/mod.d.ts +9 -0
  67. package/esm/dif/types/mod.d.ts.map +1 -0
  68. package/esm/dif/types/mod.js +8 -0
  69. package/esm/dif/types/type.d.ts +91 -0
  70. package/esm/dif/types/type.d.ts.map +1 -0
  71. package/esm/dif/types/type.js +33 -0
  72. package/esm/dif/types/update.d.ts +63 -0
  73. package/esm/dif/types/update.d.ts.map +1 -0
  74. package/esm/dif/types/update.js +16 -0
  75. package/esm/dif/types/value.d.ts +62 -0
  76. package/esm/dif/types/value.d.ts.map +1 -0
  77. package/esm/dif/types/value.js +1 -0
  78. package/esm/dif/update.d.ts +20 -0
  79. package/esm/dif/update.d.ts.map +1 -0
  80. package/esm/dif/update.js +41 -0
  81. package/esm/dif/utils.d.ts +8 -0
  82. package/esm/dif/utils.d.ts.map +1 -0
  83. package/esm/dif/utils.js +67 -0
  84. package/esm/lib/js-core-types/array.d.ts +3 -0
  85. package/esm/lib/js-core-types/array.d.ts.map +1 -0
  86. package/esm/lib/js-core-types/array.js +175 -0
  87. package/esm/lib/js-core-types/map.d.ts +15 -0
  88. package/esm/lib/js-core-types/map.d.ts.map +1 -0
  89. package/esm/lib/js-core-types/map.js +88 -0
  90. package/esm/lib/js-core-types/mod.d.ts +8 -0
  91. package/esm/lib/js-core-types/mod.d.ts.map +1 -0
  92. package/esm/lib/js-core-types/mod.js +7 -0
  93. package/esm/lib/mod.d.ts +8 -0
  94. package/esm/lib/mod.d.ts.map +1 -0
  95. package/esm/lib/mod.js +7 -0
  96. package/esm/lib/special-core-types/mod.d.ts +9 -0
  97. package/esm/lib/special-core-types/mod.d.ts.map +1 -0
  98. package/esm/lib/special-core-types/mod.js +8 -0
  99. package/esm/lib/special-core-types/tagged.d.ts +17 -0
  100. package/esm/lib/special-core-types/tagged.d.ts.map +1 -0
  101. package/esm/lib/special-core-types/tagged.js +37 -0
  102. package/esm/lib/special-core-types/undefined.d.ts +7 -0
  103. package/esm/lib/special-core-types/undefined.d.ts.map +1 -0
  104. package/esm/lib/special-core-types/undefined.js +28 -0
  105. package/esm/mod.d.ts +2 -3
  106. package/esm/mod.d.ts.map +1 -1
  107. package/esm/mod.js +2 -3
  108. package/esm/network/com-hub.d.ts +28 -1
  109. package/esm/network/com-hub.d.ts.map +1 -1
  110. package/esm/network/com-hub.js +6 -2
  111. package/esm/network/interfaces/websocket-server-base.d.ts +1 -1
  112. package/esm/network/interfaces/websocket-server-base.d.ts.map +1 -1
  113. package/esm/network/interfaces/websocket-server-base.js +8 -7
  114. package/esm/network/interfaces/websocket-server-deno.d.ts +1 -1
  115. package/esm/network/interfaces/websocket-server-deno.d.ts.map +1 -1
  116. package/esm/repl/mod.js +1 -1
  117. package/esm/runtime/runtime.d.ts +43 -18
  118. package/esm/runtime/runtime.d.ts.map +1 -1
  119. package/esm/runtime/runtime.js +55 -32
  120. package/esm/{refs/ref.d.ts → shared-container/base-shared-container.d.ts} +13 -5
  121. package/esm/shared-container/base-shared-container.d.ts.map +1 -0
  122. package/esm/shared-container/base-shared-container.js +95 -0
  123. package/esm/shared-container/mod.d.ts +36 -0
  124. package/esm/shared-container/mod.d.ts.map +1 -0
  125. package/esm/shared-container/mod.js +29 -0
  126. package/esm/shared-container/owned.d.ts +33 -0
  127. package/esm/shared-container/owned.d.ts.map +1 -0
  128. package/esm/shared-container/owned.js +60 -0
  129. package/esm/shared-container/reference.d.ts +31 -0
  130. package/esm/shared-container/reference.d.ts.map +1 -0
  131. package/esm/shared-container/reference.js +64 -0
  132. package/esm/utils/devtools-formatter.js +2 -2
  133. package/esm/utils/option.d.ts +17 -0
  134. package/esm/utils/option.d.ts.map +1 -0
  135. package/esm/utils/option.js +54 -0
  136. package/package.json +1 -1
  137. package/esm/dif/definitions.d.ts +0 -134
  138. package/esm/dif/definitions.d.ts.map +0 -1
  139. package/esm/dif/definitions.js +0 -38
  140. package/esm/refs/ref.d.ts.map +0 -1
  141. package/esm/refs/ref.js +0 -60
@@ -0,0 +1,175 @@
1
+ import { CoreLibTypeId } from "../../dif/core.js";
2
+ import { IS_PROXY_ACCESS } from "../../dif/dif-handler.js";
3
+ import { interceptAccessors } from "../../dif/utils.js";
4
+ import { DEBUG_MODE } from "../../global.js";
5
+ import { Option } from "../../utils/option.js";
6
+ export const arrayTypeBinding = {
7
+ coreLibTypeId: CoreLibTypeId.List,
8
+ bind(target, pointerAddress) {
9
+ const metadata = {};
10
+ const arrayMethods = getArrayMethods(target, pointerAddress, this.difHandler, metadata);
11
+ // catch acccess (get or set) to original array value, not via proxy - this check is only active in debug mode
12
+ if (DEBUG_MODE) {
13
+ interceptAccessors(target, () => {
14
+ if (!metadata[IS_PROXY_ACCESS]) {
15
+ throw new Error("Invalid access to original array value that was moved to a reference");
16
+ }
17
+ return Option.None();
18
+ }, () => {
19
+ if (!metadata[IS_PROXY_ACCESS]) {
20
+ throw new Error("Invalid access to original array value that was moved to a reference");
21
+ }
22
+ });
23
+ }
24
+ // deno-lint-ignore no-this-alias
25
+ const self = this;
26
+ const proxy = new Proxy(target, {
27
+ get(_target, key) {
28
+ return self.allowOriginalValueAccess(proxy, () => {
29
+ return arrayMethods[key] ??
30
+ Reflect.get(target, key);
31
+ });
32
+ },
33
+ set(_target, prop, value, receiver) {
34
+ console.log("=> array." + String(prop) + " =", value);
35
+ return self.allowOriginalValueAccess(proxy, () => {
36
+ const index = Number(prop);
37
+ if (typeof prop === "string" && !isNaN(index) && index >= 0) {
38
+ // check if out of bounds - fill with null&js.empty
39
+ if (index >= target.length) {
40
+ triggerArrayFillEmpty(target, target.length, index, pointerAddress, self.difHandler);
41
+ }
42
+ self.difHandler.triggerIndexSet(pointerAddress, index, value);
43
+ }
44
+ else if (prop === "length") {
45
+ // if length is reduced, trigger delete for removed items
46
+ const newLength = Number(value);
47
+ // explicit length value 0 is treated as a full clear
48
+ if (newLength == 0) {
49
+ self.difHandler.triggerClear(pointerAddress);
50
+ }
51
+ else if (newLength < target.length) {
52
+ self.difHandler.triggerListSplice(pointerAddress, newLength, target.length - newLength, []);
53
+ } // if length is increased, trigger set for new empty items
54
+ else if (newLength > target.length) {
55
+ triggerArrayFillEmpty(target, target.length, newLength, pointerAddress, self.difHandler);
56
+ }
57
+ }
58
+ // x[1..4] = js:empty
59
+ return Reflect.set(target, prop, value, receiver);
60
+ });
61
+ },
62
+ });
63
+ return {
64
+ value: proxy,
65
+ metadata,
66
+ };
67
+ },
68
+ handleAppend(target, value) {
69
+ this.difHandler.getOriginalValueFromProxy(target).push(value);
70
+ // target.push(value);
71
+ },
72
+ handleSet(target, key, value) {
73
+ this.difHandler.getOriginalValueFromProxy(target)[key] = value;
74
+ },
75
+ handleDelete(target, key) {
76
+ // remove key (splice)
77
+ this.difHandler.getOriginalValueFromProxy(target).splice(key, 1);
78
+ },
79
+ handleClear(target) {
80
+ this.difHandler.getOriginalValueFromProxy(target).length = 0;
81
+ },
82
+ handleReplace(target, newValue) {
83
+ const original = this.difHandler.getOriginalValueFromProxy(target);
84
+ original.length = 0;
85
+ original.push(...newValue);
86
+ },
87
+ handleListSplice(target, start, deleteCount, items) {
88
+ this.difHandler
89
+ .getOriginalValueFromProxy(target)
90
+ .splice(start, deleteCount, ...items);
91
+ },
92
+ };
93
+ /**
94
+ * Implementes optimized array methods that send DIF updates on mutation.
95
+ * @returns
96
+ */
97
+ function getArrayMethods(array, pointerAddress, difHandler, metadata) {
98
+ const originalPush = array.push.bind(array);
99
+ const originalUnshift = array.unshift.bind(array);
100
+ const originalSplice = array.splice.bind(array);
101
+ const originalFill = array.fill.bind(array);
102
+ return {
103
+ push: generateInterceptedArrayPush(array, originalPush, pointerAddress, difHandler),
104
+ unshift: generateInterceptedArrayUnshift(originalUnshift, pointerAddress, difHandler, metadata),
105
+ splice: generateInterceptedArraySplice(array, originalSplice, pointerAddress, difHandler, metadata),
106
+ fill: generateInterceptedArrayFill(array, originalFill, pointerAddress, difHandler, metadata),
107
+ };
108
+ }
109
+ function generateInterceptedArrayPush(array, originalPush, pointerAddress, difHandler) {
110
+ return (...items) => {
111
+ difHandler.triggerListSplice(pointerAddress, array.length, 0, items);
112
+ return originalPush(...items);
113
+ };
114
+ }
115
+ function generateInterceptedArrayUnshift(originalUnshift, pointerAddress, difHandler, metadata) {
116
+ return (...items) => {
117
+ difHandler.triggerListSplice(pointerAddress, 0, 0, items);
118
+ try {
119
+ metadata[IS_PROXY_ACCESS] = true;
120
+ return originalUnshift(...items);
121
+ }
122
+ finally {
123
+ metadata[IS_PROXY_ACCESS] = false;
124
+ }
125
+ };
126
+ }
127
+ function generateInterceptedArraySplice(array, originalSplice, pointerAddress, difHandler, metadata) {
128
+ return (start, deleteCount, ...items) => {
129
+ difHandler.triggerListSplice(pointerAddress, start, deleteCount ?? (array.length - start), items);
130
+ try {
131
+ metadata[IS_PROXY_ACCESS] = true;
132
+ return originalSplice(start, deleteCount, ...items);
133
+ }
134
+ finally {
135
+ metadata[IS_PROXY_ACCESS] = false;
136
+ }
137
+ };
138
+ }
139
+ function generateInterceptedArrayFill(array, originalFill, pointerAddress, difHandler, metadata) {
140
+ return (value, start, end) => {
141
+ const actualStart = start !== undefined
142
+ ? (start < 0 ? Math.max(array.length + start, 0) : Math.min(start, array.length))
143
+ : 0;
144
+ const actualEnd = end !== undefined
145
+ ? (end < 0 ? Math.max(array.length + end, 0) : Math.min(end, array.length))
146
+ : array.length;
147
+ const itemCount = actualEnd - actualStart;
148
+ // splice to replace the filled range
149
+ if (itemCount > 0) {
150
+ difHandler.triggerListSplice(pointerAddress, actualStart, actualEnd - actualStart, new Array(itemCount).fill(value));
151
+ }
152
+ try {
153
+ metadata[IS_PROXY_ACCESS] = true;
154
+ return originalFill(value, start, end);
155
+ }
156
+ finally {
157
+ metadata[IS_PROXY_ACCESS] = false;
158
+ }
159
+ };
160
+ }
161
+ /**
162
+ * Sends DIF updates that correspond to filling an array up to a certain index with
163
+ * empty values.
164
+ */
165
+ function triggerArrayFillEmpty(array, from, to, pointerAddress, difHandler) {
166
+ const originalLength = array.length;
167
+ for (let i = from; i < to; i++) {
168
+ if (i < originalLength) {
169
+ difHandler.triggerSet(pointerAddress, i, null); // TODO: special js empty value
170
+ }
171
+ else {
172
+ difHandler.triggerAppend(pointerAddress, null); // TODO: special js empty value
173
+ }
174
+ }
175
+ }
@@ -0,0 +1,15 @@
1
+ import type { TypeBindingDefinition } from "../../dif/type-registry.js";
2
+ import type { DIFTypeDefinition } from "../../dif/types/mod.js";
3
+ declare const ORIGINAL_SET: unique symbol;
4
+ declare const ORIGINAL_DELETE: unique symbol;
5
+ declare const ORIGINAL_CLEAR: unique symbol;
6
+ type MapMetadata<K = unknown, V = unknown> = {
7
+ [ORIGINAL_SET]: Map<K, V>["set"];
8
+ [ORIGINAL_DELETE]: Map<K, V>["delete"];
9
+ [ORIGINAL_CLEAR]: Map<K, V>["clear"];
10
+ };
11
+ export declare const mapTypeBinding: TypeBindingDefinition<Map<unknown, unknown>, MapMetadata>;
12
+ export declare const JS_MAP_TYPE_DEFINITION: DIFTypeDefinition;
13
+ export declare function isJsMapTypeDefinition(typeDef: DIFTypeDefinition): boolean;
14
+ export {};
15
+ //# sourceMappingURL=map.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../../src/lib/js-core-types/map.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAyB,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAGvF,QAAA,MAAM,YAAY,eAAyB,CAAC;AAC5C,QAAA,MAAM,eAAe,eAA4B,CAAC;AAClD,QAAA,MAAM,cAAc,eAA2B,CAAC;AAEhD,KAAK,WAAW,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,IAAI;IACzC,CAAC,YAAY,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC,eAAe,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC,cAAc,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;CACxC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,qBAAqB,CAC9C,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,EACrB,WAAW,CAsEd,CAAC;AAiBF,eAAO,MAAM,sBAAsB,EAAE,iBAEpC,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAOzE"}
@@ -0,0 +1,88 @@
1
+ import { CoreLibTypeId } from "../../dif/core.js";
2
+ import { JsLibTypeAddress } from "../../dif/js-lib.js";
3
+ const ORIGINAL_SET = Symbol("ORIGINAL_SET");
4
+ const ORIGINAL_DELETE = Symbol("ORIGINAL_DELETE");
5
+ const ORIGINAL_CLEAR = Symbol("ORIGINAL_CLEAR");
6
+ export const mapTypeBinding = {
7
+ coreLibTypeId: CoreLibTypeId.Map,
8
+ bind(value, pointerAddress) {
9
+ const originalSet = value.set.bind(value);
10
+ const originalDelete = value.delete.bind(value);
11
+ const originalClear = value.clear.bind(value);
12
+ Object.defineProperties(value, {
13
+ set: {
14
+ value: (key, val) => {
15
+ this.difHandler.triggerSet(pointerAddress, key, val);
16
+ return originalSet.call(value, key, val);
17
+ },
18
+ configurable: true,
19
+ writable: true,
20
+ },
21
+ delete: {
22
+ value: (key) => {
23
+ this.difHandler.triggerDelete(pointerAddress, key);
24
+ return originalDelete.call(value, key);
25
+ },
26
+ configurable: true,
27
+ writable: true,
28
+ },
29
+ clear: {
30
+ value: () => {
31
+ console.warn("triggering clear for pointer address:", pointerAddress);
32
+ this.difHandler.triggerClear(pointerAddress);
33
+ return originalClear.call(value);
34
+ },
35
+ configurable: true,
36
+ writable: true,
37
+ },
38
+ });
39
+ return {
40
+ value,
41
+ metadata: {
42
+ [ORIGINAL_SET]: originalSet,
43
+ [ORIGINAL_DELETE]: originalDelete,
44
+ [ORIGINAL_CLEAR]: originalClear,
45
+ },
46
+ };
47
+ },
48
+ handleSet(target, key, value) {
49
+ const set = this.getCustomReferenceMetadata(target)[ORIGINAL_SET];
50
+ set.call(target, key, value);
51
+ },
52
+ handleDelete(target, key) {
53
+ const del = this.getCustomReferenceMetadata(target)[ORIGINAL_DELETE];
54
+ del.call(target, key);
55
+ },
56
+ handleClear(target) {
57
+ const clear = this.getCustomReferenceMetadata(target)[ORIGINAL_CLEAR];
58
+ clear.call(target);
59
+ },
60
+ handleReplace(target, newValue) {
61
+ const metadata = this.getCustomReferenceMetadata(target);
62
+ metadata[ORIGINAL_CLEAR].call(target);
63
+ for (const [key, value] of newValue.entries()) {
64
+ metadata[ORIGINAL_SET].call(target, key, value);
65
+ }
66
+ },
67
+ };
68
+ const JS_MAP_IMPL_TYPE_DEFINITION = [
69
+ CoreLibTypeId.Map,
70
+ [JsLibTypeAddress.map],
71
+ ];
72
+ function isJsMapImplTypeDefinition(impl) {
73
+ return (Array.isArray(impl) &&
74
+ impl.length === 2 &&
75
+ impl[0] === CoreLibTypeId.Map &&
76
+ Array.isArray(impl[1]) &&
77
+ impl[1].length === 1 &&
78
+ impl[1][0] === JsLibTypeAddress.map);
79
+ }
80
+ export const JS_MAP_TYPE_DEFINITION = {
81
+ impl_type: JS_MAP_IMPL_TYPE_DEFINITION,
82
+ };
83
+ export function isJsMapTypeDefinition(typeDef) {
84
+ return (typeof typeDef === "object" &&
85
+ typeDef !== null &&
86
+ "impl_type" in typeDef &&
87
+ isJsMapImplTypeDefinition(typeDef.impl_type));
88
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @module js-core-types
3
+ * @description
4
+ * This module contains all core type definitions that have a builtin JS mapping, such as arrays and maps.
5
+ */
6
+ export * from "./map.js";
7
+ export * from "./array.js";
8
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/lib/js-core-types/mod.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @module js-core-types
3
+ * @description
4
+ * This module contains all core type definitions that have a builtin JS mapping, such as arrays and maps.
5
+ */
6
+ export * from "./map.js";
7
+ export * from "./array.js";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @module lib
3
+ * @description
4
+ * This module contains all core library types and utilities for the DATEX runtime.
5
+ */
6
+ export * from "./js-core-types/mod.js";
7
+ export * from "./special-core-types/mod.js";
8
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/lib/mod.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC"}
package/esm/lib/mod.js ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @module lib
3
+ * @description
4
+ * This module contains all core library types and utilities for the DATEX runtime.
5
+ */
6
+ export * from "./js-core-types/mod.js";
7
+ export * from "./special-core-types/mod.js";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @module special-core-types
3
+ * @description
4
+ * This module contains type definitions for special core types in the DATEX runtime, such as endpoints and ranges.
5
+ */
6
+ export * from "./endpoint.js";
7
+ export * from "./range.js";
8
+ export * from "./tagged.js";
9
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/lib/special-core-types/mod.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @module special-core-types
3
+ * @description
4
+ * This module contains type definitions for special core types in the DATEX runtime, such as endpoints and ranges.
5
+ */
6
+ export * from "./endpoint.js";
7
+ export * from "./range.js";
8
+ export * from "./tagged.js";
@@ -0,0 +1,17 @@
1
+ export declare const EMPTY_TAG: unique symbol;
2
+ /**
3
+ * A simple wrapper type that allows to associate a string tag with a value.
4
+ */
5
+ export declare class Tagged<Tag extends string, const Value = typeof EMPTY_TAG> {
6
+ #private;
7
+ constructor(tag: Tag, value?: Value);
8
+ get value(): Value;
9
+ set value(newValue: Value);
10
+ get tag(): Tag;
11
+ }
12
+ /**
13
+ * Creates a new Tagged instance with the given tag and value.
14
+ */
15
+ export declare function tagged<Tag extends string>(tag: Tag): Tagged<Tag, typeof EMPTY_TAG>;
16
+ export declare function tagged<Tag extends string, const Value>(tag: Tag, value: Value): Tagged<Tag, Value>;
17
+ //# sourceMappingURL=tagged.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tagged.d.ts","sourceRoot":"","sources":["../../../src/lib/special-core-types/tagged.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,eAAsB,CAAC;AAE7C;;GAEG;AACH,qBAAa,MAAM,CAAC,GAAG,SAAS,MAAM,EAAE,KAAK,CAAC,KAAK,GAAG,OAAO,SAAS;;gBAK9D,GAAG,EAAE,GAAG,EACR,KAAK,GAAE,KAA0B;IAMrC,IAAW,KAAK,IAAI,KAAK,CAExB;IAED,IAAW,KAAK,CAAC,QAAQ,EAAE,KAAK,EAE/B;IAED,IAAW,GAAG,IAAI,GAAG,CAEpB;CACJ;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,GAAG,SAAS,MAAM,EACrC,GAAG,EAAE,GAAG,GACT,MAAM,CAAC,GAAG,EAAE,OAAO,SAAS,CAAC,CAAC;AACjC,wBAAgB,MAAM,CAAC,GAAG,SAAS,MAAM,EAAE,KAAK,CAAC,KAAK,EAClD,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,GACb,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC"}
@@ -0,0 +1,37 @@
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 _Tagged_tag, _Tagged_value;
13
+ export const EMPTY_TAG = Symbol("EMPTY_TAG");
14
+ /**
15
+ * A simple wrapper type that allows to associate a string tag with a value.
16
+ */
17
+ export class Tagged {
18
+ constructor(tag, value = EMPTY_TAG) {
19
+ _Tagged_tag.set(this, void 0);
20
+ _Tagged_value.set(this, void 0);
21
+ __classPrivateFieldSet(this, _Tagged_tag, tag, "f");
22
+ __classPrivateFieldSet(this, _Tagged_value, value, "f");
23
+ }
24
+ get value() {
25
+ return __classPrivateFieldGet(this, _Tagged_value, "f");
26
+ }
27
+ set value(newValue) {
28
+ __classPrivateFieldSet(this, _Tagged_value, newValue, "f");
29
+ }
30
+ get tag() {
31
+ return __classPrivateFieldGet(this, _Tagged_tag, "f");
32
+ }
33
+ }
34
+ _Tagged_tag = new WeakMap(), _Tagged_value = new WeakMap();
35
+ export function tagged(tag, value = EMPTY_TAG) {
36
+ return new Tagged(tag, value);
37
+ }
@@ -0,0 +1,7 @@
1
+ import type { DIFValue } from "../../dif/types/mod.js";
2
+ import type { DIFTypeDefinition } from "../../dif/types/type.js";
3
+ export declare const JS_UNDEFINED_TYPE_DEFINITION: DIFTypeDefinition;
4
+ export declare function isJsUndefinedTypeDefinition(typeDef: DIFTypeDefinition): boolean;
5
+ export declare const JS_UNDEFINED: DIFValue;
6
+ export declare function isJsUndefined(value: DIFValue): boolean;
7
+ //# sourceMappingURL=undefined.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"undefined.d.ts","sourceRoot":"","sources":["../../../src/lib/special-core-types/undefined.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAyB,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAiBxF,eAAO,MAAM,4BAA4B,EAAE,iBAE1C,CAAC;AAEF,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAO/E;AAED,eAAO,MAAM,YAAY,EAAE,QAAmE,CAAC;AAC/F,wBAAgB,aAAa,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAGtD"}
@@ -0,0 +1,28 @@
1
+ import { CoreLibTypeId } from "../../dif/core.js";
2
+ import { JsLibTypeAddress } from "../../dif/js-lib.js";
3
+ const JS_UNDEFINED_IMPL_TYPE_DEFINITION = [
4
+ CoreLibTypeId.null,
5
+ [JsLibTypeAddress.undefined],
6
+ ];
7
+ function isJsUndefinedImplTypeDefinition(impl) {
8
+ return (Array.isArray(impl) &&
9
+ impl.length === 2 &&
10
+ impl[0] === CoreLibTypeId.null &&
11
+ Array.isArray(impl[1]) &&
12
+ impl[1].length === 1 &&
13
+ impl[1][0] === JsLibTypeAddress.undefined);
14
+ }
15
+ export const JS_UNDEFINED_TYPE_DEFINITION = {
16
+ impl_type: JS_UNDEFINED_IMPL_TYPE_DEFINITION,
17
+ };
18
+ export function isJsUndefinedTypeDefinition(typeDef) {
19
+ return (typeof typeDef === "object" &&
20
+ typeDef !== null &&
21
+ "impl_type" in typeDef &&
22
+ isJsUndefinedImplTypeDefinition(typeDef.impl_type));
23
+ }
24
+ export const JS_UNDEFINED = [CoreLibTypeId.null, null, JS_UNDEFINED_TYPE_DEFINITION];
25
+ export function isJsUndefined(value) {
26
+ return Array.isArray(value) && value.length === 3 && value[0] === CoreLibTypeId.null && value[1] === null &&
27
+ isJsUndefinedTypeDefinition(value[2]);
28
+ }
package/esm/mod.d.ts CHANGED
@@ -22,9 +22,8 @@
22
22
  export * from "./runtime/runtime.js";
23
23
  export * as DIF from "./dif/mod.js";
24
24
  export * as Network from "./network/mod.js";
25
- export * from "./lib/special-core-types/endpoint.js";
26
- export * from "./lib/special-core-types/range.js";
27
- export * from "./refs/ref.js";
25
+ export * as Builtins from "./lib/mod.js";
26
+ export * as Shared from "./shared-container/mod.js";
28
27
  export * from "./repl/mod.js";
29
28
  import "./utils/devtools-formatter.js";
30
29
  //# sourceMappingURL=mod.d.ts.map
package/esm/mod.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,qBAAqB,CAAC;AAG7B,cAAc,sBAAsB,CAAC;AACrC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,cAAc,sCAAsC,CAAC;AACrD,cAAc,mCAAmC,CAAC;AAClD,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,OAAO,+BAA+B,CAAC"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,qBAAqB,CAAC;AAG7B,cAAc,sBAAsB,CAAC;AACrC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,QAAQ,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AACpD,cAAc,eAAe,CAAC;AAC9B,OAAO,+BAA+B,CAAC"}
package/esm/mod.js CHANGED
@@ -22,8 +22,7 @@
22
22
  export * from "./runtime/runtime.js";
23
23
  export * as DIF from "./dif/mod.js";
24
24
  export * as Network from "./network/mod.js";
25
- export * from "./lib/special-core-types/endpoint.js";
26
- export * from "./lib/special-core-types/range.js";
27
- export * from "./refs/ref.js";
25
+ export * as Builtins from "./lib/mod.js";
26
+ export * as Shared from "./shared-container/mod.js";
28
27
  export * from "./repl/mod.js";
29
28
  import "./utils/devtools-formatter.js";
@@ -1,9 +1,36 @@
1
- import type { ComHubMetadata, ComInterfaceConfiguration, JSComHub, NetworkTraceResult } from "../datex-web/datex_web";
2
1
  import type { Runtime } from "../runtime/runtime.js";
2
+ import type { DIFValueContainer } from "../dif/types/value.js";
3
+ import type { JSComHub } from "../datex.js";
4
+ import type { ComHubMetadata } from "../datex-web/types/network/com_hub/metadata.js";
5
+ import type { NetworkTraceResult } from "../datex-web/types/network/com_hub/network_tracing.js";
6
+ import type { SocketPropertiesPartial } from "../datex-web/types/network/com_hub.js";
7
+ import type { ComInterfaceProperties } from "../datex-web/types/network/com_interfaces/com_interface/properties.js";
3
8
  export type ComInterfaceFactory<SetupData = unknown> = {
4
9
  interfaceType: string;
5
10
  factory: ComInterfaceFactoryFn<SetupData>;
6
11
  };
12
+ export type SocketConfiguration = {
13
+ properties: DIFValueContainer<SocketPropertiesPartial>;
14
+ iterator: ReadableStream<ArrayBufferLike>;
15
+ send_callback: (data: ArrayBuffer) => void;
16
+ };
17
+ export type ComInterfaceConfiguration = {
18
+ /**
19
+ * The properties of the interface instance
20
+ */
21
+ properties: ComInterfaceProperties;
22
+ /**
23
+ * Indicates that this interface only establishes a single socket connection
24
+ * And stops the sockets iterator after yielding the first socket configuration.
25
+ * When set to true, the first socket connection is awaited on interface creation.
26
+ */
27
+ has_single_socket: boolean;
28
+ new_sockets_iterator: ReadableStream<SocketConfiguration>;
29
+ /**
30
+ * An optional asynchronous callback that is called by the com hub when the interface is closed
31
+ */
32
+ close_async_callback?: never;
33
+ };
7
34
  export type ComInterfaceFactoryFn<SetupData = unknown> = (setup_data: SetupData) => ComInterfaceConfiguration | Promise<ComInterfaceConfiguration>;
8
35
  export type ComInterfaceUUID = `com_interface::${string}`;
9
36
  export type ComInterfaceSocketUUID = `socket::${string}`;
@@ -1 +1 @@
1
- {"version":3,"file":"com-hub.d.ts","sourceRoot":"","sources":["../../src/network/com-hub.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,cAAc,EACd,yBAAyB,EACzB,QAAQ,EACR,kBAAkB,EACrB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD,MAAM,MAAM,mBAAmB,CAAC,SAAS,GAAG,OAAO,IAAI;IACnD,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,qBAAqB,CAAC,SAAS,CAAC,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,qBAAqB,CAAC,SAAS,GAAG,OAAO,IAAI,CACrD,UAAU,EAAE,SAAS,KACpB,yBAAyB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;AAEpE,MAAM,MAAM,gBAAgB,GAAG,kBAAkB,MAAM,EAAE,CAAC;AAC1D,MAAM,MAAM,sBAAsB,GAAG,WAAW,MAAM,EAAE,CAAC;AAEzD;;GAEG;AACH,qBAAa,MAAM;;gBAKH,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO;IAKzC,wBAAwB,CAAC,SAAS,EACrC,iBAAiB,EAAE,mBAAmB,CAAC,SAAS,CAAC;IAWrD;;;;;;OAMG;IACU,eAAe,CAAC,SAAS,EAClC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,SAAS,EACpB,QAAQ,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,gBAAgB,CAAC;IAQrB,eAAe,CAClB,cAAc,EAAE,gBAAgB,GACjC,OAAO,CAAC,IAAI,CAAC;IAIT,YAAY,CACf,WAAW,EAAE,sBAAsB,GACpC,OAAO,CAAC,IAAI,CAAC;IAIhB;;;OAGG;IACI,aAAa,IAAI,IAAI;IAKrB,WAAW,IAAI,cAAc;IAKpC;;;OAGG;IACU,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUjD,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC;IAK1E;;;OAGG;IACI,gCAAgC,CACnC,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,GAC3D,IAAI;IAIP;;;OAGG;IACI,gCAAgC,CACnC,QAAQ,EAAE,CACN,KAAK,EAAE,UAAU,EACjB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EAAE,KAClB,IAAI,GACV,IAAI;CAGV"}
1
+ {"version":3,"file":"com-hub.d.ts","sourceRoot":"","sources":["../../src/network/com-hub.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AACrF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAChG,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uEAAuE,CAAC;AAEpH,MAAM,MAAM,mBAAmB,CAAC,SAAS,GAAG,OAAO,IAAI;IACnD,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,qBAAqB,CAAC,SAAS,CAAC,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAC9B,UAAU,EAAE,iBAAiB,CAAC,uBAAuB,CAAC,CAAC;IACvD,QAAQ,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC;IAC1C,aAAa,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACpC;;OAEG;IACH,UAAU,EAAE,sBAAsB,CAAC;IACnC;;;;OAIG;IACH,iBAAiB,EAAE,OAAO,CAAC;IAC3B,oBAAoB,EAAE,cAAc,CAAC,mBAAmB,CAAC,CAAC;IAC1D;;OAEG;IACH,oBAAoB,CAAC,EAAE,KAAK,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,qBAAqB,CAAC,SAAS,GAAG,OAAO,IAAI,CACrD,UAAU,EAAE,SAAS,KACpB,yBAAyB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;AAEpE,MAAM,MAAM,gBAAgB,GAAG,kBAAkB,MAAM,EAAE,CAAC;AAC1D,MAAM,MAAM,sBAAsB,GAAG,WAAW,MAAM,EAAE,CAAC;AAEzD;;GAEG;AACH,qBAAa,MAAM;;gBAKH,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO;IAKzC,wBAAwB,CAAC,SAAS,EACrC,iBAAiB,EAAE,mBAAmB,CAAC,SAAS,CAAC;IAerD;;;;;;OAMG;IACU,eAAe,CAAC,SAAS,EAClC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,SAAS,EACpB,QAAQ,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,gBAAgB,CAAC;IAQrB,eAAe,CAClB,cAAc,EAAE,gBAAgB,GACjC,OAAO,CAAC,IAAI,CAAC;IAIT,YAAY,CACf,WAAW,EAAE,sBAAsB,GACpC,OAAO,CAAC,IAAI,CAAC;IAIhB;;;OAGG;IACI,aAAa,IAAI,IAAI;IAKrB,WAAW,IAAI,cAAc;IAKpC;;;OAGG;IACU,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUjD,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC;IAK1E;;;OAGG;IACI,gCAAgC,CACnC,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,GAC3D,IAAI;IAIP;;;OAGG;IACI,gCAAgC,CACnC,QAAQ,EAAE,CACN,KAAK,EAAE,UAAU,EACjB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EAAE,KAClB,IAAI,GACV,IAAI;CAGV"}
@@ -24,7 +24,11 @@ export class ComHub {
24
24
  registerInterfaceFactory(factoryDefinition) {
25
25
  __classPrivateFieldGet(this, _ComHub_jsComHub, "f").register_interface_factory(factoryDefinition.interfaceType, async (setupData) => {
26
26
  const setupDataJS = await __classPrivateFieldGet(this, _ComHub_runtime, "f").dif.resolveDIFValueContainer(setupData);
27
- return factoryDefinition.factory(setupDataJS);
27
+ const data = await factoryDefinition.factory(setupDataJS);
28
+ return {
29
+ ...data,
30
+ properties: __classPrivateFieldGet(this, _ComHub_runtime, "f").dif.convertJSValueToDIFValueContainer(data.properties),
31
+ };
28
32
  });
29
33
  }
30
34
  /**
@@ -53,7 +57,7 @@ export class ComHub {
53
57
  }
54
58
  getMetadata() {
55
59
  // as any required because get_metadata only exists in debug builds
56
- return __classPrivateFieldGet(this, _ComHub_jsComHub, "f").get_metadata();
60
+ return __classPrivateFieldGet(this, _ComHub_runtime, "f").dif.resolveDIFValueContainer(__classPrivateFieldGet(this, _ComHub_jsComHub, "f").get_metadata());
57
61
  }
58
62
  /**
59
63
  * Prints the trace for a specific endpoint. Only available in debug builds.
@@ -1,5 +1,5 @@
1
1
  import type { ComInterfaceFactory } from "../com-hub.js";
2
- import type { WebSocketServerInterfaceSetupData } from "../../datex.js";
2
+ import type { WebSocketServerInterfaceSetupData } from "../../datex-web/types/network/com_interfaces/default_setup_data/websocket/websocket_server.js";
3
3
  /**
4
4
  * Utility function to create a WebSocket server communication interface factory from a given server factory function.
5
5
  * @param serverFactory
@@ -1 +1 @@
1
- {"version":3,"file":"websocket-server-base.d.ts","sourceRoot":"","sources":["../../../src/network/interfaces/websocket-server-base.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAuB,iCAAiC,EAAE,MAAM,gBAAgB,CAAC;AAE7F;;;GAGG;AACH,wBAAgB,wCAAwC,CACpD,aAAa,EAAE,CAAC,SAAS,EAAE,iCAAiC,KAAK,cAAc,CAAC,SAAS,CAAC,GAC3F,mBAAmB,CAAC,iCAAiC,CAAC,CAiDxD"}
1
+ {"version":3,"file":"websocket-server-base.d.ts","sourceRoot":"","sources":["../../../src/network/interfaces/websocket-server-base.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,mBAAmB,EAAuB,MAAM,eAAe,CAAC;AAE9E,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,+FAA+F,CAAC;AAGvJ;;;GAGG;AACH,wBAAgB,wCAAwC,CACpD,aAAa,EAAE,CAAC,SAAS,EAAE,iCAAiC,KAAK,cAAc,CAAC,SAAS,CAAC,GAC3F,mBAAmB,CAAC,iCAAiC,CAAC,CAgDxD"}
@@ -1,3 +1,5 @@
1
+ import { tagged } from "../../lib/special-core-types/tagged.js";
2
+ import { DIFHandler } from "../../dif/dif-handler.js";
1
3
  /**
2
4
  * Utility function to create a WebSocket server communication interface factory from a given server factory function.
3
5
  * @param serverFactory
@@ -15,13 +17,13 @@ export function createWebsocketServerComInterfaceFactory(serverFactory) {
15
17
  interface_type: "websocket-server",
16
18
  channel: "websocket",
17
19
  name: setupData.bind_address,
18
- direction: "InOut",
20
+ direction: tagged("InOut"),
19
21
  round_trip_time: 0,
20
22
  max_bandwidth: 0,
21
23
  continuous_connection: false,
22
24
  allow_redirects: false,
23
25
  is_secure_channel: false,
24
- reconnection_config: "NoReconnect",
26
+ reconnection_config: tagged("NoReconnect"),
25
27
  auto_identify: true,
26
28
  connectable_interfaces: [], // TODO add websocket client connections
27
29
  },
@@ -30,12 +32,11 @@ export function createWebsocketServerComInterfaceFactory(serverFactory) {
30
32
  async transform(socket, controller) {
31
33
  const incoming_data_stream = await createSocketDataIterator(socket);
32
34
  controller.enqueue({
33
- properties: {
34
- direction: "InOut",
35
+ properties: DIFHandler.convertJSValueToDIFValueContainer({
36
+ direction: tagged("InOut"),
35
37
  channel_factor: 1,
36
- connection_timestamp: Date.now(),
37
- direct_endpoint: undefined,
38
- },
38
+ direct_endpoint: null,
39
+ }),
39
40
  iterator: incoming_data_stream,
40
41
  send_callback: (data) => {
41
42
  socket.send(data);
@@ -1,4 +1,4 @@
1
- import type { WebSocketServerInterfaceSetupData } from "../../datex.js";
1
+ import type { WebSocketServerInterfaceSetupData } from "../../datex-web/types/network/com_interfaces/default_setup_data/websocket/websocket_server.js";
2
2
  import type { ComInterfaceFactory } from "../com-hub.js";
3
3
  export declare const websocketServerDenoComInterfaceFactory: ComInterfaceFactory<WebSocketServerInterfaceSetupData>;
4
4
  //# sourceMappingURL=websocket-server-deno.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"websocket-server-deno.d.ts","sourceRoot":"","sources":["../../../src/network/interfaces/websocket-server-deno.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,gBAAgB,CAAC;AAExE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AA4BzD,eAAO,MAAM,sCAAsC,EAAE,mBAAmB,CAAC,iCAAiC,CAC3C,CAAC"}
1
+ {"version":3,"file":"websocket-server-deno.d.ts","sourceRoot":"","sources":["../../../src/network/interfaces/websocket-server-deno.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,+FAA+F,CAAC;AAGvJ,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AA4BzD,eAAO,MAAM,sCAAsC,EAAE,mBAAmB,CAAC,iCAAiC,CAC3C,CAAC"}
package/esm/repl/mod.js CHANGED
@@ -24,7 +24,7 @@ export class Repl {
24
24
  }
25
25
  async execute(script) {
26
26
  const result = await __classPrivateFieldGet(this, _Repl_repl, "f").execute(script);
27
- const jsValue = this.runtime.dif.resolveDIFValueContainerSync(result);
27
+ const jsValue = this.runtime.dif.resolveDIFValueContainer(result);
28
28
  return this.runtime.valueToString(jsValue);
29
29
  }
30
30
  }