@builder-builder/builder 0.0.27 → 0.0.29

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 (132) hide show
  1. package/dist/bb.js +9 -10
  2. package/dist/client/client.d.ts +2 -1
  3. package/dist/client/client.js +4 -1
  4. package/dist/client/public.d.ts +2 -2
  5. package/dist/client/public.js +1 -1
  6. package/dist/client/schema.d.ts +126 -45
  7. package/dist/client/schema.js +6 -1
  8. package/dist/components/BuilderOption.svelte.d.ts +12 -12
  9. package/dist/components/BuilderOptionValueBoolean.svelte.d.ts +20 -0
  10. package/dist/components/BuilderOptionValueNumber.svelte.d.ts +21 -0
  11. package/dist/components/BuilderOptionValueSelect.svelte.d.ts +21 -0
  12. package/dist/components/BuilderOptionValueString.svelte.d.ts +21 -0
  13. package/dist/components/BuilderRender.svelte.d.ts +2 -2
  14. package/dist/components/index.d.ts +8 -8
  15. package/dist/components/index.js +4376 -4258
  16. package/dist/components/index.min.js +3 -0
  17. package/dist/entities/collection/collection.d.ts +191 -401
  18. package/dist/entities/collection/collection.js +7 -4
  19. package/dist/entities/collection/{when.d.ts → condition.d.ts} +4 -5
  20. package/dist/entities/collection/condition.js +2 -0
  21. package/dist/entities/collection/config.d.ts +62 -80
  22. package/dist/entities/collection/index.d.ts +4 -4
  23. package/dist/entities/collection/index.js +2 -2
  24. package/dist/entities/component/component.d.ts +71 -83
  25. package/dist/entities/component/component.js +4 -4
  26. package/dist/entities/component/condition.d.ts +10 -0
  27. package/dist/entities/component/{when.js → condition.js} +3 -9
  28. package/dist/entities/component/config.d.ts +33 -33
  29. package/dist/entities/component/config.js +18 -16
  30. package/dist/entities/component/detail.d.ts +61 -0
  31. package/dist/entities/component/detail.js +71 -0
  32. package/dist/entities/component/index.d.ts +6 -6
  33. package/dist/entities/component/index.js +3 -3
  34. package/dist/entities/{when.d.ts → condition.d.ts} +23 -36
  35. package/dist/entities/{when.js → condition.js} +20 -25
  36. package/dist/entities/expectation.d.ts +135 -3
  37. package/dist/entities/expectation.js +6 -2
  38. package/dist/entities/index.d.ts +9 -9
  39. package/dist/entities/index.js +4 -4
  40. package/dist/entities/kind.d.ts +4 -4
  41. package/dist/entities/kind.js +24 -25
  42. package/dist/entities/model/bind.d.ts +5 -5
  43. package/dist/entities/model/methods.d.ts +18 -27
  44. package/dist/entities/model/methods.js +4 -22
  45. package/dist/entities/model/model.d.ts +3 -1
  46. package/dist/entities/model/model.js +25 -27
  47. package/dist/entities/option/condition.d.ts +9 -0
  48. package/dist/entities/option/condition.js +2 -0
  49. package/dist/entities/option/config.d.ts +47 -72
  50. package/dist/entities/option/config.js +6 -6
  51. package/dist/entities/option/expectation.d.ts +6 -1
  52. package/dist/entities/option/expectation.js +2 -2
  53. package/dist/entities/option/index.d.ts +8 -8
  54. package/dist/entities/option/index.js +4 -4
  55. package/dist/entities/option/option.d.ts +179 -210
  56. package/dist/entities/option/option.js +4 -4
  57. package/dist/entities/option/select.d.ts +16 -43
  58. package/dist/entities/option/select.js +8 -31
  59. package/dist/entities/option/value.d.ts +73 -0
  60. package/dist/entities/option/value.js +99 -0
  61. package/dist/entities/paths.d.ts +2 -2
  62. package/dist/entities/pricing/expression.d.ts +16 -39
  63. package/dist/entities/pricing/expression.js +1 -16
  64. package/dist/entities/pricing/index.d.ts +1 -1
  65. package/dist/entities/pricing/rates.d.ts +1 -1
  66. package/dist/entities/references.d.ts +124 -84
  67. package/dist/entities/serialise.d.ts +175 -109
  68. package/dist/entities/serialise.js +32 -27
  69. package/dist/entities/ui/describe.d.ts +1 -1
  70. package/dist/entities/ui/input.d.ts +2 -2
  71. package/dist/entities/ui/page.d.ts +1 -1
  72. package/dist/entities/ui/pages.d.ts +2 -2
  73. package/dist/entities/validated.d.ts +3 -3
  74. package/dist/environment.d.ts +2 -2
  75. package/dist/errors/errors.d.ts +94 -58
  76. package/dist/errors/errors.js +41 -7
  77. package/dist/errors/exception.d.ts +3 -3
  78. package/dist/errors/index.d.ts +1 -1
  79. package/dist/errors/index.js +1 -1
  80. package/dist/errors/public.d.ts +1 -1
  81. package/dist/index.d.ts +1 -1
  82. package/dist/index.js +1 -1
  83. package/dist/instance.d.ts +53 -9
  84. package/dist/instance.js +6 -2
  85. package/dist/mappers/dependencies.d.ts +3 -0
  86. package/dist/mappers/dependencies.js +45 -0
  87. package/dist/mappers/index.d.ts +2 -2
  88. package/dist/mappers/index.js +2 -1
  89. package/dist/mappers/instance.js +26 -21
  90. package/dist/mappers/price.js +6 -4
  91. package/dist/mappers/resolve.js +23 -22
  92. package/dist/mappers/variants/index.d.ts +1 -2
  93. package/dist/mappers/variants/index.js +1 -2
  94. package/dist/mappers/variants/option-graph.d.ts +1 -2
  95. package/dist/mappers/variants/option-graph.js +4 -18
  96. package/dist/mappers/variants/variants.d.ts +3 -6
  97. package/dist/mappers/variants/variants.js +34 -11
  98. package/dist/primitive.d.ts +3 -0
  99. package/dist/primitive.js +2 -0
  100. package/dist/public.d.ts +20 -20
  101. package/dist/public.js +17 -9
  102. package/dist/validate/builder.d.ts +2 -2
  103. package/dist/validate/builder.js +15 -15
  104. package/dist/validate/expectations.d.ts +2 -2
  105. package/dist/validate/expectations.js +23 -5
  106. package/dist/validate/instance.d.ts +2 -2
  107. package/dist/validate/instance.js +31 -13
  108. package/dist/validate/model.d.ts +4 -4
  109. package/dist/validate/model.js +57 -51
  110. package/dist/validate/paths.d.ts +2 -2
  111. package/dist/validate/paths.js +19 -14
  112. package/dist/validate/pricing.d.ts +4 -4
  113. package/dist/validate/pricing.js +31 -31
  114. package/dist/validate/resolve.d.ts +2 -2
  115. package/dist/validate/resolve.js +27 -31
  116. package/dist/validate/ui.d.ts +4 -4
  117. package/dist/validate/ui.js +38 -38
  118. package/dist/validate/variants.d.ts +3 -3
  119. package/dist/validate/variants.js +32 -31
  120. package/package.json +4 -2
  121. package/dist/components/BuilderOptionSelect.svelte.d.ts +0 -21
  122. package/dist/components/BuilderOptionToggleBoolean.svelte.d.ts +0 -20
  123. package/dist/components/BuilderOptionToggleNumber.svelte.d.ts +0 -21
  124. package/dist/components/BuilderOptionToggleString.svelte.d.ts +0 -21
  125. package/dist/entities/collection/when.js +0 -2
  126. package/dist/entities/component/field.d.ts +0 -59
  127. package/dist/entities/component/field.js +0 -52
  128. package/dist/entities/component/when.d.ts +0 -11
  129. package/dist/entities/option/toggle.d.ts +0 -45
  130. package/dist/entities/option/toggle.js +0 -66
  131. package/dist/entities/option/when.d.ts +0 -10
  132. package/dist/entities/option/when.js +0 -2
