@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.
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 -85
  6. package/dist/entities/builder/bind.js +1 -9
  7. package/dist/entities/builder/builder.d.ts +17 -509
  8. package/dist/entities/builder/builder.js +19 -79
  9. package/dist/entities/builder/factory.d.ts +7 -0
  10. package/dist/entities/builder/factory.js +4 -0
  11. package/dist/entities/builder/index.d.ts +3 -6
  12. package/dist/entities/builder/index.js +1 -2
  13. package/dist/entities/collection/collection.d.ts +69 -19
  14. package/dist/entities/collection/collection.js +7 -25
  15. package/dist/entities/collection/config.d.ts +38 -1095
  16. package/dist/entities/collection/config.js +8 -8
  17. package/dist/entities/collection/expectation.d.ts +8 -4
  18. package/dist/entities/collection/index.d.ts +2 -2
  19. package/dist/entities/collection/when.d.ts +5 -4
  20. package/dist/entities/component/component.d.ts +264 -293
  21. package/dist/entities/component/component.js +5 -5
  22. package/dist/entities/component/details.d.ts +32 -57
  23. package/dist/entities/component/details.js +8 -8
  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 +4 -2
  29. package/dist/entities/component/index.js +2 -1
  30. package/dist/entities/component/when.d.ts +1 -1
  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 +20 -17
  36. package/dist/entities/index.js +9 -8
  37. package/dist/entities/kind.d.ts +8 -5
  38. package/dist/entities/kind.js +3 -4
  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 +1 -1
  51. package/dist/entities/option/index.js +1 -1
  52. package/dist/entities/option/option.d.ts +210 -209
  53. package/dist/entities/option/option.js +5 -5
  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 +3 -21
  59. package/dist/entities/option/values.js +8 -2
  60. package/dist/entities/option/when.d.ts +5 -4
  61. package/dist/entities/refs.d.ts +6 -0
  62. package/dist/entities/refs.js +1 -0
  63. package/dist/entities/serialise.d.ts +388 -2919
  64. package/dist/entities/serialise.js +116 -17
  65. package/dist/entities/ui/describe.d.ts +22 -31
  66. package/dist/entities/ui/describe.js +1 -1
  67. package/dist/entities/ui/index.d.ts +2 -5
  68. package/dist/entities/ui/index.js +1 -2
  69. package/dist/entities/ui/page.d.ts +22 -31
  70. package/dist/entities/ui/page.js +1 -1
  71. package/dist/entities/ui/pages.d.ts +11 -8
  72. package/dist/entities/ui/pages.js +1 -1
  73. package/dist/entities/ui/ui.d.ts +22 -1194
  74. package/dist/entities/ui/ui.js +16 -28
  75. package/dist/entities/ui/uis.d.ts +5 -15
  76. package/dist/entities/ui/uis.js +12 -18
  77. package/dist/entities/validated.d.ts +35 -0
  78. package/dist/entities/validated.js +1 -0
  79. package/dist/entities/when.d.ts +62 -54
  80. package/dist/entities/when.js +1 -0
  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 -28
  86. package/dist/index.js +5 -13
  87. package/dist/instance.d.ts +56 -0
  88. package/dist/instance.js +10 -0
  89. package/dist/mappers/index.d.ts +7 -7
  90. package/dist/mappers/index.js +5 -4
  91. package/dist/mappers/instance.d.ts +3 -0
  92. package/dist/mappers/instance.js +36 -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 +5 -4
  96. package/dist/mappers/render/render.d.ts +2 -3
  97. package/dist/mappers/render/render.js +97 -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 +13 -48
  109. package/dist/references.js +6 -14
  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 +220 -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 +5 -4
  133. package/dist/entities/bind.d.ts +0 -4
  134. package/dist/entities/bind.js +0 -44
  135. package/dist/entities/builder/builders.d.ts +0 -35
  136. package/dist/entities/builder/builders.js +0 -19
  137. package/dist/entities/builder/expectation.d.ts +0 -12
  138. package/dist/entities/builder/methods.d.ts +0 -58
  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/bind.d.ts +0 -10
  143. package/dist/entities/ui/bind.js +0 -9
  144. package/dist/entities/ui/validate.d.ts +0 -8
  145. package/dist/entities/ui/validate.js +0 -21
  146. package/dist/entities/validate.d.ts +0 -28
  147. package/dist/mappers/assert/builder.d.ts +0 -2
  148. package/dist/mappers/assert/builder.js +0 -46
  149. package/dist/mappers/assert/expectation.d.ts +0 -2
  150. package/dist/mappers/assert/expectation.js +0 -23
  151. package/dist/mappers/assert/index.d.ts +0 -6
  152. package/dist/mappers/assert/index.js +0 -4
  153. package/dist/mappers/assert/model.d.ts +0 -13
  154. package/dist/mappers/assert/model.js +0 -47
  155. package/dist/mappers/assert/models.d.ts +0 -33
  156. package/dist/mappers/assert/models.js +0 -74
  157. package/dist/mappers/assert/ui.d.ts +0 -2
  158. package/dist/mappers/assert/ui.js +0 -22
  159. package/dist/mappers/instance/index.d.ts +0 -1
  160. package/dist/mappers/instance/index.js +0 -1
  161. package/dist/mappers/instance/instance.d.ts +0 -4
  162. package/dist/mappers/instance/instance.js +0 -33
  163. package/dist/mappers/models/component-graph.d.ts +0 -9
  164. package/dist/mappers/models/component-graph.js +0 -51
  165. package/dist/mappers/models/graph.d.ts +0 -12
  166. package/dist/mappers/models/graph.js +0 -17
  167. package/dist/mappers/models/index.d.ts +0 -1
  168. package/dist/mappers/models/index.js +0 -1
  169. package/dist/mappers/models/models.d.ts +0 -3
  170. package/dist/mappers/models/models.js +0 -37
  171. package/dist/mappers/models/option-graph.d.ts +0 -9
  172. package/dist/mappers/order/index.d.ts +0 -2
  173. package/dist/mappers/order/index.js +0 -1
  174. package/dist/mappers/order/order.d.ts +0 -14
  175. package/dist/mappers/order/order.js +0 -31
  176. package/dist/mappers/refs.d.ts +0 -12
  177. package/dist/mappers/refs.js +0 -36
  178. package/dist/model.d.ts +0 -35
  179. package/dist/model.js +0 -9
  180. package/dist/walker/index.d.ts +0 -2
  181. package/dist/walker/index.js +0 -1
  182. package/dist/walker/walkable.d.ts +0 -4
  183. package/dist/walker/walkable.js +0 -4
  184. package/dist/walker/walker.d.ts +0 -26
  185. package/dist/walker/walker.js +0 -115
  186. package/dist/walker/walkers.d.ts +0 -9
  187. package/dist/walker/walkers.js +0 -55
  188. /package/dist/entities/{builder/expectation.js → entry.js} +0 -0
  189. /package/dist/entities/{builder/state.js → model/bind.js} +0 -0
  190. /package/dist/entities/{errors.js → model/expectation.js} +0 -0
  191. /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 { BuilderWhen, WhenSerialised } from '../when';
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<Paramable<BuilderOptionValues>>;
7
- export declare class BuilderOption<const Name extends string = string, const Payload extends Paramable<BuilderOptionPayload> = Paramable<BuilderOptionPayload>, const GatePaths extends Paramable<BuilderPaths> = Paramable<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>;
18
- export declare const BuilderOptionSelectMapSerialisedSchema: v.GenericSchema;
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.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
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.InstanceSchema<typeof import("../..").BuilderParameter, 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<{
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.MetadataAction<{
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.MetadataAction<{
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
- readonly serialisable: typeof import("./toggle").BuilderToggleType;
66
- readonly instance: v.InstanceSchema<typeof import("./toggle").BuilderToggleType, undefined>;
67
- }>, 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<{
68
99
  type: "toggle";
69
100
  valueType: "string" | "number" | "boolean";
70
101
  defaultValue: string | number | boolean | null;
71
102
  isOptional: boolean;
72
- }>]>], undefined>, v.ReadonlyAction<Readonly<{
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
- }> | Readonly<{
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
- }>>]>, v.GenericSchema], undefined>], undefined>, v.MetadataAction<unknown, {
86
- readonly paramable: v.UnionSchema<[v.SchemaWithPipe<readonly [v.VariantSchema<"type", [v.SchemaWithPipe<readonly [v.ObjectSchema<{
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.InstanceSchema<typeof import("../..").BuilderParameter, 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)[])[] | Readonly<{
153
- type: "parameter";
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
- name: string;
156
- }> | import("../..").BuilderParameter<string>, {
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: unknown;
162
- gatePaths?: readonly (readonly (string | number)[])[] | Readonly<{
134
+ payload: Readonly<{
163
135
  type: "parameter";
164
136
  id: string;
165
137
  name: string;
166
- }> | import("../..").BuilderParameter<string> | undefined;
167
- }, {
168
- readonly serialisable: typeof BuilderOption;
169
- readonly instance: v.InstanceSchema<typeof BuilderOption, undefined>;
170
- }>, v.ReadonlyAction<{
171
- name: string;
172
- payload: unknown;
173
- gatePaths?: readonly (readonly (string | number)[])[] | Readonly<{
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
- }> | import("../..").BuilderParameter<string> | undefined;
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.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
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.InstanceSchema<typeof import("../..").BuilderParameter, 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<{
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.MetadataAction<{
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.MetadataAction<{
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
- readonly serialisable: typeof import("./toggle").BuilderToggleType;
227
- readonly instance: v.InstanceSchema<typeof import("./toggle").BuilderToggleType, undefined>;
228
- }>, 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<{
229
227
  type: "toggle";
230
228
  valueType: "string" | "number" | "boolean";
231
229
  defaultValue: string | number | boolean | null;
232
230
  isOptional: boolean;
233
- }>]>], undefined>, v.ReadonlyAction<Readonly<{
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
- }> | Readonly<{
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
- }>>]>, v.GenericSchema], undefined>], undefined>, v.MetadataAction<unknown, {
247
- readonly paramable: v.UnionSchema<[v.SchemaWithPipe<readonly [v.VariantSchema<"type", [v.SchemaWithPipe<readonly [v.ObjectSchema<{
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.InstanceSchema<typeof import("../..").BuilderParameter, 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)[])[] | Readonly<{
314
- type: "parameter";
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
- name: string;
317
- }> | import("../..").BuilderParameter<string>, {
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: unknown;
323
- gatePaths?: readonly (readonly (string | number)[])[] | Readonly<{
262
+ payload: Readonly<{
324
263
  type: "parameter";
325
264
  id: string;
326
265
  name: string;
327
- }> | import("../..").BuilderParameter<string> | undefined;
328
- }, {
329
- readonly serialisable: typeof BuilderOption;
330
- readonly instance: v.InstanceSchema<typeof BuilderOption, undefined>;
331
- }>, v.ReadonlyAction<{
332
- name: string;
333
- payload: unknown;
334
- gatePaths?: readonly (readonly (string | number)[])[] | Readonly<{
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
- }> | import("../..").BuilderParameter<string> | undefined;
300
+ }> | Readonly<{
301
+ type: "ref";
302
+ id: string;
303
+ }> | undefined;
339
304
  }>]>, undefined>, v.ReadonlyAction<Readonly<{
340
305
  name: string;
341
- payload: unknown;
342
- gatePaths?: readonly (readonly (string | number)[])[] | Readonly<{
306
+ payload: Readonly<{
343
307
  type: "parameter";
344
308
  id: string;
345
309
  name: string;
346
- }> | import("../..").BuilderParameter<string> | undefined;
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
- 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
19
  export const BuilderOptionSelectMapSerialisedSchema = createSelectMapSerialisedSchema(BuilderOptionValuesSerialisedSchema);
20
- export const BuilderOptionSerialisedSchema = serialisable(BuilderOption, v.object({
20
+ export const BuilderOptionSerialisedSchema = serialisable(v.object({
21
21
  name: v.string(),
22
22
  payload: paramable(v.union([BuilderOptionValuesSerialisedSchema, BuilderOptionWhenSerialisedSchema])),
23
- gatePaths: v.optional(paramable(BuilderPathsSchema))
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.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
+ }
@@ -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.MetadataAction<{
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;