@builder-builder/builder 0.0.25 → 0.0.27

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 (103) hide show
  1. package/dist/client/schema.d.ts +29 -4
  2. package/dist/client/schema.js +3 -1
  3. package/dist/components/Builder.svelte.d.ts +24 -0
  4. package/dist/components/BuilderCollectionButtons.svelte.d.ts +22 -0
  5. package/dist/components/BuilderCollections.svelte.d.ts +23 -0
  6. package/dist/components/BuilderDescription.svelte.d.ts +18 -0
  7. package/dist/components/BuilderLayout.svelte.d.ts +24 -0
  8. package/dist/components/BuilderOption.svelte.d.ts +31 -0
  9. package/dist/components/BuilderOptionSelect.svelte.d.ts +21 -0
  10. package/dist/components/BuilderOptionToggleBoolean.svelte.d.ts +20 -0
  11. package/dist/components/BuilderOptionToggleNumber.svelte.d.ts +21 -0
  12. package/dist/components/BuilderOptionToggleString.svelte.d.ts +21 -0
  13. package/dist/components/BuilderPrice.svelte.d.ts +21 -0
  14. package/dist/components/BuilderRender.svelte.d.ts +39 -0
  15. package/dist/components/config.d.ts +2 -0
  16. package/dist/components/config.js +1 -0
  17. package/dist/components/dispatch.d.ts +1 -0
  18. package/dist/components/dispatch.js +3 -0
  19. package/dist/components/id.d.ts +1 -0
  20. package/dist/components/id.js +3 -0
  21. package/dist/components/index.d.ts +25 -0
  22. package/dist/components/index.js +7441 -0
  23. package/dist/entities/builder/builder.js +2 -1
  24. package/dist/entities/collection/collection.js +2 -1
  25. package/dist/entities/collection/config.d.ts +20 -20
  26. package/dist/entities/collection/config.js +3 -2
  27. package/dist/entities/component/component.d.ts +30 -30
  28. package/dist/entities/component/component.js +2 -1
  29. package/dist/entities/component/config.d.ts +12 -12
  30. package/dist/entities/component/field.d.ts +4 -4
  31. package/dist/entities/component/field.js +4 -3
  32. package/dist/entities/expectation.d.ts +2 -2
  33. package/dist/entities/expectation.js +2 -1
  34. package/dist/entities/index.d.ts +1 -1
  35. package/dist/entities/kind.d.ts +1 -1
  36. package/dist/entities/kind.js +43 -3
  37. package/dist/entities/model/models.d.ts +3 -3
  38. package/dist/entities/option/config.d.ts +4 -4
  39. package/dist/entities/option/option.d.ts +22 -22
  40. package/dist/entities/option/option.js +2 -1
  41. package/dist/entities/option/select.d.ts +1 -1
  42. package/dist/entities/option/select.js +5 -4
  43. package/dist/entities/option/toggle.d.ts +1 -1
  44. package/dist/entities/option/toggle.js +4 -3
  45. package/dist/entities/paths.d.ts +2 -2
  46. package/dist/entities/paths.js +2 -1
  47. package/dist/entities/pricing/expression.js +5 -4
  48. package/dist/entities/pricing/rates.js +2 -1
  49. package/dist/entities/references.d.ts +50 -2
  50. package/dist/entities/references.js +2 -1
  51. package/dist/entities/serialise.d.ts +318 -113
  52. package/dist/entities/serialise.js +4 -3
  53. package/dist/entities/tags.d.ts +1 -1
  54. package/dist/entities/tags.js +2 -1
  55. package/dist/entities/ui/describe.d.ts +126 -34
  56. package/dist/entities/ui/describe.js +3 -2
  57. package/dist/entities/ui/input.d.ts +158 -49
  58. package/dist/entities/ui/input.js +13 -6
  59. package/dist/entities/ui/page.d.ts +124 -32
  60. package/dist/entities/ui/page.js +2 -1
  61. package/dist/entities/ui/pages.d.ts +11 -3
  62. package/dist/entities/ui/pages.js +3 -2
  63. package/dist/entities/validated.d.ts +1 -0
  64. package/dist/entities/when.d.ts +16 -16
  65. package/dist/entities/when.js +2 -2
  66. package/dist/errors/errors.d.ts +10 -0
  67. package/dist/errors/errors.js +6 -0
  68. package/dist/instance.d.ts +7 -7
  69. package/dist/instance.js +4 -4
  70. package/dist/mappers/index.d.ts +1 -1
  71. package/dist/mappers/order.js +4 -2
  72. package/dist/mappers/price.js +1 -2
  73. package/dist/mappers/render/collection.d.ts +9 -0
  74. package/dist/mappers/render/collection.js +27 -0
  75. package/dist/mappers/render/compose.d.ts +5 -0
  76. package/dist/mappers/render/compose.js +15 -0
  77. package/dist/mappers/render/description.d.ts +3 -0
  78. package/dist/mappers/render/description.js +17 -0
  79. package/dist/mappers/render/index.d.ts +3 -1
  80. package/dist/mappers/render/option.d.ts +21 -0
  81. package/dist/mappers/render/option.js +26 -0
  82. package/dist/mappers/render/page.d.ts +11 -0
  83. package/dist/mappers/render/page.js +11 -0
  84. package/dist/mappers/render/paths.d.ts +3 -0
  85. package/dist/mappers/render/paths.js +21 -0
  86. package/dist/mappers/render/render.d.ts +1 -1
  87. package/dist/mappers/render/render.js +33 -98
  88. package/dist/mappers/resolve.d.ts +2 -1
  89. package/dist/mappers/resolve.js +24 -23
  90. package/dist/primitive.d.ts +5 -0
  91. package/dist/primitive.js +6 -1
  92. package/dist/public.d.ts +1 -1
  93. package/dist/references.d.ts +6 -6
  94. package/dist/references.js +3 -2
  95. package/dist/validate/model.js +16 -5
  96. package/dist/validate/paths.js +3 -5
  97. package/dist/validate/pricing.js +5 -6
  98. package/dist/validate/resolve.d.ts +2 -1
  99. package/dist/validate/resolve.js +87 -73
  100. package/dist/validate/ui.js +14 -13
  101. package/package.json +7 -5
  102. package/dist/mappers/render/pages.d.ts +0 -24
  103. package/dist/mappers/render/pages.js +0 -2