@@ -4,39 +4,41 @@ import { paramable } from '../../references.js';
4
4
  import { createEntityValidator } from '../kind.js';
5
5
  import { serialisable } from '../serialisable.js';
6
6
  import { BuilderTagsSchema } from '../tags.js';
7
- import { BuilderComponentFieldSerialisedSchema, BuilderComponentFieldsSerialisedSchema } from './field.js';
7
+ import { BuilderComponentDetailsSerialisedSchema } from './detail.js';
8
8
  export class BuilderComponentConfig {
9
- fields;
9
+ details;
10
10
  tags;
11
- constructor(fields, tags) {
12
- this.fields = fields;
11
+ constructor(details, tags) {
12
+ this.details = details;
13
13
  this.tags = tags;
14
14
  }
15
15
  tag(...tags) {
16
- return new BuilderComponentConfig(this.fields, tags);
16
+ return new BuilderComponentConfig(this.details, tags);
17
17
  }
18
18
  }
19
19
  export const BuilderComponentConfigSchema = v.instance(BuilderComponentConfig);
20
20
  export const BuilderComponentConfigSerialisedSchema = serialisable(v.object({
21
- fields: paramable(BuilderComponentFieldsSerialisedSchema),
21
+ details: paramable(BuilderComponentDetailsSerialisedSchema),
22
22
  tags: v.optional(BuilderTagsSchema)
23
23
  }));
24
24
  export const BuilderComponentConfigsSerialisedSchema = v.pipe(v.array(BuilderComponentConfigSerialisedSchema), v.readonly());
25
- export function componentConfig(...fields) {
26
- return new BuilderComponentConfig(fields);
25
+ export function componentConfig(...details) {
26
+ return new BuilderComponentConfig(details);
27
27
  }
28
28
  export const validateComponentConfig = createEntityValidator('componentConfig', BuilderComponentConfigSerialisedSchema, (input, errors) => {
29
- if (!check.is(BuilderComponentFieldsSerialisedSchema, input.fields)) {
29
+ if (!check.is(BuilderComponentDetailsSerialisedSchema, input.details)) {
30
30
  return;
31
31
  }
32
- const seen = new Set();
33
- input.fields.forEach((field) => {
34
- if (!check.is(BuilderComponentFieldSerialisedSchema, field)) {
35
- return;
32
+ const seenNames = new Set();
33
+ const seenKinds = new Set();
34
+ input.details.forEach((detail) => {
35
+ if (seenNames.has(detail.name)) {
36
+ errors.entityDuplicateDetail();
36
37
  }
37
- if (seen.has(field.name)) {
38
- errors.entityDuplicateField();
38
+ seenNames.add(detail.name);
39
+ if (detail.kind === 'price' && seenKinds.has(detail.kind)) {
40
+ errors.entityDuplicatePrice();
39
41
  }
40
- seen.add(field.name);
42
+ seenKinds.add(detail.kind);
41
43
  });
42
44
  });
@@ -0,0 +1,61 @@
1
+ import type { BuilderPrimitive } from '../../primitive';
2
+ import type { BuilderTags } from '../tags';
3
+ import * as v from 'valibot';
4
+ export declare const BuilderComponentDetailKindSchema: v.PicklistSchema<["string", "boolean", "number", "price", "image"], undefined>;
5
+ export type BuilderComponentDetailKind = v.InferOutput<typeof BuilderComponentDetailKindSchema>;
6
+ export declare class BuilderComponentDetail<const Name extends string = string, const ValueSchema extends v.GenericSchema<BuilderPrimitive> = v.GenericSchema<BuilderPrimitive>> {
7
+ #private;
8
+ readonly value: v.InferOutput<ValueSchema>;
9
+ readonly type: "component-detail";
10
+ readonly name: Name;
11
+ readonly kind: BuilderComponentDetailKind;
12
+ readonly valueSchema: ValueSchema;
13
+ readonly isOptional: boolean;
14
+ readonly tags?: BuilderTags;
15
+ constructor(name: Name, kind: BuilderComponentDetailKind, optional?: boolean, tags?: BuilderTags);
16
+ optional(): BuilderComponentDetail<Name, v.NullableSchema<ValueSchema, undefined>>;
17
+ tag(...tags: Array<string>): BuilderComponentDetail<Name, ValueSchema>;
18
+ }
19
+ export declare function detailString<const Name extends string>(name: Name): BuilderComponentDetail<Name, v.StringSchema<undefined>>;
20
+ export declare function detailNumber<const Name extends string>(name: Name): BuilderComponentDetail<Name, v.NumberSchema<undefined>>;
21
+ export declare function detailBoolean<const Name extends string>(name: Name): BuilderComponentDetail<Name, v.BooleanSchema<undefined>>;
22
+ export declare function detailPrice<const Name extends string>(name: Name): BuilderComponentDetail<Name, v.NumberSchema<undefined>>;
23
+ export declare function detailImage<const Name extends string>(name: Name): BuilderComponentDetail<Name, v.StringSchema<undefined>>;
24
+ export declare const BuilderComponentDetailSchema: v.InstanceSchema<typeof BuilderComponentDetail, undefined>;
25
+ export declare const BuilderComponentDetailsSchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.InstanceSchema<typeof BuilderComponentDetail, undefined>, undefined>, v.ReadonlyAction<BuilderComponentDetail<string, v.GenericSchema<string | number | boolean | null>>[]>]>;
26
+ export type BuilderComponentDetails = v.InferOutput<typeof BuilderComponentDetailsSchema>;
27
+ export declare const BuilderComponentDetailSerialisedSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
28
+ readonly type: v.LiteralSchema<"component-detail", undefined>;
29
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
30
+ readonly kind: v.PicklistSchema<["string", "boolean", "number", "price", "image"], undefined>;
31
+ readonly isOptional: v.BooleanSchema<undefined>;
32
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
33
+ }, undefined>, v.ReadonlyAction<{
34
+ type: "component-detail";
35
+ name: string;
36
+ kind: "string" | "number" | "boolean" | "price" | "image";
37
+ isOptional: boolean;
38
+ tags?: readonly string[] | undefined;
39
+ }>]>;
40
+ export type BuilderComponentDetailSerialised = v.InferOutput<typeof BuilderComponentDetailSerialisedSchema>;
41
+ export declare const BuilderComponentDetailsSerialisedSchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
42
+ readonly type: v.LiteralSchema<"component-detail", undefined>;
43
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
44
+ readonly kind: v.PicklistSchema<["string", "boolean", "number", "price", "image"], undefined>;
45
+ readonly isOptional: v.BooleanSchema<undefined>;
46
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
47
+ }, undefined>, v.ReadonlyAction<{
48
+ type: "component-detail";
49
+ name: string;
50
+ kind: "string" | "number" | "boolean" | "price" | "image";
51
+ isOptional: boolean;
52
+ tags?: readonly string[] | undefined;
53
+ }>]>, undefined>, v.ReadonlyAction<Readonly<{
54
+ type: "component-detail";
55
+ name: string;
56
+ kind: "string" | "number" | "boolean" | "price" | "image";
57
+ isOptional: boolean;
58
+ tags?: readonly string[] | undefined;
59
+ }>[]>]>;
60
+ export type BuilderComponentDetailsSerialised = v.InferOutput<typeof BuilderComponentDetailsSerialisedSchema>;
61
+ export declare function detailValueSchema(kind: BuilderComponentDetailKind, optional: boolean): v.GenericSchema<BuilderPrimitive>;
@@ -0,0 +1,71 @@
1
+ import * as v from 'valibot';
2
+ import { BooleanSchema, NameSchema, NumberSchema, StringSchema, UrlSchema } from '../../primitive.js';
3
+ import { serialisable } from '../serialisable.js';
4
+ import { BuilderTagsSchema } from '../tags.js';
5
+ export const BuilderComponentDetailKindSchema = v.picklist([
6
+ 'string',
7
+ 'boolean',
8
+ 'number',
9
+ 'price',
10
+ 'image'
11
+ ]);
12
+ export class BuilderComponentDetail {
13
+ type = 'component-detail';
14
+ name;
15
+ kind;
16
+ valueSchema;
17
+ isOptional;
18
+ tags;
19
+ constructor(name, kind, optional = false, tags) {
20
+ this.name = name;
21
+ this.kind = kind;
22
+ this.valueSchema = detailValueSchema(kind, optional);
23
+ this.isOptional = optional;
24
+ this.tags = tags;
25
+ }
26
+ #next(patch) {
27
+ return new BuilderComponentDetail(this.name, this.kind, patch.optional ?? this.isOptional, patch.tags ?? this.tags);
28
+ }
29
+ optional() {
30
+ return this.#next({ optional: true });
31
+ }
32
+ tag(...tags) {
33
+ return this.#next({ tags });
34
+ }
35
+ }
36
+ export function detailString(name) {
37
+ return new BuilderComponentDetail(name, 'string');
38
+ }
39
+ export function detailNumber(name) {
40
+ return new BuilderComponentDetail(name, 'number');
41
+ }
42
+ export function detailBoolean(name) {
43
+ return new BuilderComponentDetail(name, 'boolean');
44
+ }
45
+ export function detailPrice(name) {
46
+ return new BuilderComponentDetail(name, 'price');
47
+ }
48
+ export function detailImage(name) {
49
+ return new BuilderComponentDetail(name, 'image');
50
+ }
51
+ export const BuilderComponentDetailSchema = v.instance(BuilderComponentDetail);
52
+ export const BuilderComponentDetailsSchema = v.pipe(v.array(BuilderComponentDetailSchema), v.readonly());
53
+ export const BuilderComponentDetailSerialisedSchema = serialisable(v.object({
54
+ type: v.literal('component-detail'),
55
+ name: NameSchema,
56
+ kind: BuilderComponentDetailKindSchema,
57
+ isOptional: BooleanSchema,
58
+ tags: v.optional(BuilderTagsSchema)
59
+ }));
60
+ export const BuilderComponentDetailsSerialisedSchema = v.pipe(v.array(BuilderComponentDetailSerialisedSchema), v.readonly());
61
+ export function detailValueSchema(kind, optional) {
62
+ const kindSchemas = {
63
+ string: StringSchema,
64
+ number: NumberSchema,
65
+ boolean: BooleanSchema,
66
+ price: NumberSchema,
67
+ image: UrlSchema
68
+ };
69
+ const baseSchema = kindSchemas[kind];
70
+ return optional ? v.nullable(baseSchema) : baseSchema;
71
+ }
@@ -1,10 +1,10 @@
1
- export type { BuilderComponentPayload, BuilderComponents, BuilderComponentSerialised, BuilderComponentsSerialised, BuilderComponentWhenSerialised } from './component';
1
+ export type { BuilderComponentPayload, BuilderComponents, BuilderComponentSerialised, BuilderComponentsSerialised, BuilderComponentConditionSerialised } from './component';
2
2
  export type { BuilderComponentConfigSerialised, BuilderComponentConfigsSerialised } from './config';
