@ventori/contracts 0.1.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.
@@ -0,0 +1,1917 @@
1
+ import * as zod from 'zod';
2
+ import { z } from 'zod';
3
+ import * as _ts_rest_core from '@ts-rest/core';
4
+ import { initContract } from '@ts-rest/core';
5
+
6
+ declare const PaginationQuerySchema: z.ZodObject<{
7
+ page: z.ZodDefault<z.ZodNumber>;
8
+ pageSize: z.ZodDefault<z.ZodNumber>;
9
+ sortBy: z.ZodOptional<z.ZodString>;
10
+ sortOrder: z.ZodDefault<z.ZodEnum<["asc", "desc"]>>;
11
+ }, "strip", z.ZodTypeAny, {
12
+ page: number;
13
+ pageSize: number;
14
+ sortOrder: "asc" | "desc";
15
+ sortBy?: string | undefined;
16
+ }, {
17
+ page?: number | undefined;
18
+ pageSize?: number | undefined;
19
+ sortBy?: string | undefined;
20
+ sortOrder?: "asc" | "desc" | undefined;
21
+ }>;
22
+ type PaginationQuery = z.infer<typeof PaginationQuerySchema>;
23
+ declare const PaginationSchema: z.ZodObject<{
24
+ page: z.ZodNumber;
25
+ pageSize: z.ZodNumber;
26
+ total: z.ZodNumber;
27
+ totalPages: z.ZodNumber;
28
+ hasNext: z.ZodBoolean;
29
+ hasPrev: z.ZodBoolean;
30
+ }, "strip", z.ZodTypeAny, {
31
+ page: number;
32
+ pageSize: number;
33
+ total: number;
34
+ totalPages: number;
35
+ hasNext: boolean;
36
+ hasPrev: boolean;
37
+ }, {
38
+ page: number;
39
+ pageSize: number;
40
+ total: number;
41
+ totalPages: number;
42
+ hasNext: boolean;
43
+ hasPrev: boolean;
44
+ }>;
45
+ type Pagination = z.infer<typeof PaginationSchema>;
46
+ declare const DataResponseSchema: <T extends z.ZodTypeAny>(itemSchema: T) => z.ZodObject<{
47
+ data: z.ZodArray<T, "many">;
48
+ pagination: z.ZodObject<{
49
+ page: z.ZodNumber;
50
+ pageSize: z.ZodNumber;
51
+ total: z.ZodNumber;
52
+ totalPages: z.ZodNumber;
53
+ hasNext: z.ZodBoolean;
54
+ hasPrev: z.ZodBoolean;
55
+ }, "strip", z.ZodTypeAny, {
56
+ page: number;
57
+ pageSize: number;
58
+ total: number;
59
+ totalPages: number;
60
+ hasNext: boolean;
61
+ hasPrev: boolean;
62
+ }, {
63
+ page: number;
64
+ pageSize: number;
65
+ total: number;
66
+ totalPages: number;
67
+ hasNext: boolean;
68
+ hasPrev: boolean;
69
+ }>;
70
+ }, "strip", z.ZodTypeAny, {
71
+ data: T["_output"][];
72
+ pagination: {
73
+ page: number;
74
+ pageSize: number;
75
+ total: number;
76
+ totalPages: number;
77
+ hasNext: boolean;
78
+ hasPrev: boolean;
79
+ };
80
+ }, {
81
+ data: T["_input"][];
82
+ pagination: {
83
+ page: number;
84
+ pageSize: number;
85
+ total: number;
86
+ totalPages: number;
87
+ hasNext: boolean;
88
+ hasPrev: boolean;
89
+ };
90
+ }>;
91
+ type DataResponse<T> = {
92
+ data: T[];
93
+ pagination: Pagination;
94
+ };
95
+
96
+ declare const ErrorResponseSchema: z.ZodObject<{
97
+ message: z.ZodString;
98
+ statusCode: z.ZodNumber;
99
+ error: z.ZodOptional<z.ZodString>;
100
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
101
+ }, "strip", z.ZodTypeAny, {
102
+ message: string;
103
+ statusCode: number;
104
+ error?: string | undefined;
105
+ details?: Record<string, unknown> | undefined;
106
+ }, {
107
+ message: string;
108
+ statusCode: number;
109
+ error?: string | undefined;
110
+ details?: Record<string, unknown> | undefined;
111
+ }>;
112
+ type ErrorResponse = z.infer<typeof ErrorResponseSchema>;
113
+ declare const NotFoundResponseSchema: z.ZodObject<{
114
+ message: z.ZodString;
115
+ }, "strip", z.ZodTypeAny, {
116
+ message: string;
117
+ }, {
118
+ message: string;
119
+ }>;
120
+ declare const ValidationErrorSchema: z.ZodObject<{
121
+ message: z.ZodString;
122
+ statusCode: z.ZodDefault<z.ZodNumber>;
123
+ error: z.ZodDefault<z.ZodString>;
124
+ details: z.ZodArray<z.ZodObject<{
125
+ field: z.ZodString;
126
+ message: z.ZodString;
127
+ }, "strip", z.ZodTypeAny, {
128
+ message: string;
129
+ field: string;
130
+ }, {
131
+ message: string;
132
+ field: string;
133
+ }>, "many">;
134
+ }, "strip", z.ZodTypeAny, {
135
+ message: string;
136
+ statusCode: number;
137
+ error: string;
138
+ details: {
139
+ message: string;
140
+ field: string;
141
+ }[];
142
+ }, {
143
+ message: string;
144
+ details: {
145
+ message: string;
146
+ field: string;
147
+ }[];
148
+ statusCode?: number | undefined;
149
+ error?: string | undefined;
150
+ }>;
151
+ type ValidationError = z.infer<typeof ValidationErrorSchema>;
152
+
153
+ declare const ApiSuccessResponseSchema: <T extends z.ZodTypeAny>(dataSchema: T) => z.ZodObject<{
154
+ success: z.ZodLiteral<true>;
155
+ data: T;
156
+ }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
157
+ success: z.ZodLiteral<true>;
158
+ data: T;
159
+ }>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{
160
+ success: z.ZodLiteral<true>;
161
+ data: T;
162
+ }> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
163
+ declare const ApiErrorResponseSchema: z.ZodObject<{
164
+ success: z.ZodLiteral<false>;
165
+ message: z.ZodString;
166
+ statusCode: z.ZodNumber;
167
+ error: z.ZodOptional<z.ZodString>;
168
+ }, "strip", z.ZodTypeAny, {
169
+ message: string;
170
+ statusCode: number;
171
+ success: false;
172
+ error?: string | undefined;
173
+ }, {
174
+ message: string;
175
+ statusCode: number;
176
+ success: false;
177
+ error?: string | undefined;
178
+ }>;
179
+ declare const ApiPaginatedResponseSchema: <T extends z.ZodTypeAny>(itemSchema: T) => z.ZodObject<{
180
+ data: z.ZodArray<T, "many">;
181
+ pagination: z.ZodObject<{
182
+ page: z.ZodNumber;
183
+ pageSize: z.ZodNumber;
184
+ total: z.ZodNumber;
185
+ totalPages: z.ZodNumber;
186
+ hasNext: z.ZodBoolean;
187
+ hasPrev: z.ZodBoolean;
188
+ }, "strip", z.ZodTypeAny, {
189
+ page: number;
190
+ pageSize: number;
191
+ total: number;
192
+ totalPages: number;
193
+ hasNext: boolean;
194
+ hasPrev: boolean;
195
+ }, {
196
+ page: number;
197
+ pageSize: number;
198
+ total: number;
199
+ totalPages: number;
200
+ hasNext: boolean;
201
+ hasPrev: boolean;
202
+ }>;
203
+ success: z.ZodLiteral<true>;
204
+ }, "strip", z.ZodTypeAny, {
205
+ data: T["_output"][];
206
+ pagination: {
207
+ page: number;
208
+ pageSize: number;
209
+ total: number;
210
+ totalPages: number;
211
+ hasNext: boolean;
212
+ hasPrev: boolean;
213
+ };
214
+ success: true;
215
+ }, {
216
+ data: T["_input"][];
217
+ pagination: {
218
+ page: number;
219
+ pageSize: number;
220
+ total: number;
221
+ totalPages: number;
222
+ hasNext: boolean;
223
+ hasPrev: boolean;
224
+ };
225
+ success: true;
226
+ }>;
227
+
228
+ type ContractInstance = ReturnType<typeof initContract>;
229
+ declare const c: ContractInstance;
230
+
231
+ declare function createCrudEndpoints<TEntity extends z.ZodTypeAny, TCreate extends z.ZodTypeAny, TUpdate extends z.ZodTypeAny>(c: ContractInstance, resource: string, schemas: {
232
+ entity: TEntity;
233
+ create: TCreate;
234
+ update: TUpdate;
235
+ }, plural?: string): {
236
+ readonly list: {
237
+ readonly method: "GET";
238
+ readonly path: `/${string}`;
239
+ readonly query: z.ZodObject<{
240
+ page: z.ZodDefault<z.ZodNumber>;
241
+ pageSize: z.ZodDefault<z.ZodNumber>;
242
+ sortBy: z.ZodOptional<z.ZodString>;
243
+ sortOrder: z.ZodDefault<z.ZodEnum<["asc", "desc"]>>;
244
+ }, "strip", z.ZodTypeAny, {
245
+ page: number;
246
+ pageSize: number;
247
+ sortOrder: "asc" | "desc";
248
+ sortBy?: string | undefined;
249
+ }, {
250
+ page?: number | undefined;
251
+ pageSize?: number | undefined;
252
+ sortBy?: string | undefined;
253
+ sortOrder?: "asc" | "desc" | undefined;
254
+ }>;
255
+ readonly responses: {
256
+ readonly 200: z.ZodObject<{
257
+ data: z.ZodArray<TEntity, "many">;
258
+ pagination: z.ZodObject<{
259
+ page: z.ZodNumber;
260
+ pageSize: z.ZodNumber;
261
+ total: z.ZodNumber;
262
+ totalPages: z.ZodNumber;
263
+ hasNext: z.ZodBoolean;
264
+ hasPrev: z.ZodBoolean;
265
+ }, "strip", z.ZodTypeAny, {
266
+ page: number;
267
+ pageSize: number;
268
+ total: number;
269
+ totalPages: number;
270
+ hasNext: boolean;
271
+ hasPrev: boolean;
272
+ }, {
273
+ page: number;
274
+ pageSize: number;
275
+ total: number;
276
+ totalPages: number;
277
+ hasNext: boolean;
278
+ hasPrev: boolean;
279
+ }>;
280
+ }, "strip", z.ZodTypeAny, {
281
+ data: TEntity["_output"][];
282
+ pagination: {
283
+ page: number;
284
+ pageSize: number;
285
+ total: number;
286
+ totalPages: number;
287
+ hasNext: boolean;
288
+ hasPrev: boolean;
289
+ };
290
+ }, {
291
+ data: TEntity["_input"][];
292
+ pagination: {
293
+ page: number;
294
+ pageSize: number;
295
+ total: number;
296
+ totalPages: number;
297
+ hasNext: boolean;
298
+ hasPrev: boolean;
299
+ };
300
+ }>;
301
+ };
302
+ readonly summary: `List all ${string}`;
303
+ };
304
+ readonly findById: {
305
+ readonly method: "GET";
306
+ readonly path: `/${string}/:id`;
307
+ readonly responses: {
308
+ readonly 200: TEntity;
309
+ readonly 404: z.ZodObject<{
310
+ message: z.ZodString;
311
+ }, "strip", z.ZodTypeAny, {
312
+ message: string;
313
+ }, {
314
+ message: string;
315
+ }>;
316
+ };
317
+ readonly summary: `Find ${string} by ID`;
318
+ };
319
+ readonly create: {
320
+ readonly method: "POST";
321
+ readonly path: `/${string}`;
322
+ readonly body: TCreate;
323
+ readonly responses: {
324
+ readonly 201: TEntity;
325
+ };
326
+ readonly summary: `Create a new ${string}`;
327
+ };
328
+ readonly update: {
329
+ readonly method: "PUT";
330
+ readonly path: `/${string}/:id`;
331
+ readonly body: TUpdate;
332
+ readonly responses: {
333
+ readonly 200: TEntity;
334
+ readonly 404: z.ZodObject<{
335
+ message: z.ZodString;
336
+ }, "strip", z.ZodTypeAny, {
337
+ message: string;
338
+ }, {
339
+ message: string;
340
+ }>;
341
+ };
342
+ readonly summary: `Update ${string} by ID`;
343
+ };
344
+ readonly remove: {
345
+ readonly method: "DELETE";
346
+ readonly path: `/${string}/:id`;
347
+ readonly body: typeof _ts_rest_core.ContractNoBody;
348
+ readonly responses: {
349
+ readonly 204: typeof _ts_rest_core.ContractNoBody;
350
+ readonly 404: z.ZodObject<{
351
+ message: z.ZodString;
352
+ }, "strip", z.ZodTypeAny, {
353
+ message: string;
354
+ }, {
355
+ message: string;
356
+ }>;
357
+ };
358
+ readonly summary: `Delete ${string} by ID`;
359
+ };
360
+ };
361
+
362
+ interface ICrudService<T> {
363
+ list(query: PaginationQuery): Promise<DataResponse<T>>;
364
+ findById(id: string): Promise<T | null>;
365
+ create(data: unknown): Promise<T>;
366
+ update(id: string, data: unknown): Promise<T | null>;
367
+ remove(id: string): Promise<void>;
368
+ }
369
+
370
+ declare function createCrudHandlers<T>(service: ICrudService<T>): {
371
+ list: ({ query }: {
372
+ query: PaginationQuery;
373
+ }) => Promise<{
374
+ status: 200;
375
+ body: DataResponse<T>;
376
+ }>;
377
+ findById: ({ params }: {
378
+ params: {
379
+ id: string;
380
+ };
381
+ }) => Promise<{
382
+ status: 404;
383
+ body: {
384
+ message: string;
385
+ };
386
+ } | {
387
+ status: 200;
388
+ body: NonNullable<Awaited<T>>;
389
+ }>;
390
+ create: ({ body }: {
391
+ body: unknown;
392
+ }) => Promise<{
393
+ status: 201;
394
+ body: Awaited<T>;
395
+ }>;
396
+ update: ({ params, body, }: {
397
+ params: {
398
+ id: string;
399
+ };
400
+ body: unknown;
401
+ }) => Promise<{
402
+ status: 404;
403
+ body: {
404
+ message: string;
405
+ };
406
+ } | {
407
+ status: 200;
408
+ body: NonNullable<Awaited<T>>;
409
+ }>;
410
+ remove: ({ params }: {
411
+ params: {
412
+ id: string;
413
+ };
414
+ }) => Promise<{
415
+ status: 204;
416
+ body: undefined;
417
+ }>;
418
+ };
419
+
420
+ declare const HttpMethod: {
421
+ readonly GET: "GET";
422
+ readonly POST: "POST";
423
+ readonly PUT: "PUT";
424
+ readonly PATCH: "PATCH";
425
+ readonly DELETE: "DELETE";
426
+ };
427
+
428
+ declare const UserSchema: z.ZodObject<{
429
+ id: z.ZodString;
430
+ email: z.ZodString;
431
+ firstName: z.ZodString;
432
+ lastName: z.ZodString;
433
+ isActive: z.ZodDefault<z.ZodBoolean>;
434
+ createdAt: z.ZodString;
435
+ updatedAt: z.ZodString;
436
+ }, "strip", z.ZodTypeAny, {
437
+ id: string;
438
+ email: string;
439
+ firstName: string;
440
+ lastName: string;
441
+ isActive: boolean;
442
+ createdAt: string;
443
+ updatedAt: string;
444
+ }, {
445
+ id: string;
446
+ email: string;
447
+ firstName: string;
448
+ lastName: string;
449
+ createdAt: string;
450
+ updatedAt: string;
451
+ isActive?: boolean | undefined;
452
+ }>;
453
+ declare const CreateUserSchema: z.ZodObject<{
454
+ email: z.ZodString;
455
+ firstName: z.ZodString;
456
+ lastName: z.ZodString;
457
+ password: z.ZodString;
458
+ }, "strip", z.ZodTypeAny, {
459
+ email: string;
460
+ firstName: string;
461
+ lastName: string;
462
+ password: string;
463
+ }, {
464
+ email: string;
465
+ firstName: string;
466
+ lastName: string;
467
+ password: string;
468
+ }>;
469
+ declare const UpdateUserSchema: z.ZodObject<Omit<{
470
+ email: z.ZodOptional<z.ZodString>;
471
+ firstName: z.ZodOptional<z.ZodString>;
472
+ lastName: z.ZodOptional<z.ZodString>;
473
+ password: z.ZodOptional<z.ZodString>;
474
+ }, "password"> & {
475
+ isActive: z.ZodOptional<z.ZodBoolean>;
476
+ }, "strip", z.ZodTypeAny, {
477
+ email?: string | undefined;
478
+ firstName?: string | undefined;
479
+ lastName?: string | undefined;
480
+ isActive?: boolean | undefined;
481
+ }, {
482
+ email?: string | undefined;
483
+ firstName?: string | undefined;
484
+ lastName?: string | undefined;
485
+ isActive?: boolean | undefined;
486
+ }>;
487
+ type User = z.infer<typeof UserSchema>;
488
+ type CreateUser = z.infer<typeof CreateUserSchema>;
489
+ type UpdateUser = z.infer<typeof UpdateUserSchema>;
490
+
491
+ declare const userContract: {
492
+ list: {
493
+ readonly query: zod.ZodObject<{
494
+ page: zod.ZodDefault<zod.ZodNumber>;
495
+ pageSize: zod.ZodDefault<zod.ZodNumber>;
496
+ sortBy: zod.ZodOptional<zod.ZodString>;
497
+ sortOrder: zod.ZodDefault<zod.ZodEnum<["asc", "desc"]>>;
498
+ }, "strip", zod.ZodTypeAny, {
499
+ page: number;
500
+ pageSize: number;
501
+ sortOrder: "asc" | "desc";
502
+ sortBy?: string | undefined;
503
+ }, {
504
+ page?: number | undefined;
505
+ pageSize?: number | undefined;
506
+ sortBy?: string | undefined;
507
+ sortOrder?: "asc" | "desc" | undefined;
508
+ }>;
509
+ readonly summary: `List all ${string}`;
510
+ readonly method: "GET";
511
+ path: `/${string}`;
512
+ responses: {
513
+ readonly 200: zod.ZodObject<{
514
+ data: zod.ZodArray<zod.ZodObject<{
515
+ id: zod.ZodString;
516
+ email: zod.ZodString;
517
+ firstName: zod.ZodString;
518
+ lastName: zod.ZodString;
519
+ isActive: zod.ZodDefault<zod.ZodBoolean>;
520
+ createdAt: zod.ZodString;
521
+ updatedAt: zod.ZodString;
522
+ }, "strip", zod.ZodTypeAny, {
523
+ id: string;
524
+ email: string;
525
+ firstName: string;
526
+ lastName: string;
527
+ isActive: boolean;
528
+ createdAt: string;
529
+ updatedAt: string;
530
+ }, {
531
+ id: string;
532
+ email: string;
533
+ firstName: string;
534
+ lastName: string;
535
+ createdAt: string;
536
+ updatedAt: string;
537
+ isActive?: boolean | undefined;
538
+ }>, "many">;
539
+ pagination: zod.ZodObject<{
540
+ page: zod.ZodNumber;
541
+ pageSize: zod.ZodNumber;
542
+ total: zod.ZodNumber;
543
+ totalPages: zod.ZodNumber;
544
+ hasNext: zod.ZodBoolean;
545
+ hasPrev: zod.ZodBoolean;
546
+ }, "strip", zod.ZodTypeAny, {
547
+ page: number;
548
+ pageSize: number;
549
+ total: number;
550
+ totalPages: number;
551
+ hasNext: boolean;
552
+ hasPrev: boolean;
553
+ }, {
554
+ page: number;
555
+ pageSize: number;
556
+ total: number;
557
+ totalPages: number;
558
+ hasNext: boolean;
559
+ hasPrev: boolean;
560
+ }>;
561
+ }, "strip", zod.ZodTypeAny, {
562
+ data: {
563
+ id: string;
564
+ email: string;
565
+ firstName: string;
566
+ lastName: string;
567
+ isActive: boolean;
568
+ createdAt: string;
569
+ updatedAt: string;
570
+ }[];
571
+ pagination: {
572
+ page: number;
573
+ pageSize: number;
574
+ total: number;
575
+ totalPages: number;
576
+ hasNext: boolean;
577
+ hasPrev: boolean;
578
+ };
579
+ }, {
580
+ data: {
581
+ id: string;
582
+ email: string;
583
+ firstName: string;
584
+ lastName: string;
585
+ createdAt: string;
586
+ updatedAt: string;
587
+ isActive?: boolean | undefined;
588
+ }[];
589
+ pagination: {
590
+ page: number;
591
+ pageSize: number;
592
+ total: number;
593
+ totalPages: number;
594
+ hasNext: boolean;
595
+ hasPrev: boolean;
596
+ };
597
+ }>;
598
+ };
599
+ };
600
+ findById: {
601
+ readonly summary: `Find ${string} by ID`;
602
+ readonly method: "GET";
603
+ path: `/${string}/:id`;
604
+ responses: {
605
+ readonly 200: zod.ZodObject<{
606
+ id: zod.ZodString;
607
+ email: zod.ZodString;
608
+ firstName: zod.ZodString;
609
+ lastName: zod.ZodString;
610
+ isActive: zod.ZodDefault<zod.ZodBoolean>;
611
+ createdAt: zod.ZodString;
612
+ updatedAt: zod.ZodString;
613
+ }, "strip", zod.ZodTypeAny, {
614
+ id: string;
615
+ email: string;
616
+ firstName: string;
617
+ lastName: string;
618
+ isActive: boolean;
619
+ createdAt: string;
620
+ updatedAt: string;
621
+ }, {
622
+ id: string;
623
+ email: string;
624
+ firstName: string;
625
+ lastName: string;
626
+ createdAt: string;
627
+ updatedAt: string;
628
+ isActive?: boolean | undefined;
629
+ }>;
630
+ readonly 404: zod.ZodObject<{
631
+ message: zod.ZodString;
632
+ }, "strip", zod.ZodTypeAny, {
633
+ message: string;
634
+ }, {
635
+ message: string;
636
+ }>;
637
+ };
638
+ };
639
+ create: {
640
+ readonly body: zod.ZodObject<{
641
+ email: zod.ZodString;
642
+ firstName: zod.ZodString;
643
+ lastName: zod.ZodString;
644
+ password: zod.ZodString;
645
+ }, "strip", zod.ZodTypeAny, {
646
+ email: string;
647
+ firstName: string;
648
+ lastName: string;
649
+ password: string;
650
+ }, {
651
+ email: string;
652
+ firstName: string;
653
+ lastName: string;
654
+ password: string;
655
+ }>;
656
+ readonly summary: `Create a new ${string}`;
657
+ readonly method: "POST";
658
+ path: `/${string}`;
659
+ responses: {
660
+ readonly 201: zod.ZodObject<{
661
+ id: zod.ZodString;
662
+ email: zod.ZodString;
663
+ firstName: zod.ZodString;
664
+ lastName: zod.ZodString;
665
+ isActive: zod.ZodDefault<zod.ZodBoolean>;
666
+ createdAt: zod.ZodString;
667
+ updatedAt: zod.ZodString;
668
+ }, "strip", zod.ZodTypeAny, {
669
+ id: string;
670
+ email: string;
671
+ firstName: string;
672
+ lastName: string;
673
+ isActive: boolean;
674
+ createdAt: string;
675
+ updatedAt: string;
676
+ }, {
677
+ id: string;
678
+ email: string;
679
+ firstName: string;
680
+ lastName: string;
681
+ createdAt: string;
682
+ updatedAt: string;
683
+ isActive?: boolean | undefined;
684
+ }>;
685
+ };
686
+ };
687
+ update: {
688
+ readonly body: zod.ZodObject<Omit<{
689
+ email: zod.ZodOptional<zod.ZodString>;
690
+ firstName: zod.ZodOptional<zod.ZodString>;
691
+ lastName: zod.ZodOptional<zod.ZodString>;
692
+ password: zod.ZodOptional<zod.ZodString>;
693
+ }, "password"> & {
694
+ isActive: zod.ZodOptional<zod.ZodBoolean>;
695
+ }, "strip", zod.ZodTypeAny, {
696
+ email?: string | undefined;
697
+ firstName?: string | undefined;
698
+ lastName?: string | undefined;
699
+ isActive?: boolean | undefined;
700
+ }, {
701
+ email?: string | undefined;
702
+ firstName?: string | undefined;
703
+ lastName?: string | undefined;
704
+ isActive?: boolean | undefined;
705
+ }>;
706
+ readonly summary: `Update ${string} by ID`;
707
+ readonly method: "PUT";
708
+ path: `/${string}/:id`;
709
+ responses: {
710
+ readonly 200: zod.ZodObject<{
711
+ id: zod.ZodString;
712
+ email: zod.ZodString;
713
+ firstName: zod.ZodString;
714
+ lastName: zod.ZodString;
715
+ isActive: zod.ZodDefault<zod.ZodBoolean>;
716
+ createdAt: zod.ZodString;
717
+ updatedAt: zod.ZodString;
718
+ }, "strip", zod.ZodTypeAny, {
719
+ id: string;
720
+ email: string;
721
+ firstName: string;
722
+ lastName: string;
723
+ isActive: boolean;
724
+ createdAt: string;
725
+ updatedAt: string;
726
+ }, {
727
+ id: string;
728
+ email: string;
729
+ firstName: string;
730
+ lastName: string;
731
+ createdAt: string;
732
+ updatedAt: string;
733
+ isActive?: boolean | undefined;
734
+ }>;
735
+ readonly 404: zod.ZodObject<{
736
+ message: zod.ZodString;
737
+ }, "strip", zod.ZodTypeAny, {
738
+ message: string;
739
+ }, {
740
+ message: string;
741
+ }>;
742
+ };
743
+ };
744
+ remove: {
745
+ readonly body: typeof _ts_rest_core.ContractNoBody;
746
+ readonly summary: `Delete ${string} by ID`;
747
+ readonly method: "DELETE";
748
+ path: `/${string}/:id`;
749
+ responses: {
750
+ readonly 204: typeof _ts_rest_core.ContractNoBody;
751
+ readonly 404: zod.ZodObject<{
752
+ message: zod.ZodString;
753
+ }, "strip", zod.ZodTypeAny, {
754
+ message: string;
755
+ }, {
756
+ message: string;
757
+ }>;
758
+ };
759
+ };
760
+ };
761
+
762
+ declare const ProductSchema: z.ZodObject<{
763
+ id: z.ZodString;
764
+ code: z.ZodString;
765
+ name: z.ZodString;
766
+ description: z.ZodOptional<z.ZodString>;
767
+ categoryId: z.ZodString;
768
+ unitOfMeasureId: z.ZodString;
769
+ taxId: z.ZodString;
770
+ isActive: z.ZodDefault<z.ZodBoolean>;
771
+ createdAt: z.ZodString;
772
+ updatedAt: z.ZodString;
773
+ }, "strip", z.ZodTypeAny, {
774
+ code: string;
775
+ id: string;
776
+ isActive: boolean;
777
+ createdAt: string;
778
+ updatedAt: string;
779
+ name: string;
780
+ categoryId: string;
781
+ unitOfMeasureId: string;
782
+ taxId: string;
783
+ description?: string | undefined;
784
+ }, {
785
+ code: string;
786
+ id: string;
787
+ createdAt: string;
788
+ updatedAt: string;
789
+ name: string;
790
+ categoryId: string;
791
+ unitOfMeasureId: string;
792
+ taxId: string;
793
+ isActive?: boolean | undefined;
794
+ description?: string | undefined;
795
+ }>;
796
+ declare const CreateProductSchema: z.ZodObject<{
797
+ code: z.ZodString;
798
+ name: z.ZodString;
799
+ description: z.ZodOptional<z.ZodString>;
800
+ categoryId: z.ZodString;
801
+ unitOfMeasureId: z.ZodString;
802
+ taxId: z.ZodString;
803
+ }, "strip", z.ZodTypeAny, {
804
+ code: string;
805
+ name: string;
806
+ categoryId: string;
807
+ unitOfMeasureId: string;
808
+ taxId: string;
809
+ description?: string | undefined;
810
+ }, {
811
+ code: string;
812
+ name: string;
813
+ categoryId: string;
814
+ unitOfMeasureId: string;
815
+ taxId: string;
816
+ description?: string | undefined;
817
+ }>;
818
+ declare const UpdateProductSchema: z.ZodObject<{
819
+ code: z.ZodOptional<z.ZodString>;
820
+ name: z.ZodOptional<z.ZodString>;
821
+ description: z.ZodOptional<z.ZodOptional<z.ZodString>>;
822
+ categoryId: z.ZodOptional<z.ZodString>;
823
+ unitOfMeasureId: z.ZodOptional<z.ZodString>;
824
+ taxId: z.ZodOptional<z.ZodString>;
825
+ } & {
826
+ isActive: z.ZodOptional<z.ZodBoolean>;
827
+ }, "strip", z.ZodTypeAny, {
828
+ code?: string | undefined;
829
+ isActive?: boolean | undefined;
830
+ description?: string | undefined;
831
+ name?: string | undefined;
832
+ categoryId?: string | undefined;
833
+ unitOfMeasureId?: string | undefined;
834
+ taxId?: string | undefined;
835
+ }, {
836
+ code?: string | undefined;
837
+ isActive?: boolean | undefined;
838
+ description?: string | undefined;
839
+ name?: string | undefined;
840
+ categoryId?: string | undefined;
841
+ unitOfMeasureId?: string | undefined;
842
+ taxId?: string | undefined;
843
+ }>;
844
+ type Product = z.infer<typeof ProductSchema>;
845
+ type CreateProduct = z.infer<typeof CreateProductSchema>;
846
+ type UpdateProduct = z.infer<typeof UpdateProductSchema>;
847
+
848
+ declare const productContract: {
849
+ list: {
850
+ readonly query: zod.ZodObject<{
851
+ page: zod.ZodDefault<zod.ZodNumber>;
852
+ pageSize: zod.ZodDefault<zod.ZodNumber>;
853
+ sortBy: zod.ZodOptional<zod.ZodString>;
854
+ sortOrder: zod.ZodDefault<zod.ZodEnum<["asc", "desc"]>>;
855
+ }, "strip", zod.ZodTypeAny, {
856
+ page: number;
857
+ pageSize: number;
858
+ sortOrder: "asc" | "desc";
859
+ sortBy?: string | undefined;
860
+ }, {
861
+ page?: number | undefined;
862
+ pageSize?: number | undefined;
863
+ sortBy?: string | undefined;
864
+ sortOrder?: "asc" | "desc" | undefined;
865
+ }>;
866
+ readonly summary: `List all ${string}`;
867
+ readonly method: "GET";
868
+ path: `/${string}`;
869
+ responses: {
870
+ readonly 200: zod.ZodObject<{
871
+ data: zod.ZodArray<zod.ZodObject<{
872
+ id: zod.ZodString;
873
+ code: zod.ZodString;
874
+ name: zod.ZodString;
875
+ description: zod.ZodOptional<zod.ZodString>;
876
+ categoryId: zod.ZodString;
877
+ unitOfMeasureId: zod.ZodString;
878
+ taxId: zod.ZodString;
879
+ isActive: zod.ZodDefault<zod.ZodBoolean>;
880
+ createdAt: zod.ZodString;
881
+ updatedAt: zod.ZodString;
882
+ }, "strip", zod.ZodTypeAny, {
883
+ code: string;
884
+ id: string;
885
+ isActive: boolean;
886
+ createdAt: string;
887
+ updatedAt: string;
888
+ name: string;
889
+ categoryId: string;
890
+ unitOfMeasureId: string;
891
+ taxId: string;
892
+ description?: string | undefined;
893
+ }, {
894
+ code: string;
895
+ id: string;
896
+ createdAt: string;
897
+ updatedAt: string;
898
+ name: string;
899
+ categoryId: string;
900
+ unitOfMeasureId: string;
901
+ taxId: string;
902
+ isActive?: boolean | undefined;
903
+ description?: string | undefined;
904
+ }>, "many">;
905
+ pagination: zod.ZodObject<{
906
+ page: zod.ZodNumber;
907
+ pageSize: zod.ZodNumber;
908
+ total: zod.ZodNumber;
909
+ totalPages: zod.ZodNumber;
910
+ hasNext: zod.ZodBoolean;
911
+ hasPrev: zod.ZodBoolean;
912
+ }, "strip", zod.ZodTypeAny, {
913
+ page: number;
914
+ pageSize: number;
915
+ total: number;
916
+ totalPages: number;
917
+ hasNext: boolean;
918
+ hasPrev: boolean;
919
+ }, {
920
+ page: number;
921
+ pageSize: number;
922
+ total: number;
923
+ totalPages: number;
924
+ hasNext: boolean;
925
+ hasPrev: boolean;
926
+ }>;
927
+ }, "strip", zod.ZodTypeAny, {
928
+ data: {
929
+ code: string;
930
+ id: string;
931
+ isActive: boolean;
932
+ createdAt: string;
933
+ updatedAt: string;
934
+ name: string;
935
+ categoryId: string;
936
+ unitOfMeasureId: string;
937
+ taxId: string;
938
+ description?: string | undefined;
939
+ }[];
940
+ pagination: {
941
+ page: number;
942
+ pageSize: number;
943
+ total: number;
944
+ totalPages: number;
945
+ hasNext: boolean;
946
+ hasPrev: boolean;
947
+ };
948
+ }, {
949
+ data: {
950
+ code: string;
951
+ id: string;
952
+ createdAt: string;
953
+ updatedAt: string;
954
+ name: string;
955
+ categoryId: string;
956
+ unitOfMeasureId: string;
957
+ taxId: string;
958
+ isActive?: boolean | undefined;
959
+ description?: string | undefined;
960
+ }[];
961
+ pagination: {
962
+ page: number;
963
+ pageSize: number;
964
+ total: number;
965
+ totalPages: number;
966
+ hasNext: boolean;
967
+ hasPrev: boolean;
968
+ };
969
+ }>;
970
+ };
971
+ };
972
+ findById: {
973
+ readonly summary: `Find ${string} by ID`;
974
+ readonly method: "GET";
975
+ path: `/${string}/:id`;
976
+ responses: {
977
+ readonly 200: zod.ZodObject<{
978
+ id: zod.ZodString;
979
+ code: zod.ZodString;
980
+ name: zod.ZodString;
981
+ description: zod.ZodOptional<zod.ZodString>;
982
+ categoryId: zod.ZodString;
983
+ unitOfMeasureId: zod.ZodString;
984
+ taxId: zod.ZodString;
985
+ isActive: zod.ZodDefault<zod.ZodBoolean>;
986
+ createdAt: zod.ZodString;
987
+ updatedAt: zod.ZodString;
988
+ }, "strip", zod.ZodTypeAny, {
989
+ code: string;
990
+ id: string;
991
+ isActive: boolean;
992
+ createdAt: string;
993
+ updatedAt: string;
994
+ name: string;
995
+ categoryId: string;
996
+ unitOfMeasureId: string;
997
+ taxId: string;
998
+ description?: string | undefined;
999
+ }, {
1000
+ code: string;
1001
+ id: string;
1002
+ createdAt: string;
1003
+ updatedAt: string;
1004
+ name: string;
1005
+ categoryId: string;
1006
+ unitOfMeasureId: string;
1007
+ taxId: string;
1008
+ isActive?: boolean | undefined;
1009
+ description?: string | undefined;
1010
+ }>;
1011
+ readonly 404: zod.ZodObject<{
1012
+ message: zod.ZodString;
1013
+ }, "strip", zod.ZodTypeAny, {
1014
+ message: string;
1015
+ }, {
1016
+ message: string;
1017
+ }>;
1018
+ };
1019
+ };
1020
+ create: {
1021
+ readonly body: zod.ZodObject<{
1022
+ code: zod.ZodString;
1023
+ name: zod.ZodString;
1024
+ description: zod.ZodOptional<zod.ZodString>;
1025
+ categoryId: zod.ZodString;
1026
+ unitOfMeasureId: zod.ZodString;
1027
+ taxId: zod.ZodString;
1028
+ }, "strip", zod.ZodTypeAny, {
1029
+ code: string;
1030
+ name: string;
1031
+ categoryId: string;
1032
+ unitOfMeasureId: string;
1033
+ taxId: string;
1034
+ description?: string | undefined;
1035
+ }, {
1036
+ code: string;
1037
+ name: string;
1038
+ categoryId: string;
1039
+ unitOfMeasureId: string;
1040
+ taxId: string;
1041
+ description?: string | undefined;
1042
+ }>;
1043
+ readonly summary: `Create a new ${string}`;
1044
+ readonly method: "POST";
1045
+ path: `/${string}`;
1046
+ responses: {
1047
+ readonly 201: zod.ZodObject<{
1048
+ id: zod.ZodString;
1049
+ code: zod.ZodString;
1050
+ name: zod.ZodString;
1051
+ description: zod.ZodOptional<zod.ZodString>;
1052
+ categoryId: zod.ZodString;
1053
+ unitOfMeasureId: zod.ZodString;
1054
+ taxId: zod.ZodString;
1055
+ isActive: zod.ZodDefault<zod.ZodBoolean>;
1056
+ createdAt: zod.ZodString;
1057
+ updatedAt: zod.ZodString;
1058
+ }, "strip", zod.ZodTypeAny, {
1059
+ code: string;
1060
+ id: string;
1061
+ isActive: boolean;
1062
+ createdAt: string;
1063
+ updatedAt: string;
1064
+ name: string;
1065
+ categoryId: string;
1066
+ unitOfMeasureId: string;
1067
+ taxId: string;
1068
+ description?: string | undefined;
1069
+ }, {
1070
+ code: string;
1071
+ id: string;
1072
+ createdAt: string;
1073
+ updatedAt: string;
1074
+ name: string;
1075
+ categoryId: string;
1076
+ unitOfMeasureId: string;
1077
+ taxId: string;
1078
+ isActive?: boolean | undefined;
1079
+ description?: string | undefined;
1080
+ }>;
1081
+ };
1082
+ };
1083
+ update: {
1084
+ readonly body: zod.ZodObject<{
1085
+ code: zod.ZodOptional<zod.ZodString>;
1086
+ name: zod.ZodOptional<zod.ZodString>;
1087
+ description: zod.ZodOptional<zod.ZodOptional<zod.ZodString>>;
1088
+ categoryId: zod.ZodOptional<zod.ZodString>;
1089
+ unitOfMeasureId: zod.ZodOptional<zod.ZodString>;
1090
+ taxId: zod.ZodOptional<zod.ZodString>;
1091
+ } & {
1092
+ isActive: zod.ZodOptional<zod.ZodBoolean>;
1093
+ }, "strip", zod.ZodTypeAny, {
1094
+ code?: string | undefined;
1095
+ isActive?: boolean | undefined;
1096
+ description?: string | undefined;
1097
+ name?: string | undefined;
1098
+ categoryId?: string | undefined;
1099
+ unitOfMeasureId?: string | undefined;
1100
+ taxId?: string | undefined;
1101
+ }, {
1102
+ code?: string | undefined;
1103
+ isActive?: boolean | undefined;
1104
+ description?: string | undefined;
1105
+ name?: string | undefined;
1106
+ categoryId?: string | undefined;
1107
+ unitOfMeasureId?: string | undefined;
1108
+ taxId?: string | undefined;
1109
+ }>;
1110
+ readonly summary: `Update ${string} by ID`;
1111
+ readonly method: "PUT";
1112
+ path: `/${string}/:id`;
1113
+ responses: {
1114
+ readonly 200: zod.ZodObject<{
1115
+ id: zod.ZodString;
1116
+ code: zod.ZodString;
1117
+ name: zod.ZodString;
1118
+ description: zod.ZodOptional<zod.ZodString>;
1119
+ categoryId: zod.ZodString;
1120
+ unitOfMeasureId: zod.ZodString;
1121
+ taxId: zod.ZodString;
1122
+ isActive: zod.ZodDefault<zod.ZodBoolean>;
1123
+ createdAt: zod.ZodString;
1124
+ updatedAt: zod.ZodString;
1125
+ }, "strip", zod.ZodTypeAny, {
1126
+ code: string;
1127
+ id: string;
1128
+ isActive: boolean;
1129
+ createdAt: string;
1130
+ updatedAt: string;
1131
+ name: string;
1132
+ categoryId: string;
1133
+ unitOfMeasureId: string;
1134
+ taxId: string;
1135
+ description?: string | undefined;
1136
+ }, {
1137
+ code: string;
1138
+ id: string;
1139
+ createdAt: string;
1140
+ updatedAt: string;
1141
+ name: string;
1142
+ categoryId: string;
1143
+ unitOfMeasureId: string;
1144
+ taxId: string;
1145
+ isActive?: boolean | undefined;
1146
+ description?: string | undefined;
1147
+ }>;
1148
+ readonly 404: zod.ZodObject<{
1149
+ message: zod.ZodString;
1150
+ }, "strip", zod.ZodTypeAny, {
1151
+ message: string;
1152
+ }, {
1153
+ message: string;
1154
+ }>;
1155
+ };
1156
+ };
1157
+ remove: {
1158
+ readonly body: typeof _ts_rest_core.ContractNoBody;
1159
+ readonly summary: `Delete ${string} by ID`;
1160
+ readonly method: "DELETE";
1161
+ path: `/${string}/:id`;
1162
+ responses: {
1163
+ readonly 204: typeof _ts_rest_core.ContractNoBody;
1164
+ readonly 404: zod.ZodObject<{
1165
+ message: zod.ZodString;
1166
+ }, "strip", zod.ZodTypeAny, {
1167
+ message: string;
1168
+ }, {
1169
+ message: string;
1170
+ }>;
1171
+ };
1172
+ };
1173
+ };
1174
+
1175
+ declare const OrderItemSchema: z.ZodObject<{
1176
+ id: z.ZodString;
1177
+ orderId: z.ZodString;
1178
+ productId: z.ZodString;
1179
+ quantity: z.ZodNumber;
1180
+ unitPrice: z.ZodNumber;
1181
+ subtotal: z.ZodNumber;
1182
+ taxAmount: z.ZodNumber;
1183
+ total: z.ZodNumber;
1184
+ }, "strip", z.ZodTypeAny, {
1185
+ total: number;
1186
+ id: string;
1187
+ orderId: string;
1188
+ productId: string;
1189
+ quantity: number;
1190
+ unitPrice: number;
1191
+ subtotal: number;
1192
+ taxAmount: number;
1193
+ }, {
1194
+ total: number;
1195
+ id: string;
1196
+ orderId: string;
1197
+ productId: string;
1198
+ quantity: number;
1199
+ unitPrice: number;
1200
+ subtotal: number;
1201
+ taxAmount: number;
1202
+ }>;
1203
+ declare const CreateOrderItemSchema: z.ZodObject<{
1204
+ productId: z.ZodString;
1205
+ quantity: z.ZodNumber;
1206
+ unitPrice: z.ZodNumber;
1207
+ }, "strip", z.ZodTypeAny, {
1208
+ productId: string;
1209
+ quantity: number;
1210
+ unitPrice: number;
1211
+ }, {
1212
+ productId: string;
1213
+ quantity: number;
1214
+ unitPrice: number;
1215
+ }>;
1216
+ declare const OrderStatusSchema: z.ZodEnum<["pending", "confirmed", "processing", "shipped", "delivered", "cancelled"]>;
1217
+ declare const OrderSchema: z.ZodObject<{
1218
+ id: z.ZodString;
1219
+ orderNumber: z.ZodString;
1220
+ clientId: z.ZodString;
1221
+ sellerId: z.ZodOptional<z.ZodString>;
1222
+ status: z.ZodEnum<["pending", "confirmed", "processing", "shipped", "delivered", "cancelled"]>;
1223
+ subtotal: z.ZodNumber;
1224
+ taxAmount: z.ZodNumber;
1225
+ discountAmount: z.ZodDefault<z.ZodNumber>;
1226
+ total: z.ZodNumber;
1227
+ notes: z.ZodOptional<z.ZodString>;
1228
+ createdAt: z.ZodString;
1229
+ updatedAt: z.ZodString;
1230
+ items: z.ZodOptional<z.ZodArray<z.ZodObject<{
1231
+ id: z.ZodString;
1232
+ orderId: z.ZodString;
1233
+ productId: z.ZodString;
1234
+ quantity: z.ZodNumber;
1235
+ unitPrice: z.ZodNumber;
1236
+ subtotal: z.ZodNumber;
1237
+ taxAmount: z.ZodNumber;
1238
+ total: z.ZodNumber;
1239
+ }, "strip", z.ZodTypeAny, {
1240
+ total: number;
1241
+ id: string;
1242
+ orderId: string;
1243
+ productId: string;
1244
+ quantity: number;
1245
+ unitPrice: number;
1246
+ subtotal: number;
1247
+ taxAmount: number;
1248
+ }, {
1249
+ total: number;
1250
+ id: string;
1251
+ orderId: string;
1252
+ productId: string;
1253
+ quantity: number;
1254
+ unitPrice: number;
1255
+ subtotal: number;
1256
+ taxAmount: number;
1257
+ }>, "many">>;
1258
+ }, "strip", z.ZodTypeAny, {
1259
+ status: "pending" | "confirmed" | "processing" | "shipped" | "delivered" | "cancelled";
1260
+ total: number;
1261
+ id: string;
1262
+ createdAt: string;
1263
+ updatedAt: string;
1264
+ subtotal: number;
1265
+ taxAmount: number;
1266
+ orderNumber: string;
1267
+ clientId: string;
1268
+ discountAmount: number;
1269
+ sellerId?: string | undefined;
1270
+ notes?: string | undefined;
1271
+ items?: {
1272
+ total: number;
1273
+ id: string;
1274
+ orderId: string;
1275
+ productId: string;
1276
+ quantity: number;
1277
+ unitPrice: number;
1278
+ subtotal: number;
1279
+ taxAmount: number;
1280
+ }[] | undefined;
1281
+ }, {
1282
+ status: "pending" | "confirmed" | "processing" | "shipped" | "delivered" | "cancelled";
1283
+ total: number;
1284
+ id: string;
1285
+ createdAt: string;
1286
+ updatedAt: string;
1287
+ subtotal: number;
1288
+ taxAmount: number;
1289
+ orderNumber: string;
1290
+ clientId: string;
1291
+ sellerId?: string | undefined;
1292
+ discountAmount?: number | undefined;
1293
+ notes?: string | undefined;
1294
+ items?: {
1295
+ total: number;
1296
+ id: string;
1297
+ orderId: string;
1298
+ productId: string;
1299
+ quantity: number;
1300
+ unitPrice: number;
1301
+ subtotal: number;
1302
+ taxAmount: number;
1303
+ }[] | undefined;
1304
+ }>;
1305
+ declare const CreateOrderSchema: z.ZodObject<{
1306
+ clientId: z.ZodString;
1307
+ sellerId: z.ZodOptional<z.ZodString>;
1308
+ notes: z.ZodOptional<z.ZodString>;
1309
+ items: z.ZodArray<z.ZodObject<{
1310
+ productId: z.ZodString;
1311
+ quantity: z.ZodNumber;
1312
+ unitPrice: z.ZodNumber;
1313
+ }, "strip", z.ZodTypeAny, {
1314
+ productId: string;
1315
+ quantity: number;
1316
+ unitPrice: number;
1317
+ }, {
1318
+ productId: string;
1319
+ quantity: number;
1320
+ unitPrice: number;
1321
+ }>, "many">;
1322
+ }, "strip", z.ZodTypeAny, {
1323
+ clientId: string;
1324
+ items: {
1325
+ productId: string;
1326
+ quantity: number;
1327
+ unitPrice: number;
1328
+ }[];
1329
+ sellerId?: string | undefined;
1330
+ notes?: string | undefined;
1331
+ }, {
1332
+ clientId: string;
1333
+ items: {
1334
+ productId: string;
1335
+ quantity: number;
1336
+ unitPrice: number;
1337
+ }[];
1338
+ sellerId?: string | undefined;
1339
+ notes?: string | undefined;
1340
+ }>;
1341
+ declare const UpdateOrderStatusSchema: z.ZodObject<{
1342
+ status: z.ZodEnum<["pending", "confirmed", "processing", "shipped", "delivered", "cancelled"]>;
1343
+ }, "strip", z.ZodTypeAny, {
1344
+ status: "pending" | "confirmed" | "processing" | "shipped" | "delivered" | "cancelled";
1345
+ }, {
1346
+ status: "pending" | "confirmed" | "processing" | "shipped" | "delivered" | "cancelled";
1347
+ }>;
1348
+ type OrderItem = z.infer<typeof OrderItemSchema>;
1349
+ type CreateOrderItem = z.infer<typeof CreateOrderItemSchema>;
1350
+ type Order = z.infer<typeof OrderSchema>;
1351
+ type CreateOrder = z.infer<typeof CreateOrderSchema>;
1352
+ type UpdateOrderStatus = z.infer<typeof UpdateOrderStatusSchema>;
1353
+ type OrderStatus = z.infer<typeof OrderStatusSchema>;
1354
+
1355
+ declare const orderContract: {
1356
+ list: {
1357
+ readonly query: zod.ZodObject<{
1358
+ page: zod.ZodDefault<zod.ZodNumber>;
1359
+ pageSize: zod.ZodDefault<zod.ZodNumber>;
1360
+ sortBy: zod.ZodOptional<zod.ZodString>;
1361
+ sortOrder: zod.ZodDefault<zod.ZodEnum<["asc", "desc"]>>;
1362
+ }, "strip", zod.ZodTypeAny, {
1363
+ page: number;
1364
+ pageSize: number;
1365
+ sortOrder: "asc" | "desc";
1366
+ sortBy?: string | undefined;
1367
+ }, {
1368
+ page?: number | undefined;
1369
+ pageSize?: number | undefined;
1370
+ sortBy?: string | undefined;
1371
+ sortOrder?: "asc" | "desc" | undefined;
1372
+ }>;
1373
+ readonly summary: `List all ${string}`;
1374
+ readonly method: "GET";
1375
+ path: `/${string}`;
1376
+ responses: {
1377
+ readonly 200: zod.ZodObject<{
1378
+ data: zod.ZodArray<zod.ZodObject<{
1379
+ id: zod.ZodString;
1380
+ orderNumber: zod.ZodString;
1381
+ clientId: zod.ZodString;
1382
+ sellerId: zod.ZodOptional<zod.ZodString>;
1383
+ status: zod.ZodEnum<["pending", "confirmed", "processing", "shipped", "delivered", "cancelled"]>;
1384
+ subtotal: zod.ZodNumber;
1385
+ taxAmount: zod.ZodNumber;
1386
+ discountAmount: zod.ZodDefault<zod.ZodNumber>;
1387
+ total: zod.ZodNumber;
1388
+ notes: zod.ZodOptional<zod.ZodString>;
1389
+ createdAt: zod.ZodString;
1390
+ updatedAt: zod.ZodString;
1391
+ items: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
1392
+ id: zod.ZodString;
1393
+ orderId: zod.ZodString;
1394
+ productId: zod.ZodString;
1395
+ quantity: zod.ZodNumber;
1396
+ unitPrice: zod.ZodNumber;
1397
+ subtotal: zod.ZodNumber;
1398
+ taxAmount: zod.ZodNumber;
1399
+ total: zod.ZodNumber;
1400
+ }, "strip", zod.ZodTypeAny, {
1401
+ total: number;
1402
+ id: string;
1403
+ orderId: string;
1404
+ productId: string;
1405
+ quantity: number;
1406
+ unitPrice: number;
1407
+ subtotal: number;
1408
+ taxAmount: number;
1409
+ }, {
1410
+ total: number;
1411
+ id: string;
1412
+ orderId: string;
1413
+ productId: string;
1414
+ quantity: number;
1415
+ unitPrice: number;
1416
+ subtotal: number;
1417
+ taxAmount: number;
1418
+ }>, "many">>;
1419
+ }, "strip", zod.ZodTypeAny, {
1420
+ status: "pending" | "confirmed" | "processing" | "shipped" | "delivered" | "cancelled";
1421
+ total: number;
1422
+ id: string;
1423
+ createdAt: string;
1424
+ updatedAt: string;
1425
+ subtotal: number;
1426
+ taxAmount: number;
1427
+ orderNumber: string;
1428
+ clientId: string;
1429
+ discountAmount: number;
1430
+ sellerId?: string | undefined;
1431
+ notes?: string | undefined;
1432
+ items?: {
1433
+ total: number;
1434
+ id: string;
1435
+ orderId: string;
1436
+ productId: string;
1437
+ quantity: number;
1438
+ unitPrice: number;
1439
+ subtotal: number;
1440
+ taxAmount: number;
1441
+ }[] | undefined;
1442
+ }, {
1443
+ status: "pending" | "confirmed" | "processing" | "shipped" | "delivered" | "cancelled";
1444
+ total: number;
1445
+ id: string;
1446
+ createdAt: string;
1447
+ updatedAt: string;
1448
+ subtotal: number;
1449
+ taxAmount: number;
1450
+ orderNumber: string;
1451
+ clientId: string;
1452
+ sellerId?: string | undefined;
1453
+ discountAmount?: number | undefined;
1454
+ notes?: string | undefined;
1455
+ items?: {
1456
+ total: number;
1457
+ id: string;
1458
+ orderId: string;
1459
+ productId: string;
1460
+ quantity: number;
1461
+ unitPrice: number;
1462
+ subtotal: number;
1463
+ taxAmount: number;
1464
+ }[] | undefined;
1465
+ }>, "many">;
1466
+ pagination: zod.ZodObject<{
1467
+ page: zod.ZodNumber;
1468
+ pageSize: zod.ZodNumber;
1469
+ total: zod.ZodNumber;
1470
+ totalPages: zod.ZodNumber;
1471
+ hasNext: zod.ZodBoolean;
1472
+ hasPrev: zod.ZodBoolean;
1473
+ }, "strip", zod.ZodTypeAny, {
1474
+ page: number;
1475
+ pageSize: number;
1476
+ total: number;
1477
+ totalPages: number;
1478
+ hasNext: boolean;
1479
+ hasPrev: boolean;
1480
+ }, {
1481
+ page: number;
1482
+ pageSize: number;
1483
+ total: number;
1484
+ totalPages: number;
1485
+ hasNext: boolean;
1486
+ hasPrev: boolean;
1487
+ }>;
1488
+ }, "strip", zod.ZodTypeAny, {
1489
+ data: {
1490
+ status: "pending" | "confirmed" | "processing" | "shipped" | "delivered" | "cancelled";
1491
+ total: number;
1492
+ id: string;
1493
+ createdAt: string;
1494
+ updatedAt: string;
1495
+ subtotal: number;
1496
+ taxAmount: number;
1497
+ orderNumber: string;
1498
+ clientId: string;
1499
+ discountAmount: number;
1500
+ sellerId?: string | undefined;
1501
+ notes?: string | undefined;
1502
+ items?: {
1503
+ total: number;
1504
+ id: string;
1505
+ orderId: string;
1506
+ productId: string;
1507
+ quantity: number;
1508
+ unitPrice: number;
1509
+ subtotal: number;
1510
+ taxAmount: number;
1511
+ }[] | undefined;
1512
+ }[];
1513
+ pagination: {
1514
+ page: number;
1515
+ pageSize: number;
1516
+ total: number;
1517
+ totalPages: number;
1518
+ hasNext: boolean;
1519
+ hasPrev: boolean;
1520
+ };
1521
+ }, {
1522
+ data: {
1523
+ status: "pending" | "confirmed" | "processing" | "shipped" | "delivered" | "cancelled";
1524
+ total: number;
1525
+ id: string;
1526
+ createdAt: string;
1527
+ updatedAt: string;
1528
+ subtotal: number;
1529
+ taxAmount: number;
1530
+ orderNumber: string;
1531
+ clientId: string;
1532
+ sellerId?: string | undefined;
1533
+ discountAmount?: number | undefined;
1534
+ notes?: string | undefined;
1535
+ items?: {
1536
+ total: number;
1537
+ id: string;
1538
+ orderId: string;
1539
+ productId: string;
1540
+ quantity: number;
1541
+ unitPrice: number;
1542
+ subtotal: number;
1543
+ taxAmount: number;
1544
+ }[] | undefined;
1545
+ }[];
1546
+ pagination: {
1547
+ page: number;
1548
+ pageSize: number;
1549
+ total: number;
1550
+ totalPages: number;
1551
+ hasNext: boolean;
1552
+ hasPrev: boolean;
1553
+ };
1554
+ }>;
1555
+ };
1556
+ };
1557
+ findById: {
1558
+ readonly summary: `Find ${string} by ID`;
1559
+ readonly method: "GET";
1560
+ path: `/${string}/:id`;
1561
+ responses: {
1562
+ readonly 200: zod.ZodObject<{
1563
+ id: zod.ZodString;
1564
+ orderNumber: zod.ZodString;
1565
+ clientId: zod.ZodString;
1566
+ sellerId: zod.ZodOptional<zod.ZodString>;
1567
+ status: zod.ZodEnum<["pending", "confirmed", "processing", "shipped", "delivered", "cancelled"]>;
1568
+ subtotal: zod.ZodNumber;
1569
+ taxAmount: zod.ZodNumber;
1570
+ discountAmount: zod.ZodDefault<zod.ZodNumber>;
1571
+ total: zod.ZodNumber;
1572
+ notes: zod.ZodOptional<zod.ZodString>;
1573
+ createdAt: zod.ZodString;
1574
+ updatedAt: zod.ZodString;
1575
+ items: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
1576
+ id: zod.ZodString;
1577
+ orderId: zod.ZodString;
1578
+ productId: zod.ZodString;
1579
+ quantity: zod.ZodNumber;
1580
+ unitPrice: zod.ZodNumber;
1581
+ subtotal: zod.ZodNumber;
1582
+ taxAmount: zod.ZodNumber;
1583
+ total: zod.ZodNumber;
1584
+ }, "strip", zod.ZodTypeAny, {
1585
+ total: number;
1586
+ id: string;
1587
+ orderId: string;
1588
+ productId: string;
1589
+ quantity: number;
1590
+ unitPrice: number;
1591
+ subtotal: number;
1592
+ taxAmount: number;
1593
+ }, {
1594
+ total: number;
1595
+ id: string;
1596
+ orderId: string;
1597
+ productId: string;
1598
+ quantity: number;
1599
+ unitPrice: number;
1600
+ subtotal: number;
1601
+ taxAmount: number;
1602
+ }>, "many">>;
1603
+ }, "strip", zod.ZodTypeAny, {
1604
+ status: "pending" | "confirmed" | "processing" | "shipped" | "delivered" | "cancelled";
1605
+ total: number;
1606
+ id: string;
1607
+ createdAt: string;
1608
+ updatedAt: string;
1609
+ subtotal: number;
1610
+ taxAmount: number;
1611
+ orderNumber: string;
1612
+ clientId: string;
1613
+ discountAmount: number;
1614
+ sellerId?: string | undefined;
1615
+ notes?: string | undefined;
1616
+ items?: {
1617
+ total: number;
1618
+ id: string;
1619
+ orderId: string;
1620
+ productId: string;
1621
+ quantity: number;
1622
+ unitPrice: number;
1623
+ subtotal: number;
1624
+ taxAmount: number;
1625
+ }[] | undefined;
1626
+ }, {
1627
+ status: "pending" | "confirmed" | "processing" | "shipped" | "delivered" | "cancelled";
1628
+ total: number;
1629
+ id: string;
1630
+ createdAt: string;
1631
+ updatedAt: string;
1632
+ subtotal: number;
1633
+ taxAmount: number;
1634
+ orderNumber: string;
1635
+ clientId: string;
1636
+ sellerId?: string | undefined;
1637
+ discountAmount?: number | undefined;
1638
+ notes?: string | undefined;
1639
+ items?: {
1640
+ total: number;
1641
+ id: string;
1642
+ orderId: string;
1643
+ productId: string;
1644
+ quantity: number;
1645
+ unitPrice: number;
1646
+ subtotal: number;
1647
+ taxAmount: number;
1648
+ }[] | undefined;
1649
+ }>;
1650
+ readonly 404: zod.ZodObject<{
1651
+ message: zod.ZodString;
1652
+ }, "strip", zod.ZodTypeAny, {
1653
+ message: string;
1654
+ }, {
1655
+ message: string;
1656
+ }>;
1657
+ };
1658
+ };
1659
+ create: {
1660
+ readonly body: zod.ZodObject<{
1661
+ clientId: zod.ZodString;
1662
+ sellerId: zod.ZodOptional<zod.ZodString>;
1663
+ notes: zod.ZodOptional<zod.ZodString>;
1664
+ items: zod.ZodArray<zod.ZodObject<{
1665
+ productId: zod.ZodString;
1666
+ quantity: zod.ZodNumber;
1667
+ unitPrice: zod.ZodNumber;
1668
+ }, "strip", zod.ZodTypeAny, {
1669
+ productId: string;
1670
+ quantity: number;
1671
+ unitPrice: number;
1672
+ }, {
1673
+ productId: string;
1674
+ quantity: number;
1675
+ unitPrice: number;
1676
+ }>, "many">;
1677
+ }, "strip", zod.ZodTypeAny, {
1678
+ clientId: string;
1679
+ items: {
1680
+ productId: string;
1681
+ quantity: number;
1682
+ unitPrice: number;
1683
+ }[];
1684
+ sellerId?: string | undefined;
1685
+ notes?: string | undefined;
1686
+ }, {
1687
+ clientId: string;
1688
+ items: {
1689
+ productId: string;
1690
+ quantity: number;
1691
+ unitPrice: number;
1692
+ }[];
1693
+ sellerId?: string | undefined;
1694
+ notes?: string | undefined;
1695
+ }>;
1696
+ readonly summary: `Create a new ${string}`;
1697
+ readonly method: "POST";
1698
+ path: `/${string}`;
1699
+ responses: {
1700
+ readonly 201: zod.ZodObject<{
1701
+ id: zod.ZodString;
1702
+ orderNumber: zod.ZodString;
1703
+ clientId: zod.ZodString;
1704
+ sellerId: zod.ZodOptional<zod.ZodString>;
1705
+ status: zod.ZodEnum<["pending", "confirmed", "processing", "shipped", "delivered", "cancelled"]>;
1706
+ subtotal: zod.ZodNumber;
1707
+ taxAmount: zod.ZodNumber;
1708
+ discountAmount: zod.ZodDefault<zod.ZodNumber>;
1709
+ total: zod.ZodNumber;
1710
+ notes: zod.ZodOptional<zod.ZodString>;
1711
+ createdAt: zod.ZodString;
1712
+ updatedAt: zod.ZodString;
1713
+ items: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
1714
+ id: zod.ZodString;
1715
+ orderId: zod.ZodString;
1716
+ productId: zod.ZodString;
1717
+ quantity: zod.ZodNumber;
1718
+ unitPrice: zod.ZodNumber;
1719
+ subtotal: zod.ZodNumber;
1720
+ taxAmount: zod.ZodNumber;
1721
+ total: zod.ZodNumber;
1722
+ }, "strip", zod.ZodTypeAny, {
1723
+ total: number;
1724
+ id: string;
1725
+ orderId: string;
1726
+ productId: string;
1727
+ quantity: number;
1728
+ unitPrice: number;
1729
+ subtotal: number;
1730
+ taxAmount: number;
1731
+ }, {
1732
+ total: number;
1733
+ id: string;
1734
+ orderId: string;
1735
+ productId: string;
1736
+ quantity: number;
1737
+ unitPrice: number;
1738
+ subtotal: number;
1739
+ taxAmount: number;
1740
+ }>, "many">>;
1741
+ }, "strip", zod.ZodTypeAny, {
1742
+ status: "pending" | "confirmed" | "processing" | "shipped" | "delivered" | "cancelled";
1743
+ total: number;
1744
+ id: string;
1745
+ createdAt: string;
1746
+ updatedAt: string;
1747
+ subtotal: number;
1748
+ taxAmount: number;
1749
+ orderNumber: string;
1750
+ clientId: string;
1751
+ discountAmount: number;
1752
+ sellerId?: string | undefined;
1753
+ notes?: string | undefined;
1754
+ items?: {
1755
+ total: number;
1756
+ id: string;
1757
+ orderId: string;
1758
+ productId: string;
1759
+ quantity: number;
1760
+ unitPrice: number;
1761
+ subtotal: number;
1762
+ taxAmount: number;
1763
+ }[] | undefined;
1764
+ }, {
1765
+ status: "pending" | "confirmed" | "processing" | "shipped" | "delivered" | "cancelled";
1766
+ total: number;
1767
+ id: string;
1768
+ createdAt: string;
1769
+ updatedAt: string;
1770
+ subtotal: number;
1771
+ taxAmount: number;
1772
+ orderNumber: string;
1773
+ clientId: string;
1774
+ sellerId?: string | undefined;
1775
+ discountAmount?: number | undefined;
1776
+ notes?: string | undefined;
1777
+ items?: {
1778
+ total: number;
1779
+ id: string;
1780
+ orderId: string;
1781
+ productId: string;
1782
+ quantity: number;
1783
+ unitPrice: number;
1784
+ subtotal: number;
1785
+ taxAmount: number;
1786
+ }[] | undefined;
1787
+ }>;
1788
+ };
1789
+ };
1790
+ update: {
1791
+ readonly body: zod.ZodObject<{
1792
+ status: zod.ZodEnum<["pending", "confirmed", "processing", "shipped", "delivered", "cancelled"]>;
1793
+ }, "strip", zod.ZodTypeAny, {
1794
+ status: "pending" | "confirmed" | "processing" | "shipped" | "delivered" | "cancelled";
1795
+ }, {
1796
+ status: "pending" | "confirmed" | "processing" | "shipped" | "delivered" | "cancelled";
1797
+ }>;
1798
+ readonly summary: `Update ${string} by ID`;
1799
+ readonly method: "PUT";
1800
+ path: `/${string}/:id`;
1801
+ responses: {
1802
+ readonly 200: zod.ZodObject<{
1803
+ id: zod.ZodString;
1804
+ orderNumber: zod.ZodString;
1805
+ clientId: zod.ZodString;
1806
+ sellerId: zod.ZodOptional<zod.ZodString>;
1807
+ status: zod.ZodEnum<["pending", "confirmed", "processing", "shipped", "delivered", "cancelled"]>;
1808
+ subtotal: zod.ZodNumber;
1809
+ taxAmount: zod.ZodNumber;
1810
+ discountAmount: zod.ZodDefault<zod.ZodNumber>;
1811
+ total: zod.ZodNumber;
1812
+ notes: zod.ZodOptional<zod.ZodString>;
1813
+ createdAt: zod.ZodString;
1814
+ updatedAt: zod.ZodString;
1815
+ items: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
1816
+ id: zod.ZodString;
1817
+ orderId: zod.ZodString;
1818
+ productId: zod.ZodString;
1819
+ quantity: zod.ZodNumber;
1820
+ unitPrice: zod.ZodNumber;
1821
+ subtotal: zod.ZodNumber;
1822
+ taxAmount: zod.ZodNumber;
1823
+ total: zod.ZodNumber;
1824
+ }, "strip", zod.ZodTypeAny, {
1825
+ total: number;
1826
+ id: string;
1827
+ orderId: string;
1828
+ productId: string;
1829
+ quantity: number;
1830
+ unitPrice: number;
1831
+ subtotal: number;
1832
+ taxAmount: number;
1833
+ }, {
1834
+ total: number;
1835
+ id: string;
1836
+ orderId: string;
1837
+ productId: string;
1838
+ quantity: number;
1839
+ unitPrice: number;
1840
+ subtotal: number;
1841
+ taxAmount: number;
1842
+ }>, "many">>;
1843
+ }, "strip", zod.ZodTypeAny, {
1844
+ status: "pending" | "confirmed" | "processing" | "shipped" | "delivered" | "cancelled";
1845
+ total: number;
1846
+ id: string;
1847
+ createdAt: string;
1848
+ updatedAt: string;
1849
+ subtotal: number;
1850
+ taxAmount: number;
1851
+ orderNumber: string;
1852
+ clientId: string;
1853
+ discountAmount: number;
1854
+ sellerId?: string | undefined;
1855
+ notes?: string | undefined;
1856
+ items?: {
1857
+ total: number;
1858
+ id: string;
1859
+ orderId: string;
1860
+ productId: string;
1861
+ quantity: number;
1862
+ unitPrice: number;
1863
+ subtotal: number;
1864
+ taxAmount: number;
1865
+ }[] | undefined;
1866
+ }, {
1867
+ status: "pending" | "confirmed" | "processing" | "shipped" | "delivered" | "cancelled";
1868
+ total: number;
1869
+ id: string;
1870
+ createdAt: string;
1871
+ updatedAt: string;
1872
+ subtotal: number;
1873
+ taxAmount: number;
1874
+ orderNumber: string;
1875
+ clientId: string;
1876
+ sellerId?: string | undefined;
1877
+ discountAmount?: number | undefined;
1878
+ notes?: string | undefined;
1879
+ items?: {
1880
+ total: number;
1881
+ id: string;
1882
+ orderId: string;
1883
+ productId: string;
1884
+ quantity: number;
1885
+ unitPrice: number;
1886
+ subtotal: number;
1887
+ taxAmount: number;
1888
+ }[] | undefined;
1889
+ }>;
1890
+ readonly 404: zod.ZodObject<{
1891
+ message: zod.ZodString;
1892
+ }, "strip", zod.ZodTypeAny, {
1893
+ message: string;
1894
+ }, {
1895
+ message: string;
1896
+ }>;
1897
+ };
1898
+ };
1899
+ remove: {
1900
+ readonly body: typeof _ts_rest_core.ContractNoBody;
1901
+ readonly summary: `Delete ${string} by ID`;
1902
+ readonly method: "DELETE";
1903
+ path: `/${string}/:id`;
1904
+ responses: {
1905
+ readonly 204: typeof _ts_rest_core.ContractNoBody;
1906
+ readonly 404: zod.ZodObject<{
1907
+ message: zod.ZodString;
1908
+ }, "strip", zod.ZodTypeAny, {
1909
+ message: string;
1910
+ }, {
1911
+ message: string;
1912
+ }>;
1913
+ };
1914
+ };
1915
+ };
1916
+
1917
+ export { ApiErrorResponseSchema, ApiPaginatedResponseSchema, ApiSuccessResponseSchema, type ContractInstance, type CreateOrder, type CreateOrderItem, CreateOrderItemSchema, CreateOrderSchema, type CreateProduct, CreateProductSchema, type CreateUser, CreateUserSchema, type DataResponse, DataResponseSchema, type ErrorResponse, ErrorResponseSchema, HttpMethod, type ICrudService, NotFoundResponseSchema, type Order, type OrderItem, OrderItemSchema, OrderSchema, type OrderStatus, OrderStatusSchema, type Pagination, type PaginationQuery, PaginationQuerySchema, PaginationSchema, type Product, ProductSchema, type UpdateOrderStatus, UpdateOrderStatusSchema, type UpdateProduct, UpdateProductSchema, type UpdateUser, UpdateUserSchema, type User, UserSchema, type ValidationError, ValidationErrorSchema, c, createCrudEndpoints, createCrudHandlers, orderContract, productContract, userContract };