@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
package/dist/bb.d.ts ADDED
@@ -0,0 +1,28 @@
1
+ import type { BuilderComponentVariantsValidated, BuilderInstanceValidated, BuilderModelValidated, BuilderRefEntities, BuilderUIValidated, BuilderValidated } from './entities/index';
2
+ import type { BuilderEnvironment, BuilderEnvironmentResult } from './environment';
3
+ import type { BuilderOrder, BuilderRenderResult } from './mappers/index';
4
+ import type { BuilderComponentVariants, BuilderInstance, BuilderInstanceInput } from './instance';
5
+ export type BBOptions = {
6
+ readonly references?: BuilderRefEntities;
7
+ };
8
+ export type BB<Env extends BuilderEnvironment = 'production'> = {
9
+ readonly validate: {
10
+ builder(input: unknown): BuilderEnvironmentResult<BuilderValidated, Env>;
11
+ model(input: unknown): BuilderEnvironmentResult<BuilderModelValidated, Env>;
12
+ ui(input: unknown): BuilderEnvironmentResult<BuilderUIValidated, Env>;
13
+ instance(model: BuilderModelValidated, instance: BuilderInstance): BuilderEnvironmentResult<BuilderInstanceValidated, Env>;
14
+ variants(model: BuilderModelValidated, input: unknown, options?: {
15
+ readonly partial?: boolean;
16
+ }): BuilderEnvironmentResult<BuilderComponentVariantsValidated, Env>;
17
+ };
18
+ instance(entity: BuilderValidated | BuilderModelValidated, partial?: BuilderInstanceInput): BuilderInstance;
19
+ render(builder: BuilderValidated, instance: BuilderInstanceValidated): BuilderRenderResult;
20
+ order(model: BuilderModelValidated, instance: BuilderInstanceValidated, variants: BuilderComponentVariantsValidated): BuilderOrder;
21
+ variants(entity: BuilderValidated | BuilderModelValidated): BuilderComponentVariants;
22
+ };
23
+ export declare const bb: typeof bbProd & {
24
+ dev: typeof bbDev;
25
+ };
26
+ declare function bbProd(options?: BBOptions): BB<'production'>;
27
+ declare function bbDev(options?: BBOptions): BB<'development'>;
28
+ export {};
package/dist/bb.js ADDED
@@ -0,0 +1,49 @@
1
+ import { BuilderException } from './exception.js';
2
+ import { assertValidated, createInstance, createVariants, order, render, validateBuilder, validateInstance, validateModel, validateUI, validateVariants } from './mappers/index.js';
3
+ export const bb = Object.assign(bbProd, {
4
+ dev: bbDev
5
+ });
6
+ function bbProd(options = {}) {
7
+ return bbFactory('production', options.references);
8
+ }
9
+ function bbDev(options = {}) {
10
+ return bbFactory('development', options.references);
11
+ }
12
+ function bbFactory(environment, references = []) {
13
+ return {
14
+ validate: {
15
+ builder: (input) => throwInProd(validateBuilder(input, references)),
16
+ model: (input) => throwInProd(validateModel(input, references)),
17
+ ui: (input) => throwInProd(validateUI(input, references)),
18
+ instance: (model, instance) => throwInProd(validateInstance(model, instance)),
19
+ variants: (model, input, variantOptions) => throwInProd(validateVariants(model, input, variantOptions))
20
+ },
21
+ instance: (entity, partial) => {
22
+ assertValidated(entity);
23
+ return createInstance(entity, partial, references);
24
+ },
25
+ render: (builder, instance) => {
26
+ assertValidated(builder);
27
+ assertValidated(instance);
28
+ return render(builder, instance, references);
29
+ },
30
+ order: (model, instance, variants) => {
31
+ assertValidated(model);
32
+ assertValidated(instance);
33
+ assertValidated(variants);
34
+ return order(model, instance, variants, references);
35
+ },
36
+ variants: (entity) => {
37
+ assertValidated(entity);
38
+ return createVariants(entity);
39
+ }
40
+ };
41
+ function throwInProd(result) {
42
+ const [entity, errors] = result;
43
+ const isDev = environment === 'development';
44
+ if (!isDev && errors.length > 0) {
45
+ throw new BuilderException(errors);
46
+ }
47
+ return (isDev ? result : entity);
48
+ }
49
+ }
package/dist/check.d.ts CHANGED
@@ -3,7 +3,7 @@ declare class Check {
3
3
  truthy<Input>(input: Input, message?: `${string}! ❌`): asserts input is Exclude<Input, null | undefined | '' | 0 | false>;
4
4
  falsy(input: unknown, message?: `${string}! ❌`): void;
5
5
  is<const Schema extends v.BaseSchema<unknown, unknown, v.BaseIssue<unknown>>>(schema: Schema, input: unknown): input is v.InferInput<Schema>;
6
- assert<const Schema extends v.BaseSchema<unknown, unknown, v.BaseIssue<unknown>>>(schema: Schema, input: unknown): asserts input is v.InferInput<Schema>;
6
+ assert<const Schema extends v.BaseSchema<unknown, unknown, v.BaseIssue<unknown>>>(schema: Schema, input: unknown, message?: `${string}! ❌`): asserts input is v.InferInput<Schema>;
7
7
  }
