@builder-builder/builder 0.0.4 → 0.0.6

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 (69) hide show
  1. package/dist/core/builder.d.ts +27 -20
  2. package/dist/core/builder.js +43 -15
  3. package/dist/core/collection/collection.d.ts +11 -12
  4. package/dist/core/collection/collection.js +5 -23
  5. package/dist/core/collection/index.d.ts +1 -1
  6. package/dist/core/collection/method.d.ts +22 -43
  7. package/dist/core/component/component.d.ts +1 -6
  8. package/dist/core/component/component.js +0 -7
  9. package/dist/core/component/graph.d.ts +0 -1
  10. package/dist/core/component/graph.js +8 -7
  11. package/dist/core/component/index.d.ts +1 -1
  12. package/dist/core/component/method.d.ts +7 -9
  13. package/dist/core/expectation.d.ts +45 -0
  14. package/dist/{assert → core}/expectation.js +6 -5
  15. package/dist/core/graph.d.ts +2 -1
  16. package/dist/core/graph.js +3 -1
  17. package/dist/core/index.d.ts +9 -6
  18. package/dist/core/index.js +3 -2
  19. package/dist/core/option/graph.d.ts +1 -2
  20. package/dist/core/option/graph.js +6 -7
  21. package/dist/core/option/method.d.ts +34 -61
  22. package/dist/core/option/method.js +4 -14
  23. package/dist/core/option/option.d.ts +5 -4
  24. package/dist/core/option/option.js +17 -36
  25. package/dist/core/parameter.d.ts +25 -12
  26. package/dist/core/parameter.js +18 -12
  27. package/dist/core/when/config.d.ts +20 -0
  28. package/dist/core/when/config.js +4 -0
  29. package/dist/core/when/constrain.d.ts +14 -0
  30. package/dist/core/when/index.d.ts +5 -0
  31. package/dist/core/when/index.js +2 -0
  32. package/dist/core/when/nullability.d.ts +18 -0
  33. package/dist/core/when/nullability.js +1 -0
  34. package/dist/core/when/resolve.d.ts +18 -0
  35. package/dist/core/when/resolve.js +22 -0
  36. package/dist/index.d.ts +6 -9
  37. package/dist/index.js +1 -2
  38. package/dist/{config.d.ts → model.d.ts} +1 -1
  39. package/dist/model.js +1 -0
  40. package/dist/paths.d.ts +5 -2
  41. package/dist/resolve/index.d.ts +2 -2
  42. package/dist/resolve/instance.d.ts +2 -2
  43. package/dist/resolve/models.d.ts +1 -1
  44. package/dist/resolve/order.d.ts +5 -4
  45. package/dist/resolve/order.js +8 -8
  46. package/dist/resolve/render.d.ts +4 -4
  47. package/dist/resolve/render.js +49 -60
  48. package/dist/resolve/validate.d.ts +6 -5
  49. package/dist/resolve/validate.js +5 -4
  50. package/dist/schemas/index.d.ts +0 -4
  51. package/dist/schemas/index.js +0 -2
  52. package/dist/serialise/deserialise.js +6 -6
  53. package/dist/serialise/index.d.ts +2 -2
  54. package/dist/serialise/index.js +1 -1
  55. package/dist/{schemas/serialise.d.ts → serialise/schemas.d.ts} +184 -162
  56. package/dist/{schemas/serialise.js → serialise/schemas.js} +24 -25
  57. package/dist/serialise/serialise.d.ts +1 -1
  58. package/dist/serialise/serialise.js +9 -3
  59. package/dist/ui.d.ts +10 -8
  60. package/dist/ui.js +37 -19
  61. package/package.json +2 -1
  62. package/dist/assert/assert.d.ts +0 -28
  63. package/dist/assert/assert.js +0 -28
  64. package/dist/assert/expectation.d.ts +0 -20
  65. package/dist/assert/index.d.ts +0 -3
  66. package/dist/assert/index.js +0 -2
  67. package/dist/schemas/layout.d.ts +0 -52
  68. package/dist/schemas/layout.js +0 -6
  69. /package/dist/{config.js → core/when/constrain.js} +0 -0
@@ -1,63 +1,70 @@
1
+ import type { Prettify } from '../prettify';
1
2
  import type { BuilderCollectionEntries, BuilderCollectionMethod } from './collection/index';
2
3
  import type { BuilderComponentEntries, BuilderComponentMethod } from './component/index';
3
- import type { BuilderOptionEntries, BuilderOptionMethod, BuilderOptionValues, BuilderSelectType } from './option/index';
4
+ import type { BuilderOptionEntries, BuilderOptionMethod } from './option/index';
4
5
  import type { BuilderBindings, BuilderBoundState } from './parameter';
6
+ import type { BuilderExpectationEntries, BuilderExpectations, ComponentAssert, ModelAssert } from './expectation';
5
7
  import { BuilderComponentGraph } from './component/index.js';
6
8
  import { BuilderOptionGraph } from './option/index.js';
7
- export type BuilderSelectMap<Select extends BuilderSelectType = BuilderSelectType> = Record<Select['options'][number], BuilderOptionValues | null>;
8
- export type BuilderSelectMapGeneric = BuilderSelectMap<any>;
9
9
  export type BuilderState = {
10
10
  readonly model: unknown;
11
11
  readonly options: BuilderOptionEntries;
12
12
  readonly components: BuilderComponentEntries;
13
13
  readonly collections: BuilderCollectionEntries;
14
+ readonly expectations: BuilderExpectationEntries;
14
15
  };
15
16
  export type BuilderStateEmpty = {
16
17
  readonly model: unknown;
17
18
  readonly options: [];
18
19
  readonly components: [];
19
20
  readonly collections: [];
21
+ readonly expectations: [];
20
22
  };
21
- import type { Prettify } from '../prettify';
22
23
  export type BuilderStateMerge<State extends BuilderState, Patch extends Partial<BuilderState>> = {
23
- model: 'model' extends keyof Patch ? Patch['model'] : State['model'];
24
- options: 'options' extends keyof Patch ? Patch['options'] : State['options'];
25
- components: 'components' extends keyof Patch ? Patch['components'] : State['components'];
26
- collections: 'collections' extends keyof Patch ? Patch['collections'] : State['collections'];
24
+ model: Prettify<'model' extends keyof Patch ? Patch['model'] : State['model']>;
25
+ options: Extract<'options' extends keyof Patch ? Patch['options'] : State['options'], BuilderOptionEntries>;
26
+ components: Extract<'components' extends keyof Patch ? Patch['components'] : State['components'], BuilderComponentEntries>;
27
+ collections: Extract<'collections' extends keyof Patch ? Patch['collections'] : State['collections'], BuilderCollectionEntries>;
28
+ expectations: Extract<'expectations' extends keyof Patch ? Patch['expectations'] : State['expectations'], BuilderExpectationEntries>;
27
29
  };