@@ -1,4 +1,5 @@
1
1
  import * as v from 'valibot';
2
+ import { NameSchema } from '../../primitive.js';
2
3
  import { BuilderRefSerialisedSchema } from '../../references.js';
3
4
  import { BuilderModel, BuilderModelSerialisedSchema } from '../model/index.js';
4
5
  import { BuilderPricing, BuilderPricingSerialisedSchema } from '../pricing/index.js';
@@ -40,7 +41,7 @@ export function builder(model, ui, pricing) {
40
41
  export const BuilderSerialisedSchema = serialisable(v.object({
41
42
  model: BuilderModelSerialisedSchema,
42
43
  ui: BuilderUISerialisedSchema,
43
- bindings: v.pipe(v.record(v.string(), v.union([BuilderRefSerialisedSchema, v.unknown()])), v.readonly()),
44
+ bindings: v.pipe(v.record(NameSchema, v.union([BuilderRefSerialisedSchema, v.unknown()])), v.readonly()),
44
45
  tags: v.optional(BuilderTagsSchema),
45
46
  pricing: BuilderPricingSerialisedSchema
46
47
  }));
@@ -1,4 +1,5 @@
1
1
  import * as v from 'valibot';
2
+ import { NameSchema } from '../../primitive.js';
2
3
  import { paramable } from '../../references.js';
3
4
  import { createEntityValidator } from '../kind.js';
4
5
  import { BuilderPathsSchema } from '../paths.js';
@@ -25,7 +26,7 @@ export const BuilderCollectionSchema = v.instance(BuilderCollection);
25
26
  export const BuilderCollectionWhenSerialisedSchema = createWhenSerialisedSchema(BuilderCollectionConfigSerialisedSchema);
26
27
  export const BuilderCollectionSelectMapSerialisedSchema = createSelectMapSerialisedSchema(BuilderCollectionConfigSerialisedSchema);
27
28
  export const BuilderCollectionSerialisedSchema = serialisable(v.object({
28
- name: v.string(),
29
+ name: NameSchema,
29
30
  payload: paramable(v.union([BuilderCollectionConfigSerialisedSchema, BuilderCollectionWhenSerialisedSchema])),
30
31
  paths: v.optional(paramable(BuilderPathsSchema)),
31
32
  tags: v.optional(BuilderTagsSchema)
@@ -15,50 +15,50 @@ export declare const BuilderCollectionConfigSchema: v.InstanceSchema<typeof Buil
15
15
  export declare const BuilderCollectionConfigSerialisedSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
16
16
  readonly model: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
17
17
  readonly type: v.LiteralSchema<"parameter", undefined>;
18
- readonly id: v.StringSchema<undefined>;
19
- readonly name: v.StringSchema<undefined>;
18
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
19
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
20
20
  }, undefined>, v.ReadonlyAction<{
21
21
  type: "parameter";
22
22
  id: string;
23
23
  name: string;
24
24
  }>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
25
25
  readonly type: v.LiteralSchema<"ref", undefined>;
26
- readonly id: v.StringSchema<undefined>;
26
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
27
27
  }, undefined>, v.ReadonlyAction<{
28
28
  type: "ref";
29
29
  id: string;
30
30
  }>]>, v.LazySchema<v.GenericSchema<import("..").BuilderModelSerialised>>], undefined>;
