@builder-builder/builder 0.0.13 → 0.0.15
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/dist/bb.d.ts +3 -1
- package/dist/bb.js +6 -1
- package/dist/check.d.ts +2 -2
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +53 -0
- package/dist/codegen/index.d.ts +7 -0
- package/dist/codegen/index.js +212 -0
- package/dist/codegen/template.d.ts +5 -0
- package/dist/codegen/template.js +17 -0
- package/dist/entities/builder/builder.d.ts +11 -1
- package/dist/entities/builder/builder.js +22 -6
- package/dist/entities/collection/collection.d.ts +7 -1
- package/dist/entities/collection/collection.js +9 -2
- package/dist/entities/collection/config.d.ts +6 -1
- package/dist/entities/collection/config.js +9 -2
- package/dist/entities/component/component.d.ts +41 -1
- package/dist/entities/component/component.js +9 -2
- package/dist/entities/component/details.d.ts +11 -2
- package/dist/entities/component/details.js +9 -2
- package/dist/entities/component/field.d.ts +10 -1
- package/dist/entities/component/field.js +13 -3
- package/dist/entities/index.d.ts +7 -3
- package/dist/entities/index.js +3 -1
- package/dist/entities/kind.d.ts +1 -1
- package/dist/entities/model/model.d.ts +5 -1
- package/dist/entities/model/model.js +10 -3
- package/dist/entities/model/models.js +9 -5
- package/dist/entities/option/option.d.ts +41 -1
- package/dist/entities/option/option.js +9 -2
- package/dist/entities/option/select.d.ts +7 -1
- package/dist/entities/option/select.js +17 -6
- package/dist/entities/option/toggle.d.ts +7 -1
- package/dist/entities/option/toggle.js +16 -4
- package/dist/entities/option/values.d.ts +6 -0
- package/dist/entities/pricing.d.ts +64 -0
- package/dist/entities/pricing.js +48 -0
- package/dist/entities/serialise.d.ts +632 -8
- package/dist/entities/serialise.js +33 -12
- package/dist/entities/tags.d.ts +3 -0
- package/dist/entities/tags.js +2 -0
- package/dist/entities/ui/describe.d.ts +231 -8
- package/dist/entities/ui/describe.js +12 -5
- package/dist/entities/ui/index.d.ts +2 -0
- package/dist/entities/ui/index.js +1 -0
- package/dist/entities/ui/input.d.ts +343 -0
- package/dist/entities/ui/input.js +51 -0
- package/dist/entities/ui/page.d.ts +231 -8
- package/dist/entities/ui/page.js +12 -5
- package/dist/entities/ui/pages.d.ts +5 -1
- package/dist/entities/ui/pages.js +9 -2
- package/dist/entities/ui/ui.d.ts +9 -4
- package/dist/entities/ui/ui.js +29 -11
- package/dist/entities/validated.d.ts +7 -3
- package/dist/exception.d.ts +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/instance.d.ts +9 -0
- package/dist/instance.js +3 -1
- package/dist/mappers/index.d.ts +6 -4
- package/dist/mappers/index.js +3 -2
- package/dist/mappers/pricing.d.ts +3 -0
- package/dist/mappers/pricing.js +101 -0
- package/dist/mappers/render/index.d.ts +1 -1
- package/dist/mappers/render/pages.d.ts +8 -0
- package/dist/mappers/render/pages.js +2 -1
- package/dist/mappers/render/render.js +19 -3
- package/dist/mappers/resolve.d.ts +4 -4
- package/dist/mappers/variants/index.d.ts +2 -1
- package/dist/mappers/variants/index.js +2 -1
- package/dist/mappers/variants/variants.d.ts +5 -2
- package/dist/mappers/variants/variants.js +2 -2
- package/dist/validate/brand.d.ts +0 -7
- package/dist/validate/brand.js +5 -5
- package/dist/validate/builder.d.ts +2 -1
- package/dist/validate/builder.js +19 -13
- package/dist/validate/errors.d.ts +138 -0
- package/dist/validate/errors.js +148 -0
- package/dist/validate/expectations.d.ts +3 -10
- package/dist/validate/expectations.js +8 -10
- package/dist/validate/index.d.ts +10 -14
- package/dist/validate/index.js +5 -7
- package/dist/validate/instance.d.ts +2 -15
- package/dist/validate/instance.js +41 -40
- package/dist/validate/model.d.ts +4 -31
- package/dist/validate/model.js +157 -176
- package/dist/validate/pricing.d.ts +6 -0
- package/dist/validate/pricing.js +71 -0
- package/dist/validate/resolve.d.ts +3 -15
- package/dist/validate/resolve.js +66 -69
- package/dist/validate/result.d.ts +1 -7
- package/dist/validate/result.js +1 -4
- package/dist/validate/ui.d.ts +4 -4
- package/dist/validate/ui.js +80 -62
- package/dist/validate/variants.d.ts +2 -53
- package/dist/validate/variants.js +83 -86
- package/package.json +12 -3
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import type { BuilderPath } from '../../paths';
|
|
2
|
+
import type { Paramable, ParamableSerialised } from '../../references';
|
|
3
|
+
import type { BuilderModelGeneric, BuilderModelStateOf } from '../model/model';
|
|
4
|
+
import type { BuilderModelState } from '../model/state';
|
|
5
|
+
import type { BuilderTags } from '../tags';
|
|
6
|
+
import type { BuilderValidPath } from '../when';
|
|
7
|
+
import * as v from 'valibot';
|
|
8
|
+
export type BuilderUIInputMetadata = Paramable<Record<string, Paramable<unknown>>>;
|
|
9
|
+
export type BuilderUIInputMetadataSerialised = ParamableSerialised<Record<string, ParamableSerialised<unknown>>>;
|
|
10
|
+
export declare class BuilderUIInput<const Path extends Paramable<BuilderPath> = Paramable<BuilderPath>, const DisplayName extends Paramable<string> = Paramable<string>, const Kind extends Paramable<string> = Paramable<string>, const Metadata extends BuilderUIInputMetadata = BuilderUIInputMetadata> {
|
|
11
|
+
#private;
|
|
12
|
+
readonly type: "input";
|
|
13
|
+
readonly path: Path;
|
|
14
|
+
readonly displayName?: DisplayName;
|
|
15
|
+
readonly kind?: Kind;
|
|
16
|
+
readonly metadata?: Metadata;
|
|
17
|
+
readonly tags?: BuilderTags;
|
|
18
|
+
constructor(path: Path, displayName?: DisplayName, kind?: Kind, metadata?: Metadata, tags?: BuilderTags);
|
|
19
|
+
display<const NewDisplayName extends Paramable<string>>(displayName: NewDisplayName): BuilderUIInput<Path, NewDisplayName, Kind, Metadata>;
|
|
20
|
+
as<const NewKind extends Paramable<string>>(kind: NewKind): BuilderUIInput<Path, DisplayName, NewKind, Metadata>;
|
|
21
|
+
meta<const NewMetadata extends BuilderUIInputMetadata>(metadata: NewMetadata): BuilderUIInput<Path, DisplayName, Kind, NewMetadata>;
|
|
22
|
+
tag(...tags: Array<string>): BuilderUIInput<Path, DisplayName, Kind, Metadata>;
|
|
23
|
+
}
|
|
24
|
+
export declare function input<const Path extends Paramable<BuilderPath>>(path: Path): BuilderUIInput<Path>;
|
|
25
|
+
export declare const BuilderUIInputSchema: v.InstanceSchema<typeof BuilderUIInput, undefined>;
|
|
26
|
+
export declare const BuilderUIInputMetadataSchema: v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
27
|
+
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
28
|
+
readonly id: v.StringSchema<undefined>;
|
|
29
|
+
readonly name: v.StringSchema<undefined>;
|
|
30
|
+
}, undefined>, v.ReadonlyAction<{
|
|
31
|
+
type: "parameter";
|
|
32
|
+
id: string;
|
|
33
|
+
name: string;
|
|
34
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
35
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
36
|
+
readonly id: v.StringSchema<undefined>;
|
|
37
|
+
}, undefined>, v.ReadonlyAction<{
|
|
38
|
+
type: "ref";
|
|
39
|
+
id: string;
|
|
40
|
+
}>]>, v.UnknownSchema], undefined>, undefined>, v.ReadonlyAction<{
|
|
41
|
+
[x: string]: unknown;
|
|
42
|
+
}>]>;
|
|
43
|
+
export declare const BuilderUIInputSerialisedSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
44
|
+
readonly type: v.LiteralSchema<"input", undefined>;
|
|
45
|
+
readonly path: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
46
|
+
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
47
|
+
readonly id: v.StringSchema<undefined>;
|
|
48
|
+
readonly name: v.StringSchema<undefined>;
|
|
49
|
+
}, undefined>, v.ReadonlyAction<{
|
|
50
|
+
type: "parameter";
|
|
51
|
+
id: string;
|
|
52
|
+
name: string;
|
|
53
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
54
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
55
|
+
readonly id: v.StringSchema<undefined>;
|
|
56
|
+
}, undefined>, v.ReadonlyAction<{
|
|
57
|
+
type: "ref";
|
|
58
|
+
id: string;
|
|
59
|
+
}>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, v.ReadonlyAction<(string | number)[]>]>], undefined>;
|
|
60
|
+
readonly displayName: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
61
|
+
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
62
|
+
readonly id: v.StringSchema<undefined>;
|
|
63
|
+
readonly name: v.StringSchema<undefined>;
|
|
64
|
+
}, undefined>, v.ReadonlyAction<{
|
|
65
|
+
type: "parameter";
|
|
66
|
+
id: string;
|
|
67
|
+
name: string;
|
|
68
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
69
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
70
|
+
readonly id: v.StringSchema<undefined>;
|
|
71
|
+
}, undefined>, v.ReadonlyAction<{
|
|
72
|
+
type: "ref";
|
|
73
|
+
id: string;
|
|
74
|
+
}>]>, v.StringSchema<undefined>], undefined>, undefined>;
|
|
75
|
+
readonly kind: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
76
|
+
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
77
|
+
readonly id: v.StringSchema<undefined>;
|
|
78
|
+
readonly name: v.StringSchema<undefined>;
|
|
79
|
+
}, undefined>, v.ReadonlyAction<{
|
|
80
|
+
type: "parameter";
|
|
81
|
+
id: string;
|
|
82
|
+
name: string;
|
|
83
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
84
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
85
|
+
readonly id: v.StringSchema<undefined>;
|
|
86
|
+
}, undefined>, v.ReadonlyAction<{
|
|
87
|
+
type: "ref";
|
|
88
|
+
id: string;
|
|
89
|
+
}>]>, v.StringSchema<undefined>], undefined>, undefined>;
|
|
90
|
+
readonly metadata: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
91
|
+
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
92
|
+
readonly id: v.StringSchema<undefined>;
|
|
93
|
+
readonly name: v.StringSchema<undefined>;
|
|
94
|
+
}, undefined>, v.ReadonlyAction<{
|
|
95
|
+
type: "parameter";
|
|
96
|
+
id: string;
|
|
97
|
+
name: string;
|
|
98
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
99
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
100
|
+
readonly id: v.StringSchema<undefined>;
|
|
101
|
+
}, undefined>, v.ReadonlyAction<{
|
|
102
|
+
type: "ref";
|
|
103
|
+
id: string;
|
|
104
|
+
}>]>, v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
105
|
+
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
106
|
+
readonly id: v.StringSchema<undefined>;
|
|
107
|
+
readonly name: v.StringSchema<undefined>;
|
|
108
|
+
}, undefined>, v.ReadonlyAction<{
|
|
109
|
+
type: "parameter";
|
|
110
|
+
id: string;
|
|
111
|
+
name: string;
|
|
112
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
113
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
114
|
+
readonly id: v.StringSchema<undefined>;
|
|
115
|
+
}, undefined>, v.ReadonlyAction<{
|
|
116
|
+
type: "ref";
|
|
117
|
+
id: string;
|
|
118
|
+
}>]>, v.UnknownSchema], undefined>, undefined>, v.ReadonlyAction<{
|
|
119
|
+
[x: string]: unknown;
|
|
120
|
+
}>]>], undefined>, undefined>;
|
|
121
|
+
readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
|
|
122
|
+
}, undefined>, v.ReadonlyAction<{
|
|
123
|
+
type: "input";
|
|
124
|
+
path: readonly (string | number)[] | Readonly<{
|
|
125
|
+
type: "parameter";
|
|
126
|
+
id: string;
|
|
127
|
+
name: string;
|
|
128
|
+
}> | Readonly<{
|
|
129
|
+
type: "ref";
|
|
130
|
+
id: string;
|
|
131
|
+
}>;
|
|
132
|
+
displayName?: string | Readonly<{
|
|
133
|
+
type: "parameter";
|
|
134
|
+
id: string;
|
|
135
|
+
name: string;
|
|
136
|
+
}> | Readonly<{
|
|
137
|
+
type: "ref";
|
|
138
|
+
id: string;
|
|
139
|
+
}> | undefined;
|
|
140
|
+
kind?: string | Readonly<{
|
|
141
|
+
type: "parameter";
|
|
142
|
+
id: string;
|
|
143
|
+
name: string;
|
|
144
|
+
}> | Readonly<{
|
|
145
|
+
type: "ref";
|
|
146
|
+
id: string;
|
|
147
|
+
}> | undefined;
|
|
148
|
+
metadata?: Readonly<{
|
|
149
|
+
type: "parameter";
|
|
150
|
+
id: string;
|
|
151
|
+
name: string;
|
|
152
|
+
}> | Readonly<{
|
|
153
|
+
type: "ref";
|
|
154
|
+
id: string;
|
|
155
|
+
}> | Readonly<{
|
|
156
|
+
[x: string]: unknown;
|
|
157
|
+
}> | undefined;
|
|
158
|
+
tags?: readonly string[] | undefined;
|
|
159
|
+
}>]>;
|
|
160
|
+
export type BuilderUIInputSerialised = v.InferOutput<typeof BuilderUIInputSerialisedSchema>;
|
|
161
|
+
export declare const BuilderUIInputsSerialisedSchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
162
|
+
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
163
|
+
readonly id: v.StringSchema<undefined>;
|
|
164
|
+
readonly name: v.StringSchema<undefined>;
|
|
165
|
+
}, undefined>, v.ReadonlyAction<{
|
|
166
|
+
type: "parameter";
|
|
167
|
+
id: string;
|
|
168
|
+
name: string;
|
|
169
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
170
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
171
|
+
readonly id: v.StringSchema<undefined>;
|
|
172
|
+
}, undefined>, v.ReadonlyAction<{
|
|
173
|
+
type: "ref";
|
|
174
|
+
id: string;
|
|
175
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
176
|
+
readonly type: v.LiteralSchema<"input", undefined>;
|
|
177
|
+
readonly path: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
178
|
+
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
179
|
+
readonly id: v.StringSchema<undefined>;
|
|
180
|
+
readonly name: v.StringSchema<undefined>;
|
|
181
|
+
}, undefined>, v.ReadonlyAction<{
|
|
182
|
+
type: "parameter";
|
|
183
|
+
id: string;
|
|
184
|
+
name: string;
|
|
185
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
186
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
187
|
+
readonly id: v.StringSchema<undefined>;
|
|
188
|
+
}, undefined>, v.ReadonlyAction<{
|
|
189
|
+
type: "ref";
|
|
190
|
+
id: string;
|
|
191
|
+
}>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, v.ReadonlyAction<(string | number)[]>]>], undefined>;
|
|
192
|
+
readonly displayName: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
193
|
+
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
194
|
+
readonly id: v.StringSchema<undefined>;
|
|
195
|
+
readonly name: v.StringSchema<undefined>;
|
|
196
|
+
}, undefined>, v.ReadonlyAction<{
|
|
197
|
+
type: "parameter";
|
|
198
|
+
id: string;
|
|
199
|
+
name: string;
|
|
200
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
201
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
202
|
+
readonly id: v.StringSchema<undefined>;
|
|
203
|
+
}, undefined>, v.ReadonlyAction<{
|
|
204
|
+
type: "ref";
|
|
205
|
+
id: string;
|
|
206
|
+
}>]>, v.StringSchema<undefined>], undefined>, undefined>;
|
|
207
|
+
readonly kind: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
208
|
+
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
209
|
+
readonly id: v.StringSchema<undefined>;
|
|
210
|
+
readonly name: v.StringSchema<undefined>;
|
|
211
|
+
}, undefined>, v.ReadonlyAction<{
|
|
212
|
+
type: "parameter";
|
|
213
|
+
id: string;
|
|
214
|
+
name: string;
|
|
215
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
216
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
217
|
+
readonly id: v.StringSchema<undefined>;
|
|
218
|
+
}, undefined>, v.ReadonlyAction<{
|
|
219
|
+
type: "ref";
|
|
220
|
+
id: string;
|
|
221
|
+
}>]>, v.StringSchema<undefined>], undefined>, undefined>;
|
|
222
|
+
readonly metadata: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
223
|
+
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
224
|
+
readonly id: v.StringSchema<undefined>;
|
|
225
|
+
readonly name: v.StringSchema<undefined>;
|
|
226
|
+
}, undefined>, v.ReadonlyAction<{
|
|
227
|
+
type: "parameter";
|
|
228
|
+
id: string;
|
|
229
|
+
name: string;
|
|
230
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
231
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
232
|
+
readonly id: v.StringSchema<undefined>;
|
|
233
|
+
}, undefined>, v.ReadonlyAction<{
|
|
234
|
+
type: "ref";
|
|
235
|
+
id: string;
|
|
236
|
+
}>]>, v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
237
|
+
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
238
|
+
readonly id: v.StringSchema<undefined>;
|
|
239
|
+
readonly name: v.StringSchema<undefined>;
|
|
240
|
+
}, undefined>, v.ReadonlyAction<{
|
|
241
|
+
type: "parameter";
|
|
242
|
+
id: string;
|
|
243
|
+
name: string;
|
|
244
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
245
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
246
|
+
readonly id: v.StringSchema<undefined>;
|
|
247
|
+
}, undefined>, v.ReadonlyAction<{
|
|
248
|
+
type: "ref";
|
|
249
|
+
id: string;
|
|
250
|
+
}>]>, v.UnknownSchema], undefined>, undefined>, v.ReadonlyAction<{
|
|
251
|
+
[x: string]: unknown;
|
|
252
|
+
}>]>], undefined>, undefined>;
|
|
253
|
+
readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
|
|
254
|
+
}, undefined>, v.ReadonlyAction<{
|
|
255
|
+
type: "input";
|
|
256
|
+
path: readonly (string | number)[] | Readonly<{
|
|
257
|
+
type: "parameter";
|
|
258
|
+
id: string;
|
|
259
|
+
name: string;
|
|
260
|
+
}> | Readonly<{
|
|
261
|
+
type: "ref";
|
|
262
|
+
id: string;
|
|
263
|
+
}>;
|
|
264
|
+
displayName?: string | Readonly<{
|
|
265
|
+
type: "parameter";
|
|
266
|
+
id: string;
|
|
267
|
+
name: string;
|
|
268
|
+
}> | Readonly<{
|
|
269
|
+
type: "ref";
|
|
270
|
+
id: string;
|
|
271
|
+
}> | undefined;
|
|
272
|
+
kind?: string | Readonly<{
|
|
273
|
+
type: "parameter";
|
|
274
|
+
id: string;
|
|
275
|
+
name: string;
|
|
276
|
+
}> | Readonly<{
|
|
277
|
+
type: "ref";
|
|
278
|
+
id: string;
|
|
279
|
+
}> | undefined;
|
|
280
|
+
metadata?: Readonly<{
|
|
281
|
+
type: "parameter";
|
|
282
|
+
id: string;
|
|
283
|
+
name: string;
|
|
284
|
+
}> | Readonly<{
|
|
285
|
+
type: "ref";
|
|
286
|
+
id: string;
|
|
287
|
+
}> | Readonly<{
|
|
288
|
+
[x: string]: unknown;
|
|
289
|
+
}> | undefined;
|
|
290
|
+
tags?: readonly string[] | undefined;
|
|
291
|
+
}>]>], undefined>, undefined>, v.ReadonlyAction<(Readonly<{
|
|
292
|
+
type: "parameter";
|
|
293
|
+
id: string;
|
|
294
|
+
name: string;
|
|
295
|
+
}> | Readonly<{
|
|
296
|
+
type: "ref";
|
|
297
|
+
id: string;
|
|
298
|
+
}> | Readonly<{
|
|
299
|
+
type: "input";
|
|
300
|
+
path: readonly (string | number)[] | Readonly<{
|
|
301
|
+
type: "parameter";
|
|
302
|
+
id: string;
|
|
303
|
+
name: string;
|
|
304
|
+
}> | Readonly<{
|
|
305
|
+
type: "ref";
|
|
306
|
+
id: string;
|
|
307
|
+
}>;
|
|
308
|
+
displayName?: string | Readonly<{
|
|
309
|
+
type: "parameter";
|
|
310
|
+
id: string;
|
|
311
|
+
name: string;
|
|
312
|
+
}> | Readonly<{
|
|
313
|
+
type: "ref";
|
|
314
|
+
id: string;
|
|
315
|
+
}> | undefined;
|
|
316
|
+
kind?: string | Readonly<{
|
|
317
|
+
type: "parameter";
|
|
318
|
+
id: string;
|
|
319
|
+
name: string;
|
|
320
|
+
}> | Readonly<{
|
|
321
|
+
type: "ref";
|
|
322
|
+
id: string;
|
|
323
|
+
}> | undefined;
|
|
324
|
+
metadata?: Readonly<{
|
|
325
|
+
type: "parameter";
|
|
326
|
+
id: string;
|
|
327
|
+
name: string;
|
|
328
|
+
}> | Readonly<{
|
|
329
|
+
type: "ref";
|
|
330
|
+
id: string;
|
|
331
|
+
}> | Readonly<{
|
|
332
|
+
[x: string]: unknown;
|
|
333
|
+
}> | undefined;
|
|
334
|
+
tags?: readonly string[] | undefined;
|
|
335
|
+
}>)[]>]>;
|
|
336
|
+
export type BuilderUIInputsSerialised = v.InferOutput<typeof BuilderUIInputsSerialisedSchema>;
|
|
337
|
+
export type BuilderUIInputs = ReadonlyArray<Paramable<BuilderUIInput>>;
|
|
338
|
+
export type BuilderUIValidInput<State extends BuilderModelState> = {
|
|
339
|
+
readonly type: 'input';
|
|
340
|
+
readonly path: Paramable<Readonly<BuilderValidPath<State>>>;
|
|
341
|
+
};
|
|
342
|
+
export type BuilderUIValidInputs<State extends BuilderModelState> = ReadonlyArray<Paramable<BuilderUIValidInput<State>>>;
|
|
343
|
+
export type BuilderUIValidInputsOf<Input extends Paramable<BuilderModelGeneric>> = BuilderUIValidInputs<BuilderModelStateOf<Input>>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
import { BuilderPathSchema } from '../../paths.js';
|
|
3
|
+
import { paramable } from '../../references.js';
|
|
4
|
+
import { serialisable } from '../../serialisable.js';
|
|
5
|
+
import { BuilderTagsSchema } from '../tags.js';
|
|
6
|
+
export class BuilderUIInput {
|
|
7
|
+
type = 'input';
|
|
8
|
+
path;
|
|
9
|
+
displayName;
|
|
10
|
+
kind;
|
|
11
|
+
metadata;
|
|
12
|
+
tags;
|
|
13
|
+
constructor(path, displayName, kind, metadata, tags) {
|
|
14
|
+
this.path = path;
|
|
15
|
+
this.displayName = displayName;
|
|
16
|
+
this.kind = kind;
|
|
17
|
+
this.metadata = metadata;
|
|
18
|
+
this.tags = tags;
|
|
19
|
+
}
|
|
20
|
+
#next(patch) {
|
|
21
|
+
return new BuilderUIInput(this.path, patch.displayName ?? this.displayName, patch.kind ?? this.kind, patch.metadata ?? this.metadata, patch.tags ?? this.tags);
|
|
22
|
+
}
|
|
23
|
+
display(displayName) {
|
|
24
|
+
return this.#next({
|
|
25
|
+
displayName: displayName
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
as(kind) {
|
|
29
|
+
return this.#next({ kind: kind });
|
|
30
|
+
}
|
|
31
|
+
meta(metadata) {
|
|
32
|
+
return this.#next({ metadata: metadata });
|
|
33
|
+
}
|
|
34
|
+
tag(...tags) {
|
|
35
|
+
return this.#next({ tags });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export function input(path) {
|
|
39
|
+
return new BuilderUIInput(path);
|
|
40
|
+
}
|
|
41
|
+
export const BuilderUIInputSchema = v.instance(BuilderUIInput);
|
|
42
|
+
export const BuilderUIInputMetadataSchema = v.pipe(v.record(v.string(), paramable(v.unknown())), v.readonly());
|
|
43
|
+
export const BuilderUIInputSerialisedSchema = serialisable(v.object({
|
|
44
|
+
type: v.literal('input'),
|
|
45
|
+
path: paramable(BuilderPathSchema),
|
|
46
|
+
displayName: v.optional(paramable(v.string())),
|
|
47
|
+
kind: v.optional(paramable(v.string())),
|
|
48
|
+
metadata: v.optional(paramable(BuilderUIInputMetadataSchema)),
|
|
49
|
+
tags: v.optional(BuilderTagsSchema)
|
|
50
|
+
}));
|
|
51
|
+
export const BuilderUIInputsSerialisedSchema = v.pipe(v.array(paramable(BuilderUIInputSerialisedSchema)), v.readonly());
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import type { BuilderPaths } from '../../paths';
|
|
2
1
|
import type { Paramable } from '../../references';
|
|
2
|
+
import type { BuilderTags } from '../tags';
|
|
3
|
+
import type { BuilderUIInputs } from './input';
|
|
3
4
|
import * as v from 'valibot';
|
|
4
|
-
export declare class BuilderUIPage<const Label extends Paramable<string> = Paramable<string>, const
|
|
5
|
+
export declare class BuilderUIPage<const Label extends Paramable<string> = Paramable<string>, const Inputs extends Paramable<BuilderUIInputs> = Paramable<BuilderUIInputs>> {
|
|
5
6
|
readonly type: "page";
|
|
6
7
|
readonly label: Label;
|
|
7
|
-
readonly
|
|
8
|
-
|
|
8
|
+
readonly inputs: Inputs;
|
|
9
|
+
readonly tags?: BuilderTags;
|
|
10
|
+
constructor(label: Label, inputs: Inputs, tags?: BuilderTags);
|
|
11
|
+
tag(...tags: Array<string>): BuilderUIPage<Label, Inputs>;
|
|
9
12
|
}
|
|
10
13
|
export declare const BuilderUIPageSchema: v.InstanceSchema<typeof BuilderUIPage, undefined>;
|
|
11
14
|
export declare const BuilderUIPageSerialisedSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
@@ -25,7 +28,7 @@ export declare const BuilderUIPageSerialisedSchema: v.SchemaWithPipe<readonly [v
|
|
|
25
28
|
type: "ref";
|
|
26
29
|
id: string;
|
|
27
30
|
}>]>, v.StringSchema<undefined>], undefined>;
|
|
28
|
-
readonly
|
|
31
|
+
readonly inputs: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
29
32
|
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
30
33
|
readonly id: v.StringSchema<undefined>;
|
|
31
34
|
readonly name: v.StringSchema<undefined>;
|
|
@@ -39,7 +42,182 @@ export declare const BuilderUIPageSerialisedSchema: v.SchemaWithPipe<readonly [v
|
|
|
39
42
|
}, undefined>, v.ReadonlyAction<{
|
|
40
43
|
type: "ref";
|
|
41
44
|
id: string;
|
|
42
|
-
}>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.
|
|
45
|
+
}>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
46
|
+
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
47
|
+
readonly id: v.StringSchema<undefined>;
|
|
48
|
+
readonly name: v.StringSchema<undefined>;
|
|
49
|
+
}, undefined>, v.ReadonlyAction<{
|
|
50
|
+
type: "parameter";
|
|
51
|
+
id: string;
|
|
52
|
+
name: string;
|
|
53
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
54
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
55
|
+
readonly id: v.StringSchema<undefined>;
|
|
56
|
+
}, undefined>, v.ReadonlyAction<{
|
|
57
|
+
type: "ref";
|
|
58
|
+
id: string;
|
|
59
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
60
|
+
readonly type: v.LiteralSchema<"input", undefined>;
|
|
61
|
+
readonly path: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
62
|
+
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
63
|
+
readonly id: v.StringSchema<undefined>;
|
|
64
|
+
readonly name: v.StringSchema<undefined>;
|
|
65
|
+
}, undefined>, v.ReadonlyAction<{
|
|
66
|
+
type: "parameter";
|
|
67
|
+
id: string;
|
|
68
|
+
name: string;
|
|
69
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
70
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
71
|
+
readonly id: v.StringSchema<undefined>;
|
|
72
|
+
}, undefined>, v.ReadonlyAction<{
|
|
73
|
+
type: "ref";
|
|
74
|
+
id: string;
|
|
75
|
+
}>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, v.ReadonlyAction<(string | number)[]>]>], undefined>;
|
|
76
|
+
readonly displayName: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
77
|
+
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
78
|
+
readonly id: v.StringSchema<undefined>;
|
|
79
|
+
readonly name: v.StringSchema<undefined>;
|
|
80
|
+
}, undefined>, v.ReadonlyAction<{
|
|
81
|
+
type: "parameter";
|
|
82
|
+
id: string;
|
|
83
|
+
name: string;
|
|
84
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
85
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
86
|
+
readonly id: v.StringSchema<undefined>;
|
|
87
|
+
}, undefined>, v.ReadonlyAction<{
|
|
88
|
+
type: "ref";
|
|
89
|
+
id: string;
|
|
90
|
+
}>]>, v.StringSchema<undefined>], undefined>, undefined>;
|
|
91
|
+
readonly kind: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
92
|
+
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
93
|
+
readonly id: v.StringSchema<undefined>;
|
|
94
|
+
readonly name: v.StringSchema<undefined>;
|
|
95
|
+
}, undefined>, v.ReadonlyAction<{
|
|
96
|
+
type: "parameter";
|
|
97
|
+
id: string;
|
|
98
|
+
name: string;
|
|
99
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
100
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
101
|
+
readonly id: v.StringSchema<undefined>;
|
|
102
|
+
}, undefined>, v.ReadonlyAction<{
|
|
103
|
+
type: "ref";
|
|
104
|
+
id: string;
|
|
105
|
+
}>]>, v.StringSchema<undefined>], undefined>, undefined>;
|
|
106
|
+
readonly metadata: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
107
|
+
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
108
|
+
readonly id: v.StringSchema<undefined>;
|
|
109
|
+
readonly name: v.StringSchema<undefined>;
|
|
110
|
+
}, undefined>, v.ReadonlyAction<{
|
|
111
|
+
type: "parameter";
|
|
112
|
+
id: string;
|
|
113
|
+
name: string;
|
|
114
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
115
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
116
|
+
readonly id: v.StringSchema<undefined>;
|
|
117
|
+
}, undefined>, v.ReadonlyAction<{
|
|
118
|
+
type: "ref";
|
|
119
|
+
id: string;
|
|
120
|
+
}>]>, v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
121
|
+
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
122
|
+
readonly id: v.StringSchema<undefined>;
|
|
123
|
+
readonly name: v.StringSchema<undefined>;
|
|
124
|
+
}, undefined>, v.ReadonlyAction<{
|
|
125
|
+
type: "parameter";
|
|
126
|
+
id: string;
|
|
127
|
+
name: string;
|
|
128
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
129
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
130
|
+
readonly id: v.StringSchema<undefined>;
|
|
131
|
+
}, undefined>, v.ReadonlyAction<{
|
|
132
|
+
type: "ref";
|
|
133
|
+
id: string;
|
|
134
|
+
}>]>, v.UnknownSchema], undefined>, undefined>, v.ReadonlyAction<{
|
|
135
|
+
[x: string]: unknown;
|
|
136
|
+
}>]>], undefined>, undefined>;
|
|
137
|
+
readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
|
|
138
|
+
}, undefined>, v.ReadonlyAction<{
|
|
139
|
+
type: "input";
|
|
140
|
+
path: readonly (string | number)[] | Readonly<{
|
|
141
|
+
type: "parameter";
|
|
142
|
+
id: string;
|
|
143
|
+
name: string;
|
|
144
|
+
}> | Readonly<{
|
|
145
|
+
type: "ref";
|
|
146
|
+
id: string;
|
|
147
|
+
}>;
|
|
148
|
+
displayName?: string | Readonly<{
|
|
149
|
+
type: "parameter";
|
|
150
|
+
id: string;
|
|
151
|
+
name: string;
|
|
152
|
+
}> | Readonly<{
|
|
153
|
+
type: "ref";
|
|
154
|
+
id: string;
|
|
155
|
+
}> | undefined;
|
|
156
|
+
kind?: string | Readonly<{
|
|
157
|
+
type: "parameter";
|
|
158
|
+
id: string;
|
|
159
|
+
name: string;
|
|
160
|
+
}> | Readonly<{
|
|
161
|
+
type: "ref";
|
|
162
|
+
id: string;
|
|
163
|
+
}> | undefined;
|
|
164
|
+
metadata?: Readonly<{
|
|
165
|
+
type: "parameter";
|
|
166
|
+
id: string;
|
|
167
|
+
name: string;
|
|
168
|
+
}> | Readonly<{
|
|
169
|
+
type: "ref";
|
|
170
|
+
id: string;
|
|
171
|
+
}> | Readonly<{
|
|
172
|
+
[x: string]: unknown;
|
|
173
|
+
}> | undefined;
|
|
174
|
+
tags?: readonly string[] | undefined;
|
|
175
|
+
}>]>], undefined>, undefined>, v.ReadonlyAction<(Readonly<{
|
|
176
|
+
type: "parameter";
|
|
177
|
+
id: string;
|
|
178
|
+
name: string;
|
|
179
|
+
}> | Readonly<{
|
|
180
|
+
type: "ref";
|
|
181
|
+
id: string;
|
|
182
|
+
}> | Readonly<{
|
|
183
|
+
type: "input";
|
|
184
|
+
path: readonly (string | number)[] | Readonly<{
|
|
185
|
+
type: "parameter";
|
|
186
|
+
id: string;
|
|
187
|
+
name: string;
|
|
188
|
+
}> | Readonly<{
|
|
189
|
+
type: "ref";
|
|
190
|
+
id: string;
|
|
191
|
+
}>;
|
|
192
|
+
displayName?: string | Readonly<{
|
|
193
|
+
type: "parameter";
|
|
194
|
+
id: string;
|
|
195
|
+
name: string;
|
|
196
|
+
}> | Readonly<{
|
|
197
|
+
type: "ref";
|
|
198
|
+
id: string;
|
|
199
|
+
}> | undefined;
|
|
200
|
+
kind?: string | Readonly<{
|
|
201
|
+
type: "parameter";
|
|
202
|
+
id: string;
|
|
203
|
+
name: string;
|
|
204
|
+
}> | Readonly<{
|
|
205
|
+
type: "ref";
|
|
206
|
+
id: string;
|
|
207
|
+
}> | undefined;
|
|
208
|
+
metadata?: Readonly<{
|
|
209
|
+
type: "parameter";
|
|
210
|
+
id: string;
|
|
211
|
+
name: string;
|
|
212
|
+
}> | Readonly<{
|
|
213
|
+
type: "ref";
|
|
214
|
+
id: string;
|
|
215
|
+
}> | Readonly<{
|
|
216
|
+
[x: string]: unknown;
|
|
217
|
+
}> | undefined;
|
|
218
|
+
tags?: readonly string[] | undefined;
|
|
219
|
+
}>)[]>]>], undefined>;
|
|
220
|
+
readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
|
|
43
221
|
}, undefined>, v.ReadonlyAction<{
|
|
44
222
|
type: "page";
|
|
45
223
|
label: string | Readonly<{
|
|
@@ -50,13 +228,58 @@ export declare const BuilderUIPageSerialisedSchema: v.SchemaWithPipe<readonly [v
|
|
|
50
228
|
type: "ref";
|
|
51
229
|
id: string;
|
|
52
230
|
}>;
|
|
53
|
-
|
|
231
|
+
inputs: Readonly<{
|
|
54
232
|
type: "parameter";
|
|
55
233
|
id: string;
|
|
56
234
|
name: string;
|
|
57
235
|
}> | Readonly<{
|
|
58
236
|
type: "ref";
|
|
59
237
|
id: string;
|
|
60
|
-
}
|
|
238
|
+
}> | readonly (Readonly<{
|
|
239
|
+
type: "parameter";
|
|
240
|
+
id: string;
|
|
241
|
+
name: string;
|
|
242
|
+
}> | Readonly<{
|
|
243
|
+
type: "ref";
|
|
244
|
+
id: string;
|
|
245
|
+
}> | Readonly<{
|
|
246
|
+
type: "input";
|
|
247
|
+
path: readonly (string | number)[] | Readonly<{
|
|
248
|
+
type: "parameter";
|
|
249
|
+
id: string;
|
|
250
|
+
name: string;
|
|
251
|
+
}> | Readonly<{
|
|
252
|
+
type: "ref";
|
|
253
|
+
id: string;
|
|
254
|
+
}>;
|
|
255
|
+
displayName?: string | Readonly<{
|
|
256
|
+
type: "parameter";
|
|
257
|
+
id: string;
|
|
258
|
+
name: string;
|
|
259
|
+
}> | Readonly<{
|
|
260
|
+
type: "ref";
|
|
261
|
+
id: string;
|
|
262
|
+
}> | undefined;
|
|
263
|
+
kind?: string | Readonly<{
|
|
264
|
+
type: "parameter";
|
|
265
|
+
id: string;
|
|
266
|
+
name: string;
|
|
267
|
+
}> | Readonly<{
|
|
268
|
+
type: "ref";
|
|
269
|
+
id: string;
|
|
270
|
+
}> | undefined;
|
|
271
|
+
metadata?: Readonly<{
|
|
272
|
+
type: "parameter";
|
|
273
|
+
id: string;
|
|
274
|
+
name: string;
|
|
275
|
+
}> | Readonly<{
|
|
276
|
+
type: "ref";
|
|
277
|
+
id: string;
|
|
278
|
+
}> | Readonly<{
|
|
279
|
+
[x: string]: unknown;
|
|
280
|
+
}> | undefined;
|
|
281
|
+
tags?: readonly string[] | undefined;
|
|
282
|
+
}>)[];
|
|
283
|
+
tags?: readonly string[] | undefined;
|
|
61
284
|
}>]>;
|
|
62
285
|
export type BuilderUIPageSerialised = v.InferOutput<typeof BuilderUIPageSerialisedSchema>;
|