@nemmtor/ts-databuilders 0.0.1-alpha.1 → 0.0.1-alpha.11

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 (3) hide show
  1. package/README.md +483 -10
  2. package/dist/main.js +7 -4
  3. package/package.json +26 -12
package/README.md CHANGED
@@ -1,14 +1,487 @@
1
1
  # 🧱 TS DataBuilders
2
- DataBuilder Generator is a lightweight CLI tool that automatically generates builder classes from annotated TypeScript types.
3
- Just add a @DataBuilder JSDoc tag, run one command, and get a fully-typed builder ready to use in your tests or factories.
2
+ Automatically generate type-safe builder classes from your TypeScript types to write cleaner, more focused tests.
4
3
 
5
- Built with [Effect](https://effect.website/).
4
+ ## Installation
5
+ Install the package:
6
+ ```bash
7
+ # npm
8
+ npm install -D @nemmtor/ts-databuilders
6
9
 
7
- [Read about TS DataBuilders.](http://www.natpryce.com/articles/000714.html)
10
+ # pnpm
11
+ pnpm add -D @nemmtor/ts-databuilders
8
12
 
9
- ## 🚀 Features
10
- - 🔍 Scans your repo for specific pattern to understand what builders to build
11
- - ⚡ Generates builder classes with fluent withX() methods and sensible defaults
12
- - 🧩 Type-safe — builders are generated directly from your TypeScript types
13
- - 🧠 Fast and Memory-efficient — processes files asynchronously and incrementally via streams
14
- - 🛠️ Pluggable works with any TypeScript project layout
13
+ # yarn
14
+ yarn add -D @nemmtor/ts-databuilders
15
+ ```
16
+
17
+ ## Configuration
18
+ Configuration is optional - it fallbacks to sensible defaults.
19
+
20
+ ### Configure via CLI flags (optional):
21
+ ```bash
22
+ pnpm ts-databuilders --include "src/**/*.ts{,x}" --output-dir src/__generated__ --jsdoc-tag DataBuilder
23
+ ```
24
+ You can also provide configuration by going through interactive wizard:
25
+ ```bash
26
+ pnpm ts-databuilders --wizard
27
+ ```
28
+
29
+ ### Configure via config file (optional)
30
+ Ts-databuilders will try to find config file `ts-databuilders.json` in the root of your repository.
31
+ Config file is optional.
32
+
33
+ Example of default config file:
34
+ ```json
35
+ {
36
+ "$schema": "https://raw.githubusercontent.com/nemmtor/ts-databuilders/refs/heads/main/schema.json",
37
+ "jsdocTag": "DataBuilder",
38
+ "inlineDefaultJsdocTag": "DataBuilderDefault",
39
+ "withNestedBuilders": true,
40
+ "outputDir": "generated/builders",
41
+ "include": "src/**/*.ts{,x}",
42
+ "fileSuffix": ".builder",
43
+ "builderSuffix": "Builder",
44
+ "defaults": {
45
+ "string": "",
46
+ "number": 0,
47
+ "boolean": false
48
+ }
49
+ }
50
+ ```
51
+
52
+ You can generate a default configuration file by running `init` command:
53
+ ```bash
54
+ pnpm ts-databuilders init
55
+ ```
56
+ You can also generate it by providing values step by step in an interactive wizard:
57
+ ```bash
58
+ pnpm ts-databuilders init --wizard
59
+ ```
60
+
61
+
62
+ ### Options Reference
63
+
64
+ | Name (in config file) | Flag (cli flags) | Description | Default |
65
+ |---------------|-------------------------------------------------------|-----------------------------------------|----------------------|
66
+ | jsdocTag | `--jsdoc-tag` | JSDoc tag to mark types for generation | `DataBuilder` |
67
+ | inlineDefaultJsdocTag | `--inline-default-jsdoc-tag` | JSDoc tag used to set default value of given field | `DataBuilderDefault` |
68
+ | withNestedBuilders | `--with-nested-builders` | When set to true ts-databuilders will use nested builders approach | `true` |
69
+ | outputDir | `--output-dir -o` | Output directory for generated builders | `generated/builders` |
70
+ | include | `--include -i` | Glob pattern for source files | `src/**/*.ts{,x}` |
71
+ | fileSuffix | `--file-suffix` | File suffix for builder files | `.builder` |
72
+ | builderSuffix | `--builder-suffix` | Class name suffix | `Builder` |
73
+ | defaults | `--default-string --default-number --default-boolean` | Default values for primitives | See example above |
74
+
75
+ **Priority:** CLI flags > Config file > Built-in defaults
76
+
77
+ #### Debugging
78
+ In order to turn on debug logs pass a flag: `--log-level debug`.
79
+
80
+ ## Quick Start
81
+ **1. Annotate your types with JSDoc:**
82
+ ```ts
83
+ /**
84
+ * @DataBuilder
85
+ */
86
+ type User = {
87
+ id: string;
88
+ email: string;
89
+ name: string;
90
+ isActive: boolean;
91
+ }
92
+ ```
93
+ **2. Generate builders:**
94
+ ```bash
95
+ pnpm ts-databuilders
96
+ ```
97
+ For the `User` type above, you'll get:
98
+ ```ts
99
+ import type { User } from "...";
100
+ import { DataBuilder } from "./data-builder";
101
+
102
+ export class UserBuilder extends DataBuilder<User> {
103
+ constructor() {
104
+ super({
105
+ id: "",
106
+ email: "",
107
+ name: "",
108
+ isActive: false
109
+ });
110
+ }
111
+
112
+ withId(id: User['id']) {
113
+ return this.with({ id });
114
+ }
115
+
116
+ withEmail(email: User['email']) {
117
+ return this.with({ email });
118
+ }
119
+
120
+ withName(name: User['name']) {
121
+ return this.with({ name });
122
+ }
123
+
124
+ withIsActive(isActive: User['isActive']) {
125
+ return this.with({ isActive });
126
+ }
127
+ }
128
+ ```
129
+
130
+ **3. Use in your tests:**
131
+ ```ts
132
+ import { UserBuilder } from '...';
133
+
134
+ const testUser = new UserBuilder()
135
+ .withEmail('test@example.com')
136
+ .withIsActive(false)
137
+ .build();
138
+ ```
139
+
140
+ ## Why?
141
+ Tests often become cluttered with boilerplate when you need to create complex objects just to test one specific field. DataBuilders let you focus on what matters:
142
+ Imagine testing a case where document aggregate should emit an event when it successfully update it's content:
143
+ ```ts
144
+ it('should emit a ContentUpdatedEvent', () => {
145
+ const aggregate = DocumentAggregate.create({
146
+ id: '1',
147
+ createdAt: new Date(),
148
+ updatedAt: new Date(),
149
+ content: 'old-content'
150
+ });
151
+ const userId = '1';
152
+
153
+ aggregate.updateContent({ updatedBy: userId, content: 'new-content' });
154
+
155
+ expect(...);
156
+ })
157
+ ```
158
+ Above code is obfuscated with all of the default values you need to provide in order to satisfy typescript.
159
+ Where in reality the only thing specific to this single test is the fact that some new content was provided to `updateContent` method.
160
+
161
+ Imagine even more complex scenario:
162
+ ```tsx
163
+ it('should show validation error when email is invalid', async () => {
164
+ render(<ProfileForm defaultValues={{
165
+ firstName: '',
166
+ lastName: '',
167
+ age: 0,
168
+ socials: {
169
+ linkedin: '',
170
+ github: '',
171
+ website: '',
172
+ twitter: '',
173
+ },
174
+ address: {
175
+ street: '',
176
+ city: '',
177
+ state: '',
178
+ zip: '',
179
+ },
180
+ skills: [],
181
+ bio: '',
182
+ email: 'invalid-email'
183
+ }}
184
+ />)
185
+
186
+ await submitForm();
187
+
188
+ expect(...);
189
+ })
190
+ ```
191
+ Again - in reality you should only be worried about email, not about whole form data.
192
+
193
+ Here's how above tests could be written with databuilders:
194
+ ```ts
195
+ it('should emit a ContentUpdatedEvent', () => {
196
+ const aggregate = DocumentAggregate.create(
197
+ new CreateDocumentAggregatedPayloadBuilder().build()
198
+ );
199
+
200
+ aggregate.updateContent(
201
+ new UpdateDocumentContentPayloadBuilder().withContent('new-content').build()
202
+ );
203
+
204
+ expect(...);
205
+ })
206
+ ```
207
+
208
+ ```tsx
209
+ it('should show validation error when email is invalid', async () => {
210
+ render(<ProfileForm defaultValues={
211
+ new ProfileFormInputBuilder.withEmail('invalid-email').build()} />
212
+ )
213
+
214
+ await submitForm();
215
+
216
+ expect(...);
217
+ })
218
+ ```
219
+
220
+ This not only makes the test code less verbose but also highlights what is really being tested.
221
+
222
+ **Why not use AI for that?** While AI can generate test data, ts-databuilders is fast, free and deterministic.
223
+
224
+ [Read more about data builders.](http://www.natpryce.com/articles/000714.html)
225
+
226
+ ## Nested Builders
227
+ > [!NOTE]
228
+ > Nested builders can be turned off by using withNestedBuilders option. Check configuration section for more details.
229
+
230
+ When your types contain complex nested objects, you can annotate their type definitions and TS DataBuilders will automatically generate nested builders, allowing you to compose them fluently.
231
+ ### Example
232
+
233
+ **Input types:**
234
+ ```ts
235
+ /**
236
+ * @DataBuilder
237
+ */
238
+ export type User = {
239
+ name: string;
240
+ address: Address;
241
+ };
242
+
243
+ /**
244
+ * @DataBuilder
245
+ */
246
+ export type Address = {
247
+ street: string;
248
+ city: string;
249
+ country: string;
250
+ };
251
+ ```
252
+ **Generated builders:**
253
+ ```ts
254
+ export class UserBuilder extends DataBuilder<User> {
255
+ constructor() {
256
+ super({
257
+ name: "",
258
+ address: new AddressBuilder().build();
259
+ });
260
+ }
261
+
262
+ withName(name: User['name']) {
263
+ return this.with({ name });
264
+ }
265
+
266
+ withAddress(address: DataBuilder<User['address']>) {
267
+ return this.with({ address: address.build() });
268
+ }
269
+ }
270
+
271
+ export class AddressBuilder extends DataBuilder<Address> {
272
+ constructor() {
273
+ super({
274
+ street: "",
275
+ city: "",
276
+ country: ""
277
+ });
278
+ }
279
+
280
+ withStreet(street: Address['street']) {
281
+ return this.with({ street });
282
+ }
283
+
284
+ withCity(city: Address['city']) {
285
+ return this.with({ city });
286
+ }
287
+
288
+ withCountry(country: Address['country']) {
289
+ return this.with({ country });
290
+ }
291
+ }
292
+ ```
293
+ **Usage:**
294
+ ```ts
295
+ // ✅ Compose builders fluently
296
+ const user = new UserBuilder()
297
+ .withName('John Doe')
298
+ .withAddress(
299
+ new AddressBuilder()
300
+ .withStreet('123 Main St')
301
+ .withCity('New York')
302
+ )
303
+ .build();
304
+ // {..., address: { street: "123 Main st", city: "New York", country: "" } }
305
+
306
+ // ✅ Use default values
307
+ const userWithDefaultAddress = new UserBuilder().build();
308
+ // {..., address: { street: "", city: "", country: "" } }
309
+
310
+ // ✅ Override just one nested field
311
+ const userWithCity = new UserBuilder()
312
+ .withAddress(
313
+ new AddressBuilder()
314
+ .withCity('San Francisco')
315
+ )
316
+ .build();
317
+ // {..., address: { street: "", city: "San Francisco", country: "" } }
318
+ ```
319
+
320
+ ## Inline Default Values
321
+ > [!NOTE]
322
+ > It's your responsibility to provide inline default value that satisfies expected type.
323
+
324
+ While global defaults work well for most cases, sometimes you need field-specific default values. This is especially important for specialized string types like ISO dates, UUIDs etc.
325
+
326
+ ```typescript
327
+ /** @DataBuilder */
328
+ type Order = {
329
+ id: string; // Empty string - won't work as UUID
330
+ createdAt: string; // Empty string - Invalid Date!
331
+ }
332
+
333
+ // Generated:
334
+ constructor() {
335
+ super({
336
+ id: "",
337
+ createdAt: "", // new Date("") = Invalid Date
338
+ });
339
+ }
340
+ ```
341
+
342
+ Use `@DataBuilderDefault` JSDoc tag to override defaults per field:
343
+ ```typescript
344
+ /** @DataBuilder */
345
+ type Order = {
346
+ /** @DataBuilderDefault '550e8400-e29b-41d4-a716-446655440000' */
347
+ id: string;
348
+
349
+ /** @DataBuilderDefault '2025-11-05T15:32:58.727Z' */
350
+ createdAt: string;
351
+ }
352
+
353
+ // Generated:
354
+ constructor() {
355
+ super({
356
+ id: '550e8400-e29b-41d4-a716-446655440000',
357
+ createdAt: '2025-11-05T15:32:58.727Z',
358
+ });
359
+ }
360
+ ```
361
+
362
+ ## Supported Types
363
+
364
+ The library supports a wide range of TypeScript type features:
365
+
366
+ ✅ **Primitives & Built-ins**
367
+ - `string`, `number`, `boolean`, `Date`
368
+ - Literal types: `'active' | 'inactive'`, `1 | 2 | 3`
369
+
370
+ ✅ **Complex Structures**
371
+ - Objects and nested objects
372
+ - Arrays: `string[]`, `Array<number>`
373
+ - Tuples: `[string, number]`
374
+ - Records: `Record<string, string>` `Record<'foo' | 'bar', string>`
375
+
376
+ ✅ **Type Operations**
377
+ - Unions: `string | number | true | false`
378
+ - Intersections: `A & B`
379
+ - Utility types: `Pick<T, K>`, `Omit<T, K>`, `Partial<T>`, `Required<T>`, `Readonly<T>`, `Extract<T, U>`, `NonNullable<T>`
380
+ - Branded types: `type UserId = string & { __brand: 'UserId' }`
381
+
382
+ ✅ **References**
383
+ - Type references from the same file
384
+ - Type references from other files
385
+ - External library types (e.g., `z.infer<typeof schema>`)
386
+
387
+ **For a comprehensive example** of supported types, check out the [example-data/bar.ts](https://github.com/nemmtor/ts-databuilders/blob/main/example-data/bar.ts) file in the repository. This file is used during development and demonstrates complex real-world type scenarios.
388
+
389
+ ## Important Rules & Limitations
390
+
391
+ ### Unique Builder Names
392
+ Each type annotated with the JSDoc tag must have a **unique name** across your codebase:
393
+ ```ts
394
+ // ❌ Error: Duplicate builder names
395
+ // In file-a.ts
396
+ /** @DataBuilder */
397
+ export type User = { name: string };
398
+
399
+ // In file-b.ts
400
+ /** @DataBuilder */
401
+ export type User = { email: string }; // 💥 Duplicate!
402
+ ```
403
+
404
+ ### Exported Types Only
405
+ Types must be **exported** to generate builders:
406
+ ```ts
407
+ // ❌ Won't work
408
+ /** @DataBuilder */
409
+ type User = { name: string };
410
+
411
+ // ✅ Works
412
+ /** @DataBuilder */
413
+ export type User = { name: string };
414
+ ```
415
+
416
+ ### Type Aliases Only
417
+ Currently, only **type aliases** are supported as root builder types. Interfaces, classes etc. are not supported:
418
+ ```ts
419
+ // ❌ Not supported
420
+ /** @DataBuilder */
421
+ export interface User {
422
+ name: string;
423
+ }
424
+
425
+ // ❌ Not supported
426
+ /** @DataBuilder */
427
+ export class User {
428
+ name: string;
429
+ }
430
+
431
+ // ✅ Supported
432
+ /** @DataBuilder */
433
+ export type User = {
434
+ name: string;
435
+ };
436
+ ```
437
+
438
+ ### Unsupported TypeScript Features
439
+
440
+ Some TypeScript features are not yet supported and will cause generation errors:
441
+
442
+ - **Recursive types**: Types that reference themselves
443
+ ```ts
444
+ // ❌ Not supported
445
+ type TreeNode = {
446
+ value: string;
447
+ children: TreeNode[]; // Self-reference
448
+ };
449
+ ```
450
+
451
+ - **Function types**: Properties that are functions
452
+ ```ts
453
+ // ❌ Not supported
454
+ type WithCallback = {
455
+ onSave: (data: string) => void;
456
+ };
457
+ ```
458
+
459
+ - typeof, keyof, any, unknown, bigint, symbol
460
+
461
+ ### Alpha Stage
462
+ ⚠️ **This library is in active development**
463
+
464
+ - Breaking changes may occur
465
+ - Not all edge cases are covered yet
466
+ - Test thoroughly before using in production
467
+
468
+ **Found an issue?** Please [report it on GitHub](https://github.com/nemmtor/ts-databuilders/issues) with:
469
+ - A minimal reproducible example (if possible)
470
+ - The type definition causing the issue
471
+ - The error message received
472
+ - Your `ts-databuilders.json` config and any provided CLI flags (if applicable)
473
+
474
+ You can also turn on debug logs by passing `--log-level debug` flag.
475
+
476
+ Your feedback helps improve the library for everyone! 🙏
477
+
478
+ ## Similar Projects
479
+ - [effect-builder](https://github.com/slashlifeai/effect-builder) - a runtime library for building objects with Effect Schema validation.
480
+
481
+ ## Contributing
482
+
483
+ Contributions welcome! Please open an issue or PR on [GitHub](https://github.com/nemmtor/ts-databuilders).
484
+
485
+ ## License
486
+
487
+ MIT © [nemmtor](https://github.com/nemmtor)
package/dist/main.js CHANGED
@@ -1,8 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import*as Le from"@effect/platform-node/NodeContext";import*as Pe from"@effect/platform-node/NodeRuntime";import{Effect as Qe}from"effect";import*as F from"@effect/cli/Command";import*as G from"effect/Layer";import*as he from"@effect/platform/FileSystem";import*as N from"effect/Effect";import*as le from"effect/Context";import*as M from"effect/Schema";var me={string:"",number:0,boolean:!1},de=M.Struct({string:M.String,number:M.NumberFromString,boolean:M.BooleanFromString});class b extends le.Tag("Configuration")(){}import Z from"node:path";import*as ue from"@effect/platform/FileSystem";import*as $ from"effect/Effect";import*as S from"effect/Match";import{Project as Oe}from"ts-morph";var H=(o)=>o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z])([A-Z][a-z])/g,"$1-$2").replace(/_/g,"-").toLowerCase(),ne=(o)=>{return o.split(/[-_\s]+/).flatMap((p)=>p.split(/(?=[A-Z])/)).filter(Boolean).map((p)=>p.charAt(0).toUpperCase()+p.slice(1).toLowerCase()).join("")},oe=(o)=>{return o.split(/[-_\s]+/).flatMap((i)=>i.split(/(?=[A-Z])/)).filter(Boolean).map((i,e)=>{let s=i.toLowerCase();return e===0?s:s.charAt(0).toUpperCase()+s.slice(1)}).join("")};var pe=(o)=>{let{fieldName:p,optional:i,typeName:e,isNestedBuilder:s}=o,r=p.replaceAll("'","").replaceAll('"',""),m=oe(r),n=`with${ne(r)}`,c=[`return this.with({ ${p}: ${m} });`],t=[`return this.with({ ${p}: ${m}.build() });`],a=s?t:c,u=[`if (!${m}) {`,` const { "${r}": _unused, ...rest } = this.build();`," return this.with(rest);","}"],h=i?[...u,...a]:a,f=`${e}['${r}']`;return{name:n,isPublic:!0,parameters:[{name:m,type:s?`DataBuilder<${f}>`:f}],statements:h}};class J extends $.Service()("@TSDataBuilders/BuilderGenerator",{effect:$.gen(function*(){let o=yield*ue.FileSystem,{outputDir:p,fileSuffix:i,builderSuffix:e,defaults:s}=yield*b,r=(m)=>S.value(m).pipe(S.when({kind:"STRING"},()=>`"${s.string}"`),S.when({kind:"NUMBER"},()=>s.number),S.when({kind:"BOOLEAN"},()=>s.boolean),S.when({kind:"UNDEFINED"},()=>"undefined"),S.when({kind:"DATE"},()=>"new Date()"),S.when({kind:"ARRAY"},()=>"[]"),S.when({kind:"LITERAL"},(n)=>n.literalValue),S.when({kind:"TYPE_CAST"},(n)=>r(n.baseTypeMetadata)),S.when({kind:"TUPLE"},(n)=>{return`[${n.members.map((t)=>r(t)).map((t)=>`${t}`).join(", ")}]`}),S.when({kind:"TYPE_LITERAL"},(n)=>{return`{${Object.entries(n.metadata).filter(([t,{optional:a}])=>!a).map(([t,a])=>`${t}: ${r(a)}`).join(", ")}}`}),S.when({kind:"RECORD"},(n)=>{if(n.keyType.kind==="STRING"||n.keyType.kind==="NUMBER")return"{}";let c=r(n.keyType),t=r(n.valueType);return`{${c}: ${t}}`}),S.when({kind:"UNION"},(n)=>{let t=n.members.slice().sort((a,u)=>{let h=fe.indexOf(a.kind),f=fe.indexOf(u.kind);return(h===-1?1/0:h)-(f===-1?1/0:f)})[0];if(!t)return"never";return r(t)}),S.when({kind:"BUILDER"},(n)=>{return`new ${n.name}${e}().build()`}),S.exhaustive);return{generateBaseBuilder:$.fnUntraced(function*(){let m=Z.resolve(p,"data-builder.ts");yield*o.writeFileString(m,_e)}),generateBuilder:$.fnUntraced(function*(m){let n=new Oe,c=m.name,t=Z.resolve(p,`${H(c)}${i}.ts`),a=n.createSourceFile(t,"",{overwrite:!0}),u=Z.resolve(m.path),h=Z.relative(Z.dirname(t),u).replace(/\.ts$/,"");if(a.addImportDeclaration({namedImports:[c],isTypeOnly:!0,moduleSpecifier:h}),a.addImportDeclaration({namedImports:["DataBuilder"],moduleSpecifier:"./data-builder"}),m.shape.kind!=="TYPE_LITERAL")return yield*$.dieMessage("[BuilderGenerator]: Expected root type to be type literal");[...new Set(je(m.shape.metadata))].forEach((T)=>{a.addImportDeclaration({namedImports:[`${T}${e}`],moduleSpecifier:`./${H(T)}${i}`})});let x=Object.entries(m.shape.metadata).filter(([T,{optional:k}])=>!k).map(([T,k])=>`${T}: ${k.kind==="TYPE_CAST"?`${r(k)} as ${c}['${T}']`:r(k)}`),C=Object.entries(m.shape.metadata).map(([T,{optional:k,kind:L}])=>pe({fieldName:T,optional:k,typeName:c,isNestedBuilder:L==="BUILDER"})),w=`{
3
- ${x.join(`,
2
+ import*as dt from"@effect/platform-node/NodeContext";import*as lt from"@effect/platform-node/NodeRuntime";import*as ft from"effect/Effect";import*as ut from"effect/Layer";import*as pt from"effect/Logger";import*as mt from"effect/LogLevel";import*as G from"@effect/cli/Command";import*as s from"@effect/cli/Options";import*as ee from"effect/Layer";import{Project as bt}from"ts-morph";import*as Oe from"@effect/platform/FileSystem";import*as be from"@effect/platform/Path";import*as m from"effect/Effect";import*as w from"effect/Match";import*as Je from"effect/Option";import*as re from"effect/Schema";import*as Ee from"@effect/platform/FileSystem";import*as $e from"@effect/platform/Path";import*as Ue from"effect/Context";import*as O from"effect/Effect";import*as I from"effect/Option";import*as i from"effect/Schema";var C={jsdocTag:"JSDoc tag used to mark types for data building generation.",inlineDefaultJsdocTag:"JSDoc tag used to set default value of given field.",withNestedbuilders:"When set to true ts-databuilders will use nested builders approach.",outputDir:"Output directory for generated builders.",include:"Glob pattern for files included while searching for jsdoc tag.",fileSuffix:"File suffix for created builder files.",builderSuffix:"Suffix for generated classes.",defaults:"Default values to be used in data builder constructor.",defaultString:"Default string value to be used in data builder constructor.",defaultNumber:"Default number value to be used in data builder constructor.",defaultBoolean:"Default boolean value to be used in data builder constructor."};import*as fe from"effect/Effect";var B=class extends fe.Service()("@TSDataBuilders/Process",{succeed:{cwd:fe.sync(()=>process.cwd())}}){};var yt=e=>e!==void 0,ne=e=>Object.fromEntries(Object.entries(e).filter(([n,c])=>yt(c)));var Ne="ts-databuilders.json",Tt=i.Struct({jsdocTag:i.NonEmptyTrimmedString,inlineDefaultJsdocTag:i.NonEmptyTrimmedString,withNestedBuilders:i.Boolean,outputDir:i.NonEmptyTrimmedString,include:i.NonEmptyTrimmedString,fileSuffix:i.NonEmptyTrimmedString,builderSuffix:i.NonEmptyTrimmedString,defaults:i.Struct({string:i.String,number:i.Number,boolean:i.Boolean})}),_=Tt.make({jsdocTag:"DataBuilder",inlineDefaultJsdocTag:"DataBuilderDefault",withNestedBuilders:!0,outputDir:"generated/builders",include:"src/**/*.ts{,x}",fileSuffix:".builder",builderSuffix:"Builder",defaults:{string:"",number:0,boolean:!1}}),Ce=i.Struct({$schema:i.optional(i.String),jsdocTag:i.String.pipe(i.annotations({description:C.jsdocTag})),inlineDefaultJsdocTag:i.String.pipe(i.annotations({description:C.inlineDefaultJsdocTag})),withNestedBuilders:i.Boolean.pipe(i.annotations({description:C.withNestedbuilders})),outputDir:i.String.pipe(i.annotations({description:C.outputDir})),include:i.String.pipe(i.annotations({description:C.include})),fileSuffix:i.String.pipe(i.annotations({description:C.fileSuffix})),builderSuffix:i.String.pipe(i.annotations({description:C.builderSuffix})),defaults:i.Struct({string:i.String.pipe(i.annotations({description:C.defaultString})),number:i.Number.pipe(i.annotations({description:C.defaultNumber})),boolean:i.Boolean.pipe(i.annotations({description:C.defaultBoolean}))}).pipe(i.partial,i.annotations({description:C.defaults}))}).pipe(i.partial),R=class extends Ue.Tag("Configuration")(){},K=i.Struct({jsdocTag:i.NonEmptyTrimmedString,inlineDefaultJsdocTag:i.NonEmptyTrimmedString,withNestedBuilders:i.BooleanFromString,outputDir:i.NonEmptyTrimmedString,include:i.NonEmptyTrimmedString,fileSuffix:i.NonEmptyTrimmedString,builderSuffix:i.NonEmptyTrimmedString,defaultString:i.String,defaultNumber:i.NumberFromString,defaultBoolean:i.BooleanFromString}),ve=e=>O.gen(function*(){yield*O.logDebug("[Configuration]: Loading configuration");let c=yield*(yield*B).cwd,d=(yield*$e.Path).join(c,Ne),a=yield*Nt(d),T=yield*ht({fromCLI:e,fromConfigFile:a});return R.of(T)}),ht=e=>O.gen(function*(){let n=Et(e),c=I.flatMap(e.fromConfigFile,T=>I.fromNullable(T.defaults)).pipe(I.map(T=>ne(T)),I.getOrElse(()=>({}))),f=ne({string:e.fromCLI.defaultString.pipe(I.getOrUndefined),number:e.fromCLI.defaultNumber.pipe(I.getOrUndefined),boolean:e.fromCLI.defaultBoolean.pipe(I.getOrUndefined)}),d={...c,...f},a={builderSuffix:yield*n("builderSuffix"),include:yield*n("include"),withNestedBuilders:yield*n("withNestedBuilders"),fileSuffix:yield*n("fileSuffix"),jsdocTag:yield*n("jsdocTag"),inlineDefaultJsdocTag:yield*n("inlineDefaultJsdocTag"),outputDir:yield*n("outputDir"),defaults:{..._.defaults,...d}};return yield*O.logDebug(`[Configuration]: Resolving config with value: ${JSON.stringify(a,null,4)}`),a}),Et=e=>n=>e.fromCLI[n].pipe(O.orElse(()=>I.flatMap(e.fromConfigFile,c=>I.fromNullable(c[n]))),O.orElseSucceed(()=>_[n])),Nt=e=>O.gen(function*(){let n=yield*Ee.FileSystem;if(yield*O.orDie(n.exists(e))){yield*O.logDebug("[Configuration]: Found config file - attempting to read it");let f=yield*Ct(e),d=yield*i.decodeUnknown(Ce)(f);return I.some(d)}else return yield*O.logDebug("[Configuration]: No config file found"),I.none()}),Ct=e=>O.gen(function*(){let n=yield*Ee.FileSystem,c=yield*O.orDie(n.readFileString(e));return yield*O.try({try:()=>JSON.parse(c),catch:f=>`[FileSystem] Unable to read and parse JSON file from '${e}': ${String(f)}`})}).pipe(O.orDie);import*as M from"effect/Schema";var De=M.transform(M.String,M.String.pipe(M.brand("KebabCase")),{decode:e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z])([A-Z][a-z])/g,"$1-$2").replace(/_/g,"-").toLowerCase(),encode:e=>e}),je=M.transform(M.String,M.String.pipe(M.brand("PascalCase")),{decode:e=>e.split(/[-_\s]+/).flatMap(n=>n.split(/(?=[A-Z])/)).filter(Boolean).map(n=>n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()).join(""),encode:e=>e}),Ge=M.transform(M.String,M.String.pipe(M.brand("CamelCase")),{decode:e=>e.split(/[-_\s]+/).flatMap(n=>n.split(/(?=[A-Z])/)).filter(Boolean).map((n,c)=>{let f=n.toLowerCase();return c===0?f:f.charAt(0).toUpperCase()+f.slice(1)}).join(""),encode:e=>e});import{randomUUID as Ot}from"crypto";import*as ue from"effect/Effect";var V=class extends ue.Service()("@TSDataBuilders/IdGenerator",{succeed:{generateUuid:ue.sync(()=>Ot())}}){};var pe=class extends m.Service()("@TSDataBuilders/BuilderGenerator",{effect:m.gen(function*(){let n=yield*Oe.FileSystem,c=yield*be.Path,f=yield*B,d=yield*R,a=yield*V,{fileSuffix:T,builderSuffix:g,defaults:h}=d,l=r=>Je.getOrUndefined(r.inlineDefault)??w.value(r).pipe(w.when({kind:"STRING"},()=>`"${h.string}"`),w.when({kind:"NUMBER"},()=>h.number),w.when({kind:"BOOLEAN"},()=>h.boolean),w.when({kind:"UNDEFINED"},()=>"undefined"),w.when({kind:"NULL"},()=>"null"),w.when({kind:"DATE"},()=>"new Date()"),w.when({kind:"ARRAY"},()=>"[]"),w.when({kind:"LITERAL"},o=>o.literalValue),w.when({kind:"TYPE_CAST"},o=>l(o.baseTypeMetadata)),w.when({kind:"TUPLE"},o=>`[${o.members.map(p=>l(p)).map(p=>`${p}`).join(", ")}]`),w.when({kind:"TYPE_LITERAL"},o=>`{${Object.entries(o.metadata).filter(([p,{optional:b}])=>!b).map(([p,b])=>`${p}: ${l(b)}`).join(", ")}}`),w.when({kind:"RECORD"},o=>{if(o.keyType.kind==="STRING"||o.keyType.kind==="NUMBER")return"{}";let u=l(o.keyType),p=l(o.valueType);return`{${u}: ${p}}`}),w.when({kind:"UNION"},o=>{let p=o.members.slice().sort((b,S)=>{let N=Ke.indexOf(b.kind),P=Ke.indexOf(S.kind);return(N===-1?1/0:N)-(P===-1?1/0:P)})[0];return p?l(p):"never"}),w.when({kind:"BUILDER"},o=>`new ${o.name}${g}().build()`),w.exhaustive);return{generateBaseBuilder:m.fnUntraced(function*(){let r=c.join(yield*f.cwd,d.outputDir),o=c.resolve(r,"data-builder.ts");yield*m.logDebug(`[Builders]: Creating base builder at ${o}`),yield*m.orDie(n.writeFileString(o,`${wt}
3
+ `))}),generateBuilder:m.fnUntraced(function*(r){let o=new bt,u=r.name;yield*m.logDebug(`[Builders]: Creating builder for ${u}`);let p=c.join(yield*f.cwd,d.outputDir),b=c.resolve(p,`${yield*De.pipe(re.decode)(u)}${T}.ts`);yield*m.logDebug(`[Builders]: Creating builder content for ${u}`);let S=o.createSourceFile(`__temp_${yield*a.generateUuid}.ts`,"",{overwrite:!0}),N=c.resolve(r.path),P=c.relative(c.dirname(b),N).replace(/\.ts$/,"");if(S.addImportDeclaration({namedImports:[u],isTypeOnly:!0,moduleSpecifier:P}),S.addImportDeclaration({namedImports:["DataBuilder"],moduleSpecifier:"./data-builder"}),r.shape.kind!=="TYPE_LITERAL")return yield*m.dieMessage("[BuilderGenerator]: Expected root type to be type literal");let x=[...new Set(xt(r.shape.metadata))];yield*m.forEach(x,A=>De.pipe(re.decode)(A).pipe(m.andThen(F=>S.addImportDeclaration({namedImports:[`${A}${g}`],moduleSpecifier:`./${F}${T}`}))),{concurrency:"unbounded"});let D=Object.entries(r.shape.metadata).filter(([A,{optional:F}])=>!F).map(([A,F])=>`${A}: ${F.kind==="TYPE_CAST"?`${l(F)} as ${u}['${A}']`:l(F)}`),$=yield*m.all(Object.entries(r.shape.metadata).map(([A,{optional:F,kind:te}])=>It({fieldName:A,optional:F,typeName:u,isNestedBuilder:te==="BUILDER"})),{concurrency:"unbounded"}),W=`{
4
+ ${D.join(`,
4
5
  `)}
5
- }`;a.addClass({name:`${c}${e}`,isExported:!0,extends:`DataBuilder<${c}>`,methods:[{name:"constructor",statements:[`super(${w});`]},...C]}),a.saveSync()})}})}){}var fe=["UNDEFINED","BOOLEAN","NUMBER","STRING","DATE","LITERAL","TYPE_LITERAL","ARRAY","TUPLE","RECORD"],_e=`export abstract class DataBuilder<T> {
6
+ }`;S.addClass({name:`${u}${g}`,isExported:!0,extends:`DataBuilder<${u}>`,methods:[{name:"constructor",statements:[`super(${W});`]},...$]}),yield*m.logDebug(`[Builders]: Saving builder content at ${b}`),yield*n.writeFileString(b,`${S.getText()}
7
+ `)})}}),dependencies:[V.Default]}){},Ke=["UNDEFINED","BOOLEAN","NUMBER","STRING","DATE","LITERAL","TYPE_LITERAL","ARRAY","TUPLE","RECORD"],wt=`export abstract class DataBuilder<T> {
6
8
  private data: T;
7
9
 
8
10
  constructor(initialData: T) {
@@ -18,4 +20,5 @@ import*as Le from"@effect/platform-node/NodeContext";import*as Pe from"@effect/p
18
20
  return this;
19
21
  }
20
22
  }
21
- `;function je(o){let p=[];function i(e){switch(e.kind){case"BUILDER":p.push(e.name);break;case"TYPE_LITERAL":Object.values(e.metadata).forEach(i);break;case"UNION":case"TUPLE":e.members.forEach(i);break;case"RECORD":i(e.keyType),i(e.valueType);break}}return Object.values(o).forEach(i),p}class P extends N.Service()("@TSDataBuilders/Builders",{effect:N.gen(function*(){let o=yield*he.FileSystem,p=yield*J,{outputDir:i}=yield*b;return{create:N.fnUntraced(function*(e){if(yield*o.exists(i))yield*o.remove(i,{recursive:!0});yield*o.makeDirectory(i,{recursive:!0}),yield*p.generateBaseBuilder();let r=e.map((c)=>c.name),m=r.filter((c,t)=>r.indexOf(c)!==t),n=[...new Set(m)];if(m.length>0)return yield*N.dieMessage(`Duplicated builders: ${n.join(", ")}`);yield*N.all(e.map((c)=>p.generateBuilder(c)),{concurrency:"unbounded"})})}}),dependencies:[J.Default]}){}import*as d from"@effect/cli/Options";import*as R from"effect/HashMap";import*as Q from"effect/Option";import*as B from"effect/Schema";var ve=d.text("jsdocTag").pipe(d.withDescription("JSDoc tag used to mark types for data building generation."),d.withSchema(B.NonEmptyTrimmedString),d.withDefault("DataBuilder")),We=d.text("output-dir").pipe(d.withAlias("o"),d.withDescription("Output directory for generated builders."),d.withSchema(B.NonEmptyTrimmedString),d.withDefault("generated/builders")),Ye=d.text("include").pipe(d.withAlias("i"),d.withDescription("Glob pattern for files included while searching for jsdoc tag."),d.withSchema(B.NonEmptyTrimmedString),d.withDefault("src/**/*.ts{,x}")),Ge=d.text("file-suffix").pipe(d.withDescription("File suffix for created builder files."),d.withSchema(B.NonEmptyTrimmedString),d.withDefault(".builder")),Ze=d.text("builder-suffix").pipe(d.withDescription("Suffix for generated classes."),d.withSchema(B.NonEmptyTrimmedString),d.withDefault("Builder")),ze=d.keyValueMap("defaults").pipe(d.withDescription("Default values to be used in data builder constructor."),d.withSchema(B.HashMapFromSelf({key:B.Literal("string","number","boolean"),value:B.String}).pipe(B.transform(de,{decode:(o)=>{return{string:o.pipe(R.get("string"),Q.getOrElse(()=>"")),number:o.pipe(R.get("number"),Q.getOrElse(()=>"0")),boolean:o.pipe(R.get("boolean"),Q.getOrElse(()=>"false"))}},encode:(o)=>{return R.make(["string",o.string],["number",o.number],["boolean",o.boolean])},strict:!1}))),d.withDefault(me)),ye={jsdocTag:ve,outputDir:We,include:Ye,fileSuffix:Ge,builderSuffix:Ze,defaults:ze};import*as I from"effect/Chunk";import*as D from"effect/Effect";import*as Te from"effect/Function";import*as _ from"effect/Option";import*as ee from"effect/Stream";import*as Ee from"effect/Data";import*as ge from"effect/Effect";import*as Se from"effect/Stream";import{glob as Ke}from"glob";class U extends ge.Service()("@TSDataBuilders/TreeWalker",{succeed:{walk:(o)=>{return Se.fromAsyncIterable(Ke.stream(o,{cwd:".",nodir:!0}),(p)=>new ie({cause:p}))}}}){}class ie extends Ee.TaggedError("TreeWalkerError"){}import{FileSystem as Ve}from"@effect/platform";import*as O from"effect/Effect";import*as A from"effect/Stream";class X extends O.Service()("@TSDataBuilders/FileContentChecker",{effect:O.gen(function*(){let o=yield*Ve.FileSystem,p=new TextDecoder;return{check:O.fnUntraced(function*(i){let{content:e,filePath:s}=i;return yield*o.stream(s,{chunkSize:16384}).pipe(A.map((n)=>p.decode(n,{stream:!0})),A.mapAccum("",(n,c)=>{let t=n+c;return[t.slice(-e.length+1),t.includes(e)]}),A.find(Boolean),A.runCollect)})}})}){}class j extends D.Service()("@TSDataBuilders/Finder",{effect:D.gen(function*(){let o=yield*X,{include:p,jsdocTag:i}=yield*b,e=`@${i}`;return{find:D.fnUntraced(function*(){return yield*(yield*U).walk(p).pipe(ee.mapEffect((n)=>o.check({filePath:n,content:e}).pipe(D.map(I.map((c)=>c?_.some(n):_.none()))),{concurrency:"unbounded"}),ee.runCollect,D.map(I.flatMap(Te.identity)),D.map(I.filter((n)=>_.isSome(n))),D.map(I.map((n)=>n.value)))})}}),dependencies:[X.Default]}){}import*as Be from"@effect/platform/FileSystem";import*as v from"effect/Data";import*as E from"effect/Effect";import*as V from"effect/Either";import{Project as He,SyntaxKind as re}from"ts-morph";import{randomUUID as Ce}from"node:crypto";import*as K from"effect/Data";import*as l from"effect/Effect";import*as y from"effect/Match";import*as ke from"effect/Option";import{Node as qe,SyntaxKind as g}from"ts-morph";class te extends l.Service()("@TSDataBuilders/TypeNodeParser",{effect:l.gen(function*(){let{jsdocTag:o}=yield*b,p=(e)=>l.gen(function*(){let{node:s,optional:r}=e,m=s.getType(),n=m.getProperties();if(m.isObject()&&n.length>0){let c={};for(let t of n){let a=t.getName(),u=t.getTypeAtLocation(s),h=t.isOptional(),x=s.getProject().createSourceFile(`__temp_${Ce()}.ts`,`type __T = ${u.getText()}`,{overwrite:!0}).getTypeAliasOrThrow("__T").getTypeNodeOrThrow(),C=yield*l.suspend(()=>i({typeNode:x,optional:h}));c[a]=C}return{kind:"TYPE_LITERAL",metadata:c,optional:r}}return yield*new be({raw:m.getText(),kind:s.getKind()})}),i=(e)=>l.gen(function*(){let{typeNode:s,optional:r}=e,m=s.getKind(),n=y.value(m).pipe(y.when(y.is(g.StringKeyword),()=>l.succeed({kind:"STRING",optional:r})),y.when(y.is(g.NumberKeyword),()=>l.succeed({kind:"NUMBER",optional:r})),y.when(y.is(g.BooleanKeyword),()=>l.succeed({kind:"BOOLEAN",optional:r})),y.when((t)=>t===g.UndefinedKeyword,()=>l.succeed({kind:"UNDEFINED",optional:r})),y.when((t)=>t===g.ArrayType,()=>l.succeed({kind:"ARRAY",optional:r})),y.when((t)=>t===g.LiteralType,()=>l.succeed({kind:"LITERAL",literalValue:s.asKindOrThrow(g.LiteralType).getLiteral().getText(),optional:r})),y.when((t)=>t===g.TypeLiteral,()=>l.gen(function*(){let a=s.asKindOrThrow(g.TypeLiteral).getMembers();return{kind:"TYPE_LITERAL",metadata:yield*l.reduce(a,{},(h,f)=>l.gen(function*(){if(!f.isKind(g.PropertySignature))return h;let x=f.getTypeNode();if(!x)return h;let C=f.getNameNode().getText(),w=f.hasQuestionToken(),T=yield*l.suspend(()=>i({typeNode:x,optional:w}));return{...h,[C]:T}})),optional:r}})),y.when(y.is(g.ImportType),()=>l.gen(function*(){let t=s.asKindOrThrow(g.ImportType),a=t.getType(),u=a.getSymbol();if(!u)throw Error("TODO: missing symbol");let h=u.getDeclarations();if(h&&h.length>1)return yield*new se;let[f]=h;if(!f)return yield*new ce;let x=u.getJsDocTags().map((C)=>C.getName()).includes(o);if(a.isObject()){let C=a.getProperties();if(C.length>0){let w={};for(let T of C){let k=T.getName(),L=T.getTypeAtLocation(t),ae=T.isOptional(),q=t.getProject().createSourceFile(`__temp_${Ce()}.ts`,`type __T = ${L.getText()}`,{overwrite:!0}),Re=q.getTypeAliasOrThrow("__T").getTypeNodeOrThrow(),Ue=yield*l.suspend(()=>i({typeNode:Re,optional:ae}));w[k]=Ue,t.getProject().removeSourceFile(q)}return{kind:"TYPE_LITERAL",metadata:w,optional:r}}}return yield*new z({kind:m,raw:s.getText()})})),y.when(y.is(g.TupleType),()=>l.gen(function*(){let a=s.asKindOrThrow(g.TupleType).getElements(),u=yield*l.all(a.map((h)=>l.suspend(()=>i({typeNode:h,optional:!1}))));return{kind:"TUPLE",optional:r,members:u}})),y.when(y.is(g.TypeReference),()=>l.gen(function*(){let t=s.asKindOrThrow(g.TypeReference),a=t.getTypeName().getText();if(a==="Date")return{kind:"DATE",optional:r};let u=t.getTypeArguments();if(a==="Record"){let[k,L]=u;if(!k||!L)return yield*new z({kind:m,raw:s.getText()});let ae=yield*l.suspend(()=>i({typeNode:k,optional:!1})),q=yield*l.suspend(()=>i({typeNode:L,optional:!1}));return{kind:"RECORD",keyType:ae,valueType:q,optional:r}}if(a==="Array")return{kind:"ARRAY",optional:r};if(["Pick","Omit","Partial","Required","Readonly","Extract","NonNullable"].includes(a))return yield*p({node:t,optional:r});let f=t.getType().getAliasSymbol();if(!f)return yield*p({node:t,optional:r});let x=f.getDeclarations();if(x&&x.length>1)return yield*new se;let[C]=x;if(!C)return yield*new ce;let w=f?.getJsDocTags().map((k)=>k.getName()).includes(o);if(!qe.isTypeAliasDeclaration(C))throw Error("TODO: for non-type-alias declarations (interfaces, etc.)");let T=C.getTypeNode();if(!T)return yield*new z({kind:m,raw:s.getText()});if(!w)return yield*l.suspend(()=>i({typeNode:T,optional:r}));return{kind:"BUILDER",name:C.getName(),optional:r}})),y.when(y.is(g.UnionType),()=>l.gen(function*(){let t=yield*l.all(s.asKindOrThrow(g.UnionType).getTypeNodes().map((a)=>l.suspend(()=>i({typeNode:a,optional:!1}))));return{kind:"UNION",optional:r,members:t}})),y.when(y.is(g.IntersectionType),()=>l.gen(function*(){let a=s.asKindOrThrow(g.IntersectionType).getTypeNodes(),u=[g.StringKeyword,g.NumberKeyword,g.BooleanKeyword],h=a.find((f)=>u.includes(f.getKind()));if(h&&a.length>1)return{kind:"TYPE_CAST",baseTypeMetadata:yield*l.suspend(()=>i({typeNode:h,optional:!1})),optional:r};throw Error("TODO: handle it")})),y.option);if(ke.isNone(n))return yield*new z({kind:m,raw:s.getText()});return yield*n.value});return{generateMetadata:i}})}){}class z extends K.TaggedError("UnsupportedSyntaxKindError"){}class se extends K.TaggedError("MultipleSymbolDeclarationsError"){}class ce extends K.TaggedError("MissingSymbolDeclarationError"){}class be extends K.TaggedError("CannotBuildTypeReferenceMetadata"){}class W extends E.Service()("@TSDataBuilders/Parser",{effect:E.gen(function*(){let o=yield*Be.FileSystem,p=yield*te,{jsdocTag:i}=yield*b;return{generateBuildersMetadata:E.fnUntraced(function*(e){let s=yield*o.readFileString(e),r=yield*E.try({try:()=>{return new He().createSourceFile(e,s,{overwrite:!0}).getTypeAliases().filter((u)=>u.getJsDocs().flatMap((h)=>h.getTags().flatMap((f)=>f.getTagName())).includes(i)).map((u)=>{let h=u.getName();if(!u.isExported())return V.left(new De({path:e,typeName:h}));let f=u.getTypeNode();if(!(f?.isKind(re.TypeLiteral)||f?.isKind(re.TypeReference)))return V.left(new Ne({path:e,typeName:u.getName()}));return V.right({name:u.getName(),node:f})}).filter(Boolean)},catch:(c)=>new xe({cause:c})}),m=yield*E.all(r.map((c)=>c));return yield*E.all(m.map(({name:c,node:t})=>p.generateMetadata({typeNode:t,optional:!1}).pipe(E.map((a)=>({name:c,shape:a,path:e})),E.catchTags({UnsupportedSyntaxKindError:(a)=>E.fail(new $e({kind:a.kind,raw:a.raw,path:e,typeName:c})),CannotBuildTypeReferenceMetadata:(a)=>E.fail(new we({kind:a.kind,raw:a.raw,path:e,typeName:c}))}))))},E.catchTags({ParserError:(e)=>E.die(e),UnexportedDatabuilderError:(e)=>E.dieMessage(`[Parser]: Unexported databuilder ${e.typeName} at ${e.path}`),RichUnsupportedSyntaxKindError:(e)=>E.dieMessage(`[Parser]: Unsupported syntax kind of id: ${e.kind} with raw type: ${e.raw} found in type ${e.typeName} in file ${e.path}`),RichCannotBuildTypeReferenceMetadata:(e)=>E.dieMessage(`[Parser]: Cannot build type reference metadata with kind of id: ${e.kind} with raw type: ${e.raw} found in type ${e.typeName} in file ${e.path}. Is it a root of databuilder?`),UnsupportedBuilderTypeError:(e)=>E.dieMessage(`[Parser]: Unsupported builder type ${e.typeName} in file ${e.path}.`)}))}}),dependencies:[te.Default]}){}class xe extends v.TaggedError("ParserError"){}class De extends v.TaggedError("UnexportedDatabuilderError"){}class Ne extends v.TaggedError("UnsupportedBuilderTypeError"){}class $e extends v.TaggedError("RichUnsupportedSyntaxKindError"){}class we extends v.TaggedError("RichCannotBuildTypeReferenceMetadata"){}import*as Me from"effect/Chunk";import*as Y from"effect/Effect";import*as Ae from"effect/Function";var Fe=Y.gen(function*(){let o=yield*j,p=yield*W,i=yield*P,e=yield*o.find(),s=yield*Y.all(Me.map(e,(r)=>p.generateBuildersMetadata(r)),{concurrency:"unbounded"}).pipe(Y.map((r)=>r.flatMap(Ae.identity)));if(s.length===0)return;yield*i.create(s)});var Je=F.make("ts-databuilders",ye),Ie=Je.pipe(F.withHandler(()=>Fe),F.provide((o)=>G.mergeAll(j.Default,W.Default,P.Default,U.Default).pipe(G.provide(G.succeed(b,b.of(o))))),F.run({name:"Typescript Databuilders generator",version:"v0.0.1"}));Ie(process.argv).pipe(Qe.provide(Le.layer),Pe.runMain);
23
+ `;function xt(e){let n=[];function c(f){switch(f.kind){case"BUILDER":n.push(f.name);break;case"TYPE_LITERAL":Object.values(f.metadata).forEach(c);break;case"UNION":case"TUPLE":f.members.forEach(c);break;case"RECORD":c(f.keyType),c(f.valueType);break}}return Object.values(e).forEach(c),n}var It=e=>m.gen(function*(){let{fieldName:n,optional:c,typeName:f,isNestedBuilder:d}=e,a=n.replaceAll("'","").replaceAll('"',""),T=yield*Ge.pipe(re.decode)(a),g=`with${yield*je.pipe(re.decode)(a)}`,h=[`return this.with({ ${n}: ${T} });`],l=[`return this.with({ ${n}: ${T}.build() });`],r=d?l:h,o=[`if (!${T}) {`,` const { "${a}": _unused, ...rest } = this.build();`," return this.with(rest);","}"],u=c?[...o,...r]:r,p=`${f}['${a}']`;return{name:g,isPublic:!0,parameters:[{name:T,type:d?`DataBuilder<${p}>`:p}],statements:u}}),z=class extends m.Service()("@TSDataBuilders/BuildersGenerator",{effect:m.gen(function*(){let n=yield*Oe.FileSystem,c=yield*pe,f=yield*B,d=yield*be.Path,a=yield*R;return{create:m.fnUntraced(function*(T){let g=d.join(yield*f.cwd,a.outputDir);(yield*m.orDie(n.exists(g)))&&(yield*m.logDebug(`[Builders]: Removing already existing output directory at ${g}`),yield*m.orDie(n.remove(g,{recursive:!0}))),yield*m.logDebug(`[Builders]: Creating output directory at ${g}`),yield*m.orDie(n.makeDirectory(g,{recursive:!0})),yield*c.generateBaseBuilder();let l=T.map(u=>u.name),r=l.filter((u,p)=>l.indexOf(u)!==p),o=[...new Set(r)];if(r.length>0)return yield*m.dieMessage(`Duplicated builders: ${o.join(", ")}`);yield*m.all(T.map(u=>c.generateBuilder(u)),{concurrency:"unbounded"})})}}),dependencies:[pe.Default]}){};import*as We from"@effect/platform/FileSystem";import*as Ve from"@effect/platform/Path";import*as Ze from"effect/Effect";import*as U from"effect/Option";import*as ze from"effect/Schema";var qe=e=>Ze.gen(function*(){let n=yield*B,c=yield*We.FileSystem,f=yield*n.cwd,a=(yield*Ve.Path).join(f,Ne),T=ne({string:e.defaultString.pipe(U.getOrUndefined),number:e.defaultNumber.pipe(U.getOrUndefined),boolean:e.defaultBoolean.pipe(U.getOrUndefined)}),g=yield*ze.decode(Ce)({$schema:"https://raw.githubusercontent.com/nemmtor/ts-databuilders/refs/heads/main/schema.json",builderSuffix:e.builderSuffix.pipe(U.getOrElse(()=>_.builderSuffix)),fileSuffix:e.fileSuffix.pipe(U.getOrElse(()=>_.fileSuffix)),include:e.include.pipe(U.getOrElse(()=>_.include)),jsdocTag:e.jsdocTag.pipe(U.getOrElse(()=>_.jsdocTag)),inlineDefaultJsdocTag:e.inlineDefaultJsdocTag.pipe(U.getOrElse(()=>_.inlineDefaultJsdocTag)),withNestedBuilders:e.withNestedBuilders.pipe(U.getOrElse(()=>_.withNestedBuilders)),outputDir:e.outputDir.pipe(U.getOrElse(()=>_.outputDir)),defaults:{..._.defaults,...T}});yield*c.writeFileString(a,`${JSON.stringify(g,null,2)}
24
+ `)});import*as H from"effect/Chunk";import*as k from"effect/Effect";import*as ge from"effect/Option";import*as Se from"effect/Stream";import*as He from"@effect/platform/FileSystem";import*as Qe from"effect/Chunk";import*as J from"effect/Effect";import*as v from"effect/Stream";var ae=class extends J.Service()("@TSDataBuilders/FileContentChecker",{effect:J.gen(function*(){let n=yield*He.FileSystem,c=new TextDecoder;return{check:J.fnUntraced(function*(f){let{content:d,filePath:a}=f;return yield*J.logDebug(`[FileContentChecker](${a}): Checking file content`),yield*v.orDie(n.stream(a,{chunkSize:16*1024})).pipe(v.map(h=>c.decode(h,{stream:!0})),v.mapAccum("",(h,l)=>{let r=h+l;return[r.slice(-d.length+1),r.includes(d)]}),v.find(h=>!!h),v.tap(()=>J.logDebug(`[FileContentChecker](${a}): found expected content`)),v.runCollect,J.map(h=>h.pipe(Qe.get(0))))})}})}){};import*as Xe from"effect/Data";import*as Z from"effect/Effect";import*as et from"effect/Stream";import{glob as Ft}from"glob";import*as me from"effect/Effect";var se=class extends me.Service()("@TSDataBuilders/Glob",{succeed:{iterate:n=>me.sync(()=>Ft.iterate(n.path,{cwd:n.cwd,nodir:!0}))}}){};var ce=class extends Z.Service()("@TSDataBuilders/TreeWalker",{effect:Z.gen(function*(){let n=yield*se,c=yield*B;return{walk:Z.fnUntraced(function*(f){let d=yield*c.cwd;return yield*Z.logDebug(`[TreeWalker]: Walking path: ${d}/${f}`),et.fromAsyncIterable(yield*n.iterate({path:f,cwd:d}),a=>new we({cause:a}))})}}),dependencies:[se.Default]}){},we=class extends Xe.TaggedError("TreeWalkerError"){};var q=class extends k.Service()("@TSDataBuilders/Finder",{effect:k.gen(function*(){let n=yield*ae,c=yield*ce,{include:f,jsdocTag:d}=yield*R,a=`@${d}`;return{find:k.gen(function*(){yield*k.logDebug("[Finder]: Attempting to find files with builders");let g=yield*(yield*c.walk(f)).pipe(Se.mapEffect(h=>n.check({filePath:h,content:a}).pipe(k.map(l=>l.pipe(ge.map(()=>h)))),{concurrency:"unbounded"}),Se.runCollect,k.map(H.filter(h=>ge.isSome(h))),k.map(H.map(h=>h.value)));return yield*k.logDebug(`[Finder]: Found builders in files: ${g.pipe(H.toArray).join(", ")}`),g}).pipe(k.catchTag("TreeWalkerError",T=>k.die(T)))}}),dependencies:[ce.Default,ae.Default]}){};import{Node as At,Project as Bt,SyntaxKind as E}from"ts-morph";import*as it from"@effect/platform/FileSystem";import*as Y from"effect/Data";import*as t from"effect/Effect";import*as de from"effect/Either";import*as y from"effect/Match";import*as j from"effect/Option";var ye=class extends t.Service()("@TSDataBuilders/TypeNodeParser",{effect:t.gen(function*(){let{jsdocTag:n,inlineDefaultJsdocTag:c,withNestedBuilders:f}=yield*R,d=yield*V,a=t.fnUntraced(function*(h){let l=h.getJsDocs();for(let r of l){let u=r.getTags().find(p=>p.getTagName()===c);if(u){let p=u.getComment();if(typeof p=="string")return j.some(p.trim())}}return j.none()}),T=t.fnUntraced(function*(h){let{type:l,contextNode:r,optional:o,inlineDefault:u}=h,p=l.getProperties();if(!l.isObject()||p.length===0)return yield*new Ie({raw:l.getText(),kind:r.getKind()});let b={};for(let S of p){let N=S.getName(),P=S.getTypeAtLocation(r),x=S.isOptional(),D=r.getProject().createSourceFile(`__temp_${yield*d.generateUuid}.ts`,`type __T = ${P.getText()}`,{overwrite:!0}),$=D.getTypeAliasOrThrow("__T").getTypeNodeOrThrow(),W=yield*t.suspend(()=>g({typeNode:$,optional:x,inlineDefault:j.none()}));b[N]=W,r.getProject().removeSourceFile(D)}return{kind:"TYPE_LITERAL",metadata:b,inlineDefault:u,optional:o}}),g=h=>t.gen(function*(){let{typeNode:l,optional:r,inlineDefault:o}=h,u=l.getKind(),p=y.value(u).pipe(y.when(y.is(E.StringKeyword),()=>t.succeed({kind:"STRING",inlineDefault:o,optional:r})),y.when(y.is(E.NumberKeyword),()=>t.succeed({kind:"NUMBER",inlineDefault:o,optional:r})),y.when(y.is(E.BooleanKeyword),()=>t.succeed({kind:"BOOLEAN",inlineDefault:o,optional:r})),y.when(y.is(E.UndefinedKeyword),()=>t.succeed({kind:"UNDEFINED",inlineDefault:o,optional:r})),y.when(y.is(E.ArrayType),()=>t.succeed({kind:"ARRAY",inlineDefault:o,optional:r})),y.when(y.is(E.LiteralType),()=>{let S=l.asKindOrThrow(E.LiteralType).getLiteral().getText();return S==="null"?t.succeed({kind:"NULL",inlineDefault:o,optional:r}):t.succeed({kind:"LITERAL",inlineDefault:o,literalValue:S,optional:r})}),y.when(y.is(E.TypeLiteral),()=>t.gen(function*(){let N=l.asKindOrThrow(E.TypeLiteral).getMembers(),P=yield*t.reduce(N,{},(x,D)=>t.gen(function*(){if(!D.isKind(E.PropertySignature))return x;let $=D.getTypeNode();if(!$)return x;let W=D.getNameNode().getText(),A=D.hasQuestionToken(),F=yield*a(D),te=yield*t.suspend(()=>g({typeNode:$,optional:A,inlineDefault:F}));return{...x,[W]:te}}));return{kind:"TYPE_LITERAL",inlineDefault:o,metadata:P,optional:r}})),y.when(y.is(E.ImportType),()=>t.gen(function*(){let S=l.asKindOrThrow(E.ImportType),N=S.getType(),P=N.getSymbol(),x=N.getText();if(!P)return yield*new Me({raw:x});let D=P.getDeclarations();if(D&&D.length>1)return yield*new he({raw:x});let[$]=D;return $?yield*T({type:N,contextNode:S,inlineDefault:o,optional:r}):yield*new Te({raw:x})})),y.when(y.is(E.TupleType),()=>t.gen(function*(){let N=l.asKindOrThrow(E.TupleType).getElements(),P=yield*t.all(N.map(x=>t.suspend(()=>g({typeNode:x,optional:!1,inlineDefault:j.none()}))),{concurrency:"unbounded"});return{kind:"TUPLE",inlineDefault:o,optional:r,members:P}})),y.when(y.is(E.TypeReference),()=>t.gen(function*(){let S=l.asKindOrThrow(E.TypeReference),N=S.getTypeName().getText();if(N==="Date")return{kind:"DATE",optional:r,inlineDefault:o};if(N==="Array")return{kind:"ARRAY",optional:r,inlineDefault:o};let P=S.getTypeArguments();if(N==="Record"){let[le,Be]=P;if(!le||!Be)return yield*new Q({kind:u,raw:l.getText()});let gt=yield*t.suspend(()=>g({typeNode:le,optional:!1,inlineDefault:j.none()})),St=yield*t.suspend(()=>g({typeNode:Be,optional:!1,inlineDefault:j.none()}));return{kind:"RECORD",keyType:gt,valueType:St,optional:r,inlineDefault:o}}if(["Pick","Omit","Partial","Required","Readonly","Extract","NonNullable"].includes(N))return yield*T({type:S.getType(),contextNode:S,optional:r,inlineDefault:o});let D=S.getType(),$=D.getText(),W=D.getAliasSymbol();if(!W)return yield*T({type:D,contextNode:S,optional:r,inlineDefault:o});let A=W.getDeclarations();if(A&&A.length>1)return yield*new he({raw:$});let[F]=A;if(!F)return yield*new Te({raw:$});let te=W?.getJsDocTags().map(le=>le.getName()).includes(n);if(!At.isTypeAliasDeclaration(F))return yield*new xe;let Ae=F.getTypeNode();return Ae?!te||!f?yield*t.suspend(()=>g({typeNode:Ae,optional:r,inlineDefault:o})):{kind:"BUILDER",name:F.getName(),inlineDefault:o,optional:r}:yield*new Q({kind:u,raw:$})})),y.when(y.is(E.UnionType),()=>t.gen(function*(){let S=yield*t.all(l.asKindOrThrow(E.UnionType).getTypeNodes().map(N=>t.suspend(()=>g({typeNode:N,optional:!1,inlineDefault:j.none()}))),{concurrency:"unbounded"});return{kind:"UNION",optional:r,members:S,inlineDefault:o}})),y.when(y.is(E.IntersectionType),()=>t.gen(function*(){let N=l.asKindOrThrow(E.IntersectionType).getTypeNodes(),P=[E.StringKeyword,E.NumberKeyword,E.BooleanKeyword],x=N.find(D=>P.includes(D.getKind()));return x&&N.length>1?{kind:"TYPE_CAST",baseTypeMetadata:yield*t.suspend(()=>g({typeNode:x,optional:!1,inlineDefault:o})),inlineDefault:o,optional:r}:yield*new Q({kind:u,raw:l.getText()})})),y.option);return j.isNone(p)?yield*new Q({kind:u,raw:l.getText()}):yield*p.value});return{generateMetadata:g}}),dependencies:[V.Default]}){},X=class extends t.Service()("@TSDataBuilders/Parser",{effect:t.gen(function*(){let n=yield*it.FileSystem,c=yield*ye,{jsdocTag:f}=yield*R;return{generateBuildersMetadata:d=>t.gen(function*(){yield*t.logDebug(`[Parser](${d}): Generating builder metadata`),yield*t.logDebug(`[Parser](${d}): Reading source code`);let a=yield*t.orDie(n.readFileString(d)),T=yield*t.try({try:()=>new Bt().createSourceFile(d,a,{overwrite:!0}).getTypeAliases().filter(u=>u.getJsDocs().flatMap(p=>p.getTags().flatMap(b=>b.getTagName())).includes(f)).map(u=>{let p=u.getName();if(!u.isExported())return de.left(new Fe({typeName:p}));let b=u.getTypeNode();return b?.isKind(E.TypeLiteral)||b?.isKind(E.TypeReference)?de.right({name:u.getName(),node:b}):de.left(new ke({typeName:u.getName()}))}).filter(Boolean),catch:l=>new Pe({cause:l})}),g=yield*t.all(T.map(l=>l),{concurrency:"unbounded"});return yield*t.logDebug(`[Parser](${d}): Generating metadata for types: ${g.map(({name:l})=>l).join(", ")}`),yield*t.all(g.map(({name:l,node:r})=>c.generateMetadata({typeNode:r,optional:!1,inlineDefault:j.none()}).pipe(t.tap(()=>t.logDebug(`[Parser](${d}): Finished generating metadata for type: ${l}`)),t.map(o=>({name:l,shape:o,path:d})))),{concurrency:"unbounded"})}).pipe(t.catchTags({ParserError:a=>t.die(a),MissingSymbolDeclarationError:a=>t.dieMessage(`[Parser](${d}): Missing symbol declaration for type: ${a.raw}`),UnsupportedTypeAliasDeclarationError:()=>t.dieMessage(`[Parser](${d}): Unsupported type alias declaration`),MultipleSymbolDeclarationsError:a=>t.dieMessage(`[Parser](${d}): Missing symbol declaration error for type: ${a.raw}`),MissingSymbolError:a=>t.dieMessage(`[Parser](${d}): Missing symbol error for type: ${a.raw}`),UnexportedDatabuilderError:a=>t.dieMessage(`[Parser](${d}): Unexported databuilder ${a.typeName}`),UnsupportedSyntaxKindError:a=>t.dieMessage(`[Parser](${d}): Unsupported syntax kind of id: ${a.kind} for type: ${a.raw}`),CannotBuildTypeReferenceMetadataError:a=>t.dieMessage(`[Parser](${d}): Cannot build type reference metadata with kind of id: ${a.kind} for type: ${a.raw}. Is it a root of databuilder?`),UnsupportedBuilderTypeError:a=>t.dieMessage(`[Parser](${d}): Unsupported builder type ${a.typeName}`)}))}}),dependencies:[ye.Default]}){},Q=class extends Y.TaggedError("UnsupportedSyntaxKindError"){},xe=class extends Y.TaggedError("UnsupportedTypeAliasDeclarationError"){},Ie=class extends Y.TaggedError("CannotBuildTypeReferenceMetadataError"){},Pe=class extends Y.TaggedError("ParserError"){},Fe=class extends Y.TaggedError("UnexportedDatabuilderError"){},ke=class extends Y.TaggedError("UnsupportedBuilderTypeError"){},Me=class extends Y.TaggedError("MissingSymbolError"){},Te=class extends Y.TaggedError("MissingSymbolDeclarationError"){},he=class extends Y.TaggedError("MultipleSymbolDeclarationsError"){};import*as ot from"effect/Chunk";import*as L from"effect/Effect";import*as rt from"effect/Function";var at=L.gen(function*(){let e=yield*q,n=yield*X,c=yield*z;yield*L.logInfo("[TSDatabuilders]: Generating builders for your project.");let f=yield*e.find;yield*L.logInfo(`[TSDatabuilders]: Found builders in ${f.length} file(s).`),yield*L.logDebug("[TSDatabuilders]: Attempting to generate builders metadata");let d=yield*L.all(ot.map(f,a=>n.generateBuildersMetadata(a)),{concurrency:"unbounded"}).pipe(L.map(a=>a.flatMap(rt.identity)));d.length!==0&&(yield*L.logDebug("[TSDatabuilders]: Attempting to create builders files"),yield*c.create(d),yield*L.logInfo(`[TSDatabuilders]: Created ${d.length} builder(s).`))});var Rt=s.text("jsdoc-tag").pipe(s.withDescription(C.jsdocTag),s.withSchema(K.fields.jsdocTag),s.optional),Lt=s.text("inline-default-jsdoc-tag").pipe(s.withDescription(C.inlineDefaultJsdocTag),s.withSchema(K.fields.inlineDefaultJsdocTag),s.optional),$t=s.text("with-nested-builders").pipe(s.withDescription(C.withNestedbuilders),s.withSchema(K.fields.withNestedBuilders),s.optional),Ut=s.text("output-dir").pipe(s.withAlias("o"),s.withDescription(C.outputDir),s.withSchema(K.fields.outputDir),s.optional),vt=s.text("include").pipe(s.withAlias("i"),s.withDescription(C.include),s.withSchema(K.fields.include),s.optional),jt=s.text("file-suffix").pipe(s.withDescription(C.fileSuffix),s.withSchema(K.fields.fileSuffix),s.optional),Gt=s.text("builder-suffix").pipe(s.withDescription(C.builderSuffix),s.withSchema(K.fields.builderSuffix),s.optional),_t=s.text("default-string").pipe(s.withDescription(C.defaultString),s.withSchema(K.fields.defaultString),s.optional),Kt=s.text("default-number").pipe(s.withDescription(C.defaultNumber),s.withSchema(K.fields.defaultNumber),s.optional),Jt=s.text("default-boolean").pipe(s.withDescription(C.defaultBoolean),s.withSchema(K.fields.defaultBoolean),s.optional),st={jsdocTag:Rt,outputDir:Ut,withNestedBuilders:$t,include:vt,fileSuffix:jt,builderSuffix:Gt,defaultString:_t,defaultNumber:Kt,defaultBoolean:Jt,inlineDefaultJsdocTag:Lt},Yt=G.make("init",st).pipe(G.withHandler(qe)),Wt=G.make("ts-databuilders",st),ct=Wt.pipe(G.withHandler(()=>at),G.withSubcommands([Yt]),G.provide(e=>ee.mergeAll(q.Default,X.Default,z.Default).pipe(ee.provide(ee.effect(R,ve(e))))),G.run({name:"Typescript Databuilders generator",version:"v0.0.1"}));var Vt=ut.mergeAll(pt.minimumLogLevel(mt.Info),B.Default,dt.layer);ct(process.argv).pipe(ft.provide(Vt),lt.runMain);
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@nemmtor/ts-databuilders",
4
+ "version": "0.0.1-alpha.11",
4
5
  "type": "module",
5
6
  "private": false,
6
7
  "description": "CLI tool that automatically generates builder classes from annotated TypeScript types.",
@@ -26,8 +27,11 @@
26
27
  "dist"
27
28
  ],
28
29
  "scripts": {
29
- "build:node": "bun build src/main.ts --target node --outfile dist/main.js --production --packages external",
30
- "start": "bun --console-depth 10 src/main.ts",
30
+ "build": "tsup",
31
+ "test": "vitest run",
32
+ "test:watch": "vitest",
33
+ "test:coverage": "vitest run --coverage",
34
+ "start": "tsx src/main.ts",
31
35
  "format": "biome format",
32
36
  "format:fix": "biome format --write",
33
37
  "lint": "biome lint",
@@ -36,26 +40,36 @@
36
40
  "check-actions:fix": "pnpm exec biome check --formatter-enabled=false --linter-enabled=false --write",
37
41
  "check-types": "tsc -b tsconfig.json",
38
42
  "check-knip": "knip",
39
- "check-dep": "depcruise --output-type err-long src"
43
+ "check-dep": "depcruise --output-type err-long src",
44
+ "gen:schema": "tsx scripts/generate-schema.ts"
40
45
  },
41
46
  "devDependencies": {
42
- "@biomejs/biome": "^2.2.7",
43
- "@effect/language-service": "^0.47.3",
47
+ "@biomejs/biome": "^2.3.2",
48
+ "@effect/language-service": "^0.55.0",
49
+ "@effect/vitest": "^0.27.0",
44
50
  "@total-typescript/ts-reset": "^0.6.1",
45
- "@types/bun": "^1.3.0",
46
- "dependency-cruiser": "^17.1.0",
47
- "knip": "^5.66.2"
51
+ "@types/node": "^24.0.0",
52
+ "@vitest/coverage-v8": "4.0.8",
53
+ "dependency-cruiser": "^17.2.0",
54
+ "knip": "^5.66.4",
55
+ "lefthook": "^2.0.2",
56
+ "tsup": "^8.5.0",
57
+ "tsx": "^4.20.6",
58
+ "vitest": "^4.0.6"
48
59
  },
49
60
  "peerDependencies": {
50
61
  "typescript": "^5.9.3"
51
62
  },
52
63
  "dependencies": {
53
- "@effect/cli": "^0.71.0",
54
- "@effect/platform": "^0.92.1",
55
- "@effect/platform-node": "^0.98.4",
64
+ "@effect/cli": "^0.72.0",
65
+ "@effect/platform": "^0.93.0",
66
+ "@effect/platform-node": "^0.100.0",
56
67
  "effect": "^3.18.4",
57
68
  "glob": "^11.0.3",
58
69
  "ts-morph": "^27.0.2"
59
70
  },
60
- "version": "0.0.1-alpha.1"
71
+ "packageManager": "pnpm@10.20.0+sha512.cf9998222162dd85864d0a8102e7892e7ba4ceadebbf5a31f9c2fce48dfce317a9c53b9f6464d1ef9042cba2e02ae02a9f7c143a2b438cd93c91840f0192b9dd",
72
+ "engines": {
73
+ "node": ">=20.0.0"
74
+ }
61
75
  }