@builder-builder/builder 0.0.14 → 0.0.15

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 (61) hide show
  1. package/dist/bb.d.ts +3 -1
  2. package/dist/bb.js +6 -1
  3. package/dist/check.d.ts +2 -2
  4. package/dist/entities/builder/builder.d.ts +11 -1
  5. package/dist/entities/builder/builder.js +22 -6
  6. package/dist/entities/collection/collection.d.ts +7 -1
  7. package/dist/entities/collection/collection.js +9 -2
  8. package/dist/entities/collection/config.d.ts +6 -1
  9. package/dist/entities/collection/config.js +9 -2
  10. package/dist/entities/component/component.d.ts +41 -1
  11. package/dist/entities/component/component.js +9 -2
  12. package/dist/entities/component/details.d.ts +11 -2
  13. package/dist/entities/component/details.js +9 -2
  14. package/dist/entities/component/field.d.ts +10 -1
  15. package/dist/entities/component/field.js +13 -3
  16. package/dist/entities/index.d.ts +5 -1
  17. package/dist/entities/index.js +2 -0
  18. package/dist/entities/kind.d.ts +1 -1
  19. package/dist/entities/model/model.d.ts +5 -1
  20. package/dist/entities/model/model.js +10 -3
  21. package/dist/entities/model/models.js +9 -5
  22. package/dist/entities/option/option.d.ts +41 -1
  23. package/dist/entities/option/option.js +9 -2
  24. package/dist/entities/option/select.d.ts +7 -1
  25. package/dist/entities/option/select.js +17 -6
  26. package/dist/entities/option/toggle.d.ts +7 -1
  27. package/dist/entities/option/toggle.js +16 -4
  28. package/dist/entities/option/values.d.ts +6 -0
  29. package/dist/entities/pricing.d.ts +64 -0
  30. package/dist/entities/pricing.js +48 -0
  31. package/dist/entities/serialise.d.ts +78 -0
  32. package/dist/entities/serialise.js +30 -11
  33. package/dist/entities/tags.d.ts +3 -0
  34. package/dist/entities/tags.js +2 -0
  35. package/dist/entities/ui/describe.d.ts +10 -1
  36. package/dist/entities/ui/describe.js +9 -2
  37. package/dist/entities/ui/input.d.ts +10 -1
  38. package/dist/entities/ui/input.js +17 -5
  39. package/dist/entities/ui/page.d.ts +10 -1
  40. package/dist/entities/ui/page.js +9 -2
  41. package/dist/entities/ui/pages.d.ts +5 -1
  42. package/dist/entities/ui/pages.js +9 -2
  43. package/dist/entities/ui/ui.d.ts +6 -1
  44. package/dist/entities/ui/ui.js +27 -12
  45. package/dist/entities/validated.d.ts +3 -1
  46. package/dist/exception.d.ts +2 -2
  47. package/dist/index.d.ts +2 -2
  48. package/dist/instance.d.ts +9 -0
  49. package/dist/instance.js +3 -1
  50. package/dist/mappers/index.d.ts +3 -2
  51. package/dist/mappers/index.js +2 -1
  52. package/dist/mappers/pricing.d.ts +3 -0
  53. package/dist/mappers/pricing.js +101 -0
  54. package/dist/validate/builder.js +5 -1
  55. package/dist/validate/errors.d.ts +9 -1
  56. package/dist/validate/errors.js +7 -0
  57. package/dist/validate/index.d.ts +3 -1
  58. package/dist/validate/index.js +1 -0
  59. package/dist/validate/pricing.d.ts +6 -0
  60. package/dist/validate/pricing.js +71 -0
  61. package/package.json +1 -1
package/dist/bb.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { BuilderComponentVariantsValidated, BuilderInstanceValidated, BuilderModelValidated, BuilderRefEntities, BuilderUIValidated, BuilderValidated } from './entities/index';
1
+ import type { BuilderComponentVariantsValidated, BuilderInstanceValidated, BuilderModelValidated, BuilderPricingValidated, BuilderRefEntities, BuilderUIValidated, BuilderValidated } from './entities/index';
2
2
  import type { BuilderEnvironment, BuilderEnvironmentResult } from './environment';
3
3
  import type { BuilderOrder, BuilderRenderResult } from './mappers/index';
4
4
  import type { BuilderComponentVariants, BuilderInstance, BuilderInstanceInput } from './instance';