31
31
  readonly min: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
32
32
  readonly type: v.LiteralSchema<"parameter", undefined>;
33
- readonly id: v.StringSchema<undefined>;
34
- readonly name: v.StringSchema<undefined>;
33
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
34
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
35
35
  }, undefined>, v.ReadonlyAction<{
36
36
  type: "parameter";
37
37
  id: string;
38
38
  name: string;
39
39
  }>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
40
40
  readonly type: v.LiteralSchema<"ref", undefined>;
41
- readonly id: v.StringSchema<undefined>;
41
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
42
42
  }, undefined>, v.ReadonlyAction<{
43
43
  type: "ref";
44
44
  id: string;
45
45
  }>]>, v.NumberSchema<undefined>], undefined>;
46
46
  readonly max: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
47
47
  readonly type: v.LiteralSchema<"parameter", undefined>;
48
- readonly id: v.StringSchema<undefined>;
49
- readonly name: v.StringSchema<undefined>;
48
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
49
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
50
50
  }, undefined>, v.ReadonlyAction<{
51
51
  type: "parameter";
52
52
  id: string;
53
53
  name: string;
54
54
  }>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
55
55
  readonly type: v.LiteralSchema<"ref", undefined>;
56
- readonly id: v.StringSchema<undefined>;
56
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
57
57
  }, undefined>, v.ReadonlyAction<{
58
58
  type: "ref";
59
59
  id: string;
60
60
  }>]>, v.NumberSchema<undefined>], undefined>;
61
- readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
61
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
62
62
  }, undefined>, v.ReadonlyAction<{
63
63
  model: Readonly<{
64
64
  type: "parameter";
@@ -90,50 +90,50 @@ export type BuilderCollectionConfigSerialised = v.InferOutput<typeof BuilderColl
90
90
  export declare const BuilderCollectionConfigsSerialisedSchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
91
91
  readonly model: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
92
92
  readonly type: v.LiteralSchema<"parameter", undefined>;
93
- readonly id: v.StringSchema<undefined>;
94
- readonly name: v.StringSchema<undefined>;
93
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
94
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
95
95
  }, undefined>, v.ReadonlyAction<{
96
96
  type: "parameter";
97
97
  id: string;
98
98
  name: string;
99
99
  }>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
100
100
  readonly type: v.LiteralSchema<"ref", undefined>;
101
- readonly id: v.StringSchema<undefined>;
101
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
102
102
  }, undefined>, v.ReadonlyAction<{
103
103
  type: "ref";
104
104
  id: string;
105
105
  }>]>, v.LazySchema<v.GenericSchema<import("..").BuilderModelSerialised>>], undefined>;
106
106
  readonly min: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
107
107
  readonly type: v.LiteralSchema<"parameter", undefined>;
108
- readonly id: v.StringSchema<undefined>;
109
- readonly name: v.StringSchema<undefined>;
108
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
109
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
110
110
  }, undefined>, v.ReadonlyAction<{
111
111
  type: "parameter";
112
112
  id: string;
113
113
  name: string;
114
114
  }>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
115
115
  readonly type: v.LiteralSchema<"ref", undefined>;
116
- readonly id: v.StringSchema<undefined>;
116
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
117
117
  }, undefined>, v.ReadonlyAction<{
118
118
  type: "ref";
119
119
  id: string;
120
120
  }>]>, v.NumberSchema<undefined>], undefined>;
121
121
  readonly max: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
122
122
  readonly type: v.LiteralSchema<"parameter", undefined>;
123
- readonly id: v.StringSchema<undefined>;
124
- readonly name: v.StringSchema<undefined>;
123
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
124
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
125
125
  }, undefined>, v.ReadonlyAction<{
126
126
  type: "parameter";
127
127
  id: string;
128
128
  name: string;
129
129
  }>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
130
130
  readonly type: v.LiteralSchema<"ref", undefined>;
131
- readonly id: v.StringSchema<undefined>;
131
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
132
132
  }, undefined>, v.ReadonlyAction<{
133
133
  type: "ref";
134
134
  id: string;
135
135
  }>]>, v.NumberSchema<undefined>], undefined>;
