@elaraai/east 0.0.1-beta.0

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 (251) hide show
  1. package/LICENSE.md +682 -0
  2. package/README.md +276 -0
  3. package/dist/src/analyze.d.ts +95 -0
  4. package/dist/src/analyze.d.ts.map +1 -0
  5. package/dist/src/analyze.js +1110 -0
  6. package/dist/src/analyze.js.map +1 -0
  7. package/dist/src/ast.d.ts +263 -0
  8. package/dist/src/ast.d.ts.map +1 -0
  9. package/dist/src/ast.js +151 -0
  10. package/dist/src/ast.js.map +1 -0
  11. package/dist/src/ast_to_ir.d.ts +24 -0
  12. package/dist/src/ast_to_ir.d.ts.map +1 -0
  13. package/dist/src/ast_to_ir.js +834 -0
  14. package/dist/src/ast_to_ir.js.map +1 -0
  15. package/dist/src/builtins.d.ts +18 -0
  16. package/dist/src/builtins.d.ts.map +1 -0
  17. package/dist/src/builtins.js +1105 -0
  18. package/dist/src/builtins.js.map +1 -0
  19. package/dist/src/comparison.d.ts +28 -0
  20. package/dist/src/comparison.d.ts.map +1 -0
  21. package/dist/src/comparison.js +1017 -0
  22. package/dist/src/comparison.js.map +1 -0
  23. package/dist/src/compile.d.ts +22 -0
  24. package/dist/src/compile.d.ts.map +1 -0
  25. package/dist/src/compile.js +3260 -0
  26. package/dist/src/compile.js.map +1 -0
  27. package/dist/src/containers/ref.d.ts +106 -0
  28. package/dist/src/containers/ref.d.ts.map +1 -0
  29. package/dist/src/containers/ref.js +100 -0
  30. package/dist/src/containers/ref.js.map +1 -0
  31. package/dist/src/containers/sortedmap.d.ts +165 -0
  32. package/dist/src/containers/sortedmap.d.ts.map +1 -0
  33. package/dist/src/containers/sortedmap.js +237 -0
  34. package/dist/src/containers/sortedmap.js.map +1 -0
  35. package/dist/src/containers/sortedset.d.ts +185 -0
  36. package/dist/src/containers/sortedset.d.ts.map +1 -0
  37. package/dist/src/containers/sortedset.js +312 -0
  38. package/dist/src/containers/sortedset.js.map +1 -0
  39. package/dist/src/containers/variant.d.ts +131 -0
  40. package/dist/src/containers/variant.d.ts.map +1 -0
  41. package/dist/src/containers/variant.js +68 -0
  42. package/dist/src/containers/variant.js.map +1 -0
  43. package/dist/src/datetime_format/parse.d.ts +50 -0
  44. package/dist/src/datetime_format/parse.d.ts.map +1 -0
  45. package/dist/src/datetime_format/parse.js +908 -0
  46. package/dist/src/datetime_format/parse.js.map +1 -0
  47. package/dist/src/datetime_format/print.d.ts +35 -0
  48. package/dist/src/datetime_format/print.d.ts.map +1 -0
  49. package/dist/src/datetime_format/print.js +157 -0
  50. package/dist/src/datetime_format/print.js.map +1 -0
  51. package/dist/src/datetime_format/tokenize.d.ts +76 -0
  52. package/dist/src/datetime_format/tokenize.d.ts.map +1 -0
  53. package/dist/src/datetime_format/tokenize.js +271 -0
  54. package/dist/src/datetime_format/tokenize.js.map +1 -0
  55. package/dist/src/datetime_format/types.d.ts +99 -0
  56. package/dist/src/datetime_format/types.d.ts.map +1 -0
  57. package/dist/src/datetime_format/types.js +103 -0
  58. package/dist/src/datetime_format/types.js.map +1 -0
  59. package/dist/src/datetime_format/validate.d.ts +51 -0
  60. package/dist/src/datetime_format/validate.d.ts.map +1 -0
  61. package/dist/src/datetime_format/validate.js +208 -0
  62. package/dist/src/datetime_format/validate.js.map +1 -0
  63. package/dist/src/default.d.ts +21 -0
  64. package/dist/src/default.d.ts.map +1 -0
  65. package/dist/src/default.js +82 -0
  66. package/dist/src/default.js.map +1 -0
  67. package/dist/src/eastir.d.ts +33 -0
  68. package/dist/src/eastir.d.ts.map +1 -0
  69. package/dist/src/eastir.js +92 -0
  70. package/dist/src/eastir.js.map +1 -0
  71. package/dist/src/error.d.ts +13 -0
  72. package/dist/src/error.d.ts.map +1 -0
  73. package/dist/src/error.js +8 -0
  74. package/dist/src/error.js.map +1 -0
  75. package/dist/src/expr/array.d.ts +1711 -0
  76. package/dist/src/expr/array.d.ts.map +1 -0
  77. package/dist/src/expr/array.js +1805 -0
  78. package/dist/src/expr/array.js.map +1 -0
  79. package/dist/src/expr/ast.d.ts +17 -0
  80. package/dist/src/expr/ast.d.ts.map +1 -0
  81. package/dist/src/expr/ast.js +302 -0
  82. package/dist/src/expr/ast.js.map +1 -0
  83. package/dist/src/expr/blob.d.ts +141 -0
  84. package/dist/src/expr/blob.d.ts.map +1 -0
  85. package/dist/src/expr/blob.js +198 -0
  86. package/dist/src/expr/blob.js.map +1 -0
  87. package/dist/src/expr/block.d.ts +201 -0
  88. package/dist/src/expr/block.d.ts.map +1 -0
  89. package/dist/src/expr/block.js +1505 -0
  90. package/dist/src/expr/block.js.map +1 -0
  91. package/dist/src/expr/boolean.d.ts +207 -0
  92. package/dist/src/expr/boolean.d.ts.map +1 -0
  93. package/dist/src/expr/boolean.js +261 -0
  94. package/dist/src/expr/boolean.js.map +1 -0
  95. package/dist/src/expr/datetime.d.ts +544 -0
  96. package/dist/src/expr/datetime.d.ts.map +1 -0
  97. package/dist/src/expr/datetime.js +980 -0
  98. package/dist/src/expr/datetime.js.map +1 -0
  99. package/dist/src/expr/dict.d.ts +1242 -0
  100. package/dist/src/expr/dict.d.ts.map +1 -0
  101. package/dist/src/expr/dict.js +1492 -0
  102. package/dist/src/expr/dict.js.map +1 -0
  103. package/dist/src/expr/expr.d.ts +95 -0
  104. package/dist/src/expr/expr.d.ts.map +1 -0
  105. package/dist/src/expr/expr.js +171 -0
  106. package/dist/src/expr/expr.js.map +1 -0
  107. package/dist/src/expr/float.d.ts +357 -0
  108. package/dist/src/expr/float.d.ts.map +1 -0
  109. package/dist/src/expr/float.js +637 -0
  110. package/dist/src/expr/float.js.map +1 -0
  111. package/dist/src/expr/function.d.ts +46 -0
  112. package/dist/src/expr/function.d.ts.map +1 -0
  113. package/dist/src/expr/function.js +58 -0
  114. package/dist/src/expr/function.js.map +1 -0
  115. package/dist/src/expr/index.d.ts +450 -0
  116. package/dist/src/expr/index.d.ts.map +1 -0
  117. package/dist/src/expr/index.js +423 -0
  118. package/dist/src/expr/index.js.map +1 -0
  119. package/dist/src/expr/integer.d.ts +256 -0
  120. package/dist/src/expr/integer.d.ts.map +1 -0
  121. package/dist/src/expr/integer.js +311 -0
  122. package/dist/src/expr/integer.js.map +1 -0
  123. package/dist/src/expr/libs/array.d.ts +106 -0
  124. package/dist/src/expr/libs/array.d.ts.map +1 -0
  125. package/dist/src/expr/libs/array.js +140 -0
  126. package/dist/src/expr/libs/array.js.map +1 -0
  127. package/dist/src/expr/libs/blob.d.ts +42 -0
  128. package/dist/src/expr/libs/blob.d.ts.map +1 -0
  129. package/dist/src/expr/libs/blob.js +70 -0
  130. package/dist/src/expr/libs/blob.js.map +1 -0
  131. package/dist/src/expr/libs/datetime.d.ts +479 -0
  132. package/dist/src/expr/libs/datetime.d.ts.map +1 -0
  133. package/dist/src/expr/libs/datetime.js +624 -0
  134. package/dist/src/expr/libs/datetime.js.map +1 -0
  135. package/dist/src/expr/libs/dict.d.ts +66 -0
  136. package/dist/src/expr/libs/dict.d.ts.map +1 -0
  137. package/dist/src/expr/libs/dict.js +77 -0
  138. package/dist/src/expr/libs/dict.js.map +1 -0
  139. package/dist/src/expr/libs/float.d.ts +299 -0
  140. package/dist/src/expr/libs/float.d.ts.map +1 -0
  141. package/dist/src/expr/libs/float.js +564 -0
  142. package/dist/src/expr/libs/float.js.map +1 -0
  143. package/dist/src/expr/libs/integer.d.ts +228 -0
  144. package/dist/src/expr/libs/integer.d.ts.map +1 -0
  145. package/dist/src/expr/libs/integer.js +398 -0
  146. package/dist/src/expr/libs/integer.js.map +1 -0
  147. package/dist/src/expr/libs/set.d.ts +59 -0
  148. package/dist/src/expr/libs/set.d.ts.map +1 -0
  149. package/dist/src/expr/libs/set.js +69 -0
  150. package/dist/src/expr/libs/set.js.map +1 -0
  151. package/dist/src/expr/libs/string.d.ts +71 -0
  152. package/dist/src/expr/libs/string.d.ts.map +1 -0
  153. package/dist/src/expr/libs/string.js +75 -0
  154. package/dist/src/expr/libs/string.js.map +1 -0
  155. package/dist/src/expr/never.d.ts +15 -0
  156. package/dist/src/expr/never.d.ts.map +1 -0
  157. package/dist/src/expr/never.js +12 -0
  158. package/dist/src/expr/never.js.map +1 -0
  159. package/dist/src/expr/null.d.ts +15 -0
  160. package/dist/src/expr/null.d.ts.map +1 -0
  161. package/dist/src/expr/null.js +12 -0
  162. package/dist/src/expr/null.js.map +1 -0
  163. package/dist/src/expr/ref.d.ts +103 -0
  164. package/dist/src/expr/ref.d.ts.map +1 -0
  165. package/dist/src/expr/ref.js +131 -0
  166. package/dist/src/expr/ref.js.map +1 -0
  167. package/dist/src/expr/regex_validation.d.ts +25 -0
  168. package/dist/src/expr/regex_validation.d.ts.map +1 -0
  169. package/dist/src/expr/regex_validation.js +130 -0
  170. package/dist/src/expr/regex_validation.js.map +1 -0
  171. package/dist/src/expr/set.d.ts +1071 -0
  172. package/dist/src/expr/set.d.ts.map +1 -0
  173. package/dist/src/expr/set.js +1137 -0
  174. package/dist/src/expr/set.js.map +1 -0
  175. package/dist/src/expr/string.d.ts +414 -0
  176. package/dist/src/expr/string.d.ts.map +1 -0
  177. package/dist/src/expr/string.js +683 -0
  178. package/dist/src/expr/string.js.map +1 -0
  179. package/dist/src/expr/struct.d.ts +48 -0
  180. package/dist/src/expr/struct.d.ts.map +1 -0
  181. package/dist/src/expr/struct.js +65 -0
  182. package/dist/src/expr/struct.js.map +1 -0
  183. package/dist/src/expr/types.d.ts +68 -0
  184. package/dist/src/expr/types.d.ts.map +1 -0
  185. package/dist/src/expr/types.js +6 -0
  186. package/dist/src/expr/types.js.map +1 -0
  187. package/dist/src/expr/variant.d.ts +137 -0
  188. package/dist/src/expr/variant.d.ts.map +1 -0
  189. package/dist/src/expr/variant.js +105 -0
  190. package/dist/src/expr/variant.js.map +1 -0
  191. package/dist/src/fuzz.d.ts +80 -0
  192. package/dist/src/fuzz.d.ts.map +1 -0
  193. package/dist/src/fuzz.js +300 -0
  194. package/dist/src/fuzz.js.map +1 -0
  195. package/dist/src/index.d.ts +21 -0
  196. package/dist/src/index.d.ts.map +1 -0
  197. package/dist/src/index.js +21 -0
  198. package/dist/src/index.js.map +1 -0
  199. package/dist/src/internal.d.ts +36 -0
  200. package/dist/src/internal.d.ts.map +1 -0
  201. package/dist/src/internal.js +11 -0
  202. package/dist/src/internal.js.map +1 -0
  203. package/dist/src/ir.d.ts +1571 -0
  204. package/dist/src/ir.d.ts.map +1 -0
  205. package/dist/src/ir.js +56 -0
  206. package/dist/src/ir.js.map +1 -0
  207. package/dist/src/location.d.ts +48 -0
  208. package/dist/src/location.d.ts.map +1 -0
  209. package/dist/src/location.js +62 -0
  210. package/dist/src/location.js.map +1 -0
  211. package/dist/src/platform.d.ts +21 -0
  212. package/dist/src/platform.d.ts.map +1 -0
  213. package/dist/src/platform.js +8 -0
  214. package/dist/src/platform.js.map +1 -0
  215. package/dist/src/serialization/beast.d.ts +39 -0
  216. package/dist/src/serialization/beast.d.ts.map +1 -0
  217. package/dist/src/serialization/beast.js +555 -0
  218. package/dist/src/serialization/beast.js.map +1 -0
  219. package/dist/src/serialization/beast2-stream.d.ts +38 -0
  220. package/dist/src/serialization/beast2-stream.d.ts.map +1 -0
  221. package/dist/src/serialization/beast2-stream.js +665 -0
  222. package/dist/src/serialization/beast2-stream.js.map +1 -0
  223. package/dist/src/serialization/beast2.d.ts +41 -0
  224. package/dist/src/serialization/beast2.d.ts.map +1 -0
  225. package/dist/src/serialization/beast2.js +489 -0
  226. package/dist/src/serialization/beast2.js.map +1 -0
  227. package/dist/src/serialization/binary-utils.d.ts +151 -0
  228. package/dist/src/serialization/binary-utils.d.ts.map +1 -0
  229. package/dist/src/serialization/binary-utils.js +929 -0
  230. package/dist/src/serialization/binary-utils.js.map +1 -0
  231. package/dist/src/serialization/east.d.ts +84 -0
  232. package/dist/src/serialization/east.d.ts.map +1 -0
  233. package/dist/src/serialization/east.js +1802 -0
  234. package/dist/src/serialization/east.js.map +1 -0
  235. package/dist/src/serialization/index.d.ts +11 -0
  236. package/dist/src/serialization/index.d.ts.map +1 -0
  237. package/dist/src/serialization/index.js +12 -0
  238. package/dist/src/serialization/index.js.map +1 -0
  239. package/dist/src/serialization/json.d.ts +36 -0
  240. package/dist/src/serialization/json.d.ts.map +1 -0
  241. package/dist/src/serialization/json.js +849 -0
  242. package/dist/src/serialization/json.js.map +1 -0
  243. package/dist/src/type_of_type.d.ts +115 -0
  244. package/dist/src/type_of_type.d.ts.map +1 -0
  245. package/dist/src/type_of_type.js +362 -0
  246. package/dist/src/type_of_type.js.map +1 -0
  247. package/dist/src/types.d.ts +648 -0
  248. package/dist/src/types.d.ts.map +1 -0
  249. package/dist/src/types.js +1631 -0
  250. package/dist/src/types.js.map +1 -0
  251. package/package.json +87 -0