@@ -9,6 +9,7 @@ export type BB<Env extends BuilderEnvironment = 'production'> = {
9
9
  readonly validate: {
10
10
  builder(input: unknown): BuilderEnvironmentResult<BuilderValidated, Env>;
11
11
  model(input: unknown): BuilderEnvironmentResult<BuilderModelValidated, Env>;
12
+ pricing(input: unknown): BuilderEnvironmentResult<BuilderPricingValidated, Env>;
12
13
  ui(input: unknown): BuilderEnvironmentResult<BuilderUIValidated, Env>;
13
14
  instance(model: BuilderModelValidated, instance: BuilderInstance): BuilderEnvironmentResult<BuilderInstanceValidated, Env>;
14
15
  variants(model: BuilderModelValidated, input: unknown, options?: {
@@ -18,6 +19,7 @@ export type BB<Env extends BuilderEnvironment = 'production'> = {
18
19
  instance(entity: BuilderValidated | BuilderModelValidated, partial?: BuilderInstanceInput): BuilderInstance;
19
20
  render(builder: BuilderValidated, instance: BuilderInstanceValidated): BuilderRenderResult;
20
21
  order(model: BuilderModelValidated, instance: BuilderInstanceValidated, variants: BuilderComponentVariantsValidated): BuilderOrder;
22
+ pricing(builder: BuilderValidated, order: BuilderOrder): number;
21
23
  variants(entity: BuilderValidated | BuilderModelValidated): BuilderComponentVariants;
22
24
  };
23
25
  export declare const bb: typeof bbProd & {
package/dist/bb.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { BuilderException } from './exception.js';
2
- import { assertValidated, createInstance, createVariants, order, render, validateBuilder, validateInstance, validateModel, validateUI, validateVariants } from './mappers/index.js';
2
+ import { assertValidated, createInstance, createVariants, order, pricing, render, validateBuilder, validateInstance, validateModel, validatePricing, validateUI, validateVariants } from './mappers/index.js';
3
3
  export const bb = Object.assign(bbProd, {
4
4
  dev: bbDev
5
5
  });
@@ -14,6 +14,7 @@ function bbFactory(environment, references = []) {
14
14
  validate: {
15
15
  builder: (input) => throwInProd(validateBuilder(input, references)),
16
16
  model: (input) => throwInProd(validateModel(input, references)),
17
+ pricing: (input) => throwInProd(validatePricing(input)),
17
18
  ui: (input) => throwInProd(validateUI(input, references)),
18
19
  instance: (model, instance) => throwInProd(validateInstance(model, instance)),
19
20
  variants: (model, input, variantOptions) => throwInProd(validateVariants(model, input, variantOptions))
@@ -33,6 +34,10 @@ function bbFactory(environment, references = []) {
33
34
  assertValidated(variants);
34
35
  return order(model, instance, variants, references);
35
36
  },
37
+ pricing: (builder, orderResult) => {
38
+ assertValidated(builder);
39
+ return pricing(builder.model, builder.pricing, orderResult, references);
40
+ },
36
41
  variants: (entity) => {
37
42
  assertValidated(entity);
38
43
  return createVariants(entity);
package/dist/check.d.ts CHANGED
@@ -2,8 +2,8 @@ import * as v from 'valibot';
2
2
  declare class Check {
3
3
  truthy<Input>(input: Input, message?: `${string}! ❌`): asserts input is Exclude<Input, null | undefined | '' | 0 | false>;
4
4
  falsy(input: unknown, message?: `${string}! ❌`): void;
5
- is<const Schema extends v.BaseSchema<unknown, unknown, v.BaseIssue<unknown>>>(schema: Schema, input: unknown): input is v.InferInput<Schema>;
6
- assert<const Schema extends v.BaseSchema<unknown, unknown, v.BaseIssue<unknown>>>(schema: Schema, input: unknown, message?: `${string}! ❌`): asserts input is v.InferInput<Schema>;
5
+ is<const Schema extends v.BaseSchema<unknown, unknown, v.BaseIssue<unknown>>>(schema: Schema, input: unknown): input is v.InferOutput<Schema>;
6
+ assert<const Schema extends v.BaseSchema<unknown, unknown, v.BaseIssue<unknown>>>(schema: Schema, input: unknown, message?: `${string}! ❌`): asserts input is v.InferOutput<Schema>;
7
7
  }
8
8
  export declare const check: Check;
9
9
  export {};
@@ -1,21 +1,31 @@
1
1
  import type { BuilderModelBindings, BuilderModelBoundState } from '../model/bind';
2
2
  import type { BuilderModelState } from '../model/state';
3
+ import type { BuilderPricing } from '../pricing';
4
+ import type { BuilderTags } from '../tags';
5
+ import type { Paramable, ParamableSerialised } from '../../references';
3
6
  import type { BuilderBindings, BuilderBindingsSerialised } from './bind';
4
7
  import * as v from 'valibot';
5
8
  import { BuilderModel, BuilderModelSerialisedSchema } from '../model/index.js';
6
9
  import { BuilderUI, BuilderUISerialisedSchema } from '../ui/index.js';
7
10
  export declare class Builder<State extends BuilderModelState = BuilderModelState> {
11
+ #private;
8
12
  readonly type: 'builder';
9
13
  readonly model: BuilderModel<State>;
10
14
  readonly ui: BuilderUI;
11
15
  readonly bindings: BuilderBindings;
12
- constructor(model?: BuilderModel<State>, ui?: BuilderUI<import("..").BuilderModelGeneric>, bindings?: BuilderBindings);
16
+ readonly tags?: BuilderTags;
17
+ readonly pricing?: Paramable<BuilderPricing>;
18
+ constructor(model?: BuilderModel<State>, ui?: BuilderUI<import("..").BuilderModelGeneric>, bindings?: BuilderBindings, tags?: BuilderTags, pricing?: Paramable<BuilderPricing>);
13
19
  bind<const Bindings extends BuilderBindings>(extra: Bindings): Bindings extends BuilderModelBindings<State> ? Builder<BuilderModelBoundState<State, Bindings>> : Builder<State>;
20
+ tag(...tags: Array<string>): Builder<State>;
21
+ priced(pricing: Paramable<BuilderPricing>): Builder<State>;
14
22
  }
15
23
  export declare const BuilderSchema: v.InstanceSchema<typeof Builder, undefined>;
16
24
  export interface BuilderSerialised {
17
25
  readonly model: v.InferOutput<typeof BuilderModelSerialisedSchema>;
18
26
  readonly ui: v.InferOutput<typeof BuilderUISerialisedSchema>;
19
27
  readonly bindings: BuilderBindingsSerialised;
28
+ readonly tags?: BuilderTags;
29
+ readonly pricing?: ParamableSerialised<BuilderPricing>;
20
30
  }
21
31
  export declare const BuilderSerialisedSchema: v.GenericSchema<BuilderSerialised>;
@@ -1,27 +1,43 @@
1
1
  import * as v from 'valibot';
2
- import { BuilderRefSerialisedSchema } from '../../references.js';
2
+ import { BuilderRefSerialisedSchema, paramable } from '../../references.js';
3
3
  import { serialisable } from '../../serialisable.js';
4
4
  import { BuilderModel, BuilderModelSerialisedSchema } from '../model/index.js';
5
+ import { BuilderPricingSchema } from '../pricing.js';
6
+ import { BuilderTagsSchema } from '../tags.js';
5
7
  import { BuilderUI, BuilderUISerialisedSchema } from '../ui/index.js';
6
8
  export class Builder {
7
9
  model;
8
10
  ui;
9
11
  bindings;
10
- constructor(model = new BuilderModel(), ui = new BuilderUI([], [], []), bindings = {}) {
12
+ tags;
13
+ pricing;
14
+ constructor(model = new BuilderModel(), ui = new BuilderUI([], [], []), bindings = {}, tags, pricing) {
11
15
  this.model = model;
12
16
  this.ui = ui;
13
17
  this.bindings = bindings;
18
+ this.tags = tags;
19
+ this.pricing = pricing;
20
+ }
21
+ #next(patch) {
22
+ return new Builder(this.model, this.ui, patch.bindings ?? this.bindings, patch.tags ?? this.tags, patch.pricing ?? this.pricing);
14
23
  }
15
24
  bind(extra) {
16
- return new Builder(this.model, this.ui, {
17
- ...this.bindings,
18
- ...extra
25
+ return this.#next({
26
+ bindings: { ...this.bindings, ...extra }
19
27
  });
20
28
  }
29
+ tag(...tags) {
30
+ return this.#next({ tags });
31
+ }
32
+ priced(pricing) {
33
+ return this.#next({ pricing });
34
+ }
21
35
  }
22
36
  export const BuilderSchema = v.instance(Builder);
23
37
  export const BuilderSerialisedSchema = serialisable(v.object({
24
38
  model: BuilderModelSerialisedSchema,
25
39
  ui: BuilderUISerialisedSchema,
26
- bindings: v.pipe(v.record(v.string(), v.union([BuilderRefSerialisedSchema, v.unknown()])), v.readonly())
40
+ bindings: v.pipe(v.record(v.string(), v.union([BuilderRefSerialisedSchema, v.unknown()])), v.readonly()),
41
+ tags: v.optional(BuilderTagsSchema),
42
+ pricing: v.optional(paramable(BuilderPricingSchema))
27
43
  }));
@@ -1,6 +1,7 @@
1
1
  import type { BuilderPaths } from '../../paths';
2
2
  import type { Paramable, ParamableSerialised } from '../../references';
3
3
  import type { BuilderModelState } from '../model/index';
4
+ import type { BuilderTags } from '../tags';
4
5
  import type { BuilderWhenSerialised } from '../when';
5
6
  import type { BuilderCollectionConfig, BuilderCollectionConfigSerialised } from './config';
6
7
  import type { BuilderCollectionWhen } from './when';
@@ -11,7 +12,9 @@ export declare class BuilderCollection<const Name extends string = string, const
11
12
  readonly name: Name;
12
13
  readonly payload: Payload;
13
14
  readonly paths?: Paths;
14
- constructor(name: Name, payload: Payload, paths?: Paths);
15
+ readonly tags?: BuilderTags;
16
+ constructor(name: Name, payload: Payload, paths?: Paths, tags?: BuilderTags);
17
+ tag(...tags: Array<string>): BuilderCollection<Name, Payload, Paths>;
15
18
  }
16
19
  export declare const BuilderCollectionSchema: v.InstanceSchema<typeof BuilderCollection, undefined>;
17
20
  export type BuilderCollections = ReadonlyArray<BuilderCollection>;
@@ -40,6 +43,7 @@ export declare const BuilderCollectionWhenSerialisedSchema: v.GenericSchema<Buil
40
43
  type: "ref";
41
44
  id: string;
42
45
  }>;
46
+ tags?: readonly string[] | undefined;
43
47
  }>>>;
44
48
  export type BuilderCollectionWhenSerialised = BuilderWhenSerialised<BuilderCollectionConfigSerialised>;
45
49
  export declare const BuilderCollectionSelectMapSerialisedSchema: v.GenericSchema<import("..").BuilderMatchSelectMap<Readonly<{
@@ -71,11 +75,13 @@ export declare const BuilderCollectionSelectMapSerialisedSchema: v.GenericSchema
71
75
  type: "ref";
72
76
  id: string;
73
77
  }>;
78
+ tags?: readonly string[] | undefined;
74
79
  }>>>;
75
80
  export type BuilderCollectionSerialised = {
76
81
  readonly name: string;
77
82
  readonly paths?: ParamableSerialised<BuilderPaths>;
78
83
  readonly payload: ParamableSerialised<BuilderCollectionConfigSerialised | BuilderCollectionWhenSerialised>;
84
+ readonly tags?: BuilderTags;
79
85
  };
80
86
  export declare const BuilderCollectionSerialisedSchema: v.GenericSchema<BuilderCollectionSerialised>;
81
87
  export declare const BuilderCollectionsSerialisedSchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.GenericSchema<BuilderCollectionSerialised>, undefined>, v.ReadonlyAction<BuilderCollectionSerialised[]>]>;
@@ -2,16 +2,22 @@ import * as v from 'valibot';
2
2
  import { BuilderPathsSchema } from '../../paths.js';
3
3
  import { paramable } from '../../references.js';
4
4
  import { serialisable } from '../../serialisable.js';
5
+ import { BuilderTagsSchema } from '../tags.js';
5
6
  import { createSelectMapSerialisedSchema, createWhenSerialisedSchema } from '../when.js';
6
7
  import { BuilderCollectionConfigSerialisedSchema } from './config.js';
7
8
  export class BuilderCollection {
8
9
  name;
9
10
  payload;
10
11
  paths;
11
- constructor(name, payload, paths) {
12
+ tags;
13
+ constructor(name, payload, paths, tags) {
12
14
  this.name = name;
13
15
  this.payload = payload;
14
16
  this.paths = paths;
17
+ this.tags = tags;
18
+ }
19
+ tag(...tags) {
20
+ return new BuilderCollection(this.name, this.payload, this.paths, tags);
15
21
  }
16
22
  }
17
23
  export const BuilderCollectionSchema = v.instance(BuilderCollection);
@@ -20,6 +26,7 @@ export const BuilderCollectionSelectMapSerialisedSchema = createSelectMapSeriali
20
26
  export const BuilderCollectionSerialisedSchema = serialisable(v.object({
21
27
  name: v.string(),
22
28
  payload: paramable(v.union([BuilderCollectionConfigSerialisedSchema, BuilderCollectionWhenSerialisedSchema])),
23
- paths: v.optional(paramable(BuilderPathsSchema))
29
+ paths: v.optional(paramable(BuilderPathsSchema)),
30
+ tags: v.optional(BuilderTagsSchema)
24
31
  }));
25
32
  export const BuilderCollectionsSerialisedSchema = v.pipe(v.array(BuilderCollectionSerialisedSchema), v.readonly());
@@ -1,12 +1,15 @@
1
1
  import type { Paramable } from '../../references';
2
2
  import type { BuilderModelGeneric } from '../model/index';
3
+ import type { BuilderTags } from '../tags';
3
4
  import * as v from 'valibot';
4
5
  export declare class BuilderCollectionConfig<Model extends Paramable<BuilderModelGeneric> = Paramable<BuilderModelGeneric>, Min extends Paramable<number> = Paramable<number>, Max extends Paramable<number> = Paramable<number>> {
5
6
  readonly type: 'collection-config';
6
7
  readonly model: Model;
7
8
  readonly min: Min;
8
9
  readonly max: Max;
9
- constructor(model: Model, min: Min, max: Max);
10
+ readonly tags?: BuilderTags;
11
+ constructor(model: Model, min: Min, max: Max, tags?: BuilderTags);
12
+ tag(...tags: Array<string>): BuilderCollectionConfig<Model, Min, Max>;
10
13
  }
11
14
  export declare const BuilderCollectionConfigSchema: v.InstanceSchema<typeof BuilderCollectionConfig, undefined>;
12
15
  export declare const BuilderCollectionConfigSerialisedSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
@@ -55,6 +58,7 @@ export declare const BuilderCollectionConfigSerialisedSchema: v.SchemaWithPipe<r
55
58
  type: "ref";
56
59
  id: string;
57
60
  }>]>, v.NumberSchema<undefined>], undefined>;
61
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
58
62
  }, undefined>, v.ReadonlyAction<{
59
63
  model: Readonly<{
60
64
  type: "parameter";
@@ -80,6 +84,7 @@ export declare const BuilderCollectionConfigSerialisedSchema: v.SchemaWithPipe<r
80
84
  type: "ref";
81
85
  id: string;
82
86
  }>;
87
+ tags?: readonly string[] | undefined;
83
88
  }>]>;
