@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.
Files changed (96) hide show
  1. package/dist/bb.d.ts +3 -1
  2. package/dist/bb.js +6 -1
  3. package/dist/check.d.ts +2 -2
  4. package/dist/cli.d.ts +2 -0
  5. package/dist/cli.js +53 -0
  6. package/dist/codegen/index.d.ts +7 -0
  7. package/dist/codegen/index.js +212 -0
  8. package/dist/codegen/template.d.ts +5 -0
  9. package/dist/codegen/template.js +17 -0
  10. package/dist/entities/builder/builder.d.ts +11 -1
  11. package/dist/entities/builder/builder.js +22 -6
  12. package/dist/entities/collection/collection.d.ts +7 -1
  13. package/dist/entities/collection/collection.js +9 -2
  14. package/dist/entities/collection/config.d.ts +6 -1
  15. package/dist/entities/collection/config.js +9 -2
  16. package/dist/entities/component/component.d.ts +41 -1
  17. package/dist/entities/component/component.js +9 -2
  18. package/dist/entities/component/details.d.ts +11 -2
  19. package/dist/entities/component/details.js +9 -2
  20. package/dist/entities/component/field.d.ts +10 -1
  21. package/dist/entities/component/field.js +13 -3
  22. package/dist/entities/index.d.ts +7 -3
  23. package/dist/entities/index.js +3 -1
  24. package/dist/entities/kind.d.ts +1 -1
  25. package/dist/entities/model/model.d.ts +5 -1
  26. package/dist/entities/model/model.js +10 -3
  27. package/dist/entities/model/models.js +9 -5
  28. package/dist/entities/option/option.d.ts +41 -1
  29. package/dist/entities/option/option.js +9 -2
  30. package/dist/entities/option/select.d.ts +7 -1
  31. package/dist/entities/option/select.js +17 -6
  32. package/dist/entities/option/toggle.d.ts +7 -1
  33. package/dist/entities/option/toggle.js +16 -4
  34. package/dist/entities/option/values.d.ts +6 -0
  35. package/dist/entities/pricing.d.ts +64 -0
  36. package/dist/entities/pricing.js +48 -0
  37. package/dist/entities/serialise.d.ts +632 -8
  38. package/dist/entities/serialise.js +33 -12
  39. package/dist/entities/tags.d.ts +3 -0
  40. package/dist/entities/tags.js +2 -0
  41. package/dist/entities/ui/describe.d.ts +231 -8
  42. package/dist/entities/ui/describe.js +12 -5
  43. package/dist/entities/ui/index.d.ts +2 -0
  44. package/dist/entities/ui/index.js +1 -0
  45. package/dist/entities/ui/input.d.ts +343 -0
  46. package/dist/entities/ui/input.js +51 -0
  47. package/dist/entities/ui/page.d.ts +231 -8
  48. package/dist/entities/ui/page.js +12 -5
  49. package/dist/entities/ui/pages.d.ts +5 -1
  50. package/dist/entities/ui/pages.js +9 -2
  51. package/dist/entities/ui/ui.d.ts +9 -4
  52. package/dist/entities/ui/ui.js +29 -11
  53. package/dist/entities/validated.d.ts +7 -3
  54. package/dist/exception.d.ts +2 -2
  55. package/dist/index.d.ts +3 -3
  56. package/dist/index.js +1 -1
  57. package/dist/instance.d.ts +9 -0
  58. package/dist/instance.js +3 -1
  59. package/dist/mappers/index.d.ts +6 -4
  60. package/dist/mappers/index.js +3 -2
  61. package/dist/mappers/pricing.d.ts +3 -0
  62. package/dist/mappers/pricing.js +101 -0
  63. package/dist/mappers/render/index.d.ts +1 -1
  64. package/dist/mappers/render/pages.d.ts +8 -0
  65. package/dist/mappers/render/pages.js +2 -1
  66. package/dist/mappers/render/render.js +19 -3
  67. package/dist/mappers/resolve.d.ts +4 -4
  68. package/dist/mappers/variants/index.d.ts +2 -1
  69. package/dist/mappers/variants/index.js +2 -1
  70. package/dist/mappers/variants/variants.d.ts +5 -2
  71. package/dist/mappers/variants/variants.js +2 -2
  72. package/dist/validate/brand.d.ts +0 -7
  73. package/dist/validate/brand.js +5 -5
  74. package/dist/validate/builder.d.ts +2 -1
  75. package/dist/validate/builder.js +19 -13
  76. package/dist/validate/errors.d.ts +138 -0
  77. package/dist/validate/errors.js +148 -0
  78. package/dist/validate/expectations.d.ts +3 -10
  79. package/dist/validate/expectations.js +8 -10
  80. package/dist/validate/index.d.ts +10 -14
  81. package/dist/validate/index.js +5 -7
  82. package/dist/validate/instance.d.ts +2 -15
  83. package/dist/validate/instance.js +41 -40
  84. package/dist/validate/model.d.ts +4 -31
  85. package/dist/validate/model.js +157 -176
  86. package/dist/validate/pricing.d.ts +6 -0
  87. package/dist/validate/pricing.js +71 -0
  88. package/dist/validate/resolve.d.ts +3 -15
  89. package/dist/validate/resolve.js +66 -69
  90. package/dist/validate/result.d.ts +1 -7
  91. package/dist/validate/result.js +1 -4
  92. package/dist/validate/ui.d.ts +4 -4
  93. package/dist/validate/ui.js +80 -62
  94. package/dist/validate/variants.d.ts +2 -53
  95. package/dist/validate/variants.js +83 -86
  96. package/package.json +12 -3
@@ -1,5 +1,6 @@
1
1
  import type { BuilderPaths } from '../../paths';
2
2
  import type { Paramable } from '../../references';
3
+ import type { BuilderTags } from '../tags';
3
4
  import type { BuilderWhenSerialised } from '../when';
4
5
  import type { BuilderComponentDetails, BuilderComponentDetailsSerialised } from './details';
5
6
  import type { BuilderComponentWhen } from './when';
