@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
package/esm/dif/dif-handler.js
CHANGED
|
@@ -9,16 +9,19 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
9
9
|
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");
|
|
10
10
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
11
|
};
|
|
12
|
-
var _DIFHandler_runtime, _DIFHandler_handle, _DIFHandler_transceiver_id, _DIFHandler_cache, _DIFHandler_observers;
|
|
12
|
+
var _DIFHandler_runtime, _DIFHandler_handle, _DIFHandler_transceiver_id, _DIFHandler_cache, _DIFHandler_proxyMapping, _DIFHandler_referenceMetadata, _DIFHandler_observers, _DIFHandler_type_registry;
|
|
13
13
|
import { Ref } from "../refs/ref.js";
|
|
14
|
-
import { Endpoint } from "../
|
|
15
|
-
import { DIFReferenceMutability, DIFUpdateKind, } from "./definitions.js";
|
|
14
|
+
import { Endpoint } from "../lib/special-core-types/endpoint.js";
|
|
15
|
+
import { DIFReferenceMutability, DIFTypeDefinitionKind, DIFUpdateKind, } from "./definitions.js";
|
|
16
16
|
import { CoreTypeAddress, CoreTypeAddressRanges } from "./core.js";
|
|
17
|
-
import {
|
|
17
|
+
import { TypeRegistry } from "./type-registry.js";
|
|
18
|
+
import { panic } from "../utils/exceptions.js";
|
|
19
|
+
import { JsLibTypeAddress } from "./js-lib.js";
|
|
20
|
+
export const IS_PROXY_ACCESS = Symbol("IS_PROXY_ACCESS");
|
|
18
21
|
/**
|
|
19
22
|
* The DIFHandler class provides methods to interact with the DATEX Core DIF runtime,
|
|
20
|
-
* including executing Datex scripts, creating and managing
|
|
21
|
-
* It includes a local
|
|
23
|
+
* including executing Datex scripts, creating and managing references, and observing changes.
|
|
24
|
+
* It includes a local reference cache to optimize performance and reduce cross-language calls.
|
|
22
25
|
*/
|
|
23
26
|
export class DIFHandler {
|
|
24
27
|
/**
|
|
@@ -42,6 +45,9 @@ export class DIFHandler {
|
|
|
42
45
|
get _transceiver_id() {
|
|
43
46
|
return __classPrivateFieldGet(this, _DIFHandler_transceiver_id, "f");
|
|
44
47
|
}
|
|
48
|
+
get type_registry() {
|
|
49
|
+
return __classPrivateFieldGet(this, _DIFHandler_type_registry, "f");
|
|
50
|
+
}
|
|
45
51
|
/**
|
|
46
52
|
* Creates a new DIFHandler instance.
|
|
47
53
|
* @param runtime - The JSRuntime instance for executing Datex scripts.
|
|
@@ -53,11 +59,22 @@ export class DIFHandler {
|
|
|
53
59
|
_DIFHandler_handle.set(this, void 0);
|
|
54
60
|
// always 0 for now - potentially used for multi DIF transceivers using the same underlying runtime
|
|
55
61
|
_DIFHandler_transceiver_id.set(this, 0);
|
|
56
|
-
/**
|
|
57
|
-
* The
|
|
62
|
+
/**
|
|
63
|
+
* The reference cache for storing and reusing object instances on the JS side
|
|
64
|
+
* The observerId is only set if the reference is being observed (if not final).
|
|
58
65
|
*/
|
|
59
66
|
_DIFHandler_cache.set(this, new Map());
|
|
67
|
+
/**
|
|
68
|
+
* Maps the original value to a proxy value
|
|
69
|
+
* (if the values is bound to a custom proxy wrapper)
|
|
70
|
+
*/
|
|
71
|
+
_DIFHandler_proxyMapping.set(this, new WeakMap());
|
|
72
|
+
/**
|
|
73
|
+
* The reference metadata map, storing metadata for each cached reference.
|
|
74
|
+
*/
|
|
75
|
+
_DIFHandler_referenceMetadata.set(this, new WeakMap());
|
|
60
76
|
_DIFHandler_observers.set(this, new Map());
|
|
77
|
+
_DIFHandler_type_registry.set(this, new TypeRegistry(this));
|
|
61
78
|
__classPrivateFieldSet(this, _DIFHandler_runtime, runtime, "f");
|
|
62
79
|
__classPrivateFieldSet(this, _DIFHandler_handle, runtime.dif(), "f");
|
|
63
80
|
}
|
|
@@ -82,31 +99,21 @@ export class DIFHandler {
|
|
|
82
99
|
return __classPrivateFieldGet(this, _DIFHandler_runtime, "f").execute_sync(datexScript, this.convertToDIFValues(values));
|
|
83
100
|
}
|
|
84
101
|
/**
|
|
85
|
-
* Creates a new pointer for the specified value.
|
|
86
|
-
* @param
|
|
102
|
+
* Creates a new pointer for the specified DIF value.
|
|
103
|
+
* @param difValueContainer - The DIFValueContainer value to create a pointer for.
|
|
87
104
|
* @param allowedType - The allowed type for the pointer.
|
|
88
105
|
* @param mutability - The mutability of the pointer.
|
|
89
106
|
* @returns The created pointer address.
|
|
90
107
|
*/
|
|
91
|
-
|
|
92
|
-
return __classPrivateFieldGet(this, _DIFHandler_handle, "f").create_pointer(
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Creates a new pointer that points to an existing address.
|
|
96
|
-
* @param address - The address to create a reference pointer for.
|
|
97
|
-
* @param allowedType - The allowed type for the pointer.
|
|
98
|
-
* @param mutability - The mutability of the pointer.
|
|
99
|
-
* @returns A Promise that resolves to the created pointer address.
|
|
100
|
-
*/
|
|
101
|
-
createRefPointer(address, allowedType = null, mutability) {
|
|
102
|
-
return __classPrivateFieldGet(this, _DIFHandler_handle, "f").create_pointer(address, allowedType, mutability);
|
|
108
|
+
createReferenceFromDIFValue(difValueContainer, allowedType = null, mutability) {
|
|
109
|
+
return __classPrivateFieldGet(this, _DIFHandler_handle, "f").create_pointer(difValueContainer, allowedType, mutability);
|
|
103
110
|
}
|
|
104
111
|
/**
|
|
105
112
|
* Updates the DIF value at the specified address.
|
|
106
113
|
* @param address - The address of the DIF value to update.
|
|
107
114
|
* @param dif - The DIFUpdate object containing the update information.
|
|
108
115
|
*/
|
|
109
|
-
|
|
116
|
+
updateReference(address, dif) {
|
|
110
117
|
__classPrivateFieldGet(this, _DIFHandler_handle, "f").update(__classPrivateFieldGet(this, _DIFHandler_transceiver_id, "f"), address, dif);
|
|
111
118
|
}
|
|
112
119
|
/**
|
|
@@ -159,7 +166,7 @@ export class DIFHandler {
|
|
|
159
166
|
* @param address - The address of the DIF value being observed.
|
|
160
167
|
* @param observerId - The observer ID returned by the observePointer method.
|
|
161
168
|
*/
|
|
162
|
-
|
|
169
|
+
unobserveReferenceBindDirect(address, observerId) {
|
|
163
170
|
__classPrivateFieldGet(this, _DIFHandler_runtime, "f").dif().unobserve_pointer(address, observerId);
|
|
164
171
|
}
|
|
165
172
|
/**
|
|
@@ -228,22 +235,27 @@ export class DIFHandler {
|
|
|
228
235
|
* @param value
|
|
229
236
|
*/
|
|
230
237
|
resolveDIFValue(value) {
|
|
231
|
-
console.log("RESOLVE", value);
|
|
232
238
|
let type = value.type;
|
|
239
|
+
let convertMapToJSObject = false;
|
|
240
|
+
// no type specified since it is inferable from the value
|
|
233
241
|
if (type === undefined) {
|
|
234
242
|
if (Array.isArray(value.value)) {
|
|
243
|
+
// [[x,y,]] -> map
|
|
235
244
|
if (Array.isArray(value.value[0])) {
|
|
236
245
|
type = CoreTypeAddress.map;
|
|
237
|
-
}
|
|
246
|
+
} // [x,y] or [] -> list
|
|
238
247
|
else {
|
|
239
248
|
type = CoreTypeAddress.list;
|
|
240
249
|
}
|
|
241
250
|
}
|
|
251
|
+
else if (typeof value.value === "object" && value.value !== null) {
|
|
252
|
+
type = CoreTypeAddress.map;
|
|
253
|
+
convertMapToJSObject = true;
|
|
254
|
+
} // primitive JS value, no type specified
|
|
242
255
|
else {
|
|
243
256
|
return value.value;
|
|
244
257
|
}
|
|
245
258
|
}
|
|
246
|
-
console.log(type, value);
|
|
247
259
|
// null, boolean and text types values are just returned as is
|
|
248
260
|
if (type === CoreTypeAddress.boolean ||
|
|
249
261
|
type == CoreTypeAddress.text ||
|
|
@@ -255,8 +267,7 @@ export class DIFHandler {
|
|
|
255
267
|
this.isPointerAddressInAdresses(type, CoreTypeAddressRanges.small_unsigned_integers))) {
|
|
256
268
|
return Number(value.value);
|
|
257
269
|
} // big integers are interpreted as JS BigInt
|
|
258
|
-
else if (typeof type === "string" && (this.isPointerAddressInAdresses(type, CoreTypeAddressRanges.big_signed_integers)
|
|
259
|
-
this.isPointerAddressInAdresses(type, CoreTypeAddressRanges.big_unsigned_integers))) {
|
|
270
|
+
else if (typeof type === "string" && (this.isPointerAddressInAdresses(type, CoreTypeAddressRanges.big_signed_integers))) {
|
|
260
271
|
return BigInt(value.value);
|
|
261
272
|
} // decimal types are interpreted as JS numbers
|
|
262
273
|
else if (typeof type === "string" &&
|
|
@@ -273,25 +284,39 @@ export class DIFHandler {
|
|
|
273
284
|
if (Array.isArray(value.value)) {
|
|
274
285
|
const resolvedMap = new Map();
|
|
275
286
|
for (const [key, val] of value.value) {
|
|
276
|
-
// TODO: currently always converting to an object here, but this should be a Map per default
|
|
277
287
|
resolvedMap.set(this.resolveDIFValueContainer(key), this.resolveDIFValueContainer(val));
|
|
278
288
|
}
|
|
279
289
|
// TODO: map promises
|
|
280
290
|
return resolvedMap;
|
|
281
291
|
}
|
|
282
292
|
else {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
293
|
+
if (convertMapToJSObject) {
|
|
294
|
+
const resolvedObj = {};
|
|
295
|
+
for (const [key, val] of Object.entries(value.value)) {
|
|
296
|
+
resolvedObj[key] = this.resolveDIFValueContainer(val);
|
|
297
|
+
}
|
|
298
|
+
return resolvedObj;
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
const resolvedMap = new Map();
|
|
302
|
+
for (const [key, val] of Object.entries(value.value)) {
|
|
303
|
+
resolvedMap.set(key, this.resolveDIFValueContainer(val));
|
|
304
|
+
}
|
|
305
|
+
return resolvedMap;
|
|
287
306
|
}
|
|
288
|
-
|
|
307
|
+
}
|
|
308
|
+
} // impl types
|
|
309
|
+
else if (typeof type == "object" &&
|
|
310
|
+
type.kind === DIFTypeDefinitionKind.ImplType) {
|
|
311
|
+
// undefined (null + js.undefined)
|
|
312
|
+
if (type.def[0] === CoreTypeAddress.null &&
|
|
313
|
+
type.def[1].length === 1 &&
|
|
314
|
+
type.def[1][0] == JsLibTypeAddress.undefined) {
|
|
315
|
+
return undefined;
|
|
289
316
|
}
|
|
290
317
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
throw new Error("Custom type resolution not implemented yet");
|
|
294
|
-
}
|
|
318
|
+
// custom types not implemented yet
|
|
319
|
+
throw new Error("Custom type resolution not implemented yet");
|
|
295
320
|
}
|
|
296
321
|
/**
|
|
297
322
|
* Converts an array of Promises or resolved values to either a Promise of an array of resolved values,
|
|
@@ -366,6 +391,20 @@ export class DIFHandler {
|
|
|
366
391
|
}
|
|
367
392
|
return result;
|
|
368
393
|
}
|
|
394
|
+
/**
|
|
395
|
+
* Resolves a DIFProperty to its corresponding JS value.
|
|
396
|
+
*/
|
|
397
|
+
resolveDIFPropertySync(property) {
|
|
398
|
+
if (property.kind === "text") {
|
|
399
|
+
return property.value;
|
|
400
|
+
}
|
|
401
|
+
else if (property.kind === "index") {
|
|
402
|
+
return property.value;
|
|
403
|
+
}
|
|
404
|
+
else {
|
|
405
|
+
return this.resolveDIFValueContainerSync(property.value);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
369
408
|
/**
|
|
370
409
|
* Resolves a pointer address to its corresponding JS value.
|
|
371
410
|
* If the pointer address is not yet loaded in memory, it returns a Promise that resolves to the value.
|
|
@@ -375,7 +414,7 @@ export class DIFHandler {
|
|
|
375
414
|
*/
|
|
376
415
|
resolvePointerAddress(address) {
|
|
377
416
|
// check cache first
|
|
378
|
-
const cached = this.
|
|
417
|
+
const cached = this.getCachedReference(address);
|
|
379
418
|
if (cached) {
|
|
380
419
|
return cached;
|
|
381
420
|
}
|
|
@@ -385,7 +424,7 @@ export class DIFHandler {
|
|
|
385
424
|
const value = this.resolveDIFValueContainer(reference.value);
|
|
386
425
|
return this.mapPromise(value, (v) => {
|
|
387
426
|
// init pointer
|
|
388
|
-
this.
|
|
427
|
+
this.initReference(address, v, reference.mut, reference.allowed_type);
|
|
389
428
|
return v;
|
|
390
429
|
});
|
|
391
430
|
});
|
|
@@ -400,7 +439,7 @@ export class DIFHandler {
|
|
|
400
439
|
*/
|
|
401
440
|
resolvePointerAddressSync(address) {
|
|
402
441
|
// check cache first
|
|
403
|
-
const cached = this.
|
|
442
|
+
const cached = this.getCachedReference(address);
|
|
404
443
|
if (cached) {
|
|
405
444
|
return cached;
|
|
406
445
|
}
|
|
@@ -408,16 +447,46 @@ export class DIFHandler {
|
|
|
408
447
|
const entry = __classPrivateFieldGet(this, _DIFHandler_handle, "f")
|
|
409
448
|
.resolve_pointer_address_sync(address);
|
|
410
449
|
const value = this.resolveDIFValueContainerSync(entry.value);
|
|
411
|
-
this.
|
|
450
|
+
this.initReference(address, value, entry.mut, entry.allowed_type);
|
|
412
451
|
return value;
|
|
413
452
|
}
|
|
453
|
+
/**
|
|
454
|
+
* Retrieves the original value from a proxy value if available
|
|
455
|
+
* @param proxy
|
|
456
|
+
* @returns
|
|
457
|
+
*/
|
|
458
|
+
getOriginalValueFromProxy(proxy) {
|
|
459
|
+
const address = this.getPointerAddressForValue(proxy);
|
|
460
|
+
if (address) {
|
|
461
|
+
const cached = __classPrivateFieldGet(this, _DIFHandler_cache, "f").get(address);
|
|
462
|
+
if (cached && cached.originalValue) {
|
|
463
|
+
return cached.originalValue;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
return null;
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Retrieves the proxy value for a given original value if available
|
|
470
|
+
* @param original
|
|
471
|
+
* @returns
|
|
472
|
+
*/
|
|
473
|
+
getProxyValueFromOriginal(original) {
|
|
474
|
+
const ref = __classPrivateFieldGet(this, _DIFHandler_proxyMapping, "f").get(original);
|
|
475
|
+
if (ref) {
|
|
476
|
+
const proxied = ref.deref();
|
|
477
|
+
if (proxied) {
|
|
478
|
+
return proxied;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
return null;
|
|
482
|
+
}
|
|
414
483
|
/**
|
|
415
484
|
* Converts an array of JS values to an array of DIFValues.
|
|
416
485
|
* If the input is null, it returns null.
|
|
417
486
|
* @param values
|
|
418
487
|
*/
|
|
419
488
|
convertToDIFValues(values) {
|
|
420
|
-
return values?.map((value) => this.
|
|
489
|
+
return values?.map((value) => this.convertJSValueToDIFValueContainer(value)) ||
|
|
421
490
|
null;
|
|
422
491
|
}
|
|
423
492
|
/**
|
|
@@ -427,21 +496,41 @@ export class DIFHandler {
|
|
|
427
496
|
return range.has(address);
|
|
428
497
|
}
|
|
429
498
|
/**
|
|
430
|
-
* Initializes a
|
|
499
|
+
* Initializes a reference with the given value and mutability, by
|
|
431
500
|
* adding a proxy wrapper if necessary, and setting up observation and caching on the JS side.
|
|
432
501
|
*/
|
|
433
|
-
|
|
434
|
-
|
|
502
|
+
initReference(pointerAddress, value, mutability, allowedType = null) {
|
|
503
|
+
let wrappedValue = this.wrapJSValue(value, pointerAddress, allowedType);
|
|
504
|
+
let typeBinding = null;
|
|
505
|
+
let metadata = undefined;
|
|
506
|
+
// bind js value (if mutable, nominal type)
|
|
507
|
+
const bindJSValue = mutability !== DIFReferenceMutability.Immutable &&
|
|
508
|
+
typeof allowedType == "string";
|
|
509
|
+
if (bindJSValue && !(wrappedValue instanceof Ref)) {
|
|
510
|
+
typeBinding = this.type_registry.getTypeBinding(allowedType);
|
|
511
|
+
if (typeBinding) {
|
|
512
|
+
const { value, metadata: newMetadata } = typeBinding
|
|
513
|
+
.bindValue(wrappedValue, pointerAddress);
|
|
514
|
+
metadata = newMetadata;
|
|
515
|
+
wrappedValue = value;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
435
518
|
// if not immutable, observe to keep the pointer 'live' and receive updates
|
|
436
519
|
let observerId = null;
|
|
437
520
|
if (mutability !== DIFReferenceMutability.Immutable) {
|
|
438
|
-
observerId = this.observePointerBindDirect(
|
|
521
|
+
observerId = this.observePointerBindDirect(pointerAddress, (update) => {
|
|
439
522
|
// if source_id is not own transceiver id, handle pointer update
|
|
440
523
|
if (update.source_id !== __classPrivateFieldGet(this, _DIFHandler_transceiver_id, "f")) {
|
|
441
|
-
|
|
524
|
+
try {
|
|
525
|
+
this.handlePointerUpdate(pointerAddress, wrappedValue, update.data, typeBinding);
|
|
526
|
+
}
|
|
527
|
+
catch (e) {
|
|
528
|
+
console.error("Error handling pointer update", e);
|
|
529
|
+
throw e;
|
|
530
|
+
}
|
|
442
531
|
}
|
|
443
532
|
// call all local observers
|
|
444
|
-
const observers = __classPrivateFieldGet(this, _DIFHandler_observers, "f").get(
|
|
533
|
+
const observers = __classPrivateFieldGet(this, _DIFHandler_observers, "f").get(pointerAddress);
|
|
445
534
|
if (observers) {
|
|
446
535
|
for (const cb of observers.values()) {
|
|
447
536
|
try {
|
|
@@ -455,55 +544,69 @@ export class DIFHandler {
|
|
|
455
544
|
console.debug("Pointer update received", update);
|
|
456
545
|
});
|
|
457
546
|
}
|
|
458
|
-
this.
|
|
459
|
-
|
|
547
|
+
this.cacheWrappedReferenceValue(pointerAddress, value, wrappedValue, observerId, metadata);
|
|
548
|
+
// set up observers
|
|
549
|
+
return wrappedValue;
|
|
460
550
|
}
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
* If the pointer is cached and has a dereferenceable value, it updates the value.
|
|
464
|
-
* @param address - The address of the pointer being updated.
|
|
465
|
-
* @param update - The DIFUpdateData containing the update information.
|
|
466
|
-
* @returns True if the pointer was found and updated, false otherwise.
|
|
467
|
-
*/
|
|
468
|
-
handlePointerUpdate(address, update) {
|
|
469
|
-
const cached = __classPrivateFieldGet(this, _DIFHandler_cache, "f").get(address);
|
|
551
|
+
handlePointerUpdate(pointerAddress, value, update, typeBinding) {
|
|
552
|
+
const cached = __classPrivateFieldGet(this, _DIFHandler_cache, "f").get(pointerAddress);
|
|
470
553
|
if (!cached)
|
|
471
554
|
return false;
|
|
472
|
-
const deref = cached.
|
|
555
|
+
const deref = cached.value.deref();
|
|
473
556
|
if (!deref)
|
|
474
557
|
return false;
|
|
475
558
|
if (deref instanceof Ref && update.kind === DIFUpdateKind.Replace) {
|
|
476
559
|
deref.updateValueSilently(this.resolveDIFValueContainerSync(update.value));
|
|
477
560
|
}
|
|
478
|
-
//
|
|
561
|
+
// handle generic updates for values (depending on type interface definition)
|
|
562
|
+
if (typeBinding) {
|
|
563
|
+
typeBinding.handleDifUpdate(value, pointerAddress, update);
|
|
564
|
+
}
|
|
479
565
|
return true;
|
|
480
566
|
}
|
|
481
567
|
/**
|
|
482
|
-
* Caches the given
|
|
483
|
-
* The
|
|
568
|
+
* Caches the given reference value with the given address in the JS side cache.
|
|
569
|
+
* The reference must already be wrapped if necessary.
|
|
484
570
|
*/
|
|
485
|
-
|
|
571
|
+
cacheWrappedReferenceValue(address, originalValue, proxiedValue, observerId, metadata = {}) {
|
|
572
|
+
const isProxifiedValue = this.isWeakKey(originalValue) &&
|
|
573
|
+
originalValue !== proxiedValue;
|
|
486
574
|
__classPrivateFieldGet(this, _DIFHandler_cache, "f").set(address, {
|
|
487
|
-
|
|
575
|
+
value: new WeakRef(proxiedValue),
|
|
576
|
+
originalValue: isProxifiedValue ? originalValue : null,
|
|
488
577
|
observerId,
|
|
489
578
|
});
|
|
490
|
-
|
|
579
|
+
__classPrivateFieldGet(this, _DIFHandler_referenceMetadata, "f").set(proxiedValue, {
|
|
580
|
+
address,
|
|
581
|
+
customMetadata: metadata,
|
|
582
|
+
});
|
|
583
|
+
// store in proxy mapping if original value is not identical to proxied value
|
|
584
|
+
// and original value is a weak key
|
|
585
|
+
if (isProxifiedValue) {
|
|
586
|
+
__classPrivateFieldGet(this, _DIFHandler_proxyMapping, "f").set(originalValue, new WeakRef(proxiedValue));
|
|
587
|
+
}
|
|
588
|
+
// register finalizer to clean up the cache and free the reference in the runtime
|
|
491
589
|
// when the object is garbage collected
|
|
492
590
|
const finalizationRegistry = new FinalizationRegistry((address) => {
|
|
591
|
+
const originalValue = __classPrivateFieldGet(this, _DIFHandler_cache, "f").get(address)?.originalValue;
|
|
592
|
+
// remove from proxy mapping if applicable
|
|
593
|
+
if (originalValue) {
|
|
594
|
+
__classPrivateFieldGet(this, _DIFHandler_proxyMapping, "f").delete(originalValue);
|
|
595
|
+
}
|
|
493
596
|
__classPrivateFieldGet(this, _DIFHandler_cache, "f").delete(address);
|
|
494
597
|
// remove local observers
|
|
495
598
|
__classPrivateFieldGet(this, _DIFHandler_observers, "f").delete(address);
|
|
496
599
|
// if observer is active, unregister it
|
|
497
600
|
if (observerId !== null) {
|
|
498
|
-
this.
|
|
601
|
+
this.unobserveReferenceBindDirect(address, observerId);
|
|
499
602
|
}
|
|
500
603
|
});
|
|
501
|
-
finalizationRegistry.register(
|
|
604
|
+
finalizationRegistry.register(proxiedValue, address);
|
|
502
605
|
}
|
|
503
|
-
|
|
606
|
+
getCachedReference(address) {
|
|
504
607
|
const cached = __classPrivateFieldGet(this, _DIFHandler_cache, "f").get(address);
|
|
505
608
|
if (cached) {
|
|
506
|
-
const deref = cached.
|
|
609
|
+
const deref = cached.value.deref();
|
|
507
610
|
if (deref) {
|
|
508
611
|
return deref;
|
|
509
612
|
}
|
|
@@ -511,92 +614,51 @@ export class DIFHandler {
|
|
|
511
614
|
return undefined;
|
|
512
615
|
}
|
|
513
616
|
/**
|
|
514
|
-
* Creates a new
|
|
617
|
+
* Creates a new reference containg the given JS value.
|
|
515
618
|
* The returned value is a proxy object that behaves like the original object,
|
|
516
619
|
* but also propagates changes between JS and the DATEX runtime.
|
|
620
|
+
* If a reference for the given value already exists, an error is thrown.
|
|
517
621
|
*/
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
622
|
+
createTransparentReference(value, allowedType = null, mutability = DIFReferenceMutability.Mutable) {
|
|
623
|
+
// if already bound to a reference, return the existing reference proxy (or the value itself)
|
|
624
|
+
const pointerAddress = this.getPointerAddressForValue(value);
|
|
625
|
+
if (pointerAddress) {
|
|
626
|
+
throw new Error(`Value is already bound to a reference ($${pointerAddress}). Cannot create a new reference for the same value.`);
|
|
627
|
+
}
|
|
628
|
+
const difValue = this.convertJSValueToDIFValueContainer(value);
|
|
629
|
+
const ptrAddress = this.createReferenceFromDIFValue(difValue, allowedType, mutability);
|
|
522
630
|
// get inferred allowed type from pointer if not explicitly set
|
|
523
631
|
if (!allowedType) {
|
|
524
632
|
allowedType = __classPrivateFieldGet(this, _DIFHandler_handle, "f").resolve_pointer_address_sync(ptrAddress).allowed_type;
|
|
525
633
|
}
|
|
526
|
-
return this.
|
|
634
|
+
return this.initReference(ptrAddress, value, mutability, allowedType);
|
|
527
635
|
}
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
if (value === null || value === undefined ||
|
|
636
|
+
isPrimitiveValue(value) {
|
|
637
|
+
return value === null || value === undefined ||
|
|
531
638
|
typeof value === "boolean" ||
|
|
532
639
|
typeof value === "number" || typeof value === "bigint" ||
|
|
533
|
-
typeof value === "string"
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
640
|
+
typeof value === "string" || typeof value === "symbol";
|
|
641
|
+
}
|
|
642
|
+
isWeakKey(value) {
|
|
643
|
+
// non-registered symbols are valid WeakKeys
|
|
644
|
+
return (typeof value === "symbol" && !Symbol.keyFor(value)) ||
|
|
645
|
+
!this.isPrimitiveValue(value);
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Wraps a given JS value in a Ref proxy if necessary.
|
|
649
|
+
*/
|
|
650
|
+
wrapJSValue(value, pointerAddress, _type = null) {
|
|
651
|
+
// primitive values are always wrapped in a Ref proxy
|
|
652
|
+
if (this.isWeakKey(value)) {
|
|
653
|
+
return value;
|
|
541
654
|
}
|
|
542
655
|
else {
|
|
543
|
-
return value;
|
|
656
|
+
return new Ref(value, pointerAddress, this);
|
|
544
657
|
}
|
|
545
658
|
}
|
|
546
659
|
isRef(value) {
|
|
547
660
|
return value instanceof Ref;
|
|
548
661
|
}
|
|
549
|
-
proxifyJSMap(map, pointerAddress) {
|
|
550
|
-
const originalSet = map.set;
|
|
551
|
-
const originalDelete = map.delete;
|
|
552
|
-
const originalClear = map.clear;
|
|
553
|
-
// deno-lint-ignore no-this-alias
|
|
554
|
-
const self = this;
|
|
555
|
-
Object.defineProperties(map, {
|
|
556
|
-
set: {
|
|
557
|
-
value: function (key, value) {
|
|
558
|
-
self.updatePointer(pointerAddress, {
|
|
559
|
-
kind: DIFUpdateKind.Set,
|
|
560
|
-
key: {
|
|
561
|
-
kind: "value",
|
|
562
|
-
value: self.convertJSValueToDIFValue(key),
|
|
563
|
-
},
|
|
564
|
-
value: self.convertJSValueToDIFValue(value),
|
|
565
|
-
});
|
|
566
|
-
return originalSet.call(this, key, value);
|
|
567
|
-
},
|
|
568
|
-
configurable: true,
|
|
569
|
-
writable: true,
|
|
570
|
-
},
|
|
571
|
-
delete: {
|
|
572
|
-
value: function (key) {
|
|
573
|
-
self.updatePointer(pointerAddress, {
|
|
574
|
-
kind: DIFUpdateKind.Remove,
|
|
575
|
-
key: {
|
|
576
|
-
kind: "value",
|
|
577
|
-
value: self.convertJSValueToDIFValue(key),
|
|
578
|
-
},
|
|
579
|
-
});
|
|
580
|
-
const result = originalDelete.call(this, key);
|
|
581
|
-
return result;
|
|
582
|
-
},
|
|
583
|
-
configurable: true,
|
|
584
|
-
writable: true,
|
|
585
|
-
},
|
|
586
|
-
clear: {
|
|
587
|
-
value: function () {
|
|
588
|
-
self.updatePointer(pointerAddress, {
|
|
589
|
-
kind: DIFUpdateKind.Clear,
|
|
590
|
-
});
|
|
591
|
-
const result = originalClear.call(this);
|
|
592
|
-
return result;
|
|
593
|
-
},
|
|
594
|
-
configurable: true,
|
|
595
|
-
writable: true,
|
|
596
|
-
},
|
|
597
|
-
});
|
|
598
|
-
return map;
|
|
599
|
-
}
|
|
600
662
|
wrapJSObjectInProxy(value) {
|
|
601
663
|
// deno-lint-ignore no-this-alias
|
|
602
664
|
const self = this;
|
|
@@ -624,22 +686,68 @@ export class DIFHandler {
|
|
|
624
686
|
},
|
|
625
687
|
});
|
|
626
688
|
}
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
689
|
+
/**
|
|
690
|
+
* Returns the pointer address for the given value if it is already cached, or null otherwise.
|
|
691
|
+
*/
|
|
630
692
|
getPointerAddressForValue(value) {
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
693
|
+
return __classPrivateFieldGet(this, _DIFHandler_referenceMetadata, "f").get(value)?.address || null;
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
696
|
+
* Returns the reference metadata for the given value if it is registered.
|
|
697
|
+
* The caller must ensure that the correct type M is used and the reference is already registered.
|
|
698
|
+
* If the reference is not found, an error is thrown.
|
|
699
|
+
*/
|
|
700
|
+
getReferenceMetadataUnsafe(value) {
|
|
701
|
+
const metadata = this.tryGetReferenceMetadata(value);
|
|
702
|
+
if (!metadata) {
|
|
703
|
+
panic("Reference metadata not found for the given value");
|
|
704
|
+
}
|
|
705
|
+
return metadata;
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Returns the reference metadata for the given value if it is registered, or null otherwise.
|
|
709
|
+
*/
|
|
710
|
+
tryGetReferenceMetadata(value) {
|
|
711
|
+
return (__classPrivateFieldGet(this, _DIFHandler_referenceMetadata, "f").get(value) ??
|
|
712
|
+
__classPrivateFieldGet(this, _DIFHandler_referenceMetadata, "f").get(__classPrivateFieldGet(this, _DIFHandler_proxyMapping, "f").get(value)?.deref()) ??
|
|
713
|
+
null);
|
|
714
|
+
}
|
|
715
|
+
isReference(value) {
|
|
716
|
+
return __classPrivateFieldGet(this, _DIFHandler_referenceMetadata, "f").has(value) ||
|
|
717
|
+
__classPrivateFieldGet(this, _DIFHandler_proxyMapping, "f").has(value);
|
|
718
|
+
}
|
|
719
|
+
getReferenceProxy(value) {
|
|
720
|
+
const reference = __classPrivateFieldGet(this, _DIFHandler_referenceMetadata, "f").get(value);
|
|
721
|
+
if (reference) {
|
|
722
|
+
return value;
|
|
723
|
+
}
|
|
724
|
+
const proxyRef = __classPrivateFieldGet(this, _DIFHandler_proxyMapping, "f").get(value);
|
|
725
|
+
if (proxyRef) {
|
|
726
|
+
const deref = proxyRef.deref();
|
|
727
|
+
if (deref) {
|
|
728
|
+
return deref;
|
|
729
|
+
}
|
|
730
|
+
else {
|
|
731
|
+
panic("Reference proxy has been garbage collected");
|
|
635
732
|
}
|
|
636
733
|
}
|
|
637
|
-
|
|
734
|
+
else {
|
|
735
|
+
return null;
|
|
736
|
+
}
|
|
638
737
|
}
|
|
639
738
|
/**
|
|
640
|
-
* Converts a given JS value to its
|
|
739
|
+
* Converts a given JS value to its DIFValueContainer representation.
|
|
740
|
+
* This method can be called statically or with an instance to use the instance's DIFHandler context.
|
|
741
|
+
* NOTE: When called statically, there is no cache for already registered references, meaning that new references will be created
|
|
742
|
+
* for the same object each time this method is called.
|
|
641
743
|
*/
|
|
642
|
-
|
|
744
|
+
static convertJSValueToDIFValueContainer(value, difHandlerInstance) {
|
|
745
|
+
// if the value is a registered reference, return its address
|
|
746
|
+
const existingReference = difHandlerInstance &&
|
|
747
|
+
difHandlerInstance.tryGetReferenceMetadata(value);
|
|
748
|
+
if (existingReference) {
|
|
749
|
+
return existingReference.address;
|
|
750
|
+
}
|
|
643
751
|
// assuming core values
|
|
644
752
|
// TODO: handle custom types
|
|
645
753
|
if (value === null) {
|
|
@@ -647,6 +755,18 @@ export class DIFHandler {
|
|
|
647
755
|
value: null,
|
|
648
756
|
};
|
|
649
757
|
}
|
|
758
|
+
else if (value === undefined) {
|
|
759
|
+
return {
|
|
760
|
+
type: {
|
|
761
|
+
kind: DIFTypeDefinitionKind.ImplType,
|
|
762
|
+
def: [
|
|
763
|
+
CoreTypeAddress.null,
|
|
764
|
+
[JsLibTypeAddress.undefined],
|
|
765
|
+
],
|
|
766
|
+
},
|
|
767
|
+
value: null,
|
|
768
|
+
};
|
|
769
|
+
}
|
|
650
770
|
else if (typeof value === "boolean") {
|
|
651
771
|
return {
|
|
652
772
|
value,
|
|
@@ -659,7 +779,7 @@ export class DIFHandler {
|
|
|
659
779
|
}
|
|
660
780
|
else if (typeof value === "bigint") {
|
|
661
781
|
return {
|
|
662
|
-
type: CoreTypeAddress.
|
|
782
|
+
type: CoreTypeAddress.integer_ibig,
|
|
663
783
|
value: value.toString(), // convert bigint to string for DIFValue
|
|
664
784
|
};
|
|
665
785
|
}
|
|
@@ -676,13 +796,14 @@ export class DIFHandler {
|
|
|
676
796
|
}
|
|
677
797
|
else if (Array.isArray(value)) {
|
|
678
798
|
return {
|
|
679
|
-
value: value.map((v) => this.
|
|
799
|
+
value: value.map((v) => this.convertJSValueToDIFValueContainer(v)),
|
|
680
800
|
};
|
|
681
801
|
}
|
|
682
802
|
else if (value instanceof Map) {
|
|
683
|
-
const map = value
|
|
684
|
-
|
|
685
|
-
this.
|
|
803
|
+
const map = value
|
|
804
|
+
.entries().map(([k, v]) => [
|
|
805
|
+
this.convertJSValueToDIFValueContainer(k),
|
|
806
|
+
this.convertJSValueToDIFValueContainer(v),
|
|
686
807
|
]).toArray();
|
|
687
808
|
return {
|
|
688
809
|
type: CoreTypeAddress.map,
|
|
@@ -692,14 +813,112 @@ export class DIFHandler {
|
|
|
692
813
|
else if (typeof value === "object") {
|
|
693
814
|
const map = {};
|
|
694
815
|
for (const [key, val] of Object.entries(value)) {
|
|
695
|
-
map[key] = this.
|
|
816
|
+
map[key] = this.convertJSValueToDIFValueContainer(val);
|
|
696
817
|
}
|
|
697
818
|
return {
|
|
698
|
-
type: CoreTypeAddress.map,
|
|
699
819
|
value: map,
|
|
700
820
|
};
|
|
701
821
|
}
|
|
702
822
|
throw new Error("Unsupported type for conversion to DIFValue");
|
|
703
823
|
}
|
|
824
|
+
/**
|
|
825
|
+
* Instance method wrapper for static convertJSValueToDIFValueContainer
|
|
826
|
+
* Converts a given JS value to its DIFValueContainer representation.
|
|
827
|
+
* @param value
|
|
828
|
+
*/
|
|
829
|
+
convertJSValueToDIFValueContainer(value) {
|
|
830
|
+
return DIFHandler.convertJSValueToDIFValueContainer(value, this);
|
|
831
|
+
}
|
|
832
|
+
/** DIF update handler utilities */
|
|
833
|
+
/**
|
|
834
|
+
* Triggers a 'set' update for the given pointer address, key and value.
|
|
835
|
+
*/
|
|
836
|
+
triggerSet(pointerAddress, key, value) {
|
|
837
|
+
const difKey = this.convertJSValueToDIFValueContainer(key);
|
|
838
|
+
const difValue = this.convertJSValueToDIFValueContainer(value);
|
|
839
|
+
const update = {
|
|
840
|
+
kind: DIFUpdateKind.Set,
|
|
841
|
+
key: { kind: "value", value: difKey },
|
|
842
|
+
value: difValue,
|
|
843
|
+
};
|
|
844
|
+
console.log("Triggering set update", update);
|
|
845
|
+
this.updateReference(pointerAddress, update);
|
|
846
|
+
}
|
|
847
|
+
/**
|
|
848
|
+
* Triggers a 'set' update for the given pointer address, index and value.
|
|
849
|
+
*/
|
|
850
|
+
triggerIndexSet(pointerAddress, index, value) {
|
|
851
|
+
if (typeof index !== "bigint" && !Number.isInteger(index)) {
|
|
852
|
+
throw new Error("Index must be a non-negative integer");
|
|
853
|
+
}
|
|
854
|
+
const difValue = this.convertJSValueToDIFValueContainer(value);
|
|
855
|
+
const update = {
|
|
856
|
+
kind: DIFUpdateKind.Set,
|
|
857
|
+
key: { kind: "index", value: Number(index) },
|
|
858
|
+
value: difValue,
|
|
859
|
+
};
|
|
860
|
+
console.log("Triggering index set update", update);
|
|
861
|
+
this.updateReference(pointerAddress, update);
|
|
862
|
+
}
|
|
863
|
+
/**
|
|
864
|
+
* Triggers an 'append' update for the given pointer address and value.
|
|
865
|
+
*/
|
|
866
|
+
triggerAppend(pointerAddress, value) {
|
|
867
|
+
const difValue = this.convertJSValueToDIFValueContainer(value);
|
|
868
|
+
const update = {
|
|
869
|
+
kind: DIFUpdateKind.Append,
|
|
870
|
+
value: difValue,
|
|
871
|
+
};
|
|
872
|
+
console.log("Triggering append update", update);
|
|
873
|
+
this.updateReference(pointerAddress, update);
|
|
874
|
+
}
|
|
875
|
+
/**
|
|
876
|
+
* Triggers a 'replace' update for the given pointer address and key.
|
|
877
|
+
*/
|
|
878
|
+
triggerReplace(pointerAddress, value) {
|
|
879
|
+
const difValue = this.convertJSValueToDIFValueContainer(value);
|
|
880
|
+
const update = {
|
|
881
|
+
kind: DIFUpdateKind.Replace,
|
|
882
|
+
value: difValue,
|
|
883
|
+
};
|
|
884
|
+
console.log("Triggering replace update", update);
|
|
885
|
+
this.updateReference(pointerAddress, update);
|
|
886
|
+
}
|
|
887
|
+
/**
|
|
888
|
+
* Triggers a 'delete' update for the given pointer address and key.
|
|
889
|
+
*/
|
|
890
|
+
triggerDelete(pointerAddress, key) {
|
|
891
|
+
const difKey = this.convertJSValueToDIFValueContainer(key);
|
|
892
|
+
const update = {
|
|
893
|
+
kind: DIFUpdateKind.Delete,
|
|
894
|
+
key: { kind: "value", value: difKey },
|
|
895
|
+
};
|
|
896
|
+
console.log("Triggering delete update", update);
|
|
897
|
+
this.updateReference(pointerAddress, update);
|
|
898
|
+
}
|
|
899
|
+
/**
|
|
900
|
+
* Triggers a 'clear' update for the given pointer address.
|
|
901
|
+
*/
|
|
902
|
+
triggerClear(pointerAddress) {
|
|
903
|
+
const update = {
|
|
904
|
+
kind: DIFUpdateKind.Clear,
|
|
905
|
+
};
|
|
906
|
+
console.log("Triggering clear update", update);
|
|
907
|
+
this.updateReference(pointerAddress, update);
|
|
908
|
+
}
|
|
909
|
+
/**
|
|
910
|
+
* Triggers a 'list splice' update for the given pointer address.
|
|
911
|
+
*/
|
|
912
|
+
triggerListSplice(pointerAddress, start, deleteCount, items) {
|
|
913
|
+
const difItems = items.map((item) => this.convertJSValueToDIFValueContainer(item));
|
|
914
|
+
const update = {
|
|
915
|
+
kind: DIFUpdateKind.ListSplice,
|
|
916
|
+
start,
|
|
917
|
+
delete_count: deleteCount,
|
|
918
|
+
items: difItems,
|
|
919
|
+
};
|
|
920
|
+
console.log("Triggering list splice update", update);
|
|
921
|
+
this.updateReference(pointerAddress, update);
|
|
922
|
+
}
|
|
704
923
|
}
|
|
705
|
-
_DIFHandler_runtime = new WeakMap(), _DIFHandler_handle = new WeakMap(), _DIFHandler_transceiver_id = new WeakMap(), _DIFHandler_cache = new WeakMap(), _DIFHandler_observers = new WeakMap();
|
|
924
|
+
_DIFHandler_runtime = new WeakMap(), _DIFHandler_handle = new WeakMap(), _DIFHandler_transceiver_id = new WeakMap(), _DIFHandler_cache = new WeakMap(), _DIFHandler_proxyMapping = new WeakMap(), _DIFHandler_referenceMetadata = new WeakMap(), _DIFHandler_observers = new WeakMap(), _DIFHandler_type_registry = new WeakMap();
|