136
- readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
136
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
137
137
  }, undefined>, v.ReadonlyAction<{
138
138
  model: Readonly<{
139
139
  type: "parameter";
@@ -1,4 +1,5 @@
1
1
  import * as v from 'valibot';
2
+ import { NumberSchema } from '../../primitive.js';
2
3
  import { isParamable, paramable } from '../../references.js';
3
4
  import { createEntityValidator } from '../kind.js';
4
5
  import { BuilderModelSerialisedSchema } from '../model/index.js';
@@ -22,8 +23,8 @@ export class BuilderCollectionConfig {
22
23
  export const BuilderCollectionConfigSchema = v.instance(BuilderCollectionConfig);
23
24
  export const BuilderCollectionConfigSerialisedSchema = serialisable(v.object({
24
25
  model: paramable(v.lazy(() => BuilderModelSerialisedSchema)),
25
- min: paramable(v.number()),
26
- max: paramable(v.number()),
26
+ min: paramable(NumberSchema),
27
+ max: paramable(NumberSchema),
27
28
  tags: v.optional(BuilderTagsSchema)
28
29
  }));
29
30
  export const BuilderCollectionConfigsSerialisedSchema = v.pipe(v.array(BuilderCollectionConfigSerialisedSchema), v.readonly());
@@ -57,42 +57,42 @@ export declare const BuilderComponentSelectMapSerialisedSchema: v.GenericSchema<
57
57
  tags?: readonly string[] | undefined;
58
58
  }>>>;
59
59
  export declare const BuilderComponentSerialisedSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
60
- readonly name: v.StringSchema<undefined>;
60
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
61
61
  readonly payload: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
62
62
  readonly type: v.LiteralSchema<"parameter", undefined>;
63
- readonly id: v.StringSchema<undefined>;
64
- readonly name: v.StringSchema<undefined>;
63
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
64
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
65
65
  }, undefined>, v.ReadonlyAction<{
66
66
  type: "parameter";
67
67
  id: string;
68
68
  name: string;
69
69
  }>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
70
70
  readonly type: v.LiteralSchema<"ref", undefined>;
71
- readonly id: v.StringSchema<undefined>;
71
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
72
72
  }, undefined>, v.ReadonlyAction<{
73
73
  type: "ref";
74
74
  id: string;
75
75
  }>]>, v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
76
76
  readonly fields: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
77
77
  readonly type: v.LiteralSchema<"parameter", undefined>;
78
- readonly id: v.StringSchema<undefined>;
79
- readonly name: v.StringSchema<undefined>;
78
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
79
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
80
80
  }, undefined>, v.ReadonlyAction<{
81
81
  type: "parameter";
82
82
  id: string;
83
83
  name: string;
84
84
  }>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
85
85
  readonly type: v.LiteralSchema<"ref", undefined>;
86
- readonly id: v.StringSchema<undefined>;
86
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
87
87
  }, undefined>, v.ReadonlyAction<{
88
88
  type: "ref";
89
89
  id: string;
90
90
  }>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
91
91
  readonly type: v.LiteralSchema<"component-field", undefined>;
92
- readonly name: v.StringSchema<undefined>;
92
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
93
93
  readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
94
94
  readonly isOptional: v.BooleanSchema<undefined>;
95
- readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
95
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
96
96
  }, undefined>, v.ReadonlyAction<{
97
97
  type: "component-field";
98
98
  name: string;
@@ -106,7 +106,7 @@ export declare const BuilderComponentSerialisedSchema: v.SchemaWithPipe<readonly
106
106
  isOptional: boolean;
107
107
  tags?: readonly string[] | undefined;
108
108
  }>[]>]>], undefined>;
109
- readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
109
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
110
110
  }, undefined>, v.ReadonlyAction<{
111
111
  fields: Readonly<{
112
112
  type: "parameter";
@@ -142,20 +142,20 @@ export declare const BuilderComponentSerialisedSchema: v.SchemaWithPipe<readonly
142
142
  }>>>], undefined>], undefined>;
143
143
  readonly paths: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
144
144
  readonly type: v.LiteralSchema<"parameter", undefined>;
145
- readonly id: v.StringSchema<undefined>;
146
- readonly name: v.StringSchema<undefined>;
145
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
146
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
147
147
  }, undefined>, v.ReadonlyAction<{
148
148
  type: "parameter";
149
149
  id: string;
150
150
  name: string;
151
151
  }>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
152
152
  readonly type: v.LiteralSchema<"ref", undefined>;
153
- readonly id: v.StringSchema<undefined>;
153
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
154
154
  }, undefined>, v.ReadonlyAction<{
155
155
  type: "ref";
156
156
  id: string;
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>;
157
+ }>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, 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.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
159
159
  }, undefined>, v.ReadonlyAction<{
160
160
  name: string;
161
161
  payload: Readonly<{
@@ -210,42 +210,42 @@ export declare const BuilderComponentSerialisedSchema: v.SchemaWithPipe<readonly
210
210
  }>]>;
211
211
  export type BuilderComponentSerialised = v.InferOutput<typeof BuilderComponentSerialisedSchema>;
212
212
  export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
213
- readonly name: v.StringSchema<undefined>;
213
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
214
214
  readonly payload: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
215
215
  readonly type: v.LiteralSchema<"parameter", undefined>;