84
89
  export type BuilderCollectionConfigSerialised = v.InferOutput<typeof BuilderCollectionConfigSerialisedSchema>;
85
90
  export declare function collectionConfig<Model extends Paramable<BuilderModelGeneric> = Paramable<BuilderModelGeneric>, Min extends Paramable<number> = Paramable<number>, Max extends Paramable<number> = Paramable<number>>(model: Model, min: Min, max: Max): BuilderCollectionConfig<Model, Min, Max>;
@@ -2,21 +2,28 @@ import * as v from 'valibot';
2
2
  import { paramable } from '../../references.js';
3
3
  import { serialisable } from '../../serialisable.js';
4
4
  import { BuilderModelSerialisedSchema } from '../model/index.js';
5
+ import { BuilderTagsSchema } from '../tags.js';
5
6
  export class BuilderCollectionConfig {
6
7
  model;
7
8
  min;
8
9
  max;
9
- constructor(model, min, max) {
10
+ tags;
11
+ constructor(model, min, max, tags) {
10
12
  this.model = model;
11
13
  this.min = min;
12
14
  this.max = max;
15
+ this.tags = tags;
16
+ }
17
+ tag(...tags) {
18
+ return new BuilderCollectionConfig(this.model, this.min, this.max, tags);
13
19
  }
14
20
  }
15
21
  export const BuilderCollectionConfigSchema = v.instance(BuilderCollectionConfig);
16
22
  export const BuilderCollectionConfigSerialisedSchema = serialisable(v.object({
17
23
  model: paramable(v.lazy(() => BuilderModelSerialisedSchema)),
18
24
  min: paramable(v.number()),
19
- max: paramable(v.number())
25
+ max: paramable(v.number()),
26
+ tags: v.optional(BuilderTagsSchema)
20
27
  }));
21
28
  export function collectionConfig(model, min, max) {
22
29
  return new BuilderCollectionConfig(model, min, max);
@@ -1,5 +1,6 @@
1
1
  import type { BuilderPaths } from '../../paths';
2
2
  import type { Paramable } from '../../references';
3
+ import type { BuilderTags } from '../tags';
3
4
  import type { BuilderWhenSerialised } from '../when';
4
5
  import type { BuilderComponentDetails, BuilderComponentDetailsSerialised } from './details';
5
6
  import type { BuilderComponentWhen } from './when';
@@ -10,7 +11,9 @@ export declare class BuilderComponent<const Name extends string = string, const
10
11
  readonly name: Name;
11
12
  readonly payload: Payload;
12
13
  readonly paths?: Paths;
13
- constructor(name: Name, payload: Payload, paths?: Paths);
14
+ readonly tags?: BuilderTags;
15
+ constructor(name: Name, payload: Payload, paths?: Paths, tags?: BuilderTags);
16
+ tag(...tags: Array<string>): BuilderComponent<Name, Payload, Paths>;
14
17
  }
15
18
  export declare const BuilderComponentSchema: v.InstanceSchema<typeof BuilderComponent, undefined>;
16
19
  export type BuilderComponents = ReadonlyArray<BuilderComponent>;
@@ -27,7 +30,9 @@ export declare const BuilderComponentWhenSerialisedSchema: v.GenericSchema<Build
27
30
  name: string;
28
31
  valueType: "string" | "number" | "boolean";
29
32
  isOptional: boolean;
33
+ tags?: readonly string[] | undefined;
30
34
  }>[];
