@builder-builder/builder 0.0.24 → 0.0.26

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 (120) hide show
  1. package/dist/client/client.d.ts +3 -1
  2. package/dist/client/client.js +29 -20
  3. package/dist/client/index.d.ts +1 -4
  4. package/dist/client/index.js +1 -2
  5. package/dist/client/public.d.ts +4 -0
  6. package/dist/client/public.js +2 -0
  7. package/dist/client/schema.d.ts +26 -18
  8. package/dist/client/schema.js +7 -1
  9. package/dist/entities/builder/builder.js +2 -1
  10. package/dist/entities/collection/collection.d.ts +2 -2
  11. package/dist/entities/collection/collection.js +2 -1
  12. package/dist/entities/collection/config.d.ts +21 -21
  13. package/dist/entities/collection/config.js +4 -3
  14. package/dist/entities/component/component.d.ts +32 -32
  15. package/dist/entities/component/component.js +2 -1
  16. package/dist/entities/component/config.d.ts +13 -13
  17. package/dist/entities/component/config.js +1 -1
  18. package/dist/entities/component/field.d.ts +4 -4
  19. package/dist/entities/component/field.js +4 -3
  20. package/dist/entities/expectation.d.ts +3 -3
  21. package/dist/entities/expectation.js +2 -1
  22. package/dist/entities/index.d.ts +1 -1
  23. package/dist/entities/kind.d.ts +4 -4
  24. package/dist/entities/kind.js +44 -4
  25. package/dist/entities/model/models.d.ts +3 -3
  26. package/dist/entities/option/config.d.ts +4 -4
  27. package/dist/entities/option/option.d.ts +24 -24
  28. package/dist/entities/option/option.js +2 -1
  29. package/dist/entities/option/select.d.ts +2 -2
  30. package/dist/entities/option/select.js +12 -9
  31. package/dist/entities/option/toggle.d.ts +2 -2
  32. package/dist/entities/option/toggle.js +5 -4
  33. package/dist/entities/paths.d.ts +4 -4
  34. package/dist/entities/paths.js +2 -1
  35. package/dist/entities/pricing/expression.js +5 -4
  36. package/dist/entities/pricing/rates.d.ts +1 -1
  37. package/dist/entities/pricing/rates.js +2 -1
  38. package/dist/entities/references.d.ts +2 -2
  39. package/dist/entities/references.js +2 -1
  40. package/dist/entities/serialise.d.ts +204 -116
  41. package/dist/entities/serialise.js +4 -3
  42. package/dist/entities/tags.d.ts +1 -1
  43. package/dist/entities/tags.js +2 -1
  44. package/dist/entities/ui/describe.d.ts +79 -35
  45. package/dist/entities/ui/describe.js +5 -4
  46. package/dist/entities/ui/input.d.ts +93 -49
  47. package/dist/entities/ui/input.js +5 -4
  48. package/dist/entities/ui/page.d.ts +77 -33
  49. package/dist/entities/ui/page.js +4 -3
  50. package/dist/entities/ui/pages.d.ts +5 -5
  51. package/dist/entities/ui/pages.js +5 -4
  52. package/dist/entities/validated.d.ts +1 -0
  53. package/dist/entities/when.d.ts +16 -16
  54. package/dist/entities/when.js +2 -2
  55. package/dist/errors/check.d.ts +2 -3
  56. package/dist/errors/check.js +5 -10
  57. package/dist/errors/errors.d.ts +241 -158
  58. package/dist/errors/errors.js +149 -173
  59. package/dist/errors/exception.d.ts +6 -4
  60. package/dist/errors/exception.js +11 -66
  61. package/dist/errors/index.d.ts +2 -4
  62. package/dist/errors/index.js +2 -2
  63. package/dist/errors/public.d.ts +2 -0
  64. package/dist/errors/public.js +1 -0
  65. package/dist/index.d.ts +4 -36
  66. package/dist/index.js +4 -19
  67. package/dist/instance.d.ts +7 -7
  68. package/dist/instance.js +4 -4
  69. package/dist/mappers/index.d.ts +1 -1
  70. package/dist/mappers/price.js +2 -3
  71. package/dist/mappers/render/collection.d.ts +9 -0
  72. package/dist/mappers/render/collection.js +27 -0
  73. package/dist/mappers/render/compose.d.ts +5 -0
  74. package/dist/mappers/render/compose.js +15 -0
  75. package/dist/mappers/render/description.d.ts +3 -0
  76. package/dist/mappers/render/description.js +17 -0
  77. package/dist/mappers/render/index.d.ts +3 -1
  78. package/dist/mappers/render/option.d.ts +20 -0
  79. package/dist/mappers/render/option.js +25 -0
  80. package/dist/mappers/render/page.d.ts +11 -0
  81. package/dist/mappers/render/page.js +11 -0
  82. package/dist/mappers/render/paths.d.ts +3 -0
  83. package/dist/mappers/render/paths.js +21 -0
  84. package/dist/mappers/render/render.d.ts +1 -1
  85. package/dist/mappers/render/render.js +33 -98
  86. package/dist/mappers/resolve.d.ts +2 -1
  87. package/dist/mappers/resolve.js +26 -25
  88. package/dist/mappers/variants/option-graph.js +11 -4
  89. package/dist/mappers/variants/variants.js +7 -6
  90. package/dist/primitive.d.ts +5 -0
  91. package/dist/primitive.js +6 -1
  92. package/dist/public.d.ts +37 -0
  93. package/dist/public.js +19 -0
  94. package/dist/references.d.ts +6 -6
  95. package/dist/references.js +3 -2
  96. package/dist/validate/brand.js +2 -4
  97. package/dist/validate/builder.d.ts +2 -2
  98. package/dist/validate/builder.js +3 -3
  99. package/dist/validate/expectations.d.ts +2 -2
  100. package/dist/validate/expectations.js +1 -1
  101. package/dist/validate/index.d.ts +0 -1
  102. package/dist/validate/instance.d.ts +2 -2
  103. package/dist/validate/instance.js +6 -6
  104. package/dist/validate/model.d.ts +4 -4
  105. package/dist/validate/model.js +129 -101
  106. package/dist/validate/paths.d.ts +2 -2
  107. package/dist/validate/paths.js +47 -25
  108. package/dist/validate/pricing.d.ts +4 -4
  109. package/dist/validate/pricing.js +30 -18
  110. package/dist/validate/resolve.d.ts +4 -3
  111. package/dist/validate/resolve.js +88 -63
  112. package/dist/validate/ui.d.ts +4 -4
  113. package/dist/validate/ui.js +17 -16
  114. package/dist/validate/variants.d.ts +2 -2
  115. package/dist/validate/variants.js +16 -16
  116. package/package.json +11 -7
  117. package/dist/mappers/render/pages.d.ts +0 -24
  118. package/dist/mappers/render/pages.js +0 -2
  119. package/dist/private.d.ts +0 -3
  120. package/dist/private.js +0 -3