3
3
  export type { ComponentAsserted } from './expectation';
4
- export type { BuilderComponentFields, BuilderComponentFieldsSerialised, BuilderComponentFieldSerialised, BuilderComponentFieldValueType } from './field';
5
- export type { BuilderComponentWhen } from './when';
6
- export { BuilderComponent, BuilderComponentSchema, BuilderComponentSelectMapSerialisedSchema, BuilderComponentSerialisedSchema, BuilderComponentsSerialisedSchema, BuilderComponentWhenSerialisedSchema, validateComponentSelectMap, validateComponentWhen } from './component.js';
4
+ export type { BuilderComponentDetailKind, BuilderComponentDetails, BuilderComponentDetailSerialised, BuilderComponentDetailsSerialised } from './detail';
5
+ export type { BuilderComponentCondition } from './condition';
6
+ export { BuilderComponent, BuilderComponentSchema, BuilderComponentSelectMapSerialisedSchema, BuilderComponentSerialisedSchema, BuilderComponentsSerialisedSchema, BuilderComponentConditionSerialisedSchema, validateComponentSelectMap, validateComponentCondition } from './component.js';
7
7
  export { BuilderComponentConfig, BuilderComponentConfigSchema, BuilderComponentConfigSerialisedSchema, BuilderComponentConfigsSerialisedSchema, componentConfig, validateComponentConfig } from './config.js';
