@elaraai/e3-types 0.0.1-alpha.2

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.
@@ -0,0 +1,210 @@
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
+ * Package object types for e3.
7
+ *
8
+ * A package bundles everything needed to run computations:
9
+ * tasks and data structure with initial values.
10
+ *
11
+ * Terminology:
12
+ * - **Package**: A deployable bundle of tasks and data structure
13
+ * - **Structure**: The shape of the data tree
14
+ * - **Task**: A computation with input/output paths (stored separately)
15
+ */
16
+ import { StructType, StringType, DictType, ValueTypeOf } from '@elaraai/east';
17
+ /**
18
+ * Data configuration in a package.
19
+ *
20
+ * Defines the structure (which paths are datasets vs trees)
21
+ * and initial values (root tree hash).
22
+ *
23
+ * @remarks
24
+ * - `structure`: Defines which paths are datasets vs trees (recursive)
25
+ * - `value`: Hash of the root tree object in the object store
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * const data: PackageData = {
30
+ * structure: variant('struct', new Map([
31
+ * ['inputs', variant('struct', new Map([
32
+ * ['sales', variant('value', variant('Array', variant('Integer', null)))],
33
+ * ]))],
34
+ * ['tasks', variant('struct', new Map([
35
+ * ['process', variant('struct', new Map([
36
+ * ['function_ir', variant('value', ...)],
37
+ * ['output', variant('value', variant('Integer', null))],
38
+ * ]))],
39
+ * ]))],
40
+ * ])),
41
+ * value: 'abc123...', // Hash of initial tree
42
+ * };
43
+ * ```
44
+ */
45
+ export declare const PackageDataType: StructType<{
46
+ /** Structure defining tree shape (what's a group vs dataset) */
47
+ structure: import("@elaraai/east").RecursiveType<import("@elaraai/east").VariantType<{
48
+ value: import("@elaraai/east").RecursiveType<import("@elaraai/east").VariantType<{
49
+ Never: import("@elaraai/east").NullType;
50
+ Null: import("@elaraai/east").NullType;
51
+ Boolean: import("@elaraai/east").NullType;
52
+ Integer: import("@elaraai/east").NullType;
53
+ Float: import("@elaraai/east").NullType;
54
+ String: import("@elaraai/east").NullType;
55
+ DateTime: import("@elaraai/east").NullType;
56
+ Blob: import("@elaraai/east").NullType;
57
+ Ref: import("@elaraai/east").RecursiveTypeMarker;
58
+ Array: import("@elaraai/east").RecursiveTypeMarker;
59
+ Set: import("@elaraai/east").RecursiveTypeMarker;
60
+ Dict: StructType<{
61
+ key: import("@elaraai/east").RecursiveTypeMarker;
62
+ value: import("@elaraai/east").RecursiveTypeMarker;
63
+ }>;
64
+ Struct: import("@elaraai/east").ArrayType<StructType<{
65
+ name: StringType;
66
+ type: import("@elaraai/east").RecursiveTypeMarker;
67
+ }>>;
68
+ Variant: import("@elaraai/east").ArrayType<StructType<{
69
+ name: StringType;
70
+ type: import("@elaraai/east").RecursiveTypeMarker;
71
+ }>>;
72
+ Recursive: import("@elaraai/east").IntegerType;
73
+ Function: StructType<{
74
+ inputs: import("@elaraai/east").ArrayType<import("@elaraai/east").RecursiveTypeMarker>;
75
+ output: import("@elaraai/east").RecursiveTypeMarker;
76
+ }>;
77
+ AsyncFunction: StructType<{
78
+ inputs: import("@elaraai/east").ArrayType<import("@elaraai/east").RecursiveTypeMarker>;
79
+ output: import("@elaraai/east").RecursiveTypeMarker;
80
+ }>;
81
+ }>>;
82
+ struct: DictType<StringType, import("@elaraai/east").RecursiveTypeMarker>;
83
+ }>>;
84
+ /** Hash of the root tree object containing initial/default values */
85
+ value: StringType;
86
+ }>;
87
+ export type PackageDataType = typeof PackageDataType;
88
+ export type PackageData = ValueTypeOf<typeof PackageDataType>;
89
+ /** @deprecated Use PackageDataType instead */
90
+ export declare const PackageDatasetsType: StructType<{
91
+ /** Structure defining tree shape (what's a group vs dataset) */
92
+ structure: import("@elaraai/east").RecursiveType<import("@elaraai/east").VariantType<{
93
+ value: import("@elaraai/east").RecursiveType<import("@elaraai/east").VariantType<{
94
+ Never: import("@elaraai/east").NullType;
95
+ Null: import("@elaraai/east").NullType;
96
+ Boolean: import("@elaraai/east").NullType;
97
+ Integer: import("@elaraai/east").NullType;
98
+ Float: import("@elaraai/east").NullType;
99
+ String: import("@elaraai/east").NullType;
100
+ DateTime: import("@elaraai/east").NullType;
101
+ Blob: import("@elaraai/east").NullType;
102
+ Ref: import("@elaraai/east").RecursiveTypeMarker;
103
+ Array: import("@elaraai/east").RecursiveTypeMarker;
104
+ Set: import("@elaraai/east").RecursiveTypeMarker;
105
+ Dict: StructType<{
106
+ key: import("@elaraai/east").RecursiveTypeMarker;
107
+ value: import("@elaraai/east").RecursiveTypeMarker;
108
+ }>;
109
+ Struct: import("@elaraai/east").ArrayType<StructType<{
110
+ name: StringType;
111
+ type: import("@elaraai/east").RecursiveTypeMarker;
112
+ }>>;
113
+ Variant: import("@elaraai/east").ArrayType<StructType<{
114
+ name: StringType;
115
+ type: import("@elaraai/east").RecursiveTypeMarker;
116
+ }>>;
117
+ Recursive: import("@elaraai/east").IntegerType;
118
+ Function: StructType<{
119
+ inputs: import("@elaraai/east").ArrayType<import("@elaraai/east").RecursiveTypeMarker>;
120
+ output: import("@elaraai/east").RecursiveTypeMarker;
121
+ }>;
122
+ AsyncFunction: StructType<{
123
+ inputs: import("@elaraai/east").ArrayType<import("@elaraai/east").RecursiveTypeMarker>;
124
+ output: import("@elaraai/east").RecursiveTypeMarker;
125
+ }>;
126
+ }>>;
127
+ struct: DictType<StringType, import("@elaraai/east").RecursiveTypeMarker>;
128
+ }>>;
129
+ /** Hash of the root tree object containing initial/default values */
130
+ value: StringType;
131
+ }>;
132
+ /** @deprecated Use PackageData instead */
133
+ export type PackageDatasetsType = PackageDataType;
134
+ /** @deprecated Use PackageData instead */
135
+ export type PackageDatasets = PackageData;
136
+ /**
137
+ * Package object stored in the object store.
138
+ *
139
+ * Packages are the unit of distribution and deployment in e3.
140
+ * They are immutable and content-addressed by their hash.
141
+ *
142
+ * @remarks
143
+ * - `tasks`: Maps task names to task object hashes. Each task object
144
+ * contains runner, input paths, and output path.
145
+ * - `data`: The structure and initial values for the data tree.
146
+ *
147
+ * Package identity (name/version) is determined by the path in the
148
+ * bundle's `packages/<name>/<version>` directory structure.
149
+ *
150
+ * @example
151
+ * ```ts
152
+ * const pkg: PackageObject = {
153
+ * tasks: new Map([['process', 'abc123...']]), // hash of TaskObject
154
+ * data: {
155
+ * structure: variant('struct', new Map([...])),
156
+ * value: 'def456...', // hash of root tree
157
+ * },
158
+ * };
159
+ * ```
160
+ */
161
+ export declare const PackageObjectType: StructType<{
162
+ /** Tasks defined in this package: name -> task object hash */
163
+ tasks: DictType<StringType, StringType>;
164
+ /** Data structure and initial values */
165
+ data: StructType<{
166
+ /** Structure defining tree shape (what's a group vs dataset) */
167
+ structure: import("@elaraai/east").RecursiveType<import("@elaraai/east").VariantType<{
168
+ value: import("@elaraai/east").RecursiveType<import("@elaraai/east").VariantType<{
169
+ Never: import("@elaraai/east").NullType;
170
+ Null: import("@elaraai/east").NullType;
171
+ Boolean: import("@elaraai/east").NullType;
172
+ Integer: import("@elaraai/east").NullType;
173
+ Float: import("@elaraai/east").NullType;
174
+ String: import("@elaraai/east").NullType;
175
+ DateTime: import("@elaraai/east").NullType;
176
+ Blob: import("@elaraai/east").NullType;
177
+ Ref: import("@elaraai/east").RecursiveTypeMarker;
178
+ Array: import("@elaraai/east").RecursiveTypeMarker;
179
+ Set: import("@elaraai/east").RecursiveTypeMarker;
180
+ Dict: StructType<{
181
+ key: import("@elaraai/east").RecursiveTypeMarker;
182
+ value: import("@elaraai/east").RecursiveTypeMarker;
183
+ }>;
184
+ Struct: import("@elaraai/east").ArrayType<StructType<{
185
+ name: StringType;
186
+ type: import("@elaraai/east").RecursiveTypeMarker;
187
+ }>>;
188
+ Variant: import("@elaraai/east").ArrayType<StructType<{
189
+ name: StringType;
190
+ type: import("@elaraai/east").RecursiveTypeMarker;
191
+ }>>;
192
+ Recursive: import("@elaraai/east").IntegerType;
193
+ Function: StructType<{
194
+ inputs: import("@elaraai/east").ArrayType<import("@elaraai/east").RecursiveTypeMarker>;
195
+ output: import("@elaraai/east").RecursiveTypeMarker;
196
+ }>;
197
+ AsyncFunction: StructType<{
198
+ inputs: import("@elaraai/east").ArrayType<import("@elaraai/east").RecursiveTypeMarker>;
199
+ output: import("@elaraai/east").RecursiveTypeMarker;
200
+ }>;
201
+ }>>;
202
+ struct: DictType<StringType, import("@elaraai/east").RecursiveTypeMarker>;
203
+ }>>;
204
+ /** Hash of the root tree object containing initial/default values */
205
+ value: StringType;
206
+ }>;
207
+ }>;
208
+ export type PackageObjectType = typeof PackageObjectType;
209
+ export type PackageObject = ValueTypeOf<typeof PackageObjectType>;
210
+ //# sourceMappingURL=package.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.d.ts","sourceRoot":"","sources":["../../src/package.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG9E;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,eAAe;IAC1B,gEAAgE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEhE,qEAAqE;;EAErE,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC;AAErD,MAAM,MAAM,WAAW,GAAG,WAAW,CAAC,OAAO,eAAe,CAAC,CAAC;AAG9D,8CAA8C;AAC9C,eAAO,MAAM,mBAAmB;IAX9B,gEAAgE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEhE,qEAAqE;;EASrB,CAAC;AACnD,0CAA0C;AAC1C,MAAM,MAAM,mBAAmB,GAAG,eAAe,CAAC;AAClD,0CAA0C;AAC1C,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,iBAAiB;IAC5B,8DAA8D;;IAE9D,wCAAwC;;QA7CxC,gEAAgE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAEhE,qEAAqE;;;EA6CrE,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC;AAEzD,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
@@ -0,0 +1,86 @@
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
+ * Package object types for e3.
7
+ *
8
+ * A package bundles everything needed to run computations:
9
+ * tasks and data structure with initial values.
10
+ *
11
+ * Terminology:
12
+ * - **Package**: A deployable bundle of tasks and data structure
13
+ * - **Structure**: The shape of the data tree
14
+ * - **Task**: A computation with input/output paths (stored separately)
15
+ */
16
+ import { StructType, StringType, DictType } from '@elaraai/east';
17
+ import { StructureType } from './structure.js';
18
+ /**
19
+ * Data configuration in a package.
20
+ *
21
+ * Defines the structure (which paths are datasets vs trees)
22
+ * and initial values (root tree hash).
23
+ *
24
+ * @remarks
25
+ * - `structure`: Defines which paths are datasets vs trees (recursive)
26
+ * - `value`: Hash of the root tree object in the object store
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const data: PackageData = {
31
+ * structure: variant('struct', new Map([
32
+ * ['inputs', variant('struct', new Map([
33
+ * ['sales', variant('value', variant('Array', variant('Integer', null)))],
34
+ * ]))],
35
+ * ['tasks', variant('struct', new Map([
36
+ * ['process', variant('struct', new Map([
37
+ * ['function_ir', variant('value', ...)],
38
+ * ['output', variant('value', variant('Integer', null))],
39
+ * ]))],
40
+ * ]))],
41
+ * ])),
42
+ * value: 'abc123...', // Hash of initial tree
43
+ * };
44
+ * ```
45
+ */
46
+ export const PackageDataType = StructType({
47
+ /** Structure defining tree shape (what's a group vs dataset) */
48
+ structure: StructureType,
49
+ /** Hash of the root tree object containing initial/default values */
50
+ value: StringType,
51
+ });
52
+ // Backwards compatibility alias
53
+ /** @deprecated Use PackageDataType instead */
54
+ export const PackageDatasetsType = PackageDataType;
55
+ /**
56
+ * Package object stored in the object store.
57
+ *
58
+ * Packages are the unit of distribution and deployment in e3.
59
+ * They are immutable and content-addressed by their hash.
60
+ *
61
+ * @remarks
62
+ * - `tasks`: Maps task names to task object hashes. Each task object
63
+ * contains runner, input paths, and output path.
64
+ * - `data`: The structure and initial values for the data tree.
65
+ *
66
+ * Package identity (name/version) is determined by the path in the
67
+ * bundle's `packages/<name>/<version>` directory structure.
68
+ *
69
+ * @example
70
+ * ```ts
71
+ * const pkg: PackageObject = {
72
+ * tasks: new Map([['process', 'abc123...']]), // hash of TaskObject
73
+ * data: {
74
+ * structure: variant('struct', new Map([...])),
75
+ * value: 'def456...', // hash of root tree
76
+ * },
77
+ * };
78
+ * ```
79
+ */
80
+ export const PackageObjectType = StructType({
81
+ /** Tasks defined in this package: name -> task object hash */
82
+ tasks: DictType(StringType, StringType),
83
+ /** Data structure and initial values */
84
+ data: PackageDataType,
85
+ });
86
+ //# sourceMappingURL=package.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.js","sourceRoot":"","sources":["../../src/package.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAe,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAAC;IACxC,gEAAgE;IAChE,SAAS,EAAE,aAAa;IACxB,qEAAqE;IACrE,KAAK,EAAE,UAAU;CAClB,CAAC,CAAC;AAKH,gCAAgC;AAChC,8CAA8C;AAC9C,MAAM,CAAC,MAAM,mBAAmB,GAAG,eAAe,CAAC;AAMnD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAAC;IAC1C,8DAA8D;IAC9D,KAAK,EAAE,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IACvC,wCAAwC;IACxC,IAAI,EAAE,eAAe;CACtB,CAAC,CAAC"}
@@ -0,0 +1,339 @@
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
+ * Data structure and path types for e3.
7
+ *
8
+ * Terminology:
9
+ * - **Dataset**: A location holding a value (leaf node in the data tree)
10
+ * - **Tree**: A location containing datasets or nested trees (branch node)
11
+ * - **Structure**: The shape of the data tree (what trees/datasets exist and their types)
12
+ * - **Path**: An address pointing to a dataset or tree
13
+ *
14
+ * Paths use East's keypath syntax:
15
+ * - `.field` for struct field access (backtick-quoted for special chars)
16
+ * - `[N]` for array index access (future)
17
+ * - `[key]` for dict key lookup (future)
18
+ *
19
+ * @see East serialization docs for keypath syntax details
20
+ */
21
+ import { VariantType, StringType, ArrayType, DictType, RecursiveType, ValueTypeOf } from '@elaraai/east';
22
+ /**
23
+ * Structure definition for a data tree node.
24
+ *
25
+ * Defines the shape of the data tree - which paths are datasets (hold values)
26
+ * and which are trees (hold other nodes).
27
+ *
28
+ * @remarks
29
+ * - `value`: A dataset - holds a typed value. The type is an `EastTypeValue`.
30
+ * - `struct`: A tree - has named children, each with its own structure.
31
+ *
32
+ * MVP only supports struct trees. Future: array, dict, variant trees.
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * // A dataset holding an Integer value
37
+ * const dataset: Structure = variant('value', variant('Integer', null));
38
+ *
39
+ * // A tree with named children
40
+ * const tree: Structure = variant('struct', new Map([
41
+ * ['count', variant('value', variant('Integer', null))],
42
+ * ['items', variant('value', variant('Array', variant('String', null)))],
43
+ * ]));
44
+ * ```
45
+ */
46
+ export declare const StructureType: RecursiveType<VariantType<{
47
+ /** Dataset: East type of the value (homoiconic EastTypeValue) */
48
+ value: RecursiveType<VariantType<{
49
+ Never: import("@elaraai/east").NullType;
50
+ Null: import("@elaraai/east").NullType;
51
+ Boolean: import("@elaraai/east").NullType;
52
+ Integer: import("@elaraai/east").NullType;
53
+ Float: import("@elaraai/east").NullType;
54
+ String: import("@elaraai/east").NullType;
55
+ DateTime: import("@elaraai/east").NullType;
56
+ Blob: import("@elaraai/east").NullType;
57
+ Ref: import("@elaraai/east").RecursiveTypeMarker;
58
+ Array: import("@elaraai/east").RecursiveTypeMarker;
59
+ Set: import("@elaraai/east").RecursiveTypeMarker;
60
+ Dict: import("@elaraai/east").StructType<{
61
+ key: import("@elaraai/east").RecursiveTypeMarker;
62
+ value: import("@elaraai/east").RecursiveTypeMarker;
63
+ }>;
64
+ Struct: ArrayType<import("@elaraai/east").StructType<{
65
+ name: StringType;
66
+ type: import("@elaraai/east").RecursiveTypeMarker;
67
+ }>>;
68
+ Variant: ArrayType<import("@elaraai/east").StructType<{
69
+ name: StringType;
70
+ type: import("@elaraai/east").RecursiveTypeMarker;
71
+ }>>;
72
+ Recursive: import("@elaraai/east").IntegerType;
73
+ Function: import("@elaraai/east").StructType<{
74
+ inputs: ArrayType<import("@elaraai/east").RecursiveTypeMarker>;
75
+ output: import("@elaraai/east").RecursiveTypeMarker;
76
+ }>;
77
+ AsyncFunction: import("@elaraai/east").StructType<{
78
+ inputs: ArrayType<import("@elaraai/east").RecursiveTypeMarker>;
79
+ output: import("@elaraai/east").RecursiveTypeMarker;
80
+ }>;
81
+ }>>;
82
+ /** Struct tree: named children mapping to child structures */
83
+ struct: DictType<StringType, import("@elaraai/east").RecursiveTypeMarker>;
84
+ }>>;
85
+ export type StructureType = typeof StructureType;
86
+ export type Structure = ValueTypeOf<typeof StructureType>;
87
+ /** @deprecated Use StructureType instead */
88
+ export declare const DatasetSchemaType: RecursiveType<VariantType<{
89
+ /** Dataset: East type of the value (homoiconic EastTypeValue) */
90
+ value: RecursiveType<VariantType<{
91
+ Never: import("@elaraai/east").NullType;
92
+ Null: import("@elaraai/east").NullType;
93
+ Boolean: import("@elaraai/east").NullType;
94
+ Integer: import("@elaraai/east").NullType;
95
+ Float: import("@elaraai/east").NullType;
96
+ String: import("@elaraai/east").NullType;
97
+ DateTime: import("@elaraai/east").NullType;
98
+ Blob: import("@elaraai/east").NullType;
99
+ Ref: import("@elaraai/east").RecursiveTypeMarker;
100
+ Array: import("@elaraai/east").RecursiveTypeMarker;
101
+ Set: import("@elaraai/east").RecursiveTypeMarker;
102
+ Dict: import("@elaraai/east").StructType<{
103
+ key: import("@elaraai/east").RecursiveTypeMarker;
104
+ value: import("@elaraai/east").RecursiveTypeMarker;
105
+ }>;
106
+ Struct: ArrayType<import("@elaraai/east").StructType<{
107
+ name: StringType;
108
+ type: import("@elaraai/east").RecursiveTypeMarker;
109
+ }>>;
110
+ Variant: ArrayType<import("@elaraai/east").StructType<{
111
+ name: StringType;
112
+ type: import("@elaraai/east").RecursiveTypeMarker;
113
+ }>>;
114
+ Recursive: import("@elaraai/east").IntegerType;
115
+ Function: import("@elaraai/east").StructType<{
116
+ inputs: ArrayType<import("@elaraai/east").RecursiveTypeMarker>;
117
+ output: import("@elaraai/east").RecursiveTypeMarker;
118
+ }>;
119
+ AsyncFunction: import("@elaraai/east").StructType<{
120
+ inputs: ArrayType<import("@elaraai/east").RecursiveTypeMarker>;
121
+ output: import("@elaraai/east").RecursiveTypeMarker;
122
+ }>;
123
+ }>>;
124
+ /** Struct tree: named children mapping to child structures */
125
+ struct: DictType<StringType, import("@elaraai/east").RecursiveTypeMarker>;
126
+ }>>;
127
+ /** @deprecated Use Structure instead */
128
+ export type DatasetSchemaType = StructureType;
129
+ /** @deprecated Use Structure instead */
130
+ export type DatasetSchema = Structure;
131
+ /**
132
+ * Path segment for navigating data trees.
133
+ *
134
+ * Uses East keypath syntax for consistency:
135
+ * - `field`: Struct field access (rendered as `.field` or `` .`field` `` if quoted)
136
+ * - `index`: Array element access (rendered as `[N]`) - future
137
+ * - `key`: Dict key lookup (rendered as `[key]`) - future
138
+ *
139
+ * @example
140
+ * ```ts
141
+ * // Struct field access
142
+ * const segment: PathSegment = variant('field', 'sales');
143
+ *
144
+ * // Array index (future)
145
+ * const segment: PathSegment = variant('index', 0n);
146
+ * ```
147
+ */
148
+ export declare const PathSegmentType: VariantType<{
149
+ /** Struct field access by name */
150
+ field: StringType;
151
+ }>;
152
+ export type PathSegmentType = typeof PathSegmentType;
153
+ export type PathSegment = ValueTypeOf<typeof PathSegmentType>;
154
+ /**
155
+ * Path: sequence of segments identifying a location in a data tree.
156
+ *
157
+ * Paths point to either a dataset (leaf) or a tree (branch).
158
+ * Used by tasks to specify where inputs come from and where outputs go.
159
+ *
160
+ * @example
161
+ * ```ts
162
+ * // Path to .inputs.sales.data
163
+ * const path: TreePath = [
164
+ * variant('field', 'inputs'),
165
+ * variant('field', 'sales'),
166
+ * variant('field', 'data'),
167
+ * ];
168
+ * ```
169
+ */
170
+ export declare const TreePathType: ArrayType<VariantType<{
171
+ /** Struct field access by name */
172
+ field: StringType;
173
+ }>>;
174
+ export type TreePathType = typeof TreePathType;
175
+ export type TreePath = ValueTypeOf<typeof TreePathType>;
176
+ /**
177
+ * Converts a path to East keypath string representation.
178
+ *
179
+ * Uses East's keypath syntax: `.field` for simple identifiers,
180
+ * `` .`field` `` for identifiers needing quoting.
181
+ *
182
+ * @param path - The path to convert
183
+ * @returns A keypath string (e.g., ".inputs.sales" or ".inputs.`my/field`")
184
+ *
185
+ * @example
186
+ * ```ts
187
+ * const path = treePath('inputs', 'sales');
188
+ * pathToString(path); // ".inputs.sales"
189
+ *
190
+ * const path2 = treePath('inputs', 'my/field');
191
+ * pathToString(path2); // ".inputs.`my/field`"
192
+ * ```
193
+ */
194
+ export declare function pathToString(path: TreePath): string;
195
+ /**
196
+ * Result of parsing a path with structure validation.
197
+ */
198
+ export interface ParsePathResult {
199
+ /** The parsed path segments */
200
+ path: TreePath;
201
+ /** The structure at the path location */
202
+ structure: Structure;
203
+ }
204
+ /**
205
+ * Parses an East keypath string into a path, validating against the structure.
206
+ *
207
+ * Supports `.field` syntax for struct field access.
208
+ * Backtick-quoted identifiers (`` .`field` ``) are supported for special chars.
209
+ *
210
+ * @param pathStr - A keypath string (e.g., ".inputs.sales")
211
+ * @param structure - The root structure to validate against
212
+ * @returns The parsed path and the structure at that location
213
+ *
214
+ * @throws {Error} If a field doesn't exist in the structure or path descends into a dataset
215
+ *
216
+ * @remarks
217
+ * - Empty string returns empty path (root) with the root structure
218
+ * - Path must start with `.` (no leading slash)
219
+ * - Backtick escaping: `` \` `` for literal backtick, `\\` for backslash
220
+ * - Future: will disambiguate variant cases from struct fields using structure
221
+ * - Future: will use structure to parse dict keys with correct type
222
+ *
223
+ * @example
224
+ * ```ts
225
+ * const structure = variant('struct', new Map([
226
+ * ['inputs', variant('struct', new Map([
227
+ * ['sales', variant('value', variant('Integer', null))],
228
+ * ]))],
229
+ * ]));
230
+ *
231
+ * const { path, structure: leafStructure } = parsePath('.inputs.sales', structure);
232
+ * // path = [field('inputs'), field('sales')]
233
+ * // leafStructure = variant('value', variant('Integer', null))
234
+ * ```
235
+ */
236
+ export declare function parsePath(pathStr: string, structure: Structure): ParsePathResult;
237
+ /**
238
+ * Creates a path from field names, validating against the structure.
239
+ *
240
+ * Convenience function for the common case of navigating through struct fields.
241
+ *
242
+ * @param structure - The root structure to validate against
243
+ * @param fields - Field names to include in the path
244
+ * @returns The parsed path and the structure at that location
245
+ *
246
+ * @throws {Error} If a field doesn't exist in the structure
247
+ *
248
+ * @example
249
+ * ```ts
250
+ * const { path, structure: leafStructure } = treePath(rootStructure, 'inputs', 'sales');
251
+ * ```
252
+ */
253
+ export declare function treePath(structure: Structure, ...fields: string[]): ParsePathResult;
254
+ /**
255
+ * Result of parsing a dataset path specification.
256
+ */
257
+ export interface ParseDatasetPathResult {
258
+ /** Workspace name */
259
+ ws: string;
260
+ /** Path within the workspace */
261
+ path: TreePath;
262
+ }
263
+ /**
264
+ * Parse workspace.path.to.dataset syntax into workspace name and TreePath.
265
+ *
266
+ * This is a lenient parser that does not validate against a structure.
267
+ * Use this for parsing user input where the structure is not yet known.
268
+ *
269
+ * @param pathSpec - Path specification in dot notation (e.g., "production.inputs.sales")
270
+ * @returns Workspace name and path segments
271
+ *
272
+ * @throws {Error} If path is empty or has unclosed backticks
273
+ *
274
+ * @example
275
+ * ```ts
276
+ * parseDatasetPath("production")
277
+ * // { ws: "production", path: [] }
278
+ *
279
+ * parseDatasetPath("production.inputs.sales")
280
+ * // { ws: "production", path: [field("inputs"), field("sales")] }
281
+ *
282
+ * // For field names with special characters, use backticks:
283
+ * parseDatasetPath("production.`my field`")
284
+ * // { ws: "production", path: [field("my field")] }
285
+ * ```
286
+ */
287
+ export declare function parseDatasetPath(pathSpec: string): ParseDatasetPathResult;
288
+ /**
289
+ * Result of parsing a package reference.
290
+ */
291
+ export interface ParsePackageRefResult {
292
+ /** Package name */
293
+ name: string;
294
+ /** Version string, or undefined if not specified */
295
+ version?: string;
296
+ }
297
+ /**
298
+ * Parse a package reference like "name" or "name@version".
299
+ *
300
+ * @param ref - Package reference string
301
+ * @returns Package name and optional version
302
+ *
303
+ * @example
304
+ * ```ts
305
+ * parsePackageRef("my-package")
306
+ * // { name: "my-package", version: undefined }
307
+ *
308
+ * parsePackageRef("my-package@1.0.0")
309
+ * // { name: "my-package", version: "1.0.0" }
310
+ *
311
+ * // Scoped packages work too:
312
+ * parsePackageRef("@scope/package@2.0.0")
313
+ * // { name: "@scope/package", version: "2.0.0" }
314
+ * ```
315
+ */
316
+ export declare function parsePackageRef(ref: string): ParsePackageRefResult;
317
+ /**
318
+ * Convert URL path segments to a TreePath.
319
+ *
320
+ * Takes slash-separated, URL-encoded path segments and converts them to
321
+ * a TreePath of field variants.
322
+ *
323
+ * @param urlPath - URL path string (e.g., "inputs/sales/data" or "/inputs/sales/data")
324
+ * @returns TreePath of field segments
325
+ *
326
+ * @example
327
+ * ```ts
328
+ * urlPathToTreePath("inputs/sales/data")
329
+ * // [field("inputs"), field("sales"), field("data")]
330
+ *
331
+ * urlPathToTreePath("inputs/my%20field")
332
+ * // [field("inputs"), field("my field")]
333
+ *
334
+ * urlPathToTreePath("")
335
+ * // []
336
+ * ```
337
+ */
338
+ export declare function urlPathToTreePath(urlPath: string): TreePath;
339
+ //# sourceMappingURL=structure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structure.d.ts","sourceRoot":"","sources":["../../src/structure.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAA0C,MAAM,eAAe,CAAC;AAEjJ;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,aAAa;IACxB,iEAAiE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEjE,8DAA8D;;GAE7D,CAAC;AACJ,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC;AAEjD,MAAM,MAAM,SAAS,GAAG,WAAW,CAAC,OAAO,aAAa,CAAC,CAAC;AAG1D,4CAA4C;AAC5C,eAAO,MAAM,iBAAiB;IAX5B,iEAAiE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEjE,8DAA8D;;GASlB,CAAC;AAC/C,wCAAwC;AACxC,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC;AAC9C,wCAAwC;AACxC,MAAM,MAAM,aAAa,GAAG,SAAS,CAAC;AAEtC;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,eAAe;IAC1B,kCAAkC;;EAKlC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC;AAErD,MAAM,MAAM,WAAW,GAAG,WAAW,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,YAAY;IA1BvB,kCAAkC;;GA0BkB,CAAC;AACvD,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC;AAE/C,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAQnD;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,+BAA+B;IAC/B,IAAI,EAAE,QAAQ,CAAC;IACf,yCAAyC;IACzC,SAAS,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,eAAe,CAgEhF;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,GAAG,eAAe,CAEnF;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,qBAAqB;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,gCAAgC;IAChC,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,sBAAsB,CAWzE;AAqCD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,qBAAqB,CAUlE;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ,CAG3D"}