@builder-builder/builder 0.0.19 → 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/dist/bb.d.ts +5 -6
  2. package/dist/bb.js +7 -4
  3. package/dist/entities/builder/builder.d.ts +2 -4
  4. package/dist/entities/collection/config.d.ts +101 -0
  5. package/dist/entities/collection/config.js +1 -0
  6. package/dist/entities/collection/index.d.ts +2 -2
  7. package/dist/entities/collection/index.js +1 -1
  8. package/dist/entities/component/component.d.ts +3 -3
  9. package/dist/entities/component/component.js +4 -4
  10. package/dist/entities/component/config.d.ts +135 -0
  11. package/dist/entities/component/{details.js → config.js} +7 -6
  12. package/dist/entities/component/index.d.ts +2 -2
  13. package/dist/entities/component/index.js +1 -1
  14. package/dist/entities/component/when.d.ts +5 -5
  15. package/dist/entities/component/when.js +3 -3
  16. package/dist/entities/index.d.ts +8 -9
  17. package/dist/entities/index.js +3 -3
  18. package/dist/entities/kind.d.ts +1 -1
  19. package/dist/entities/model/index.d.ts +1 -1
  20. package/dist/entities/model/methods.d.ts +8 -8
  21. package/dist/entities/model/methods.js +2 -2
  22. package/dist/entities/model/models.d.ts +1 -1
  23. package/dist/entities/option/config.d.ts +109 -0
  24. package/dist/entities/option/config.js +15 -0
  25. package/dist/entities/option/index.d.ts +6 -6
  26. package/dist/entities/option/index.js +3 -3
  27. package/dist/entities/option/option.d.ts +3 -3
  28. package/dist/entities/option/option.js +4 -4
  29. package/dist/entities/option/select.d.ts +14 -14
  30. package/dist/entities/option/select.js +5 -5
  31. package/dist/entities/option/toggle.d.ts +10 -10
  32. package/dist/entities/option/toggle.js +7 -7
  33. package/dist/entities/option/when.d.ts +5 -5
  34. package/dist/entities/{refs.d.ts → references.d.ts} +2 -2
  35. package/dist/entities/serialise.d.ts +4 -4
  36. package/dist/entities/serialise.js +10 -10
  37. package/dist/entities/ui/input.d.ts +1 -2
  38. package/dist/entities/ui/ui.d.ts +1 -2
  39. package/dist/entities/ui/uis.d.ts +1 -1
  40. package/dist/entities/ui/uis.js +1 -1
  41. package/dist/entities/validated.d.ts +5 -5
  42. package/dist/environment.d.ts +1 -1
  43. package/dist/index.d.ts +11 -10
  44. package/dist/index.js +2 -2
  45. package/dist/mappers/index.d.ts +2 -4
  46. package/dist/mappers/index.js +1 -2
  47. package/dist/mappers/instance.d.ts +2 -2
  48. package/dist/mappers/instance.js +6 -6
  49. package/dist/mappers/order.d.ts +2 -2
  50. package/dist/mappers/order.js +4 -4
  51. package/dist/mappers/render/pages.d.ts +2 -2
  52. package/dist/mappers/render/render.d.ts +2 -2
  53. package/dist/mappers/render/render.js +11 -11
  54. package/dist/mappers/resolve.d.ts +11 -11
  55. package/dist/mappers/resolve.js +28 -28
  56. package/dist/mappers/variants/option-graph.d.ts +2 -2
  57. package/dist/private.d.ts +1 -1
  58. package/dist/private.js +1 -1
  59. package/dist/validate/builder.d.ts +2 -2
  60. package/dist/validate/index.d.ts +1 -0
  61. package/dist/validate/model.d.ts +2 -2
  62. package/dist/validate/model.js +1 -1
  63. package/dist/validate/pricing.d.ts +2 -2
  64. package/dist/validate/resolve.d.ts +2 -2
  65. package/dist/validate/ui.d.ts +2 -2
  66. package/dist/validate/ui.js +1 -1
  67. package/dist/validate/variants.js +2 -2
  68. package/package.json +1 -1
  69. package/dist/entities/component/details.d.ts +0 -66
  70. package/dist/entities/entry.d.ts +0 -4
  71. package/dist/entities/option/values.d.ts +0 -49
  72. package/dist/entities/option/values.js +0 -14
  73. package/dist/entities/refs.js +0 -1
  74. /package/dist/entities/{entry.js → references.js} +0 -0
