@player-lang/functional-dsl-generator 0.0.2-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/cjs/index.cjs +2146 -0
  2. package/dist/cjs/index.cjs.map +1 -0
  3. package/dist/index.legacy-esm.js +2075 -0
  4. package/dist/index.mjs +2075 -0
  5. package/dist/index.mjs.map +1 -0
  6. package/package.json +38 -0
  7. package/src/__tests__/__snapshots__/generator.test.ts.snap +886 -0
  8. package/src/__tests__/builder-class-generator.test.ts +627 -0
  9. package/src/__tests__/cli.test.ts +685 -0
  10. package/src/__tests__/default-value-generator.test.ts +365 -0
  11. package/src/__tests__/generator.test.ts +2860 -0
  12. package/src/__tests__/import-generator.test.ts +444 -0
  13. package/src/__tests__/path-utils.test.ts +174 -0
  14. package/src/__tests__/type-collector.test.ts +674 -0
  15. package/src/__tests__/type-transformer.test.ts +934 -0
  16. package/src/__tests__/utils.test.ts +597 -0
  17. package/src/builder-class-generator.ts +254 -0
  18. package/src/cli.ts +285 -0
  19. package/src/default-value-generator.ts +307 -0
  20. package/src/generator.ts +257 -0
  21. package/src/import-generator.ts +331 -0
  22. package/src/index.ts +38 -0
  23. package/src/path-utils.ts +155 -0
  24. package/src/ts-morph-type-finder.ts +319 -0
  25. package/src/type-categorizer.ts +131 -0
  26. package/src/type-collector.ts +296 -0
  27. package/src/type-resolver.ts +266 -0
  28. package/src/type-transformer.ts +487 -0
  29. package/src/utils.ts +762 -0
  30. package/types/builder-class-generator.d.ts +56 -0
  31. package/types/cli.d.ts +6 -0
  32. package/types/default-value-generator.d.ts +74 -0
  33. package/types/generator.d.ts +102 -0
  34. package/types/import-generator.d.ts +77 -0
  35. package/types/index.d.ts +12 -0
  36. package/types/path-utils.d.ts +65 -0
  37. package/types/ts-morph-type-finder.d.ts +73 -0
  38. package/types/type-categorizer.d.ts +46 -0
  39. package/types/type-collector.d.ts +62 -0
  40. package/types/type-resolver.d.ts +49 -0
  41. package/types/type-transformer.d.ts +74 -0
  42. package/types/utils.d.ts +205 -0
