@glitchproof/form-field-generator 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 GlitchProof
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 GlitchProof
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,501 +1,502 @@
1
- # TypeScript Fields Generator
2
-
3
- > Type-safe field path generation for nested objects and arrays
4
-
5
- Build compile-time validated field accessors from your data schemas. Eliminate typos, refactoring errors, and manual path string management.
6
-
7
- ```typescript
8
- const fields = generateFields({
9
- user: {
10
- profile: { firstName: 'firstName', email: 'email' },
11
- addresses: [{ street: 'street', city: 'city' }],
12
- },
13
- });
14
-
15
- fields.$USER.$PROFILE.FIRST_NAME_FIELD; // 'user.profile.firstName'
16
- fields.$USER.$ADDRESSES.STREET_FIELD(0); // 'user.addresses.0.street'
17
- ```
18
-
19
- ## Why?
20
-
21
- **The Problem:**
22
-
23
- ```typescript
24
- // Brittle string paths everywhere
25
- <input {...register('user.profile.firstName')} />
26
- db.select('user.addresses.0.city')
27
- errors['user.profile.email'] // typo? good luck finding it
28
- ```
29
-
30
- **The Solution:**
31
-
32
- ```typescript
33
- // Type-safe, refactor-friendly, autocomplete-enabled
34
- <input {...register(fields.$USER.$PROFILE.FIRST_NAME_FIELD)} />
35
- db.select(fields.$USER.$ADDRESSES.CITY_FIELD(0))
36
- errors[fields.$USER.$PROFILE.EMAIL_FIELD] // TypeScript catches typos
37
- ```
38
-
39
- ## Installation
40
-
41
- ```bash
42
- npm install @glitchproof/form-field-generator
43
- ```
44
-
45
- ## Core Concepts
46
-
47
- ### Simple Fields
48
-
49
- Input values become uppercase constants and field paths:
50
-
51
- ```typescript
52
- const fields = generateFields({
53
- email: 'email',
54
- firstName: 'firstName',
55
- });
56
-
57
- fields.EMAIL; // 'email' - the value
58
- fields.EMAIL_FIELD; // 'email' - the path
59
- fields.FIRST_NAME_FIELD; // 'firstName' - camelCase → SCREAMING_SNAKE_CASE
60
- ```
61
-
62
- ### Nested Objects
63
-
64
- Nested structures get `$` prefixed accessors:
65
-
66
- ```typescript
67
- const fields = generateFields({
68
- user: {
69
- name: 'name',
70
- email: 'email',
71
- },
72
- });
73
-
74
- fields.$USER.NAME_FIELD; // 'user.name'
75
- fields.$USER.EMAIL_FIELD; // 'user.email'
76
- fields.$USER.KEY; // 'user' - original key
77
- ```
78
-
79
- ### Arrays
80
-
81
- Array fields become functions that accept indices:
82
-
83
- ```typescript
84
- const fields = generateFields({
85
- users: [{ name: 'name', email: 'email' }],
86
- });
87
-
88
- fields.$USERS.NAME_FIELD(0); // 'users.0.name'
89
- fields.$USERS.EMAIL_FIELD(5); // 'users.5.email'
90
- fields.USERS_FIELD(); // '.users' - the array itself
91
- ```
92
-
93
- ### Nested Arrays
94
-
95
- Multiple indices for deeply nested arrays:
96
-
97
- ```typescript
98
- const fields = generateFields({
99
- orders: [
100
- {
101
- items: [{ productId: 'productId', qty: 'qty' }],
102
- },
103
- ],
104
- });
105
-
106
- fields.$ORDERS.$ITEMS.PRODUCT_ID_FIELD(0, 2); // 'orders.0.items.2.productId'
107
- // ^ ^
108
- // order item
109
- ```
110
-
111
- ## Real-World Usage
112
-
113
- ### React Hook Form
114
-
115
- Stop hardcoding form field paths:
116
-
117
- ```typescript
118
- import { useForm } from 'react-hook-form';
119
-
120
- const formFields = generateFields({
121
- email: 'email',
122
- password: 'password',
123
- profile: {
124
- firstName: 'firstName',
125
- lastName: 'lastName'
126
- }
127
- });
128
-
129
- function RegistrationForm() {
130
- const { register, formState: { errors } } = useForm();
131
-
132
- return (
133
- <form>
134
- <input {...register(formFields.EMAIL_FIELD)} />
135
- {errors[formFields.EMAIL] && <span>Email required</span>}
136
-
137
- <input {...register(formFields.$PROFILE.FIRST_NAME_FIELD)} />
138
- <input {...register(formFields.$PROFILE.LAST_NAME_FIELD)} />
139
- </form>
140
- );
141
- }
142
- ```
143
-
144
- **Benefits:**
145
-
146
- - Rename `firstName` → `givenName`? Change once in schema, works everywhere
147
- - TypeScript autocomplete guides you
148
- - Impossible to typo field names
149
-
150
- ### Database Queries
151
-
152
- Build type-safe query builders:
153
-
154
- ```typescript
155
- const schema = generateFields({
156
- id: 'id',
157
- title: 'title',
158
- author: {
159
- name: 'name',
160
- email: 'email',
161
- },
162
- tags: [{ name: 'name' }],
163
- });
164
-
165
- // Prisma-style
166
- db.posts.findMany({
167
- select: {
168
- [schema.ID]: true,
169
- [schema.TITLE]: true,
170
- [schema.$AUTHOR.NAME]: true,
171
- },
172
- where: {
173
- [schema.$AUTHOR.EMAIL_FIELD]: 'user@example.com',
174
- },
175
- });
176
-
177
- // SQL builder
178
- query()
179
- .select(schema.TITLE_FIELD)
180
- .where(schema.$AUTHOR.NAME_FIELD, '=', 'John')
181
- .orderBy(schema.ID_FIELD);
182
- ```
183
-
184
- ### Validation Schemas
185
-
186
- Stop duplicating field paths:
187
-
188
- ```typescript
189
- import { z } from 'zod';
190
-
191
- const userFields = generateFields({
192
- email: 'email',
193
- password: 'password',
194
- profile: {
195
- age: 'age',
196
- },
197
- });
198
-
199
- // Define validation once
200
- const schema = z.object({
201
- [userFields.EMAIL]: z.string().email(),
202
- [userFields.PASSWORD]: z.string().min(8),
203
- [userFields.$PROFILE.AGE]: z.number().min(18),
204
- });
205
-
206
- // Use in forms, API validation, etc.
207
- schema.parse(formData);
208
- ```
209
-
210
- ### State Management
211
-
212
- Type-safe selectors and reducers:
213
-
214
- ```typescript
215
- const stateFields = generateFields({
216
- user: {
217
- profile: { name: 'name' },
218
- preferences: { theme: 'theme' },
219
- },
220
- session: {
221
- token: 'token',
222
- expiresAt: 'expiresAt',
223
- },
224
- });
225
-
226
- // Redux selectors
227
- const selectUserName = (state) =>
228
- state[stateFields.$USER.$PROFILE.KEY][stateFields.$USER.$PROFILE.NAME];
229
-
230
- // Zustand
231
- const useStore = create((set) => ({
232
- [stateFields.$USER.KEY]: {},
233
- [stateFields.$SESSION.KEY]: {},
234
- }));
235
- ```
236
-
237
- ### API Field Selection
238
-
239
- Control exactly what data you fetch:
240
-
241
- ```typescript
242
- const apiFields = generateFields({
243
- user: {
244
- id: 'id',
245
- email: 'email',
246
- posts: [
247
- {
248
- title: 'title',
249
- comments: [{ text: 'text' }],
250
- },
251
- ],
252
- },
253
- });
254
-
255
- // GraphQL
256
- const query = gql`
257
- query {
258
- user {
259
- ${apiFields.$USER.ID}
260
- ${apiFields.$USER.EMAIL}
261
- posts {
262
- ${apiFields.$USER.$POSTS.TITLE}
263
- }
264
- }
265
- }
266
- `;
267
-
268
- // REST with query params
269
- fetch(
270
- `/api/user?fields=${[
271
- apiFields.$USER.EMAIL_FIELD,
272
- apiFields.$USER.$POSTS.TITLE_FIELD,
273
- ].join(',')}`,
274
- );
275
- ```
276
-
277
- ## API Reference
278
-
279
- ### `generateFields(schema)`
280
-
281
- **Input:** Object schema where values are field names (strings), nested objects, or arrays.
282
-
283
- **Output:** Generated field accessors with type safety.
284
-
285
- #### Generated Properties
286
-
287
- | Pattern | Type | Example |
288
- | ------------------ | ---------------------- | -------------------------- |
289
- | `FIELD_NAME` | `string` | `EMAIL` → `'email'` |
290
- | `FIELD_NAME_FIELD` | `string` or `function` | `EMAIL_FIELD` → `'email'` |
291
- | `$NESTED` | `object` | Nested field accessors |
292
- | `KEY` | `string` | Original key name |
293
- | `PATH` | `string` or `function` | Full path to field |
294
- | `AT` | `function` | Only listed object fields |
295
- | | | have this method to get |
296
- | | | object path from nested or |
297
- | | | list inside |
298
- | | | |
299
- | `ELEMENT_AT` | `function` | Only array fields has |
300
- | | | array fields to get array |
301
- | | | specific element like |
302
- | | | fields.$USERS.ELEMENT_AT(3)|
303
- | | | provide path `users.3` |
304
-
305
- **Notes:**
306
-
307
- - Field names convert to `SCREAMING_SNAKE_CASE`
308
- - Nested objects prefix with `$`
309
- - Array fields become functions accepting indices
310
- - `_FIELD` suffix provides full path
311
-
312
- ## TypeScript Support
313
-
314
- Requires TypeScript 4.5+.
315
-
316
- Full type inference and autocomplete:
317
-
318
- ```typescript
319
- const fields = generateFields({
320
- user: {
321
- name: 'name',
322
- tags: [{ value: 'value' }],
323
- },
324
- });
325
-
326
- // ✅ Valid - TypeScript knows these exist
327
- fields.$USER.NAME_FIELD;
328
- fields.$USER.$TAGS.VALUE_FIELD(0);
329
-
330
- // ❌ Type error - property doesn't exist
331
- fields.$USER.INVALID_FIELD;
332
-
333
- // ❌ Type error - wrong arity
334
- fields.$USER.$TAGS.VALUE_FIELD(); // Expected 1 argument
335
- ```
336
-
337
- ## Design Decisions
338
-
339
- **Why `$` prefix for nested objects?**
340
- Distinguishes between value constants (`EMAIL`) and nested accessors (`$PROFILE`). Makes structure immediately visible.
341
-
342
- **Why functions for arrays?**
343
- Arrays need dynamic indices. Functions provide type-safe, flexible access: `ITEMS_FIELD(index)`.
344
-
345
- **Why both `NAME` and `NAME_FIELD`?**
346
-
347
- - `NAME` - the value: `'name'` (useful for object keys)
348
- - `NAME_FIELD` - the path: `'user.name'` (useful for form libraries)
349
-
350
- **Why `SCREAMING_SNAKE_CASE`?**
351
-
352
- - Distinguishes generated constants from regular variables
353
- - Convention in many libraries (Redux actions, etc.)
354
- - Easier to spot in large codebases
355
-
356
- ## Performance
357
-
358
- - **Zero runtime overhead** - pure type-level transformations
359
- - **Tree-shakeable** - dead code elimination works perfectly
360
- - **No dependencies** - ~2KB gzipped
361
- - **Fast TypeScript compilation** - efficient recursive types
362
-
363
- ## Patterns & Best Practices
364
-
365
- ### Central Field Definitions
366
-
367
- ```typescript
368
- // src/fields/user.fields.ts
369
- export const UserFields = generateFields({
370
- id: 'id',
371
- email: 'email',
372
- profile: {
373
- firstName: 'firstName',
374
- lastName: 'lastName',
375
- },
376
- });
377
-
378
- // Use everywhere
379
- import { UserFields } from '@/fields/user.fields';
380
- ```
381
-
382
- ### Combining Multiple Schemas
383
-
384
- ```typescript
385
- const productFields = generateFields({
386
- /* ... */
387
- });
388
- const orderFields = generateFields({
389
- /* ... */
390
- });
391
-
392
- // Use separately or together
393
- const allFields = { productFields, orderFields };
394
- ```
395
-
396
- ### Conditional Field Access
397
-
398
- ```typescript
399
- const fields = generateFields({
400
- user: {
401
- role: 'role',
402
- adminSettings: { permission: 'permission' },
403
- },
404
- });
405
-
406
- // Type-safe conditional access
407
- const getSettingsPath = (isAdmin: boolean) =>
408
- isAdmin ? fields.$USER.$ADMIN_SETTINGS.PERMISSION_FIELD : null;
409
- ```
410
-
411
- ### Testing
412
-
413
- ```typescript
414
- import { describe, it, expect } from 'vitest';
415
-
416
- describe('UserFields', () => {
417
- it('generates correct paths', () => {
418
- expect(UserFields.EMAIL_FIELD).toBe('email');
419
- expect(UserFields.$PROFILE.FIRST_NAME_FIELD).toBe('profile.firstName');
420
- });
421
-
422
- it('handles array indices', () => {
423
- expect(UserFields.$ADDRESSES.STREET_FIELD(0)).toBe('addresses.0.street');
424
- });
425
- });
426
- ```
427
-
428
- ## Migration Guide
429
-
430
- ### From Hardcoded Strings
431
-
432
- ```typescript
433
- // Before
434
- const emailField = 'user.profile.email';
435
- const addressField = (index) => `user.addresses.${index}.street`;
436
-
437
- // After
438
- const fields = generateFields({
439
- user: {
440
- profile: { email: 'email' },
441
- addresses: [{ street: 'street' }],
442
- },
443
- });
444
-
445
- const emailField = fields.$USER.$PROFILE.EMAIL_FIELD;
446
- const addressField = (index) => fields.$USER.$ADDRESSES.STREET_FIELD(index);
447
- ```
448
-
449
- ### From Constants
450
-
451
- ```typescript
452
- // Before
453
- export const FIELDS = {
454
- EMAIL: 'email',
455
- PROFILE_NAME: 'profile.name',
456
- };
457
-
458
- // After
459
- export const FIELDS = generateFields({
460
- email: 'email',
461
- profile: { name: 'name' },
462
- });
463
- // Access: FIELDS.EMAIL, FIELDS.$PROFILE.NAME_FIELD
464
- ```
465
-
466
- ## Limitations
467
-
468
- - Requires TypeScript 4.5+ for full type support
469
- - Very deep nesting (10+ levels) may slow TypeScript compilation
470
- - Arrays of primitives not supported (wrap in objects: `[{ value: string }]`)
471
- - Dynamic keys not supported (must be known at compile time)
472
-
473
- ## Troubleshooting
474
-
475
- **TypeScript shows `any` type:**
476
-
477
- - Ensure you're using TypeScript 4.5+
478
- - Add `as const` to your schema: `generateFields({ ... } as const)`
479
-
480
- **"Expected N arguments" error:**
481
-
482
- - Check array nesting level
483
- - Each array level adds one required index argument
484
-
485
- **Slow compilation:**
486
-
487
- - Reduce nesting depth
488
- - Split large schemas into smaller pieces
489
-
490
- ## Contributing
491
-
492
- Contributions welcome! Please:
493
-
494
- - Add tests for new features
495
- - Update TypeScript types accordingly
496
- - Follow existing code style
497
- - Update documentation
498
-
499
- ## License
500
-
501
- MIT
1
+ # TypeScript Fields Generator
2
+
3
+ > Type-safe field path generation for nested objects and arrays
4
+
5
+ Build compile-time validated field accessors from your data schemas. Eliminate typos, refactoring errors, and manual path string management.
6
+
7
+ ```typescript
8
+ const fields = generateFields({
9
+ user: {
10
+ profile: { firstName: 'firstName', email: 'email' },
11
+ addresses: [{ street: 'street', city: 'city' }],
12
+ },
13
+ });
14
+
15
+ fields.$USER.$PROFILE.FIRST_NAME_FIELD; // 'user.profile.firstName'
16
+ fields.$USER.$ADDRESSES.STREET_FIELD(0); // 'user.addresses.0.street'
17
+ ```
18
+
19
+ ## Why?
20
+
21
+ **The Problem:**
22
+
23
+ ```typescript
24
+ // Brittle string paths everywhere
25
+ <input {...register('user.profile.firstName')} />
26
+ db.select('user.addresses.0.city')
27
+ errors['user.profile.email'] // typo? good luck finding it
28
+ ```
29
+
30
+ **The Solution:**
31
+
32
+ ```typescript
33
+ // Type-safe, refactor-friendly, autocomplete-enabled
34
+ <input {...register(fields.$USER.$PROFILE.FIRST_NAME_FIELD)} />
35
+ db.select(fields.$USER.$ADDRESSES.CITY_FIELD(0))
36
+ errors[fields.$USER.$PROFILE.EMAIL_FIELD] // TypeScript catches typos
37
+ ```
38
+
39
+ ## Installation
40
+
41
+ ```bash
42
+ npm install @glitchproof/form-field-generator
43
+ ```
44
+
45
+ ## Core Concepts
46
+
47
+ ### Simple Fields
48
+
49
+ Input values become uppercase constants and field paths:
50
+
51
+ ```typescript
52
+ const fields = generateFields({
53
+ email: 'email',
54
+ firstName: 'firstName',
55
+ });
56
+
57
+ fields.EMAIL; // 'email' - the value
58
+ fields.EMAIL_FIELD; // 'email' - the path
59
+ fields.FIRST_NAME_FIELD; // 'firstName' - camelCase → SCREAMING_SNAKE_CASE
60
+ ```
61
+
62
+ ### Nested Objects
63
+
64
+ Nested structures get `$` prefixed accessors:
65
+
66
+ ```typescript
67
+ const fields = generateFields({
68
+ user: {
69
+ name: 'name',
70
+ email: 'email',
71
+ },
72
+ });
73
+
74
+ fields.$USER.NAME_FIELD; // 'user.name'
75
+ fields.$USER.EMAIL_FIELD; // 'user.email'
76
+ fields.$USER.KEY; // 'user' - original key
77
+ ```
78
+
79
+ ### Arrays
80
+
81
+ Array fields become functions that accept indices:
82
+
83
+ ```typescript
84
+ const fields = generateFields({
85
+ users: [{ name: 'name', email: 'email' }],
86
+ });
87
+
88
+ fields.$USERS.NAME_FIELD(0); // 'users.0.name'
89
+ fields.$USERS.EMAIL_FIELD(5); // 'users.5.email'
90
+ fields.$USERS.ELEMENT_AT(5); // users.5
91
+ fields.$USERS.KEY; // users
92
+ ```
93
+
94
+ ### Nested Arrays
95
+
96
+ Multiple indices for deeply nested arrays:
97
+
98
+ ```typescript
99
+ const fields = generateFields({
100
+ orders: [
101
+ {
102
+ items: [{ productId: 'productId', qty: 'qty' }],
103
+ },
104
+ ],
105
+ });
106
+
107
+ fields.$ORDERS.$ITEMS.PRODUCT_ID_FIELD(0, 2); // 'orders.0.items.2.productId'
108
+ // ^ ^
109
+ // order item
110
+ ```
111
+
112
+ ## Real-World Usage
113
+
114
+ ### React Hook Form
115
+
116
+ Stop hardcoding form field paths:
117
+
118
+ ```typescript
119
+ import { useForm } from 'react-hook-form';
120
+
121
+ const formFields = generateFields({
122
+ email: 'email',
123
+ password: 'password',
124
+ profile: {
125
+ firstName: 'firstName',
126
+ lastName: 'lastName'
127
+ }
128
+ });
129
+
130
+ function RegistrationForm() {
131
+ const { register, formState: { errors } } = useForm();
132
+
133
+ return (
134
+ <form>
135
+ <input {...register(formFields.EMAIL_FIELD)} />
136
+ {errors[formFields.EMAIL] && <span>Email required</span>}
137
+
138
+ <input {...register(formFields.$PROFILE.FIRST_NAME_FIELD)} />
139
+ <input {...register(formFields.$PROFILE.LAST_NAME_FIELD)} />
140
+ </form>
141
+ );
142
+ }
143
+ ```
144
+
145
+ **Benefits:**
146
+
147
+ - Rename `firstName` `givenName`? Change once in schema, works everywhere
148
+ - TypeScript autocomplete guides you
149
+ - Impossible to typo field names
150
+
151
+ ### Database Queries
152
+
153
+ Build type-safe query builders:
154
+
155
+ ```typescript
156
+ const schema = generateFields({
157
+ id: 'id',
158
+ title: 'title',
159
+ author: {
160
+ name: 'name',
161
+ email: 'email',
162
+ },
163
+ tags: [{ name: 'name' }],
164
+ });
165
+
166
+ // Prisma-style
167
+ db.posts.findMany({
168
+ select: {
169
+ [schema.ID]: true,
170
+ [schema.TITLE]: true,
171
+ [schema.$AUTHOR.NAME]: true,
172
+ },
173
+ where: {
174
+ [schema.$AUTHOR.EMAIL_FIELD]: 'user@example.com',
175
+ },
176
+ });
177
+
178
+ // SQL builder
179
+ query()
180
+ .select(schema.TITLE_FIELD)
181
+ .where(schema.$AUTHOR.NAME_FIELD, '=', 'John')
182
+ .orderBy(schema.ID_FIELD);
183
+ ```
184
+
185
+ ### Validation Schemas
186
+
187
+ Stop duplicating field paths:
188
+
189
+ ```typescript
190
+ import { z } from 'zod';
191
+
192
+ const userFields = generateFields({
193
+ email: 'email',
194
+ password: 'password',
195
+ profile: {
196
+ age: 'age',
197
+ },
198
+ });
199
+
200
+ // Define validation once
201
+ const schema = z.object({
202
+ [userFields.EMAIL]: z.string().email(),
203
+ [userFields.PASSWORD]: z.string().min(8),
204
+ [userFields.$PROFILE.AGE]: z.number().min(18),
205
+ });
206
+
207
+ // Use in forms, API validation, etc.
208
+ schema.parse(formData);
209
+ ```
210
+
211
+ ### State Management
212
+
213
+ Type-safe selectors and reducers:
214
+
215
+ ```typescript
216
+ const stateFields = generateFields({
217
+ user: {
218
+ profile: { name: 'name' },
219
+ preferences: { theme: 'theme' },
220
+ },
221
+ session: {
222
+ token: 'token',
223
+ expiresAt: 'expiresAt',
224
+ },
225
+ });
226
+
227
+ // Redux selectors
228
+ const selectUserName = (state) =>
229
+ state[stateFields.$USER.$PROFILE.KEY][stateFields.$USER.$PROFILE.NAME];
230
+
231
+ // Zustand
232
+ const useStore = create((set) => ({
233
+ [stateFields.$USER.KEY]: {},
234
+ [stateFields.$SESSION.KEY]: {},
235
+ }));
236
+ ```
237
+
238
+ ### API Field Selection
239
+
240
+ Control exactly what data you fetch:
241
+
242
+ ```typescript
243
+ const apiFields = generateFields({
244
+ user: {
245
+ id: 'id',
246
+ email: 'email',
247
+ posts: [
248
+ {
249
+ title: 'title',
250
+ comments: [{ text: 'text' }],
251
+ },
252
+ ],
253
+ },
254
+ });
255
+
256
+ // GraphQL
257
+ const query = gql`
258
+ query {
259
+ user {
260
+ ${apiFields.$USER.ID}
261
+ ${apiFields.$USER.EMAIL}
262
+ posts {
263
+ ${apiFields.$USER.$POSTS.TITLE}
264
+ }
265
+ }
266
+ }
267
+ `;
268
+
269
+ // REST with query params
270
+ fetch(
271
+ `/api/user?fields=${[
272
+ apiFields.$USER.EMAIL_FIELD,
273
+ apiFields.$USER.$POSTS.TITLE_FIELD,
274
+ ].join(',')}`,
275
+ );
276
+ ```
277
+
278
+ ## API Reference
279
+
280
+ ### `generateFields(schema)`
281
+
282
+ **Input:** Object schema where values are field names (strings), nested objects, or arrays.
283
+
284
+ **Output:** Generated field accessors with type safety.
285
+
286
+ #### Generated Properties
287
+
288
+ | Pattern | Type | Example |
289
+ | ------------------ | ---------------------- | --------------------------- |
290
+ | `FIELD_NAME` | `string` | `EMAIL` → `'email'` |
291
+ | `FIELD_NAME_FIELD` | `string` or `function` | `EMAIL_FIELD` `'email'` |
292
+ | `$NESTED` | `object` | Nested field accessors |
293
+ | `KEY` | `string` | Original key name |
294
+ | `PATH` | `string` or `function` | Full path to field |
295
+ | `AT` | `function` | Only listed object fields |
296
+ | | | have this method to get |
297
+ | | | object path from nested or |
298
+ | | | list inside |
299
+ | | | |
300
+ | `ELEMENT_AT` | `function` | Only array fields has |
301
+ | | | array fields to get array |
302
+ | | | specific element like |
303
+ | | | fields.$USERS.ELEMENT_AT(3) |
304
+ | | | provide path `users.3` |
305
+
306
+ **Notes:**
307
+
308
+ - Field names convert to `SCREAMING_SNAKE_CASE`
309
+ - Nested objects prefix with `$`
310
+ - Array fields become functions accepting indices
311
+ - `_FIELD` suffix provides full path
312
+
313
+ ## TypeScript Support
314
+
315
+ Requires TypeScript 4.5+.
316
+
317
+ Full type inference and autocomplete:
318
+
319
+ ```typescript
320
+ const fields = generateFields({
321
+ user: {
322
+ name: 'name',
323
+ tags: [{ value: 'value' }],
324
+ },
325
+ });
326
+
327
+ // ✅ Valid - TypeScript knows these exist
328
+ fields.$USER.NAME_FIELD;
329
+ fields.$USER.$TAGS.VALUE_FIELD(0);
330
+
331
+ // ❌ Type error - property doesn't exist
332
+ fields.$USER.INVALID_FIELD;
333
+
334
+ // Type error - wrong arity
335
+ fields.$USER.$TAGS.VALUE_FIELD(); // Expected 1 argument
336
+ ```
337
+
338
+ ## Design Decisions
339
+
340
+ **Why `$` prefix for nested objects?**
341
+ Distinguishes between value constants (`EMAIL`) and nested accessors (`$PROFILE`). Makes structure immediately visible.
342
+
343
+ **Why functions for arrays?**
344
+ Arrays need dynamic indices. Functions provide type-safe, flexible access: `ITEMS_FIELD(index)`.
345
+
346
+ **Why both `NAME` and `NAME_FIELD`?**
347
+
348
+ - `NAME` - the value: `'name'` (useful for object keys)
349
+ - `NAME_FIELD` - the path: `'user.name'` (useful for form libraries)
350
+
351
+ **Why `SCREAMING_SNAKE_CASE`?**
352
+
353
+ - Distinguishes generated constants from regular variables
354
+ - Convention in many libraries (Redux actions, etc.)
355
+ - Easier to spot in large codebases
356
+
357
+ ## Performance
358
+
359
+ - **Zero runtime overhead** - pure type-level transformations
360
+ - **Tree-shakeable** - dead code elimination works perfectly
361
+ - **No dependencies** - ~2KB gzipped
362
+ - **Fast TypeScript compilation** - efficient recursive types
363
+
364
+ ## Patterns & Best Practices
365
+
366
+ ### Central Field Definitions
367
+
368
+ ```typescript
369
+ // src/fields/user.fields.ts
370
+ export const UserFields = generateFields({
371
+ id: 'id',
372
+ email: 'email',
373
+ profile: {
374
+ firstName: 'firstName',
375
+ lastName: 'lastName',
376
+ },
377
+ });
378
+
379
+ // Use everywhere
380
+ import { UserFields } from '@/fields/user.fields';
381
+ ```
382
+
383
+ ### Combining Multiple Schemas
384
+
385
+ ```typescript
386
+ const productFields = generateFields({
387
+ /* ... */
388
+ });
389
+ const orderFields = generateFields({
390
+ /* ... */
391
+ });
392
+
393
+ // Use separately or together
394
+ const allFields = { productFields, orderFields };
395
+ ```
396
+
397
+ ### Conditional Field Access
398
+
399
+ ```typescript
400
+ const fields = generateFields({
401
+ user: {
402
+ role: 'role',
403
+ adminSettings: { permission: 'permission' },
404
+ },
405
+ });
406
+
407
+ // Type-safe conditional access
408
+ const getSettingsPath = (isAdmin: boolean) =>
409
+ isAdmin ? fields.$USER.$ADMIN_SETTINGS.PERMISSION_FIELD : null;
410
+ ```
411
+
412
+ ### Testing
413
+
414
+ ```typescript
415
+ import { describe, it, expect } from 'vitest';
416
+
417
+ describe('UserFields', () => {
418
+ it('generates correct paths', () => {
419
+ expect(UserFields.EMAIL_FIELD).toBe('email');
420
+ expect(UserFields.$PROFILE.FIRST_NAME_FIELD).toBe('profile.firstName');
421
+ });
422
+
423
+ it('handles array indices', () => {
424
+ expect(UserFields.$ADDRESSES.STREET_FIELD(0)).toBe('addresses.0.street');
425
+ });
426
+ });
427
+ ```
428
+
429
+ ## Migration Guide
430
+
431
+ ### From Hardcoded Strings
432
+
433
+ ```typescript
434
+ // Before
435
+ const emailField = 'user.profile.email';
436
+ const addressField = (index) => `user.addresses.${index}.street`;
437
+
438
+ // After
439
+ const fields = generateFields({
440
+ user: {
441
+ profile: { email: 'email' },
442
+ addresses: [{ street: 'street' }],
443
+ },
444
+ });
445
+
446
+ const emailField = fields.$USER.$PROFILE.EMAIL_FIELD;
447
+ const addressField = (index) => fields.$USER.$ADDRESSES.STREET_FIELD(index);
448
+ ```
449
+
450
+ ### From Constants
451
+
452
+ ```typescript
453
+ // Before
454
+ export const FIELDS = {
455
+ EMAIL: 'email',
456
+ PROFILE_NAME: 'profile.name',
457
+ };
458
+
459
+ // After
460
+ export const FIELDS = generateFields({
461
+ email: 'email',
462
+ profile: { name: 'name' },
463
+ });
464
+ // Access: FIELDS.EMAIL, FIELDS.$PROFILE.NAME_FIELD
465
+ ```
466
+
467
+ ## Limitations
468
+
469
+ - Requires TypeScript 4.5+ for full type support
470
+ - Very deep nesting (10+ levels) may slow TypeScript compilation
471
+ - Arrays of primitives not supported (wrap in objects: `[{ value: string }]`)
472
+ - Dynamic keys not supported (must be known at compile time)
473
+
474
+ ## Troubleshooting
475
+
476
+ **TypeScript shows `any` type:**
477
+
478
+ - Ensure you're using TypeScript 4.5+
479
+ - Add `as const` to your schema: `generateFields({ ... } as const)`
480
+
481
+ **"Expected N arguments" error:**
482
+
483
+ - Check array nesting level
484
+ - Each array level adds one required index argument
485
+
486
+ **Slow compilation:**
487
+
488
+ - Reduce nesting depth
489
+ - Split large schemas into smaller pieces
490
+
491
+ ## Contributing
492
+
493
+ Contributions welcome! Please:
494
+
495
+ - Add tests for new features
496
+ - Update TypeScript types accordingly
497
+ - Follow existing code style
498
+ - Update documentation
499
+
500
+ ## License
501
+
502
+ MIT
@@ -1 +1 @@
1
- {"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../src/core/convert.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAU1C,eAAO,MAAM,OAAO,GAAI,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACxD,OAAO,MAAM,EACb,UAAS,OAAwB,wBA8ElC,CAAC"}
1
+ {"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../src/core/convert.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAU1C,eAAO,MAAM,OAAO,GAAI,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACxD,OAAO,MAAM,EACb,UAAS,OAAwB,wBA6ElC,CAAC"}
@@ -25,15 +25,15 @@ export const convert = (field, context = defaultContext) => {
25
25
  if (Array.isArray(value)) {
26
26
  const accessorName = `$${convertedName}`;
27
27
  const subGroupPath = path ? `${path}.${key}.#` : `${key}.#`;
28
+ const subGroupPathField = path ? `${path}.${key}` : `${key}`;
28
29
  const subGroup = convert(value, {
29
30
  path: subGroupPath,
30
31
  });
31
32
  subGroup.KEY = key;
32
33
  if (path)
33
- subGroup.PATH = createIndexFormatter(`${path}.${key}`);
34
- subGroup.ELEMENT_AT = createIndexFormatter(`${path}.${key}.#`);
34
+ subGroup.PATH = createIndexFormatter(subGroupPathField);
35
+ subGroup.ELEMENT_AT = createIndexFormatter(subGroupPath);
35
36
  acc[accessorName] = subGroup;
36
- acc[`${convertedName}_FIELD`] = createIndexFormatter(`${path}.${key}`);
37
37
  return acc;
38
38
  }
39
39
  if (typeof value === 'object' && value) {
@@ -1 +1 @@
1
- {"version":3,"file":"convert.js","sourceRoot":"","sources":["../../src/core/convert.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CA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C,GAAG,IAAI,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;YAEnD,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,EAAE;gBAC9B,IAAI,EAAE,YAAY;aACnB,CAAC,CAAC;YAEH,QAAQ,CAAC,GAAG,GAAG,GAAG,CAAC;YAEnB,IAAI,IAAI;gBACN,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,YAAY,CAAC;oBACpC,CAAC,CAAC,oBAAoB,CAAC,YAAY,CAAC;oBACpC,CAAC,CAAC,YAAY,CAAC;YAEnB,IAAI,QAAQ,CAAC,YAAY,CAAC;gBACxB,QAAQ,CAAC,EAAE,GAAG,oBAAoB,CAAC,YAAY,CAAC,CAAC;YAEnD,GAAG,CAAC,YAAY,CAAC,GAAG,QAAQ,CAAC;YAE7B,OAAO,GAAG,CAAC;QACb,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC,EACD,EAAyB,CAC1B,CAAC;AACJ,CAAC,CAAC"}
package/dist/type.d.ts CHANGED
@@ -46,7 +46,7 @@ type FieldsGroup<Field extends DICT_NESTED_VALUES, Path extends string, FieldNam
46
46
  [KEY in keyof Field as Field[KEY] extends DICT_NESTED_VALUES ? ExceptNumber<KEY, TO_OBJECT_FIELD_NAME<KEY>> : never]: Field[KEY] extends DICT_OBJECT_VALUE ? FieldsGroup<Field[KEY], `${Path}.${KEY & string}`, KEY & string> : Field[KEY] extends DICT_ARRAY_VALUE ? FieldsGroup<Field[KEY], `${Path}.${KEY & string}`, KEY & string> : never;
47
47
  } & {
48
48
  [KEY in keyof Field as Field[KEY] extends string ? TO_FIELD_NAME<KEY> : never]: IsListedBefore<Path> extends true ? ListFieldAccessor<`${Path}.${Field[KEY] & string}`> : `${Path}.${Field[KEY] & string}`;
49
- } & ExtendObjectWithCondition<IsListedBefore<Path>, FeatureFieldsForArraySubFields<Path>> & ExtendObjectWithCondition<SubArrayElement<Field> extends never ? false : true, FeatureFieldsForArrayFields<`${Path}.${number}`>>;
49
+ } & ExtendObjectWithCondition<IsListedBefore<Path> extends true ? SubArrayElement<Field> extends never ? true : false : false, FeatureFieldsForArraySubFields<Path>> & ExtendObjectWithCondition<SubArrayElement<Field> extends never ? false : true, FeatureFieldsForArrayFields<`${Path}.${number}`>>;
50
50
  export type GenerateFields<Fields extends DICT> = {
51
51
  [KEY in keyof Fields as Fields[KEY] extends string ? TO_FIELD_NAME<KEY> : never]: Fields[KEY];
52
52
  } & {
@@ -1 +1 @@
1
- {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../src/type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,KAAK,kBAAkB,GAAG,IAAI,MAAM,EAAE,CAAC;AAEvC,KAAK,UAAU,GACX,MAAM,GACN,SAAS;IAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,UAAU,CAAA;CAAE,EAAE,GACjD;IAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,UAAU,CAAA;CAAE,CAAC;AAE3C,KAAK,iBAAiB,GAAG;IAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,UAAU,CAAA;CAAE,CAAC;AAChE,KAAK,gBAAgB,GAAG,SAAS;IAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,UAAU,CAAA;CAAE,EAAE,CAAC;AAE1E,KAAK,kBAAkB,GAAG,gBAAgB,GAAG,iBAAiB,CAAC;AAE/D,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAE9C,KAAK,gBAAgB,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,GAAG,MAAM,CAAC,EAAE,GACtE,GAAG,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,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M,CAAC,GAAG,CAAC;CAC9F,GAAG;KACD,GAAG,IAAI,MAAM,MAAM,IAAI,MAAM,CAAC,GAAG,CAAC,SAAS,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC;CACxF,GAAG;KACD,GAAG,IAAI,MAAM,MAAM,IAAI,MAAM,CAAC,GAAG,CAAC,SAAS,kBAAkB,GAAG,oBAAoB,CAAC,GAAG,CAAC,GAAE,KAAK,GAC/F,MAAM,CAAC,GAAG,CAAC,SAAS,kBAAkB,GAClC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,MAAM,EAAE,GAAG,GAAG,MAAM,CAAC,GACpD,KAAK;CACZ,CAAC"}
package/package.json CHANGED
@@ -1,46 +1,46 @@
1
- {
2
- "name": "@glitchproof/form-field-generator",
3
- "version": "1.0.2",
4
- "description": "> Type-safe field path generation for nested objects and arrays",
5
- "scripts": {
6
- "build": "tsc",
7
- "ci": "bun run build && bun format:check && bun test",
8
- "format": "prettier --write .",
9
- "format:src": "prettier --write src/**/*.ts",
10
- "format:check": "prettier --write --check .",
11
- "format:check:src": "prettier --check src/**/*.ts",
12
- "test": "vitest run",
13
- "local:release": "changeset version && changeset publish",
14
- "prepublishOnly": "bun ci",
15
- "changeset": "changeset",
16
- "version-packages": "changeset version",
17
- "release": "changeset publish"
18
- },
19
- "keywords": [
20
- "react hook form",
21
- "field-name-generator",
22
- "fields generator"
23
- ],
24
- "author": "GlitchTruth",
25
- "repository": {
26
- "type": "git",
27
- "url": "git+https://github.com/RashadNazarzade/field-generator.git"
28
- },
29
- "files": [
30
- "dist"
31
- ],
32
- "type": "module",
33
- "main": "dist/index.js",
34
- "license": "MIT",
35
- "devDependencies": {
36
- "@changesets/cli": "^2.29.7",
37
- "prettier": "^3.6.2",
38
- "typescript": "^5.9.3",
39
- "vitest": "^4.0.10"
40
- },
41
- "types": "./dist/index.d.ts",
42
- "bugs": {
43
- "url": "https://github.com/RashadNazarzade/field-generator/issues"
44
- },
45
- "homepage": "https://github.com/RashadNazarzade/field-generator#readme"
46
- }
1
+ {
2
+ "name": "@glitchproof/form-field-generator",
3
+ "version": "1.0.4",
4
+ "description": "> Type-safe field path generation for nested objects and arrays",
5
+ "scripts": {
6
+ "build": "tsc",
7
+ "ci": "bun run build && bun format:check && bun test",
8
+ "format": "prettier --write .",
9
+ "format:src": "prettier --write src/**/*.ts",
10
+ "format:check": "prettier --write --check .",
11
+ "format:check:src": "prettier --check src/**/*.ts",
12
+ "test": "vitest run",
13
+ "local:release": "changeset version && changeset publish",
14
+ "prepublishOnly": "bun ci",
15
+ "changeset": "changeset",
16
+ "version-packages": "changeset version",
17
+ "release": "changeset publish"
18
+ },
19
+ "keywords": [
20
+ "react hook form",
21
+ "field-name-generator",
22
+ "fields generator"
23
+ ],
24
+ "author": "GlitchTruth",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/RashadNazarzade/field-generator.git"
28
+ },
29
+ "files": [
30
+ "dist"
31
+ ],
32
+ "type": "module",
33
+ "main": "dist/index.js",
34
+ "license": "MIT",
35
+ "devDependencies": {
36
+ "@changesets/cli": "^2.29.7",
37
+ "prettier": "^3.6.2",
38
+ "typescript": "^5.9.3",
39
+ "vitest": "^4.0.10"
40
+ },
41
+ "types": "./dist/index.d.ts",
42
+ "bugs": {
43
+ "url": "https://github.com/RashadNazarzade/field-generator/issues"
44
+ },
45
+ "homepage": "https://github.com/RashadNazarzade/field-generator#readme"
46
+ }