@@ -10,7 +11,9 @@ export declare class BuilderComponent<const Name extends string = string, const
10
11
  readonly name: Name;
11
12
  readonly payload: Payload;
12
13
  readonly paths?: Paths;
13
- constructor(name: Name, payload: Payload, paths?: Paths);
14
+ readonly tags?: BuilderTags;
15
+ constructor(name: Name, payload: Payload, paths?: Paths, tags?: BuilderTags);
16
+ tag(...tags: Array<string>): BuilderComponent<Name, Payload, Paths>;
14
17
  }
15
18
  export declare const BuilderComponentSchema: v.InstanceSchema<typeof BuilderComponent, undefined>;
16
19
  export type BuilderComponents = ReadonlyArray<BuilderComponent>;
@@ -27,7 +30,9 @@ export declare const BuilderComponentWhenSerialisedSchema: v.GenericSchema<Build
27
30
  name: string;
28
31
  valueType: "string" | "number" | "boolean";
29
32
  isOptional: boolean;
33
+ tags?: readonly string[] | undefined;
30
34
  }>[];
35
+ tags?: readonly string[] | undefined;
31
36
  }>>>;
32
37
  export type BuilderComponentWhenSerialised = BuilderWhenSerialised<BuilderComponentDetailsSerialised>;
33
38
  export declare const BuilderComponentSelectMapSerialisedSchema: v.GenericSchema<import("..").BuilderMatchSelectMap<Readonly<{
@@ -47,7 +52,9 @@ export declare const BuilderComponentSelectMapSerialisedSchema: v.GenericSchema<
47
52
  name: string;
48
53
  valueType: "string" | "number" | "boolean";
49
54
  isOptional: boolean;
55
+ tags?: readonly string[] | undefined;
50
56
  }>[];
57
+ tags?: readonly string[] | undefined;
51
58
  }>>>;
52
59
  export declare const BuilderComponentSerialisedSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
53
60
  readonly name: v.StringSchema<undefined>;
@@ -85,17 +92,21 @@ export declare const BuilderComponentSerialisedSchema: v.SchemaWithPipe<readonly
85
92
  readonly name: v.StringSchema<undefined>;
86
93
  readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
87
94
  readonly isOptional: v.BooleanSchema<undefined>;
95
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
88
96
  }, undefined>, v.ReadonlyAction<{
89
97
  type: "component-field";
90
98
  name: string;
91
99
  valueType: "string" | "number" | "boolean";
92
100
  isOptional: boolean;
101
+ tags?: readonly string[] | undefined;
93
102
  }>]>, undefined>, v.ReadonlyAction<Readonly<{
94
103
  type: "component-field";
95
104
  name: string;
96
105
  valueType: "string" | "number" | "boolean";
97
106
  isOptional: boolean;
107
+ tags?: readonly string[] | undefined;
98
108
  }>[]>]>], undefined>;
109
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
99
110
  }, undefined>, v.ReadonlyAction<{
100
111
  fields: Readonly<{
101
112
  type: "parameter";
@@ -109,7 +120,9 @@ export declare const BuilderComponentSerialisedSchema: v.SchemaWithPipe<readonly
109
120
  name: string;
110
121
  valueType: "string" | "number" | "boolean";
111
122
  isOptional: boolean;
123
+ tags?: readonly string[] | undefined;
112
124
  }>[];
125
+ tags?: readonly string[] | undefined;
113
126
  }>]>, v.GenericSchema<BuilderWhenSerialised<Readonly<{
114
127
  fields: Readonly<{
115
128
  type: "parameter";
@@ -123,7 +136,9 @@ export declare const BuilderComponentSerialisedSchema: v.SchemaWithPipe<readonly
123
136
  name: string;
124
137
  valueType: "string" | "number" | "boolean";
125
138
  isOptional: boolean;
139
+ tags?: readonly string[] | undefined;
126
140
  }>[];
141
+ tags?: readonly string[] | undefined;
127
142
  }>>>], undefined>], undefined>;
128
143
  readonly paths: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
129
144
  readonly type: v.LiteralSchema<"parameter", undefined>;
@@ -140,6 +155,7 @@ export declare const BuilderComponentSerialisedSchema: v.SchemaWithPipe<readonly
140
155
  type: "ref";
141
156
  id: string;
142
157
  }>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, v.ReadonlyAction<(string | number)[]>]>, undefined>, v.ReadonlyAction<(readonly (string | number)[])[]>]>], undefined>, undefined>;
158
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
143
159
  }, undefined>, v.ReadonlyAction<{
144
160
  name: string;
145
161
  payload: Readonly<{
@@ -162,7 +178,9 @@ export declare const BuilderComponentSerialisedSchema: v.SchemaWithPipe<readonly
162
178
  name: string;
163
179
  valueType: "string" | "number" | "boolean";
164
180
  isOptional: boolean;
181
+ tags?: readonly string[] | undefined;
165
182
  }>[];
183
+ tags?: readonly string[] | undefined;
166
184
  }> | BuilderWhenSerialised<Readonly<{
167
185
  fields: Readonly<{
168
186
  type: "parameter";
@@ -176,7 +194,9 @@ export declare const BuilderComponentSerialisedSchema: v.SchemaWithPipe<readonly
176
194
  name: string;
177
195
  valueType: "string" | "number" | "boolean";
178
196
  isOptional: boolean;
197
+ tags?: readonly string[] | undefined;
179
198
  }>[];
199
+ tags?: readonly string[] | undefined;
180
200
  }>>;
181
201
  paths?: readonly (readonly (string | number)[])[] | Readonly<{
182
202
  type: "parameter";
@@ -186,6 +206,7 @@ export declare const BuilderComponentSerialisedSchema: v.SchemaWithPipe<readonly
186
206
  type: "ref";
187
207
  id: string;
188
208
  }> | undefined;
209
+ tags?: readonly string[] | undefined;
189
210
  }>]>;
190
211
  export type BuilderComponentSerialised = v.InferOutput<typeof BuilderComponentSerialisedSchema>;
