@builder-builder/builder 0.0.9 → 0.0.11

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