35
+ tags?: readonly string[] | undefined;
31
36
  }>>>;
32
37
  export type BuilderComponentWhenSerialised = BuilderWhenSerialised<BuilderComponentDetailsSerialised>;
33
38
  export declare const BuilderComponentSelectMapSerialisedSchema: v.GenericSchema<import("..").BuilderMatchSelectMap<Readonly<{
@@ -47,7 +52,9 @@ export declare const BuilderComponentSelectMapSerialisedSchema: v.GenericSchema<
47
52
  name: string;
48
53
  valueType: "string" | "number" | "boolean";
49
54
  isOptional: boolean;
55
+ tags?: readonly string[] | undefined;
50
56
  }>[];
57
+ tags?: readonly string[] | undefined;
51
58
  }>>>;
52
59
  export declare const BuilderComponentSerialisedSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
53
60
  readonly name: v.StringSchema<undefined>;
@@ -85,17 +92,21 @@ export declare const BuilderComponentSerialisedSchema: v.SchemaWithPipe<readonly
85
92
  readonly name: v.StringSchema<undefined>;
86
93
  readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
87
94
  readonly isOptional: v.BooleanSchema<undefined>;
95
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
88
96
  }, undefined>, v.ReadonlyAction<{
89
97
  type: "component-field";
90
98
  name: string;
91
99
  valueType: "string" | "number" | "boolean";
92
100
  isOptional: boolean;
101
+ tags?: readonly string[] | undefined;
93
102
  }>]>, undefined>, v.ReadonlyAction<Readonly<{
94
103
  type: "component-field";
95
104
  name: string;
96
105
  valueType: "string" | "number" | "boolean";
97
106
  isOptional: boolean;
107
+ tags?: readonly string[] | undefined;
98
108
  }>[]>]>], undefined>;