191
212
  export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
@@ -224,17 +245,21 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
224
245
  readonly name: v.StringSchema<undefined>;
225
246
  readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
226
247
  readonly isOptional: v.BooleanSchema<undefined>;
248
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
227
249
  }, undefined>, v.ReadonlyAction<{
228
250
  type: "component-field";
229
251
  name: string;
230
252
  valueType: "string" | "number" | "boolean";
231
253
  isOptional: boolean;
254
+ tags?: readonly string[] | undefined;
232
255
  }>]>, undefined>, v.ReadonlyAction<Readonly<{
233
256
  type: "component-field";
234
257
  name: string;
235
258
  valueType: "string" | "number" | "boolean";
236
259
  isOptional: boolean;
260
+ tags?: readonly string[] | undefined;
237
261
  }>[]>]>], undefined>;
262
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
238
263
  }, undefined>, v.ReadonlyAction<{
239
264
  fields: Readonly<{
240
265
  type: "parameter";
@@ -248,7 +273,9 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
248
273
  name: string;
249
274
  valueType: "string" | "number" | "boolean";
250
275
  isOptional: boolean;
276
+ tags?: readonly string[] | undefined;
251
277
  }>[];
278
+ tags?: readonly string[] | undefined;
252
279
  }>]>, v.GenericSchema<BuilderWhenSerialised<Readonly<{
253
280
  fields: Readonly<{
254
281
  type: "parameter";
@@ -262,7 +289,9 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
262
289
  name: string;
263
290
  valueType: "string" | "number" | "boolean";
264
291
  isOptional: boolean;
292
+ tags?: readonly string[] | undefined;
265
293
  }>[];
294
+ tags?: readonly string[] | undefined;
266
295
  }>>>], undefined>], undefined>;
267
296
  readonly paths: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
268
297
  readonly type: v.LiteralSchema<"parameter", undefined>;
@@ -279,6 +308,7 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
279
308
  type: "ref";
280
309
  id: string;
281
310
  }>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, v.ReadonlyAction<(string | number)[]>]>, undefined>, v.ReadonlyAction<(readonly (string | number)[])[]>]>], undefined>, undefined>;
311
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
282
312
  }, undefined>, v.ReadonlyAction<{
283
313
  name: string;
284
314
  payload: Readonly<{
@@ -301,7 +331,9 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
301
331
  name: string;
302
332
  valueType: "string" | "number" | "boolean";
303
333
  isOptional: boolean;
334
+ tags?: readonly string[] | undefined;
304
335
  }>[];
336
+ tags?: readonly string[] | undefined;
305
337
  }> | BuilderWhenSerialised<Readonly<{
306
338
  fields: Readonly<{
307
339
  type: "parameter";
@@ -315,7 +347,9 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
315
347
  name: string;
316
348
  valueType: "string" | "number" | "boolean";
317
349
  isOptional: boolean;
350
+ tags?: readonly string[] | undefined;
318
351
  }>[];
352
+ tags?: readonly string[] | undefined;
319
353
  }>>;
320
354
  paths?: readonly (readonly (string | number)[])[] | Readonly<{
321
355
  type: "parameter";
@@ -325,6 +359,7 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
325
359
  type: "ref";
326
360
  id: string;
327
361
  }> | undefined;
362
+ tags?: readonly string[] | undefined;
328
363
  }>]>, undefined>, v.ReadonlyAction<Readonly<{
329
364
  name: string;
330
365
  payload: Readonly<{
@@ -347,7 +382,9 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
347
382
  name: string;
348
383
  valueType: "string" | "number" | "boolean";
349
384
  isOptional: boolean;
385
+ tags?: readonly string[] | undefined;
350
386
  }>[];
387
+ tags?: readonly string[] | undefined;
351
388
  }> | BuilderWhenSerialised<Readonly<{
352
389
  fields: Readonly<{
353
390
  type: "parameter";
@@ -361,7 +398,9 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
361
398
  name: string;
362
399
  valueType: "string" | "number" | "boolean";
363
400
  isOptional: boolean;
401
+ tags?: readonly string[] | undefined;
364
402
  }>[];
403
+ tags?: readonly string[] | undefined;
365
404
  }>>;
366
405
  paths?: readonly (readonly (string | number)[])[] | Readonly<{
367
406
  type: "parameter";
@@ -371,5 +410,6 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
371
410
  type: "ref";
372
411
  id: string;
373
412
  }> | undefined;
413
+ tags?: readonly string[] | undefined;
374
414
  }>[]>]>;
375
415
  export type BuilderComponentsSerialised = v.InferOutput<typeof BuilderComponentsSerialisedSchema>;
@@ -2,16 +2,22 @@ import * as v from 'valibot';
2
2
  import { BuilderPathsSchema } from '../../paths.js';
3
3
  import { paramable } from '../../references.js';
4
4
  import { serialisable } from '../../serialisable.js';
5
+ import { BuilderTagsSchema } from '../tags.js';
5
6
  import { createSelectMapSerialisedSchema, createWhenSerialisedSchema } from '../when.js';
6
7
  import { BuilderComponentDetailsSerialisedSchema } from './details.js';
