@elaraai/east 0.0.1-beta.25 → 0.0.1-beta.26

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 (102) hide show
  1. package/dist/src/ast_to_ir.js +1 -1
  2. package/dist/src/ast_to_ir.js.map +1 -1
  3. package/dist/src/builtins.d.ts +1 -1
  4. package/dist/src/builtins.d.ts.map +1 -1
  5. package/dist/src/builtins.js +22 -0
  6. package/dist/src/builtins.js.map +1 -1
  7. package/dist/src/compile.d.ts.map +1 -1
  8. package/dist/src/compile.js +35 -0
  9. package/dist/src/compile.js.map +1 -1
  10. package/dist/src/expr/array.d.ts +8 -0
  11. package/dist/src/expr/array.d.ts.map +1 -1
  12. package/dist/src/expr/array.js +11 -0
  13. package/dist/src/expr/array.js.map +1 -1
  14. package/dist/src/expr/blob.d.ts +8 -0
  15. package/dist/src/expr/blob.d.ts.map +1 -1
  16. package/dist/src/expr/blob.js +11 -0
  17. package/dist/src/expr/blob.js.map +1 -1
  18. package/dist/src/expr/block.d.ts +46 -0
  19. package/dist/src/expr/block.d.ts.map +1 -1
  20. package/dist/src/expr/block.js +124 -1
  21. package/dist/src/expr/block.js.map +1 -1
  22. package/dist/src/expr/boolean.d.ts +8 -0
  23. package/dist/src/expr/boolean.d.ts.map +1 -1
  24. package/dist/src/expr/boolean.js +11 -0
  25. package/dist/src/expr/boolean.js.map +1 -1
  26. package/dist/src/expr/datetime.d.ts +28 -0
  27. package/dist/src/expr/datetime.d.ts.map +1 -1
  28. package/dist/src/expr/datetime.js +31 -0
  29. package/dist/src/expr/datetime.js.map +1 -1
  30. package/dist/src/expr/dict.d.ts +8 -0
  31. package/dist/src/expr/dict.d.ts.map +1 -1
  32. package/dist/src/expr/dict.js +11 -0
  33. package/dist/src/expr/dict.js.map +1 -1
  34. package/dist/src/expr/float.d.ts +46 -0
  35. package/dist/src/expr/float.d.ts.map +1 -1
  36. package/dist/src/expr/float.js +52 -0
  37. package/dist/src/expr/float.js.map +1 -1
  38. package/dist/src/expr/index.d.ts +91 -2
  39. package/dist/src/expr/index.d.ts.map +1 -1
  40. package/dist/src/expr/index.js +97 -2
  41. package/dist/src/expr/index.js.map +1 -1
  42. package/dist/src/expr/integer.d.ts +73 -0
  43. package/dist/src/expr/integer.d.ts.map +1 -1
  44. package/dist/src/expr/integer.js +52 -0
  45. package/dist/src/expr/integer.js.map +1 -1
  46. package/dist/src/expr/set.d.ts +8 -0
  47. package/dist/src/expr/set.d.ts.map +1 -1
  48. package/dist/src/expr/set.js +11 -0
  49. package/dist/src/expr/set.js.map +1 -1
  50. package/dist/src/expr/string.d.ts +28 -0
  51. package/dist/src/expr/string.d.ts.map +1 -1
  52. package/dist/src/expr/string.js +31 -0
  53. package/dist/src/expr/string.js.map +1 -1
  54. package/dist/src/expr/variant.d.ts +8 -0
  55. package/dist/src/expr/variant.d.ts.map +1 -1
  56. package/dist/src/expr/variant.js +11 -0
  57. package/dist/src/expr/variant.js.map +1 -1
  58. package/dist/src/fuzz.d.ts +36 -2
  59. package/dist/src/fuzz.d.ts.map +1 -1
  60. package/dist/src/fuzz.js +344 -77
  61. package/dist/src/fuzz.js.map +1 -1
  62. package/dist/src/index.d.ts +1 -0
  63. package/dist/src/index.d.ts.map +1 -1
  64. package/dist/src/index.js +1 -0
  65. package/dist/src/index.js.map +1 -1
  66. package/dist/src/internal.d.ts +5 -0
  67. package/dist/src/internal.d.ts.map +1 -1
  68. package/dist/src/internal.js +6 -0
  69. package/dist/src/internal.js.map +1 -1
  70. package/dist/src/patch/apply.d.ts +15 -0
  71. package/dist/src/patch/apply.d.ts.map +1 -0
  72. package/dist/src/patch/apply.js +380 -0
  73. package/dist/src/patch/apply.js.map +1 -0
  74. package/dist/src/patch/compose.d.ts +15 -0
  75. package/dist/src/patch/compose.d.ts.map +1 -0
  76. package/dist/src/patch/compose.js +480 -0
  77. package/dist/src/patch/compose.js.map +1 -0
  78. package/dist/src/patch/diff.d.ts +15 -0
  79. package/dist/src/patch/diff.d.ts.map +1 -0
  80. package/dist/src/patch/diff.js +328 -0
  81. package/dist/src/patch/diff.js.map +1 -0
  82. package/dist/src/patch/fuzz.d.ts +73 -0
  83. package/dist/src/patch/fuzz.d.ts.map +1 -0
  84. package/dist/src/patch/fuzz.js +159 -0
  85. package/dist/src/patch/fuzz.js.map +1 -0
  86. package/dist/src/patch/index.d.ts +18 -0
  87. package/dist/src/patch/index.d.ts.map +1 -0
  88. package/dist/src/patch/index.js +20 -0
  89. package/dist/src/patch/index.js.map +1 -0
  90. package/dist/src/patch/invert.d.ts +15 -0
  91. package/dist/src/patch/invert.d.ts.map +1 -0
  92. package/dist/src/patch/invert.js +302 -0
  93. package/dist/src/patch/invert.js.map +1 -0
  94. package/dist/src/patch/type_of_patch.d.ts +17 -0
  95. package/dist/src/patch/type_of_patch.d.ts.map +1 -0
  96. package/dist/src/patch/type_of_patch.js +143 -0
  97. package/dist/src/patch/type_of_patch.js.map +1 -0
  98. package/dist/src/patch/types.d.ts +166 -0
  99. package/dist/src/patch/types.d.ts.map +1 -0
  100. package/dist/src/patch/types.js +69 -0
  101. package/dist/src/patch/types.js.map +1 -0
  102. package/package.json +1 -2
