@hatua/schema 0.0.0 → 0.1.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.
- package/LICENSE +21 -0
- package/dist/contract.test.d.ts +1 -0
- package/dist/generated/component.d.ts +312 -0
- package/dist/generated/context.d.ts +43 -0
- package/dist/generated/definition.d.ts +309 -0
- package/dist/generated/execution.d.ts +148 -0
- package/dist/generated/function.d.ts +193 -0
- package/dist/generated/index.d.ts +5 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +335 -0
- package/dist/references.d.ts +77 -0
- package/package.json +25 -5
- package/README.md +0 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Pedro Gomes
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const manifest: z.ZodObject<{
|
|
3
|
+
kind: z.ZodEnum<{
|
|
4
|
+
component: "component";
|
|
5
|
+
trigger: "trigger";
|
|
6
|
+
}>;
|
|
7
|
+
use: z.ZodString;
|
|
8
|
+
name: z.ZodString;
|
|
9
|
+
group: z.ZodOptional<z.ZodString>;
|
|
10
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
11
|
+
blurb: z.ZodOptional<z.ZodString>;
|
|
12
|
+
once: z.ZodOptional<z.ZodBoolean>;
|
|
13
|
+
fixed: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
15
|
+
k: z.ZodString;
|
|
16
|
+
label: z.ZodString;
|
|
17
|
+
kind: z.ZodEnum<{
|
|
18
|
+
number: "number";
|
|
19
|
+
text: "text";
|
|
20
|
+
mono: "mono";
|
|
21
|
+
textarea: "textarea";
|
|
22
|
+
ref: "ref";
|
|
23
|
+
map: "map";
|
|
24
|
+
enum: "enum";
|
|
25
|
+
bool: "bool";
|
|
26
|
+
conn: "conn";
|
|
27
|
+
secret: "secret";
|
|
28
|
+
}>;
|
|
29
|
+
conn_type: z.ZodOptional<z.ZodString>;
|
|
30
|
+
req: z.ZodOptional<z.ZodBoolean>;
|
|
31
|
+
hint: z.ZodOptional<z.ZodString>;
|
|
32
|
+
ph: z.ZodOptional<z.ZodString>;
|
|
33
|
+
mono: z.ZodOptional<z.ZodBoolean>;
|
|
34
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
35
|
+
value: z.ZodString;
|
|
36
|
+
label: z.ZodString;
|
|
37
|
+
hint: z.ZodOptional<z.ZodString>;
|
|
38
|
+
}, z.core.$strict>>>;
|
|
39
|
+
toggleLabel: z.ZodOptional<z.ZodString>;
|
|
40
|
+
entry_types: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
41
|
+
number: "number";
|
|
42
|
+
boolean: "boolean";
|
|
43
|
+
object: "object";
|
|
44
|
+
text: "text";
|
|
45
|
+
datetime: "datetime";
|
|
46
|
+
list: "list";
|
|
47
|
+
}>>>;
|
|
48
|
+
when: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
49
|
+
}, z.core.$strict>>;
|
|
50
|
+
outputs: z.ZodArray<z.ZodObject<{
|
|
51
|
+
k: z.ZodString;
|
|
52
|
+
label: z.ZodString;
|
|
53
|
+
t: z.ZodEnum<{
|
|
54
|
+
number: "number";
|
|
55
|
+
boolean: "boolean";
|
|
56
|
+
object: "object";
|
|
57
|
+
text: "text";
|
|
58
|
+
datetime: "datetime";
|
|
59
|
+
list: "list";
|
|
60
|
+
item: "item";
|
|
61
|
+
}>;
|
|
62
|
+
of: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>>;
|
|
63
|
+
}, z.core.$strict>>;
|
|
64
|
+
metadata: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
65
|
+
k: z.ZodString;
|
|
66
|
+
label: z.ZodString;
|
|
67
|
+
t: z.ZodEnum<{
|
|
68
|
+
number: "number";
|
|
69
|
+
boolean: "boolean";
|
|
70
|
+
text: "text";
|
|
71
|
+
datetime: "datetime";
|
|
72
|
+
}>;
|
|
73
|
+
role: z.ZodEnum<{
|
|
74
|
+
measure: "measure";
|
|
75
|
+
dimension: "dimension";
|
|
76
|
+
}>;
|
|
77
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
78
|
+
}, z.core.$strict>>>;
|
|
79
|
+
}, z.core.$strict>;
|
|
80
|
+
export type Manifest = z.infer<typeof manifest>;
|
|
81
|
+
export declare const field: z.ZodObject<{
|
|
82
|
+
k: z.ZodString;
|
|
83
|
+
label: z.ZodString;
|
|
84
|
+
kind: z.ZodEnum<{
|
|
85
|
+
number: "number";
|
|
86
|
+
text: "text";
|
|
87
|
+
mono: "mono";
|
|
88
|
+
textarea: "textarea";
|
|
89
|
+
ref: "ref";
|
|
90
|
+
map: "map";
|
|
91
|
+
enum: "enum";
|
|
92
|
+
bool: "bool";
|
|
93
|
+
conn: "conn";
|
|
94
|
+
secret: "secret";
|
|
95
|
+
}>;
|
|
96
|
+
conn_type: z.ZodOptional<z.ZodString>;
|
|
97
|
+
req: z.ZodOptional<z.ZodBoolean>;
|
|
98
|
+
hint: z.ZodOptional<z.ZodString>;
|
|
99
|
+
ph: z.ZodOptional<z.ZodString>;
|
|
100
|
+
mono: z.ZodOptional<z.ZodBoolean>;
|
|
101
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
102
|
+
value: z.ZodString;
|
|
103
|
+
label: z.ZodString;
|
|
104
|
+
hint: z.ZodOptional<z.ZodString>;
|
|
105
|
+
}, z.core.$strict>>>;
|
|
106
|
+
toggleLabel: z.ZodOptional<z.ZodString>;
|
|
107
|
+
entry_types: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
108
|
+
number: "number";
|
|
109
|
+
boolean: "boolean";
|
|
110
|
+
object: "object";
|
|
111
|
+
text: "text";
|
|
112
|
+
datetime: "datetime";
|
|
113
|
+
list: "list";
|
|
114
|
+
}>>>;
|
|
115
|
+
when: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
116
|
+
}, z.core.$strict>;
|
|
117
|
+
export type Field = z.infer<typeof field>;
|
|
118
|
+
export declare const output: z.ZodObject<{
|
|
119
|
+
k: z.ZodString;
|
|
120
|
+
label: z.ZodString;
|
|
121
|
+
t: z.ZodEnum<{
|
|
122
|
+
number: "number";
|
|
123
|
+
boolean: "boolean";
|
|
124
|
+
object: "object";
|
|
125
|
+
text: "text";
|
|
126
|
+
datetime: "datetime";
|
|
127
|
+
list: "list";
|
|
128
|
+
item: "item";
|
|
129
|
+
}>;
|
|
130
|
+
of: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>>;
|
|
131
|
+
}, z.core.$strict>;
|
|
132
|
+
export type Output = z.infer<typeof output>;
|
|
133
|
+
export declare const metadataDescriptor: z.ZodObject<{
|
|
134
|
+
k: z.ZodString;
|
|
135
|
+
label: z.ZodString;
|
|
136
|
+
t: z.ZodEnum<{
|
|
137
|
+
number: "number";
|
|
138
|
+
boolean: "boolean";
|
|
139
|
+
text: "text";
|
|
140
|
+
datetime: "datetime";
|
|
141
|
+
}>;
|
|
142
|
+
role: z.ZodEnum<{
|
|
143
|
+
measure: "measure";
|
|
144
|
+
dimension: "dimension";
|
|
145
|
+
}>;
|
|
146
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
147
|
+
}, z.core.$strict>;
|
|
148
|
+
export type MetadataDescriptor = z.infer<typeof metadataDescriptor>;
|
|
149
|
+
/**
|
|
150
|
+
* The Host-supplied declaration of a step type. Hatua ships its own set and Hosts add business-specific ones; the format is identical and the only difference is who wrote the file.
|
|
151
|
+
* Adding a component is adding a manifest entry: the library card, the inspector form, the reference tree, the map chips, the validation and the YAML output all follow from it, with no screen-level code.
|
|
152
|
+
* There is deliberately no connector manifest. Connections are established outside Hatua and arrive from a Host interface carrying their own type, which a `conn` field matches against via `conn_type`.
|
|
153
|
+
* Accepts either a single manifest or a `components:` catalogue — one file per component suits authoring and diffing, a catalogue suits serving.
|
|
154
|
+
*/
|
|
155
|
+
export declare const componentManifest: z.ZodUnion<readonly [z.ZodObject<{
|
|
156
|
+
kind: z.ZodEnum<{
|
|
157
|
+
component: "component";
|
|
158
|
+
trigger: "trigger";
|
|
159
|
+
}>;
|
|
160
|
+
use: z.ZodString;
|
|
161
|
+
name: z.ZodString;
|
|
162
|
+
group: z.ZodOptional<z.ZodString>;
|
|
163
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
164
|
+
blurb: z.ZodOptional<z.ZodString>;
|
|
165
|
+
once: z.ZodOptional<z.ZodBoolean>;
|
|
166
|
+
fixed: z.ZodOptional<z.ZodBoolean>;
|
|
167
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
168
|
+
k: z.ZodString;
|
|
169
|
+
label: z.ZodString;
|
|
170
|
+
kind: z.ZodEnum<{
|
|
171
|
+
number: "number";
|
|
172
|
+
text: "text";
|
|
173
|
+
mono: "mono";
|
|
174
|
+
textarea: "textarea";
|
|
175
|
+
ref: "ref";
|
|
176
|
+
map: "map";
|
|
177
|
+
enum: "enum";
|
|
178
|
+
bool: "bool";
|
|
179
|
+
conn: "conn";
|
|
180
|
+
secret: "secret";
|
|
181
|
+
}>;
|
|
182
|
+
conn_type: z.ZodOptional<z.ZodString>;
|
|
183
|
+
req: z.ZodOptional<z.ZodBoolean>;
|
|
184
|
+
hint: z.ZodOptional<z.ZodString>;
|
|
185
|
+
ph: z.ZodOptional<z.ZodString>;
|
|
186
|
+
mono: z.ZodOptional<z.ZodBoolean>;
|
|
187
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
188
|
+
value: z.ZodString;
|
|
189
|
+
label: z.ZodString;
|
|
190
|
+
hint: z.ZodOptional<z.ZodString>;
|
|
191
|
+
}, z.core.$strict>>>;
|
|
192
|
+
toggleLabel: z.ZodOptional<z.ZodString>;
|
|
193
|
+
entry_types: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
194
|
+
number: "number";
|
|
195
|
+
boolean: "boolean";
|
|
196
|
+
object: "object";
|
|
197
|
+
text: "text";
|
|
198
|
+
datetime: "datetime";
|
|
199
|
+
list: "list";
|
|
200
|
+
}>>>;
|
|
201
|
+
when: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
202
|
+
}, z.core.$strict>>;
|
|
203
|
+
outputs: z.ZodArray<z.ZodObject<{
|
|
204
|
+
k: z.ZodString;
|
|
205
|
+
label: z.ZodString;
|
|
206
|
+
t: z.ZodEnum<{
|
|
207
|
+
number: "number";
|
|
208
|
+
boolean: "boolean";
|
|
209
|
+
object: "object";
|
|
210
|
+
text: "text";
|
|
211
|
+
datetime: "datetime";
|
|
212
|
+
list: "list";
|
|
213
|
+
item: "item";
|
|
214
|
+
}>;
|
|
215
|
+
of: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>>;
|
|
216
|
+
}, z.core.$strict>>;
|
|
217
|
+
metadata: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
218
|
+
k: z.ZodString;
|
|
219
|
+
label: z.ZodString;
|
|
220
|
+
t: z.ZodEnum<{
|
|
221
|
+
number: "number";
|
|
222
|
+
boolean: "boolean";
|
|
223
|
+
text: "text";
|
|
224
|
+
datetime: "datetime";
|
|
225
|
+
}>;
|
|
226
|
+
role: z.ZodEnum<{
|
|
227
|
+
measure: "measure";
|
|
228
|
+
dimension: "dimension";
|
|
229
|
+
}>;
|
|
230
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
231
|
+
}, z.core.$strict>>>;
|
|
232
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
233
|
+
components: z.ZodArray<z.ZodObject<{
|
|
234
|
+
kind: z.ZodEnum<{
|
|
235
|
+
component: "component";
|
|
236
|
+
trigger: "trigger";
|
|
237
|
+
}>;
|
|
238
|
+
use: z.ZodString;
|
|
239
|
+
name: z.ZodString;
|
|
240
|
+
group: z.ZodOptional<z.ZodString>;
|
|
241
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
242
|
+
blurb: z.ZodOptional<z.ZodString>;
|
|
243
|
+
once: z.ZodOptional<z.ZodBoolean>;
|
|
244
|
+
fixed: z.ZodOptional<z.ZodBoolean>;
|
|
245
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
246
|
+
k: z.ZodString;
|
|
247
|
+
label: z.ZodString;
|
|
248
|
+
kind: z.ZodEnum<{
|
|
249
|
+
number: "number";
|
|
250
|
+
text: "text";
|
|
251
|
+
mono: "mono";
|
|
252
|
+
textarea: "textarea";
|
|
253
|
+
ref: "ref";
|
|
254
|
+
map: "map";
|
|
255
|
+
enum: "enum";
|
|
256
|
+
bool: "bool";
|
|
257
|
+
conn: "conn";
|
|
258
|
+
secret: "secret";
|
|
259
|
+
}>;
|
|
260
|
+
conn_type: z.ZodOptional<z.ZodString>;
|
|
261
|
+
req: z.ZodOptional<z.ZodBoolean>;
|
|
262
|
+
hint: z.ZodOptional<z.ZodString>;
|
|
263
|
+
ph: z.ZodOptional<z.ZodString>;
|
|
264
|
+
mono: z.ZodOptional<z.ZodBoolean>;
|
|
265
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
266
|
+
value: z.ZodString;
|
|
267
|
+
label: z.ZodString;
|
|
268
|
+
hint: z.ZodOptional<z.ZodString>;
|
|
269
|
+
}, z.core.$strict>>>;
|
|
270
|
+
toggleLabel: z.ZodOptional<z.ZodString>;
|
|
271
|
+
entry_types: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
272
|
+
number: "number";
|
|
273
|
+
boolean: "boolean";
|
|
274
|
+
object: "object";
|
|
275
|
+
text: "text";
|
|
276
|
+
datetime: "datetime";
|
|
277
|
+
list: "list";
|
|
278
|
+
}>>>;
|
|
279
|
+
when: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
280
|
+
}, z.core.$strict>>;
|
|
281
|
+
outputs: z.ZodArray<z.ZodObject<{
|
|
282
|
+
k: z.ZodString;
|
|
283
|
+
label: z.ZodString;
|
|
284
|
+
t: z.ZodEnum<{
|
|
285
|
+
number: "number";
|
|
286
|
+
boolean: "boolean";
|
|
287
|
+
object: "object";
|
|
288
|
+
text: "text";
|
|
289
|
+
datetime: "datetime";
|
|
290
|
+
list: "list";
|
|
291
|
+
item: "item";
|
|
292
|
+
}>;
|
|
293
|
+
of: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>>;
|
|
294
|
+
}, z.core.$strict>>;
|
|
295
|
+
metadata: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
296
|
+
k: z.ZodString;
|
|
297
|
+
label: z.ZodString;
|
|
298
|
+
t: z.ZodEnum<{
|
|
299
|
+
number: "number";
|
|
300
|
+
boolean: "boolean";
|
|
301
|
+
text: "text";
|
|
302
|
+
datetime: "datetime";
|
|
303
|
+
}>;
|
|
304
|
+
role: z.ZodEnum<{
|
|
305
|
+
measure: "measure";
|
|
306
|
+
dimension: "dimension";
|
|
307
|
+
}>;
|
|
308
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
309
|
+
}, z.core.$strict>>>;
|
|
310
|
+
}, z.core.$strict>>;
|
|
311
|
+
}, z.core.$strict>]>;
|
|
312
|
+
export type ComponentManifest = z.infer<typeof componentManifest>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const contextKey: z.ZodObject<{
|
|
3
|
+
k: z.ZodString;
|
|
4
|
+
label: z.ZodString;
|
|
5
|
+
t: z.ZodEnum<{
|
|
6
|
+
number: "number";
|
|
7
|
+
boolean: "boolean";
|
|
8
|
+
object: "object";
|
|
9
|
+
text: "text";
|
|
10
|
+
datetime: "datetime";
|
|
11
|
+
list: "list";
|
|
12
|
+
}>;
|
|
13
|
+
description: z.ZodOptional<z.ZodString>;
|
|
14
|
+
of: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>>;
|
|
15
|
+
}, z.core.$strict>;
|
|
16
|
+
export type ContextKey = z.infer<typeof contextKey>;
|
|
17
|
+
/**
|
|
18
|
+
* The Host-supplied declaration of the ambient values it hands its runner for every execution — the run id, the tenant, the caller's address, when the run started, who triggered it. Addressed as `run.` from any Expression, beside `triggers.` and `var.`.
|
|
19
|
+
* Hatua only ever reads these. It declares no keys of its own and invents none: without a declaration there is no Run Context, the same bargain ADR-0007 strikes for connections and ADR-0010 for functions — a shape Hatua reads so the builder can offer and type-check it, and values the Host's runner supplies.
|
|
20
|
+
* There is exactly one Run Context per execution, so this file declares keys directly rather than naming a type someone instantiates. That is why there is no `use`, no `name`, and no catalogue wrapper: a Host serves one of these, and a second is a mistake rather than a longer list.
|
|
21
|
+
* A key is spelled `{k, label, t}` — the same triple every declared output already uses, with `of` nesting the same way — because the reference tree, the completion list and the type checker read outputs today and a second spelling for the same idea would be a second reader to keep in step. What it adds is `description`, for the sentence the completion list shows under the focused row.
|
|
22
|
+
* This is a separate file rather than a fourth `kind:` inside the Component Manifest, for the reason ADR-0010 gives about functions: a conditional manifest shape would need the JSON-Schema-to-zod generator to grow `if`/`then`, and ADR-0006 keeps that generator deliberately narrow precisely because a silent mistranslation there is the failure the whole decision prevents. A Component Manifest requires `use`, `name`, `fields` and `outputs`, none of which a Run Context has.
|
|
23
|
+
*/
|
|
24
|
+
export declare const runContextManifest: z.ZodObject<{
|
|
25
|
+
kind: z.ZodEnum<{
|
|
26
|
+
context: "context";
|
|
27
|
+
}>;
|
|
28
|
+
keys: z.ZodArray<z.ZodObject<{
|
|
29
|
+
k: z.ZodString;
|
|
30
|
+
label: z.ZodString;
|
|
31
|
+
t: z.ZodEnum<{
|
|
32
|
+
number: "number";
|
|
33
|
+
boolean: "boolean";
|
|
34
|
+
object: "object";
|
|
35
|
+
text: "text";
|
|
36
|
+
datetime: "datetime";
|
|
37
|
+
list: "list";
|
|
38
|
+
}>;
|
|
39
|
+
description: z.ZodOptional<z.ZodString>;
|
|
40
|
+
of: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>>;
|
|
41
|
+
}, z.core.$strict>>;
|
|
42
|
+
}, z.core.$strict>;
|
|
43
|
+
export type RunContextManifest = z.infer<typeof runContextManifest>;
|