@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
|
@@ -33,13 +33,13 @@ export declare const entitiesMap: {
|
|
|
33
33
|
readonly runtime: v.InstanceSchema<typeof import(".").BuilderToggleConfig, undefined>;
|
|
34
34
|
readonly serialised: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
35
35
|
readonly type: v.LiteralSchema<"toggle", undefined>;
|
|
36
|
-
readonly
|
|
36
|
+
readonly kind: v.PicklistSchema<["string", "boolean", "number"], undefined>;
|
|
37
37
|
readonly defaultValue: v.NullableSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
|
|
38
38
|
readonly isOptional: v.BooleanSchema<undefined>;
|
|
39
39
|
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>;
|
|
40
40
|
}, undefined>, v.ReadonlyAction<{
|
|
41
41
|
type: "toggle";
|
|
42
|
-
|
|
42
|
+
kind: "string" | "number" | "boolean";
|
|
43
43
|
defaultValue: string | number | boolean | null;
|
|
44
44
|
isOptional: boolean;
|
|
45
45
|
tags?: readonly string[] | undefined;
|
|
@@ -61,7 +61,7 @@ export declare const entitiesMap: {
|
|
|
61
61
|
tags?: readonly string[] | undefined;
|
|
62
62
|
}>> | Readonly<Readonly<{
|
|
63
63
|
type: "toggle";
|
|
64
|
-
|
|
64
|
+
kind: "string" | "number" | "boolean";
|
|
65
65
|
defaultValue: string | number | boolean | null;
|
|
66
66
|
isOptional: boolean;
|
|
67
67
|
tags?: readonly string[] | undefined;
|
|
@@ -81,7 +81,7 @@ export declare const entitiesMap: {
|
|
|
81
81
|
tags?: readonly string[] | undefined;
|
|
82
82
|
}>> | Readonly<Readonly<{
|
|
83
83
|
type: "toggle";
|
|
84
|
-
|
|
84
|
+
kind: "string" | "number" | "boolean";
|
|
85
85
|
defaultValue: string | number | boolean | null;
|
|
86
86
|
isOptional: boolean;
|
|
87
87
|
tags?: readonly string[] | undefined;
|
|
@@ -99,7 +99,7 @@ export declare const entitiesMap: {
|
|
|
99
99
|
tags?: readonly string[] | undefined;
|
|
100
100
|
}>> | Readonly<Readonly<{
|
|
101
101
|
type: "toggle";
|
|
102
|
-
|
|
102
|
+
kind: "string" | "number" | "boolean";
|
|
103
103
|
defaultValue: string | number | boolean | null;
|
|
104
104
|
isOptional: boolean;
|
|
105
105
|
tags?: readonly string[] | undefined;
|
|
@@ -115,7 +115,7 @@ export declare const entitiesMap: {
|
|
|
115
115
|
tags?: readonly string[] | undefined;
|
|
116
116
|
}>> | Readonly<Readonly<{
|
|
117
117
|
type: "toggle";
|
|
118
|
-
|
|
118
|
+
kind: "string" | "number" | "boolean";
|
|
119
119
|
defaultValue: string | number | boolean | null;
|
|
120
120
|
isOptional: boolean;
|
|
121
121
|
tags?: readonly string[] | undefined;
|
|
@@ -124,7 +124,7 @@ export declare const entitiesMap: {
|
|
|
124
124
|
readonly componentConfig: {
|
|
125
125
|
readonly runtime: v.InstanceSchema<typeof import(".").BuilderComponentConfig, undefined>;
|
|
126
126
|
readonly serialised: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
127
|
-
readonly
|
|
127
|
+
readonly details: v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
128
128
|
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
129
129
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
130
130
|
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
@@ -139,27 +139,27 @@ export declare const entitiesMap: {
|
|
|
139
139
|
type: "ref";
|
|
140
140
|
id: string;
|
|
141
141
|
}>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
142
|
-
readonly type: v.LiteralSchema<"component-
|
|
142
|
+
readonly type: v.LiteralSchema<"component-detail", undefined>;
|
|
143
143
|
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
144
|
-
readonly
|
|
144
|
+
readonly kind: v.PicklistSchema<["string", "boolean", "number", "price", "image"], undefined>;
|
|
145
145
|
readonly isOptional: v.BooleanSchema<undefined>;
|
|
146
146
|
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>;
|
|
147
147
|
}, undefined>, v.ReadonlyAction<{
|
|
148
|
-
type: "component-
|
|
148
|
+
type: "component-detail";
|
|
149
149
|
name: string;
|
|
150
|
-
|
|
150
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
151
151
|
isOptional: boolean;
|
|
152
152
|
tags?: readonly string[] | undefined;
|
|
153
153
|
}>]>, undefined>, v.ReadonlyAction<Readonly<{
|
|
154
|
-
type: "component-
|
|
154
|
+
type: "component-detail";
|
|
155
155
|
name: string;
|
|
156
|
-
|
|
156
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
157
157
|
isOptional: boolean;
|
|
158
158
|
tags?: readonly string[] | undefined;
|
|
159
159
|
}>[]>]>], undefined>;
|
|
160
160
|
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>;
|
|
161
161
|
}, undefined>, v.ReadonlyAction<{
|
|
162
|
-
|
|
162
|
+
details: Readonly<{
|
|
163
163
|
type: "parameter";
|
|
164
164
|
id: string;
|
|
165
165
|
name: string;
|
|
@@ -167,9 +167,9 @@ export declare const entitiesMap: {
|
|
|
167
167
|
type: "ref";
|
|
168
168
|
id: string;
|
|
169
169
|
}> | readonly Readonly<{
|
|
170
|
-
type: "component-
|
|
170
|
+
type: "component-detail";
|
|
171
171
|
name: string;
|
|
172
|
-
|
|
172
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
173
173
|
isOptional: boolean;
|
|
174
174
|
tags?: readonly string[] | undefined;
|
|
175
175
|
}>[];
|
|
@@ -182,7 +182,7 @@ export declare const entitiesMap: {
|
|
|
182
182
|
id: string;
|
|
183
183
|
name: string;
|
|
184
184
|
}> | Readonly<{
|
|
185
|
-
|
|
185
|
+
details: Readonly<{
|
|
186
186
|
type: "parameter";
|
|
187
187
|
id: string;
|
|
188
188
|
name: string;
|
|
@@ -190,9 +190,9 @@ export declare const entitiesMap: {
|
|
|
190
190
|
type: "ref";
|
|
191
191
|
id: string;
|
|
192
192
|
}> | readonly Readonly<{
|
|
193
|
-
type: "component-
|
|
193
|
+
type: "component-detail";
|
|
194
194
|
name: string;
|
|
195
|
-
|
|
195
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
196
196
|
isOptional: boolean;
|
|
197
197
|
tags?: readonly string[] | undefined;
|
|
198
198
|
}>[];
|
|
@@ -203,7 +203,7 @@ export declare const entitiesMap: {
|
|
|
203
203
|
id: string;
|
|
204
204
|
name: string;
|
|
205
205
|
}> | Readonly<{
|
|
206
|
-
|
|
206
|
+
details: Readonly<{
|
|
207
207
|
type: "parameter";
|
|
208
208
|
id: string;
|
|
209
209
|
name: string;
|
|
@@ -211,9 +211,9 @@ export declare const entitiesMap: {
|
|
|
211
211
|
type: "ref";
|
|
212
212
|
id: string;
|
|
213
213
|
}> | readonly Readonly<{
|
|
214
|
-
type: "component-
|
|
214
|
+
type: "component-detail";
|
|
215
215
|
name: string;
|
|
216
|
-
|
|
216
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
217
217
|
isOptional: boolean;
|
|
218
218
|
tags?: readonly string[] | undefined;
|
|
219
219
|
}>[];
|
|
@@ -222,7 +222,7 @@ export declare const entitiesMap: {
|
|
|
222
222
|
};
|
|
223
223
|
readonly componentWhen: {
|
|
224
224
|
readonly runtime: v.GenericSchema<import("./when").BuilderWhenSerialised<Readonly<{
|
|
225
|
-
|
|
225
|
+
details: Readonly<{
|
|
226
226
|
type: "parameter";
|
|
227
227
|
id: string;
|
|
228
228
|
name: string;
|
|
@@ -230,16 +230,16 @@ export declare const entitiesMap: {
|
|
|
230
230
|
type: "ref";
|
|
231
231
|
id: string;
|
|
232
232
|
}> | readonly Readonly<{
|
|
233
|
-
type: "component-
|
|
233
|
+
type: "component-detail";
|
|
234
234
|
name: string;
|
|
235
|
-
|
|
235
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
236
236
|
isOptional: boolean;
|
|
237
237
|
tags?: readonly string[] | undefined;
|
|
238
238
|
}>[];
|
|
239
239
|
tags?: readonly string[] | undefined;
|
|
240
240
|
}>>>;
|
|
241
241
|
readonly serialised: v.GenericSchema<import("./when").BuilderWhenSerialised<Readonly<{
|
|
242
|
-
|
|
242
|
+
details: Readonly<{
|
|
243
243
|
type: "parameter";
|
|
244
244
|
id: string;
|
|
245
245
|
name: string;
|
|
@@ -247,9 +247,9 @@ export declare const entitiesMap: {
|
|
|
247
247
|
type: "ref";
|
|
248
248
|
id: string;
|
|
249
249
|
}> | readonly Readonly<{
|
|
250
|
-
type: "component-
|
|
250
|
+
type: "component-detail";
|
|
251
251
|
name: string;
|
|
252
|
-
|
|
252
|
+
kind: "string" | "number" | "boolean" | "price" | "image";
|
|
253
253
|
isOptional: boolean;
|
|
254
254
|
tags?: readonly string[] | undefined;
|
|
255
255
|
}>[];
|
|
@@ -1422,9 +1422,9 @@ export declare const entitiesMap: {
|
|
|
1422
1422
|
readonly serialised: v.BooleanSchema<undefined>;
|
|
1423
1423
|
};
|
|
1424
1424
|
};
|
|
1425
|
-
export declare const validateNumber: (input: unknown, references?: import("./references").BuilderReferences,
|
|
1426
|
-
export declare const validateString: (input: unknown, references?: import("./references").BuilderReferences,
|
|
1427
|
-
export declare const validateBoolean: (input: unknown, references?: import("./references").BuilderReferences,
|
|
1425
|
+
export declare const validateNumber: (input: unknown, references?: import("./references").BuilderReferences, issues?: import("../errors/errors").BuilderIssuesScope) => import("./validated").ValidationResult<number>;
|
|
1426
|
+
export declare const validateString: (input: unknown, references?: import("./references").BuilderReferences, issues?: import("../errors/errors").BuilderIssuesScope) => import("./validated").ValidationResult<string>;
|
|
1427
|
+
export declare const validateBoolean: (input: unknown, references?: import("./references").BuilderReferences, issues?: import("../errors/errors").BuilderIssuesScope) => import("./validated").ValidationResult<boolean>;
|
|
1428
1428
|
export type EntitiesMap = typeof entitiesMap;
|
|
1429
1429
|
export type EntitiesSerialisedSchemas = EntitiesMap[BuilderEntityKind]['serialised'];
|
|
1430
1430
|
export declare const BuilderEntityKindSchema: v.PicklistSchema<readonly ["builder", "model", "select", "toggle", "optionSelectMap", "optionWhen", "componentConfig", "componentSelectMap", "componentWhen", "collectionConfig", "collectionSelectMap", "collectionWhen", "ui", "uiDescribe", "uiItems", "uiPage", "uiPages", "uiInput", "pricing", "pricingRates", "expectations", "paths", "path", "number", "string", "boolean"], undefined>;
|
|
@@ -1433,5 +1433,4 @@ type SerialiseMap = {
|
|
|
1433
1433
|
readonly [EntityKind in keyof EntitiesMap]: (input: v.InferOutput<EntitiesMap[EntityKind]['runtime']>) => v.InferOutput<EntitiesMap[EntityKind]['serialised']>;
|
|
1434
1434
|
};
|
|
1435
1435
|
export declare const serialise: SerialiseMap;
|
|
1436
|
-
export declare function serialiseValue(value: unknown): unknown;
|
|
1437
1436
|
export {};
|
|
@@ -4,7 +4,7 @@ import { BooleanSchema, NumberSchema, StringSchema } from '../primitive.js';
|
|
|
4
4
|
import { BuilderParameterSchema, BuilderRefSchema, isParamable } from '../references.js';
|
|
5
5
|
import { BuilderSchema, BuilderSerialisedSchema } from './builder/index.js';
|
|
6
6
|
import { BuilderCollectionConfigSchema, BuilderCollectionConfigSerialisedSchema, BuilderCollectionSchema, BuilderCollectionSelectMapSerialisedSchema, BuilderCollectionWhenSerialisedSchema } from './collection/index.js';
|
|
7
|
-
import { BuilderComponentConfigSchema, BuilderComponentConfigSerialisedSchema,
|
|
7
|
+
import { BuilderComponentConfigSchema, BuilderComponentConfigSerialisedSchema, BuilderComponentDetailSchema, BuilderComponentSchema, BuilderComponentSelectMapSerialisedSchema, BuilderComponentWhenSerialisedSchema } from './component/index.js';
|
|
8
8
|
import { BuilderExpectationSchema, BuilderExpectationsSchema, BuilderExpectationsSerialisedSchema } from './expectation.js';
|
|
9
9
|
import { builderEntityKinds, createEntityValidator } from './kind.js';
|
|
10
10
|
import { BuilderModelSchema, BuilderModelSerialisedSchema } from './model/index.js';
|
|
@@ -73,7 +73,7 @@ export const validateBoolean = createEntityValidator('boolean', entitiesMap.bool
|
|
|
73
73
|
export const BuilderEntityKindSchema = v.picklist(builderEntityKinds);
|
|
74
74
|
export const BuilderEntitySerialisedSchema = v.union(builderEntityKinds.map((kind) => entitiesMap[kind].serialised));
|
|
75
75
|
export const serialise = Object.fromEntries(builderEntityKinds.map((kind) => [kind, serialiseValue]));
|
|
76
|
-
|
|
76
|
+
function serialiseValue(value) {
|
|
77
77
|
if (value == null || typeof value !== 'object') {
|
|
78
78
|
return value;
|
|
79
79
|
}
|
|
@@ -149,13 +149,13 @@ const serialiserMap = [
|
|
|
149
149
|
serialiser(BuilderComponentSchema, serialiseNamedEntry),
|
|
150
150
|
serialiser(BuilderCollectionSchema, serialiseNamedEntry),
|
|
151
151
|
serialiser(BuilderComponentConfigSchema, (value) => ({
|
|
152
|
-
|
|
152
|
+
details: serialiseValue(value.details),
|
|
153
153
|
tags: value.tags
|
|
154
154
|
})),
|
|
155
|
-
serialiser(
|
|
156
|
-
type: 'component-
|
|
155
|
+
serialiser(BuilderComponentDetailSchema, (value) => ({
|
|
156
|
+
type: 'component-detail',
|
|
157
157
|
name: value.name,
|
|
158
|
-
|
|
158
|
+
kind: value.kind,
|
|
159
159
|
isOptional: value.isOptional,
|
|
160
160
|
tags: value.tags
|
|
161
161
|
})),
|
|
@@ -175,7 +175,7 @@ const serialiserMap = [
|
|
|
175
175
|
})),
|
|
176
176
|
serialiser(BuilderToggleConfigSchema, (value) => ({
|
|
177
177
|
type: 'toggle',
|
|
178
|
-
|
|
178
|
+
kind: value.kind,
|
|
179
179
|
defaultValue: value.defaultValue,
|
|
180
180
|
isOptional: value.isOptional,
|
|
181
181
|
tags: value.tags
|
|
@@ -378,7 +378,7 @@ export declare const BuilderUIDescribeSerialisedSchema: v.SchemaWithPipe<readonl
|
|
|
378
378
|
tags?: readonly string[] | undefined;
|
|
379
379
|
}>]>;
|
|
380
380
|
export type BuilderUIDescribeSerialised = v.InferOutput<typeof BuilderUIDescribeSerialisedSchema>;
|
|
381
|
-
export declare const validateUIDescribe: (input: unknown, references?: import("..").BuilderReferences,
|
|
381
|
+
export declare const validateUIDescribe: (input: unknown, references?: import("..").BuilderReferences, issues?: import("../../errors").BuilderIssuesScope) => import("..").ValidationResult<{
|
|
382
382
|
readonly type: "describe";
|
|
383
383
|
readonly label: string;
|
|
384
384
|
readonly inputs: readonly {
|
|
@@ -441,7 +441,7 @@ export declare const BuilderUIInputsSerialisedSchema: v.SchemaWithPipe<readonly
|
|
|
441
441
|
tags?: readonly string[] | undefined;
|
|
442
442
|
}>)[]>]>;
|
|
443
443
|
export type BuilderUIInputsSerialised = v.InferOutput<typeof BuilderUIInputsSerialisedSchema>;
|
|
444
|
-
export declare const validateUIInput: (input: unknown, references?: import("..").BuilderReferences,
|
|
444
|
+
export declare const validateUIInput: (input: unknown, references?: import("..").BuilderReferences, issues?: import("../../errors").BuilderIssuesScope) => import("..").ValidationResult<{
|
|
445
445
|
readonly type: "input";
|
|
446
446
|
readonly path: readonly (string | number)[];
|
|
447
447
|
readonly displayName?: string | undefined;
|
|
@@ -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'];
|
package/dist/entities/when.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BuilderPrimitive, BuilderPrimitives } from '../primitive';
|
|
1
|
+
import type { BuilderPrimitive, BuilderPrimitives, BuilderPrimitivesNonEmpty } from '../primitive';
|
|
2
2
|
import type { BuilderParameter, BuilderParameterSerialised, Paramable } from '../references';
|
|
3
3
|
import type { BuilderModelGeneric, BuilderModelState, BuilderModelStateOf } from './model/index';
|
|
4
4
|
import type { BuilderPath, BuilderPaths } from './paths';
|
|
@@ -143,7 +143,7 @@ export declare function createWhenSerialisedSchema<Payload extends v.GenericSche
|
|
|
143
143
|
export declare function createWhenFactories<Payload>(): {
|
|
144
144
|
enable: <const Values extends Paramable<Payload>>(values: Values) => BuilderEnableConfig<Values>;
|
|
145
145
|
match: <const MatchPayload extends Paramable<Payload>, const MatchPath extends Paramable<BuilderPath>, const SelectMap extends Paramable<BuilderMatchSelectMap<Paramable<Payload>>>>(matchPath: MatchPath, selectMap: SelectMap) => BuilderMatchConfig<MatchPayload, MatchPath, SelectMap>;
|
|
146
|
-
unless: <const Values extends Paramable<Payload>, const UnlessPath extends Paramable<BuilderPath>>(unlessPath: UnlessPath, disabledValues:
|
|
146
|
+
unless: <const Values extends Paramable<Payload>, const UnlessPath extends Paramable<BuilderPath>>(unlessPath: UnlessPath, disabledValues: BuilderPrimitivesNonEmpty, values: Values) => BuilderUnlessConfig<Values, UnlessPath>;
|
|
147
147
|
};
|
|
148
148
|
export type BuilderValidPath<State extends BuilderModelState> = InstanceValidPath<State['instance']>;
|
|
149
149
|
export type BuilderValidPaths<State extends BuilderModelState> = ReadonlyArray<BuilderValidPath<State>>;
|
|
@@ -167,15 +167,15 @@ export type WhenConfigNullable<Config extends BuilderWhenGeneric> = Config exten
|
|
|
167
167
|
readonly type: 'match';
|
|
168
168
|
readonly selectMap: infer SelectMap;
|
|
169
169
|
} ? null extends SelectMap[keyof SelectMap] ? null : never : never;
|
|
170
|
-
export type WhenNullability<State extends BuilderModelState,
|
|
170
|
+
export type WhenNullability<State extends BuilderModelState, ConditionPaths extends Paramable<BuilderPaths>, Config extends Paramable<BuilderWhenGeneric>> = [ConditionPaths] extends [BuilderParameter] ? null : WhenNullabilityFromPaths<State['instance'], Extract<ConditionPaths, BuilderValidPaths<State>>, Config>;
|
|
171
171
|
type BuilderResolvePath<Instance, Path extends BuilderPath> = Path extends readonly [
|
|
172
172
|
infer Head extends keyof Instance & string
|
|
173
173
|
] ? Instance[Head] : Path extends readonly [
|
|
174
174
|
infer Head extends keyof Instance & string,
|
|
175
175
|
...infer Tail extends BuilderPath
|
|
176
176
|
] ? Instance[Head] extends ReadonlyArray<infer Item> ? Tail extends readonly [number, ...infer Rest extends BuilderPath] ? BuilderResolvePath<Item, Rest> : never : BuilderResolvePath<Instance[Head], Tail> : never;
|
|
177
|
-
type WhenNullabilityFromPaths<Instance,
|
|
178
|
-
type WhenPathsNullable<Instance,
|
|
177
|
+
type WhenNullabilityFromPaths<Instance, ConditionPaths extends BuilderPaths, Config extends Paramable<BuilderWhenGeneric>> = Config extends BuilderParameter ? WhenPathsNullable<Instance, ConditionPaths> : Config extends BuilderWhenGeneric ? WhenPathsNullable<Instance, ConditionPaths> | WhenConfigNullable<Config> : never;
|
|
178
|
+
type WhenPathsNullable<Instance, ConditionPaths extends BuilderPaths> = ConditionPaths extends readonly [
|
|
179
179
|
infer Head extends BuilderPath,
|
|
180
180
|
...infer Tail extends BuilderPaths
|
|
181
181
|
] ? WhenPathNullable<Instance, Head> | WhenPathsNullable<Instance, Tail> : never;
|
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];
|