@builder-builder/builder 0.0.27 → 0.0.28
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 +4 -4
- 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 +79 -18
- package/dist/client/schema.js +6 -1
- package/dist/components/BuilderRender.svelte.d.ts +2 -2
- package/dist/components/index.js +4377 -4303
- package/dist/components/index.min.js +3 -0
- package/dist/entities/collection/collection.d.ts +66 -66
- package/dist/entities/collection/config.d.ts +17 -17
- package/dist/entities/collection/when.d.ts +1 -1
- package/dist/entities/component/component.d.ts +64 -64
- 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 +2 -2
- package/dist/entities/component/index.js +1 -1
- package/dist/entities/component/when.d.ts +2 -2
- package/dist/entities/expectation.d.ts +1 -1
- package/dist/entities/index.d.ts +4 -4
- package/dist/entities/index.js +1 -1
- package/dist/entities/kind.d.ts +3 -3
- package/dist/entities/kind.js +20 -20
- package/dist/entities/model/methods.d.ts +1 -1
- package/dist/entities/option/config.d.ts +7 -7
- package/dist/entities/option/config.js +1 -1
- package/dist/entities/option/index.d.ts +4 -4
- package/dist/entities/option/index.js +2 -2
- package/dist/entities/option/option.d.ts +22 -22
- package/dist/entities/option/select.d.ts +1 -1
- package/dist/entities/option/toggle.d.ts +9 -9
- package/dist/entities/option/toggle.js +15 -10
- package/dist/entities/option/when.d.ts +1 -1
- 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 +24 -24
- package/dist/entities/serialise.d.ts +31 -32
- package/dist/entities/serialise.js +7 -7
- package/dist/entities/ui/describe.d.ts +1 -1
- package/dist/entities/ui/input.d.ts +1 -1
- package/dist/entities/ui/page.d.ts +1 -1
- package/dist/entities/ui/pages.d.ts +2 -2
- package/dist/entities/validated.d.ts +2 -2
- package/dist/entities/when.d.ts +5 -5
- package/dist/environment.d.ts +2 -2
- package/dist/errors/errors.d.ts +86 -55
- package/dist/errors/errors.js +36 -5
- 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 +44 -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/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 +3 -17
- 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 +8 -8
- package/dist/public.js +1 -1
- 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 +3 -3
- 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 +51 -42
- 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 +18 -18
- 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/entities/component/field.d.ts +0 -59
- package/dist/entities/component/field.js +0 -52
package/dist/errors/errors.d.ts
CHANGED
|
@@ -1,253 +1,284 @@
|
|
|
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
15
|
target: "string" | "number" | "boolean" | "builder" | "model" | "select" | "toggle" | "optionSelectMap" | "optionWhen" | "componentConfig" | "componentSelectMap" | "componentWhen" | "collectionConfig" | "collectionSelectMap" | "collectionWhen" | "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
|
entityInvalidToggleDefault(): {
|
|
52
53
|
kind: "entity-invalid-toggle-default";
|
|
53
|
-
location:
|
|
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;
|
|
94
105
|
root: unknown;
|
|
95
106
|
} & object;
|
|
96
107
|
modelEmptyComponents(): {
|
|
97
108
|
kind: "model-empty-components";
|
|
98
|
-
location:
|
|
109
|
+
location: BuilderIssueLocation;
|
|
110
|
+
root: unknown;
|
|
111
|
+
} & object;
|
|
112
|
+
modelCircularDependency(): {
|
|
113
|
+
kind: "model-circular-dependency";
|
|
114
|
+
location: BuilderIssueLocation;
|
|
99
115
|
root: unknown;
|
|
100
116
|
} & object;
|
|
101
117
|
pathEmpty(): {
|
|
102
118
|
kind: "path-empty";
|
|
103
|
-
location:
|
|
119
|
+
location: BuilderIssueLocation;
|
|
104
120
|
root: unknown;
|
|
105
121
|
} & object;
|
|
106
122
|
pathInvalidSegment(): {
|
|
107
123
|
kind: "path-invalid-segment";
|
|
108
|
-
location:
|
|
124
|
+
location: BuilderIssueLocation;
|
|
109
125
|
root: unknown;
|
|
110
126
|
} & object;
|
|
111
127
|
pathInvalidIndex(max: number): {
|
|
112
128
|
kind: "path-invalid-index";
|
|
113
|
-
location:
|
|
129
|
+
location: BuilderIssueLocation;
|
|
114
130
|
root: unknown;
|
|
115
131
|
} & {
|
|
116
132
|
max: number;
|
|
117
133
|
};
|
|
118
134
|
pathTargetIsCollection(): {
|
|
119
135
|
kind: "path-target-is-collection";
|
|
120
|
-
location:
|
|
136
|
+
location: BuilderIssueLocation;
|
|
121
137
|
root: unknown;
|
|
122
138
|
} & object;
|
|
123
139
|
pathTargetIsComponent(): {
|
|
124
140
|
kind: "path-target-is-component";
|
|
125
|
-
location:
|
|
141
|
+
location: BuilderIssueLocation;
|
|
126
142
|
root: unknown;
|
|
127
143
|
} & object;
|
|
128
144
|
pathMissingOption(): {
|
|
129
145
|
kind: "path-missing-option";
|
|
130
|
-
location:
|
|
146
|
+
location: BuilderIssueLocation;
|
|
131
147
|
root: unknown;
|
|
132
148
|
} & object;
|
|
133
149
|
pathMissingCollection(): {
|
|
134
150
|
kind: "path-missing-collection";
|
|
135
|
-
location:
|
|
151
|
+
location: BuilderIssueLocation;
|
|
136
152
|
root: unknown;
|
|
137
153
|
} & object;
|
|
138
154
|
referenceMissing(): {
|
|
139
155
|
kind: "reference-missing";
|
|
140
|
-
location:
|
|
156
|
+
location: BuilderIssueLocation;
|
|
141
157
|
root: unknown;
|
|
142
158
|
} & object;
|
|
143
159
|
referenceCircular(): {
|
|
144
160
|
kind: "reference-circular";
|
|
145
|
-
location:
|
|
161
|
+
location: BuilderIssueLocation;
|
|
146
162
|
root: unknown;
|
|
147
163
|
} & object;
|
|
148
164
|
referenceUnboundParameter(): {
|
|
149
165
|
kind: "reference-unbound-parameter";
|
|
150
|
-
location:
|
|
166
|
+
location: BuilderIssueLocation;
|
|
151
167
|
root: unknown;
|
|
152
168
|
} & object;
|
|
153
169
|
referenceInvalid(): {
|
|
154
170
|
kind: "reference-invalid";
|
|
155
|
-
location:
|
|
171
|
+
location: BuilderIssueLocation;
|
|
156
172
|
root: unknown;
|
|
157
173
|
} & object;
|
|
158
174
|
instanceInvalidOption(): {
|
|
159
175
|
kind: "instance-invalid-option";
|
|
160
|
-
location:
|
|
176
|
+
location: BuilderIssueLocation;
|
|
161
177
|
root: unknown;
|
|
162
178
|
} & object;
|
|
163
179
|
instanceInvalidCollection(): {
|
|
164
180
|
kind: "instance-invalid-collection";
|
|
165
|
-
location:
|
|
181
|
+
location: BuilderIssueLocation;
|
|
182
|
+
root: unknown;
|
|
183
|
+
} & object;
|
|
184
|
+
instanceInvalidCollectionMin(): {
|
|
185
|
+
kind: "instance-invalid-collection-min";
|
|
186
|
+
location: BuilderIssueLocation;
|
|
187
|
+
root: unknown;
|
|
188
|
+
} & object;
|
|
189
|
+
instanceInvalidCollectionMax(): {
|
|
190
|
+
kind: "instance-invalid-collection-max";
|
|
191
|
+
location: BuilderIssueLocation;
|
|
192
|
+
root: unknown;
|
|
193
|
+
} & object;
|
|
194
|
+
instanceUnexpectedKey(): {
|
|
195
|
+
kind: "instance-unexpected-key";
|
|
196
|
+
location: BuilderIssueLocation;
|
|
166
197
|
root: unknown;
|
|
167
198
|
} & object;
|
|
168
199
|
variantsInvalid(): {
|
|
169
200
|
kind: "variants-invalid";
|
|
170
|
-
location:
|
|
201
|
+
location: BuilderIssueLocation;
|
|
171
202
|
root: unknown;
|
|
172
203
|
} & object;
|
|
173
204
|
variantsMissingComponent(): {
|
|
174
205
|
kind: "variants-missing-component";
|
|
175
|
-
location:
|
|
206
|
+
location: BuilderIssueLocation;
|
|
176
207
|
root: unknown;
|
|
177
208
|
} & object;
|
|
178
209
|
variantsUnexpectedComponent(): {
|
|
179
210
|
kind: "variants-unexpected-component";
|
|
180
|
-
location:
|
|
211
|
+
location: BuilderIssueLocation;
|
|
181
212
|
root: unknown;
|
|
182
213
|
} & object;
|
|
183
214
|
variantsMissingVariant(instance: BuilderInstance): {
|
|
184
215
|
kind: "variants-missing-variant";
|
|
185
|
-
location:
|
|
216
|
+
location: BuilderIssueLocation;
|
|
186
217
|
root: unknown;
|
|
187
218
|
} & {
|
|
188
219
|
instance: BuilderInstance;
|
|
189
220
|
};
|
|
190
221
|
variantsInvalidVariant(): {
|
|
191
222
|
kind: "variants-invalid-variant";
|
|
192
|
-
location:
|
|
223
|
+
location: BuilderIssueLocation;
|
|
193
224
|
root: unknown;
|
|
194
225
|
} & object;
|
|
195
226
|
variantsMissingDetail(): {
|
|
196
227
|
kind: "variants-missing-detail";
|
|
197
|
-
location:
|
|
228
|
+
location: BuilderIssueLocation;
|
|
198
229
|
root: unknown;
|
|
199
230
|
} & object;
|
|
200
231
|
variantsUnexpectedDetail(): {
|
|
201
232
|
kind: "variants-unexpected-detail";
|
|
202
|
-
location:
|
|
233
|
+
location: BuilderIssueLocation;
|
|
203
234
|
root: unknown;
|
|
204
235
|
} & object;
|
|
205
236
|
variantsInvalidDetail(): {
|
|
206
237
|
kind: "variants-invalid-detail";
|
|
207
|
-
location:
|
|
238
|
+
location: BuilderIssueLocation;
|
|
208
239
|
root: unknown;
|
|
209
240
|
} & object;
|
|
210
241
|
pricingInvalidScope(): {
|
|
211
242
|
kind: "pricing-invalid-scope";
|
|
212
|
-
location:
|
|
243
|
+
location: BuilderIssueLocation;
|
|
213
244
|
root: unknown;
|
|
214
245
|
} & object;
|
|
215
246
|
pricingNestedVariants(): {
|
|
216
247
|
kind: "pricing-nested-variants";
|
|
217
|
-
location:
|
|
248
|
+
location: BuilderIssueLocation;
|
|
218
249
|
root: unknown;
|
|
219
250
|
} & object;
|
|
220
251
|
pricingMalformedExpression(): {
|
|
221
252
|
kind: "pricing-malformed-expression";
|
|
222
|
-
location:
|
|
253
|
+
location: BuilderIssueLocation;
|
|
223
254
|
root: unknown;
|
|
224
255
|
} & object;
|
|
225
256
|
pricingInvalidRateValue(): {
|
|
226
257
|
kind: "pricing-invalid-rate-value";
|
|
227
|
-
location:
|
|
258
|
+
location: BuilderIssueLocation;
|
|
228
259
|
root: unknown;
|
|
229
260
|
} & object;
|
|
230
261
|
pricingEmptyRates(): {
|
|
231
262
|
kind: "pricing-empty-rates";
|
|
232
|
-
location:
|
|
263
|
+
location: BuilderIssueLocation;
|
|
233
264
|
root: unknown;
|
|
234
265
|
} & object;
|
|
235
266
|
pricingDivideByZero(): {
|
|
236
267
|
kind: "pricing-divide-by-zero";
|
|
237
|
-
location:
|
|
268
|
+
location: BuilderIssueLocation;
|
|
238
269
|
root: unknown;
|
|
239
270
|
} & object;
|
|
240
271
|
pricingMissingOption(): {
|
|
241
272
|
kind: "pricing-missing-option";
|
|
242
|
-
location:
|
|
273
|
+
location: BuilderIssueLocation;
|
|
243
274
|
root: unknown;
|
|
244
275
|
} & object;
|
|
245
276
|
pricingMissingRate(): {
|
|
246
277
|
kind: "pricing-missing-rate";
|
|
247
|
-
location:
|
|
278
|
+
location: BuilderIssueLocation;
|
|
248
279
|
root: unknown;
|
|
249
280
|
} & object;
|
|
250
281
|
}
|
|
251
|
-
export type
|
|
252
|
-
export type
|
|
253
|
-
export type
|
|
282
|
+
export type BuilderIssue = ReturnType<BuilderIssuesScope[Exclude<keyof BuilderIssuesScope, 'scope' | 'errors' | 'warnings'>]>;
|
|
283
|
+
export type BuilderIssueKind = BuilderIssue['kind'];
|
|
284
|
+
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 {
|
|
@@ -44,8 +48,14 @@ export class BuilderErrorsScope {
|
|
|
44
48
|
entityInvalidToggleDefault() {
|
|
45
49
|
return this.#addError('entity-invalid-toggle-default');
|
|
46
50
|
}
|
|
47
|
-
|
|
48
|
-
return this.#addError('entity-duplicate-
|
|
51
|
+
entityDuplicateDetail() {
|
|
52
|
+
return this.#addError('entity-duplicate-detail');
|
|
53
|
+
}
|
|
54
|
+
entityDuplicatePrice() {
|
|
55
|
+
return this.#addError('entity-duplicate-price');
|
|
56
|
+
}
|
|
57
|
+
entityEmptyDisabledValues() {
|
|
58
|
+
return this.#addWarning('entity-empty-disabled-values');
|
|
49
59
|
}
|
|
50
60
|
modelDuplicateOption() {
|
|
51
61
|
return this.#addError('model-duplicate-option');
|
|
@@ -71,6 +81,9 @@ export class BuilderErrorsScope {
|
|
|
71
81
|
modelEmptyComponents() {
|
|
72
82
|
return this.#addError('model-empty-components');
|
|
73
83
|
}
|
|
84
|
+
modelCircularDependency() {
|
|
85
|
+
return this.#addError('model-circular-dependency');
|
|
86
|
+
}
|
|
74
87
|
pathEmpty() {
|
|
75
88
|
return this.#addError('path-empty');
|
|
76
89
|
}
|
|
@@ -110,6 +123,15 @@ export class BuilderErrorsScope {
|
|
|
110
123
|
instanceInvalidCollection() {
|
|
111
124
|
return this.#addError('instance-invalid-collection');
|
|
112
125
|
}
|
|
126
|
+
instanceInvalidCollectionMin() {
|
|
127
|
+
return this.#addError('instance-invalid-collection-min');
|
|
128
|
+
}
|
|
129
|
+
instanceInvalidCollectionMax() {
|
|
130
|
+
return this.#addError('instance-invalid-collection-max');
|
|
131
|
+
}
|
|
132
|
+
instanceUnexpectedKey() {
|
|
133
|
+
return this.#addError('instance-unexpected-key');
|
|
134
|
+
}
|
|
113
135
|
variantsInvalid() {
|
|
114
136
|
return this.#addError('variants-invalid');
|
|
115
137
|
}
|
|
@@ -159,9 +181,18 @@ export class BuilderErrorsScope {
|
|
|
159
181
|
return this.#addError('pricing-missing-rate');
|
|
160
182
|
}
|
|
161
183
|
#addError(kind, extras) {
|
|
162
|
-
const error =
|
|
163
|
-
Object.defineProperty(error, 'root', { value: this.#root, enumerable: false });
|
|
184
|
+
const error = this.#issue(kind, extras);
|
|
164
185
|
this.#errors = [...this.#errors, error];
|
|
165
186
|
return error;
|
|
166
187
|
}
|
|
188
|
+
#addWarning(kind, extras) {
|
|
189
|
+
const warning = this.#issue(kind, extras);
|
|
190
|
+
this.#warnings = [...this.#warnings, warning];
|
|
191
|
+
return warning;
|
|
192
|
+
}
|
|
193
|
+
#issue(kind, extras) {
|
|
194
|
+
const issue = { kind, location: this.#location, ...extras };
|
|
195
|
+
Object.defineProperty(issue, 'root', { value: this.#root, enumerable: false });
|
|
196
|
+
return issue;
|
|
197
|
+
}
|
|
167
198
|
}
|
|
@@ -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, BuilderCollectionWhenSerialisedSchema, BuilderComponentConfigSchema, BuilderComponentConfigSerialisedSchema,
|
|
2
|
+
export { BuilderCollectionConfigSchema, BuilderCollectionConfigSerialisedSchema, BuilderCollectionSchema, BuilderCollectionSelectMapSerialisedSchema, BuilderCollectionSerialisedSchema, BuilderCollectionsSerialisedSchema, BuilderCollectionWhenSerialisedSchema, BuilderComponentConfigSchema, BuilderComponentConfigSerialisedSchema, BuilderComponentDetailSchema, BuilderComponentDetailSerialisedSchema, BuilderComponentDetailsSchema, BuilderComponentDetailsSerialisedSchema, BuilderComponentDetailKindSchema, BuilderComponentSchema, BuilderComponentSelectMapSerialisedSchema, BuilderComponentSerialisedSchema, BuilderComponentsSerialisedSchema, BuilderComponentWhenSerialisedSchema, BuilderDescriptionItemSchema, BuilderDescriptionSchema, BuilderEntityKindSchema, BuilderEntitySerialisedSchema, BuilderExpectationKindSchema, BuilderExpectationSchema, BuilderExpectationSerialisedSchema, BuilderExpectationsSchema, BuilderExpectationsSerialisedSchema, BuilderModelSchema, BuilderModelSerialisedSchema, BuilderOptionConfigSchema, BuilderOptionConfigSerialisedSchema, BuilderOptionSchema, BuilderOptionSelectMapSerialisedSchema, BuilderOptionSerialisedSchema, BuilderOptionsSerialisedSchema, BuilderOptionWhenSerialisedSchema, BuilderPathSchema, BuilderPathsSchema, BuilderReferenceSchema, BuilderReferencesSchema, BuilderSchema, BuilderSelectConfigSchema, BuilderSelectConfigSerialisedSchema, BuilderSerialisedSchema, BuilderToggleConfigSchema, BuilderToggleConfigSerialisedSchema, BuilderUIDescribeSchema, BuilderUIDescribeSerialisedSchema, BuilderUIItemSerialisedSchema, BuilderUIItemsSerialisedSchema, BuilderUIPageSchema, BuilderUIPageSerialisedSchema, BuilderUIPagesSchema, BuilderUIPagesSerialisedSchema, BuilderUISchema, BuilderUISerialisedSchema, BuilderWhenConfigSchema, BuilderWhenEnableSchema, BuilderWhenMatchSchema, BuilderWhenUnlessSchema } 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, BuilderCollectionWhenSerialisedSchema, BuilderComponentConfigSchema, BuilderComponentConfigSerialisedSchema,
|
|
2
|
+
export { BuilderCollectionConfigSchema, BuilderCollectionConfigSerialisedSchema, BuilderCollectionSchema, BuilderCollectionSelectMapSerialisedSchema, BuilderCollectionSerialisedSchema, BuilderCollectionsSerialisedSchema, BuilderCollectionWhenSerialisedSchema, BuilderComponentConfigSchema, BuilderComponentConfigSerialisedSchema, BuilderComponentDetailSchema, BuilderComponentDetailSerialisedSchema, BuilderComponentDetailsSchema, BuilderComponentDetailsSerialisedSchema, BuilderComponentDetailKindSchema, BuilderComponentSchema, BuilderComponentSelectMapSerialisedSchema, BuilderComponentSerialisedSchema, BuilderComponentsSerialisedSchema, BuilderComponentWhenSerialisedSchema, BuilderDescriptionItemSchema, BuilderDescriptionSchema, BuilderEntityKindSchema, BuilderEntitySerialisedSchema, BuilderExpectationKindSchema, BuilderExpectationSchema, BuilderExpectationSerialisedSchema, BuilderExpectationsSchema, BuilderExpectationsSerialisedSchema, BuilderModelSchema, BuilderModelSerialisedSchema, BuilderOptionConfigSchema, BuilderOptionConfigSerialisedSchema, BuilderOptionSchema, BuilderOptionSelectMapSerialisedSchema, BuilderOptionSerialisedSchema, BuilderOptionsSerialisedSchema, BuilderOptionWhenSerialisedSchema, BuilderPathSchema, BuilderPathsSchema, BuilderReferenceSchema, BuilderReferencesSchema, BuilderSchema, BuilderSelectConfigSchema, BuilderSelectConfigSerialisedSchema, BuilderSerialisedSchema, BuilderToggleConfigSchema, BuilderToggleConfigSerialisedSchema, BuilderUIDescribeSchema, BuilderUIDescribeSerialisedSchema, BuilderUIItemSerialisedSchema, BuilderUIItemsSerialisedSchema, BuilderUIPageSchema, BuilderUIPageSerialisedSchema, BuilderUIPagesSchema, BuilderUIPagesSerialisedSchema, BuilderUISchema, BuilderUISerialisedSchema, BuilderWhenConfigSchema, BuilderWhenEnableSchema, BuilderWhenMatchSchema, BuilderWhenUnlessSchema } from './entities/index.js';
|
|
3
3
|
export { BuilderEnvironmentSchema } from './environment.js';
|
|
4
4
|
export { BuilderComponentVariantsSchema, BuilderVariantsSchema } from './instance.js';
|
package/dist/instance.d.ts
CHANGED
|
@@ -7,57 +7,101 @@ export declare const BuilderInstanceSchema: v.GenericSchema<BuilderInstance>;
|
|
|
7
7
|
export declare const BuilderInstancesSchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.GenericSchema<BuilderInstance>, undefined>, v.ReadonlyAction<BuilderInstance[]>]>;
|
|
8
8
|
export type BuilderInstances = v.InferOutput<typeof BuilderInstancesSchema>;
|
|
9
9
|
export type BuilderInstanceInput = Readonly<Record<string, unknown>>;
|
|
10
|
+
export declare const BuilderVariantDetailSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
11
|
+
readonly kind: v.PicklistSchema<["string", "boolean", "number", "price", "image"], undefined>;
|
|
12
|
+
readonly value: v.NullableSchema<v.NullableSchema<v.UnionSchema<[v.StringSchema<undefined>, v.BooleanSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, undefined>;
|
|
13
|
+
}, undefined>, v.ReadonlyAction<{
|
|
14
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
15
|
+
value: string | number | boolean | null;
|
|
16
|
+
}>]>;
|
|
17
|
+
export type BuilderVariantDetail = v.InferOutput<typeof BuilderVariantDetailSchema>;
|
|
10
18
|
export declare const BuilderComponentVariantSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
11
19
|
readonly instance: v.GenericSchema<BuilderInstance>;
|
|
12
|
-
readonly details: v.OptionalSchema<v.RecordSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, v.
|
|
20
|
+
readonly details: v.OptionalSchema<v.RecordSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
21
|
+
readonly kind: v.PicklistSchema<["string", "boolean", "number", "price", "image"], undefined>;
|
|
22
|
+
readonly value: v.NullableSchema<v.NullableSchema<v.UnionSchema<[v.StringSchema<undefined>, v.BooleanSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, undefined>;
|
|
23
|
+
}, undefined>, v.ReadonlyAction<{
|
|
24
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
25
|
+
value: string | number | boolean | null;
|
|
26
|
+
}>]>, undefined>, undefined>;
|
|
13
27
|
readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
|
|
14
28
|
}, undefined>, v.ReadonlyAction<{
|
|
15
29
|
instance: BuilderInstance;
|
|
16
30
|
details?: {
|
|
17
|
-
[x: string]:
|
|
31
|
+
readonly [x: string]: Readonly<{
|
|
32
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
33
|
+
value: string | number | boolean | null;
|
|
34
|
+
}>;
|
|
18
35
|
} | undefined;
|
|
19
36
|
tags?: readonly string[] | undefined;
|
|
20
37
|
}>]>;
|
|
21
38
|
export type BuilderComponentVariant = v.InferOutput<typeof BuilderComponentVariantSchema>;
|
|
22
39
|
export declare const BuilderComponentVariantsSchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
23
40
|
readonly instance: v.GenericSchema<BuilderInstance>;
|
|
24
|
-
readonly details: v.OptionalSchema<v.RecordSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, v.
|
|
41
|
+
readonly details: v.OptionalSchema<v.RecordSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
42
|
+
readonly kind: v.PicklistSchema<["string", "boolean", "number", "price", "image"], undefined>;
|
|
43
|
+
readonly value: v.NullableSchema<v.NullableSchema<v.UnionSchema<[v.StringSchema<undefined>, v.BooleanSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, undefined>;
|
|
44
|
+
}, undefined>, v.ReadonlyAction<{
|
|
45
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
46
|
+
value: string | number | boolean | null;
|
|
47
|
+
}>]>, undefined>, undefined>;
|
|
25
48
|
readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
|
|
26
49
|
}, undefined>, v.ReadonlyAction<{
|
|
27
50
|
instance: BuilderInstance;
|
|
28
51
|
details?: {
|
|
29
|
-
[x: string]:
|
|
52
|
+
readonly [x: string]: Readonly<{
|
|
53
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
54
|
+
value: string | number | boolean | null;
|
|
55
|
+
}>;
|
|
30
56
|
} | undefined;
|
|
31
57
|
tags?: readonly string[] | undefined;
|
|
32
58
|
}>]>, undefined>, v.ReadonlyAction<Readonly<{
|
|
33
59
|
instance: BuilderInstance;
|
|
34
60
|
details?: {
|
|
35
|
-
[x: string]:
|
|
61
|
+
readonly [x: string]: Readonly<{
|
|
62
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
63
|
+
value: string | number | boolean | null;
|
|
64
|
+
}>;
|
|
36
65
|
} | undefined;
|
|
37
66
|
tags?: readonly string[] | undefined;
|
|
38
67
|
}>[]>]>;
|
|
39
68
|
export type BuilderComponentVariants = v.InferOutput<typeof BuilderComponentVariantsSchema>;
|
|
40
69
|
export declare const BuilderVariantsSchema: v.SchemaWithPipe<readonly [v.RecordSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
41
70
|
readonly instance: v.GenericSchema<BuilderInstance>;
|
|
42
|
-
readonly details: v.OptionalSchema<v.RecordSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, v.
|
|
71
|
+
readonly details: v.OptionalSchema<v.RecordSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
72
|
+
readonly kind: v.PicklistSchema<["string", "boolean", "number", "price", "image"], undefined>;
|
|
73
|
+
readonly value: v.NullableSchema<v.NullableSchema<v.UnionSchema<[v.StringSchema<undefined>, v.BooleanSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, undefined>;
|
|
74
|
+
}, undefined>, v.ReadonlyAction<{
|
|
75
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
76
|
+
value: string | number | boolean | null;
|
|
77
|
+
}>]>, undefined>, undefined>;
|
|
43
78
|
readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
|
|
44
79
|
}, undefined>, v.ReadonlyAction<{
|
|
45
80
|
instance: BuilderInstance;
|
|
46
81
|
details?: {
|
|
47
|
-
[x: string]:
|
|
82
|
+
readonly [x: string]: Readonly<{
|
|
83
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
84
|
+
value: string | number | boolean | null;
|
|
85
|
+
}>;
|
|
48
86
|
} | undefined;
|
|
49
87
|
tags?: readonly string[] | undefined;
|
|
50
88
|
}>]>, undefined>, v.ReadonlyAction<Readonly<{
|
|
51
89
|
instance: BuilderInstance;
|
|
52
90
|
details?: {
|
|
53
|
-
[x: string]:
|
|
91
|
+
readonly [x: string]: Readonly<{
|
|
92
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
93
|
+
value: string | number | boolean | null;
|
|
94
|
+
}>;
|
|
54
95
|
} | undefined;
|
|
55
96
|
tags?: readonly string[] | undefined;
|
|
56
97
|
}>[]>]>, undefined>, v.ReadonlyAction<{
|
|
57
98
|
readonly [x: string]: readonly Readonly<{
|
|
58
99
|
instance: BuilderInstance;
|
|
59
100
|
details?: {
|
|
60
|
-
[x: string]:
|
|
101
|
+
readonly [x: string]: Readonly<{
|
|
102
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
103
|
+
value: string | number | boolean | null;
|
|
104
|
+
}>;
|
|
61
105
|
} | undefined;
|
|
62
106
|
tags?: readonly string[] | undefined;
|
|
63
107
|
}>[];
|
package/dist/instance.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
|
-
import { BuilderTagsSchema } from './entities/index.js';
|
|
2
|
+
import { BuilderComponentDetailKindSchema, BuilderTagsSchema } from './entities/index.js';
|
|
3
3
|
import { BuilderPrimitiveSchema, NameSchema } from './primitive.js';
|
|
4
4
|
export const BuilderInstanceSchema = v.pipe(v.record(NameSchema, v.union([BuilderPrimitiveSchema, v.lazy(() => BuilderInstancesSchema)])), v.readonly());
|
|
5
5
|
export const BuilderInstancesSchema = v.pipe(v.array(BuilderInstanceSchema), v.readonly());
|
|
6
|
+
export const BuilderVariantDetailSchema = v.pipe(v.object({
|
|
7
|
+
kind: BuilderComponentDetailKindSchema,
|
|
8
|
+
value: v.nullable(BuilderPrimitiveSchema)
|
|
9
|
+
}), v.readonly());
|
|
6
10
|
export const BuilderComponentVariantSchema = v.pipe(v.object({
|
|
7
11
|
instance: BuilderInstanceSchema,
|
|
8
|
-
details: v.optional(v.record(NameSchema,
|
|
12
|
+
details: v.optional(v.record(NameSchema, BuilderVariantDetailSchema)),
|
|
9
13
|
tags: v.optional(BuilderTagsSchema)
|
|
10
14
|
}), v.readonly());
|
|
11
15
|
export const BuilderComponentVariantsSchema = v.pipe(v.array(BuilderComponentVariantSchema), v.readonly());
|