@@ -1,8 +1,8 @@
1
- import type { BuilderModelSerialised, BuilderPricingSerialised, BuilderPricingValidated, BuilderRefEntities } from '../entities/index';
1
+ import type { BuilderModelSerialised, BuilderPricingSerialised, BuilderPricingValidated, BuilderReferences } from '../entities/index';
2
2
  import type { BuilderResolve } from './resolve';
3
3
  import type { ValidationResult } from './result';
4
4
  import { BuilderValidateErrors } from './errors.js';
5
5
  export type BuilderPricingValidationResult = ValidationResult<BuilderPricingValidated>;
6
- export declare function validatePricing(input: unknown, references?: BuilderRefEntities, errors?: BuilderValidateErrors): BuilderPricingValidationResult;
6
+ export declare function validatePricing(input: unknown, references?: BuilderReferences, errors?: BuilderValidateErrors): BuilderPricingValidationResult;
7
7
  export declare function validatePricingStructure(input: BuilderPricingSerialised, resolve: BuilderResolve, errors: BuilderValidateErrors): BuilderPricingSerialised;
8
8
  export declare function checkPricingExpectations(model: BuilderModelSerialised, pricing: BuilderPricingSerialised, errors: BuilderValidateErrors): void;
@@ -1,4 +1,4 @@
1
- import type { BuilderBindings, BuilderRefEntities } from '../entities/index';
1
+ import type { BuilderBindings, BuilderReferences } from '../entities/index';
2
2
  import type { BuilderValidateErrors } from './errors';
3
3
  export type BuilderResolve = (value: unknown) => unknown;
4
- export declare function resolver(errors: BuilderValidateErrors, references?: BuilderRefEntities, bindings?: BuilderBindings): BuilderResolve;
4
+ export declare function resolver(errors: BuilderValidateErrors, references?: BuilderReferences, bindings?: BuilderBindings): BuilderResolve;
@@ -1,8 +1,8 @@
1
- import type { BuilderModelSerialised, BuilderRefEntities, BuilderUISerialised, BuilderUIValidated } from '../entities/index';
1
+ import type { BuilderModelSerialised, BuilderReferences, BuilderUISerialised, BuilderUIValidated } from '../entities/index';
2
2
  import type { BuilderResolve } from './resolve';
3
3
  import type { ValidationResult } from './result';
4
4
  import { BuilderValidateErrors } from './errors.js';
5
5
  export type BuilderUIValidationResult = ValidationResult<BuilderUIValidated>;
6
- export declare function validateUI(input: unknown, references?: BuilderRefEntities, errors?: BuilderValidateErrors): BuilderUIValidationResult;
6
+ export declare function validateUI(input: unknown, references?: BuilderReferences, errors?: BuilderValidateErrors): BuilderUIValidationResult;
7
7
  export declare function validateUIStructure(ui: BuilderUISerialised, resolve: BuilderResolve, errors: BuilderValidateErrors): BuilderUIValidated;
8
8
  export declare function checkUIExpectations(mergedModel: BuilderModelSerialised, ui: BuilderUIValidated, errors: BuilderValidateErrors): void;
@@ -1,8 +1,8 @@
1
1
  import { check } from '../check.js';
2
2
  import { BuilderModelSerialisedSchema, BuilderUIInputMetadataSchema, BuilderUISerialisedSchema, modelsMerge, serialise, uis } from '../entities/index.js';
3
+ import { resolveCollections } from '../mappers/index.js';
3
4
  import { validate } from './brand.js';
4
5
  import { BuilderValidateErrors } from './errors.js';
5
- import { resolveCollections } from '../mappers/index.js';
6
6
  import { checkExpectations } from './expectations.js';
7
7
  import { checkPath } from './paths.js';
8
8
  import { resolver } from './resolve.js';
@@ -1,5 +1,5 @@
1
1
  import { check } from '../check.js';