216
- readonly id: v.StringSchema<undefined>;
217
- readonly name: v.StringSchema<undefined>;
216
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
217
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
218
218
  }, undefined>, v.ReadonlyAction<{
219
219
  type: "parameter";
220
220
  id: string;
221
221
  name: string;
222
222
  }>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
223
223
  readonly type: v.LiteralSchema<"ref", undefined>;
224
- readonly id: v.StringSchema<undefined>;
224
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
225
225
  }, undefined>, v.ReadonlyAction<{
226
226
  type: "ref";
227
227
  id: string;
228
228
  }>]>, v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
229
229
  readonly fields: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
230
230
  readonly type: v.LiteralSchema<"parameter", undefined>;
231
- readonly id: v.StringSchema<undefined>;
232
- readonly name: v.StringSchema<undefined>;
231
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
232
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
233
233
  }, undefined>, v.ReadonlyAction<{
234
234
  type: "parameter";
235
235
  id: string;
236
236
  name: string;
237
237
  }>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
238
238
  readonly type: v.LiteralSchema<"ref", undefined>;
239
- readonly id: v.StringSchema<undefined>;
239
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
240
240
  }, undefined>, v.ReadonlyAction<{
241
241
  type: "ref";
242
242
  id: string;
243
243
  }>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
244
244
  readonly type: v.LiteralSchema<"component-field", undefined>;
245
- readonly name: v.StringSchema<undefined>;
245
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
246
246
  readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
247
247
  readonly isOptional: v.BooleanSchema<undefined>;
248
- readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
248
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
249
249
  }, undefined>, v.ReadonlyAction<{
250
250
  type: "component-field";
251
251
  name: string;
@@ -259,7 +259,7 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
259
259
  isOptional: boolean;
260
260
  tags?: readonly string[] | undefined;
261
261
  }>[]>]>], undefined>;
262
- readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
262
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
263
263
  }, undefined>, v.ReadonlyAction<{
264
264
  fields: Readonly<{
265
265
  type: "parameter";
@@ -295,20 +295,20 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
295
295
  }>>>], undefined>], undefined>;
296
296
  readonly paths: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
297
297
  readonly type: v.LiteralSchema<"parameter", undefined>;
298
- readonly id: v.StringSchema<undefined>;
299
- readonly name: v.StringSchema<undefined>;
298
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
299
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
300
300
  }, undefined>, v.ReadonlyAction<{
301
301
  type: "parameter";
302
302
  id: string;
303
303
  name: string;
304
304
  }>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
305
305
  readonly type: v.LiteralSchema<"ref", undefined>;
306
- readonly id: v.StringSchema<undefined>;
306
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
307
307
  }, undefined>, v.ReadonlyAction<{
308
308
  type: "ref";
309
309
  id: string;
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>;
310
+ }>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, 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.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
312
312
  }, undefined>, v.ReadonlyAction<{
313
313
  name: string;
314
314
  payload: Readonly<{
@@ -1,4 +1,5 @@
1
1
  import * as v from 'valibot';
2
+ import { NameSchema } from '../../primitive.js';
2
3
  import { paramable } from '../../references.js';
3
4
  import { createEntityValidator } from '../kind.js';
4
5
  import { BuilderPathsSchema } from '../paths.js';
@@ -25,7 +26,7 @@ export const BuilderComponentSchema = v.instance(BuilderComponent);
25
26
  export const BuilderComponentWhenSerialisedSchema = createWhenSerialisedSchema(BuilderComponentConfigSerialisedSchema);
26
27
  export const BuilderComponentSelectMapSerialisedSchema = createSelectMapSerialisedSchema(BuilderComponentConfigSerialisedSchema);
27
28
  export const BuilderComponentSerialisedSchema = serialisable(v.object({
28
- name: v.string(),
29
+ name: NameSchema,
29
30
  payload: paramable(v.union([BuilderComponentConfigSerialisedSchema, BuilderComponentWhenSerialisedSchema])),
30
31
  paths: v.optional(paramable(BuilderPathsSchema)),
31
32
  tags: v.optional(BuilderTagsSchema)
@@ -13,24 +13,24 @@ export declare const BuilderComponentConfigSchema: v.InstanceSchema<typeof Build
13
13
  export declare const BuilderComponentConfigSerialisedSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
14
14
  readonly fields: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
15
15
  readonly type: v.LiteralSchema<"parameter", undefined>;
16
- readonly id: v.StringSchema<undefined>;
17
- readonly name: v.StringSchema<undefined>;
16
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
17
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
18
18
  }, undefined>, v.ReadonlyAction<{
19
19
  type: "parameter";
20
20
  id: string;
21
21
  name: string;
22
22
  }>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
23
23
  readonly type: v.LiteralSchema<"ref", undefined>;
24
- readonly id: v.StringSchema<undefined>;
24
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
25
25
  }, undefined>, v.ReadonlyAction<{
26
26
  type: "ref";
27
27
  id: string;
28
28
  }>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
29
29
  readonly type: v.LiteralSchema<"component-field", undefined>;
30
- readonly name: v.StringSchema<undefined>;
30
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
31
31
  readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
32
32
  readonly isOptional: v.BooleanSchema<undefined>;
33
- readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
33
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
34
34
  }, undefined>, v.ReadonlyAction<{
35
35
  type: "component-field";
36
36
  name: string;
@@ -44,7 +44,7 @@ export declare const BuilderComponentConfigSerialisedSchema: v.SchemaWithPipe<re
44
44
  isOptional: boolean;
45
45
  tags?: readonly string[] | undefined;
46
46
  }>[]>]>], undefined>;