8
8
  export { componentExpectation } from './expectation.js';
9
- export { BuilderComponentField, BuilderComponentFieldSchema, BuilderComponentFieldSerialisedSchema, BuilderComponentFieldsSchema, BuilderComponentFieldsSerialisedSchema, BuilderComponentFieldValueTypeSchema, detailBoolean, detailNumber, detailString, detailValueSchema } from './field.js';
10
- export { componentWhen } from './when.js';
9
+ export { BuilderComponentDetail, BuilderComponentDetailKindSchema, BuilderComponentDetailSchema, BuilderComponentDetailSerialisedSchema, BuilderComponentDetailsSchema, BuilderComponentDetailsSerialisedSchema, detailBoolean, detailImage, detailNumber, detailPrice, detailString, detailValueSchema } from './detail.js';
10
+ export { componentCondition } from './condition.js';
@@ -1,5 +1,5 @@
1
- export { BuilderComponent, BuilderComponentSchema, BuilderComponentSelectMapSerialisedSchema, BuilderComponentSerialisedSchema, BuilderComponentsSerialisedSchema, BuilderComponentWhenSerialisedSchema, validateComponentSelectMap, validateComponentWhen } from './component.js';
1
+ export { BuilderComponent, BuilderComponentSchema, BuilderComponentSelectMapSerialisedSchema, BuilderComponentSerialisedSchema, BuilderComponentsSerialisedSchema, BuilderComponentConditionSerialisedSchema, validateComponentSelectMap, validateComponentCondition } from './component.js';
2
2
  export { BuilderComponentConfig, BuilderComponentConfigSchema, BuilderComponentConfigSerialisedSchema, BuilderComponentConfigsSerialisedSchema, componentConfig, validateComponentConfig } from './config.js';
3
3
  export { componentExpectation } from './expectation.js';
4
- export { BuilderComponentField, BuilderComponentFieldSchema, BuilderComponentFieldSerialisedSchema, BuilderComponentFieldsSchema, BuilderComponentFieldsSerialisedSchema, BuilderComponentFieldValueTypeSchema, detailBoolean, detailNumber, detailString, detailValueSchema } from './field.js';
5
- export { componentWhen } from './when.js';
4
+ export { BuilderComponentDetail, BuilderComponentDetailKindSchema, BuilderComponentDetailSchema, BuilderComponentDetailSerialisedSchema, BuilderComponentDetailsSchema, BuilderComponentDetailsSerialisedSchema, detailBoolean, detailImage, detailNumber, detailPrice, detailString, detailValueSchema } from './detail.js';
5
+ export { componentCondition } from './condition.js';
@@ -1,12 +1,8 @@
1
- import type { BuilderPrimitive, BuilderPrimitives } from '../primitive';
1
+ import type { BuilderPrimitive, BuilderPrimitives, BuilderPrimitivesNonEmpty } from '../primitive';
2
2
  import type { BuilderParameter, BuilderParameterSerialised, Paramable } from '../references';
3
3
  import type { BuilderModelGeneric, BuilderModelState, BuilderModelStateOf } from './model/index';
4
4
  import type { BuilderPath, BuilderPaths } from './paths';
5
5
  import * as v from 'valibot';
6
- export type BuilderEnableConfig<Payload = unknown> = {
7
- readonly type: 'enable';
8
- readonly payload: Payload;
9
- };
10
6
  export type BuilderMatchSelectMap<Item> = Record<string, Item | null>;
