@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.
Files changed (56) hide show
  1. package/esm/datex-core/datex_core_js.internal.d.ts +248 -264
  2. package/esm/datex-core/datex_core_js.internal.d.ts.map +1 -1
  3. package/esm/datex-core/datex_core_js.internal.js +584 -547
  4. package/esm/datex-core/datex_core_js.js +7 -3
  5. package/esm/datex-core/datex_core_js.wasm +0 -0
  6. package/esm/datex-core/wasm_url.node.js +1 -1
  7. package/esm/default.d.ts +8 -0
  8. package/esm/default.d.ts.map +1 -1
  9. package/esm/default.js +8 -0
  10. package/esm/deno.json +5 -3
  11. package/esm/dif/core.d.ts +5 -3
  12. package/esm/dif/core.d.ts.map +1 -1
  13. package/esm/dif/core.js +7 -5
  14. package/esm/dif/definitions.d.ts +45 -34
  15. package/esm/dif/definitions.d.ts.map +1 -1
  16. package/esm/dif/definitions.js +14 -9
  17. package/esm/dif/dif-handler.d.ts +125 -34
  18. package/esm/dif/dif-handler.d.ts.map +1 -1
  19. package/esm/dif/dif-handler.js +366 -159
  20. package/esm/dif/display.d.ts +3 -3
  21. package/esm/dif/display.d.ts.map +1 -1
  22. package/esm/dif/display.js +5 -5
  23. package/esm/dif/js-lib.d.ts +8 -0
  24. package/esm/dif/js-lib.d.ts.map +1 -0
  25. package/esm/dif/js-lib.js +3 -0
  26. package/esm/dif/mod.d.ts +5 -1
  27. package/esm/dif/mod.d.ts.map +1 -1
  28. package/esm/dif/mod.js +5 -1
  29. package/esm/dif/type-registry.d.ts +80 -0
  30. package/esm/dif/type-registry.d.ts.map +1 -0
  31. package/esm/dif/type-registry.js +166 -0
  32. package/esm/global.d.ts +2 -0
  33. package/esm/global.d.ts.map +1 -0
  34. package/esm/global.js +1 -0
  35. package/esm/{runtime/special-core-types.d.ts → lib/special-core-types/endpoint.d.ts} +1 -1
  36. package/esm/lib/special-core-types/endpoint.d.ts.map +1 -0
  37. package/esm/mod.d.ts +16 -10
  38. package/esm/mod.d.ts.map +1 -1
  39. package/esm/mod.js +16 -10
  40. package/esm/network/interface-impls/base.d.ts +9 -1
  41. package/esm/network/interface-impls/base.d.ts.map +1 -1
  42. package/esm/refs/ref.d.ts.map +1 -1
  43. package/esm/refs/ref.js +1 -2
  44. package/esm/runtime/runtime.d.ts +19 -49
  45. package/esm/runtime/runtime.d.ts.map +1 -1
  46. package/esm/runtime/runtime.js +32 -7
  47. package/esm/utils/exceptions.d.ts +4 -0
  48. package/esm/utils/exceptions.d.ts.map +1 -0
  49. package/esm/utils/exceptions.js +9 -0
  50. package/esm/utils/js-runtime-compat/js-runtime.d.ts.map +1 -1
  51. package/package.json +1 -1
  52. package/esm/dif/builders.d.ts +0 -16
  53. package/esm/dif/builders.d.ts.map +0 -1
  54. package/esm/dif/builders.js +0 -28
  55. package/esm/runtime/special-core-types.d.ts.map +0 -1
  56. /package/esm/{runtime/special-core-types.js → lib/special-core-types/endpoint.js} +0 -0
@@ -1,8 +1,12 @@
1
1
  import * as imports from "./datex_core_js.internal.js";
2
- import { runtimeInterface, detectRuntime } from "../utils/js-runtime-compat/js-runtime.js";
2
+ import {
3
+ detectRuntime,
4
+ runtimeInterface,
5
+ } from "../utils/js-runtime-compat/js-runtime.js";
3
6
 
4
7
  let wasmUrl;
