@builder-builder/builder 0.0.10 → 0.0.12
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 +28 -0
- package/dist/bb.js +49 -0
- package/dist/check.d.ts +1 -1
- package/dist/check.js +4 -2
- package/dist/entities/builder/bind.d.ts +4 -85
- package/dist/entities/builder/bind.js +1 -9
- package/dist/entities/builder/builder.d.ts +17 -509
- package/dist/entities/builder/builder.js +19 -79
- package/dist/entities/builder/factory.d.ts +7 -0
- package/dist/entities/builder/factory.js +4 -0
- package/dist/entities/builder/index.d.ts +3 -6
- package/dist/entities/builder/index.js +1 -2
- package/dist/entities/collection/collection.d.ts +69 -19
- package/dist/entities/collection/collection.js +7 -25
- package/dist/entities/collection/config.d.ts +38 -1095
- package/dist/entities/collection/config.js +8 -8
- package/dist/entities/collection/expectation.d.ts +8 -4
- package/dist/entities/collection/index.d.ts +2 -2
- package/dist/entities/collection/when.d.ts +5 -4
- package/dist/entities/component/component.d.ts +264 -293
- package/dist/entities/component/component.js +5 -5
- package/dist/entities/component/details.d.ts +32 -57
- package/dist/entities/component/details.js +8 -8
- package/dist/entities/component/expectation.d.ts +7 -4
- package/dist/entities/component/expectation.js +0 -3
- package/dist/entities/component/field.d.ts +50 -0
- package/dist/entities/component/field.js +41 -0
- package/dist/entities/component/index.d.ts +4 -2
- package/dist/entities/component/index.js +2 -1
- package/dist/entities/component/when.d.ts +1 -1
- package/dist/entities/component/when.js +2 -2
- package/dist/entities/entry.d.ts +4 -0
- package/dist/entities/expectation.d.ts +10 -22
- package/dist/entities/expectation.js +2 -7
- package/dist/entities/index.d.ts +20 -17
- package/dist/entities/index.js +9 -8
- package/dist/entities/kind.d.ts +8 -5
- package/dist/entities/kind.js +3 -4
- package/dist/entities/model/bind.d.ts +83 -0
- package/dist/entities/model/expectation.d.ts +16 -0
- package/dist/entities/model/index.d.ts +7 -0
- package/dist/entities/model/index.js +2 -0
- package/dist/entities/model/methods.d.ts +57 -0
- package/dist/entities/{builder → model}/methods.js +8 -8
- package/dist/entities/model/model.d.ts +39 -0
- package/dist/entities/model/model.js +73 -0
- package/dist/entities/model/models.d.ts +39 -0
- package/dist/entities/model/models.js +14 -0
- package/dist/entities/{builder → model}/state.d.ts +10 -10
- package/dist/entities/option/index.d.ts +1 -1
- package/dist/entities/option/index.js +1 -1
- package/dist/entities/option/option.d.ts +210 -209
- package/dist/entities/option/option.js +5 -5
- package/dist/entities/option/select.d.ts +2 -12
- package/dist/entities/option/select.js +6 -3
- package/dist/entities/option/toggle.d.ts +2 -9
- package/dist/entities/option/toggle.js +3 -3
- package/dist/entities/option/values.d.ts +3 -21
- package/dist/entities/option/values.js +8 -2
- package/dist/entities/option/when.d.ts +5 -4
- package/dist/entities/refs.d.ts +6 -0
- package/dist/entities/refs.js +1 -0
- package/dist/entities/serialise.d.ts +388 -2919
- package/dist/entities/serialise.js +116 -17
- package/dist/entities/ui/describe.d.ts +22 -31
- package/dist/entities/ui/describe.js +1 -1
- package/dist/entities/ui/index.d.ts +2 -5
- package/dist/entities/ui/index.js +1 -2
- package/dist/entities/ui/page.d.ts +22 -31
- package/dist/entities/ui/page.js +1 -1
- package/dist/entities/ui/pages.d.ts +11 -8
- package/dist/entities/ui/pages.js +1 -1
- package/dist/entities/ui/ui.d.ts +22 -1194
- package/dist/entities/ui/ui.js +16 -28
- package/dist/entities/ui/uis.d.ts +5 -15
- package/dist/entities/ui/uis.js +12 -18
- package/dist/entities/validated.d.ts +35 -0
- package/dist/entities/validated.js +1 -0
- package/dist/entities/when.d.ts +62 -54
- package/dist/entities/when.js +1 -0
- package/dist/environment.d.ts +5 -0
- package/dist/environment.js +2 -0
- package/dist/exception.d.ts +8 -3
- package/dist/exception.js +3 -0
- package/dist/index.d.ts +21 -28
- package/dist/index.js +5 -13
- package/dist/instance.d.ts +56 -0
- package/dist/instance.js +10 -0
- package/dist/mappers/index.d.ts +7 -7
- package/dist/mappers/index.js +5 -4
- package/dist/mappers/instance.d.ts +3 -0
- package/dist/mappers/instance.js +36 -0
- package/dist/mappers/order.d.ts +6 -0
- package/dist/mappers/order.js +22 -0
- package/dist/mappers/render/pages.d.ts +5 -4
- package/dist/mappers/render/render.d.ts +2 -3
- package/dist/mappers/render/render.js +97 -78
- package/dist/mappers/resolve.d.ts +5 -9
- package/dist/mappers/resolve.js +25 -33
- package/dist/mappers/variants/index.d.ts +1 -0
- package/dist/mappers/variants/index.js +1 -0
- package/dist/mappers/variants/option-graph.d.ts +19 -0
- package/dist/mappers/{models → variants}/option-graph.js +33 -22
- package/dist/mappers/variants/variants.d.ts +3 -0
- package/dist/mappers/variants/variants.js +57 -0
- package/dist/private.d.ts +4 -0
- package/dist/private.js +4 -0
- package/dist/references.d.ts +13 -48
- package/dist/references.js +6 -14
- package/dist/serialisable.d.ts +1 -9
- package/dist/serialisable.js +2 -3
- package/dist/validate/brand.d.ts +14 -0
- package/dist/validate/brand.js +17 -0
- package/dist/validate/builder.d.ts +4 -0
- package/dist/validate/builder.js +27 -0
- package/dist/validate/expectations.d.ts +10 -0
- package/dist/validate/expectations.js +12 -0
- package/dist/validate/index.d.ts +18 -0
- package/dist/validate/index.js +9 -0
- package/dist/validate/instance.d.ts +19 -0
- package/dist/validate/instance.js +46 -0
- package/dist/validate/model.d.ts +36 -0
- package/dist/validate/model.js +220 -0
- package/dist/validate/resolve.d.ts +16 -0
- package/dist/validate/resolve.js +91 -0
- package/dist/validate/result.d.ts +8 -0
- package/dist/validate/result.js +4 -0
- package/dist/validate/ui.d.ts +8 -0
- package/dist/validate/ui.js +77 -0
- package/dist/validate/variants.d.ts +59 -0
- package/dist/validate/variants.js +102 -0
- package/package.json +5 -4
- package/dist/entities/bind.d.ts +0 -4
- package/dist/entities/bind.js +0 -44
- package/dist/entities/builder/builders.d.ts +0 -35
- package/dist/entities/builder/builders.js +0 -19
- package/dist/entities/builder/expectation.d.ts +0 -12
- package/dist/entities/builder/methods.d.ts +0 -58
- package/dist/entities/builder/validate.d.ts +0 -3
- package/dist/entities/builder/validate.js +0 -108
- package/dist/entities/errors.d.ts +0 -21
- package/dist/entities/ui/bind.d.ts +0 -10
- package/dist/entities/ui/bind.js +0 -9
- package/dist/entities/ui/validate.d.ts +0 -8
- package/dist/entities/ui/validate.js +0 -21
- package/dist/entities/validate.d.ts +0 -28
- package/dist/mappers/assert/builder.d.ts +0 -2
- package/dist/mappers/assert/builder.js +0 -46
- package/dist/mappers/assert/expectation.d.ts +0 -2
- package/dist/mappers/assert/expectation.js +0 -23
- package/dist/mappers/assert/index.d.ts +0 -6
- package/dist/mappers/assert/index.js +0 -4
- package/dist/mappers/assert/model.d.ts +0 -13
- package/dist/mappers/assert/model.js +0 -47
- package/dist/mappers/assert/models.d.ts +0 -33
- package/dist/mappers/assert/models.js +0 -74
- package/dist/mappers/assert/ui.d.ts +0 -2
- package/dist/mappers/assert/ui.js +0 -22
- package/dist/mappers/instance/index.d.ts +0 -1
- package/dist/mappers/instance/index.js +0 -1
- package/dist/mappers/instance/instance.d.ts +0 -4
- package/dist/mappers/instance/instance.js +0 -33
- package/dist/mappers/models/component-graph.d.ts +0 -9
- package/dist/mappers/models/component-graph.js +0 -51
- package/dist/mappers/models/graph.d.ts +0 -12
- package/dist/mappers/models/graph.js +0 -17
- package/dist/mappers/models/index.d.ts +0 -1
- package/dist/mappers/models/index.js +0 -1
- package/dist/mappers/models/models.d.ts +0 -3
- package/dist/mappers/models/models.js +0 -37
- package/dist/mappers/models/option-graph.d.ts +0 -9
- package/dist/mappers/order/index.d.ts +0 -2
- package/dist/mappers/order/index.js +0 -1
- package/dist/mappers/order/order.d.ts +0 -14
- package/dist/mappers/order/order.js +0 -31
- package/dist/mappers/refs.d.ts +0 -12
- package/dist/mappers/refs.js +0 -36
- package/dist/model.d.ts +0 -35
- package/dist/model.js +0 -9
- package/dist/walker/index.d.ts +0 -2
- package/dist/walker/index.js +0 -1
- package/dist/walker/walkable.d.ts +0 -4
- package/dist/walker/walkable.js +0 -4
- package/dist/walker/walker.d.ts +0 -26
- package/dist/walker/walker.js +0 -115
- package/dist/walker/walkers.d.ts +0 -9
- package/dist/walker/walkers.js +0 -55
- /package/dist/entities/{builder/expectation.js → entry.js} +0 -0
- /package/dist/entities/{builder/state.js → model/bind.js} +0 -0
- /package/dist/entities/{errors.js → model/expectation.js} +0 -0
- /package/dist/entities/{validate.js → model/state.js} +0 -0
|
@@ -1,24 +1,55 @@
|
|
|
1
1
|
import type { BuilderPaths } from '../../paths';
|
|
2
2
|
import type { Paramable } from '../../references';
|
|
3
|
-
import type {
|
|
3
|
+
import type { BuilderWhenSerialised } from '../when';
|
|
4
4
|
import type { BuilderOptionValues, BuilderOptionValuesSerialised } from './values';
|
|
5
|
+
import type { BuilderOptionWhen } from './when';
|
|
5
6
|
import * as v from 'valibot';
|
|
6
|
-
export type BuilderOptionPayload = BuilderOptionValues |
|
|
7
|
-
export declare class BuilderOption<const Name extends string = string, const Payload extends Paramable<BuilderOptionPayload> = Paramable<BuilderOptionPayload>, const
|
|
7
|
+
export type BuilderOptionPayload = BuilderOptionValues | BuilderOptionWhen;
|
|
8
|
+
export declare class BuilderOption<const Name extends string = string, const Payload extends Paramable<BuilderOptionPayload> = Paramable<BuilderOptionPayload>, const Paths extends Paramable<BuilderPaths> = Paramable<BuilderPaths>> {
|
|
8
9
|
readonly type: 'option';
|
|
9
10
|
readonly name: Name;
|
|
10
11
|
readonly payload: Payload;
|
|
11
|
-
readonly
|
|
12
|
-
constructor(name: Name, payload: Payload,
|
|
12
|
+
readonly paths?: Paths;
|
|
13
|
+
constructor(name: Name, payload: Payload, paths?: Paths);
|
|
13
14
|
}
|
|
14
15
|
export declare const BuilderOptionSchema: v.InstanceSchema<typeof BuilderOption, undefined>;
|
|
15
16
|
export type BuilderOptions = ReadonlyArray<BuilderOption>;
|
|
16
|
-
export declare const BuilderOptionWhenSerialisedSchema: v.GenericSchema
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
export declare const BuilderOptionWhenSerialisedSchema: v.GenericSchema<BuilderWhenSerialised<Readonly<Readonly<{
|
|
18
|
+
type: "select";
|
|
19
|
+
readonly options: readonly [string, ...string[]];
|
|
20
|
+
defaultValue: string | null;
|
|
21
|
+
isOptional: boolean;
|
|
22
|
+
optionLabels: {
|
|
23
|
+
[x: string]: string;
|
|
24
|
+
};
|
|
25
|
+
}>> | Readonly<Readonly<{
|
|
26
|
+
type: "toggle";
|
|
27
|
+
valueType: "string" | "number" | "boolean";
|
|
28
|
+
defaultValue: string | number | boolean | null;
|
|
29
|
+
isOptional: boolean;
|
|
30
|
+
}>>>>;
|
|
31
|
+
export type BuilderOptionWhenSerialised = BuilderWhenSerialised<BuilderOptionValuesSerialised>;
|
|
32
|
+
export declare const BuilderOptionSelectMapSerialisedSchema: v.GenericSchema<import("..").BuilderMatchSelectMap<Readonly<{
|
|
33
|
+
type: "parameter";
|
|
34
|
+
id: string;
|
|
35
|
+
name: string;
|
|
36
|
+
}> | Readonly<Readonly<{
|
|
37
|
+
type: "select";
|
|
38
|
+
readonly options: readonly [string, ...string[]];
|
|
39
|
+
defaultValue: string | null;
|
|
40
|
+
isOptional: boolean;
|
|
41
|
+
optionLabels: {
|
|
42
|
+
[x: string]: string;
|
|
43
|
+
};
|
|
44
|
+
}>> | Readonly<Readonly<{
|
|
45
|
+
type: "toggle";
|
|
46
|
+
valueType: "string" | "number" | "boolean";
|
|
47
|
+
defaultValue: string | number | boolean | null;
|
|
48
|
+
isOptional: boolean;
|
|
49
|
+
}>>>>;
|
|
19
50
|
export declare const BuilderOptionSerialisedSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
20
51
|
readonly name: v.StringSchema<undefined>;
|
|
21
|
-
readonly payload: v.
|
|
52
|
+
readonly payload: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
22
53
|
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
23
54
|
readonly id: v.StringSchema<undefined>;
|
|
24
55
|
readonly name: v.StringSchema<undefined>;
|
|
@@ -26,24 +57,19 @@ export declare const BuilderOptionSerialisedSchema: v.SchemaWithPipe<readonly [v
|
|
|
26
57
|
type: "parameter";
|
|
27
58
|
id: string;
|
|
28
59
|
name: string;
|
|
29
|
-
}>]>, v.
|
|
60
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
61
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
62
|
+
readonly id: v.StringSchema<undefined>;
|
|
63
|
+
}, undefined>, v.ReadonlyAction<{
|
|
64
|
+
type: "ref";
|
|
65
|
+
id: string;
|
|
66
|
+
}>]>, v.UnionSchema<[v.SchemaWithPipe<readonly [v.VariantSchema<"type", [v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
30
67
|
readonly type: v.LiteralSchema<"select", undefined>;
|
|
31
68
|
readonly options: v.SchemaWithPipe<readonly [v.TupleWithRestSchema<[v.StringSchema<undefined>], v.StringSchema<undefined>, undefined>, v.ReadonlyAction<[string, ...string[]]>]>;
|
|
32
69
|
readonly defaultValue: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
33
70
|
readonly isOptional: v.BooleanSchema<undefined>;
|
|
34
71
|
readonly optionLabels: v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>;
|
|
35
|
-
}, undefined>, v.
|
|
36
|
-
type: "select";
|
|
37
|
-
readonly options: readonly [string, ...string[]];
|
|
38
|
-
defaultValue: string | null;
|
|
39
|
-
isOptional: boolean;
|
|
40
|
-
optionLabels: {
|
|
41
|
-
[x: string]: string;
|
|
42
|
-
};
|
|
43
|
-
}, {
|
|
44
|
-
readonly serialisable: typeof import("./select").BuilderSelectType;
|
|
45
|
-
readonly instance: v.InstanceSchema<typeof import("./select").BuilderSelectType, undefined>;
|
|
46
|
-
}>, v.ReadonlyAction<{
|
|
72
|
+
}, undefined>, v.ReadonlyAction<{
|
|
47
73
|
type: "select";
|
|
48
74
|
readonly options: readonly [string, ...string[]];
|
|
49
75
|
defaultValue: string | null;
|
|
@@ -56,20 +82,25 @@ export declare const BuilderOptionSerialisedSchema: v.SchemaWithPipe<readonly [v
|
|
|
56
82
|
readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
|
|
57
83
|
readonly defaultValue: v.NullableSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
|
|
58
84
|
readonly isOptional: v.BooleanSchema<undefined>;
|
|
59
|
-
}, undefined>, v.
|
|
85
|
+
}, undefined>, v.ReadonlyAction<{
|
|
60
86
|
type: "toggle";
|
|
61
87
|
valueType: "string" | "number" | "boolean";
|
|
62
88
|
defaultValue: string | number | boolean | null;
|
|
63
89
|
isOptional: boolean;
|
|
64
|
-
}, {
|
|
65
|
-
|
|
66
|
-
readonly
|
|
67
|
-
|
|
90
|
+
}>]>], undefined>, v.ReadonlyAction<Readonly<{
|
|
91
|
+
type: "select";
|
|
92
|
+
readonly options: readonly [string, ...string[]];
|
|
93
|
+
defaultValue: string | null;
|
|
94
|
+
isOptional: boolean;
|
|
95
|
+
optionLabels: {
|
|
96
|
+
[x: string]: string;
|
|
97
|
+
};
|
|
98
|
+
}> | Readonly<{
|
|
68
99
|
type: "toggle";
|
|
69
100
|
valueType: "string" | "number" | "boolean";
|
|
70
101
|
defaultValue: string | number | boolean | null;
|
|
71
102
|
isOptional: boolean;
|
|
72
|
-
}
|
|
103
|
+
}>>]>, v.GenericSchema<BuilderWhenSerialised<Readonly<Readonly<{
|
|
73
104
|
type: "select";
|
|
74
105
|
readonly options: readonly [string, ...string[]];
|
|
75
106
|
defaultValue: string | null;
|
|
@@ -77,71 +108,13 @@ export declare const BuilderOptionSerialisedSchema: v.SchemaWithPipe<readonly [v
|
|
|
77
108
|
optionLabels: {
|
|
78
109
|
[x: string]: string;
|
|
79
110
|
};
|
|
80
|
-
}
|
|
111
|
+
}>> | Readonly<Readonly<{
|
|
81
112
|
type: "toggle";
|
|
82
113
|
valueType: "string" | "number" | "boolean";
|
|
83
114
|
defaultValue: string | number | boolean | null;
|
|
84
115
|
isOptional: boolean;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
readonly type: v.LiteralSchema<"select", undefined>;
|
|
88
|
-
readonly options: v.SchemaWithPipe<readonly [v.TupleWithRestSchema<[v.StringSchema<undefined>], v.StringSchema<undefined>, undefined>, v.ReadonlyAction<[string, ...string[]]>]>;
|
|
89
|
-
readonly defaultValue: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
90
|
-
readonly isOptional: v.BooleanSchema<undefined>;
|
|
91
|
-
readonly optionLabels: v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>;
|
|
92
|
-
}, undefined>, v.MetadataAction<{
|
|
93
|
-
type: "select";
|
|
94
|
-
readonly options: readonly [string, ...string[]];
|
|
95
|
-
defaultValue: string | null;
|
|
96
|
-
isOptional: boolean;
|
|
97
|
-
optionLabels: {
|
|
98
|
-
[x: string]: string;
|
|
99
|
-
};
|
|
100
|
-
}, {
|
|
101
|
-
readonly serialisable: typeof import("./select").BuilderSelectType;
|
|
102
|
-
readonly instance: v.InstanceSchema<typeof import("./select").BuilderSelectType, undefined>;
|
|
103
|
-
}>, v.ReadonlyAction<{
|
|
104
|
-
type: "select";
|
|
105
|
-
readonly options: readonly [string, ...string[]];
|
|
106
|
-
defaultValue: string | null;
|
|
107
|
-
isOptional: boolean;
|
|
108
|
-
optionLabels: {
|
|
109
|
-
[x: string]: string;
|
|
110
|
-
};
|
|
111
|
-
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
112
|
-
readonly type: v.LiteralSchema<"toggle", undefined>;
|
|
113
|
-
readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
|
|
114
|
-
readonly defaultValue: v.NullableSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
|
|
115
|
-
readonly isOptional: v.BooleanSchema<undefined>;
|
|
116
|
-
}, undefined>, v.MetadataAction<{
|
|
117
|
-
type: "toggle";
|
|
118
|
-
valueType: "string" | "number" | "boolean";
|
|
119
|
-
defaultValue: string | number | boolean | null;
|
|
120
|
-
isOptional: boolean;
|
|
121
|
-
}, {
|
|
122
|
-
readonly serialisable: typeof import("./toggle").BuilderToggleType;
|
|
123
|
-
readonly instance: v.InstanceSchema<typeof import("./toggle").BuilderToggleType, undefined>;
|
|
124
|
-
}>, v.ReadonlyAction<{
|
|
125
|
-
type: "toggle";
|
|
126
|
-
valueType: "string" | "number" | "boolean";
|
|
127
|
-
defaultValue: string | number | boolean | null;
|
|
128
|
-
isOptional: boolean;
|
|
129
|
-
}>]>], undefined>, v.ReadonlyAction<Readonly<{
|
|
130
|
-
type: "select";
|
|
131
|
-
readonly options: readonly [string, ...string[]];
|
|
132
|
-
defaultValue: string | null;
|
|
133
|
-
isOptional: boolean;
|
|
134
|
-
optionLabels: {
|
|
135
|
-
[x: string]: string;
|
|
136
|
-
};
|
|
137
|
-
}> | Readonly<{
|
|
138
|
-
type: "toggle";
|
|
139
|
-
valueType: "string" | "number" | "boolean";
|
|
140
|
-
defaultValue: string | number | boolean | null;
|
|
141
|
-
isOptional: boolean;
|
|
142
|
-
}>>]>, v.GenericSchema], undefined>;
|
|
143
|
-
}>]>;
|
|
144
|
-
readonly gatePaths: v.OptionalSchema<v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
116
|
+
}>>>>], undefined>], undefined>;
|
|
117
|
+
readonly paths: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
145
118
|
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
146
119
|
readonly id: v.StringSchema<undefined>;
|
|
147
120
|
readonly name: v.StringSchema<undefined>;
|
|
@@ -149,37 +122,62 @@ export declare const BuilderOptionSerialisedSchema: v.SchemaWithPipe<readonly [v
|
|
|
149
122
|
type: "parameter";
|
|
150
123
|
id: string;
|
|
151
124
|
name: string;
|
|
152
|
-
}>]>, v.
|
|
153
|
-
type: "
|
|
125
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
126
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
127
|
+
readonly id: v.StringSchema<undefined>;
|
|
128
|
+
}, undefined>, v.ReadonlyAction<{
|
|
129
|
+
type: "ref";
|
|
154
130
|
id: string;
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
readonly paramable: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, v.ReadonlyAction<(string | number)[]>]>, undefined>, v.ReadonlyAction<(readonly (string | number)[])[]>]>;
|
|
158
|
-
}>]>, undefined>;
|
|
159
|
-
}, undefined>, v.MetadataAction<{
|
|
131
|
+
}>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, v.ReadonlyAction<(string | number)[]>]>, undefined>, v.ReadonlyAction<(readonly (string | number)[])[]>]>], undefined>, undefined>;
|
|
132
|
+
}, undefined>, v.ReadonlyAction<{
|
|
160
133
|
name: string;
|
|
161
|
-
payload:
|
|
162
|
-
gatePaths?: readonly (readonly (string | number)[])[] | Readonly<{
|
|
134
|
+
payload: Readonly<{
|
|
163
135
|
type: "parameter";
|
|
164
136
|
id: string;
|
|
165
137
|
name: string;
|
|
166
|
-
}> |
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
138
|
+
}> | Readonly<{
|
|
139
|
+
type: "ref";
|
|
140
|
+
id: string;
|
|
141
|
+
}> | Readonly<Readonly<{
|
|
142
|
+
type: "select";
|
|
143
|
+
readonly options: readonly [string, ...string[]];
|
|
144
|
+
defaultValue: string | null;
|
|
145
|
+
isOptional: boolean;
|
|
146
|
+
optionLabels: {
|
|
147
|
+
[x: string]: string;
|
|
148
|
+
};
|
|
149
|
+
}>> | Readonly<Readonly<{
|
|
150
|
+
type: "toggle";
|
|
151
|
+
valueType: "string" | "number" | "boolean";
|
|
152
|
+
defaultValue: string | number | boolean | null;
|
|
153
|
+
isOptional: boolean;
|
|
154
|
+
}>> | BuilderWhenSerialised<Readonly<Readonly<{
|
|
155
|
+
type: "select";
|
|
156
|
+
readonly options: readonly [string, ...string[]];
|
|
157
|
+
defaultValue: string | null;
|
|
158
|
+
isOptional: boolean;
|
|
159
|
+
optionLabels: {
|
|
160
|
+
[x: string]: string;
|
|
161
|
+
};
|
|
162
|
+
}>> | Readonly<Readonly<{
|
|
163
|
+
type: "toggle";
|
|
164
|
+
valueType: "string" | "number" | "boolean";
|
|
165
|
+
defaultValue: string | number | boolean | null;
|
|
166
|
+
isOptional: boolean;
|
|
167
|
+
}>>>;
|
|
168
|
+
paths?: readonly (readonly (string | number)[])[] | Readonly<{
|
|
174
169
|
type: "parameter";
|
|
175
170
|
id: string;
|
|
176
171
|
name: string;
|
|
177
|
-
}> |
|
|
172
|
+
}> | Readonly<{
|
|
173
|
+
type: "ref";
|
|
174
|
+
id: string;
|
|
175
|
+
}> | undefined;
|
|
178
176
|
}>]>;
|
|
179
177
|
export type BuilderOptionSerialised = v.InferOutput<typeof BuilderOptionSerialisedSchema>;
|
|
180
178
|
export declare const BuilderOptionsSerialisedSchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
181
179
|
readonly name: v.StringSchema<undefined>;
|
|
182
|
-
readonly payload: v.
|
|
180
|
+
readonly payload: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
183
181
|
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
184
182
|
readonly id: v.StringSchema<undefined>;
|
|
185
183
|
readonly name: v.StringSchema<undefined>;
|
|
@@ -187,24 +185,19 @@ export declare const BuilderOptionsSerialisedSchema: v.SchemaWithPipe<readonly [
|
|
|
187
185
|
type: "parameter";
|
|
188
186
|
id: string;
|
|
189
187
|
name: string;
|
|
190
|
-
}>]>, v.
|
|
188
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
189
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
190
|
+
readonly id: v.StringSchema<undefined>;
|
|
191
|
+
}, undefined>, v.ReadonlyAction<{
|
|
192
|
+
type: "ref";
|
|
193
|
+
id: string;
|
|
194
|
+
}>]>, v.UnionSchema<[v.SchemaWithPipe<readonly [v.VariantSchema<"type", [v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
191
195
|
readonly type: v.LiteralSchema<"select", undefined>;
|
|
192
196
|
readonly options: v.SchemaWithPipe<readonly [v.TupleWithRestSchema<[v.StringSchema<undefined>], v.StringSchema<undefined>, undefined>, v.ReadonlyAction<[string, ...string[]]>]>;
|
|
193
197
|
readonly defaultValue: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
194
198
|
readonly isOptional: v.BooleanSchema<undefined>;
|
|
195
199
|
readonly optionLabels: v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>;
|
|
196
|
-
}, undefined>, v.
|
|
197
|
-
type: "select";
|
|
198
|
-
readonly options: readonly [string, ...string[]];
|
|
199
|
-
defaultValue: string | null;
|
|
200
|
-
isOptional: boolean;
|
|
201
|
-
optionLabels: {
|
|
202
|
-
[x: string]: string;
|
|
203
|
-
};
|
|
204
|
-
}, {
|
|
205
|
-
readonly serialisable: typeof import("./select").BuilderSelectType;
|
|
206
|
-
readonly instance: v.InstanceSchema<typeof import("./select").BuilderSelectType, undefined>;
|
|
207
|
-
}>, v.ReadonlyAction<{
|
|
200
|
+
}, undefined>, v.ReadonlyAction<{
|
|
208
201
|
type: "select";
|
|
209
202
|
readonly options: readonly [string, ...string[]];
|
|
210
203
|
defaultValue: string | null;
|
|
@@ -217,20 +210,25 @@ export declare const BuilderOptionsSerialisedSchema: v.SchemaWithPipe<readonly [
|
|
|
217
210
|
readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
|
|
218
211
|
readonly defaultValue: v.NullableSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
|
|
219
212
|
readonly isOptional: v.BooleanSchema<undefined>;
|
|
220
|
-
}, undefined>, v.
|
|
213
|
+
}, undefined>, v.ReadonlyAction<{
|
|
221
214
|
type: "toggle";
|
|
222
215
|
valueType: "string" | "number" | "boolean";
|
|
223
216
|
defaultValue: string | number | boolean | null;
|
|
224
217
|
isOptional: boolean;
|
|
225
|
-
}, {
|
|
226
|
-
|
|
227
|
-
readonly
|
|
228
|
-
|
|
218
|
+
}>]>], undefined>, v.ReadonlyAction<Readonly<{
|
|
219
|
+
type: "select";
|
|
220
|
+
readonly options: readonly [string, ...string[]];
|
|
221
|
+
defaultValue: string | null;
|
|
222
|
+
isOptional: boolean;
|
|
223
|
+
optionLabels: {
|
|
224
|
+
[x: string]: string;
|
|
225
|
+
};
|
|
226
|
+
}> | Readonly<{
|
|
229
227
|
type: "toggle";
|
|
230
228
|
valueType: "string" | "number" | "boolean";
|
|
231
229
|
defaultValue: string | number | boolean | null;
|
|
232
230
|
isOptional: boolean;
|
|
233
|
-
}
|
|
231
|
+
}>>]>, v.GenericSchema<BuilderWhenSerialised<Readonly<Readonly<{
|
|
234
232
|
type: "select";
|
|
235
233
|
readonly options: readonly [string, ...string[]];
|
|
236
234
|
defaultValue: string | null;
|
|
@@ -238,71 +236,13 @@ export declare const BuilderOptionsSerialisedSchema: v.SchemaWithPipe<readonly [
|
|
|
238
236
|
optionLabels: {
|
|
239
237
|
[x: string]: string;
|
|
240
238
|
};
|
|
241
|
-
}
|
|
239
|
+
}>> | Readonly<Readonly<{
|
|
242
240
|
type: "toggle";
|
|
243
241
|
valueType: "string" | "number" | "boolean";
|
|
244
242
|
defaultValue: string | number | boolean | null;
|
|
245
243
|
isOptional: boolean;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
readonly type: v.LiteralSchema<"select", undefined>;
|
|
249
|
-
readonly options: v.SchemaWithPipe<readonly [v.TupleWithRestSchema<[v.StringSchema<undefined>], v.StringSchema<undefined>, undefined>, v.ReadonlyAction<[string, ...string[]]>]>;
|
|
250
|
-
readonly defaultValue: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
251
|
-
readonly isOptional: v.BooleanSchema<undefined>;
|
|
252
|
-
readonly optionLabels: v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>;
|
|
253
|
-
}, undefined>, v.MetadataAction<{
|
|
254
|
-
type: "select";
|
|
255
|
-
readonly options: readonly [string, ...string[]];
|
|
256
|
-
defaultValue: string | null;
|
|
257
|
-
isOptional: boolean;
|
|
258
|
-
optionLabels: {
|
|
259
|
-
[x: string]: string;
|
|
260
|
-
};
|
|
261
|
-
}, {
|
|
262
|
-
readonly serialisable: typeof import("./select").BuilderSelectType;
|
|
263
|
-
readonly instance: v.InstanceSchema<typeof import("./select").BuilderSelectType, undefined>;
|
|
264
|
-
}>, v.ReadonlyAction<{
|
|
265
|
-
type: "select";
|
|
266
|
-
readonly options: readonly [string, ...string[]];
|
|
267
|
-
defaultValue: string | null;
|
|
268
|
-
isOptional: boolean;
|
|
269
|
-
optionLabels: {
|
|
270
|
-
[x: string]: string;
|
|
271
|
-
};
|
|
272
|
-
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
273
|
-
readonly type: v.LiteralSchema<"toggle", undefined>;
|
|
274
|
-
readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
|
|
275
|
-
readonly defaultValue: v.NullableSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
|
|
276
|
-
readonly isOptional: v.BooleanSchema<undefined>;
|
|
277
|
-
}, undefined>, v.MetadataAction<{
|
|
278
|
-
type: "toggle";
|
|
279
|
-
valueType: "string" | "number" | "boolean";
|
|
280
|
-
defaultValue: string | number | boolean | null;
|
|
281
|
-
isOptional: boolean;
|
|
282
|
-
}, {
|
|
283
|
-
readonly serialisable: typeof import("./toggle").BuilderToggleType;
|
|
284
|
-
readonly instance: v.InstanceSchema<typeof import("./toggle").BuilderToggleType, undefined>;
|
|
285
|
-
}>, v.ReadonlyAction<{
|
|
286
|
-
type: "toggle";
|
|
287
|
-
valueType: "string" | "number" | "boolean";
|
|
288
|
-
defaultValue: string | number | boolean | null;
|
|
289
|
-
isOptional: boolean;
|
|
290
|
-
}>]>], undefined>, v.ReadonlyAction<Readonly<{
|
|
291
|
-
type: "select";
|
|
292
|
-
readonly options: readonly [string, ...string[]];
|
|
293
|
-
defaultValue: string | null;
|
|
294
|
-
isOptional: boolean;
|
|
295
|
-
optionLabels: {
|
|
296
|
-
[x: string]: string;
|
|
297
|
-
};
|
|
298
|
-
}> | Readonly<{
|
|
299
|
-
type: "toggle";
|
|
300
|
-
valueType: "string" | "number" | "boolean";
|
|
301
|
-
defaultValue: string | number | boolean | null;
|
|
302
|
-
isOptional: boolean;
|
|
303
|
-
}>>]>, v.GenericSchema], undefined>;
|
|
304
|
-
}>]>;
|
|
305
|
-
readonly gatePaths: v.OptionalSchema<v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
244
|
+
}>>>>], undefined>], undefined>;
|
|
245
|
+
readonly paths: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
306
246
|
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
307
247
|
readonly id: v.StringSchema<undefined>;
|
|
308
248
|
readonly name: v.StringSchema<undefined>;
|
|
@@ -310,39 +250,100 @@ export declare const BuilderOptionsSerialisedSchema: v.SchemaWithPipe<readonly [
|
|
|
310
250
|
type: "parameter";
|
|
311
251
|
id: string;
|
|
312
252
|
name: string;
|
|
313
|
-
}>]>, v.
|
|
314
|
-
type: "
|
|
253
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
254
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
255
|
+
readonly id: v.StringSchema<undefined>;
|
|
256
|
+
}, undefined>, v.ReadonlyAction<{
|
|
257
|
+
type: "ref";
|
|
315
258
|
id: string;
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
readonly paramable: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, v.ReadonlyAction<(string | number)[]>]>, undefined>, v.ReadonlyAction<(readonly (string | number)[])[]>]>;
|
|
319
|
-
}>]>, undefined>;
|
|
320
|
-
}, undefined>, v.MetadataAction<{
|
|
259
|
+
}>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, v.ReadonlyAction<(string | number)[]>]>, undefined>, v.ReadonlyAction<(readonly (string | number)[])[]>]>], undefined>, undefined>;
|
|
260
|
+
}, undefined>, v.ReadonlyAction<{
|
|
321
261
|
name: string;
|
|
322
|
-
payload:
|
|
323
|
-
gatePaths?: readonly (readonly (string | number)[])[] | Readonly<{
|
|
262
|
+
payload: Readonly<{
|
|
324
263
|
type: "parameter";
|
|
325
264
|
id: string;
|
|
326
265
|
name: string;
|
|
327
|
-
}> |
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
266
|
+
}> | Readonly<{
|
|
267
|
+
type: "ref";
|
|
268
|
+
id: string;
|
|
269
|
+
}> | Readonly<Readonly<{
|
|
270
|
+
type: "select";
|
|
271
|
+
readonly options: readonly [string, ...string[]];
|
|
272
|
+
defaultValue: string | null;
|
|
273
|
+
isOptional: boolean;
|
|
274
|
+
optionLabels: {
|
|
275
|
+
[x: string]: string;
|
|
276
|
+
};
|
|
277
|
+
}>> | Readonly<Readonly<{
|
|
278
|
+
type: "toggle";
|
|
279
|
+
valueType: "string" | "number" | "boolean";
|
|
280
|
+
defaultValue: string | number | boolean | null;
|
|
281
|
+
isOptional: boolean;
|
|
282
|
+
}>> | BuilderWhenSerialised<Readonly<Readonly<{
|
|
283
|
+
type: "select";
|
|
284
|
+
readonly options: readonly [string, ...string[]];
|
|
285
|
+
defaultValue: string | null;
|
|
286
|
+
isOptional: boolean;
|
|
287
|
+
optionLabels: {
|
|
288
|
+
[x: string]: string;
|
|
289
|
+
};
|
|
290
|
+
}>> | Readonly<Readonly<{
|
|
291
|
+
type: "toggle";
|
|
292
|
+
valueType: "string" | "number" | "boolean";
|
|
293
|
+
defaultValue: string | number | boolean | null;
|
|
294
|
+
isOptional: boolean;
|
|
295
|
+
}>>>;
|
|
296
|
+
paths?: readonly (readonly (string | number)[])[] | Readonly<{
|
|
335
297
|
type: "parameter";
|
|
336
298
|
id: string;
|
|
337
299
|
name: string;
|
|
338
|
-
}> |
|
|
300
|
+
}> | Readonly<{
|
|
301
|
+
type: "ref";
|
|
302
|
+
id: string;
|
|
303
|
+
}> | undefined;
|
|
339
304
|
}>]>, undefined>, v.ReadonlyAction<Readonly<{
|
|
340
305
|
name: string;
|
|
341
|
-
payload:
|
|
342
|
-
gatePaths?: readonly (readonly (string | number)[])[] | Readonly<{
|
|
306
|
+
payload: Readonly<{
|
|
343
307
|
type: "parameter";
|
|
344
308
|
id: string;
|
|
345
309
|
name: string;
|
|
346
|
-
}> |
|
|
310
|
+
}> | Readonly<{
|
|
311
|
+
type: "ref";
|
|
312
|
+
id: string;
|
|
313
|
+
}> | Readonly<Readonly<{
|
|
314
|
+
type: "select";
|
|
315
|
+
readonly options: readonly [string, ...string[]];
|
|
316
|
+
defaultValue: string | null;
|
|
317
|
+
isOptional: boolean;
|
|
318
|
+
optionLabels: {
|
|
319
|
+
[x: string]: string;
|
|
320
|
+
};
|
|
321
|
+
}>> | Readonly<Readonly<{
|
|
322
|
+
type: "toggle";
|
|
323
|
+
valueType: "string" | "number" | "boolean";
|
|
324
|
+
defaultValue: string | number | boolean | null;
|
|
325
|
+
isOptional: boolean;
|
|
326
|
+
}>> | BuilderWhenSerialised<Readonly<Readonly<{
|
|
327
|
+
type: "select";
|
|
328
|
+
readonly options: readonly [string, ...string[]];
|
|
329
|
+
defaultValue: string | null;
|
|
330
|
+
isOptional: boolean;
|
|
331
|
+
optionLabels: {
|
|
332
|
+
[x: string]: string;
|
|
333
|
+
};
|
|
334
|
+
}>> | Readonly<Readonly<{
|
|
335
|
+
type: "toggle";
|
|
336
|
+
valueType: "string" | "number" | "boolean";
|
|
337
|
+
defaultValue: string | number | boolean | null;
|
|
338
|
+
isOptional: boolean;
|
|
339
|
+
}>>>;
|
|
340
|
+
paths?: readonly (readonly (string | number)[])[] | Readonly<{
|
|
341
|
+
type: "parameter";
|
|
342
|
+
id: string;
|
|
343
|
+
name: string;
|
|
344
|
+
}> | Readonly<{
|
|
345
|
+
type: "ref";
|
|
346
|
+
id: string;
|
|
347
|
+
}> | undefined;
|
|
347
348
|
}>[]>]>;
|
|
348
349
|
export type BuilderOptionsSerialised = v.InferOutput<typeof BuilderOptionsSerialisedSchema>;
|
|
@@ -7,19 +7,19 @@ import { BuilderOptionValuesSerialisedSchema } from './values.js';
|
|
|
7
7
|
export class BuilderOption {
|
|
8
8
|
name;
|
|
9
9
|
payload;
|
|
10
|
-
|
|
11
|
-
constructor(name, payload,
|
|
10
|
+
paths;
|
|
11
|
+
constructor(name, payload, paths) {
|
|
12
12
|
this.name = name;
|
|
13
13
|
this.payload = payload;
|
|
14
|
-
this.
|
|
14
|
+
this.paths = paths;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
export const BuilderOptionSchema = v.instance(BuilderOption);
|
|
18
18
|
export const BuilderOptionWhenSerialisedSchema = createWhenSerialisedSchema(BuilderOptionValuesSerialisedSchema);
|
|
19
19
|
export const BuilderOptionSelectMapSerialisedSchema = createSelectMapSerialisedSchema(BuilderOptionValuesSerialisedSchema);
|
|
20
|
-
export const BuilderOptionSerialisedSchema = serialisable(
|
|
20
|
+
export const BuilderOptionSerialisedSchema = serialisable(v.object({
|
|
21
21
|
name: v.string(),
|
|
22
22
|
payload: paramable(v.union([BuilderOptionValuesSerialisedSchema, BuilderOptionWhenSerialisedSchema])),
|
|
23
|
-
|
|
23
|
+
paths: v.optional(paramable(BuilderPathsSchema))
|
|
24
24
|
}));
|
|
25
25
|
export const BuilderOptionsSerialisedSchema = v.pipe(v.array(BuilderOptionSerialisedSchema), v.readonly());
|
|
@@ -25,18 +25,7 @@ export declare const BuilderSelectTypeSerialisedSchema: v.SchemaWithPipe<readonl
|
|
|
25
25
|
readonly defaultValue: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
26
26
|
readonly isOptional: v.BooleanSchema<undefined>;
|
|
27
27
|
readonly optionLabels: v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>;
|
|
28
|
-
}, undefined>, v.
|
|
29
|
-
type: "select";
|
|
30
|
-
readonly options: readonly [string, ...string[]];
|
|
31
|
-
defaultValue: string | null;
|
|
32
|
-
isOptional: boolean;
|
|
33
|
-
optionLabels: {
|
|
34
|
-
[x: string]: string;
|
|
35
|
-
};
|
|
36
|
-
}, {
|
|
37
|
-
readonly serialisable: typeof BuilderSelectType;
|
|
38
|
-
readonly instance: v.InstanceSchema<typeof BuilderSelectType, undefined>;
|
|
39
|
-
}>, v.ReadonlyAction<{
|
|
28
|
+
}, undefined>, v.ReadonlyAction<{
|
|
40
29
|
type: "select";
|
|
41
30
|
readonly options: readonly [string, ...string[]];
|
|
42
31
|
defaultValue: string | null;
|
|
@@ -46,4 +35,5 @@ export declare const BuilderSelectTypeSerialisedSchema: v.SchemaWithPipe<readonl
|
|
|
46
35
|
};
|
|
47
36
|
}>]>;
|
|
48
37
|
export type BuilderSelectTypeSerialised = v.InferOutput<typeof BuilderSelectTypeSerialisedSchema>;
|
|
38
|
+
export declare function selectValueSchema(options: ReadonlyArray<string>, optional: boolean): v.GenericSchema<string | null>;
|
|
49
39
|
export {};
|
|
@@ -9,8 +9,7 @@ export class BuilderSelectType {
|
|
|
9
9
|
optionLabels;
|
|
10
10
|
constructor(values, defaultValue, optional = false, optionLabels = {}) {
|
|
11
11
|
this.options = values;
|
|
12
|
-
|
|
13
|
-
this.valueSchema = (optional ? v.nullable(baseSchema) : baseSchema);
|
|
12
|
+
this.valueSchema = selectValueSchema(values, optional);
|
|
14
13
|
this.defaultValue = defaultValue;
|
|
15
14
|
this.isOptional = optional;
|
|
16
15
|
this.optionLabels = optionLabels;
|
|
@@ -31,10 +30,14 @@ export function select(values) {
|
|
|
31
30
|
return new BuilderSelectType(values, defaultValue, false);
|
|
32
31
|
}
|
|
33
32
|
export const BuilderSelectTypeSchema = v.instance(BuilderSelectType);
|
|
34
|
-
export const BuilderSelectTypeSerialisedSchema = serialisable(
|
|
33
|
+
export const BuilderSelectTypeSerialisedSchema = serialisable(v.object({
|
|
35
34
|
type: v.literal('select'),
|
|
36
35
|
options: v.pipe(v.tupleWithRest([v.string()], v.string()), v.readonly()),
|
|
37
36
|
defaultValue: v.nullable(v.string()),
|
|
38
37
|
isOptional: v.boolean(),
|
|
39
38
|
optionLabels: v.record(v.string(), v.string())
|
|
40
39
|
}));
|
|
40
|
+
export function selectValueSchema(options, optional) {
|
|
41
|
+
const baseSchema = v.union(options.map((value) => v.literal(value)));
|
|
42
|
+
return optional ? v.nullable(baseSchema) : baseSchema;
|
|
43
|
+
}
|
|
@@ -22,18 +22,11 @@ export declare const BuilderToggleTypeSerialisedSchema: v.SchemaWithPipe<readonl
|
|
|
22
22
|
readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
|
|
23
23
|
readonly defaultValue: v.NullableSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
|
|
24
24
|
readonly isOptional: v.BooleanSchema<undefined>;
|
|
25
|
-
}, undefined>, v.
|
|
26
|
-
type: "toggle";
|
|
27
|
-
valueType: "string" | "number" | "boolean";
|
|
28
|
-
defaultValue: string | number | boolean | null;
|
|
29
|
-
isOptional: boolean;
|
|
30
|
-
}, {
|
|
31
|
-
readonly serialisable: typeof BuilderToggleType;
|
|
32
|
-
readonly instance: v.InstanceSchema<typeof BuilderToggleType, undefined>;
|
|
33
|
-
}>, v.ReadonlyAction<{
|
|
25
|
+
}, undefined>, v.ReadonlyAction<{
|
|
34
26
|
type: "toggle";
|
|
35
27
|
valueType: "string" | "number" | "boolean";
|
|
36
28
|
defaultValue: string | number | boolean | null;
|
|
37
29
|
isOptional: boolean;
|
|
38
30
|
}>]>;
|
|
39
31
|
export type BuilderToggleTypeSerialised = v.InferOutput<typeof BuilderToggleTypeSerialisedSchema>;
|
|
32
|
+
export declare function toggleValueSchema(valueType: BuilderToggleValueType, optional: boolean): v.GenericSchema;
|