11
7
  export type BuilderMatchConfig<Payload = unknown, MatchPath = BuilderPath, SelectMap = BuilderMatchSelectMap<Payload>> = {
12
8
  readonly type: 'match';
@@ -19,11 +15,10 @@ export type BuilderUnlessConfig<Payload = unknown, UnlessPath = BuilderPath> = {
19
15
  readonly disabledValues: BuilderPrimitives;
20
16
  readonly payload: Payload;
21
17
  };
22
- export type BuilderWhen<Payload = unknown, MatchPath = BuilderPath, MatchSelectMap = Record<string, Payload | null>, UnlessPath = BuilderPath> = BuilderEnableConfig<Payload> | BuilderMatchConfig<Payload, MatchPath, MatchSelectMap> | BuilderUnlessConfig<Payload, UnlessPath>;
23
- export type BuilderWhenSerialised<Payload> = {
24
- readonly type: 'enable';
25
- readonly payload: Payload | BuilderParameterSerialised;
26
- } | {
18
+ export type BuilderCondition<Payload = unknown, MatchPath = BuilderPath, MatchSelectMap = Record<string, Payload | null>, UnlessPath = BuilderPath> = BuilderMatchConfig<Payload, MatchPath, MatchSelectMap> | BuilderUnlessConfig<Payload, UnlessPath>;
19
+ export declare function match<const MatchPath extends Paramable<BuilderPath>, const SelectMap extends Paramable<BuilderMatchSelectMap<unknown>>>(matchPath: MatchPath, selectMap: SelectMap): BuilderMatchConfig<unknown, MatchPath, SelectMap>;
20
+ export declare function unless<const Values, const UnlessPath extends Paramable<BuilderPath>>(unlessPath: UnlessPath, disabledValues: BuilderPrimitivesNonEmpty, values: Values): BuilderUnlessConfig<Values, UnlessPath>;
21
+ export type BuilderConditionSerialised<Payload> = {
27
22
  readonly type: 'match';
28
23
  readonly matchPath: BuilderParameterSerialised | BuilderPath;
29
24
  readonly selectMap: Record<string, (Payload | BuilderParameterSerialised) | null> | BuilderParameterSerialised;
@@ -33,13 +28,10 @@ export type BuilderWhenSerialised<Payload> = {
33
28
  readonly disabledValues: BuilderPrimitives;
34
29
  readonly payload: Payload | BuilderParameterSerialised;
35
30
  };
36
- export type WhenConfigPayload<Config extends BuilderWhenGeneric, Payload> = Config extends {
31
+ export type ConditionConfigPayload<Config extends BuilderConditionGeneric, Payload> = Config extends {
37
32
  readonly payload: infer Inner extends Payload;
38
33
  } ? Inner : Config extends BuilderMatchConfig ? NonNullable<Config['selectMap'][keyof Config['selectMap']]> & Payload : never;
39
- export declare const BuilderWhenEnableSchema: v.ObjectSchema<{
40
- readonly type: v.LiteralSchema<"enable", undefined>;
41
- }, undefined>;
42
- export declare const BuilderWhenMatchSchema: v.ObjectSchema<{
34
+ export declare const BuilderConditionMatchSchema: v.ObjectSchema<{
43
35
  readonly type: v.LiteralSchema<"match", undefined>;
44
36
  readonly matchPath: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
45
37
  readonly type: v.LiteralSchema<"parameter", undefined>;
@@ -57,7 +49,7 @@ export declare const BuilderWhenMatchSchema: v.ObjectSchema<{
57
49
  id: string;
58
50
  }>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, v.NumberSchema<undefined>], undefined>, undefined>, v.ReadonlyAction<(string | number)[]>]>], undefined>;
59
51
  }, undefined>;
60
- export declare const BuilderWhenUnlessSchema: v.ObjectSchema<{
52
+ export declare const BuilderConditionUnlessSchema: v.ObjectSchema<{
61
53
  readonly type: v.LiteralSchema<"unless", undefined>;
62
54
  readonly unlessPath: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
63
55
  readonly type: v.LiteralSchema<"parameter", undefined>;
@@ -75,9 +67,7 @@ export declare const BuilderWhenUnlessSchema: v.ObjectSchema<{
75
67
  id: string;
76
68
  }>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, v.NumberSchema<undefined>], undefined>, undefined>, v.ReadonlyAction<(string | number)[]>]>], undefined>;
77
69
  }, undefined>;