7
8
  export class BuilderComponent {
8
9
  name;
9
10
  payload;
10
11
  paths;
11
- constructor(name, payload, paths) {
12
+ tags;
13
+ constructor(name, payload, paths, tags) {
12
14
  this.name = name;
13
15
  this.payload = payload;
14
16
  this.paths = paths;
17
+ this.tags = tags;
18
+ }
19
+ tag(...tags) {
20
+ return new BuilderComponent(this.name, this.payload, this.paths, tags);
15
21
  }
16
22
  }
17
23
  export const BuilderComponentSchema = v.instance(BuilderComponent);
@@ -20,6 +26,7 @@ export const BuilderComponentSelectMapSerialisedSchema = createSelectMapSerialis
20
26
  export const BuilderComponentSerialisedSchema = serialisable(v.object({
21
27
  name: v.string(),
22
28
  payload: paramable(v.union([BuilderComponentDetailsSerialisedSchema, BuilderComponentWhenSerialisedSchema])),
23
- paths: v.optional(paramable(BuilderPathsSchema))
29
+ paths: v.optional(paramable(BuilderPathsSchema)),
30
+ tags: v.optional(BuilderTagsSchema)
24
31
  }));
25
32
  export const BuilderComponentsSerialisedSchema = v.pipe(v.array(BuilderComponentSerialisedSchema), v.readonly());
@@ -1,10 +1,13 @@
1
1
  import type { Paramable } from '../../references';
2
+ import type { BuilderTags } from '../tags';
2
3
  import type { BuilderComponentFields } from './field';
3
4
  import * as v from 'valibot';
4
5
  export declare class BuilderComponentDetails<const Fields extends Paramable<BuilderComponentFields> = Paramable<BuilderComponentFields>> {
5
6
  readonly type: 'component-details';
6
- fields: Fields;
7
- constructor(fields: Fields);
7
+ readonly fields: Fields;
8
+ readonly tags?: BuilderTags;
9
+ constructor(fields: Fields, tags?: BuilderTags);
10
+ tag(...tags: Array<string>): BuilderComponentDetails<Fields>;
8
11
  }
9
12
  export declare const BuilderComponentDetailsSchema: v.InstanceSchema<typeof BuilderComponentDetails, undefined>;
10
13
  export declare const BuilderComponentDetailsSerialisedSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
@@ -27,17 +30,21 @@ export declare const BuilderComponentDetailsSerialisedSchema: v.SchemaWithPipe<r
27
30
  readonly name: v.StringSchema<undefined>;
28
31
  readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
29
32
  readonly isOptional: v.BooleanSchema<undefined>;
33
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
30
34
  }, undefined>, v.ReadonlyAction<{
31
35
  type: "component-field";
32
36
  name: string;
33
37
  valueType: "string" | "number" | "boolean";
34
38
  isOptional: boolean;
39
+ tags?: readonly string[] | undefined;
35
40
  }>]>, undefined>, v.ReadonlyAction<Readonly<{
36
41
  type: "component-field";
37
42
  name: string;
38
43
  valueType: "string" | "number" | "boolean";
39
44
  isOptional: boolean;
45
+ tags?: readonly string[] | undefined;
40
46
  }>[]>]>], undefined>;
47
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
41
48
  }, undefined>, v.ReadonlyAction<{
42
49
  fields: Readonly<{
43
50
  type: "parameter";
@@ -51,7 +58,9 @@ export declare const BuilderComponentDetailsSerialisedSchema: v.SchemaWithPipe<r
51
58
  name: string;
52
59
  valueType: "string" | "number" | "boolean";
53
60
  isOptional: boolean;
61
+ tags?: readonly string[] | undefined;
54
62
  }>[];
63
+ tags?: readonly string[] | undefined;
55
64
  }>]>;
56
65
  export type BuilderComponentDetailsSerialised = v.InferOutput<typeof BuilderComponentDetailsSerialisedSchema>;
57
66
  export declare function componentDetails<const Fields extends BuilderComponentFields>(...fields: Fields): BuilderComponentDetails<Fields>;
@@ -1,16 +1,23 @@
1
1
  import * as v from 'valibot';
2
2
  import { paramable } from '../../references.js';
3
3
  import { serialisable } from '../../serialisable.js';
4
+ import { BuilderTagsSchema } from '../tags.js';
4
5
  import { BuilderComponentFieldsSerialisedSchema } from './field.js';
5
6
  export class BuilderComponentDetails {
6
7
  fields;
7
- constructor(fields) {
8
+ tags;
9
+ constructor(fields, tags) {
8
10
  this.fields = fields;
11
+ this.tags = tags;
12
+ }
13
+ tag(...tags) {
14
+ return new BuilderComponentDetails(this.fields, tags);
9
15
  }
10
16
  }
11
17
  export const BuilderComponentDetailsSchema = v.instance(BuilderComponentDetails);
12
18
  export const BuilderComponentDetailsSerialisedSchema = serialisable(v.object({
13
- fields: paramable(BuilderComponentFieldsSerialisedSchema)
19
+ fields: paramable(BuilderComponentFieldsSerialisedSchema),
20
+ tags: v.optional(BuilderTagsSchema)
14
21
  }));
15
22
  export function componentDetails(...fields) {
16
23
  return new BuilderComponentDetails(fields);
@@ -1,16 +1,20 @@
1
1
  import type { BuilderPrimitive } from '../../primitive';
2
+ import type { BuilderTags } from '../tags';
2
3
  import * as v from 'valibot';
3
4
  export declare const BuilderComponentFieldValueTypeSchema: v.PicklistSchema<["string", "boolean", "number"], undefined>;
4
5
  export type BuilderComponentFieldValueType = v.InferOutput<typeof BuilderComponentFieldValueTypeSchema>;
5
6
  export declare class BuilderComponentField<const Name extends string = string, const ValueSchema extends v.GenericSchema<BuilderPrimitive> = v.GenericSchema<BuilderPrimitive>> {
7
+ #private;
6
8
  readonly value: v.InferOutput<ValueSchema>;
7
9
  readonly type: "component-field";
8
10
  readonly name: Name;
9
11
  readonly valueType: BuilderComponentFieldValueType;
10
12
  readonly valueSchema: ValueSchema;
11
13
  readonly isOptional: boolean;
12
- constructor(name: Name, valueType: BuilderComponentFieldValueType, optional?: boolean);
14
+ readonly tags?: BuilderTags;
15
+ constructor(name: Name, valueType: BuilderComponentFieldValueType, optional?: boolean, tags?: BuilderTags);
13
16
  optional(): BuilderComponentField<Name, v.NullableSchema<ValueSchema, undefined>>;
17
+ tag(...tags: Array<string>): BuilderComponentField<Name, ValueSchema>;
14
18
  }
15
19
  export declare function detailString<const Name extends string>(name: Name): BuilderComponentField<Name, v.StringSchema<undefined>>;
16
20
  export declare function detailNumber<const Name extends string>(name: Name): BuilderComponentField<Name, v.NumberSchema<undefined>>;
@@ -23,11 +27,13 @@ export declare const BuilderComponentFieldSerialisedSchema: v.SchemaWithPipe<rea
23
27
  readonly name: v.StringSchema<undefined>;
24
28
  readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
25
29
  readonly isOptional: v.BooleanSchema<undefined>;
30
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
26
31
  }, undefined>, v.ReadonlyAction<{
27
32
  type: "component-field";
28
33
  name: string;
29
34
  valueType: "string" | "number" | "boolean";
30
35
  isOptional: boolean;
36
+ tags?: readonly string[] | undefined;
31
37
  }>]>;