@@ -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 { BuilderPathSchema } from '../paths.js';
@@ -40,14 +41,14 @@ export function input(path) {
40
41
  return new BuilderUIInput(path);
41
42
  }
42
43
  export const BuilderUIInputSchema = v.instance(BuilderUIInput);
43
- export const BuilderUIInputMetadataSchema = v.pipe(v.record(v.string(), paramable(v.unknown())), v.readonly());
44
+ export const BuilderUIInputMetadataSchema = v.pipe(v.record(NameSchema, paramable(v.unknown())), v.readonly());
44
45
  export const BuilderUIInputSerialisedSchema = serialisable(v.object({
45
46
  type: v.literal('input'),
46
47
  path: paramable(BuilderPathSchema),
47
- displayName: v.optional(paramable(v.string())),
48
- kind: v.optional(paramable(v.string())),
48
+ displayName: v.optional(paramable(NameSchema)),
49
+ kind: v.optional(paramable(NameSchema)),
49
50
  metadata: v.optional(paramable(BuilderUIInputMetadataSchema)),
50
51
  tags: v.optional(BuilderTagsSchema)
51
52
  }));
52
- export const BuilderUIInputsSerialisedSchema = v.pipe(v.array(paramable(BuilderUIInputSerialisedSchema)), v.readonly());
53
+ export const BuilderUIInputsSerialisedSchema = v.pipe(v.array(paramable(BuilderUIInputSerialisedSchema)), v.minLength(1), v.readonly());
53
54
  export const validateUIInput = createEntityValidator('uiInput', BuilderUIInputSerialisedSchema);