109
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
99
110
  }, undefined>, v.ReadonlyAction<{
100
111
  fields: Readonly<{
101
112
  type: "parameter";
@@ -109,7 +120,9 @@ export declare const BuilderComponentSerialisedSchema: v.SchemaWithPipe<readonly
109
120
  name: string;
110
121
  valueType: "string" | "number" | "boolean";
111
122
  isOptional: boolean;
123
+ tags?: readonly string[] | undefined;
112
124
  }>[];
125
+ tags?: readonly string[] | undefined;
113
126
  }>]>, v.GenericSchema<BuilderWhenSerialised<Readonly<{
114
127
  fields: Readonly<{
115
128
  type: "parameter";
@@ -123,7 +136,9 @@ export declare const BuilderComponentSerialisedSchema: v.SchemaWithPipe<readonly
123
136
  name: string;
124
137
  valueType: "string" | "number" | "boolean";
125
138
  isOptional: boolean;
139
+ tags?: readonly string[] | undefined;
126
140
  }>[];
141
+ tags?: readonly string[] | undefined;
127
142
  }>>>], undefined>], undefined>;
128
143
  readonly paths: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
129
144
  readonly type: v.LiteralSchema<"parameter", undefined>;
@@ -140,6 +155,7 @@ export declare const BuilderComponentSerialisedSchema: v.SchemaWithPipe<readonly
140
155
  type: "ref";
