@integraciones_doc24/sdk 1.16.37 → 1.16.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +225 -206
  2. package/lib/baseSdk/diagnostica.d.ts +54 -54
  3. package/lib/baseSdk/diagnostica.js +82 -82
  4. package/lib/baseSdk/external.d.ts +177 -177
  5. package/lib/baseSdk/external.js +96 -96
  6. package/lib/baseSdk/index.d.ts +2 -2
  7. package/lib/baseSdk/index.js +76 -77
  8. package/lib/baseSdk/user.d.ts +112 -112
  9. package/lib/baseSdk/user.js +136 -136
  10. package/lib/index.d.ts +400 -400
  11. package/lib/index.js +22 -22
  12. package/lib/request/index.d.ts +4 -4
  13. package/lib/request/index.js +32 -32
  14. package/lib/request/token.d.ts +2 -2
  15. package/lib/request/token.js +34 -34
  16. package/lib/request/validation.d.ts +10 -10
  17. package/lib/request/validation.js +28 -28
  18. package/lib/schemas.d.ts +2482 -2703
  19. package/lib/schemas.js +540 -573
  20. package/lib/types.d.ts +170 -174
  21. package/lib/types.js +2 -2
  22. package/lib/userSdk/binah.d.ts +21 -21
  23. package/lib/userSdk/binah.js +20 -20
  24. package/lib/userSdk/chat.d.ts +57 -57
  25. package/lib/userSdk/chat.js +98 -98
  26. package/lib/userSdk/external.d.ts +34 -34
  27. package/lib/userSdk/external.js +72 -72
  28. package/lib/userSdk/index.d.ts +2 -2
  29. package/lib/userSdk/index.js +33 -33
  30. package/lib/userSdk/patients.d.ts +58 -58
  31. package/lib/userSdk/patients.js +89 -89
  32. package/lib/userSdk/schedule.d.ts +58 -59
  33. package/lib/userSdk/schedule.js +89 -90
  34. package/lib/userSdk/specialties.d.ts +19 -19
  35. package/lib/userSdk/specialties.js +48 -48
  36. package/lib/userSdk/videoVisit.d.ts +175 -225
  37. package/lib/userSdk/videoVisit.js +242 -283
  38. package/lib/utils.d.ts +3 -4
  39. package/lib/utils.js +43 -68
  40. package/lib/webhook/index.d.ts +2 -2
  41. package/lib/webhook/index.js +67 -67
  42. package/lib/webhook/responses.d.ts +35 -35
  43. package/lib/webhook/responses.js +42 -42
  44. package/lib/webhook/token.d.ts +2 -2
  45. package/lib/webhook/token.js +23 -23
  46. package/package.json +37 -37