2
- import { BuilderComponentDetailsSerialisedSchema, detailValueSchema } from '../entities/index.js';
2
+ import { BuilderComponentConfigSerialisedSchema, detailValueSchema } from '../entities/index.js';
3
3
  import { BuilderComponentVariantsSchema } from '../instance.js';
4
4
  import { createVariants } from '../mappers/index.js';
5
5
  import { validate } from './brand.js';
@@ -99,7 +99,7 @@ export function validateVariants(model, input, options = {}, errors = new Builde
99
99
  }
100
100
  function variantDetails(component, variantInstance) {
101
101
  const { payload } = component;
102
- if (check.is(BuilderComponentDetailsSerialisedSchema, payload)) {
102
+ if (check.is(BuilderComponentConfigSerialisedSchema, payload)) {
103
103
  return payload;
104
104
  }
105
105
  if (payload.type === 'match') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder-builder/builder",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,66 +0,0 @@
1
- import type { Paramable } from '../../references';
2
- import type { BuilderTags } from '../tags';
3
- import type { BuilderComponentFields } from './field';
4
- import * as v from 'valibot';
5
- export declare class BuilderComponentDetails<const Fields extends Paramable<BuilderComponentFields> = Paramable<BuilderComponentFields>> {
6
- readonly type: 'component-details';
7
- readonly fields: Fields;
8
- readonly tags?: BuilderTags;
9
- constructor(fields: Fields, tags?: BuilderTags);
10
- tag(...tags: Array<string>): BuilderComponentDetails<Fields>;
11
- }
12
- export declare const BuilderComponentDetailsSchema: v.InstanceSchema<typeof BuilderComponentDetails, undefined>;
13
- export declare const BuilderComponentDetailsSerialisedSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
14
- readonly fields: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
15
- readonly type: v.LiteralSchema<"parameter", undefined>;
16
- readonly id: v.StringSchema<undefined>;
17
- readonly name: v.StringSchema<undefined>;
18
- }, undefined>, v.ReadonlyAction<{
19
- type: "parameter";
20
- id: string;
21
- name: string;
22
- }>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
23
- readonly type: v.LiteralSchema<"ref", undefined>;
24
- readonly id: v.StringSchema<undefined>;
25
- }, undefined>, v.ReadonlyAction<{
26
- type: "ref";
27
- id: string;
28
- }>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
29
- readonly type: v.LiteralSchema<"component-field", undefined>;
30
- readonly name: v.StringSchema<undefined>;
31
- readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
32
- readonly isOptional: v.BooleanSchema<undefined>;
33
- readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
34
- }, undefined>, v.ReadonlyAction<{
35
- type: "component-field";
36
- name: string;
37
- valueType: "string" | "number" | "boolean";
38
- isOptional: boolean;
39
- tags?: readonly string[] | undefined;
40
- }>]>, undefined>, v.ReadonlyAction<Readonly<{
41
- type: "component-field";
42
- name: string;
43
- valueType: "string" | "number" | "boolean";
44
- isOptional: boolean;
45
- tags?: readonly string[] | undefined;
46
- }>[]>]>], undefined>;
47
- readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
48
- }, undefined>, v.ReadonlyAction<{
49
- fields: Readonly<{
50
- type: "parameter";
51
- id: string;
52
- name: string;
53
- }> | Readonly<{
54
- type: "ref";
55
- id: string;
56
- }> | readonly Readonly<{
57
- type: "component-field";
58
- name: string;
59
- valueType: "string" | "number" | "boolean";
60
- isOptional: boolean;
61
- tags?: readonly string[] | undefined;
62
- }>[];
63
- tags?: readonly string[] | undefined;
64
- }>]>;
65
- export type BuilderComponentDetailsSerialised = v.InferOutput<typeof BuilderComponentDetailsSerialisedSchema>;
66
- export declare function componentDetails<const Fields extends BuilderComponentFields>(...fields: Fields): BuilderComponentDetails<Fields>;
@@ -1,4 +0,0 @@
1
- import type { BuilderCollectionSerialised } from './collection/index';
2
- import type { BuilderComponentSerialised } from './component/index';
3
- import type { BuilderOptionSerialised } from './option/index';
4
- export type BuilderModelEntrySerialised = BuilderOptionSerialised | BuilderComponentSerialised | BuilderCollectionSerialised;
@@ -1,49 +0,0 @@
1
- import * as v from 'valibot';
2
- export declare const BuilderOptionValuesSchema: v.UnionSchema<[v.InstanceSchema<typeof import("./select.js").BuilderSelectType, undefined>, v.InstanceSchema<typeof import("./toggle.js").BuilderToggleType, undefined>], undefined>;
3
- export type BuilderOptionValues = v.InferOutput<typeof BuilderOptionValuesSchema>;
4
- export declare const BuilderOptionValuesSerialisedSchema: v.SchemaWithPipe<readonly [v.VariantSchema<"type", [v.SchemaWithPipe<readonly [v.ObjectSchema<{
5
- readonly type: v.LiteralSchema<"select", undefined>;
6
- readonly options: v.SchemaWithPipe<readonly [v.TupleWithRestSchema<[v.StringSchema<undefined>], v.StringSchema<undefined>, undefined>, v.ReadonlyAction<[string, ...string[]]>]>;
7
- readonly defaultValue: v.NullableSchema<v.StringSchema<undefined>, undefined>;
8
- readonly isOptional: v.BooleanSchema<undefined>;
9
- readonly optionLabels: v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>;
10
- readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
11
- }, undefined>, v.ReadonlyAction<{
12
- type: "select";
13
- readonly options: readonly [string, ...string[]];
14
- defaultValue: string | null;
15
- isOptional: boolean;
16
- optionLabels: {
17
- [x: string]: string;
18
- };
19
- tags?: readonly string[] | undefined;
20
- }>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
21
- readonly type: v.LiteralSchema<"toggle", undefined>;
22
- readonly valueType: v.PicklistSchema<["string", "boolean", "number"], undefined>;
23
- readonly defaultValue: v.NullableSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
24
- readonly isOptional: v.BooleanSchema<undefined>;
25
- readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
26
- }, undefined>, v.ReadonlyAction<{
27
- type: "toggle";
28
- valueType: "string" | "number" | "boolean";
29
- defaultValue: string | number | boolean | null;
30
- isOptional: boolean;
31
- tags?: readonly string[] | undefined;
32
- }>]>], undefined>, v.ReadonlyAction<Readonly<{
33
- type: "select";
34
- readonly options: readonly [string, ...string[]];
35
- defaultValue: string | null;
36
- isOptional: boolean;
37
- optionLabels: {
38
- [x: string]: string;
39
- };
40
- tags?: readonly string[] | undefined;
41
- }> | Readonly<{
42
- type: "toggle";
43
- valueType: "string" | "number" | "boolean";
44
- defaultValue: string | number | boolean | null;
45
- isOptional: boolean;
46
- tags?: readonly string[] | undefined;
47
- }>>]>;
48
- export type BuilderOptionValuesSerialised = v.InferOutput<typeof BuilderOptionValuesSerialisedSchema>;
49
- export declare function optionValueSchema(payload: BuilderOptionValuesSerialised): v.GenericSchema;
@@ -1,14 +0,0 @@
1
- import * as v from 'valibot';
2
- import { BuilderSelectTypeSchema, BuilderSelectTypeSerialisedSchema, selectValueSchema } from './select.js';
3
- import { BuilderToggleTypeSchema, BuilderToggleTypeSerialisedSchema, toggleValueSchema } from './toggle.js';
4
- export const BuilderOptionValuesSchema = v.union([
5
- BuilderSelectTypeSchema,
6
- BuilderToggleTypeSchema
7
- ]);
8
- export const BuilderOptionValuesSerialisedSchema = v.pipe(v.variant('type', [BuilderSelectTypeSerialisedSchema, BuilderToggleTypeSerialisedSchema]), v.readonly());
9
- export function optionValueSchema(payload) {
10
- if (payload.type === 'select') {
11
- return selectValueSchema(payload.options, payload.isOptional);
12
- }
13
- return toggleValueSchema(payload.valueType, payload.isOptional);
14
- }
@@ -1 +0,0 @@
1
- export {};
File without changes