141
156
  id: string;
142
157
  }>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, v.ReadonlyAction<(string | number)[]>]>, undefined>, v.ReadonlyAction<(readonly (string | number)[])[]>]>], undefined>, undefined>;
158
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
143
159
  }, undefined>, v.ReadonlyAction<{
144
160
  name: string;
145
161
  payload: Readonly<{
@@ -162,7 +178,9 @@ export declare const BuilderComponentSerialisedSchema: v.SchemaWithPipe<readonly
162
178
  name: string;
163
179
  valueType: "string" | "number" | "boolean";
164
180
  isOptional: boolean;
181
+ tags?: readonly string[] | undefined;
165
182
  }>[];
183
+ tags?: readonly string[] | undefined;
166
184
  }> | BuilderWhenSerialised<Readonly<{
167
185
  fields: Readonly<{
168
186
  type: "parameter";
@@ -176,7 +194,9 @@ export declare const BuilderComponentSerialisedSchema: v.SchemaWithPipe<readonly
176
194
  name: string;
177
195
  valueType: "string" | "number" | "boolean";
178
196
  isOptional: boolean;
197
+ tags?: readonly string[] | undefined;
179
198
  }>[];
199
+ tags?: readonly string[] | undefined;
180
200
  }>>;
181
201
  paths?: readonly (readonly (string | number)[])[] | Readonly<{
182
202
  type: "parameter";
@@ -186,6 +206,7 @@ export declare const BuilderComponentSerialisedSchema: v.SchemaWithPipe<readonly
186
206
  type: "ref";
187
207
  id: string;
188
208
  }> | undefined;
209
+ tags?: readonly string[] | undefined;
189
210
  }>]>;
190
211
  export type BuilderComponentSerialised = v.InferOutput<typeof BuilderComponentSerialisedSchema>;
191
212
  export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
@@ -224,17 +245,21 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
224
245
  readonly name: v.StringSchema<undefined>;
225
246
  readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
226
247
  readonly isOptional: v.BooleanSchema<undefined>;
248
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
227
249
  }, undefined>, v.ReadonlyAction<{
228
250
  type: "component-field";
229
251
  name: string;
230
252
  valueType: "string" | "number" | "boolean";
231
253
  isOptional: boolean;
254
+ tags?: readonly string[] | undefined;
232
255
  }>]>, undefined>, v.ReadonlyAction<Readonly<{
233
256
  type: "component-field";
234
257
  name: string;
235
258
  valueType: "string" | "number" | "boolean";
236
259
  isOptional: boolean;
260
+ tags?: readonly string[] | undefined;
237
261
  }>[]>]>], undefined>;