@@ -0,0 +1,69 @@
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
+ * Error thrown when patch operations encounter conflicts.
7
+ */
8
+ export class ConflictError extends Error {
9
+ constructor(message) {
10
+ super(message);
11
+ this.name = "ConflictError";
12
+ }
13
+ }
14
+ // ============================================================================
15
+ // Helper functions
16
+ // ============================================================================
17
+ /**
18
+ * Resolve a type that might be a Recursive back-reference.
19
+ * @internal
20
+ */
21
+ export function resolveType(t, types) {
22
+ if (t.type === "Recursive") {
23
+ const resolved = types[types.length - Number(t.value)];
24
+ if (resolved === undefined) {
25
+ throw new Error(`Internal error: Recursive type not found in context`);
26
+ }
27
+ return resolved;
28
+ }
29
+ return t;
30
+ }
31
+ /**
32
+ * Compute the Longest Common Subsequence of two arrays.
33
+ * @internal
34
+ */
35
+ export function computeLCS(before, after, equal) {
36
+ const m = before.length;
37
+ const n = after.length;
38
+ const dp = Array.from({ length: m + 1 }, () => Array(n + 1).fill(0));
39
+ for (let i = 1; i <= m; i++) {
40
+ for (let j = 1; j <= n; j++) {
41
+ if (equal(before[i - 1], after[j - 1])) {
42
+ dp[i][j] = dp[i - 1][j - 1] + 1;
43
+ }
44
+ else {
45
+ dp[i][j] = Math.max(dp[i - 1][j], dp[i][j - 1]);
46
+ }
47
+ }
48
+ }
49
+ const beforeIndices = [];
50
+ const afterIndices = [];
51
+ let i = m;
52
+ let j = n;
53
+ while (i > 0 && j > 0) {
54
+ if (equal(before[i - 1], after[j - 1])) {
55
+ beforeIndices.unshift(i - 1);
56
+ afterIndices.unshift(j - 1);
57
+ i--;
58
+ j--;
59
+ }
60
+ else if (dp[i - 1][j] > dp[i][j - 1]) {
61
+ i--;
62
+ }
63
+ else {
64
+ j--;
65
+ }
66
+ }
67
+ return { beforeIndices, afterIndices };
68
+ }
69
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/patch/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA8IH;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AAED,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,CAAgB,EAAE,KAA2B;IACvE,IAAI,CAAC,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QAC3B,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;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AC;IACH,CAAC;IAED,MAAM,aAAa,GAAa,EAAE,CAAC;IACnC,MAAM,YAAY,GAAa,EAAE,CAAC;IAClC,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,IAAI,CAAC,GAAG,CAAC,CAAC;IAEV,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACtB,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAE,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,CAAE,CAAC,EAAE,CAAC;YACzC,aAAa,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAC7B,YAAY,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAC5B,CAAC,EAAE,CAAC;YACJ,CAAC,EAAE,CAAC;QACN,CAAC;aAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAE,CAAC,CAAC,CAAE,GAAG,EAAE,CAAC,CAAC,CAAE,CAAC,CAAC,GAAG,CAAC,CAAE,EAAE,CAAC;YAC3C,CAAC,EAAE,CAAC;QACN,CAAC;aAAM,CAAC;YACN,CAAC,EAAE,CAAC;QACN,CAAC;IACH,CAAC;IAED,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC;AACzC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elaraai/east",
3
- "version": "0.0.1-beta.25",
3
+ "version": "0.0.1-beta.26",
4
4
  "description": "East is a simple and fast language used by Elara AI Pty Ltd.",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -29,7 +29,6 @@
29
29
  "test": "npm run build && node --enable-source-maps --test 'dist/test/**/*.spec.js' 'dist/src/**/*.spec.js'",
30
30
  "test:coverage": "npm run build && node --enable-source-maps --test --experimental-test-coverage 'dist/test/**/*.spec.js' 'dist/src/**/*.spec.js'",
31
31
  "test:export": "npm run build && EXPORT_TEST_IR=/tmp/east-test-ir node --enable-source-maps --test 'dist/test/**/*.spec.js'",
32
- "extract-examples": "tsx scripts/extract-typedoc-examples.ts",
33
32
  "lint": "eslint .",
34
33
  "lint:fix": "eslint . --fix",
35
34
  "version:patch": "npm version patch -m 'chore: bump version to %s'",