@elaraai/e3-types 1.0.78 → 1.0.80

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 (153) hide show
  1. package/README.md +1 -1
  2. package/dist/src/api.d.ts +569 -36
  3. package/dist/src/api.d.ts.map +1 -1
  4. package/dist/src/api.js +257 -32
  5. package/dist/src/api.js.map +1 -1
  6. package/dist/src/collection-manifest.d.ts +37 -0
  7. package/dist/src/collection-manifest.d.ts.map +1 -0
  8. package/dist/src/collection-manifest.js +37 -0
  9. package/dist/src/collection-manifest.js.map +1 -0
  10. package/dist/src/dataflow.d.ts +264 -19
  11. package/dist/src/dataflow.d.ts.map +1 -1
  12. package/dist/src/dataflow.js +156 -15
  13. package/dist/src/dataflow.js.map +1 -1
  14. package/dist/src/dataflow.spec.js +184 -27
  15. package/dist/src/dataflow.spec.js.map +1 -1
  16. package/dist/src/dataset-blob.d.ts +75 -15
  17. package/dist/src/dataset-blob.d.ts.map +1 -1
  18. package/dist/src/dataset-blob.js +95 -28
  19. package/dist/src/dataset-blob.js.map +1 -1
  20. package/dist/src/dataset-blob.spec.d.ts +6 -0
  21. package/dist/src/dataset-blob.spec.d.ts.map +1 -0
  22. package/dist/src/dataset-blob.spec.js +92 -0
  23. package/dist/src/dataset-blob.spec.js.map +1 -0
  24. package/dist/src/dataset-ref.d.ts +5 -4
  25. package/dist/src/dataset-ref.d.ts.map +1 -1
  26. package/dist/src/dataset-ref.js +5 -4
  27. package/dist/src/dataset-ref.js.map +1 -1
  28. package/dist/src/environment.d.ts +3 -2
  29. package/dist/src/environment.d.ts.map +1 -1
  30. package/dist/src/environment.js +3 -2
  31. package/dist/src/environment.js.map +1 -1
  32. package/dist/src/execution.d.ts +112 -18
  33. package/dist/src/execution.d.ts.map +1 -1
  34. package/dist/src/execution.js +174 -45
  35. package/dist/src/execution.js.map +1 -1
  36. package/dist/src/execution.spec.d.ts +6 -0
  37. package/dist/src/execution.spec.d.ts.map +1 -0
  38. package/dist/src/execution.spec.js +108 -0
  39. package/dist/src/execution.spec.js.map +1 -0
  40. package/dist/src/function.d.ts +14 -12
  41. package/dist/src/function.d.ts.map +1 -1
  42. package/dist/src/function.js +17 -32
  43. package/dist/src/function.js.map +1 -1
  44. package/dist/src/index.d.ts +16 -12
  45. package/dist/src/index.d.ts.map +1 -1
  46. package/dist/src/index.js +25 -20
  47. package/dist/src/index.js.map +1 -1
  48. package/dist/src/lock.d.ts +68 -22
  49. package/dist/src/lock.d.ts.map +1 -1
  50. package/dist/src/lock.js +33 -22
  51. package/dist/src/lock.js.map +1 -1
  52. package/dist/src/names.d.ts +21 -0
  53. package/dist/src/names.d.ts.map +1 -0
  54. package/dist/src/names.js +31 -0
  55. package/dist/src/names.js.map +1 -0
  56. package/dist/src/package.d.ts +11 -78
  57. package/dist/src/package.d.ts.map +1 -1
  58. package/dist/src/package.js +13 -66
  59. package/dist/src/package.js.map +1 -1
  60. package/dist/src/record.d.ts +582 -18
  61. package/dist/src/record.d.ts.map +1 -1
  62. package/dist/src/record.js +405 -7
  63. package/dist/src/record.js.map +1 -1
  64. package/dist/src/{stream.spec.d.ts → record.spec.d.ts} +1 -1
  65. package/dist/src/record.spec.d.ts.map +1 -0
  66. package/dist/src/record.spec.js +143 -0
  67. package/dist/src/record.spec.js.map +1 -0
  68. package/dist/src/release.d.ts +36 -0
  69. package/dist/src/release.d.ts.map +1 -0
  70. package/dist/src/release.js +71 -0
  71. package/dist/src/release.js.map +1 -0
  72. package/dist/src/release.spec.d.ts +6 -0
  73. package/dist/src/release.spec.d.ts.map +1 -0
  74. package/dist/src/release.spec.js +42 -0
  75. package/dist/src/release.spec.js.map +1 -0
  76. package/dist/src/repository.d.ts +64 -0
  77. package/dist/src/repository.d.ts.map +1 -0
  78. package/dist/src/repository.js +49 -0
  79. package/dist/src/repository.js.map +1 -0
  80. package/dist/src/runner.d.ts +16 -62
  81. package/dist/src/runner.d.ts.map +1 -1
  82. package/dist/src/runner.js +16 -79
  83. package/dist/src/runner.js.map +1 -1
  84. package/dist/src/runner.spec.js +11 -85
  85. package/dist/src/runner.spec.js.map +1 -1
  86. package/dist/src/structure.d.ts +0 -57
  87. package/dist/src/structure.d.ts.map +1 -1
  88. package/dist/src/structure.js +0 -3
  89. package/dist/src/structure.js.map +1 -1
  90. package/dist/src/task.d.ts +210 -318
  91. package/dist/src/task.d.ts.map +1 -1
  92. package/dist/src/task.js +117 -472
  93. package/dist/src/task.js.map +1 -1
  94. package/dist/src/task.spec.js +62 -154
  95. package/dist/src/task.spec.js.map +1 -1
  96. package/dist/src/transfer.d.ts +16 -22
  97. package/dist/src/transfer.d.ts.map +1 -1
  98. package/dist/src/transfer.js +16 -22
  99. package/dist/src/transfer.js.map +1 -1
  100. package/dist/src/transfer.spec.js +4 -34
  101. package/dist/src/transfer.spec.js.map +1 -1
  102. package/dist/src/unit-plan.d.ts +130 -0
  103. package/dist/src/unit-plan.d.ts.map +1 -0
  104. package/dist/src/unit-plan.js +107 -0
  105. package/dist/src/unit-plan.js.map +1 -0
  106. package/dist/src/unit-plan.spec.d.ts +6 -0
  107. package/dist/src/unit-plan.spec.d.ts.map +1 -0
  108. package/dist/src/unit-plan.spec.js +29 -0
  109. package/dist/src/unit-plan.spec.js.map +1 -0
  110. package/dist/src/workspace.d.ts +22 -11
  111. package/dist/src/workspace.d.ts.map +1 -1
  112. package/dist/src/workspace.js +10 -11
  113. package/dist/src/workspace.js.map +1 -1
  114. package/package.json +3 -3
  115. package/src/api.ts +276 -32
  116. package/src/collection-manifest.ts +53 -0
  117. package/src/dataflow.spec.ts +223 -31
  118. package/src/dataflow.ts +183 -26
  119. package/src/dataset-blob.spec.ts +117 -0
  120. package/src/dataset-blob.ts +157 -21
  121. package/src/dataset-ref.ts +5 -4
  122. package/src/environment.ts +3 -2
  123. package/src/execution.spec.ts +114 -0
  124. package/src/execution.ts +175 -51
  125. package/src/function.ts +19 -32
  126. package/src/index.ts +122 -39
  127. package/src/lock.ts +39 -22
  128. package/src/names.ts +39 -0
  129. package/src/package.ts +15 -71
  130. package/src/record.spec.ts +195 -0
  131. package/src/record.ts +489 -7
  132. package/src/release.spec.ts +47 -0
  133. package/src/release.ts +69 -0
  134. package/src/repository.ts +67 -0
  135. package/src/runner.spec.ts +11 -94
  136. package/src/runner.ts +16 -80
  137. package/src/structure.ts +0 -8
  138. package/src/task.spec.ts +67 -188
  139. package/src/task.ts +140 -522
  140. package/src/transfer.spec.ts +4 -51
  141. package/src/transfer.ts +16 -22
  142. package/src/unit-plan.spec.ts +31 -0
  143. package/src/unit-plan.ts +121 -0
  144. package/src/workspace.ts +13 -11
  145. package/dist/src/stream.d.ts +0 -97
  146. package/dist/src/stream.d.ts.map +0 -1
  147. package/dist/src/stream.js +0 -134
  148. package/dist/src/stream.js.map +0 -1
  149. package/dist/src/stream.spec.d.ts.map +0 -1
  150. package/dist/src/stream.spec.js +0 -60
  151. package/dist/src/stream.spec.js.map +0 -1
  152. package/src/stream.spec.ts +0 -88
  153. package/src/stream.ts +0 -170
