@integraciones_doc24/sdk 1.16.38 → 1.16.39

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.
@@ -9,16 +9,20 @@ const utils_1 = require("../utils");
9
9
  const diagnostica_1 = require("./diagnostica");
10
10
  const user_1 = require("./user");
11
11
  const external_1 = require("./external");
12
+ const integrationError_1 = require("./integrationError");
12
13
  const getBaseSdk = async (url, credentials) => {
13
14
  const makeRequest = await request_1.getRequestFactory(url, credentials);
14
15
  const diagnosticaMethods = diagnostica_1.getDiagnosticaMethods(makeRequest);
15
16
  const externalMethods = external_1.getExternalMethods(makeRequest);
16
17
  const userMethods = user_1.getUserMethods(makeRequest, url, credentials);
18
+ const integrationErrorMethods = integrationError_1.getIntegrationErrorMethods(makeRequest);
17
19
  const baseSdk = {
18
20
  ...diagnosticaMethods,
19
21
  ...externalMethods,
22
+ ...integrationErrorMethods,
20
23
  ...userMethods,
21
24
  getProfessional: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.professional, async (professionalId) => {
25
+ var _a;
22
26
  const path = `/professional/${professionalId}`;
23
27
  const response = await makeRequest('GET', path);
24
28
  const raw = response.data;
@@ -27,7 +31,7 @@ const getBaseSdk = async (url, credentials) => {
27
31
  firstName: raw.name,
28
32
  lastName: raw.lastname,
29
33
  birthdate: utils_1.parseDate(raw.birthdate),
30
- gender: raw.gender.toLowerCase(),
34
+ gender: (_a = raw.gender) === null || _a === void 0 ? void 0 : _a.toLowerCase(),
31
35
  email: raw.email,
32
36
  phone: raw.phone,
33
37
  logoUrl: raw.image,
@@ -0,0 +1,16 @@
1
+ import { RequestMaker } from '../request';
2
+ export declare const getIntegrationErrorMethods: (makeRequest: RequestMaker) => {
3
+ reportIntegrationError: (params: {
4
+ details?: Record<string, unknown> | undefined;
5
+ operation?: string | undefined;
6
+ severity?: "INFO" | "WARNING" | "ERROR" | "CRITICAL" | undefined;
7
+ errorCode?: string | undefined;
8
+ httpStatus?: number | undefined;
9
+ externalId?: string | undefined;
10
+ params: Record<string, unknown>;
11
+ integration: string;
12
+ occurredAt: Date;
13
+ }) => Promise<{
14
+ errorId: number;
15
+ }>;
16
+ };
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getIntegrationErrorMethods = void 0;
4
+ const zod_1 = require("zod");
5
+ const validation_1 = require("../request/validation");
6
+ const schemas_1 = require("../schemas");
7
+ const getIntegrationErrorMethods = (makeRequest) => {
8
+ // The brand is resolved by doc24 from the token's iss, so it is not sent.
9
+ // doc24 answers 201 for a new error and 200 with the same error_id when
10
+ // externalId was already reported, so retries are safe.
11
+ const reportIntegrationError = async (params) => {
12
+ var _a, _b;
13
+ const path = '/integration-error';
14
+ const response = await makeRequest('POST', path, {
15
+ integration: params.integration,
16
+ operation: params.operation,
17
+ severity: params.severity,
18
+ error_code: params.errorCode,
19
+ http_status: params.httpStatus,
20
+ params: params.params,
21
+ occurred_at: params.occurredAt.toISOString().replace(/\.\d{3}Z$/, 'Z'),
22
+ external_id: params.externalId,
23
+ details: params.details,
24
+ });
25
+ // Spec defines a flat {error_id}; accept the usual `data` wrapper too.
26
+ const errorId = (_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.error_id) !== null && _b !== void 0 ? _b : response.error_id;
27
+ return { errorId: Number(errorId) };
28
+ };
29
+ return {
30
+ reportIntegrationError: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.reportIntegrationErrorParams]), schemas_1.doc24Schemas.reportIntegrationErrorResponse, reportIntegrationError),
31
+ };
32
+ };
33
+ exports.getIntegrationErrorMethods = getIntegrationErrorMethods;
@@ -13,6 +13,7 @@ export declare const getUserMethods: (makeRequest: RequestMaker, url: string, cr
13
13
  affiliationStatus?: string | null | undefined;
14
14
  localidad?: string | null | undefined;
15
15
  codPostal?: string | null | undefined;
16
+ provincia?: string | null | undefined;
16
17
  phone?: string | undefined;
17
18
  firstName: string;
18
19
  lastName: string;
@@ -45,6 +46,7 @@ export declare const getUserMethods: (makeRequest: RequestMaker, url: string, cr
45
46
  affiliationStatus?: string | null | undefined;
46
47
  localidad?: string | null | undefined;
47
48
  codPostal?: string | null | undefined;
49
+ provincia?: string | null | undefined;
48
50
  phone?: string | undefined;
49
51
  firstName: string;
50
52
  lastName: string;
@@ -68,6 +70,7 @@ export declare const getUserMethods: (makeRequest: RequestMaker, url: string, cr
68
70
  affiliationStatus?: string | null | undefined;
69
71
  localidad?: string | null | undefined;
70
72
  codPostal?: string | null | undefined;
73
+ provincia?: string | null | undefined;
71
74
  phone?: string | undefined;
72
75
  firstName: string;
73
76
  lastName: string;
package/lib/index.d.ts CHANGED
@@ -17,6 +17,7 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
17
17
  affiliationStatus?: string | null | undefined;
18
18
  localidad?: string | null | undefined;
19
19
  codPostal?: string | null | undefined;
20
+ provincia?: string | null | undefined;
20
21
  phone?: string | undefined;
21
22
  firstName: string;
22
23
  lastName: string;
@@ -49,6 +50,7 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
49
50
  affiliationStatus?: string | null | undefined;
50
51
  localidad?: string | null | undefined;
51
52
  codPostal?: string | null | undefined;
53
+ provincia?: string | null | undefined;
52
54
  phone?: string | undefined;
53
55
  firstName: string;
54
56
  lastName: string;
@@ -67,6 +69,7 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
67
69
  affiliationStatus?: string | null | undefined;
68
70
  localidad?: string | null | undefined;
69
71
  codPostal?: string | null | undefined;
72
+ provincia?: string | null | undefined;
70
73
  phone?: string | undefined;
71
74
  firstName: string;
72
75
  lastName: string;
@@ -396,5 +399,18 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
396
399
  emailCode?: undefined;
397
400
  phoneCode: string;
398
401
  })) => Promise<any>;
402
+ reportIntegrationError: (params: {
403
+ details?: Record<string, unknown> | undefined;
404
+ operation?: string | undefined;
405
+ severity?: "INFO" | "WARNING" | "ERROR" | "CRITICAL" | undefined;
406
+ errorCode?: string | undefined;
407
+ httpStatus?: number | undefined;
408
+ externalId?: string | undefined;
409
+ params: Record<string, unknown>;
410
+ integration: string;
411
+ occurredAt: Date;
412
+ }) => Promise<{
413
+ errorId: number;
414
+ }>;
399
415
  }>;
400
416
  export type { Doc24 } from './types';
package/lib/schemas.d.ts CHANGED
@@ -9,6 +9,44 @@ export declare const doc24Schemas: {
9
9
  iss: string;
10
10
  key: string;
11
11
  }>;
