@builder-builder/builder 0.0.28 → 0.0.29
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.js +5 -6
- package/dist/client/schema.d.ts +49 -29
- package/dist/components/BuilderOption.svelte.d.ts +12 -12
- package/dist/components/BuilderOptionValueBoolean.svelte.d.ts +20 -0
- package/dist/components/BuilderOptionValueNumber.svelte.d.ts +21 -0
- package/dist/components/BuilderOptionValueSelect.svelte.d.ts +21 -0
- package/dist/components/BuilderOptionValueString.svelte.d.ts +21 -0
- package/dist/components/index.d.ts +8 -8
- package/dist/components/index.js +2479 -2435
- package/dist/components/index.min.js +3 -3
- package/dist/entities/collection/collection.d.ts +162 -372
- package/dist/entities/collection/collection.js +7 -4
- package/dist/entities/collection/{when.d.ts → condition.d.ts} +3 -4
- package/dist/entities/collection/condition.js +2 -0
- package/dist/entities/collection/config.d.ts +52 -70
- package/dist/entities/collection/index.d.ts +4 -4
- package/dist/entities/collection/index.js +2 -2
- package/dist/entities/component/component.d.ts +11 -23
- package/dist/entities/component/component.js +4 -4
- package/dist/entities/component/{when.d.ts → condition.d.ts} +3 -4
- package/dist/entities/component/{when.js → condition.js} +3 -9
- package/dist/entities/component/index.d.ts +4 -4
- package/dist/entities/component/index.js +2 -2
- package/dist/entities/{when.d.ts → condition.d.ts} +21 -34
- package/dist/entities/{when.js → condition.js} +20 -25
- package/dist/entities/expectation.d.ts +135 -3
- package/dist/entities/expectation.js +6 -2
- package/dist/entities/index.d.ts +8 -8
- package/dist/entities/index.js +4 -4
- package/dist/entities/kind.d.ts +1 -1
- package/dist/entities/kind.js +4 -5
- package/dist/entities/model/bind.d.ts +5 -5
- package/dist/entities/model/methods.d.ts +18 -27
- package/dist/entities/model/methods.js +4 -22
- package/dist/entities/model/model.d.ts +3 -1
- package/dist/entities/model/model.js +25 -27
- package/dist/entities/option/condition.d.ts +9 -0
- package/dist/entities/option/condition.js +2 -0
- package/dist/entities/option/config.d.ts +44 -69
- package/dist/entities/option/config.js +6 -6
- package/dist/entities/option/expectation.d.ts +6 -1
- package/dist/entities/option/expectation.js +2 -2
- package/dist/entities/option/index.d.ts +8 -8
- package/dist/entities/option/index.js +4 -4
- package/dist/entities/option/option.d.ts +171 -202
- package/dist/entities/option/option.js +4 -4
- package/dist/entities/option/select.d.ts +16 -43
- package/dist/entities/option/select.js +8 -31
- package/dist/entities/option/value.d.ts +73 -0
- package/dist/entities/option/value.js +99 -0
- package/dist/entities/references.d.ts +104 -64
- package/dist/entities/serialise.d.ts +147 -80
- package/dist/entities/serialise.js +26 -21
- package/dist/entities/ui/input.d.ts +1 -1
- package/dist/entities/validated.d.ts +1 -1
- package/dist/errors/errors.d.ts +8 -3
- package/dist/errors/errors.js +5 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/mappers/dependencies.js +4 -3
- package/dist/mappers/resolve.js +23 -22
- package/dist/mappers/variants/option-graph.js +1 -1
- package/dist/public.d.ts +17 -17
- package/dist/public.js +17 -9
- package/dist/validate/expectations.js +21 -3
- package/dist/validate/model.js +8 -11
- package/dist/validate/resolve.js +14 -18
- package/package.json +1 -1
- package/dist/components/BuilderOptionSelect.svelte.d.ts +0 -21
- package/dist/components/BuilderOptionToggleBoolean.svelte.d.ts +0 -20
- package/dist/components/BuilderOptionToggleNumber.svelte.d.ts +0 -21
- package/dist/components/BuilderOptionToggleString.svelte.d.ts +0 -21
- package/dist/entities/collection/when.js +0 -2
- package/dist/entities/option/toggle.d.ts +0 -45
- package/dist/entities/option/toggle.js +0 -71
- package/dist/entities/option/when.d.ts +0 -10
- package/dist/entities/option/when.js +0 -2
|
@@ -9,117 +9,119 @@ export declare const entitiesMap: {
|
|
|
9
9
|
readonly runtime: v.InstanceSchema<typeof import(".").BuilderModel, undefined>;
|
|
10
10
|
readonly serialised: v.GenericSchema<import(".").BuilderModelSerialised>;
|
|
11
11
|
};
|
|
12
|
-
readonly
|
|
13
|
-
readonly runtime: v.InstanceSchema<typeof import(".").BuilderSelectConfig, undefined>;
|
|
14
|
-
readonly serialised: v.SchemaWithPipe<readonly [v.
|
|
15
|
-
readonly
|
|
16
|
-
readonly
|
|
17
|
-
readonly defaultValue: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
12
|
+
readonly value: {
|
|
13
|
+
readonly runtime: v.UnionSchema<[v.InstanceSchema<typeof import(".").BuilderValueConfig, undefined>, v.InstanceSchema<typeof import(".").BuilderSelectConfig, undefined>], undefined>;
|
|
14
|
+
readonly serialised: v.SchemaWithPipe<readonly [v.VariantSchema<"kind", [v.StrictObjectSchema<{
|
|
15
|
+
readonly kind: v.PicklistSchema<["string", "boolean", "number"], undefined>;
|
|
16
|
+
readonly type: v.LiteralSchema<"value", undefined>;
|
|
17
|
+
readonly defaultValue: v.NullableSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
|
|
18
18
|
readonly isOptional: v.BooleanSchema<undefined>;
|
|
19
|
-
readonly optionLabels: v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>;
|
|
20
19
|
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>;
|
|
21
|
-
}, undefined>, v.
|
|
22
|
-
|
|
23
|
-
readonly options: readonly [string, ...string[]]
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
optionLabels: {
|
|
27
|
-
[x: string]: string;
|
|
28
|
-
};
|
|
29
|
-
tags?: readonly string[] | undefined;
|
|
30
|
-
}>]>;
|
|
31
|
-
};
|
|
32
|
-
readonly toggle: {
|
|
33
|
-
readonly runtime: v.InstanceSchema<typeof import(".").BuilderToggleConfig, undefined>;
|
|
34
|
-
readonly serialised: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
35
|
-
readonly type: v.LiteralSchema<"toggle", undefined>;
|
|
36
|
-
readonly kind: v.PicklistSchema<["string", "boolean", "number"], undefined>;
|
|
20
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
21
|
+
readonly kind: v.LiteralSchema<"select", undefined>;
|
|
22
|
+
readonly options: v.SchemaWithPipe<readonly [v.TupleWithRestSchema<[v.StringSchema<undefined>], v.StringSchema<undefined>, undefined>, v.ReadonlyAction<[string, ...string[]]>]>;
|
|
23
|
+
readonly optionLabels: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>, undefined>;
|
|
24
|
+
readonly type: v.LiteralSchema<"value", undefined>;
|
|
37
25
|
readonly defaultValue: v.NullableSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
|
|
38
26
|
readonly isOptional: v.BooleanSchema<undefined>;
|
|
39
27
|
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>;
|
|
40
|
-
}, undefined>, v.ReadonlyAction<{
|
|
41
|
-
type: "toggle";
|
|
28
|
+
}, undefined>], undefined>, v.ReadonlyAction<{
|
|
42
29
|
kind: "string" | "number" | "boolean";
|
|
30
|
+
type: "value";
|
|
31
|
+
defaultValue: string | number | boolean | null;
|
|
32
|
+
isOptional: boolean;
|
|
33
|
+
tags?: readonly string[] | undefined;
|
|
34
|
+
} | {
|
|
35
|
+
kind: "select";
|
|
36
|
+
readonly options: readonly [string, ...string[]];
|
|
37
|
+
optionLabels?: {
|
|
38
|
+
[x: string]: string;
|
|
39
|
+
} | undefined;
|
|
40
|
+
type: "value";
|
|
43
41
|
defaultValue: string | number | boolean | null;
|
|
44
42
|
isOptional: boolean;
|
|
45
43
|
tags?: readonly string[] | undefined;
|
|
46
44
|
}>]>;
|
|
47
45
|
};
|
|
48
46
|
readonly optionSelectMap: {
|
|
49
|
-
readonly runtime: v.GenericSchema<import("./
|
|
47
|
+
readonly runtime: v.GenericSchema<import("./condition").BuilderMatchSelectMap<Readonly<{
|
|
50
48
|
type: "parameter";
|
|
51
49
|
id: string;
|
|
52
50
|
name: string;
|
|
53
|
-
}> | Readonly<
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
defaultValue: string | null;
|
|
51
|
+
}> | Readonly<{
|
|
52
|
+
kind: "string" | "number" | "boolean";
|
|
53
|
+
type: "value";
|
|
54
|
+
defaultValue: string | number | boolean | null;
|
|
57
55
|
isOptional: boolean;
|
|
58
|
-
optionLabels: {
|
|
59
|
-
[x: string]: string;
|
|
60
|
-
};
|
|
61
56
|
tags?: readonly string[] | undefined;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
57
|
+
}> | Readonly<{
|
|
58
|
+
kind: "select";
|
|
59
|
+
readonly options: readonly [string, ...string[]];
|
|
60
|
+
optionLabels?: {
|
|
61
|
+
[x: string]: string;
|
|
62
|
+
} | undefined;
|
|
63
|
+
type: "value";
|
|
65
64
|
defaultValue: string | number | boolean | null;
|
|
66
65
|
isOptional: boolean;
|
|
67
66
|
tags?: readonly string[] | undefined;
|
|
68
|
-
}
|
|
69
|
-
readonly serialised: v.GenericSchema<import("./
|
|
67
|
+
}>>>;
|
|
68
|
+
readonly serialised: v.GenericSchema<import("./condition").BuilderMatchSelectMap<Readonly<{
|
|
70
69
|
type: "parameter";
|
|
71
70
|
id: string;
|
|
72
71
|
name: string;
|
|
73
|
-
}> | Readonly<
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
defaultValue: string | null;
|
|
72
|
+
}> | Readonly<{
|
|
73
|
+
kind: "string" | "number" | "boolean";
|
|
74
|
+
type: "value";
|
|
75
|
+
defaultValue: string | number | boolean | null;
|
|
77
76
|
isOptional: boolean;
|
|
78
|
-
|
|
77
|
+
tags?: readonly string[] | undefined;
|
|
78
|
+
}> | Readonly<{
|
|
79
|
+
kind: "select";
|
|
80
|
+
readonly options: readonly [string, ...string[]];
|
|
81
|
+
optionLabels?: {
|
|
79
82
|
[x: string]: string;
|
|
80
|
-
};
|
|
83
|
+
} | undefined;
|
|
84
|
+
type: "value";
|
|
85
|
+
defaultValue: string | number | boolean | null;
|
|
86
|
+
isOptional: boolean;
|
|
81
87
|
tags?: readonly string[] | undefined;
|
|
82
|
-
}
|
|
83
|
-
|
|
88
|
+
}>>>;
|
|
89
|
+
};
|
|
90
|
+
readonly optionCondition: {
|
|
91
|
+
readonly runtime: v.GenericSchema<import("./condition").BuilderConditionSerialised<Readonly<{
|
|
84
92
|
kind: "string" | "number" | "boolean";
|
|
93
|
+
type: "value";
|
|
85
94
|
defaultValue: string | number | boolean | null;
|
|
86
95
|
isOptional: boolean;
|
|
87
96
|
tags?: readonly string[] | undefined;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
readonly optionWhen: {
|
|
91
|
-
readonly runtime: v.GenericSchema<import("./when").BuilderWhenSerialised<Readonly<Readonly<{
|
|
92
|
-
type: "select";
|
|
97
|
+
}> | Readonly<{
|
|
98
|
+
kind: "select";
|
|
93
99
|
readonly options: readonly [string, ...string[]];
|
|
94
|
-
|
|
95
|
-
isOptional: boolean;
|
|
96
|
-
optionLabels: {
|
|
100
|
+
optionLabels?: {
|
|
97
101
|
[x: string]: string;
|
|
98
|
-
};
|
|
102
|
+
} | undefined;
|
|
103
|
+
type: "value";
|
|
104
|
+
defaultValue: string | number | boolean | null;
|
|
105
|
+
isOptional: boolean;
|
|
99
106
|
tags?: readonly string[] | undefined;
|
|
100
|
-
}
|
|
101
|
-
|
|
107
|
+
}>>>;
|
|
108
|
+
readonly serialised: v.GenericSchema<import("./condition").BuilderConditionSerialised<Readonly<{
|
|
102
109
|
kind: "string" | "number" | "boolean";
|
|
110
|
+
type: "value";
|
|
103
111
|
defaultValue: string | number | boolean | null;
|
|
104
112
|
isOptional: boolean;
|
|
105
113
|
tags?: readonly string[] | undefined;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
type: "select";
|
|
114
|
+
}> | Readonly<{
|
|
115
|
+
kind: "select";
|
|
109
116
|
readonly options: readonly [string, ...string[]];
|
|
110
|
-
|
|
111
|
-
isOptional: boolean;
|
|
112
|
-
optionLabels: {
|
|
117
|
+
optionLabels?: {
|
|
113
118
|
[x: string]: string;
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
}>> | Readonly<Readonly<{
|
|
117
|
-
type: "toggle";
|
|
118
|
-
kind: "string" | "number" | "boolean";
|
|
119
|
+
} | undefined;
|
|
120
|
+
type: "value";
|
|
119
121
|
defaultValue: string | number | boolean | null;
|
|
120
122
|
isOptional: boolean;
|
|
121
123
|
tags?: readonly string[] | undefined;
|
|
122
|
-
}
|
|
124
|
+
}>>>;
|
|
123
125
|
};
|
|
124
126
|
readonly componentConfig: {
|
|
125
127
|
readonly runtime: v.InstanceSchema<typeof import(".").BuilderComponentConfig, undefined>;
|
|
@@ -177,7 +179,7 @@ export declare const entitiesMap: {
|
|
|
177
179
|
}>]>;
|
|
178
180
|
};
|
|
179
181
|
readonly componentSelectMap: {
|
|
180
|
-
readonly runtime: v.GenericSchema<import("./
|
|
182
|
+
readonly runtime: v.GenericSchema<import("./condition").BuilderMatchSelectMap<Readonly<{
|
|
181
183
|
type: "parameter";
|
|
182
184
|
id: string;
|
|
183
185
|
name: string;
|
|
@@ -198,7 +200,7 @@ export declare const entitiesMap: {
|
|
|
198
200
|
}>[];
|
|
199
201
|
tags?: readonly string[] | undefined;
|
|
200
202
|
}>>>;
|
|
201
|
-
readonly serialised: v.GenericSchema<import("./
|
|
203
|
+
readonly serialised: v.GenericSchema<import("./condition").BuilderMatchSelectMap<Readonly<{
|
|
202
204
|
type: "parameter";
|
|
203
205
|
id: string;
|
|
204
206
|
name: string;
|
|
@@ -220,8 +222,8 @@ export declare const entitiesMap: {
|
|
|
220
222
|
tags?: readonly string[] | undefined;
|
|
221
223
|
}>>>;
|
|
222
224
|
};
|
|
223
|
-
readonly
|
|
224
|
-
readonly runtime: v.GenericSchema<import("./
|
|
225
|
+
readonly componentCondition: {
|
|
226
|
+
readonly runtime: v.GenericSchema<import("./condition").BuilderConditionSerialised<Readonly<{
|
|
225
227
|
details: Readonly<{
|
|
226
228
|
type: "parameter";
|
|
227
229
|
id: string;
|
|
@@ -238,7 +240,7 @@ export declare const entitiesMap: {
|
|
|
238
240
|
}>[];
|
|
239
241
|
tags?: readonly string[] | undefined;
|
|
240
242
|
}>>>;
|
|
241
|
-
readonly serialised: v.GenericSchema<import("./
|
|
243
|
+
readonly serialised: v.GenericSchema<import("./condition").BuilderConditionSerialised<Readonly<{
|
|
242
244
|
details: Readonly<{
|
|
243
245
|
type: "parameter";
|
|
244
246
|
id: string;
|
|
@@ -334,7 +336,7 @@ export declare const entitiesMap: {
|
|
|
334
336
|
}>]>;
|
|
335
337
|
};
|
|
336
338
|
readonly collectionSelectMap: {
|
|
337
|
-
readonly runtime: v.GenericSchema<import("./
|
|
339
|
+
readonly runtime: v.GenericSchema<import("./condition").BuilderMatchSelectMap<Readonly<{
|
|
338
340
|
type: "parameter";
|
|
339
341
|
id: string;
|
|
340
342
|
name: string;
|
|
@@ -365,7 +367,7 @@ export declare const entitiesMap: {
|
|
|
365
367
|
}>;
|
|
366
368
|
tags?: readonly string[] | undefined;
|
|
367
369
|
}>>>;
|
|
368
|
-
readonly serialised: v.GenericSchema<import("./
|
|
370
|
+
readonly serialised: v.GenericSchema<import("./condition").BuilderMatchSelectMap<Readonly<{
|
|
369
371
|
type: "parameter";
|
|
370
372
|
id: string;
|
|
371
373
|
name: string;
|
|
@@ -397,8 +399,8 @@ export declare const entitiesMap: {
|
|
|
397
399
|
tags?: readonly string[] | undefined;
|
|
398
400
|
}>>>;
|
|
399
401
|
};
|
|
400
|
-
readonly
|
|
401
|
-
readonly runtime: v.GenericSchema<import("./
|
|
402
|
+
readonly collectionCondition: {
|
|
403
|
+
readonly runtime: v.GenericSchema<import("./condition").BuilderConditionSerialised<Readonly<{
|
|
402
404
|
model: Readonly<{
|
|
403
405
|
type: "parameter";
|
|
404
406
|
id: string;
|
|
@@ -425,7 +427,7 @@ export declare const entitiesMap: {
|
|
|
425
427
|
}>;
|
|
426
428
|
tags?: readonly string[] | undefined;
|
|
427
429
|
}>>>;
|
|
428
|
-
readonly serialised: v.GenericSchema<import("./
|
|
430
|
+
readonly serialised: v.GenericSchema<import("./condition").BuilderConditionSerialised<Readonly<{
|
|
429
431
|
model: Readonly<{
|
|
430
432
|
type: "parameter";
|
|
431
433
|
id: string;
|
|
@@ -1393,12 +1395,77 @@ export declare const entitiesMap: {
|
|
|
1393
1395
|
readonly serialised: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
1394
1396
|
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
1395
1397
|
readonly kind: v.PicklistSchema<["option", "component", "collection"], undefined>;
|
|
1398
|
+
readonly payload: v.OptionalSchema<v.LazySchema<v.SchemaWithPipe<readonly [v.VariantSchema<"kind", [v.StrictObjectSchema<{
|
|
1399
|
+
readonly kind: v.PicklistSchema<["string", "boolean", "number"], undefined>;
|
|
1400
|
+
readonly type: v.LiteralSchema<"value", undefined>;
|
|
1401
|
+
readonly defaultValue: v.NullableSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
|
|
1402
|
+
readonly isOptional: v.BooleanSchema<undefined>;
|
|
1403
|
+
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>;
|
|
1404
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
1405
|
+
readonly kind: v.LiteralSchema<"select", undefined>;
|
|
1406
|
+
readonly options: v.SchemaWithPipe<readonly [v.TupleWithRestSchema<[v.StringSchema<undefined>], v.StringSchema<undefined>, undefined>, v.ReadonlyAction<[string, ...string[]]>]>;
|
|
1407
|
+
readonly optionLabels: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>, undefined>;
|
|
1408
|
+
readonly type: v.LiteralSchema<"value", undefined>;
|
|
1409
|
+
readonly defaultValue: v.NullableSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
|
|
1410
|
+
readonly isOptional: v.BooleanSchema<undefined>;
|
|
1411
|
+
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>;
|
|
1412
|
+
}, undefined>], undefined>, v.ReadonlyAction<{
|
|
1413
|
+
kind: "string" | "number" | "boolean";
|
|
1414
|
+
type: "value";
|
|
1415
|
+
defaultValue: string | number | boolean | null;
|
|
1416
|
+
isOptional: boolean;
|
|
1417
|
+
tags?: readonly string[] | undefined;
|
|
1418
|
+
} | {
|
|
1419
|
+
kind: "select";
|
|
1420
|
+
readonly options: readonly [string, ...string[]];
|
|
1421
|
+
optionLabels?: {
|
|
1422
|
+
[x: string]: string;
|
|
1423
|
+
} | undefined;
|
|
1424
|
+
type: "value";
|
|
1425
|
+
defaultValue: string | number | boolean | null;
|
|
1426
|
+
isOptional: boolean;
|
|
1427
|
+
tags?: readonly string[] | undefined;
|
|
1428
|
+
}>]>>, undefined>;
|
|
1396
1429
|
}, undefined>, v.ReadonlyAction<{
|
|
1397
1430
|
name: string;
|
|
1398
1431
|
kind: "option" | "component" | "collection";
|
|
1432
|
+
payload?: Readonly<{
|
|
1433
|
+
kind: "string" | "number" | "boolean";
|
|
1434
|
+
type: "value";
|
|
1435
|
+
defaultValue: string | number | boolean | null;
|
|
1436
|
+
isOptional: boolean;
|
|
1437
|
+
tags?: readonly string[] | undefined;
|
|
1438
|
+
}> | Readonly<{
|
|
1439
|
+
kind: "select";
|
|
1440
|
+
readonly options: readonly [string, ...string[]];
|
|
1441
|
+
optionLabels?: {
|
|
1442
|
+
[x: string]: string;
|
|
1443
|
+
} | undefined;
|
|
1444
|
+
type: "value";
|
|
1445
|
+
defaultValue: string | number | boolean | null;
|
|
1446
|
+
isOptional: boolean;
|
|
1447
|
+
tags?: readonly string[] | undefined;
|
|
1448
|
+
}> | undefined;
|
|
1399
1449
|
}>]>, undefined>, v.ReadonlyAction<Readonly<{
|
|
1400
1450
|
name: string;
|
|
1401
1451
|
kind: "option" | "component" | "collection";
|
|
1452
|
+
payload?: Readonly<{
|
|
1453
|
+
kind: "string" | "number" | "boolean";
|
|
1454
|
+
type: "value";
|
|
1455
|
+
defaultValue: string | number | boolean | null;
|
|
1456
|
+
isOptional: boolean;
|
|
1457
|
+
tags?: readonly string[] | undefined;
|
|
1458
|
+
}> | Readonly<{
|
|
1459
|
+
kind: "select";
|
|
1460
|
+
readonly options: readonly [string, ...string[]];
|
|
1461
|
+
optionLabels?: {
|
|
1462
|
+
[x: string]: string;
|
|
1463
|
+
} | undefined;
|
|
1464
|
+
type: "value";
|
|
1465
|
+
defaultValue: string | number | boolean | null;
|
|
1466
|
+
isOptional: boolean;
|
|
1467
|
+
tags?: readonly string[] | undefined;
|
|
1468
|
+
}> | undefined;
|
|
1402
1469
|
}>[]>]>;
|
|
1403
1470
|
};
|
|
1404
1471
|
readonly paths: {
|
|
@@ -1427,7 +1494,7 @@ export declare const validateString: (input: unknown, references?: import("./ref
|
|
|
1427
1494
|
export declare const validateBoolean: (input: unknown, references?: import("./references").BuilderReferences, issues?: import("../errors/errors").BuilderIssuesScope) => import("./validated").ValidationResult<boolean>;
|
|
1428
1495
|
export type EntitiesMap = typeof entitiesMap;
|
|
1429
1496
|
export type EntitiesSerialisedSchemas = EntitiesMap[BuilderEntityKind]['serialised'];
|
|
1430
|
-
export declare const BuilderEntityKindSchema: v.PicklistSchema<readonly ["builder", "model", "
|
|
1497
|
+
export declare const BuilderEntityKindSchema: v.PicklistSchema<readonly ["builder", "model", "value", "optionSelectMap", "optionCondition", "componentConfig", "componentSelectMap", "componentCondition", "collectionConfig", "collectionSelectMap", "collectionCondition", "ui", "uiDescribe", "uiItems", "uiPage", "uiPages", "uiInput", "pricing", "pricingRates", "expectations", "paths", "path", "number", "string", "boolean"], undefined>;
|
|
1431
1498
|
export declare const BuilderEntitySerialisedSchema: v.GenericSchema<{ [Kind in BuilderEntityKind]: v.InferOutput<EntitiesMap[Kind]["serialised"]>; }[BuilderEntityKind]>;
|
|
1432
1499
|
type SerialiseMap = {
|
|
1433
1500
|
readonly [EntityKind in keyof EntitiesMap]: (input: v.InferOutput<EntitiesMap[EntityKind]['runtime']>) => v.InferOutput<EntitiesMap[EntityKind]['serialised']>;
|
|
@@ -3,27 +3,29 @@ import { check } from '../errors/index.js';
|
|
|
3
3
|
import { BooleanSchema, NumberSchema, StringSchema } from '../primitive.js';
|
|
4
4
|
import { BuilderParameterSchema, BuilderRefSchema, isParamable } from '../references.js';
|
|
5
5
|
import { BuilderSchema, BuilderSerialisedSchema } from './builder/index.js';
|
|
6
|
-
import { BuilderCollectionConfigSchema, BuilderCollectionConfigSerialisedSchema, BuilderCollectionSchema, BuilderCollectionSelectMapSerialisedSchema,
|
|
7
|
-
import { BuilderComponentConfigSchema, BuilderComponentConfigSerialisedSchema, BuilderComponentDetailSchema, BuilderComponentSchema, BuilderComponentSelectMapSerialisedSchema,
|
|
6
|
+
import { BuilderCollectionConfigSchema, BuilderCollectionConfigSerialisedSchema, BuilderCollectionSchema, BuilderCollectionSelectMapSerialisedSchema, BuilderCollectionConditionSerialisedSchema } from './collection/index.js';
|
|
7
|
+
import { BuilderComponentConfigSchema, BuilderComponentConfigSerialisedSchema, BuilderComponentDetailSchema, BuilderComponentSchema, BuilderComponentSelectMapSerialisedSchema, BuilderComponentConditionSerialisedSchema } from './component/index.js';
|
|
8
8
|
import { BuilderExpectationSchema, BuilderExpectationsSchema, BuilderExpectationsSerialisedSchema } from './expectation.js';
|
|
9
9
|
import { builderEntityKinds, createEntityValidator } from './kind.js';
|
|
10
10
|
import { BuilderModelSchema, BuilderModelSerialisedSchema } from './model/index.js';
|
|
11
|
-
import { BuilderOptionSchema, BuilderOptionSelectMapSerialisedSchema,
|
|
11
|
+
import { BuilderOptionSchema, BuilderOptionSelectMapSerialisedSchema, BuilderOptionConditionSerialisedSchema, BuilderSelectConfigSchema, BuilderValueConfigSchema, BuilderValueConfigSerialisedSchema } from './option/index.js';
|
|
12
12
|
import { BuilderPathSchema, BuilderPathsSchema } from './paths.js';
|
|
13
13
|
import { BuilderPricingSchema, BuilderPricingSerialisedSchema, BuilderRatesSchema } from './pricing/index.js';
|
|
14
14
|
import { BuilderUIDescribeSchema, BuilderUIDescribeSerialisedSchema, BuilderUIInputSchema, BuilderUIInputSerialisedSchema, BuilderUIItemsSerialisedSchema, BuilderUIPageSchema, BuilderUIPageSerialisedSchema, BuilderUIPagesSchema, BuilderUIPagesSerialisedSchema, BuilderUISchema, BuilderUISerialisedSchema } from './ui/index.js';
|
|
15
15
|
export const entitiesMap = {
|
|
16
16
|
builder: { runtime: BuilderSchema, serialised: BuilderSerialisedSchema },
|
|
17
17
|
model: { runtime: BuilderModelSchema, serialised: BuilderModelSerialisedSchema },
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
value: {
|
|
19
|
+
runtime: v.union([BuilderValueConfigSchema, BuilderSelectConfigSchema]),
|
|
20
|
+
serialised: BuilderValueConfigSerialisedSchema
|
|
21
|
+
},
|
|
20
22
|
optionSelectMap: {
|
|
21
23
|
runtime: BuilderOptionSelectMapSerialisedSchema,
|
|
22
24
|
serialised: BuilderOptionSelectMapSerialisedSchema
|
|
23
25
|
},
|
|
24
|
-
|
|
25
|
-
runtime:
|
|
26
|
-
serialised:
|
|
26
|
+
optionCondition: {
|
|
27
|
+
runtime: BuilderOptionConditionSerialisedSchema,
|
|
28
|
+
serialised: BuilderOptionConditionSerialisedSchema
|
|
27
29
|
},
|
|
28
30
|
componentConfig: {
|
|
29
31
|
runtime: BuilderComponentConfigSchema,
|
|
@@ -33,9 +35,9 @@ export const entitiesMap = {
|
|
|
33
35
|
runtime: BuilderComponentSelectMapSerialisedSchema,
|
|
34
36
|
serialised: BuilderComponentSelectMapSerialisedSchema
|
|
35
37
|
},
|
|
36
|
-
|
|
37
|
-
runtime:
|
|
38
|
-
serialised:
|
|
38
|
+
componentCondition: {
|
|
39
|
+
runtime: BuilderComponentConditionSerialisedSchema,
|
|
40
|
+
serialised: BuilderComponentConditionSerialisedSchema
|
|
39
41
|
},
|
|
40
42
|
collectionConfig: {
|
|
41
43
|
runtime: BuilderCollectionConfigSchema,
|
|
@@ -45,9 +47,9 @@ export const entitiesMap = {
|
|
|
45
47
|
runtime: BuilderCollectionSelectMapSerialisedSchema,
|
|
46
48
|
serialised: BuilderCollectionSelectMapSerialisedSchema
|
|
47
49
|
},
|
|
48
|
-
|
|
49
|
-
runtime:
|
|
50
|
-
serialised:
|
|
50
|
+
collectionCondition: {
|
|
51
|
+
runtime: BuilderCollectionConditionSerialisedSchema,
|
|
52
|
+
serialised: BuilderCollectionConditionSerialisedSchema
|
|
51
53
|
},
|
|
52
54
|
ui: { runtime: BuilderUISchema, serialised: BuilderUISerialisedSchema },
|
|
53
55
|
uiDescribe: { runtime: BuilderUIDescribeSchema, serialised: BuilderUIDescribeSerialisedSchema },
|
|
@@ -165,22 +167,25 @@ const serialiserMap = [
|
|
|
165
167
|
max: serialiseValue(value.max),
|
|
166
168
|
tags: value.tags
|
|
167
169
|
})),
|
|
168
|
-
serialiser(
|
|
169
|
-
type: '
|
|
170
|
-
|
|
170
|
+
serialiser(BuilderValueConfigSchema, (value) => ({
|
|
171
|
+
type: 'value',
|
|
172
|
+
kind: value.kind,
|
|
171
173
|
defaultValue: value.defaultValue,
|
|
172
174
|
isOptional: value.isOptional,
|
|
173
|
-
optionLabels: value.optionLabels,
|
|
174
175
|
tags: value.tags
|
|
175
176
|
})),
|
|
176
|
-
serialiser(
|
|
177
|
-
type: '
|
|
177
|
+
serialiser(BuilderSelectConfigSchema, (value) => ({
|
|
178
|
+
type: 'value',
|
|
178
179
|
kind: value.kind,
|
|
179
180
|
defaultValue: value.defaultValue,
|
|
180
181
|
isOptional: value.isOptional,
|
|
182
|
+
options: value.options,
|
|
183
|
+
optionLabels: value.optionLabels,
|
|
181
184
|
tags: value.tags
|
|
182
185
|
})),
|
|
183
|
-
serialiser(BuilderExpectationSchema, (value) =>
|
|
186
|
+
serialiser(BuilderExpectationSchema, (value) => value.payload == null
|
|
187
|
+
? { name: value.name, kind: value.kind }
|
|
188
|
+
: { name: value.name, kind: value.kind, payload: serialiseValue(value.payload) })
|
|
184
189
|
];
|
|
185
190
|
function serialiseNamedEntry(value) {
|
|
186
191
|
const entry = {
|
|
@@ -2,7 +2,7 @@ import type { Paramable, ParamableSerialised } from '../../references';
|
|
|
2
2
|
import type { BuilderModelGeneric, BuilderModelState, BuilderModelStateOf } from '../model/index';
|
|
3
3
|
import type { BuilderPath } from '../paths';
|
|
4
4
|
import type { BuilderTags } from '../tags';
|
|
5
|
-
import type { BuilderValidPath } from '../
|
|
5
|
+
import type { BuilderValidPath } from '../condition';
|
|
6
6
|
import * as v from 'valibot';
|
|
7
7
|
export type BuilderUIInputMetadata = Paramable<Record<string, Paramable<unknown>>>;
|
|
8
8
|
export type BuilderUIInputMetadataSerialised = ParamableSerialised<Record<string, ParamableSerialised<unknown>>>;
|
|
@@ -38,7 +38,7 @@ export type BuilderInstancesValidated = Prettify<Validated<BuilderInstances>>;
|
|
|
38
38
|
export type BuilderVariantsValidated = Prettify<Validated<BuilderVariants>>;
|
|
39
39
|
export type BuilderOptionValidated = Prettify<Validated<BuilderOptionSerialised>>;
|
|
40
40
|
export type BuilderOptionsValidated = Prettify<Validated<BuilderOptionsSerialised>>;
|
|
41
|
-
export type BuilderOptionConfigValidated = BuilderValidatedMap['
|
|
41
|
+
export type BuilderOptionConfigValidated = BuilderValidatedMap['value'];
|
|
42
42
|
export type BuilderComponentValidated = Prettify<Validated<BuilderComponentSerialised>>;
|
|
43
43
|
export type BuilderComponentsValidated = Prettify<Validated<BuilderComponentsSerialised>>;
|
|
44
44
|
export type BuilderComponentConfigValidated = BuilderValidatedMap['componentConfig'];
|
package/dist/errors/errors.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare class BuilderIssuesScope {
|
|
|
12
12
|
location: BuilderIssueLocation;
|
|
13
13
|
root: unknown;
|
|
14
14
|
} & {
|
|
15
|
-
target: "string" | "number" | "boolean" | "
|
|
15
|
+
target: "string" | "number" | "boolean" | "value" | "builder" | "model" | "optionSelectMap" | "optionCondition" | "componentConfig" | "componentSelectMap" | "componentCondition" | "collectionConfig" | "collectionSelectMap" | "collectionCondition" | "ui" | "uiDescribe" | "uiItems" | "uiPage" | "uiPages" | "uiInput" | "pricing" | "pricingRates" | "expectations" | "paths" | "path";
|
|
16
16
|
};
|
|
17
17
|
entityEmptyLabel(): {
|
|
18
18
|
kind: "entity-empty-label";
|
|
@@ -49,8 +49,8 @@ export declare class BuilderIssuesScope {
|
|
|
49
49
|
location: BuilderIssueLocation;
|
|
50
50
|
root: unknown;
|
|
51
51
|
} & object;
|
|
52
|
-
|
|
53
|
-
kind: "entity-invalid-
|
|
52
|
+
entityInvalidValueDefault(): {
|
|
53
|
+
kind: "entity-invalid-value-default";
|
|
54
54
|
location: BuilderIssueLocation;
|
|
55
55
|
root: unknown;
|
|
56
56
|
} & object;
|
|
@@ -104,6 +104,11 @@ export declare class BuilderIssuesScope {
|
|
|
104
104
|
location: BuilderIssueLocation;
|
|
105
105
|
root: unknown;
|
|
106
106
|
} & object;
|
|
107
|
+
modelInvalidExpectation(): {
|
|
108
|
+
kind: "model-invalid-expectation";
|
|
109
|
+
location: BuilderIssueLocation;
|
|
110
|
+
root: unknown;
|
|
111
|
+
} & object;
|
|
107
112
|
modelEmptyComponents(): {
|
|
108
113
|
kind: "model-empty-components";
|
|
109
114
|
location: BuilderIssueLocation;
|
package/dist/errors/errors.js
CHANGED
|
@@ -45,8 +45,8 @@ export class BuilderIssuesScope {
|
|
|
45
45
|
entityInvalidSelectLabel() {
|
|
46
46
|
return this.#addError('entity-invalid-select-label');
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
return this.#addError('entity-invalid-
|
|
48
|
+
entityInvalidValueDefault() {
|
|
49
|
+
return this.#addError('entity-invalid-value-default');
|
|
50
50
|
}
|
|
51
51
|
entityDuplicateDetail() {
|
|
52
52
|
return this.#addError('entity-duplicate-detail');
|
|
@@ -78,6 +78,9 @@ export class BuilderIssuesScope {
|
|
|
78
78
|
modelUnmetExpectation() {
|
|
79
79
|
return this.#addError('model-unmet-expectation');
|
|
80
80
|
}
|
|
81
|
+
modelInvalidExpectation() {
|
|
82
|
+
return this.#addError('model-invalid-expectation');
|
|
83
|
+
}
|
|
81
84
|
modelEmptyComponents() {
|
|
82
85
|
return this.#addError('model-empty-components');
|
|
83
86
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from './public.js';
|
|
2
|
-
export { BuilderCollectionConfigSchema, BuilderCollectionConfigSerialisedSchema, BuilderCollectionSchema, BuilderCollectionSelectMapSerialisedSchema, BuilderCollectionSerialisedSchema, BuilderCollectionsSerialisedSchema,
|
|
2
|
+
export { BuilderCollectionConfigSchema, BuilderCollectionConfigSerialisedSchema, BuilderCollectionSchema, BuilderCollectionSelectMapSerialisedSchema, BuilderCollectionSerialisedSchema, BuilderCollectionsSerialisedSchema, BuilderCollectionConditionSerialisedSchema, BuilderComponentConfigSchema, BuilderComponentConfigSerialisedSchema, BuilderComponentDetailSchema, BuilderComponentDetailSerialisedSchema, BuilderComponentDetailsSchema, BuilderComponentDetailsSerialisedSchema, BuilderComponentDetailKindSchema, BuilderComponentSchema, BuilderComponentSelectMapSerialisedSchema, BuilderComponentSerialisedSchema, BuilderComponentsSerialisedSchema, BuilderComponentConditionSerialisedSchema, BuilderDescriptionItemSchema, BuilderDescriptionSchema, BuilderEntityKindSchema, BuilderEntitySerialisedSchema, BuilderExpectationKindSchema, BuilderExpectationSchema, BuilderExpectationSerialisedSchema, BuilderExpectationsSchema, BuilderExpectationsSerialisedSchema, BuilderModelSchema, BuilderModelSerialisedSchema, BuilderOptionConfigSchema, BuilderOptionConfigSerialisedSchema, BuilderOptionSchema, BuilderOptionSelectMapSerialisedSchema, BuilderOptionSerialisedSchema, BuilderOptionsSerialisedSchema, BuilderOptionConditionSerialisedSchema, BuilderPathSchema, BuilderPathsSchema, BuilderReferenceSchema, BuilderReferencesSchema, BuilderSchema, BuilderSerialisedSchema, BuilderSelectConfigSchema, BuilderValueConfigSchema, BuilderValueConfigSerialisedSchema, BuilderUIDescribeSchema, BuilderUIDescribeSerialisedSchema, BuilderUIItemSerialisedSchema, BuilderUIItemsSerialisedSchema, BuilderUIPageSchema, BuilderUIPageSerialisedSchema, BuilderUIPagesSchema, BuilderUIPagesSerialisedSchema, BuilderUISchema, BuilderUISerialisedSchema, BuilderConditionConfigSchema, BuilderConditionMatchSchema, BuilderConditionUnlessSchema } from './entities/index.js';
|
|
3
3
|
export { BuilderEnvironmentSchema } from './environment.js';
|
|
4
4
|
export { BuilderComponentVariantsSchema, BuilderVariantsSchema } from './instance.js';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from './public.js';
|
|
2
|
-
export { BuilderCollectionConfigSchema, BuilderCollectionConfigSerialisedSchema, BuilderCollectionSchema, BuilderCollectionSelectMapSerialisedSchema, BuilderCollectionSerialisedSchema, BuilderCollectionsSerialisedSchema,
|
|
2
|
+
export { BuilderCollectionConfigSchema, BuilderCollectionConfigSerialisedSchema, BuilderCollectionSchema, BuilderCollectionSelectMapSerialisedSchema, BuilderCollectionSerialisedSchema, BuilderCollectionsSerialisedSchema, BuilderCollectionConditionSerialisedSchema, BuilderComponentConfigSchema, BuilderComponentConfigSerialisedSchema, BuilderComponentDetailSchema, BuilderComponentDetailSerialisedSchema, BuilderComponentDetailsSchema, BuilderComponentDetailsSerialisedSchema, BuilderComponentDetailKindSchema, BuilderComponentSchema, BuilderComponentSelectMapSerialisedSchema, BuilderComponentSerialisedSchema, BuilderComponentsSerialisedSchema, BuilderComponentConditionSerialisedSchema, BuilderDescriptionItemSchema, BuilderDescriptionSchema, BuilderEntityKindSchema, BuilderEntitySerialisedSchema, BuilderExpectationKindSchema, BuilderExpectationSchema, BuilderExpectationSerialisedSchema, BuilderExpectationsSchema, BuilderExpectationsSerialisedSchema, BuilderModelSchema, BuilderModelSerialisedSchema, BuilderOptionConfigSchema, BuilderOptionConfigSerialisedSchema, BuilderOptionSchema, BuilderOptionSelectMapSerialisedSchema, BuilderOptionSerialisedSchema, BuilderOptionsSerialisedSchema, BuilderOptionConditionSerialisedSchema, BuilderPathSchema, BuilderPathsSchema, BuilderReferenceSchema, BuilderReferencesSchema, BuilderSchema, BuilderSerialisedSchema, BuilderSelectConfigSchema, BuilderValueConfigSchema, BuilderValueConfigSerialisedSchema, BuilderUIDescribeSchema, BuilderUIDescribeSerialisedSchema, BuilderUIItemSerialisedSchema, BuilderUIItemsSerialisedSchema, BuilderUIPageSchema, BuilderUIPageSerialisedSchema, BuilderUIPagesSchema, BuilderUIPagesSerialisedSchema, BuilderUISchema, BuilderUISerialisedSchema, BuilderConditionConfigSchema, BuilderConditionMatchSchema, BuilderConditionUnlessSchema } from './entities/index.js';
|
|
3
3
|
export { BuilderEnvironmentSchema } from './environment.js';
|
|
4
4
|
export { BuilderComponentVariantsSchema, BuilderVariantsSchema } from './instance.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BuilderPathSchema, BuilderPathsSchema,
|
|
1
|
+
import { BuilderPathSchema, BuilderPathsSchema, BuilderConditionMatchSchema, BuilderConditionUnlessSchema } from '../entities/index.js';
|
|
2
2
|
import { check } from '../errors/index.js';
|
|
3
3
|
export function dependencies(model) {
|
|
4
4
|
const entries = [...model.options, ...model.collections, ...model.components];
|
|
@@ -31,11 +31,12 @@ export function dependencies(model) {
|
|
|
31
31
|
export function dependencyKeys(payload, paths = []) {
|
|
32
32
|
const conditionPaths = check.is(BuilderPathsSchema, paths) ? paths : [];
|
|
33
33
|
const keys = new Set(conditionPaths.map(([first]) => String(first)));
|
|
34
|
-
if (check.is(
|
|
34
|
+
if (check.is(BuilderConditionMatchSchema, payload) &&
|
|
35
|
+
check.is(BuilderPathSchema, payload.matchPath)) {
|
|
35
36
|
const [firstMatchSegment] = payload.matchPath;
|
|
36
37
|
keys.add(String(firstMatchSegment));
|
|
37
38
|
}
|
|
38
|
-
else if (check.is(
|
|
39
|
+
else if (check.is(BuilderConditionUnlessSchema, payload) &&
|
|
39
40
|
check.is(BuilderPathSchema, payload.unlessPath)) {
|
|
40
41
|
const [firstUnlessSegment] = payload.unlessPath;
|
|
41
42
|
keys.add(String(firstUnlessSegment));
|