@@ -0,0 +1,130 @@
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
+ * The unit graph of a task split into pieces, a stage at a time.
7
+ *
8
+ * A split task runs in stages: its pieces, and then, for a set, a dict or a
9
+ * fold, each level of the merges that assemble their outputs. Each stage's
10
+ * units are one of these objects, written when the stage starts and named by
11
+ * the task's entry in the dataflow's execution state. So resuming a stage reads
12
+ * this object back, and finds the units that finished in the execution cache.
13
+ * Each names the plan of the stage before it, and the task's `success` record
14
+ * names the last, so every stage the task ran is found from its record, and
15
+ * with them the units gc keeps beside it.
16
+ *
17
+ * It names other objects, so it carries a `kind` tag the garbage collector
18
+ * dispatches on.
19
+ *
20
+ * @packageDocumentation
21
+ */
22
+ import { ArrayType, IntegerType, OptionType, StringType, StructType, VariantType, type ValueTypeOf } from '@elaraai/east';
23
+ /** The kind tag every unit plan carries. */
24
+ export declare const UNIT_PLAN_KIND = "$plan";
25
+ /** Parts a merge level assembles into one: a group of the pieces' outputs
26
+ * whose keys overlap, over one key range, or a fold's partials. */
27
+ export declare const UnitPlanGroupType: StructType<{
28
+ /** The hash of the key range the group's merges run over — `{from, to}`
29
+ * over the parts' key type — or `none` to merge the parts whole. */
30
+ readonly range: OptionType<StringType>;
31
+ /** The parts, in the order they fold: each unit of the level merges a run
32
+ * of them, and a run of one passes through. */
33
+ readonly entries: ArrayType<StringType>;
34
+ }>;
35
+ export type UnitPlanGroupType = typeof UnitPlanGroupType;
36
+ export type UnitPlanGroup = ValueTypeOf<typeof UnitPlanGroupType>;
37
+ /**
38
+ * A stage of a split task.
39
+ *
40
+ * - `pieces`: each piece's inputs, in the task's input order — a partitioned
41
+ * input's piece of it, and every other input as it is.
42
+ * - `merge`: one level of the merges that assemble the pieces' outputs, and
43
+ * the groups it merges, in key order.
44
+ */
45
+ export declare const UnitPlanStageType: VariantType<{
46
+ readonly pieces: ArrayType<ArrayType<StringType>>;
47
+ readonly merge: StructType<{
48
+ /** The level, from 1. */
49
+ readonly level: IntegerType;
50
+ /** The number of levels the merges take. */
51
+ readonly levels: IntegerType;
52
+ /** The groups, in key order. */
53
+ readonly groups: ArrayType<StructType<{
54
+ /** The hash of the key range the group's merges run over — `{from, to}`
55
+ * over the parts' key type — or `none` to merge the parts whole. */
56
+ readonly range: OptionType<StringType>;
57
+ /** The parts, in the order they fold: each unit of the level merges a run
58
+ * of them, and a run of one passes through. */
59
+ readonly entries: ArrayType<StringType>;
60
+ }>>;
61
+ }>;
62
+ }>;
63
+ export type UnitPlanStageType = typeof UnitPlanStageType;
64
+ export type UnitPlanStage = ValueTypeOf<typeof UnitPlanStageType>;
65
+ /**
66
+ * A stage of a split task's unit graph, stored as an object.
67
+ *
68
+ * @example
69
+ * ```ts
70
+ * import { none, variant } from '@elaraai/east';
71
+ *
72
+ * const plan: UnitPlan = {
73
+ * kind: UNIT_PLAN_KIND,
74
+ * task: '5e7a3b…',
75
+ * inputs: '9c01de…',
76
+ * stage: variant('pieces', [['a1b2…'], ['c3d4…']]),
77
+ * previous: none,
78
+ * peakBytes: none,
79
+ * };
80
+ * ```
81
+ */
82
+ export declare const UnitPlanType: StructType<{
83
+ /** Always {@link UNIT_PLAN_KIND}. */
84
+ readonly kind: StringType;
85
+ /** The task object's hash. */
86
+ readonly task: StringType;
87
+ /** The task's inputs hash: the execution the plan belongs to. */
88
+ readonly inputs: StringType;
89
+ /** The stage. */
90
+ readonly stage: VariantType<{
91
+ readonly pieces: ArrayType<ArrayType<StringType>>;
92
+ readonly merge: StructType<{
93
+ /** The level, from 1. */
94
+ readonly level: IntegerType;
95
+ /** The number of levels the merges take. */
96
+ readonly levels: IntegerType;
97
+ /** The groups, in key order. */
98
+ readonly groups: ArrayType<StructType<{
99
+ /** The hash of the key range the group's merges run over — `{from, to}`
100
+ * over the parts' key type — or `none` to merge the parts whole. */
101
+ readonly range: OptionType<StringType>;
102
+ /** The parts, in the order they fold: each unit of the level merges a run
103
+ * of them, and a run of one passes through. */
104
+ readonly entries: ArrayType<StringType>;
105
+ }>>;
106
+ }>;
107
+ }>;
108
+ /** The plan of the stage before this one; `none` for the pieces. */
109
+ readonly previous: OptionType<StringType>;
110
+ /** The largest peak resident memory, in bytes, a unit of the stages before
111
+ * this one reached, as their execution records hold it; `none` for the
112
+ * pieces, or when no unit reported one. A task taken up at this stage
113
+ * starts its own peak from it, so its record counts every stage wherever
114
+ * it was taken up. */
115
+ readonly peakBytes: OptionType<IntegerType>;
116
+ }>;
117
+ export type UnitPlanType = typeof UnitPlanType;
118
+ export type UnitPlan = ValueTypeOf<typeof UnitPlanType>;
119
+ /** Encodes a {@link UnitPlanType} object for the object store. */
120
+ export declare const encodeUnitPlan: (plan: UnitPlan) => Uint8Array;
121
+ /**
122
+ * Decodes a unit plan.
123
+ *
124
+ * @param data - the stored bytes
125
+ * @returns the plan
126
+ * @throws {Error} When the bytes are not a unit plan, or carry another kind
127
+ * tag.
128
+ */
129
+ export declare function decodeUnitPlan(data: Uint8Array): UnitPlan;
130
+ //# sourceMappingURL=unit-plan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unit-plan.d.ts","sourceRoot":"","sources":["../../src/unit-plan.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAoC,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5J,4CAA4C;AAC5C,eAAO,MAAM,cAAc,UAAU,CAAC;AAEtC;oEACoE;AACpE,eAAO,MAAM,iBAAiB;IAC5B;yEACqE;;IAErE;oDACgD;;EAEhD,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC;AACzD,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB;;;QAG1B,yBAAyB;;QAEzB,4CAA4C;;QAE5C,gCAAgC;;YAzBlC;iFACqE;;YAErE;4DACgD;;;;EAwBhD,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC;AACzD,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,YAAY;IACvB,qCAAqC;;IAErC,8BAA8B;;IAE9B,iEAAiE;;IAEjE,iBAAiB;;;;YAnCf,yBAAyB;;YAEzB,4CAA4C;;YAE5C,gCAAgC;;gBAzBlC;qFACqE;;gBAErE;gEACgD;;;;;IAsDhD,oEAAoE;;IAEpE;;;;2BAIuB;;EAEvB,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC;AAC/C,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD,kEAAkE;AAClE,eAAO,MAAM,cAAc,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,UAA0C,CAAC;AAI5F;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,QAAQ,CAMzD"}
@@ -0,0 +1,107 @@
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
+ * The unit graph of a task split into pieces, a stage at a time.
7
+ *
8
+ * A split task runs in stages: its pieces, and then, for a set, a dict or a
9
+ * fold, each level of the merges that assemble their outputs. Each stage's
10
+ * units are one of these objects, written when the stage starts and named by
11
+ * the task's entry in the dataflow's execution state. So resuming a stage reads
12
+ * this object back, and finds the units that finished in the execution cache.
13
+ * Each names the plan of the stage before it, and the task's `success` record
14
+ * names the last, so every stage the task ran is found from its record, and
15
+ * with them the units gc keeps beside it.
16
+ *
17
+ * It names other objects, so it carries a `kind` tag the garbage collector
18
+ * dispatches on.
19
+ *
20
+ * @packageDocumentation
21
+ */
22
+ import { ArrayType, IntegerType, OptionType, StringType, StructType, VariantType, decodeBeast2For, encodeBeast2For } from '@elaraai/east';
23
+ /** The kind tag every unit plan carries. */
24
+ export const UNIT_PLAN_KIND = '$plan';
25
+ /** Parts a merge level assembles into one: a group of the pieces' outputs
26
+ * whose keys overlap, over one key range, or a fold's partials. */
27
+ export const UnitPlanGroupType = StructType({
28
+ /** The hash of the key range the group's merges run over — `{from, to}`
29
+ * over the parts' key type — or `none` to merge the parts whole. */
30
+ range: OptionType(StringType),
31
+ /** The parts, in the order they fold: each unit of the level merges a run
32
+ * of them, and a run of one passes through. */
33
+ entries: ArrayType(StringType),
34
+ });
35
+ /**
36
+ * A stage of a split task.
37
+ *
38
+ * - `pieces`: each piece's inputs, in the task's input order — a partitioned
39
+ * input's piece of it, and every other input as it is.
40
+ * - `merge`: one level of the merges that assemble the pieces' outputs, and
41
+ * the groups it merges, in key order.
42
+ */
43
+ export const UnitPlanStageType = VariantType({
44
+ pieces: ArrayType(ArrayType(StringType)),
45
+ merge: StructType({
46
+ /** The level, from 1. */
47
+ level: IntegerType,
48
+ /** The number of levels the merges take. */
49
+ levels: IntegerType,
50
+ /** The groups, in key order. */
51
+ groups: ArrayType(UnitPlanGroupType),
52
+ }),
53
+ });
54
+ /**
55
+ * A stage of a split task's unit graph, stored as an object.
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * import { none, variant } from '@elaraai/east';
60
+ *
61
+ * const plan: UnitPlan = {
62
+ * kind: UNIT_PLAN_KIND,
63
+ * task: '5e7a3b…',
64
+ * inputs: '9c01de…',
65
+ * stage: variant('pieces', [['a1b2…'], ['c3d4…']]),
66
+ * previous: none,
67
+ * peakBytes: none,
68
+ * };
69
+ * ```
70
+ */
71
+ export const UnitPlanType = StructType({
72
+ /** Always {@link UNIT_PLAN_KIND}. */
73
+ kind: StringType,
74
+ /** The task object's hash. */
75
+ task: StringType,
76
+ /** The task's inputs hash: the execution the plan belongs to. */
77
+ inputs: StringType,
78
+ /** The stage. */
79
+ stage: UnitPlanStageType,
80
+ /** The plan of the stage before this one; `none` for the pieces. */
81
+ previous: OptionType(StringType),
82
+ /** The largest peak resident memory, in bytes, a unit of the stages before
83
+ * this one reached, as their execution records hold it; `none` for the
84
+ * pieces, or when no unit reported one. A task taken up at this stage
85
+ * starts its own peak from it, so its record counts every stage wherever
86
+ * it was taken up. */
87
+ peakBytes: OptionType(IntegerType),
88
+ });
89
+ /** Encodes a {@link UnitPlanType} object for the object store. */
90
+ export const encodeUnitPlan = encodeBeast2For(UnitPlanType);
91
+ const decodeUnitPlanValue = decodeBeast2For(UnitPlanType);
92
+ /**
93
+ * Decodes a unit plan.
94
+ *
95
+ * @param data - the stored bytes
96
+ * @returns the plan
97
+ * @throws {Error} When the bytes are not a unit plan, or carry another kind
98
+ * tag.
99
+ */
100
+ export function decodeUnitPlan(data) {
101
+ const plan = decodeUnitPlanValue(data);
102
+ if (plan.kind !== UNIT_PLAN_KIND) {
103
+ throw new Error(`the object is not a unit plan: its kind is '${plan.kind}', not '${UNIT_PLAN_KIND}'`);
104
+ }
105
+ return plan;
106
+ }
107
+ //# sourceMappingURL=unit-plan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unit-plan.js","sourceRoot":"","sources":["../../src/unit-plan.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAoB,MAAM,eAAe,CAAC;AAE5J,4CAA4C;AAC5C,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC;AAEtC;oEACoE;AACpE,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAAC;IAC1C;yEACqE;IACrE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC;IAC7B;oDACgD;IAChD,OAAO,EAAE,SAAS,CAAC,UAAU,CAAC;CAC/B,CAAC,CAAC;AAIH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,WAAW,CAAC;IAC3C,MAAM,EAAE,SAAS,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IACxC,KAAK,EAAE,UAAU,CAAC;QAChB,yBAAyB;QACzB,KAAK,EAAE,WAAW;QAClB,4CAA4C;QAC5C,MAAM,EAAE,WAAW;QACnB,gCAAgC;QAChC,MAAM,EAAE,SAAS,CAAC,iBAAiB,CAAC;KACrC,CAAC;CACH,CAAC,CAAC;AAIH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC;IACrC,qCAAqC;IACrC,IAAI,EAAE,UAAU;IAChB,8BAA8B;IAC9B,IAAI,EAAE,UAAU;IAChB,iEAAiE;IACjE,MAAM,EAAE,UAAU;IAClB,iBAAiB;IACjB,KAAK,EAAE,iBAAiB;IACxB,oEAAoE;IACpE,QAAQ,EAAE,UAAU,CAAC,UAAU,CAAC;IAChC;;;;2BAIuB;IACvB,SAAS,EAAE,UAAU,CAAC,WAAW,CAAC;CACnC,CAAC,CAAC;AAIH,kEAAkE;AAClE,MAAM,CAAC,MAAM,cAAc,GAAmC,eAAe,CAAC,YAAY,CAAC,CAAC;AAE5F,MAAM,mBAAmB,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC;AAE1D;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,IAAgB;IAC7C,MAAM,IAAI,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACvC,IAAI,IAAI,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,+CAA+C,IAAI,CAAC,IAAI,WAAW,cAAc,GAAG,CAAC,CAAC;IACxG,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,6 @@
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 {};
6
+ //# sourceMappingURL=unit-plan.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unit-plan.spec.d.ts","sourceRoot":"","sources":["../../src/unit-plan.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,29 @@
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 { describe, it } from 'node:test';
6
+ import assert from 'node:assert/strict';
7
+ import { encodeBeast2For, equalFor, none, some, variant } from '@elaraai/east';
8
+ import { UNIT_PLAN_KIND, UnitPlanType, decodeUnitPlan, encodeUnitPlan } from './unit-plan.js';
9
+ describe('unit plans', () => {
10
+ it('round-trips each stage', () => {
11
+ const plans = [
12
+ { kind: UNIT_PLAN_KIND, task: 'a1', inputs: 'b2', stage: variant('pieces', [['c3', 'd4'], ['e5', 'd4']]), previous: none, peakBytes: none },
13
+ {
14
+ kind: UNIT_PLAN_KIND, task: 'a1', inputs: 'b2',
15
+ stage: variant('merge', { level: 1n, levels: 2n, groups: [{ range: some('f6'), entries: ['g7', 'h8'] }, { range: none, entries: ['i9'] }] }),
16
+ previous: some('j0'),
17
+ peakBytes: some(52428800n),
18
+ },
19
+ ];
20
+ for (const plan of plans) {
21
+ assert.ok(equalFor(UnitPlanType)(decodeUnitPlan(encodeUnitPlan(plan)), plan));
22
+ }
23
+ });
24
+ it('refuses an object of another kind', () => {
25
+ const other = encodeBeast2For(UnitPlanType)({ kind: 'task', task: 'a1', inputs: 'b2', stage: variant('pieces', []), previous: none, peakBytes: none });
26
+ assert.throws(() => decodeUnitPlan(other), { message: "the object is not a unit plan: its kind is 'task', not '$plan'" });
27
+ });
28
+ });
29
+ //# sourceMappingURL=unit-plan.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unit-plan.spec.js","sourceRoot":"","sources":["../../src/unit-plan.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,cAAc,EAAE,cAAc,EAAiB,MAAM,gBAAgB,CAAC;AAE7G,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;QAChC,MAAM,KAAK,GAAe;YACxB,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE;YAC3I;gBACE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI;gBAC9C,KAAK,EAAE,OAAO,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;gBAC5I,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC;gBACpB,SAAS,EAAE,IAAI,CAAC,SAAW,CAAC;aAC7B;SACF,CAAC;QACF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,cAAc,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;QAChF,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;QAC3C,MAAM,KAAK,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACvJ,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,EAAE,OAAO,EAAE,gEAAgE,EAAE,CAAC,CAAC;IAC5H,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -5,21 +5,15 @@
5
5
  /**
6
6
  * Workspace state type definitions.
7
7
  *
8
- * A workspace is a mutable working copy of a package. The state tracks:
9
- * - Which package was deployed (immutable reference via hash)
10
- * - When the deployment occurred
11
- * - Current root data tree hash
12
- * - When the root was last updated
8
+ * A workspace is a mutable working copy of a package. Its record is `none`
9
+ * from its creation until a package is deployed to it, and then its state:
10
+ * which package was deployed, when, and the latest dataflow run.
13
11
  *
14
- * State file location: workspaces/<name>/state.beast2
15
- * No state file = workspace exists but not yet deployed.
12
+ * A local repository keeps the record at `workspaces/<name>.beast2`.
16
13
  */