@@ -1,283 +1,242 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getVideoVisitMethods = void 0;
7
- const zod_1 = require("zod");
8
- const validation_1 = require("../request/validation");
9
- const schemas_1 = require("../schemas");
10
- const utils_1 = require("../utils");
11
- const fs_1 = __importDefault(require("fs"));
12
- const form_data_1 = __importDefault(require("form-data"));
13
- const getVideoVisitMethods = (makeRequest) => {
14
- const scheduleVideoVisit = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.scheduleParameters]), zod_1.string(), async (params) => {
15
- const specificParams = params.type === 'appointment'
16
- ? {
17
- type: 'P',
18
- appointment_id: params.appointmentId,
19
- modality: params.modality || 'A',
20
- }
21
- : { type: 'E' };
22
- const mappedParams = {
23
- ...specificParams,
24
- patient_id: params.patientId,
25
- specialty_id: params.specialtyId,
26
- language: params.language.toUpperCase(),
27
- details: params.details,
28
- extra_info: { ...params.extraInfo, modality: params.modality || 'A' },
29
- };
30
- const response = await makeRequest('POST', '/video-visit', mappedParams);
31
- return response.data.vc_token;
32
- });
33
- const cancelVideoVisit = validation_1.validateFunction(zod_1.tuple([zod_1.string()]), zod_1.undefined(), async (vcToken) => {
34
- const path = `/video-visit/${vcToken}`;
35
- await makeRequest('DELETE', path);
36
- });
37
- const getVideoVisit = validation_1.validateFunction(zod_1.tuple([zod_1.string(), zod_1.number()]), schemas_1.doc24Schemas.videoVisit, async (vcToken, patientId) => {
38
- const path = `/video-visit/${vcToken}/${patientId}`;
39
- const response = await makeRequest('GET', path);
40
- return mapVideoVisit(response.data);
41
- });
42
- const getPatientVideoVisitHistory = validation_1.validateFunction(zod_1.tuple([zod_1.number()]), zod_1.array(schemas_1.doc24Schemas.historicalVideoVisit), async (patientId) => {
43
- const path = `/video-visit-history/${patientId}`;
44
- const response = await makeRequest('GET', path);
45
- return response.data.map((raw) => mapHistoricalVideoVisit(raw));
46
- });
47
- const getVideoVisitDetails = validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.videoVisitDetails, async (vcId) => {
48
- var _a;
49
- const path = `/video-visit-records/${vcId}`;
50
- const response = await makeRequest('GET', path);
51
- return {
52
- id: response.data.consultation_id,
53
- vcToken: (_a = response.data.vc_token) !== null && _a !== void 0 ? _a : undefined,
54
- status: response.data.status,
55
- paymentStatus: response.data.payment_status,
56
- professional: response.data.professional_id
57
- ? {
58
- id: response.data.professional_id,
59
- fullName: response.data.professional,
60
- }
61
- : undefined,
62
- patient: {
63
- fullName: response.data.patient,
64
- firstAccessDate: response.data.patient_first_access_date &&
65
- utils_1.parseDateTime(response.data.patient_first_access_date),
66
- lastAccessDate: response.data.patient_last_access_date &&
67
- utils_1.parseDateTime(response.data.patient_last_access_date),
68
- },
69
- finishDate: response.data.finish_date &&
70
- utils_1.parseDateTime(response.data.finish_date),
71
- retries: response.data.retries,
72
- language: response.data.language,
73
- appointment: response.data.appointment_id
74
- ? {
75
- id: response.data.appointment_id,
76
- date: utils_1.parseDateTime(`${response.data.appointment_date} ${response.data.appointment_time}`, response.data.time_zone),
77
- }
78
- : null,
79
- report: {
80
- motive: response.data.motive,
81
- actualDesease: response.data.actual_desease,
82
- indications: response.data.indications,
83
- alertSigns: response.data.alert_signs,
84
- extendedMotive: response.data.extended_motive,
85
- diagnose: response.data.diagnose.map((d) => ({
86
- description: d.diagnostico,
87
- code: d.codificacion,
88
- })),
89
- },
90
- pdf: {
91
- atention: response.data.pdf_atention
92
- ? response.data.pdf_atention
93
- : undefined,
94
- medication: response.data.pdf_medication,
95
- images: response.data.pdf_images
96
- ? response.data.pdf_images
97
- : undefined,
98
- otherExams: response.data.pdf_other_exams
99
- ? response.data.pdf_other_exams
100
- : undefined,
101
- labs: response.data.pdf_labs ? response.data.pdf_labs : undefined,
102
- },
103
- files: response.data.files.map((f) => ({
104
- name: f.nombre_file,
105
- url: f.file,
106
- })),
107
- attachedFiles: mapAttachedFiles(response.data.attached_files),
108
- };
109
- });
110
- const getActiveVideoVisits = validation_1.validateFunction(zod_1.tuple([]), zod_1.array(schemas_1.doc24Schemas.activeVideoVisitData), async () => {
111
- const path = '/active-video-visits';
112
- const response = await makeRequest('GET', path);
113
- const consultations = response.data['active-consultations'];
114
- return consultations.map((s) => ({
115
- patientId: s.patient_id,
116
- consultationId: s.consultation_id,
117
- vcToken: s.vc_token,
118
- }));
119
- });
120
- const getVideoVisitLink = validation_1.validateFunction(zod_1.tuple([zod_1.string(), zod_1.number()]), zod_1.string().nullable(), async (vcToken, patientId) => {
121
- const path = `/video-visit-link/${vcToken}/${patientId}`;
122
- const response = await makeRequest('GET', path);
123
- return response.data.link;
124
- });
125
- const getCompleteVideoVisitDetails = validation_1.validateFunction(zod_1.tuple([zod_1.string()]), schemas_1.doc24Schemas.completeVideoVisitDetails, async (vcToken) => {
126
- const path = `/consultation/${vcToken}`;
127
- const response = await makeRequest('GET', path);
128
- return {
129
- id: response.data.id_consulta,
130
- status: response.data.estado,
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,
136
- professional: response.data.id_profesional
137
- ? {
138
- id: response.data.id_profesional,
139
- fullName: response.data.profesional,
140
- specialtyId: response.data.id_especialidad,
141
- specialty: response.data.especialidad,
142
- idPrestadorInterno: response.data.id_prestador_interno != null
143
- ? String(response.data.id_prestador_interno)
144
- : undefined,
145
- }
146
- : undefined,
147
- finishDate: response.data.fecha_fin && utils_1.parseDateTime(response.data.fecha_fin),
148
- retries: response.data.intentos_conexion,
149
- language: response.data.tag_idioma,
150
- report: {
151
- motive: response.data.motivo,
152
- actualDesease: response.data.enfermedad_actual,
153
- indications: response.data.conducta_terapeutica,
154
- alertSigns: response.data.signos_alerta,
155
- extendedMotive: response.data.motivo_extendido_consulta,
156
- diagnose: response.data.diagnostico.map((d) => ({
157
- description: d.diagnostico,
158
- code: d.codificacion,
159
- })),
160
- medication: response.data.medicacion.map((m) => ({
161
- description: m.detalle_producto,
162
- quantity: m.cantidad,
163
- dose: m.dosificacion,
164
- farmalinkId: m.id_prescripcion_farmalink,
165
- })),
166
- prescription: {
167
- link: response.data.link_receta,
168
- codigo: response.data.codigo_verificacion_receta,
169
- },
170
- inPersonRequired: response.data.presencial_requerida,
171
- referral: {
172
- status: response.data.derivada,
173
- specialtyId: response.data.derivada_id_especialidad,
174
- inPersonRequired: response.data.derivada_presencial_obligatoria,
175
- comments: response.data.derivada_comentarios,
176
- },
177
- },
178
- pdf: {
179
- atention: response.data.pdf_atencion
180
- ? response.data.pdf_atencion
181
- : undefined,
182
- medication: response.data.pdf_medicacion,
183
- images: response.data.pdf_imagenes
184
- ? response.data.pdf_imagenes
185
- : undefined,
186
- otherExams: response.data.pdf_otras
187
- ? response.data.pdf_otras
188
- : undefined,
189
- labs: response.data.pdf_laboratorios
190
- ? response.data.pdf_laboratorios
191
- : undefined,
192
- certificate: response.data.pdf_certificado
193
- ? response.data.pdf_certificado
194
- : undefined,
195
- },
196
- files: response.data.files_atencion.map((f) => ({
197
- name: f.nombre_file,
198
- url: f.file,
199
- })),
200
- attachedFiles: mapAttachedFiles(response.data.attached_files),
201
- };
202
- });
203
- const uploadFileConsultation = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.uploadFileConsultationParams]), schemas_1.doc24Schemas.uploadFileConsultationResponse, async (params) => {
204
- const form = new form_data_1.default();
205
- form.append('vc_token', params.vcToken);
206
- form.append('attached_file', fs_1.default.createReadStream(params.attachedFile));
207
- if (params.fileName)
208
- form.append('file_name', params.fileName);
209
- const response = await makeRequest('POST', '/upload-file-consultation', form);
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
- });
221
- });
222
- return {
223
- scheduleVideoVisit,
224
- cancelVideoVisit,
225
- getVideoVisit,
226
- getPatientVideoVisitHistory,
227
- getVideoVisitDetails,
228
- getVideoVisitLink,
229
- getActiveVideoVisits,
230
- getCompleteVideoVisitDetails,
231
- uploadFileConsultation,
232
- deleteFileConsultation,
233
- };
234
- };
235
- exports.getVideoVisitMethods = getVideoVisitMethods;
236
- const mapVideoVisit = (raw) => {
237
- var _a, _b, _c, _d, _e, _f, _g;
238
- return {
239
- id: raw.vc_id,
240
- creationDate: utils_1.parseDateTime(raw.creation_date),
241
- patientId: raw.patient_id,
242
- user: { id: raw.user_id, email: raw.email, phone: raw.phone },
243
- vcToken: raw.vc_token,
244
- appointment: raw.appointment_id
245
- ? {
246
- id: raw.appointment_id,
247
- date: utils_1.parseDateTime(`${raw.appointment_date} ${raw.appointment_time}`, raw.time_zone),
248
- }
249
- : undefined,
250
- videoVisit: raw.video_visit_id
251
- ? { id: raw.video_visit_id, status: raw.video_visit_status }
252
- : undefined,
253
- paymentStatus: (_a = raw.payment_status) !== null && _a !== void 0 ? _a : undefined,
254
- atentionId: (_b = raw.atentionId) !== null && _b !== void 0 ? _b : undefined,
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),
261
- };
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
- });
275
- const mapHistoricalVideoVisit = (raw) => {
276
- return {
277
- ...mapVideoVisit(raw),
278
- professional: raw.professional,
279
- specialty: raw.specialty,
280
- medications: raw.medications != null ? Boolean(raw.medications) : undefined,
281
- practices: raw.practices != null ? Boolean(raw.practices) : undefined,
282
- };
283
- };
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getVideoVisitMethods = void 0;
7
+ const zod_1 = require("zod");
8
+ const validation_1 = require("../request/validation");
9
+ const schemas_1 = require("../schemas");
10
+ const utils_1 = require("../utils");
11
+ const fs_1 = __importDefault(require("fs"));
12
+ const form_data_1 = __importDefault(require("form-data"));
13
+ const getVideoVisitMethods = (makeRequest) => {
14
+ const scheduleVideoVisit = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.scheduleParameters]), zod_1.string(), async (params) => {
15
+ const specificParams = params.type === 'appointment'
16
+ ? {
17
+ type: 'P',
18
+ appointment_id: params.appointmentId,
19
+ modaility: params.modality || 'A',
20
+ }
21
+ : { type: 'E' };
22
+ const mappedParams = {
23
+ ...specificParams,
24
+ patient_id: params.patientId,
25
+ specialty_id: params.specialtyId,
26
+ language: params.language.toUpperCase(),
27
+ details: params.details,
28
+ extra_info: params.extraInfo,
29
+ };
30
+ const response = await makeRequest('POST', '/video-visit', mappedParams);
31
+ return response.data.vc_token;
32
+ });
33
+ const cancelVideoVisit = validation_1.validateFunction(zod_1.tuple([zod_1.string()]), zod_1.undefined(), async (vcToken) => {
34
+ const path = `/video-visit/${vcToken}`;
35
+ await makeRequest('DELETE', path);
36
+ });
37
+ const getVideoVisit = validation_1.validateFunction(zod_1.tuple([zod_1.string(), zod_1.number()]), schemas_1.doc24Schemas.videoVisit, async (vcToken, patientId) => {
38
+ const path = `/video-visit/${vcToken}/${patientId}`;
39
+ const response = await makeRequest('GET', path);
40
+ return mapVideoVisit(response.data);
41
+ });
42
+ const getPatientVideoVisitHistory = validation_1.validateFunction(zod_1.tuple([zod_1.number()]), zod_1.array(schemas_1.doc24Schemas.historicalVideoVisit), async (patientId) => {
43
+ const path = `/video-visit-history/${patientId}`;
44
+ const response = await makeRequest('GET', path);
45
+ return response.data.map((raw) => mapHistoricalVideoVisit(raw));
46
+ });
47
+ const getVideoVisitDetails = validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.videoVisitDetails, async (vcId) => {
48
+ const path = `/video-visit-records/${vcId}`;
49
+ const response = await makeRequest('GET', path);
50
+ return {
51
+ id: response.data.consultation_id,
52
+ status: response.data.status,
53
+ paymentStatus: response.data.payment_status,
54
+ professional: response.data.professional_id
55
+ ? {
56
+ id: response.data.professional_id,
57
+ fullName: response.data.professional,
58
+ }
59
+ : undefined,
60
+ patient: {
61
+ fullName: response.data.patient,
62
+ firstAccessDate: response.data.patient_first_access_date &&
63
+ utils_1.parseDateTime(response.data.patient_first_access_date),
64
+ lastAccessDate: response.data.patient_last_access_date &&
65
+ utils_1.parseDateTime(response.data.patient_last_access_date),
66
+ },
67
+ finishDate: response.data.finish_date &&
68
+ utils_1.parseDateTime(response.data.finish_date),
69
+ retries: response.data.retries,
70
+ language: response.data.language,
71
+ appointment: response.data.appointment_id
72
+ ? {
73
+ id: response.data.appointment_id,
74
+ date: utils_1.parseDateTime(`${response.data.appointment_date} ${response.data.appointment_time}`, response.data.time_zone),
75
+ }
76
+ : null,
77
+ report: {
78
+ motive: response.data.motive,
79
+ actualDesease: response.data.actual_desease,
80
+ indications: response.data.indications,
81
+ alertSigns: response.data.alert_signs,
82
+ extendedMotive: response.data.extended_motive,
83
+ diagnose: response.data.diagnose.map((d) => ({
84
+ description: d.diagnostico,
85
+ code: d.codificacion,
86
+ })),
87
+ },
88
+ pdf: {
89
+ atention: response.data.pdf_atention
90
+ ? response.data.pdf_atention
91
+ : undefined,
92
+ medication: response.data.pdf_medication,
93
+ images: response.data.pdf_images
94
+ ? response.data.pdf_images
95
+ : undefined,
96
+ otherExams: response.data.pdf_other_exams
97
+ ? response.data.pdf_other_exams
98
+ : undefined,
99
+ labs: response.data.pdf_labs ? response.data.pdf_labs : undefined,
100
+ },
101
+ files: response.data.files.map((f) => ({
102
+ name: f.nombre_file,
103
+ url: f.file,
104
+ })),
105
+ };
106
+ });
107
+ const getActiveVideoVisits = validation_1.validateFunction(zod_1.tuple([]), zod_1.array(schemas_1.doc24Schemas.activeVideoVisitData), async () => {
108
+ const path = '/active-video-visits';
109
+ const response = await makeRequest('GET', path);
110
+ const consultations = response.data['active-consultations'];
111
+ return consultations.map((s) => ({
112
+ patientId: s.patient_id,
113
+ consultationId: s.consultation_id,
114
+ vcToken: s.vc_token,
115
+ }));
116
+ });
117
+ const getVideoVisitLink = validation_1.validateFunction(zod_1.tuple([zod_1.string(), zod_1.number()]), zod_1.string().nullable(), async (vcToken, patientId) => {
118
+ const path = `/video-visit-link/${vcToken}/${patientId}`;
119
+ const response = await makeRequest('GET', path);
120
+ return response.data.link;
121
+ });
122
+ const getCompleteVideoVisitDetails = validation_1.validateFunction(zod_1.tuple([zod_1.string()]), schemas_1.doc24Schemas.completeVideoVisitDetails, async (vcToken) => {
123
+ const path = `/consultation/${vcToken}`;
124
+ const response = await makeRequest('GET', path);
125
+ return {
126
+ id: response.data.id_consulta,
127
+ status: response.data.estado,
128
+ paymentStatus: response.data.estado_pago,
129
+ professional: response.data.id_profesional
130
+ ? {
131
+ id: response.data.id_profesional,
132
+ fullName: response.data.profesional,
133
+ specialtyId: response.data.id_especialidad,
134
+ specialty: response.data.especialidad,
135
+ }
136
+ : undefined,
137
+ finishDate: response.data.fecha_fin && utils_1.parseDateTime(response.data.fecha_fin),
138
+ retries: response.data.intentos_conexion,
139
+ language: response.data.tag_idioma,
140
+ report: {
141
+ motive: response.data.motivo,
142
+ actualDesease: response.data.enfermedad_actual,
143
+ indications: response.data.conducta_terapeutica,
144
+ alertSigns: response.data.signos_alerta,
145
+ extendedMotive: response.data.motivo_extendido_consulta,
146
+ diagnose: response.data.diagnostico.map((d) => ({
147
+ description: d.diagnostico,
148
+ code: d.codificacion,
149
+ })),
150
+ medication: response.data.medicacion.map((m) => ({
151
+ description: m.detalle_producto,
152
+ quantity: m.cantidad,
153
+ dose: m.dosificacion,
154
+ farmalinkId: m.id_prescripcion_farmalink,
155
+ })),
156
+ prescription: {
157
+ link: response.data.link_receta,
158
+ codigo: response.data.codigo_verificacion_receta,
159
+ },
160
+ inPersonRequired: response.data.presencial_requerida,
161
+ referral: {
162
+ status: response.data.derivada,
163
+ specialtyId: response.data.derivada_id_especialidad,
164
+ inPersonRequired: response.data.derivada_presencial_obligatoria,
165
+ comments: response.data.derivada_comentarios,
166
+ },
167
+ },
168
+ pdf: {
169
+ atention: response.data.pdf_atencion
170
+ ? response.data.pdf_atencion
171
+ : undefined,
172
+ medication: response.data.pdf_medicacion,
173
+ images: response.data.pdf_imagenes
174
+ ? response.data.pdf_imagenes
175
+ : undefined,
176
+ otherExams: response.data.pdf_otras
177
+ ? response.data.pdf_otras
178
+ : undefined,
179
+ labs: response.data.pdf_laboratorios
180
+ ? response.data.pdf_laboratorios
181
+ : undefined,
182
+ certificate: response.data.pdf_certificado
183
+ ? response.data.pdf_certificado
184
+ : undefined,
185
+ },
186
+ files: response.data.files_atencion.map((f) => ({
187
+ name: f.nombre_file,
188
+ url: f.file,
189
+ })),
190
+ };
191
+ });
192
+ const uploadFileConsultation = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.uploadFileConsultationParams]), zod_1.any(), async (params) => {
193
+ const form = new form_data_1.default();
194
+ form.append('vc_token', params.vcToken);
195
+ form.append('attached_file', fs_1.default.createReadStream(params.attachedFile));
196
+ if (params.fileName)
197
+ form.append('file_name', params.fileName);
198
+ const response = await makeRequest('POST', '/upload-file-consultation', form);
199
+ return response.data;
200
+ });
201
+ return {
202
+ scheduleVideoVisit,
203
+ cancelVideoVisit,
204
+ getVideoVisit,
205
+ getPatientVideoVisitHistory,
206
+ getVideoVisitDetails,
207
+ getVideoVisitLink,
208
+ getActiveVideoVisits,
209
+ getCompleteVideoVisitDetails,
210
+ uploadFileConsultation,
211
+ };
212
+ };
213
+ exports.getVideoVisitMethods = getVideoVisitMethods;
214
+ const mapVideoVisit = (raw) => {
215
+ var _a, _b, _c;
216
+ return {
217
+ id: raw.vc_id,
218
+ creationDate: utils_1.parseDateTime(raw.creation_date),
219
+ patientId: raw.patient_id,
220
+ user: { id: raw.user_id, email: raw.email, phone: raw.phone },
221
+ vcToken: raw.vc_token,
222
+ appointment: raw.appointment_id
223
+ ? {
224
+ id: raw.appointment_id,
225
+ date: utils_1.parseDateTime(`${raw.appointment_date} ${raw.appointment_time}`, raw.time_zone),
226
+ }
227
+ : undefined,
228
+ videoVisit: raw.video_visit_id
229
+ ? { id: raw.video_visit_id, status: raw.video_visit_status }
230
+ : undefined,
231
+ paymentStatus: (_a = raw.payment_status) !== null && _a !== void 0 ? _a : undefined,
232
+ atentionId: (_b = raw.atentionId) !== null && _b !== void 0 ? _b : undefined,
233
+ waitingTime: (_c = raw.waiting_time) !== null && _c !== void 0 ? _c : undefined,
234
+ };
235
+ };
236
+ const mapHistoricalVideoVisit = (raw) => {
237
+ return {
238
+ ...mapVideoVisit(raw),
239
+ professional: raw.professional,
240
+ specialty: raw.specialty,
241
+ };
242
+ };
package/lib/utils.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- export declare const parseDate: (str: string, timeZone?: string | null | undefined) => Date;
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;
4
- export declare const normalizeTimezoneOffset: (raw?: string | undefined, defualtTimezone?: number) => string | undefined;
1
+ export declare const parseDate: (str: string, timeZone?: string | null | undefined) => Date;
2
+ export declare const parseDateTime: (str: string, timeZone?: string | null | undefined) => Date;
3
+ export declare const normalizeTimezoneOffset: (raw?: string | undefined, defualtTimezone?: number) => string | undefined;