@@ -15,44 +15,44 @@ export declare const BuilderUIPageSerialisedSchema: v.SchemaWithPipe<readonly [v
15
15
  readonly type: v.LiteralSchema<"page", undefined>;
16
16
  readonly label: 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
- }>]>, v.StringSchema<undefined>], undefined>;
30
+ }>]>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>], undefined>;
31
31
  readonly inputs: 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.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
46
46
  readonly type: v.LiteralSchema<"parameter", undefined>;
47
- readonly id: v.StringSchema<undefined>;
48
- readonly name: v.StringSchema<undefined>;
47
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
48
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
49
49
  }, undefined>, v.ReadonlyAction<{
50
50
  type: "parameter";
51
51
  id: string;
52
52
  name: string;
53
53
  }>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
54
54
  readonly type: v.LiteralSchema<"ref", undefined>;
55
- readonly id: v.StringSchema<undefined>;
55
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
56
56
  }, undefined>, v.ReadonlyAction<{
57
57
  type: "ref";
58
58
  id: string;
@@ -60,81 +60,81 @@ export declare const BuilderUIPageSerialisedSchema: v.SchemaWithPipe<readonly [v
60
60
  readonly type: v.LiteralSchema<"input", undefined>;
61
61
  readonly path: 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
- }>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, v.ReadonlyAction<(string | number)[]>]>], undefined>;
75
+ }>]>, 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>;
76
76
  readonly displayName: v.OptionalSchema<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
- }>]>, v.StringSchema<undefined>], undefined>, undefined>;
90
+ }>]>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>], undefined>, undefined>;
91
91
  readonly kind: v.OptionalSchema<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
- }>]>, v.StringSchema<undefined>], undefined>, undefined>;
105
+ }>]>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>], undefined>, undefined>;
106
106
  readonly metadata: v.OptionalSchema<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
- }>]>, v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
120
+ }>]>, v.SchemaWithPipe<readonly [v.RecordSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
121
121
  readonly type: v.LiteralSchema<"parameter", undefined>;
122
- readonly id: v.StringSchema<undefined>;
123
- readonly name: v.StringSchema<undefined>;
122
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
123
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
124
124
  }, undefined>, v.ReadonlyAction<{
125
125
  type: "parameter";
126
126
  id: string;
127
127
  name: string;
128
128
  }>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
129
129
  readonly type: v.LiteralSchema<"ref", undefined>;
130
- readonly id: v.StringSchema<undefined>;
130
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
131
131
  }, undefined>, v.ReadonlyAction<{
132
132
  type: "ref";
133
133
  id: string;
134
134
  }>]>, v.UnknownSchema], undefined>, undefined>, v.ReadonlyAction<{
135
135
  [x: string]: unknown;
136
136
  }>]>], undefined>, undefined>;
