@builder-builder/builder 0.0.19 → 0.0.20
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 +5 -6
- package/dist/bb.js +7 -4
- package/dist/entities/builder/builder.d.ts +2 -4
- package/dist/entities/collection/config.d.ts +101 -0
- package/dist/entities/collection/config.js +1 -0
- package/dist/entities/collection/index.d.ts +2 -2
- package/dist/entities/collection/index.js +1 -1
- package/dist/entities/component/component.d.ts +3 -3
- package/dist/entities/component/component.js +4 -4
- package/dist/entities/component/config.d.ts +135 -0
- package/dist/entities/component/{details.js → config.js} +7 -6
- package/dist/entities/component/index.d.ts +2 -2
- package/dist/entities/component/index.js +1 -1
- package/dist/entities/component/when.d.ts +5 -5
- package/dist/entities/component/when.js +3 -3
- package/dist/entities/index.d.ts +8 -9
- package/dist/entities/index.js +3 -3
- package/dist/entities/kind.d.ts +1 -1
- package/dist/entities/model/index.d.ts +1 -1
- package/dist/entities/model/methods.d.ts +8 -8
- package/dist/entities/model/methods.js +2 -2
- package/dist/entities/model/models.d.ts +1 -1
- package/dist/entities/option/config.d.ts +109 -0
- package/dist/entities/option/config.js +15 -0
- package/dist/entities/option/index.d.ts +6 -6
- package/dist/entities/option/index.js +3 -3
- package/dist/entities/option/option.d.ts +3 -3
- package/dist/entities/option/option.js +4 -4
- package/dist/entities/option/select.d.ts +14 -14
- package/dist/entities/option/select.js +5 -5
- package/dist/entities/option/toggle.d.ts +10 -10
- package/dist/entities/option/toggle.js +7 -7
- package/dist/entities/option/when.d.ts +5 -5
- package/dist/entities/{refs.d.ts → references.d.ts} +2 -2
- package/dist/entities/serialise.d.ts +4 -4
- package/dist/entities/serialise.js +10 -10
- package/dist/entities/ui/input.d.ts +1 -2
- package/dist/entities/ui/ui.d.ts +1 -2
- package/dist/entities/ui/uis.d.ts +1 -1
- package/dist/entities/ui/uis.js +1 -1
- package/dist/entities/validated.d.ts +5 -5
- package/dist/environment.d.ts +1 -1
- package/dist/index.d.ts +11 -10
- package/dist/index.js +2 -2
- package/dist/mappers/index.d.ts +2 -4
- package/dist/mappers/index.js +1 -2
- package/dist/mappers/instance.d.ts +2 -2
- package/dist/mappers/instance.js +6 -6
- package/dist/mappers/order.d.ts +2 -2
- package/dist/mappers/order.js +4 -4
- package/dist/mappers/render/pages.d.ts +2 -2
- package/dist/mappers/render/render.d.ts +2 -2
- package/dist/mappers/render/render.js +11 -11
- package/dist/mappers/resolve.d.ts +11 -11
- package/dist/mappers/resolve.js +28 -28
- package/dist/mappers/variants/option-graph.d.ts +2 -2
- package/dist/private.d.ts +1 -1
- package/dist/private.js +1 -1
- package/dist/validate/builder.d.ts +2 -2
- package/dist/validate/index.d.ts +1 -0
- package/dist/validate/model.d.ts +2 -2
- package/dist/validate/model.js +1 -1
- package/dist/validate/pricing.d.ts +2 -2
- package/dist/validate/resolve.d.ts +2 -2
- package/dist/validate/ui.d.ts +2 -2
- package/dist/validate/ui.js +1 -1
- package/dist/validate/variants.js +2 -2
- package/package.json +1 -1
- package/dist/entities/component/details.d.ts +0 -66
- package/dist/entities/entry.d.ts +0 -4
- package/dist/entities/option/values.d.ts +0 -49
- package/dist/entities/option/values.js +0 -14
- package/dist/entities/refs.js +0 -1
- /package/dist/entities/{entry.js → references.js} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { BuilderPaths } from '../../paths';
|
|
2
2
|
import type { BuilderParameter, Paramable } from '../../references';
|
|
3
3
|
import type { BuilderCollectionConfig, BuilderCollectionWhen } from '../collection/index';
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
4
|
+
import type { BuilderComponentConfig, BuilderComponentWhen } from '../component/index';
|
|
5
|
+
import type { BuilderOptionConfig, BuilderOptionWhen } from '../option/index';
|
|
6
6
|
import type { BuilderValidPaths, BuilderWhenConstrained, WhenConfigPayload, WhenNullability } from '../when';
|
|
7
7
|
import type { BuilderModel } from './model';
|
|
8
8
|
import type { BuilderModelState, BuilderModelStateAppend } from './state';
|
|
@@ -10,19 +10,19 @@ import { BuilderCollection } from '../collection/index.js';
|
|
|
10
10
|
import { BuilderComponent } from '../component/index.js';
|
|
11
11
|
import { BuilderOption } from '../option/index.js';
|
|
12
12
|
export type BuilderOptionMethod<State extends BuilderModelState> = {
|
|
13
|
-
<const Name extends string, const Payload extends Paramable<
|
|
13
|
+
<const Name extends string, const Payload extends Paramable<BuilderOptionConfig>>(name: Name, payload: Payload): OptionStateAppend<State, BuilderOption<Name, Payload>>;
|
|
14
14
|
when: <const Paths extends Paramable<BuilderValidPaths<State>>, const Name extends string, const Payload extends Paramable<BuilderOptionWhen>>(paths: Paths, name: Name, payload: Payload & BuilderWhenConstrained<State, Payload>) => OptionStateAppend<State, OptionWhenResolver<Name, Payload>, OptionInstanceOf<OptionWhenResolver<Name, Payload>> | WhenNullability<State, Paths, Payload>>;
|
|
15
15
|
};
|
|
16
16
|
export type BuilderComponentMethod<State extends BuilderModelState> = {
|
|
17
|
-
<const Name extends string, const Payload extends Paramable<
|
|
17
|
+
<const Name extends string, const Payload extends Paramable<BuilderComponentConfig>>(name: Name, payload?: Payload): ComponentStateAppend<State, BuilderComponent<Name, Payload>>;
|
|
18
18
|
when: <const Paths extends Paramable<BuilderValidPaths<State>>, const Name extends string, const Payload extends Paramable<BuilderComponentWhen>>(paths: Paths, name: Name, payload?: Payload & BuilderWhenConstrained<State, Payload>) => ComponentStateAppend<State, ComponentWhenResolver<Name, Payload>>;
|
|
19
19
|
};
|
|
20
20
|
export type BuilderCollectionMethod<State extends BuilderModelState> = {
|
|
21
21
|
<const Name extends string, const Payload extends Paramable<BuilderCollectionConfig>>(name: Name, payload: Payload): CollectionStateAppend<State, BuilderCollection<Name, Payload>>;
|
|
22
22
|
when: <const Paths extends Paramable<BuilderValidPaths<State>>, const Name extends string, const Payload extends Paramable<BuilderCollectionWhen>>(paths: Paths, name: Name, payload: Payload & BuilderWhenConstrained<State, Payload>) => CollectionStateAppend<State, CollectionWhenResolver<Name, Payload>, CollectionInstanceOf<CollectionWhenResolver<Name, Payload>> | WhenNullability<State, Paths, Payload>>;
|
|
23
23
|
};
|
|
24
|
-
type OptionWhenResolver<Name extends string, Payload extends Paramable<BuilderOptionWhen>> = Payload extends BuilderOptionWhen ? BuilderOption<Name, WhenConfigPayload<Payload,
|
|
25
|
-
type ComponentWhenResolver<Name extends string, Payload extends Paramable<BuilderComponentWhen>> = Payload extends BuilderComponentWhen ? BuilderComponent<Name, WhenConfigPayload<Payload,
|
|
24
|
+
type OptionWhenResolver<Name extends string, Payload extends Paramable<BuilderOptionWhen>> = Payload extends BuilderOptionWhen ? BuilderOption<Name, WhenConfigPayload<Payload, BuilderOptionConfig>> : BuilderOption<Name, BuilderParameter>;
|
|
25
|
+
type ComponentWhenResolver<Name extends string, Payload extends Paramable<BuilderComponentWhen>> = Payload extends BuilderComponentWhen ? BuilderComponent<Name, WhenConfigPayload<Payload, BuilderComponentConfig>> : BuilderComponent<Name, BuilderParameter>;
|
|
26
26
|
type CollectionWhenResolver<Name extends string, Payload extends Paramable<BuilderCollectionWhen>> = Payload extends BuilderCollectionWhen ? BuilderCollection<Name, WhenConfigPayload<Payload, BuilderCollectionConfig>> : BuilderCollection<Name, BuilderParameter>;
|
|
27
27
|
type OptionStateAppend<State extends BuilderModelState, Option extends BuilderOption, InstanceType = OptionInstanceOf<Option>> = BuilderModel<BuilderModelStateAppend<State, {
|
|
28
28
|
instance: State['instance'] & {
|
|
@@ -45,10 +45,10 @@ type CollectionInstanceOf<Collection extends BuilderCollection> = [Collection['p
|
|
|
45
45
|
] ? null : Collection['payload'] extends BuilderCollectionConfig ? Collection['payload']['model'] extends BuilderModel<infer State extends BuilderModelState> ? CollectionShape<Collection, State['instance']> : ReadonlyArray<unknown> : ReadonlyArray<unknown>;
|
|
46
46
|
type CollectionShape<Collection extends BuilderCollection, Item> = Collection['payload'] extends BuilderCollectionConfig ? Collection['payload']['min'] extends number ? Collection['payload']['max'] extends number ? number extends Collection['payload']['min'] ? ReadonlyArray<Item> : number extends Collection['payload']['max'] ? ReadonlyArray<Item> : Collection['payload']['min'] extends Collection['payload']['max'] ? CollectionTuple<Item, Collection['payload']['min']> : ReadonlyArray<Item> : ReadonlyArray<Item> : ReadonlyArray<Item> : ReadonlyArray<Item>;
|
|
47
47
|
type CollectionTuple<Item, Length extends number, Result extends ReadonlyArray<Item> = []> = Result['length'] extends Length ? Result : CollectionTuple<Item, Length, [...Result, Item]>;
|
|
48
|
-
export declare function builderOptionMethod(): ((name: string, payload: Paramable<
|
|
48
|
+
export declare function builderOptionMethod(): ((name: string, payload: Paramable<BuilderOptionConfig>) => BuilderOption<string, Paramable<import("..").BuilderSelectConfig<readonly [string, ...string[]], import("valibot").GenericSchema<string | null>> | import("..").BuilderToggleConfig<import("valibot").GenericSchema<string | number | boolean | null>>>, Paramable<readonly (readonly (string | number)[])[]>>) & {
|
|
49
49
|
when(paths: Paramable<BuilderPaths>, name: string, payload: Paramable<BuilderOptionWhen>): BuilderOption<string, Paramable<BuilderOptionWhen>, readonly (readonly (string | number)[])[] | BuilderParameter<string> | import("../..").BuilderRef>;
|
|
50
50
|
};
|
|
51
|
-
export declare function builderComponentMethod(): ((name: string, payload?: Paramable<
|
|
51
|
+
export declare function builderComponentMethod(): ((name: string, payload?: Paramable<BuilderComponentConfig>) => BuilderComponent<string, Paramable<BuilderComponentConfig<Paramable<readonly import("..").BuilderComponentField<string, import("valibot").GenericSchema<string | number | boolean | null>>[]>>>, Paramable<readonly (readonly (string | number)[])[]>>) & {
|
|
52
52
|
when(paths: Paramable<BuilderPaths>, name: string, payload?: Paramable<BuilderComponentWhen>): BuilderComponent<string, Paramable<BuilderComponentWhen>, readonly (readonly (string | number)[])[] | BuilderParameter<string> | import("../..").BuilderRef>;
|
|
53
53
|
};
|
|
54
54
|
export declare function builderCollectionMethod(): ((name: string, payload: Paramable<BuilderCollectionConfig>) => BuilderCollection<string, Paramable<BuilderCollectionConfig<Paramable<import("./model").BuilderModelGeneric>, Paramable<number>, Paramable<number>>>, Paramable<readonly (readonly (string | number)[])[]>>) & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BuilderCollection } from '../collection/index.js';
|
|
2
|
-
import { BuilderComponent,
|
|
2
|
+
import { BuilderComponent, componentConfig, componentWhen } from '../component/index.js';
|
|
3
3
|
import { BuilderOption } from '../option/index.js';
|
|
4
4
|
export function builderOptionMethod() {
|
|
5
5
|
return Object.assign((name, payload) => {
|
|
@@ -12,7 +12,7 @@ export function builderOptionMethod() {
|
|
|
12
12
|
}
|
|
13
13
|
export function builderComponentMethod() {
|
|
14
14
|
return Object.assign((name, payload) => {
|
|
15
|
-
return new BuilderComponent(name, payload ??
|
|
15
|
+
return new BuilderComponent(name, payload ?? componentConfig());
|
|
16
16
|
}, {
|
|
17
17
|
when(paths, name, payload) {
|
|
18
18
|
return new BuilderComponent(name, payload ?? componentWhen.enable(), paths);
|
|
@@ -35,5 +35,5 @@ type BuilderModelsInstanceMerge<Parts extends BuilderModels> = Parts extends rea
|
|
|
35
35
|
infer Head,
|
|
36
36
|
...infer Tail extends BuilderModels
|
|
37
37
|
] ? Head extends BuilderModelGeneric ? BuilderModelStateOf<Head>['instance'] & BuilderModelsInstanceMerge<Tail> : BuilderModelsInstanceMerge<Tail> : unknown;
|
|
38
|
-
export declare function modelsMerge(model:
|
|
38
|
+
export declare function modelsMerge<Model extends BuilderModelSerialised | BuilderModelValidated>(model: Model): Model;
|
|
39
39
|
export {};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
export declare const BuilderOptionConfigSchema: v.UnionSchema<[v.InstanceSchema<typeof import("./select.js").BuilderSelectConfig, undefined>, v.InstanceSchema<typeof import("./toggle.js").BuilderToggleConfig, undefined>], undefined>;
|
|
3
|
+
export type BuilderOptionConfig = v.InferOutput<typeof BuilderOptionConfigSchema>;
|
|
4
|
+
export declare const BuilderOptionConfigSerialisedSchema: v.SchemaWithPipe<readonly [v.VariantSchema<"type", [v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
5
|
+
readonly type: v.LiteralSchema<"select", undefined>;
|
|
6
|
+
readonly options: v.SchemaWithPipe<readonly [v.TupleWithRestSchema<[v.StringSchema<undefined>], v.StringSchema<undefined>, undefined>, v.ReadonlyAction<[string, ...string[]]>]>;
|
|
7
|
+
readonly defaultValue: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
8
|
+
readonly isOptional: v.BooleanSchema<undefined>;
|
|
9
|
+
readonly optionLabels: v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>;
|
|
10
|
+
readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
|
|
11
|
+
}, undefined>, v.ReadonlyAction<{
|
|
12
|
+
type: "select";
|
|
13
|
+
readonly options: readonly [string, ...string[]];
|
|
14
|
+
defaultValue: string | null;
|
|
15
|
+
isOptional: boolean;
|
|
16
|
+
optionLabels: {
|
|
17
|
+
[x: string]: string;
|
|
18
|
+
};
|
|
19
|
+
tags?: readonly string[] | undefined;
|
|
20
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
21
|
+
readonly type: v.LiteralSchema<"toggle", undefined>;
|
|
22
|
+
readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
|
|
23
|
+
readonly defaultValue: v.NullableSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
|
|
24
|
+
readonly isOptional: v.BooleanSchema<undefined>;
|
|
25
|
+
readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
|
|
26
|
+
}, undefined>, v.ReadonlyAction<{
|
|
27
|
+
type: "toggle";
|
|
28
|
+
valueType: "string" | "number" | "boolean";
|
|
29
|
+
defaultValue: string | number | boolean | null;
|
|
30
|
+
isOptional: boolean;
|
|
31
|
+
tags?: readonly string[] | undefined;
|
|
32
|
+
}>]>], undefined>, v.ReadonlyAction<Readonly<{
|
|
33
|
+
type: "select";
|
|
34
|
+
readonly options: readonly [string, ...string[]];
|
|
35
|
+
defaultValue: string | null;
|
|
36
|
+
isOptional: boolean;
|
|
37
|
+
optionLabels: {
|
|
38
|
+
[x: string]: string;
|
|
39
|
+
};
|
|
40
|
+
tags?: readonly string[] | undefined;
|
|
41
|
+
}> | Readonly<{
|
|
42
|
+
type: "toggle";
|
|
43
|
+
valueType: "string" | "number" | "boolean";
|
|
44
|
+
defaultValue: string | number | boolean | null;
|
|
45
|
+
isOptional: boolean;
|
|
46
|
+
tags?: readonly string[] | undefined;
|
|
47
|
+
}>>]>;
|
|
48
|
+
export type BuilderOptionConfigSerialised = v.InferOutput<typeof BuilderOptionConfigSerialisedSchema>;
|
|
49
|
+
export declare const BuilderOptionConfigsSerialisedSchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.VariantSchema<"type", [v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
50
|
+
readonly type: v.LiteralSchema<"select", undefined>;
|
|
51
|
+
readonly options: v.SchemaWithPipe<readonly [v.TupleWithRestSchema<[v.StringSchema<undefined>], v.StringSchema<undefined>, undefined>, v.ReadonlyAction<[string, ...string[]]>]>;
|
|
52
|
+
readonly defaultValue: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
53
|
+
readonly isOptional: v.BooleanSchema<undefined>;
|
|
54
|
+
readonly optionLabels: v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>;
|
|
55
|
+
readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
|
|
56
|
+
}, undefined>, v.ReadonlyAction<{
|
|
57
|
+
type: "select";
|
|
58
|
+
readonly options: readonly [string, ...string[]];
|
|
59
|
+
defaultValue: string | null;
|
|
60
|
+
isOptional: boolean;
|
|
61
|
+
optionLabels: {
|
|
62
|
+
[x: string]: string;
|
|
63
|
+
};
|
|
64
|
+
tags?: readonly string[] | undefined;
|
|
65
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
66
|
+
readonly type: v.LiteralSchema<"toggle", undefined>;
|
|
67
|
+
readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
|
|
68
|
+
readonly defaultValue: v.NullableSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
|
|
69
|
+
readonly isOptional: v.BooleanSchema<undefined>;
|
|
70
|
+
readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
|
|
71
|
+
}, undefined>, v.ReadonlyAction<{
|
|
72
|
+
type: "toggle";
|
|
73
|
+
valueType: "string" | "number" | "boolean";
|
|
74
|
+
defaultValue: string | number | boolean | null;
|
|
75
|
+
isOptional: boolean;
|
|
76
|
+
tags?: readonly string[] | undefined;
|
|
77
|
+
}>]>], undefined>, v.ReadonlyAction<Readonly<{
|
|
78
|
+
type: "select";
|
|
79
|
+
readonly options: readonly [string, ...string[]];
|
|
80
|
+
defaultValue: string | null;
|
|
81
|
+
isOptional: boolean;
|
|
82
|
+
optionLabels: {
|
|
83
|
+
[x: string]: string;
|
|
84
|
+
};
|
|
85
|
+
tags?: readonly string[] | undefined;
|
|
86
|
+
}> | Readonly<{
|
|
87
|
+
type: "toggle";
|
|
88
|
+
valueType: "string" | "number" | "boolean";
|
|
89
|
+
defaultValue: string | number | boolean | null;
|
|
90
|
+
isOptional: boolean;
|
|
91
|
+
tags?: readonly string[] | undefined;
|
|
92
|
+
}>>]>, undefined>, v.ReadonlyAction<(Readonly<Readonly<{
|
|
93
|
+
type: "select";
|
|
94
|
+
readonly options: readonly [string, ...string[]];
|
|
95
|
+
defaultValue: string | null;
|
|
96
|
+
isOptional: boolean;
|
|
97
|
+
optionLabels: {
|
|
98
|
+
[x: string]: string;
|
|
99
|
+
};
|
|
100
|
+
tags?: readonly string[] | undefined;
|
|
101
|
+
}>> | Readonly<Readonly<{
|
|
102
|
+
type: "toggle";
|
|
103
|
+
valueType: "string" | "number" | "boolean";
|
|
104
|
+
defaultValue: string | number | boolean | null;
|
|
105
|
+
isOptional: boolean;
|
|
106
|
+
tags?: readonly string[] | undefined;
|
|
107
|
+
}>>)[]>]>;
|
|
108
|
+
export type BuilderOptionConfigsSerialised = v.InferOutput<typeof BuilderOptionConfigsSerialisedSchema>;
|
|
109
|
+
export declare function optionValueSchema(payload: BuilderOptionConfigSerialised): v.GenericSchema;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
import { BuilderSelectConfigSchema, BuilderSelectConfigSerialisedSchema, selectValueSchema } from './select.js';
|
|
3
|
+
import { BuilderToggleConfigSchema, BuilderToggleConfigSerialisedSchema, toggleValueSchema } from './toggle.js';
|
|
4
|
+
export const BuilderOptionConfigSchema = v.union([
|
|
5
|
+
BuilderSelectConfigSchema,
|
|
6
|
+
BuilderToggleConfigSchema
|
|
7
|
+
]);
|
|
8
|
+
export const BuilderOptionConfigSerialisedSchema = v.pipe(v.variant('type', [BuilderSelectConfigSerialisedSchema, BuilderToggleConfigSerialisedSchema]), v.readonly());
|
|
9
|
+
export const BuilderOptionConfigsSerialisedSchema = v.pipe(v.array(BuilderOptionConfigSerialisedSchema), v.readonly());
|
|
10
|
+
export function optionValueSchema(payload) {
|
|
11
|
+
if (payload.type === 'select') {
|
|
12
|
+
return selectValueSchema(payload.options, payload.isOptional);
|
|
13
|
+
}
|
|
14
|
+
return toggleValueSchema(payload.valueType, payload.isOptional);
|
|
15
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export type { BuilderOptionPayload, BuilderOptions, BuilderOptionSerialised, BuilderOptionsSerialised, BuilderOptionWhenSerialised } from './option';
|
|
2
|
-
export type {
|
|
3
|
-
export type {
|
|
4
|
-
export type {
|
|
2
|
+
export type { BuilderSelectConfigLabels, BuilderSelectConfigSerialised, BuilderSelectConfigValues } from './select';
|
|
3
|
+
export type { BuilderToggleConfigSerialised, BuilderToggleValueType } from './toggle';
|
|
4
|
+
export type { BuilderOptionConfig, BuilderOptionConfigSerialised, BuilderOptionConfigsSerialised } from './config';
|
|
5
5
|
export type { BuilderOptionWhen } from './when';
|
|
6
6
|
export { BuilderOption, BuilderOptionSchema, BuilderOptionSelectMapSerialisedSchema, BuilderOptionSerialisedSchema, BuilderOptionsSerialisedSchema, BuilderOptionWhenSerialisedSchema } from './option.js';
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
7
|
+
export { BuilderSelectConfig, BuilderSelectConfigSchema, BuilderSelectConfigSerialisedSchema, select } from './select.js';
|
|
8
|
+
export { BuilderToggleConfig, BuilderToggleConfigSchema, BuilderToggleConfigSerialisedSchema, toggleBoolean, toggleNumber, toggleString } from './toggle.js';
|
|
9
|
+
export { BuilderOptionConfigSchema, BuilderOptionConfigSerialisedSchema, BuilderOptionConfigsSerialisedSchema, optionValueSchema } from './config.js';
|
|
10
10
|
export { optionExpectation } from './expectation.js';
|
|
11
11
|
export { optionWhen } from './when.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { BuilderOption, BuilderOptionSchema, BuilderOptionSelectMapSerialisedSchema, BuilderOptionSerialisedSchema, BuilderOptionsSerialisedSchema, BuilderOptionWhenSerialisedSchema } from './option.js';
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
2
|
+
export { BuilderSelectConfig, BuilderSelectConfigSchema, BuilderSelectConfigSerialisedSchema, select } from './select.js';
|
|
3
|
+
export { BuilderToggleConfig, BuilderToggleConfigSchema, BuilderToggleConfigSerialisedSchema, toggleBoolean, toggleNumber, toggleString } from './toggle.js';
|
|
4
|
+
export { BuilderOptionConfigSchema, BuilderOptionConfigSerialisedSchema, BuilderOptionConfigsSerialisedSchema, optionValueSchema } from './config.js';
|
|
5
5
|
export { optionExpectation } from './expectation.js';
|
|
6
6
|
export { optionWhen } from './when.js';
|
|
@@ -2,10 +2,10 @@ import type { BuilderPaths } from '../../paths';
|
|
|
2
2
|
import type { Paramable } from '../../references';
|
|
3
3
|
import type { BuilderTags } from '../tags';
|
|
4
4
|
import type { BuilderWhenSerialised } from '../when';
|
|
5
|
-
import type {
|
|
5
|
+
import type { BuilderOptionConfig, BuilderOptionConfigSerialised } from './config';
|
|
6
6
|
import type { BuilderOptionWhen } from './when';
|
|
7
7
|
import * as v from 'valibot';
|
|
8
|
-
export type BuilderOptionPayload =
|
|
8
|
+
export type BuilderOptionPayload = BuilderOptionConfig | BuilderOptionWhen;
|
|
9
9
|
export declare class BuilderOption<const Name extends string = string, const Payload extends Paramable<BuilderOptionPayload> = Paramable<BuilderOptionPayload>, const Paths extends Paramable<BuilderPaths> = Paramable<BuilderPaths>> {
|
|
10
10
|
readonly type: 'option';
|
|
11
11
|
readonly name: Name;
|
|
@@ -33,7 +33,7 @@ export declare const BuilderOptionWhenSerialisedSchema: v.GenericSchema<BuilderW
|
|
|
33
33
|
isOptional: boolean;
|
|
34
34
|
tags?: readonly string[] | undefined;
|
|
35
35
|
}>>>>;
|
|
36
|
-
export type BuilderOptionWhenSerialised = BuilderWhenSerialised<
|
|
36
|
+
export type BuilderOptionWhenSerialised = BuilderWhenSerialised<BuilderOptionConfigSerialised>;
|
|
37
37
|
export declare const BuilderOptionSelectMapSerialisedSchema: v.GenericSchema<import("..").BuilderMatchSelectMap<Readonly<{
|
|
38
38
|
type: "parameter";
|
|
39
39
|
id: string;
|
|
@@ -4,7 +4,7 @@ import { paramable } from '../../references.js';
|
|
|
4
4
|
import { serialisable } from '../../serialisable.js';
|
|
5
5
|
import { BuilderTagsSchema } from '../tags.js';
|
|
6
6
|
import { createSelectMapSerialisedSchema, createWhenSerialisedSchema } from '../when.js';
|
|
7
|
-
import {
|
|
7
|
+
import { BuilderOptionConfigSerialisedSchema } from './config.js';
|
|
8
8
|
export class BuilderOption {
|
|
9
9
|
name;
|
|
10
10
|
payload;
|
|
@@ -21,11 +21,11 @@ export class BuilderOption {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
export const BuilderOptionSchema = v.instance(BuilderOption);
|
|
24
|
-
export const BuilderOptionWhenSerialisedSchema = createWhenSerialisedSchema(
|
|
25
|
-
export const BuilderOptionSelectMapSerialisedSchema = createSelectMapSerialisedSchema(
|
|
24
|
+
export const BuilderOptionWhenSerialisedSchema = createWhenSerialisedSchema(BuilderOptionConfigSerialisedSchema);
|
|
25
|
+
export const BuilderOptionSelectMapSerialisedSchema = createSelectMapSerialisedSchema(BuilderOptionConfigSerialisedSchema);
|
|
26
26
|
export const BuilderOptionSerialisedSchema = serialisable(v.object({
|
|
27
27
|
name: v.string(),
|
|
28
|
-
payload: paramable(v.union([
|
|
28
|
+
payload: paramable(v.union([BuilderOptionConfigSerialisedSchema, BuilderOptionWhenSerialisedSchema])),
|
|
29
29
|
paths: v.optional(paramable(BuilderPathsSchema)),
|
|
30
30
|
tags: v.optional(BuilderTagsSchema)
|
|
31
31
|
}));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { BuilderTags } from '../tags';
|
|
2
2
|
import * as v from 'valibot';
|
|
3
|
-
export type
|
|
4
|
-
export type
|
|
5
|
-
export declare class
|
|
3
|
+
export type BuilderSelectConfigLabels<Values extends BuilderSelectConfigValues> = Partial<Record<Values[number], string>>;
|
|
4
|
+
export type BuilderSelectConfigValues = readonly [string, ...ReadonlyArray<string>];
|
|
5
|
+
export declare class BuilderSelectConfig<const Values extends BuilderSelectConfigValues = BuilderSelectConfigValues, const ValueSchema extends v.GenericSchema<string | null> = v.GenericSchema<string | null>> {
|
|
6
6
|
#private;
|
|
7
7
|
readonly value: v.InferOutput<ValueSchema>;
|
|
8
8
|
readonly type: "select";
|
|
@@ -10,20 +10,20 @@ export declare class BuilderSelectType<const Values extends BuilderSelectTypeVal
|
|
|
10
10
|
readonly valueSchema: ValueSchema;
|
|
11
11
|
readonly defaultValue: v.InferOutput<ValueSchema>;
|
|
12
12
|
readonly isOptional: boolean;
|
|
13
|
-
readonly optionLabels:
|
|
13
|
+
readonly optionLabels: BuilderSelectConfigLabels<Values>;
|
|
14
14
|
readonly tags?: BuilderTags;
|
|
15
|
-
constructor(values: Values, defaultValue: v.InferOutput<ValueSchema>, optional?: boolean, optionLabels?:
|
|
16
|
-
default(newDefault: v.InferOutput<ValueSchema>):
|
|
17
|
-
optional():
|
|
18
|
-
labels(optionLabels:
|
|
19
|
-
tag(...tags: Array<string>):
|
|
15
|
+
constructor(values: Values, defaultValue: v.InferOutput<ValueSchema>, optional?: boolean, optionLabels?: BuilderSelectConfigLabels<Values>, tags?: BuilderTags);
|
|
16
|
+
default(newDefault: v.InferOutput<ValueSchema>): BuilderSelectConfig<Values, ValueSchema>;
|
|
17
|
+
optional(): BuilderSelectConfig<Values, v.NullableSchema<ValueSchema, undefined>>;
|
|
18
|
+
labels(optionLabels: BuilderSelectConfigLabels<Values>): BuilderSelectConfig<Values, ValueSchema>;
|
|
19
|
+
tag(...tags: Array<string>): BuilderSelectConfig<Values, ValueSchema>;
|
|
20
20
|
}
|
|
21
|
-
type SelectSchema<Values extends
|
|
21
|
+
type SelectSchema<Values extends BuilderSelectConfigValues> = v.UnionSchema<{
|
|
22
22
|
[K in keyof Values]: v.LiteralSchema<Values[K], undefined>;
|
|
23
23
|
}, undefined>;
|
|
24
|
-
export declare function select<const Values extends
|
|
25
|
-
export declare const
|
|
26
|
-
export declare const
|
|
24
|
+
export declare function select<const Values extends BuilderSelectConfigValues>(values: Values): BuilderSelectConfig<Values, SelectSchema<Values>>;
|
|
25
|
+
export declare const BuilderSelectConfigSchema: v.InstanceSchema<typeof BuilderSelectConfig, undefined>;
|
|
26
|
+
export declare const BuilderSelectConfigSerialisedSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
27
27
|
readonly type: v.LiteralSchema<"select", undefined>;
|
|
28
28
|
readonly options: v.SchemaWithPipe<readonly [v.TupleWithRestSchema<[v.StringSchema<undefined>], v.StringSchema<undefined>, undefined>, v.ReadonlyAction<[string, ...string[]]>]>;
|
|
29
29
|
readonly defaultValue: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -40,6 +40,6 @@ export declare const BuilderSelectTypeSerialisedSchema: v.SchemaWithPipe<readonl
|
|
|
40
40
|
};
|
|
41
41
|
tags?: readonly string[] | undefined;
|
|
42
42
|
}>]>;
|
|
43
|
-
export type
|
|
43
|
+
export type BuilderSelectConfigSerialised = v.InferOutput<typeof BuilderSelectConfigSerialisedSchema>;
|
|
44
44
|
export declare function selectValueSchema(options: ReadonlyArray<string>, optional: boolean): v.GenericSchema<string | null>;
|
|
45
45
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
2
|
import { serialisable } from '../../serialisable.js';
|
|
3
3
|
import { BuilderTagsSchema } from '../tags.js';
|
|
4
|
-
export class
|
|
4
|
+
export class BuilderSelectConfig {
|
|
5
5
|
type = 'select';
|
|
6
6
|
options;
|
|
7
7
|
valueSchema;
|
|
@@ -18,7 +18,7 @@ export class BuilderSelectType {
|
|
|
18
18
|
this.tags = tags;
|
|
19
19
|
}
|
|
20
20
|
#next(patch) {
|
|
21
|
-
return new
|
|
21
|
+
return new BuilderSelectConfig(this.options, 'defaultValue' in patch
|
|
22
22
|
? patch.defaultValue
|
|
23
23
|
: this.defaultValue, patch.optional ?? this.isOptional, patch.optionLabels ?? this.optionLabels, patch.tags ?? this.tags);
|
|
24
24
|
}
|
|
@@ -37,10 +37,10 @@ export class BuilderSelectType {
|
|
|
37
37
|
}
|
|
38
38
|
export function select(values) {
|
|
39
39
|
const [defaultValue] = values;
|
|
40
|
-
return new
|
|
40
|
+
return new BuilderSelectConfig(values, defaultValue, false);
|
|
41
41
|
}
|
|
42
|
-
export const
|
|
43
|
-
export const
|
|
42
|
+
export const BuilderSelectConfigSchema = v.instance(BuilderSelectConfig);
|
|
43
|
+
export const BuilderSelectConfigSerialisedSchema = serialisable(v.object({
|
|
44
44
|
type: v.literal('select'),
|
|
45
45
|
options: v.pipe(v.tupleWithRest([v.string()], v.string()), v.readonly()),
|
|
46
46
|
defaultValue: v.nullable(v.string()),
|
|
@@ -3,7 +3,7 @@ import type { BuilderTags } from '../tags';
|
|
|
3
3
|
import * as v from 'valibot';
|
|
4
4
|
export declare const BuilderToggleValueTypeSchema: v.PicklistSchema<["string", "boolean", "number"], undefined>;
|
|
5
5
|
export type BuilderToggleValueType = v.InferOutput<typeof BuilderToggleValueTypeSchema>;
|
|
6
|
-
export declare class
|
|
6
|
+
export declare class BuilderToggleConfig<const ValueSchema extends v.GenericSchema<BuilderPrimitive> = v.GenericSchema<BuilderPrimitive>> {
|
|
7
7
|
#private;
|
|
8
8
|
readonly value: v.InferOutput<ValueSchema>;
|
|
9
9
|
readonly type: "toggle";
|
|
@@ -13,15 +13,15 @@ export declare class BuilderToggleType<const ValueSchema extends v.GenericSchema
|
|
|
13
13
|
readonly isOptional: boolean;
|
|
14
14
|
readonly tags?: BuilderTags;
|
|
15
15
|
constructor(valueType: BuilderToggleValueType, defaultValue: v.InferOutput<ValueSchema>, optional?: boolean, tags?: BuilderTags);
|
|
16
|
-
default(newDefault: v.InferOutput<ValueSchema>):
|
|
17
|
-
optional():
|
|
18
|
-
tag(...tags: Array<string>):
|
|
16
|
+
default(newDefault: v.InferOutput<ValueSchema>): BuilderToggleConfig<ValueSchema>;
|
|
17
|
+
optional(): BuilderToggleConfig<v.NullableSchema<ValueSchema, undefined>>;
|
|
18
|
+
tag(...tags: Array<string>): BuilderToggleConfig<ValueSchema>;
|
|
19
19
|
}
|
|
20
|
-
export declare function toggleString():
|
|
21
|
-
export declare function toggleBoolean():
|
|
22
|
-
export declare function toggleNumber():
|
|
23
|
-
export declare const
|
|
24
|
-
export declare const
|
|
20
|
+
export declare function toggleString(): BuilderToggleConfig<v.StringSchema<undefined>>;
|
|
21
|
+
export declare function toggleBoolean(): BuilderToggleConfig<v.BooleanSchema<undefined>>;
|
|
22
|
+
export declare function toggleNumber(): BuilderToggleConfig<v.NumberSchema<undefined>>;
|
|
23
|
+
export declare const BuilderToggleConfigSchema: v.InstanceSchema<typeof BuilderToggleConfig, undefined>;
|
|
24
|
+
export declare const BuilderToggleConfigSerialisedSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
25
25
|
readonly type: v.LiteralSchema<"toggle", undefined>;
|
|
26
26
|
readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
|
|
27
27
|
readonly defaultValue: v.NullableSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
|
|
@@ -34,5 +34,5 @@ export declare const BuilderToggleTypeSerialisedSchema: v.SchemaWithPipe<readonl
|
|
|
34
34
|
isOptional: boolean;
|
|
35
35
|
tags?: readonly string[] | undefined;
|
|
36
36
|
}>]>;
|
|
37
|
-
export type
|
|
37
|
+
export type BuilderToggleConfigSerialised = v.InferOutput<typeof BuilderToggleConfigSerialisedSchema>;
|
|
38
38
|
export declare function toggleValueSchema(valueType: BuilderToggleValueType, optional: boolean): v.GenericSchema;
|
|
@@ -2,7 +2,7 @@ import * as v from 'valibot';
|
|
|
2
2
|
import { serialisable } from '../../serialisable.js';
|
|
3
3
|
import { BuilderTagsSchema } from '../tags.js';
|
|
4
4
|
export const BuilderToggleValueTypeSchema = v.picklist(['string', 'boolean', 'number']);
|
|
5
|
-
export class
|
|
5
|
+
export class BuilderToggleConfig {
|
|
6
6
|
type = 'toggle';
|
|
7
7
|
valueType;
|
|
8
8
|
valueSchema;
|
|
@@ -17,7 +17,7 @@ export class BuilderToggleType {
|
|
|
17
17
|
this.tags = tags;
|
|
18
18
|
}
|
|
19
19
|
#next(patch) {
|
|
20
|
-
return new
|
|
20
|
+
return new BuilderToggleConfig(this.valueType, 'defaultValue' in patch
|
|
21
21
|
? patch.defaultValue
|
|
22
22
|
: this.defaultValue, patch.optional ?? this.isOptional, patch.tags ?? this.tags);
|
|
23
23
|
}
|
|
@@ -32,16 +32,16 @@ export class BuilderToggleType {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
export function toggleString() {
|
|
35
|
-
return new
|
|
35
|
+
return new BuilderToggleConfig('string', '');
|
|
36
36
|
}
|
|
37
37
|
export function toggleBoolean() {
|
|
38
|
-
return new
|
|
38
|
+
return new BuilderToggleConfig('boolean', false);
|
|
39
39
|
}
|
|
40
40
|
export function toggleNumber() {
|
|
41
|
-
return new
|
|
41
|
+
return new BuilderToggleConfig('number', 0);
|
|
42
42
|
}
|
|
43
|
-
export const
|
|
44
|
-
export const
|
|
43
|
+
export const BuilderToggleConfigSchema = v.instance(BuilderToggleConfig);
|
|
44
|
+
export const BuilderToggleConfigSerialisedSchema = serialisable(v.object({
|
|
45
45
|
type: v.literal('toggle'),
|
|
46
46
|
valueType: BuilderToggleValueTypeSchema,
|
|
47
47
|
defaultValue: v.nullable(v.union([v.boolean(), v.string(), v.number()])),
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { BuilderPath } from '../../paths';
|
|
2
2
|
import type { Paramable } from '../../references';
|
|
3
3
|
import type { BuilderWhen } from '../when';
|
|
4
|
-
import type {
|
|
5
|
-
export type BuilderOptionWhen = BuilderWhen<Paramable<
|
|
4
|
+
import type { BuilderOptionConfig } from './config';
|
|
5
|
+
export type BuilderOptionWhen = BuilderWhen<Paramable<BuilderOptionConfig>, Paramable<BuilderPath>, Paramable<Record<string, Paramable<BuilderOptionConfig> | null>>, Paramable<BuilderPath>>;
|
|
6
6
|
export declare const optionWhen: {
|
|
7
|
-
enable: <const Values extends Paramable<import("./select").
|
|
8
|
-
match: <const MatchPayload extends Paramable<import("./select").
|
|
9
|
-
unless: <const Values extends Paramable<import("./select").
|
|
7
|
+
enable: <const Values extends Paramable<import("./select").BuilderSelectConfig<readonly [string, ...string[]], import("valibot").GenericSchema<string | null>> | import("./toggle").BuilderToggleConfig<import("valibot").GenericSchema<string | number | boolean | null>>>>(values: Values) => import("..").BuilderEnableConfig<Values>;
|
|
8
|
+
match: <const MatchPayload extends Paramable<import("./select").BuilderSelectConfig<readonly [string, ...string[]], import("valibot").GenericSchema<string | null>> | import("./toggle").BuilderToggleConfig<import("valibot").GenericSchema<string | number | boolean | null>>>, const MatchPath extends Paramable<BuilderPath>, const SelectMap extends Paramable<import("..").BuilderMatchSelectMap<Paramable<import("./select").BuilderSelectConfig<readonly [string, ...string[]], import("valibot").GenericSchema<string | null>> | import("./toggle").BuilderToggleConfig<import("valibot").GenericSchema<string | number | boolean | null>>>>>>(matchPath: MatchPath, selectMap: SelectMap) => import("..").BuilderMatchConfig<MatchPayload, MatchPath, SelectMap>;
|
|
9
|
+
unless: <const Values extends Paramable<import("./select").BuilderSelectConfig<readonly [string, ...string[]], import("valibot").GenericSchema<string | null>> | import("./toggle").BuilderToggleConfig<import("valibot").GenericSchema<string | number | boolean | null>>>, const UnlessPath extends Paramable<BuilderPath>>(unlessPath: UnlessPath, disabledValues: import("../..").BuilderPrimitives, values: Values) => import("..").BuilderUnlessConfig<Values, UnlessPath>;
|
|
10
10
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BuilderEntitySerialised } from './kind.js';
|
|
2
|
-
export type
|
|
2
|
+
export type BuilderReference = {
|
|
3
3
|
readonly id: string;
|
|
4
4
|
readonly serialised: BuilderEntitySerialised;
|
|
5
5
|
};
|
|
6
|
-
export type
|
|
6
|
+
export type BuilderReferences = ReadonlyArray<BuilderReference>;
|
|
@@ -9,7 +9,7 @@ export declare const entitiesMap: {
|
|
|
9
9
|
readonly serialised: v.GenericSchema<import("./index.js").BuilderModelSerialised>;
|
|
10
10
|
};
|
|
11
11
|
readonly select: {
|
|
12
|
-
readonly runtime: v.InstanceSchema<typeof import("./index.js").
|
|
12
|
+
readonly runtime: v.InstanceSchema<typeof import("./index.js").BuilderSelectConfig, undefined>;
|
|
13
13
|
readonly serialised: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
14
14
|
readonly type: v.LiteralSchema<"select", undefined>;
|
|
15
15
|
readonly options: v.SchemaWithPipe<readonly [v.TupleWithRestSchema<[v.StringSchema<undefined>], v.StringSchema<undefined>, undefined>, v.ReadonlyAction<[string, ...string[]]>]>;
|
|
@@ -29,7 +29,7 @@ export declare const entitiesMap: {
|
|
|
29
29
|
}>]>;
|
|
30
30
|
};
|
|
31
31
|
readonly toggle: {
|
|
32
|
-
readonly runtime: v.InstanceSchema<typeof import("./index.js").
|
|
32
|
+
readonly runtime: v.InstanceSchema<typeof import("./index.js").BuilderToggleConfig, undefined>;
|
|
33
33
|
readonly serialised: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
34
34
|
readonly type: v.LiteralSchema<"toggle", undefined>;
|
|
35
35
|
readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
|
|
@@ -120,8 +120,8 @@ export declare const entitiesMap: {
|
|
|
120
120
|
tags?: readonly string[] | undefined;
|
|
121
121
|
}>>>>;
|
|
122
122
|
};
|
|
123
|
-
readonly
|
|
124
|
-
readonly runtime: v.InstanceSchema<typeof import("./index.js").
|
|
123
|
+
readonly componentConfig: {
|
|
124
|
+
readonly runtime: v.InstanceSchema<typeof import("./index.js").BuilderComponentConfig, undefined>;
|
|
125
125
|
readonly serialised: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
126
126
|
readonly fields: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
127
127
|
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
@@ -4,17 +4,17 @@ import { BuilderPathSchema, BuilderPathsSchema } from '../paths.js';
|
|
|
4
4
|
import { BuilderParameterSchema, BuilderRefSchema, isParamable } from '../references.js';
|
|
5
5
|
import { BuilderSchema, BuilderSerialisedSchema } from './builder/index.js';
|
|
6
6
|
import { BuilderCollectionConfigSchema, BuilderCollectionConfigSerialisedSchema, BuilderCollectionSchema, BuilderCollectionSelectMapSerialisedSchema, BuilderCollectionWhenSerialisedSchema } from './collection/index.js';
|
|
7
|
-
import {
|
|
7
|
+
import { BuilderComponentConfigSchema, BuilderComponentConfigSerialisedSchema, BuilderComponentFieldSchema, BuilderComponentSchema, BuilderComponentSelectMapSerialisedSchema, BuilderComponentWhenSerialisedSchema } from './component/index.js';
|
|
8
8
|
import { BuilderExpectationSchema, BuilderExpectationsSchema, BuilderExpectationsSerialisedSchema } from './expectation.js';
|
|
9
9
|
import { BuilderModelSchema, BuilderModelSerialisedSchema } from './model/index.js';
|
|
10
|
-
import { BuilderOptionSchema, BuilderOptionSelectMapSerialisedSchema, BuilderOptionWhenSerialisedSchema,
|
|
10
|
+
import { BuilderOptionSchema, BuilderOptionSelectMapSerialisedSchema, BuilderOptionWhenSerialisedSchema, BuilderSelectConfigSchema, BuilderSelectConfigSerialisedSchema, BuilderToggleConfigSchema, BuilderToggleConfigSerialisedSchema } from './option/index.js';
|
|
11
11
|
import { BuilderPricingSchema, BuilderPricingSerialisedSchema, BuilderRatesSchema } from './pricing/index.js';
|
|
12
12
|
import { BuilderUIDescribeSchema, BuilderUIDescribeSerialisedSchema, BuilderUIInputSchema, BuilderUIInputSerialisedSchema, BuilderUIItemsSerialisedSchema, BuilderUIPageSchema, BuilderUIPageSerialisedSchema, BuilderUIPagesSchema, BuilderUIPagesSerialisedSchema, BuilderUISchema, BuilderUISerialisedSchema } from './ui/index.js';
|
|
13
13
|
export const entitiesMap = {
|
|
14
14
|
builder: { runtime: BuilderSchema, serialised: BuilderSerialisedSchema },
|
|
15
15
|
model: { runtime: BuilderModelSchema, serialised: BuilderModelSerialisedSchema },
|
|
16
|
-
select: { runtime:
|
|
17
|
-
toggle: { runtime:
|
|
16
|
+
select: { runtime: BuilderSelectConfigSchema, serialised: BuilderSelectConfigSerialisedSchema },
|
|
17
|
+
toggle: { runtime: BuilderToggleConfigSchema, serialised: BuilderToggleConfigSerialisedSchema },
|
|
18
18
|
optionSelectMap: {
|
|
19
19
|
runtime: BuilderOptionSelectMapSerialisedSchema,
|
|
20
20
|
serialised: BuilderOptionSelectMapSerialisedSchema
|
|
@@ -23,9 +23,9 @@ export const entitiesMap = {
|
|
|
23
23
|
runtime: BuilderOptionWhenSerialisedSchema,
|
|
24
24
|
serialised: BuilderOptionWhenSerialisedSchema
|
|
25
25
|
},
|
|
26
|
-
|
|
27
|
-
runtime:
|
|
28
|
-
serialised:
|
|
26
|
+
componentConfig: {
|
|
27
|
+
runtime: BuilderComponentConfigSchema,
|
|
28
|
+
serialised: BuilderComponentConfigSerialisedSchema
|
|
29
29
|
},
|
|
30
30
|
componentSelectMap: {
|
|
31
31
|
runtime: BuilderComponentSelectMapSerialisedSchema,
|
|
@@ -141,7 +141,7 @@ const serialiserMap = [
|
|
|
141
141
|
serialiser(BuilderOptionSchema, serialiseNamedEntry),
|
|
142
142
|
serialiser(BuilderComponentSchema, serialiseNamedEntry),
|
|
143
143
|
serialiser(BuilderCollectionSchema, serialiseNamedEntry),
|
|
144
|
-
serialiser(
|
|
144
|
+
serialiser(BuilderComponentConfigSchema, (value) => ({
|
|
145
145
|
fields: serialiseValue(value.fields),
|
|
146
146
|
tags: value.tags
|
|
147
147
|
})),
|
|
@@ -158,7 +158,7 @@ const serialiserMap = [
|
|
|
158
158
|
max: serialiseValue(value.max),
|
|
159
159
|
tags: value.tags
|
|
160
160
|
})),
|
|
161
|
-
serialiser(
|
|
161
|
+
serialiser(BuilderSelectConfigSchema, (value) => ({
|
|
162
162
|
type: 'select',
|
|
163
163
|
options: value.options,
|
|
164
164
|
defaultValue: value.defaultValue,
|
|
@@ -166,7 +166,7 @@ const serialiserMap = [
|
|
|
166
166
|
optionLabels: value.optionLabels,
|
|
167
167
|
tags: value.tags
|
|
168
168
|
})),
|
|
169
|
-
serialiser(
|
|
169
|
+
serialiser(BuilderToggleConfigSchema, (value) => ({
|
|
170
170
|
type: 'toggle',
|
|
171
171
|
valueType: value.valueType,
|
|
172
172
|
defaultValue: value.defaultValue,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { BuilderPath } from '../../paths';
|
|
2
2
|
import type { Paramable, ParamableSerialised } from '../../references';
|
|
3
|
-
import type { BuilderModelGeneric, BuilderModelStateOf } from '../model/
|
|
4
|
-
import type { BuilderModelState } from '../model/state';
|
|
3
|
+
import type { BuilderModelGeneric, BuilderModelState, BuilderModelStateOf } from '../model/index';
|
|
5
4
|
import type { BuilderTags } from '../tags';
|
|
6
5
|
import type { BuilderValidPath } from '../when';
|
|
7
6
|
import * as v from 'valibot';
|
package/dist/entities/ui/ui.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { Paramable, ParamableSerialised } from '../../references';
|
|
2
2
|
import type { BuilderExpectation, BuilderExpectations, BuilderExpectationsSerialised } from '../expectation';
|
|
3
3
|
import type { CollectionNamesOf } from '../collection/index';
|
|
4
|
-
import type { BuilderModel, BuilderModelGeneric, BuilderModelStateOf } from '../model/
|
|
5
|
-
import type { BuilderModelStateAsserted } from '../model/expectation';
|
|
4
|
+
import type { BuilderModel, BuilderModelGeneric, BuilderModelStateAsserted, BuilderModelStateOf } from '../model/index';
|
|
6
5
|
import type { BuilderTags } from '../tags';
|
|
7
6
|
import type { BuilderUIValidInputsOf } from './input';
|
|
8
7
|
import type { BuilderUIItems, BuilderUIItemsSerialised } from './pages';
|