17
14
  import { StructType, StringType, DateTimeType, OptionType, ValueTypeOf } from '@elaraai/east';
18
15
  /**
19
- * Workspace state stored in workspaces/<name>/state.beast2
20
- *
21
- * Contains both deployment info and current data root in a single
22
- * atomic unit to ensure consistency.
16
+ * A deployed workspace's state.
23
17
  *
24
18
  * Future audit trail support:
25
19
  * When we implement full audit trail, this state will move to the object
@@ -44,4 +38,21 @@ export declare const WorkspaceStateType: StructType<{
44
38
  readonly currentRunId: OptionType<StringType>;
45
39
  }>;
46
40
  export type WorkspaceState = ValueTypeOf<typeof WorkspaceStateType>;
41
+ /**
42
+ * A workspace's record: `none` until a package is deployed to it, and then
43
+ * its state.
44
+ */
45
+ export declare const WorkspaceRecordType: OptionType<StructType<{
46
+ /** Name of the deployed package */
47
+ readonly packageName: StringType;
48
+ /** Version of the deployed package */
49
+ readonly packageVersion: StringType;
50
+ /** Hash of the package object at deploy time (immutable reference) */
51
+ readonly packageHash: StringType;
52
+ /** UTC datetime when the package was deployed */
53
+ readonly deployedAt: DateTimeType;
54
+ /** Run ID of the latest completed dataflow run (null if never run) */
55
+ readonly currentRunId: OptionType<StringType>;
56
+ }>>;
57
+ export type WorkspaceRecord = ValueTypeOf<typeof WorkspaceRecordType>;
47
58
  //# sourceMappingURL=workspace.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/workspace.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE9F;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,kBAAkB;IAC7B,mCAAmC;;IAEnC,sCAAsC;;IAEtC,sEAAsE;;IAEtE,iDAAiD;;IAEjD,sEAAsE;;EAEtE,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