@@ -0,0 +1,886 @@
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
+
3
+ exports[`FunctionalBuilderGenerator > Array Types > generates builder for asset with array of complex objects 1`] = `
4
+ "import type { ChoiceAsset, ChoiceItem } from "../types/choice-";
5
+ import { type FunctionalBuilder, type BaseBuildContext, type FunctionalPartial, FunctionalBuilderBase, createInspectMethod, type TaggedTemplateValue } from "@player-lang/functional-dsl";
6
+
7
+ export interface ChoiceAssetBuilderMethods {
8
+ /** A unique identifier for this asset */
9
+ withId(value: string | TaggedTemplateValue<string>): ChoiceAssetBuilder;
10
+ /** Sets the binding property */
11
+ withBinding(value: string | TaggedTemplateValue<string>): ChoiceAssetBuilder;
12
+ /** Sets the choices property */
13
+ withChoices(value: Array<ChoiceItem | FunctionalBuilder<ChoiceItem, BaseBuildContext> | FunctionalPartial<ChoiceItem, BaseBuildContext>>): ChoiceAssetBuilder;
14
+ }
15
+
16
+ /**
17
+ * A builder for ChoiceAsset
18
+ */
19
+ export class ChoiceAssetBuilder extends FunctionalBuilderBase<ChoiceAsset> implements ChoiceAssetBuilderMethods, FunctionalBuilder<ChoiceAsset, BaseBuildContext> {
20
+ private static readonly defaults: Record<string, unknown> = {"type":"choice","id":"","binding":""};
21
+ private static readonly __arrayProperties__: ReadonlySet<string> = new Set(["choices"]);
22
+ private static readonly __assetWrapperPaths__: ReadonlyArray<ReadonlyArray<string>> = [["choices","label"]];
23
+
24
+ /** A unique identifier for this asset */
25
+ withId(value: string | TaggedTemplateValue<string>): ChoiceAssetBuilder {
26
+ return this.set("id", value);
27
+ }
28
+
29
+ /** Sets the binding property */
30
+ withBinding(value: string | TaggedTemplateValue<string>): ChoiceAssetBuilder {
31
+ return this.set("binding", value);
32
+ }
33
+
34
+ /** Sets the choices property */
35
+ withChoices(value: Array<ChoiceItem | FunctionalBuilder<ChoiceItem, BaseBuildContext> | FunctionalPartial<ChoiceItem, BaseBuildContext>>): ChoiceAssetBuilder {
36
+ return this.set("choices", value);
37
+ }
38
+
39
+ /**
40
+ * Builds the final ChoiceAsset object
41
+ * @param context - Optional build context for nested builders
42
+ */
43
+ build(context?: BaseBuildContext): ChoiceAsset {
44
+ return this.buildWithDefaults(ChoiceAssetBuilder.defaults, context);
45
+ }
46
+
47
+ [Symbol.for("nodejs.util.inspect.custom")](): string {
48
+ return createInspectMethod("ChoiceAssetBuilder", this.values);
49
+ }
50
+ }
51
+
52
+ /**
53
+ * Creates a new ChoiceAsset builder
54
+ * @param initial Optional initial values
55
+ * @returns A functional builder for ChoiceAsset
56
+ */
57
+ export function choice(initial?: FunctionalPartial<ChoiceAsset>): ChoiceAssetBuilder {
58
+ return new ChoiceAssetBuilder(initial);
59
+ }"
60
+ `;
61
+
62
+ exports[`FunctionalBuilderGenerator > Array Types > generates builder for asset with array of primitives 1`] = `
63
+ "import type { ActionAsset } from "../types/action-";
64
+ import { type FunctionalBuilder, type BaseBuildContext, type FunctionalPartial, FunctionalBuilderBase, createInspectMethod, type TaggedTemplateValue } from "@player-lang/functional-dsl";
65
+
66
+ export interface ActionAssetBuilderMethods {
67
+ /** A unique identifier for this asset */
68
+ withId(value: string | TaggedTemplateValue<string>): ActionAssetBuilder;
69
+ /** Sets the validate property */
70
+ withValidate(value: Array<string | TaggedTemplateValue<string>> | string | TaggedTemplateValue<string>): ActionAssetBuilder;
71
+ }
72
+
73
+ /**
74
+ * A builder for ActionAsset
75
+ */
76
+ export class ActionAssetBuilder extends FunctionalBuilderBase<ActionAsset> implements ActionAssetBuilderMethods, FunctionalBuilder<ActionAsset, BaseBuildContext> {
77
+ private static readonly defaults: Record<string, unknown> = {"type":"action","id":""};
78
+ private static readonly __arrayProperties__: ReadonlySet<string> = new Set(["validate"]);
79
+
80
+ /** A unique identifier for this asset */
81
+ withId(value: string | TaggedTemplateValue<string>): ActionAssetBuilder {
82
+ return this.set("id", value);
83
+ }
84
+
85
+ /** Sets the validate property */
86
+ withValidate(value: Array<string | TaggedTemplateValue<string>> | string | TaggedTemplateValue<string>): ActionAssetBuilder {
87
+ return this.set("validate", value);
88
+ }
89
+
90
+ /**
91
+ * Builds the final ActionAsset object
92
+ * @param context - Optional build context for nested builders
93
+ */
94
+ build(context?: BaseBuildContext): ActionAsset {
95
+ return this.buildWithDefaults(ActionAssetBuilder.defaults, context);
96
+ }
97
+
98
+ [Symbol.for("nodejs.util.inspect.custom")](): string {
99
+ return createInspectMethod("ActionAssetBuilder", this.values);
100
+ }
101
+ }
102
+
103
+ /**
104
+ * Creates a new ActionAsset builder
105
+ * @param initial Optional initial values
106
+ * @returns A functional builder for ActionAsset
107
+ */
108
+ export function action(initial?: FunctionalPartial<ActionAsset>): ActionAssetBuilder {
109
+ return new ActionAssetBuilder(initial);
110
+ }"
111
+ `;
112
+
113
+ exports[`FunctionalBuilderGenerator > Array Types > generates builder for non-Asset type with complex properties 1`] = `
114
+ "import type { ChoiceItem } from "../types/choice-item";
115
+ import type { Asset } from "@player-ui/types";
116
+ import { type FunctionalBuilder, type BaseBuildContext, type FunctionalPartial, FunctionalBuilderBase, createInspectMethod, type TaggedTemplateValue } from "@player-lang/functional-dsl";
117
+
118
+ export interface ChoiceItemBuilderMethods {
119
+ /** Sets the id property */
120
+ withId(value: string | TaggedTemplateValue<string>): ChoiceItemBuilder;
121
+ /** Sets the label property */
122
+ withLabel(value: Asset | FunctionalBuilder<Asset, BaseBuildContext>): ChoiceItemBuilder;
123
+ /** Sets the value property */
124
+ withValue(value: string | TaggedTemplateValue<string> | number | TaggedTemplateValue<number> | boolean | TaggedTemplateValue<boolean> | null): ChoiceItemBuilder;
125
+ }
126
+
127
+ /**
128
+ * A builder for ChoiceItem
129
+ */
130
+ export class ChoiceItemBuilder extends FunctionalBuilderBase<ChoiceItem> implements ChoiceItemBuilderMethods, FunctionalBuilder<ChoiceItem, BaseBuildContext> {
131
+ private static readonly defaults: Record<string, unknown> = {"id":""};
132
+ private static readonly __assetWrapperPaths__: ReadonlyArray<ReadonlyArray<string>> = [["label"]];
133
+
134
+ /** Sets the id property */
135
+ withId(value: string | TaggedTemplateValue<string>): ChoiceItemBuilder {
136
+ return this.set("id", value);
137
+ }
138
+
139
+ /** Sets the label property */
140
+ withLabel(value: Asset | FunctionalBuilder<Asset, BaseBuildContext>): ChoiceItemBuilder {
141
+ return this.set("label", value);
142
+ }
143
+
144
+ /** Sets the value property */
145
+ withValue(value: string | TaggedTemplateValue<string> | number | TaggedTemplateValue<number> | boolean | TaggedTemplateValue<boolean> | null): ChoiceItemBuilder {
146
+ return this.set("value", value);
147
+ }
148
+
149
+ /**
150
+ * Builds the final ChoiceItem object
151
+ * @param context - Optional build context for nested builders
152
+ */
153
+ build(context?: BaseBuildContext): ChoiceItem {
154
+ return this.buildWithDefaults(ChoiceItemBuilder.defaults, context);
155
+ }
156
+
157
+ [Symbol.for("nodejs.util.inspect.custom")](): string {
158
+ return createInspectMethod("ChoiceItemBuilder", this.values);
159
+ }
160
+ }
161
+
162
+ /**
163
+ * Creates a new ChoiceItem builder
164
+ * @param initial Optional initial values
165
+ * @returns A functional builder for ChoiceItem
166
+ */
167
+ export function choiceItem(initial?: FunctionalPartial<ChoiceItem>): ChoiceItemBuilder {
168
+ return new ChoiceItemBuilder(initial);
169
+ }"
170
+ `;
171
+
172
+ exports[`FunctionalBuilderGenerator > Asset Wrapper (Slot) Types > generates builder for asset with AssetWrapper slots 1`] = `
173
+ "import type { InfoAsset } from "../types/info-";
174
+ import type { Asset } from "@player-ui/types";
175
+ import { type FunctionalBuilder, type BaseBuildContext, type FunctionalPartial, FunctionalBuilderBase, createInspectMethod, type TaggedTemplateValue } from "@player-lang/functional-dsl";
176
+
177
+ export interface InfoAssetBuilderMethods {
178
+ /** A unique identifier for this asset */
179
+ withId(value: string | TaggedTemplateValue<string>): InfoAssetBuilder;
180
+ /** Sets the title property */
181
+ withTitle(value: Asset | FunctionalBuilder<Asset, BaseBuildContext>): InfoAssetBuilder;
182
+ /** Sets the subtitle property */
183
+ withSubtitle(value: Asset | FunctionalBuilder<Asset, BaseBuildContext>): InfoAssetBuilder;
184
+ /** Sets the primaryInfo property */
185
+ withPrimaryInfo(value: Array<Asset | FunctionalBuilder<Asset, BaseBuildContext>>): InfoAssetBuilder;
186
+ }
187
+
188
+ /**
189
+ * A builder for InfoAsset
190
+ */
191
+ export class InfoAssetBuilder extends FunctionalBuilderBase<InfoAsset> implements InfoAssetBuilderMethods, FunctionalBuilder<InfoAsset, BaseBuildContext> {
192
+ private static readonly defaults: Record<string, unknown> = {"type":"info","id":"","primaryInfo":[]};
193
+ private static readonly __arrayProperties__: ReadonlySet<string> = new Set(["primaryInfo"]);
194
+ private static readonly __assetWrapperPaths__: ReadonlyArray<ReadonlyArray<string>> = [["title"],["subtitle"],["primaryInfo"]];
195
+
196
+ /** A unique identifier for this asset */
197
+ withId(value: string | TaggedTemplateValue<string>): InfoAssetBuilder {
198
+ return this.set("id", value);
199
+ }
200
+
201
+ /** Sets the title property */
202
+ withTitle(value: Asset | FunctionalBuilder<Asset, BaseBuildContext>): InfoAssetBuilder {
203
+ return this.set("title", value);
204
+ }
205
+
206
+ /** Sets the subtitle property */
207
+ withSubtitle(value: Asset | FunctionalBuilder<Asset, BaseBuildContext>): InfoAssetBuilder {
208
+ return this.set("subtitle", value);
209
+ }
210
+
211
+ /** Sets the primaryInfo property */
212
+ withPrimaryInfo(value: Array<Asset | FunctionalBuilder<Asset, BaseBuildContext>>): InfoAssetBuilder {
213
+ return this.set("primaryInfo", value);
214
+ }
215
+
216
+ /**
217
+ * Builds the final InfoAsset object
218
+ * @param context - Optional build context for nested builders
219
+ */
220
+ build(context?: BaseBuildContext): InfoAsset {
221
+ return this.buildWithDefaults(InfoAssetBuilder.defaults, context);
222
+ }
223
+
224
+ [Symbol.for("nodejs.util.inspect.custom")](): string {
225
+ return createInspectMethod("InfoAssetBuilder", this.values);
226
+ }
227
+ }
228
+
229
+ /**
230
+ * Creates a new InfoAsset builder
231
+ * @param initial Optional initial values
232
+ * @returns A functional builder for InfoAsset
233
+ */
234
+ export function info(initial?: FunctionalPartial<InfoAsset>): InfoAssetBuilder {
235
+ return new InfoAssetBuilder(initial);
236
+ }"
237
+ `;
238
+
239
+ exports[`FunctionalBuilderGenerator > Asset Wrapper (Slot) Types > generates builder for asset with array of AssetWrapper slots 1`] = `
240
+ "import type { CollectionAsset } from "../types/collection-";
241
+ import type { Asset } from "@player-ui/types";
242
+ import { type FunctionalBuilder, type BaseBuildContext, type FunctionalPartial, FunctionalBuilderBase, createInspectMethod, type TaggedTemplateValue } from "@player-lang/functional-dsl";
243
+
244
+ export interface CollectionAssetBuilderMethods {
245
+ /** A unique identifier for this asset */
246
+ withId(value: string | TaggedTemplateValue<string>): CollectionAssetBuilder;
247
+ /** Sets the label property */
248
+ withLabel(value: Asset | FunctionalBuilder<Asset, BaseBuildContext>): CollectionAssetBuilder;
249
+ /** Sets the values property */
250
+ withValues(value: Array<Asset | FunctionalBuilder<Asset, BaseBuildContext>>): CollectionAssetBuilder;
251
+ }
252
+
253
+ /**
254
+ * A builder for CollectionAsset
255
+ */
256
+ export class CollectionAssetBuilder extends FunctionalBuilderBase<CollectionAsset> implements CollectionAssetBuilderMethods, FunctionalBuilder<CollectionAsset, BaseBuildContext> {
257
+ private static readonly defaults: Record<string, unknown> = {"type":"collection","id":""};
258
+ private static readonly __arrayProperties__: ReadonlySet<string> = new Set(["values"]);
259
+ private static readonly __assetWrapperPaths__: ReadonlyArray<ReadonlyArray<string>> = [["label"],["values"]];
260
+
261
+ /** A unique identifier for this asset */
262
+ withId(value: string | TaggedTemplateValue<string>): CollectionAssetBuilder {
263
+ return this.set("id", value);
264
+ }
265
+
266
+ /** Sets the label property */
267
+ withLabel(value: Asset | FunctionalBuilder<Asset, BaseBuildContext>): CollectionAssetBuilder {
268
+ return this.set("label", value);
269
+ }
270
+
271
+ /** Sets the values property */
272
+ withValues(value: Array<Asset | FunctionalBuilder<Asset, BaseBuildContext>>): CollectionAssetBuilder {
273
+ return this.set("values", value);
274
+ }
275
+
276
+ /**
277
+ * Builds the final CollectionAsset object
278
+ * @param context - Optional build context for nested builders
279
+ */
280
+ build(context?: BaseBuildContext): CollectionAsset {
281
+ return this.buildWithDefaults(CollectionAssetBuilder.defaults, context);
282
+ }
283
+
284
+ [Symbol.for("nodejs.util.inspect.custom")](): string {
285
+ return createInspectMethod("CollectionAssetBuilder", this.values);
286
+ }
287
+ }
288
+
289
+ /**
290
+ * Creates a new CollectionAsset builder
291
+ * @param initial Optional initial values
292
+ * @returns A functional builder for CollectionAsset
293
+ */
294
+ export function collection(initial?: FunctionalPartial<CollectionAsset>): CollectionAssetBuilder {
295
+ return new CollectionAssetBuilder(initial);
296
+ }"
297
+ `;
298
+
299
+ exports[`FunctionalBuilderGenerator > Basic Types > generates builder for asset with number and boolean properties 1`] = `
300
+ "import type { CounterAsset } from "../types/counter-";
301
+ import { type FunctionalBuilder, type BaseBuildContext, type FunctionalPartial, FunctionalBuilderBase, createInspectMethod, type TaggedTemplateValue } from "@player-lang/functional-dsl";
302
+
303
+ export interface CounterAssetBuilderMethods {
304
+ /** A unique identifier for this asset */
305
+ withId(value: string | TaggedTemplateValue<string>): CounterAssetBuilder;
306
+ /** Sets the value property */
307
+ withValue(value: number | TaggedTemplateValue<number>): CounterAssetBuilder;
308
+ /** Sets the min property */
309
+ withMin(value: number | TaggedTemplateValue<number>): CounterAssetBuilder;
310
+ /** Sets the max property */
311
+ withMax(value: number | TaggedTemplateValue<number>): CounterAssetBuilder;
312
+ /** Sets the enabled property */
313
+ withEnabled(value: boolean | TaggedTemplateValue<boolean>): CounterAssetBuilder;
314
+ }
315
+
316
+ /**
317
+ * A builder for CounterAsset
318
+ */
319
+ export class CounterAssetBuilder extends FunctionalBuilderBase<CounterAsset> implements CounterAssetBuilderMethods, FunctionalBuilder<CounterAsset, BaseBuildContext> {
320
+ private static readonly defaults: Record<string, unknown> = {"type":"counter","id":"","value":0};
321
+
322
+ /** A unique identifier for this asset */
323
+ withId(value: string | TaggedTemplateValue<string>): CounterAssetBuilder {
324
+ return this.set("id", value);
325
+ }
326
+
327
+ /** Sets the value property */
328
+ withValue(value: number | TaggedTemplateValue<number>): CounterAssetBuilder {
329
+ return this.set("value", value);
330
+ }
331
+
332
+ /** Sets the min property */
333
+ withMin(value: number | TaggedTemplateValue<number>): CounterAssetBuilder {
334
+ return this.set("min", value);
335
+ }
336
+
337
+ /** Sets the max property */
338
+ withMax(value: number | TaggedTemplateValue<number>): CounterAssetBuilder {
339
+ return this.set("max", value);
340
+ }
341
+
342
+ /** Sets the enabled property */
343
+ withEnabled(value: boolean | TaggedTemplateValue<boolean>): CounterAssetBuilder {
344
+ return this.set("enabled", value);
345
+ }
346
+
347
+ /**
348
+ * Builds the final CounterAsset object
349
+ * @param context - Optional build context for nested builders
350
+ */
351
+ build(context?: BaseBuildContext): CounterAsset {
352
+ return this.buildWithDefaults(CounterAssetBuilder.defaults, context);
353
+ }
354
+
355
+ [Symbol.for("nodejs.util.inspect.custom")](): string {
356
+ return createInspectMethod("CounterAssetBuilder", this.values);
357
+ }
358
+ }
359
+
360
+ /**
361
+ * Creates a new CounterAsset builder
362
+ * @param initial Optional initial values
363
+ * @returns A functional builder for CounterAsset
364
+ */
365
+ export function counter(initial?: FunctionalPartial<CounterAsset>): CounterAssetBuilder {
366
+ return new CounterAssetBuilder(initial);
367
+ }"
368
+ `;
369
+
370
+ exports[`FunctionalBuilderGenerator > Basic Types > generates builder for asset with optional properties 1`] = `
371
+ "import type { InputAsset } from "../types/input-";
372
+ import { type FunctionalBuilder, type BaseBuildContext, type FunctionalPartial, FunctionalBuilderBase, createInspectMethod, type TaggedTemplateValue } from "@player-lang/functional-dsl";
373
+
374
+ export interface InputAssetBuilderMethods {
375
+ /** A unique identifier for this asset */
376
+ withId(value: string | TaggedTemplateValue<string>): InputAssetBuilder;
377
+ /** Sets the binding property */
378
+ withBinding(value: string | TaggedTemplateValue<string>): InputAssetBuilder;
379
+ /** Sets the label property */
380
+ withLabel(value: string | TaggedTemplateValue<string>): InputAssetBuilder;
381
+ /** Sets the placeholder property */
382
+ withPlaceholder(value: string | TaggedTemplateValue<string>): InputAssetBuilder;
383
+ }
384
+
385
+ /**
386
+ * A builder for InputAsset
387
+ */
388
+ export class InputAssetBuilder extends FunctionalBuilderBase<InputAsset> implements InputAssetBuilderMethods, FunctionalBuilder<InputAsset, BaseBuildContext> {
389
+ private static readonly defaults: Record<string, unknown> = {"type":"input","id":"","binding":""};
390
+
391
+ /** A unique identifier for this asset */
392
+ withId(value: string | TaggedTemplateValue<string>): InputAssetBuilder {
393
+ return this.set("id", value);
394
+ }
395
+
396
+ /** Sets the binding property */
397
+ withBinding(value: string | TaggedTemplateValue<string>): InputAssetBuilder {
398
+ return this.set("binding", value);
399
+ }
400
+
401
+ /** Sets the label property */
402
+ withLabel(value: string | TaggedTemplateValue<string>): InputAssetBuilder {
403
+ return this.set("label", value);
404
+ }
405
+
406
+ /** Sets the placeholder property */
407
+ withPlaceholder(value: string | TaggedTemplateValue<string>): InputAssetBuilder {
408
+ return this.set("placeholder", value);
409
+ }
410
+
411
+ /**
412
+ * Builds the final InputAsset object
413
+ * @param context - Optional build context for nested builders
414
+ */
415
+ build(context?: BaseBuildContext): InputAsset {
416
+ return this.buildWithDefaults(InputAssetBuilder.defaults, context);
417
+ }
418
+
419
+ [Symbol.for("nodejs.util.inspect.custom")](): string {
420
+ return createInspectMethod("InputAssetBuilder", this.values);
421
+ }
422
+ }
423
+
424
+ /**
425
+ * Creates a new InputAsset builder
426
+ * @param initial Optional initial values
427
+ * @returns A functional builder for InputAsset
428
+ */
429
+ export function input(initial?: FunctionalPartial<InputAsset>): InputAssetBuilder {
430
+ return new InputAssetBuilder(initial);
431
+ }"
432
+ `;
433
+
434
+ exports[`FunctionalBuilderGenerator > Basic Types > generates builder for simple asset with string property 1`] = `
435
+ "import type { TextAsset } from "../types/text-";
436
+ import { type FunctionalBuilder, type BaseBuildContext, type FunctionalPartial, FunctionalBuilderBase, createInspectMethod, type TaggedTemplateValue } from "@player-lang/functional-dsl";
437
+
438
+ export interface TextAssetBuilderMethods {
439
+ /** A unique identifier for this asset */
440
+ withId(value: string | TaggedTemplateValue<string>): TextAssetBuilder;
441
+ /** Sets the value property */
442
+ withValue(value: string | TaggedTemplateValue<string>): TextAssetBuilder;
443
+ }
444
+
445
+ /**
446
+ * A builder for TextAsset
447
+ */
448
+ export class TextAssetBuilder extends FunctionalBuilderBase<TextAsset> implements TextAssetBuilderMethods, FunctionalBuilder<TextAsset, BaseBuildContext> {
449
+ private static readonly defaults: Record<string, unknown> = {"type":"text","id":"","value":""};
450
+
451
+ /** A unique identifier for this asset */
452
+ withId(value: string | TaggedTemplateValue<string>): TextAssetBuilder {
453
+ return this.set("id", value);
454
+ }
455
+
456
+ /** Sets the value property */
457
+ withValue(value: string | TaggedTemplateValue<string>): TextAssetBuilder {
458
+ return this.set("value", value);
459
+ }
460
+
461
+ /**
462
+ * Builds the final TextAsset object
463
+ * @param context - Optional build context for nested builders
464
+ */
465
+ build(context?: BaseBuildContext): TextAsset {
466
+ return this.buildWithDefaults(TextAssetBuilder.defaults, context);
467
+ }
468
+
469
+ [Symbol.for("nodejs.util.inspect.custom")](): string {
470
+ return createInspectMethod("TextAssetBuilder", this.values);
471
+ }
472
+ }
473
+
474
+ /**
475
+ * Creates a new TextAsset builder
476
+ * @param initial Optional initial values
477
+ * @returns A functional builder for TextAsset
478
+ */
479
+ export function text(initial?: FunctionalPartial<TextAsset>): TextAssetBuilder {
480
+ return new TextAssetBuilder(initial);
481
+ }"
482
+ `;
483
+
484
+ exports[`FunctionalBuilderGenerator > Binding and Expression Types > generates builder for asset with Binding property 1`] = `
485
+ "import type { InputAsset } from "../types/input-";
486
+ import { type FunctionalBuilder, type BaseBuildContext, type FunctionalPartial, FunctionalBuilderBase, createInspectMethod, type TaggedTemplateValue } from "@player-lang/functional-dsl";
487
+
488
+ export interface InputAssetBuilderMethods {
489
+ /** A unique identifier for this asset */
490
+ withId(value: string | TaggedTemplateValue<string>): InputAssetBuilder;
491
+ /** Sets the binding property */
492
+ withBinding(value: string | TaggedTemplateValue<string>): InputAssetBuilder;
493
+ /** Sets the label property */
494
+ withLabel(value: string | TaggedTemplateValue<string>): InputAssetBuilder;
495
+ }
496
+
497
+ /**
498
+ * A builder for InputAsset
499
+ */
500
+ export class InputAssetBuilder extends FunctionalBuilderBase<InputAsset> implements InputAssetBuilderMethods, FunctionalBuilder<InputAsset, BaseBuildContext> {
501
+ private static readonly defaults: Record<string, unknown> = {"type":"input","id":"","binding":""};
502
+
503
+ /** A unique identifier for this asset */
504
+ withId(value: string | TaggedTemplateValue<string>): InputAssetBuilder {
505
+ return this.set("id", value);
506
+ }
507
+
508
+ /** Sets the binding property */
509
+ withBinding(value: string | TaggedTemplateValue<string>): InputAssetBuilder {
510
+ return this.set("binding", value);
511
+ }
512
+
513
+ /** Sets the label property */
514
+ withLabel(value: string | TaggedTemplateValue<string>): InputAssetBuilder {
515
+ return this.set("label", value);
516
+ }
517
+
518
+ /**
519
+ * Builds the final InputAsset object
520
+ * @param context - Optional build context for nested builders
521
+ */
522
+ build(context?: BaseBuildContext): InputAsset {
523
+ return this.buildWithDefaults(InputAssetBuilder.defaults, context);
524
+ }
525
+
526
+ [Symbol.for("nodejs.util.inspect.custom")](): string {
527
+ return createInspectMethod("InputAssetBuilder", this.values);
528
+ }
529
+ }
530
+
531
+ /**
532
+ * Creates a new InputAsset builder
533
+ * @param initial Optional initial values
534
+ * @returns A functional builder for InputAsset
535
+ */
536
+ export function input(initial?: FunctionalPartial<InputAsset>): InputAssetBuilder {
537
+ return new InputAssetBuilder(initial);
538
+ }"
539
+ `;
540
+
541
+ exports[`FunctionalBuilderGenerator > Binding and Expression Types > generates builder for asset with Expression property 1`] = `
542
+ "import type { ActionAsset } from "../types/action-";
543
+ import { type FunctionalBuilder, type BaseBuildContext, type FunctionalPartial, FunctionalBuilderBase, createInspectMethod, type TaggedTemplateValue } from "@player-lang/functional-dsl";
544
+
545
+ export interface ActionAssetBuilderMethods {
546
+ /** A unique identifier for this asset */
547
+ withId(value: string | TaggedTemplateValue<string>): ActionAssetBuilder;
548
+ /** Sets the value property */
549
+ withValue(value: string | TaggedTemplateValue<string>): ActionAssetBuilder;
550
+ /** Sets the exp property */
551
+ withExp(value: string | TaggedTemplateValue<string>): ActionAssetBuilder;
552
+ }
553
+
554
+ /**
555
+ * A builder for ActionAsset
556
+ */
557
+ export class ActionAssetBuilder extends FunctionalBuilderBase<ActionAsset> implements ActionAssetBuilderMethods, FunctionalBuilder<ActionAsset, BaseBuildContext> {
558
+ private static readonly defaults: Record<string, unknown> = {"type":"action","id":""};
559
+
560
+ /** A unique identifier for this asset */
561
+ withId(value: string | TaggedTemplateValue<string>): ActionAssetBuilder {
562
+ return this.set("id", value);
563
+ }
564
+
565
+ /** Sets the value property */
566
+ withValue(value: string | TaggedTemplateValue<string>): ActionAssetBuilder {
567
+ return this.set("value", value);
568
+ }
569
+
570
+ /** Sets the exp property */
571
+ withExp(value: string | TaggedTemplateValue<string>): ActionAssetBuilder {
572
+ return this.set("exp", value);
573
+ }
574
+
575
+ /**
576
+ * Builds the final ActionAsset object
577
+ * @param context - Optional build context for nested builders
578
+ */
579
+ build(context?: BaseBuildContext): ActionAsset {
580
+ return this.buildWithDefaults(ActionAssetBuilder.defaults, context);
581
+ }
582
+
583
+ [Symbol.for("nodejs.util.inspect.custom")](): string {
584
+ return createInspectMethod("ActionAssetBuilder", this.values);
585
+ }
586
+ }
587
+
588
+ /**
589
+ * Creates a new ActionAsset builder
590
+ * @param initial Optional initial values
591
+ * @returns A functional builder for ActionAsset
592
+ */
593
+ export function action(initial?: FunctionalPartial<ActionAsset>): ActionAssetBuilder {
594
+ return new ActionAssetBuilder(initial);
595
+ }"
596
+ `;
597
+
598
+ exports[`FunctionalBuilderGenerator > Generic Types > generates builder for asset with generic parameter 1`] = `
599
+ "import type { InputAsset } from "../types/input-";
600
+ import type { Asset } from "@player-ui/types";
601
+ import { type FunctionalBuilder, type BaseBuildContext, type FunctionalPartial, FunctionalBuilderBase, createInspectMethod, type TaggedTemplateValue } from "@player-lang/functional-dsl";
602
+
603
+ export interface InputAssetBuilderMethods<AnyTextAsset extends Asset = Asset> {
604
+ /** A unique identifier for this asset */
605
+ withId(value: string | TaggedTemplateValue<string>): InputAssetBuilder<AnyTextAsset>;
606
+ /** Sets the binding property */
607
+ withBinding(value: string | TaggedTemplateValue<string>): InputAssetBuilder<AnyTextAsset>;
608
+ /** Sets the label property */
609
+ withLabel(value: Asset | FunctionalBuilder<Asset, BaseBuildContext>): InputAssetBuilder<AnyTextAsset>;
610
+ /** Sets the note property */
611
+ withNote(value: Asset | FunctionalBuilder<Asset, BaseBuildContext>): InputAssetBuilder<AnyTextAsset>;
612
+ }
613
+
614
+ /**
615
+ * A builder for InputAsset
616
+ */
617
+ export class InputAssetBuilder<AnyTextAsset extends Asset = Asset> extends FunctionalBuilderBase<InputAsset<AnyTextAsset>> implements InputAssetBuilderMethods<AnyTextAsset>, FunctionalBuilder<InputAsset<AnyTextAsset>, BaseBuildContext> {
618
+ private static readonly defaults: Record<string, unknown> = {"type":"input","id":"","binding":""};
619
+ private static readonly __assetWrapperPaths__: ReadonlyArray<ReadonlyArray<string>> = [["label"],["note"]];
620
+
621
+ /** A unique identifier for this asset */
622
+ withId(value: string | TaggedTemplateValue<string>): InputAssetBuilder<AnyTextAsset> {
623
+ return this.set("id", value);
624
+ }
625
+
626
+ /** Sets the binding property */
627
+ withBinding(value: string | TaggedTemplateValue<string>): InputAssetBuilder<AnyTextAsset> {
628
+ return this.set("binding", value);
629
+ }
630
+
631
+ /** Sets the label property */
632
+ withLabel(value: Asset | FunctionalBuilder<Asset, BaseBuildContext>): InputAssetBuilder<AnyTextAsset> {
633
+ return this.set("label", value);
634
+ }
635
+
636
+ /** Sets the note property */
637
+ withNote(value: Asset | FunctionalBuilder<Asset, BaseBuildContext>): InputAssetBuilder<AnyTextAsset> {
638
+ return this.set("note", value);
639
+ }
640
+
641
+ /**
642
+ * Builds the final InputAsset object
643
+ * @param context - Optional build context for nested builders
644
+ */
645
+ build(context?: BaseBuildContext): InputAsset<AnyTextAsset> {
646
+ return this.buildWithDefaults(InputAssetBuilder.defaults, context);
647
+ }
648
+
649
+ [Symbol.for("nodejs.util.inspect.custom")](): string {
650
+ return createInspectMethod("InputAssetBuilder", this.values);
651
+ }
652
+ }
653
+
654
+ /**
655
+ * Creates a new InputAsset builder
656
+ * @param initial Optional initial values
657
+ * @returns A functional builder for InputAsset
658
+ */
659
+ export function input<AnyTextAsset extends Asset = Asset>(initial?: FunctionalPartial<InputAsset<AnyTextAsset>>): InputAssetBuilder<AnyTextAsset> {
660
+ return new InputAssetBuilder<AnyTextAsset>(initial);
661
+ }"
662
+ `;
663
+
664
+ exports[`FunctionalBuilderGenerator > Nested Object Types > generates builder for asset with named nested type 1`] = `
665
+ "import type { ActionAsset, ActionMetaData } from "../types/action-";
666
+ import type { Asset } from "@player-ui/types";
667
+ import { type FunctionalBuilder, type BaseBuildContext, type FunctionalPartial, FunctionalBuilderBase, createInspectMethod, type TaggedTemplateValue } from "@player-lang/functional-dsl";
668
+
669
+ export interface ActionAssetBuilderMethods {
670
+ /** A unique identifier for this asset */
671
+ withId(value: string | TaggedTemplateValue<string>): ActionAssetBuilder;
672
+ /** Sets the value property */
673
+ withValue(value: string | TaggedTemplateValue<string>): ActionAssetBuilder;
674
+ /** Sets the label property */
675
+ withLabel(value: Asset | FunctionalBuilder<Asset, BaseBuildContext>): ActionAssetBuilder;
676
+ /** Sets the metaData property */
677
+ withMetaData(value: ActionMetaData | FunctionalBuilder<ActionMetaData, BaseBuildContext> | FunctionalPartial<ActionMetaData, BaseBuildContext>): ActionAssetBuilder;
678
+ }
679
+
680
+ /**
681
+ * A builder for ActionAsset
682
+ */
683
+ export class ActionAssetBuilder extends FunctionalBuilderBase<ActionAsset> implements ActionAssetBuilderMethods, FunctionalBuilder<ActionAsset, BaseBuildContext> {
684
+ private static readonly defaults: Record<string, unknown> = {"type":"action","id":""};
685
+ private static readonly __assetWrapperPaths__: ReadonlyArray<ReadonlyArray<string>> = [["label"]];
686
+
687
+ /** A unique identifier for this asset */
688
+ withId(value: string | TaggedTemplateValue<string>): ActionAssetBuilder {
689
+ return this.set("id", value);
690
+ }
691
+
692
+ /** Sets the value property */
693
+ withValue(value: string | TaggedTemplateValue<string>): ActionAssetBuilder {
694
+ return this.set("value", value);
695
+ }
696
+
697
+ /** Sets the label property */
698
+ withLabel(value: Asset | FunctionalBuilder<Asset, BaseBuildContext>): ActionAssetBuilder {
699
+ return this.set("label", value);
700
+ }
701
+
702
+ /** Sets the metaData property */
703
+ withMetaData(value: ActionMetaData | FunctionalBuilder<ActionMetaData, BaseBuildContext> | FunctionalPartial<ActionMetaData, BaseBuildContext>): ActionAssetBuilder {
704
+ return this.set("metaData", value);
705
+ }
706
+
707
+ /**
708
+ * Builds the final ActionAsset object
709
+ * @param context - Optional build context for nested builders
710
+ */
711
+ build(context?: BaseBuildContext): ActionAsset {
712
+ return this.buildWithDefaults(ActionAssetBuilder.defaults, context);
713
+ }
714
+
715
+ [Symbol.for("nodejs.util.inspect.custom")](): string {
716
+ return createInspectMethod("ActionAssetBuilder", this.values);
717
+ }
718
+ }
719
+
720
+ /**
721
+ * Creates a new ActionAsset builder
722
+ * @param initial Optional initial values
723
+ * @returns A functional builder for ActionAsset
724
+ */
725
+ export function action(initial?: FunctionalPartial<ActionAsset>): ActionAssetBuilder {
726
+ return new ActionAssetBuilder(initial);
727
+ }"
728
+ `;
729
+
730
+ exports[`FunctionalBuilderGenerator > Nested Object Types > generates builder for asset with nested object property 1`] = `
731
+ "import type { ActionAsset } from "../types/action-";
732
+ import { type FunctionalBuilder, type BaseBuildContext, type FunctionalPartial, FunctionalBuilderBase, createInspectMethod, type TaggedTemplateValue } from "@player-lang/functional-dsl";
733
+
734
+ export interface ActionAssetBuilderMethods {
735
+ /** A unique identifier for this asset */
736
+ withId(value: string | TaggedTemplateValue<string>): ActionAssetBuilder;
737
+ /** Sets the value property */
738
+ withValue(value: string | TaggedTemplateValue<string>): ActionAssetBuilder;
739
+ /** Sets the confirmation property */
740
+ withConfirmation(value: { message: string | TaggedTemplateValue<string>; affirmativeLabel: string | TaggedTemplateValue<string>; negativeLabel?: string | TaggedTemplateValue<string> } | FunctionalBuilder<{ message: string | TaggedTemplateValue<string>; affirmativeLabel: string | TaggedTemplateValue<string>; negativeLabel?: string | TaggedTemplateValue<string> }, BaseBuildContext> | FunctionalPartial<{ message: string | TaggedTemplateValue<string>; affirmativeLabel: string | TaggedTemplateValue<string>; negativeLabel?: string | TaggedTemplateValue<string> }, BaseBuildContext>): ActionAssetBuilder;
741
+ }
742
+
743
+ /**
744
+ * A builder for ActionAsset
745
+ */
746
+ export class ActionAssetBuilder extends FunctionalBuilderBase<ActionAsset> implements ActionAssetBuilderMethods, FunctionalBuilder<ActionAsset, BaseBuildContext> {
747
+ private static readonly defaults: Record<string, unknown> = {"type":"action","id":""};
748
+
749
+ /** A unique identifier for this asset */
750
+ withId(value: string | TaggedTemplateValue<string>): ActionAssetBuilder {
751
+ return this.set("id", value);
752
+ }
753
+
754
+ /** Sets the value property */
755
+ withValue(value: string | TaggedTemplateValue<string>): ActionAssetBuilder {
756
+ return this.set("value", value);
757
+ }
758
+
759
+ /** Sets the confirmation property */
760
+ withConfirmation(value: { message: string | TaggedTemplateValue<string>; affirmativeLabel: string | TaggedTemplateValue<string>; negativeLabel?: string | TaggedTemplateValue<string> } | FunctionalBuilder<{ message: string | TaggedTemplateValue<string>; affirmativeLabel: string | TaggedTemplateValue<string>; negativeLabel?: string | TaggedTemplateValue<string> }, BaseBuildContext> | FunctionalPartial<{ message: string | TaggedTemplateValue<string>; affirmativeLabel: string | TaggedTemplateValue<string>; negativeLabel?: string | TaggedTemplateValue<string> }, BaseBuildContext>): ActionAssetBuilder {
761
+ return this.set("confirmation", value);
762
+ }
763
+
764
+ /**
765
+ * Builds the final ActionAsset object
766
+ * @param context - Optional build context for nested builders
767
+ */
768
+ build(context?: BaseBuildContext): ActionAsset {
769
+ return this.buildWithDefaults(ActionAssetBuilder.defaults, context);
770
+ }
771
+
772
+ [Symbol.for("nodejs.util.inspect.custom")](): string {
773
+ return createInspectMethod("ActionAssetBuilder", this.values);
774
+ }
775
+ }
776
+
777
+ /**
778
+ * Creates a new ActionAsset builder
779
+ * @param initial Optional initial values
780
+ * @returns A functional builder for ActionAsset
781
+ */
782
+ export function action(initial?: FunctionalPartial<ActionAsset>): ActionAssetBuilder {
783
+ return new ActionAssetBuilder(initial);
784
+ }"
785
+ `;
786
+
787
+ exports[`FunctionalBuilderGenerator > Union Types > generates builder for asset with discriminated union modifiers 1`] = `
788
+ "import type { CollectionAsset, CalloutModifier, TagModifier } from "../types/collection-";
789
+ import { type FunctionalBuilder, type BaseBuildContext, type FunctionalPartial, FunctionalBuilderBase, createInspectMethod, type TaggedTemplateValue } from "@player-lang/functional-dsl";
790
+
791
+ export interface CollectionAssetBuilderMethods {
792
+ /** A unique identifier for this asset */
793
+ withId(value: string | TaggedTemplateValue<string>): CollectionAssetBuilder;
794
+ /** Sets the modifiers property */
795
+ withModifiers(value: Array<CalloutModifier | FunctionalBuilder<CalloutModifier, BaseBuildContext> | FunctionalPartial<CalloutModifier, BaseBuildContext> | TagModifier | FunctionalBuilder<TagModifier, BaseBuildContext> | FunctionalPartial<TagModifier, BaseBuildContext>>): CollectionAssetBuilder;
796
+ }
797
+
798
+ /**
799
+ * A builder for CollectionAsset
800
+ */
801
+ export class CollectionAssetBuilder extends FunctionalBuilderBase<CollectionAsset> implements CollectionAssetBuilderMethods, FunctionalBuilder<CollectionAsset, BaseBuildContext> {
802
+ private static readonly defaults: Record<string, unknown> = {"type":"collection","id":""};
803
+ private static readonly __arrayProperties__: ReadonlySet<string> = new Set(["modifiers"]);
804
+
805
+ /** A unique identifier for this asset */
806
+ withId(value: string | TaggedTemplateValue<string>): CollectionAssetBuilder {
807
+ return this.set("id", value);
808
+ }
809
+
810
+ /** Sets the modifiers property */
811
+ withModifiers(value: Array<CalloutModifier | FunctionalBuilder<CalloutModifier, BaseBuildContext> | FunctionalPartial<CalloutModifier, BaseBuildContext> | TagModifier | FunctionalBuilder<TagModifier, BaseBuildContext> | FunctionalPartial<TagModifier, BaseBuildContext>>): CollectionAssetBuilder {
812
+ return this.set("modifiers", value);
813
+ }
814
+
815
+ /**
816
+ * Builds the final CollectionAsset object
817
+ * @param context - Optional build context for nested builders
818
+ */
819
+ build(context?: BaseBuildContext): CollectionAsset {
820
+ return this.buildWithDefaults(CollectionAssetBuilder.defaults, context);
821
+ }
822
+
823
+ [Symbol.for("nodejs.util.inspect.custom")](): string {
824
+ return createInspectMethod("CollectionAssetBuilder", this.values);
825
+ }
826
+ }
827
+
828
+ /**
829
+ * Creates a new CollectionAsset builder
830
+ * @param initial Optional initial values
831
+ * @returns A functional builder for CollectionAsset
832
+ */
833
+ export function collection(initial?: FunctionalPartial<CollectionAsset>): CollectionAssetBuilder {
834
+ return new CollectionAssetBuilder(initial);
835
+ }"
836
+ `;
837
+
838
+ exports[`FunctionalBuilderGenerator > Union Types > generates builder for asset with union property 1`] = `
839
+ "import type { ActionAsset } from "../types/action-";
840
+ import { type FunctionalBuilder, type BaseBuildContext, type FunctionalPartial, FunctionalBuilderBase, createInspectMethod, type TaggedTemplateValue } from "@player-lang/functional-dsl";
841
+
842
+ export interface ActionAssetBuilderMethods {
843
+ /** A unique identifier for this asset */
844
+ withId(value: string | TaggedTemplateValue<string>): ActionAssetBuilder;
845
+ /** Sets the size property */
846
+ withSize(value: "small" | "medium" | "large"): ActionAssetBuilder;
847
+ }
848
+
849
+ /**
850
+ * A builder for ActionAsset
851
+ */
852
+ export class ActionAssetBuilder extends FunctionalBuilderBase<ActionAsset> implements ActionAssetBuilderMethods, FunctionalBuilder<ActionAsset, BaseBuildContext> {
853
+ private static readonly defaults: Record<string, unknown> = {"type":"action","id":""};
854
+
855
+ /** A unique identifier for this asset */
856
+ withId(value: string | TaggedTemplateValue<string>): ActionAssetBuilder {
857
+ return this.set("id", value);
858
+ }
859
+
860
+ /** Sets the size property */
861
+ withSize(value: "small" | "medium" | "large"): ActionAssetBuilder {
862
+ return this.set("size", value);
863
+ }
864
+
865
+ /**
866
+ * Builds the final ActionAsset object
867
+ * @param context - Optional build context for nested builders
868
+ */
869
+ build(context?: BaseBuildContext): ActionAsset {
870
+ return this.buildWithDefaults(ActionAssetBuilder.defaults, context);
871
+ }
872
+
873
+ [Symbol.for("nodejs.util.inspect.custom")](): string {
874
+ return createInspectMethod("ActionAssetBuilder", this.values);
875
+ }
876
+ }
877
+
878
+ /**
879
+ * Creates a new ActionAsset builder
880
+ * @param initial Optional initial values
881
+ * @returns A functional builder for ActionAsset
882
+ */
883
+ export function action(initial?: FunctionalPartial<ActionAsset>): ActionAssetBuilder {
884
+ return new ActionAssetBuilder(initial);
885
+ }"
886
+ `;