32
38
  export type BuilderComponentFieldSerialised = v.InferOutput<typeof BuilderComponentFieldSerialisedSchema>;
33
39
  export declare const BuilderComponentFieldsSerialisedSchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
@@ -35,16 +41,19 @@ export declare const BuilderComponentFieldsSerialisedSchema: v.SchemaWithPipe<re
35
41
  readonly name: v.StringSchema<undefined>;
36
42
  readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
37
43
  readonly isOptional: v.BooleanSchema<undefined>;
44
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
38
45
  }, undefined>, v.ReadonlyAction<{
39
46
  type: "component-field";
40
47
  name: string;
41
48
  valueType: "string" | "number" | "boolean";
42
49
  isOptional: boolean;
50
+ tags?: readonly string[] | undefined;
43
51
  }>]>, undefined>, v.ReadonlyAction<Readonly<{
44
52
  type: "component-field";
45
53
  name: string;
46
54
  valueType: "string" | "number" | "boolean";
47
55
  isOptional: boolean;
56
+ tags?: readonly string[] | undefined;
48
57
  }>[]>]>;
49
58
  export type BuilderComponentFieldsSerialised = v.InferOutput<typeof BuilderComponentFieldsSerialisedSchema>;
50
59
  export declare function detailValueSchema(valueType: BuilderComponentFieldValueType, optional: boolean): v.GenericSchema<BuilderPrimitive>;
@@ -1,5 +1,6 @@
1
1
  import * as v from 'valibot';
2
2
  import { serialisable } from '../../serialisable.js';
3
+ import { BuilderTagsSchema } from '../tags.js';
3
4
  export const BuilderComponentFieldValueTypeSchema = v.picklist(['string', 'boolean', 'number']);