1
+ {"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/workspace.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE9F;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB;IAC7B,mCAAmC;;IAEnC,sCAAsC;;IAEtC,sEAAsE;;IAEtE,iDAAiD;;IAEjD,sEAAsE;;EAEtE,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEpE;;;GAGG;AACH,eAAO,MAAM,mBAAmB;IAlB9B,mCAAmC;;IAEnC,sCAAsC;;IAEtC,sEAAsE;;IAEtE,iDAAiD;;IAEjD,sEAAsE;;GAUP,CAAC;AAElE,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
@@ -5,21 +5,15 @@
5
5
  /**
6
6
  * Workspace state type definitions.
7
7
  *
8
- * A workspace is a mutable working copy of a package. The state tracks:
9
- * - Which package was deployed (immutable reference via hash)
10
- * - When the deployment occurred
11
- * - Current root data tree hash
12
- * - When the root was last updated
8
+ * A workspace is a mutable working copy of a package. Its record is `none`
9
+ * from its creation until a package is deployed to it, and then its state:
10
+ * which package was deployed, when, and the latest dataflow run.
13
11
  *
14
- * State file location: workspaces/<name>/state.beast2
15
- * No state file = workspace exists but not yet deployed.
12
+ * A local repository keeps the record at `workspaces/<name>.beast2`.
16
13
  */
17
14
  import { StructType, StringType, DateTimeType, OptionType } from '@elaraai/east';
18
15
  /**
19
- * Workspace state stored in workspaces/<name>/state.beast2
20
- *
21
- * Contains both deployment info and current data root in a single
22
- * atomic unit to ensure consistency.
16
+ * A deployed workspace's state.
23
17
  *
24
18
  * Future audit trail support:
25
19
  * When we implement full audit trail, this state will move to the object
@@ -43,4 +37,9 @@ export const WorkspaceStateType = StructType({
43
37
  /** Run ID of the latest completed dataflow run (null if never run) */
44
38
  currentRunId: OptionType(StringType),
45
39
  });