47
- readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
47
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
48
48
  }, undefined>, v.ReadonlyAction<{
49
49
  fields: Readonly<{
50
50
  type: "parameter";
@@ -66,24 +66,24 @@ export type BuilderComponentConfigSerialised = v.InferOutput<typeof BuilderCompo
66
66
  export declare const BuilderComponentConfigsSerialisedSchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
67
67
  readonly fields: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
68
68
  readonly type: v.LiteralSchema<"parameter", undefined>;
69
- readonly id: v.StringSchema<undefined>;
70
- readonly name: v.StringSchema<undefined>;
69
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
70
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
71
71
  }, undefined>, v.ReadonlyAction<{
72
72
  type: "parameter";
73
73
  id: string;
74
74
  name: string;
75
75
  }>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
76
76
  readonly type: v.LiteralSchema<"ref", undefined>;
77
- readonly id: v.StringSchema<undefined>;
77
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
78
78
  }, undefined>, v.ReadonlyAction<{
79
79
  type: "ref";
80
80
  id: string;
81
81
  }>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
82
82
  readonly type: v.LiteralSchema<"component-field", undefined>;
83
- readonly name: v.StringSchema<undefined>;
83
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
84
84
  readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
85
85
  readonly isOptional: v.BooleanSchema<undefined>;
86
- readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
86
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
87
87
  }, undefined>, v.ReadonlyAction<{
88
88
  type: "component-field";
89
89
  name: string;
@@ -97,7 +97,7 @@ export declare const BuilderComponentConfigsSerialisedSchema: v.SchemaWithPipe<r
97
97
  isOptional: boolean;
98
98
  tags?: readonly string[] | undefined;
99
99
  }>[]>]>], undefined>;
100
- readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
100
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
101
101
  }, undefined>, v.ReadonlyAction<{
102
102
  fields: Readonly<{
103
103
  type: "parameter";
@@ -24,10 +24,10 @@ export declare const BuilderComponentFieldsSchema: v.SchemaWithPipe<readonly [v.
24
24
  export type BuilderComponentFields = v.InferOutput<typeof BuilderComponentFieldsSchema>;
25
25
  export declare const BuilderComponentFieldSerialisedSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
26
26
  readonly type: v.LiteralSchema<"component-field", undefined>;
27
- readonly name: v.StringSchema<undefined>;
27
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
28
28
  readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
29
29
  readonly isOptional: v.BooleanSchema<undefined>;
30
- readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
30
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
31
31
  }, undefined>, v.ReadonlyAction<{
32
32
  type: "component-field";
33
33
  name: string;
@@ -38,10 +38,10 @@ export declare const BuilderComponentFieldSerialisedSchema: v.SchemaWithPipe<rea
38
38
  export type BuilderComponentFieldSerialised = v.InferOutput<typeof BuilderComponentFieldSerialisedSchema>;
39
39
  export declare const BuilderComponentFieldsSerialisedSchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
40
40
  readonly type: v.LiteralSchema<"component-field", undefined>;
41
- readonly name: v.StringSchema<undefined>;
41
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
42
42
  readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
43
43
  readonly isOptional: v.BooleanSchema<undefined>;
44
- readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
44
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
45
45
  }, undefined>, v.ReadonlyAction<{
46
46
  type: "component-field";
47
47
  name: string;
@@ -1,4 +1,5 @@
1
1
  import * as v from 'valibot';
2
+ import { BooleanSchema, NameSchema, NumberSchema, StringSchema } from '../../primitive.js';
2
3
  import { serialisable } from '../serialisable.js';
3
4
  import { BuilderTagsSchema } from '../tags.js';
4
5
  export const BuilderComponentFieldValueTypeSchema = v.picklist(['string', 'boolean', 'number']);
@@ -39,13 +40,13 @@ export const BuilderComponentFieldSchema = v.instance(BuilderComponentField);
39
40
  export const BuilderComponentFieldsSchema = v.pipe(v.array(BuilderComponentFieldSchema), v.readonly());
40
41
  export const BuilderComponentFieldSerialisedSchema = serialisable(v.object({
41
42
  type: v.literal('component-field'),
42
- name: v.string(),
43
+ name: NameSchema,
43
44
  valueType: BuilderComponentFieldValueTypeSchema,
44
- isOptional: v.boolean(),
45
+ isOptional: BooleanSchema,
45
46
  tags: v.optional(BuilderTagsSchema)
46
47
  }));
47
48
  export const BuilderComponentFieldsSerialisedSchema = v.pipe(v.array(BuilderComponentFieldSerialisedSchema), v.readonly());
48
49
  export function detailValueSchema(valueType, optional) {
49
- const baseSchema = valueType === 'string' ? v.string() : valueType === 'boolean' ? v.boolean() : v.number();
50
+ const baseSchema = valueType === 'string' ? StringSchema : valueType === 'boolean' ? BooleanSchema : NumberSchema;
50
51
  return optional ? v.nullable(baseSchema) : baseSchema;
51
52
  }
@@ -12,7 +12,7 @@ export declare const BuilderExpectationSchema: v.InstanceSchema<typeof BuilderEx
12
12
  export declare const BuilderExpectationsSchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.InstanceSchema<typeof BuilderExpectation, undefined>, undefined>, v.ReadonlyAction<BuilderExpectation<string, unknown, "option" | "component" | "collection">[]>]>;
13
13
  export type BuilderExpectations = v.InferOutput<typeof BuilderExpectationsSchema>;
14
14
  export declare const BuilderExpectationSerialisedSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
15
- readonly name: v.StringSchema<undefined>;
15
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
16
16
  readonly kind: v.PicklistSchema<["option", "component", "collection"], undefined>;
17
17
  }, undefined>, v.ReadonlyAction<{
18
18
  name: string;
@@ -20,7 +20,7 @@ export declare const BuilderExpectationSerialisedSchema: v.SchemaWithPipe<readon
20
20
  }>]>;
