@builder-builder/builder 0.0.26 → 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 +103 -17
- package/dist/client/schema.js +7 -0
- package/dist/components/Builder.svelte.d.ts +24 -0
- package/dist/components/BuilderCollectionButtons.svelte.d.ts +22 -0
- package/dist/components/BuilderCollections.svelte.d.ts +23 -0
- package/dist/components/BuilderDescription.svelte.d.ts +18 -0
- package/dist/components/BuilderLayout.svelte.d.ts +24 -0
- package/dist/components/BuilderOption.svelte.d.ts +31 -0
- package/dist/components/BuilderOptionSelect.svelte.d.ts +21 -0
- package/dist/components/BuilderOptionToggleBoolean.svelte.d.ts +20 -0
- package/dist/components/BuilderOptionToggleNumber.svelte.d.ts +21 -0
- package/dist/components/BuilderOptionToggleString.svelte.d.ts +21 -0
- package/dist/components/BuilderPrice.svelte.d.ts +21 -0
- package/dist/components/BuilderRender.svelte.d.ts +39 -0
- package/dist/components/config.d.ts +2 -0
- package/dist/components/config.js +1 -0
- package/dist/components/dispatch.d.ts +1 -0
- package/dist/components/dispatch.js +3 -0
- package/dist/components/id.d.ts +1 -0
- package/dist/components/id.js +3 -0
- package/dist/components/index.d.ts +25 -0
- package/dist/components/index.js +7515 -0
- 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 +72 -24
- package/dist/entities/serialise.d.ts +148 -32
- package/dist/entities/serialise.js +7 -7
- package/dist/entities/ui/describe.d.ts +49 -1
- package/dist/entities/ui/input.d.ts +67 -2
- package/dist/entities/ui/input.js +8 -2
- package/dist/entities/ui/page.d.ts +49 -1
- package/dist/entities/ui/pages.d.ts +10 -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/order.js +4 -2
- package/dist/mappers/price.js +6 -4
- package/dist/mappers/render/option.d.ts +1 -0
- package/dist/mappers/render/option.js +1 -0
- 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 +9 -5
- package/dist/entities/component/field.d.ts +0 -59
- package/dist/entities/component/field.js +0 -52
|
@@ -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
|
|
@@ -107,6 +107,21 @@ export declare const BuilderUIDescribeSerialisedSchema: v.SchemaWithPipe<readonl
|
|
|
107
107
|
type: "ref";
|
|
108
108
|
id: string;
|
|
109
109
|
}>]>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>], undefined>, undefined>;
|
|
110
|
+
readonly placeholderLabel: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
111
|
+
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
112
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
113
|
+
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
114
|
+
}, undefined>, v.ReadonlyAction<{
|
|
115
|
+
type: "parameter";
|
|
116
|
+
id: string;
|
|
117
|
+
name: string;
|
|
118
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
119
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
120
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
121
|
+
}, undefined>, v.ReadonlyAction<{
|
|
122
|
+
type: "ref";
|
|
123
|
+
id: string;
|
|
124
|
+
}>]>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>], undefined>, undefined>;
|
|
110
125
|
readonly metadata: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
111
126
|
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
112
127
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
@@ -165,6 +180,14 @@ export declare const BuilderUIDescribeSerialisedSchema: v.SchemaWithPipe<readonl
|
|
|
165
180
|
type: "ref";
|
|
166
181
|
id: string;
|
|
167
182
|
}> | undefined;
|
|
183
|
+
placeholderLabel?: string | Readonly<{
|
|
184
|
+
type: "parameter";
|
|
185
|
+
id: string;
|
|
186
|
+
name: string;
|
|
187
|
+
}> | Readonly<{
|
|
188
|
+
type: "ref";
|
|
189
|
+
id: string;
|
|
190
|
+
}> | undefined;
|
|
168
191
|
metadata?: Readonly<{
|
|
169
192
|
type: "parameter";
|
|
170
193
|
id: string;
|
|
@@ -209,6 +232,14 @@ export declare const BuilderUIDescribeSerialisedSchema: v.SchemaWithPipe<readonl
|
|
|
209
232
|
type: "ref";
|
|
210
233
|
id: string;
|
|
211
234
|
}> | undefined;
|
|
235
|
+
placeholderLabel?: string | Readonly<{
|
|
236
|
+
type: "parameter";
|
|
237
|
+
id: string;
|
|
238
|
+
name: string;
|
|
239
|
+
}> | Readonly<{
|
|
240
|
+
type: "ref";
|
|
241
|
+
id: string;
|
|
242
|
+
}> | undefined;
|
|
212
243
|
metadata?: Readonly<{
|
|
213
244
|
type: "parameter";
|
|
214
245
|
id: string;
|
|
@@ -253,6 +284,14 @@ export declare const BuilderUIDescribeSerialisedSchema: v.SchemaWithPipe<readonl
|
|
|
253
284
|
type: "ref";
|
|
254
285
|
id: string;
|
|
255
286
|
}> | undefined;
|
|
287
|
+
placeholderLabel?: string | Readonly<{
|
|
288
|
+
type: "parameter";
|
|
289
|
+
id: string;
|
|
290
|
+
name: string;
|
|
291
|
+
}> | Readonly<{
|
|
292
|
+
type: "ref";
|
|
293
|
+
id: string;
|
|
294
|
+
}> | undefined;
|
|
256
295
|
metadata?: Readonly<{
|
|
257
296
|
type: "parameter";
|
|
258
297
|
id: string;
|
|
@@ -316,6 +355,14 @@ export declare const BuilderUIDescribeSerialisedSchema: v.SchemaWithPipe<readonl
|
|
|
316
355
|
type: "ref";
|
|
317
356
|
id: string;
|
|
318
357
|
}> | undefined;
|
|
358
|
+
placeholderLabel?: string | Readonly<{
|
|
359
|
+
type: "parameter";
|
|
360
|
+
id: string;
|
|
361
|
+
name: string;
|
|
362
|
+
}> | Readonly<{
|
|
363
|
+
type: "ref";
|
|
364
|
+
id: string;
|
|
365
|
+
}> | undefined;
|
|
319
366
|
metadata?: Readonly<{
|
|
320
367
|
type: "parameter";
|
|
321
368
|
id: string;
|
|
@@ -331,7 +378,7 @@ export declare const BuilderUIDescribeSerialisedSchema: v.SchemaWithPipe<readonl
|
|
|
331
378
|
tags?: readonly string[] | undefined;
|
|
332
379
|
}>]>;
|
|
333
380
|
export type BuilderUIDescribeSerialised = v.InferOutput<typeof BuilderUIDescribeSerialisedSchema>;
|
|
334
|
-
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<{
|
|
335
382
|
readonly type: "describe";
|
|
336
383
|
readonly label: string;
|
|
337
384
|
readonly inputs: readonly {
|
|
@@ -339,6 +386,7 @@ export declare const validateUIDescribe: (input: unknown, references?: import(".
|
|
|
339
386
|
readonly path: readonly (string | number)[];
|
|
340
387
|
readonly displayName?: string | undefined;
|
|
341
388
|
readonly kind?: string | undefined;
|
|
389
|
+
readonly placeholderLabel?: string | undefined;
|
|
342
390
|
readonly metadata?: {
|
|
343
391
|
readonly [x: string]: unknown;
|
|
344
392
|
} | undefined;
|
|
@@ -12,11 +12,13 @@ export declare class BuilderUIInput<const Path extends Paramable<BuilderPath> =
|
|
|
12
12
|
readonly path: Path;
|
|
13
13
|
readonly displayName?: DisplayName;
|
|
14
14
|
readonly kind?: Kind;
|
|
15
|
+
readonly placeholderLabel?: Paramable<string>;
|
|
15
16
|
readonly metadata?: Metadata;
|
|
16
17
|
readonly tags?: BuilderTags;
|
|
17
|
-
constructor(path: Path, displayName?: DisplayName, kind?: Kind, metadata?: Metadata, tags?: BuilderTags);
|
|
18
|
+
constructor(path: Path, displayName?: DisplayName, kind?: Kind, placeholderLabel?: Paramable<string>, metadata?: Metadata, tags?: BuilderTags);
|
|
18
19
|
display<const NewDisplayName extends Paramable<string>>(displayName: NewDisplayName): BuilderUIInput<Path, NewDisplayName, Kind, Metadata>;
|
|
19
20
|
as<const NewKind extends Paramable<string>>(kind: NewKind): BuilderUIInput<Path, DisplayName, NewKind, Metadata>;
|
|
21
|
+
placeholder(placeholderLabel: Paramable<string>): BuilderUIInput<Path, DisplayName, Kind, Metadata>;
|
|
20
22
|
meta<const NewMetadata extends BuilderUIInputMetadata>(metadata: NewMetadata): BuilderUIInput<Path, DisplayName, Kind, NewMetadata>;
|
|
21
23
|
tag(...tags: Array<string>): BuilderUIInput<Path, DisplayName, Kind, Metadata>;
|
|
22
24
|
}
|
|
@@ -86,6 +88,21 @@ export declare const BuilderUIInputSerialisedSchema: v.SchemaWithPipe<readonly [
|
|
|
86
88
|
type: "ref";
|
|
87
89
|
id: string;
|
|
88
90
|
}>]>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>], undefined>, undefined>;
|
|
91
|
+
readonly placeholderLabel: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
92
|
+
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
93
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
94
|
+
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
95
|
+
}, undefined>, v.ReadonlyAction<{
|
|
96
|
+
type: "parameter";
|
|
97
|
+
id: string;
|
|
98
|
+
name: string;
|
|
99
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
100
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
101
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
102
|
+
}, undefined>, v.ReadonlyAction<{
|
|
103
|
+
type: "ref";
|
|
104
|
+
id: string;
|
|
105
|
+
}>]>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>], undefined>, undefined>;
|
|
89
106
|
readonly metadata: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
90
107
|
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
91
108
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
@@ -144,6 +161,14 @@ export declare const BuilderUIInputSerialisedSchema: v.SchemaWithPipe<readonly [
|
|
|
144
161
|
type: "ref";
|
|
145
162
|
id: string;
|
|
146
163
|
}> | undefined;
|
|
164
|
+
placeholderLabel?: string | Readonly<{
|
|
165
|
+
type: "parameter";
|
|
166
|
+
id: string;
|
|
167
|
+
name: string;
|
|
168
|
+
}> | Readonly<{
|
|
169
|
+
type: "ref";
|
|
170
|
+
id: string;
|
|
171
|
+
}> | undefined;
|
|
147
172
|
metadata?: Readonly<{
|
|
148
173
|
type: "parameter";
|
|
149
174
|
id: string;
|
|
@@ -218,6 +243,21 @@ export declare const BuilderUIInputsSerialisedSchema: v.SchemaWithPipe<readonly
|
|
|
218
243
|
type: "ref";
|
|
219
244
|
id: string;
|
|
220
245
|
}>]>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>], undefined>, undefined>;
|
|
246
|
+
readonly placeholderLabel: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
247
|
+
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
248
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
249
|
+
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
250
|
+
}, undefined>, v.ReadonlyAction<{
|
|
251
|
+
type: "parameter";
|
|
252
|
+
id: string;
|
|
253
|
+
name: string;
|
|
254
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
255
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
256
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
257
|
+
}, undefined>, v.ReadonlyAction<{
|
|
258
|
+
type: "ref";
|
|
259
|
+
id: string;
|
|
260
|
+
}>]>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>], undefined>, undefined>;
|
|
221
261
|
readonly metadata: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
222
262
|
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
223
263
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
@@ -276,6 +316,14 @@ export declare const BuilderUIInputsSerialisedSchema: v.SchemaWithPipe<readonly
|
|
|
276
316
|
type: "ref";
|
|
277
317
|
id: string;
|
|
278
318
|
}> | undefined;
|
|
319
|
+
placeholderLabel?: string | Readonly<{
|
|
320
|
+
type: "parameter";
|
|
321
|
+
id: string;
|
|
322
|
+
name: string;
|
|
323
|
+
}> | Readonly<{
|
|
324
|
+
type: "ref";
|
|
325
|
+
id: string;
|
|
326
|
+
}> | undefined;
|
|
279
327
|
metadata?: Readonly<{
|
|
280
328
|
type: "parameter";
|
|
281
329
|
id: string;
|
|
@@ -320,6 +368,14 @@ export declare const BuilderUIInputsSerialisedSchema: v.SchemaWithPipe<readonly
|
|
|
320
368
|
type: "ref";
|
|
321
369
|
id: string;
|
|
322
370
|
}> | undefined;
|
|
371
|
+
placeholderLabel?: string | Readonly<{
|
|
372
|
+
type: "parameter";
|
|
373
|
+
id: string;
|
|
374
|
+
name: string;
|
|
375
|
+
}> | Readonly<{
|
|
376
|
+
type: "ref";
|
|
377
|
+
id: string;
|
|
378
|
+
}> | undefined;
|
|
323
379
|
metadata?: Readonly<{
|
|
324
380
|
type: "parameter";
|
|
325
381
|
id: string;
|
|
@@ -364,6 +420,14 @@ export declare const BuilderUIInputsSerialisedSchema: v.SchemaWithPipe<readonly
|
|
|
364
420
|
type: "ref";
|
|
365
421
|
id: string;
|
|
366
422
|
}> | undefined;
|
|
423
|
+
placeholderLabel?: string | Readonly<{
|
|
424
|
+
type: "parameter";
|
|
425
|
+
id: string;
|
|
426
|
+
name: string;
|
|
427
|
+
}> | Readonly<{
|
|
428
|
+
type: "ref";
|
|
429
|
+
id: string;
|
|
430
|
+
}> | undefined;
|
|
367
431
|
metadata?: Readonly<{
|
|
368
432
|
type: "parameter";
|
|
369
433
|
id: string;
|
|
@@ -377,11 +441,12 @@ export declare const BuilderUIInputsSerialisedSchema: v.SchemaWithPipe<readonly
|
|
|
377
441
|
tags?: readonly string[] | undefined;
|
|
378
442
|
}>)[]>]>;
|
|
379
443
|
export type BuilderUIInputsSerialised = v.InferOutput<typeof BuilderUIInputsSerialisedSchema>;
|
|
380
|
-
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<{
|
|
381
445
|
readonly type: "input";
|
|
382
446
|
readonly path: readonly (string | number)[];
|
|
383
447
|
readonly displayName?: string | undefined;
|
|
384
448
|
readonly kind?: string | undefined;
|
|
449
|
+
readonly placeholderLabel?: string | undefined;
|
|
385
450
|
readonly metadata?: {
|
|
386
451
|
readonly [x: string]: unknown;
|
|
387
452
|
} | undefined;
|
|
@@ -10,17 +10,19 @@ export class BuilderUIInput {
|
|
|
10
10
|
path;
|
|
11
11
|
displayName;
|
|
12
12
|
kind;
|
|
13
|
+
placeholderLabel;
|
|
13
14
|
metadata;
|
|
14
15
|
tags;
|
|
15
|
-
constructor(path, displayName, kind, metadata, tags) {
|
|
16
|
+
constructor(path, displayName, kind, placeholderLabel, metadata, tags) {
|
|
16
17
|
this.path = path;
|
|
17
18
|
this.displayName = displayName;
|
|
18
19
|
this.kind = kind;
|
|
20
|
+
this.placeholderLabel = placeholderLabel;
|
|
19
21
|
this.metadata = metadata;
|
|
20
22
|
this.tags = tags;
|
|
21
23
|
}
|
|
22
24
|
#next(patch) {
|
|
23
|
-
return new BuilderUIInput(this.path, patch.displayName ?? this.displayName, patch.kind ?? this.kind, patch.metadata ?? this.metadata, patch.tags ?? this.tags);
|
|
25
|
+
return new BuilderUIInput(this.path, patch.displayName ?? this.displayName, patch.kind ?? this.kind, patch.placeholderLabel ?? this.placeholderLabel, patch.metadata ?? this.metadata, patch.tags ?? this.tags);
|
|
24
26
|
}
|
|
25
27
|
display(displayName) {
|
|
26
28
|
return this.#next({
|
|
@@ -30,6 +32,9 @@ export class BuilderUIInput {
|
|
|
30
32
|
as(kind) {
|
|
31
33
|
return this.#next({ kind: kind });
|
|
32
34
|
}
|
|
35
|
+
placeholder(placeholderLabel) {
|
|
36
|
+
return this.#next({ placeholderLabel });
|
|
37
|
+
}
|
|
33
38
|
meta(metadata) {
|
|
34
39
|
return this.#next({ metadata: metadata });
|
|
35
40
|
}
|
|
@@ -47,6 +52,7 @@ export const BuilderUIInputSerialisedSchema = serialisable(v.object({
|
|
|
47
52
|
path: paramable(BuilderPathSchema),
|
|
48
53
|
displayName: v.optional(paramable(NameSchema)),
|
|
49
54
|
kind: v.optional(paramable(NameSchema)),
|
|
55
|
+
placeholderLabel: v.optional(paramable(NameSchema)),
|
|
50
56
|
metadata: v.optional(paramable(BuilderUIInputMetadataSchema)),
|
|
51
57
|
tags: v.optional(BuilderTagsSchema)
|
|
52
58
|
}));
|
|
@@ -103,6 +103,21 @@ export declare const BuilderUIPageSerialisedSchema: v.SchemaWithPipe<readonly [v
|
|
|
103
103
|
type: "ref";
|
|
104
104
|
id: string;
|
|
105
105
|
}>]>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>], undefined>, undefined>;
|
|
106
|
+
readonly placeholderLabel: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
107
|
+
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
108
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
109
|
+
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
110
|
+
}, undefined>, v.ReadonlyAction<{
|
|
111
|
+
type: "parameter";
|
|
112
|
+
id: string;
|
|
113
|
+
name: string;
|
|
114
|
+
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
115
|
+
readonly type: v.LiteralSchema<"ref", undefined>;
|
|
116
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
117
|
+
}, undefined>, v.ReadonlyAction<{
|
|
118
|
+
type: "ref";
|
|
119
|
+
id: string;
|
|
120
|
+
}>]>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>], undefined>, undefined>;
|
|
106
121
|
readonly metadata: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
107
122
|
readonly type: v.LiteralSchema<"parameter", undefined>;
|
|
108
123
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
@@ -161,6 +176,14 @@ export declare const BuilderUIPageSerialisedSchema: v.SchemaWithPipe<readonly [v
|
|
|
161
176
|
type: "ref";
|
|
162
177
|
id: string;
|
|
163
178
|
}> | undefined;
|
|
179
|
+
placeholderLabel?: string | Readonly<{
|
|
180
|
+
type: "parameter";
|
|
181
|
+
id: string;
|
|
182
|
+
name: string;
|
|
183
|
+
}> | Readonly<{
|
|
184
|
+
type: "ref";
|
|
185
|
+
id: string;
|
|
186
|
+
}> | undefined;
|
|
164
187
|
metadata?: Readonly<{
|
|
165
188
|
type: "parameter";
|
|
166
189
|
id: string;
|
|
@@ -205,6 +228,14 @@ export declare const BuilderUIPageSerialisedSchema: v.SchemaWithPipe<readonly [v
|
|
|
205
228
|
type: "ref";
|
|
206
229
|
id: string;
|
|
207
230
|
}> | undefined;
|
|
231
|
+
placeholderLabel?: string | Readonly<{
|
|
232
|
+
type: "parameter";
|
|
233
|
+
id: string;
|
|
234
|
+
name: string;
|
|
235
|
+
}> | Readonly<{
|
|
236
|
+
type: "ref";
|
|
237
|
+
id: string;
|
|
238
|
+
}> | undefined;
|
|
208
239
|
metadata?: Readonly<{
|
|
209
240
|
type: "parameter";
|
|
210
241
|
id: string;
|
|
@@ -249,6 +280,14 @@ export declare const BuilderUIPageSerialisedSchema: v.SchemaWithPipe<readonly [v
|
|
|
249
280
|
type: "ref";
|
|
250
281
|
id: string;
|
|
251
282
|
}> | undefined;
|
|
283
|
+
placeholderLabel?: string | Readonly<{
|
|
284
|
+
type: "parameter";
|
|
285
|
+
id: string;
|
|
286
|
+
name: string;
|
|
287
|
+
}> | Readonly<{
|
|
288
|
+
type: "ref";
|
|
289
|
+
id: string;
|
|
290
|
+
}> | undefined;
|
|
252
291
|
metadata?: Readonly<{
|
|
253
292
|
type: "parameter";
|
|
254
293
|
id: string;
|
|
@@ -312,6 +351,14 @@ export declare const BuilderUIPageSerialisedSchema: v.SchemaWithPipe<readonly [v
|
|
|
312
351
|
type: "ref";
|
|
313
352
|
id: string;
|
|
314
353
|
}> | undefined;
|
|
354
|
+
placeholderLabel?: string | Readonly<{
|
|
355
|
+
type: "parameter";
|
|
356
|
+
id: string;
|
|
357
|
+
name: string;
|
|
358
|
+
}> | Readonly<{
|
|
359
|
+
type: "ref";
|
|
360
|
+
id: string;
|
|
361
|
+
}> | undefined;
|
|
315
362
|
metadata?: Readonly<{
|
|
316
363
|
type: "parameter";
|
|
317
364
|
id: string;
|
|
@@ -327,7 +374,7 @@ export declare const BuilderUIPageSerialisedSchema: v.SchemaWithPipe<readonly [v
|
|
|
327
374
|
tags?: readonly string[] | undefined;
|
|
328
375
|
}>]>;
|
|
329
376
|
export type BuilderUIPageSerialised = v.InferOutput<typeof BuilderUIPageSerialisedSchema>;
|
|
330
|
-
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<{
|
|
331
378
|
readonly type: "page";
|
|
332
379
|
readonly label: string;
|
|
333
380
|
readonly inputs: readonly {
|
|
@@ -335,6 +382,7 @@ export declare const validateUIPage: (input: unknown, references?: import("..").
|
|
|
335
382
|
readonly path: readonly (string | number)[];
|
|
336
383
|
readonly displayName?: string | undefined;
|
|
337
384
|
readonly kind?: string | undefined;
|
|
385
|
+
readonly placeholderLabel?: string | undefined;
|
|
338
386
|
readonly metadata?: {
|
|
339
387
|
readonly [x: string]: unknown;
|
|
340
388
|
} | undefined;
|
|
@@ -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;
|
|
@@ -60,6 +60,7 @@ export declare const validateUIPages: (input: unknown, references?: import("..")
|
|
|
60
60
|
readonly path: readonly (string | number)[];
|
|
61
61
|
readonly displayName?: string | undefined;
|
|
62
62
|
readonly kind?: string | undefined;
|
|
63
|
+
readonly placeholderLabel?: string | undefined;
|
|
63
64
|
readonly metadata?: {
|
|
64
65
|
readonly [x: string]: unknown;
|
|
65
66
|
} | undefined;
|
|
@@ -74,6 +75,7 @@ export declare const validateUIPages: (input: unknown, references?: import("..")
|
|
|
74
75
|
readonly path: readonly (string | number)[];
|
|
75
76
|
readonly displayName?: string | undefined;
|
|
76
77
|
readonly kind?: string | undefined;
|
|
78
|
+
readonly placeholderLabel?: string | undefined;
|
|
77
79
|
readonly metadata?: {
|
|
78
80
|
readonly [x: string]: unknown;
|
|
79
81
|
} | undefined;
|
|
@@ -92,6 +94,7 @@ export declare const validateUIPages: (input: unknown, references?: import("..")
|
|
|
92
94
|
readonly path: readonly (string | number)[];
|
|
93
95
|
readonly displayName?: string | undefined;
|
|
94
96
|
readonly kind?: string | undefined;
|
|
97
|
+
readonly placeholderLabel?: string | undefined;
|
|
95
98
|
readonly metadata?: {
|
|
96
99
|
readonly [x: string]: unknown;
|
|
97
100
|
} | undefined;
|
|
@@ -106,6 +109,7 @@ export declare const validateUIPages: (input: unknown, references?: import("..")
|
|
|
106
109
|
readonly path: readonly (string | number)[];
|
|
107
110
|
readonly displayName?: string | undefined;
|
|
108
111
|
readonly kind?: string | undefined;
|
|
112
|
+
readonly placeholderLabel?: string | undefined;
|
|
109
113
|
readonly metadata?: {
|
|
110
114
|
readonly [x: string]: unknown;
|
|
111
115
|
} | undefined;
|
|
@@ -117,7 +121,7 @@ export declare const validateUIPages: (input: unknown, references?: import("..")
|
|
|
117
121
|
})[];
|
|
118
122
|
readonly tags?: readonly string[] | undefined;
|
|
119
123
|
}>;
|
|
120
|
-
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 ({
|
|
121
125
|
readonly type: "page";
|
|
122
126
|
readonly label: string;
|
|
123
127
|
readonly inputs: readonly {
|
|
@@ -125,6 +129,7 @@ export declare const validateUIItems: (input: unknown, references?: import("..")
|
|
|
125
129
|
readonly path: readonly (string | number)[];
|
|
126
130
|
readonly displayName?: string | undefined;
|
|
127
131
|
readonly kind?: string | undefined;
|
|
132
|
+
readonly placeholderLabel?: string | undefined;
|
|
128
133
|
readonly metadata?: {
|
|
129
134
|
readonly [x: string]: unknown;
|
|
130
135
|
} | undefined;
|
|
@@ -139,6 +144,7 @@ export declare const validateUIItems: (input: unknown, references?: import("..")
|
|
|
139
144
|
readonly path: readonly (string | number)[];
|
|
140
145
|
readonly displayName?: string | undefined;
|
|
141
146
|
readonly kind?: string | undefined;
|
|
147
|
+
readonly placeholderLabel?: string | undefined;
|
|
142
148
|
readonly metadata?: {
|
|
143
149
|
readonly [x: string]: unknown;
|
|
144
150
|
} | undefined;
|
|
@@ -157,6 +163,7 @@ export declare const validateUIItems: (input: unknown, references?: import("..")
|
|
|
157
163
|
readonly path: readonly (string | number)[];
|
|
158
164
|
readonly displayName?: string | undefined;
|
|
159
165
|
readonly kind?: string | undefined;
|
|
166
|
+
readonly placeholderLabel?: string | undefined;
|
|
160
167
|
readonly metadata?: {
|
|
161
168
|
readonly [x: string]: unknown;
|
|
162
169
|
} | undefined;
|
|
@@ -171,6 +178,7 @@ export declare const validateUIItems: (input: unknown, references?: import("..")
|
|
|
171
178
|
readonly path: readonly (string | number)[];
|
|
172
179
|
readonly displayName?: string | undefined;
|
|
173
180
|
readonly kind?: string | undefined;
|
|
181
|
+
readonly placeholderLabel?: string | undefined;
|
|
174
182
|
readonly metadata?: {
|
|
175
183
|
readonly [x: string]: unknown;
|
|
176
184
|
} | undefined;
|
|
@@ -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];
|