40
+ /**
41
+ * A workspace's record: `none` until a package is deployed to it, and then
42
+ * its state.
43
+ */
44
+ export const WorkspaceRecordType = OptionType(WorkspaceStateType);
46
45
  //# sourceMappingURL=workspace.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../src/workspace.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAe,MAAM,eAAe,CAAC;AAE9F;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAC;IAC3C,mCAAmC;IACnC,WAAW,EAAE,UAAU;IACvB,sCAAsC;IACtC,cAAc,EAAE,UAAU;IAC1B,sEAAsE;IACtE,WAAW,EAAE,UAAU;IACvB,iDAAiD;IACjD,UAAU,EAAE,YAAY;IACxB,sEAAsE;IACtE,YAAY,EAAE,UAAU,CAAC,UAAU,CAAC;CACrC,CAAC,CAAC"}
1
+ {"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../src/workspace.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAe,MAAM,eAAe,CAAC;AAE9F;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAC;IAC3C,mCAAmC;IACnC,WAAW,EAAE,UAAU;IACvB,sCAAsC;IACtC,cAAc,EAAE,UAAU;IAC1B,sEAAsE;IACtE,WAAW,EAAE,UAAU;IACvB,iDAAiD;IACjD,UAAU,EAAE,YAAY;IACxB,sEAAsE;IACtE,YAAY,EAAE,UAAU,CAAC,UAAU,CAAC;CACrC,CAAC,CAAC;AAIH;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elaraai/e3-types",
3
- "version": "1.0.78",
3
+ "version": "1.0.80",
4
4
  "description": "Shared type definitions for e3 (East Execution Engine)",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -18,7 +18,7 @@
18
18
  "directory": "libs/e3/packages/e3-types"
19
19
  },
20
20
  "peerDependencies": {
21
- "@elaraai/east": "1.0.78"
21
+ "@elaraai/east": "1.0.80"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/node": "^22.0.0",
@@ -31,6 +31,6 @@
31
31
  "build": "tsc",
32
32
  "lint": "eslint .",
33
33
  "lint:fix": "eslint . --fix",
34
- "test": "npm run build && node --enable-source-maps --test-reporter=spec --test 'dist/src/**/*.spec.js'"
34
+ "test": "npm run build && node --enable-source-maps --test-reporter=spec --test-timeout=480000 --test 'dist/src/**/*.spec.js'"
35
35
  }
36
36
  }