8
8
  export declare const check: Check;
9
9
  export {};
package/dist/check.js CHANGED
@@ -15,8 +15,10 @@ class Check {
15
15
  is(schema, input) {
16
16
  return v.is(schema, input);
17
17
  }
18
- assert(schema, input) {
19
- v.assert(schema, input);
18
+ assert(schema, input, message = DEFAULT_MESSAGE) {
19
+ if (!v.is(schema, input)) {
20
+ throw new BuilderException([], message);
21
+ }
20
22
  }
21
23
  }
22
24
  export const check = new Check();
@@ -0,0 +1,4 @@
1
+ import type { BuilderEntitySerialised } from '../kind';
2
+ import type { BuilderRefSerialised } from '../../references';
3
+ export type BuilderBindings = Readonly<Record<string, unknown>>;
4
+ export type BuilderBindingsSerialised = Readonly<Record<string, BuilderEntitySerialised | BuilderRefSerialised>>;
@@ -1,494 +1,21 @@
1
- import type { Prettify } from '../../prettify';
2
- import type { BuilderRefs, Refable } from '../../references';
3
- import type { BuilderCollections } from '../collection/index';
4
- import type { BuilderComponentDetails, BuilderComponents } from '../component/index';
5
- import type { BuilderExpectation, BuilderExpectations } from '../expectation';
6
- import type { BuilderOptions } from '../option/index';
7
- import type { BuilderWhenConstrained } from '../when';
8
- import type { BuilderStateAsserted } from './expectation';
9
- import type { BuilderCollectionMethod, BuilderComponentMethod, BuilderOptionMethod } from './methods';
10
- import type { BuilderBindings, BuilderBoundState } from './parameter';
11
- import type { BuilderState, BuilderStateEmpty } from './state';
1
+ import type { BuilderModelBindings, BuilderModelBoundState } from '../model/bind';
2
+ import type { BuilderModelState } from '../model/state';
3
+ import type { BuilderBindings, BuilderBindingsSerialised } from './bind';
12
4
  import * as v from 'valibot';
13
- export declare class Builder<State extends BuilderState = BuilderStateEmpty> {
14
- #private;
5
+ import { BuilderModel, BuilderModelSerialisedSchema } from '../model/index.js';
6
+ import { BuilderUI, BuilderUISerialisedSchema } from '../ui/index.js';
7
+ export declare class Builder<State extends BuilderModelState = BuilderModelState> {
15
8
  readonly type: 'builder';
16
- readonly references: State['references'];
17
- readonly options: State['options'];
18
- readonly components: State['components'];
19
- readonly collections: State['collections'];
20
- readonly expectations: BuilderExpectations;
21
- readonly id: `${string}-${string}-${string}-${string}-${string}`;
22
- constructor(references?: BuilderRefs, options?: BuilderOptions, components?: BuilderComponents, collections?: BuilderCollections, expectations?: BuilderExpectations);
23
- get option(): BuilderOptionMethod<State>;
24
- get component(): BuilderComponentMethod<State>;
25
- get collection(): BuilderCollectionMethod<State>;
26
- expect<const Expectations extends readonly [BuilderExpectation, ...ReadonlyArray<BuilderExpectation>]>(...expectations: Expectations): Builder<BuilderStateAsserted<State, Expectations>>;
27
- bind<const Bindings extends BuilderBindings<State>>(bindings: Bindings & {
28
- readonly [Key in keyof Bindings]: BuilderWhenConstrained<State, Bindings[Key]>;
29
- }): Builder<BuilderBoundState<State, Bindings>>;
9
+ readonly model: BuilderModel<State>;
10
+ readonly ui: BuilderUI;
11
+ readonly bindings: BuilderBindings;
12
+ constructor(model?: BuilderModel<State>, ui?: BuilderUI<import("..").BuilderModelGeneric>, bindings?: BuilderBindings);
13
+ bind<const Bindings extends BuilderBindings>(extra: Bindings): Bindings extends BuilderModelBindings<State> ? Builder<BuilderModelBoundState<State, Bindings>> : Builder<State>;
30
14
  }
31
- export type BuilderGeneric = Builder<BuilderState>;
32
15
  export declare const BuilderSchema: v.InstanceSchema<typeof Builder, undefined>;
33
- export declare const BuilderSerialisedSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
34
- readonly references: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
35
- readonly type: v.LiteralSchema<"ref", undefined>;
36
- readonly id: v.StringSchema<undefined>;
37
- readonly name: v.StringSchema<undefined>;
38
- }, undefined>, v.ReadonlyAction<{
39
- type: "ref";
40
- id: string;
41
- name: string;
42
- }>]>, undefined>, v.ReadonlyAction<Readonly<{
43
- type: "ref";
44
- id: string;
45
- name: string;
46
- }>[]>]>;
47
- readonly options: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
48
- readonly name: v.StringSchema<undefined>;
49
- readonly payload: v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
50
- readonly type: v.LiteralSchema<"ref", undefined>;
51
- readonly id: v.StringSchema<undefined>;
52
- readonly name: v.StringSchema<undefined>;
53
- }, undefined>, v.ReadonlyAction<{
54
- type: "ref";
55
- id: string;
56
- name: string;
57
- }>]>, v.InstanceSchema<typeof import("../..").BuilderRef, undefined>, v.UnionSchema<[v.SchemaWithPipe<readonly [v.VariantSchema<"type", [v.SchemaWithPipe<readonly [v.ObjectSchema<{
58
- readonly type: v.LiteralSchema<"select", undefined>;
59
- readonly options: v.SchemaWithPipe<readonly [v.TupleWithRestSchema<[v.StringSchema<undefined>], v.StringSchema<undefined>, undefined>, v.ReadonlyAction<[string, ...string[]]>]>;
60
- readonly defaultValue: v.NullableSchema<v.StringSchema<undefined>, undefined>;
61
- readonly isOptional: v.BooleanSchema<undefined>;
62
- readonly optionLabels: v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>;
63
- }, undefined>, v.MetadataAction<{
64
- type: "select";
65
- readonly options: readonly [string, ...string[]];
66
- defaultValue: string | null;
67
- isOptional: boolean;
68
- optionLabels: {
69
- [x: string]: string;
70
- };
71
- }, {
72
- readonly serialisable: typeof import("..").BuilderSelectType;
73
- readonly instance: v.InstanceSchema<typeof import("..").BuilderSelectType, undefined>;
74
- }>, v.ReadonlyAction<{
75
- type: "select";
76
- readonly options: readonly [string, ...string[]];
77
- defaultValue: string | null;
78
- isOptional: boolean;
79
- optionLabels: {
80
- [x: string]: string;
81
- };
82
- }>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
83
- readonly type: v.LiteralSchema<"toggle", undefined>;
84
- readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
85
- readonly defaultValue: v.NullableSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
86
- readonly isOptional: v.BooleanSchema<undefined>;
87
- }, undefined>, v.MetadataAction<{
88
- type: "toggle";
89
- valueType: "string" | "number" | "boolean";
90
- defaultValue: string | number | boolean | null;
91
- isOptional: boolean;
92
- }, {
93
- readonly serialisable: typeof import("..").BuilderToggleType;
94
- readonly instance: v.InstanceSchema<typeof import("..").BuilderToggleType, undefined>;
95
- }>, v.ReadonlyAction<{
96
- type: "toggle";
97
- valueType: "string" | "number" | "boolean";
98
- defaultValue: string | number | boolean | null;
99
- isOptional: boolean;
100
- }>]>], undefined>, v.ReadonlyAction<Readonly<{
101
- type: "select";
102
- readonly options: readonly [string, ...string[]];
103
- defaultValue: string | null;
104
- isOptional: boolean;
105
- optionLabels: {
106
- [x: string]: string;
107
- };
108
- }> | Readonly<{
109
- type: "toggle";
110
- valueType: "string" | "number" | "boolean";
111
- defaultValue: string | number | boolean | null;
112
- isOptional: boolean;
113
- }>>]>, v.GenericSchema], undefined>], undefined>, v.MetadataAction<unknown, {
114
- readonly refable: v.UnionSchema<[v.SchemaWithPipe<readonly [v.VariantSchema<"type", [v.SchemaWithPipe<readonly [v.ObjectSchema<{
115
- readonly type: v.LiteralSchema<"select", undefined>;
116
- readonly options: v.SchemaWithPipe<readonly [v.TupleWithRestSchema<[v.StringSchema<undefined>], v.StringSchema<undefined>, undefined>, v.ReadonlyAction<[string, ...string[]]>]>;
117
- readonly defaultValue: v.NullableSchema<v.StringSchema<undefined>, undefined>;
118
- readonly isOptional: v.BooleanSchema<undefined>;
119
- readonly optionLabels: v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>;
120
- }, undefined>, v.MetadataAction<{
121
- type: "select";
122
- readonly options: readonly [string, ...string[]];
123
- defaultValue: string | null;
124
- isOptional: boolean;
125
- optionLabels: {
126
- [x: string]: string;
127
- };
128
- }, {
129
- readonly serialisable: typeof import("..").BuilderSelectType;
130
- readonly instance: v.InstanceSchema<typeof import("..").BuilderSelectType, undefined>;
131
- }>, v.ReadonlyAction<{
132
- type: "select";
133
- readonly options: readonly [string, ...string[]];
134
- defaultValue: string | null;
135
- isOptional: boolean;
136
- optionLabels: {
137
- [x: string]: string;
138
- };
139
- }>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
140
- readonly type: v.LiteralSchema<"toggle", undefined>;
141
- readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
142
- readonly defaultValue: v.NullableSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
143
- readonly isOptional: v.BooleanSchema<undefined>;
144
- }, undefined>, v.MetadataAction<{
145
- type: "toggle";
146
- valueType: "string" | "number" | "boolean";
147
- defaultValue: string | number | boolean | null;
148
- isOptional: boolean;
149
- }, {
150
- readonly serialisable: typeof import("..").BuilderToggleType;
151
- readonly instance: v.InstanceSchema<typeof import("..").BuilderToggleType, undefined>;
152
- }>, v.ReadonlyAction<{
153
- type: "toggle";
154
- valueType: "string" | "number" | "boolean";
155
- defaultValue: string | number | boolean | null;
156
- isOptional: boolean;
157
- }>]>], undefined>, v.ReadonlyAction<Readonly<{
158
- type: "select";
159
- readonly options: readonly [string, ...string[]];
160
- defaultValue: string | null;
161
- isOptional: boolean;
162
- optionLabels: {
163
- [x: string]: string;
164
- };
165
- }> | Readonly<{
166
- type: "toggle";
167
- valueType: "string" | "number" | "boolean";
168
- defaultValue: string | number | boolean | null;
169
- isOptional: boolean;
170
- }>>]>, v.GenericSchema], undefined>;
171
- }>]>;
172
- readonly gatePaths: v.OptionalSchema<v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
173
- readonly type: v.LiteralSchema<"ref", undefined>;
174
- readonly id: v.StringSchema<undefined>;
175
- readonly name: v.StringSchema<undefined>;
176
- }, undefined>, v.ReadonlyAction<{
177
- type: "ref";
178
- id: string;
179
- name: string;
180
- }>]>, 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<{
181
- type: "ref";
182
- id: string;
183
- name: string;
184
- }>, {
185
- 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)[])[]>]>;
186
- }>]>, undefined>;
187
- }, undefined>, v.MetadataAction<{
188
- name: string;
189
- payload: unknown;
190
- gatePaths?: readonly (readonly (string | number)[])[] | import("../..").BuilderRef | Readonly<{
191
- type: "ref";
192
- id: string;
193
- name: string;
194
- }> | undefined;
195
- }, {
196
- readonly serialisable: typeof import("..").BuilderOption;
197
- readonly instance: v.InstanceSchema<typeof import("..").BuilderOption, undefined>;
198
- }>, v.ReadonlyAction<{
199
- name: string;
200
- payload: unknown;
201
- gatePaths?: readonly (readonly (string | number)[])[] | import("../..").BuilderRef | Readonly<{
202
- type: "ref";
203
- id: string;
204
- name: string;
205
- }> | undefined;
206
- }>]>, undefined>, v.ReadonlyAction<Readonly<{
207
- name: string;
208
- payload: unknown;
209
- gatePaths?: readonly (readonly (string | number)[])[] | import("../..").BuilderRef | Readonly<{
210
- type: "ref";
211
- id: string;
212
- name: string;
213
- }> | undefined;
214
- }>[]>]>;
215
- readonly components: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
216
- readonly name: v.StringSchema<undefined>;
217
- readonly payload: v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
218
- readonly type: v.LiteralSchema<"ref", undefined>;
219
- readonly id: v.StringSchema<undefined>;
220
- readonly name: v.StringSchema<undefined>;
221
- }, undefined>, v.ReadonlyAction<{
222
- type: "ref";
223
- id: string;
224
- name: string;
225
- }>]>, v.InstanceSchema<typeof import("../..").BuilderRef, undefined>, v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
226
- readonly expectations: v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
227
- readonly type: v.LiteralSchema<"ref", undefined>;
228
- readonly id: v.StringSchema<undefined>;
229
- readonly name: v.StringSchema<undefined>;
230
- }, undefined>, v.ReadonlyAction<{
231
- type: "ref";
232
- id: string;
233
- name: string;
234
- }>]>, v.InstanceSchema<typeof import("../..").BuilderRef, undefined>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
235
- readonly name: v.StringSchema<undefined>;
236
- readonly kind: v.PicklistSchema<["option", "component", "collection", "detail"], undefined>;
237
- }, undefined>, v.MetadataAction<{
238
- name: string;
239
- kind: "option" | "component" | "collection" | "detail";
240
- }, {
241
- readonly serialisable: typeof BuilderExpectation;
242
- readonly instance: v.InstanceSchema<typeof BuilderExpectation, undefined>;
243
- }>, v.ReadonlyAction<{
244
- name: string;
245
- kind: "option" | "component" | "collection" | "detail";
246
- }>]>, undefined>, v.ReadonlyAction<Readonly<{
247
- name: string;
248
- kind: "option" | "component" | "collection" | "detail";
249
- }>[]>]>], undefined>, v.MetadataAction<import("../..").BuilderRef | Readonly<{
250
- type: "ref";
251
- id: string;
252
- name: string;
253
- }> | readonly Readonly<{
254
- name: string;
255
- kind: "option" | "component" | "collection" | "detail";
256
- }>[], {
257
- readonly refable: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
258
- readonly name: v.StringSchema<undefined>;
259
- readonly kind: v.PicklistSchema<["option", "component", "collection", "detail"], undefined>;
260
- }, undefined>, v.MetadataAction<{
261
- name: string;
262
- kind: "option" | "component" | "collection" | "detail";
263
- }, {
264
- readonly serialisable: typeof BuilderExpectation;
265
- readonly instance: v.InstanceSchema<typeof BuilderExpectation, undefined>;
266
- }>, v.ReadonlyAction<{
267
- name: string;
268
- kind: "option" | "component" | "collection" | "detail";
269
- }>]>, undefined>, v.ReadonlyAction<Readonly<{
270
- name: string;
271
- kind: "option" | "component" | "collection" | "detail";
272
- }>[]>]>;
273
- }>]>;
274
- }, undefined>, v.MetadataAction<{
275
- expectations: import("../..").BuilderRef | Readonly<{
276
- type: "ref";
277
- id: string;
278
- name: string;
279
- }> | readonly Readonly<{
280
- name: string;
281
- kind: "option" | "component" | "collection" | "detail";
282
- }>[];
283
- }, {
284
- readonly serialisable: typeof BuilderComponentDetails;
285
- readonly instance: v.InstanceSchema<typeof BuilderComponentDetails, undefined>;
286
- }>, v.ReadonlyAction<{
287
- expectations: import("../..").BuilderRef | Readonly<{
288
- type: "ref";
289
- id: string;
290
- name: string;
291
- }> | readonly Readonly<{
292
- name: string;
293
- kind: "option" | "component" | "collection" | "detail";
294
- }>[];
295
- }>]>, v.GenericSchema], undefined>], undefined>, v.MetadataAction<unknown, {
296
- readonly refable: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
297
- readonly expectations: v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
298
- readonly type: v.LiteralSchema<"ref", undefined>;
299
- readonly id: v.StringSchema<undefined>;
300
- readonly name: v.StringSchema<undefined>;
301
- }, undefined>, v.ReadonlyAction<{
302
- type: "ref";
303
- id: string;
304
- name: string;
305
- }>]>, v.InstanceSchema<typeof import("../..").BuilderRef, undefined>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
306
- readonly name: v.StringSchema<undefined>;
307
- readonly kind: v.PicklistSchema<["option", "component", "collection", "detail"], undefined>;
308
- }, undefined>, v.MetadataAction<{
309
- name: string;
310
- kind: "option" | "component" | "collection" | "detail";
311
- }, {
312
- readonly serialisable: typeof BuilderExpectation;
313
- readonly instance: v.InstanceSchema<typeof BuilderExpectation, undefined>;
314
- }>, v.ReadonlyAction<{
315
- name: string;
316
- kind: "option" | "component" | "collection" | "detail";
317
- }>]>, undefined>, v.ReadonlyAction<Readonly<{
318
- name: string;
319
- kind: "option" | "component" | "collection" | "detail";
320
- }>[]>]>], undefined>, v.MetadataAction<import("../..").BuilderRef | Readonly<{
321
- type: "ref";
322
- id: string;
323
- name: string;
324
- }> | readonly Readonly<{
325
- name: string;
326
- kind: "option" | "component" | "collection" | "detail";
327
- }>[], {
328
- readonly refable: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
329
- readonly name: v.StringSchema<undefined>;
330
- readonly kind: v.PicklistSchema<["option", "component", "collection", "detail"], undefined>;
331
- }, undefined>, v.MetadataAction<{
332
- name: string;
333
- kind: "option" | "component" | "collection" | "detail";
334
- }, {
335
- readonly serialisable: typeof BuilderExpectation;
336
- readonly instance: v.InstanceSchema<typeof BuilderExpectation, undefined>;
337
- }>, v.ReadonlyAction<{
338
- name: string;
339
- kind: "option" | "component" | "collection" | "detail";
340
- }>]>, undefined>, v.ReadonlyAction<Readonly<{
341
- name: string;
342
- kind: "option" | "component" | "collection" | "detail";
343
- }>[]>]>;
344
- }>]>;
345
- }, undefined>, v.MetadataAction<{
346
- expectations: import("../..").BuilderRef | Readonly<{
347
- type: "ref";
348
- id: string;
349
- name: string;
350
- }> | readonly Readonly<{
351
- name: string;
352
- kind: "option" | "component" | "collection" | "detail";
353
- }>[];
354
- }, {
355
- readonly serialisable: typeof BuilderComponentDetails;
356
- readonly instance: v.InstanceSchema<typeof BuilderComponentDetails, undefined>;
357
- }>, v.ReadonlyAction<{
358
- expectations: import("../..").BuilderRef | Readonly<{
359
- type: "ref";
360
- id: string;
361
- name: string;
362
- }> | readonly Readonly<{
363
- name: string;
364
- kind: "option" | "component" | "collection" | "detail";
365
- }>[];
366
- }>]>, v.GenericSchema], undefined>;
367
- }>]>;
368
- readonly gatePaths: v.OptionalSchema<v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
369
- readonly type: v.LiteralSchema<"ref", undefined>;
370
- readonly id: v.StringSchema<undefined>;
371
- readonly name: v.StringSchema<undefined>;
372
- }, undefined>, v.ReadonlyAction<{
373
- type: "ref";
374
- id: string;
375
- name: string;
376
- }>]>, 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<{
377
- type: "ref";
378
- id: string;
379
- name: string;
380
- }>, {
381
- 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)[])[]>]>;
382
- }>]>, undefined>;
383
- }, undefined>, v.MetadataAction<{
384
- name: string;
385
- payload: unknown;
386
- gatePaths?: readonly (readonly (string | number)[])[] | import("../..").BuilderRef | Readonly<{
387
- type: "ref";
388
- id: string;
389
- name: string;
390
- }> | undefined;
391
- }, {
392
- readonly serialisable: typeof import("..").BuilderComponent;
393
- readonly instance: v.InstanceSchema<typeof import("..").BuilderComponent, undefined>;
394
- }>, v.ReadonlyAction<{
395
- name: string;
396
- payload: unknown;
397
- gatePaths?: readonly (readonly (string | number)[])[] | import("../..").BuilderRef | Readonly<{
398
- type: "ref";
399
- id: string;
400
- name: string;
401
- }> | undefined;
402
- }>]>, undefined>, v.ReadonlyAction<Readonly<{
403
- name: string;
404
- payload: unknown;
405
- gatePaths?: readonly (readonly (string | number)[])[] | import("../..").BuilderRef | Readonly<{
406
- type: "ref";
407
- id: string;
408
- name: string;
409
- }> | undefined;
410
- }>[]>]>;
411
- readonly collections: v.SchemaWithPipe<readonly [v.ArraySchema<v.GenericSchema<import("..").BuilderCollectionSerialised>, undefined>, v.ReadonlyAction<import("..").BuilderCollectionSerialised[]>]>;
412
- readonly expectations: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
413
- readonly name: v.StringSchema<undefined>;
414
- readonly kind: v.PicklistSchema<["option", "component", "collection", "detail"], undefined>;
415
- }, undefined>, v.MetadataAction<{
416
- name: string;
417
- kind: "option" | "component" | "collection" | "detail";
418
- }, {
419
- readonly serialisable: typeof BuilderExpectation;
420
- readonly instance: v.InstanceSchema<typeof BuilderExpectation, undefined>;
421
- }>, v.ReadonlyAction<{
422
- name: string;
423
- kind: "option" | "component" | "collection" | "detail";
424
- }>]>, undefined>, v.ReadonlyAction<Readonly<{
425
- name: string;
426
- kind: "option" | "component" | "collection" | "detail";
427
- }>[]>]>;
428
- }, undefined>, v.MetadataAction<{
429
- readonly references: readonly Readonly<{
430
- type: "ref";
431
- id: string;
432
- name: string;
433
- }>[];
434
- readonly options: readonly Readonly<{
435
- name: string;
436
- payload: unknown;
437
- gatePaths?: readonly (readonly (string | number)[])[] | import("../..").BuilderRef | Readonly<{
438
- type: "ref";
439
- id: string;
440
- name: string;
441
- }> | undefined;
442
- }>[];
443
- readonly components: readonly Readonly<{
444
- name: string;
445
- payload: unknown;
446
- gatePaths?: readonly (readonly (string | number)[])[] | import("../..").BuilderRef | Readonly<{
447
- type: "ref";
448
- id: string;
449
- name: string;
450
- }> | undefined;
451
- }>[];
452
- readonly collections: readonly import("..").BuilderCollectionSerialised[];
453
- readonly expectations: readonly Readonly<{
454
- name: string;
455
- kind: "option" | "component" | "collection" | "detail";
456
- }>[];
457
- }, {
458
- readonly serialisable: typeof Builder;
459
- readonly instance: v.InstanceSchema<typeof Builder, undefined>;
460
- }>, v.ReadonlyAction<{
461
- readonly references: readonly Readonly<{
462
- type: "ref";
463
- id: string;
464
- name: string;
465
- }>[];
466
- readonly options: readonly Readonly<{
467
- name: string;
468
- payload: unknown;
469
- gatePaths?: readonly (readonly (string | number)[])[] | import("../..").BuilderRef | Readonly<{
470
- type: "ref";
471
- id: string;
472
- name: string;
473
- }> | undefined;
474
- }>[];
475
- readonly components: readonly Readonly<{
476
- name: string;
477
- payload: unknown;
478
- gatePaths?: readonly (readonly (string | number)[])[] | import("../..").BuilderRef | Readonly<{
479
- type: "ref";
480
- id: string;
481
- name: string;
482
- }> | undefined;
483
- }>[];
484
- readonly collections: readonly import("..").BuilderCollectionSerialised[];
485
- readonly expectations: readonly Readonly<{
486
- name: string;
487
- kind: "option" | "component" | "collection" | "detail";
488
- }>[];
489
- }>]>;
490
- export type BuilderSerialised = v.InferOutput<typeof BuilderSerialisedSchema>;
491
- export type BuilderStateOf<Input extends Refable<BuilderGeneric>> = Input extends Builder<infer State extends BuilderState> ? State : BuilderStateEmpty;
492
- export type BuilderInstanceOf<Input extends BuilderGeneric> = Input extends Builder<infer State extends BuilderState> ? Prettify<State['model']> : never;
493
- export type BuilderReference = Refable<BuilderGeneric>;
494
- export type BuilderReferences = ReadonlyArray<Refable<BuilderGeneric>>;
16
+ export interface BuilderSerialised {
17
+ readonly model: v.InferOutput<typeof BuilderModelSerialisedSchema>;
18
+ readonly ui: v.InferOutput<typeof BuilderUISerialisedSchema>;
19
+ readonly bindings: BuilderBindingsSerialised;
20
+ }
21
+ export declare const BuilderSerialisedSchema: v.GenericSchema<BuilderSerialised>;