@builder-builder/builder 0.0.19 → 0.0.21
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/bb.d.ts +12 -14
- package/dist/bb.js +32 -6
- package/dist/entities/builder/bind.d.ts +1 -1
- package/dist/entities/builder/builder.d.ts +2 -4
- package/dist/entities/builder/builder.js +1 -1
- package/dist/entities/collection/collection.d.ts +689 -1
- package/dist/entities/collection/collection.js +5 -2
- package/dist/entities/collection/config.d.ts +290 -0
- package/dist/entities/collection/config.js +13 -2
- package/dist/entities/collection/expectation.d.ts +1 -1
- package/dist/entities/collection/index.d.ts +3 -3
- package/dist/entities/collection/index.js +2 -2
- package/dist/entities/collection/when.d.ts +1 -1
- package/dist/entities/component/component.d.ts +64 -10
- package/dist/entities/component/component.js +9 -6
- package/dist/entities/component/config.d.ts +145 -0
- package/dist/entities/component/config.js +42 -0
- package/dist/entities/component/field.js +1 -1
- package/dist/entities/component/index.d.ts +3 -3
- package/dist/entities/component/index.js +2 -2
- package/dist/entities/component/when.d.ts +6 -6
- package/dist/entities/component/when.js +3 -3
- package/dist/entities/expectation.d.ts +4 -0
- package/dist/entities/expectation.js +3 -1
- package/dist/entities/index.d.ts +18 -17
- package/dist/entities/index.js +11 -10
- package/dist/entities/kind.d.ts +10 -7
- package/dist/entities/kind.js +39 -5
- package/dist/entities/model/bind.d.ts +1 -1
- package/dist/entities/model/index.d.ts +1 -1
- package/dist/entities/model/methods.d.ts +12 -12
- package/dist/entities/model/methods.js +2 -2
- package/dist/entities/model/model.js +1 -1
- package/dist/entities/model/models.d.ts +1 -1
- package/dist/entities/option/config.d.ts +109 -0
- package/dist/entities/option/config.js +15 -0
- package/dist/entities/option/index.d.ts +7 -7
- package/dist/entities/option/index.js +4 -4
- package/dist/entities/option/option.d.ts +88 -10
- package/dist/entities/option/option.js +9 -6
- package/dist/entities/option/select.d.ts +24 -14
- package/dist/entities/option/select.js +17 -6
- package/dist/entities/option/toggle.d.ts +17 -10
- package/dist/entities/option/toggle.js +19 -8
- package/dist/entities/option/when.d.ts +6 -6
- package/dist/{paths.d.ts → entities/paths.d.ts} +2 -0
- package/dist/{paths.js → entities/paths.js} +3 -0
- package/dist/entities/pricing/index.d.ts +1 -1
- package/dist/entities/pricing/index.js +1 -1
- package/dist/entities/pricing/pricing.js +1 -1
- package/dist/entities/pricing/rates.d.ts +5 -0
- package/dist/entities/pricing/rates.js +3 -1
- package/dist/entities/references.d.ts +723 -0
- package/dist/entities/references.js +7 -0
- package/dist/entities/serialise.d.ts +49 -43
- package/dist/entities/serialise.js +19 -13
- package/dist/entities/ui/describe.d.ts +15 -0
- package/dist/entities/ui/describe.js +11 -2
- package/dist/entities/ui/index.d.ts +4 -4
- package/dist/entities/ui/index.js +4 -4
- package/dist/entities/ui/input.d.ts +12 -3
- package/dist/entities/ui/input.js +4 -2
- package/dist/entities/ui/page.d.ts +15 -0
- package/dist/entities/ui/page.js +11 -2
- package/dist/entities/ui/pages.d.ts +132 -0
- package/dist/entities/ui/pages.js +12 -2
- package/dist/entities/ui/ui.d.ts +2 -3
- package/dist/entities/ui/ui.js +2 -2
- package/dist/entities/ui/uis.d.ts +1 -1
- package/dist/entities/ui/uis.js +2 -2
- package/dist/entities/validated.d.ts +26 -18
- package/dist/entities/when.d.ts +4 -3
- package/dist/entities/when.js +22 -2
- package/dist/environment.d.ts +2 -2
- package/dist/{validate → errors}/errors.d.ts +57 -35
- package/dist/{validate → errors}/errors.js +40 -5
- package/dist/errors/exception.d.ts +5 -0
- package/dist/{exception.js → errors/exception.js} +0 -3
- package/dist/errors/index.d.ts +4 -0
- package/dist/errors/index.js +3 -0
- package/dist/index.d.ts +19 -18
- package/dist/index.js +5 -4
- package/dist/instance.d.ts +7 -7
- package/dist/instance.js +4 -4
- package/dist/mappers/index.d.ts +2 -4
- package/dist/mappers/index.js +1 -2
- package/dist/mappers/instance.d.ts +2 -2
- package/dist/mappers/instance.js +7 -7
- package/dist/mappers/order.d.ts +4 -4
- package/dist/mappers/order.js +5 -5
- package/dist/mappers/price.js +18 -18
- package/dist/mappers/render/pages.d.ts +2 -2
- package/dist/mappers/render/render.d.ts +2 -2
- package/dist/mappers/render/render.js +12 -12
- package/dist/mappers/resolve.d.ts +11 -12
- package/dist/mappers/resolve.js +29 -46
- package/dist/mappers/variants/option-graph.d.ts +2 -3
- package/dist/mappers/variants/option-graph.js +2 -3
- package/dist/mappers/variants/variants.d.ts +2 -2
- package/dist/mappers/variants/variants.js +1 -1
- package/dist/private.d.ts +1 -2
- package/dist/private.js +1 -2
- package/dist/references.js +1 -1
- package/dist/validate/brand.js +1 -2
- package/dist/validate/builder.d.ts +3 -4
- package/dist/validate/builder.js +2 -3
- package/dist/validate/expectations.d.ts +1 -1
- package/dist/validate/index.d.ts +5 -2
- package/dist/validate/index.js +1 -0
- package/dist/validate/instance.d.ts +2 -3
- package/dist/validate/instance.js +1 -2
- package/dist/validate/model.d.ts +3 -4
- package/dist/validate/model.js +39 -44
- package/dist/validate/paths.d.ts +2 -3
- package/dist/validate/paths.js +1 -1
- package/dist/validate/pricing.d.ts +3 -4
- package/dist/validate/pricing.js +2 -3
- package/dist/validate/resolve.d.ts +3 -3
- package/dist/validate/resolve.js +1 -1
- package/dist/validate/ui.d.ts +3 -4
- package/dist/validate/ui.js +14 -5
- package/dist/validate/variants.d.ts +4 -5
- package/dist/validate/variants.js +6 -7
- package/package.json +7 -2
- package/dist/entities/component/details.d.ts +0 -66
- package/dist/entities/component/details.js +0 -24
- package/dist/entities/entry.d.ts +0 -4
- package/dist/entities/entry.js +0 -1
- package/dist/entities/option/values.d.ts +0 -49
- package/dist/entities/option/values.js +0 -14
- package/dist/entities/refs.d.ts +0 -6
- package/dist/entities/refs.js +0 -1
- package/dist/exception.d.ts +0 -13
- package/dist/validate/result.d.ts +0 -2
- package/dist/validate/result.js +0 -1
- /package/dist/{serialisable.d.ts → entities/serialisable.d.ts} +0 -0
- /package/dist/{serialisable.js → entities/serialisable.js} +0 -0
- /package/dist/{check.d.ts → errors/check.d.ts} +0 -0
- /package/dist/{check.js → errors/check.js} +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
|
-
import { BuilderPathsSchema } from '../../paths.js';
|
|
3
2
|
import { paramable } from '../../references.js';
|
|
4
|
-
import {
|
|
3
|
+
import { createEntityValidator } from '../kind.js';
|
|
4
|
+
import { BuilderPathsSchema } from '../paths.js';
|
|
5
|
+
import { serialisable } from '../serialisable.js';
|
|
5
6
|
import { BuilderTagsSchema } from '../tags.js';
|
|
6
7
|
import { createSelectMapSerialisedSchema, createWhenSerialisedSchema } from '../when.js';
|
|
7
8
|
import { BuilderCollectionConfigSerialisedSchema } from './config.js';
|
|
@@ -30,3 +31,5 @@ export const BuilderCollectionSerialisedSchema = serialisable(v.object({
|
|
|
30
31
|
tags: v.optional(BuilderTagsSchema)
|
|
31
32
|
}));
|
|
32
33
|
export const BuilderCollectionsSerialisedSchema = v.pipe(v.array(BuilderCollectionSerialisedSchema), v.readonly());
|
|
34
|
+
export const validateCollectionWhen = createEntityValidator('collectionWhen', BuilderCollectionWhenSerialisedSchema);
|
|
35
|
+
export const validateCollectionSelectMap = createEntityValidator('collectionSelectMap', BuilderCollectionSelectMapSerialisedSchema);
|
|
@@ -87,4 +87,294 @@ export declare const BuilderCollectionConfigSerialisedSchema: v.SchemaWithPipe<r
|
|
|
87
87
|
tags?: readonly string[] | undefined;
|
|
88
88
|
}>]>;
|
|
89
89
|
export type BuilderCollectionConfigSerialised = v.InferOutput<typeof BuilderCollectionConfigSerialisedSchema>;
|
|
90
|
+
export declare const BuilderCollectionConfigsSerialisedSchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
91
|
+
readonly model: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
92
|
+
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
93
|
+
readonly id: v.StringSchema<undefined>;
|
|
94
|
+
readonly name: v.StringSchema<undefined>;
|
|
95
|
+
}, undefined>, v.ReadonlyAction<{
|
|
96
|
+
type: "parameter";
|
|
97
|
+
id: string;
|
|
98
|
+
name: string;
|
|
99
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
100
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
101
|
+
readonly id: v.StringSchema<undefined>;
|
|
102
|
+
}, undefined>, v.ReadonlyAction<{
|
|
103
|
+
type: "ref";
|
|
104
|
+
id: string;
|
|
105
|
+
}>]>, v.LazySchema<v.GenericSchema<import("..").BuilderModelSerialised>>], undefined>;
|
|
106
|
+
readonly min: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
107
|
+
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
108
|
+
readonly id: v.StringSchema<undefined>;
|
|
109
|
+
readonly name: v.StringSchema<undefined>;
|
|
110
|
+
}, undefined>, v.ReadonlyAction<{
|
|
111
|
+
type: "parameter";
|
|
112
|
+
id: string;
|
|
113
|
+
name: string;
|
|
114
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
115
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
116
|
+
readonly id: v.StringSchema<undefined>;
|
|
117
|
+
}, undefined>, v.ReadonlyAction<{
|
|
118
|
+
type: "ref";
|
|
119
|
+
id: string;
|
|
120
|
+
}>]>, v.NumberSchema<undefined>], undefined>;
|
|
121
|
+
readonly max: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
122
|
+
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
123
|
+
readonly id: v.StringSchema<undefined>;
|
|
124
|
+
readonly name: v.StringSchema<undefined>;
|
|
125
|
+
}, undefined>, v.ReadonlyAction<{
|
|
126
|
+
type: "parameter";
|
|
127
|
+
id: string;
|
|
128
|
+
name: string;
|
|
129
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
130
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
131
|
+
readonly id: v.StringSchema<undefined>;
|
|
132
|
+
}, undefined>, v.ReadonlyAction<{
|
|
133
|
+
type: "ref";
|
|
134
|
+
id: string;
|
|
135
|
+
}>]>, v.NumberSchema<undefined>], undefined>;
|
|
136
|
+
readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
|
|
137
|
+
}, undefined>, v.ReadonlyAction<{
|
|
138
|
+
model: Readonly<{
|
|
139
|
+
type: "parameter";
|
|
140
|
+
id: string;
|
|
141
|
+
name: string;
|
|
142
|
+
}> | Readonly<{
|
|
143
|
+
type: "ref";
|
|
144
|
+
id: string;
|
|
145
|
+
}> | import("..").BuilderModelSerialised;
|
|
146
|
+
min: number | Readonly<{
|
|
147
|
+
type: "parameter";
|
|
148
|
+
id: string;
|
|
149
|
+
name: string;
|
|
150
|
+
}> | Readonly<{
|
|
151
|
+
type: "ref";
|
|
152
|
+
id: string;
|
|
153
|
+
}>;
|
|
154
|
+
max: number | Readonly<{
|
|
155
|
+
type: "parameter";
|
|
156
|
+
id: string;
|
|
157
|
+
name: string;
|
|
158
|
+
}> | Readonly<{
|
|
159
|
+
type: "ref";
|
|
160
|
+
id: string;
|
|
161
|
+
}>;
|
|
162
|
+
tags?: readonly string[] | undefined;
|
|
163
|
+
}>]>, undefined>, v.ReadonlyAction<Readonly<{
|
|
164
|
+
model: Readonly<{
|
|
165
|
+
type: "parameter";
|
|
166
|
+
id: string;
|
|
167
|
+
name: string;
|
|
168
|
+
}> | Readonly<{
|
|
169
|
+
type: "ref";
|
|
170
|
+
id: string;
|
|
171
|
+
}> | import("..").BuilderModelSerialised;
|
|
172
|
+
min: number | Readonly<{
|
|
173
|
+
type: "parameter";
|
|
174
|
+
id: string;
|
|
175
|
+
name: string;
|
|
176
|
+
}> | Readonly<{
|
|
177
|
+
type: "ref";
|
|
178
|
+
id: string;
|
|
179
|
+
}>;
|
|
180
|
+
max: number | Readonly<{
|
|
181
|
+
type: "parameter";
|
|
182
|
+
id: string;
|
|
183
|
+
name: string;
|
|
184
|
+
}> | Readonly<{
|
|
185
|
+
type: "ref";
|
|
186
|
+
id: string;
|
|
187
|
+
}>;
|
|
188
|
+
tags?: readonly string[] | undefined;
|
|
189
|
+
}>[]>]>;
|
|
190
|
+
export type BuilderCollectionConfigsSerialised = v.InferOutput<typeof BuilderCollectionConfigsSerialisedSchema>;
|
|
90
191
|
export declare function collectionConfig<Model extends Paramable<BuilderModelGeneric> = Paramable<BuilderModelGeneric>, Min extends Paramable<number> = Paramable<number>, Max extends Paramable<number> = Paramable<number>>(model: Model, min: Min, max: Max): BuilderCollectionConfig<Model, Min, Max>;
|
|
192
|
+
export declare const validateCollectionConfig: (input: unknown, references?: import("..").BuilderReferences, errors?: import("../../errors").BuilderValidateErrors) => import("..").ValidationResult<{
|
|
193
|
+
readonly model: {
|
|
194
|
+
readonly models: readonly (/*elided*/ any & import("../../validate").BuilderValidatedBrand)[];
|
|
195
|
+
readonly options: readonly {
|
|
196
|
+
readonly name: string;
|
|
197
|
+
readonly payload: {
|
|
198
|
+
readonly type: "enable";
|
|
199
|
+
readonly payload: {
|
|
200
|
+
readonly type: "select";
|
|
201
|
+
readonly options: readonly [string, ...string[]];
|
|
202
|
+
readonly defaultValue: string | null;
|
|
203
|
+
readonly isOptional: boolean;
|
|
204
|
+
readonly optionLabels: {
|
|
205
|
+
readonly [x: string]: string;
|
|
206
|
+
} & import("../../validate").BuilderValidatedBrand;
|
|
207
|
+
readonly tags?: readonly string[] | undefined;
|
|
208
|
+
} | {
|
|
209
|
+
readonly type: "toggle";
|
|
210
|
+
readonly valueType: "string" | "number" | "boolean";
|
|
211
|
+
readonly defaultValue: string | number | boolean | null;
|
|
212
|
+
readonly isOptional: boolean;
|
|
213
|
+
readonly tags?: readonly string[] | undefined;
|
|
214
|
+
};
|
|
215
|
+
} | {
|
|
216
|
+
readonly type: "match";
|
|
217
|
+
readonly matchPath: readonly (string | number)[];
|
|
218
|
+
readonly selectMap: {
|
|
219
|
+
readonly [x: string]: {
|
|
220
|
+
readonly type: "select";
|
|
221
|
+
readonly options: readonly [string, ...string[]];
|
|
222
|
+
readonly defaultValue: string | null;
|
|
223
|
+
readonly isOptional: boolean;
|
|
224
|
+
readonly optionLabels: {
|
|
225
|
+
readonly [x: string]: string;
|
|
226
|
+
} & import("../../validate").BuilderValidatedBrand;
|
|
227
|
+
readonly tags?: readonly string[] | undefined;
|
|
228
|
+
} | {
|
|
229
|
+
readonly type: "toggle";
|
|
230
|
+
readonly valueType: "string" | "number" | "boolean";
|
|
231
|
+
readonly defaultValue: string | number | boolean | null;
|
|
232
|
+
readonly isOptional: boolean;
|
|
233
|
+
readonly tags?: readonly string[] | undefined;
|
|
234
|
+
} | null;
|
|
235
|
+
};
|
|
236
|
+
} | {
|
|
237
|
+
readonly type: "unless";
|
|
238
|
+
readonly unlessPath: readonly (string | number)[];
|
|
239
|
+
readonly disabledValues: readonly (string | number | boolean | null)[];
|
|
240
|
+
readonly payload: {
|
|
241
|
+
readonly type: "select";
|
|
242
|
+
readonly options: readonly [string, ...string[]];
|
|
243
|
+
readonly defaultValue: string | null;
|
|
244
|
+
readonly isOptional: boolean;
|
|
245
|
+
readonly optionLabels: {
|
|
246
|
+
readonly [x: string]: string;
|
|
247
|
+
} & import("../../validate").BuilderValidatedBrand;
|
|
248
|
+
readonly tags?: readonly string[] | undefined;
|
|
249
|
+
} | {
|
|
250
|
+
readonly type: "toggle";
|
|
251
|
+
readonly valueType: "string" | "number" | "boolean";
|
|
252
|
+
readonly defaultValue: string | number | boolean | null;
|
|
253
|
+
readonly isOptional: boolean;
|
|
254
|
+
readonly tags?: readonly string[] | undefined;
|
|
255
|
+
};
|
|
256
|
+
} | {
|
|
257
|
+
readonly type: "select";
|
|
258
|
+
readonly options: readonly [string, ...string[]];
|
|
259
|
+
readonly defaultValue: string | null;
|
|
260
|
+
readonly isOptional: boolean;
|
|
261
|
+
readonly optionLabels: {
|
|
262
|
+
readonly [x: string]: string;
|
|
263
|
+
} & import("../../validate").BuilderValidatedBrand;
|
|
264
|
+
readonly tags?: readonly string[] | undefined;
|
|
265
|
+
} | {
|
|
266
|
+
readonly type: "toggle";
|
|
267
|
+
readonly valueType: "string" | "number" | "boolean";
|
|
268
|
+
readonly defaultValue: string | number | boolean | null;
|
|
269
|
+
readonly isOptional: boolean;
|
|
270
|
+
readonly tags?: readonly string[] | undefined;
|
|
271
|
+
};
|
|
272
|
+
readonly paths?: readonly (readonly (string | number)[])[] | undefined;
|
|
273
|
+
readonly tags?: readonly string[] | undefined;
|
|
274
|
+
}[];
|
|
275
|
+
readonly components: readonly {
|
|
276
|
+
readonly name: string;
|
|
277
|
+
readonly payload: {
|
|
278
|
+
readonly fields: readonly {
|
|
279
|
+
readonly type: "component-field";
|
|
280
|
+
readonly name: string;
|
|
281
|
+
readonly valueType: "string" | "number" | "boolean";
|
|
282
|
+
readonly isOptional: boolean;
|
|
283
|
+
readonly tags?: readonly string[] | undefined;
|
|
284
|
+
}[];
|
|
285
|
+
readonly tags?: readonly string[] | undefined;
|
|
286
|
+
} | {
|
|
287
|
+
readonly type: "enable";
|
|
288
|
+
readonly payload: {
|
|
289
|
+
readonly fields: readonly {
|
|
290
|
+
readonly type: "component-field";
|
|
291
|
+
readonly name: string;
|
|
292
|
+
readonly valueType: "string" | "number" | "boolean";
|
|
293
|
+
readonly isOptional: boolean;
|
|
294
|
+
readonly tags?: readonly string[] | undefined;
|
|
295
|
+
}[];
|
|
296
|
+
readonly tags?: readonly string[] | undefined;
|
|
297
|
+
};
|
|
298
|
+
} | {
|
|
299
|
+
readonly type: "match";
|
|
300
|
+
readonly matchPath: readonly (string | number)[];
|
|
301
|
+
readonly selectMap: {
|
|
302
|
+
readonly [x: string]: {
|
|
303
|
+
readonly fields: readonly {
|
|
304
|
+
readonly type: "component-field";
|
|
305
|
+
readonly name: string;
|
|
306
|
+
readonly valueType: "string" | "number" | "boolean";
|
|
307
|
+
readonly isOptional: boolean;
|
|
308
|
+
readonly tags?: readonly string[] | undefined;
|
|
309
|
+
}[];
|
|
310
|
+
readonly tags?: readonly string[] | undefined;
|
|
311
|
+
} | null;
|
|
312
|
+
};
|
|
313
|
+
} | {
|
|
314
|
+
readonly type: "unless";
|
|
315
|
+
readonly unlessPath: readonly (string | number)[];
|
|
316
|
+
readonly disabledValues: readonly (string | number | boolean | null)[];
|
|
317
|
+
readonly payload: {
|
|
318
|
+
readonly fields: readonly {
|
|
319
|
+
readonly type: "component-field";
|
|
320
|
+
readonly name: string;
|
|
321
|
+
readonly valueType: "string" | "number" | "boolean";
|
|
322
|
+
readonly isOptional: boolean;
|
|
323
|
+
readonly tags?: readonly string[] | undefined;
|
|
324
|
+
}[];
|
|
325
|
+
readonly tags?: readonly string[] | undefined;
|
|
326
|
+
};
|
|
327
|
+
};
|
|
328
|
+
readonly paths?: readonly (readonly (string | number)[])[] | undefined;
|
|
329
|
+
readonly tags?: readonly string[] | undefined;
|
|
330
|
+
}[];
|
|
331
|
+
readonly collections: readonly {
|
|
332
|
+
readonly name: string;
|
|
333
|
+
readonly paths?: readonly (readonly (string | number)[])[] | undefined;
|
|
334
|
+
readonly payload: {
|
|
335
|
+
readonly model: /*elided*/ any & import("../../validate").BuilderValidatedBrand;
|
|
336
|
+
readonly min: number;
|
|
337
|
+
readonly max: number;
|
|
338
|
+
readonly tags?: readonly string[] | undefined;
|
|
339
|
+
} | {
|
|
340
|
+
readonly type: "enable";
|
|
341
|
+
readonly payload: {
|
|
342
|
+
readonly model: /*elided*/ any & import("../../validate").BuilderValidatedBrand;
|
|
343
|
+
readonly min: number;
|
|
344
|
+
readonly max: number;
|
|
345
|
+
readonly tags?: readonly string[] | undefined;
|
|
346
|
+
};
|
|
347
|
+
} | {
|
|
348
|
+
readonly type: "match";
|
|
349
|
+
readonly matchPath: readonly (string | number)[];
|
|
350
|
+
readonly selectMap: {
|
|
351
|
+
readonly [x: string]: {
|
|
352
|
+
readonly model: /*elided*/ any & import("../../validate").BuilderValidatedBrand;
|
|
353
|
+
readonly min: number;
|
|
354
|
+
readonly max: number;
|
|
355
|
+
readonly tags?: readonly string[] | undefined;
|
|
356
|
+
} | null;
|
|
357
|
+
};
|
|
358
|
+
} | {
|
|
359
|
+
readonly type: "unless";
|
|
360
|
+
readonly unlessPath: readonly (string | number)[];
|
|
361
|
+
readonly disabledValues: readonly (string | number | boolean | null)[];
|
|
362
|
+
readonly payload: {
|
|
363
|
+
readonly model: /*elided*/ any & import("../../validate").BuilderValidatedBrand;
|
|
364
|
+
readonly min: number;
|
|
365
|
+
readonly max: number;
|
|
366
|
+
readonly tags?: readonly string[] | undefined;
|
|
367
|
+
};
|
|
368
|
+
};
|
|
369
|
+
readonly tags?: readonly string[] | undefined;
|
|
370
|
+
}[];
|
|
371
|
+
readonly expectations: readonly ({
|
|
372
|
+
readonly name: string;
|
|
373
|
+
readonly kind: "option" | "component" | "collection";
|
|
374
|
+
} & import("../../validate").BuilderValidatedBrand)[];
|
|
375
|
+
readonly tags?: readonly string[] | undefined;
|
|
376
|
+
} & import("../../validate").BuilderValidatedBrand;
|
|
377
|
+
readonly min: number;
|
|
378
|
+
readonly max: number;
|
|
379
|
+
readonly tags?: readonly string[] | undefined;
|
|
380
|
+
}>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
|
-
import { paramable } from '../../references.js';
|
|
3
|
-
import {
|
|
2
|
+
import { isParamable, paramable } from '../../references.js';
|
|
3
|
+
import { createEntityValidator } from '../kind.js';
|
|
4
4
|
import { BuilderModelSerialisedSchema } from '../model/index.js';
|
|
5
|
+
import { serialisable } from '../serialisable.js';
|
|
5
6
|
import { BuilderTagsSchema } from '../tags.js';
|
|
6
7
|
export class BuilderCollectionConfig {
|
|
7
8
|
model;
|
|
@@ -25,6 +26,16 @@ export const BuilderCollectionConfigSerialisedSchema = serialisable(v.object({
|
|
|
25
26
|
max: paramable(v.number()),
|
|
26
27
|
tags: v.optional(BuilderTagsSchema)
|
|
27
28
|
}));
|
|
29
|
+
export const BuilderCollectionConfigsSerialisedSchema = v.pipe(v.array(BuilderCollectionConfigSerialisedSchema), v.readonly());
|
|
28
30
|
export function collectionConfig(model, min, max) {
|
|
29
31
|
return new BuilderCollectionConfig(model, min, max);
|
|
30
32
|
}
|
|
33
|
+
export const validateCollectionConfig = createEntityValidator('collectionConfig', BuilderCollectionConfigSerialisedSchema, (input, errors) => {
|
|
34
|
+
const { min, max } = input;
|
|
35
|
+
if (isParamable(min) || isParamable(max)) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (min < 0 || max <= 0 || max < min) {
|
|
39
|
+
errors.invalidCollectionBounds(min, max);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { BuilderModelState } from '../model/index';
|
|
2
1
|
import type { BuilderExpectations } from '../expectation';
|
|
2
|
+
import type { BuilderModelState } from '../model/index';
|
|
3
3
|
import type { BuilderCollection } from './collection';
|
|
4
4
|
import { BuilderExpectation } from '../expectation.js';
|
|
5
5
|
export declare function collectionExpectation<const Name extends string>(name: Name): BuilderExpectation<Name, never, "collection">;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export type { BuilderCollectionPayload, BuilderCollections, BuilderCollectionSerialised, BuilderCollectionsSerialised, BuilderCollectionWhenSerialised, CollectionNamesOf, CollectionShape } from './collection';
|
|
2
|
-
export type { BuilderCollectionConfigSerialised } from './config';
|
|
2
|
+
export type { BuilderCollectionConfigSerialised, BuilderCollectionConfigsSerialised } from './config';
|
|
3
3
|
export type { CollectionsAsserted } from './expectation';
|
|
4
4
|
export type { BuilderCollectionWhen } from './when';
|
|
5
|
-
export { BuilderCollection, BuilderCollectionSchema, BuilderCollectionSelectMapSerialisedSchema, BuilderCollectionSerialisedSchema, BuilderCollectionsSerialisedSchema, BuilderCollectionWhenSerialisedSchema } from './collection.js';
|
|
6
|
-
export { BuilderCollectionConfig, BuilderCollectionConfigSchema, BuilderCollectionConfigSerialisedSchema, collectionConfig } from './config.js';
|
|
5
|
+
export { BuilderCollection, BuilderCollectionSchema, BuilderCollectionSelectMapSerialisedSchema, BuilderCollectionSerialisedSchema, BuilderCollectionsSerialisedSchema, BuilderCollectionWhenSerialisedSchema, validateCollectionSelectMap, validateCollectionWhen } from './collection.js';
|
|
6
|
+
export { BuilderCollectionConfig, BuilderCollectionConfigSchema, BuilderCollectionConfigSerialisedSchema, BuilderCollectionConfigsSerialisedSchema, collectionConfig, validateCollectionConfig } from './config.js';
|
|
7
7
|
export { collectionExpectation } from './expectation.js';
|
|
8
8
|
export { collectionWhen } from './when.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { BuilderCollection, BuilderCollectionSchema, BuilderCollectionSelectMapSerialisedSchema, BuilderCollectionSerialisedSchema, BuilderCollectionsSerialisedSchema, BuilderCollectionWhenSerialisedSchema } from './collection.js';
|
|
2
|
-
export { BuilderCollectionConfig, BuilderCollectionConfigSchema, BuilderCollectionConfigSerialisedSchema, collectionConfig } from './config.js';
|
|
1
|
+
export { BuilderCollection, BuilderCollectionSchema, BuilderCollectionSelectMapSerialisedSchema, BuilderCollectionSerialisedSchema, BuilderCollectionsSerialisedSchema, BuilderCollectionWhenSerialisedSchema, validateCollectionSelectMap, validateCollectionWhen } from './collection.js';
|
|
2
|
+
export { BuilderCollectionConfig, BuilderCollectionConfigSchema, BuilderCollectionConfigSerialisedSchema, BuilderCollectionConfigsSerialisedSchema, collectionConfig, validateCollectionConfig } from './config.js';
|
|
3
3
|
export { collectionExpectation } from './expectation.js';
|
|
4
4
|
export { collectionWhen } from './when.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { BuilderPath } from '../../paths';
|
|
2
1
|
import type { Paramable } from '../../references';
|
|
2
|
+
import type { BuilderPath } from '../paths';
|
|
3
3
|
import type { BuilderWhen } from '../when';
|
|
4
4
|
import type { BuilderCollectionConfig } from './config';
|
|
5
5
|
export type BuilderCollectionWhen = BuilderWhen<Paramable<BuilderCollectionConfig>, Paramable<BuilderPath>, Paramable<Record<string, Paramable<BuilderCollectionConfig> | null>>, Paramable<BuilderPath>>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { BuilderPaths } from '../../paths';
|
|
2
1
|
import type { Paramable } from '../../references';
|
|
2
|
+
import type { BuilderPaths } from '../paths';
|
|
3
3
|
import type { BuilderTags } from '../tags';
|
|
4
4
|
import type { BuilderWhenSerialised } from '../when';
|
|
5
|
-
import type {
|
|
5
|
+
import type { BuilderComponentConfig, BuilderComponentConfigSerialised } from './config';
|
|
6
6
|
import type { BuilderComponentWhen } from './when';
|
|
7
7
|
import * as v from 'valibot';
|
|
8
|
-
export type BuilderComponentPayload =
|
|
8
|
+
export type BuilderComponentPayload = BuilderComponentConfig | BuilderComponentWhen;
|
|
9
9
|
export declare class BuilderComponent<const Name extends string = string, const Payload extends Paramable<BuilderComponentPayload> = Paramable<BuilderComponentPayload>, const Paths extends Paramable<BuilderPaths> = Paramable<BuilderPaths>> {
|
|
10
10
|
readonly type: 'component';
|
|
11
11
|
readonly name: Name;
|
|
@@ -34,7 +34,7 @@ export declare const BuilderComponentWhenSerialisedSchema: v.GenericSchema<Build
|
|
|
34
34
|
}>[];
|
|
35
35
|
tags?: readonly string[] | undefined;
|
|
36
36
|
}>>>;
|
|
37
|
-
export type BuilderComponentWhenSerialised = BuilderWhenSerialised<
|
|
37
|
+
export type BuilderComponentWhenSerialised = BuilderWhenSerialised<BuilderComponentConfigSerialised>;
|
|
38
38
|
export declare const BuilderComponentSelectMapSerialisedSchema: v.GenericSchema<import("..").BuilderMatchSelectMap<Readonly<{
|
|
39
39
|
type: "parameter";
|
|
40
40
|
id: string;
|
|
@@ -198,14 +198,14 @@ export declare const BuilderComponentSerialisedSchema: v.SchemaWithPipe<readonly
|
|
|
198
198
|
}>[];
|
|
199
199
|
tags?: readonly string[] | undefined;
|
|
200
200
|
}>>;
|
|
201
|
-
paths?:
|
|
201
|
+
paths?: Readonly<{
|
|
202
202
|
type: "parameter";
|
|
203
203
|
id: string;
|
|
204
204
|
name: string;
|
|
205
205
|
}> | Readonly<{
|
|
206
206
|
type: "ref";
|
|
207
207
|
id: string;
|
|
208
|
-
}> | undefined;
|
|
208
|
+
}> | readonly (readonly (string | number)[])[] | undefined;
|
|
209
209
|
tags?: readonly string[] | undefined;
|
|
210
210
|
}>]>;
|
|
211
211
|
export type BuilderComponentSerialised = v.InferOutput<typeof BuilderComponentSerialisedSchema>;
|
|
@@ -351,14 +351,14 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
|
|
|
351
351
|
}>[];
|
|
352
352
|
tags?: readonly string[] | undefined;
|
|
353
353
|
}>>;
|
|
354
|
-
paths?:
|
|
354
|
+
paths?: Readonly<{
|
|
355
355
|
type: "parameter";
|
|
356
356
|
id: string;
|
|
357
357
|
name: string;
|
|
358
358
|
}> | Readonly<{
|
|
359
359
|
type: "ref";
|
|
360
360
|
id: string;
|
|
361
|
-
}> | undefined;
|
|
361
|
+
}> | readonly (readonly (string | number)[])[] | undefined;
|
|
362
362
|
tags?: readonly string[] | undefined;
|
|
363
363
|
}>]>, undefined>, v.ReadonlyAction<Readonly<{
|
|
364
364
|
name: string;
|
|
@@ -402,14 +402,68 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
|
|
|
402
402
|
}>[];
|
|
403
403
|
tags?: readonly string[] | undefined;
|
|
404
404
|
}>>;
|
|
405
|
-
paths?:
|
|
405
|
+
paths?: Readonly<{
|
|
406
406
|
type: "parameter";
|
|
407
407
|
id: string;
|
|
408
408
|
name: string;
|
|
409
409
|
}> | Readonly<{
|
|
410
410
|
type: "ref";
|
|
411
411
|
id: string;
|
|
412
|
-
}> | undefined;
|
|
412
|
+
}> | readonly (readonly (string | number)[])[] | undefined;
|
|
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").BuilderValidateErrors) => import("..").ValidationResult<{
|
|
417
|
+
readonly type: "enable";
|
|
418
|
+
readonly payload: {
|
|
419
|
+
readonly fields: readonly {
|
|
420
|
+
readonly type: "component-field";
|
|
421
|
+
readonly name: string;
|
|
422
|
+
readonly valueType: "string" | "number" | "boolean";
|
|
423
|
+
readonly isOptional: boolean;
|
|
424
|
+
readonly tags?: readonly string[] | undefined;
|
|
425
|
+
}[];
|
|
426
|
+
readonly tags?: readonly string[] | undefined;
|
|
427
|
+
};
|
|
428
|
+
} | {
|
|
429
|
+
readonly type: "match";
|
|
430
|
+
readonly matchPath: readonly (string | number)[];
|
|
431
|
+
readonly selectMap: {
|
|
432
|
+
readonly [x: string]: {
|
|
433
|
+
readonly fields: readonly {
|
|
434
|
+
readonly type: "component-field";
|
|
435
|
+
readonly name: string;
|
|
436
|
+
readonly valueType: "string" | "number" | "boolean";
|
|
437
|
+
readonly isOptional: boolean;
|
|
438
|
+
readonly tags?: readonly string[] | undefined;
|
|
439
|
+
}[];
|
|
440
|
+
readonly tags?: readonly string[] | undefined;
|
|
441
|
+
} | null;
|
|
442
|
+
};
|
|
443
|
+
} | {
|
|
444
|
+
readonly type: "unless";
|
|
445
|
+
readonly unlessPath: readonly (string | number)[];
|
|
446
|
+
readonly disabledValues: readonly (string | number | boolean | null)[];
|
|
447
|
+
readonly payload: {
|
|
448
|
+
readonly fields: readonly {
|
|
449
|
+
readonly type: "component-field";
|
|
450
|
+
readonly name: string;
|
|
451
|
+
readonly valueType: "string" | "number" | "boolean";
|
|
452
|
+
readonly isOptional: boolean;
|
|
453
|
+
readonly tags?: readonly string[] | undefined;
|
|
454
|
+
}[];
|
|
455
|
+
readonly tags?: readonly string[] | undefined;
|
|
456
|
+
};
|
|
457
|
+
}>;
|
|
458
|
+
export declare const validateComponentSelectMap: (input: unknown, references?: import("..").BuilderReferences, errors?: import("../../errors").BuilderValidateErrors) => import("..").ValidationResult<{
|
|
459
|
+
readonly [x: string]: {
|
|
460
|
+
readonly fields: readonly {
|
|
461
|
+
readonly type: "component-field";
|
|
462
|
+
readonly name: string;
|
|
463
|
+
readonly valueType: "string" | "number" | "boolean";
|
|
464
|
+
readonly isOptional: boolean;
|
|
465
|
+
readonly tags?: readonly string[] | undefined;
|
|
466
|
+
}[];
|
|
467
|
+
readonly tags?: readonly string[] | undefined;
|
|
468
|
+
} | null;
|
|
469
|
+
}>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
|
-
import { BuilderPathsSchema } from '../../paths.js';
|
|
3
2
|
import { paramable } from '../../references.js';
|
|
4
|
-
import {
|
|
3
|
+
import { createEntityValidator } from '../kind.js';
|
|
4
|
+
import { BuilderPathsSchema } from '../paths.js';
|
|
5
|
+
import { serialisable } from '../serialisable.js';
|
|
5
6
|
import { BuilderTagsSchema } from '../tags.js';
|
|
6
7
|
import { createSelectMapSerialisedSchema, createWhenSerialisedSchema } from '../when.js';
|
|
7
|
-
import {
|
|
8
|
+
import { BuilderComponentConfigSerialisedSchema } from './config.js';
|
|
8
9
|
export class BuilderComponent {
|
|
9
10
|
name;
|
|
10
11
|
payload;
|
|
@@ -21,12 +22,14 @@ export class BuilderComponent {
|
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
export const BuilderComponentSchema = v.instance(BuilderComponent);
|
|
24
|
-
export const BuilderComponentWhenSerialisedSchema = createWhenSerialisedSchema(
|
|
25
|
-
export const BuilderComponentSelectMapSerialisedSchema = createSelectMapSerialisedSchema(
|
|
25
|
+
export const BuilderComponentWhenSerialisedSchema = createWhenSerialisedSchema(BuilderComponentConfigSerialisedSchema);
|
|
26
|
+
export const BuilderComponentSelectMapSerialisedSchema = createSelectMapSerialisedSchema(BuilderComponentConfigSerialisedSchema);
|
|
26
27
|
export const BuilderComponentSerialisedSchema = serialisable(v.object({
|
|
27
28
|
name: v.string(),
|
|
28
|
-
payload: paramable(v.union([
|
|
29
|
+
payload: paramable(v.union([BuilderComponentConfigSerialisedSchema, BuilderComponentWhenSerialisedSchema])),
|
|
29
30
|
paths: v.optional(paramable(BuilderPathsSchema)),
|
|
30
31
|
tags: v.optional(BuilderTagsSchema)
|
|
31
32
|
}));
|
|
32
33
|
export const BuilderComponentsSerialisedSchema = v.pipe(v.array(BuilderComponentSerialisedSchema), v.readonly());
|
|
34
|
+
export const validateComponentWhen = createEntityValidator('componentWhen', BuilderComponentWhenSerialisedSchema);
|
|
35
|
+
export const validateComponentSelectMap = createEntityValidator('componentSelectMap', BuilderComponentSelectMapSerialisedSchema);
|