262
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
238
263
  }, undefined>, v.ReadonlyAction<{
239
264
  fields: Readonly<{
240
265
  type: "parameter";
@@ -248,7 +273,9 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
248
273
  name: string;
249
274
  valueType: "string" | "number" | "boolean";
250
275
  isOptional: boolean;
276
+ tags?: readonly string[] | undefined;
251
277
  }>[];
278
+ tags?: readonly string[] | undefined;
252
279
  }>]>, v.GenericSchema<BuilderWhenSerialised<Readonly<{
253
280
  fields: Readonly<{
254
281
  type: "parameter";
@@ -262,7 +289,9 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
262
289
  name: string;
263
290
  valueType: "string" | "number" | "boolean";
264
291
  isOptional: boolean;
292
+ tags?: readonly string[] | undefined;
265
293
  }>[];
294
+ tags?: readonly string[] | undefined;
266
295
  }>>>], undefined>], undefined>;
267
296
  readonly paths: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
268
297
  readonly type: v.LiteralSchema<"parameter", undefined>;
@@ -279,6 +308,7 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
279
308
  type: "ref";
280
309
  id: string;
281
310
  }>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, v.ReadonlyAction<(string | number)[]>]>, undefined>, v.ReadonlyAction<(readonly (string | number)[])[]>]>], undefined>, undefined>;
311
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
282
312
  }, undefined>, v.ReadonlyAction<{
283
313
  name: string;
284
314
  payload: Readonly<{
@@ -301,7 +331,9 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
301
331
  name: string;
302
332
  valueType: "string" | "number" | "boolean";
303
333
  isOptional: boolean;
334
+ tags?: readonly string[] | undefined;
304
335
  }>[];
336
+ tags?: readonly string[] | undefined;
305
337
  }> | BuilderWhenSerialised<Readonly<{
306
338
  fields: Readonly<{
307
339
  type: "parameter";
@@ -315,7 +347,9 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
315
347
  name: string;
316
348
  valueType: "string" | "number" | "boolean";
317
349
  isOptional: boolean;
350
+ tags?: readonly string[] | undefined;
318
351
  }>[];
352
+ tags?: readonly string[] | undefined;
319
353
  }>>;
320
354
  paths?: readonly (readonly (string | number)[])[] | Readonly<{
321
355
  type: "parameter";
@@ -325,6 +359,7 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
325
359
  type: "ref";
326
360
  id: string;
327
361
  }> | undefined;
362
+ tags?: readonly string[] | undefined;
328
363
  }>]>, undefined>, v.ReadonlyAction<Readonly<{
329
364
  name: string;
330
365
  payload: Readonly<{
@@ -347,7 +382,9 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
347
382
  name: string;
348
383
  valueType: "string" | "number" | "boolean";
349
384
  isOptional: boolean;
385
+ tags?: readonly string[] | undefined;
350
386
  }>[];
387
+ tags?: readonly string[] | undefined;
351
388
  }> | BuilderWhenSerialised<Readonly<{
352
389
  fields: Readonly<{
353
390
  type: "parameter";
@@ -361,7 +398,9 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
361
398
  name: string;
362
399
  valueType: "string" | "number" | "boolean";
363
400
  isOptional: boolean;
401
+ tags?: readonly string[] | undefined;
364
402
  }>[];
403
+ tags?: readonly string[] | undefined;
365
404
  }>>;
366
405
  paths?: readonly (readonly (string | number)[])[] | Readonly<{
367
406
  type: "parameter";
@@ -371,5 +410,6 @@ export declare const BuilderComponentsSerialisedSchema: v.SchemaWithPipe<readonl
371
410
  type: "ref";
372
411
  id: string;
373
412
  }> | undefined;
413
+ tags?: readonly string[] | undefined;
374
414
  }>[]>]>;
375
415
  export type BuilderComponentsSerialised = v.InferOutput<typeof BuilderComponentsSerialisedSchema>;
@@ -2,16 +2,22 @@ import * as v from 'valibot';
2
2
  import { BuilderPathsSchema } from '../../paths.js';
3
3
  import { paramable } from '../../references.js';
4
4
  import { serialisable } from '../../serialisable.js';
5
+ import { BuilderTagsSchema } from '../tags.js';
5
6
  import { createSelectMapSerialisedSchema, createWhenSerialisedSchema } from '../when.js';
6
7
  import { BuilderComponentDetailsSerialisedSchema } from './details.js';