30
+ export type BuilderMerge<State extends BuilderState, Patch extends Partial<BuilderState>> = Builder<BuilderStateMerge<State, Patch>>;
28
31
  export type BuilderGeneric = Builder<any>;
29
- export type BuilderFactory = (builder: BuilderGeneric) => BuilderGeneric;
30
- export type BuilderPart = BuilderGeneric | BuilderFactory;
31
- export type BuilderParts = ReadonlyArray<BuilderPart>;
32
+ export type Builders = ReadonlyArray<BuilderGeneric>;
32
33
  export type BuilderStateOf<Input extends BuilderGeneric> = Input extends Builder<infer State extends BuilderState> ? State : BuilderStateEmpty;
33
34
  export type BuilderModelOf<Input extends BuilderGeneric> = Input extends Builder<infer State extends BuilderState> ? Prettify<State['model']> : never;
34
- export type BuilderCollectionsOf<Input extends BuilderGeneric> = Input extends Builder<infer State extends BuilderState> ? State['collections'] : never;
35
35
  export declare class Builder<State extends BuilderState = BuilderStateEmpty> {
36
36
  #private;
37
37
  readonly _options: State['options'];
38
38
  readonly _components: State['components'];
39
39
  readonly _collections: State['collections'];
40
+ readonly _expectations: State['expectations'];
40
41
  readonly options: BuilderOptionEntries;
41
42
  readonly components: BuilderComponentEntries;
42
43
  readonly collections: BuilderCollectionEntries;
43
- constructor(options?: BuilderOptionEntries, collections?: BuilderCollectionEntries, components?: BuilderComponentEntries);
44
+ readonly expectations: BuilderExpectationEntries;
45
+ constructor(options?: BuilderOptionEntries, collections?: BuilderCollectionEntries, components?: BuilderComponentEntries, expectations?: BuilderExpectationEntries);
44
46
  get optionGraph(): BuilderOptionGraph;
45
47
  get componentGraph(): BuilderComponentGraph;
46
48
  get option(): BuilderOptionMethod<State>;
47
49
  get component(): BuilderComponentMethod<State>;
48
50
  get collection(): BuilderCollectionMethod<State>;
51
+ expect<const Expectations extends BuilderExpectations>(...expectations: Expectations): BuilderMerge<State, {
52
+ model: ModelAssert<Builder<State>, Expectations>;
53
+ components: ComponentAssert<Builder<State>, Expectations>;
54
+ expectations: [...State['expectations'], ...Expectations];
55
+ }>;
49
56
  bind<const Bindings extends BuilderBindings<State>>(bindings: Bindings): Builder<BuilderBoundState<State, Bindings>>;
50
57
  }