137
- readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
137
+ 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>;
138
138
  }, undefined>, v.ReadonlyAction<{
139
139
  type: "input";
140
140
  path: readonly (string | number)[] | Readonly<{
@@ -172,7 +172,51 @@ export declare const BuilderUIPageSerialisedSchema: v.SchemaWithPipe<readonly [v
172
172
  [x: string]: unknown;
173
173
  }> | undefined;
174
174
  tags?: readonly string[] | undefined;
175
- }>]>], undefined>, undefined>, v.ReadonlyAction<(Readonly<{
175
+ }>]>], undefined>, undefined>, v.MinLengthAction<(Readonly<{
176
+ type: "parameter";
177
+ id: string;
178
+ name: string;
179
+ }> | Readonly<{
180
+ type: "ref";
181
+ id: string;
182
+ }> | Readonly<{
183
+ type: "input";
184
+ path: readonly (string | number)[] | Readonly<{
185
+ type: "parameter";
186
+ id: string;
187
+ name: string;
188
+ }> | Readonly<{
189
+ type: "ref";
190
+ id: string;
191
+ }>;
192
+ displayName?: string | Readonly<{
193
+ type: "parameter";
194
+ id: string;
195
+ name: string;
196
+ }> | Readonly<{
197
+ type: "ref";
198
+ id: string;
199
+ }> | undefined;
200
+ kind?: string | Readonly<{
201
+ type: "parameter";
202
+ id: string;
203
+ name: string;
204
+ }> | Readonly<{
205
+ type: "ref";
206
+ id: string;
207
+ }> | undefined;
208
+ metadata?: Readonly<{
209
+ type: "parameter";
210
+ id: string;
211
+ name: string;
212
+ }> | Readonly<{
213
+ type: "ref";
214
+ id: string;
215
+ }> | Readonly<{
216
+ [x: string]: unknown;
217
+ }> | undefined;
218
+ tags?: readonly string[] | undefined;
219
+ }>)[], 1, undefined>, v.ReadonlyAction<(Readonly<{
176
220
  type: "parameter";
177
221
  id: string;
178
222
  name: string;
@@ -217,7 +261,7 @@ export declare const BuilderUIPageSerialisedSchema: v.SchemaWithPipe<readonly [v
217
261
  }> | undefined;
218
262
  tags?: readonly string[] | undefined;
219
263
  }>)[]>]>], undefined>;