@@ -0,0 +1,300 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ *
5
+ * @remarks
6
+ */
7
+ import { NullType, BooleanType, IntegerType, FloatType, StringType, DateTimeType, BlobType, ArrayType, SetType, DictType, StructType, VariantType, OptionType, } from "./types.js";
8
+ import { isVariant, variant } from "./containers/variant.js";
9
+ import { printType } from "./types.js";
10
+ import { printFor } from "./serialization/east.js";
11
+ import { toEastTypeValue } from "./type_of_type.js";
12
+ import { ref } from "./containers/ref.js";
13
+ /**
14
+ * Generates a random East type for fuzz testing.
15
+ *
16
+ * @param depth - Current nesting depth (used internally to limit recursion)
17
+ * @returns A randomly generated {@link EastType}
18
+ *
19
+ * @remarks
20
+ * Types are kept reasonably simple to avoid generating huge nested structures:
21
+ * - Maximum nesting depth of 3 levels
22
+ * - Higher chance of primitives at deeper levels
23
+ * - Sets and Dicts use {@link StringType} keys (immutability constraint)
24
+ * - Structs have 0-4 random fields
25
+ * - Variants have 1-3 random cases, with 30% chance of {@link OptionType}
26
+ */
27
+ export function randomType(depth = 0) {
28
+ // Limit nesting to avoid stack overflow and keep tests fast
29
+ const maxDepth = 3;
30
+ // Higher chance of primitives at deeper levels
31
+ const primitiveWeight = depth >= maxDepth ? 0.9 : 0.5;
32
+ if (Math.random() < primitiveWeight) {
33
+ // Primitive type
34
+ const r = Math.random() * 7;
35
+ if (r < 1)
36
+ return NullType;
37
+ if (r < 2)
38
+ return BooleanType;
39
+ if (r < 3)
40
+ return IntegerType;
41
+ if (r < 4)
42
+ return FloatType;
43
+ if (r < 5)
44
+ return StringType;
45
+ if (r < 6)
46
+ return DateTimeType;
47
+ return BlobType;
48
+ }
49
+ // Complex type
50
+ const r = Math.random() * 5;
51
+ if (r < 1) {
52
+ // Array
53
+ return ArrayType(randomType(depth + 1));
54
+ }
55
+ else if (r < 2) {
56
+ // Set (keys must be immutable)
57
+ return SetType(StringType);
58
+ }
59
+ else if (r < 3) {
60
+ // Dict (keys must be immutable)
61
+ return DictType(StringType, randomType(depth + 1));
62
+ }
63
+ else if (r < 4) {
64
+ // Struct with 0-4 fields
65
+ const fieldCount = Math.floor(Math.random() * 5);
66
+ const fields = {};
67
+ for (let i = 0; i < fieldCount; i++) {
68
+ fields[`field${i}`] = randomType(depth + 1);
69
+ }
70
+ return StructType(fields);
71
+ }
72
+ else {
73
+ // Variant
74
+ if (Math.random() < 0.3) {
75
+ // Option type (common variant pattern)
76
+ return OptionType(randomType(depth + 1));
77
+ }
78
+ else {
79
+ // Custom variant with 1-3 cases
80
+ const caseCount = 1 + Math.floor(Math.random() * 3);
81
+ const cases = {};
82
+ for (let i = 0; i < caseCount; i++) {
83
+ cases[`case${i}`] = randomType(depth + 1);
84
+ }
85
+ return VariantType(cases);
86
+ }
87
+ }
88
+ }
89
+ export function randomValueFor(type) {
90
+ // Convert EastTypeValue to EastType if needed
91
+ if (!isVariant(type)) {
92
+ type = toEastTypeValue(type);
93
+ }
94
+ if (type.type === "Never") {
95
+ throw new Error("Cannot generate values for Never type");
96
+ }
97
+ else if (type.type === "Null") {
98
+ return () => null;
99
+ }
100
+ else if (type.type === "Boolean") {
101
+ return (() => Math.random() < 0.5);
102
+ }
103
+ else if (type.type === "Integer") {
104
+ return (() => BigInt(Math.floor(Math.random() * 200) - 100));
105
+ }
106
+ else if (type.type === "Float") {
107
+ return (() => {
108
+ const r = Math.random();
109
+ if (r < 0.05)
110
+ return NaN;
111
+ if (r < 0.10)
112
+ return Infinity;
113
+ if (r < 0.15)
114
+ return -Infinity;
115
+ if (r < 0.20)
116
+ return 0.0;
117
+ if (r < 0.25)
118
+ return -0.0;
119
+ return Math.random() * 200 - 100;
120
+ });
121
+ }
122
+ else if (type.type === "String") {
123
+ return (() => {
124
+ const length = Math.floor(Math.random() * 20);
125
+ if (length === 0)
126
+ return "";
127
+ return Math.random().toString(36).substring(2, 2 + length);
128
+ });
129
+ }
130
+ else if (type.type === "DateTime") {
131
+ return (() => {
132
+ const year2025 = new Date("2025-01-01T00:00:00.000Z").valueOf();
133
+ const oneYear = 1000 * 60 * 60 * 24 * 365;
134
+ return new Date(year2025 + Math.floor(Math.random() * oneYear));
135
+ });
136
+ }
137
+ else if (type.type === "Blob") {
138
+ return (() => {
139
+ const length = Math.floor(Math.random() * 100); // Keep small for speed
140
+ const arr = new Uint8Array(length);
141
+ for (let i = 0; i < length; i++) {
142
+ arr[i] = Math.floor(Math.random() * 256);
143
+ }
144
+ return arr;
145
+ });
146
+ }
147
+ else if (type.type === "Ref") {
148
+ const valueFn = randomValueFor(type.value);
149
+ return (() => ref(valueFn()));
150
+ }
151
+ else if (type.type === "Array") {
152
+ const itemFn = randomValueFor(type.value);
153
+ return (() => {
154
+ const length = Math.floor(Math.random() * 5);
155
+ return Array.from({ length }, itemFn);
156
+ });
157
+ }
158
+ else if (type.type === "Set") {
159
+ const itemFn = randomValueFor(type.value);
160
+ return (() => {
161
+ const length = Math.floor(Math.random() * 5);
162
+ const set = new Set();
163
+ for (let i = 0; i < length; i++) {
164
+ set.add(itemFn());
165
+ }
166
+ return set;
167
+ });
168
+ }
169
+ else if (type.type === "Dict") {
170
+ const keyFn = randomValueFor(type.value.key);
171
+ const valueFn = randomValueFor(type.value.value);
172
+ return (() => {
173
+ const length = Math.floor(Math.random() * 5);
174
+ const dict = new Map();
175
+ for (let i = 0; i < length; i++) {
176
+ dict.set(keyFn(), valueFn());
177
+ }
178
+ return dict;
179
+ });
180
+ }
181
+ else if (type.type === "Struct") {
182
+ const fieldFns = Object.fromEntries(type.value.map(({ name, type: fieldType }) => [name, randomValueFor(fieldType)]));
183
+ return (() => {
184
+ const obj = {};
185
+ for (const [key, fn] of Object.entries(fieldFns)) {
186
+ obj[key] = fn();
187
+ }
188
+ return obj;
189
+ });
190
+ }
191
+ else if (type.type === "Variant") {
192
+ const caseKeys = type.value.map(({ name }) => name);
193
+ const caseFns = Object.fromEntries(type.value.map(({ name, type: caseType }) => [name, randomValueFor(caseType)]));
194
+ return (() => {
195
+ const caseKey = caseKeys[Math.floor(Math.random() * caseKeys.length)];
196
+ return variant(caseKey, caseFns[caseKey]());
197
+ });
198
+ }
199
+ else if (type.type === "Recursive") {
200
+ throw new Error("Cannot generate values for Recursive type");
201
+ }
202
+ else if (type.type === "Function") {
203
+ throw new Error("Cannot generate values for Function type");
204
+ }
205
+ else {
206
+ throw new Error(`Unhandled type: ${printType(type)}`);
207
+ }
208
+ }
209
+ /**
210
+ * Runs a fuzz test over a generic function parameterized by a type.
211
+ *
212
+ * @param fn - Factory function that takes a type and returns a test function for values of that type
213
+ * @param n_types - Number of random types to test
214
+ * @param n_samples - Number of random values to test per type
215
+ * @returns `true` if all tests passed, `false` if any failed
216
+ *
217
+ * @remarks
218
+ * For each randomly generated type:
219
+ * 1. Creates a test function using the provided factory
220
+ * 2. Generates random values of that type
221
+ * 3. Runs the test function on each value
222
+ * 4. Reports any failures to stderr with type, value, and error details
223
+ *
224
+ * Attempts to generate unique types (up to 100 attempts per type) to maximize
225
+ * test coverage. Prints summary statistics showing success/failure counts.
226
+ *
227
+ * @example
228
+ * ```ts
229
+ * import { printFor, parseFor } from "./serialization/east.js";
230
+ *
231
+ * // Test that serialization and parsing work
232
+ * await fuzzerTest(
233
+ * (type) => async (value) => {
234
+ * const parse = parseFor(type);
235
+ * const result = parse(serialized);
236
+ * if (!result.success) {
237
+ * throw new Error(`Parse failed: ${result.error}`);
238
+ * }
239
+ * },
240
+ * 100, // test 100 random types
241
+ * 10 // with 10 random values each
242
+ * );
243
+ * ```
244
+ */
245
+ export async function fuzzerTest(fn, n_types = 100, n_samples = 10) {
246
+ let n_type_success = 0;
247
+ let n_type_fail = 0;
248
+ const type_cache = new Set();
249
+ for (let i = 0; i < n_types; i++) {
250
+ let n_success = 0;
251
+ let n_fail = 0;
252
+ // Generate a unique random type
253
+ let type;
254
+ let attempts = 0;
255
+ while (true) {
256
+ type = randomType();
257
+ const typeStr = printType(type);
258
+ if (!type_cache.has(typeStr)) {
259
+ type_cache.add(typeStr);
260
+ break;
261
+ }
262
+ attempts++;
263
+ if (attempts > 100) {
264
+ // Give up and allow duplicates
265
+ break;
266
+ }
267
+ }
268
+ const type_fn = fn(type);
269
+ const randomValue = randomValueFor(type);
270
+ const print = printFor(type);
271
+ for (let j = 0; j < n_samples; j++) {
272
+ const value = randomValue();
273
+ try {
274
+ await type_fn(value);
275
+ n_success++;
276
+ }
277
+ catch (e) {
278
+ n_fail++;
279
+ console.error(` Test failed for type ${printType(type)}`);
280
+ console.error(` Value: ${print(value)}`);
281
+ console.error(` Error: ${e?.stack ?? e}`);
282
+ }
283
+ }
284
+ if (n_fail > 0) {
285
+ n_type_fail++;
286
+ console.error(` FAILED: ${n_success}/${n_samples} samples passed for type ${printType(type)}`);
287
+ }
288
+ else {
289
+ n_type_success++;
290
+ }
291
+ }
292
+ if (n_type_fail > 0) {
293
+ console.error(`FAILED: ${n_type_success}/${n_types} types passed`);
294
+ return false;
295
+ }
296
+ else {
297
+ return true;
298
+ }
299
+ }
300
+ //# sourceMappingURL=fuzz.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fuzz.js","sourceRoot":"","sources":["../../src/fuzz.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAGL,QAA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;gBACH,MAAM,OAAO,CAAC,KAAK,CAAC,CAAC;gBACrB,SAAS,EAAE,CAAC;YACd,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,MAAM,EAAE,CAAC;gBACT,OAAO,CAAC,KAAK,CAAC,4BAA4B,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBAC7D,OAAO,CAAC,KAAK,CAAC,cAAc,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;gBAC5C,OAAO,CAAC,KAAK,CAAC,cAAe,CAAS,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC,CAAC;YACxD,CAAC;QACH,CAAC;QAED,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;YACf,WAAW,EAAE,CAAC;YACd,OAAO,CAAC,KAAK,CAAC,aAAa,SAAS,IAAI,SAAS,4BAA4B,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAClG,CAAC;aAAM,CAAC;YACN,cAAc,EAAE,CAAC;QACnB,CAAC;IACH,CAAC;IAED,IAAI,WAAW,GAAG,CAAC,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,WAAW,cAAc,IAAI,OAAO,eAAe,CAAC,CAAC;QACnE,OAAO,KAAK,CAAC;IACf,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ export * from './location.js';
6
+ export * from './containers/ref.js';
7
+ export * from './containers/variant.js';
8
+ export * from './containers/sortedset.js';
9
+ export * from './containers/sortedmap.js';
10
+ export * from './types.js';
11
+ export * from './type_of_type.js';
12
+ export * from './serialization/index.js';
13
+ export * from './comparison.js';
14
+ export * from './ast.js';
15
+ export * from './expr/index.js';
16
+ export * from './ir.js';
17
+ export * from './error.js';
18
+ export * from './compile.js';
19
+ export * from './default.js';
20
+ export * from './eastir.js';
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ export * from './location.js';
6
+ export * from './containers/ref.js';
7
+ export * from './containers/variant.js';
8
+ export * from './containers/sortedset.js';
9
+ export * from './containers/sortedmap.js';
10
+ export * from './types.js';
11
+ export * from './type_of_type.js';
12
+ export * from './serialization/index.js';
13
+ export * from './comparison.js';
14
+ export * from './ast.js';
15
+ export * from './expr/index.js';
16
+ export * from './ir.js';
17
+ export * from './error.js';
18
+ export * from './compile.js';
19
+ export * from './default.js';
20
+ export * from './eastir.js';
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Internal exports for East
7
+ * These are more internal APIs that may be useful for tools and integrations
8
+ */
9
+ import type { EastType } from './types.js';
10
+ import { platform } from './expr/block.js';
11
+ export { EastIR } from './eastir.js';
12
+ export type { PlatformFunction } from './platform.js';
13
+ export { FunctionExpr, type CallableFunctionExpr } from './expr/function.js';
14
+ export { platform };
15
+ export type { EastType };
16
+ export { EastError } from './error.js';
17
+ export type { LocationValue } from './ir.js';
18
+ export { type LiteralValue, LiteralValueType } from './type_of_type.js';
19
+ /**
20
+ * Type helper for platform function definitions.
21
+ * Use this to properly type platform function declarations.
22
+ *
23
+ * @typeParam Inputs - Tuple of input parameter types
24
+ * @typeParam Output - Return type of the platform function
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * import { East, StringType, NullType } from "@elaraai/east";
29
+ * import type { PlatformFunctionDef } from "@elaraai/east/internal";
30
+ *
31
+ * export const console_log: PlatformFunctionDef<[typeof StringType], typeof NullType> =
32
+ * East.platform("console_log", [StringType], NullType);
33
+ * ```
34
+ */
35
+ export type PlatformFunctionDef<Inputs extends EastType[], Output extends EastType> = ReturnType<typeof platform<Inputs, Output>>;
36
+ //# sourceMappingURL=internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/internal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,KAAK,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,CAAC;AACpB,YAAY,EAAE,QAAQ,EAAE,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,OAAO,EAAE,KAAK,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAExE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,mBAAmB,CAAC,MAAM,SAAS,QAAQ,EAAE,EAAE,MAAM,SAAS,QAAQ,IAC9E,UAAU,CAAC,OAAO,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ import { platform } from './expr/block.js';
6
+ export { EastIR } from './eastir.js';
7
+ export { FunctionExpr } from './expr/function.js';
8
+ export { platform };
9
+ export { EastError } from './error.js';
10
+ export { LiteralValueType } from './type_of_type.js';
11
+ //# sourceMappingURL=internal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../src/internal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,YAAY,EAA6B,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,CAAC;AAEpB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAqB,gBAAgB,EAAE,MAAM,mBAAmB,CAAC"}