@dakkitor/api-contracts 1.1.103 → 1.1.104
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actives/actives.contract.d.ts +256 -256
- package/dist/agent-client-links/agent-client-links.contract.d.ts +58 -58
- package/dist/auth/auth.contract.d.ts +316 -6
- package/dist/auth/auth.contract.d.ts.map +1 -1
- package/dist/auth/auth.contract.js +39 -2
- package/dist/bookings/bookings.contract.d.ts +992 -992
- package/dist/call-history/call-history.contract.d.ts +46 -46
- package/dist/collaboration-checkings/collaboration-checkings.contract.d.ts +104 -104
- package/dist/collaborations/collaborations.contract.d.ts +97 -97
- package/dist/jobs/jobs.contract.d.ts +180 -180
- package/dist/lead-assignments/lead-assignments.contract.d.ts +48 -48
- package/dist/lead-distribution/agent-lead-distribution.contract.d.ts +24 -24
- package/dist/users/users.contract.d.ts +60 -54
- package/dist/users/users.contract.d.ts.map +1 -1
- package/dist/users/users.contract.js +5 -1
- package/dist/workers/workers.contract.d.ts +34 -34
- package/package.json +1 -1
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
export declare const ImpersonateSchema: z.ZodObject<{
|
|
3
|
+
targetUserId: z.ZodString;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
targetUserId: string;
|
|
6
|
+
}, {
|
|
7
|
+
targetUserId: string;
|
|
8
|
+
}>;
|
|
9
|
+
export type Impersonate = z.infer<typeof ImpersonateSchema>;
|
|
2
10
|
export declare const LoginSchema: z.ZodObject<{
|
|
3
11
|
email: z.ZodString;
|
|
4
12
|
password: z.ZodString;
|
|
@@ -86,21 +94,24 @@ export declare const authContract: {
|
|
|
86
94
|
firstName: z.ZodOptional<z.ZodString>;
|
|
87
95
|
lastName: z.ZodOptional<z.ZodString>;
|
|
88
96
|
phone: z.ZodOptional<z.ZodString>;
|
|
89
|
-
roles: z.ZodOptional<z.ZodArray<z.ZodEnum<["ADMIN", "SECOND_AGENT", "FIRST_AGENT", "COMPANY_CHECKING", "KPI", "
|
|
97
|
+
roles: z.ZodOptional<z.ZodArray<z.ZodEnum<["ADMIN", "SECOND_AGENT", "FIRST_AGENT", "COMPANY_CHECKING", "KPI", "TEAM_LEADS"]>, "many">>;
|
|
98
|
+
impersonatedBy: z.ZodOptional<z.ZodString>;
|
|
90
99
|
}, "strip", z.ZodTypeAny, {
|
|
91
100
|
email: string;
|
|
92
101
|
id: string;
|
|
93
102
|
lastName?: string | undefined;
|
|
94
103
|
firstName?: string | undefined;
|
|
95
104
|
phone?: string | undefined;
|
|
96
|
-
roles?: ("ADMIN" | "SECOND_AGENT" | "FIRST_AGENT" | "COMPANY_CHECKING" | "KPI" | "
|
|
105
|
+
roles?: ("ADMIN" | "SECOND_AGENT" | "FIRST_AGENT" | "COMPANY_CHECKING" | "KPI" | "TEAM_LEADS")[] | undefined;
|
|
106
|
+
impersonatedBy?: string | undefined;
|
|
97
107
|
}, {
|
|
98
108
|
email: string;
|
|
99
109
|
id: string;
|
|
100
110
|
lastName?: string | undefined;
|
|
101
111
|
firstName?: string | undefined;
|
|
102
112
|
phone?: string | undefined;
|
|
103
|
-
roles?: ("ADMIN" | "SECOND_AGENT" | "FIRST_AGENT" | "COMPANY_CHECKING" | "KPI" | "
|
|
113
|
+
roles?: ("ADMIN" | "SECOND_AGENT" | "FIRST_AGENT" | "COMPANY_CHECKING" | "KPI" | "TEAM_LEADS")[] | undefined;
|
|
114
|
+
impersonatedBy?: string | undefined;
|
|
104
115
|
}>;
|
|
105
116
|
401: z.ZodObject<{
|
|
106
117
|
statusCode: z.ZodNumber;
|
|
@@ -135,6 +146,7 @@ export declare const authContract: {
|
|
|
135
146
|
isPublic: boolean;
|
|
136
147
|
};
|
|
137
148
|
summary: "Refresh access token";
|
|
149
|
+
description: "Refreshes the access token and returns the current user profile. If impersonating, returns the impersonated user profile with impersonatedBy field.";
|
|
138
150
|
method: "GET";
|
|
139
151
|
path: "/v2/auth/refresh";
|
|
140
152
|
responses: {
|
|
@@ -189,11 +201,29 @@ export declare const authContract: {
|
|
|
189
201
|
correlationId?: string | undefined;
|
|
190
202
|
}>;
|
|
191
203
|
200: z.ZodObject<{
|
|
192
|
-
|
|
204
|
+
id: z.ZodString;
|
|
205
|
+
email: z.ZodString;
|
|
206
|
+
firstName: z.ZodOptional<z.ZodString>;
|
|
207
|
+
lastName: z.ZodOptional<z.ZodString>;
|
|
208
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
209
|
+
roles: z.ZodOptional<z.ZodArray<z.ZodEnum<["ADMIN", "SECOND_AGENT", "FIRST_AGENT", "COMPANY_CHECKING", "KPI", "TEAM_LEADS"]>, "many">>;
|
|
210
|
+
impersonatedBy: z.ZodOptional<z.ZodString>;
|
|
193
211
|
}, "strip", z.ZodTypeAny, {
|
|
194
|
-
|
|
212
|
+
email: string;
|
|
213
|
+
id: string;
|
|
214
|
+
lastName?: string | undefined;
|
|
215
|
+
firstName?: string | undefined;
|
|
216
|
+
phone?: string | undefined;
|
|
217
|
+
roles?: ("ADMIN" | "SECOND_AGENT" | "FIRST_AGENT" | "COMPANY_CHECKING" | "KPI" | "TEAM_LEADS")[] | undefined;
|
|
218
|
+
impersonatedBy?: string | undefined;
|
|
195
219
|
}, {
|
|
196
|
-
|
|
220
|
+
email: string;
|
|
221
|
+
id: string;
|
|
222
|
+
lastName?: string | undefined;
|
|
223
|
+
firstName?: string | undefined;
|
|
224
|
+
phone?: string | undefined;
|
|
225
|
+
roles?: ("ADMIN" | "SECOND_AGENT" | "FIRST_AGENT" | "COMPANY_CHECKING" | "KPI" | "TEAM_LEADS")[] | undefined;
|
|
226
|
+
impersonatedBy?: string | undefined;
|
|
197
227
|
}>;
|
|
198
228
|
401: z.ZodObject<{
|
|
199
229
|
statusCode: z.ZodNumber;
|
|
@@ -408,5 +438,285 @@ export declare const authContract: {
|
|
|
408
438
|
}>;
|
|
409
439
|
};
|
|
410
440
|
};
|
|
441
|
+
impersonate: {
|
|
442
|
+
metadata: {
|
|
443
|
+
tags: string[];
|
|
444
|
+
};
|
|
445
|
+
summary: "Impersonate another user (admin only)";
|
|
446
|
+
description: "Allows an admin to impersonate another user. Returns the target user profile with impersonatedBy field. Tokens are set via HTTP-only cookies.";
|
|
447
|
+
method: "POST";
|
|
448
|
+
body: z.ZodObject<{
|
|
449
|
+
targetUserId: z.ZodString;
|
|
450
|
+
}, "strip", z.ZodTypeAny, {
|
|
451
|
+
targetUserId: string;
|
|
452
|
+
}, {
|
|
453
|
+
targetUserId: string;
|
|
454
|
+
}>;
|
|
455
|
+
path: "/v2/auth/impersonate";
|
|
456
|
+
responses: {
|
|
457
|
+
500: z.ZodObject<{
|
|
458
|
+
statusCode: z.ZodNumber;
|
|
459
|
+
message: z.ZodString;
|
|
460
|
+
code: z.ZodString;
|
|
461
|
+
details: z.ZodOptional<z.ZodUnknown>;
|
|
462
|
+
timestamp: z.ZodString;
|
|
463
|
+
path: z.ZodString;
|
|
464
|
+
correlationId: z.ZodOptional<z.ZodString>;
|
|
465
|
+
}, "strip", z.ZodTypeAny, {
|
|
466
|
+
code: string;
|
|
467
|
+
path: string;
|
|
468
|
+
message: string;
|
|
469
|
+
statusCode: number;
|
|
470
|
+
timestamp: string;
|
|
471
|
+
details?: unknown;
|
|
472
|
+
correlationId?: string | undefined;
|
|
473
|
+
}, {
|
|
474
|
+
code: string;
|
|
475
|
+
path: string;
|
|
476
|
+
message: string;
|
|
477
|
+
statusCode: number;
|
|
478
|
+
timestamp: string;
|
|
479
|
+
details?: unknown;
|
|
480
|
+
correlationId?: string | undefined;
|
|
481
|
+
}>;
|
|
482
|
+
200: z.ZodObject<{
|
|
483
|
+
id: z.ZodString;
|
|
484
|
+
email: z.ZodString;
|
|
485
|
+
firstName: z.ZodOptional<z.ZodString>;
|
|
486
|
+
lastName: z.ZodOptional<z.ZodString>;
|
|
487
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
488
|
+
roles: z.ZodOptional<z.ZodArray<z.ZodEnum<["ADMIN", "SECOND_AGENT", "FIRST_AGENT", "COMPANY_CHECKING", "KPI", "TEAM_LEADS"]>, "many">>;
|
|
489
|
+
impersonatedBy: z.ZodOptional<z.ZodString>;
|
|
490
|
+
}, "strip", z.ZodTypeAny, {
|
|
491
|
+
email: string;
|
|
492
|
+
id: string;
|
|
493
|
+
lastName?: string | undefined;
|
|
494
|
+
firstName?: string | undefined;
|
|
495
|
+
phone?: string | undefined;
|
|
496
|
+
roles?: ("ADMIN" | "SECOND_AGENT" | "FIRST_AGENT" | "COMPANY_CHECKING" | "KPI" | "TEAM_LEADS")[] | undefined;
|
|
497
|
+
impersonatedBy?: string | undefined;
|
|
498
|
+
}, {
|
|
499
|
+
email: string;
|
|
500
|
+
id: string;
|
|
501
|
+
lastName?: string | undefined;
|
|
502
|
+
firstName?: string | undefined;
|
|
503
|
+
phone?: string | undefined;
|
|
504
|
+
roles?: ("ADMIN" | "SECOND_AGENT" | "FIRST_AGENT" | "COMPANY_CHECKING" | "KPI" | "TEAM_LEADS")[] | undefined;
|
|
505
|
+
impersonatedBy?: string | undefined;
|
|
506
|
+
}>;
|
|
507
|
+
400: z.ZodObject<{
|
|
508
|
+
statusCode: z.ZodNumber;
|
|
509
|
+
message: z.ZodString;
|
|
510
|
+
code: z.ZodString;
|
|
511
|
+
details: z.ZodOptional<z.ZodUnknown>;
|
|
512
|
+
timestamp: z.ZodString;
|
|
513
|
+
path: z.ZodString;
|
|
514
|
+
correlationId: z.ZodOptional<z.ZodString>;
|
|
515
|
+
}, "strip", z.ZodTypeAny, {
|
|
516
|
+
code: string;
|
|
517
|
+
path: string;
|
|
518
|
+
message: string;
|
|
519
|
+
statusCode: number;
|
|
520
|
+
timestamp: string;
|
|
521
|
+
details?: unknown;
|
|
522
|
+
correlationId?: string | undefined;
|
|
523
|
+
}, {
|
|
524
|
+
code: string;
|
|
525
|
+
path: string;
|
|
526
|
+
message: string;
|
|
527
|
+
statusCode: number;
|
|
528
|
+
timestamp: string;
|
|
529
|
+
details?: unknown;
|
|
530
|
+
correlationId?: string | undefined;
|
|
531
|
+
}>;
|
|
532
|
+
401: z.ZodObject<{
|
|
533
|
+
statusCode: z.ZodNumber;
|
|
534
|
+
message: z.ZodString;
|
|
535
|
+
code: z.ZodString;
|
|
536
|
+
details: z.ZodOptional<z.ZodUnknown>;
|
|
537
|
+
timestamp: z.ZodString;
|
|
538
|
+
path: z.ZodString;
|
|
539
|
+
correlationId: z.ZodOptional<z.ZodString>;
|
|
540
|
+
}, "strip", z.ZodTypeAny, {
|
|
541
|
+
code: string;
|
|
542
|
+
path: string;
|
|
543
|
+
message: string;
|
|
544
|
+
statusCode: number;
|
|
545
|
+
timestamp: string;
|
|
546
|
+
details?: unknown;
|
|
547
|
+
correlationId?: string | undefined;
|
|
548
|
+
}, {
|
|
549
|
+
code: string;
|
|
550
|
+
path: string;
|
|
551
|
+
message: string;
|
|
552
|
+
statusCode: number;
|
|
553
|
+
timestamp: string;
|
|
554
|
+
details?: unknown;
|
|
555
|
+
correlationId?: string | undefined;
|
|
556
|
+
}>;
|
|
557
|
+
403: z.ZodObject<{
|
|
558
|
+
statusCode: z.ZodNumber;
|
|
559
|
+
message: z.ZodString;
|
|
560
|
+
code: z.ZodString;
|
|
561
|
+
details: z.ZodOptional<z.ZodUnknown>;
|
|
562
|
+
timestamp: z.ZodString;
|
|
563
|
+
path: z.ZodString;
|
|
564
|
+
correlationId: z.ZodOptional<z.ZodString>;
|
|
565
|
+
}, "strip", z.ZodTypeAny, {
|
|
566
|
+
code: string;
|
|
567
|
+
path: string;
|
|
568
|
+
message: string;
|
|
569
|
+
statusCode: number;
|
|
570
|
+
timestamp: string;
|
|
571
|
+
details?: unknown;
|
|
572
|
+
correlationId?: string | undefined;
|
|
573
|
+
}, {
|
|
574
|
+
code: string;
|
|
575
|
+
path: string;
|
|
576
|
+
message: string;
|
|
577
|
+
statusCode: number;
|
|
578
|
+
timestamp: string;
|
|
579
|
+
details?: unknown;
|
|
580
|
+
correlationId?: string | undefined;
|
|
581
|
+
}>;
|
|
582
|
+
404: z.ZodObject<{
|
|
583
|
+
statusCode: z.ZodNumber;
|
|
584
|
+
message: z.ZodString;
|
|
585
|
+
code: z.ZodString;
|
|
586
|
+
details: z.ZodOptional<z.ZodUnknown>;
|
|
587
|
+
timestamp: z.ZodString;
|
|
588
|
+
path: z.ZodString;
|
|
589
|
+
correlationId: z.ZodOptional<z.ZodString>;
|
|
590
|
+
}, "strip", z.ZodTypeAny, {
|
|
591
|
+
code: string;
|
|
592
|
+
path: string;
|
|
593
|
+
message: string;
|
|
594
|
+
statusCode: number;
|
|
595
|
+
timestamp: string;
|
|
596
|
+
details?: unknown;
|
|
597
|
+
correlationId?: string | undefined;
|
|
598
|
+
}, {
|
|
599
|
+
code: string;
|
|
600
|
+
path: string;
|
|
601
|
+
message: string;
|
|
602
|
+
statusCode: number;
|
|
603
|
+
timestamp: string;
|
|
604
|
+
details?: unknown;
|
|
605
|
+
correlationId?: string | undefined;
|
|
606
|
+
}>;
|
|
607
|
+
};
|
|
608
|
+
};
|
|
609
|
+
stopImpersonation: {
|
|
610
|
+
metadata: {
|
|
611
|
+
tags: string[];
|
|
612
|
+
};
|
|
613
|
+
summary: "Stop impersonating and return to admin session";
|
|
614
|
+
description: "Stops the current impersonation session and returns the admin user profile. Tokens are set via HTTP-only cookies.";
|
|
615
|
+
method: "POST";
|
|
616
|
+
body: typeof import("@ts-rest/core").ContractNoBody;
|
|
617
|
+
path: "/v2/auth/stop-impersonation";
|
|
618
|
+
responses: {
|
|
619
|
+
400: z.ZodObject<{
|
|
620
|
+
statusCode: z.ZodNumber;
|
|
621
|
+
message: z.ZodString;
|
|
622
|
+
code: z.ZodString;
|
|
623
|
+
details: z.ZodOptional<z.ZodUnknown>;
|
|
624
|
+
timestamp: z.ZodString;
|
|
625
|
+
path: z.ZodString;
|
|
626
|
+
correlationId: z.ZodOptional<z.ZodString>;
|
|
627
|
+
}, "strip", z.ZodTypeAny, {
|
|
628
|
+
code: string;
|
|
629
|
+
path: string;
|
|
630
|
+
message: string;
|
|
631
|
+
statusCode: number;
|
|
632
|
+
timestamp: string;
|
|
633
|
+
details?: unknown;
|
|
634
|
+
correlationId?: string | undefined;
|
|
635
|
+
}, {
|
|
636
|
+
code: string;
|
|
637
|
+
path: string;
|
|
638
|
+
message: string;
|
|
639
|
+
statusCode: number;
|
|
640
|
+
timestamp: string;
|
|
641
|
+
details?: unknown;
|
|
642
|
+
correlationId?: string | undefined;
|
|
643
|
+
}>;
|
|
644
|
+
500: z.ZodObject<{
|
|
645
|
+
statusCode: z.ZodNumber;
|
|
646
|
+
message: z.ZodString;
|
|
647
|
+
code: z.ZodString;
|
|
648
|
+
details: z.ZodOptional<z.ZodUnknown>;
|
|
649
|
+
timestamp: z.ZodString;
|
|
650
|
+
path: z.ZodString;
|
|
651
|
+
correlationId: z.ZodOptional<z.ZodString>;
|
|
652
|
+
}, "strip", z.ZodTypeAny, {
|
|
653
|
+
code: string;
|
|
654
|
+
path: string;
|
|
655
|
+
message: string;
|
|
656
|
+
statusCode: number;
|
|
657
|
+
timestamp: string;
|
|
658
|
+
details?: unknown;
|
|
659
|
+
correlationId?: string | undefined;
|
|
660
|
+
}, {
|
|
661
|
+
code: string;
|
|
662
|
+
path: string;
|
|
663
|
+
message: string;
|
|
664
|
+
statusCode: number;
|
|
665
|
+
timestamp: string;
|
|
666
|
+
details?: unknown;
|
|
667
|
+
correlationId?: string | undefined;
|
|
668
|
+
}>;
|
|
669
|
+
200: z.ZodObject<{
|
|
670
|
+
id: z.ZodString;
|
|
671
|
+
email: z.ZodString;
|
|
672
|
+
firstName: z.ZodOptional<z.ZodString>;
|
|
673
|
+
lastName: z.ZodOptional<z.ZodString>;
|
|
674
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
675
|
+
roles: z.ZodOptional<z.ZodArray<z.ZodEnum<["ADMIN", "SECOND_AGENT", "FIRST_AGENT", "COMPANY_CHECKING", "KPI", "TEAM_LEADS"]>, "many">>;
|
|
676
|
+
impersonatedBy: z.ZodOptional<z.ZodString>;
|
|
677
|
+
}, "strip", z.ZodTypeAny, {
|
|
678
|
+
email: string;
|
|
679
|
+
id: string;
|
|
680
|
+
lastName?: string | undefined;
|
|
681
|
+
firstName?: string | undefined;
|
|
682
|
+
phone?: string | undefined;
|
|
683
|
+
roles?: ("ADMIN" | "SECOND_AGENT" | "FIRST_AGENT" | "COMPANY_CHECKING" | "KPI" | "TEAM_LEADS")[] | undefined;
|
|
684
|
+
impersonatedBy?: string | undefined;
|
|
685
|
+
}, {
|
|
686
|
+
email: string;
|
|
687
|
+
id: string;
|
|
688
|
+
lastName?: string | undefined;
|
|
689
|
+
firstName?: string | undefined;
|
|
690
|
+
phone?: string | undefined;
|
|
691
|
+
roles?: ("ADMIN" | "SECOND_AGENT" | "FIRST_AGENT" | "COMPANY_CHECKING" | "KPI" | "TEAM_LEADS")[] | undefined;
|
|
692
|
+
impersonatedBy?: string | undefined;
|
|
693
|
+
}>;
|
|
694
|
+
401: z.ZodObject<{
|
|
695
|
+
statusCode: z.ZodNumber;
|
|
696
|
+
message: z.ZodString;
|
|
697
|
+
code: z.ZodString;
|
|
698
|
+
details: z.ZodOptional<z.ZodUnknown>;
|
|
699
|
+
timestamp: z.ZodString;
|
|
700
|
+
path: z.ZodString;
|
|
701
|
+
correlationId: z.ZodOptional<z.ZodString>;
|
|
702
|
+
}, "strip", z.ZodTypeAny, {
|
|
703
|
+
code: string;
|
|
704
|
+
path: string;
|
|
705
|
+
message: string;
|
|
706
|
+
statusCode: number;
|
|
707
|
+
timestamp: string;
|
|
708
|
+
details?: unknown;
|
|
709
|
+
correlationId?: string | undefined;
|
|
710
|
+
}, {
|
|
711
|
+
code: string;
|
|
712
|
+
path: string;
|
|
713
|
+
message: string;
|
|
714
|
+
statusCode: number;
|
|
715
|
+
timestamp: string;
|
|
716
|
+
details?: unknown;
|
|
717
|
+
correlationId?: string | undefined;
|
|
718
|
+
}>;
|
|
719
|
+
};
|
|
720
|
+
};
|
|
411
721
|
};
|
|
412
722
|
//# sourceMappingURL=auth.contract.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.contract.d.ts","sourceRoot":"","sources":["../../contracts/auth/auth.contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"auth.contract.d.ts","sourceRoot":"","sources":["../../contracts/auth/auth.contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,iBAAiB;;;;;;EAIM,CAAC;AAErC,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAI5D,eAAO,MAAM,WAAW;;;;;;;;;EAKM,CAAC;AAE/B,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEhD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkGxB,CAAC"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.authContract = exports.LoginSchema = void 0;
|
|
3
|
+
exports.authContract = exports.LoginSchema = exports.ImpersonateSchema = void 0;
|
|
4
4
|
const core_1 = require("@ts-rest/core");
|
|
5
5
|
const zod_1 = require("zod");
|
|
6
6
|
const common_schemas_1 = require("../common/common-schemas");
|
|
7
7
|
const error_schemas_1 = require("../common/error-schemas");
|
|
8
8
|
const users_contract_1 = require("../users/users.contract");
|
|
9
|
+
exports.ImpersonateSchema = zod_1.z
|
|
10
|
+
.object({
|
|
11
|
+
targetUserId: zod_1.z.string().uuid().describe('ID of the user to impersonate'),
|
|
12
|
+
})
|
|
13
|
+
.openapi({ title: 'Impersonate' });
|
|
9
14
|
const c = (0, core_1.initContract)();
|
|
10
15
|
exports.LoginSchema = zod_1.z
|
|
11
16
|
.object({
|
|
@@ -32,10 +37,11 @@ exports.authContract = c.router({
|
|
|
32
37
|
method: 'GET',
|
|
33
38
|
path: '/auth/refresh',
|
|
34
39
|
responses: {
|
|
35
|
-
200:
|
|
40
|
+
200: users_contract_1.ProfileSchema,
|
|
36
41
|
401: error_schemas_1.ErrorResponseSchema,
|
|
37
42
|
},
|
|
38
43
|
summary: 'Refresh access token',
|
|
44
|
+
description: 'Refreshes the access token and returns the current user profile. If impersonating, returns the impersonated user profile with impersonatedBy field.',
|
|
39
45
|
metadata: {
|
|
40
46
|
tags: ['Authentication'],
|
|
41
47
|
isPublic: true,
|
|
@@ -67,6 +73,37 @@ exports.authContract = c.router({
|
|
|
67
73
|
tags: ['Authentication'],
|
|
68
74
|
},
|
|
69
75
|
},
|
|
76
|
+
impersonate: {
|
|
77
|
+
method: 'POST',
|
|
78
|
+
path: '/auth/impersonate',
|
|
79
|
+
body: exports.ImpersonateSchema,
|
|
80
|
+
responses: {
|
|
81
|
+
200: users_contract_1.ProfileSchema,
|
|
82
|
+
400: error_schemas_1.ErrorResponseSchema,
|
|
83
|
+
401: error_schemas_1.ErrorResponseSchema,
|
|
84
|
+
403: error_schemas_1.ErrorResponseSchema,
|
|
85
|
+
404: error_schemas_1.ErrorResponseSchema,
|
|
86
|
+
},
|
|
87
|
+
summary: 'Impersonate another user (admin only)',
|
|
88
|
+
description: 'Allows an admin to impersonate another user. Returns the target user profile with impersonatedBy field. Tokens are set via HTTP-only cookies.',
|
|
89
|
+
metadata: {
|
|
90
|
+
tags: ['Authentication'],
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
stopImpersonation: {
|
|
94
|
+
method: 'POST',
|
|
95
|
+
path: '/auth/stop-impersonation',
|
|
96
|
+
body: c.noBody(),
|
|
97
|
+
responses: {
|
|
98
|
+
200: users_contract_1.ProfileSchema,
|
|
99
|
+
401: error_schemas_1.ErrorResponseSchema,
|
|
100
|
+
},
|
|
101
|
+
summary: 'Stop impersonating and return to admin session',
|
|
102
|
+
description: 'Stops the current impersonation session and returns the admin user profile. Tokens are set via HTTP-only cookies.',
|
|
103
|
+
metadata: {
|
|
104
|
+
tags: ['Authentication'],
|
|
105
|
+
},
|
|
106
|
+
},
|
|
70
107
|
}, {
|
|
71
108
|
pathPrefix: '/v2',
|
|
72
109
|
commonResponses: {
|