create-quadrokit 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/README.md +2 -2
  2. package/biome.monorepo.json +67 -0
  3. package/dist/index.js +239 -0
  4. package/package.json +11 -4
  5. package/templates/README.md +37 -0
  6. package/templates/admin-shell/.cursor/rules/commitlint-conventional.mdc +47 -0
  7. package/templates/admin-shell/.env.example +2 -0
  8. package/templates/admin-shell/biome.json +12 -0
  9. package/templates/admin-shell/index.html +12 -0
  10. package/templates/admin-shell/package.json +45 -0
  11. package/templates/admin-shell/postcss.config.js +6 -0
  12. package/templates/admin-shell/src/components/AppShell.tsx +68 -0
  13. package/templates/admin-shell/src/i18n.ts +12 -0
  14. package/templates/admin-shell/src/lib/quadro-client.ts +4 -0
  15. package/templates/admin-shell/src/locales/en.json +15 -0
  16. package/templates/admin-shell/src/main.tsx +15 -0
  17. package/templates/admin-shell/src/pages/AgenciesPage.tsx +69 -0
  18. package/templates/admin-shell/src/pages/HomePage.tsx +67 -0
  19. package/templates/admin-shell/src/router.tsx +15 -0
  20. package/templates/admin-shell/src/stores/useSidebarHint.ts +12 -0
  21. package/templates/admin-shell/src/vite-env.d.ts +9 -0
  22. package/templates/admin-shell/tailwind.config.ts +7 -0
  23. package/templates/admin-shell/tsconfig.app.json +16 -0
  24. package/templates/admin-shell/tsconfig.json +4 -0
  25. package/templates/admin-shell/tsconfig.node.json +10 -0
  26. package/templates/admin-shell/vite.config.ts +25 -0
  27. package/templates/dashboard/.cursor/rules/commitlint-conventional.mdc +47 -0
  28. package/templates/dashboard/.env.example +2 -0
  29. package/templates/dashboard/biome.json +12 -0
  30. package/templates/dashboard/index.html +12 -0
  31. package/templates/dashboard/package.json +45 -0
  32. package/templates/dashboard/postcss.config.js +6 -0
  33. package/templates/dashboard/src/components/AppShell.tsx +44 -0
  34. package/templates/dashboard/src/i18n.ts +12 -0
  35. package/templates/dashboard/src/lib/quadro-client.ts +4 -0
  36. package/templates/dashboard/src/locales/en.json +15 -0
  37. package/templates/dashboard/src/main.tsx +15 -0
  38. package/templates/dashboard/src/pages/AgenciesPage.tsx +69 -0
  39. package/templates/dashboard/src/pages/HomePage.tsx +67 -0
  40. package/templates/dashboard/src/router.tsx +15 -0
  41. package/templates/dashboard/src/stores/useSidebarHint.ts +12 -0
  42. package/templates/dashboard/src/vite-env.d.ts +9 -0
  43. package/templates/dashboard/tailwind.config.ts +7 -0
  44. package/templates/dashboard/tsconfig.app.json +16 -0
  45. package/templates/dashboard/tsconfig.json +4 -0
  46. package/templates/dashboard/tsconfig.node.json +10 -0
  47. package/templates/dashboard/vite.config.ts +25 -0
  48. package/templates/ecommerce/.cursor/rules/commitlint-conventional.mdc +47 -0
  49. package/templates/ecommerce/.env.example +2 -0
  50. package/templates/ecommerce/biome.json +12 -0
  51. package/templates/ecommerce/index.html +12 -0
  52. package/templates/ecommerce/package.json +45 -0
  53. package/templates/ecommerce/postcss.config.js +6 -0
  54. package/templates/ecommerce/src/components/AppShell.tsx +44 -0
  55. package/templates/ecommerce/src/i18n.ts +12 -0
  56. package/templates/ecommerce/src/lib/quadro-client.ts +4 -0
  57. package/templates/ecommerce/src/locales/en.json +20 -0
  58. package/templates/ecommerce/src/main.tsx +15 -0
  59. package/templates/ecommerce/src/pages/AgenciesPage.tsx +69 -0
  60. package/templates/ecommerce/src/pages/HomePage.tsx +52 -0
  61. package/templates/ecommerce/src/router.tsx +15 -0
  62. package/templates/ecommerce/src/stores/useSidebarHint.ts +12 -0
  63. package/templates/ecommerce/src/vite-env.d.ts +9 -0
  64. package/templates/ecommerce/tailwind.config.ts +7 -0
  65. package/templates/ecommerce/tsconfig.app.json +16 -0
  66. package/templates/ecommerce/tsconfig.json +4 -0
  67. package/templates/ecommerce/tsconfig.node.json +10 -0
  68. package/templates/ecommerce/vite.config.ts +25 -0
  69. package/templates/website/.cursor/rules/commitlint-conventional.mdc +47 -0
  70. package/templates/website/.env.example +2 -0
  71. package/templates/website/biome.json +12 -0
  72. package/templates/website/index.html +12 -0
  73. package/templates/website/package.json +45 -0
  74. package/templates/website/postcss.config.js +6 -0
  75. package/templates/website/src/components/AppShell.tsx +44 -0
  76. package/templates/website/src/i18n.ts +12 -0
  77. package/templates/website/src/lib/quadro-client.ts +4 -0
  78. package/templates/website/src/locales/en.json +21 -0
  79. package/templates/website/src/main.tsx +15 -0
  80. package/templates/website/src/pages/AgenciesPage.tsx +69 -0
  81. package/templates/website/src/pages/HomePage.tsx +83 -0
  82. package/templates/website/src/router.tsx +15 -0
  83. package/templates/website/src/stores/useSidebarHint.ts +12 -0
  84. package/templates/website/src/vite-env.d.ts +9 -0
  85. package/templates/website/tailwind.config.ts +7 -0
  86. package/templates/website/tsconfig.app.json +16 -0
  87. package/templates/website/tsconfig.json +4 -0
  88. package/templates/website/tsconfig.node.json +10 -0
  89. package/templates/website/vite.config.ts +25 -0
  90. package/vendor/generated/client.gen.ts +2725 -0
  91. package/vendor/generated/meta.json +5 -0
  92. package/vendor/generated/types.gen.ts +991 -0
  93. package/src/index.ts +0 -237
  94. package/tsconfig.json +0 -9
