@builder-builder/builder 0.0.10 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bb.d.ts +28 -0
- package/dist/bb.js +49 -0
- package/dist/check.d.ts +1 -1
- package/dist/check.js +4 -2
- package/dist/entities/builder/bind.d.ts +4 -85
- package/dist/entities/builder/bind.js +1 -9
- package/dist/entities/builder/builder.d.ts +17 -509
- package/dist/entities/builder/builder.js +19 -79
- package/dist/entities/builder/factory.d.ts +7 -0
- package/dist/entities/builder/factory.js +4 -0
- package/dist/entities/builder/index.d.ts +3 -6
- package/dist/entities/builder/index.js +1 -2
- package/dist/entities/collection/collection.d.ts +69 -19
- package/dist/entities/collection/collection.js +7 -25
- package/dist/entities/collection/config.d.ts +38 -1095
- package/dist/entities/collection/config.js +8 -8
- package/dist/entities/collection/expectation.d.ts +8 -4
- package/dist/entities/collection/index.d.ts +2 -2
- package/dist/entities/collection/when.d.ts +5 -4
- package/dist/entities/component/component.d.ts +264 -293
- package/dist/entities/component/component.js +5 -5
- package/dist/entities/component/details.d.ts +32 -57
- package/dist/entities/component/details.js +8 -8
- package/dist/entities/component/expectation.d.ts +7 -4
- package/dist/entities/component/expectation.js +0 -3
- package/dist/entities/component/field.d.ts +50 -0
- package/dist/entities/component/field.js +41 -0
- package/dist/entities/component/index.d.ts +4 -2
- package/dist/entities/component/index.js +2 -1
- package/dist/entities/component/when.d.ts +1 -1
- package/dist/entities/component/when.js +2 -2
- package/dist/entities/entry.d.ts +4 -0
- package/dist/entities/expectation.d.ts +10 -22
- package/dist/entities/expectation.js +2 -7
- package/dist/entities/index.d.ts +20 -17
- package/dist/entities/index.js +9 -8
- package/dist/entities/kind.d.ts +8 -5
- package/dist/entities/kind.js +3 -4
- package/dist/entities/model/bind.d.ts +83 -0
- package/dist/entities/model/expectation.d.ts +16 -0
- package/dist/entities/model/index.d.ts +7 -0
- package/dist/entities/model/index.js +2 -0
- package/dist/entities/model/methods.d.ts +57 -0
- package/dist/entities/{builder → model}/methods.js +8 -8
- package/dist/entities/model/model.d.ts +39 -0
- package/dist/entities/model/model.js +73 -0
- package/dist/entities/model/models.d.ts +39 -0
- package/dist/entities/model/models.js +14 -0
- package/dist/entities/{builder → model}/state.d.ts +10 -10
- package/dist/entities/option/index.d.ts +1 -1
- package/dist/entities/option/index.js +1 -1
- package/dist/entities/option/option.d.ts +210 -209
- package/dist/entities/option/option.js +5 -5
- package/dist/entities/option/select.d.ts +2 -12
- package/dist/entities/option/select.js +6 -3
- package/dist/entities/option/toggle.d.ts +2 -9
- package/dist/entities/option/toggle.js +3 -3
- package/dist/entities/option/values.d.ts +3 -21
- package/dist/entities/option/values.js +8 -2
- package/dist/entities/option/when.d.ts +5 -4
- package/dist/entities/refs.d.ts +6 -0
- package/dist/entities/refs.js +1 -0
- package/dist/entities/serialise.d.ts +388 -2919
- package/dist/entities/serialise.js +116 -17
- package/dist/entities/ui/describe.d.ts +22 -31
- package/dist/entities/ui/describe.js +1 -1
- package/dist/entities/ui/index.d.ts +2 -5
- package/dist/entities/ui/index.js +1 -2
- package/dist/entities/ui/page.d.ts +22 -31
- package/dist/entities/ui/page.js +1 -1
- package/dist/entities/ui/pages.d.ts +11 -8
- package/dist/entities/ui/pages.js +1 -1
- package/dist/entities/ui/ui.d.ts +22 -1194
- package/dist/entities/ui/ui.js +16 -28
- package/dist/entities/ui/uis.d.ts +5 -15
- package/dist/entities/ui/uis.js +12 -18
- package/dist/entities/validated.d.ts +35 -0
- package/dist/entities/validated.js +1 -0
- package/dist/entities/when.d.ts +62 -54
- package/dist/entities/when.js +1 -0
- package/dist/environment.d.ts +5 -0
- package/dist/environment.js +2 -0
- package/dist/exception.d.ts +8 -3
- package/dist/exception.js +3 -0
- package/dist/index.d.ts +21 -28
- package/dist/index.js +5 -13
- package/dist/instance.d.ts +56 -0
- package/dist/instance.js +10 -0
- package/dist/mappers/index.d.ts +7 -7
- package/dist/mappers/index.js +5 -4
- package/dist/mappers/instance.d.ts +3 -0
- package/dist/mappers/instance.js +36 -0
- package/dist/mappers/order.d.ts +6 -0
- package/dist/mappers/order.js +22 -0
- package/dist/mappers/render/pages.d.ts +5 -4
- package/dist/mappers/render/render.d.ts +2 -3
- package/dist/mappers/render/render.js +97 -78
- package/dist/mappers/resolve.d.ts +5 -9
- package/dist/mappers/resolve.js +25 -33
- package/dist/mappers/variants/index.d.ts +1 -0
- package/dist/mappers/variants/index.js +1 -0
- package/dist/mappers/variants/option-graph.d.ts +19 -0
- package/dist/mappers/{models → variants}/option-graph.js +33 -22
- package/dist/mappers/variants/variants.d.ts +3 -0
- package/dist/mappers/variants/variants.js +57 -0
- package/dist/private.d.ts +4 -0
- package/dist/private.js +4 -0
- package/dist/references.d.ts +13 -48
- package/dist/references.js +6 -14
- package/dist/serialisable.d.ts +1 -9
- package/dist/serialisable.js +2 -3
- package/dist/validate/brand.d.ts +14 -0
- package/dist/validate/brand.js +17 -0
- package/dist/validate/builder.d.ts +4 -0
- package/dist/validate/builder.js +27 -0
- package/dist/validate/expectations.d.ts +10 -0
- package/dist/validate/expectations.js +12 -0
- package/dist/validate/index.d.ts +18 -0
- package/dist/validate/index.js +9 -0
- package/dist/validate/instance.d.ts +19 -0
- package/dist/validate/instance.js +46 -0
- package/dist/validate/model.d.ts +36 -0
- package/dist/validate/model.js +220 -0
- package/dist/validate/resolve.d.ts +16 -0
- package/dist/validate/resolve.js +91 -0
- package/dist/validate/result.d.ts +8 -0
- package/dist/validate/result.js +4 -0
- package/dist/validate/ui.d.ts +8 -0
- package/dist/validate/ui.js +77 -0
- package/dist/validate/variants.d.ts +59 -0
- package/dist/validate/variants.js +102 -0
- package/package.json +5 -4
- package/dist/entities/bind.d.ts +0 -4
- package/dist/entities/bind.js +0 -44
- package/dist/entities/builder/builders.d.ts +0 -35
- package/dist/entities/builder/builders.js +0 -19
- package/dist/entities/builder/expectation.d.ts +0 -12
- package/dist/entities/builder/methods.d.ts +0 -58
- package/dist/entities/builder/validate.d.ts +0 -3
- package/dist/entities/builder/validate.js +0 -108
- package/dist/entities/errors.d.ts +0 -21
- package/dist/entities/ui/bind.d.ts +0 -10
- package/dist/entities/ui/bind.js +0 -9
- package/dist/entities/ui/validate.d.ts +0 -8
- package/dist/entities/ui/validate.js +0 -21
- package/dist/entities/validate.d.ts +0 -28
- package/dist/mappers/assert/builder.d.ts +0 -2
- package/dist/mappers/assert/builder.js +0 -46
- package/dist/mappers/assert/expectation.d.ts +0 -2
- package/dist/mappers/assert/expectation.js +0 -23
- package/dist/mappers/assert/index.d.ts +0 -6
- package/dist/mappers/assert/index.js +0 -4
- package/dist/mappers/assert/model.d.ts +0 -13
- package/dist/mappers/assert/model.js +0 -47
- package/dist/mappers/assert/models.d.ts +0 -33
- package/dist/mappers/assert/models.js +0 -74
- package/dist/mappers/assert/ui.d.ts +0 -2
- package/dist/mappers/assert/ui.js +0 -22
- package/dist/mappers/instance/index.d.ts +0 -1
- package/dist/mappers/instance/index.js +0 -1
- package/dist/mappers/instance/instance.d.ts +0 -4
- package/dist/mappers/instance/instance.js +0 -33
- package/dist/mappers/models/component-graph.d.ts +0 -9
- package/dist/mappers/models/component-graph.js +0 -51
- package/dist/mappers/models/graph.d.ts +0 -12
- package/dist/mappers/models/graph.js +0 -17
- package/dist/mappers/models/index.d.ts +0 -1
- package/dist/mappers/models/index.js +0 -1
- package/dist/mappers/models/models.d.ts +0 -3
- package/dist/mappers/models/models.js +0 -37
- package/dist/mappers/models/option-graph.d.ts +0 -9
- package/dist/mappers/order/index.d.ts +0 -2
- package/dist/mappers/order/index.js +0 -1
- package/dist/mappers/order/order.d.ts +0 -14
- package/dist/mappers/order/order.js +0 -31
- package/dist/mappers/refs.d.ts +0 -12
- package/dist/mappers/refs.js +0 -36
- package/dist/model.d.ts +0 -35
- package/dist/model.js +0 -9
- package/dist/walker/index.d.ts +0 -2
- package/dist/walker/index.js +0 -1
- package/dist/walker/walkable.d.ts +0 -4
- package/dist/walker/walkable.js +0 -4
- package/dist/walker/walker.d.ts +0 -26
- package/dist/walker/walker.js +0 -115
- package/dist/walker/walkers.d.ts +0 -9
- package/dist/walker/walkers.js +0 -55
- /package/dist/entities/{builder/expectation.js → entry.js} +0 -0
- /package/dist/entities/{builder/state.js → model/bind.js} +0 -0
- /package/dist/entities/{errors.js → model/expectation.js} +0 -0
- /package/dist/entities/{validate.js → model/state.js} +0 -0
|
@@ -1,513 +1,21 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
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 './bind';
|
|
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
|
-
|
|
14
|
-
|
|
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
|
|
17
|
-
readonly
|
|
18
|
-
readonly
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
readonly references: BuilderReferences;
|
|
22
|
-
readonly id: `${string}-${string}-${string}-${string}-${string}`;
|
|
23
|
-
constructor(parameters?: BuilderParameters, options?: BuilderOptions, components?: BuilderComponents, collections?: BuilderCollections, expectations?: BuilderExpectations, references?: BuilderReferences);
|
|
24
|
-
get option(): BuilderOptionMethod<State>;
|
|
25
|
-
get component(): BuilderComponentMethod<State>;
|
|
26
|
-
get collection(): BuilderCollectionMethod<State>;
|
|
27
|
-
expect<const Expectations extends readonly [BuilderExpectation, ...ReadonlyArray<BuilderExpectation>]>(...expectations: Expectations): Builder<BuilderStateAsserted<State, Expectations>>;
|
|
28
|
-
bind<const Bindings extends BuilderBindings<State>>(bindings: Bindings & {
|
|
29
|
-
readonly [Key in keyof Bindings]: BuilderWhenConstrained<State, Bindings[Key]>;
|
|
30
|
-
}): Builder<Prettify<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>;
|
|
31
14
|
}
|
|
32
|
-
export type BuilderGeneric = Builder<BuilderState>;
|
|
33
15
|
export declare const BuilderSchema: v.InstanceSchema<typeof Builder, undefined>;
|
|
34
|
-
export
|
|
35
|
-
readonly
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
type: "parameter";
|
|
41
|
-
id: string;
|
|
42
|
-
name: string;
|
|
43
|
-
}>]>, undefined>, v.ReadonlyAction<Readonly<{
|
|
44
|
-
type: "parameter";
|
|
45
|
-
id: string;
|
|
46
|
-
name: string;
|
|
47
|
-
}>[]>]>;
|
|
48
|
-
readonly options: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
49
|
-
readonly name: v.StringSchema<undefined>;
|
|
50
|
-
readonly payload: v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
51
|
-
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
52
|
-
readonly id: v.StringSchema<undefined>;
|
|
53
|
-
readonly name: v.StringSchema<undefined>;
|
|
54
|
-
}, undefined>, v.ReadonlyAction<{
|
|
55
|
-
type: "parameter";
|
|
56
|
-
id: string;
|
|
57
|
-
name: string;
|
|
58
|
-
}>]>, v.InstanceSchema<typeof import("../..").BuilderParameter, undefined>, v.UnionSchema<[v.SchemaWithPipe<readonly [v.VariantSchema<"type", [v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
59
|
-
readonly type: v.LiteralSchema<"select", undefined>;
|
|
60
|
-
readonly options: v.SchemaWithPipe<readonly [v.TupleWithRestSchema<[v.StringSchema<undefined>], v.StringSchema<undefined>, undefined>, v.ReadonlyAction<[string, ...string[]]>]>;
|
|
61
|
-
readonly defaultValue: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
62
|
-
readonly isOptional: v.BooleanSchema<undefined>;
|
|
63
|
-
readonly optionLabels: v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>;
|
|
64
|
-
}, undefined>, v.MetadataAction<{
|
|
65
|
-
type: "select";
|
|
66
|
-
readonly options: readonly [string, ...string[]];
|
|
67
|
-
defaultValue: string | null;
|
|
68
|
-
isOptional: boolean;
|
|
69
|
-
optionLabels: {
|
|
70
|
-
[x: string]: string;
|
|
71
|
-
};
|
|
72
|
-
}, {
|
|
73
|
-
readonly serialisable: typeof import("..").BuilderSelectType;
|
|
74
|
-
readonly instance: v.InstanceSchema<typeof import("..").BuilderSelectType, undefined>;
|
|
75
|
-
}>, v.ReadonlyAction<{
|
|
76
|
-
type: "select";
|
|
77
|
-
readonly options: readonly [string, ...string[]];
|
|
78
|
-
defaultValue: string | null;
|
|
79
|
-
isOptional: boolean;
|
|
80
|
-
optionLabels: {
|
|
81
|
-
[x: string]: string;
|
|
82
|
-
};
|
|
83
|
-
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
84
|
-
readonly type: v.LiteralSchema<"toggle", undefined>;
|
|
85
|
-
readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
|
|
86
|
-
readonly defaultValue: v.NullableSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
|
|
87
|
-
readonly isOptional: v.BooleanSchema<undefined>;
|
|
88
|
-
}, undefined>, v.MetadataAction<{
|
|
89
|
-
type: "toggle";
|
|
90
|
-
valueType: "string" | "number" | "boolean";
|
|
91
|
-
defaultValue: string | number | boolean | null;
|
|
92
|
-
isOptional: boolean;
|
|
93
|
-
}, {
|
|
94
|
-
readonly serialisable: typeof import("..").BuilderToggleType;
|
|
95
|
-
readonly instance: v.InstanceSchema<typeof import("..").BuilderToggleType, undefined>;
|
|
96
|
-
}>, v.ReadonlyAction<{
|
|
97
|
-
type: "toggle";
|
|
98
|
-
valueType: "string" | "number" | "boolean";
|
|
99
|
-
defaultValue: string | number | boolean | null;
|
|
100
|
-
isOptional: boolean;
|
|
101
|
-
}>]>], undefined>, v.ReadonlyAction<Readonly<{
|
|
102
|
-
type: "select";
|
|
103
|
-
readonly options: readonly [string, ...string[]];
|
|
104
|
-
defaultValue: string | null;
|
|
105
|
-
isOptional: boolean;
|
|
106
|
-
optionLabels: {
|
|
107
|
-
[x: string]: string;
|
|
108
|
-
};
|
|
109
|
-
}> | Readonly<{
|
|
110
|
-
type: "toggle";
|
|
111
|
-
valueType: "string" | "number" | "boolean";
|
|
112
|
-
defaultValue: string | number | boolean | null;
|
|
113
|
-
isOptional: boolean;
|
|
114
|
-
}>>]>, v.GenericSchema], undefined>], undefined>, v.MetadataAction<unknown, {
|
|
115
|
-
readonly paramable: v.UnionSchema<[v.SchemaWithPipe<readonly [v.VariantSchema<"type", [v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
116
|
-
readonly type: v.LiteralSchema<"select", undefined>;
|
|
117
|
-
readonly options: v.SchemaWithPipe<readonly [v.TupleWithRestSchema<[v.StringSchema<undefined>], v.StringSchema<undefined>, undefined>, v.ReadonlyAction<[string, ...string[]]>]>;
|
|
118
|
-
readonly defaultValue: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
119
|
-
readonly isOptional: v.BooleanSchema<undefined>;
|
|
120
|
-
readonly optionLabels: v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>;
|
|
121
|
-
}, undefined>, v.MetadataAction<{
|
|
122
|
-
type: "select";
|
|
123
|
-
readonly options: readonly [string, ...string[]];
|
|
124
|
-
defaultValue: string | null;
|
|
125
|
-
isOptional: boolean;
|
|
126
|
-
optionLabels: {
|
|
127
|
-
[x: string]: string;
|
|
128
|
-
};
|
|
129
|
-
}, {
|
|
130
|
-
readonly serialisable: typeof import("..").BuilderSelectType;
|
|
131
|
-
readonly instance: v.InstanceSchema<typeof import("..").BuilderSelectType, undefined>;
|
|
132
|
-
}>, v.ReadonlyAction<{
|
|
133
|
-
type: "select";
|
|
134
|
-
readonly options: readonly [string, ...string[]];
|
|
135
|
-
defaultValue: string | null;
|
|
136
|
-
isOptional: boolean;
|
|
137
|
-
optionLabels: {
|
|
138
|
-
[x: string]: string;
|
|
139
|
-
};
|
|
140
|
-
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
141
|
-
readonly type: v.LiteralSchema<"toggle", undefined>;
|
|
142
|
-
readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
|
|
143
|
-
readonly defaultValue: v.NullableSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
|
|
144
|
-
readonly isOptional: v.BooleanSchema<undefined>;
|
|
145
|
-
}, undefined>, v.MetadataAction<{
|
|
146
|
-
type: "toggle";
|
|
147
|
-
valueType: "string" | "number" | "boolean";
|
|
148
|
-
defaultValue: string | number | boolean | null;
|
|
149
|
-
isOptional: boolean;
|
|
150
|
-
}, {
|
|
151
|
-
readonly serialisable: typeof import("..").BuilderToggleType;
|
|
152
|
-
readonly instance: v.InstanceSchema<typeof import("..").BuilderToggleType, undefined>;
|
|
153
|
-
}>, v.ReadonlyAction<{
|
|
154
|
-
type: "toggle";
|
|
155
|
-
valueType: "string" | "number" | "boolean";
|
|
156
|
-
defaultValue: string | number | boolean | null;
|
|
157
|
-
isOptional: boolean;
|
|
158
|
-
}>]>], undefined>, v.ReadonlyAction<Readonly<{
|
|
159
|
-
type: "select";
|
|
160
|
-
readonly options: readonly [string, ...string[]];
|
|
161
|
-
defaultValue: string | null;
|
|
162
|
-
isOptional: boolean;
|
|
163
|
-
optionLabels: {
|
|
164
|
-
[x: string]: string;
|
|
165
|
-
};
|
|
166
|
-
}> | Readonly<{
|
|
167
|
-
type: "toggle";
|
|
168
|
-
valueType: "string" | "number" | "boolean";
|
|
169
|
-
defaultValue: string | number | boolean | null;
|
|
170
|
-
isOptional: boolean;
|
|
171
|
-
}>>]>, v.GenericSchema], undefined>;
|
|
172
|
-
}>]>;
|
|
173
|
-
readonly gatePaths: v.OptionalSchema<v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
174
|
-
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
175
|
-
readonly id: v.StringSchema<undefined>;
|
|
176
|
-
readonly name: v.StringSchema<undefined>;
|
|
177
|
-
}, undefined>, v.ReadonlyAction<{
|
|
178
|
-
type: "parameter";
|
|
179
|
-
id: string;
|
|
180
|
-
name: string;
|
|
181
|
-
}>]>, 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<{
|
|
182
|
-
type: "parameter";
|
|
183
|
-
id: string;
|
|
184
|
-
name: string;
|
|
185
|
-
}> | import("../..").BuilderParameter<string>, {
|
|
186
|
-
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)[])[]>]>;
|
|
187
|
-
}>]>, undefined>;
|
|
188
|
-
}, undefined>, v.MetadataAction<{
|
|
189
|
-
name: string;
|
|
190
|
-
payload: unknown;
|
|
191
|
-
gatePaths?: readonly (readonly (string | number)[])[] | Readonly<{
|
|
192
|
-
type: "parameter";
|
|
193
|
-
id: string;
|
|
194
|
-
name: string;
|
|
195
|
-
}> | import("../..").BuilderParameter<string> | undefined;
|
|
196
|
-
}, {
|
|
197
|
-
readonly serialisable: typeof import("..").BuilderOption;
|
|
198
|
-
readonly instance: v.InstanceSchema<typeof import("..").BuilderOption, undefined>;
|
|
199
|
-
}>, v.ReadonlyAction<{
|
|
200
|
-
name: string;
|
|
201
|
-
payload: unknown;
|
|
202
|
-
gatePaths?: readonly (readonly (string | number)[])[] | Readonly<{
|
|
203
|
-
type: "parameter";
|
|
204
|
-
id: string;
|
|
205
|
-
name: string;
|
|
206
|
-
}> | import("../..").BuilderParameter<string> | undefined;
|
|
207
|
-
}>]>, undefined>, v.ReadonlyAction<Readonly<{
|
|
208
|
-
name: string;
|
|
209
|
-
payload: unknown;
|
|
210
|
-
gatePaths?: readonly (readonly (string | number)[])[] | Readonly<{
|
|
211
|
-
type: "parameter";
|
|
212
|
-
id: string;
|
|
213
|
-
name: string;
|
|
214
|
-
}> | import("../..").BuilderParameter<string> | undefined;
|
|
215
|
-
}>[]>]>;
|
|
216
|
-
readonly components: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
217
|
-
readonly name: v.StringSchema<undefined>;
|
|
218
|
-
readonly payload: v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
219
|
-
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
220
|
-
readonly id: v.StringSchema<undefined>;
|
|
221
|
-
readonly name: v.StringSchema<undefined>;
|
|
222
|
-
}, undefined>, v.ReadonlyAction<{
|
|
223
|
-
type: "parameter";
|
|
224
|
-
id: string;
|
|
225
|
-
name: string;
|
|
226
|
-
}>]>, v.InstanceSchema<typeof import("../..").BuilderParameter, undefined>, v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
227
|
-
readonly expectations: v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
228
|
-
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
229
|
-
readonly id: v.StringSchema<undefined>;
|
|
230
|
-
readonly name: v.StringSchema<undefined>;
|
|
231
|
-
}, undefined>, v.ReadonlyAction<{
|
|
232
|
-
type: "parameter";
|
|
233
|
-
id: string;
|
|
234
|
-
name: string;
|
|
235
|
-
}>]>, v.InstanceSchema<typeof import("../..").BuilderParameter, undefined>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
236
|
-
readonly name: v.StringSchema<undefined>;
|
|
237
|
-
readonly kind: v.PicklistSchema<["option", "component", "collection", "detail"], undefined>;
|
|
238
|
-
}, undefined>, v.MetadataAction<{
|
|
239
|
-
name: string;
|
|
240
|
-
kind: "option" | "component" | "collection" | "detail";
|
|
241
|
-
}, {
|
|
242
|
-
readonly serialisable: typeof BuilderExpectation;
|
|
243
|
-
readonly instance: v.InstanceSchema<typeof BuilderExpectation, undefined>;
|
|
244
|
-
}>, v.ReadonlyAction<{
|
|
245
|
-
name: string;
|
|
246
|
-
kind: "option" | "component" | "collection" | "detail";
|
|
247
|
-
}>]>, undefined>, v.ReadonlyAction<Readonly<{
|
|
248
|
-
name: string;
|
|
249
|
-
kind: "option" | "component" | "collection" | "detail";
|
|
250
|
-
}>[]>]>], undefined>, v.MetadataAction<Readonly<{
|
|
251
|
-
type: "parameter";
|
|
252
|
-
id: string;
|
|
253
|
-
name: string;
|
|
254
|
-
}> | import("../..").BuilderParameter<string> | readonly Readonly<{
|
|
255
|
-
name: string;
|
|
256
|
-
kind: "option" | "component" | "collection" | "detail";
|
|
257
|
-
}>[], {
|
|
258
|
-
readonly paramable: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
259
|
-
readonly name: v.StringSchema<undefined>;
|
|
260
|
-
readonly kind: v.PicklistSchema<["option", "component", "collection", "detail"], undefined>;
|
|
261
|
-
}, undefined>, v.MetadataAction<{
|
|
262
|
-
name: string;
|
|
263
|
-
kind: "option" | "component" | "collection" | "detail";
|
|
264
|
-
}, {
|
|
265
|
-
readonly serialisable: typeof BuilderExpectation;
|
|
266
|
-
readonly instance: v.InstanceSchema<typeof BuilderExpectation, undefined>;
|
|
267
|
-
}>, v.ReadonlyAction<{
|
|
268
|
-
name: string;
|
|
269
|
-
kind: "option" | "component" | "collection" | "detail";
|
|
270
|
-
}>]>, undefined>, v.ReadonlyAction<Readonly<{
|
|
271
|
-
name: string;
|
|
272
|
-
kind: "option" | "component" | "collection" | "detail";
|
|
273
|
-
}>[]>]>;
|
|
274
|
-
}>]>;
|
|
275
|
-
}, undefined>, v.MetadataAction<{
|
|
276
|
-
expectations: Readonly<{
|
|
277
|
-
type: "parameter";
|
|
278
|
-
id: string;
|
|
279
|
-
name: string;
|
|
280
|
-
}> | import("../..").BuilderParameter<string> | readonly Readonly<{
|
|
281
|
-
name: string;
|
|
282
|
-
kind: "option" | "component" | "collection" | "detail";
|
|
283
|
-
}>[];
|
|
284
|
-
}, {
|
|
285
|
-
readonly serialisable: typeof BuilderComponentDetails;
|
|
286
|
-
readonly instance: v.InstanceSchema<typeof BuilderComponentDetails, undefined>;
|
|
287
|
-
}>, v.ReadonlyAction<{
|
|
288
|
-
expectations: Readonly<{
|
|
289
|
-
type: "parameter";
|
|
290
|
-
id: string;
|
|
291
|
-
name: string;
|
|
292
|
-
}> | import("../..").BuilderParameter<string> | readonly Readonly<{
|
|
293
|
-
name: string;
|
|
294
|
-
kind: "option" | "component" | "collection" | "detail";
|
|
295
|
-
}>[];
|
|
296
|
-
}>]>, v.GenericSchema], undefined>], undefined>, v.MetadataAction<unknown, {
|
|
297
|
-
readonly paramable: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
298
|
-
readonly expectations: v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
299
|
-
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
300
|
-
readonly id: v.StringSchema<undefined>;
|
|
301
|
-
readonly name: v.StringSchema<undefined>;
|
|
302
|
-
}, undefined>, v.ReadonlyAction<{
|
|
303
|
-
type: "parameter";
|
|
304
|
-
id: string;
|
|
305
|
-
name: string;
|
|
306
|
-
}>]>, v.InstanceSchema<typeof import("../..").BuilderParameter, undefined>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
307
|
-
readonly name: v.StringSchema<undefined>;
|
|
308
|
-
readonly kind: v.PicklistSchema<["option", "component", "collection", "detail"], undefined>;
|
|
309
|
-
}, undefined>, v.MetadataAction<{
|
|
310
|
-
name: string;
|
|
311
|
-
kind: "option" | "component" | "collection" | "detail";
|
|
312
|
-
}, {
|
|
313
|
-
readonly serialisable: typeof BuilderExpectation;
|
|
314
|
-
readonly instance: v.InstanceSchema<typeof BuilderExpectation, undefined>;
|
|
315
|
-
}>, v.ReadonlyAction<{
|
|
316
|
-
name: string;
|
|
317
|
-
kind: "option" | "component" | "collection" | "detail";
|
|
318
|
-
}>]>, undefined>, v.ReadonlyAction<Readonly<{
|
|
319
|
-
name: string;
|
|
320
|
-
kind: "option" | "component" | "collection" | "detail";
|
|
321
|
-
}>[]>]>], undefined>, v.MetadataAction<Readonly<{
|
|
322
|
-
type: "parameter";
|
|
323
|
-
id: string;
|
|
324
|
-
name: string;
|
|
325
|
-
}> | import("../..").BuilderParameter<string> | readonly Readonly<{
|
|
326
|
-
name: string;
|
|
327
|
-
kind: "option" | "component" | "collection" | "detail";
|
|
328
|
-
}>[], {
|
|
329
|
-
readonly paramable: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
330
|
-
readonly name: v.StringSchema<undefined>;
|
|
331
|
-
readonly kind: v.PicklistSchema<["option", "component", "collection", "detail"], undefined>;
|
|
332
|
-
}, undefined>, v.MetadataAction<{
|
|
333
|
-
name: string;
|
|
334
|
-
kind: "option" | "component" | "collection" | "detail";
|
|
335
|
-
}, {
|
|
336
|
-
readonly serialisable: typeof BuilderExpectation;
|
|
337
|
-
readonly instance: v.InstanceSchema<typeof BuilderExpectation, undefined>;
|
|
338
|
-
}>, v.ReadonlyAction<{
|
|
339
|
-
name: string;
|
|
340
|
-
kind: "option" | "component" | "collection" | "detail";
|
|
341
|
-
}>]>, undefined>, v.ReadonlyAction<Readonly<{
|
|
342
|
-
name: string;
|
|
343
|
-
kind: "option" | "component" | "collection" | "detail";
|
|
344
|
-
}>[]>]>;
|
|
345
|
-
}>]>;
|
|
346
|
-
}, undefined>, v.MetadataAction<{
|
|
347
|
-
expectations: Readonly<{
|
|
348
|
-
type: "parameter";
|
|
349
|
-
id: string;
|
|
350
|
-
name: string;
|
|
351
|
-
}> | import("../..").BuilderParameter<string> | readonly Readonly<{
|
|
352
|
-
name: string;
|
|
353
|
-
kind: "option" | "component" | "collection" | "detail";
|
|
354
|
-
}>[];
|
|
355
|
-
}, {
|
|
356
|
-
readonly serialisable: typeof BuilderComponentDetails;
|
|
357
|
-
readonly instance: v.InstanceSchema<typeof BuilderComponentDetails, undefined>;
|
|
358
|
-
}>, v.ReadonlyAction<{
|
|
359
|
-
expectations: Readonly<{
|
|
360
|
-
type: "parameter";
|
|
361
|
-
id: string;
|
|
362
|
-
name: string;
|
|
363
|
-
}> | import("../..").BuilderParameter<string> | readonly Readonly<{
|
|
364
|
-
name: string;
|
|
365
|
-
kind: "option" | "component" | "collection" | "detail";
|
|
366
|
-
}>[];
|
|
367
|
-
}>]>, v.GenericSchema], undefined>;
|
|
368
|
-
}>]>;
|
|
369
|
-
readonly gatePaths: v.OptionalSchema<v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
370
|
-
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
371
|
-
readonly id: v.StringSchema<undefined>;
|
|
372
|
-
readonly name: v.StringSchema<undefined>;
|
|
373
|
-
}, undefined>, v.ReadonlyAction<{
|
|
374
|
-
type: "parameter";
|
|
375
|
-
id: string;
|
|
376
|
-
name: string;
|
|
377
|
-
}>]>, 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<{
|
|
378
|
-
type: "parameter";
|
|
379
|
-
id: string;
|
|
380
|
-
name: string;
|
|
381
|
-
}> | import("../..").BuilderParameter<string>, {
|
|
382
|
-
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)[])[]>]>;
|
|
383
|
-
}>]>, undefined>;
|
|
384
|
-
}, undefined>, v.MetadataAction<{
|
|
385
|
-
name: string;
|
|
386
|
-
payload: unknown;
|
|
387
|
-
gatePaths?: readonly (readonly (string | number)[])[] | Readonly<{
|
|
388
|
-
type: "parameter";
|
|
389
|
-
id: string;
|
|
390
|
-
name: string;
|
|
391
|
-
}> | import("../..").BuilderParameter<string> | undefined;
|
|
392
|
-
}, {
|
|
393
|
-
readonly serialisable: typeof import("..").BuilderComponent;
|
|
394
|
-
readonly instance: v.InstanceSchema<typeof import("..").BuilderComponent, undefined>;
|
|
395
|
-
}>, v.ReadonlyAction<{
|
|
396
|
-
name: string;
|
|
397
|
-
payload: unknown;
|
|
398
|
-
gatePaths?: readonly (readonly (string | number)[])[] | Readonly<{
|
|
399
|
-
type: "parameter";
|
|
400
|
-
id: string;
|
|
401
|
-
name: string;
|
|
402
|
-
}> | import("../..").BuilderParameter<string> | undefined;
|
|
403
|
-
}>]>, undefined>, v.ReadonlyAction<Readonly<{
|
|
404
|
-
name: string;
|
|
405
|
-
payload: unknown;
|
|
406
|
-
gatePaths?: readonly (readonly (string | number)[])[] | Readonly<{
|
|
407
|
-
type: "parameter";
|
|
408
|
-
id: string;
|
|
409
|
-
name: string;
|
|
410
|
-
}> | import("../..").BuilderParameter<string> | undefined;
|
|
411
|
-
}>[]>]>;
|
|
412
|
-
readonly collections: v.SchemaWithPipe<readonly [v.ArraySchema<v.GenericSchema<import("..").BuilderCollectionSerialised>, undefined>, v.ReadonlyAction<import("..").BuilderCollectionSerialised[]>]>;
|
|
413
|
-
readonly expectations: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
414
|
-
readonly name: v.StringSchema<undefined>;
|
|
415
|
-
readonly kind: v.PicklistSchema<["option", "component", "collection", "detail"], undefined>;
|
|
416
|
-
}, undefined>, v.MetadataAction<{
|
|
417
|
-
name: string;
|
|
418
|
-
kind: "option" | "component" | "collection" | "detail";
|
|
419
|
-
}, {
|
|
420
|
-
readonly serialisable: typeof BuilderExpectation;
|
|
421
|
-
readonly instance: v.InstanceSchema<typeof BuilderExpectation, undefined>;
|
|
422
|
-
}>, v.ReadonlyAction<{
|
|
423
|
-
name: string;
|
|
424
|
-
kind: "option" | "component" | "collection" | "detail";
|
|
425
|
-
}>]>, undefined>, v.ReadonlyAction<Readonly<{
|
|
426
|
-
name: string;
|
|
427
|
-
kind: "option" | "component" | "collection" | "detail";
|
|
428
|
-
}>[]>]>;
|
|
429
|
-
readonly references: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
430
|
-
readonly parameter: v.StringSchema<undefined>;
|
|
431
|
-
readonly id: v.StringSchema<undefined>;
|
|
432
|
-
}, undefined>, v.ReadonlyAction<{
|
|
433
|
-
parameter: string;
|
|
434
|
-
id: string;
|
|
435
|
-
}>]>, undefined>, v.ReadonlyAction<Readonly<{
|
|
436
|
-
parameter: string;
|
|
437
|
-
id: string;
|
|
438
|
-
}>[]>]>;
|
|
439
|
-
}, undefined>, v.MetadataAction<{
|
|
440
|
-
readonly parameters: readonly Readonly<{
|
|
441
|
-
type: "parameter";
|
|
442
|
-
id: string;
|
|
443
|
-
name: string;
|
|
444
|
-
}>[];
|
|
445
|
-
readonly options: readonly Readonly<{
|
|
446
|
-
name: string;
|
|
447
|
-
payload: unknown;
|
|
448
|
-
gatePaths?: readonly (readonly (string | number)[])[] | Readonly<{
|
|
449
|
-
type: "parameter";
|
|
450
|
-
id: string;
|
|
451
|
-
name: string;
|
|
452
|
-
}> | import("../..").BuilderParameter<string> | undefined;
|
|
453
|
-
}>[];
|
|
454
|
-
readonly components: readonly Readonly<{
|
|
455
|
-
name: string;
|
|
456
|
-
payload: unknown;
|
|
457
|
-
gatePaths?: readonly (readonly (string | number)[])[] | Readonly<{
|
|
458
|
-
type: "parameter";
|
|
459
|
-
id: string;
|
|
460
|
-
name: string;
|
|
461
|
-
}> | import("../..").BuilderParameter<string> | undefined;
|
|
462
|
-
}>[];
|
|
463
|
-
readonly collections: readonly import("..").BuilderCollectionSerialised[];
|
|
464
|
-
readonly expectations: readonly Readonly<{
|
|
465
|
-
name: string;
|
|
466
|
-
kind: "option" | "component" | "collection" | "detail";
|
|
467
|
-
}>[];
|
|
468
|
-
readonly references: readonly Readonly<{
|
|
469
|
-
parameter: string;
|
|
470
|
-
id: string;
|
|
471
|
-
}>[];
|
|
472
|
-
}, {
|
|
473
|
-
readonly serialisable: typeof Builder;
|
|
474
|
-
readonly instance: v.InstanceSchema<typeof Builder, undefined>;
|
|
475
|
-
}>, v.ReadonlyAction<{
|
|
476
|
-
readonly parameters: readonly Readonly<{
|
|
477
|
-
type: "parameter";
|
|
478
|
-
id: string;
|
|
479
|
-
name: string;
|
|
480
|
-
}>[];
|
|
481
|
-
readonly options: readonly Readonly<{
|
|
482
|
-
name: string;
|
|
483
|
-
payload: unknown;
|
|
484
|
-
gatePaths?: readonly (readonly (string | number)[])[] | Readonly<{
|
|
485
|
-
type: "parameter";
|
|
486
|
-
id: string;
|
|
487
|
-
name: string;
|
|
488
|
-
}> | import("../..").BuilderParameter<string> | undefined;
|
|
489
|
-
}>[];
|
|
490
|
-
readonly components: readonly Readonly<{
|
|
491
|
-
name: string;
|
|
492
|
-
payload: unknown;
|
|
493
|
-
gatePaths?: readonly (readonly (string | number)[])[] | Readonly<{
|
|
494
|
-
type: "parameter";
|
|
495
|
-
id: string;
|
|
496
|
-
name: string;
|
|
497
|
-
}> | import("../..").BuilderParameter<string> | undefined;
|
|
498
|
-
}>[];
|
|
499
|
-
readonly collections: readonly import("..").BuilderCollectionSerialised[];
|
|
500
|
-
readonly expectations: readonly Readonly<{
|
|
501
|
-
name: string;
|
|
502
|
-
kind: "option" | "component" | "collection" | "detail";
|
|
503
|
-
}>[];
|
|
504
|
-
readonly references: readonly Readonly<{
|
|
505
|
-
parameter: string;
|
|
506
|
-
id: string;
|
|
507
|
-
}>[];
|
|
508
|
-
}>]>;
|
|
509
|
-
export type BuilderSerialised = v.InferOutput<typeof BuilderSerialisedSchema>;
|
|
510
|
-
export type BuilderStateOf<Input extends Paramable<BuilderGeneric>> = Input extends Builder<infer State extends BuilderState> ? State : BuilderStateEmpty;
|
|
511
|
-
export type BuilderInstanceOf<Input extends BuilderGeneric> = Input extends Builder<infer State extends BuilderState> ? Prettify<State['model']> : never;
|
|
512
|
-
export type BuilderPart = Paramable<BuilderGeneric>;
|
|
513
|
-
export type BuilderParts = ReadonlyArray<Paramable<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>;
|
|
@@ -1,87 +1,27 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
|
-
import {
|
|
3
|
-
import { BuilderParametersSerialisedSchema, BuilderReferencesSchema } from '../../references.js';
|
|
2
|
+
import { BuilderRefSerialisedSchema } from '../../references.js';
|
|
4
3
|
import { serialisable } from '../../serialisable.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { BuilderExpectationsSerialisedSchema } from '../expectation.js';
|
|
8
|
-
import { BuilderOptionsSerialisedSchema } from '../option/index.js';
|
|
9
|
-
import { builderCollectionMethod, builderComponentMethod, builderOptionMethod } from './methods.js';
|
|
10
|
-
import { bindBuilder } from './bind.js';
|
|
11
|
-
import { validateDuplicates, validatePaths } from './validate.js';
|
|
4
|
+
import { BuilderModel, BuilderModelSerialisedSchema } from '../model/index.js';
|
|
5
|
+
import { BuilderUI, BuilderUISerialisedSchema } from '../ui/index.js';
|
|
12
6
|
export class Builder {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
constructor(parameters = [], options = [], components = [], collections = [], expectations = [], references = []) {
|
|
21
|
-
this.parameters = parameters;
|
|
22
|
-
this.options = options;
|
|
23
|
-
this.components = components;
|
|
24
|
-
this.collections = collections;
|
|
25
|
-
this.expectations = expectations;
|
|
26
|
-
this.references = references;
|
|
27
|
-
validateDuplicates(this);
|
|
28
|
-
validatePaths(this);
|
|
7
|
+
model;
|
|
8
|
+
ui;
|
|
9
|
+
bindings;
|
|
10
|
+
constructor(model = new BuilderModel(), ui = new BuilderUI([], [], []), bindings = {}) {
|
|
11
|
+
this.model = model;
|
|
12
|
+
this.ui = ui;
|
|
13
|
+
this.bindings = bindings;
|
|
29
14
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
35
|
-
const when = (gatePaths, name, config) => {
|
|
36
|
-
return this.#next({ options: [...this.options, method.when(gatePaths, name, config)] });
|
|
37
|
-
};
|
|
38
|
-
return Object.assign(add, { when });
|
|
39
|
-
}
|
|
40
|
-
get component() {
|
|
41
|
-
const method = builderComponentMethod();
|
|
42
|
-
const add = (name, details) => {
|
|
43
|
-
const wrappedDetails = check.is(BuilderComponentDetailsSchema, details)
|
|
44
|
-
? details
|
|
45
|
-
: details != null
|
|
46
|
-
? componentDetails(details)
|
|
47
|
-
: details;
|
|
48
|
-
return this.#next({ components: [...this.components, method(name, wrappedDetails)] });
|
|
49
|
-
};
|
|
50
|
-
const when = (gatePaths, name, config) => {
|
|
51
|
-
return this.#next({
|
|
52
|
-
components: [...this.components, method.when(gatePaths, name, config)]
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
return Object.assign(add, { when });
|
|
56
|
-
}
|
|
57
|
-
get collection() {
|
|
58
|
-
const method = builderCollectionMethod();
|
|
59
|
-
const add = (name, payload) => {
|
|
60
|
-
return this.#next({ collections: [...this.collections, method(name, payload)] });
|
|
61
|
-
};
|
|
62
|
-
const when = (gatePaths, name, config) => {
|
|
63
|
-
return this.#next({
|
|
64
|
-
collections: [...this.collections, method.when(gatePaths, name, config)]
|
|
65
|
-
});
|
|
66
|
-
};
|
|
67
|
-
return Object.assign(add, { when });
|
|
68
|
-
}
|
|
69
|
-
expect(...expectations) {
|
|
70
|
-
return this.#next({ expectations: [...this.expectations, ...expectations] });
|
|
71
|
-
}
|
|
72
|
-
bind(bindings) {
|
|
73
|
-
return bindBuilder(this, bindings);
|
|
74
|
-
}
|
|
75
|
-
#next(patch) {
|
|
76
|
-
return new Builder(this.parameters, patch.options ?? this.options, patch.components ?? this.components, patch.collections ?? this.collections, patch.expectations ?? this.expectations, this.references);
|
|
15
|
+
bind(extra) {
|
|
16
|
+
return new Builder(this.model, this.ui, {
|
|
17
|
+
...this.bindings,
|
|
18
|
+
...extra
|
|
19
|
+
});
|
|
77
20
|
}
|
|
78
21
|
}
|
|
79
22
|
export const BuilderSchema = v.instance(Builder);
|
|
80
|
-
export const BuilderSerialisedSchema = serialisable(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
collections: BuilderCollectionsSerialisedSchema,
|
|
85
|
-
expectations: BuilderExpectationsSerialisedSchema,
|
|
86
|
-
references: BuilderReferencesSchema
|
|
23
|
+
export const BuilderSerialisedSchema = serialisable(v.object({
|
|
24
|
+
model: BuilderModelSerialisedSchema,
|
|
25
|
+
ui: BuilderUISerialisedSchema,
|
|
26
|
+
bindings: v.pipe(v.record(v.string(), v.union([BuilderRefSerialisedSchema, v.unknown()])), v.readonly())
|
|
87
27
|
}));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BuilderModel } from '../model/model';
|
|
2
|
+
import type { BuilderModelState } from '../model/state';
|
|
3
|
+
import type { BuilderUI } from '../ui/ui';
|
|
4
|
+
import type { BuilderBindings } from './bind';
|
|
5
|
+
import { Builder } from './builder.js';
|
|
6
|
+
export declare function builder(): Builder<BuilderModelState>;
|
|
7
|
+
export declare function builder<const State extends BuilderModelState>(model: BuilderModel<State>, ui?: BuilderUI, bindings?: BuilderBindings): Builder<State>;
|