@builder-builder/builder 0.0.27 → 0.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bb.js +9 -10
- package/dist/client/client.d.ts +2 -1
- package/dist/client/client.js +4 -1
- package/dist/client/public.d.ts +2 -2
- package/dist/client/public.js +1 -1
- package/dist/client/schema.d.ts +126 -45
- package/dist/client/schema.js +6 -1
- package/dist/components/BuilderOption.svelte.d.ts +12 -12
- package/dist/components/BuilderOptionValueBoolean.svelte.d.ts +20 -0
- package/dist/components/BuilderOptionValueNumber.svelte.d.ts +21 -0
- package/dist/components/BuilderOptionValueSelect.svelte.d.ts +21 -0
- package/dist/components/BuilderOptionValueString.svelte.d.ts +21 -0
- package/dist/components/BuilderRender.svelte.d.ts +2 -2
- package/dist/components/index.d.ts +8 -8
- package/dist/components/index.js +4376 -4258
- package/dist/components/index.min.js +3 -0
- package/dist/entities/collection/collection.d.ts +191 -401
- package/dist/entities/collection/collection.js +7 -4
- package/dist/entities/collection/{when.d.ts → condition.d.ts} +4 -5
- package/dist/entities/collection/condition.js +2 -0
- package/dist/entities/collection/config.d.ts +62 -80
- package/dist/entities/collection/index.d.ts +4 -4
- package/dist/entities/collection/index.js +2 -2
- package/dist/entities/component/component.d.ts +71 -83
- package/dist/entities/component/component.js +4 -4
- package/dist/entities/component/condition.d.ts +10 -0
- package/dist/entities/component/{when.js → condition.js} +3 -9
- package/dist/entities/component/config.d.ts +33 -33
- package/dist/entities/component/config.js +18 -16
- package/dist/entities/component/detail.d.ts +61 -0
- package/dist/entities/component/detail.js +71 -0
- package/dist/entities/component/index.d.ts +6 -6
- package/dist/entities/component/index.js +3 -3
- package/dist/entities/{when.d.ts → condition.d.ts} +23 -36
- package/dist/entities/{when.js → condition.js} +20 -25
- package/dist/entities/expectation.d.ts +135 -3
- package/dist/entities/expectation.js +6 -2
- package/dist/entities/index.d.ts +9 -9
- package/dist/entities/index.js +4 -4
- package/dist/entities/kind.d.ts +4 -4
- package/dist/entities/kind.js +24 -25
- package/dist/entities/model/bind.d.ts +5 -5
- package/dist/entities/model/methods.d.ts +18 -27
- package/dist/entities/model/methods.js +4 -22
- package/dist/entities/model/model.d.ts +3 -1
- package/dist/entities/model/model.js +25 -27
- package/dist/entities/option/condition.d.ts +9 -0
- package/dist/entities/option/condition.js +2 -0
- package/dist/entities/option/config.d.ts +47 -72
- package/dist/entities/option/config.js +6 -6
- package/dist/entities/option/expectation.d.ts +6 -1
- package/dist/entities/option/expectation.js +2 -2
- package/dist/entities/option/index.d.ts +8 -8
- package/dist/entities/option/index.js +4 -4
- package/dist/entities/option/option.d.ts +179 -210
- package/dist/entities/option/option.js +4 -4
- package/dist/entities/option/select.d.ts +16 -43
- package/dist/entities/option/select.js +8 -31
- package/dist/entities/option/value.d.ts +73 -0
- package/dist/entities/option/value.js +99 -0
- package/dist/entities/paths.d.ts +2 -2
- package/dist/entities/pricing/expression.d.ts +16 -39
- package/dist/entities/pricing/expression.js +1 -16
- package/dist/entities/pricing/index.d.ts +1 -1
- package/dist/entities/pricing/rates.d.ts +1 -1
- package/dist/entities/references.d.ts +124 -84
- package/dist/entities/serialise.d.ts +175 -109
- package/dist/entities/serialise.js +32 -27
- package/dist/entities/ui/describe.d.ts +1 -1
- package/dist/entities/ui/input.d.ts +2 -2
- package/dist/entities/ui/page.d.ts +1 -1
- package/dist/entities/ui/pages.d.ts +2 -2
- package/dist/entities/validated.d.ts +3 -3
- package/dist/environment.d.ts +2 -2
- package/dist/errors/errors.d.ts +94 -58
- package/dist/errors/errors.js +41 -7
- package/dist/errors/exception.d.ts +3 -3
- package/dist/errors/index.d.ts +1 -1
- package/dist/errors/index.js +1 -1
- package/dist/errors/public.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/instance.d.ts +53 -9
- package/dist/instance.js +6 -2
- package/dist/mappers/dependencies.d.ts +3 -0
- package/dist/mappers/dependencies.js +45 -0
- package/dist/mappers/index.d.ts +2 -2
- package/dist/mappers/index.js +2 -1
- package/dist/mappers/instance.js +26 -21
- package/dist/mappers/price.js +6 -4
- package/dist/mappers/resolve.js +23 -22
- package/dist/mappers/variants/index.d.ts +1 -2
- package/dist/mappers/variants/index.js +1 -2
- package/dist/mappers/variants/option-graph.d.ts +1 -2
- package/dist/mappers/variants/option-graph.js +4 -18
- package/dist/mappers/variants/variants.d.ts +3 -6
- package/dist/mappers/variants/variants.js +34 -11
- package/dist/primitive.d.ts +3 -0
- package/dist/primitive.js +2 -0
- package/dist/public.d.ts +20 -20
- package/dist/public.js +17 -9
- package/dist/validate/builder.d.ts +2 -2
- package/dist/validate/builder.js +15 -15
- package/dist/validate/expectations.d.ts +2 -2
- package/dist/validate/expectations.js +23 -5
- package/dist/validate/instance.d.ts +2 -2
- package/dist/validate/instance.js +31 -13
- package/dist/validate/model.d.ts +4 -4
- package/dist/validate/model.js +57 -51
- package/dist/validate/paths.d.ts +2 -2
- package/dist/validate/paths.js +19 -14
- package/dist/validate/pricing.d.ts +4 -4
- package/dist/validate/pricing.js +31 -31
- package/dist/validate/resolve.d.ts +2 -2
- package/dist/validate/resolve.js +27 -31
- package/dist/validate/ui.d.ts +4 -4
- package/dist/validate/ui.js +38 -38
- package/dist/validate/variants.d.ts +3 -3
- package/dist/validate/variants.js +32 -31
- package/package.json +4 -2
- package/dist/components/BuilderOptionSelect.svelte.d.ts +0 -21
- package/dist/components/BuilderOptionToggleBoolean.svelte.d.ts +0 -20
- package/dist/components/BuilderOptionToggleNumber.svelte.d.ts +0 -21
- package/dist/components/BuilderOptionToggleString.svelte.d.ts +0 -21
- package/dist/entities/collection/when.js +0 -2
- package/dist/entities/component/field.d.ts +0 -59
- package/dist/entities/component/field.js +0 -52
- package/dist/entities/component/when.d.ts +0 -11
- package/dist/entities/option/toggle.d.ts +0 -45
- package/dist/entities/option/toggle.js +0 -66
- package/dist/entities/option/when.d.ts +0 -10
- package/dist/entities/option/when.js +0 -2
|
@@ -374,7 +374,7 @@ export declare const BuilderUIPageSerialisedSchema: v.SchemaWithPipe<readonly [v
|
|
|
374
374
|
tags?: readonly string[] | undefined;
|
|
375
375
|
}>]>;
|
|
376
376
|
export type BuilderUIPageSerialised = v.InferOutput<typeof BuilderUIPageSerialisedSchema>;
|
|
377
|
-
export declare const validateUIPage: (input: unknown, references?: import("..").BuilderReferences,
|
|
377
|
+
export declare const validateUIPage: (input: unknown, references?: import("..").BuilderReferences, issues?: import("../../errors").BuilderIssuesScope) => import("..").ValidationResult<{
|
|
378
378
|
readonly type: "page";
|
|
379
379
|
readonly label: string;
|
|
380
380
|
readonly inputs: readonly {
|
|
@@ -48,7 +48,7 @@ export declare const BuilderUIItemsSerialisedSchema: v.SchemaWithPipe<readonly [
|
|
|
48
48
|
type: "ref";
|
|
49
49
|
id: string;
|
|
50
50
|
}> | BuilderUIItemSerialised)[]>]>;
|
|
51
|
-
export declare const validateUIPages: (input: unknown, references?: import("..").BuilderReferences,
|
|
51
|
+
export declare const validateUIPages: (input: unknown, references?: import("..").BuilderReferences, issues?: import("../../errors").BuilderIssuesScope) => import("..").ValidationResult<{
|
|
52
52
|
readonly type: "pages";
|
|
53
53
|
readonly name: string;
|
|
54
54
|
readonly label: string;
|
|
@@ -121,7 +121,7 @@ export declare const validateUIPages: (input: unknown, references?: import("..")
|
|
|
121
121
|
})[];
|
|
122
122
|
readonly tags?: readonly string[] | undefined;
|
|
123
123
|
}>;
|
|
124
|
-
export declare const validateUIItems: (input: unknown, references?: import("..").BuilderReferences,
|
|
124
|
+
export declare const validateUIItems: (input: unknown, references?: import("..").BuilderReferences, issues?: import("../../errors").BuilderIssuesScope) => import("..").ValidationResult<readonly ({
|
|
125
125
|
readonly type: "page";
|
|
126
126
|
readonly label: string;
|
|
127
127
|
readonly inputs: readonly {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BuilderIssues } from '../errors/index';
|
|
2
2
|
import type { BuilderInstance, BuilderInstances, BuilderVariants } from '../instance';
|
|
3
3
|
import type { Prettify } from '../prettify';
|
|
4
4
|
import type { BuilderParameter, BuilderParameterSerialised, BuilderRef, BuilderRefSerialised } from '../references';
|
|
@@ -24,7 +24,7 @@ type ValidatedTuple<Input extends ReadonlyArray<unknown>> = Input extends readon
|
|
|
24
24
|
export type BuilderValidatedMap = {
|
|
25
25
|
readonly [Kind in BuilderEntityKind]: Prettify<Validated<v.InferOutput<(typeof entitiesMap)[Kind]['serialised']>>>;
|
|
26
26
|
};
|
|
27
|
-
export type ValidationResult<Entity> = readonly [Entity,
|
|
27
|
+
export type ValidationResult<Entity> = readonly [Entity, BuilderIssues, BuilderIssues];
|
|
28
28
|
export type BuilderValidated = BuilderValidatedMap['builder'];
|
|
29
29
|
export type BuilderModelValidated = BuilderValidatedMap['model'];
|
|
30
30
|
export type BuilderPricingValidated = BuilderValidatedMap['pricing'];
|
|
@@ -38,7 +38,7 @@ export type BuilderInstancesValidated = Prettify<Validated<BuilderInstances>>;
|
|
|
38
38
|
export type BuilderVariantsValidated = Prettify<Validated<BuilderVariants>>;
|
|
39
39
|
export type BuilderOptionValidated = Prettify<Validated<BuilderOptionSerialised>>;
|
|
40
40
|
export type BuilderOptionsValidated = Prettify<Validated<BuilderOptionsSerialised>>;
|
|
41
|
-
export type BuilderOptionConfigValidated = BuilderValidatedMap['
|
|
41
|
+
export type BuilderOptionConfigValidated = BuilderValidatedMap['value'];
|
|
42
42
|
export type BuilderComponentValidated = Prettify<Validated<BuilderComponentSerialised>>;
|
|
43
43
|
export type BuilderComponentsValidated = Prettify<Validated<BuilderComponentsSerialised>>;
|
|
44
44
|
export type BuilderComponentConfigValidated = BuilderValidatedMap['componentConfig'];
|
package/dist/environment.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BuilderIssues } from './errors/index';
|
|
2
2
|
import * as v from 'valibot';
|
|
3
3
|
export declare const BuilderEnvironmentSchema: v.PicklistSchema<["development", "staging", "production"], undefined>;
|
|
4
4
|
export type BuilderEnvironment = v.InferOutput<typeof BuilderEnvironmentSchema>;
|
|
5
|
-
export type BuilderEnvironmentResult<EntityType, Env extends BuilderEnvironment = 'production'> = Env extends 'development' ? readonly [EntityType,
|
|
5
|
+
export type BuilderEnvironmentResult<EntityType, Env extends BuilderEnvironment = 'production'> = Env extends 'development' ? readonly [EntityType, BuilderIssues, BuilderIssues] : readonly [EntityType, ReadonlyArray<never>, BuilderIssues];
|
package/dist/errors/errors.d.ts
CHANGED
|
@@ -1,253 +1,289 @@
|
|
|
1
1
|
import type { BuilderEntityKind } from '../entities/index';
|
|
2
2
|
import type { BuilderInstance } from '../instance';
|
|
3
|
-
export type
|
|
4
|
-
export declare class
|
|
3
|
+
export type BuilderIssueLocation = ReadonlyArray<string | number>;
|
|
4
|
+
export declare class BuilderIssuesScope {
|
|
5
5
|
#private;
|
|
6
6
|
constructor(root: unknown);
|
|
7
|
-
get errors():
|
|
7
|
+
get errors(): BuilderIssues;
|
|
8
|
+
get warnings(): BuilderIssues;
|
|
8
9
|
scope<Result>(part: string | number, fn: () => Result): Result;
|
|
9
10
|
entityInvalid(target: BuilderEntityKind): {
|
|
10
11
|
kind: "entity-invalid";
|
|
11
|
-
location:
|
|
12
|
+
location: BuilderIssueLocation;
|
|
12
13
|
root: unknown;
|
|
13
14
|
} & {
|
|
14
|
-
target: "string" | "number" | "boolean" | "
|
|
15
|
+
target: "string" | "number" | "boolean" | "value" | "builder" | "model" | "optionSelectMap" | "optionCondition" | "componentConfig" | "componentSelectMap" | "componentCondition" | "collectionConfig" | "collectionSelectMap" | "collectionCondition" | "ui" | "uiDescribe" | "uiItems" | "uiPage" | "uiPages" | "uiInput" | "pricing" | "pricingRates" | "expectations" | "paths" | "path";
|
|
15
16
|
};
|
|
16
17
|
entityEmptyLabel(): {
|
|
17
18
|
kind: "entity-empty-label";
|
|
18
|
-
location:
|
|
19
|
+
location: BuilderIssueLocation;
|
|
19
20
|
root: unknown;
|
|
20
21
|
} & object;
|
|
21
22
|
entityEmptyInputs(): {
|
|
22
23
|
kind: "entity-empty-inputs";
|
|
23
|
-
location:
|
|
24
|
+
location: BuilderIssueLocation;
|
|
24
25
|
root: unknown;
|
|
25
26
|
} & object;
|
|
26
27
|
entityEmptyName(): {
|
|
27
28
|
kind: "entity-empty-name";
|
|
28
|
-
location:
|
|
29
|
+
location: BuilderIssueLocation;
|
|
29
30
|
root: unknown;
|
|
30
31
|
} & object;
|
|
31
32
|
entityEmptyId(): {
|
|
32
33
|
kind: "entity-empty-id";
|
|
33
|
-
location:
|
|
34
|
+
location: BuilderIssueLocation;
|
|
34
35
|
root: unknown;
|
|
35
36
|
} & object;
|
|
36
37
|
entityInvalidCollectionBounds(): {
|
|
37
38
|
kind: "entity-invalid-collection-bounds";
|
|
38
|
-
location:
|
|
39
|
+
location: BuilderIssueLocation;
|
|
39
40
|
root: unknown;
|
|
40
41
|
} & object;
|
|
41
42
|
entityInvalidSelectDefault(): {
|
|
42
43
|
kind: "entity-invalid-select-default";
|
|
43
|
-
location:
|
|
44
|
+
location: BuilderIssueLocation;
|
|
44
45
|
root: unknown;
|
|
45
46
|
} & object;
|
|
46
47
|
entityInvalidSelectLabel(): {
|
|
47
48
|
kind: "entity-invalid-select-label";
|
|
48
|
-
location:
|
|
49
|
+
location: BuilderIssueLocation;
|
|
49
50
|
root: unknown;
|
|
50
51
|
} & object;
|
|
51
|
-
|
|
52
|
-
kind: "entity-invalid-
|
|
53
|
-
location:
|
|
52
|
+
entityInvalidValueDefault(): {
|
|
53
|
+
kind: "entity-invalid-value-default";
|
|
54
|
+
location: BuilderIssueLocation;
|
|
54
55
|
root: unknown;
|
|
55
56
|
} & object;
|
|
56
|
-
|
|
57
|
-
kind: "entity-duplicate-
|
|
58
|
-
location:
|
|
57
|
+
entityDuplicateDetail(): {
|
|
58
|
+
kind: "entity-duplicate-detail";
|
|
59
|
+
location: BuilderIssueLocation;
|
|
60
|
+
root: unknown;
|
|
61
|
+
} & object;
|
|
62
|
+
entityDuplicatePrice(): {
|
|
63
|
+
kind: "entity-duplicate-price";
|
|
64
|
+
location: BuilderIssueLocation;
|
|
65
|
+
root: unknown;
|
|
66
|
+
} & object;
|
|
67
|
+
entityEmptyDisabledValues(): {
|
|
68
|
+
kind: "entity-empty-disabled-values";
|
|
69
|
+
location: BuilderIssueLocation;
|
|
59
70
|
root: unknown;
|
|
60
71
|
} & object;
|
|
61
72
|
modelDuplicateOption(): {
|
|
62
73
|
kind: "model-duplicate-option";
|
|
63
|
-
location:
|
|
74
|
+
location: BuilderIssueLocation;
|
|
64
75
|
root: unknown;
|
|
65
76
|
} & object;
|
|
66
77
|
modelDuplicateComponent(): {
|
|
67
78
|
kind: "model-duplicate-component";
|
|
68
|
-
location:
|
|
79
|
+
location: BuilderIssueLocation;
|
|
69
80
|
root: unknown;
|
|
70
81
|
} & object;
|
|
71
82
|
modelDuplicateCollection(): {
|
|
72
83
|
kind: "model-duplicate-collection";
|
|
73
|
-
location:
|
|
84
|
+
location: BuilderIssueLocation;
|
|
74
85
|
root: unknown;
|
|
75
86
|
} & object;
|
|
76
87
|
modelOverriddenOption(): {
|
|
77
88
|
kind: "model-overridden-option";
|
|
78
|
-
location:
|
|
89
|
+
location: BuilderIssueLocation;
|
|
79
90
|
root: unknown;
|
|
80
91
|
} & object;
|
|
81
92
|
modelOverriddenComponent(): {
|
|
82
93
|
kind: "model-overridden-component";
|
|
83
|
-
location:
|
|
94
|
+
location: BuilderIssueLocation;
|
|
84
95
|
root: unknown;
|
|
85
96
|
} & object;
|
|
86
97
|
modelOverriddenCollection(): {
|
|
87
98
|
kind: "model-overridden-collection";
|
|
88
|
-
location:
|
|
99
|
+
location: BuilderIssueLocation;
|
|
89
100
|
root: unknown;
|
|
90
101
|
} & object;
|
|
91
102
|
modelUnmetExpectation(): {
|
|
92
103
|
kind: "model-unmet-expectation";
|
|
93
|
-
location:
|
|
104
|
+
location: BuilderIssueLocation;
|
|
105
|
+
root: unknown;
|
|
106
|
+
} & object;
|
|
107
|
+
modelInvalidExpectation(): {
|
|
108
|
+
kind: "model-invalid-expectation";
|
|
109
|
+
location: BuilderIssueLocation;
|
|
94
110
|
root: unknown;
|
|
95
111
|
} & object;
|
|
96
112
|
modelEmptyComponents(): {
|
|
97
113
|
kind: "model-empty-components";
|
|
98
|
-
location:
|
|
114
|
+
location: BuilderIssueLocation;
|
|
115
|
+
root: unknown;
|
|
116
|
+
} & object;
|
|
117
|
+
modelCircularDependency(): {
|
|
118
|
+
kind: "model-circular-dependency";
|
|
119
|
+
location: BuilderIssueLocation;
|
|
99
120
|
root: unknown;
|
|
100
121
|
} & object;
|
|
101
122
|
pathEmpty(): {
|
|
102
123
|
kind: "path-empty";
|
|
103
|
-
location:
|
|
124
|
+
location: BuilderIssueLocation;
|
|
104
125
|
root: unknown;
|
|
105
126
|
} & object;
|
|
106
127
|
pathInvalidSegment(): {
|
|
107
128
|
kind: "path-invalid-segment";
|
|
108
|
-
location:
|
|
129
|
+
location: BuilderIssueLocation;
|
|
109
130
|
root: unknown;
|
|
110
131
|
} & object;
|
|
111
132
|
pathInvalidIndex(max: number): {
|
|
112
133
|
kind: "path-invalid-index";
|
|
113
|
-
location:
|
|
134
|
+
location: BuilderIssueLocation;
|
|
114
135
|
root: unknown;
|
|
115
136
|
} & {
|
|
116
137
|
max: number;
|
|
117
138
|
};
|
|
118
139
|
pathTargetIsCollection(): {
|
|
119
140
|
kind: "path-target-is-collection";
|
|
120
|
-
location:
|
|
141
|
+
location: BuilderIssueLocation;
|
|
121
142
|
root: unknown;
|
|
122
143
|
} & object;
|
|
123
144
|
pathTargetIsComponent(): {
|
|
124
145
|
kind: "path-target-is-component";
|
|
125
|
-
location:
|
|
146
|
+
location: BuilderIssueLocation;
|
|
126
147
|
root: unknown;
|
|
127
148
|
} & object;
|
|
128
149
|
pathMissingOption(): {
|
|
129
150
|
kind: "path-missing-option";
|
|
130
|
-
location:
|
|
151
|
+
location: BuilderIssueLocation;
|
|
131
152
|
root: unknown;
|
|
132
153
|
} & object;
|
|
133
154
|
pathMissingCollection(): {
|
|
134
155
|
kind: "path-missing-collection";
|
|
135
|
-
location:
|
|
156
|
+
location: BuilderIssueLocation;
|
|
136
157
|
root: unknown;
|
|
137
158
|
} & object;
|
|
138
159
|
referenceMissing(): {
|
|
139
160
|
kind: "reference-missing";
|
|
140
|
-
location:
|
|
161
|
+
location: BuilderIssueLocation;
|
|
141
162
|
root: unknown;
|
|
142
163
|
} & object;
|
|
143
164
|
referenceCircular(): {
|
|
144
165
|
kind: "reference-circular";
|
|
145
|
-
location:
|
|
166
|
+
location: BuilderIssueLocation;
|
|
146
167
|
root: unknown;
|
|
147
168
|
} & object;
|
|
148
169
|
referenceUnboundParameter(): {
|
|
149
170
|
kind: "reference-unbound-parameter";
|
|
150
|
-
location:
|
|
171
|
+
location: BuilderIssueLocation;
|
|
151
172
|
root: unknown;
|
|
152
173
|
} & object;
|
|
153
174
|
referenceInvalid(): {
|
|
154
175
|
kind: "reference-invalid";
|
|
155
|
-
location:
|
|
176
|
+
location: BuilderIssueLocation;
|
|
156
177
|
root: unknown;
|
|
157
178
|
} & object;
|
|
158
179
|
instanceInvalidOption(): {
|
|
159
180
|
kind: "instance-invalid-option";
|
|
160
|
-
location:
|
|
181
|
+
location: BuilderIssueLocation;
|
|
161
182
|
root: unknown;
|
|
162
183
|
} & object;
|
|
163
184
|
instanceInvalidCollection(): {
|
|
164
185
|
kind: "instance-invalid-collection";
|
|
165
|
-
location:
|
|
186
|
+
location: BuilderIssueLocation;
|
|
187
|
+
root: unknown;
|
|
188
|
+
} & object;
|
|
189
|
+
instanceInvalidCollectionMin(): {
|
|
190
|
+
kind: "instance-invalid-collection-min";
|
|
191
|
+
location: BuilderIssueLocation;
|
|
192
|
+
root: unknown;
|
|
193
|
+
} & object;
|
|
194
|
+
instanceInvalidCollectionMax(): {
|
|
195
|
+
kind: "instance-invalid-collection-max";
|
|
196
|
+
location: BuilderIssueLocation;
|
|
197
|
+
root: unknown;
|
|
198
|
+
} & object;
|
|
199
|
+
instanceUnexpectedKey(): {
|
|
200
|
+
kind: "instance-unexpected-key";
|
|
201
|
+
location: BuilderIssueLocation;
|
|
166
202
|
root: unknown;
|
|
167
203
|
} & object;
|
|
168
204
|
variantsInvalid(): {
|
|
169
205
|
kind: "variants-invalid";
|
|
170
|
-
location:
|
|
206
|
+
location: BuilderIssueLocation;
|
|
171
207
|
root: unknown;
|
|
172
208
|
} & object;
|
|
173
209
|
variantsMissingComponent(): {
|
|
174
210
|
kind: "variants-missing-component";
|
|
175
|
-
location:
|
|
211
|
+
location: BuilderIssueLocation;
|
|
176
212
|
root: unknown;
|
|
177
213
|
} & object;
|
|
178
214
|
variantsUnexpectedComponent(): {
|
|
179
215
|
kind: "variants-unexpected-component";
|
|
180
|
-
location:
|
|
216
|
+
location: BuilderIssueLocation;
|
|
181
217
|
root: unknown;
|
|
182
218
|
} & object;
|
|
183
219
|
variantsMissingVariant(instance: BuilderInstance): {
|
|
184
220
|
kind: "variants-missing-variant";
|
|
185
|
-
location:
|
|
221
|
+
location: BuilderIssueLocation;
|
|
186
222
|
root: unknown;
|
|
187
223
|
} & {
|
|
188
224
|
instance: BuilderInstance;
|
|
189
225
|
};
|
|
190
226
|
variantsInvalidVariant(): {
|
|
191
227
|
kind: "variants-invalid-variant";
|
|
192
|
-
location:
|
|
228
|
+
location: BuilderIssueLocation;
|
|
193
229
|
root: unknown;
|
|
194
230
|
} & object;
|
|
195
231
|
variantsMissingDetail(): {
|
|
196
232
|
kind: "variants-missing-detail";
|
|
197
|
-
location:
|
|
233
|
+
location: BuilderIssueLocation;
|
|
198
234
|
root: unknown;
|
|
199
235
|
} & object;
|
|
200
236
|
variantsUnexpectedDetail(): {
|
|
201
237
|
kind: "variants-unexpected-detail";
|
|
202
|
-
location:
|
|
238
|
+
location: BuilderIssueLocation;
|
|
203
239
|
root: unknown;
|
|
204
240
|
} & object;
|
|
205
241
|
variantsInvalidDetail(): {
|
|
206
242
|
kind: "variants-invalid-detail";
|
|
207
|
-
location:
|
|
243
|
+
location: BuilderIssueLocation;
|
|
208
244
|
root: unknown;
|
|
209
245
|
} & object;
|
|
210
246
|
pricingInvalidScope(): {
|
|
211
247
|
kind: "pricing-invalid-scope";
|
|
212
|
-
location:
|
|
248
|
+
location: BuilderIssueLocation;
|
|
213
249
|
root: unknown;
|
|
214
250
|
} & object;
|
|
215
251
|
pricingNestedVariants(): {
|
|
216
252
|
kind: "pricing-nested-variants";
|
|
217
|
-
location:
|
|
253
|
+
location: BuilderIssueLocation;
|
|
218
254
|
root: unknown;
|
|
219
255
|
} & object;
|
|
220
256
|
pricingMalformedExpression(): {
|
|
221
257
|
kind: "pricing-malformed-expression";
|
|
222
|
-
location:
|
|
258
|
+
location: BuilderIssueLocation;
|
|
223
259
|
root: unknown;
|
|
224
260
|
} & object;
|
|
225
261
|
pricingInvalidRateValue(): {
|
|
226
262
|
kind: "pricing-invalid-rate-value";
|
|
227
|
-
location:
|
|
263
|
+
location: BuilderIssueLocation;
|
|
228
264
|
root: unknown;
|
|
229
265
|
} & object;
|
|
230
266
|
pricingEmptyRates(): {
|
|
231
267
|
kind: "pricing-empty-rates";
|
|
232
|
-
location:
|
|
268
|
+
location: BuilderIssueLocation;
|
|
233
269
|
root: unknown;
|
|
234
270
|
} & object;
|
|
235
271
|
pricingDivideByZero(): {
|
|
236
272
|
kind: "pricing-divide-by-zero";
|
|
237
|
-
location:
|
|
273
|
+
location: BuilderIssueLocation;
|
|
238
274
|
root: unknown;
|
|
239
275
|
} & object;
|
|
240
276
|
pricingMissingOption(): {
|
|
241
277
|
kind: "pricing-missing-option";
|
|
242
|
-
location:
|
|
278
|
+
location: BuilderIssueLocation;
|
|
243
279
|
root: unknown;
|
|
244
280
|
} & object;
|
|
245
281
|
pricingMissingRate(): {
|
|
246
282
|
kind: "pricing-missing-rate";
|
|
247
|
-
location:
|
|
283
|
+
location: BuilderIssueLocation;
|
|
248
284
|
root: unknown;
|
|
249
285
|
} & object;
|
|
250
286
|
}
|
|
251
|
-
export type
|
|
252
|
-
export type
|
|
253
|
-
export type
|
|
287
|
+
export type BuilderIssue = ReturnType<BuilderIssuesScope[Exclude<keyof BuilderIssuesScope, 'scope' | 'errors' | 'warnings'>]>;
|
|
288
|
+
export type BuilderIssueKind = BuilderIssue['kind'];
|
|
289
|
+
export type BuilderIssues = ReadonlyArray<BuilderIssue>;
|
package/dist/errors/errors.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export class
|
|
1
|
+
export class BuilderIssuesScope {
|
|
2
2
|
#errors = [];
|
|
3
|
+
#warnings = [];
|
|
3
4
|
#location = [];
|
|
4
5
|
#root;
|
|
5
6
|
constructor(root) {
|
|
@@ -8,6 +9,9 @@ export class BuilderErrorsScope {
|
|
|
8
9
|
get errors() {
|
|
9
10
|
return this.#errors;
|
|
10
11
|
}
|
|
12
|
+
get warnings() {
|
|
13
|
+
return this.#warnings;
|
|
14
|
+
}
|
|
11
15
|
scope(part, fn) {
|
|
12
16
|
this.#location = [...this.#location, part];
|
|
13
17
|
try {
|
|
@@ -41,11 +45,17 @@ export class BuilderErrorsScope {
|
|
|
41
45
|
entityInvalidSelectLabel() {
|
|
42
46
|
return this.#addError('entity-invalid-select-label');
|
|
43
47
|
}
|
|
44
|
-
|
|
45
|
-
return this.#addError('entity-invalid-
|
|
48
|
+
entityInvalidValueDefault() {
|
|
49
|
+
return this.#addError('entity-invalid-value-default');
|
|
50
|
+
}
|
|
51
|
+
entityDuplicateDetail() {
|
|
52
|
+
return this.#addError('entity-duplicate-detail');
|
|
53
|
+
}
|
|
54
|
+
entityDuplicatePrice() {
|
|
55
|
+
return this.#addError('entity-duplicate-price');
|
|
46
56
|
}
|
|
47
|
-
|
|
48
|
-
return this.#
|
|
57
|
+
entityEmptyDisabledValues() {
|
|
58
|
+
return this.#addWarning('entity-empty-disabled-values');
|
|
49
59
|
}
|
|
50
60
|
modelDuplicateOption() {
|
|
51
61
|
return this.#addError('model-duplicate-option');
|
|
@@ -68,9 +78,15 @@ export class BuilderErrorsScope {
|
|
|
68
78
|
modelUnmetExpectation() {
|
|
69
79
|
return this.#addError('model-unmet-expectation');
|
|
70
80
|
}
|
|
81
|
+
modelInvalidExpectation() {
|
|
82
|
+
return this.#addError('model-invalid-expectation');
|
|
83
|
+
}
|
|
71
84
|
modelEmptyComponents() {
|
|
72
85
|
return this.#addError('model-empty-components');
|
|
73
86
|
}
|
|
87
|
+
modelCircularDependency() {
|
|
88
|
+
return this.#addError('model-circular-dependency');
|
|
89
|
+
}
|
|
74
90
|
pathEmpty() {
|
|
75
91
|
return this.#addError('path-empty');
|
|
76
92
|
}
|
|
@@ -110,6 +126,15 @@ export class BuilderErrorsScope {
|
|
|
110
126
|
instanceInvalidCollection() {
|
|
111
127
|
return this.#addError('instance-invalid-collection');
|
|
112
128
|
}
|
|
129
|
+
instanceInvalidCollectionMin() {
|
|
130
|
+
return this.#addError('instance-invalid-collection-min');
|
|
131
|
+
}
|
|
132
|
+
instanceInvalidCollectionMax() {
|
|
133
|
+
return this.#addError('instance-invalid-collection-max');
|
|
134
|
+
}
|
|
135
|
+
instanceUnexpectedKey() {
|
|
136
|
+
return this.#addError('instance-unexpected-key');
|
|
137
|
+
}
|
|
113
138
|
variantsInvalid() {
|
|
114
139
|
return this.#addError('variants-invalid');
|
|
115
140
|
}
|
|
@@ -159,9 +184,18 @@ export class BuilderErrorsScope {
|
|
|
159
184
|
return this.#addError('pricing-missing-rate');
|
|
160
185
|
}
|
|
161
186
|
#addError(kind, extras) {
|
|
162
|
-
const error =
|
|
163
|
-
Object.defineProperty(error, 'root', { value: this.#root, enumerable: false });
|
|
187
|
+
const error = this.#issue(kind, extras);
|
|
164
188
|
this.#errors = [...this.#errors, error];
|
|
165
189
|
return error;
|
|
166
190
|
}
|
|
191
|
+
#addWarning(kind, extras) {
|
|
192
|
+
const warning = this.#issue(kind, extras);
|
|
193
|
+
this.#warnings = [...this.#warnings, warning];
|
|
194
|
+
return warning;
|
|
195
|
+
}
|
|
196
|
+
#issue(kind, extras) {
|
|
197
|
+
const issue = { kind, location: this.#location, ...extras };
|
|
198
|
+
Object.defineProperty(issue, 'root', { value: this.#root, enumerable: false });
|
|
199
|
+
return issue;
|
|
200
|
+
}
|
|
167
201
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BuilderIssues } from './errors';
|
|
2
2
|
import type * as v from 'valibot';
|
|
3
3
|
export type BuilderExceptionPayload = {
|
|
4
4
|
readonly category: 'validation';
|
|
5
|
-
readonly errors:
|
|
5
|
+
readonly errors: BuilderIssues;
|
|
6
6
|
} | {
|
|
7
7
|
readonly category: 'invariant';
|
|
8
8
|
readonly value: unknown;
|
|
@@ -20,5 +20,5 @@ export type BuilderExceptionPayload = {
|
|
|
20
20
|
export declare class BuilderException extends globalThis.Error {
|
|
21
21
|
readonly payload: BuilderExceptionPayload;
|
|
22
22
|
constructor(payload: BuilderExceptionPayload);
|
|
23
|
-
get errors():
|
|
23
|
+
get errors(): BuilderIssues;
|
|
24
24
|
}
|
package/dist/errors/index.d.ts
CHANGED
package/dist/errors/index.js
CHANGED
package/dist/errors/public.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type {
|
|
1
|
+
export type { BuilderIssue, BuilderIssueKind, BuilderIssueLocation, BuilderIssues } from './errors';
|
|
2
2
|
export { BuilderException } from './exception.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from './public.js';
|
|
2
|
-
export { BuilderCollectionConfigSchema, BuilderCollectionConfigSerialisedSchema, BuilderCollectionSchema, BuilderCollectionSelectMapSerialisedSchema, BuilderCollectionSerialisedSchema, BuilderCollectionsSerialisedSchema,
|
|
2
|
+
export { BuilderCollectionConfigSchema, BuilderCollectionConfigSerialisedSchema, BuilderCollectionSchema, BuilderCollectionSelectMapSerialisedSchema, BuilderCollectionSerialisedSchema, BuilderCollectionsSerialisedSchema, BuilderCollectionConditionSerialisedSchema, BuilderComponentConfigSchema, BuilderComponentConfigSerialisedSchema, BuilderComponentDetailSchema, BuilderComponentDetailSerialisedSchema, BuilderComponentDetailsSchema, BuilderComponentDetailsSerialisedSchema, BuilderComponentDetailKindSchema, BuilderComponentSchema, BuilderComponentSelectMapSerialisedSchema, BuilderComponentSerialisedSchema, BuilderComponentsSerialisedSchema, BuilderComponentConditionSerialisedSchema, BuilderDescriptionItemSchema, BuilderDescriptionSchema, BuilderEntityKindSchema, BuilderEntitySerialisedSchema, BuilderExpectationKindSchema, BuilderExpectationSchema, BuilderExpectationSerialisedSchema, BuilderExpectationsSchema, BuilderExpectationsSerialisedSchema, BuilderModelSchema, BuilderModelSerialisedSchema, BuilderOptionConfigSchema, BuilderOptionConfigSerialisedSchema, BuilderOptionSchema, BuilderOptionSelectMapSerialisedSchema, BuilderOptionSerialisedSchema, BuilderOptionsSerialisedSchema, BuilderOptionConditionSerialisedSchema, BuilderPathSchema, BuilderPathsSchema, BuilderReferenceSchema, BuilderReferencesSchema, BuilderSchema, BuilderSerialisedSchema, BuilderSelectConfigSchema, BuilderValueConfigSchema, BuilderValueConfigSerialisedSchema, BuilderUIDescribeSchema, BuilderUIDescribeSerialisedSchema, BuilderUIItemSerialisedSchema, BuilderUIItemsSerialisedSchema, BuilderUIPageSchema, BuilderUIPageSerialisedSchema, BuilderUIPagesSchema, BuilderUIPagesSerialisedSchema, BuilderUISchema, BuilderUISerialisedSchema, BuilderConditionConfigSchema, BuilderConditionMatchSchema, BuilderConditionUnlessSchema } from './entities/index.js';
|
|
3
3
|
export { BuilderEnvironmentSchema } from './environment.js';
|
|
4
4
|
export { BuilderComponentVariantsSchema, BuilderVariantsSchema } from './instance.js';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from './public.js';
|
|
2
|
-
export { BuilderCollectionConfigSchema, BuilderCollectionConfigSerialisedSchema, BuilderCollectionSchema, BuilderCollectionSelectMapSerialisedSchema, BuilderCollectionSerialisedSchema, BuilderCollectionsSerialisedSchema,
|
|
2
|
+
export { BuilderCollectionConfigSchema, BuilderCollectionConfigSerialisedSchema, BuilderCollectionSchema, BuilderCollectionSelectMapSerialisedSchema, BuilderCollectionSerialisedSchema, BuilderCollectionsSerialisedSchema, BuilderCollectionConditionSerialisedSchema, BuilderComponentConfigSchema, BuilderComponentConfigSerialisedSchema, BuilderComponentDetailSchema, BuilderComponentDetailSerialisedSchema, BuilderComponentDetailsSchema, BuilderComponentDetailsSerialisedSchema, BuilderComponentDetailKindSchema, BuilderComponentSchema, BuilderComponentSelectMapSerialisedSchema, BuilderComponentSerialisedSchema, BuilderComponentsSerialisedSchema, BuilderComponentConditionSerialisedSchema, BuilderDescriptionItemSchema, BuilderDescriptionSchema, BuilderEntityKindSchema, BuilderEntitySerialisedSchema, BuilderExpectationKindSchema, BuilderExpectationSchema, BuilderExpectationSerialisedSchema, BuilderExpectationsSchema, BuilderExpectationsSerialisedSchema, BuilderModelSchema, BuilderModelSerialisedSchema, BuilderOptionConfigSchema, BuilderOptionConfigSerialisedSchema, BuilderOptionSchema, BuilderOptionSelectMapSerialisedSchema, BuilderOptionSerialisedSchema, BuilderOptionsSerialisedSchema, BuilderOptionConditionSerialisedSchema, BuilderPathSchema, BuilderPathsSchema, BuilderReferenceSchema, BuilderReferencesSchema, BuilderSchema, BuilderSerialisedSchema, BuilderSelectConfigSchema, BuilderValueConfigSchema, BuilderValueConfigSerialisedSchema, BuilderUIDescribeSchema, BuilderUIDescribeSerialisedSchema, BuilderUIItemSerialisedSchema, BuilderUIItemsSerialisedSchema, BuilderUIPageSchema, BuilderUIPageSerialisedSchema, BuilderUIPagesSchema, BuilderUIPagesSerialisedSchema, BuilderUISchema, BuilderUISerialisedSchema, BuilderConditionConfigSchema, BuilderConditionMatchSchema, BuilderConditionUnlessSchema } from './entities/index.js';
|
|
3
3
|
export { BuilderEnvironmentSchema } from './environment.js';
|
|
4
4
|
export { BuilderComponentVariantsSchema, BuilderVariantsSchema } from './instance.js';
|