@@ -0,0 +1,2725 @@
1
+ /* eslint-disable */
2
+ /* Auto-generated by @quadrokit/client — do not edit */
3
+
4
+ import {
5
+ type CollectionHandle,
6
+ type CollectionOptions,
7
+ QuadroHttp,
8
+ type SelectedEntity,
9
+ attachRelatedApis,
10
+ callDatastorePath,
11
+ makeDataClassApi,
12
+ } from '@quadrokit/client/runtime';
13
+
14
+ import type {
15
+ Agency,
16
+ AgencyPath,
17
+ Car,
18
+ CarModel,
19
+ CarModelPath,
20
+ CarPath,
21
+ CategoryAgency,
22
+ CategoryAgencyPath,
23
+ CategoryCar,
24
+ CategoryCarPath,
25
+ ChosenOptions,
26
+ ChosenOptionsPath,
27
+ Color,
28
+ ColorPath,
29
+ Customer,
30
+ CustomerPath,
31
+ Defect,
32
+ DefectCategory,
33
+ DefectCategoryPath,
34
+ DefectPath,
35
+ DefectiveElement,
36
+ DefectiveElementPath,
37
+ Department,
38
+ DepartmentPath,
39
+ Employee,
40
+ EmployeePath,
41
+ Inventory,
42
+ InventoryPath,
43
+ OptionAvailable,
44
+ OptionAvailablePath,
45
+ OptionCategory,
46
+ OptionCategoryPath,
47
+ Region,
48
+ RegionPath,
49
+ Reservation,
50
+ ReservationPath,
51
+ Status,
52
+ StatusPath,
53
+ User,
54
+ UserPath,
55
+ } from './types.gen.js';
56
+
57
+ export const quadrokitCatalogMeta = {
58
+ __NAME: 'carsQodlyRent',
59
+ sessionCookieName: '4DSID_carsQodlyRent',
60
+ } as const;
61
+
62
+ export interface QuadroClientConfig {
63
+ baseURL: string;
64
+ fetchImpl?: typeof fetch;
65
+ defaultHeaders?: Record<string, string>;
66
+ }
67
+
68
+ export function createClient(config: QuadroClientConfig) {
69
+ const http = new QuadroHttp({
70
+ baseURL: config.baseURL,
71
+ fetchImpl: config.fetchImpl,
72
+ defaultHeaders: config.defaultHeaders,
73
+ });
74
+
75
+ function mapAgencyRow(http: QuadroHttp, raw: unknown): Agency {
76
+ const row = raw as Agency;
77
+ const pk = (row as { ID?: number }).ID ?? (row as { id?: number }).id;
78
+ attachRelatedApis(
79
+ raw,
80
+ {
81
+ http,
82
+ parentClass: 'Agency',
83
+ parentId: pk as number,
84
+ relationMap: {
85
+ manager: 'Employee',
86
+ category: 'CategoryAgency',
87
+ department: 'Department',
88
+ },
89
+ keyNames: {
90
+ Agency: ['ID'],
91
+ Employee: ['ID'],
92
+ Customer: ['ID'],
93
+ CarModel: ['ID'],
94
+ Region: ['ID'],
95
+ Car: ['ID'],
96
+ Reservation: ['ID'],
97
+ Inventory: ['ID'],
98
+ Status: ['ID'],
99
+ Color: ['ID'],
100
+ OptionCategory: ['ID'],
101
+ Defect: ['ID'],
102
+ CategoryCar: ['ID'],
103
+ ChosenOptions: ['ID'],
104
+ DefectCategory: ['ID'],
105
+ DefectiveElement: ['ID'],
106
+ OptionAvailable: ['ID'],
107
+ Department: ['ID'],
108
+ CategoryAgency: ['ID'],
109
+ User: ['ID'],
110
+ },
111
+ },
112
+ [
113
+ { attr: 'reservationsDeparted', targetClass: 'Reservation' },
114
+ { attr: 'reservationsArrived', targetClass: 'Reservation' },
115
+ { attr: 'employees', targetClass: 'Employee' },
116
+ { attr: 'cars', targetClass: 'Car' },
117
+ { attr: 'todayBookings', targetClass: 'Reservation' },
118
+ ],
119
+ );
120
+ return row;
121
+ }
122
+
123
+ function mapEmployeeRow(http: QuadroHttp, raw: unknown): Employee {
124
+ const row = raw as Employee;
125
+ const pk = (row as { ID?: number }).ID ?? (row as { id?: number }).id;
126
+ attachRelatedApis(
127
+ raw,
128
+ {
129
+ http,
130
+ parentClass: 'Employee',
131
+ parentId: pk as number,
132
+ relationMap: { employeeAgency: 'Agency' },
133
+ keyNames: {
134
+ Agency: ['ID'],
135
+ Employee: ['ID'],
136
+ Customer: ['ID'],
137
+ CarModel: ['ID'],
138
+ Region: ['ID'],
139
+ Car: ['ID'],
140
+ Reservation: ['ID'],
141
+ Inventory: ['ID'],
142
+ Status: ['ID'],
143
+ Color: ['ID'],
144
+ OptionCategory: ['ID'],
145
+ Defect: ['ID'],
146
+ CategoryCar: ['ID'],
147
+ ChosenOptions: ['ID'],
148
+ DefectCategory: ['ID'],
149
+ DefectiveElement: ['ID'],
150
+ OptionAvailable: ['ID'],
151
+ Department: ['ID'],
152
+ CategoryAgency: ['ID'],
153
+ User: ['ID'],
154
+ },
155
+ },
156
+ [
157
+ { attr: 'reservations', targetClass: 'Reservation' },
158
+ { attr: 'managedAgencies', targetClass: 'Agency' },
159
+ { attr: 'inventories', targetClass: 'Inventory' },
160
+ { attr: 'users', targetClass: 'User' },
161
+ ],
162
+ );
163
+ return row;
164
+ }
165
+
166
+ function mapCustomerRow(http: QuadroHttp, raw: unknown): Customer {
167
+ const row = raw as Customer;
168
+ const pk = (row as { ID?: number }).ID ?? (row as { id?: number }).id;
169
+ attachRelatedApis(
170
+ raw,
171
+ {
172
+ http,
173
+ parentClass: 'Customer',
174
+ parentId: pk as number,
175
+ relationMap: {},
176
+ keyNames: {
177
+ Agency: ['ID'],
178
+ Employee: ['ID'],
179
+ Customer: ['ID'],
180
+ CarModel: ['ID'],
181
+ Region: ['ID'],
182
+ Car: ['ID'],
183
+ Reservation: ['ID'],
184
+ Inventory: ['ID'],
185
+ Status: ['ID'],
186
+ Color: ['ID'],
187
+ OptionCategory: ['ID'],
188
+ Defect: ['ID'],
189
+ CategoryCar: ['ID'],
190
+ ChosenOptions: ['ID'],
191
+ DefectCategory: ['ID'],
192
+ DefectiveElement: ['ID'],
193
+ OptionAvailable: ['ID'],
194
+ Department: ['ID'],
195
+ CategoryAgency: ['ID'],
196
+ User: ['ID'],
197
+ },
198
+ },
199
+ [{ attr: 'reservations', targetClass: 'Reservation' }],
200
+ );
201
+ return row;
202
+ }
203
+
204
+ function mapCarModelRow(http: QuadroHttp, raw: unknown): CarModel {
205
+ const row = raw as CarModel;
206
+ const pk = (row as { ID?: number }).ID ?? (row as { id?: number }).id;
207
+ attachRelatedApis(
208
+ raw,
209
+ {
210
+ http,
211
+ parentClass: 'CarModel',
212
+ parentId: pk as number,
213
+ relationMap: { category: 'CategoryCar' },
214
+ keyNames: {
215
+ Agency: ['ID'],
216
+ Employee: ['ID'],
217
+ Customer: ['ID'],
218
+ CarModel: ['ID'],
219
+ Region: ['ID'],
220
+ Car: ['ID'],
221
+ Reservation: ['ID'],
222
+ Inventory: ['ID'],
223
+ Status: ['ID'],
224
+ Color: ['ID'],
225
+ OptionCategory: ['ID'],
226
+ Defect: ['ID'],
227
+ CategoryCar: ['ID'],
228
+ ChosenOptions: ['ID'],
229
+ DefectCategory: ['ID'],
230
+ DefectiveElement: ['ID'],
231
+ OptionAvailable: ['ID'],
232
+ Department: ['ID'],
233
+ CategoryAgency: ['ID'],
234
+ User: ['ID'],
235
+ },
236
+ },
237
+ [{ attr: 'cars', targetClass: 'Car' }],
238
+ );
239
+ return row;
240
+ }
241
+
242
+ function mapRegionRow(http: QuadroHttp, raw: unknown): Region {
243
+ const row = raw as Region;
244
+ const pk = (row as { ID?: number }).ID ?? (row as { id?: number }).id;
245
+ attachRelatedApis(
246
+ raw,
247
+ {
248
+ http,
249
+ parentClass: 'Region',
250
+ parentId: pk as number,
251
+ relationMap: {},
252
+ keyNames: {
253
+ Agency: ['ID'],
254
+ Employee: ['ID'],
255
+ Customer: ['ID'],
256
+ CarModel: ['ID'],
257
+ Region: ['ID'],
258
+ Car: ['ID'],
259
+ Reservation: ['ID'],
260
+ Inventory: ['ID'],
261
+ Status: ['ID'],
262
+ Color: ['ID'],
263
+ OptionCategory: ['ID'],
264
+ Defect: ['ID'],
265
+ CategoryCar: ['ID'],
266
+ ChosenOptions: ['ID'],
267
+ DefectCategory: ['ID'],
268
+ DefectiveElement: ['ID'],
269
+ OptionAvailable: ['ID'],
270
+ Department: ['ID'],
271
+ CategoryAgency: ['ID'],
272
+ User: ['ID'],
273
+ },
274
+ },
275
+ [{ attr: 'departments', targetClass: 'Department' }],
276
+ );
277
+ return row;
278
+ }
279
+
280
+ function mapCarRow(http: QuadroHttp, raw: unknown): Car {
281
+ const row = raw as Car;
282
+ const pk = (row as { ID?: number }).ID ?? (row as { id?: number }).id;
283
+ attachRelatedApis(
284
+ raw,
285
+ {
286
+ http,
287
+ parentClass: 'Car',
288
+ parentId: pk as number,
289
+ relationMap: { color: 'Color', model: 'CarModel', agency: 'Agency' },
290
+ keyNames: {
291
+ Agency: ['ID'],
292
+ Employee: ['ID'],
293
+ Customer: ['ID'],
294
+ CarModel: ['ID'],
295
+ Region: ['ID'],
296
+ Car: ['ID'],
297
+ Reservation: ['ID'],
298
+ Inventory: ['ID'],
299
+ Status: ['ID'],
300
+ Color: ['ID'],
301
+ OptionCategory: ['ID'],
302
+ Defect: ['ID'],
303
+ CategoryCar: ['ID'],
304
+ ChosenOptions: ['ID'],
305
+ DefectCategory: ['ID'],
306
+ DefectiveElement: ['ID'],
307
+ OptionAvailable: ['ID'],
308
+ Department: ['ID'],
309
+ CategoryAgency: ['ID'],
310
+ User: ['ID'],
311
+ },
312
+ },
313
+ [
314
+ { attr: 'reservations', targetClass: 'Reservation' },
315
+ { attr: 'defects', targetClass: 'Defect' },
316
+ ],
317
+ );
318
+ return row;
319
+ }
320
+
321
+ function mapReservationRow(http: QuadroHttp, raw: unknown): Reservation {
322
+ const row = raw as Reservation;
323
+ const pk = (row as { ID?: number }).ID ?? (row as { id?: number }).id;
324
+ attachRelatedApis(
325
+ raw,
326
+ {
327
+ http,
328
+ parentClass: 'Reservation',
329
+ parentId: pk as number,
330
+ relationMap: {
331
+ departureAgency: 'Agency',
332
+ car: 'Car',
333
+ arrivalAgency: 'Agency',
334
+ employee: 'Employee',
335
+ customer: 'Customer',
336
+ departureInventory: 'Inventory',
337
+ arrivalInventory: 'Inventory',
338
+ status: 'Status',
339
+ categoryCar: 'CategoryCar',
340
+ },
341
+ keyNames: {
342
+ Agency: ['ID'],
343
+ Employee: ['ID'],
344
+ Customer: ['ID'],
345
+ CarModel: ['ID'],
346
+ Region: ['ID'],
347
+ Car: ['ID'],
348
+ Reservation: ['ID'],
349
+ Inventory: ['ID'],
350
+ Status: ['ID'],
351
+ Color: ['ID'],
352
+ OptionCategory: ['ID'],
353
+ Defect: ['ID'],
354
+ CategoryCar: ['ID'],
355
+ ChosenOptions: ['ID'],
356
+ DefectCategory: ['ID'],
357
+ DefectiveElement: ['ID'],
358
+ OptionAvailable: ['ID'],
359
+ Department: ['ID'],
360
+ CategoryAgency: ['ID'],
361
+ User: ['ID'],
362
+ },
363
+ },
364
+ [
365
+ { attr: 'chosenOptions', targetClass: 'ChosenOptions' },
366
+ { attr: 'alternatives', targetClass: 'Car' },
367
+ ],
368
+ );
369
+ return row;
370
+ }
371
+
372
+ function mapInventoryRow(http: QuadroHttp, raw: unknown): Inventory {
373
+ const row = raw as Inventory;
374
+ const pk = (row as { ID?: number }).ID ?? (row as { id?: number }).id;
375
+ attachRelatedApis(
376
+ raw,
377
+ {
378
+ http,
379
+ parentClass: 'Inventory',
380
+ parentId: pk as number,
381
+ relationMap: { employee: 'Employee' },
382
+ keyNames: {
383
+ Agency: ['ID'],
384
+ Employee: ['ID'],
385
+ Customer: ['ID'],
386
+ CarModel: ['ID'],
387
+ Region: ['ID'],
388
+ Car: ['ID'],
389
+ Reservation: ['ID'],
390
+ Inventory: ['ID'],
391
+ Status: ['ID'],
392
+ Color: ['ID'],
393
+ OptionCategory: ['ID'],
394
+ Defect: ['ID'],
395
+ CategoryCar: ['ID'],
396
+ ChosenOptions: ['ID'],
397
+ DefectCategory: ['ID'],
398
+ DefectiveElement: ['ID'],
399
+ OptionAvailable: ['ID'],
400
+ Department: ['ID'],
401
+ CategoryAgency: ['ID'],
402
+ User: ['ID'],
403
+ },
404
+ },
405
+ [
406
+ { attr: 'reservationDeparture', targetClass: 'Reservation' },
407
+ { attr: 'reservationArrival', targetClass: 'Reservation' },
408
+ { attr: 'defects', targetClass: 'Defect' },
409
+ ],
410
+ );
411
+ return row;
412
+ }
413
+
414
+ function mapStatusRow(http: QuadroHttp, raw: unknown): Status {
415
+ const row = raw as Status;
416
+ const pk = (row as { ID?: number }).ID ?? (row as { id?: number }).id;
417
+ attachRelatedApis(
418
+ raw,
419
+ {
420
+ http,
421
+ parentClass: 'Status',
422
+ parentId: pk as number,
423
+ relationMap: {},
424
+ keyNames: {
425
+ Agency: ['ID'],
426
+ Employee: ['ID'],
427
+ Customer: ['ID'],
428
+ CarModel: ['ID'],
429
+ Region: ['ID'],
430
+ Car: ['ID'],
431
+ Reservation: ['ID'],
432
+ Inventory: ['ID'],
433
+ Status: ['ID'],
434
+ Color: ['ID'],
435
+ OptionCategory: ['ID'],
436
+ Defect: ['ID'],
437
+ CategoryCar: ['ID'],
438
+ ChosenOptions: ['ID'],
439
+ DefectCategory: ['ID'],
440
+ DefectiveElement: ['ID'],
441
+ OptionAvailable: ['ID'],
442
+ Department: ['ID'],
443
+ CategoryAgency: ['ID'],
444
+ User: ['ID'],
445
+ },
446
+ },
447
+ [{ attr: 'reservations', targetClass: 'Reservation' }],
448
+ );
449
+ return row;
450
+ }
451
+
452
+ function mapColorRow(http: QuadroHttp, raw: unknown): Color {
453
+ const row = raw as Color;
454
+ const pk = (row as { ID?: number }).ID ?? (row as { id?: number }).id;
455
+ attachRelatedApis(
456
+ raw,
457
+ {
458
+ http,
459
+ parentClass: 'Color',
460
+ parentId: pk as number,
461
+ relationMap: {},
462
+ keyNames: {
463
+ Agency: ['ID'],
464
+ Employee: ['ID'],
465
+ Customer: ['ID'],
466
+ CarModel: ['ID'],
467
+ Region: ['ID'],
468
+ Car: ['ID'],
469
+ Reservation: ['ID'],
470
+ Inventory: ['ID'],
471
+ Status: ['ID'],
472
+ Color: ['ID'],
473
+ OptionCategory: ['ID'],
474
+ Defect: ['ID'],
475
+ CategoryCar: ['ID'],
476
+ ChosenOptions: ['ID'],
477
+ DefectCategory: ['ID'],
478
+ DefectiveElement: ['ID'],
479
+ OptionAvailable: ['ID'],
480
+ Department: ['ID'],
481
+ CategoryAgency: ['ID'],
482
+ User: ['ID'],
483
+ },
484
+ },
485
+ [{ attr: 'cars', targetClass: 'Car' }],
486
+ );
487
+ return row;
488
+ }
489
+
490
+ function mapOptionCategoryRow(
491
+ http: QuadroHttp,
492
+ raw: unknown,
493
+ ): OptionCategory {
494
+ const row = raw as OptionCategory;
495
+ const pk = (row as { ID?: number }).ID ?? (row as { id?: number }).id;
496
+ attachRelatedApis(
497
+ raw,
498
+ {
499
+ http,
500
+ parentClass: 'OptionCategory',
501
+ parentId: pk as number,
502
+ relationMap: {},
503
+ keyNames: {
504
+ Agency: ['ID'],
505
+ Employee: ['ID'],
506
+ Customer: ['ID'],
507
+ CarModel: ['ID'],
508
+ Region: ['ID'],
509
+ Car: ['ID'],
510
+ Reservation: ['ID'],
511
+ Inventory: ['ID'],
512
+ Status: ['ID'],
513
+ Color: ['ID'],
514
+ OptionCategory: ['ID'],
515
+ Defect: ['ID'],
516
+ CategoryCar: ['ID'],
517
+ ChosenOptions: ['ID'],
518
+ DefectCategory: ['ID'],
519
+ DefectiveElement: ['ID'],
520
+ OptionAvailable: ['ID'],
521
+ Department: ['ID'],
522
+ CategoryAgency: ['ID'],
523
+ User: ['ID'],
524
+ },
525
+ },
526
+ [{ attr: 'options', targetClass: 'OptionAvailable' }],
527
+ );
528
+ return row;
529
+ }
530
+
531
+ function mapDefectRow(http: QuadroHttp, raw: unknown): Defect {
532
+ const row = raw as Defect;
533
+ const pk = (row as { ID?: number }).ID ?? (row as { id?: number }).id;
534
+ attachRelatedApis(
535
+ raw,
536
+ {
537
+ http,
538
+ parentClass: 'Defect',
539
+ parentId: pk as number,
540
+ relationMap: {
541
+ element: 'DefectiveElement',
542
+ inventory: 'Inventory',
543
+ car: 'Car',
544
+ },
545
+ keyNames: {
546
+ Agency: ['ID'],
547
+ Employee: ['ID'],
548
+ Customer: ['ID'],
549
+ CarModel: ['ID'],
550
+ Region: ['ID'],
551
+ Car: ['ID'],
552
+ Reservation: ['ID'],
553
+ Inventory: ['ID'],
554
+ Status: ['ID'],
555
+ Color: ['ID'],
556
+ OptionCategory: ['ID'],
557
+ Defect: ['ID'],
558
+ CategoryCar: ['ID'],
559
+ ChosenOptions: ['ID'],
560
+ DefectCategory: ['ID'],
561
+ DefectiveElement: ['ID'],
562
+ OptionAvailable: ['ID'],
563
+ Department: ['ID'],
564
+ CategoryAgency: ['ID'],
565
+ User: ['ID'],
566
+ },
567
+ },
568
+ [],
569
+ );
570
+ return row;
571
+ }
572
+
573
+ function mapCategoryCarRow(http: QuadroHttp, raw: unknown): CategoryCar {
574
+ const row = raw as CategoryCar;
575
+ const pk = (row as { ID?: number }).ID ?? (row as { id?: number }).id;
576
+ attachRelatedApis(
577
+ raw,
578
+ {
579
+ http,
580
+ parentClass: 'CategoryCar',
581
+ parentId: pk as number,
582
+ relationMap: {},
583
+ keyNames: {
584
+ Agency: ['ID'],
585
+ Employee: ['ID'],
586
+ Customer: ['ID'],
587
+ CarModel: ['ID'],
588
+ Region: ['ID'],
589
+ Car: ['ID'],
590
+ Reservation: ['ID'],
591
+ Inventory: ['ID'],
592
+ Status: ['ID'],
593
+ Color: ['ID'],
594
+ OptionCategory: ['ID'],
595
+ Defect: ['ID'],
596
+ CategoryCar: ['ID'],
597
+ ChosenOptions: ['ID'],
598
+ DefectCategory: ['ID'],
599
+ DefectiveElement: ['ID'],
600
+ OptionAvailable: ['ID'],
601
+ Department: ['ID'],
602
+ CategoryAgency: ['ID'],
603
+ User: ['ID'],
604
+ },
605
+ },
606
+ [
607
+ { attr: 'reservations', targetClass: 'Reservation' },
608
+ { attr: 'carsModel', targetClass: 'CarModel' },
609
+ ],
610
+ );
611
+ return row;
612
+ }
613
+
614
+ function mapChosenOptionsRow(http: QuadroHttp, raw: unknown): ChosenOptions {
615
+ const row = raw as ChosenOptions;
616
+ const pk = (row as { ID?: number }).ID ?? (row as { id?: number }).id;
617
+ attachRelatedApis(
618
+ raw,
619
+ {
620
+ http,
621
+ parentClass: 'ChosenOptions',
622
+ parentId: pk as number,
623
+ relationMap: {
624
+ reservation: 'Reservation',
625
+ optionChosen: 'OptionAvailable',
626
+ },
627
+ keyNames: {
628
+ Agency: ['ID'],
629
+ Employee: ['ID'],
630
+ Customer: ['ID'],
631
+ CarModel: ['ID'],
632
+ Region: ['ID'],
633
+ Car: ['ID'],
634
+ Reservation: ['ID'],
635
+ Inventory: ['ID'],
636
+ Status: ['ID'],
637
+ Color: ['ID'],
638
+ OptionCategory: ['ID'],
639
+ Defect: ['ID'],
640
+ CategoryCar: ['ID'],
641
+ ChosenOptions: ['ID'],
642
+ DefectCategory: ['ID'],
643
+ DefectiveElement: ['ID'],
644
+ OptionAvailable: ['ID'],
645
+ Department: ['ID'],
646
+ CategoryAgency: ['ID'],
647
+ User: ['ID'],
648
+ },
649
+ },
650
+ [],
651
+ );
652
+ return row;
653
+ }
654
+
655
+ function mapDefectCategoryRow(
656
+ http: QuadroHttp,
657
+ raw: unknown,
658
+ ): DefectCategory {
659
+ const row = raw as DefectCategory;
660
+ const pk = (row as { ID?: number }).ID ?? (row as { id?: number }).id;
661
+ attachRelatedApis(
662
+ raw,
663
+ {
664
+ http,
665
+ parentClass: 'DefectCategory',
666
+ parentId: pk as number,
667
+ relationMap: {},
668
+ keyNames: {
669
+ Agency: ['ID'],
670
+ Employee: ['ID'],
671
+ Customer: ['ID'],
672
+ CarModel: ['ID'],
673
+ Region: ['ID'],
674
+ Car: ['ID'],
675
+ Reservation: ['ID'],
676
+ Inventory: ['ID'],
677
+ Status: ['ID'],
678
+ Color: ['ID'],
679
+ OptionCategory: ['ID'],
680
+ Defect: ['ID'],
681
+ CategoryCar: ['ID'],
682
+ ChosenOptions: ['ID'],
683
+ DefectCategory: ['ID'],
684
+ DefectiveElement: ['ID'],
685
+ OptionAvailable: ['ID'],
686
+ Department: ['ID'],
687
+ CategoryAgency: ['ID'],
688
+ User: ['ID'],
689
+ },
690
+ },
691
+ [{ attr: 'defectiveElements', targetClass: 'DefectiveElement' }],
692
+ );
693
+ return row;
694
+ }
695
+
696
+ function mapDefectiveElementRow(
697
+ http: QuadroHttp,
698
+ raw: unknown,
699
+ ): DefectiveElement {
700
+ const row = raw as DefectiveElement;
701
+ const pk = (row as { ID?: number }).ID ?? (row as { id?: number }).id;
702
+ attachRelatedApis(
703
+ raw,
704
+ {
705
+ http,
706
+ parentClass: 'DefectiveElement',
707
+ parentId: pk as number,
708
+ relationMap: { category: 'DefectCategory' },
709
+ keyNames: {
710
+ Agency: ['ID'],
711
+ Employee: ['ID'],
712
+ Customer: ['ID'],
713
+ CarModel: ['ID'],
714
+ Region: ['ID'],
715
+ Car: ['ID'],
716
+ Reservation: ['ID'],
717
+ Inventory: ['ID'],
718
+ Status: ['ID'],
719
+ Color: ['ID'],
720
+ OptionCategory: ['ID'],
721
+ Defect: ['ID'],
722
+ CategoryCar: ['ID'],
723
+ ChosenOptions: ['ID'],
724
+ DefectCategory: ['ID'],
725
+ DefectiveElement: ['ID'],
726
+ OptionAvailable: ['ID'],
727
+ Department: ['ID'],
728
+ CategoryAgency: ['ID'],
729
+ User: ['ID'],
730
+ },
731
+ },
732
+ [{ attr: 'defects', targetClass: 'Defect' }],
733
+ );
734
+ return row;
735
+ }
736
+
737
+ function mapOptionAvailableRow(
738
+ http: QuadroHttp,
739
+ raw: unknown,
740
+ ): OptionAvailable {
741
+ const row = raw as OptionAvailable;
742
+ const pk = (row as { ID?: number }).ID ?? (row as { id?: number }).id;
743
+ attachRelatedApis(
744
+ raw,
745
+ {
746
+ http,
747
+ parentClass: 'OptionAvailable',
748
+ parentId: pk as number,
749
+ relationMap: { category: 'OptionCategory' },
750
+ keyNames: {
751
+ Agency: ['ID'],
752
+ Employee: ['ID'],
753
+ Customer: ['ID'],
754
+ CarModel: ['ID'],
755
+ Region: ['ID'],
756
+ Car: ['ID'],
757
+ Reservation: ['ID'],
758
+ Inventory: ['ID'],
759
+ Status: ['ID'],
760
+ Color: ['ID'],
761
+ OptionCategory: ['ID'],
762
+ Defect: ['ID'],
763
+ CategoryCar: ['ID'],
764
+ ChosenOptions: ['ID'],
765
+ DefectCategory: ['ID'],
766
+ DefectiveElement: ['ID'],
767
+ OptionAvailable: ['ID'],
768
+ Department: ['ID'],
769
+ CategoryAgency: ['ID'],
770
+ User: ['ID'],
771
+ },
772
+ },
773
+ [{ attr: 'chosenBy', targetClass: 'ChosenOptions' }],
774
+ );
775
+ return row;
776
+ }
777
+
778
+ function mapDepartmentRow(http: QuadroHttp, raw: unknown): Department {
779
+ const row = raw as Department;
780
+ const pk = (row as { ID?: number }).ID ?? (row as { id?: number }).id;
781
+ attachRelatedApis(
782
+ raw,
783
+ {
784
+ http,
785
+ parentClass: 'Department',
786
+ parentId: pk as number,
787
+ relationMap: { region: 'Region' },
788
+ keyNames: {
789
+ Agency: ['ID'],
790
+ Employee: ['ID'],
791
+ Customer: ['ID'],
792
+ CarModel: ['ID'],
793
+ Region: ['ID'],
794
+ Car: ['ID'],
795
+ Reservation: ['ID'],
796
+ Inventory: ['ID'],
797
+ Status: ['ID'],
798
+ Color: ['ID'],
799
+ OptionCategory: ['ID'],
800
+ Defect: ['ID'],
801
+ CategoryCar: ['ID'],
802
+ ChosenOptions: ['ID'],
803
+ DefectCategory: ['ID'],
804
+ DefectiveElement: ['ID'],
805
+ OptionAvailable: ['ID'],
806
+ Department: ['ID'],
807
+ CategoryAgency: ['ID'],
808
+ User: ['ID'],
809
+ },
810
+ },
811
+ [{ attr: 'agencies', targetClass: 'Agency' }],
812
+ );
813
+ return row;
814
+ }
815
+
816
+ function mapCategoryAgencyRow(
817
+ http: QuadroHttp,
818
+ raw: unknown,
819
+ ): CategoryAgency {
820
+ const row = raw as CategoryAgency;
821
+ const pk = (row as { ID?: number }).ID ?? (row as { id?: number }).id;
822
+ attachRelatedApis(
823
+ raw,
824
+ {
825
+ http,
826
+ parentClass: 'CategoryAgency',
827
+ parentId: pk as number,
828
+ relationMap: {},
829
+ keyNames: {
830
+ Agency: ['ID'],
831
+ Employee: ['ID'],
832
+ Customer: ['ID'],
833
+ CarModel: ['ID'],
834
+ Region: ['ID'],
835
+ Car: ['ID'],
836
+ Reservation: ['ID'],
837
+ Inventory: ['ID'],
838
+ Status: ['ID'],
839
+ Color: ['ID'],
840
+ OptionCategory: ['ID'],
841
+ Defect: ['ID'],
842
+ CategoryCar: ['ID'],
843
+ ChosenOptions: ['ID'],
844
+ DefectCategory: ['ID'],
845
+ DefectiveElement: ['ID'],
846
+ OptionAvailable: ['ID'],
847
+ Department: ['ID'],
848
+ CategoryAgency: ['ID'],
849
+ User: ['ID'],
850
+ },
851
+ },
852
+ [{ attr: 'agencies', targetClass: 'Agency' }],
853
+ );
854
+ return row;
855
+ }
856
+
857
+ function mapUserRow(http: QuadroHttp, raw: unknown): User {
858
+ const row = raw as User;
859
+ const pk = (row as { ID?: number }).ID ?? (row as { id?: number }).id;
860
+ attachRelatedApis(
861
+ raw,
862
+ {
863
+ http,
864
+ parentClass: 'User',
865
+ parentId: pk as number,
866
+ relationMap: { employee: 'Employee' },
867
+ keyNames: {
868
+ Agency: ['ID'],
869
+ Employee: ['ID'],
870
+ Customer: ['ID'],
871
+ CarModel: ['ID'],
872
+ Region: ['ID'],
873
+ Car: ['ID'],
874
+ Reservation: ['ID'],
875
+ Inventory: ['ID'],
876
+ Status: ['ID'],
877
+ Color: ['ID'],
878
+ OptionCategory: ['ID'],
879
+ Defect: ['ID'],
880
+ CategoryCar: ['ID'],
881
+ ChosenOptions: ['ID'],
882
+ DefectCategory: ['ID'],
883
+ DefectiveElement: ['ID'],
884
+ OptionAvailable: ['ID'],
885
+ Department: ['ID'],
886
+ CategoryAgency: ['ID'],
887
+ User: ['ID'],
888
+ },
889
+ },
890
+ [],
891
+ );
892
+ return row;
893
+ }
894
+
895
+ return {
896
+ authentify: {
897
+ login: (body: { email: string; password: string }) =>
898
+ callDatastorePath(http, ['authentify', 'login'], { body }),
899
+ },
900
+ Agency: (() => {
901
+ const cfg = {
902
+ http,
903
+ className: 'Agency',
904
+ relationMap: {
905
+ manager: 'Employee',
906
+ category: 'CategoryAgency',
907
+ department: 'Department',
908
+ },
909
+ keyNames: ['ID'],
910
+ } as const;
911
+ const api = makeDataClassApi<Agency>(cfg);
912
+ return {
913
+ all<S extends readonly AgencyPath[] = readonly []>(
914
+ options?: CollectionOptions & { select?: S },
915
+ ): CollectionHandle<
916
+ S['length'] extends 0 ? Agency : SelectedEntity<Agency, S>
917
+ > {
918
+ const inner = api.all(options as CollectionOptions);
919
+ return {
920
+ ...inner,
921
+ delete: inner.delete.bind(inner),
922
+ release: inner.release.bind(inner),
923
+ get length() {
924
+ return inner.length;
925
+ },
926
+ [Symbol.asyncIterator]() {
927
+ const it = inner[Symbol.asyncIterator]();
928
+ return {
929
+ async next() {
930
+ const n = await it.next();
931
+ if (!n.done && n.value) {
932
+ mapAgencyRow(http, n.value);
933
+ }
934
+ return n;
935
+ },
936
+ };
937
+ },
938
+ } as CollectionHandle<
939
+ S['length'] extends 0 ? Agency : SelectedEntity<Agency, S>
940
+ >;
941
+ },
942
+ async get<S extends readonly AgencyPath[] = readonly []>(
943
+ id: string | number,
944
+ options?: { select?: S },
945
+ ): Promise<
946
+ (S['length'] extends 0 ? Agency : SelectedEntity<Agency, S>) | null
947
+ > {
948
+ const entity = await api.get(id, options);
949
+ if (entity) {
950
+ mapAgencyRow(http, entity);
951
+ }
952
+ return entity as
953
+ | (S['length'] extends 0 ? Agency : SelectedEntity<Agency, S>)
954
+ | null;
955
+ },
956
+ delete: (id: string | number) => api.delete(id),
957
+ query<S extends readonly AgencyPath[] = readonly []>(
958
+ filter: string,
959
+ options?: CollectionOptions & { params?: unknown[]; select?: S },
960
+ ): CollectionHandle<
961
+ S['length'] extends 0 ? Agency : SelectedEntity<Agency, S>
962
+ > {
963
+ const inner = api.query(filter, options as CollectionOptions);
964
+ return {
965
+ ...inner,
966
+ delete: inner.delete.bind(inner),
967
+ release: inner.release.bind(inner),
968
+ get length() {
969
+ return inner.length;
970
+ },
971
+ [Symbol.asyncIterator]() {
972
+ const it = inner[Symbol.asyncIterator]();
973
+ return {
974
+ async next() {
975
+ const n = await it.next();
976
+ if (!n.done && n.value) {
977
+ mapAgencyRow(http, n.value);
978
+ }
979
+ return n;
980
+ },
981
+ };
982
+ },
983
+ } as CollectionHandle<
984
+ S['length'] extends 0 ? Agency : SelectedEntity<Agency, S>
985
+ >;
986
+ },
987
+ };
988
+ })(),
989
+ Employee: (() => {
990
+ const cfg = {
991
+ http,
992
+ className: 'Employee',
993
+ relationMap: { employeeAgency: 'Agency' },
994
+ keyNames: ['ID'],
995
+ } as const;
996
+ const api = makeDataClassApi<Employee>(cfg);
997
+ return {
998
+ all<S extends readonly EmployeePath[] = readonly []>(
999
+ options?: CollectionOptions & { select?: S },
1000
+ ): CollectionHandle<
1001
+ S['length'] extends 0 ? Employee : SelectedEntity<Employee, S>
1002
+ > {
1003
+ const inner = api.all(options as CollectionOptions);
1004
+ return {
1005
+ ...inner,
1006
+ delete: inner.delete.bind(inner),
1007
+ release: inner.release.bind(inner),
1008
+ get length() {
1009
+ return inner.length;
1010
+ },
1011
+ [Symbol.asyncIterator]() {
1012
+ const it = inner[Symbol.asyncIterator]();
1013
+ return {
1014
+ async next() {
1015
+ const n = await it.next();
1016
+ if (!n.done && n.value) {
1017
+ mapEmployeeRow(http, n.value);
1018
+ }
1019
+ return n;
1020
+ },
1021
+ };
1022
+ },
1023
+ } as CollectionHandle<
1024
+ S['length'] extends 0 ? Employee : SelectedEntity<Employee, S>
1025
+ >;
1026
+ },
1027
+ async get<S extends readonly EmployeePath[] = readonly []>(
1028
+ id: string | number,
1029
+ options?: { select?: S },
1030
+ ): Promise<
1031
+ | (S['length'] extends 0 ? Employee : SelectedEntity<Employee, S>)
1032
+ | null
1033
+ > {
1034
+ const entity = await api.get(id, options);
1035
+ if (entity) {
1036
+ mapEmployeeRow(http, entity);
1037
+ }
1038
+ return entity as
1039
+ | (S['length'] extends 0 ? Employee : SelectedEntity<Employee, S>)
1040
+ | null;
1041
+ },
1042
+ delete: (id: string | number) => api.delete(id),
1043
+ query<S extends readonly EmployeePath[] = readonly []>(
1044
+ filter: string,
1045
+ options?: CollectionOptions & { params?: unknown[]; select?: S },
1046
+ ): CollectionHandle<
1047
+ S['length'] extends 0 ? Employee : SelectedEntity<Employee, S>
1048
+ > {
1049
+ const inner = api.query(filter, options as CollectionOptions);
1050
+ return {
1051
+ ...inner,
1052
+ delete: inner.delete.bind(inner),
1053
+ release: inner.release.bind(inner),
1054
+ get length() {
1055
+ return inner.length;
1056
+ },
1057
+ [Symbol.asyncIterator]() {
1058
+ const it = inner[Symbol.asyncIterator]();
1059
+ return {
1060
+ async next() {
1061
+ const n = await it.next();
1062
+ if (!n.done && n.value) {
1063
+ mapEmployeeRow(http, n.value);
1064
+ }
1065
+ return n;
1066
+ },
1067
+ };
1068
+ },
1069
+ } as CollectionHandle<
1070
+ S['length'] extends 0 ? Employee : SelectedEntity<Employee, S>
1071
+ >;
1072
+ },
1073
+ };
1074
+ })(),
1075
+ Customer: (() => {
1076
+ const cfg = {
1077
+ http,
1078
+ className: 'Customer',
1079
+ relationMap: {},
1080
+ keyNames: ['ID'],
1081
+ } as const;
1082
+ const api = makeDataClassApi<Customer>(cfg);
1083
+ return {
1084
+ all<S extends readonly CustomerPath[] = readonly []>(
1085
+ options?: CollectionOptions & { select?: S },
1086
+ ): CollectionHandle<
1087
+ S['length'] extends 0 ? Customer : SelectedEntity<Customer, S>
1088
+ > {
1089
+ const inner = api.all(options as CollectionOptions);
1090
+ return {
1091
+ ...inner,
1092
+ delete: inner.delete.bind(inner),
1093
+ release: inner.release.bind(inner),
1094
+ get length() {
1095
+ return inner.length;
1096
+ },
1097
+ [Symbol.asyncIterator]() {
1098
+ const it = inner[Symbol.asyncIterator]();
1099
+ return {
1100
+ async next() {
1101
+ const n = await it.next();
1102
+ if (!n.done && n.value) {
1103
+ mapCustomerRow(http, n.value);
1104
+ }
1105
+ return n;
1106
+ },
1107
+ };
1108
+ },
1109
+ } as CollectionHandle<
1110
+ S['length'] extends 0 ? Customer : SelectedEntity<Customer, S>
1111
+ >;
1112
+ },
1113
+ async get<S extends readonly CustomerPath[] = readonly []>(
1114
+ id: string | number,
1115
+ options?: { select?: S },
1116
+ ): Promise<
1117
+ | (S['length'] extends 0 ? Customer : SelectedEntity<Customer, S>)
1118
+ | null
1119
+ > {
1120
+ const entity = await api.get(id, options);
1121
+ if (entity) {
1122
+ mapCustomerRow(http, entity);
1123
+ }
1124
+ return entity as
1125
+ | (S['length'] extends 0 ? Customer : SelectedEntity<Customer, S>)
1126
+ | null;
1127
+ },
1128
+ delete: (id: string | number) => api.delete(id),
1129
+ query<S extends readonly CustomerPath[] = readonly []>(
1130
+ filter: string,
1131
+ options?: CollectionOptions & { params?: unknown[]; select?: S },
1132
+ ): CollectionHandle<
1133
+ S['length'] extends 0 ? Customer : SelectedEntity<Customer, S>
1134
+ > {
1135
+ const inner = api.query(filter, options as CollectionOptions);
1136
+ return {
1137
+ ...inner,
1138
+ delete: inner.delete.bind(inner),
1139
+ release: inner.release.bind(inner),
1140
+ get length() {
1141
+ return inner.length;
1142
+ },
1143
+ [Symbol.asyncIterator]() {
1144
+ const it = inner[Symbol.asyncIterator]();
1145
+ return {
1146
+ async next() {
1147
+ const n = await it.next();
1148
+ if (!n.done && n.value) {
1149
+ mapCustomerRow(http, n.value);
1150
+ }
1151
+ return n;
1152
+ },
1153
+ };
1154
+ },
1155
+ } as CollectionHandle<
1156
+ S['length'] extends 0 ? Customer : SelectedEntity<Customer, S>
1157
+ >;
1158
+ },
1159
+ };
1160
+ })(),
1161
+ CarModel: (() => {
1162
+ const cfg = {
1163
+ http,
1164
+ className: 'CarModel',
1165
+ relationMap: { category: 'CategoryCar' },
1166
+ keyNames: ['ID'],
1167
+ } as const;
1168
+ const api = makeDataClassApi<CarModel>(cfg);
1169
+ return {
1170
+ all<S extends readonly CarModelPath[] = readonly []>(
1171
+ options?: CollectionOptions & { select?: S },
1172
+ ): CollectionHandle<
1173
+ S['length'] extends 0 ? CarModel : SelectedEntity<CarModel, S>
1174
+ > {
1175
+ const inner = api.all(options as CollectionOptions);
1176
+ return {
1177
+ ...inner,
1178
+ delete: inner.delete.bind(inner),
1179
+ release: inner.release.bind(inner),
1180
+ get length() {
1181
+ return inner.length;
1182
+ },
1183
+ [Symbol.asyncIterator]() {
1184
+ const it = inner[Symbol.asyncIterator]();
1185
+ return {
1186
+ async next() {
1187
+ const n = await it.next();
1188
+ if (!n.done && n.value) {
1189
+ mapCarModelRow(http, n.value);
1190
+ }
1191
+ return n;
1192
+ },
1193
+ };
1194
+ },
1195
+ } as CollectionHandle<
1196
+ S['length'] extends 0 ? CarModel : SelectedEntity<CarModel, S>
1197
+ >;
1198
+ },
1199
+ async get<S extends readonly CarModelPath[] = readonly []>(
1200
+ id: string | number,
1201
+ options?: { select?: S },
1202
+ ): Promise<
1203
+ | (S['length'] extends 0 ? CarModel : SelectedEntity<CarModel, S>)
1204
+ | null
1205
+ > {
1206
+ const entity = await api.get(id, options);
1207
+ if (entity) {
1208
+ mapCarModelRow(http, entity);
1209
+ }
1210
+ return entity as
1211
+ | (S['length'] extends 0 ? CarModel : SelectedEntity<CarModel, S>)
1212
+ | null;
1213
+ },
1214
+ delete: (id: string | number) => api.delete(id),
1215
+ query<S extends readonly CarModelPath[] = readonly []>(
1216
+ filter: string,
1217
+ options?: CollectionOptions & { params?: unknown[]; select?: S },
1218
+ ): CollectionHandle<
1219
+ S['length'] extends 0 ? CarModel : SelectedEntity<CarModel, S>
1220
+ > {
1221
+ const inner = api.query(filter, options as CollectionOptions);
1222
+ return {
1223
+ ...inner,
1224
+ delete: inner.delete.bind(inner),
1225
+ release: inner.release.bind(inner),
1226
+ get length() {
1227
+ return inner.length;
1228
+ },
1229
+ [Symbol.asyncIterator]() {
1230
+ const it = inner[Symbol.asyncIterator]();
1231
+ return {
1232
+ async next() {
1233
+ const n = await it.next();
1234
+ if (!n.done && n.value) {
1235
+ mapCarModelRow(http, n.value);
1236
+ }
1237
+ return n;
1238
+ },
1239
+ };
1240
+ },
1241
+ } as CollectionHandle<
1242
+ S['length'] extends 0 ? CarModel : SelectedEntity<CarModel, S>
1243
+ >;
1244
+ },
1245
+ };
1246
+ })(),
1247
+ Region: (() => {
1248
+ const cfg = {
1249
+ http,
1250
+ className: 'Region',
1251
+ relationMap: {},
1252
+ keyNames: ['ID'],
1253
+ } as const;
1254
+ const api = makeDataClassApi<Region>(cfg);
1255
+ return {
1256
+ all<S extends readonly RegionPath[] = readonly []>(
1257
+ options?: CollectionOptions & { select?: S },
1258
+ ): CollectionHandle<
1259
+ S['length'] extends 0 ? Region : SelectedEntity<Region, S>
1260
+ > {
1261
+ const inner = api.all(options as CollectionOptions);
1262
+ return {
1263
+ ...inner,
1264
+ delete: inner.delete.bind(inner),
1265
+ release: inner.release.bind(inner),
1266
+ get length() {
1267
+ return inner.length;
1268
+ },
1269
+ [Symbol.asyncIterator]() {
1270
+ const it = inner[Symbol.asyncIterator]();
1271
+ return {
1272
+ async next() {
1273
+ const n = await it.next();
1274
+ if (!n.done && n.value) {
1275
+ mapRegionRow(http, n.value);
1276
+ }
1277
+ return n;
1278
+ },
1279
+ };
1280
+ },
1281
+ } as CollectionHandle<
1282
+ S['length'] extends 0 ? Region : SelectedEntity<Region, S>
1283
+ >;
1284
+ },
1285
+ async get<S extends readonly RegionPath[] = readonly []>(
1286
+ id: string | number,
1287
+ options?: { select?: S },
1288
+ ): Promise<
1289
+ (S['length'] extends 0 ? Region : SelectedEntity<Region, S>) | null
1290
+ > {
1291
+ const entity = await api.get(id, options);
1292
+ if (entity) {
1293
+ mapRegionRow(http, entity);
1294
+ }
1295
+ return entity as
1296
+ | (S['length'] extends 0 ? Region : SelectedEntity<Region, S>)
1297
+ | null;
1298
+ },
1299
+ delete: (id: string | number) => api.delete(id),
1300
+ query<S extends readonly RegionPath[] = readonly []>(
1301
+ filter: string,
1302
+ options?: CollectionOptions & { params?: unknown[]; select?: S },
1303
+ ): CollectionHandle<
1304
+ S['length'] extends 0 ? Region : SelectedEntity<Region, S>
1305
+ > {
1306
+ const inner = api.query(filter, options as CollectionOptions);
1307
+ return {
1308
+ ...inner,
1309
+ delete: inner.delete.bind(inner),
1310
+ release: inner.release.bind(inner),
1311
+ get length() {
1312
+ return inner.length;
1313
+ },
1314
+ [Symbol.asyncIterator]() {
1315
+ const it = inner[Symbol.asyncIterator]();
1316
+ return {
1317
+ async next() {
1318
+ const n = await it.next();
1319
+ if (!n.done && n.value) {
1320
+ mapRegionRow(http, n.value);
1321
+ }
1322
+ return n;
1323
+ },
1324
+ };
1325
+ },
1326
+ } as CollectionHandle<
1327
+ S['length'] extends 0 ? Region : SelectedEntity<Region, S>
1328
+ >;
1329
+ },
1330
+ };
1331
+ })(),
1332
+ Car: (() => {
1333
+ const cfg = {
1334
+ http,
1335
+ className: 'Car',
1336
+ relationMap: { color: 'Color', model: 'CarModel', agency: 'Agency' },
1337
+ keyNames: ['ID'],
1338
+ } as const;
1339
+ const api = makeDataClassApi<Car>(cfg);
1340
+ return {
1341
+ all<S extends readonly CarPath[] = readonly []>(
1342
+ options?: CollectionOptions & { select?: S },
1343
+ ): CollectionHandle<
1344
+ S['length'] extends 0 ? Car : SelectedEntity<Car, S>
1345
+ > {
1346
+ const inner = api.all(options as CollectionOptions);
1347
+ return {
1348
+ ...inner,
1349
+ delete: inner.delete.bind(inner),
1350
+ release: inner.release.bind(inner),
1351
+ get length() {
1352
+ return inner.length;
1353
+ },
1354
+ [Symbol.asyncIterator]() {
1355
+ const it = inner[Symbol.asyncIterator]();
1356
+ return {
1357
+ async next() {
1358
+ const n = await it.next();
1359
+ if (!n.done && n.value) {
1360
+ mapCarRow(http, n.value);
1361
+ }
1362
+ return n;
1363
+ },
1364
+ };
1365
+ },
1366
+ } as CollectionHandle<
1367
+ S['length'] extends 0 ? Car : SelectedEntity<Car, S>
1368
+ >;
1369
+ },
1370
+ async get<S extends readonly CarPath[] = readonly []>(
1371
+ id: string | number,
1372
+ options?: { select?: S },
1373
+ ): Promise<
1374
+ (S['length'] extends 0 ? Car : SelectedEntity<Car, S>) | null
1375
+ > {
1376
+ const entity = await api.get(id, options);
1377
+ if (entity) {
1378
+ mapCarRow(http, entity);
1379
+ }
1380
+ return entity as
1381
+ | (S['length'] extends 0 ? Car : SelectedEntity<Car, S>)
1382
+ | null;
1383
+ },
1384
+ delete: (id: string | number) => api.delete(id),
1385
+ query<S extends readonly CarPath[] = readonly []>(
1386
+ filter: string,
1387
+ options?: CollectionOptions & { params?: unknown[]; select?: S },
1388
+ ): CollectionHandle<
1389
+ S['length'] extends 0 ? Car : SelectedEntity<Car, S>
1390
+ > {
1391
+ const inner = api.query(filter, options as CollectionOptions);
1392
+ return {
1393
+ ...inner,
1394
+ delete: inner.delete.bind(inner),
1395
+ release: inner.release.bind(inner),
1396
+ get length() {
1397
+ return inner.length;
1398
+ },
1399
+ [Symbol.asyncIterator]() {
1400
+ const it = inner[Symbol.asyncIterator]();
1401
+ return {
1402
+ async next() {
1403
+ const n = await it.next();
1404
+ if (!n.done && n.value) {
1405
+ mapCarRow(http, n.value);
1406
+ }
1407
+ return n;
1408
+ },
1409
+ };
1410
+ },
1411
+ } as CollectionHandle<
1412
+ S['length'] extends 0 ? Car : SelectedEntity<Car, S>
1413
+ >;
1414
+ },
1415
+ };
1416
+ })(),
1417
+ Reservation: (() => {
1418
+ const cfg = {
1419
+ http,
1420
+ className: 'Reservation',
1421
+ relationMap: {
1422
+ departureAgency: 'Agency',
1423
+ car: 'Car',
1424
+ arrivalAgency: 'Agency',
1425
+ employee: 'Employee',
1426
+ customer: 'Customer',
1427
+ departureInventory: 'Inventory',
1428
+ arrivalInventory: 'Inventory',
1429
+ status: 'Status',
1430
+ categoryCar: 'CategoryCar',
1431
+ },
1432
+ keyNames: ['ID'],
1433
+ } as const;
1434
+ const api = makeDataClassApi<Reservation>(cfg);
1435
+ return {
1436
+ all<S extends readonly ReservationPath[] = readonly []>(
1437
+ options?: CollectionOptions & { select?: S },
1438
+ ): CollectionHandle<
1439
+ S['length'] extends 0 ? Reservation : SelectedEntity<Reservation, S>
1440
+ > {
1441
+ const inner = api.all(options as CollectionOptions);
1442
+ return {
1443
+ ...inner,
1444
+ delete: inner.delete.bind(inner),
1445
+ release: inner.release.bind(inner),
1446
+ get length() {
1447
+ return inner.length;
1448
+ },
1449
+ [Symbol.asyncIterator]() {
1450
+ const it = inner[Symbol.asyncIterator]();
1451
+ return {
1452
+ async next() {
1453
+ const n = await it.next();
1454
+ if (!n.done && n.value) {
1455
+ mapReservationRow(http, n.value);
1456
+ }
1457
+ return n;
1458
+ },
1459
+ };
1460
+ },
1461
+ } as CollectionHandle<
1462
+ S['length'] extends 0 ? Reservation : SelectedEntity<Reservation, S>
1463
+ >;
1464
+ },
1465
+ async get<S extends readonly ReservationPath[] = readonly []>(
1466
+ id: string | number,
1467
+ options?: { select?: S },
1468
+ ): Promise<
1469
+ | (S['length'] extends 0
1470
+ ? Reservation
1471
+ : SelectedEntity<Reservation, S>)
1472
+ | null
1473
+ > {
1474
+ const entity = await api.get(id, options);
1475
+ if (entity) {
1476
+ mapReservationRow(http, entity);
1477
+ }
1478
+ return entity as
1479
+ | (S['length'] extends 0
1480
+ ? Reservation
1481
+ : SelectedEntity<Reservation, S>)
1482
+ | null;
1483
+ },
1484
+ delete: (id: string | number) => api.delete(id),
1485
+ query<S extends readonly ReservationPath[] = readonly []>(
1486
+ filter: string,
1487
+ options?: CollectionOptions & { params?: unknown[]; select?: S },
1488
+ ): CollectionHandle<
1489
+ S['length'] extends 0 ? Reservation : SelectedEntity<Reservation, S>
1490
+ > {
1491
+ const inner = api.query(filter, options as CollectionOptions);
1492
+ return {
1493
+ ...inner,
1494
+ delete: inner.delete.bind(inner),
1495
+ release: inner.release.bind(inner),
1496
+ get length() {
1497
+ return inner.length;
1498
+ },
1499
+ [Symbol.asyncIterator]() {
1500
+ const it = inner[Symbol.asyncIterator]();
1501
+ return {
1502
+ async next() {
1503
+ const n = await it.next();
1504
+ if (!n.done && n.value) {
1505
+ mapReservationRow(http, n.value);
1506
+ }
1507
+ return n;
1508
+ },
1509
+ };
1510
+ },
1511
+ } as CollectionHandle<
1512
+ S['length'] extends 0 ? Reservation : SelectedEntity<Reservation, S>
1513
+ >;
1514
+ },
1515
+ };
1516
+ })(),
1517
+ Inventory: (() => {
1518
+ const cfg = {
1519
+ http,
1520
+ className: 'Inventory',
1521
+ relationMap: { employee: 'Employee' },
1522
+ keyNames: ['ID'],
1523
+ } as const;
1524
+ const api = makeDataClassApi<Inventory>(cfg);
1525
+ return {
1526
+ all<S extends readonly InventoryPath[] = readonly []>(
1527
+ options?: CollectionOptions & { select?: S },
1528
+ ): CollectionHandle<
1529
+ S['length'] extends 0 ? Inventory : SelectedEntity<Inventory, S>
1530
+ > {
1531
+ const inner = api.all(options as CollectionOptions);
1532
+ return {
1533
+ ...inner,
1534
+ delete: inner.delete.bind(inner),
1535
+ release: inner.release.bind(inner),
1536
+ get length() {
1537
+ return inner.length;
1538
+ },
1539
+ [Symbol.asyncIterator]() {
1540
+ const it = inner[Symbol.asyncIterator]();
1541
+ return {
1542
+ async next() {
1543
+ const n = await it.next();
1544
+ if (!n.done && n.value) {
1545
+ mapInventoryRow(http, n.value);
1546
+ }
1547
+ return n;
1548
+ },
1549
+ };
1550
+ },
1551
+ } as CollectionHandle<
1552
+ S['length'] extends 0 ? Inventory : SelectedEntity<Inventory, S>
1553
+ >;
1554
+ },
1555
+ async get<S extends readonly InventoryPath[] = readonly []>(
1556
+ id: string | number,
1557
+ options?: { select?: S },
1558
+ ): Promise<
1559
+ | (S['length'] extends 0 ? Inventory : SelectedEntity<Inventory, S>)
1560
+ | null
1561
+ > {
1562
+ const entity = await api.get(id, options);
1563
+ if (entity) {
1564
+ mapInventoryRow(http, entity);
1565
+ }
1566
+ return entity as
1567
+ | (S['length'] extends 0 ? Inventory : SelectedEntity<Inventory, S>)
1568
+ | null;
1569
+ },
1570
+ delete: (id: string | number) => api.delete(id),
1571
+ query<S extends readonly InventoryPath[] = readonly []>(
1572
+ filter: string,
1573
+ options?: CollectionOptions & { params?: unknown[]; select?: S },
1574
+ ): CollectionHandle<
1575
+ S['length'] extends 0 ? Inventory : SelectedEntity<Inventory, S>
1576
+ > {
1577
+ const inner = api.query(filter, options as CollectionOptions);
1578
+ return {
1579
+ ...inner,
1580
+ delete: inner.delete.bind(inner),
1581
+ release: inner.release.bind(inner),
1582
+ get length() {
1583
+ return inner.length;
1584
+ },
1585
+ [Symbol.asyncIterator]() {
1586
+ const it = inner[Symbol.asyncIterator]();
1587
+ return {
1588
+ async next() {
1589
+ const n = await it.next();
1590
+ if (!n.done && n.value) {
1591
+ mapInventoryRow(http, n.value);
1592
+ }
1593
+ return n;
1594
+ },
1595
+ };
1596
+ },
1597
+ } as CollectionHandle<
1598
+ S['length'] extends 0 ? Inventory : SelectedEntity<Inventory, S>
1599
+ >;
1600
+ },
1601
+ };
1602
+ })(),
1603
+ Status: (() => {
1604
+ const cfg = {
1605
+ http,
1606
+ className: 'Status',
1607
+ relationMap: {},
1608
+ keyNames: ['ID'],
1609
+ } as const;
1610
+ const api = makeDataClassApi<Status>(cfg);
1611
+ return {
1612
+ all<S extends readonly StatusPath[] = readonly []>(
1613
+ options?: CollectionOptions & { select?: S },
1614
+ ): CollectionHandle<
1615
+ S['length'] extends 0 ? Status : SelectedEntity<Status, S>
1616
+ > {
1617
+ const inner = api.all(options as CollectionOptions);
1618
+ return {
1619
+ ...inner,
1620
+ delete: inner.delete.bind(inner),
1621
+ release: inner.release.bind(inner),
1622
+ get length() {
1623
+ return inner.length;
1624
+ },
1625
+ [Symbol.asyncIterator]() {
1626
+ const it = inner[Symbol.asyncIterator]();
1627
+ return {
1628
+ async next() {
1629
+ const n = await it.next();
1630
+ if (!n.done && n.value) {
1631
+ mapStatusRow(http, n.value);
1632
+ }
1633
+ return n;
1634
+ },
1635
+ };
1636
+ },
1637
+ } as CollectionHandle<
1638
+ S['length'] extends 0 ? Status : SelectedEntity<Status, S>
1639
+ >;
1640
+ },
1641
+ async get<S extends readonly StatusPath[] = readonly []>(
1642
+ id: string | number,
1643
+ options?: { select?: S },
1644
+ ): Promise<
1645
+ (S['length'] extends 0 ? Status : SelectedEntity<Status, S>) | null
1646
+ > {
1647
+ const entity = await api.get(id, options);
1648
+ if (entity) {
1649
+ mapStatusRow(http, entity);
1650
+ }
1651
+ return entity as
1652
+ | (S['length'] extends 0 ? Status : SelectedEntity<Status, S>)
1653
+ | null;
1654
+ },
1655
+ delete: (id: string | number) => api.delete(id),
1656
+ query<S extends readonly StatusPath[] = readonly []>(
1657
+ filter: string,
1658
+ options?: CollectionOptions & { params?: unknown[]; select?: S },
1659
+ ): CollectionHandle<
1660
+ S['length'] extends 0 ? Status : SelectedEntity<Status, S>
1661
+ > {
1662
+ const inner = api.query(filter, options as CollectionOptions);
1663
+ return {
1664
+ ...inner,
1665
+ delete: inner.delete.bind(inner),
1666
+ release: inner.release.bind(inner),
1667
+ get length() {
1668
+ return inner.length;
1669
+ },
1670
+ [Symbol.asyncIterator]() {
1671
+ const it = inner[Symbol.asyncIterator]();
1672
+ return {
1673
+ async next() {
1674
+ const n = await it.next();
1675
+ if (!n.done && n.value) {
1676
+ mapStatusRow(http, n.value);
1677
+ }
1678
+ return n;
1679
+ },
1680
+ };
1681
+ },
1682
+ } as CollectionHandle<
1683
+ S['length'] extends 0 ? Status : SelectedEntity<Status, S>
1684
+ >;
1685
+ },
1686
+ };
1687
+ })(),
1688
+ Color: (() => {
1689
+ const cfg = {
1690
+ http,
1691
+ className: 'Color',
1692
+ relationMap: {},
1693
+ keyNames: ['ID'],
1694
+ } as const;
1695
+ const api = makeDataClassApi<Color>(cfg);
1696
+ return {
1697
+ all<S extends readonly ColorPath[] = readonly []>(
1698
+ options?: CollectionOptions & { select?: S },
1699
+ ): CollectionHandle<
1700
+ S['length'] extends 0 ? Color : SelectedEntity<Color, S>
1701
+ > {
1702
+ const inner = api.all(options as CollectionOptions);
1703
+ return {
1704
+ ...inner,
1705
+ delete: inner.delete.bind(inner),
1706
+ release: inner.release.bind(inner),
1707
+ get length() {
1708
+ return inner.length;
1709
+ },
1710
+ [Symbol.asyncIterator]() {
1711
+ const it = inner[Symbol.asyncIterator]();
1712
+ return {
1713
+ async next() {
1714
+ const n = await it.next();
1715
+ if (!n.done && n.value) {
1716
+ mapColorRow(http, n.value);
1717
+ }
1718
+ return n;
1719
+ },
1720
+ };
1721
+ },
1722
+ } as CollectionHandle<
1723
+ S['length'] extends 0 ? Color : SelectedEntity<Color, S>
1724
+ >;
1725
+ },
1726
+ async get<S extends readonly ColorPath[] = readonly []>(
1727
+ id: string | number,
1728
+ options?: { select?: S },
1729
+ ): Promise<
1730
+ (S['length'] extends 0 ? Color : SelectedEntity<Color, S>) | null
1731
+ > {
1732
+ const entity = await api.get(id, options);
1733
+ if (entity) {
1734
+ mapColorRow(http, entity);
1735
+ }
1736
+ return entity as
1737
+ | (S['length'] extends 0 ? Color : SelectedEntity<Color, S>)
1738
+ | null;
1739
+ },
1740
+ delete: (id: string | number) => api.delete(id),
1741
+ query<S extends readonly ColorPath[] = readonly []>(
1742
+ filter: string,
1743
+ options?: CollectionOptions & { params?: unknown[]; select?: S },
1744
+ ): CollectionHandle<
1745
+ S['length'] extends 0 ? Color : SelectedEntity<Color, S>
1746
+ > {
1747
+ const inner = api.query(filter, options as CollectionOptions);
1748
+ return {
1749
+ ...inner,
1750
+ delete: inner.delete.bind(inner),
1751
+ release: inner.release.bind(inner),
1752
+ get length() {
1753
+ return inner.length;
1754
+ },
1755
+ [Symbol.asyncIterator]() {
1756
+ const it = inner[Symbol.asyncIterator]();
1757
+ return {
1758
+ async next() {
1759
+ const n = await it.next();
1760
+ if (!n.done && n.value) {
1761
+ mapColorRow(http, n.value);
1762
+ }
1763
+ return n;
1764
+ },
1765
+ };
1766
+ },
1767
+ } as CollectionHandle<
1768
+ S['length'] extends 0 ? Color : SelectedEntity<Color, S>
1769
+ >;
1770
+ },
1771
+ };
1772
+ })(),
1773
+ OptionCategory: (() => {
1774
+ const cfg = {
1775
+ http,
1776
+ className: 'OptionCategory',
1777
+ relationMap: {},
1778
+ keyNames: ['ID'],
1779
+ } as const;
1780
+ const api = makeDataClassApi<OptionCategory>(cfg);
1781
+ return {
1782
+ all<S extends readonly OptionCategoryPath[] = readonly []>(
1783
+ options?: CollectionOptions & { select?: S },
1784
+ ): CollectionHandle<
1785
+ S['length'] extends 0
1786
+ ? OptionCategory
1787
+ : SelectedEntity<OptionCategory, S>
1788
+ > {
1789
+ const inner = api.all(options as CollectionOptions);
1790
+ return {
1791
+ ...inner,
1792
+ delete: inner.delete.bind(inner),
1793
+ release: inner.release.bind(inner),
1794
+ get length() {
1795
+ return inner.length;
1796
+ },
1797
+ [Symbol.asyncIterator]() {
1798
+ const it = inner[Symbol.asyncIterator]();
1799
+ return {
1800
+ async next() {
1801
+ const n = await it.next();
1802
+ if (!n.done && n.value) {
1803
+ mapOptionCategoryRow(http, n.value);
1804
+ }
1805
+ return n;
1806
+ },
1807
+ };
1808
+ },
1809
+ } as CollectionHandle<
1810
+ S['length'] extends 0
1811
+ ? OptionCategory
1812
+ : SelectedEntity<OptionCategory, S>
1813
+ >;
1814
+ },
1815
+ async get<S extends readonly OptionCategoryPath[] = readonly []>(
1816
+ id: string | number,
1817
+ options?: { select?: S },
1818
+ ): Promise<
1819
+ | (S['length'] extends 0
1820
+ ? OptionCategory
1821
+ : SelectedEntity<OptionCategory, S>)
1822
+ | null
1823
+ > {
1824
+ const entity = await api.get(id, options);
1825
+ if (entity) {
1826
+ mapOptionCategoryRow(http, entity);
1827
+ }
1828
+ return entity as
1829
+ | (S['length'] extends 0
1830
+ ? OptionCategory
1831
+ : SelectedEntity<OptionCategory, S>)
1832
+ | null;
1833
+ },
1834
+ delete: (id: string | number) => api.delete(id),
1835
+ query<S extends readonly OptionCategoryPath[] = readonly []>(
1836
+ filter: string,
1837
+ options?: CollectionOptions & { params?: unknown[]; select?: S },
1838
+ ): CollectionHandle<
1839
+ S['length'] extends 0
1840
+ ? OptionCategory
1841
+ : SelectedEntity<OptionCategory, S>
1842
+ > {
1843
+ const inner = api.query(filter, options as CollectionOptions);
1844
+ return {
1845
+ ...inner,
1846
+ delete: inner.delete.bind(inner),
1847
+ release: inner.release.bind(inner),
1848
+ get length() {
1849
+ return inner.length;
1850
+ },
1851
+ [Symbol.asyncIterator]() {
1852
+ const it = inner[Symbol.asyncIterator]();
1853
+ return {
1854
+ async next() {
1855
+ const n = await it.next();
1856
+ if (!n.done && n.value) {
1857
+ mapOptionCategoryRow(http, n.value);
1858
+ }
1859
+ return n;
1860
+ },
1861
+ };
1862
+ },
1863
+ } as CollectionHandle<
1864
+ S['length'] extends 0
1865
+ ? OptionCategory
1866
+ : SelectedEntity<OptionCategory, S>
1867
+ >;
1868
+ },
1869
+ };
1870
+ })(),
1871
+ Defect: (() => {
1872
+ const cfg = {
1873
+ http,
1874
+ className: 'Defect',
1875
+ relationMap: {
1876
+ element: 'DefectiveElement',
1877
+ inventory: 'Inventory',
1878
+ car: 'Car',
1879
+ },
1880
+ keyNames: ['ID'],
1881
+ } as const;
1882
+ const api = makeDataClassApi<Defect>(cfg);
1883
+ return {
1884
+ all<S extends readonly DefectPath[] = readonly []>(
1885
+ options?: CollectionOptions & { select?: S },
1886
+ ): CollectionHandle<
1887
+ S['length'] extends 0 ? Defect : SelectedEntity<Defect, S>
1888
+ > {
1889
+ const inner = api.all(options as CollectionOptions);
1890
+ return {
1891
+ ...inner,
1892
+ delete: inner.delete.bind(inner),
1893
+ release: inner.release.bind(inner),
1894
+ get length() {
1895
+ return inner.length;
1896
+ },
1897
+ [Symbol.asyncIterator]() {
1898
+ const it = inner[Symbol.asyncIterator]();
1899
+ return {
1900
+ async next() {
1901
+ const n = await it.next();
1902
+ if (!n.done && n.value) {
1903
+ mapDefectRow(http, n.value);
1904
+ }
1905
+ return n;
1906
+ },
1907
+ };
1908
+ },
1909
+ } as CollectionHandle<
1910
+ S['length'] extends 0 ? Defect : SelectedEntity<Defect, S>
1911
+ >;
1912
+ },
1913
+ async get<S extends readonly DefectPath[] = readonly []>(
1914
+ id: string | number,
1915
+ options?: { select?: S },
1916
+ ): Promise<
1917
+ (S['length'] extends 0 ? Defect : SelectedEntity<Defect, S>) | null
1918
+ > {
1919
+ const entity = await api.get(id, options);
1920
+ if (entity) {
1921
+ mapDefectRow(http, entity);
1922
+ }
1923
+ return entity as
1924
+ | (S['length'] extends 0 ? Defect : SelectedEntity<Defect, S>)
1925
+ | null;
1926
+ },
1927
+ delete: (id: string | number) => api.delete(id),
1928
+ query<S extends readonly DefectPath[] = readonly []>(
1929
+ filter: string,
1930
+ options?: CollectionOptions & { params?: unknown[]; select?: S },
1931
+ ): CollectionHandle<
1932
+ S['length'] extends 0 ? Defect : SelectedEntity<Defect, S>
1933
+ > {
1934
+ const inner = api.query(filter, options as CollectionOptions);
1935
+ return {
1936
+ ...inner,
1937
+ delete: inner.delete.bind(inner),
1938
+ release: inner.release.bind(inner),
1939
+ get length() {
1940
+ return inner.length;
1941
+ },
1942
+ [Symbol.asyncIterator]() {
1943
+ const it = inner[Symbol.asyncIterator]();
1944
+ return {
1945
+ async next() {
1946
+ const n = await it.next();
1947
+ if (!n.done && n.value) {
1948
+ mapDefectRow(http, n.value);
1949
+ }
1950
+ return n;
1951
+ },
1952
+ };
1953
+ },
1954
+ } as CollectionHandle<
1955
+ S['length'] extends 0 ? Defect : SelectedEntity<Defect, S>
1956
+ >;
1957
+ },
1958
+ };
1959
+ })(),
1960
+ CategoryCar: (() => {
1961
+ const cfg = {
1962
+ http,
1963
+ className: 'CategoryCar',
1964
+ relationMap: {},
1965
+ keyNames: ['ID'],
1966
+ } as const;
1967
+ const api = makeDataClassApi<CategoryCar>(cfg);
1968
+ return {
1969
+ all<S extends readonly CategoryCarPath[] = readonly []>(
1970
+ options?: CollectionOptions & { select?: S },
1971
+ ): CollectionHandle<
1972
+ S['length'] extends 0 ? CategoryCar : SelectedEntity<CategoryCar, S>
1973
+ > {
1974
+ const inner = api.all(options as CollectionOptions);
1975
+ return {
1976
+ ...inner,
1977
+ delete: inner.delete.bind(inner),
1978
+ release: inner.release.bind(inner),
1979
+ get length() {
1980
+ return inner.length;
1981
+ },
1982
+ [Symbol.asyncIterator]() {
1983
+ const it = inner[Symbol.asyncIterator]();
1984
+ return {
1985
+ async next() {
1986
+ const n = await it.next();
1987
+ if (!n.done && n.value) {
1988
+ mapCategoryCarRow(http, n.value);
1989
+ }
1990
+ return n;
1991
+ },
1992
+ };
1993
+ },
1994
+ } as CollectionHandle<
1995
+ S['length'] extends 0 ? CategoryCar : SelectedEntity<CategoryCar, S>
1996
+ >;
1997
+ },
1998
+ async get<S extends readonly CategoryCarPath[] = readonly []>(
1999
+ id: string | number,
2000
+ options?: { select?: S },
2001
+ ): Promise<
2002
+ | (S['length'] extends 0
2003
+ ? CategoryCar
2004
+ : SelectedEntity<CategoryCar, S>)
2005
+ | null
2006
+ > {
2007
+ const entity = await api.get(id, options);
2008
+ if (entity) {
2009
+ mapCategoryCarRow(http, entity);
2010
+ }
2011
+ return entity as
2012
+ | (S['length'] extends 0
2013
+ ? CategoryCar
2014
+ : SelectedEntity<CategoryCar, S>)
2015
+ | null;
2016
+ },
2017
+ delete: (id: string | number) => api.delete(id),
2018
+ query<S extends readonly CategoryCarPath[] = readonly []>(
2019
+ filter: string,
2020
+ options?: CollectionOptions & { params?: unknown[]; select?: S },
2021
+ ): CollectionHandle<
2022
+ S['length'] extends 0 ? CategoryCar : SelectedEntity<CategoryCar, S>
2023
+ > {
2024
+ const inner = api.query(filter, options as CollectionOptions);
2025
+ return {
2026
+ ...inner,
2027
+ delete: inner.delete.bind(inner),
2028
+ release: inner.release.bind(inner),
2029
+ get length() {
2030
+ return inner.length;
2031
+ },
2032
+ [Symbol.asyncIterator]() {
2033
+ const it = inner[Symbol.asyncIterator]();
2034
+ return {
2035
+ async next() {
2036
+ const n = await it.next();
2037
+ if (!n.done && n.value) {
2038
+ mapCategoryCarRow(http, n.value);
2039
+ }
2040
+ return n;
2041
+ },
2042
+ };
2043
+ },
2044
+ } as CollectionHandle<
2045
+ S['length'] extends 0 ? CategoryCar : SelectedEntity<CategoryCar, S>
2046
+ >;
2047
+ },
2048
+ };
2049
+ })(),
2050
+ ChosenOptions: (() => {
2051
+ const cfg = {
2052
+ http,
2053
+ className: 'ChosenOptions',
2054
+ relationMap: {
2055
+ reservation: 'Reservation',
2056
+ optionChosen: 'OptionAvailable',
2057
+ },
2058
+ keyNames: ['ID'],
2059
+ } as const;
2060
+ const api = makeDataClassApi<ChosenOptions>(cfg);
2061
+ return {
2062
+ all<S extends readonly ChosenOptionsPath[] = readonly []>(
2063
+ options?: CollectionOptions & { select?: S },
2064
+ ): CollectionHandle<
2065
+ S['length'] extends 0
2066
+ ? ChosenOptions
2067
+ : SelectedEntity<ChosenOptions, S>
2068
+ > {
2069
+ const inner = api.all(options as CollectionOptions);
2070
+ return {
2071
+ ...inner,
2072
+ delete: inner.delete.bind(inner),
2073
+ release: inner.release.bind(inner),
2074
+ get length() {
2075
+ return inner.length;
2076
+ },
2077
+ [Symbol.asyncIterator]() {
2078
+ const it = inner[Symbol.asyncIterator]();
2079
+ return {
2080
+ async next() {
2081
+ const n = await it.next();
2082
+ if (!n.done && n.value) {
2083
+ mapChosenOptionsRow(http, n.value);
2084
+ }
2085
+ return n;
2086
+ },
2087
+ };
2088
+ },
2089
+ } as CollectionHandle<
2090
+ S['length'] extends 0
2091
+ ? ChosenOptions
2092
+ : SelectedEntity<ChosenOptions, S>
2093
+ >;
2094
+ },
2095
+ async get<S extends readonly ChosenOptionsPath[] = readonly []>(
2096
+ id: string | number,
2097
+ options?: { select?: S },
2098
+ ): Promise<
2099
+ | (S['length'] extends 0
2100
+ ? ChosenOptions
2101
+ : SelectedEntity<ChosenOptions, S>)
2102
+ | null
2103
+ > {
2104
+ const entity = await api.get(id, options);
2105
+ if (entity) {
2106
+ mapChosenOptionsRow(http, entity);
2107
+ }
2108
+ return entity as
2109
+ | (S['length'] extends 0
2110
+ ? ChosenOptions
2111
+ : SelectedEntity<ChosenOptions, S>)
2112
+ | null;
2113
+ },
2114
+ delete: (id: string | number) => api.delete(id),
2115
+ query<S extends readonly ChosenOptionsPath[] = readonly []>(
2116
+ filter: string,
2117
+ options?: CollectionOptions & { params?: unknown[]; select?: S },
2118
+ ): CollectionHandle<
2119
+ S['length'] extends 0
2120
+ ? ChosenOptions
2121
+ : SelectedEntity<ChosenOptions, S>
2122
+ > {
2123
+ const inner = api.query(filter, options as CollectionOptions);
2124
+ return {
2125
+ ...inner,
2126
+ delete: inner.delete.bind(inner),
2127
+ release: inner.release.bind(inner),
2128
+ get length() {
2129
+ return inner.length;
2130
+ },
2131
+ [Symbol.asyncIterator]() {
2132
+ const it = inner[Symbol.asyncIterator]();
2133
+ return {
2134
+ async next() {
2135
+ const n = await it.next();
2136
+ if (!n.done && n.value) {
2137
+ mapChosenOptionsRow(http, n.value);
2138
+ }
2139
+ return n;
2140
+ },
2141
+ };
2142
+ },
2143
+ } as CollectionHandle<
2144
+ S['length'] extends 0
2145
+ ? ChosenOptions
2146
+ : SelectedEntity<ChosenOptions, S>
2147
+ >;
2148
+ },
2149
+ };
2150
+ })(),
2151
+ DefectCategory: (() => {
2152
+ const cfg = {
2153
+ http,
2154
+ className: 'DefectCategory',
2155
+ relationMap: {},
2156
+ keyNames: ['ID'],
2157
+ } as const;
2158
+ const api = makeDataClassApi<DefectCategory>(cfg);
2159
+ return {
2160
+ all<S extends readonly DefectCategoryPath[] = readonly []>(
2161
+ options?: CollectionOptions & { select?: S },
2162
+ ): CollectionHandle<
2163
+ S['length'] extends 0
2164
+ ? DefectCategory
2165
+ : SelectedEntity<DefectCategory, S>
2166
+ > {
2167
+ const inner = api.all(options as CollectionOptions);
2168
+ return {
2169
+ ...inner,
2170
+ delete: inner.delete.bind(inner),
2171
+ release: inner.release.bind(inner),
2172
+ get length() {
2173
+ return inner.length;
2174
+ },
2175
+ [Symbol.asyncIterator]() {
2176
+ const it = inner[Symbol.asyncIterator]();
2177
+ return {
2178
+ async next() {
2179
+ const n = await it.next();
2180
+ if (!n.done && n.value) {
2181
+ mapDefectCategoryRow(http, n.value);
2182
+ }
2183
+ return n;
2184
+ },
2185
+ };
2186
+ },
2187
+ } as CollectionHandle<
2188
+ S['length'] extends 0
2189
+ ? DefectCategory
2190
+ : SelectedEntity<DefectCategory, S>
2191
+ >;
2192
+ },
2193
+ async get<S extends readonly DefectCategoryPath[] = readonly []>(
2194
+ id: string | number,
2195
+ options?: { select?: S },
2196
+ ): Promise<
2197
+ | (S['length'] extends 0
2198
+ ? DefectCategory
2199
+ : SelectedEntity<DefectCategory, S>)
2200
+ | null
2201
+ > {
2202
+ const entity = await api.get(id, options);
2203
+ if (entity) {
2204
+ mapDefectCategoryRow(http, entity);
2205
+ }
2206
+ return entity as
2207
+ | (S['length'] extends 0
2208
+ ? DefectCategory
2209
+ : SelectedEntity<DefectCategory, S>)
2210
+ | null;
2211
+ },
2212
+ delete: (id: string | number) => api.delete(id),
2213
+ query<S extends readonly DefectCategoryPath[] = readonly []>(
2214
+ filter: string,
2215
+ options?: CollectionOptions & { params?: unknown[]; select?: S },
2216
+ ): CollectionHandle<
2217
+ S['length'] extends 0
2218
+ ? DefectCategory
2219
+ : SelectedEntity<DefectCategory, S>
2220
+ > {
2221
+ const inner = api.query(filter, options as CollectionOptions);
2222
+ return {
2223
+ ...inner,
2224
+ delete: inner.delete.bind(inner),
2225
+ release: inner.release.bind(inner),
2226
+ get length() {
2227
+ return inner.length;
2228
+ },
2229
+ [Symbol.asyncIterator]() {
2230
+ const it = inner[Symbol.asyncIterator]();
2231
+ return {
2232
+ async next() {
2233
+ const n = await it.next();
2234
+ if (!n.done && n.value) {
2235
+ mapDefectCategoryRow(http, n.value);
2236
+ }
2237
+ return n;
2238
+ },
2239
+ };
2240
+ },
2241
+ } as CollectionHandle<
2242
+ S['length'] extends 0
2243
+ ? DefectCategory
2244
+ : SelectedEntity<DefectCategory, S>
2245
+ >;
2246
+ },
2247
+ };
2248
+ })(),
2249
+ DefectiveElement: (() => {
2250
+ const cfg = {
2251
+ http,
2252
+ className: 'DefectiveElement',
2253
+ relationMap: { category: 'DefectCategory' },
2254
+ keyNames: ['ID'],
2255
+ } as const;
2256
+ const api = makeDataClassApi<DefectiveElement>(cfg);
2257
+ return {
2258
+ all<S extends readonly DefectiveElementPath[] = readonly []>(
2259
+ options?: CollectionOptions & { select?: S },
2260
+ ): CollectionHandle<
2261
+ S['length'] extends 0
2262
+ ? DefectiveElement
2263
+ : SelectedEntity<DefectiveElement, S>
2264
+ > {
2265
+ const inner = api.all(options as CollectionOptions);
2266
+ return {
2267
+ ...inner,
2268
+ delete: inner.delete.bind(inner),
2269
+ release: inner.release.bind(inner),
2270
+ get length() {
2271
+ return inner.length;
2272
+ },
2273
+ [Symbol.asyncIterator]() {
2274
+ const it = inner[Symbol.asyncIterator]();
2275
+ return {
2276
+ async next() {
2277
+ const n = await it.next();
2278
+ if (!n.done && n.value) {
2279
+ mapDefectiveElementRow(http, n.value);
2280
+ }
2281
+ return n;
2282
+ },
2283
+ };
2284
+ },
2285
+ } as CollectionHandle<
2286
+ S['length'] extends 0
2287
+ ? DefectiveElement
2288
+ : SelectedEntity<DefectiveElement, S>
2289
+ >;
2290
+ },
2291
+ async get<S extends readonly DefectiveElementPath[] = readonly []>(
2292
+ id: string | number,
2293
+ options?: { select?: S },
2294
+ ): Promise<
2295
+ | (S['length'] extends 0
2296
+ ? DefectiveElement
2297
+ : SelectedEntity<DefectiveElement, S>)
2298
+ | null
2299
+ > {
2300
+ const entity = await api.get(id, options);
2301
+ if (entity) {
2302
+ mapDefectiveElementRow(http, entity);
2303
+ }
2304
+ return entity as
2305
+ | (S['length'] extends 0
2306
+ ? DefectiveElement
2307
+ : SelectedEntity<DefectiveElement, S>)
2308
+ | null;
2309
+ },
2310
+ delete: (id: string | number) => api.delete(id),
2311
+ query<S extends readonly DefectiveElementPath[] = readonly []>(
2312
+ filter: string,
2313
+ options?: CollectionOptions & { params?: unknown[]; select?: S },
2314
+ ): CollectionHandle<
2315
+ S['length'] extends 0
2316
+ ? DefectiveElement
2317
+ : SelectedEntity<DefectiveElement, S>
2318
+ > {
2319
+ const inner = api.query(filter, options as CollectionOptions);
2320
+ return {
2321
+ ...inner,
2322
+ delete: inner.delete.bind(inner),
2323
+ release: inner.release.bind(inner),
2324
+ get length() {
2325
+ return inner.length;
2326
+ },
2327
+ [Symbol.asyncIterator]() {
2328
+ const it = inner[Symbol.asyncIterator]();
2329
+ return {
2330
+ async next() {
2331
+ const n = await it.next();
2332
+ if (!n.done && n.value) {
2333
+ mapDefectiveElementRow(http, n.value);
2334
+ }
2335
+ return n;
2336
+ },
2337
+ };
2338
+ },
2339
+ } as CollectionHandle<
2340
+ S['length'] extends 0
2341
+ ? DefectiveElement
2342
+ : SelectedEntity<DefectiveElement, S>
2343
+ >;
2344
+ },
2345
+ };
2346
+ })(),
2347
+ OptionAvailable: (() => {
2348
+ const cfg = {
2349
+ http,
2350
+ className: 'OptionAvailable',
2351
+ relationMap: { category: 'OptionCategory' },
2352
+ keyNames: ['ID'],
2353
+ } as const;
2354
+ const api = makeDataClassApi<OptionAvailable>(cfg);
2355
+ return {
2356
+ all<S extends readonly OptionAvailablePath[] = readonly []>(
2357
+ options?: CollectionOptions & { select?: S },
2358
+ ): CollectionHandle<
2359
+ S['length'] extends 0
2360
+ ? OptionAvailable
2361
+ : SelectedEntity<OptionAvailable, S>
2362
+ > {
2363
+ const inner = api.all(options as CollectionOptions);
2364
+ return {
2365
+ ...inner,
2366
+ delete: inner.delete.bind(inner),
2367
+ release: inner.release.bind(inner),
2368
+ get length() {
2369
+ return inner.length;
2370
+ },
2371
+ [Symbol.asyncIterator]() {
2372
+ const it = inner[Symbol.asyncIterator]();
2373
+ return {
2374
+ async next() {
2375
+ const n = await it.next();
2376
+ if (!n.done && n.value) {
2377
+ mapOptionAvailableRow(http, n.value);
2378
+ }
2379
+ return n;
2380
+ },
2381
+ };
2382
+ },
2383
+ } as CollectionHandle<
2384
+ S['length'] extends 0
2385
+ ? OptionAvailable
2386
+ : SelectedEntity<OptionAvailable, S>
2387
+ >;
2388
+ },
2389
+ async get<S extends readonly OptionAvailablePath[] = readonly []>(
2390
+ id: string | number,
2391
+ options?: { select?: S },
2392
+ ): Promise<
2393
+ | (S['length'] extends 0
2394
+ ? OptionAvailable
2395
+ : SelectedEntity<OptionAvailable, S>)
2396
+ | null
2397
+ > {
2398
+ const entity = await api.get(id, options);
2399
+ if (entity) {
2400
+ mapOptionAvailableRow(http, entity);
2401
+ }
2402
+ return entity as
2403
+ | (S['length'] extends 0
2404
+ ? OptionAvailable
2405
+ : SelectedEntity<OptionAvailable, S>)
2406
+ | null;
2407
+ },
2408
+ delete: (id: string | number) => api.delete(id),
2409
+ query<S extends readonly OptionAvailablePath[] = readonly []>(
2410
+ filter: string,
2411
+ options?: CollectionOptions & { params?: unknown[]; select?: S },
2412
+ ): CollectionHandle<
2413
+ S['length'] extends 0
2414
+ ? OptionAvailable
2415
+ : SelectedEntity<OptionAvailable, S>
2416
+ > {
2417
+ const inner = api.query(filter, options as CollectionOptions);
2418
+ return {
2419
+ ...inner,
2420
+ delete: inner.delete.bind(inner),
2421
+ release: inner.release.bind(inner),
2422
+ get length() {
2423
+ return inner.length;
2424
+ },
2425
+ [Symbol.asyncIterator]() {
2426
+ const it = inner[Symbol.asyncIterator]();
2427
+ return {
2428
+ async next() {
2429
+ const n = await it.next();
2430
+ if (!n.done && n.value) {
2431
+ mapOptionAvailableRow(http, n.value);
2432
+ }
2433
+ return n;
2434
+ },
2435
+ };
2436
+ },
2437
+ } as CollectionHandle<
2438
+ S['length'] extends 0
2439
+ ? OptionAvailable
2440
+ : SelectedEntity<OptionAvailable, S>
2441
+ >;
2442
+ },
2443
+ };
2444
+ })(),
2445
+ Department: (() => {
2446
+ const cfg = {
2447
+ http,
2448
+ className: 'Department',
2449
+ relationMap: { region: 'Region' },
2450
+ keyNames: ['ID'],
2451
+ } as const;
2452
+ const api = makeDataClassApi<Department>(cfg);
2453
+ return {
2454
+ all<S extends readonly DepartmentPath[] = readonly []>(
2455
+ options?: CollectionOptions & { select?: S },
2456
+ ): CollectionHandle<
2457
+ S['length'] extends 0 ? Department : SelectedEntity<Department, S>
2458
+ > {
2459
+ const inner = api.all(options as CollectionOptions);
2460
+ return {
2461
+ ...inner,
2462
+ delete: inner.delete.bind(inner),
2463
+ release: inner.release.bind(inner),
2464
+ get length() {
2465
+ return inner.length;
2466
+ },
2467
+ [Symbol.asyncIterator]() {
2468
+ const it = inner[Symbol.asyncIterator]();
2469
+ return {
2470
+ async next() {
2471
+ const n = await it.next();
2472
+ if (!n.done && n.value) {
2473
+ mapDepartmentRow(http, n.value);
2474
+ }
2475
+ return n;
2476
+ },
2477
+ };
2478
+ },
2479
+ } as CollectionHandle<
2480
+ S['length'] extends 0 ? Department : SelectedEntity<Department, S>
2481
+ >;
2482
+ },
2483
+ async get<S extends readonly DepartmentPath[] = readonly []>(
2484
+ id: string | number,
2485
+ options?: { select?: S },
2486
+ ): Promise<
2487
+ | (S['length'] extends 0 ? Department : SelectedEntity<Department, S>)
2488
+ | null
2489
+ > {
2490
+ const entity = await api.get(id, options);
2491
+ if (entity) {
2492
+ mapDepartmentRow(http, entity);
2493
+ }
2494
+ return entity as
2495
+ | (S['length'] extends 0
2496
+ ? Department
2497
+ : SelectedEntity<Department, S>)
2498
+ | null;
2499
+ },
2500
+ delete: (id: string | number) => api.delete(id),
2501
+ query<S extends readonly DepartmentPath[] = readonly []>(
2502
+ filter: string,
2503
+ options?: CollectionOptions & { params?: unknown[]; select?: S },
2504
+ ): CollectionHandle<
2505
+ S['length'] extends 0 ? Department : SelectedEntity<Department, S>
2506
+ > {
2507
+ const inner = api.query(filter, options as CollectionOptions);
2508
+ return {
2509
+ ...inner,
2510
+ delete: inner.delete.bind(inner),
2511
+ release: inner.release.bind(inner),
2512
+ get length() {
2513
+ return inner.length;
2514
+ },
2515
+ [Symbol.asyncIterator]() {
2516
+ const it = inner[Symbol.asyncIterator]();
2517
+ return {
2518
+ async next() {
2519
+ const n = await it.next();
2520
+ if (!n.done && n.value) {
2521
+ mapDepartmentRow(http, n.value);
2522
+ }
2523
+ return n;
2524
+ },
2525
+ };
2526
+ },
2527
+ } as CollectionHandle<
2528
+ S['length'] extends 0 ? Department : SelectedEntity<Department, S>
2529
+ >;
2530
+ },
2531
+ };
2532
+ })(),
2533
+ CategoryAgency: (() => {
2534
+ const cfg = {
2535
+ http,
2536
+ className: 'CategoryAgency',
2537
+ relationMap: {},
2538
+ keyNames: ['ID'],
2539
+ } as const;
2540
+ const api = makeDataClassApi<CategoryAgency>(cfg);
2541
+ return {
2542
+ all<S extends readonly CategoryAgencyPath[] = readonly []>(
2543
+ options?: CollectionOptions & { select?: S },
2544
+ ): CollectionHandle<
2545
+ S['length'] extends 0
2546
+ ? CategoryAgency
2547
+ : SelectedEntity<CategoryAgency, S>
2548
+ > {
2549
+ const inner = api.all(options as CollectionOptions);
2550
+ return {
2551
+ ...inner,
2552
+ delete: inner.delete.bind(inner),
2553
+ release: inner.release.bind(inner),
2554
+ get length() {
2555
+ return inner.length;
2556
+ },
2557
+ [Symbol.asyncIterator]() {
2558
+ const it = inner[Symbol.asyncIterator]();
2559
+ return {
2560
+ async next() {
2561
+ const n = await it.next();
2562
+ if (!n.done && n.value) {
2563
+ mapCategoryAgencyRow(http, n.value);
2564
+ }
2565
+ return n;
2566
+ },
2567
+ };
2568
+ },
2569
+ } as CollectionHandle<
2570
+ S['length'] extends 0
2571
+ ? CategoryAgency
2572
+ : SelectedEntity<CategoryAgency, S>
2573
+ >;
2574
+ },
2575
+ async get<S extends readonly CategoryAgencyPath[] = readonly []>(
2576
+ id: string | number,
2577
+ options?: { select?: S },
2578
+ ): Promise<
2579
+ | (S['length'] extends 0
2580
+ ? CategoryAgency
2581
+ : SelectedEntity<CategoryAgency, S>)
2582
+ | null
2583
+ > {
2584
+ const entity = await api.get(id, options);
2585
+ if (entity) {
2586
+ mapCategoryAgencyRow(http, entity);
2587
+ }
2588
+ return entity as
2589
+ | (S['length'] extends 0
2590
+ ? CategoryAgency
2591
+ : SelectedEntity<CategoryAgency, S>)
2592
+ | null;
2593
+ },
2594
+ delete: (id: string | number) => api.delete(id),
2595
+ query<S extends readonly CategoryAgencyPath[] = readonly []>(
2596
+ filter: string,
2597
+ options?: CollectionOptions & { params?: unknown[]; select?: S },
2598
+ ): CollectionHandle<
2599
+ S['length'] extends 0
2600
+ ? CategoryAgency
2601
+ : SelectedEntity<CategoryAgency, S>
2602
+ > {
2603
+ const inner = api.query(filter, options as CollectionOptions);
2604
+ return {
2605
+ ...inner,
2606
+ delete: inner.delete.bind(inner),
2607
+ release: inner.release.bind(inner),
2608
+ get length() {
2609
+ return inner.length;
2610
+ },
2611
+ [Symbol.asyncIterator]() {
2612
+ const it = inner[Symbol.asyncIterator]();
2613
+ return {
2614
+ async next() {
2615
+ const n = await it.next();
2616
+ if (!n.done && n.value) {
2617
+ mapCategoryAgencyRow(http, n.value);
2618
+ }
2619
+ return n;
2620
+ },
2621
+ };
2622
+ },
2623
+ } as CollectionHandle<
2624
+ S['length'] extends 0
2625
+ ? CategoryAgency
2626
+ : SelectedEntity<CategoryAgency, S>
2627
+ >;
2628
+ },
2629
+ };
2630
+ })(),
2631
+ User: (() => {
2632
+ const cfg = {
2633
+ http,
2634
+ className: 'User',
2635
+ relationMap: { employee: 'Employee' },
2636
+ keyNames: ['ID'],
2637
+ } as const;
2638
+ const api = makeDataClassApi<User>(cfg);
2639
+ return {
2640
+ all<S extends readonly UserPath[] = readonly []>(
2641
+ options?: CollectionOptions & { select?: S },
2642
+ ): CollectionHandle<
2643
+ S['length'] extends 0 ? User : SelectedEntity<User, S>
2644
+ > {
2645
+ const inner = api.all(options as CollectionOptions);
2646
+ return {
2647
+ ...inner,
2648
+ delete: inner.delete.bind(inner),
2649
+ release: inner.release.bind(inner),
2650
+ get length() {
2651
+ return inner.length;
2652
+ },
2653
+ [Symbol.asyncIterator]() {
2654
+ const it = inner[Symbol.asyncIterator]();
2655
+ return {
2656
+ async next() {
2657
+ const n = await it.next();
2658
+ if (!n.done && n.value) {
2659
+ mapUserRow(http, n.value);
2660
+ }
2661
+ return n;
2662
+ },
2663
+ };
2664
+ },
2665
+ } as CollectionHandle<
2666
+ S['length'] extends 0 ? User : SelectedEntity<User, S>
2667
+ >;
2668
+ },
2669
+ async get<S extends readonly UserPath[] = readonly []>(
2670
+ id: string | number,
2671
+ options?: { select?: S },
2672
+ ): Promise<
2673
+ (S['length'] extends 0 ? User : SelectedEntity<User, S>) | null
2674
+ > {
2675
+ const entity = await api.get(id, options);
2676
+ if (entity) {
2677
+ mapUserRow(http, entity);
2678
+ }
2679
+ return entity as
2680
+ | (S['length'] extends 0 ? User : SelectedEntity<User, S>)
2681
+ | null;
2682
+ },
2683
+ delete: (id: string | number) => api.delete(id),
2684
+ query<S extends readonly UserPath[] = readonly []>(
2685
+ filter: string,
2686
+ options?: CollectionOptions & { params?: unknown[]; select?: S },
2687
+ ): CollectionHandle<
2688
+ S['length'] extends 0 ? User : SelectedEntity<User, S>
2689
+ > {
2690
+ const inner = api.query(filter, options as CollectionOptions);
2691
+ return {
2692
+ ...inner,
2693
+ delete: inner.delete.bind(inner),
2694
+ release: inner.release.bind(inner),
2695
+ get length() {
2696
+ return inner.length;
2697
+ },
2698
+ [Symbol.asyncIterator]() {
2699
+ const it = inner[Symbol.asyncIterator]();
2700
+ return {
2701
+ async next() {
2702
+ const n = await it.next();
2703
+ if (!n.done && n.value) {
2704
+ mapUserRow(http, n.value);
2705
+ }
2706
+ return n;
2707
+ },
2708
+ };
2709
+ },
2710
+ } as CollectionHandle<
2711
+ S['length'] extends 0 ? User : SelectedEntity<User, S>
2712
+ >;
2713
+ },
2714
+ };
2715
+ })(),
2716
+ rpc: (
2717
+ segments: string[],
2718
+ init?: { method?: 'GET' | 'POST'; body?: unknown },
2719
+ ) => callDatastorePath(http, segments, init),
2720
+ sessionCookieName: quadrokitCatalogMeta.sessionCookieName,
2721
+ _http: http,
2722
+ };
2723
+ }
2724
+
2725
+ export type QuadroClient = ReturnType<typeof createClient>;