@builder-builder/builder 0.0.27 → 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 +9 -10
- package/dist/client/client.d.ts +2 -1
- package/dist/client/client.js +4 -1
- package/dist/client/public.d.ts +2 -2
- package/dist/client/public.js +1 -1
- package/dist/client/schema.d.ts +126 -45
- package/dist/client/schema.js +6 -1
- 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/BuilderRender.svelte.d.ts +2 -2
- package/dist/components/index.d.ts +8 -8
- package/dist/components/index.js +4376 -4258
- package/dist/components/index.min.js +3 -0
- package/dist/entities/collection/collection.d.ts +191 -401
- package/dist/entities/collection/collection.js +7 -4
- package/dist/entities/collection/{when.d.ts → condition.d.ts} +4 -5
- package/dist/entities/collection/condition.js +2 -0
- package/dist/entities/collection/config.d.ts +62 -80
- package/dist/entities/collection/index.d.ts +4 -4
- package/dist/entities/collection/index.js +2 -2
- package/dist/entities/component/component.d.ts +71 -83
- package/dist/entities/component/component.js +4 -4
- package/dist/entities/component/condition.d.ts +10 -0
- package/dist/entities/component/{when.js → condition.js} +3 -9
- package/dist/entities/component/config.d.ts +33 -33
- package/dist/entities/component/config.js +18 -16
- package/dist/entities/component/detail.d.ts +61 -0
- package/dist/entities/component/detail.js +71 -0
- package/dist/entities/component/index.d.ts +6 -6
- package/dist/entities/component/index.js +3 -3
- package/dist/entities/{when.d.ts → condition.d.ts} +23 -36
- 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 +9 -9
- package/dist/entities/index.js +4 -4
- package/dist/entities/kind.d.ts +4 -4
- package/dist/entities/kind.js +24 -25
- 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 +47 -72
- 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 +179 -210
- 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/paths.d.ts +2 -2
- package/dist/entities/pricing/expression.d.ts +16 -39
- package/dist/entities/pricing/expression.js +1 -16
- package/dist/entities/pricing/index.d.ts +1 -1
- package/dist/entities/pricing/rates.d.ts +1 -1
- package/dist/entities/references.d.ts +124 -84
- package/dist/entities/serialise.d.ts +175 -109
- package/dist/entities/serialise.js +32 -27
- package/dist/entities/ui/describe.d.ts +1 -1
- package/dist/entities/ui/input.d.ts +2 -2
- package/dist/entities/ui/page.d.ts +1 -1
- package/dist/entities/ui/pages.d.ts +2 -2
- package/dist/entities/validated.d.ts +3 -3
- package/dist/environment.d.ts +2 -2
- package/dist/errors/errors.d.ts +94 -58
- package/dist/errors/errors.js +41 -7
- package/dist/errors/exception.d.ts +3 -3
- package/dist/errors/index.d.ts +1 -1
- package/dist/errors/index.js +1 -1
- package/dist/errors/public.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/instance.d.ts +53 -9
- package/dist/instance.js +6 -2
- package/dist/mappers/dependencies.d.ts +3 -0
- package/dist/mappers/dependencies.js +45 -0
- package/dist/mappers/index.d.ts +2 -2
- package/dist/mappers/index.js +2 -1
- package/dist/mappers/instance.js +26 -21
- package/dist/mappers/price.js +6 -4
- package/dist/mappers/resolve.js +23 -22
- package/dist/mappers/variants/index.d.ts +1 -2
- package/dist/mappers/variants/index.js +1 -2
- package/dist/mappers/variants/option-graph.d.ts +1 -2
- package/dist/mappers/variants/option-graph.js +4 -18
- package/dist/mappers/variants/variants.d.ts +3 -6
- package/dist/mappers/variants/variants.js +34 -11
- package/dist/primitive.d.ts +3 -0
- package/dist/primitive.js +2 -0
- package/dist/public.d.ts +20 -20
- package/dist/public.js +17 -9
- package/dist/validate/builder.d.ts +2 -2
- package/dist/validate/builder.js +15 -15
- package/dist/validate/expectations.d.ts +2 -2
- package/dist/validate/expectations.js +23 -5
- package/dist/validate/instance.d.ts +2 -2
- package/dist/validate/instance.js +31 -13
- package/dist/validate/model.d.ts +4 -4
- package/dist/validate/model.js +57 -51
- package/dist/validate/paths.d.ts +2 -2
- package/dist/validate/paths.js +19 -14
- package/dist/validate/pricing.d.ts +4 -4
- package/dist/validate/pricing.js +31 -31
- package/dist/validate/resolve.d.ts +2 -2
- package/dist/validate/resolve.js +27 -31
- package/dist/validate/ui.d.ts +4 -4
- package/dist/validate/ui.js +38 -38
- package/dist/validate/variants.d.ts +3 -3
- package/dist/validate/variants.js +32 -31
- package/package.json +4 -2
- 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/component/field.d.ts +0 -59
- package/dist/entities/component/field.js +0 -52
- package/dist/entities/component/when.d.ts +0 -11
- package/dist/entities/option/toggle.d.ts +0 -45
- package/dist/entities/option/toggle.js +0 -66
- package/dist/entities/option/when.d.ts +0 -10
- package/dist/entities/option/when.js +0 -2
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Paramable } from '../../references';
|
|
2
2
|
import type { BuilderPaths } from '../paths';
|
|
3
3
|
import type { BuilderTags } from '../tags';
|
|
4
|
-
import type {
|
|
4
|
+
import type { BuilderConditionSerialised } from '../condition';
|
|
5
5
|
import type { BuilderComponentConfig, BuilderComponentConfigSerialised } from './config';
|
|
6
|
-
import type {
|
|
6
|
+
import type { BuilderComponentCondition } from './condition';
|
|
7
7
|
import * as v from 'valibot';
|
|
8
|
-
export type BuilderComponentPayload = BuilderComponentConfig |
|
|
8
|
+
export type BuilderComponentPayload = BuilderComponentConfig | BuilderComponentCondition;
|
|
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;
|
|
@@ -17,8 +17,8 @@ export declare class BuilderComponent<const Name extends string = string, const
|
|
|
17
17
|
}
|
|
18
18
|
export declare const BuilderComponentSchema: v.InstanceSchema<typeof BuilderComponent, undefined>;
|
|
19
19
|
export type BuilderComponents = ReadonlyArray<BuilderComponent>;
|
|
20
|
-
export declare const
|
|
21
|
-
|
|
20
|
+
export declare const BuilderComponentConditionSerialisedSchema: v.GenericSchema<BuilderConditionSerialised<Readonly<{
|
|
21
|
+
details: Readonly<{
|
|
22
22
|
type: "parameter";
|
|
23
23
|
id: string;
|
|
24
24
|
name: string;
|
|
@@ -26,21 +26,21 @@ export declare const BuilderComponentWhenSerialisedSchema: v.GenericSchema<Build
|
|
|
26
26
|
type: "ref";
|
|
27
27
|
id: string;
|
|
28
28
|
}> | readonly Readonly<{
|
|
29
|
-
type: "component-
|
|
29
|
+
type: "component-detail";
|
|
30
30
|
name: string;
|
|
31
|
-
|
|
31
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
32
32
|
isOptional: boolean;
|
|
33
33
|
tags?: readonly string[] | undefined;
|
|
34
34
|
}>[];
|
|
35
35
|
tags?: readonly string[] | undefined;
|
|
36
36
|
}>>>;
|
|
37
|
-
export type
|
|
37
|
+
export type BuilderComponentConditionSerialised = BuilderConditionSerialised<BuilderComponentConfigSerialised>;
|
|
38
38
|
export declare const BuilderComponentSelectMapSerialisedSchema: v.GenericSchema<import("..").BuilderMatchSelectMap<Readonly<{
|
|
39
39
|
type: "parameter";
|
|
40
40
|
id: string;
|
|
41
41
|
name: string;
|
|
42
42
|
}> | Readonly<{
|
|
43
|
-
|
|
43
|
+
details: Readonly<{
|
|
44
44
|
type: "parameter";
|
|
45
45
|
id: string;
|
|
46
46
|
name: string;
|
|
@@ -48,9 +48,9 @@ export declare const BuilderComponentSelectMapSerialisedSchema: v.GenericSchema<
|
|
|
48
48
|
type: "ref";
|
|
49
49
|
id: string;
|
|
50
50
|
}> | readonly Readonly<{
|
|
51
|
-
type: "component-
|
|
51
|
+
type: "component-detail";
|
|
52
52
|
name: string;
|
|
53
|
-
|
|
53
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
54
54
|
isOptional: boolean;
|
|
55
55
|
tags?: readonly string[] | undefined;
|
|
56
56
|
}>[];
|
|
@@ -73,7 +73,7 @@ export declare const BuilderComponentSerialisedSchema: v.SchemaWithPipe<readonly
|
|
|
73
73
|
type: "ref";
|
|
74
74
|
id: string;
|
|
75
75
|
}>]>, v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
76
|
-
readonly
|
|
76
|
+
readonly details: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
77
77
|
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
78
78
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
79
79
|
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
@@ -88,27 +88,27 @@ export declare const BuilderComponentSerialisedSchema: v.SchemaWithPipe<readonly
|
|
|
88
88
|
type: "ref";
|
|
89
89
|
id: string;
|
|
90
90
|
}>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
91
|
-
readonly type: v.LiteralSchema<"component-
|
|
91
|
+
readonly type: v.LiteralSchema<"component-detail", undefined>;
|
|
92
92
|
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
93
|
-
readonly
|
|
93
|
+
readonly kind: v.PicklistSchema<["string", "boolean", "number", "price", "image"], undefined>;
|
|
94
94
|
readonly isOptional: v.BooleanSchema<undefined>;
|
|
95
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
|
-
type: "component-
|
|
97
|
+
type: "component-detail";
|
|
98
98
|
name: string;
|
|
99
|
-
|
|
99
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
100
100
|
isOptional: boolean;
|
|
101
101
|
tags?: readonly string[] | undefined;
|
|
102
102
|
}>]>, undefined>, v.ReadonlyAction<Readonly<{
|
|
103
|
-
type: "component-
|
|
103
|
+
type: "component-detail";
|
|
104
104
|
name: string;
|
|
105
|
-
|
|
105
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
106
106
|
isOptional: boolean;
|
|
107
107
|
tags?: readonly string[] | undefined;
|
|
108
108
|
}>[]>]>], undefined>;
|
|
109
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
|
+
details: Readonly<{
|
|
112
112
|
type: "parameter";
|
|
113
113
|
id: string;
|
|
114
114
|
name: string;
|
|
@@ -116,15 +116,15 @@ export declare const BuilderComponentSerialisedSchema: v.SchemaWithPipe<readonly
|
|
|
116
116
|
type: "ref";
|
|
117
117
|
id: string;
|
|
118
118
|
}> | readonly Readonly<{
|
|
119
|
-
type: "component-
|
|
119
|
+
type: "component-detail";
|
|
120
120
|
name: string;
|
|
121
|
-
|
|
121
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
122
122
|
isOptional: boolean;
|
|
123
123
|
tags?: readonly string[] | undefined;
|
|
124
124
|
}>[];
|
|
125
125
|
tags?: readonly string[] | undefined;
|
|
126
|
-
}>]>, v.GenericSchema<
|
|
127
|
-
|
|
126
|
+
}>]>, v.GenericSchema<BuilderConditionSerialised<Readonly<{
|
|
127
|
+
details: Readonly<{
|
|
128
128
|
type: "parameter";
|
|
129
129
|
id: string;
|
|
130
130
|
name: string;
|
|
@@ -132,9 +132,9 @@ export declare const BuilderComponentSerialisedSchema: v.SchemaWithPipe<readonly
|
|
|
132
132
|
type: "ref";
|
|
133
133
|
id: string;
|
|
134
134
|
}> | readonly Readonly<{
|
|
135
|
-
type: "component-
|
|
135
|
+
type: "component-detail";
|
|
136
136
|
name: string;
|
|
137
|
-
|
|
137
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
138
138
|
isOptional: boolean;
|
|
139
139
|
tags?: readonly string[] | undefined;
|
|
140
140
|
}>[];
|
|
@@ -166,7 +166,7 @@ export declare const BuilderComponentSerialisedSchema: v.SchemaWithPipe<readonly
|
|
|
166
166
|
type: "ref";
|
|
167
167
|
id: string;
|
|
168
168
|
}> | Readonly<{
|
|
169
|
-
|
|
169
|
+
details: Readonly<{
|
|
170
170
|
type: "parameter";
|
|
171
171
|
id: string;
|
|
172
172
|
name: string;
|
|
@@ -174,15 +174,15 @@ export declare const BuilderComponentSerialisedSchema: v.SchemaWithPipe<readonly
|
|
|
174
174
|
type: "ref";
|
|
175
175
|
id: string;
|
|
176
176
|
}> | readonly Readonly<{
|
|
177
|
-
type: "component-
|
|
177
|
+
type: "component-detail";
|
|
178
178
|
name: string;
|
|
179
|
-
|
|
179
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
180
180
|
isOptional: boolean;
|
|
181
181
|
tags?: readonly string[] | undefined;
|
|
182
182
|
}>[];
|
|
183
183
|
tags?: readonly string[] | undefined;
|
|
184
|
-
}> |
|
|
185
|
-
|
|
184
|
+
}> | BuilderConditionSerialised<Readonly<{
|
|
185
|
+
details: Readonly<{
|
|
186
186
|
type: "parameter";
|
|
187
187
|
id: string;
|
|
188
188
|
name: string;
|
|
@@ -190,9 +190,9 @@ export declare const BuilderComponentSerialisedSchema: v.SchemaWithPipe<readonly
|
|
|
190
190
|
type: "ref";
|
|
191
191
|
id: string;
|
|
192
192
|
}> | readonly Readonly<{
|
|
193
|
-
type: "component-
|
|
193
|
+
type: "component-detail";
|
|
194
194
|
name: string;
|
|
195
|
-
|
|
195
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
196
196
|
isOptional: boolean;
|
|
197
197
|
tags?: readonly string[] | undefined;
|
|
198
198
|
}>[];
|
|
@@ -226,7 +226,7 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
|
|
|
226
226
|
type: "ref";
|
|
227
227
|
id: string;
|
|
228
228
|
}>]>, v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
229
|
-
readonly
|
|
229
|
+
readonly details: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
230
230
|
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
231
231
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
232
232
|
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
@@ -241,27 +241,27 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
|
|
|
241
241
|
type: "ref";
|
|
242
242
|
id: string;
|
|
243
243
|
}>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
244
|
-
readonly type: v.LiteralSchema<"component-
|
|
244
|
+
readonly type: v.LiteralSchema<"component-detail", undefined>;
|
|
245
245
|
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
246
|
-
readonly
|
|
246
|
+
readonly kind: v.PicklistSchema<["string", "boolean", "number", "price", "image"], undefined>;
|
|
247
247
|
readonly isOptional: v.BooleanSchema<undefined>;
|
|
248
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
|
-
type: "component-
|
|
250
|
+
type: "component-detail";
|
|
251
251
|
name: string;
|
|
252
|
-
|
|
252
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
253
253
|
isOptional: boolean;
|
|
254
254
|
tags?: readonly string[] | undefined;
|
|
255
255
|
}>]>, undefined>, v.ReadonlyAction<Readonly<{
|
|
256
|
-
type: "component-
|
|
256
|
+
type: "component-detail";
|
|
257
257
|
name: string;
|
|
258
|
-
|
|
258
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
259
259
|
isOptional: boolean;
|
|
260
260
|
tags?: readonly string[] | undefined;
|
|
261
261
|
}>[]>]>], undefined>;
|
|
262
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
|
+
details: Readonly<{
|
|
265
265
|
type: "parameter";
|
|
266
266
|
id: string;
|
|
267
267
|
name: string;
|
|
@@ -269,15 +269,15 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
|
|
|
269
269
|
type: "ref";
|
|
270
270
|
id: string;
|
|
271
271
|
}> | readonly Readonly<{
|
|
272
|
-
type: "component-
|
|
272
|
+
type: "component-detail";
|
|
273
273
|
name: string;
|
|
274
|
-
|
|
274
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
275
275
|
isOptional: boolean;
|
|
276
276
|
tags?: readonly string[] | undefined;
|
|
277
277
|
}>[];
|
|
278
278
|
tags?: readonly string[] | undefined;
|
|
279
|
-
}>]>, v.GenericSchema<
|
|
280
|
-
|
|
279
|
+
}>]>, v.GenericSchema<BuilderConditionSerialised<Readonly<{
|
|
280
|
+
details: Readonly<{
|
|
281
281
|
type: "parameter";
|
|
282
282
|
id: string;
|
|
283
283
|
name: string;
|
|
@@ -285,9 +285,9 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
|
|
|
285
285
|
type: "ref";
|
|
286
286
|
id: string;
|
|
287
287
|
}> | readonly Readonly<{
|
|
288
|
-
type: "component-
|
|
288
|
+
type: "component-detail";
|
|
289
289
|
name: string;
|
|
290
|
-
|
|
290
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
291
291
|
isOptional: boolean;
|
|
292
292
|
tags?: readonly string[] | undefined;
|
|
293
293
|
}>[];
|
|
@@ -319,7 +319,7 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
|
|
|
319
319
|
type: "ref";
|
|
320
320
|
id: string;
|
|
321
321
|
}> | Readonly<{
|
|
322
|
-
|
|
322
|
+
details: Readonly<{
|
|
323
323
|
type: "parameter";
|
|
324
324
|
id: string;
|
|
325
325
|
name: string;
|
|
@@ -327,15 +327,15 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
|
|
|
327
327
|
type: "ref";
|
|
328
328
|
id: string;
|
|
329
329
|
}> | readonly Readonly<{
|
|
330
|
-
type: "component-
|
|
330
|
+
type: "component-detail";
|
|
331
331
|
name: string;
|
|
332
|
-
|
|
332
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
333
333
|
isOptional: boolean;
|
|
334
334
|
tags?: readonly string[] | undefined;
|
|
335
335
|
}>[];
|
|
336
336
|
tags?: readonly string[] | undefined;
|
|
337
|
-
}> |
|
|
338
|
-
|
|
337
|
+
}> | BuilderConditionSerialised<Readonly<{
|
|
338
|
+
details: Readonly<{
|
|
339
339
|
type: "parameter";
|
|
340
340
|
id: string;
|
|
341
341
|
name: string;
|
|
@@ -343,9 +343,9 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
|
|
|
343
343
|
type: "ref";
|
|
344
344
|
id: string;
|
|
345
345
|
}> | readonly Readonly<{
|
|
346
|
-
type: "component-
|
|
346
|
+
type: "component-detail";
|
|
347
347
|
name: string;
|
|
348
|
-
|
|
348
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
349
349
|
isOptional: boolean;
|
|
350
350
|
tags?: readonly string[] | undefined;
|
|
351
351
|
}>[];
|
|
@@ -370,7 +370,7 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
|
|
|
370
370
|
type: "ref";
|
|
371
371
|
id: string;
|
|
372
372
|
}> | Readonly<{
|
|
373
|
-
|
|
373
|
+
details: Readonly<{
|
|
374
374
|
type: "parameter";
|
|
375
375
|
id: string;
|
|
376
376
|
name: string;
|
|
@@ -378,15 +378,15 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
|
|
|
378
378
|
type: "ref";
|
|
379
379
|
id: string;
|
|
380
380
|
}> | readonly Readonly<{
|
|
381
|
-
type: "component-
|
|
381
|
+
type: "component-detail";
|
|
382
382
|
name: string;
|
|
383
|
-
|
|
383
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
384
384
|
isOptional: boolean;
|
|
385
385
|
tags?: readonly string[] | undefined;
|
|
386
386
|
}>[];
|
|
387
387
|
tags?: readonly string[] | undefined;
|
|
388
|
-
}> |
|
|
389
|
-
|
|
388
|
+
}> | BuilderConditionSerialised<Readonly<{
|
|
389
|
+
details: Readonly<{
|
|
390
390
|
type: "parameter";
|
|
391
391
|
id: string;
|
|
392
392
|
name: string;
|
|
@@ -394,9 +394,9 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
|
|
|
394
394
|
type: "ref";
|
|
395
395
|
id: string;
|
|
396
396
|
}> | readonly Readonly<{
|
|
397
|
-
type: "component-
|
|
397
|
+
type: "component-detail";
|
|
398
398
|
name: string;
|
|
399
|
-
|
|
399
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
400
400
|
isOptional: boolean;
|
|
401
401
|
tags?: readonly string[] | undefined;
|
|
402
402
|
}>[];
|
|
@@ -413,27 +413,15 @@ 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
|
|
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
|
-
} | {
|
|
416
|
+
export declare const validateComponentCondition: (input: unknown, references?: import("..").BuilderReferences, issues?: import("../../errors").BuilderIssuesScope) => import("..").ValidationResult<{
|
|
429
417
|
readonly type: "match";
|
|
430
418
|
readonly matchPath: readonly (string | number)[];
|
|
431
419
|
readonly selectMap: {
|
|
432
420
|
readonly [x: string]: {
|
|
433
|
-
readonly
|
|
434
|
-
readonly type: "component-
|
|
421
|
+
readonly details: readonly {
|
|
422
|
+
readonly type: "component-detail";
|
|
435
423
|
readonly name: string;
|
|
436
|
-
readonly
|
|
424
|
+
readonly kind: "string" | "number" | "boolean" | "price" | "image";
|
|
437
425
|
readonly isOptional: boolean;
|
|
438
426
|
readonly tags?: readonly string[] | undefined;
|
|
439
427
|
}[];
|
|
@@ -445,22 +433,22 @@ export declare const validateComponentWhen: (input: unknown, references?: import
|
|
|
445
433
|
readonly unlessPath: readonly (string | number)[];
|
|
446
434
|
readonly disabledValues: readonly (string | number | boolean | null)[];
|
|
447
435
|
readonly payload: {
|
|
448
|
-
readonly
|
|
449
|
-
readonly type: "component-
|
|
436
|
+
readonly details: readonly {
|
|
437
|
+
readonly type: "component-detail";
|
|
450
438
|
readonly name: string;
|
|
451
|
-
readonly
|
|
439
|
+
readonly kind: "string" | "number" | "boolean" | "price" | "image";
|
|
452
440
|
readonly isOptional: boolean;
|
|
453
441
|
readonly tags?: readonly string[] | undefined;
|
|
454
442
|
}[];
|
|
455
443
|
readonly tags?: readonly string[] | undefined;
|
|
456
444
|
};
|
|
457
445
|
}>;
|
|
458
|
-
export declare const validateComponentSelectMap: (input: unknown, references?: import("..").BuilderReferences,
|
|
446
|
+
export declare const validateComponentSelectMap: (input: unknown, references?: import("..").BuilderReferences, issues?: import("../../errors").BuilderIssuesScope) => import("..").ValidationResult<{
|
|
459
447
|
readonly [x: string]: {
|
|
460
|
-
readonly
|
|
461
|
-
readonly type: "component-
|
|
448
|
+
readonly details: readonly {
|
|
449
|
+
readonly type: "component-detail";
|
|
462
450
|
readonly name: string;
|
|
463
|
-
readonly
|
|
451
|
+
readonly kind: "string" | "number" | "boolean" | "price" | "image";
|
|
464
452
|
readonly isOptional: boolean;
|
|
465
453
|
readonly tags?: readonly string[] | undefined;
|
|
466
454
|
}[];
|
|
@@ -5,7 +5,7 @@ import { createEntityValidator } from '../kind.js';
|
|
|
5
5
|
import { BuilderPathsSchema } from '../paths.js';
|
|
6
6
|
import { serialisable } from '../serialisable.js';
|
|
7
7
|
import { BuilderTagsSchema } from '../tags.js';
|
|
8
|
-
import { createSelectMapSerialisedSchema,
|
|
8
|
+
import { createSelectMapSerialisedSchema, createConditionSerialisedSchema } from '../condition.js';
|
|
9
9
|
import { BuilderComponentConfigSerialisedSchema } from './config.js';
|
|
10
10
|
export class BuilderComponent {
|
|
11
11
|
name;
|
|
@@ -23,14 +23,14 @@ export class BuilderComponent {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
export const BuilderComponentSchema = v.instance(BuilderComponent);
|
|
26
|
-
export const
|
|
26
|
+
export const BuilderComponentConditionSerialisedSchema = createConditionSerialisedSchema(BuilderComponentConfigSerialisedSchema);
|
|
27
27
|
export const BuilderComponentSelectMapSerialisedSchema = createSelectMapSerialisedSchema(BuilderComponentConfigSerialisedSchema);
|
|
28
28
|
export const BuilderComponentSerialisedSchema = serialisable(v.object({
|
|
29
29
|
name: NameSchema,
|
|
30
|
-
payload: paramable(v.union([BuilderComponentConfigSerialisedSchema,
|
|
30
|
+
payload: paramable(v.union([BuilderComponentConfigSerialisedSchema, BuilderComponentConditionSerialisedSchema])),
|
|
31
31
|
paths: v.optional(paramable(BuilderPathsSchema)),
|
|
32
32
|
tags: v.optional(BuilderTagsSchema)
|
|
33
33
|
}));
|
|
34
34
|
export const BuilderComponentsSerialisedSchema = v.pipe(v.array(BuilderComponentSerialisedSchema), v.readonly());
|
|
35
|
-
export const
|
|
35
|
+
export const validateComponentCondition = createEntityValidator('componentCondition', BuilderComponentConditionSerialisedSchema);
|
|
36
36
|
export const validateComponentSelectMap = createEntityValidator('componentSelectMap', BuilderComponentSelectMapSerialisedSchema);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BuilderPrimitivesNonEmpty } from '../../primitive';
|
|
2
|
+
import type { Paramable } from '../../references';
|
|
3
|
+
import type { BuilderPath } from '../paths';
|
|
4
|
+
import type { BuilderMatchConfig, BuilderMatchSelectMap, BuilderUnlessConfig, BuilderCondition } from '../condition';
|
|
5
|
+
import type { BuilderComponentConfig } from './config';
|
|
6
|
+
export type BuilderComponentCondition = BuilderCondition<Paramable<BuilderComponentConfig>, Paramable<BuilderPath>, Paramable<Record<string, Paramable<BuilderComponentConfig> | null>>, Paramable<BuilderPath>>;
|
|
7
|
+
export declare const componentCondition: {
|
|
8
|
+
match: <const Payload extends Paramable<BuilderComponentConfig>, const MatchPath extends Paramable<BuilderPath>, const SelectMap extends Paramable<BuilderMatchSelectMap<Paramable<BuilderComponentConfig>>>>(matchPath: MatchPath, selectMap: SelectMap) => BuilderMatchConfig<Payload, MatchPath, SelectMap>;
|
|
9
|
+
unless: <const UnlessPath extends Paramable<BuilderPath>, const Payload extends Paramable<BuilderComponentConfig>>(unlessPath: UnlessPath, disabledValues: BuilderPrimitivesNonEmpty, payload?: Payload) => BuilderUnlessConfig<Payload, UnlessPath>;
|
|
10
|
+
};
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createConditionFactories } from '../condition.js';
|
|
2
2
|
import { componentConfig } from './config.js';
|
|
3
|
-
const baseFactories =
|
|
4
|
-
export const
|
|
5
|
-
enable: (payload) => {
|
|
6
|
-
return {
|
|
7
|
-
type: 'enable',
|
|
8
|
-
payload: (payload ?? componentConfig())
|
|
9
|
-
};
|
|
10
|
-
},
|
|
3
|
+
const baseFactories = createConditionFactories();
|
|
4
|
+
export const componentCondition = {
|
|
11
5
|
match: baseFactories.match,
|
|
12
6
|
unless: (unlessPath, disabledValues, payload) => {
|
|
13
7
|
return {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import type { Paramable } from '../../references';
|
|
2
2
|
import type { BuilderTags } from '../tags';
|
|
3
|
-
import type {
|
|
3
|
+
import type { BuilderComponentDetails } from './detail';
|
|
4
4
|
import * as v from 'valibot';
|
|
5
|
-
export declare class BuilderComponentConfig<const
|
|
5
|
+
export declare class BuilderComponentConfig<const Details extends Paramable<BuilderComponentDetails> = Paramable<BuilderComponentDetails>> {
|
|
6
6
|
readonly type: 'component-config';
|
|
7
|
-
readonly
|
|
7
|
+
readonly details: Details;
|
|
8
8
|
readonly tags?: BuilderTags;
|
|
9
|
-
constructor(
|
|
10
|
-
tag(...tags: Array<string>): BuilderComponentConfig<
|
|
9
|
+
constructor(details: Details, tags?: BuilderTags);
|
|
10
|
+
tag(...tags: Array<string>): BuilderComponentConfig<Details>;
|
|
11
11
|
}
|
|
12
12
|
export declare const BuilderComponentConfigSchema: v.InstanceSchema<typeof BuilderComponentConfig, undefined>;
|
|
13
13
|
export declare const BuilderComponentConfigSerialisedSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
14
|
-
readonly
|
|
14
|
+
readonly details: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
15
15
|
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
16
16
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
17
17
|
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
@@ -26,27 +26,27 @@ export declare const BuilderComponentConfigSerialisedSchema: v.SchemaWithPipe<re
|
|
|
26
26
|
type: "ref";
|
|
27
27
|
id: string;
|
|
28
28
|
}>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
29
|
-
readonly type: v.LiteralSchema<"component-
|
|
29
|
+
readonly type: v.LiteralSchema<"component-detail", undefined>;
|
|
30
30
|
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
31
|
-
readonly
|
|
31
|
+
readonly kind: v.PicklistSchema<["string", "boolean", "number", "price", "image"], undefined>;
|
|
32
32
|
readonly isOptional: v.BooleanSchema<undefined>;
|
|
33
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
|
-
type: "component-
|
|
35
|
+
type: "component-detail";
|
|
36
36
|
name: string;
|
|
37
|
-
|
|
37
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
38
38
|
isOptional: boolean;
|
|
39
39
|
tags?: readonly string[] | undefined;
|
|
40
40
|
}>]>, undefined>, v.ReadonlyAction<Readonly<{
|
|
41
|
-
type: "component-
|
|
41
|
+
type: "component-detail";
|
|
42
42
|
name: string;
|
|
43
|
-
|
|
43
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
44
44
|
isOptional: boolean;
|
|
45
45
|
tags?: readonly string[] | undefined;
|
|
46
46
|
}>[]>]>], undefined>;
|
|
47
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
|
+
details: Readonly<{
|
|
50
50
|
type: "parameter";
|
|
51
51
|
id: string;
|
|
52
52
|
name: string;
|
|
@@ -54,9 +54,9 @@ export declare const BuilderComponentConfigSerialisedSchema: v.SchemaWithPipe<re
|
|
|
54
54
|
type: "ref";
|
|
55
55
|
id: string;
|
|
56
56
|
}> | readonly Readonly<{
|
|
57
|
-
type: "component-
|
|
57
|
+
type: "component-detail";
|
|
58
58
|
name: string;
|
|
59
|
-
|
|
59
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
60
60
|
isOptional: boolean;
|
|
61
61
|
tags?: readonly string[] | undefined;
|
|
62
62
|
}>[];
|
|
@@ -64,7 +64,7 @@ export declare const BuilderComponentConfigSerialisedSchema: v.SchemaWithPipe<re
|
|
|
64
64
|
}>]>;
|
|
65
65
|
export type BuilderComponentConfigSerialised = v.InferOutput<typeof BuilderComponentConfigSerialisedSchema>;
|
|
66
66
|
export declare const BuilderComponentConfigsSerialisedSchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
67
|
-
readonly
|
|
67
|
+
readonly details: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
68
68
|
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
69
69
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
70
70
|
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
@@ -79,27 +79,27 @@ export declare const BuilderComponentConfigsSerialisedSchema: v.SchemaWithPipe<r
|
|
|
79
79
|
type: "ref";
|
|
80
80
|
id: string;
|
|
81
81
|
}>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
82
|
-
readonly type: v.LiteralSchema<"component-
|
|
82
|
+
readonly type: v.LiteralSchema<"component-detail", undefined>;
|
|
83
83
|
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
84
|
-
readonly
|
|
84
|
+
readonly kind: v.PicklistSchema<["string", "boolean", "number", "price", "image"], undefined>;
|
|
85
85
|
readonly isOptional: v.BooleanSchema<undefined>;
|
|
86
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
|
-
type: "component-
|
|
88
|
+
type: "component-detail";
|
|
89
89
|
name: string;
|
|
90
|
-
|
|
90
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
91
91
|
isOptional: boolean;
|
|
92
92
|
tags?: readonly string[] | undefined;
|
|
93
93
|
}>]>, undefined>, v.ReadonlyAction<Readonly<{
|
|
94
|
-
type: "component-
|
|
94
|
+
type: "component-detail";
|
|
95
95
|
name: string;
|
|
96
|
-
|
|
96
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
97
97
|
isOptional: boolean;
|
|
98
98
|
tags?: readonly string[] | undefined;
|
|
99
99
|
}>[]>]>], undefined>;
|
|
100
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
|
+
details: Readonly<{
|
|
103
103
|
type: "parameter";
|
|
104
104
|
id: string;
|
|
105
105
|
name: string;
|
|
@@ -107,15 +107,15 @@ export declare const BuilderComponentConfigsSerialisedSchema: v.SchemaWithPipe<r
|
|
|
107
107
|
type: "ref";
|
|
108
108
|
id: string;
|
|
109
109
|
}> | readonly Readonly<{
|
|
110
|
-
type: "component-
|
|
110
|
+
type: "component-detail";
|
|
111
111
|
name: string;
|
|
112
|
-
|
|
112
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
113
113
|
isOptional: boolean;
|
|
114
114
|
tags?: readonly string[] | undefined;
|
|
115
115
|
}>[];
|
|
116
116
|
tags?: readonly string[] | undefined;
|
|
117
117
|
}>]>, undefined>, v.ReadonlyAction<Readonly<{
|
|
118
|
-
|
|
118
|
+
details: Readonly<{
|
|
119
119
|
type: "parameter";
|
|
120
120
|
id: string;
|
|
121
121
|
name: string;
|
|
@@ -123,21 +123,21 @@ export declare const BuilderComponentConfigsSerialisedSchema: v.SchemaWithPipe<r
|
|
|
123
123
|
type: "ref";
|
|
124
124
|
id: string;
|
|
125
125
|
}> | readonly Readonly<{
|
|
126
|
-
type: "component-
|
|
126
|
+
type: "component-detail";
|
|
127
127
|
name: string;
|
|
128
|
-
|
|
128
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
129
129
|
isOptional: boolean;
|
|
130
130
|
tags?: readonly string[] | undefined;
|
|
131
131
|
}>[];
|
|
132
132
|
tags?: readonly string[] | undefined;
|
|
133
133
|
}>[]>]>;
|
|
134
134
|
export type BuilderComponentConfigsSerialised = v.InferOutput<typeof BuilderComponentConfigsSerialisedSchema>;
|
|
135
|
-
export declare function componentConfig<const
|
|
136
|
-
export declare const validateComponentConfig: (input: unknown, references?: import("..").BuilderReferences,
|
|
137
|
-
readonly
|
|
138
|
-
readonly type: "component-
|
|
135
|
+
export declare function componentConfig<const Details extends BuilderComponentDetails>(...details: Details): BuilderComponentConfig<Details>;
|
|
136
|
+
export declare const validateComponentConfig: (input: unknown, references?: import("..").BuilderReferences, issues?: import("../../errors/errors").BuilderIssuesScope) => import("..").ValidationResult<{
|
|
137
|
+
readonly details: readonly {
|
|
138
|
+
readonly type: "component-detail";
|
|
139
139
|
readonly name: string;
|
|
140
|
-
readonly
|
|
140
|
+
readonly kind: "string" | "number" | "boolean" | "price" | "image";
|
|
141
141
|
readonly isOptional: boolean;
|
|
142
142
|
readonly tags?: readonly string[] | undefined;
|
|
143
143
|
}[];
|