220
- readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
264
+ 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>;
221
265
  }, undefined>, v.ReadonlyAction<{
222
266
  type: "page";
223
267
  label: string | Readonly<{
@@ -283,7 +327,7 @@ export declare const BuilderUIPageSerialisedSchema: v.SchemaWithPipe<readonly [v
283
327
  tags?: readonly string[] | undefined;
284
328
  }>]>;
285
329
  export type BuilderUIPageSerialised = v.InferOutput<typeof BuilderUIPageSerialisedSchema>;
286
- export declare const validateUIPage: (input: unknown, references?: import("..").BuilderReferences, errors?: import("../../errors").BuilderValidateErrors) => import("..").ValidationResult<{
330
+ export declare const validateUIPage: (input: unknown, references?: import("..").BuilderReferences, errors?: import("../../errors").BuilderErrorsScope) => import("..").ValidationResult<{
287
331
  readonly type: "page";
288
332
  readonly label: string;
289
333
  readonly inputs: readonly {
@@ -1,4 +1,5 @@
1
1
  import * as v from 'valibot';
2
+ import { NameSchema } from '../../primitive.js';
2
3
  import { isParamable, paramable } from '../../references.js';
3
4
  import { createEntityValidator } from '../kind.js';
4
5
  import { serialisable } from '../serialisable.js';
@@ -21,15 +22,15 @@ export class BuilderUIPage {
21
22
  export const BuilderUIPageSchema = v.instance(BuilderUIPage);
22
23
  export const BuilderUIPageSerialisedSchema = serialisable(v.object({
23
24
  type: v.literal('page'),
24
- label: paramable(v.string()),
25
+ label: paramable(NameSchema),
25
26
  inputs: paramable(BuilderUIInputsSerialisedSchema),
26
27
  tags: v.optional(BuilderTagsSchema)
27
28
  }));
28
29
  export const validateUIPage = createEntityValidator('uiPage', BuilderUIPageSerialisedSchema, (input, errors) => {
29
30
  if (!isParamable(input.label) && input.label.length === 0) {
30
- errors.emptyLabel();
31
+ errors.entityEmptyLabel();
31
32
  }
32
33
  if (!isParamable(input.inputs) && input.inputs.length === 0) {
33
- errors.emptyInputs();
34
+ errors.entityEmptyInputs();
34
35
  }
35
36
  });
@@ -28,15 +28,15 @@ export declare const BuilderUIPagesSerialisedSchema: v.GenericSchema<BuilderUIPa
28
28
  export declare const BuilderUIItemSerialisedSchema: v.GenericSchema<BuilderUIItemSerialised>;
29
29
  export declare const BuilderUIItemsSerialisedSchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
30
30
  readonly type: v.LiteralSchema<"parameter", undefined>;
31
- readonly id: v.StringSchema<undefined>;
32
- readonly name: v.StringSchema<undefined>;
31
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
32
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
33
33
  }, undefined>, v.ReadonlyAction<{
34
34
  type: "parameter";
35
35
  id: string;
36
36
  name: string;
37
37
  }>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
38
38
  readonly type: v.LiteralSchema<"ref", undefined>;
39
- readonly id: v.StringSchema<undefined>;
39
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
40
40
  }, undefined>, v.ReadonlyAction<{
41
41
  type: "ref";
42
42
  id: string;
@@ -48,7 +48,7 @@ export declare const BuilderUIItemsSerialisedSchema: v.SchemaWithPipe<readonly [
48
48
  type: "ref";
49
49
  id: string;
50
50
  }> | BuilderUIItemSerialised)[]>]>;
51
- export declare const validateUIPages: (input: unknown, references?: import("..").BuilderReferences, errors?: import("../../errors").BuilderValidateErrors) => import("..").ValidationResult<{
51
+ export declare const validateUIPages: (input: unknown, references?: import("..").BuilderReferences, errors?: import("../../errors").BuilderErrorsScope) => import("..").ValidationResult<{
52
52
  readonly type: "pages";
53
53
  readonly name: string;
54
54
  readonly label: string;
@@ -117,7 +117,7 @@ export declare const validateUIPages: (input: unknown, references?: import("..")
117
117
  })[];
118
118
  readonly tags?: readonly string[] | undefined;
119
119
  }>;
120
- export declare const validateUIItems: (input: unknown, references?: import("..").BuilderReferences, errors?: import("../../errors").BuilderValidateErrors) => import("..").ValidationResult<readonly ({
120
+ export declare const validateUIItems: (input: unknown, references?: import("..").BuilderReferences, errors?: import("../../errors").BuilderErrorsScope) => import("..").ValidationResult<readonly ({
121
121
  readonly type: "page";
122
122
  readonly label: string;
123
123
  readonly inputs: readonly {
@@ -1,4 +1,5 @@
1
1
  import * as v from 'valibot';
2
+ import { NameSchema } from '../../primitive.js';
2
3
  import { isParamable, paramable } from '../../references.js';
3
4
  import { createEntityValidator } from '../kind.js';
4
5
  import { serialisable } from '../serialisable.js';
@@ -24,8 +25,8 @@ export class BuilderUIPages {
24
25
  export const BuilderUIPagesSchema = v.instance(BuilderUIPages);
25
26
  export const BuilderUIPagesSerialisedSchema = serialisable(v.object({
26
27
  type: v.literal('pages'),
27
- name: v.string(),
28
- label: paramable(v.string()),
28
+ name: NameSchema,
29
+ label: paramable(NameSchema),
29
30
  items: paramable(v.lazy(() => BuilderUIItemsSerialisedSchema)),
30
31
  tags: v.optional(BuilderTagsSchema)
31
32
  }));
@@ -37,10 +38,10 @@ export const BuilderUIItemSerialisedSchema = v.union([
37
38
  export const BuilderUIItemsSerialisedSchema = v.pipe(v.array(paramable(BuilderUIItemSerialisedSchema)), v.readonly());
38
39
  export const validateUIPages = createEntityValidator('uiPages', BuilderUIPagesSerialisedSchema, (input, errors) => {
39
40
  if (input.name.length === 0) {
40
- errors.emptyName();
41
+ errors.entityEmptyName();
41
42
  }
42
43
  if (!isParamable(input.label) && input.label.length === 0) {
43
- errors.emptyLabel();
44
+ errors.entityEmptyLabel();
44
45
  }
45
46
  });
46
47
  export const validateUIItems = createEntityValidator('uiItems', BuilderUIItemsSerialisedSchema);
@@ -30,6 +30,7 @@ export type BuilderModelValidated = BuilderValidatedMap['model'];
30
30
  export type BuilderPricingValidated = BuilderValidatedMap['pricing'];
31
31
  export type BuilderUIValidated = BuilderValidatedMap['ui'];
32
32
  export type BuilderUIDescribeValidated = BuilderValidatedMap['uiDescribe'];
33
+ export type BuilderUIInputValidated = BuilderValidatedMap['uiInput'];
33
34
  export type BuilderUIItemsValidated = BuilderValidatedMap['uiItems'];
34
35
  export type BuilderUIPageValidated = BuilderValidatedMap['uiPage'];
35
36
  export type BuilderInstanceValidated = Prettify<Validated<BuilderInstance>>;
@@ -43,37 +43,37 @@ export declare const BuilderWhenMatchSchema: v.ObjectSchema<{
43
43
  readonly type: v.LiteralSchema<"match", undefined>;
44
44
  readonly matchPath: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
45
45
  readonly type: v.LiteralSchema<"parameter", undefined>;
46
- readonly id: v.StringSchema<undefined>;
47
- readonly name: v.StringSchema<undefined>;
46
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
47
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
48
48
  }, undefined>, v.ReadonlyAction<{
49
49
  type: "parameter";
50
50
  id: string;
51
51
  name: string;
52
52
  }>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
53
53
  readonly type: v.LiteralSchema<"ref", undefined>;
54
- readonly id: v.StringSchema<undefined>;
54
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
55
55
  }, undefined>, v.ReadonlyAction<{
56
56
  type: "ref";
57
57
  id: string;
58
- }>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, v.ReadonlyAction<(string | number)[]>]>], undefined>;
58
+ }>]>, 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>;
59
59
  }, undefined>;
60
60
  export declare const BuilderWhenUnlessSchema: v.ObjectSchema<{
61
61
  readonly type: v.LiteralSchema<"unless", undefined>;
62
62
  readonly unlessPath: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
63
63
  readonly type: v.LiteralSchema<"parameter", undefined>;
64
- readonly id: v.StringSchema<undefined>;
65
- readonly name: v.StringSchema<undefined>;
64
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
65
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
66
66
  }, undefined>, v.ReadonlyAction<{
67
67
  type: "parameter";
68
68
  id: string;
69
69
  name: string;
70
70
  }>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
71
71
  readonly type: v.LiteralSchema<"ref", undefined>;
72
- readonly id: v.StringSchema<undefined>;
72
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
73
73
  }, undefined>, v.ReadonlyAction<{
74
74
  type: "ref";
75
75
  id: string;
76
- }>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, v.ReadonlyAction<(string | number)[]>]>], undefined>;
76
+ }>]>, 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>;
77
77
  }, undefined>;
