@builder-builder/builder 0.0.12 → 0.0.14
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/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/index.d.ts +3 -3
- package/dist/entities/index.js +1 -1
- package/dist/entities/kind.d.ts +1 -1
- package/dist/entities/serialise.d.ts +554 -8
- package/dist/entities/serialise.js +5 -3
- package/dist/entities/ui/describe.d.ts +222 -8
- package/dist/entities/ui/describe.js +5 -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 +334 -0
- package/dist/entities/ui/input.js +39 -0
- package/dist/entities/ui/page.d.ts +222 -8
- package/dist/entities/ui/page.js +5 -5
- package/dist/entities/ui/ui.d.ts +3 -3
- package/dist/entities/ui/ui.js +7 -4
- package/dist/entities/validated.d.ts +23 -21
- package/dist/entities/when.d.ts +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/mappers/index.d.ts +3 -2
- package/dist/mappers/index.js +1 -1
- package/dist/mappers/instance.js +10 -6
- package/dist/mappers/order.js +5 -2
- 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 +31 -54
- package/dist/mappers/resolve.d.ts +13 -4
- package/dist/mappers/resolve.js +73 -16
- package/dist/mappers/variants/index.d.ts +2 -1
- package/dist/mappers/variants/index.js +2 -1
- package/dist/mappers/variants/option-graph.d.ts +2 -2
- package/dist/mappers/variants/option-graph.js +6 -3
- package/dist/mappers/variants/variants.d.ts +5 -2
- package/dist/mappers/variants/variants.js +11 -7
- package/dist/paths.d.ts +0 -1
- package/dist/paths.js +0 -8
- package/dist/validate/brand.d.ts +0 -7
- package/dist/validate/brand.js +12 -6
- package/dist/validate/builder.d.ts +2 -1
- package/dist/validate/builder.js +14 -12
- package/dist/validate/errors.d.ts +130 -0
- package/dist/validate/errors.js +141 -0
- package/dist/validate/expectations.d.ts +3 -10
- package/dist/validate/expectations.js +8 -10
- package/dist/validate/index.d.ts +8 -14
- package/dist/validate/index.js +4 -7
- package/dist/validate/instance.d.ts +2 -15
- package/dist/validate/instance.js +42 -40
- package/dist/validate/model.d.ts +4 -31
- package/dist/validate/model.js +157 -173
- package/dist/validate/resolve.d.ts +3 -15
- package/dist/validate/resolve.js +66 -71
- 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 +14 -3
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
export class BuilderUIInput {
|
|
6
|
+
type = 'input';
|
|
7
|
+
path;
|
|
8
|
+
displayName;
|
|
9
|
+
kind;
|
|
10
|
+
metadata;
|
|
11
|
+
constructor(path, displayName, kind, metadata) {
|
|
12
|
+
this.path = path;
|
|
13
|
+
this.displayName = displayName;
|
|
14
|
+
this.kind = kind;
|
|
15
|
+
this.metadata = metadata;
|
|
16
|
+
}
|
|
17
|
+
display(displayName) {
|
|
18
|
+
return new BuilderUIInput(this.path, displayName, this.kind, this.metadata);
|
|
19
|
+
}
|
|
20
|
+
as(kind) {
|
|
21
|
+
return new BuilderUIInput(this.path, this.displayName, kind, this.metadata);
|
|
22
|
+
}
|
|
23
|
+
meta(metadata) {
|
|
24
|
+
return new BuilderUIInput(this.path, this.displayName, this.kind, metadata);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export function input(path) {
|
|
28
|
+
return new BuilderUIInput(path);
|
|
29
|
+
}
|
|
30
|
+
export const BuilderUIInputSchema = v.instance(BuilderUIInput);
|
|
31
|
+
export const BuilderUIInputMetadataSchema = v.pipe(v.record(v.string(), paramable(v.unknown())), v.readonly());
|
|
32
|
+
export const BuilderUIInputSerialisedSchema = serialisable(v.object({
|
|
33
|
+
type: v.literal('input'),
|
|
34
|
+
path: paramable(BuilderPathSchema),
|
|
35
|
+
displayName: v.optional(paramable(v.string())),
|
|
36
|
+
kind: v.optional(paramable(v.string())),
|
|
37
|
+
metadata: v.optional(paramable(BuilderUIInputMetadataSchema))
|
|
38
|
+
}));
|
|
39
|
+
export const BuilderUIInputsSerialisedSchema = v.pipe(v.array(paramable(BuilderUIInputSerialisedSchema)), v.readonly());
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { BuilderPaths } from '../../paths';
|
|
2
1
|
import type { Paramable } from '../../references';
|
|
2
|
+
import type { BuilderUIInputs } from './input';
|
|
3
3
|
import * as v from 'valibot';
|
|
4
|
-
export declare class BuilderUIPage<const Label extends Paramable<string> = Paramable<string>, const
|
|
4
|
+
export declare class BuilderUIPage<const Label extends Paramable<string> = Paramable<string>, const Inputs extends Paramable<BuilderUIInputs> = Paramable<BuilderUIInputs>> {
|
|
5
5
|
readonly type: "page";
|
|
6
6
|
readonly label: Label;
|
|
7
|
-
readonly
|
|
8
|
-
constructor(label: Label,
|
|
7
|
+
readonly inputs: Inputs;
|
|
8
|
+
constructor(label: Label, inputs: Inputs);
|
|
9
9
|
}
|
|
10
10
|
export declare const BuilderUIPageSchema: v.InstanceSchema<typeof BuilderUIPage, undefined>;
|
|
11
11
|
export declare const BuilderUIPageSerialisedSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
@@ -25,7 +25,7 @@ export declare const BuilderUIPageSerialisedSchema: v.SchemaWithPipe<readonly [v
|
|
|
25
25
|
type: "ref";
|
|
26
26
|
id: string;
|
|
27
27
|
}>]>, v.StringSchema<undefined>], undefined>;
|
|
28
|
-
readonly
|
|
28
|
+
readonly inputs: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
29
29
|
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
30
30
|
readonly id: v.StringSchema<undefined>;
|
|
31
31
|
readonly name: v.StringSchema<undefined>;
|
|
@@ -39,7 +39,178 @@ export declare const BuilderUIPageSerialisedSchema: v.SchemaWithPipe<readonly [v
|
|
|
39
39
|
}, undefined>, v.ReadonlyAction<{
|
|
40
40
|
type: "ref";
|
|
41
41
|
id: string;
|
|
42
|
-
}>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.
|
|
42
|
+
}>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
43
|
+
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
44
|
+
readonly id: v.StringSchema<undefined>;
|
|
45
|
+
readonly name: v.StringSchema<undefined>;
|
|
46
|
+
}, undefined>, v.ReadonlyAction<{
|
|
47
|
+
type: "parameter";
|
|
48
|
+
id: string;
|
|
49
|
+
name: string;
|
|
50
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
51
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
52
|
+
readonly id: v.StringSchema<undefined>;
|
|
53
|
+
}, undefined>, v.ReadonlyAction<{
|
|
54
|
+
type: "ref";
|
|
55
|
+
id: string;
|
|
56
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
57
|
+
readonly type: v.LiteralSchema<"input", undefined>;
|
|
58
|
+
readonly path: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
59
|
+
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
60
|
+
readonly id: v.StringSchema<undefined>;
|
|
61
|
+
readonly name: v.StringSchema<undefined>;
|
|
62
|
+
}, undefined>, v.ReadonlyAction<{
|
|
63
|
+
type: "parameter";
|
|
64
|
+
id: string;
|
|
65
|
+
name: string;
|
|
66
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
67
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
68
|
+
readonly id: v.StringSchema<undefined>;
|
|
69
|
+
}, undefined>, v.ReadonlyAction<{
|
|
70
|
+
type: "ref";
|
|
71
|
+
id: string;
|
|
72
|
+
}>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, v.ReadonlyAction<(string | number)[]>]>], undefined>;
|
|
73
|
+
readonly displayName: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
74
|
+
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
75
|
+
readonly id: v.StringSchema<undefined>;
|
|
76
|
+
readonly name: v.StringSchema<undefined>;
|
|
77
|
+
}, undefined>, v.ReadonlyAction<{
|
|
78
|
+
type: "parameter";
|
|
79
|
+
id: string;
|
|
80
|
+
name: string;
|
|
81
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
82
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
83
|
+
readonly id: v.StringSchema<undefined>;
|
|
84
|
+
}, undefined>, v.ReadonlyAction<{
|
|
85
|
+
type: "ref";
|
|
86
|
+
id: string;
|
|
87
|
+
}>]>, v.StringSchema<undefined>], undefined>, undefined>;
|
|
88
|
+
readonly kind: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
89
|
+
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
90
|
+
readonly id: v.StringSchema<undefined>;
|
|
91
|
+
readonly name: v.StringSchema<undefined>;
|
|
92
|
+
}, undefined>, v.ReadonlyAction<{
|
|
93
|
+
type: "parameter";
|
|
94
|
+
id: string;
|
|
95
|
+
name: string;
|
|
96
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
97
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
98
|
+
readonly id: v.StringSchema<undefined>;
|
|
99
|
+
}, undefined>, v.ReadonlyAction<{
|
|
100
|
+
type: "ref";
|
|
101
|
+
id: string;
|
|
102
|
+
}>]>, v.StringSchema<undefined>], undefined>, undefined>;
|
|
103
|
+
readonly metadata: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
104
|
+
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
105
|
+
readonly id: v.StringSchema<undefined>;
|
|
106
|
+
readonly name: v.StringSchema<undefined>;
|
|
107
|
+
}, undefined>, v.ReadonlyAction<{
|
|
108
|
+
type: "parameter";
|
|
109
|
+
id: string;
|
|
110
|
+
name: string;
|
|
111
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
112
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
113
|
+
readonly id: v.StringSchema<undefined>;
|
|
114
|
+
}, undefined>, v.ReadonlyAction<{
|
|
115
|
+
type: "ref";
|
|
116
|
+
id: string;
|
|
117
|
+
}>]>, v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
118
|
+
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
119
|
+
readonly id: v.StringSchema<undefined>;
|
|
120
|
+
readonly name: v.StringSchema<undefined>;
|
|
121
|
+
}, undefined>, v.ReadonlyAction<{
|
|
122
|
+
type: "parameter";
|
|
123
|
+
id: string;
|
|
124
|
+
name: string;
|
|
125
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
126
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
127
|
+
readonly id: v.StringSchema<undefined>;
|
|
128
|
+
}, undefined>, v.ReadonlyAction<{
|
|
129
|
+
type: "ref";
|
|
130
|
+
id: string;
|
|
131
|
+
}>]>, v.UnknownSchema], undefined>, undefined>, v.ReadonlyAction<{
|
|
132
|
+
[x: string]: unknown;
|
|
133
|
+
}>]>], undefined>, undefined>;
|
|
134
|
+
}, undefined>, v.ReadonlyAction<{
|
|
135
|
+
type: "input";
|
|
136
|
+
path: readonly (string | number)[] | Readonly<{
|
|
137
|
+
type: "parameter";
|
|
138
|
+
id: string;
|
|
139
|
+
name: string;
|
|
140
|
+
}> | Readonly<{
|
|
141
|
+
type: "ref";
|
|
142
|
+
id: string;
|
|
143
|
+
}>;
|
|
144
|
+
displayName?: string | Readonly<{
|
|
145
|
+
type: "parameter";
|
|
146
|
+
id: string;
|
|
147
|
+
name: string;
|
|
148
|
+
}> | Readonly<{
|
|
149
|
+
type: "ref";
|
|
150
|
+
id: string;
|
|
151
|
+
}> | undefined;
|
|
152
|
+
kind?: string | Readonly<{
|
|
153
|
+
type: "parameter";
|
|
154
|
+
id: string;
|
|
155
|
+
name: string;
|
|
156
|
+
}> | Readonly<{
|
|
157
|
+
type: "ref";
|
|
158
|
+
id: string;
|
|
159
|
+
}> | undefined;
|
|
160
|
+
metadata?: Readonly<{
|
|
161
|
+
type: "parameter";
|
|
162
|
+
id: string;
|
|
163
|
+
name: string;
|
|
164
|
+
}> | Readonly<{
|
|
165
|
+
type: "ref";
|
|
166
|
+
id: string;
|
|
167
|
+
}> | Readonly<{
|
|
168
|
+
[x: string]: unknown;
|
|
169
|
+
}> | undefined;
|
|
170
|
+
}>]>], undefined>, undefined>, v.ReadonlyAction<(Readonly<{
|
|
171
|
+
type: "parameter";
|
|
172
|
+
id: string;
|
|
173
|
+
name: string;
|
|
174
|
+
}> | Readonly<{
|
|
175
|
+
type: "ref";
|
|
176
|
+
id: string;
|
|
177
|
+
}> | Readonly<{
|
|
178
|
+
type: "input";
|
|
179
|
+
path: readonly (string | number)[] | Readonly<{
|
|
180
|
+
type: "parameter";
|
|
181
|
+
id: string;
|
|
182
|
+
name: string;
|
|
183
|
+
}> | Readonly<{
|
|
184
|
+
type: "ref";
|
|
185
|
+
id: string;
|
|
186
|
+
}>;
|
|
187
|
+
displayName?: string | Readonly<{
|
|
188
|
+
type: "parameter";
|
|
189
|
+
id: string;
|
|
190
|
+
name: string;
|
|
191
|
+
}> | Readonly<{
|
|
192
|
+
type: "ref";
|
|
193
|
+
id: string;
|
|
194
|
+
}> | undefined;
|
|
195
|
+
kind?: string | Readonly<{
|
|
196
|
+
type: "parameter";
|
|
197
|
+
id: string;
|
|
198
|
+
name: string;
|
|
199
|
+
}> | Readonly<{
|
|
200
|
+
type: "ref";
|
|
201
|
+
id: string;
|
|
202
|
+
}> | undefined;
|
|
203
|
+
metadata?: Readonly<{
|
|
204
|
+
type: "parameter";
|
|
205
|
+
id: string;
|
|
206
|
+
name: string;
|
|
207
|
+
}> | Readonly<{
|
|
208
|
+
type: "ref";
|
|
209
|
+
id: string;
|
|
210
|
+
}> | Readonly<{
|
|
211
|
+
[x: string]: unknown;
|
|
212
|
+
}> | undefined;
|
|
213
|
+
}>)[]>]>], undefined>;
|
|
43
214
|
}, undefined>, v.ReadonlyAction<{
|
|
44
215
|
type: "page";
|
|
45
216
|
label: string | Readonly<{
|
|
@@ -50,13 +221,56 @@ export declare const BuilderUIPageSerialisedSchema: v.SchemaWithPipe<readonly [v
|
|
|
50
221
|
type: "ref";
|
|
51
222
|
id: string;
|
|
52
223
|
}>;
|
|
53
|
-
|
|
224
|
+
inputs: Readonly<{
|
|
54
225
|
type: "parameter";
|
|
55
226
|
id: string;
|
|
56
227
|
name: string;
|
|
57
228
|
}> | Readonly<{
|
|
58
229
|
type: "ref";
|
|
59
230
|
id: string;
|
|
60
|
-
}
|
|
231
|
+
}> | readonly (Readonly<{
|
|
232
|
+
type: "parameter";
|
|
233
|
+
id: string;
|
|
234
|
+
name: string;
|
|
235
|
+
}> | Readonly<{
|
|
236
|
+
type: "ref";
|
|
237
|
+
id: string;
|
|
238
|
+
}> | Readonly<{
|
|
239
|
+
type: "input";
|
|
240
|
+
path: readonly (string | number)[] | Readonly<{
|
|
241
|
+
type: "parameter";
|
|
242
|
+
id: string;
|
|
243
|
+
name: string;
|
|
244
|
+
}> | Readonly<{
|
|
245
|
+
type: "ref";
|
|
246
|
+
id: string;
|
|
247
|
+
}>;
|
|
248
|
+
displayName?: string | Readonly<{
|
|
249
|
+
type: "parameter";
|
|
250
|
+
id: string;
|
|
251
|
+
name: string;
|
|
252
|
+
}> | Readonly<{
|
|
253
|
+
type: "ref";
|
|
254
|
+
id: string;
|
|
255
|
+
}> | undefined;
|
|
256
|
+
kind?: string | Readonly<{
|
|
257
|
+
type: "parameter";
|
|
258
|
+
id: string;
|
|
259
|
+
name: string;
|
|
260
|
+
}> | Readonly<{
|
|
261
|
+
type: "ref";
|
|
262
|
+
id: string;
|
|
263
|
+
}> | undefined;
|
|
264
|
+
metadata?: Readonly<{
|
|
265
|
+
type: "parameter";
|
|
266
|
+
id: string;
|
|
267
|
+
name: string;
|
|
268
|
+
}> | Readonly<{
|
|
269
|
+
type: "ref";
|
|
270
|
+
id: string;
|
|
271
|
+
}> | Readonly<{
|
|
272
|
+
[x: string]: unknown;
|
|
273
|
+
}> | undefined;
|
|
274
|
+
}>)[];
|
|
61
275
|
}>]>;
|
|
62
276
|
export type BuilderUIPageSerialised = v.InferOutput<typeof BuilderUIPageSerialisedSchema>;
|
package/dist/entities/ui/page.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
|
-
import { BuilderPathsSchema } from '../../paths.js';
|
|
3
2
|
import { paramable } from '../../references.js';
|
|
4
3
|
import { serialisable } from '../../serialisable.js';
|
|
4
|
+
import { BuilderUIInputsSerialisedSchema } from './input.js';
|
|
5
5
|
export class BuilderUIPage {
|
|
6
6
|
type = 'page';
|
|
7
7
|
label;
|
|
8
|
-
|
|
9
|
-
constructor(label,
|
|
8
|
+
inputs;
|
|
9
|
+
constructor(label, inputs) {
|
|
10
10
|
this.label = label;
|
|
11
|
-
this.
|
|
11
|
+
this.inputs = inputs;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
export const BuilderUIPageSchema = v.instance(BuilderUIPage);
|
|
15
15
|
export const BuilderUIPageSerialisedSchema = serialisable(v.object({
|
|
16
16
|
type: v.literal('page'),
|
|
17
17
|
label: paramable(v.string()),
|
|
18
|
-
|
|
18
|
+
inputs: paramable(BuilderUIInputsSerialisedSchema)
|
|
19
19
|
}));
|
package/dist/entities/ui/ui.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { BuilderExpectation, BuilderExpectations, BuilderExpectationsSerial
|
|
|
3
3
|
import type { CollectionNamesOf } from '../collection/index';
|
|
4
4
|
import type { BuilderModel, BuilderModelGeneric, BuilderModelStateOf } from '../model/model';
|
|
5
5
|
import type { BuilderModelStateAsserted } from '../model/expectation';
|
|
6
|
-
import type {
|
|
6
|
+
import type { BuilderUIValidInputsOf } from './input';
|
|
7
7
|
import type { BuilderUIItems, BuilderUIItemsSerialised } from './pages';
|
|
8
8
|
import * as v from 'valibot';
|
|
9
9
|
export type BuilderUIs = ReadonlyArray<Paramable<BuilderUI>>;
|
|
@@ -16,8 +16,8 @@ export declare class BuilderUI<Model extends BuilderModelGeneric = BuilderModelG
|
|
|
16
16
|
readonly expectations: BuilderExpectations;
|
|
17
17
|
constructor(uis: BuilderUIs, items: BuilderUIItems, expectations: BuilderExpectations);
|
|
18
18
|
expect<const Exps extends readonly [BuilderExpectation, ...ReadonlyArray<BuilderExpectation>]>(...expectations: Exps): BuilderUI<BuilderModel<BuilderModelStateAsserted<BuilderModelStateOf<Model>, Exps>>>;
|
|
19
|
-
page(label: Paramable<string>,
|
|
20
|
-
describe(label: Paramable<string>,
|
|
19
|
+
page(label: Paramable<string>, inputs: Paramable<BuilderUIValidInputsOf<Model>>): BuilderUI<Model>;
|
|
20
|
+
describe(label: Paramable<string>, inputs: Paramable<BuilderUIValidInputsOf<Model>>): BuilderUI<Model>;
|
|
21
21
|
pages<const Name extends CollectionNamesOf<BuilderModelStateOf<Model>>>(name: Name, label: Paramable<string>, itemUI: Paramable<BuilderUI<BuilderModelGeneric>>): BuilderUI<Model>;
|
|
22
22
|
}
|
|
23
23
|
export declare const BuilderUISchema: v.InstanceSchema<typeof BuilderUI, undefined>;
|
package/dist/entities/ui/ui.js
CHANGED
|
@@ -21,11 +21,14 @@ export class BuilderUI {
|
|
|
21
21
|
...expectations
|
|
22
22
|
]);
|
|
23
23
|
}
|
|
24
|
-
page(label,
|
|
25
|
-
return new BuilderUI(this.uis, [...this.items, new BuilderUIPage(label,
|
|
24
|
+
page(label, inputs) {
|
|
25
|
+
return new BuilderUI(this.uis, [...this.items, new BuilderUIPage(label, inputs)], this.expectations);
|
|
26
26
|
}
|
|
27
|
-
describe(label,
|
|
28
|
-
return new BuilderUI(this.uis, [
|
|
27
|
+
describe(label, inputs) {
|
|
28
|
+
return new BuilderUI(this.uis, [
|
|
29
|
+
...this.items,
|
|
30
|
+
new BuilderUIDescribe(label, inputs)
|
|
31
|
+
], this.expectations);
|
|
29
32
|
}
|
|
30
33
|
pages(name, label, itemUI) {
|
|
31
34
|
const items = check.is(BuilderUISchema, itemUI) ? itemUI.items : itemUI;
|
|
@@ -4,32 +4,34 @@ import type { Prettify } from '../prettify';
|
|
|
4
4
|
import type { BuilderParameter, BuilderParameterSerialised, BuilderRef, BuilderRefSerialised } from '../references';
|
|
5
5
|
import type { BuilderSerialised } from './builder/index';
|
|
6
6
|
import type { BuilderCollectionConfigSerialised, BuilderCollectionSerialised, BuilderCollectionsSerialised } from './collection/index';
|
|
7
|
-
import type { BuilderComponentSerialised, BuilderComponentsSerialised } from './component/index';
|
|
7
|
+
import type { BuilderComponentDetailsSerialised, BuilderComponentSerialised, BuilderComponentsSerialised } from './component/index';
|
|
8
8
|
import type { BuilderModelSerialised } from './model/index';
|
|
9
|
-
import type { BuilderOptionSerialised, BuilderOptionsSerialised } from './option/index';
|
|
9
|
+
import type { BuilderOptionSerialised, BuilderOptionsSerialised, BuilderOptionValuesSerialised } from './option/index';
|
|
10
10
|
import type { BuilderUIDescribeSerialised, BuilderUIItemsSerialised, BuilderUIPageSerialised, BuilderUISerialised } from './ui/index';
|
|
11
|
-
export type Validated<Input> = Input extends BuilderComponentVariants | BuilderInstance | BuilderModelSerialised | BuilderSerialised | BuilderUISerialised ?
|
|
12
|
-
type Validate<Input> = Input extends BuilderParameter<string> | BuilderParameterSerialised | BuilderRef | BuilderRefSerialised ? never : Input extends ReadonlyArray<unknown> ? ValidatedTuple<Input> : Input extends object ?
|
|
11
|
+
export type Validated<Input> = Input extends BuilderComponentVariants | BuilderInstance | BuilderModelSerialised | BuilderSerialised | BuilderUISerialised ? Validate<Input> & BuilderValidatedBrand : Validate<Input>;
|
|
12
|
+
type Validate<Input> = Input extends BuilderParameter<string> | BuilderParameterSerialised | BuilderRef | BuilderRefSerialised ? never : Input extends ReadonlyArray<unknown> ? ValidatedTuple<Input> : Input extends object ? {
|
|
13
13
|
readonly [Key in keyof Input]: Validated<Input[Key]>;
|
|
14
|
-
}
|
|
14
|
+
} : Input;
|
|
15
15
|
type ValidatedTuple<Input extends ReadonlyArray<unknown>> = Input extends readonly [
|
|
16
16
|
infer Head,
|
|
17
17
|
...infer Rest extends ReadonlyArray<unknown>
|
|
18
18
|
] ? [Validated<Head>] extends [never] ? ValidatedTuple<Rest> : readonly [Validated<Head>, ...ValidatedTuple<Rest>] : Input extends readonly [] ? readonly [] : ReadonlyArray<Validated<Input[number]>>;
|
|
19
|
-
export type BuilderValidated = Validated<BuilderSerialised
|
|
20
|
-
export type BuilderModelValidated = Validated<BuilderModelSerialised
|
|
21
|
-
export type BuilderUIValidated = Validated<BuilderUISerialised
|
|
22
|
-
export type BuilderInstanceValidated = Validated<BuilderInstance
|
|
23
|
-
export type BuilderInstancesValidated = Validated<BuilderInstances
|
|
24
|
-
export type BuilderComponentVariantsValidated = Validated<BuilderComponentVariants
|
|
25
|
-
export type BuilderOptionValidated = Validated<BuilderOptionSerialised
|
|
26
|
-
export type BuilderOptionsValidated = Validated<BuilderOptionsSerialised
|
|
27
|
-
export type
|
|
28
|
-
export type
|
|
29
|
-
export type
|
|
30
|
-
export type
|
|
31
|
-
export type
|
|
32
|
-
export type
|
|
33
|
-
export type
|
|
34
|
-
export type
|
|
19
|
+
export type BuilderValidated = Prettify<Validated<BuilderSerialised>>;
|
|
20
|
+
export type BuilderModelValidated = Prettify<Validated<BuilderModelSerialised>>;
|
|
21
|
+
export type BuilderUIValidated = Prettify<Validated<BuilderUISerialised>>;
|
|
22
|
+
export type BuilderInstanceValidated = Prettify<Validated<BuilderInstance>>;
|
|
23
|
+
export type BuilderInstancesValidated = Prettify<Validated<BuilderInstances>>;
|
|
24
|
+
export type BuilderComponentVariantsValidated = Prettify<Validated<BuilderComponentVariants>>;
|
|
25
|
+
export type BuilderOptionValidated = Prettify<Validated<BuilderOptionSerialised>>;
|
|
26
|
+
export type BuilderOptionsValidated = Prettify<Validated<BuilderOptionsSerialised>>;
|
|
27
|
+
export type BuilderOptionValuesValidated = Prettify<Validated<BuilderOptionValuesSerialised>>;
|
|
28
|
+
export type BuilderComponentValidated = Prettify<Validated<BuilderComponentSerialised>>;
|
|
29
|
+
export type BuilderComponentsValidated = Prettify<Validated<BuilderComponentsSerialised>>;
|
|
30
|
+
export type BuilderComponentDetailsValidated = Prettify<Validated<BuilderComponentDetailsSerialised>>;
|
|
31
|
+
export type BuilderCollectionValidated = Prettify<Validated<BuilderCollectionSerialised>>;
|
|
32
|
+
export type BuilderCollectionsValidated = Prettify<Validated<BuilderCollectionsSerialised>>;
|
|
33
|
+
export type BuilderCollectionConfigValidated = Prettify<Validated<BuilderCollectionConfigSerialised>>;
|
|
34
|
+
export type BuilderUIItemsValidated = Prettify<Validated<BuilderUIItemsSerialised>>;
|
|
35
|
+
export type BuilderUIPageValidated = Prettify<Validated<BuilderUIPageSerialised>>;
|
|
36
|
+
export type BuilderUIDescribeValidated = Prettify<Validated<BuilderUIDescribeSerialised>>;
|
|
35
37
|
export {};
|
package/dist/entities/when.d.ts
CHANGED
|
@@ -112,8 +112,6 @@ export declare const BuilderWhenConfigSchema: v.SchemaWithPipe<readonly [v.Varia
|
|
|
112
112
|
id: string;
|
|
113
113
|
}>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, v.ReadonlyAction<(string | number)[]>]>], undefined>;
|
|
114
114
|
}, undefined>], undefined>, v.ReadonlyAction<{
|
|
115
|
-
type: "enable";
|
|
116
|
-
} | {
|
|
117
115
|
type: "match";
|
|
118
116
|
matchPath: readonly (string | number)[] | Readonly<{
|
|
119
117
|
type: "parameter";
|
|
@@ -133,6 +131,8 @@ export declare const BuilderWhenConfigSchema: v.SchemaWithPipe<readonly [v.Varia
|
|
|
133
131
|
type: "ref";
|
|
134
132
|
id: string;
|
|
135
133
|
}>;
|
|
134
|
+
} | {
|
|
135
|
+
type: "enable";
|
|
136
136
|
}>]>;
|
|
137
137
|
export type BuilderWhenConfig = v.InferOutput<typeof BuilderWhenConfigSchema>;
|
|
138
138
|
export type BuilderWhenGeneric = BuilderWhen<unknown, unknown, unknown, unknown>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export type { BB, BBOptions } from './bb';
|
|
2
|
-
export type { BuilderBindings, BuilderBindingsSerialised, BuilderCollection, BuilderCollectionConfig, BuilderCollectionConfigSerialised, BuilderCollections, BuilderCollectionSerialised, BuilderCollectionsSerialised, BuilderCollectionWhen, BuilderCollectionWhenSerialised, BuilderComponent, BuilderComponentDetails, BuilderComponentDetailsSerialised, BuilderComponentField, BuilderComponentFields, BuilderComponentFieldSerialised, BuilderComponentFieldsSerialised, BuilderComponentFieldValueType, BuilderComponents, BuilderComponentSerialised, BuilderComponentsSerialised, BuilderComponentWhen, BuilderComponentWhenSerialised, BuilderDescription, BuilderDescriptionItem, BuilderEntityKind, BuilderEntitySerialised, BuilderExpectation, BuilderExpectationKind, BuilderExpectations, BuilderExpectationSerialised, BuilderExpectationsSerialised, BuilderInstanceOf, BuilderModel, BuilderModels, BuilderModelSerialised, BuilderModelValidated, BuilderOption, BuilderOptions, BuilderOptionSerialised, BuilderOptionsSerialised, BuilderOptionValues, BuilderOptionValuesSerialised, BuilderOptionWhen, BuilderOptionWhenSerialised, BuilderRefEntities, BuilderRefEntity, BuilderSelectType, BuilderSelectTypeLabels, BuilderSelectTypeSerialised, BuilderSelectTypeValues, BuilderSerialised, BuilderToggleType, BuilderToggleTypeSerialised, BuilderToggleValueType, BuilderUI, BuilderUIDescribe, BuilderUIDescribeSerialised, BuilderUIItem, BuilderUIItems, BuilderUIItemsSerialised, BuilderUIPage, BuilderUIPages, BuilderUIPageSerialised, BuilderUIPagesSerialised, BuilderUIs, BuilderUIsSerialised, BuilderUISerialised, BuilderUIValidated, BuilderValidated, BuilderComponentVariantsValidated, BuilderInstanceValidated, BuilderEnableConfig, BuilderMatchConfig, BuilderMatchSelectMap, BuilderUnlessConfig, BuilderWhen, BuilderWhenConfig, BuilderWhenSerialised } from './entities/index';
|
|
2
|
+
export type { BuilderBindings, BuilderBindingsSerialised, BuilderCollection, BuilderCollectionConfig, BuilderCollectionConfigSerialised, BuilderCollections, BuilderCollectionSerialised, BuilderCollectionsSerialised, BuilderCollectionWhen, BuilderCollectionWhenSerialised, BuilderComponent, BuilderComponentDetails, BuilderComponentDetailsSerialised, BuilderComponentField, BuilderComponentFields, BuilderComponentFieldSerialised, BuilderComponentFieldsSerialised, BuilderComponentFieldValueType, BuilderComponents, BuilderComponentSerialised, BuilderComponentsSerialised, BuilderComponentWhen, BuilderComponentWhenSerialised, BuilderDescription, BuilderDescriptionItem, BuilderEntityKind, BuilderEntitySerialised, BuilderExpectation, BuilderExpectationKind, BuilderExpectations, BuilderExpectationSerialised, BuilderExpectationsSerialised, BuilderInstanceOf, BuilderModel, BuilderModels, BuilderModelSerialised, BuilderModelValidated, BuilderOption, BuilderOptions, BuilderOptionSerialised, BuilderOptionsSerialised, BuilderOptionValues, BuilderOptionValuesSerialised, BuilderOptionWhen, BuilderOptionWhenSerialised, BuilderRefEntities, BuilderRefEntity, BuilderSelectType, BuilderSelectTypeLabels, BuilderSelectTypeSerialised, BuilderSelectTypeValues, BuilderSerialised, BuilderToggleType, BuilderToggleTypeSerialised, BuilderToggleValueType, BuilderUI, BuilderUIDescribe, BuilderUIDescribeSerialised, BuilderUIInput, BuilderUIInputMetadata, BuilderUIInputMetadataSerialised, BuilderUIInputs, BuilderUIInputsSerialised, BuilderUIInputSerialised, BuilderUIItem, BuilderUIItems, BuilderUIItemsSerialised, BuilderUIPage, BuilderUIPages, BuilderUIPageSerialised, BuilderUIPagesSerialised, BuilderUIs, BuilderUIsSerialised, BuilderUISerialised, BuilderUIValidated, BuilderValidated, BuilderComponentVariantsValidated, BuilderInstanceValidated, BuilderEnableConfig, BuilderMatchConfig, BuilderMatchSelectMap, BuilderUnlessConfig, BuilderWhen, BuilderWhenConfig, BuilderWhenSerialised } from './entities/index';
|
|
3
3
|
export type { BuilderEnvironment } from './environment';
|
|
4
4
|
export type { BuilderError, BuilderErrorBase, BuilderErrorLocation, BuilderErrors } from './exception';
|
|
5
|
-
export type { BuilderComponentVariantsValidationResult, BuilderErrorDuplicateName, BuilderErrorInvalidCollection, BuilderErrorInvalidCollectionBounds, BuilderErrorInvalidDetail, BuilderErrorInvalidInput, BuilderErrorInvalidOption, BuilderErrorInvalidPath, BuilderErrorInvalidPathReason, BuilderErrorInvalidSelectMapKey, BuilderErrorInvalidVariant, BuilderErrorMissingComponent, BuilderErrorMissingDetail, BuilderErrorMissingReference, BuilderErrorMissingVariant, BuilderErrorUnboundParameter, BuilderErrorUnexpectedComponent, BuilderErrorUnexpectedDetail, BuilderErrorUnmetExpectation, BuilderErrorUnvalidated, BuilderInstanceValidationResult, BuilderModelValidationResult, BuilderOrder, BuilderRenderOption, BuilderRenderOptions, BuilderRenderPage, BuilderRenderPages, BuilderRenderResult, BuilderRenderUpdate, BuilderUIValidationResult, BuilderValidationResult, BuilderVariantsValidationOptions } from './mappers/index';
|
|
5
|
+
export type { BuilderComponentVariantsValidationResult, BuilderErrorDuplicateName, BuilderErrorInvalidCollection, BuilderErrorInvalidCollectionBounds, BuilderErrorInvalidDetail, BuilderErrorInvalidInput, BuilderErrorInvalidOption, BuilderErrorInvalidPath, BuilderErrorInvalidPathReason, BuilderErrorInvalidSelectMapKey, BuilderErrorInvalidVariant, BuilderErrorMissingComponent, BuilderErrorMissingDetail, BuilderErrorMissingReference, BuilderErrorMissingVariant, BuilderErrorUnboundParameter, BuilderErrorUnexpectedComponent, BuilderErrorUnexpectedDetail, BuilderErrorUnmetExpectation, BuilderErrorUnvalidated, BuilderInstanceValidationResult, BuilderModelValidationResult, BuilderOrder, BuilderRenderMetadata, BuilderRenderOption, BuilderRenderOptions, BuilderRenderPage, BuilderRenderPages, BuilderRenderResult, BuilderRenderUpdate, BuilderUIValidationResult, BuilderValidationResult, BuilderVariantsValidationOptions } from './mappers/index';
|
|
6
6
|
export type { BuilderComponentVariants, BuilderInstance, BuilderInstanceInput, BuilderInstances, BuilderVariant, BuilderVariants } from './instance';
|
|
7
7
|
export type { BuilderPath, BuilderPaths } from './paths';
|
|
8
8
|
export type { BuilderPrimitive, BuilderPrimitives } from './primitive';
|
|
9
9
|
export type { BuilderParameter, BuilderParameterSerialised, BuilderRef, Paramable, ParamableSerialised } from './references';
|
|
10
10
|
export { bb } from './bb.js';
|
|
11
|
-
export { Builder, builder, detailBoolean, detailNumber, detailString, model, parameter, ref, select, serialise, toggleBoolean, toggleNumber, toggleString } from './entities/index.js';
|
|
11
|
+
export { Builder, builder, detailBoolean, detailNumber, detailString, input, model, parameter, ref, select, serialise, toggleBoolean, toggleNumber, toggleString } from './entities/index.js';
|
|
12
12
|
export { BuilderException } from './exception.js';
|
|
13
13
|
export { ordinal } from './mappers/index.js';
|
|
14
14
|
import { collectionConfig, collectionExpectation, componentDetails, componentExpectation, optionExpectation, uis } from './entities/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { bb } from './bb.js';
|
|
2
|
-
export { Builder, builder, detailBoolean, detailNumber, detailString, model, parameter, ref, select, serialise, toggleBoolean, toggleNumber, toggleString } from './entities/index.js';
|
|
2
|
+
export { Builder, builder, detailBoolean, detailNumber, detailString, input, model, parameter, ref, select, serialise, toggleBoolean, toggleNumber, toggleString } from './entities/index.js';
|
|
3
3
|
export { BuilderException } from './exception.js';
|
|
4
4
|
export { ordinal } from './mappers/index.js';
|
|
5
5
|
import { collectionConfig, collectionExpectation, collectionWhen, componentDetails, componentExpectation, componentWhen, optionExpectation, optionWhen, uis } from './entities/index.js';
|
package/dist/mappers/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export type { BuilderComponentVariantsValidationResult, BuilderErrorDuplicateName, BuilderErrorInvalidCollection, BuilderErrorInvalidCollectionBounds, BuilderErrorInvalidDetail, BuilderErrorInvalidInput, BuilderErrorInvalidOption, BuilderErrorInvalidPath, BuilderErrorInvalidPathReason, BuilderErrorInvalidSelectMapKey, BuilderErrorInvalidVariant, BuilderErrorMissingComponent, BuilderErrorMissingDetail, BuilderErrorMissingReference, BuilderErrorMissingVariant, BuilderErrorUnboundParameter, BuilderErrorUnexpectedComponent, BuilderErrorUnexpectedDetail, BuilderErrorUnmetExpectation, BuilderErrorUnvalidated, BuilderInstanceValidationResult, BuilderModelValidationResult, BuilderUIValidationResult, BuilderValidationResult, BuilderVariantsValidationOptions } from '../validate/index';
|
|
2
2
|
export type { BuilderOrder } from './order';
|
|
3
|
-
export type { BuilderRenderOption, BuilderRenderOptions, BuilderRenderPage, BuilderRenderPages, BuilderRenderResult, BuilderRenderUpdate } from './render/index';
|
|
3
|
+
export type { BuilderRenderMetadata, BuilderRenderOption, BuilderRenderOptions, BuilderRenderPage, BuilderRenderPages, BuilderRenderResult, BuilderRenderUpdate } from './render/index';
|
|
4
4
|
export { assertValidated, validateBuilder, validateInstance, validateModel, validateUI, validateVariants } from '../validate/index.js';
|
|
5
|
+
export type { BuilderOptionGraph } from './variants/index.js';
|
|
5
6
|
export { createInstance } from './instance.js';
|
|
6
|
-
export { createVariants } from './variants/index.js';
|
|
7
|
+
export { createVariants, optionGraph, variantsFor } from './variants/index.js';
|
|
7
8
|
export { order } from './order.js';
|
|
8
9
|
export { ordinal, render } from './render/index.js';
|
|
9
10
|
export { resolveCollection, resolveComponent, resolveOption } from './resolve.js';
|
package/dist/mappers/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { assertValidated, validateBuilder, validateInstance, validateModel, validateUI, validateVariants } from '../validate/index.js';
|
|
2
2
|
export { createInstance } from './instance.js';
|
|
3
|
-
export { createVariants } from './variants/index.js';
|
|
3
|
+
export { createVariants, optionGraph, variantsFor } from './variants/index.js';
|
|
4
4
|
export { order } from './order.js';
|
|
5
5
|
export { ordinal, render } from './render/index.js';
|
|
6
6
|
export { resolveCollection, resolveComponent, resolveOption } from './resolve.js';
|
package/dist/mappers/instance.js
CHANGED
|
@@ -1,33 +1,37 @@
|
|
|
1
1
|
import { check } from '../check.js';
|
|
2
2
|
import { modelsMerge, optionValueSchema } from '../entities/index.js';
|
|
3
|
+
import { BuilderInstanceSchema, BuilderInstancesSchema } from '../instance.js';
|
|
3
4
|
import { resolveCollection, resolveOption } from './resolve.js';
|
|
4
5
|
export function createInstance(entity, partial = {}, refs = []) {
|
|
5
6
|
const model = 'model' in entity ? entity.model : entity;
|
|
6
|
-
|
|
7
|
+
const instance = buildInstance(model, partial, refs);
|
|
8
|
+
check.assert(BuilderInstanceSchema, instance);
|
|
9
|
+
return instance;
|
|
7
10
|
}
|
|
8
11
|
function buildInstance(model, partial, refs) {
|
|
9
12
|
const merged = modelsMerge(model);
|
|
10
13
|
let instance = { ...partial };
|
|
11
14
|
merged.options.forEach((option) => {
|
|
12
15
|
const { name } = option;
|
|
13
|
-
const payload = resolveOption(option, instance, refs);
|
|
16
|
+
const payload = resolveOption(option, model, instance, refs);
|
|
14
17
|
if (payload == null) {
|
|
15
18
|
return;
|
|
16
19
|
}
|
|
17
|
-
|
|
18
|
-
if (check.is(optionValueSchema(payload), existing)) {
|
|
20
|
+
if (check.is(optionValueSchema(payload), instance[name])) {
|
|
19
21
|
return;
|
|
20
22
|
}
|
|
21
23
|
instance = { ...instance, [name]: payload.defaultValue };
|
|
22
24
|
});
|
|
23
25
|
merged.collections.forEach((collection) => {
|
|
24
26
|
const { name } = collection;
|
|
25
|
-
const payload = resolveCollection(collection, instance, refs);
|
|
27
|
+
const payload = resolveCollection(collection, model, instance, refs);
|
|
26
28
|
if (payload == null) {
|
|
27
29
|
return;
|
|
28
30
|
}
|
|
29
31
|
const existing = instance[name];
|
|
30
|
-
const existingItems =
|
|
32
|
+
const existingItems = check.is(BuilderInstancesSchema, existing)
|
|
33
|
+
? existing
|
|
34
|
+
: [];
|
|
31
35
|
const count = Math.max(existingItems.length, payload.min);
|
|
32
36
|
const items = Array.from({ length: count }, (_, index) => buildInstance(payload.model, existingItems[index] ?? {}, refs));
|
|
33
37
|
instance = { ...instance, [name]: items };
|
package/dist/mappers/order.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { check } from '../check.js';
|
|
2
|
+
import { BuilderInstancesSchema } from '../instance.js';
|
|
1
3
|
import { resolveCollection, resolveComponent } from './resolve.js';
|
|
2
4
|
export function order(model, instance, variants, refs = []) {
|
|
3
5
|
const result = {};
|
|
4
6
|
model.components.forEach((component) => {
|
|
5
|
-
if (resolveComponent(component, instance, refs) == null) {
|
|
7
|
+
if (resolveComponent(component, model, instance, refs) == null) {
|
|
6
8
|
return;
|
|
7
9
|
}
|
|
8
10
|
const componentVariants = variants[component.name] ?? [];
|
|
@@ -11,11 +13,12 @@ export function order(model, instance, variants, refs = []) {
|
|
|
11
13
|
});
|
|
12
14
|
model.collections.forEach((collection) => {
|
|
13
15
|
const { name } = collection;
|
|
14
|
-
const payload = resolveCollection(collection, instance, refs);
|
|
16
|
+
const payload = resolveCollection(collection, model, instance, refs);
|
|
15
17
|
if (payload == null) {
|
|
16
18
|
return;
|
|
17
19
|
}
|
|
18
20
|
const itemInstances = instance[name];
|
|
21
|
+
check.assert(BuilderInstancesSchema, itemInstances);
|
|
19
22
|
result[name] = itemInstances.map((itemInstance) => order(payload.model, itemInstance, variants, refs));
|
|
20
23
|
});
|
|
21
24
|
return result;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { BuilderRenderOption, BuilderRenderOptions, BuilderRenderPage, BuilderRenderPages, BuilderRenderUpdate } from './pages';
|
|
1
|
+
export type { BuilderRenderMetadata, BuilderRenderOption, BuilderRenderOptions, BuilderRenderPage, BuilderRenderPages, BuilderRenderUpdate } from './pages';
|
|
2
2
|
export type { BuilderRenderResult } from './render';
|
|
3
3
|
export { render } from './render.js';
|
|
4
4
|
export { ordinal } from './ordinal.js';
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import type { BuilderOptionValuesSerialised } from '../../entities/index';
|
|
2
2
|
import type { BuilderPrimitive } from '../../primitive';
|
|
3
3
|
import type { BuilderInstance } from '../../instance';
|
|
4
|
+
import * as v from 'valibot';
|
|
4
5
|
export type BuilderRenderUpdate = (model: BuilderInstance, primitive: BuilderPrimitive) => BuilderInstance;
|
|
6
|
+
export declare const BuilderRenderMetadataSchema: v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, v.ReadonlyAction<{
|
|
7
|
+
[x: string]: unknown;
|
|
8
|
+
}>]>;
|
|
9
|
+
export type BuilderRenderMetadata = v.InferOutput<typeof BuilderRenderMetadataSchema>;
|
|
5
10
|
export type BuilderRenderOption = Readonly<{
|
|
6
11
|
name: string;
|
|
7
12
|
value: BuilderPrimitive;
|
|
8
13
|
update: BuilderRenderUpdate;
|
|
9
14
|
option: BuilderOptionValuesSerialised;
|
|
15
|
+
displayName?: string;
|
|
16
|
+
kind?: string;
|
|
17
|
+
metadata?: BuilderRenderMetadata;
|
|
10
18
|
}>;
|
|
11
19
|
export type BuilderRenderOptions = ReadonlyArray<BuilderRenderOption>;
|
|
12
20
|
export type BuilderRenderPage = Readonly<{
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
export const BuilderRenderMetadataSchema = v.pipe(v.record(v.string(), v.unknown()), v.readonly());
|