51
- export declare function builder<const Parts extends BuilderParts>(...parts: Parts): Builder<MergedPartsState<Parts>>;
52
- type ExtractPartState<Part> = Part extends BuilderGeneric ? BuilderStateOf<Part> : Part extends (...args: ReadonlyArray<any>) => infer Result ? Result extends BuilderGeneric ? BuilderStateOf<Result> : BuilderStateEmpty : BuilderStateEmpty;
53
- type MergedPartsState<Parts extends ReadonlyArray<BuilderPart>> = Parts extends readonly [
54
- infer Head,
55
- ...infer Tail extends ReadonlyArray<BuilderPart>
56
- ] ? MergeStates<ExtractPartState<Head>, MergedPartsState<Tail>> : BuilderStateEmpty;
57
- type MergeStates<Left extends BuilderState, Right extends BuilderState> = {
58
+ export declare function builder<const BuildersToMerge extends Builders>(...buildersToMerge: BuildersToMerge): Builder<MergedPartsState<BuildersToMerge>>;
59
+ type MergedPartsState<Parts extends ReadonlyArray<BuilderGeneric>> = Parts extends readonly [
60
+ infer Head extends BuilderGeneric,
61
+ ...infer Tail extends ReadonlyArray<BuilderGeneric>
62
+ ] ? MergedStates<BuilderStateOf<Head>, MergedPartsState<Tail>> : BuilderStateEmpty;
63
+ type MergedStates<Left extends BuilderState, Right extends BuilderState> = {
58
64
  model: Left['model'] & Right['model'];
59
65
  options: [...Left['options'], ...Right['options']];
60
66
  components: [...Left['components'], ...Right['components']];
61
67
  collections: [...Left['collections'], ...Right['collections']];
68
+ expectations: [...Left['expectations'], ...Right['expectations']];
62
69
  };
63
70
  export {};
@@ -1,20 +1,22 @@
1
- import { bindOptions } from './parameter.js';
2
1
  import * as v from 'valibot';
2
+ import { BuilderExpectation } from './expectation.js';
3
3
  import { check } from '../check.js';
4
4
  import { BuilderCollection, resolveCollectionNames } from './collection/index.js';
5
5
  import { BuilderComponent, BuilderComponentGraph } from './component/index.js';
6
6
  import { BuilderOption, BuilderOptionGraph } from './option/index.js';
7
- import { BuilderParameter } from './parameter.js';
7
+ import { BuilderParameter, bindOptions, extractValues } from './parameter.js';
8
8
  export class Builder {
9
9
  options;
10
10
  components;
11
11
  collections;
12
+ expectations;
12
13
  #optionGraph = null;
13
14
  #componentGraph = null;
14
- constructor(options = [], collections = [], components = []) {
15
+ constructor(options = [], collections = [], components = [], expectations = []) {
15
16
  this.options = options;
16
17
  this.collections = collections;
17
18
  this.components = components;
19
+ this.expectations = expectations;
18
20
  }
19
21
  get optionGraph() {
20
22
  if (this.#optionGraph === null) {
@@ -33,16 +35,22 @@ export class Builder {
33
35
  return this.#componentGraph;
34
36
  }
35
37
  get option() {
38
+ const existingNames = new Set(this.options.map((entry) => entry.name));
36
39
  const addOption = (name, values) => {
40
+ check.falsy(existingNames.has(name), `Duplicate option name '${name}'! ❌`);
37
41
  const entry = new BuilderOption(name, values);
38
42
  return this.#next([...this.options, entry], this.collections, this.components);
39
43
  };
40
44
  const addConditionalOption = (gatePaths, name, config) => {
41
- const values = v.is(v.instance(BuilderParameter), config) ? config : config.values;
42
- const optionConfig = v.is(v.instance(BuilderParameter), config) ? null : config;
43
- const entry = new BuilderOption(name, values, gatePaths, optionConfig);
45
+ check.falsy(existingNames.has(name), `Duplicate option name '${name}'! ❌`);
46
+ if (v.is(v.instance(BuilderParameter), config)) {
47
+ const entry = new BuilderOption(name, config, gatePaths, null);
48
+ return this.#next([...this.options, entry], this.collections, this.components);
49
+ }
50
+ const entry = new BuilderOption(name, extractValues(config), gatePaths, config);
44
51
  return this.#next([...this.options, entry], this.collections, this.components);
45
52
  };
53
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- bridges loose implementation to strict overloaded type
46
54
  return Object.assign(addOption, { when: addConditionalOption });
47
55
  }
48
56
  get component() {
@@ -57,6 +65,7 @@ export class Builder {
57
65
  const entry = new BuilderComponent(name, paths, dependencies);
58
66
  return this.#next(this.options, this.collections, [...this.components, entry]);
59
67
  };
68
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- bridges loose implementation to strict overloaded type
60
69
  return Object.assign(addComponent, { when: addConditionalComponent });
61
70
  }
62
71
  get collection() {
@@ -76,21 +85,40 @@ export class Builder {
76
85
  const entry = new BuilderCollection(name, defaultEntry.builder, defaultEntry.min, defaultEntry.max, gatePaths, config);
77
86
  return this.#next(this.options, [...this.collections, entry], this.components);
78
87
  };
88
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- bridges loose implementation to strict overloaded type
79
89
  return Object.assign(addCollection, { when: addConditionalCollection });
80
90
  }
91
+ expect(...expectations) {
92
+ return new Builder(this.options, this.collections, this.components, [
93
+ ...this.expectations,
94
+ ...expectations
95
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- type narrowing cast, validated at merge time
96
+ ]);
97
+ }
81
98
  bind(bindings) {
82
99
  const boundOptions = bindOptions(this.options, bindings);
83
- return new Builder(boundOptions, this.collections, this.components);
100
+ return new Builder(boundOptions, this.collections, this.components, this.expectations);
84
101
  }
85
102
  #next(options, collections, components) {
86
- return new Builder(options, collections, components);
103
+ return new Builder(options, collections, components, this.expectations);
87
104
  }
88
105
  }
89
- export function builder(...parts) {
90
- const instances = parts.filter((part) => part instanceof Builder);
91
- const base = new Builder(instances.flatMap((instance) => instance.options), instances.flatMap((instance) => instance.collections), instances.flatMap((instance) => instance.components));
92
- const factories = parts.filter((part) => !(part instanceof Builder));
93
- return factories.reduce((accumulated, factory) => {
94
- return factory(accumulated);
95
- }, base);
106
+ export function builder(...buildersToMerge) {
107
+ const merged = new Builder(buildersToMerge.flatMap((builder) => builder.options), buildersToMerge.flatMap((builder) => builder.collections), buildersToMerge.flatMap((builder) => builder.components));
108
+ buildersToMerge
109
+ .flatMap((builder) => builder.expectations)
110
+ .forEach((expectation) => {
111
+ if (v.is(v.instance(BuilderExpectation), expectation)) {
112
+ if (expectation.kind === 'option') {
113
+ expectation.validate(merged.options);
114
+ }
115
+ else if (expectation.kind === 'component') {
116
+ expectation.validate(merged.components);
117
+ }
118
+ else if (expectation.kind === 'collection') {
119
+ expectation.validate(merged.collections);
120
+ }
121
+ }
122
+ });
123
+ return merged;
96
124
  }
@@ -1,22 +1,20 @@
1
- import type { BuilderModel, BuilderModels } from '../../config';
1
+ import type { BuilderModel, BuilderModels } from '../../model';
2
2
  import type { BuilderPaths } from '../../paths';
3
+ import type { BuilderGeneric, BuilderModelOf, BuilderStateOf } from '../builder';
3
4
  import type { BuilderCollectionWhenConfig } from './method';
4
- import type { BuilderGeneric, BuilderStateOf } from '../builder';
5
5
  export type BuilderCollectionConfig<CollectionRecipe = any, Min extends number = number, Max extends number = number> = {
6
6
  readonly builder: CollectionRecipe;
7
7
  readonly min: Min;
8
8
  readonly max: Max;
9
9
  };
10
10
  export type BuilderCollectionEntries = ReadonlyArray<BuilderCollection>;
11
- export type BuilderTupleOf<Item, Length extends number, Result extends ReadonlyArray<Item> = []> = Result['length'] extends Length ? Result : BuilderTupleOf<Item, Length, [...Result, Item]>;
12
- export type BuilderCollectionOf<Builder extends BuilderGeneric, Name extends string> = FindCollection<BuilderStateOf<Builder>['collections'], Name>;
13
- type FindCollection<Config extends BuilderCollectionEntries, Name extends string> = Config extends readonly [infer Head, ...infer Tail extends BuilderCollectionEntries] ? Extract<Head, BuilderCollection<Name, any, any, any>> extends never ? FindCollection<Tail, Name> : Extract<Head, BuilderCollection<Name, any, any, any>> : Extract<Config[number], BuilderCollection<Name, any, any, any>>;
14
- export type BuilderCollectionNamesOf<Builder extends BuilderGeneric> = ExtractCollectionNames<BuilderStateOf<Builder>['collections']>;
15
- type ExtractCollectionNames<Entries extends BuilderCollectionEntries> = Entries extends readonly [
16
- infer Head extends BuilderCollection,
17
- ...infer Tail extends BuilderCollectionEntries
18
- ] ? Head['name'] | ExtractCollectionNames<Tail> : never;
19
- export type BuilderCollectionModelOf<CollectionRecipe, Min extends number, Max extends number> = number extends Min ? ReadonlyArray<ExtractModel<CollectionRecipe>> : number extends Max ? ReadonlyArray<ExtractModel<CollectionRecipe>> : Min extends Max ? BuilderTupleOf<ExtractModel<CollectionRecipe>, Min> : ReadonlyArray<ExtractModel<CollectionRecipe>>;
11
+ export type TupleOf<Item, Length extends number, Result extends ReadonlyArray<Item> = []> = Result['length'] extends Length ? Result : TupleOf<Item, Length, [...Result, Item]>;
12
+ export type CollectionShape<Item, Min extends number, Max extends number> = number extends Min ? ReadonlyArray<Item> : number extends Max ? ReadonlyArray<Item> : Min extends Max ? TupleOf<Item, Min> : ReadonlyArray<Item>;
13
+ export type BuilderCollectionOf<Builder extends BuilderGeneric, Name extends string> = CollectionOf<BuilderStateOf<Builder>['collections'], Name>;
14
+ export type BuilderCollectionNamesOf<Builder extends BuilderGeneric | null> = [Builder] extends [
15
+ BuilderGeneric
16
+ ] ? CollectionNamesOf<BuilderStateOf<Builder>['collections']> : never;
17
+ export type BuilderCollectionModelOf<CollectionRecipe extends BuilderGeneric, Min extends number, Max extends number> = CollectionShape<BuilderModelOf<CollectionRecipe>, Min, Max>;
20
18
  export declare class BuilderCollection<const Name extends string = string, const CollectionRecipe = any, const Min extends number = number, const Max extends number = number> implements BuilderCollectionConfig<CollectionRecipe, Min, Max> {
21
19
  readonly name: Name;
22
20
  readonly builder: CollectionRecipe;
@@ -29,5 +27,6 @@ export declare class BuilderCollection<const Name extends string = string, const
29
27
  }
30
28
  export declare function resolveCollectionNames(collections: BuilderCollectionEntries): Set<string>;
31
29
  export declare function resolveCollectionModels(model: BuilderModel, collectionName: string): BuilderModels;
32
- type ExtractModel<Input> = Input extends BuilderGeneric ? BuilderStateOf<Input>['model'] : unknown;
30
+ type CollectionOf<Config extends BuilderCollectionEntries, Name extends string> = Config extends readonly [infer Head, ...infer Tail extends BuilderCollectionEntries] ? Extract<Head, BuilderCollection<Name, any, any, any>> extends never ? CollectionOf<Tail, Name> : Extract<Head, BuilderCollection<Name, any, any, any>> : Extract<Config[number], BuilderCollection<Name, any, any, any>>;
31
+ type CollectionNamesOf<Entries extends BuilderCollectionEntries> = Entries[number]['name'];
33
32
  export {};
@@ -1,5 +1,5 @@
1
1
  import { check } from '../../check.js';
2
- import { readPath } from '../../paths.js';
2
+ import { resolve } from '../when/index.js';
3
3
  export class BuilderCollection {
4
4
  name;
5
5
  builder;
@@ -19,28 +19,10 @@ export class BuilderCollection {
19
19
  this.config = config;
20
20
  }
21
21
  resolve(model) {
22
- if (this.config === null) {
23
- return this;
24
- }
25
- if (!this.gatePaths.every((path) => !!readPath(model, path))) {
26
- return null;
27
- }
28
- switch (this.config.type) {
29
- case 'enable': {
30
- return this;
31
- }
32
- case 'match': {
33
- const matchPath = this.config.matchPath;
34
- const entry = this.config.selectMap[String(readPath(model, matchPath))];
35
- return entry ? new BuilderCollection(this.name, entry.builder, entry.min, entry.max) : null;
36
- }
37
- case 'unless': {
38
- const value = readPath(model, this.config.unlessPath);
39
- return !this.config.disabledValues.includes(value)
40
- ? this
41
- : null;
42
- }
43
- }
22
+ return resolve(this, model, (selectMap, matchValue) => {
23
+ const entry = selectMap[matchValue];
24
+ return entry ? new BuilderCollection(this.name, entry.builder, entry.min, entry.max) : null;
25
+ });
44
26
  }
45
27
  }
46
28
  export function resolveCollectionNames(collections) {
@@ -1,4 +1,4 @@
1
- export type { BuilderCollectionConfig, BuilderCollectionEntries, BuilderCollectionModelOf, BuilderCollectionNamesOf, BuilderCollectionOf, BuilderTupleOf } from './collection';
1
+ export type { BuilderCollectionConfig, BuilderCollectionEntries, BuilderCollectionModelOf, BuilderCollectionNamesOf, BuilderCollectionOf, TupleOf, CollectionShape } from './collection';
2
2
  export type { BuilderCollectionEnableConfig, BuilderCollectionMatchConfig, BuilderCollectionMethod, BuilderCollectionUnlessConfig, BuilderCollectionWhenConfig } from './method';
3
3
  export { BuilderCollection, resolveCollectionModels, resolveCollectionNames } from './collection.js';
4
4
  export { collection } from './method.js';
@@ -1,51 +1,30 @@
1
- import type { BuilderPrimitive } from '../../config';
2
- import type { BuilderPath, BuilderPaths, BuilderResolvePath, BuilderValidPath } from '../../paths';
3
- import type { BuilderStateMerge, BuilderGeneric, BuilderState } from '../builder';
4
- import type { Builder } from '../builder';
1
+ import type { BuilderPrimitive } from '../../model';
2
+ import type { BuilderPath, BuilderValidPaths } from '../../paths';
3
+ import type { BuilderGeneric, BuilderMerge, BuilderState } from '../builder';
4
+ import type { BuilderWhenEnableConfig, BuilderWhenMatchConfig, BuilderWhenUnlessConfig, WhenConfigConstrained, WhenNullability } from '../when/index';
5
5
  import type { BuilderCollection, BuilderCollectionConfig, BuilderCollectionModelOf } from './collection';
6
- export type BuilderCollectionEnableConfig<CollectionRecipe = any, Min extends number = number, Max extends number = number> = {
7
- readonly type: 'enable';
8
- readonly builder: CollectionRecipe;
9
- readonly min: Min;
10
- readonly max: Max;
11
- };
12
- export type BuilderCollectionMatchConfig<SelectMap extends Record<string, BuilderCollectionConfig | null> = Record<string, BuilderCollectionConfig | null>, MatchPath extends BuilderPath = BuilderPath> = {
13
- readonly type: 'match';
14
- readonly matchPath: MatchPath;
15
- readonly selectMap: SelectMap;
16
- };
17
- export type BuilderCollectionUnlessConfig<CollectionRecipe = any, Min extends number = number, Max extends number = number, UnlessPath extends BuilderPath = BuilderPath> = {
18
- readonly type: 'unless';
19
- readonly unlessPath: UnlessPath;
20
- readonly disabledValues: ReadonlyArray<BuilderPrimitive>;
21
- readonly builder: CollectionRecipe;
22
- readonly min: Min;
23
- readonly max: Max;
24
- };
6
+ export type BuilderCollectionEnableConfig<CollectionRecipe = any, Min extends number = number, Max extends number = number> = BuilderWhenEnableConfig<BuilderCollectionConfig<CollectionRecipe, Min, Max>>;
7
+ export type BuilderCollectionMatchConfig<SelectMap extends Record<string, BuilderCollectionConfig | null> = Record<string, BuilderCollectionConfig | null>, MatchPath extends BuilderPath = BuilderPath> = BuilderWhenMatchConfig<SelectMap, MatchPath>;
8
+ export type BuilderCollectionUnlessConfig<CollectionRecipe = any, Min extends number = number, Max extends number = number, UnlessPath extends BuilderPath = BuilderPath> = BuilderWhenUnlessConfig<BuilderCollectionConfig<CollectionRecipe, Min, Max>, UnlessPath>;
25
9
  export type BuilderCollectionWhenConfig = BuilderCollectionEnableConfig | BuilderCollectionMatchConfig | BuilderCollectionUnlessConfig;
26
- export declare const collection: {
27
- enable: <const CollectionRecipe extends BuilderGeneric, const Min extends number, const Max extends number>(builder: CollectionRecipe, min: Min, max: Max) => BuilderCollectionEnableConfig<CollectionRecipe, Min, Max>;
28
- match: <const MatchPath extends BuilderPath, const SelectMap extends Record<string, BuilderCollectionConfig | null>>(matchPath: MatchPath, selectMap: SelectMap) => BuilderCollectionMatchConfig<SelectMap, MatchPath>;
29
- unless: <const CollectionRecipe extends BuilderGeneric, const Min extends number, const Max extends number, const UnlessPath extends BuilderPath>(unlessPath: UnlessPath, disabledValues: ReadonlyArray<BuilderPrimitive>, builder: CollectionRecipe, min: Min, max: Max) => BuilderCollectionUnlessConfig<CollectionRecipe, Min, Max, UnlessPath>;
30
- };
31
- type CollectionWhenConfigModel<Config extends BuilderCollectionWhenConfig> = Config extends BuilderCollectionEnableConfig<infer BuilderInput, infer Min, infer Max> ? BuilderCollectionModelOf<BuilderInput, Min, Max> : Config extends BuilderCollectionUnlessConfig<infer BuilderInput, infer Min, infer Max> ? BuilderCollectionModelOf<BuilderInput, Min, Max> : Config extends BuilderCollectionMatchConfig<infer SelectMapType> ? BuilderCollectionModelOf<(NonNullable<SelectMapType[keyof SelectMapType]> & BuilderCollectionConfig)['builder'], (NonNullable<SelectMapType[keyof SelectMapType]> & BuilderCollectionConfig)['min'], (NonNullable<SelectMapType[keyof SelectMapType]> & BuilderCollectionConfig)['max']> : never;
32
- type CollectionWhenConfigResolver<Name extends string, Config extends BuilderCollectionWhenConfig> = Config extends BuilderCollectionEnableConfig<infer BuilderInput, infer Min, infer Max> ? BuilderCollection<Name, BuilderInput, Min, Max> : Config extends BuilderCollectionUnlessConfig<infer BuilderInput, infer Min, infer Max> ? BuilderCollection<Name, BuilderInput, Min, Max> : Config extends BuilderCollectionMatchConfig<infer SelectMapType> ? BuilderCollection<Name, (NonNullable<SelectMapType[keyof SelectMapType]> & BuilderCollectionConfig)['builder'], (NonNullable<SelectMapType[keyof SelectMapType]> & BuilderCollectionConfig)['min'], (NonNullable<SelectMapType[keyof SelectMapType]> & BuilderCollectionConfig)['max']> : never;
33
- type CollectionConfigNullable<Config extends BuilderCollectionWhenConfig> = Config extends BuilderCollectionUnlessConfig ? null : Config extends BuilderCollectionMatchConfig<infer SelectMapType> ? null extends SelectMapType[keyof SelectMapType] ? null : never : never;
34
- type CollectionGatePathsNullable<Model, GatePaths extends BuilderPaths> = GatePaths extends readonly [infer Head extends BuilderPath, ...infer Tail extends BuilderPaths] ? null extends BuilderResolvePath<Model, Head> ? null : CollectionGatePathsNullable<Model, Tail> : never;
35
- type CollectionWhenNullability<Model, GatePaths extends BuilderPaths, Config extends BuilderCollectionWhenConfig> = CollectionGatePathsNullable<Model, GatePaths> | CollectionConfigNullable<Config>;
36
- type CollectionWhenConfigConstrained<Model, Config extends BuilderCollectionWhenConfig> = Config extends BuilderCollectionMatchConfig ? Config & {
37
- readonly matchPath: Readonly<BuilderValidPath<Model>>;
38
- } : Config extends BuilderCollectionUnlessConfig ? Config & {
39
- readonly unlessPath: Readonly<BuilderValidPath<Model>>;
40
- } : Config;
41
10
  export type BuilderCollectionMethod<State extends BuilderState> = {
42
- <const Name extends string, const CollectionRecipe extends BuilderGeneric, const Min extends number, const Max extends number>(name: Name, collectionRecipe: CollectionRecipe, min?: Min, max?: Max): Builder<BuilderStateMerge<State, {
11
+ <const Name extends string, const CollectionRecipe extends BuilderGeneric, const Min extends number, const Max extends number>(name: Name, collectionRecipe: CollectionRecipe, min?: Min, max?: Max): BuilderMerge<State, {
43
12
  model: State['model'] & Record<Name, BuilderCollectionModelOf<CollectionRecipe, Min, Max>>;
44
13
  collections: [...State['collections'], BuilderCollection<Name, CollectionRecipe, Min, Max>];
45
- }>>;
46
- when: <const GatePaths extends ReadonlyArray<BuilderValidPath<State['model']>>, const Name extends string, const Config extends BuilderCollectionWhenConfig>(gatePaths: GatePaths, name: Name, config: Config & CollectionWhenConfigConstrained<State['model'], Config>) => Builder<BuilderStateMerge<State, {
47
- model: State['model'] & Record<Name, CollectionWhenConfigModel<Config> | CollectionWhenNullability<State['model'], GatePaths, Config>>;
14
+ }>;
15
+ when: <const GatePaths extends BuilderValidPaths<State['model']>, const Name extends string, const Config extends BuilderCollectionWhenConfig>(gatePaths: GatePaths, name: Name, config: Config & WhenConfigConstrained<State['model'], Config>) => BuilderMerge<State, {
16
+ model: State['model'] & Record<Name, CollectionWhenConfigModel<Config> | WhenNullability<State['model'], GatePaths, Config>>;
48
17
  collections: [...State['collections'], CollectionWhenConfigResolver<Name, Config>];
49
- }>>;
18
+ }>;
19
+ };
20
+ export declare const collection: {
21
+ enable: <const CollectionRecipe extends BuilderGeneric, const Min extends number, const Max extends number>(builder: CollectionRecipe, min: Min, max: Max) => BuilderCollectionEnableConfig<CollectionRecipe, Min, Max>;
22
+ match: <const MatchPath extends BuilderPath, const SelectMap extends Record<string, BuilderCollectionConfig | null>>(matchPath: MatchPath, selectMap: SelectMap) => BuilderCollectionMatchConfig<SelectMap, MatchPath>;
23
+ unless: <const CollectionRecipe extends BuilderGeneric, const Min extends number, const Max extends number, const UnlessPath extends BuilderPath>(unlessPath: UnlessPath, disabledValues: ReadonlyArray<BuilderPrimitive>, builder: CollectionRecipe, min: Min, max: Max) => BuilderCollectionUnlessConfig<CollectionRecipe, Min, Max, UnlessPath>;
50
24
  };
25
+ type SelectMapEntryOf<SelectMap> = NonNullable<SelectMap[keyof SelectMap]> & BuilderCollectionConfig;
26
+ type CollectionModelOfConfig<Config extends BuilderCollectionConfig> = BuilderCollectionModelOf<Config['builder'], Config['min'], Config['max']>;
27
+ type CollectionOfConfig<Name extends string, Config extends BuilderCollectionConfig> = BuilderCollection<Name, Config['builder'], Config['min'], Config['max']>;
28
+ type CollectionWhenConfigModel<Config extends BuilderCollectionWhenConfig> = Config extends BuilderCollectionEnableConfig<infer BuilderInput extends BuilderGeneric, infer Min extends number, infer Max extends number> ? BuilderCollectionModelOf<BuilderInput, Min, Max> : Config extends BuilderCollectionUnlessConfig<infer BuilderInput extends BuilderGeneric, infer Min extends number, infer Max extends number> ? BuilderCollectionModelOf<BuilderInput, Min, Max> : Config extends BuilderCollectionMatchConfig<infer SelectMapType> ? CollectionModelOfConfig<SelectMapEntryOf<SelectMapType>> : never;
29
+ type CollectionWhenConfigResolver<Name extends string, Config extends BuilderCollectionWhenConfig> = Config extends BuilderCollectionEnableConfig<infer BuilderInput, infer Min extends number, infer Max extends number> ? BuilderCollection<Name, BuilderInput, Min, Max> : Config extends BuilderCollectionUnlessConfig<infer BuilderInput, infer Min extends number, infer Max extends number> ? BuilderCollection<Name, BuilderInput, Min, Max> : Config extends BuilderCollectionMatchConfig<infer SelectMapType> ? CollectionOfConfig<Name, SelectMapEntryOf<SelectMapType>> : never;
51
30
  export {};
@@ -1,14 +1,9 @@
1
1
  import type { BuilderPaths } from '../../paths';
2
2
  export type BuilderComponentEntries = ReadonlyArray<BuilderComponent>;
3
- export type BuilderComponentMap = Record<string, BuilderComponent>;
4
- export type BuilderComponentNamesOf<Components extends BuilderComponentEntries> = Components extends readonly [
5
- ...infer Init extends BuilderComponentEntries,
6
- BuilderComponent<infer Name>
7
- ] ? Name | BuilderComponentNamesOf<Init> : never;
3
+ export type BuilderComponentNamesOf<Components extends BuilderComponentEntries> = Components[number]['name'];
8
4
  export declare class BuilderComponent<const Name extends string = string> {
9
5
  readonly name: Name;
10
6
  readonly paths: BuilderPaths;
11
7
  readonly dependencies: ReadonlyArray<string>;
12
8
  constructor(name: Name, paths: BuilderPaths, dependencies?: ReadonlyArray<string>);
13
- resolve(resolved: BuilderComponentMap): BuilderComponent<Name> | null;
14
9
  }
@@ -7,11 +7,4 @@ export class BuilderComponent {
7
7
  this.paths = paths;
8
8
  this.dependencies = dependencies;
9
9
  }
10
- resolve(resolved) {
11
- if (this.dependencies.length === 0) {
12
- return this;
13
- }
14
- const ready = this.dependencies.every((dependency) => !!resolved[dependency]);
15
- return ready ? this : null;
16
- }
17
10
  }
@@ -5,6 +5,5 @@ export declare class BuilderComponentGraph {
5
5
  #private;
6
6
  readonly paths: GraphPaths;
7
7
  constructor(paths?: GraphPaths);
8
- has(name: string): boolean;
9
8
  add(component: BuilderComponent, options: BuilderOptionGraph): BuilderComponentGraph;
10
9
  }
@@ -1,21 +1,21 @@
1
1
  import { check } from '../../check.js';
2
+ import { crossProduct } from '../graph.js';
2
3
  import { BuilderComponent } from './component.js';
3
- const EMPTY_MODEL = '{}';
4
4
  export class BuilderComponentGraph {
5
5
  paths;
6
6
  constructor(paths = []) {
7
7
  this.paths = paths;
8
8
  }
9
- has(name) {
10
- return this.paths.some((graphPath) => graphPath.name === name);
11
- }
12
9
  add(component, options) {
13
- check.falsy(this.has(component.name), `Duplicate component name '${component.name}'! ❌`);
14
- const keys = new Set(component.paths.map((path) => String(path[0])));
10
+ check.falsy(this.#has(component.name), `Duplicate component name '${component.name}'! ❌`);
11
+ const keys = new Set(component.paths.map(([first]) => String(first)));
15
12
  const models = this.#mergeModels(keys, options);
16
13
  const newPath = { name: component.name, keys, models };
17
14
  return new BuilderComponentGraph([...this.paths, newPath]);
18
15
  }
16
+ #has(name) {
17
+ return this.paths.some((graphPath) => graphPath.name === name);
18
+ }
19
19
  #mergeModels(keys, options) {
20
20
  const graphPaths = Array.from(keys)
21
21
  .map((key) => options.get(key))
@@ -27,7 +27,7 @@ export class BuilderComponentGraph {
27
27
  Array.from(graphPath.keys).every((key) => handledKeys.has(key));
28
28
  if (!isHandled) {
29
29
  const componentModels = this.#createModels(graphPath, keys);
30
- models = models.flatMap((model) => componentModels.map((pathModel) => ({ ...model, ...pathModel })));
30
+ models = crossProduct(models, componentModels);
31
31
  handledKeys.add(graphPath.name);
32
32
  graphPath.keys.forEach((key) => handledKeys.add(key));
33
33
  }
@@ -48,3 +48,4 @@ export class BuilderComponentGraph {
48
48
  return models;
49
49
  }
50
50
  }
51
+ const EMPTY_MODEL = '{}';
@@ -1,4 +1,4 @@
1
- export type { BuilderComponentEntries, BuilderComponentMap, BuilderComponentNamesOf } from './component';
1
+ export type { BuilderComponentEntries, BuilderComponentNamesOf } from './component';
2
2
  export type { BuilderComponentMethod } from './method';
3
3
  export { BuilderComponent } from './component.js';
4
4
  export { BuilderComponentGraph } from './graph.js';
@@ -1,13 +1,11 @@
1
- import type { BuilderValidPath } from '../../paths';
2
- import type { BuilderComponentNamesOf } from './component';
3
- import type { BuilderStateMerge, BuilderState } from '../builder';
4
- import type { Builder } from '../builder';
5
- import type { BuilderComponent } from './component';
1
+ import type { BuilderValidPaths } from '../../paths';
2
+ import type { BuilderMerge, BuilderState } from '../builder';
3
+ import type { BuilderComponent, BuilderComponentNamesOf } from './component';
6
4
  export type BuilderComponentMethod<State extends BuilderState> = {
7
- <const Name extends string>(name: Name, paths: ReadonlyArray<BuilderValidPath<State['model']>>): Builder<BuilderStateMerge<State, {
5
+ <const Name extends string>(name: Name, paths: BuilderValidPaths<State['model']>): BuilderMerge<State, {
8
6
  components: [...State['components'], BuilderComponent<Name>];
9
- }>>;
10
- when: <const Name extends string>(dependencies: ReadonlyArray<BuilderComponentNamesOf<State['components']>>, name: Name, paths: ReadonlyArray<BuilderValidPath<State['model']>>) => Builder<BuilderStateMerge<State, {
7
+ }>;
8
+ when: <const Name extends string>(dependencies: ReadonlyArray<BuilderComponentNamesOf<State['components']>>, name: Name, paths: BuilderValidPaths<State['model']>) => BuilderMerge<State, {
11
9
  components: [...State['components'], BuilderComponent<Name>];
12
- }>>;
10
+ }>;
13
11
  };
@@ -0,0 +1,45 @@
1
+ import type { BuilderGeneric, BuilderMerge, BuilderStateOf } from './builder';
2
+ import type { Prettify } from '../prettify';
3
+ import { BuilderCollection } from './collection/index.js';
4
+ import { BuilderComponent } from './component/index.js';
5
+ export type BuilderExpectationKind = 'option' | 'component' | 'collection';
6
+ export type BuilderExpectationEntries = ReadonlyArray<BuilderExpectation>;
7
+ export type BuilderExpectations = readonly [
8
+ BuilderExpectation,
9
+ ...ReadonlyArray<BuilderExpectation>
10
+ ];
11
+ export type BuilderModelAsserted<BuilderInput extends BuilderGeneric | null, Expectations extends BuilderExpectations, Resolved extends BuilderGeneric = [BuilderInput] extends [BuilderGeneric] ? BuilderInput : BuilderGeneric> = BuilderMerge<BuilderStateOf<Resolved>, {
12
+ model: ModelAssert<Resolved, Expectations>;
13
+ components: ComponentAssert<Resolved, Expectations>;
14
+ collections: CollectionAssert<Resolved, Expectations>;
15
+ }>;
16
+ export type ModelAssert<BuilderInput extends BuilderGeneric, Items extends BuilderExpectations, Current extends BuilderStateOf<BuilderInput> = BuilderStateOf<BuilderInput>, Asserted extends ExpectedModel<Items> = ExpectedModel<Items>> = unknown extends Current['model'] ? Prettify<Asserted> : Prettify<Current['model'] & Asserted>;
17
+ export type ComponentAssert<BuilderInput extends BuilderGeneric, Items extends BuilderExpectations, Current extends BuilderStateOf<BuilderInput> = BuilderStateOf<BuilderInput>, Asserted extends ExpectedComponents<Items> = ExpectedComponents<Items>> = Current['components'] extends [] ? ExpectedComponents<Items> : number extends Asserted['length'] ? Asserted : [...Current['components'], ...Asserted];
18
+ export type CollectionAssert<BuilderInput extends BuilderGeneric, Items extends BuilderExpectations, Current extends BuilderStateOf<BuilderInput> = BuilderStateOf<BuilderInput>, Asserted extends ExpectedCollections<Items> = ExpectedCollections<Items>> = Current['collections'] extends [] ? ExpectedCollections<Items> : number extends Asserted['length'] ? Asserted : [...Current['collections'], ...Asserted];
19
+ export declare class BuilderExpectation<Name extends string = string, Value = unknown, Kind extends BuilderExpectationKind = BuilderExpectationKind> {
20
+ readonly name: Name;
21
+ readonly kind: Kind;
22
+ constructor(name: Name, kind: Kind);
23
+ optional(): BuilderExpectation<Name, Value | null, Kind>;
24
+ validate(entries: ReadonlyArray<{
25
+ readonly name: string;
26
+ }>): void;
27
+ }
28
+ export declare const has: {
29
+ option: <const Name extends string>(name: Name) => BuilderExpectation<Name, string, "option">;
30
+ component: <const Name extends string>(name: Name) => BuilderExpectation<Name, never, "component">;
31
+ collection: <const Name extends string>(name: Name) => BuilderExpectation<Name, unknown, "collection">;
32
+ };
33
+ type ExpectedModel<Items extends ReadonlyArray<BuilderExpectation>> = Items extends readonly [
34
+ infer Head,
35
+ ...infer Tail extends ReadonlyArray<BuilderExpectation>
36
+ ] ? (Head extends BuilderExpectation<infer Name, infer Value, 'option'> ? Record<Name, Value> : unknown) & ExpectedModel<Tail> : unknown;
37
+ type ExpectedComponents<Items extends ReadonlyArray<BuilderExpectation>> = Items extends readonly [
38
+ infer Head,
39
+ ...infer Tail extends ReadonlyArray<BuilderExpectation>
40
+ ] ? Head extends BuilderExpectation<infer Name, any, 'component'> ? [BuilderComponent<Name>, ...ExpectedComponents<Tail>] : ExpectedComponents<Tail> : [];
41
+ type ExpectedCollections<Items extends ReadonlyArray<BuilderExpectation>> = Items extends readonly [
42
+ infer Head,
43
+ ...infer Tail extends ReadonlyArray<BuilderExpectation>
44
+ ] ? Head extends BuilderExpectation<infer Name, any, 'collection'> ? [BuilderCollection<Name>, ...ExpectedCollections<Tail>] : ExpectedCollections<Tail> : [];
45
+ export {};
@@ -1,3 +1,5 @@
1
+ import { BuilderCollection } from './collection/index.js';
2
+ import { BuilderComponent } from './component/index.js';
1
3
  import { check } from '../check.js';
2
4
  export class BuilderExpectation {
3
5
  name;
@@ -13,9 +15,8 @@ export class BuilderExpectation {
13
15
  check.truthy(entries.some((entry) => entry.name === this.name), `assert: no \`${this.kind}\` named '${this.name}' exists in the builder config! ❌`);
14
16
  }
15
17
  }
16
- export const option = {
17
- expect: (name) => new BuilderExpectation(name, 'option')
18
- };
19
- export const component = {
20
- expect: (name) => new BuilderExpectation(name, 'component')
18
+ export const has = {
19
+ option: (name) => new BuilderExpectation(name, 'option'),
20
+ component: (name) => new BuilderExpectation(name, 'component'),
21
+ collection: (name) => new BuilderExpectation(name, 'collection')
21
22
  };
@@ -1,4 +1,4 @@
1
- import type { BuilderModels } from '../config';
1
+ import type { BuilderModels } from '../model';
2
2
  export type GraphKeys = ReadonlySet<string>;
3
3
  export type GraphPath = {
4
4
  name: string;
@@ -6,3 +6,4 @@ export type GraphPath = {
6
6
  models: BuilderModels;
7
7
  };
8
8
  export type GraphPaths = ReadonlyArray<GraphPath>;
9
+ export declare function crossProduct(left: BuilderModels, right: BuilderModels): BuilderModels;
@@ -1 +1,3 @@
1
- export {};
1
+ export function crossProduct(left, right) {
2
+ return left.flatMap((leftModel) => right.map((rightModel) => ({ ...leftModel, ...rightModel })));
3
+ }
@@ -1,9 +1,12 @@
1
- export type { BuilderCollectionConfig, BuilderCollectionEnableConfig, BuilderCollectionEntries, BuilderCollectionMatchConfig, BuilderCollectionMethod, BuilderCollectionModelOf, BuilderCollectionNamesOf, BuilderCollectionOf, BuilderCollectionUnlessConfig, BuilderCollectionWhenConfig, BuilderTupleOf } from './collection/index';
2
- export type { BuilderComponentEntries, BuilderComponentMap, BuilderComponentMethod, BuilderComponentNamesOf } from './component/index';
3
- export type { BuilderOptionEnableConfig, BuilderOptionEntries, BuilderOptionGraphs, BuilderOptionMatchConfig, BuilderOptionMethod, BuilderOptionUnlessConfig, BuilderOptionValues, BuilderOptionValuesMap, BuilderOptionWhenConfig, BuilderSelectTypeGeneric, BuilderSelectTypeLabels, BuilderSelectTypeValues, BuilderToggleTypeGeneric, BuilderOptionValueSchema } from './option/index';
4
- export type { BuilderStateMerge, BuilderFactory, BuilderGeneric, BuilderModelOf, BuilderPart, BuilderParts, BuilderState, BuilderStateEmpty, BuilderStateOf, BuilderSelectMap, BuilderSelectMapGeneric } from './builder';
1
+ export type { BuilderCollectionConfig, BuilderCollectionEnableConfig, BuilderCollectionEntries, BuilderCollectionMatchConfig, BuilderCollectionMethod, BuilderCollectionModelOf, BuilderCollectionNamesOf, BuilderCollectionOf, BuilderCollectionUnlessConfig, BuilderCollectionWhenConfig } from './collection/index';
2
+ export type { BuilderComponentEntries, BuilderComponentMethod, BuilderComponentNamesOf } from './component/index';
3
+ export type { BuilderExpectationEntries, BuilderExpectations, BuilderModelAsserted } from './expectation';
4
+ export type { BuilderOptionEnableConfig, BuilderOptionEntries, BuilderOptionMatchConfig, BuilderOptionMethod, BuilderOptionUnlessConfig, BuilderOptionValues, BuilderOptionValuesMap, BuilderOptionWhenConfig, BuilderSelectTypeLabels, BuilderSelectTypeValues } from './option/index';
5
+ export type { BuilderWhenEnableConfig, BuilderWhenMatchConfig, BuilderWhenUnlessConfig } from './when/index';
6
+ export type { BuilderMerge, BuilderGeneric, BuilderModelOf, Builders, BuilderState, BuilderStateEmpty, BuilderStateOf } from './builder';
7
+ export { Builder, builder } from './builder.js';
5
8
  export { BuilderCollection, collection, resolveCollectionModels, resolveCollectionNames } from './collection/index.js';
6
9
  export { BuilderComponent, BuilderComponentGraph } from './component/index.js';
10
+ export { BuilderExpectation, has } from './expectation.js';
7
11
  export { BuilderOption, BuilderOptionGraph, select, BuilderSelectType, BuilderToggleType, toggleBoolean, toggleNumber, toggleString, enable, match, unless } from './option/index.js';
8
- export { Builder, builder } from './builder.js';
9
- export { BuilderParameter } from './parameter.js';
12
+ export { BuilderParameter, BuilderParameterSchema } from './parameter.js';
@@ -1,5 +1,6 @@
1
+ export { Builder, builder } from './builder.js';
1
2
  export { BuilderCollection, collection, resolveCollectionModels, resolveCollectionNames } from './collection/index.js';
2
3
  export { BuilderComponent, BuilderComponentGraph } from './component/index.js';
4
+ export { BuilderExpectation, has } from './expectation.js';
3
5
  export { BuilderOption, BuilderOptionGraph, select, BuilderSelectType, BuilderToggleType, toggleBoolean, toggleNumber, toggleString, enable, match, unless } from './option/index.js';
4
- export { Builder, builder } from './builder.js';
5
- export { BuilderParameter } from './parameter.js';
6
+ export { BuilderParameter, BuilderParameterSchema } from './parameter.js';