78
78
  export declare const BuilderWhenConfigSchema: v.SchemaWithPipe<readonly [v.VariantSchema<"type", [v.ObjectSchema<{
79
79
  readonly type: v.LiteralSchema<"enable", undefined>;
@@ -81,36 +81,36 @@ export declare const BuilderWhenConfigSchema: v.SchemaWithPipe<readonly [v.Varia
81
81
  readonly type: v.LiteralSchema<"match", undefined>;
82
82
  readonly matchPath: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
83
83
  readonly type: v.LiteralSchema<"parameter", undefined>;
84
- readonly id: v.StringSchema<undefined>;
85
- readonly name: v.StringSchema<undefined>;
84
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
85
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
86
86
  }, undefined>, v.ReadonlyAction<{
87
87
  type: "parameter";
88
88
  id: string;
89
89
  name: string;
90
90
  }>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
91
91
  readonly type: v.LiteralSchema<"ref", undefined>;
92
- readonly id: v.StringSchema<undefined>;
92
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
93
93
  }, undefined>, v.ReadonlyAction<{
94
94
  type: "ref";
95
95
  id: string;
96
- }>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, v.ReadonlyAction<(string | number)[]>]>], undefined>;
96
+ }>]>, 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>;
97
97
  }, undefined>, v.ObjectSchema<{
98
98
  readonly type: v.LiteralSchema<"unless", undefined>;
99
99
  readonly unlessPath: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
100
100
  readonly type: v.LiteralSchema<"parameter", undefined>;
101
- readonly id: v.StringSchema<undefined>;
102
- readonly name: v.StringSchema<undefined>;
101
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
102
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
103
103
  }, undefined>, v.ReadonlyAction<{
104
104
  type: "parameter";
105
105
  id: string;
106
106
  name: string;
107
107
  }>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
