@integraciones_doc24/sdk 1.14.5 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/baseSdk/external.d.ts +0 -29
- package/lib/baseSdk/external.js +0 -57
- package/lib/index.d.ts +0 -29
- package/lib/types.d.ts +4 -4
- package/lib/userSdk/external.d.ts +32 -0
- package/lib/userSdk/external.js +69 -0
- package/lib/userSdk/index.js +3 -0
- package/package.json +1 -1
|
@@ -174,33 +174,4 @@ export declare const getExternalMethods: (makeRequest: RequestMaker) => {
|
|
|
174
174
|
emailCode?: undefined;
|
|
175
175
|
phoneCode: string;
|
|
176
176
|
})) => Promise<any>;
|
|
177
|
-
getExternalStudiesHistoryLink: (patient: {
|
|
178
|
-
identificationType: "DNI";
|
|
179
|
-
identificationValue: string;
|
|
180
|
-
birthdate: Date;
|
|
181
|
-
gender: "m" | "f";
|
|
182
|
-
}) => Promise<string | null>;
|
|
183
|
-
getExternalAppointmentsLink: (identificationValue: string, birthdate: Date) => Promise<string | null>;
|
|
184
|
-
getExternalAppointments: () => Promise<{
|
|
185
|
-
date: Date;
|
|
186
|
-
birthdate: Date;
|
|
187
|
-
appointment: string;
|
|
188
|
-
id: number;
|
|
189
|
-
specialty: string;
|
|
190
|
-
patientName: string;
|
|
191
|
-
clinic: string;
|
|
192
|
-
professionalName: string;
|
|
193
|
-
modality: string;
|
|
194
|
-
}[]>;
|
|
195
|
-
cancelExternalAppointment: (appointmentId: {
|
|
196
|
-
date: Date;
|
|
197
|
-
birthdate: Date;
|
|
198
|
-
appointment: string;
|
|
199
|
-
id: number;
|
|
200
|
-
specialty: string;
|
|
201
|
-
patientName: string;
|
|
202
|
-
clinic: string;
|
|
203
|
-
professionalName: string;
|
|
204
|
-
modality: string;
|
|
205
|
-
}) => Promise<void>;
|
|
206
177
|
};
|
package/lib/baseSdk/external.js
CHANGED
|
@@ -5,7 +5,6 @@ const date_fns_1 = require("date-fns");
|
|
|
5
5
|
const zod_1 = require("zod");
|
|
6
6
|
const validation_1 = require("../request/validation");
|
|
7
7
|
const schemas_1 = require("../schemas");
|
|
8
|
-
const utils_1 = require("../utils");
|
|
9
8
|
const getExternalMethods = (makeRequest) => {
|
|
10
9
|
const externalLogin = async ({ user, password, }) => {
|
|
11
10
|
const path = '/external-login';
|
|
@@ -85,50 +84,6 @@ const getExternalMethods = (makeRequest) => {
|
|
|
85
84
|
});
|
|
86
85
|
return response.data;
|
|
87
86
|
};
|
|
88
|
-
const getExternalStudiesHistoryLink = async (patient) => {
|
|
89
|
-
var _a, _b;
|
|
90
|
-
const path = '/history-external-studies';
|
|
91
|
-
const response = await makeRequest('POST', path, {
|
|
92
|
-
patient: mapPatientData(patient),
|
|
93
|
-
});
|
|
94
|
-
return (_b = (_a = response.data.info) === null || _a === void 0 ? void 0 : _a.link) !== null && _b !== void 0 ? _b : null;
|
|
95
|
-
};
|
|
96
|
-
const getExternalAppointmentsLink = async (identificationValue, birthdate) => {
|
|
97
|
-
const path = `/external-appointments-link/${identificationValue}/${date_fns_1.format(birthdate, 'yyyy-MM-dd')}`;
|
|
98
|
-
const response = await makeRequest('GET', path);
|
|
99
|
-
return response.data.link;
|
|
100
|
-
};
|
|
101
|
-
const getExternalAppointments = async () => {
|
|
102
|
-
const path = '/external-appointments';
|
|
103
|
-
const response = await makeRequest('GET', path);
|
|
104
|
-
return response.data.appointments.map((a) => ({
|
|
105
|
-
id: a.appointment_id,
|
|
106
|
-
patientName: a.patient_name,
|
|
107
|
-
birthdate: utils_1.parseDate(a.birthdate),
|
|
108
|
-
appointment: a.appointment,
|
|
109
|
-
clinic: a.clinic,
|
|
110
|
-
professionalName: a.professional,
|
|
111
|
-
date: utils_1.parseDateTime(`${a.day} ${a.hour}:00`),
|
|
112
|
-
specialty: a.specialty,
|
|
113
|
-
modality: a.modality,
|
|
114
|
-
}));
|
|
115
|
-
};
|
|
116
|
-
const cancelExternalAppointment = async (appointment) => {
|
|
117
|
-
const path = `/cancel-external-appointment`;
|
|
118
|
-
await makeRequest('POST', path, {
|
|
119
|
-
appointment_id: appointment.id,
|
|
120
|
-
patient_name: appointment.patientName,
|
|
121
|
-
birthdate: date_fns_1.format(appointment.birthdate, 'yyyy-MM-dd'),
|
|
122
|
-
appointment: appointment.appointment,
|
|
123
|
-
clinic: appointment.clinic,
|
|
124
|
-
professional: appointment.professionalName,
|
|
125
|
-
day: date_fns_1.format(appointment.date, 'yyyy-MM-dd'),
|
|
126
|
-
hour: date_fns_1.format(appointment.date, 'HH:mm'),
|
|
127
|
-
specialty: appointment.specialty,
|
|
128
|
-
modality: appointment.modality,
|
|
129
|
-
});
|
|
130
|
-
return;
|
|
131
|
-
};
|
|
132
87
|
return {
|
|
133
88
|
externalLogin: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalLoginParams]), schemas_1.doc24Schemas.externalLoginResponse, externalLogin),
|
|
134
89
|
preExternalEnrollment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.preExternalEnrollmentParams]), zod_1.void(), preExternalEnrollment),
|
|
@@ -136,18 +91,6 @@ const getExternalMethods = (makeRequest) => {
|
|
|
136
91
|
sendExternalVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.sendExternalVerificationCodeParams]), zod_1.void(), sendExternalVerificationCode),
|
|
137
92
|
verifyExternalVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.verifyExternalVerificationCodeParams]), zod_1.any(), verifyExternalVerificationCode),
|
|
138
93
|
externalResetPassword: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalResetPasswordParams]), zod_1.any(), externalResetPassword),
|
|
139
|
-
getExternalStudiesHistoryLink: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalPatient]), zod_1.string().nullable(), getExternalStudiesHistoryLink),
|
|
140
|
-
getExternalAppointmentsLink: validation_1.validateFunction(zod_1.tuple([zod_1.string(), zod_1.date()]), zod_1.string().nullable(), getExternalAppointmentsLink),
|
|
141
|
-
getExternalAppointments: validation_1.validateFunction(zod_1.tuple([]), zod_1.array(schemas_1.doc24Schemas.externalAppointment), getExternalAppointments),
|
|
142
|
-
cancelExternalAppointment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalAppointment]), zod_1.void(), cancelExternalAppointment),
|
|
143
94
|
};
|
|
144
95
|
};
|
|
145
96
|
exports.getExternalMethods = getExternalMethods;
|
|
146
|
-
const mapPatientData = (patient) => {
|
|
147
|
-
return {
|
|
148
|
-
birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
|
|
149
|
-
id_type: 'dni',
|
|
150
|
-
id_value: patient.identificationValue,
|
|
151
|
-
gender: patient.gender.toLocaleUpperCase(),
|
|
152
|
-
};
|
|
153
|
-
};
|
package/lib/index.d.ts
CHANGED
|
@@ -360,34 +360,5 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
|
|
|
360
360
|
emailCode?: undefined;
|
|
361
361
|
phoneCode: string;
|
|
362
362
|
})) => Promise<any>;
|
|
363
|
-
getExternalStudiesHistoryLink: (patient: {
|
|
364
|
-
identificationType: "DNI";
|
|
365
|
-
identificationValue: string;
|
|
366
|
-
birthdate: Date;
|
|
367
|
-
gender: "m" | "f";
|
|
368
|
-
}) => Promise<string | null>;
|
|
369
|
-
getExternalAppointmentsLink: (identificationValue: string, birthdate: Date) => Promise<string | null>;
|
|
370
|
-
getExternalAppointments: () => Promise<{
|
|
371
|
-
date: Date;
|
|
372
|
-
birthdate: Date;
|
|
373
|
-
appointment: string;
|
|
374
|
-
id: number;
|
|
375
|
-
specialty: string;
|
|
376
|
-
patientName: string;
|
|
377
|
-
clinic: string;
|
|
378
|
-
professionalName: string;
|
|
379
|
-
modality: string;
|
|
380
|
-
}[]>;
|
|
381
|
-
cancelExternalAppointment: (appointmentId: {
|
|
382
|
-
date: Date;
|
|
383
|
-
birthdate: Date;
|
|
384
|
-
appointment: string;
|
|
385
|
-
id: number;
|
|
386
|
-
specialty: string;
|
|
387
|
-
patientName: string;
|
|
388
|
-
clinic: string;
|
|
389
|
-
professionalName: string;
|
|
390
|
-
modality: string;
|
|
391
|
-
}) => Promise<void>;
|
|
392
363
|
}>;
|
|
393
364
|
export type { Doc24 } from './types';
|
package/lib/types.d.ts
CHANGED
|
@@ -63,10 +63,6 @@ export declare namespace Doc24 {
|
|
|
63
63
|
sendExternalVerificationCode: (params: SendExternalVerificationCodeParams) => Promise<void>;
|
|
64
64
|
verifyExternalVerificationCode: (params: VerifyExternalVerificationCodeParams) => Promise<any>;
|
|
65
65
|
externalResetPassword: (params: ExternalResetPasswordParams) => Promise<any>;
|
|
66
|
-
getExternalStudiesHistoryLink: (patient: ExternalPatient) => Promise<string | null>;
|
|
67
|
-
getExternalAppointmentsLink: (identificationValue: string, birthdate: Date) => Promise<string | null>;
|
|
68
|
-
getExternalAppointments: () => Promise<ExternalAppointment[]>;
|
|
69
|
-
cancelExternalAppointment: (appointmentId: ExternalAppointment) => Promise<void>;
|
|
70
66
|
};
|
|
71
67
|
type UserSdk = {
|
|
72
68
|
declarePatient: (params: DeclarePatientParams) => Promise<DeclarePatientResponse>;
|
|
@@ -90,6 +86,10 @@ export declare namespace Doc24 {
|
|
|
90
86
|
getChatPosts: (chatId: number) => Promise<ChatPost[]>;
|
|
91
87
|
cancelChat: (chatId: number) => Promise<void>;
|
|
92
88
|
sendChatMessage: (chatId: number, message: string) => Promise<number>;
|
|
89
|
+
getExternalStudiesHistoryLink: (patient: ExternalPatient) => Promise<string | null>;
|
|
90
|
+
getExternalAppointmentsLink: (identificationValue: string, birthdate: Date) => Promise<string | null>;
|
|
91
|
+
getExternalAppointments: () => Promise<ExternalAppointment[]>;
|
|
92
|
+
cancelExternalAppointment: (appointmentId: ExternalAppointment) => Promise<void>;
|
|
93
93
|
userId: number;
|
|
94
94
|
};
|
|
95
95
|
namespace Webhook {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { RequestMaker } from '../request';
|
|
2
|
+
export declare const getExternalMethods: (makeRequest: RequestMaker) => {
|
|
3
|
+
getExternalStudiesHistoryLink: (patient: {
|
|
4
|
+
identificationType: "DNI";
|
|
5
|
+
identificationValue: string;
|
|
6
|
+
birthdate: Date;
|
|
7
|
+
gender: "m" | "f";
|
|
8
|
+
}) => Promise<string | null>;
|
|
9
|
+
getExternalAppointmentsLink: (identificationValue: string, birthdate: Date) => Promise<string | null>;
|
|
10
|
+
getExternalAppointments: () => Promise<{
|
|
11
|
+
date: Date;
|
|
12
|
+
birthdate: Date;
|
|
13
|
+
appointment: string;
|
|
14
|
+
id: number;
|
|
15
|
+
specialty: string;
|
|
16
|
+
patientName: string;
|
|
17
|
+
clinic: string;
|
|
18
|
+
professionalName: string;
|
|
19
|
+
modality: string;
|
|
20
|
+
}[]>;
|
|
21
|
+
cancelExternalAppointment: (appointmentId: {
|
|
22
|
+
date: Date;
|
|
23
|
+
birthdate: Date;
|
|
24
|
+
appointment: string;
|
|
25
|
+
id: number;
|
|
26
|
+
specialty: string;
|
|
27
|
+
patientName: string;
|
|
28
|
+
clinic: string;
|
|
29
|
+
professionalName: string;
|
|
30
|
+
modality: string;
|
|
31
|
+
}) => Promise<void>;
|
|
32
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getExternalMethods = void 0;
|
|
4
|
+
const date_fns_1 = require("date-fns");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const validation_1 = require("../request/validation");
|
|
7
|
+
const schemas_1 = require("../schemas");
|
|
8
|
+
const utils_1 = require("../utils");
|
|
9
|
+
const getExternalMethods = (makeRequest) => {
|
|
10
|
+
const getExternalStudiesHistoryLink = async (patient) => {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
const path = '/history-external-studies';
|
|
13
|
+
const response = await makeRequest('POST', path, {
|
|
14
|
+
patient: mapPatientData(patient),
|
|
15
|
+
});
|
|
16
|
+
return (_b = (_a = response.data.info) === null || _a === void 0 ? void 0 : _a.link) !== null && _b !== void 0 ? _b : null;
|
|
17
|
+
};
|
|
18
|
+
const getExternalAppointmentsLink = async (identificationValue, birthdate) => {
|
|
19
|
+
const path = `/external-appointments-link/${identificationValue}/${date_fns_1.format(birthdate, 'yyyy-MM-dd')}`;
|
|
20
|
+
const response = await makeRequest('GET', path);
|
|
21
|
+
return response.data.link;
|
|
22
|
+
};
|
|
23
|
+
const getExternalAppointments = async () => {
|
|
24
|
+
const path = '/external-appointments';
|
|
25
|
+
const response = await makeRequest('GET', path);
|
|
26
|
+
return response.data.appointments.map((a) => ({
|
|
27
|
+
id: a.appointment_id,
|
|
28
|
+
patientName: a.patient_name,
|
|
29
|
+
birthdate: utils_1.parseDate(a.birthdate),
|
|
30
|
+
appointment: a.appointment,
|
|
31
|
+
clinic: a.clinic,
|
|
32
|
+
professionalName: a.professional,
|
|
33
|
+
date: utils_1.parseDateTime(`${a.day} ${a.hour}:00`),
|
|
34
|
+
specialty: a.specialty,
|
|
35
|
+
modality: a.modality,
|
|
36
|
+
}));
|
|
37
|
+
};
|
|
38
|
+
const cancelExternalAppointment = async (appointment) => {
|
|
39
|
+
const path = `/cancel-external-appointment`;
|
|
40
|
+
await makeRequest('POST', path, {
|
|
41
|
+
appointment_id: appointment.id,
|
|
42
|
+
patient_name: appointment.patientName,
|
|
43
|
+
birthdate: date_fns_1.format(appointment.birthdate, 'yyyy-MM-dd'),
|
|
44
|
+
appointment: appointment.appointment,
|
|
45
|
+
clinic: appointment.clinic,
|
|
46
|
+
professional: appointment.professionalName,
|
|
47
|
+
day: date_fns_1.format(appointment.date, 'yyyy-MM-dd'),
|
|
48
|
+
hour: date_fns_1.format(appointment.date, 'HH:mm'),
|
|
49
|
+
specialty: appointment.specialty,
|
|
50
|
+
modality: appointment.modality,
|
|
51
|
+
});
|
|
52
|
+
return;
|
|
53
|
+
};
|
|
54
|
+
return {
|
|
55
|
+
getExternalStudiesHistoryLink: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalPatient]), zod_1.string().nullable(), getExternalStudiesHistoryLink),
|
|
56
|
+
getExternalAppointmentsLink: validation_1.validateFunction(zod_1.tuple([zod_1.string(), zod_1.date()]), zod_1.string().nullable(), getExternalAppointmentsLink),
|
|
57
|
+
getExternalAppointments: validation_1.validateFunction(zod_1.tuple([]), zod_1.array(schemas_1.doc24Schemas.externalAppointment), getExternalAppointments),
|
|
58
|
+
cancelExternalAppointment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalAppointment]), zod_1.void(), cancelExternalAppointment),
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
exports.getExternalMethods = getExternalMethods;
|
|
62
|
+
const mapPatientData = (patient) => {
|
|
63
|
+
return {
|
|
64
|
+
birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
|
|
65
|
+
id_type: 'dni',
|
|
66
|
+
id_value: patient.identificationValue,
|
|
67
|
+
gender: patient.gender.toLocaleUpperCase(),
|
|
68
|
+
};
|
|
69
|
+
};
|
package/lib/userSdk/index.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.userSdk = void 0;
|
|
4
4
|
const request_1 = require("../request");
|
|
5
5
|
const chat_1 = require("./chat");
|
|
6
|
+
const external_1 = require("./external");
|
|
6
7
|
const patients_1 = require("./patients");
|
|
7
8
|
const schedule_1 = require("./schedule");
|
|
8
9
|
const specialties_1 = require("./specialties");
|
|
@@ -14,12 +15,14 @@ const userSdk = async (url, credentials, userId) => {
|
|
|
14
15
|
const scheduleMethods = schedule_1.getScheduleMethods(makeRequest);
|
|
15
16
|
const videoVisitMethods = videoVisit_1.getVideoVisitMethods(makeRequest);
|
|
16
17
|
const chatMethods = chat_1.getChatMethods(makeRequest);
|
|
18
|
+
const externalMethods = external_1.getExternalMethods(makeRequest);
|
|
17
19
|
const sdk = {
|
|
18
20
|
...patientMethods,
|
|
19
21
|
...specialtyMethods,
|
|
20
22
|
...scheduleMethods,
|
|
21
23
|
...videoVisitMethods,
|
|
22
24
|
...chatMethods,
|
|
25
|
+
...externalMethods,
|
|
23
26
|
userId,
|
|
24
27
|
};
|
|
25
28
|
return sdk;
|