12
+ reportIntegrationErrorParams: import("zod").ZodObject<{
13
+ integration: import("zod").ZodString;
14
+ operation: import("zod").ZodOptional<import("zod").ZodString>;
15
+ severity: import("zod").ZodOptional<import("zod").ZodEnum<["INFO", "WARNING", "ERROR", "CRITICAL"]>>;
16
+ errorCode: import("zod").ZodOptional<import("zod").ZodString>;
17
+ httpStatus: import("zod").ZodOptional<import("zod").ZodNumber>;
18
+ params: import("zod").ZodRecord<import("zod").ZodUnknown>;
19
+ occurredAt: import("zod").ZodDate;
20
+ externalId: import("zod").ZodOptional<import("zod").ZodString>;
21
+ details: import("zod").ZodOptional<import("zod").ZodEffects<import("zod").ZodRecord<import("zod").ZodUnknown>, Record<string, unknown>>>;
22
+ }, "strip", import("zod").ZodTypeAny, {
23
+ details?: Record<string, unknown> | undefined;
24
+ operation?: string | undefined;
25
+ severity?: "INFO" | "WARNING" | "ERROR" | "CRITICAL" | undefined;
26
+ errorCode?: string | undefined;
27
+ httpStatus?: number | undefined;
28
+ externalId?: string | undefined;
29
+ params: Record<string, unknown>;
30
+ integration: string;
31
+ occurredAt: Date;
32
+ }, {
33
+ details?: Record<string, unknown> | undefined;
34
+ operation?: string | undefined;
35
+ severity?: "INFO" | "WARNING" | "ERROR" | "CRITICAL" | undefined;
36
+ errorCode?: string | undefined;
37
+ httpStatus?: number | undefined;
38
+ externalId?: string | undefined;
39
+ params: Record<string, unknown>;
40
+ integration: string;
41
+ occurredAt: Date;
42
+ }>;
43
+ reportIntegrationErrorResponse: import("zod").ZodObject<{
44
+ errorId: import("zod").ZodNumber;
45
+ }, "strip", import("zod").ZodTypeAny, {
46
+ errorId: number;
47
+ }, {
48
+ errorId: number;
49
+ }>;
12
50
  sdkParams: import("zod").ZodObject<{
13
51
  url: import("zod").ZodString;
14
52
  credentials: import("zod").ZodObject<{
@@ -49,6 +87,7 @@ export declare const doc24Schemas: {
49
87
  affiliationStatus: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
50
88
  localidad: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
51
89
  codPostal: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
90
+ provincia: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
52
91
  }, {
53
92
  phone: import("zod").ZodOptional<import("zod").ZodString>;
54
93
  email: import("zod").ZodString;
@@ -63,6 +102,7 @@ export declare const doc24Schemas: {
63
102
  affiliationStatus?: string | null | undefined;
64
103
  localidad?: string | null | undefined;
65
104
  codPostal?: string | null | undefined;
105
+ provincia?: string | null | undefined;
66
106
  phone?: string | undefined;
67
107
  firstName: string;
68
108
  lastName: string;
@@ -80,6 +120,7 @@ export declare const doc24Schemas: {
80
120
  affiliationStatus?: string | null | undefined;
81
121
  localidad?: string | null | undefined;
82
122
  codPostal?: string | null | undefined;
123
+ provincia?: string | null | undefined;
83
124
  phone?: string | undefined;
84
125
  firstName: string;
85
126
  lastName: string;
@@ -102,6 +143,7 @@ export declare const doc24Schemas: {
102
143
  affiliationStatus: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
103
144
  localidad: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
104
145
  codPostal: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
146
+ provincia: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
105
147
  }, "strip", import("zod").ZodTypeAny, {
106
148
  identificationType?: number | undefined;
107
149
  identificationValue?: string | undefined;
@@ -113,6 +155,7 @@ export declare const doc24Schemas: {
113
155
  affiliationStatus?: string | null | undefined;
114
156
  localidad?: string | null | undefined;
115
157
  codPostal?: string | null | undefined;
158
+ provincia?: string | null | undefined;
116
159
  firstName: string;
117
160
  lastName: string;
118
161
  countryId: string;
@@ -128,6 +171,7 @@ export declare const doc24Schemas: {
128
171
  affiliationStatus?: string | null | undefined;
129
172
  localidad?: string | null | undefined;
130
173
  codPostal?: string | null | undefined;
174
+ provincia?: string | null | undefined;
131
175
  firstName: string;
132
176
  lastName: string;
133
177
  countryId: string;
@@ -216,15 +260,17 @@ export declare const doc24Schemas: {
216
260
  province: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
217
261
  city: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
218
262
  address: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
263
+ addressPhone: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
219
264
  }, "strip", import("zod").ZodTypeAny, {
220
265
  length?: number | null | undefined;
266
+ address?: string | null | undefined;
267
+ city?: string | null | undefined;
268
+ province?: string | null | undefined;
221
269
  ranking?: unknown;
222
270
  consultation_value?: string | null | undefined;
223
271
  inPerson?: boolean | null | undefined;
224
272
  virtual?: boolean | null | undefined;
225
- province?: string | null | undefined;
226
- city?: string | null | undefined;
227
- address?: string | null | undefined;
273
+ addressPhone?: string | null | undefined;
228
274
  date: Date;
229
275
  type: "appointment" | "chat" | "instant";
230
276
  id: string | number;
@@ -245,13 +291,14 @@ export declare const doc24Schemas: {
245
291
  atentions: number;
246
292
  }, {
247
293
  length?: number | null | undefined;
294
+ address?: string | null | undefined;
295
+ city?: string | null | undefined;
296
+ province?: string | null | undefined;
248
297
  ranking?: unknown;
249
298
  consultation_value?: string | null | undefined;
250
299
  inPerson?: boolean | null | undefined;
251
300
  virtual?: boolean | null | undefined;
252
- province?: string | null | undefined;
253
- city?: string | null | undefined;
254
- address?: string | null | undefined;
301
+ addressPhone?: string | null | undefined;
255
302
  date: Date;
256
303
  type: "appointment" | "chat" | "instant";
257
304
  id: string | number;
@@ -515,6 +562,25 @@ export declare const doc24Schemas: {
515
562
  language: string;
516
563
  details: string;
517
564
  }>]>;
565
+ attachedFile: import("zod").ZodObject<{
566
+ fileId: import("zod").ZodNumber;
567
+ fileName: import("zod").ZodNullable<import("zod").ZodString>;
568
+ fileUrl: import("zod").ZodString;
569
+ fileType: import("zod").ZodEnum<["IMG", "FILE"]>;
570
+ uploadDate: import("zod").ZodDate;
571
+ }, "strip", import("zod").ZodTypeAny, {
572
+ fileId: number;
573
+ fileName: string | null;
574
+ fileUrl: string;
575
+ fileType: "IMG" | "FILE";
576
+ uploadDate: Date;
577
+ }, {
578
+ fileId: number;
579
+ fileName: string | null;
580
+ fileUrl: string;
581
+ fileType: "IMG" | "FILE";
582
+ uploadDate: Date;
583
+ }>;
518
584
  videoVisit: import("zod").ZodObject<{
519
585
  id: import("zod").ZodNullable<import("zod").ZodNumber>;
520
586
  creationDate: import("zod").ZodDate;
@@ -556,11 +622,35 @@ export declare const doc24Schemas: {
556
622
  paymentStatus: import("zod").ZodOptional<import("zod").ZodString>;
557
623
  atentionId: import("zod").ZodOptional<import("zod").ZodNumber>;
558
624
  waitingTime: import("zod").ZodOptional<import("zod").ZodString>;
625
+ address: import("zod").ZodOptional<import("zod").ZodString>;
626
+ city: import("zod").ZodOptional<import("zod").ZodString>;
627
+ province: import("zod").ZodOptional<import("zod").ZodString>;
628
+ modality: import("zod").ZodOptional<import("zod").ZodEnum<["P", "V"]>>;
629
+ attachedFiles: import("zod").ZodArray<import("zod").ZodObject<{
630
+ fileId: import("zod").ZodNumber;
631
+ fileName: import("zod").ZodNullable<import("zod").ZodString>;
632
+ fileUrl: import("zod").ZodString;
633
+ fileType: import("zod").ZodEnum<["IMG", "FILE"]>;
634
+ uploadDate: import("zod").ZodDate;
635
+ }, "strip", import("zod").ZodTypeAny, {
636
+ fileId: number;
637
+ fileName: string | null;
638
+ fileUrl: string;
639
+ fileType: "IMG" | "FILE";
640
+ uploadDate: Date;
641
+ }, {
642
+ fileId: number;
643
+ fileName: string | null;
644
+ fileUrl: string;
645
+ fileType: "IMG" | "FILE";
646
+ uploadDate: Date;
647
+ }>, "many">;
559
648
  }, "strip", import("zod").ZodTypeAny, {
560
649
  appointment?: {
561
650
  date: Date;
562
651
  id: number;
563
652
  } | undefined;
653
+ modality?: "P" | "V" | undefined;
564
654
  videoVisit?: {
565
655
  id: number;
566
656
  status: string;
@@ -568,6 +658,9 @@ export declare const doc24Schemas: {
568
658
  paymentStatus?: string | undefined;
569
659
  atentionId?: number | undefined;
570
660
  waitingTime?: string | undefined;
661
+ address?: string | undefined;
662
+ city?: string | undefined;
663
+ province?: string | undefined;
571
664
  id: number | null;
572
665
  patientId: number;
573
666
  creationDate: Date;
@@ -577,11 +670,19 @@ export declare const doc24Schemas: {
577
670
  id: number;
578
671
  };
579
672
  vcToken: string;
673
+ attachedFiles: {
674
+ fileId: number;
675
+ fileName: string | null;
676
+ fileUrl: string;
677
+ fileType: "IMG" | "FILE";
678
+ uploadDate: Date;
679
+ }[];
580
680
  }, {
581
681
  appointment?: {
582
682
  date: Date;
583
683
  id: number;
584
684
  } | undefined;
685
+ modality?: "P" | "V" | undefined;
585
686
  videoVisit?: {
586
687
  id: number;
587
688
  status: string;
@@ -589,6 +690,9 @@ export declare const doc24Schemas: {
589
690
  paymentStatus?: string | undefined;
590
691
  atentionId?: number | undefined;
591
692
  waitingTime?: string | undefined;
693
+ address?: string | undefined;
694
+ city?: string | undefined;
695
+ province?: string | undefined;
592
696
  id: number | null;
593
697
  patientId: number;
594
698
  creationDate: Date;
@@ -598,6 +702,13 @@ export declare const doc24Schemas: {
598
702
  id: number;
599
703
  };
600
704
  vcToken: string;
705
+ attachedFiles: {
706
+ fileId: number;
707
+ fileName: string | null;
708
+ fileUrl: string;
709
+ fileType: "IMG" | "FILE";
710
+ uploadDate: Date;
711
+ }[];
601
712
  }>;
602
713
  historicalVideoVisit: import("zod").ZodObject<import("zod").extendShape<{
603
714
  id: import("zod").ZodNullable<import("zod").ZodNumber>;
@@ -640,14 +751,40 @@ export declare const doc24Schemas: {
640
751
  paymentStatus: import("zod").ZodOptional<import("zod").ZodString>;
641
752
  atentionId: import("zod").ZodOptional<import("zod").ZodNumber>;
642
753
  waitingTime: import("zod").ZodOptional<import("zod").ZodString>;
754
+ address: import("zod").ZodOptional<import("zod").ZodString>;
755
+ city: import("zod").ZodOptional<import("zod").ZodString>;
756
+ province: import("zod").ZodOptional<import("zod").ZodString>;
757
+ modality: import("zod").ZodOptional<import("zod").ZodEnum<["P", "V"]>>;
758
+ attachedFiles: import("zod").ZodArray<import("zod").ZodObject<{
759
+ fileId: import("zod").ZodNumber;
760
+ fileName: import("zod").ZodNullable<import("zod").ZodString>;
761
+ fileUrl: import("zod").ZodString;
762
+ fileType: import("zod").ZodEnum<["IMG", "FILE"]>;
763
+ uploadDate: import("zod").ZodDate;
764
+ }, "strip", import("zod").ZodTypeAny, {
765
+ fileId: number;
766
+ fileName: string | null;
767
+ fileUrl: string;
768
+ fileType: "IMG" | "FILE";
769
+ uploadDate: Date;
770
+ }, {
771
+ fileId: number;
772
+ fileName: string | null;
773
+ fileUrl: string;
774
+ fileType: "IMG" | "FILE";
775
+ uploadDate: Date;
776
+ }>, "many">;
643
777
  }, {
644
778
  specialty: import("zod").ZodString;
645
779
  professional: import("zod").ZodString;
780
+ medications: import("zod").ZodOptional<import("zod").ZodBoolean>;
781
+ practices: import("zod").ZodOptional<import("zod").ZodBoolean>;
646
782
  }>, "strip", import("zod").ZodTypeAny, {
647
783
  appointment?: {
648
784
  date: Date;
649
785
  id: number;
650
786
  } | undefined;
787
+ modality?: "P" | "V" | undefined;
651
788
  videoVisit?: {
652
789
  id: number;
653
790
  status: string;
@@ -655,6 +792,11 @@ export declare const doc24Schemas: {
655
792
  paymentStatus?: string | undefined;
656
793
  atentionId?: number | undefined;
657
794
  waitingTime?: string | undefined;
795
+ address?: string | undefined;
796
+ city?: string | undefined;
797
+ province?: string | undefined;
798
+ medications?: boolean | undefined;
799
+ practices?: boolean | undefined;
658
800
  id: number | null;
659
801
  patientId: number;
660
802
  professional: string;
@@ -665,12 +807,20 @@ export declare const doc24Schemas: {
665
807
  id: number;
666
808
  };
667
809
  vcToken: string;
810
+ attachedFiles: {
811
+ fileId: number;
812
+ fileName: string | null;
813
+ fileUrl: string;
814
+ fileType: "IMG" | "FILE";
815
+ uploadDate: Date;
816
+ }[];
668
817
  specialty: string;
669
818
  }, {
670
819
  appointment?: {
671
820
  date: Date;
672
821
  id: number;
673
822
  } | undefined;
823
+ modality?: "P" | "V" | undefined;
674
824
  videoVisit?: {
675
825
  id: number;
676
826
  status: string;
@@ -678,6 +828,11 @@ export declare const doc24Schemas: {
678
828
  paymentStatus?: string | undefined;
679
829
  atentionId?: number | undefined;
680
830
  waitingTime?: string | undefined;
831
+ address?: string | undefined;
832
+ city?: string | undefined;
833
+ province?: string | undefined;
834
+ medications?: boolean | undefined;
835
+ practices?: boolean | undefined;
681
836
  id: number | null;
682
837
  patientId: number;
683
838
  professional: string;
@@ -688,10 +843,18 @@ export declare const doc24Schemas: {
688
843
  id: number;
689
844
  };
690
845
  vcToken: string;
846
+ attachedFiles: {
847
+ fileId: number;
848
+ fileName: string | null;
849
+ fileUrl: string;
850
+ fileType: "IMG" | "FILE";
851
+ uploadDate: Date;
852
+ }[];
691
853
  specialty: string;
692
854
  }>;
693
855
  videoVisitDetails: import("zod").ZodObject<{
694
856
  id: import("zod").ZodNumber;
857
+ vcToken: import("zod").ZodOptional<import("zod").ZodString>;
695
858
  status: import("zod").ZodString;
696
859
  paymentStatus: import("zod").ZodString;
697
860
  professional: import("zod").ZodOptional<import("zod").ZodObject<{
@@ -796,11 +959,31 @@ export declare const doc24Schemas: {
796
959
  name: string;
797
960
  url: string;
798
961
  }>, "many">;
962
+ attachedFiles: import("zod").ZodArray<import("zod").ZodObject<{
963
+ fileId: import("zod").ZodNumber;
964
+ fileName: import("zod").ZodNullable<import("zod").ZodString>;
965
+ fileUrl: import("zod").ZodString;
966
+ fileType: import("zod").ZodEnum<["IMG", "FILE"]>;
967
+ uploadDate: import("zod").ZodDate;
968
+ }, "strip", import("zod").ZodTypeAny, {
969
+ fileId: number;
970
+ fileName: string | null;
971
+ fileUrl: string;
972
+ fileType: "IMG" | "FILE";
973
+ uploadDate: Date;
974
+ }, {
975
+ fileId: number;
976
+ fileName: string | null;
977
+ fileUrl: string;
978
+ fileType: "IMG" | "FILE";
979
+ uploadDate: Date;
980
+ }>, "many">;
799
981
  }, "strip", import("zod").ZodTypeAny, {
800
982
  professional?: {
801
983
  id: number;
802
984
  fullName: string;
803
985
  } | undefined;
986
+ vcToken?: string | undefined;
804
987
  appointment: {
805
988
  date: Date;
806
989
  id: number;
@@ -814,6 +997,13 @@ export declare const doc24Schemas: {
814
997
  };
815
998
  status: string;
816
999
  paymentStatus: string;
1000
+ attachedFiles: {
1001
+ fileId: number;
1002
+ fileName: string | null;
1003
+ fileUrl: string;
1004
+ fileType: "IMG" | "FILE";
1005
+ uploadDate: Date;
1006
+ }[];
817
1007
  finishDate: Date | null;
818
1008
  retries: number;
819
1009
  report: {
@@ -843,6 +1033,7 @@ export declare const doc24Schemas: {
843
1033
  id: number;
844
1034
  fullName: string;
845
1035
  } | undefined;
1036
+ vcToken?: string | undefined;
846
1037
  appointment: {
847
1038
  date: Date;
848
1039
  id: number;
@@ -856,6 +1047,13 @@ export declare const doc24Schemas: {
856
1047
  };
857
1048
  status: string;
858
1049
  paymentStatus: string;
1050
+ attachedFiles: {
1051
+ fileId: number;
1052
+ fileName: string | null;
1053
+ fileUrl: string;
1054
+ fileType: "IMG" | "FILE";
1055
+ uploadDate: Date;
1056
+ }[];
859
1057
  finishDate: Date | null;
860
1058
  retries: number;
861
1059
  report: {
@@ -885,17 +1083,24 @@ export declare const doc24Schemas: {
885
1083
  id: import("zod").ZodNumber;
886
1084
  status: import("zod").ZodString;
887
1085
  paymentStatus: import("zod").ZodString;
1086
+ modality: import("zod").ZodOptional<import("zod").ZodEnum<["P", "V"]>>;
1087
+ address: import("zod").ZodOptional<import("zod").ZodString>;
1088
+ city: import("zod").ZodOptional<import("zod").ZodString>;
1089
+ province: import("zod").ZodOptional<import("zod").ZodString>;
888
1090
  professional: import("zod").ZodOptional<import("zod").ZodObject<{
889
1091
  id: import("zod").ZodNumber;
890
1092
  fullName: import("zod").ZodString;
891
1093
  specialtyId: import("zod").ZodNumber;
892
1094
  specialty: import("zod").ZodString;
1095
+ idPrestadorInterno: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
893
1096
  }, "strip", import("zod").ZodTypeAny, {
1097
+ idPrestadorInterno?: string | null | undefined;
894
1098
  id: number;
895
1099
  fullName: string;
896
1100
  specialtyId: number;
897
1101
  specialty: string;
898
1102
  }, {
1103
+ idPrestadorInterno?: string | null | undefined;
899
1104
  id: number;
900
1105
  fullName: string;
901
1106
  specialtyId: number;
@@ -1050,18 +1255,49 @@ export declare const doc24Schemas: {
1050
1255
  name: string;
1051
1256
  url: string;
1052
1257
  }>, "many">;
1258
+ attachedFiles: import("zod").ZodArray<import("zod").ZodObject<{
1259
+ fileId: import("zod").ZodNumber;
1260
+ fileName: import("zod").ZodNullable<import("zod").ZodString>;
1261
+ fileUrl: import("zod").ZodString;
1262
+ fileType: import("zod").ZodEnum<["IMG", "FILE"]>;
1263
+ uploadDate: import("zod").ZodDate;
1264
+ }, "strip", import("zod").ZodTypeAny, {
1265
+ fileId: number;
1266
+ fileName: string | null;
1267
+ fileUrl: string;
1268
+ fileType: "IMG" | "FILE";
1269
+ uploadDate: Date;
1270
+ }, {
1271
+ fileId: number;
1272
+ fileName: string | null;
1273
+ fileUrl: string;
1274
+ fileType: "IMG" | "FILE";
1275
+ uploadDate: Date;
1276
+ }>, "many">;
1053
1277
  }, "strip", import("zod").ZodTypeAny, {
1278
+ modality?: "P" | "V" | undefined;
1054
1279
  professional?: {
1280
+ idPrestadorInterno?: string | null | undefined;
1055
1281
  id: number;
1056
1282
  fullName: string;
1057
1283
  specialtyId: number;
1058
1284
  specialty: string;
1059
1285
  } | undefined;
1286
+ address?: string | undefined;
1287
+ city?: string | undefined;
1288
+ province?: string | undefined;
1060
1289
  retries?: number | null | undefined;
1061
1290
  id: number;
1062
1291
  language: string;
1063
1292
  status: string;
1064
1293
  paymentStatus: string;
1294
+ attachedFiles: {
1295
+ fileId: number;
1296
+ fileName: string | null;
1297
+ fileUrl: string;
1298
+ fileType: "IMG" | "FILE";
1299
+ uploadDate: Date;
1300
+ }[];
1065
1301
  finishDate: Date | null;
1066
1302
  report: {
1067
1303
  indications?: string | null | undefined;
@@ -1104,17 +1340,29 @@ export declare const doc24Schemas: {
1104
1340
  url: string;
1105
1341
  }[];
1106
1342
  }, {
1343
+ modality?: "P" | "V" | undefined;
1107
1344
  professional?: {
1345
+ idPrestadorInterno?: string | null | undefined;
1108
1346
  id: number;
1109
1347
  fullName: string;
1110
1348
  specialtyId: number;
1111
1349
  specialty: string;
1112
1350
  } | undefined;
1351
+ address?: string | undefined;
1352
+ city?: string | undefined;
1353
+ province?: string | undefined;
1113
1354
  retries?: number | null | undefined;
1114
1355
  id: number;
1115
1356
  language: string;
1116
1357
  status: string;
1117
1358
  paymentStatus: string;
1359
+ attachedFiles: {
1360
+ fileId: number;
1361
+ fileName: string | null;
1362
+ fileUrl: string;
1363
+ fileType: "IMG" | "FILE";
1364
+ uploadDate: Date;
1365
+ }[];
1118
1366
  finishDate: Date | null;
1119
1367
  report: {
1120
1368
  indications?: string | null | undefined;
@@ -1731,6 +1979,7 @@ export declare const doc24Schemas: {
1731
1979
  affiliationStatus: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
1732
1980
  localidad: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
1733
1981
  codPostal: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
1982
+ provincia: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
1734
1983
  }, {
1735
1984
  phone: import("zod").ZodOptional<import("zod").ZodString>;
1736
1985
  email: import("zod").ZodString;
@@ -1745,6 +1994,7 @@ export declare const doc24Schemas: {
1745
1994
  affiliationStatus?: string | null | undefined;
1746
1995
  localidad?: string | null | undefined;
1747
1996
  codPostal?: string | null | undefined;
1997
+ provincia?: string | null | undefined;
1748
1998
  phone?: string | undefined;
1749
1999
  firstName: string;
1750
2000
  lastName: string;
@@ -1762,6 +2012,7 @@ export declare const doc24Schemas: {
1762
2012
  affiliationStatus?: string | null | undefined;
1763
2013
  localidad?: string | null | undefined;
1764
2014
  codPostal?: string | null | undefined;
2015
+ provincia?: string | null | undefined;
1765
2016
  phone?: string | undefined;
1766
2017
  firstName: string;
1767
2018
  lastName: string;
@@ -1781,6 +2032,7 @@ export declare const doc24Schemas: {
1781
2032
  affiliationStatus?: string | null | undefined;
1782
2033
  localidad?: string | null | undefined;
1783
2034
  codPostal?: string | null | undefined;
2035
+ provincia?: string | null | undefined;
1784
2036
  phone?: string | undefined;
1785
2037
  firstName: string;
1786
2038
  lastName: string;
@@ -1800,6 +2052,7 @@ export declare const doc24Schemas: {
1800
2052
  affiliationStatus?: string | null | undefined;
1801
2053
  localidad?: string | null | undefined;
1802
2054
  codPostal?: string | null | undefined;
2055
+ provincia?: string | null | undefined;
1803
2056
  phone?: string | undefined;
1804
2057
  firstName: string;
1805
2058
  lastName: string;
@@ -1870,6 +2123,7 @@ export declare const doc24Schemas: {
1870
2123
  affiliationStatus: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
1871
2124
  localidad: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
1872
2125
  codPostal: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
2126
+ provincia: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
1873
2127
  }, "strip", import("zod").ZodTypeAny, {
1874
2128
  identificationType?: number | undefined;
1875
2129
  identificationValue?: string | undefined;
@@ -1881,6 +2135,7 @@ export declare const doc24Schemas: {
1881
2135
  affiliationStatus?: string | null | undefined;
1882
2136
  localidad?: string | null | undefined;
1883
2137
  codPostal?: string | null | undefined;
2138
+ provincia?: string | null | undefined;
1884
2139
  firstName: string;
1885
2140
  lastName: string;
1886
2141
  countryId: string;
@@ -1896,6 +2151,7 @@ export declare const doc24Schemas: {
1896
2151
  affiliationStatus?: string | null | undefined;
1897
2152
  localidad?: string | null | undefined;
1898
2153
  codPostal?: string | null | undefined;
2154
+ provincia?: string | null | undefined;
1899
2155
  firstName: string;
1900
2156
  lastName: string;
1901
2157
  countryId: string;
@@ -1913,6 +2169,7 @@ export declare const doc24Schemas: {
1913
2169
  affiliationStatus?: string | null | undefined;
1914
2170
  localidad?: string | null | undefined;
1915
2171
  codPostal?: string | null | undefined;
2172
+ provincia?: string | null | undefined;
1916
2173
  firstName: string;
1917
2174
  lastName: string;
1918
2175
  countryId: string;
@@ -1930,6 +2187,7 @@ export declare const doc24Schemas: {
1930
2187
  affiliationStatus?: string | null | undefined;
1931
2188
  localidad?: string | null | undefined;
1932
2189
  codPostal?: string | null | undefined;
2190
+ provincia?: string | null | undefined;
1933
2191
  firstName: string;
1934
2192
  lastName: string;
1935
2193
  countryId: string;
@@ -2466,6 +2724,23 @@ export declare const doc24Schemas: {
2466
2724
  vcToken: string;
2467
2725
  attachedFile: string;
2468
2726
  }>;
2727
+ uploadFileConsultationResponse: import("zod").ZodObject<{
2728
+ fileId: import("zod").ZodOptional<import("zod").ZodNumber>;
2729
+ }, "strip", import("zod").ZodTypeAny, {
2730
+ fileId?: number | undefined;
2731
+ }, {
2732
+ fileId?: number | undefined;
2733
+ }>;
2734
+ deleteFileConsultationParams: import("zod").ZodObject<{
2735
+ vcToken: import("zod").ZodString;
2736
+ fileId: import("zod").ZodNumber;
2737
+ }, "strip", import("zod").ZodTypeAny, {
2738
+ fileId: number;
2739
+ vcToken: string;
2740
+ }, {
2741
+ fileId: number;
2742
+ vcToken: string;
2743
+ }>;
2469
2744
  healthQuizParams: import("zod").ZodObject<{
2470
2745
  patientId: import("zod").ZodNumber;
2471
2746
  quiz: import("zod").ZodRecord<import("zod").ZodAny>;
package/lib/schemas.js CHANGED
@@ -20,6 +20,7 @@ const basePersonData = zod_1.object({
20
20
  affiliationStatus: zod_1.string().nullish(),
21
21
  localidad: zod_1.string().nullish(),
22
22
  codPostal: zod_1.string().nullish(),
23
+ provincia: zod_1.string().nullish(),
23
24
  });
24
25
  const patient = basePersonData;
25
26
  const user = basePersonData.extend({
@@ -61,6 +62,7 @@ const availableAppointment = zod_1.object({
61
62
  province: zod_1.string().nullish(),
62
63
  city: zod_1.string().nullish(),
63
64
  address: zod_1.string().nullish(),
65
+ addressPhone: zod_1.string().nullish(),
64
66
  });
65
67
  const appointment = zod_1.object({
66
68
  id: zod_1.number(),
@@ -172,6 +174,15 @@ const diagnosticaDeepLinkResponse = zod_1.object({
172
174
  forwardingRequired: zod_1.literal(true),
173
175
  deepLink: zod_1.string().url(),
174
176
  }).or(zod_1.object({ forwardingRequired: zod_1.literal(false) }));
177
+ // Files the patient attached from the waiting room (upload-file-consultation).
178
+ // Separate from `files`, which are the attention's own documents.
179
+ const attachedFile = zod_1.object({
180
+ fileId: zod_1.number(),
181
+ fileName: zod_1.string().nullable(),
182
+ fileUrl: zod_1.string().url(),
183
+ fileType: zod_1.enum(['IMG', 'FILE']),
184
+ uploadDate: zod_1.date(),
185
+ });
175
186
  const videoVisit = zod_1.object({
176
187
  id: zod_1.number().nullable(),
177
188
  creationDate: zod_1.date(),
@@ -193,10 +204,17 @@ const videoVisit = zod_1.object({
193
204
  paymentStatus: zod_1.string().optional(),
194
205
  atentionId: zod_1.number().optional(),
195
206
  waitingTime: zod_1.string().optional(),
207
+ address: zod_1.string().optional(),
208
+ city: zod_1.string().optional(),
209
+ province: zod_1.string().optional(),
210
+ modality: zod_1.enum(['P', 'V']).optional(),
211
+ attachedFiles: zod_1.array(attachedFile),
196
212
  });
197
213
  const historicalVideoVisit = videoVisit.extend({
198
214
  specialty: zod_1.string(),
199
215
  professional: zod_1.string(),
216
+ medications: zod_1.boolean().optional(),
217
+ practices: zod_1.boolean().optional(),
200
218
  });
201
219
  const coverageInfo = zod_1.object({
202
220
  financerId: zod_1.number().nullable(),
@@ -339,8 +357,28 @@ const binahWellnessResponse = zod_1.object({
339
357
  }),
340
358
  signature: zod_1.string(),
341
359
  });
360
+ const integrationErrorDetailsMaxBytes = 64 * 1024;
361
+ const reportIntegrationErrorParams = zod_1.object({
362
+ integration: zod_1.string().min(1),
363
+ operation: zod_1.string().optional(),
364
+ severity: zod_1.enum(['INFO', 'WARNING', 'ERROR', 'CRITICAL']).optional(),
365
+ errorCode: zod_1.string().optional(),
366
+ httpStatus: zod_1.number().int().optional(),
367
+ params: zod_1.record(zod_1.unknown()),
368
+ occurredAt: zod_1.date(),
369
+ externalId: zod_1.string().optional(),
370
+ details: zod_1.record(zod_1.unknown())
371
+ .refine((d) => Buffer.byteLength(JSON.stringify(d), 'utf8') <=
372
+ integrationErrorDetailsMaxBytes, { message: 'details must not exceed 64 KB' })
373
+ .optional(),
374
+ });
375
+ const reportIntegrationErrorResponse = zod_1.object({
376
+ errorId: zod_1.number(),
377
+ });
342
378
  exports.doc24Schemas = {
343
379
  sdkCredentials,
380
+ reportIntegrationErrorParams,
381
+ reportIntegrationErrorResponse,
344
382
  sdkParams: zod_1.object({ url: zod_1.string(), credentials: sdkCredentials }),
345
383
  user,
346
384
  patient,
@@ -372,10 +410,12 @@ exports.doc24Schemas = {
372
410
  appointmentScheduleParameters,
373
411
  instantScheduleParameters,
374
412
  ]),
413
+ attachedFile,
375
414
  videoVisit,
376
415
  historicalVideoVisit,
377
416
  videoVisitDetails: zod_1.object({
378
417
  id: zod_1.number(),
418
+ vcToken: zod_1.string().optional(),
379
419
  status: zod_1.string(),
380
420
  paymentStatus: zod_1.string(),
381
421
  professional: zod_1.object({
@@ -407,16 +447,22 @@ exports.doc24Schemas = {
407
447
  medication: zod_1.array(zod_1.any()),
408
448
  }),
409
449
  files: zod_1.array(zod_1.object({ name: zod_1.string(), url: zod_1.string().url() })),
450
+ attachedFiles: zod_1.array(attachedFile),
410
451
  }),
411
452
  completeVideoVisitDetails: zod_1.object({
412
453
  id: zod_1.number(),
413
454
  status: zod_1.string(),
414
455
  paymentStatus: zod_1.string(),
456
+ modality: zod_1.enum(['P', 'V']).optional(),
457
+ address: zod_1.string().optional(),
458
+ city: zod_1.string().optional(),
459
+ province: zod_1.string().optional(),
415
460
  professional: zod_1.object({
416
461
  id: zod_1.number(),
417
462
  fullName: zod_1.string(),
418
463
  specialtyId: zod_1.number(),
419
464
  specialty: zod_1.string(),
465
+ idPrestadorInterno: zod_1.string().nullish(),
420
466
  }).optional(),
421
467
  finishDate: zod_1.date().nullable(),
422
468
  retries: zod_1.number().nullish(),
@@ -455,6 +501,7 @@ exports.doc24Schemas = {
455
501
  certificate: zod_1.array(zod_1.any()).or(zod_1.string()).nullish(),
456
502
  }),
457
503
  files: zod_1.array(zod_1.object({ name: zod_1.string(), url: zod_1.string().url() })),
504
+ attachedFiles: zod_1.array(attachedFile),
458
505
  }),
459
506
  activeVideoVisitData: zod_1.object({
460
507
  consultationId: zod_1.number(),
@@ -532,6 +579,13 @@ exports.doc24Schemas = {
532
579
  attachedFile: zod_1.string(),
533
580
  fileName: zod_1.string().optional(),
534
581
  }),
582
+ uploadFileConsultationResponse: zod_1.object({
583
+ fileId: zod_1.number().optional(),
584
+ }),
585
+ deleteFileConsultationParams: zod_1.object({
586
+ vcToken: zod_1.string(),
587
+ fileId: zod_1.number(),
588
+ }),
535
589
  healthQuizParams: zod_1.object({
536
590
  patientId: zod_1.number(),
537
591
  quiz: zod_1.record(zod_1.any()),
package/lib/types.d.ts CHANGED
@@ -11,6 +11,7 @@ export declare namespace Doc24 {
11
11
  type AvailableScheduleClinics = TypeOf<typeof doc24Schemas.availableScheduleClinics>;
12
12
  type ScheduleFilter = TypeOf<typeof doc24Schemas.scheduleFilter>;
13
13
  type ScheduleParameters = TypeOf<typeof doc24Schemas.scheduleParameters>;
14
+ type AttachedFile = TypeOf<typeof doc24Schemas.attachedFile>;
14
15
  type VideoVisit = TypeOf<typeof doc24Schemas.videoVisit>;
15
16
  type HistoricalVideoVisit = TypeOf<typeof doc24Schemas.historicalVideoVisit>;
16
17
  type VideoVisitDetails = TypeOf<typeof doc24Schemas.videoVisitDetails>;
@@ -50,7 +51,11 @@ export declare namespace Doc24 {
50
51
  type BinahWellnessGetLinkParams = TypeOf<typeof doc24Schemas.binahWellnessGetLinkParams>;
51
52
  type BinahWellnessResponse = TypeOf<typeof doc24Schemas.binahWellnessResponse>;
52
53
  type ProfessionalsBySpecialtyFilter = TypeOf<typeof doc24Schemas.professionalsBySpecialtyFilter>;
54
+ type ReportIntegrationErrorParams = TypeOf<typeof doc24Schemas.reportIntegrationErrorParams>;
55
+ type ReportIntegrationErrorResponse = TypeOf<typeof doc24Schemas.reportIntegrationErrorResponse>;
53
56
  type UploadFileConsultationParams = TypeOf<typeof doc24Schemas.uploadFileConsultationParams>;
57
+ type UploadFileConsultationResponse = TypeOf<typeof doc24Schemas.uploadFileConsultationResponse>;
58
+ type DeleteFileConsultationParams = TypeOf<typeof doc24Schemas.deleteFileConsultationParams>;
54
59
  type HealthQuizParams = TypeOf<typeof doc24Schemas.healthQuizParams>;
55
60
  type BaseSdk = {
56
61
  declareUser: (params: DeclareUserParams) => Promise<DeclareUserResponse>;
@@ -70,6 +75,7 @@ export declare namespace Doc24 {
70
75
  sendExternalVerificationCode: (params: SendExternalVerificationCodeParams) => Promise<void>;
71
76
  verifyExternalVerificationCode: (params: VerifyExternalVerificationCodeParams) => Promise<any>;
72
77
  externalResetPassword: (params: ExternalResetPasswordParams) => Promise<any>;
78
+ reportIntegrationError: (params: ReportIntegrationErrorParams) => Promise<ReportIntegrationErrorResponse>;
73
79
  };
74
80
  type UserSdk = {
75
81
  declarePatient: (params: DeclarePatientParams) => Promise<DeclarePatientResponse>;
@@ -103,7 +109,8 @@ export declare namespace Doc24 {
103
109
  submitHealthQuiz: (params: HealthQuizParams) => Promise<void>;
104
110
  userId: number;
105
111
  getBinahWellnessLink: (body: BinahWellnessGetLinkParams) => Promise<BinahWellnessResponse>;
106
- uploadFileConsultation: (params: UploadFileConsultationParams) => Promise<unknown>;
112
+ uploadFileConsultation: (params: UploadFileConsultationParams) => Promise<UploadFileConsultationResponse>;
113
+ deleteFileConsultation: (params: DeleteFileConsultationParams) => Promise<void>;
107
114
  };
108
115
  namespace Webhook {
109
116
  type StatusChangeEventStatus = 'S' | 'C' | 'F' | 'A' | 'D' | 'L';
@@ -12,6 +12,7 @@ export declare const getPatientMethods: (makeRequest: RequestMaker) => {
12
12
  affiliationStatus?: string | null | undefined;
13
13
  localidad?: string | null | undefined;
14
14
  codPostal?: string | null | undefined;
15
+ provincia?: string | null | undefined;
15
16
  firstName: string;
16
17
  lastName: string;
17
18
  countryId: string;
@@ -43,6 +44,7 @@ export declare const getPatientMethods: (makeRequest: RequestMaker) => {
43
44
  affiliationStatus?: string | null | undefined;
44
45
  localidad?: string | null | undefined;
45
46
  codPostal?: string | null | undefined;
47
+ provincia?: string | null | undefined;
46
48
  firstName: string;
47
49
  lastName: string;
48
50
  countryId: string;
@@ -24,6 +24,8 @@ const getPatientMethods = (makeRequest) => {
24
24
  affiliation_status: patient.affiliationStatus,
25
25
  localidad: patient.localidad,
26
26
  cod_postal: patient.codPostal,
27
+ // Only sent when informed; never as null or empty
28
+ provincia: patient.provincia || undefined,
27
29
  };
28
30
  const parsedChannel = channel ? parseInt(channel) : channel;
29
31
  const response = await makeRequest('POST', path, {
@@ -13,13 +13,14 @@ export declare const getScheduleMethods: (makeRequest: RequestMaker) => {
13
13
  showAppointmentConfiguration?: boolean | undefined;
14
14
  } | undefined) => Promise<{
15
15
  length?: number | null | undefined;
16
+ address?: string | null | undefined;
17
+ city?: string | null | undefined;
18
+ province?: string | null | undefined;
16
19
  ranking?: unknown;
17
20
  consultation_value?: string | null | undefined;
18
21
  inPerson?: boolean | null | undefined;
19
22
  virtual?: boolean | null | undefined;
20
- province?: string | null | undefined;
21
- city?: string | null | undefined;
22
- address?: string | null | undefined;
23
+ addressPhone?: string | null | undefined;
23
24
  date: Date;
24
25
  type: "appointment" | "chat" | "instant";
25
26
  id: string | number;
@@ -17,7 +17,7 @@ const getScheduleMethods = (makeRequest) => {
17
17
  };
18
18
  const path = `/schedule/dates/${patientId}/${JSON.stringify(mappedFilter)}`;
19
19
  const response = await makeRequest('GET', path);
20
- return response.data.available_dates.map((o) => utils_1.parseDate(o.date, o.time_zone));
20
+ return response.data.available_dates.map((o) => utils_1.parseDate(o.date, filter.userTimeZone));
21
21
  };
22
22
  const getSchedule = async (patientId, specialtyId, filter = {}) => {
23
23
  var _a;
@@ -37,7 +37,7 @@ const getScheduleMethods = (makeRequest) => {
37
37
  const response = await makeRequest('GET', path);
38
38
  return response.data.available_appointments.map((a) => ({
39
39
  id: a.id,
40
- date: utils_1.parseDateTime(`${a.date} ${a.hour}`, a.time_zone),
40
+ date: utils_1.parseDateTime(`${a.date} ${a.hour}`, utils_1.getConvertedHourTimeZone(filter.userTimeZone, a.time_zone)),
41
41
  clinicId: a.clinic,
42
42
  professional: {
43
43
  id: a.professional_id,
@@ -59,6 +59,7 @@ const getScheduleMethods = (makeRequest) => {
59
59
  province: a.province,
60
60
  city: a.city,
61
61
  address: a.address,
62
+ addressPhone: a.address_phone,
62
63
  }));
63
64
  };
64
65
  const getAppointment = async (appointmentId) => {
@@ -23,6 +23,7 @@ export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
23
23
  date: Date;
24
24
  id: number;
25
25
  } | undefined;
26
+ modality?: "P" | "V" | undefined;
26
27
  videoVisit?: {
27
28
  id: number;
28
29
  status: string;
@@ -30,6 +31,9 @@ export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
30
31
  paymentStatus?: string | undefined;
31
32
  atentionId?: number | undefined;
32
33
  waitingTime?: string | undefined;
34
+ address?: string | undefined;
35
+ city?: string | undefined;
36
+ province?: string | undefined;
33
37
  id: number | null;
34
38
  patientId: number;
35
39
  creationDate: Date;
@@ -39,12 +43,20 @@ export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
39
43
  id: number;
40
44
  };
41
45
  vcToken: string;
46
+ attachedFiles: {
47
+ fileId: number;
48
+ fileName: string | null;
49
+ fileUrl: string;
50
+ fileType: "IMG" | "FILE";
51
+ uploadDate: Date;
52
+ }[];
42
53
  }>;
43
54
  getPatientVideoVisitHistory: (patientId: number) => Promise<{
44
55
  appointment?: {
45
56
  date: Date;
46
57
  id: number;
47
58
  } | undefined;
59
+ modality?: "P" | "V" | undefined;
48
60
  videoVisit?: {
49
61
  id: number;
50
62
  status: string;
@@ -52,6 +64,11 @@ export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
52
64
  paymentStatus?: string | undefined;
53
65
  atentionId?: number | undefined;
54
66
  waitingTime?: string | undefined;
67
+ address?: string | undefined;
68
+ city?: string | undefined;
69
+ province?: string | undefined;
70
+ medications?: boolean | undefined;
71
+ practices?: boolean | undefined;
55
72
  id: number | null;
56
73
  patientId: number;
57
74
  professional: string;
@@ -62,6 +79,13 @@ export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
62
79
  id: number;
63
80
  };
64
81
  vcToken: string;
82
+ attachedFiles: {
83
+ fileId: number;
84
+ fileName: string | null;
85
+ fileUrl: string;
86
+ fileType: "IMG" | "FILE";
87
+ uploadDate: Date;
88
+ }[];
65
89
  specialty: string;
66
90
  }[]>;
67
91
  getVideoVisitDetails: (vcId: number) => Promise<{
@@ -69,6 +93,7 @@ export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
69
93
  id: number;
70
94
  fullName: string;
71
95
  } | undefined;
96
+ vcToken?: string | undefined;
72
97
  appointment: {
73
98
  date: Date;
74
99
  id: number;
@@ -82,6 +107,13 @@ export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
82
107
  };
83
108
  status: string;
84
109
  paymentStatus: string;
110
+ attachedFiles: {
111
+ fileId: number;
112
+ fileName: string | null;
113
+ fileUrl: string;
114
+ fileType: "IMG" | "FILE";
115
+ uploadDate: Date;
116
+ }[];
85
117
  finishDate: Date | null;
86
118
  retries: number;
87
119
  report: {
@@ -114,17 +146,29 @@ export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
114
146
  consultationId: number;
115
147
  }[]>;
116
148
  getCompleteVideoVisitDetails: (vcToken: string) => Promise<{
149
+ modality?: "P" | "V" | undefined;
117
150
  professional?: {
151
+ idPrestadorInterno?: string | null | undefined;
118
152
  id: number;
119
153
  fullName: string;
120
154
  specialtyId: number;
121
155
  specialty: string;
122
156
  } | undefined;
157
+ address?: string | undefined;
158
+ city?: string | undefined;
159
+ province?: string | undefined;
123
160
  retries?: number | null | undefined;
124
161
  id: number;
125
162
  language: string;
126
163
  status: string;
127
164
  paymentStatus: string;
165
+ attachedFiles: {
166
+ fileId: number;
167
+ fileName: string | null;
168
+ fileUrl: string;
169
+ fileType: "IMG" | "FILE";
170
+ uploadDate: Date;
171
+ }[];
128
172
  finishDate: Date | null;
129
173
  report: {
130
174
  indications?: string | null | undefined;
@@ -171,5 +215,11 @@ export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
171
215
  fileName?: string | undefined;
172
216
  vcToken: string;
173
217
  attachedFile: string;
174
- }) => Promise<unknown>;
218
+ }) => Promise<{
219
+ fileId?: number | undefined;
220
+ }>;
221
+ deleteFileConsultation: (params: {
222
+ fileId: number;
223
+ vcToken: string;
224
+ }) => Promise<void>;
175
225
  };
@@ -16,7 +16,7 @@ const getVideoVisitMethods = (makeRequest) => {
16
16
  ? {
17
17
  type: 'P',
18
18
  appointment_id: params.appointmentId,
19
- modaility: params.modality || 'A',
19
+ modality: params.modality || 'A',
20
20
  }
21
21
  : { type: 'E' };
22
22
  const mappedParams = {
@@ -25,7 +25,7 @@ const getVideoVisitMethods = (makeRequest) => {
25
25
  specialty_id: params.specialtyId,
26
26
  language: params.language.toUpperCase(),
27
27
  details: params.details,
28
- extra_info: params.extraInfo,
28
+ extra_info: { ...params.extraInfo, modality: params.modality || 'A' },
29
29
  };
30
30
  const response = await makeRequest('POST', '/video-visit', mappedParams);
31
31
  return response.data.vc_token;
@@ -45,10 +45,12 @@ const getVideoVisitMethods = (makeRequest) => {
45
45
  return response.data.map((raw) => mapHistoricalVideoVisit(raw));
46
46
  });
47
47
  const getVideoVisitDetails = validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.videoVisitDetails, async (vcId) => {
48
+ var _a;
48
49
  const path = `/video-visit-records/${vcId}`;
49
50
  const response = await makeRequest('GET', path);
50
51
  return {
51
52
  id: response.data.consultation_id,
53
+ vcToken: (_a = response.data.vc_token) !== null && _a !== void 0 ? _a : undefined,
52
54
  status: response.data.status,
53
55
  paymentStatus: response.data.payment_status,
54
56
  professional: response.data.professional_id
@@ -102,6 +104,7 @@ const getVideoVisitMethods = (makeRequest) => {
102
104
  name: f.nombre_file,
103
105
  url: f.file,
104
106
  })),
107
+ attachedFiles: mapAttachedFiles(response.data.attached_files),
105
108
  };
106
109
  });
107
110
  const getActiveVideoVisits = validation_1.validateFunction(zod_1.tuple([]), zod_1.array(schemas_1.doc24Schemas.activeVideoVisitData), async () => {
@@ -126,12 +129,19 @@ const getVideoVisitMethods = (makeRequest) => {
126
129
  id: response.data.id_consulta,
127
130
  status: response.data.estado,
128
131
  paymentStatus: response.data.estado_pago,
132
+ modality: response.data.modalidad,
133
+ address: response.data.direccion,
134
+ city: response.data.localidad,
135
+ province: response.data.provincia,
129
136
  professional: response.data.id_profesional
130
137
  ? {
131
138
  id: response.data.id_profesional,
132
139
  fullName: response.data.profesional,
133
140
  specialtyId: response.data.id_especialidad,
134
141
  specialty: response.data.especialidad,
142
+ idPrestadorInterno: response.data.id_prestador_interno != null
143
+ ? String(response.data.id_prestador_interno)
144
+ : undefined,
135
145
  }
136
146
  : undefined,
137
147
  finishDate: response.data.fecha_fin && utils_1.parseDateTime(response.data.fecha_fin),
@@ -187,16 +197,27 @@ const getVideoVisitMethods = (makeRequest) => {
187
197
  name: f.nombre_file,
188
198
  url: f.file,
189
199
  })),
200
+ attachedFiles: mapAttachedFiles(response.data.attached_files),
190
201
  };
191
202
  });
192
- const uploadFileConsultation = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.uploadFileConsultationParams]), zod_1.any(), async (params) => {
203
+ const uploadFileConsultation = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.uploadFileConsultationParams]), schemas_1.doc24Schemas.uploadFileConsultationResponse, async (params) => {
193
204
  const form = new form_data_1.default();
194
205
  form.append('vc_token', params.vcToken);
195
206
  form.append('attached_file', fs_1.default.createReadStream(params.attachedFile));
196
207
  if (params.fileName)
197
208
  form.append('file_name', params.fileName);
198
209
  const response = await makeRequest('POST', '/upload-file-consultation', form);
199
- return response.data;
210
+ // Unlike most doc24 endpoints, this one is not wrapped in `data`:
211
+ // {status, message, file_id}.
212
+ return {
213
+ fileId: response.file_id != null ? Number(response.file_id) : undefined,
214
+ };
215
+ });
216
+ const deleteFileConsultation = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.deleteFileConsultationParams]), zod_1.undefined(), async (params) => {
217
+ await makeRequest('DELETE', '/delete-file-consultation', {
218
+ vc_token: params.vcToken,
219
+ file_id: params.fileId,
220
+ });
200
221
  });
201
222
  return {
202
223
  scheduleVideoVisit,
@@ -208,11 +229,12 @@ const getVideoVisitMethods = (makeRequest) => {
208
229
  getActiveVideoVisits,
209
230
  getCompleteVideoVisitDetails,
210
231
  uploadFileConsultation,
232
+ deleteFileConsultation,
211
233
  };
212
234
  };
213
235
  exports.getVideoVisitMethods = getVideoVisitMethods;
214
236
  const mapVideoVisit = (raw) => {
215
- var _a, _b, _c;
237
+ var _a, _b, _c, _d, _e, _f, _g;
216
238
  return {
217
239
  id: raw.vc_id,
218
240
  creationDate: utils_1.parseDateTime(raw.creation_date),
@@ -231,12 +253,31 @@ const mapVideoVisit = (raw) => {
231
253
  paymentStatus: (_a = raw.payment_status) !== null && _a !== void 0 ? _a : undefined,
232
254
  atentionId: (_b = raw.atentionId) !== null && _b !== void 0 ? _b : undefined,
233
255
  waitingTime: (_c = raw.waiting_time) !== null && _c !== void 0 ? _c : undefined,
256
+ address: (_d = raw.direccion) !== null && _d !== void 0 ? _d : undefined,
257
+ city: (_e = raw.localidad) !== null && _e !== void 0 ? _e : undefined,
258
+ province: (_f = raw.provincia) !== null && _f !== void 0 ? _f : undefined,
259
+ modality: (_g = raw.modalidad) !== null && _g !== void 0 ? _g : undefined,
260
+ attachedFiles: mapAttachedFiles(raw.attached_files),
234
261
  };
235
262
  };
263
+ // `upload_date` is Argentina time without offset: parse with the default -03,
264
+ // never with the brand's `time_zone` (that one is a correction, not the zone).
265
+ const mapAttachedFiles = (raw) => (raw !== null && raw !== void 0 ? raw : []).map((f) => {
266
+ var _a;
267
+ return ({
268
+ fileId: Number(f.file_id),
269
+ fileName: (_a = f.file_name) !== null && _a !== void 0 ? _a : null,
270
+ fileUrl: f.file_url,
271
+ fileType: f.file_type,
272
+ uploadDate: utils_1.parseDateTime(f.upload_date),
273
+ });
274
+ });
236
275
  const mapHistoricalVideoVisit = (raw) => {
237
276
  return {
238
277
  ...mapVideoVisit(raw),
239
278
  professional: raw.professional,
240
279
  specialty: raw.specialty,
280
+ medications: raw.medications != null ? Boolean(raw.medications) : undefined,
281
+ practices: raw.practices != null ? Boolean(raw.practices) : undefined,
241
282
  };
242
283
  };
package/lib/utils.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export declare const parseDate: (str: string, timeZone?: string | null | undefined) => Date;
2
2
  export declare const parseDateTime: (str: string, timeZone?: string | null | undefined) => Date;
3
+ export declare const getConvertedHourTimeZone: (userTimeZone?: string | null | undefined, professionalTimeZone?: string | null | undefined) => string;
3
4
  export declare const normalizeTimezoneOffset: (raw?: string | undefined, defualtTimezone?: number) => string | undefined;
package/lib/utils.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizeTimezoneOffset = exports.parseDateTime = exports.parseDate = void 0;
3
+ exports.normalizeTimezoneOffset = exports.getConvertedHourTimeZone = exports.parseDateTime = exports.parseDate = void 0;
4
4
  const date_fns_1 = require("date-fns");
5
5
  // import {Doc24} from '.';
6
6
  const defaultTimeZone = '-03';
@@ -8,6 +8,31 @@ const parseDate = (str, timeZone) => exports.parseDateTime(`${str} 00:00:00`, ti
8
8
  exports.parseDate = parseDate;
9
9
  const parseDateTime = (str, timeZone) => date_fns_1.parse(`${str} ${timeZone !== null && timeZone !== void 0 ? timeZone : defaultTimeZone}`, 'yyyy-MM-dd HH:mm:ss X', new Date());
10
10
  exports.parseDateTime = parseDateTime;
11
+ const offsetToMinutes = (offset) => {
12
+ var _a;
13
+ const match = offset === null || offset === void 0 ? void 0 : offset.trim().match(/^([+-])(\d{1,2}):?(\d{2})?$/);
14
+ if (!match)
15
+ return undefined;
16
+ const minutes = Number(match[2]) * 60 + Number((_a = match[3]) !== null && _a !== void 0 ? _a : 0);
17
+ return match[1] === '-' ? -minutes : minutes;
18
+ };
19
+ const minutesToOffset = (minutes) => {
20
+ const abs = Math.abs(minutes);
21
+ const hh = Math.floor(abs / 60).toString().padStart(2, '0');
22
+ const mm = (abs % 60).toString().padStart(2, '0');
23
+ return `${minutes < 0 ? '-' : '+'}${hh}${mm === '00' ? '' : mm}`;
24
+ };
25
+ // WEH-1702: doc24 convierte la hora local del médico (en `time_zone`) al
26
+ // user_time_zone como si estuviera en -03. Esta es la zona que deshace ese
27
+ // corrimiento. Revertir cuando doc24 convierta desde `time_zone`.
28
+ const getConvertedHourTimeZone = (userTimeZone, professionalTimeZone) => {
29
+ var _a, _b;
30
+ const ar = offsetToMinutes(defaultTimeZone);
31
+ const user = (_a = offsetToMinutes(userTimeZone)) !== null && _a !== void 0 ? _a : ar;
32
+ const professional = (_b = offsetToMinutes(professionalTimeZone)) !== null && _b !== void 0 ? _b : ar;
33
+ return minutesToOffset(user - ar + professional);
34
+ };
35
+ exports.getConvertedHourTimeZone = getConvertedHourTimeZone;
11
36
  const normalizeTimezoneOffset = (raw, defualtTimezone = -3) => {
12
37
  if (!raw)
13
38
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integraciones_doc24/sdk",
3
- "version": "1.16.38",
3
+ "version": "1.16.39",
4
4
  "publishConfig": {
5
5
  "tag": "latest"
6
6
  },