108
108
  readonly type: v.LiteralSchema<"ref", undefined>;
109
- readonly id: v.StringSchema<undefined>;
109
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
110
110
  }, undefined>, v.ReadonlyAction<{
111
111
  type: "ref";
112
112
  id: string;
113
- }>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, v.ReadonlyAction<(string | number)[]>]>], undefined>;
113
+ }>]>, 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>;
114
114
  }, undefined>], undefined>, v.ReadonlyAction<{
115
115
  type: "enable";
116
116
  } | {
@@ -1,6 +1,6 @@
1
1
  import * as v from 'valibot';
2
2
  import { check } from '../errors/index.js';
3
- import { BuilderPrimitivesSchema } from '../primitive.js';
3
+ import { BuilderPrimitivesSchema, StringSchema } from '../primitive.js';
4
4
  import { isParamable, paramable } from '../references.js';
5
5
  import { BuilderPathSchema } from './paths.js';
6
6
  export const BuilderWhenEnableSchema = v.object({
@@ -36,7 +36,7 @@ export function whenBranches(payload, schema) {
36
36
  }
37
37
  }
38
38
  export function createSelectMapSerialisedSchema(payloadSchema) {
39
- return v.pipe(v.record(v.string(), v.nullable(paramable(payloadSchema))), v.readonly());
39
+ return v.pipe(v.record(StringSchema, v.nullable(paramable(payloadSchema))), v.readonly());
40
40
  }
41
41
  export function createWhenSerialisedSchema(payloadSchema) {
42
42
  const paramablePayload = paramable(payloadSchema);
@@ -1,9 +1,8 @@
1
1
  import * as v from 'valibot';
2
2
  declare class Check {
3
- truthy<Input>(input: Input, message: `${string}! ❌`): asserts input is Exclude<Input, null | undefined | '' | 0 | false>;
4
- falsy(input: unknown, message: `${string}! ❌`): void;
3
+ invariant<Input>(input: Input): asserts input is Exclude<Input, null | undefined | '' | 0 | false>;
5
4
  is<const Schema extends v.BaseSchema<unknown, unknown, v.BaseIssue<unknown>>>(schema: Schema, input: unknown): input is v.InferOutput<Schema>;
6
- assert<const Schema extends v.BaseSchema<unknown, unknown, v.BaseIssue<unknown>>>(schema: Schema, input: unknown, message?: `${string}! ❌`): asserts input is v.InferOutput<Schema>;
5
+ assert<const Schema extends v.BaseSchema<unknown, unknown, v.BaseIssue<unknown>>>(schema: Schema, input: unknown): asserts input is v.InferOutput<Schema>;
7
6
  }
8
7
  export declare const check: Check;
9
8
  export {};
@@ -1,27 +1,22 @@
1
1
  import * as v from 'valibot';
2
- import { BuilderException, formatSchemaIssues } from './exception.js';
2
+ import { BuilderException } from './exception.js';
3
3
  class Check {
4
- truthy(input, message) {
4
+ invariant(input) {
5
5
  if (!input) {
6
- throw new BuilderException({ category: 'assertion', summary: message });
7
- }
8
- }
9
- falsy(input, message) {
10
- if (input) {
11
- throw new BuilderException({ category: 'assertion', summary: message });
6
+ throw new BuilderException({ category: 'invariant', value: input });
12
7
  }
13
8
  }
14
9
  is(schema, input) {
15
10
  return v.is(schema, input);
16
11
  }
17
- assert(schema, input, message) {
12
+ assert(schema, input) {
18
13
  const result = v.safeParse(schema, input);
19
14
  if (result.success) {
20
15
  return;
21
16
  }
22
17
  throw new BuilderException({
23
18
  category: 'assertion',
24
- summary: message ?? formatSchemaIssues(result.issues),
19
+ value: input,
25
20
  issues: result.issues
26
21
  });
27
22
  }