21
21
  export type BuilderExpectationSerialised = v.InferOutput<typeof BuilderExpectationSerialisedSchema>;
22
22
  export declare const BuilderExpectationsSerialisedSchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
23
- readonly name: v.StringSchema<undefined>;
23
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
24
24
  readonly kind: v.PicklistSchema<["option", "component", "collection"], undefined>;
25
25
  }, undefined>, v.ReadonlyAction<{
26
26
  name: string;
@@ -1,4 +1,5 @@
1
1
  import * as v from 'valibot';
2
+ import { NameSchema } from '../primitive.js';
2
3
  import { createEntityValidator } from './kind.js';
3
4
  import { serialisable } from './serialisable.js';
4
5
  export const BuilderExpectationKindSchema = v.picklist(['option', 'component', 'collection']);
@@ -13,7 +14,7 @@ export class BuilderExpectation {
13
14
  export const BuilderExpectationSchema = v.instance(BuilderExpectation);
14
15
  export const BuilderExpectationsSchema = v.pipe(v.array(BuilderExpectationSchema), v.readonly());
15
16
  export const BuilderExpectationSerialisedSchema = serialisable(v.object({
16
- name: v.string(),
17
+ name: NameSchema,
17
18
  kind: BuilderExpectationKindSchema
18
19
  }));
19
20
  export const BuilderExpectationsSerialisedSchema = v.pipe(v.array(BuilderExpectationSerialisedSchema), v.readonly());
@@ -11,7 +11,7 @@ export type { BuilderPricingExpression, BuilderPricingLookupKey, BuilderPricingR
11
11
  export type { BuilderReference, BuilderReferences } from './references.js';
12
12
  export type { BuilderTags } from './tags';
13
13
  export type { BuilderDescription, BuilderDescriptionItem, BuilderUIDescribeSerialised, BuilderUIInputMetadata, BuilderUIInputMetadataSerialised, BuilderUIInputs, BuilderUIInputSerialised, BuilderUIInputsSerialised, BuilderUIItem, BuilderUIItems, BuilderUIItemSerialised, BuilderUIItemsSerialised, BuilderUIPageSerialised, BuilderUIPagesSerialised, BuilderUIs, BuilderUISerialised, BuilderUIsSerialised } from './ui/index';
14
- export type { BuilderCollectionConfigValidated, BuilderCollectionsValidated, BuilderCollectionValidated, BuilderComponentConfigValidated, BuilderComponentsValidated, BuilderComponentValidated, BuilderInstancesValidated, BuilderInstanceValidated, BuilderModelValidated, BuilderOptionConfigValidated, BuilderOptionsValidated, BuilderOptionValidated, BuilderPricingValidated, BuilderUIDescribeValidated, BuilderUIItemsValidated, BuilderUIPageValidated, BuilderUIValidated, BuilderValidated, BuilderValidatedMap, BuilderVariantsValidated, Validated, ValidationResult } from './validated';
14
+ export type { BuilderCollectionConfigValidated, BuilderCollectionsValidated, BuilderCollectionValidated, BuilderComponentConfigValidated, BuilderComponentsValidated, BuilderComponentValidated, BuilderInstancesValidated, BuilderInstanceValidated, BuilderModelValidated, BuilderOptionConfigValidated, BuilderOptionsValidated, BuilderOptionValidated, BuilderPricingValidated, BuilderUIDescribeValidated, BuilderUIInputValidated, BuilderUIItemsValidated, BuilderUIPageValidated, BuilderUIValidated, BuilderValidated, BuilderValidatedMap, BuilderVariantsValidated, Validated, ValidationResult } from './validated';
15
15
  export type { BuilderEnableConfig, BuilderMatchConfig, BuilderMatchSelectMap, BuilderUnlessConfig, BuilderWhen, BuilderWhenConfig, BuilderWhenSerialised } from './when';
16
16
  export { Builder, builder, BuilderSchema, BuilderSerialisedSchema } from './builder/index.js';
17
17
  export { BuilderCollection, BuilderCollectionConfig, BuilderCollectionConfigSchema, BuilderCollectionConfigSerialisedSchema, BuilderCollectionConfigsSerialisedSchema, BuilderCollectionSchema, BuilderCollectionSelectMapSerialisedSchema, BuilderCollectionSerialisedSchema, BuilderCollectionsSerialisedSchema, BuilderCollectionWhenSerialisedSchema, collectionConfig, collectionExpectation, collectionWhen, validateCollectionConfig, validateCollectionSelectMap, validateCollectionWhen } from './collection/index.js';
@@ -1,7 +1,7 @@
1
1
  import type { BuilderReferences } from './references';
2
2
  import type { EntitiesMap } from './serialise';
3
3
  import type { BuilderValidatedMap, ValidationResult } from './validated';
4
- import type * as v from 'valibot';
4
+ import * as v from 'valibot';
5
5
  import { BuilderErrorsScope } from '../errors/index.js';
6
6
  export declare const builderEntityKinds: readonly ["builder", "model", "select", "toggle", "optionSelectMap", "optionWhen", "componentConfig", "componentSelectMap", "componentWhen", "collectionConfig", "collectionSelectMap", "collectionWhen", "ui", "uiDescribe", "uiItems", "uiPage", "uiPages", "uiInput", "pricing", "pricingRates", "expectations", "paths", "path", "number", "string", "boolean"];
7
7
  export type BuilderEntityKind = (typeof builderEntityKinds)[number];
@@ -1,4 +1,5 @@
1
- import { BuilderErrorsScope, check } from '../errors/index.js';
1
+ import * as v from 'valibot';
2
+ import { BuilderErrorsScope } from '../errors/index.js';
2
3
  export const builderEntityKinds = [
3
4
  'builder',
4
5
  'model',
@@ -29,11 +30,50 @@ export const builderEntityKinds = [
29
30
  ];
30
31
  export function createEntityValidator(kind, schema, validate) {
31
32
  return (input, references = [], errors = new BuilderErrorsScope(input)) => {
32
- if (!check.is(schema, input)) {
33
- errors.entityInvalid(kind);
33
+ const result = v.safeParse(schema, input);
34
+ if (!result.success) {
35
+ if (!toEmptyErrors(result.issues, errors)) {
36
+ errors.entityInvalid(kind);
37
+ }
34
38
  return [input, errors.errors];
35
39
  }
36
40
  validate?.(input, errors, references);
37
41
  return [input, errors.errors];
38
42
  };
39
43
  }
44
+ function toEmptyErrors(issues, errors) {
45
+ if (issues.length === 0) {
46
+ return false;
47
+ }
48
+ return issues.map((issue) => toEmptyError(issue, errors)).every(Boolean);
49
+ }
50
+ function toEmptyError(issue, errors) {
51
+ const [firstSegment] = issue.path ?? [];
52
+ if (firstSegment == null || !hasMinLengthFailure(issue)) {
53
+ return false;
54
+ }
55
+ const { key } = firstSegment;
56
+ if (key === 'name') {
57
+ errors.entityEmptyName();
58
+ return true;
59
+ }
60
+ if (key === 'label') {
61
+ errors.entityEmptyLabel();
62
+ return true;
63
+ }
64
+ if (key === 'id') {
65
+ errors.entityEmptyId();
66
+ return true;
67
+ }
68
+ if (key === 'inputs') {
69
+ errors.entityEmptyInputs();
70
+ return true;
71
+ }
72
+ return false;
73
+ }
74
+ function hasMinLengthFailure(issue) {
75
+ if (issue.type === 'min_length') {
76
+ return true;
77
+ }
78
+ return issue.issues?.some(hasMinLengthFailure) ?? false;
79
+ }