@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.
- package/dist/client/client.d.ts +3 -1
- package/dist/client/client.js +29 -20
- package/dist/client/index.d.ts +1 -4
- package/dist/client/index.js +1 -2
- package/dist/client/public.d.ts +4 -0
- package/dist/client/public.js +2 -0
- package/dist/client/schema.d.ts +26 -18
- package/dist/client/schema.js +7 -1
- package/dist/entities/builder/builder.js +2 -1
- package/dist/entities/collection/collection.d.ts +2 -2
- package/dist/entities/collection/collection.js +2 -1
- package/dist/entities/collection/config.d.ts +21 -21
- package/dist/entities/collection/config.js +4 -3
- package/dist/entities/component/component.d.ts +32 -32
- package/dist/entities/component/component.js +2 -1
- package/dist/entities/component/config.d.ts +13 -13
- package/dist/entities/component/config.js +1 -1
- package/dist/entities/component/field.d.ts +4 -4
- package/dist/entities/component/field.js +4 -3
- package/dist/entities/expectation.d.ts +3 -3
- package/dist/entities/expectation.js +2 -1
- package/dist/entities/index.d.ts +1 -1
- package/dist/entities/kind.d.ts +4 -4
- package/dist/entities/kind.js +44 -4
- package/dist/entities/model/models.d.ts +3 -3
- package/dist/entities/option/config.d.ts +4 -4
- package/dist/entities/option/option.d.ts +24 -24
- package/dist/entities/option/option.js +2 -1
- package/dist/entities/option/select.d.ts +2 -2
- package/dist/entities/option/select.js +12 -9
- package/dist/entities/option/toggle.d.ts +2 -2
- package/dist/entities/option/toggle.js +5 -4
- package/dist/entities/paths.d.ts +4 -4
- package/dist/entities/paths.js +2 -1
- package/dist/entities/pricing/expression.js +5 -4
- package/dist/entities/pricing/rates.d.ts +1 -1
- package/dist/entities/pricing/rates.js +2 -1
- package/dist/entities/references.d.ts +2 -2
- package/dist/entities/references.js +2 -1
- package/dist/entities/serialise.d.ts +204 -116
- package/dist/entities/serialise.js +4 -3
- package/dist/entities/tags.d.ts +1 -1
- package/dist/entities/tags.js +2 -1
- package/dist/entities/ui/describe.d.ts +79 -35
- package/dist/entities/ui/describe.js +5 -4
- package/dist/entities/ui/input.d.ts +93 -49
- package/dist/entities/ui/input.js +5 -4
- package/dist/entities/ui/page.d.ts +77 -33
- package/dist/entities/ui/page.js +4 -3
- package/dist/entities/ui/pages.d.ts +5 -5
- package/dist/entities/ui/pages.js +5 -4
- package/dist/entities/validated.d.ts +1 -0
- package/dist/entities/when.d.ts +16 -16
- package/dist/entities/when.js +2 -2
- package/dist/errors/check.d.ts +2 -3
- package/dist/errors/check.js +5 -10
- package/dist/errors/errors.d.ts +241 -158
- package/dist/errors/errors.js +149 -173
- package/dist/errors/exception.d.ts +6 -4
- package/dist/errors/exception.js +11 -66
- package/dist/errors/index.d.ts +2 -4
- package/dist/errors/index.js +2 -2
- package/dist/errors/public.d.ts +2 -0
- package/dist/errors/public.js +1 -0
- package/dist/index.d.ts +4 -36
- package/dist/index.js +4 -19
- package/dist/instance.d.ts +7 -7
- package/dist/instance.js +4 -4
- package/dist/mappers/index.d.ts +1 -1
- package/dist/mappers/price.js +2 -3
- package/dist/mappers/render/collection.d.ts +9 -0
- package/dist/mappers/render/collection.js +27 -0
- package/dist/mappers/render/compose.d.ts +5 -0
- package/dist/mappers/render/compose.js +15 -0
- package/dist/mappers/render/description.d.ts +3 -0
- package/dist/mappers/render/description.js +17 -0
- package/dist/mappers/render/index.d.ts +3 -1
- package/dist/mappers/render/option.d.ts +20 -0
- package/dist/mappers/render/option.js +25 -0
- package/dist/mappers/render/page.d.ts +11 -0
- package/dist/mappers/render/page.js +11 -0
- package/dist/mappers/render/paths.d.ts +3 -0
- package/dist/mappers/render/paths.js +21 -0
- package/dist/mappers/render/render.d.ts +1 -1
- package/dist/mappers/render/render.js +33 -98
- package/dist/mappers/resolve.d.ts +2 -1
- package/dist/mappers/resolve.js +26 -25
- package/dist/mappers/variants/option-graph.js +11 -4
- package/dist/mappers/variants/variants.js +7 -6
- package/dist/primitive.d.ts +5 -0
- package/dist/primitive.js +6 -1
- package/dist/public.d.ts +37 -0
- package/dist/public.js +19 -0
- package/dist/references.d.ts +6 -6
- package/dist/references.js +3 -2
- package/dist/validate/brand.js +2 -4
- package/dist/validate/builder.d.ts +2 -2
- package/dist/validate/builder.js +3 -3
- package/dist/validate/expectations.d.ts +2 -2
- package/dist/validate/expectations.js +1 -1
- package/dist/validate/index.d.ts +0 -1
- package/dist/validate/instance.d.ts +2 -2
- package/dist/validate/instance.js +6 -6
- package/dist/validate/model.d.ts +4 -4
- package/dist/validate/model.js +129 -101
- package/dist/validate/paths.d.ts +2 -2
- package/dist/validate/paths.js +47 -25
- package/dist/validate/pricing.d.ts +4 -4
- package/dist/validate/pricing.js +30 -18
- package/dist/validate/resolve.d.ts +4 -3
- package/dist/validate/resolve.js +88 -63
- package/dist/validate/ui.d.ts +4 -4
- package/dist/validate/ui.js +17 -16
- package/dist/validate/variants.d.ts +2 -2
- package/dist/validate/variants.js +16 -16
- package/package.json +11 -7
- package/dist/mappers/render/pages.d.ts +0 -24
- package/dist/mappers/render/pages.js +0 -2
- package/dist/private.d.ts +0 -3
- package/dist/private.js +0 -3
|
@@ -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<{
|
|
@@ -413,7 +413,7 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
|
|
|
413
413
|
tags?: readonly string[] | undefined;
|
|
414
414
|
}>[]>]>;
|
|
415
415
|
export type BuilderComponentsSerialised = v.InferOutput<typeof BuilderComponentsSerialisedSchema>;
|
|
416
|
-
export declare const validateComponentWhen: (input: unknown, references?: import("..").BuilderReferences, errors?: import("../../errors").
|
|
416
|
+
export declare const validateComponentWhen: (input: unknown, references?: import("..").BuilderReferences, errors?: import("../../errors").BuilderErrorsScope) => import("..").ValidationResult<{
|
|
417
417
|
readonly type: "enable";
|
|
418
418
|
readonly payload: {
|
|
419
419
|
readonly fields: readonly {
|
|
@@ -455,7 +455,7 @@ export declare const validateComponentWhen: (input: unknown, references?: import
|
|
|
455
455
|
readonly tags?: readonly string[] | undefined;
|
|
456
456
|
};
|
|
457
457
|
}>;
|
|
458
|
-
export declare const validateComponentSelectMap: (input: unknown, references?: import("..").BuilderReferences, errors?: import("../../errors").
|
|
458
|
+
export declare const validateComponentSelectMap: (input: unknown, references?: import("..").BuilderReferences, errors?: import("../../errors").BuilderErrorsScope) => import("..").ValidationResult<{
|
|
459
459
|
readonly [x: string]: {
|
|
460
460
|
readonly fields: readonly {
|
|
461
461
|
readonly type: "component-field";
|
|
@@ -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:
|
|
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";
|
|
@@ -133,7 +133,7 @@ export declare const BuilderComponentConfigsSerialisedSchema: v.SchemaWithPipe<r
|
|
|
133
133
|
}>[]>]>;
|
|
134
134
|
export type BuilderComponentConfigsSerialised = v.InferOutput<typeof BuilderComponentConfigsSerialisedSchema>;
|
|
135
135
|
export declare function componentConfig<const Fields extends BuilderComponentFields>(...fields: Fields): BuilderComponentConfig<Fields>;
|
|
136
|
-
export declare const validateComponentConfig: (input: unknown, references?: import("..").BuilderReferences, errors?: import("../../
|
|
136
|
+
export declare const validateComponentConfig: (input: unknown, references?: import("..").BuilderReferences, errors?: import("../../errors/errors").BuilderErrorsScope) => import("..").ValidationResult<{
|
|
137
137
|
readonly fields: readonly {
|
|
138
138
|
readonly type: "component-field";
|
|
139
139
|
readonly name: string;
|
|
@@ -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:
|
|
43
|
+
name: NameSchema,
|
|
43
44
|
valueType: BuilderComponentFieldValueTypeSchema,
|
|
44
|
-
isOptional:
|
|
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' ?
|
|
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;
|
|
@@ -30,7 +30,7 @@ export declare const BuilderExpectationsSerialisedSchema: v.SchemaWithPipe<reado
|
|
|
30
30
|
kind: "option" | "component" | "collection";
|
|
31
31
|
}>[]>]>;
|
|
32
32
|
export type BuilderExpectationsSerialised = v.InferOutput<typeof BuilderExpectationsSerialisedSchema>;
|
|
33
|
-
export declare const validateExpectations: (input: unknown, references?: import("./references.js").BuilderReferences, errors?: import("../errors/errors.js").
|
|
33
|
+
export declare const validateExpectations: (input: unknown, references?: import("./references.js").BuilderReferences, errors?: import("../errors/errors.js").BuilderErrorsScope) => import("./validated.js").ValidationResult<readonly ({
|
|
34
34
|
readonly name: string;
|
|
35
35
|
readonly kind: "option" | "component" | "collection";
|
|
36
36
|
} & import("../validate/brand.js").BuilderValidatedBrand)[]>;
|
|
@@ -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:
|
|
17
|
+
name: NameSchema,
|
|
17
18
|
kind: BuilderExpectationKindSchema
|
|
18
19
|
}));
|
|
19
20
|
export const BuilderExpectationsSerialisedSchema = v.pipe(v.array(BuilderExpectationSerialisedSchema), v.readonly());
|
package/dist/entities/index.d.ts
CHANGED
|
@@ -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';
|
package/dist/entities/kind.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { BuilderReferences } from './references';
|
|
2
2
|
import type { EntitiesMap } from './serialise';
|
|
3
3
|
import type { BuilderValidatedMap, ValidationResult } from './validated';
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
4
|
+
import * as v from 'valibot';
|
|
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];
|
|
8
8
|
export type BuilderEntitySerialised = {
|
|
9
9
|
[Kind in BuilderEntityKind]: v.InferOutput<EntitiesMap[Kind]['serialised']>;
|
|
10
10
|
}[BuilderEntityKind];
|
|
11
|
-
export type EntityValidate<Kind extends BuilderEntityKind> = (input: BuilderValidatedMap[Kind], errors:
|
|
12
|
-
export declare function createEntityValidator<Kind extends BuilderEntityKind>(kind: Kind, schema: v.GenericSchema, validate?: EntityValidate<Kind>): (input: unknown, references?: BuilderReferences, errors?:
|
|
11
|
+
export type EntityValidate<Kind extends BuilderEntityKind> = (input: BuilderValidatedMap[Kind], errors: BuilderErrorsScope, references: BuilderReferences) => void;
|
|
12
|
+
export declare function createEntityValidator<Kind extends BuilderEntityKind>(kind: Kind, schema: v.GenericSchema, validate?: EntityValidate<Kind>): (input: unknown, references?: BuilderReferences, errors?: BuilderErrorsScope) => ValidationResult<BuilderValidatedMap[Kind]>;
|
package/dist/entities/kind.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
import { BuilderErrorsScope } from '../errors/index.js';
|
|
2
3
|
export const builderEntityKinds = [
|
|
3
4
|
'builder',
|
|
4
5
|
'model',
|
|
@@ -28,12 +29,51 @@ export const builderEntityKinds = [
|
|
|
28
29
|
'boolean'
|
|
29
30
|
];
|
|
30
31
|
export function createEntityValidator(kind, schema, validate) {
|
|
31
|
-
return (input, references = [], errors = new
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
return (input, references = [], errors = new BuilderErrorsScope(input)) => {
|
|
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
|
+
}
|
|
@@ -7,15 +7,15 @@ export type BuilderModels = ReadonlyArray<Paramable<BuilderModelGeneric>>;
|
|
|
7
7
|
export type BuilderModelsSerialised = ReadonlyArray<ParamableSerialised<BuilderModelSerialised>>;
|
|
8
8
|
export declare const BuilderModelsSerialisedSchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
9
9
|
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
10
|
-
readonly id: v.StringSchema<undefined>;
|
|
11
|
-
readonly name: v.StringSchema<undefined>;
|
|
10
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
11
|
+
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
12
12
|
}, undefined>, v.ReadonlyAction<{
|
|
13
13
|
type: "parameter";
|
|
14
14
|
id: string;
|
|
15
15
|
name: string;
|
|
16
16
|
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
17
17
|
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
18
|
-
readonly id: v.StringSchema<undefined>;
|
|
18
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
19
19
|
}, undefined>, v.ReadonlyAction<{
|
|
20
20
|
type: "ref";
|
|
21
21
|
id: string;
|
|
@@ -7,7 +7,7 @@ export declare const BuilderOptionConfigSerialisedSchema: v.SchemaWithPipe<reado
|
|
|
7
7
|
readonly defaultValue: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
8
8
|
readonly isOptional: v.BooleanSchema<undefined>;
|
|
9
9
|
readonly optionLabels: v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>;
|
|
10
|
-
readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
|
|
10
|
+
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>;
|
|
11
11
|
}, undefined>, v.ReadonlyAction<{
|
|
12
12
|
type: "select";
|
|
13
13
|
readonly options: readonly [string, ...string[]];
|
|
@@ -22,7 +22,7 @@ export declare const BuilderOptionConfigSerialisedSchema: v.SchemaWithPipe<reado
|
|
|
22
22
|
readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
|
|
23
23
|
readonly defaultValue: v.NullableSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
|
|
24
24
|
readonly isOptional: v.BooleanSchema<undefined>;
|
|
25
|
-
readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
|
|
25
|
+
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>;
|
|
26
26
|
}, undefined>, v.ReadonlyAction<{
|
|
27
27
|
type: "toggle";
|
|
28
28
|
valueType: "string" | "number" | "boolean";
|
|
@@ -52,7 +52,7 @@ export declare const BuilderOptionConfigsSerialisedSchema: v.SchemaWithPipe<read
|
|
|
52
52
|
readonly defaultValue: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
53
53
|
readonly isOptional: v.BooleanSchema<undefined>;
|
|
54
54
|
readonly optionLabels: v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>;
|
|
55
|
-
readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
|
|
55
|
+
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>;
|
|
56
56
|
}, undefined>, v.ReadonlyAction<{
|
|
57
57
|
type: "select";
|
|
58
58
|
readonly options: readonly [string, ...string[]];
|
|
@@ -67,7 +67,7 @@ export declare const BuilderOptionConfigsSerialisedSchema: v.SchemaWithPipe<read
|
|
|
67
67
|
readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
|
|
68
68
|
readonly defaultValue: v.NullableSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
|
|
69
69
|
readonly isOptional: v.BooleanSchema<undefined>;
|
|
70
|
-
readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
|
|
70
|
+
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>;
|
|
71
71
|
}, undefined>, v.ReadonlyAction<{
|
|
72
72
|
type: "toggle";
|
|
73
73
|
valueType: "string" | "number" | "boolean";
|