4
5
  export class BuilderComponentField {
5
6
  type = 'component-field';
@@ -7,14 +8,22 @@ export class BuilderComponentField {
7
8
  valueType;
8
9
  valueSchema;
9
10
  isOptional;
10
- constructor(name, valueType, optional = false) {
11
+ tags;
12
+ constructor(name, valueType, optional = false, tags) {
11
13
  this.name = name;
12
14
  this.valueType = valueType;
13
15
  this.valueSchema = detailValueSchema(valueType, optional);
14
16
  this.isOptional = optional;
17
+ this.tags = tags;
18
+ }
19
+ #next(patch) {
20
+ return new BuilderComponentField(this.name, this.valueType, patch.optional ?? this.isOptional, patch.tags ?? this.tags);
15
21
  }
16
22
  optional() {
17
- return new BuilderComponentField(this.name, this.valueType, true);
23
+ return this.#next({ optional: true });
24
+ }
25
+ tag(...tags) {
26
+ return this.#next({ tags });
18
27
  }
19
28
  }
20
29
  export function detailString(name) {
@@ -32,7 +41,8 @@ export const BuilderComponentFieldSerialisedSchema = serialisable(v.object({
32
41
  type: v.literal('component-field'),
33
42
  name: v.string(),
34
43
  valueType: BuilderComponentFieldValueTypeSchema,
35
- isOptional: v.boolean()
44
+ isOptional: v.boolean(),
45
+ tags: v.optional(BuilderTagsSchema)
36
46
  }));
37
47
  export const BuilderComponentFieldsSerialisedSchema = v.pipe(v.array(BuilderComponentFieldSerialisedSchema), v.readonly());
38
48
  export function detailValueSchema(valueType, optional) {
@@ -7,17 +7,21 @@ export type { BuilderModelEntrySerialised } from './entry';
7
7
  export type { BuilderInstanceOf, BuilderModelGeneric, BuilderModels, BuilderModelSerialised, BuilderModelState, BuilderModelStateEmpty, BuilderModelStateOf } from './model/index';
8
8
  export { BuilderModel, BuilderModelSchema, BuilderModelSerialisedSchema, model, modelsMerge } from './model/index.js';
9
9
  export type { BuilderOptionPayload, BuilderOptions, BuilderOptionSerialised, BuilderOptionsSerialised, BuilderOptionValues, BuilderOptionValuesSerialised, BuilderOptionWhen, BuilderOptionWhenSerialised, BuilderSelectTypeLabels, BuilderSelectTypeSerialised, BuilderSelectTypeValues, BuilderToggleTypeSerialised, BuilderToggleValueType } from './option/index';
10
+ export type { BuilderPricing, BuilderPricingExpression, BuilderPricingReduce, BuilderPricingTagExpression } from './pricing';
10
11
  export type { BuilderRefEntities, BuilderRefEntity } from './refs.js';
11
- export type { BuilderDescription, BuilderDescriptionItem, BuilderUIDescribeSerialised, BuilderUIItem, BuilderUIItems, BuilderUIItemSerialised, BuilderUIItemsSerialised, BuilderUIPageSerialised, BuilderUIPagesSerialised, BuilderUIs, BuilderUIsSerialised, BuilderUISerialised } from './ui/index';
12
- export type { BuilderCollectionConfigValidated, BuilderCollectionsValidated, BuilderCollectionValidated, BuilderComponentsValidated, BuilderComponentValidated, BuilderComponentVariantsValidated, BuilderInstancesValidated, BuilderInstanceValidated, BuilderModelValidated, BuilderOptionsValidated, BuilderOptionValidated, BuilderUIDescribeValidated, BuilderUIItemsValidated, BuilderUIPageValidated, BuilderUIValidated, BuilderValidated } from './validated';
12
+ export type { BuilderTags } from './tags';
13
+ export type { BuilderDescription, BuilderDescriptionItem, BuilderUIDescribeSerialised, BuilderUIInputMetadata, BuilderUIInputMetadataSerialised, BuilderUIInputs, BuilderUIInputsSerialised, BuilderUIInputSerialised, BuilderUIItem, BuilderUIItems, BuilderUIItemSerialised, BuilderUIItemsSerialised, BuilderUIPageSerialised, BuilderUIPagesSerialised, BuilderUIs, BuilderUIsSerialised, BuilderUISerialised } from './ui/index';
14
+ export type { BuilderCollectionConfigValidated, BuilderCollectionsValidated, BuilderCollectionValidated, BuilderComponentDetailsValidated, BuilderComponentsValidated, BuilderComponentValidated, BuilderComponentVariantsValidated, BuilderInstancesValidated, BuilderInstanceValidated, BuilderModelValidated, BuilderOptionsValidated, BuilderOptionValidated, BuilderOptionValuesValidated, BuilderPricingValidated, BuilderUIDescribeValidated, BuilderUIItemsValidated, BuilderUIPageValidated, BuilderUIValidated, BuilderValidated } from './validated';
13
15
  export type { BuilderEnableConfig, BuilderMatchConfig, BuilderMatchSelectMap, BuilderUnlessConfig, BuilderWhen, BuilderWhenConfig, BuilderWhenSerialised } from './when';
14
16
  export { Builder, builder, BuilderSchema, BuilderSerialisedSchema } from './builder/index.js';
15
17
  export { BuilderCollection, BuilderCollectionConfig, BuilderCollectionConfigSchema, BuilderCollectionConfigSerialisedSchema, BuilderCollectionSchema, BuilderCollectionSelectMapSerialisedSchema, BuilderCollectionSerialisedSchema, BuilderCollectionsSerialisedSchema, BuilderCollectionWhenSerialisedSchema, collectionConfig, collectionExpectation, collectionWhen } from './collection/index.js';
16
18
  export { BuilderComponent, BuilderComponentDetails, BuilderComponentDetailsSchema, BuilderComponentDetailsSerialisedSchema, BuilderComponentField, BuilderComponentFieldSchema, BuilderComponentFieldSerialisedSchema, BuilderComponentFieldsSchema, BuilderComponentFieldsSerialisedSchema, BuilderComponentFieldValueTypeSchema, BuilderComponentSchema, BuilderComponentSelectMapSerialisedSchema, BuilderComponentSerialisedSchema, BuilderComponentsSerialisedSchema, BuilderComponentWhenSerialisedSchema, componentDetails, componentExpectation, componentWhen, detailBoolean, detailNumber, detailString, detailValueSchema } from './component/index.js';
17
19
  export { parameter, ref } from '../references.js';
20
+ export { BuilderPricingExpressionSchema, BuilderPricingReduceSchema, BuilderPricingSchema, BuilderPricingTagExpressionSchema } from './pricing.js';
21
+ export { BuilderTagsSchema } from './tags.js';
18
22
  export { BuilderExpectation, BuilderExpectationKindSchema, BuilderExpectationSchema, BuilderExpectationSerialisedSchema, BuilderExpectationsSchema, BuilderExpectationsSerialisedSchema } from './expectation.js';
19
23
  export { BuilderEntityKindSchema, BuilderEntitySerialisedSchema } from './kind.js';
20
24
  export { BuilderOption, BuilderOptionSchema, BuilderOptionSelectMapSerialisedSchema, BuilderOptionSerialisedSchema, BuilderOptionsSerialisedSchema, BuilderOptionValuesSchema, BuilderOptionValuesSerialisedSchema, BuilderOptionWhenSerialisedSchema, BuilderSelectType, BuilderSelectTypeSchema, BuilderSelectTypeSerialisedSchema, BuilderToggleType, BuilderToggleTypeSchema, BuilderToggleTypeSerialisedSchema, optionExpectation, optionValueSchema, optionWhen, select, toggleBoolean, toggleNumber, toggleString } from './option/index.js';
21
25
  export { serialise } from './serialise.js';
22
- export { BuilderDescriptionItemSchema, BuilderDescriptionSchema, BuilderUI, BuilderUIDescribe, BuilderUIDescribeSchema, BuilderUIDescribeSerialisedSchema, BuilderUIItemSerialisedSchema, BuilderUIItemsSerialisedSchema, BuilderUIPage, BuilderUIPages, BuilderUIPageSchema, BuilderUIPageSerialisedSchema, BuilderUIPagesSchema, BuilderUIPagesSerialisedSchema, BuilderUISchema, BuilderUISerialisedSchema, uis } from './ui/index.js';
26
+ export { BuilderDescriptionItemSchema, BuilderDescriptionSchema, BuilderUI, BuilderUIDescribe, BuilderUIDescribeSchema, BuilderUIDescribeSerialisedSchema, BuilderUIInput, BuilderUIInputMetadataSchema, BuilderUIInputSchema, BuilderUIInputSerialisedSchema, BuilderUIInputsSerialisedSchema, BuilderUIItemSerialisedSchema, BuilderUIItemsSerialisedSchema, BuilderUIPage, BuilderUIPages, BuilderUIPageSchema, BuilderUIPageSerialisedSchema, BuilderUIPagesSchema, BuilderUIPagesSerialisedSchema, BuilderUISchema, BuilderUISerialisedSchema, input, uis } from './ui/index.js';
23
27
  export { BuilderWhenConfigSchema, BuilderWhenEnableSchema, BuilderWhenMatchSchema, BuilderWhenSerialisedSchema, BuilderWhenUnlessSchema, createWhenFactories, createWhenSerialisedSchema } from './when.js';
@@ -3,9 +3,11 @@ export { Builder, builder, BuilderSchema, BuilderSerialisedSchema } from './buil
3
3
  export { BuilderCollection, BuilderCollectionConfig, BuilderCollectionConfigSchema, BuilderCollectionConfigSerialisedSchema, BuilderCollectionSchema, BuilderCollectionSelectMapSerialisedSchema, BuilderCollectionSerialisedSchema, BuilderCollectionsSerialisedSchema, BuilderCollectionWhenSerialisedSchema, collectionConfig, collectionExpectation, collectionWhen } from './collection/index.js';
4
4
  export { BuilderComponent, BuilderComponentDetails, BuilderComponentDetailsSchema, BuilderComponentDetailsSerialisedSchema, BuilderComponentField, BuilderComponentFieldSchema, BuilderComponentFieldSerialisedSchema, BuilderComponentFieldsSchema, BuilderComponentFieldsSerialisedSchema, BuilderComponentFieldValueTypeSchema, BuilderComponentSchema, BuilderComponentSelectMapSerialisedSchema, BuilderComponentSerialisedSchema, BuilderComponentsSerialisedSchema, BuilderComponentWhenSerialisedSchema, componentDetails, componentExpectation, componentWhen, detailBoolean, detailNumber, detailString, detailValueSchema } from './component/index.js';
5
5
  export { parameter, ref } from '../references.js';
6
+ export { BuilderPricingExpressionSchema, BuilderPricingReduceSchema, BuilderPricingSchema, BuilderPricingTagExpressionSchema } from './pricing.js';
7
+ export { BuilderTagsSchema } from './tags.js';
6
8
  export { BuilderExpectation, BuilderExpectationKindSchema, BuilderExpectationSchema, BuilderExpectationSerialisedSchema, BuilderExpectationsSchema, BuilderExpectationsSerialisedSchema } from './expectation.js';
7
9
  export { BuilderEntityKindSchema, BuilderEntitySerialisedSchema } from './kind.js';
8
10
  export { BuilderOption, BuilderOptionSchema, BuilderOptionSelectMapSerialisedSchema, BuilderOptionSerialisedSchema, BuilderOptionsSerialisedSchema, BuilderOptionValuesSchema, BuilderOptionValuesSerialisedSchema, BuilderOptionWhenSerialisedSchema, BuilderSelectType, BuilderSelectTypeSchema, BuilderSelectTypeSerialisedSchema, BuilderToggleType, BuilderToggleTypeSchema, BuilderToggleTypeSerialisedSchema, optionExpectation, optionValueSchema, optionWhen, select, toggleBoolean, toggleNumber, toggleString } from './option/index.js';
9
11
  export { serialise } from './serialise.js';
10
- export { BuilderDescriptionItemSchema, BuilderDescriptionSchema, BuilderUI, BuilderUIDescribe, BuilderUIDescribeSchema, BuilderUIDescribeSerialisedSchema, BuilderUIItemSerialisedSchema, BuilderUIItemsSerialisedSchema, BuilderUIPage, BuilderUIPages, BuilderUIPageSchema, BuilderUIPageSerialisedSchema, BuilderUIPagesSchema, BuilderUIPagesSerialisedSchema, BuilderUISchema, BuilderUISerialisedSchema, uis } from './ui/index.js';
12
+ export { BuilderDescriptionItemSchema, BuilderDescriptionSchema, BuilderUI, BuilderUIDescribe, BuilderUIDescribeSchema, BuilderUIDescribeSerialisedSchema, BuilderUIInput, BuilderUIInputMetadataSchema, BuilderUIInputSchema, BuilderUIInputSerialisedSchema, BuilderUIInputsSerialisedSchema, BuilderUIItemSerialisedSchema, BuilderUIItemsSerialisedSchema, BuilderUIPage, BuilderUIPages, BuilderUIPageSchema, BuilderUIPageSerialisedSchema, BuilderUIPagesSchema, BuilderUIPagesSerialisedSchema, BuilderUISchema, BuilderUISerialisedSchema, input, uis } from './ui/index.js';
11
13
  export { BuilderWhenConfigSchema, BuilderWhenEnableSchema, BuilderWhenMatchSchema, BuilderWhenSerialisedSchema, BuilderWhenUnlessSchema, createWhenFactories, createWhenSerialisedSchema } from './when.js';
@@ -2,7 +2,7 @@ import type { EntitiesMap } from './serialise';
2
2
  import * as v from 'valibot';
3
3
  import { entitiesMap } from './serialise.js';
4
4
  export type BuilderEntityKind = keyof typeof entitiesMap;
5
- export declare const BuilderEntityKindSchema: v.PicklistSchema<readonly ("string" | "number" | "boolean" | "builder" | "model" | "ui" | "select" | "toggle" | "paths" | "uiPage" | "uiDescribe" | "uiPages" | "componentDetails" | "collectionConfig" | "expectations" | "uiItems" | "optionWhen" | "componentWhen" | "collectionWhen" | "optionSelectMap" | "componentSelectMap" | "collectionSelectMap" | "path")[], undefined>;
5
+ export declare const BuilderEntityKindSchema: v.PicklistSchema<readonly ("string" | "number" | "boolean" | "builder" | "model" | "pricing" | "ui" | "select" | "toggle" | "path" | "uiPage" | "uiDescribe" | "uiPages" | "uiInput" | "componentDetails" | "collectionConfig" | "expectations" | "uiItems" | "optionWhen" | "componentWhen" | "collectionWhen" | "optionSelectMap" | "componentSelectMap" | "collectionSelectMap" | "paths")[], undefined>;
6
6
  export type BuilderEntitySerialised = {
7
7
  [Kind in keyof EntitiesMap]: v.InferOutput<EntitiesMap[Kind]['serialised']>;
8
8
  }[keyof EntitiesMap];
@@ -5,6 +5,7 @@ import type { BuilderCollections, BuilderCollectionsSerialised } from '../collec
5
5
  import type { BuilderComponents, BuilderComponentsSerialised } from '../component/index';
6
6
  import type { BuilderExpectation, BuilderExpectations, BuilderExpectationsSerialised } from '../expectation';
7
7
  import type { BuilderOptions, BuilderOptionsSerialised } from '../option/index';
8
+ import type { BuilderTags } from '../tags';
8
9
  import type { BuilderModelStateAsserted } from './expectation';
9
10
  import type { BuilderCollectionMethod, BuilderComponentMethod, BuilderOptionMethod } from './methods';
10
11
  import type { BuilderModels, BuilderModelsMerge, BuilderModelsSerialised } from './models';
@@ -18,7 +19,9 @@ export declare class BuilderModel<State extends BuilderModelState = BuilderModel
18
19
  readonly components: State['components'];
19
20
  readonly collections: State['collections'];
20
21
  readonly expectations: BuilderExpectations;
21
- constructor(models?: BuilderModels, options?: BuilderOptions, components?: BuilderComponents, collections?: BuilderCollections, expectations?: BuilderExpectations);
22
+ readonly tags?: BuilderTags;
23
+ constructor(models?: BuilderModels, options?: BuilderOptions, components?: BuilderComponents, collections?: BuilderCollections, expectations?: BuilderExpectations, tags?: BuilderTags);
24
+ tag(...tags: Array<string>): BuilderModel<State>;
22
25
  get option(): BuilderOptionMethod<State>;
23
26
  get component(): BuilderComponentMethod<State>;
24
27
  get collection(): BuilderCollectionMethod<State>;
@@ -33,6 +36,7 @@ export interface BuilderModelSerialised {
33
36
  readonly components: BuilderComponentsSerialised;
34
37
  readonly collections: BuilderCollectionsSerialised;
35
38
  readonly expectations: BuilderExpectationsSerialised;
39
+ readonly tags?: BuilderTags;
36
40
  }
37
41
  export declare const BuilderModelSerialisedSchema: v.GenericSchema<BuilderModelSerialised>;
38
42
  export type BuilderModelStateOf<Input extends Paramable<BuilderModelGeneric>> = Input extends BuilderModel<infer State extends BuilderModelState> ? State : BuilderModelStateEmpty;
@@ -4,6 +4,7 @@ import { BuilderCollectionsSerialisedSchema } from '../collection/index.js';
4
4
  import { BuilderComponentsSerialisedSchema } from '../component/index.js';
5
5
  import { BuilderExpectationsSerialisedSchema } from '../expectation.js';
6
6
  import { BuilderOptionsSerialisedSchema } from '../option/index.js';
7
+ import { BuilderTagsSchema } from '../tags.js';
7
8
  import { builderCollectionMethod, builderComponentMethod, builderOptionMethod } from './methods.js';
8
9
  import { BuilderModelsSerialisedSchema } from './models.js';
9
10
  export class BuilderModel {
@@ -12,12 +13,17 @@ export class BuilderModel {
12
13
  components;
13
14
  collections;
14
15
  expectations;
15
- constructor(models = [], options = [], components = [], collections = [], expectations = []) {
16
+ tags;
17
+ constructor(models = [], options = [], components = [], collections = [], expectations = [], tags) {
16
18
  this.models = models;
17
19
  this.options = options;
18
20
  this.components = components;
19
21
  this.collections = collections;
20
22
  this.expectations = expectations;
23
+ this.tags = tags;
24
+ }
25
+ tag(...tags) {
26
+ return new BuilderModel(this.models, this.options, this.components, this.collections, this.expectations, tags);
21
27
  }
22
28
  get option() {
23
29
  const method = builderOptionMethod();
@@ -57,7 +63,7 @@ export class BuilderModel {
57
63
  return this.#next({ expectations: [...this.expectations, ...expectations] });
58
64
  }
59
65
  #next(patch) {
60
- return new BuilderModel(this.models, patch.options ?? this.options, patch.components ?? this.components, patch.collections ?? this.collections, patch.expectations ?? this.expectations);
66
+ return new BuilderModel(this.models, patch.options ?? this.options, patch.components ?? this.components, patch.collections ?? this.collections, patch.expectations ?? this.expectations, this.tags);
61
67
  }
62
68
  }
63
69
  export function model(...parts) {
@@ -69,5 +75,6 @@ export const BuilderModelSerialisedSchema = serialisable(v.object({
69
75
  options: BuilderOptionsSerialisedSchema,
70
76
  components: BuilderComponentsSerialisedSchema,
71
77
  collections: BuilderCollectionsSerialisedSchema,
72
- expectations: BuilderExpectationsSerialisedSchema
78
+ expectations: BuilderExpectationsSerialisedSchema,
79
+ tags: v.optional(BuilderTagsSchema)
73
80
  }));
@@ -3,12 +3,16 @@ import { paramable } from '../../references.js';
3
3
  import { BuilderModelSerialisedSchema } from './model.js';
4
4
  export const BuilderModelsSerialisedSchema = v.pipe(v.array(paramable(v.lazy(() => BuilderModelSerialisedSchema))), v.readonly());
5
5
  export function modelsMerge(model) {
6
- const merged = model.models.map(modelsMerge);
6
+ const flat = flattenModels(model);
7
7
  return {
8
8
  models: [],
9
- options: [...model.options, ...merged.flatMap((nested) => nested.options)],
10
- components: [...model.components, ...merged.flatMap((nested) => nested.components)],
11
- collections: [...model.collections, ...merged.flatMap((nested) => nested.collections)],
12
- expectations: [...model.expectations, ...merged.flatMap((nested) => nested.expectations)]
9
+ options: flat.flatMap((entry) => entry.options),
10
+ components: flat.flatMap((entry) => entry.components),
11
+ collections: flat.flatMap((entry) => entry.collections),
12
+ expectations: flat.flatMap((entry) => entry.expectations),
13
+ tags: Array.from(new Set(flat.flatMap((entry) => entry.tags ?? [])))
13
14
  };
14
15
  }
16
+ function flattenModels(model) {
17
+ return [model, ...model.models.flatMap(flattenModels)];
18
+ }