7
8
  export class BuilderComponent {
8
9
  name;
9
10
  payload;
10
11
  paths;
11
- constructor(name, payload, paths) {
12
+ tags;
13
+ constructor(name, payload, paths, tags) {
12
14
  this.name = name;
13
15
  this.payload = payload;
14
16
  this.paths = paths;
17
+ this.tags = tags;
18
+ }
19
+ tag(...tags) {
20
+ return new BuilderComponent(this.name, this.payload, this.paths, tags);
15
21
  }
16
22
  }
17
23
  export const BuilderComponentSchema = v.instance(BuilderComponent);
@@ -20,6 +26,7 @@ export const BuilderComponentSelectMapSerialisedSchema = createSelectMapSerialis
20
26
  export const BuilderComponentSerialisedSchema = serialisable(v.object({
21
27
  name: v.string(),
22
28
  payload: paramable(v.union([BuilderComponentDetailsSerialisedSchema, BuilderComponentWhenSerialisedSchema])),
23
- paths: v.optional(paramable(BuilderPathsSchema))
29
+ paths: v.optional(paramable(BuilderPathsSchema)),
30
+ tags: v.optional(BuilderTagsSchema)
24
31
  }));
25
32
  export const BuilderComponentsSerialisedSchema = v.pipe(v.array(BuilderComponentSerialisedSchema), v.readonly());
@@ -1,10 +1,13 @@
1
1
  import type { Paramable } from '../../references';
2
+ import type { BuilderTags } from '../tags';
2
3
  import type { BuilderComponentFields } from './field';
3
4
  import * as v from 'valibot';
4
5
  export declare class BuilderComponentDetails<const Fields extends Paramable<BuilderComponentFields> = Paramable<BuilderComponentFields>> {
5
6
  readonly type: 'component-details';
6
- fields: Fields;
7
- constructor(fields: Fields);
7
+ readonly fields: Fields;
8
+ readonly tags?: BuilderTags;
9
+ constructor(fields: Fields, tags?: BuilderTags);
10
+ tag(...tags: Array<string>): BuilderComponentDetails<Fields>;
8
11
  }
9
12
  export declare const BuilderComponentDetailsSchema: v.InstanceSchema<typeof BuilderComponentDetails, undefined>;
10
13
  export declare const BuilderComponentDetailsSerialisedSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
@@ -27,17 +30,21 @@ export declare const BuilderComponentDetailsSerialisedSchema: v.SchemaWithPipe<r
27
30
  readonly name: v.StringSchema<undefined>;
28
31
  readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
29
32
  readonly isOptional: v.BooleanSchema<undefined>;
33
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
30
34
  }, undefined>, v.ReadonlyAction<{
31
35
  type: "component-field";
32
36
  name: string;
33
37
  valueType: "string" | "number" | "boolean";
34
38
  isOptional: boolean;
39
+ tags?: readonly string[] | undefined;
35
40
  }>]>, undefined>, v.ReadonlyAction<Readonly<{
36
41
  type: "component-field";
37
42
  name: string;
38
43
  valueType: "string" | "number" | "boolean";
39
44
  isOptional: boolean;
45
+ tags?: readonly string[] | undefined;
40
46
  }>[]>]>], undefined>;
47
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
41
48
  }, undefined>, v.ReadonlyAction<{
42
49
  fields: Readonly<{
43
50
  type: "parameter";
@@ -51,7 +58,9 @@ export declare const BuilderComponentDetailsSerialisedSchema: v.SchemaWithPipe<r
51
58
  name: string;
52
59
  valueType: "string" | "number" | "boolean";
53
60
  isOptional: boolean;
61
+ tags?: readonly string[] | undefined;
54
62
  }>[];
63
+ tags?: readonly string[] | undefined;
55
64
  }>]>;
56
65
  export type BuilderComponentDetailsSerialised = v.InferOutput<typeof BuilderComponentDetailsSerialisedSchema>;
57
66
  export declare function componentDetails<const Fields extends BuilderComponentFields>(...fields: Fields): BuilderComponentDetails<Fields>;
@@ -1,16 +1,23 @@
1
1
  import * as v from 'valibot';
2
2
  import { paramable } from '../../references.js';
3
3
  import { serialisable } from '../../serialisable.js';
4
+ import { BuilderTagsSchema } from '../tags.js';
4
5
  import { BuilderComponentFieldsSerialisedSchema } from './field.js';
5
6
  export class BuilderComponentDetails {
6
7
  fields;
7
- constructor(fields) {
8
+ tags;
9
+ constructor(fields, tags) {
8
10
  this.fields = fields;
11
+ this.tags = tags;
12
+ }
13
+ tag(...tags) {
14
+ return new BuilderComponentDetails(this.fields, tags);
9
15
  }
10
16
  }
11
17
  export const BuilderComponentDetailsSchema = v.instance(BuilderComponentDetails);
12
18
  export const BuilderComponentDetailsSerialisedSchema = serialisable(v.object({
13
- fields: paramable(BuilderComponentFieldsSerialisedSchema)
19
+ fields: paramable(BuilderComponentFieldsSerialisedSchema),
20
+ tags: v.optional(BuilderTagsSchema)
14
21
  }));
15
22
  export function componentDetails(...fields) {
16
23
  return new BuilderComponentDetails(fields);