78
- export declare const BuilderWhenConfigSchema: v.SchemaWithPipe<readonly [v.VariantSchema<"type", [v.ObjectSchema<{
79
- readonly type: v.LiteralSchema<"enable", undefined>;
80
- }, undefined>, v.ObjectSchema<{
70
+ export declare const BuilderConditionConfigSchema: v.SchemaWithPipe<readonly [v.VariantSchema<"type", [v.ObjectSchema<{
81
71
  readonly type: v.LiteralSchema<"match", undefined>;
82
72
  readonly matchPath: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
83
73
  readonly type: v.LiteralSchema<"parameter", undefined>;
@@ -112,8 +102,6 @@ export declare const BuilderWhenConfigSchema: v.SchemaWithPipe<readonly [v.Varia
112
102
  id: string;
113
103
  }>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, v.NumberSchema<undefined>], undefined>, undefined>, v.ReadonlyAction<(string | number)[]>]>], undefined>;
114
104
  }, undefined>], undefined>, v.ReadonlyAction<{
115
- type: "enable";
116
- } | {
117
105
  type: "match";
118
106
  matchPath: readonly (string | number)[] | Readonly<{
119
107
  type: "parameter";
@@ -134,21 +122,20 @@ export declare const BuilderWhenConfigSchema: v.SchemaWithPipe<readonly [v.Varia
134
122
  id: string;
135
123
  }>;
136
124
  }>]>;
137
- export type BuilderWhenConfig = v.InferOutput<typeof BuilderWhenConfigSchema>;
138
- export type BuilderWhenGeneric = BuilderWhen<unknown, unknown, unknown, unknown>;
139
- export declare const BuilderWhenSerialisedSchema: v.GenericSchema<BuilderWhenSerialised<unknown>>;
140
- export declare function whenBranches<Leaf>(payload: unknown, schema: v.GenericSchema<Leaf>): ReadonlyArray<Leaf>;
125
+ export type BuilderConditionConfig = v.InferOutput<typeof BuilderConditionConfigSchema>;
126
+ export type BuilderConditionGeneric = BuilderCondition<unknown, unknown, unknown, unknown>;
127
+ export declare const BuilderConditionSerialisedSchema: v.GenericSchema<BuilderConditionSerialised<unknown>>;
128
+ export declare function conditionBranches<Leaf>(payload: unknown, schema: v.GenericSchema<Leaf>): ReadonlyArray<Leaf>;
141
129
  export declare function createSelectMapSerialisedSchema<Payload extends v.GenericSchema>(payloadSchema: Payload): v.GenericSchema<BuilderMatchSelectMap<v.InferOutput<Payload> | BuilderParameterSerialised>>;
142
- export declare function createWhenSerialisedSchema<Payload extends v.GenericSchema>(payloadSchema: Payload): v.GenericSchema<BuilderWhenSerialised<v.InferOutput<Payload>>>;
143
- export declare function createWhenFactories<Payload>(): {
144
- enable: <const Values extends Paramable<Payload>>(values: Values) => BuilderEnableConfig<Values>;
130
+ export declare function createConditionSerialisedSchema<Payload extends v.GenericSchema>(payloadSchema: Payload): v.GenericSchema<BuilderConditionSerialised<v.InferOutput<Payload>>>;
131
+ export declare function createConditionFactories<Payload>(): {
145
132
  match: <const MatchPayload extends Paramable<Payload>, const MatchPath extends Paramable<BuilderPath>, const SelectMap extends Paramable<BuilderMatchSelectMap<Paramable<Payload>>>>(matchPath: MatchPath, selectMap: SelectMap) => BuilderMatchConfig<MatchPayload, MatchPath, SelectMap>;
146
- unless: <const Values extends Paramable<Payload>, const UnlessPath extends Paramable<BuilderPath>>(unlessPath: UnlessPath, disabledValues: BuilderPrimitives, values: Values) => BuilderUnlessConfig<Values, UnlessPath>;
133
+ unless: <const Values extends Paramable<Payload>, const UnlessPath extends Paramable<BuilderPath>>(unlessPath: UnlessPath, disabledValues: BuilderPrimitivesNonEmpty, values: Values) => BuilderUnlessConfig<Values, UnlessPath>;
147
134
  };
148
135
  export type BuilderValidPath<State extends BuilderModelState> = InstanceValidPath<State['instance']>;
149
136
  export type BuilderValidPaths<State extends BuilderModelState> = ReadonlyArray<BuilderValidPath<State>>;
150
137
  export type BuilderValidPathsOf<Input extends Paramable<BuilderModelGeneric>> = BuilderValidPaths<BuilderModelStateOf<Input>>;
151
- export type BuilderWhenConstrained<State extends BuilderModelState, Config> = Config extends BuilderParameter ? Config : Config extends {
138
+ export type BuilderConditionConstrained<State extends BuilderModelState, Config> = Config extends BuilderParameter ? Config : Config extends {
152
139
  readonly type: 'match';
153
140
  readonly matchPath: infer MatchPath extends BuilderPath;
154
141
  readonly selectMap: infer SelectMap;
@@ -161,25 +148,25 @@ export type BuilderWhenConstrained<State extends BuilderModelState, Config> = Co
161
148
  } ? Config & {
162
149
  readonly unlessPath: [UnlessPath] extends [Readonly<BuilderValidPath<State>>] ? UnlessPath : Readonly<BuilderValidPath<State>>;
163
150
  } : Config;
164
- export type WhenConfigNullable<Config extends BuilderWhenGeneric> = Config extends {
151
+ export type ConditionConfigNullable<Config extends BuilderConditionGeneric> = Config extends {
165
152
  readonly type: 'unless';
166
153
  } ? null : Config extends {
167
154
  readonly type: 'match';
168
155
  readonly selectMap: infer SelectMap;
169
156
  } ? null extends SelectMap[keyof SelectMap] ? null : never : never;
170
- export type WhenNullability<State extends BuilderModelState, GatePaths extends Paramable<BuilderPaths>, Config extends Paramable<BuilderWhenGeneric>> = [GatePaths] extends [BuilderParameter] ? null : WhenNullabilityFromPaths<State['instance'], Extract<GatePaths, BuilderValidPaths<State>>, Config>;
157
+ export type ConditionNullability<State extends BuilderModelState, ConditionPaths extends Paramable<BuilderPaths>, Config extends Paramable<BuilderConditionGeneric>> = [ConditionPaths] extends [BuilderParameter] ? null : ConditionNullabilityFromPaths<State['instance'], Extract<ConditionPaths, BuilderValidPaths<State>>, Config>;
171
158
  type BuilderResolvePath<Instance, Path extends BuilderPath> = Path extends readonly [
172
159
  infer Head extends keyof Instance & string
173
160
  ] ? Instance[Head] : Path extends readonly [
174
161
  infer Head extends keyof Instance & string,
175
162
  ...infer Tail extends BuilderPath
176
163
  ] ? Instance[Head] extends ReadonlyArray<infer Item> ? Tail extends readonly [number, ...infer Rest extends BuilderPath] ? BuilderResolvePath<Item, Rest> : never : BuilderResolvePath<Instance[Head], Tail> : never;
177
- type WhenNullabilityFromPaths<Instance, GatePaths extends BuilderPaths, Config extends Paramable<BuilderWhenGeneric>> = Config extends BuilderParameter ? WhenPathsNullable<Instance, GatePaths> : Config extends BuilderWhenGeneric ? WhenPathsNullable<Instance, GatePaths> | WhenConfigNullable<Config> : never;
178
- type WhenPathsNullable<Instance, GatePaths extends BuilderPaths> = GatePaths extends readonly [
164
+ type ConditionNullabilityFromPaths<Instance, ConditionPaths extends BuilderPaths, Config extends Paramable<BuilderConditionGeneric>> = Config extends BuilderParameter ? ConditionPathsNullable<Instance, ConditionPaths> : Config extends BuilderConditionGeneric ? ConditionPathsNullable<Instance, ConditionPaths> | ConditionConfigNullable<Config> : never;
165
+ type ConditionPathsNullable<Instance, ConditionPaths extends BuilderPaths> = ConditionPaths extends readonly [
179
166
  infer Head extends BuilderPath,
180
167
  ...infer Tail extends BuilderPaths
181
- ] ? WhenPathNullable<Instance, Head> | WhenPathsNullable<Instance, Tail> : never;
182
- type WhenPathNullable<Instance, Path extends BuilderPath> = null extends BuilderResolvePath<Instance, Path> ? null : never;
168
+ ] ? ConditionPathNullable<Instance, Head> | ConditionPathsNullable<Instance, Tail> : never;
169
+ type ConditionPathNullable<Instance, Path extends BuilderPath> = null extends BuilderResolvePath<Instance, Path> ? null : never;
183
170
  type InstanceValidPath<Instance, Depth extends ReadonlyArray<never> = []> = Depth['length'] extends 10 ? never : Instance extends BuilderPrimitive | null ? never : Instance extends ReadonlyArray<infer Item> ? [number] | [number, ...InstanceValidPath<Item, [...Depth, never]>] : {
184
171
  [Key in keyof Instance & string]: [Key] | (Instance[Key] extends BuilderPrimitive | null ? never : [Key, ...InstanceValidPath<Instance[Key], [...Depth, never]>]);
185
172
  }[keyof Instance & string];
@@ -3,64 +3,59 @@ import { check } from '../errors/index.js';
3
3
  import { BuilderPrimitivesSchema, StringSchema } from '../primitive.js';
4
4
  import { isParamable, paramable } from '../references.js';
5
5
  import { BuilderPathSchema } from './paths.js';
6
- export const BuilderWhenEnableSchema = v.object({
7
- type: v.literal('enable')
8
- });
9
- export const BuilderWhenMatchSchema = v.object({
6
+ export function match(matchPath, selectMap) {
7
+ return { type: 'match', matchPath, selectMap };
8
+ }
9
+ export function unless(unlessPath, disabledValues, values) {
10
+ return { type: 'unless', unlessPath, disabledValues, payload: values };
11
+ }
12
+ export const BuilderConditionMatchSchema = v.object({
10
13
  type: v.literal('match'),
11
14
  matchPath: paramable(BuilderPathSchema)
12
15
  });
13
- export const BuilderWhenUnlessSchema = v.object({
16
+ export const BuilderConditionUnlessSchema = v.object({
14
17
  type: v.literal('unless'),
15
18
  unlessPath: paramable(BuilderPathSchema)
16
19
  });
17
- export const BuilderWhenConfigSchema = v.pipe(v.variant('type', [BuilderWhenEnableSchema, BuilderWhenMatchSchema, BuilderWhenUnlessSchema]), v.readonly());
18
- export const BuilderWhenSerialisedSchema = createWhenSerialisedSchema(v.unknown());
19
- export function whenBranches(payload, schema) {
20
+ export const BuilderConditionConfigSchema = v.pipe(v.variant('type', [BuilderConditionMatchSchema, BuilderConditionUnlessSchema]), v.readonly());
21
+ export const BuilderConditionSerialisedSchema = createConditionSerialisedSchema(v.unknown());
22
+ export function conditionBranches(payload, schema) {
20
23
  if (check.is(schema, payload)) {
21
24
  return [payload];
22
25
  }
23
26
  if (isParamable(payload)) {
24
27
  return [];
25
28
  }
26
- check.assert(BuilderWhenSerialisedSchema, payload);
27
- const when = payload;
28
- switch (when.type) {
29
- case 'enable':
29
+ check.assert(BuilderConditionSerialisedSchema, payload);
30
+ const condition = payload;
31
+ switch (condition.type) {
30
32
  case 'unless': {
31
- return [when.payload];
33
+ return [condition.payload];
32
34
  }
33
35
  case 'match': {
34
- return Object.values(when.selectMap).filter((branch) => branch != null);
36
+ return Object.values(condition.selectMap).filter((branch) => branch != null);
35
37
  }
36
38
  }
37
39
  }
38
40
  export function createSelectMapSerialisedSchema(payloadSchema) {
39
41
  return v.pipe(v.record(StringSchema, v.nullable(paramable(payloadSchema))), v.readonly());
40
42
  }
41
- export function createWhenSerialisedSchema(payloadSchema) {
43
+ export function createConditionSerialisedSchema(payloadSchema) {
42
44
  const paramablePayload = paramable(payloadSchema);
43
45
  return v.pipe(v.variant('type', [
44
46
  v.object({
45
- ...BuilderWhenEnableSchema.entries,
46
- payload: paramablePayload
47
- }),
48
- v.object({
49
- ...BuilderWhenMatchSchema.entries,
47
+ ...BuilderConditionMatchSchema.entries,
50
48
  selectMap: paramable(createSelectMapSerialisedSchema(payloadSchema))
51
49
  }),
52
50
  v.object({
53
- ...BuilderWhenUnlessSchema.entries,
51
+ ...BuilderConditionUnlessSchema.entries,
54
52
  disabledValues: BuilderPrimitivesSchema,
55
53
  payload: paramablePayload
56
54
  })
57
55
  ]), v.readonly());
58
56
  }
59
- export function createWhenFactories() {
57
+ export function createConditionFactories() {
60
58
  return {
61
- enable: (values) => {
62
- return { type: 'enable', payload: values };
63
- },
64
59
  match: (matchPath, selectMap) => {
65
60
  return { type: 'match', matchPath, selectMap };
66
61
  },
@@ -1,3 +1,4 @@
1
+ import type { BuilderOptionConfig } from './option/index';
1
2
  import * as v from 'valibot';
2
3
  export declare const BuilderExpectationKindSchema: v.PicklistSchema<["option", "component", "collection"], undefined>;
3
4
  export type BuilderExpectationKind = v.InferOutput<typeof BuilderExpectationKindSchema>;
@@ -6,7 +7,8 @@ export declare class BuilderExpectation<Name extends string = string, Value = un
6
7
  readonly value: Value;
7
8
  readonly name: Name;
8
9
  readonly kind: Kind;
9
- constructor(name: Name, kind: Kind);
10
+ readonly payload: BuilderOptionConfig | null;
11
+ constructor(name: Name, kind: Kind, payload?: BuilderOptionConfig | null);
10
12
  }
11
13
  export declare const BuilderExpectationSchema: v.InstanceSchema<typeof BuilderExpectation, undefined>;
12
14
  export declare const BuilderExpectationsSchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.InstanceSchema<typeof BuilderExpectation, undefined>, undefined>, v.ReadonlyAction<BuilderExpectation<string, unknown, "option" | "component" | "collection">[]>]>;
@@ -14,23 +16,153 @@ export type BuilderExpectations = v.InferOutput<typeof BuilderExpectationsSchema
14
16
  export declare const BuilderExpectationSerialisedSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
15
17
  readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
16
18
  readonly kind: v.PicklistSchema<["option", "component", "collection"], undefined>;
19
+ readonly payload: v.OptionalSchema<v.LazySchema<v.SchemaWithPipe<readonly [v.VariantSchema<"kind", [v.StrictObjectSchema<{
20
+ readonly kind: v.PicklistSchema<["string", "boolean", "number"], undefined>;
21
+ readonly type: v.LiteralSchema<"value", undefined>;
22
+ readonly defaultValue: v.NullableSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
23
+ readonly isOptional: v.BooleanSchema<undefined>;
24
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
25
+ }, undefined>, v.StrictObjectSchema<{
26
+ readonly kind: v.LiteralSchema<"select", undefined>;
27
+ readonly options: v.SchemaWithPipe<readonly [v.TupleWithRestSchema<[v.StringSchema<undefined>], v.StringSchema<undefined>, undefined>, v.ReadonlyAction<[string, ...string[]]>]>;
28
+ readonly optionLabels: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>, undefined>;
29
+ readonly type: v.LiteralSchema<"value", undefined>;
30
+ readonly defaultValue: v.NullableSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
31
+ readonly isOptional: v.BooleanSchema<undefined>;
32
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
33
+ }, undefined>], undefined>, v.ReadonlyAction<{
34
+ kind: "string" | "number" | "boolean";
35
+ type: "value";
36
+ defaultValue: string | number | boolean | null;
37
+ isOptional: boolean;
38
+ tags?: readonly string[] | undefined;
39
+ } | {
40
+ kind: "select";
41
+ readonly options: readonly [string, ...string[]];
42
+ optionLabels?: {
43
+ [x: string]: string;
44
+ } | undefined;
45
+ type: "value";
46
+ defaultValue: string | number | boolean | null;
47
+ isOptional: boolean;
48
+ tags?: readonly string[] | undefined;
49
+ }>]>>, undefined>;
17
50
  }, undefined>, v.ReadonlyAction<{
18
51
  name: string;
19
52
  kind: "option" | "component" | "collection";
53
+ payload?: Readonly<{
54
+ kind: "string" | "number" | "boolean";
55
+ type: "value";
56
+ defaultValue: string | number | boolean | null;
57
+ isOptional: boolean;
58
+ tags?: readonly string[] | undefined;
59
+ }> | Readonly<{
60
+ kind: "select";
61
+ readonly options: readonly [string, ...string[]];
62
+ optionLabels?: {
63
+ [x: string]: string;
64
+ } | undefined;
65
+ type: "value";
66
+ defaultValue: string | number | boolean | null;
67
+ isOptional: boolean;
68
+ tags?: readonly string[] | undefined;
69
+ }> | undefined;
20
70
  }>]>;
21
71
  export type BuilderExpectationSerialised = v.InferOutput<typeof BuilderExpectationSerialisedSchema>;
22
72
  export declare const BuilderExpectationsSerialisedSchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
23
73
  readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
24
74
  readonly kind: v.PicklistSchema<["option", "component", "collection"], undefined>;
75
+ readonly payload: v.OptionalSchema<v.LazySchema<v.SchemaWithPipe<readonly [v.VariantSchema<"kind", [v.StrictObjectSchema<{
76
+ readonly kind: v.PicklistSchema<["string", "boolean", "number"], undefined>;
77
+ readonly type: v.LiteralSchema<"value", undefined>;
78
+ readonly defaultValue: v.NullableSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
79
+ readonly isOptional: v.BooleanSchema<undefined>;
80
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
81
+ }, undefined>, v.StrictObjectSchema<{
82
+ readonly kind: v.LiteralSchema<"select", undefined>;
83
+ readonly options: v.SchemaWithPipe<readonly [v.TupleWithRestSchema<[v.StringSchema<undefined>], v.StringSchema<undefined>, undefined>, v.ReadonlyAction<[string, ...string[]]>]>;
84
+ readonly optionLabels: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>, undefined>;
85
+ readonly type: v.LiteralSchema<"value", 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
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
89
+ }, undefined>], undefined>, v.ReadonlyAction<{
90
+ kind: "string" | "number" | "boolean";
91
+ type: "value";
92
+ defaultValue: string | number | boolean | null;
93
+ isOptional: boolean;
94
+ tags?: readonly string[] | undefined;
95
+ } | {
96
+ kind: "select";
97
+ readonly options: readonly [string, ...string[]];
98
+ optionLabels?: {
99
+ [x: string]: string;
100
+ } | undefined;
101
+ type: "value";
102
+ defaultValue: string | number | boolean | null;
103
+ isOptional: boolean;
104
+ tags?: readonly string[] | undefined;
105
+ }>]>>, undefined>;
25
106
  }, undefined>, v.ReadonlyAction<{
26
107
  name: string;
27
108
  kind: "option" | "component" | "collection";
109
+ payload?: Readonly<{
110
+ kind: "string" | "number" | "boolean";
111
+ type: "value";
112
+ defaultValue: string | number | boolean | null;
113
+ isOptional: boolean;
114
+ tags?: readonly string[] | undefined;
115
+ }> | Readonly<{
116
+ kind: "select";
117
+ readonly options: readonly [string, ...string[]];
118
+ optionLabels?: {
119
+ [x: string]: string;
120
+ } | undefined;
121
+ type: "value";
122
+ defaultValue: string | number | boolean | null;
123
+ isOptional: boolean;
124
+ tags?: readonly string[] | undefined;
125
+ }> | undefined;
28
126
  }>]>, undefined>, v.ReadonlyAction<Readonly<{
29
127
  name: string;
30
128
  kind: "option" | "component" | "collection";
129
+ payload?: Readonly<{
130
+ kind: "string" | "number" | "boolean";
131
+ type: "value";
132
+ defaultValue: string | number | boolean | null;
133
+ isOptional: boolean;
134
+ tags?: readonly string[] | undefined;
135
+ }> | Readonly<{
136
+ kind: "select";
137
+ readonly options: readonly [string, ...string[]];
138
+ optionLabels?: {
139
+ [x: string]: string;
140
+ } | undefined;
141
+ type: "value";
142
+ defaultValue: string | number | boolean | null;
143
+ isOptional: boolean;
144
+ tags?: readonly string[] | undefined;
145
+ }> | undefined;
31
146
  }>[]>]>;
32
147
  export type BuilderExpectationsSerialised = v.InferOutput<typeof BuilderExpectationsSerialisedSchema>;
33
- export declare const validateExpectations: (input: unknown, references?: import("./references.js").BuilderReferences, errors?: import("../errors/errors.js").BuilderErrorsScope) => import("./validated.js").ValidationResult<readonly ({
148
+ export declare const validateExpectations: (input: unknown, references?: import("./references").BuilderReferences, issues?: import("../errors").BuilderIssuesScope) => import("./validated").ValidationResult<readonly {
34
149
  readonly name: string;
35
150
  readonly kind: "option" | "component" | "collection";
36
- } & import("../validate/brand.js").BuilderValidatedBrand)[]>;
151
+ readonly payload?: {
152
+ readonly kind: "string" | "number" | "boolean";
153
+ readonly type: "value";
154
+ readonly defaultValue: string | number | boolean | null;
155
+ readonly isOptional: boolean;
156
+ readonly tags?: readonly string[] | undefined;
157
+ } | {
158
+ readonly kind: "select";
159
+ readonly options: readonly [string, ...string[]];
160
+ readonly optionLabels?: ({
161
+ readonly [x: string]: string;
162
+ } & import("../validate").BuilderValidatedBrand) | undefined;
163
+ readonly type: "value";
164
+ readonly defaultValue: string | number | boolean | null;
165
+ readonly isOptional: boolean;
166
+ readonly tags?: readonly string[] | undefined;
167
+ } | undefined;
168
+ }[]>;