5
- if (detectRuntime() == "browser") {
8
+ const isVite = !!import.meta.env?.MODE;
9
+ if (detectRuntime() == "browser" && isVite) {
6
10
  wasmUrl = (await import("./wasm_url.node.js")).default;
7
11
  } else {
8
12
  wasmUrl = new URL("datex_core_js.wasm", import.meta.url);
@@ -14,4 +18,4 @@ const wasm = (await runtimeInterface.instantiateWebAssembly(wasmUrl, {
14
18
  export * from "./datex_core_js.internal.js";
15
19
  import { __wbg_set_wasm } from "./datex_core_js.internal.js";
16
20
  __wbg_set_wasm(wasm.exports);
17
- wasm.exports.__wbindgen_start();
21
+ wasm.exports.__wbindgen_start();
Binary file
@@ -1 +1 @@
1
- export { default } from "./datex_core_js.wasm?url";
1
+ export { default } from "./datex_core_js.wasm?url";
package/esm/default.d.ts CHANGED
@@ -2,6 +2,14 @@
2
2
  * @module default.ts
3
3
  * @description
4
4
  * This module exports an instance of the DATEX runtime.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * import { Datex } from "@unyt/datex/default";
9
+ *
10
+ * // Use the Datex runtime instance
11
+ * const result = await Datex.execute("@example :: 1 + 2");
12
+ * ```
5
13
  */
6
14
  import { Runtime } from "./runtime/runtime.js";
7
15
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../src/default.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,qBAAqB,CAAC;AAG7B,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAa/C;;GAEG;AACH,eAAO,MAAM,KAAK,EAAE,OAElB,CAAC"}
1
+ {"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../src/default.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,qBAAqB,CAAC;AAG7B,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAa/C;;GAEG;AACH,eAAO,MAAM,KAAK,EAAE,OAElB,CAAC"}
package/esm/default.js CHANGED
@@ -2,6 +2,14 @@
2
2
  * @module default.ts
3
3
  * @description
4
4
  * This module exports an instance of the DATEX runtime.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * import { Datex } from "@unyt/datex/default";
9
+ *
10
+ * // Use the Datex runtime instance
11
+ * const result = await Datex.execute("@example :: 1 + 2");
12
+ * ```
5
13
  */
6
14
  import { Runtime } from "./runtime/runtime.js";
7
15
  /**
package/esm/deno.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unyt/datex",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./src/mod.ts",
@@ -39,14 +39,16 @@
39
39
  "imports": {
40
40
  "@david/path": "jsr:@david/path@^0.2.0",
41
41
  "@deno/dnt": "jsr:@deno/dnt@^0.42.1",
42
- "@deno/wasmbuild": "https://jsr.io/@deno/wasmbuild/0.19.3/lib/commands/build_command.ts",
42
+ "@deno/wasmbuild": "https://jsr.io/@deno/wasmbuild/0.20.0/lib/commands/build_command.ts",
43
43
  "@qnighy/dedent": "jsr:@qnighy/dedent@^0.1.2",
44
44
  "@std/assert": "jsr:@std/assert@^1.0.15",
45
45
  "@std/cli": "jsr:@std/cli@^1.0.23",
46
46
  "@std/encoding": "jsr:@std/encoding@^1.0.10",
47
47
  "@std/fmt": "jsr:@std/fmt@^1.0.8",
48
+ "@std/fs": "jsr:@std/fs@^1.0.19",
48
49
  "@std/uuid": "jsr:@std/uuid@^1.0.9",
49
- "@unyt/speck": "jsr:@unyt/speck@^0.0.10"
50
+ "@unyt/speck": "jsr:@unyt/speck@^0.0.10",
51
+ "datex-core-js/": "./src/"
50
52
  },
51
53
  "test": {
52
54
  "exclude": [
package/esm/dif/core.d.ts CHANGED
@@ -5,15 +5,18 @@ export declare const CoreTypeAddress: {
5
5
  readonly null: "010000";
6
6
  readonly type: "020000";
7
7
  readonly boolean: "030000";
8
+ readonly callable: "050000";
8
9
  readonly endpoint: "070000";
9
10
  readonly text: "080000";
10
11
  readonly list: "090000";
11
12
  readonly unit: "0b0000";
12
13
  readonly map: "0c0000";
14
+ readonly never: "0d0000";
15
+ readonly unknown: "0e0000";
13
16
  readonly decimal: "2c0100";
14
17
  readonly decimal_f32: "2d0100";
15
18
  readonly decimal_f64: "2e0100";
16
- readonly decimal_big: "2f0100";
19
+ readonly decimal_dbig: "2f0100";
17
20
  readonly integer: "640000";
18
21
  readonly integer_u8: "650000";
19
22
  readonly integer_u16: "660000";
@@ -25,7 +28,7 @@ export declare const CoreTypeAddress: {
25
28
  readonly integer_i32: "6c0000";
26
29
  readonly integer_i64: "6d0000";
27
30
  readonly integer_i128: "6e0000";
28
- readonly integer_big: "6f0000";
31
+ readonly integer_ibig: "6f0000";
29
32
  };
30
33
  /**
31
34
  * Type representing the unique pointer addresses of core types.
@@ -36,7 +39,6 @@ export type CoreTypeAddress = typeof CoreTypeAddress[keyof typeof CoreTypeAddres
36
39
  */
37
40
  export declare const CoreTypeAddressRanges: {
38
41
  readonly small_unsigned_integers: Set<"650000" | "660000" | "670000" | "680000" | "690000">;
39
- readonly big_unsigned_integers: Set<"6f0000">;
40
42
  readonly small_signed_integers: Set<"6a0000" | "6b0000" | "6c0000" | "6d0000" | "6e0000">;
41
43
  readonly big_signed_integers: Set<"6f0000">;
42
44
  readonly decimals: Set<"2c0100" | "2d0100" | "2e0100" | "2f0100">;
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/dif/core.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;CAyBlB,CAAC;AACX;;GAEG;AACH,MAAM,MAAM,eAAe,GACvB,OAAO,eAAe,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AAEzD;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;CAuBxB,CAAC"}
1
+ {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/dif/core.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BlB,CAAC;AACX;;GAEG;AACH,MAAM,MAAM,eAAe,GACvB,OAAO,eAAe,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AAEzD;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;CAsBxB,CAAC"}
package/esm/dif/core.js CHANGED
@@ -5,15 +5,18 @@ export const CoreTypeAddress = {
5
5
  null: "010000",
6
6
  type: "020000",
7
7
  boolean: "030000",
8
+ callable: "050000",
8
9
  endpoint: "070000",
9
10
  text: "080000",
10
11
  list: "090000",
11
12
  unit: "0b0000",
12
13
  map: "0c0000",
14
+ never: "0d0000",
15
+ unknown: "0e0000",
13
16
  decimal: "2c0100",
14
17
  decimal_f32: "2d0100",
15
18
  decimal_f64: "2e0100",
16
- decimal_big: "2f0100",
19
+ decimal_dbig: "2f0100",
17
20
  integer: "640000",
18
21
  integer_u8: "650000",
19
22
  integer_u16: "660000",
@@ -25,7 +28,7 @@ export const CoreTypeAddress = {
25
28
  integer_i32: "6c0000",
26
29
  integer_i64: "6d0000",
27
30
  integer_i128: "6e0000",
28
- integer_big: "6f0000",
31
+ integer_ibig: "6f0000",
29
32
  };
30
33
  /**
31
34
  * Mapping of core type address ranges for categorization.
@@ -38,7 +41,6 @@ export const CoreTypeAddressRanges = {
38
41
  CoreTypeAddress.integer_u64,
39
42
  CoreTypeAddress.integer_u128,
40
43
  ]),
41
- big_unsigned_integers: new Set([CoreTypeAddress.integer_big]),
42
44
  small_signed_integers: new Set([
43
45
  CoreTypeAddress.integer_i8,
44
46
  CoreTypeAddress.integer_i16,
@@ -46,11 +48,11 @@ export const CoreTypeAddressRanges = {
46
48
  CoreTypeAddress.integer_i64,
47
49
  CoreTypeAddress.integer_i128,
48
50
  ]),
49
- big_signed_integers: new Set([CoreTypeAddress.integer_big]),
51
+ big_signed_integers: new Set([CoreTypeAddress.integer_ibig]),
50
52
  decimals: new Set([
51
53
  CoreTypeAddress.decimal,
52
54
  CoreTypeAddress.decimal_f32,
53
55
  CoreTypeAddress.decimal_f64,
54
- CoreTypeAddress.decimal_big,
56
+ CoreTypeAddress.decimal_dbig,
55
57
  ]),
56
58
  };
@@ -13,26 +13,26 @@ export type DIFPointerAddress = string;
13
13
  * which may optionally include type information.
14
14
  */
15
15
  export type DIFValue = {
16
- type?: DIFTypeContainer;
16
+ type?: DIFTypeDefinition;
17
17
  value: DIFRepresentationValue;
18
18
  };
19
- /**
20
- * A DATEX value or pointer address representation in the DIF format.
21
- */
22
- export type DIFContainer = DIFValue | DIFPointerAddress;
23
19
  /**
24
20
  * Mapping of DIF type kinds.
25
21
  */
26
- export declare const DIFTypeKinds: {
27
- readonly Structural: 0;
28
- readonly Reference: 1;
29
- readonly Intersection: 2;
30
- readonly Union: 3;
31
- readonly Unit: 4;
32
- readonly Function: 5;
22
+ export declare const DIFTypeDefinitionKind: {
23
+ readonly Structural: 1;
24
+ readonly Reference: 2;
25
+ readonly Type: 3;
26
+ readonly Intersection: 4;
27
+ readonly Union: 5;
28
+ readonly ImplType: 6;
29
+ readonly Unit: 7;
30
+ readonly Never: 8;
31
+ readonly Unknown: 9;
32
+ readonly Function: 10;
33
33
  };
34
34
  /** A DIF type kind. */
35
- export type DIFTypeKind = typeof DIFTypeKinds[keyof typeof DIFTypeKinds];
35
+ export type DIFTypeDefinitionKind = typeof DIFTypeDefinitionKind[keyof typeof DIFTypeDefinitionKind];
36
36
  /**
37
37
  * Representation of reference mutability (mutable or immutable) in DIF.
38
38
  */
@@ -42,25 +42,27 @@ export declare const DIFReferenceMutability: {
42
42
  };
43
43
  /** A DIF reference mutability. */
44
44
  export type DIFReferenceMutability = typeof DIFReferenceMutability[keyof typeof DIFReferenceMutability];
45
- /** A DIF type definition based on its kind. */
46
- export type DIFTypeDefinition<Kind extends DIFTypeKind = DIFTypeKind> = Kind extends typeof DIFTypeKinds.Structural ? DIFValue : Kind extends typeof DIFTypeKinds.Reference ? DIFPointerAddress : Kind extends typeof DIFTypeKinds.Intersection ? Array<DIFTypeContainer> : Kind extends typeof DIFTypeKinds.Union ? Array<DIFTypeContainer> : Kind extends typeof DIFTypeKinds.Unit ? null : Kind extends typeof DIFTypeKinds.Function ? unknown : never;
47
- /** A DIF type representation. */
48
- export type DIFType<Kind extends DIFTypeKind = DIFTypeKind> = {
45
+ export type DIFType = DIFPointerAddress | {
49
46
  name?: string;
50
- kind: Kind;
51
- def: DIFTypeDefinition<Kind>;
52
47
  mut?: DIFReferenceMutability;
48
+ def: DIFTypeDefinition;
49
+ };
50
+ /** A DIF type definition based on its kind. */
51
+ export type DIFTypeDefinitionInner<Kind extends DIFTypeDefinitionKind = DIFTypeDefinitionKind> = Kind extends typeof DIFTypeDefinitionKind.Structural ? DIFValue : Kind extends typeof DIFTypeDefinitionKind.Reference ? DIFPointerAddress : Kind extends typeof DIFTypeDefinitionKind.Intersection ? Array<DIFType> : Kind extends typeof DIFTypeDefinitionKind.Union ? Array<DIFType> : Kind extends typeof DIFTypeDefinitionKind.Unit ? null : Kind extends typeof DIFTypeDefinitionKind.Function ? unknown : Kind extends typeof DIFTypeDefinitionKind.ImplType ? [DIFType, Array<DIFPointerAddress>] : never;
52
+ /** A DIF type definition representation. */
53
+ export type DIFTypeDefinition<Kind extends DIFTypeDefinitionKind = DIFTypeDefinitionKind> = Kind extends typeof DIFTypeDefinitionKind.Reference ? DIFPointerAddress : VerboseDIFTypeDefinition<Kind>;
54
+ type VerboseDIFTypeDefinition<Kind extends DIFTypeDefinitionKind = DIFTypeDefinitionKind> = {
55
+ kind: Kind;
56
+ def: DIFTypeDefinitionInner<Kind>;
53
57
  };
54
58
  /** A representation of a reference in DIF. */
55
59
  export type DIFReference = {
56
60
  value: DIFValueContainer;
57
- allowed_type: DIFTypeContainer;
61
+ allowed_type: DIFTypeDefinition;
58
62
  mut: DIFReferenceMutability;
59
63
  };
60
64
  /** A representation of a value or pointer address in DIF. */
61
65
  export type DIFValueContainer = DIFValue | DIFPointerAddress;
62
- /** A representation of a type or type pointer address in DIF. */
63
- export type DIFTypeContainer = DIFType | DIFPointerAddress;
64
66
  /** A DIF object, mapping string keys to DIF value containers. */
65
67
  export type DIFObject = Record<string, DIFValueContainer>;
66
68
  /** A DIF array, containing DIF value containers. */
@@ -87,30 +89,38 @@ export type DIFProperty = {
87
89
  */
88
90
  export declare const DIFUpdateKind: {
89
91
  readonly Replace: "replace";
90
- readonly Push: "push";
92
+ readonly Append: "append";
91
93
  readonly Set: "set";
92
- readonly Remove: "remove";
94
+ readonly Delete: "delete";
93
95
  readonly Clear: "clear";
96
+ readonly ListSplice: "list_splice";
94
97
  };
95
98
  /** A DIF update kind. */
96
99
  export type DIFUpdateKind = typeof DIFUpdateKind[keyof typeof DIFUpdateKind];
97
100
  /** Different kinds of updates that can be applied to a DIF value. */
98
- export type DIFUpdateData = {
99
- kind: typeof DIFUpdateKind.Replace;
101
+ export type DIFUpdateBaseData<Kind extends DIFUpdateKind> = {
102
+ kind: Kind;
103
+ };
104
+ export type DIFUpdateDataReplace = DIFUpdateBaseData<typeof DIFUpdateKind.Replace> & {
100
105
  value: DIFValueContainer;
101
- } | {
102
- kind: typeof DIFUpdateKind.Push;
106
+ };
107
+ export type DIFUpdateDataPush = DIFUpdateBaseData<typeof DIFUpdateKind.Append> & {
103
108
  value: DIFValueContainer;
104
- } | {
105
- kind: typeof DIFUpdateKind.Remove;
109
+ };
110
+ export type DIFUpdateDataDelete = DIFUpdateBaseData<typeof DIFUpdateKind.Delete> & {
106
111
  key: DIFProperty;
107
- } | {
108
- kind: typeof DIFUpdateKind.Set;
112
+ };
113
+ export type DIFUpdateDataSet = DIFUpdateBaseData<typeof DIFUpdateKind.Set> & {
109
114
  key: DIFProperty;
110
115
  value: DIFValueContainer;
111
- } | {
112
- kind: typeof DIFUpdateKind.Clear;
113
116
  };
117
+ export type DIFUpdateDataClear = DIFUpdateBaseData<typeof DIFUpdateKind.Clear>;
118
+ export type DIFUpdateDataListSplice = DIFUpdateBaseData<typeof DIFUpdateKind.ListSplice> & {
119
+ start: number;
120
+ delete_count: number;
121
+ items: DIFValueContainer[];
122
+ };
123
+ export type DIFUpdateData = DIFUpdateDataReplace | DIFUpdateDataPush | DIFUpdateDataDelete | DIFUpdateDataSet | DIFUpdateDataClear | DIFUpdateDataListSplice;
114
124
  /** A DIF update struct, associating a source ID with update data. */
115
125
  export type DIFUpdate = {
116
126
  source_id: number;
@@ -120,4 +130,5 @@ export type DIFUpdate = {
120
130
  export type ObserveOptions = {
121
131
  relay_own_updates: boolean;
122
132
  };
133
+ export {};
123
134
  //# sourceMappingURL=definitions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.d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O,aAAa,CAAC,MAAM,CAAC,GAC9C;IACE,KAAK,EAAE,iBAAiB,CAAC;CAC5B,CAAC;AACN,MAAM,MAAM,mBAAmB,GACzB,iBAAiB,CAAC,OAAO,aAAa,CAAC,MAAM,CAAC,GAC9C;IACE,GAAG,EAAE,WAAW,CAAC;CACpB,CAAC;AACN,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,OAAO,aAAa,CAAC,GAAG,CAAC,GAAG;IACzE,GAAG,EAAE,WAAW,CAAC;IACjB,KAAK,EAAE,iBAAiB,CAAC;CAC5B,CAAC;AACF,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;AAC/E,MAAM,MAAM,uBAAuB,GAC7B,iBAAiB,CAAC,OAAO,aAAa,CAAC,UAAU,CAAC,GAClD;IACE,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,iBAAiB,EAAE,CAAC;CAC9B,CAAC;AAEN,MAAM,MAAM,aAAa,GACnB,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"}
@@ -6,13 +6,17 @@
6
6
  /**
7
7
  * Mapping of DIF type kinds.
8
8
  */
9
- export const DIFTypeKinds = {
10
- Structural: 0,
11
- Reference: 1,
12
- Intersection: 2,
13
- Union: 3,
14
- Unit: 4,
15
- Function: 5,
9
+ export const DIFTypeDefinitionKind = {
10
+ Structural: 1,
11
+ Reference: 2,
12
+ Type: 3,
13
+ Intersection: 4,
14
+ Union: 5,
15
+ ImplType: 6,
16
+ Unit: 7,
17
+ Never: 8,
18
+ Unknown: 9,
19
+ Function: 10,
16
20
  };
17
21
  /**
18
22
  * Representation of reference mutability (mutable or immutable) in DIF.
@@ -26,8 +30,9 @@ export const DIFReferenceMutability = {
26
30
  */
27
31
  export const DIFUpdateKind = {
28
32
  Replace: "replace",
29
- Push: "push",
33
+ Append: "append",
30
34
  Set: "set",
31
- Remove: "remove",
35
+ Delete: "delete",
32
36
  Clear: "clear",
37
+ ListSplice: "list_splice",
33
38
  };
@@ -1,10 +1,19 @@
1
1
  import type { JSRuntime, RuntimeDIFHandle } from "../datex-core.js";
2
2
  import { Ref } from "../refs/ref.js";
3
- import { type DIFContainer, type DIFPointerAddress, DIFReferenceMutability, type DIFTypeContainer, type DIFUpdate, type DIFUpdateData, type DIFValue, type DIFValueContainer, type ObserveOptions } from "./definitions.js";
3
+ import { type DIFPointerAddress, type DIFProperty, DIFReferenceMutability, type DIFTypeDefinition, type DIFUpdate, type DIFUpdateData, type DIFValue, type DIFValueContainer, type ObserveOptions } from "./definitions.js";
4
+ import { type TypeBinding, TypeRegistry } from "./type-registry.js";
5
+ export declare const IS_PROXY_ACCESS: unique symbol;
6
+ export type CustomReferenceMetadata = Record<string | symbol, unknown> & {
7
+ [IS_PROXY_ACCESS]?: boolean;
8
+ };
9
+ export type ReferenceMetadata<M extends CustomReferenceMetadata> = {
10
+ address: string;
11
+ customMetadata: M;
12
+ };
4
13
  /**
5
14
  * The DIFHandler class provides methods to interact with the DATEX Core DIF runtime,
6
- * including executing Datex scripts, creating and managing pointers, and observing changes.
7
- * It includes a local pointer cache to optimize performance and reduce cross-language calls.
15
+ * including executing Datex scripts, creating and managing references, and observing changes.
16
+ * It includes a local reference cache to optimize performance and reduce cross-language calls.
8
17
  */
9
18
  export declare class DIFHandler {
10
19
  #private;
@@ -23,6 +32,7 @@ export declare class DIFHandler {
23
32
  * @returns The transceiver ID of the DIF client.
24
33
  */
25
34
  get _transceiver_id(): number;
35
+ get type_registry(): TypeRegistry;
26
36
  /**
27
37
  * Creates a new DIFHandler instance.
28
38
  * @param runtime - The JSRuntime instance for executing Datex scripts.
@@ -36,7 +46,7 @@ export declare class DIFHandler {
36
46
  * @returns A Promise that resolves to the execution result as a DIFContainer.
37
47
  * @throws If an error occurs during execution.
38
48
  */
39
- executeDIF(datexScript: string, values?: unknown[] | null): Promise<DIFContainer>;
49
+ executeDIF(datexScript: string, values?: unknown[] | null): Promise<DIFValueContainer>;
40
50
  /**
41
51
  * Executes a Datex script synchronously and returns the result as a DIFContainer.
42
52
  * @param datexScript - The Datex script source code to execute.
@@ -44,29 +54,21 @@ export declare class DIFHandler {
44
54
  * @returns The execution result as a DIFContainer.
45
55
  * @throws If an error occurs during execution.
46
56
  */
47
- executeSyncDIF(datexScript: string, values?: unknown[] | null): DIFContainer;
57
+ executeSyncDIF(datexScript: string, values?: unknown[] | null): DIFValueContainer;
48
58
  /**
49
- * Creates a new pointer for the specified value.
50
- * @param difValue - The DIFValue value to create a pointer for.
59
+ * Creates a new pointer for the specified DIF value.
60
+ * @param difValueContainer - The DIFValueContainer value to create a pointer for.
51
61
  * @param allowedType - The allowed type for the pointer.
52
62
  * @param mutability - The mutability of the pointer.
53
63
  * @returns The created pointer address.
54
64
  */
55
- createPointer(difValue: DIFValue, allowedType: (DIFTypeContainer | null) | undefined, mutability: DIFReferenceMutability): string;
56
- /**
57
- * Creates a new pointer that points to an existing address.
58
- * @param address - The address to create a reference pointer for.
59
- * @param allowedType - The allowed type for the pointer.
60
- * @param mutability - The mutability of the pointer.
61
- * @returns A Promise that resolves to the created pointer address.
62
- */
63
- createRefPointer(address: string, allowedType: (DIFTypeContainer | null) | undefined, mutability: DIFReferenceMutability): string;
65
+ createReferenceFromDIFValue(difValueContainer: DIFValueContainer, allowedType: (DIFTypeDefinition | null) | undefined, mutability: DIFReferenceMutability): string;
64
66
  /**
65
67
  * Updates the DIF value at the specified address.
66
68
  * @param address - The address of the DIF value to update.
67
69
  * @param dif - The DIFUpdate object containing the update information.
68
70
  */
69
- updatePointer(address: string, dif: DIFUpdateData): void;
71
+ updateReference(address: string, dif: DIFUpdateData): void;
70
72
  /**
71
73
  * Registers an observer callback for changes to the DIF value at the specified address
72
74
  * directly on the DATEX core runtime.
@@ -105,7 +107,7 @@ export declare class DIFHandler {
105
107
  * @param address - The address of the DIF value being observed.
106
108
  * @param observerId - The observer ID returned by the observePointer method.
107
109
  */
108
- unobservePointerBindDirect(address: string, observerId: number): void;
110
+ unobserveReferenceBindDirect(address: string, observerId: number): void;
109
111
  /**
110
112
  * Registers a local observer callback for changes to the DIF value at the specified address.
111
113
  * The callback will be invoked whenever the value at the address is updated.
@@ -169,6 +171,10 @@ export declare class DIFHandler {
169
171
  * @throws If the resolution would require asynchronous operations.
170
172
  */
171
173
  resolveDIFValueContainerSync<T extends unknown>(value: DIFValueContainer): T;
174
+ /**
175
+ * Resolves a DIFProperty to its corresponding JS value.
176
+ */
177
+ resolveDIFPropertySync<T extends unknown>(property: DIFProperty): T;
172
178
  /**
173
179
  * Resolves a pointer address to its corresponding JS value.
174
180
  * If the pointer address is not yet loaded in memory, it returns a Promise that resolves to the value.
@@ -186,49 +192,134 @@ export declare class DIFHandler {
186
192
  * @throws If the resolution would require asynchronous operations.
187
193
  */
188
194
  resolvePointerAddressSync<T extends unknown>(address: string): T;
195
+ /**
196
+ * Retrieves the original value from a proxy value if available
197
+ * @param proxy
198
+ * @returns
199
+ */
200
+ getOriginalValueFromProxy<T extends WeakKey>(proxy: T): T | null;
201
+ /**
202
+ * Retrieves the proxy value for a given original value if available
203
+ * @param original
204
+ * @returns
205
+ */
206
+ getProxyValueFromOriginal<T extends WeakKey>(original: T): T | null;
189
207
  /**
190
208
  * Converts an array of JS values to an array of DIFValues.
191
209
  * If the input is null, it returns null.
192
210
  * @param values
193
211
  */
194
- convertToDIFValues<T extends unknown[]>(values: T | null): DIFValue[] | null;
212
+ convertToDIFValues<T extends unknown[]>(values: T | null): DIFValueContainer[] | null;
195
213
  /**
196
214
  * Returns true if the given address is within the specified address range.
197
215
  */
198
216
  protected isPointerAddressInAdresses(address: DIFPointerAddress, range: Set<string>): boolean;
199
217
  /**
200
- * Initializes a pointer with the given value and mutability, by
218
+ * Initializes a reference with the given value and mutability, by
201
219
  * adding a proxy wrapper if necessary, and setting up observation and caching on the JS side.
202
220
  */
203
- protected initPointer<T>(ptrAddress: string, value: T, mutability: DIFReferenceMutability, allowedType?: DIFTypeContainer | null): T | Ref<T>;
221
+ protected initReference<T>(pointerAddress: string, value: T, mutability: DIFReferenceMutability, allowedType?: DIFTypeDefinition | null): T | Ref<T>;
204
222
  /**
205
223
  * Handles a pointer update received from the DATEX core runtime.
224
+ * for non-primitive values.
206
225
  * If the pointer is cached and has a dereferenceable value, it updates the value.
207
- * @param address - The address of the pointer being updated.
226
+ * @param pointerAddress - The address of the pointer being updated.
208
227
  * @param update - The DIFUpdateData containing the update information.
209
228
  * @returns True if the pointer was found and updated, false otherwise.
210
229
  */
211
- protected handlePointerUpdate(address: string, update: DIFUpdateData): boolean;
230
+ protected handlePointerUpdate<T extends WeakKey>(pointerAddress: string, value: T, update: DIFUpdateData, typeBinding: TypeBinding<T> | null): boolean;
212
231
  /**
213
- * Caches the given pointer value with the given address in the JS side cache.
214
- * The pointer must already be wrapped if necessary.
232
+ * Handles a pointer update received from the DATEX core runtime.
233
+ * for primitive values (typeBinding not supported).
234
+ * If the pointer is cached and has a dereferenceable value, it updates the value.
235
+ * @param pointerAddress - The address of the pointer being updated.
236
+ * @param update - The DIFUpdateData containing the update information.
237
+ * @returns True if the pointer was found and updated, false otherwise.
215
238
  */
216
- protected cacheWrappedPointerValue(address: string, value: WeakKey, observerId: number | null): void;
217
- protected getCachedPointer(address: string): WeakKey | undefined;
239
+ protected handlePointerUpdate<T>(pointerAddress: string, value: T, update: DIFUpdateData, typeBinding: null): boolean;
218
240
  /**
219
- * Creates a new pointer containg the given JS value.
241
+ * Caches the given reference value with the given address in the JS side cache.
242
+ * The reference must already be wrapped if necessary.
243
+ */
244
+ protected cacheWrappedReferenceValue(address: string, originalValue: unknown, proxiedValue: WeakKey, observerId: number | null, metadata?: CustomReferenceMetadata): void;
245
+ protected getCachedReference(address: string): WeakKey | undefined;
246
+ /**
247
+ * Creates a new reference containg the given JS value.
220
248
  * The returned value is a proxy object that behaves like the original object,
221
249
  * but also propagates changes between JS and the DATEX runtime.
250
+ * If a reference for the given value already exists, an error is thrown.
251
+ */
252
+ createTransparentReference<V, M extends DIFReferenceMutability = typeof DIFReferenceMutability.Mutable>(value: V, allowedType?: DIFTypeDefinition | null, mutability?: M): PointerOut<V, M>;
253
+ protected isPrimitiveValue(value: unknown): value is null | undefined | boolean | number | bigint | string | symbol;
254
+ protected isWeakKey(value: unknown): value is WeakKey;
255
+ /**
256
+ * Wraps a given JS value in a Ref proxy if necessary.
222
257
  */
223
- createPointerFromJSValue(value: unknown, allowedType?: DIFTypeContainer | null, mutability?: DIFReferenceMutability): unknown | Ref<unknown>;
224
- protected wrapJSValueInProxy<T>(value: T, pointerAddress: string, _type?: DIFTypeContainer | null): (T | Ref<unknown>) & WeakKey;
258
+ protected wrapJSValue<T>(value: T, pointerAddress: string, _type?: DIFTypeDefinition | null): (T | Ref<unknown>) & WeakKey;
225
259
  private isRef;
226
- private proxifyJSMap;
227
260
  private wrapJSObjectInProxy;
228
- getPointerAddressForValue<T>(value: T): string | null;
229
261
  /**
230
- * Converts a given JS value to its DIFValue representation.
262
+ * Returns the pointer address for the given value if it is already cached, or null otherwise.
263
+ */
264
+ getPointerAddressForValue<T extends WeakKey>(value: T): string | null;
265
+ /**
266
+ * Returns the reference metadata for the given value if it is registered.
267
+ * The caller must ensure that the correct type M is used and the reference is already registered.
268
+ * If the reference is not found, an error is thrown.
269
+ */
270
+ getReferenceMetadataUnsafe<M extends CustomReferenceMetadata, T extends WeakKey>(value: T): ReferenceMetadata<M>;
271
+ /**
272
+ * Returns the reference metadata for the given value if it is registered, or null otherwise.
273
+ */
274
+ tryGetReferenceMetadata<M extends CustomReferenceMetadata, T extends WeakKey>(value: T): ReferenceMetadata<M> | null;
275
+ isReference(value: WeakKey): boolean;
276
+ getReferenceProxy<T extends WeakKey>(value: T): T | null;
277
+ /**
278
+ * Converts a given JS value to its DIFValueContainer representation.
279
+ */
280
+ convertJSValueToDIFValueContainer<T extends unknown>(value: T): DIFValueContainer;
281
+ /** DIF update handler utilities */
282
+ /**
283
+ * Triggers a 'set' update for the given pointer address, key and value.
284
+ */
285
+ triggerSet<K, V>(pointerAddress: string, key: K, value: V): void;
286
+ /**
287
+ * Triggers a 'set' update for the given pointer address, index and value.
288
+ */
289
+ triggerIndexSet<V>(pointerAddress: string, index: number | bigint, value: V): void;
290
+ /**
291
+ * Triggers an 'append' update for the given pointer address and value.
292
+ */
293
+ triggerAppend<V>(pointerAddress: string, value: V): void;
294
+ /**
295
+ * Triggers a 'replace' update for the given pointer address and key.
296
+ */
297
+ triggerReplace<V>(pointerAddress: string, value: V): void;
298
+ /**
299
+ * Triggers a 'delete' update for the given pointer address and key.
300
+ */
301
+ triggerDelete<K>(pointerAddress: string, key: K): void;
302
+ /**
303
+ * Triggers a 'clear' update for the given pointer address.
304
+ */
305
+ triggerClear(pointerAddress: string): void;
306
+ /**
307
+ * Triggers a 'list splice' update for the given pointer address.
231
308
  */
232
- convertJSValueToDIFValue<T extends unknown>(value: T): DIFValue;
309
+ triggerListSplice<V>(pointerAddress: string, start: number, deleteCount: number, items: V[]): void;
233
310
  }
311
+ type PrimitiveValue = string | number | boolean | bigint | symbol;
312
+ type WidenLiteral<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T extends bigint ? bigint : T extends symbol ? symbol : T;
313
+ /** A type representing an assignable reference or a plain value **/
314
+ export type AssignableRef<T> = Ref<T> | T & {
315
+ value?: T;
316
+ };
317
+ type Builtins = ((...args: unknown[]) => unknown) | Date | RegExp | Map<unknown, unknown> | Set<unknown> | WeakMap<WeakKey, unknown> | WeakSet<WeakKey> | Array<unknown>;
318
+ type IsPlainObject<T> = T extends Builtins ? false : T extends object ? true : false;
319
+ export type PointerOut<V, M extends DIFReferenceMutability> = V extends Ref<infer U> ? M extends typeof DIFReferenceMutability.Immutable ? Ref<U> : AssignableRef<U> : IsPlainObject<V> extends true ? (M extends typeof DIFReferenceMutability.Immutable ? {
320
+ readonly [K in keyof V]: V[K];
321
+ } : {
322
+ [K in keyof V]: V[K];
323
+ }) : V extends PrimitiveValue ? Ref<M extends typeof DIFReferenceMutability["Immutable"] ? V : WidenLiteral<V>> : V;
324
+ export {};
234
325
  //# sourceMappingURL=dif-handler.d.ts.map