@integraciones_doc24/sdk 1.5.1 → 1.7.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/README.md +1 -1
- package/lib/baseSdk/diagnostica.js +20 -18
- package/lib/baseSdk/external.d.ts +162 -0
- package/lib/baseSdk/external.js +75 -0
- package/lib/baseSdk/index.js +3 -0
- package/lib/baseSdk/user.js +1 -1
- package/lib/index.d.ts +159 -0
- package/lib/schemas.d.ts +238 -1
- package/lib/schemas.js +50 -2
- package/lib/types.d.ts +13 -2
- package/lib/userSdk/schedule.d.ts +1 -0
- package/lib/userSdk/schedule.js +14 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -80,7 +80,7 @@ type BaseSdk = {
|
|
|
80
80
|
getAvailableScheduleClinics: () => Promise<AvailableScheduleClinics>;
|
|
81
81
|
enroll: (params: EnrollmentParams) => Promise<void>;
|
|
82
82
|
getCoverageInfo: (identificationValue: string) => Promise<CoverageInfo>;
|
|
83
|
-
getVerificationCode: (params:
|
|
83
|
+
getVerificationCode: (params: VerificationCodeParams) => Promise<void>;
|
|
84
84
|
getDiagnosticaHistory: (
|
|
85
85
|
patient: DiagnosticaPatientFilter,
|
|
86
86
|
from: Date,
|
|
@@ -6,14 +6,12 @@ const zod_1 = require("zod");
|
|
|
6
6
|
const validation_1 = require("../request/validation");
|
|
7
7
|
const schemas_1 = require("../schemas");
|
|
8
8
|
const getDiagnosticaMethods = (makeRequest) => {
|
|
9
|
-
const getDiagnosticaHistory =
|
|
9
|
+
const getDiagnosticaHistory = async (patient, from, to) => {
|
|
10
10
|
const path = '/history-diagnostica';
|
|
11
11
|
const response = await makeRequest('POST', path, {
|
|
12
12
|
patient: {
|
|
13
13
|
gender: patient.gender,
|
|
14
|
-
id_type: patient.identificationType
|
|
15
|
-
? 'DNI'
|
|
16
|
-
: patient.identificationType,
|
|
14
|
+
id_type: patient.identificationType,
|
|
17
15
|
id_value: patient.identificationValue,
|
|
18
16
|
},
|
|
19
17
|
dateFrom: from.toISOString(),
|
|
@@ -26,12 +24,8 @@ const getDiagnosticaMethods = (makeRequest) => {
|
|
|
26
24
|
exams: i.exams,
|
|
27
25
|
deepLink: i.deeplink,
|
|
28
26
|
}));
|
|
29
|
-
}
|
|
30
|
-
const getDiagnosticaDeepLink =
|
|
31
|
-
zod_1.string(),
|
|
32
|
-
schemas_1.doc24Schemas.diagnosticaUser,
|
|
33
|
-
schemas_1.doc24Schemas.diagnosticaPatient,
|
|
34
|
-
]), schemas_1.doc24Schemas.diagnosticaDeepLinkResponse, async (kiosk, user, patient) => {
|
|
27
|
+
};
|
|
28
|
+
const getDiagnosticaDeepLink = async (kiosk, user, patient) => {
|
|
35
29
|
const path = '/deeplink-diagnostica';
|
|
36
30
|
const response = await makeRequest('POST', path, {
|
|
37
31
|
kiosk,
|
|
@@ -42,12 +36,8 @@ const getDiagnosticaMethods = (makeRequest) => {
|
|
|
42
36
|
if (data.forwarding_required)
|
|
43
37
|
return { forwardingRequired: true, deepLink: data.deeplink };
|
|
44
38
|
return { forwardingRequired: false };
|
|
45
|
-
}
|
|
46
|
-
const getDiagnosticaAccess =
|
|
47
|
-
zod_1.string(),
|
|
48
|
-
schemas_1.doc24Schemas.diagnosticaUser,
|
|
49
|
-
schemas_1.doc24Schemas.diagnosticaPatient,
|
|
50
|
-
]), zod_1.void(), async (kiosk, user, patient) => {
|
|
39
|
+
};
|
|
40
|
+
const getDiagnosticaAccess = async (kiosk, user, patient) => {
|
|
51
41
|
const path = '/access-diagnostica';
|
|
52
42
|
await makeRequest('POST', path, {
|
|
53
43
|
kiosk,
|
|
@@ -55,8 +45,20 @@ const getDiagnosticaMethods = (makeRequest) => {
|
|
|
55
45
|
patient: mapPatientData(patient),
|
|
56
46
|
});
|
|
57
47
|
return;
|
|
58
|
-
}
|
|
59
|
-
return {
|
|
48
|
+
};
|
|
49
|
+
return {
|
|
50
|
+
getDiagnosticaHistory: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.diagnosticaPatientFilter, zod_1.date(), zod_1.date()]), schemas_1.doc24Schemas.diagnosticaHistoryAppointment.array(), getDiagnosticaHistory),
|
|
51
|
+
getDiagnosticaDeepLink: validation_1.validateFunction(zod_1.tuple([
|
|
52
|
+
zod_1.string(),
|
|
53
|
+
schemas_1.doc24Schemas.diagnosticaUser,
|
|
54
|
+
schemas_1.doc24Schemas.diagnosticaPatient,
|
|
55
|
+
]), schemas_1.doc24Schemas.diagnosticaDeepLinkResponse, getDiagnosticaDeepLink),
|
|
56
|
+
getDiagnosticaAccess: validation_1.validateFunction(zod_1.tuple([
|
|
57
|
+
zod_1.string(),
|
|
58
|
+
schemas_1.doc24Schemas.diagnosticaUser,
|
|
59
|
+
schemas_1.doc24Schemas.diagnosticaPatient,
|
|
60
|
+
]), zod_1.void(), getDiagnosticaAccess),
|
|
61
|
+
};
|
|
60
62
|
};
|
|
61
63
|
exports.getDiagnosticaMethods = getDiagnosticaMethods;
|
|
62
64
|
const mapPatientData = (patient) => {
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { RequestMaker } from '../request';
|
|
2
|
+
export declare const getExternalMethods: (makeRequest: RequestMaker) => {
|
|
3
|
+
externalLogin: (params: {
|
|
4
|
+
password: string;
|
|
5
|
+
user: string;
|
|
6
|
+
}) => Promise<{
|
|
7
|
+
firstName: string;
|
|
8
|
+
lastName: string;
|
|
9
|
+
countryId: string;
|
|
10
|
+
gender: "m" | "f";
|
|
11
|
+
phone: string;
|
|
12
|
+
email: string;
|
|
13
|
+
birthday: Date;
|
|
14
|
+
identificationNumber: string;
|
|
15
|
+
}>;
|
|
16
|
+
preExternalEnrollment: (params: ({
|
|
17
|
+
birthdate: Date;
|
|
18
|
+
identificationNumber: string;
|
|
19
|
+
} & {
|
|
20
|
+
phone: string;
|
|
21
|
+
email: string;
|
|
22
|
+
}) | ({
|
|
23
|
+
birthdate: Date;
|
|
24
|
+
identificationNumber: string;
|
|
25
|
+
} & {
|
|
26
|
+
phone?: undefined;
|
|
27
|
+
email: string;
|
|
28
|
+
}) | ({
|
|
29
|
+
birthdate: Date;
|
|
30
|
+
identificationNumber: string;
|
|
31
|
+
} & {
|
|
32
|
+
email?: undefined;
|
|
33
|
+
phone: string;
|
|
34
|
+
})) => Promise<any>;
|
|
35
|
+
externalEnrollment: (params: ({
|
|
36
|
+
birthdate: Date;
|
|
37
|
+
identificationNumber: string;
|
|
38
|
+
} & {
|
|
39
|
+
phone: string;
|
|
40
|
+
email: string;
|
|
41
|
+
} & {
|
|
42
|
+
password: string;
|
|
43
|
+
} & {
|
|
44
|
+
emailCode: string;
|
|
45
|
+
phoneCode: string;
|
|
46
|
+
}) | ({
|
|
47
|
+
birthdate: Date;
|
|
48
|
+
identificationNumber: string;
|
|
49
|
+
} & {
|
|
50
|
+
phone: string;
|
|
51
|
+
email: string;
|
|
52
|
+
} & {
|
|
53
|
+
password: string;
|
|
54
|
+
} & {
|
|
55
|
+
phoneCode?: undefined;
|
|
56
|
+
emailCode: string;
|
|
57
|
+
}) | ({
|
|
58
|
+
birthdate: Date;
|
|
59
|
+
identificationNumber: string;
|
|
60
|
+
} & {
|
|
61
|
+
phone: string;
|
|
62
|
+
email: string;
|
|
63
|
+
} & {
|
|
64
|
+
password: string;
|
|
65
|
+
} & {
|
|
66
|
+
emailCode?: undefined;
|
|
67
|
+
phoneCode: string;
|
|
68
|
+
}) | ({
|
|
69
|
+
birthdate: Date;
|
|
70
|
+
identificationNumber: string;
|
|
71
|
+
} & {
|
|
72
|
+
phone?: undefined;
|
|
73
|
+
email: string;
|
|
74
|
+
} & {
|
|
75
|
+
password: string;
|
|
76
|
+
} & {
|
|
77
|
+
emailCode: string;
|
|
78
|
+
phoneCode: string;
|
|
79
|
+
}) | ({
|
|
80
|
+
birthdate: Date;
|
|
81
|
+
identificationNumber: string;
|
|
82
|
+
} & {
|
|
83
|
+
phone?: undefined;
|
|
84
|
+
email: string;
|
|
85
|
+
} & {
|
|
86
|
+
password: string;
|
|
87
|
+
} & {
|
|
88
|
+
phoneCode?: undefined;
|
|
89
|
+
emailCode: string;
|
|
90
|
+
}) | ({
|
|
91
|
+
birthdate: Date;
|
|
92
|
+
identificationNumber: string;
|
|
93
|
+
} & {
|
|
94
|
+
phone?: undefined;
|
|
95
|
+
email: string;
|
|
96
|
+
} & {
|
|
97
|
+
password: string;
|
|
98
|
+
} & {
|
|
99
|
+
emailCode?: undefined;
|
|
100
|
+
phoneCode: string;
|
|
101
|
+
}) | ({
|
|
102
|
+
birthdate: Date;
|
|
103
|
+
identificationNumber: string;
|
|
104
|
+
} & {
|
|
105
|
+
email?: undefined;
|
|
106
|
+
phone: string;
|
|
107
|
+
} & {
|
|
108
|
+
password: string;
|
|
109
|
+
} & {
|
|
110
|
+
emailCode: string;
|
|
111
|
+
phoneCode: string;
|
|
112
|
+
}) | ({
|
|
113
|
+
birthdate: Date;
|
|
114
|
+
identificationNumber: string;
|
|
115
|
+
} & {
|
|
116
|
+
email?: undefined;
|
|
117
|
+
phone: string;
|
|
118
|
+
} & {
|
|
119
|
+
password: string;
|
|
120
|
+
} & {
|
|
121
|
+
phoneCode?: undefined;
|
|
122
|
+
emailCode: string;
|
|
123
|
+
}) | ({
|
|
124
|
+
birthdate: Date;
|
|
125
|
+
identificationNumber: string;
|
|
126
|
+
} & {
|
|
127
|
+
email?: undefined;
|
|
128
|
+
phone: string;
|
|
129
|
+
} & {
|
|
130
|
+
password: string;
|
|
131
|
+
} & {
|
|
132
|
+
emailCode?: undefined;
|
|
133
|
+
phoneCode: string;
|
|
134
|
+
})) => Promise<any>;
|
|
135
|
+
getExternalVerificationCode: (params: {
|
|
136
|
+
birthdate: Date;
|
|
137
|
+
channel: "1" | "2";
|
|
138
|
+
identificationNumber: string;
|
|
139
|
+
}) => Promise<any>;
|
|
140
|
+
externalResetPassword: (params: ({
|
|
141
|
+
birthdate: Date;
|
|
142
|
+
password: string;
|
|
143
|
+
identificationNumber: string;
|
|
144
|
+
} & {
|
|
145
|
+
emailCode: string;
|
|
146
|
+
phoneCode: string;
|
|
147
|
+
}) | ({
|
|
148
|
+
birthdate: Date;
|
|
149
|
+
password: string;
|
|
150
|
+
identificationNumber: string;
|
|
151
|
+
} & {
|
|
152
|
+
phoneCode?: undefined;
|
|
153
|
+
emailCode: string;
|
|
154
|
+
}) | ({
|
|
155
|
+
birthdate: Date;
|
|
156
|
+
password: string;
|
|
157
|
+
identificationNumber: string;
|
|
158
|
+
} & {
|
|
159
|
+
emailCode?: undefined;
|
|
160
|
+
phoneCode: string;
|
|
161
|
+
})) => Promise<any>;
|
|
162
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
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 getExternalMethods = (makeRequest) => {
|
|
9
|
+
const externalLogin = async ({ user, password, }) => {
|
|
10
|
+
const path = '/external-login';
|
|
11
|
+
const response = await makeRequest('POST', path, { user, password });
|
|
12
|
+
const info = response.data.login_info;
|
|
13
|
+
return {
|
|
14
|
+
firstName: info.firstname,
|
|
15
|
+
lastName: info.lastname,
|
|
16
|
+
countryId: info.country_id,
|
|
17
|
+
birthday: new Date(Date.parse(info.birthdate)),
|
|
18
|
+
identificationNumber: info.identification_number,
|
|
19
|
+
gender: info.gender === 'F' ? 'f' : 'm',
|
|
20
|
+
email: info.email,
|
|
21
|
+
phone: info.telephone,
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
const preExternalEnrollment = async (params) => {
|
|
25
|
+
const path = '/pre-external-enrollment';
|
|
26
|
+
const response = await makeRequest('POST', path, {
|
|
27
|
+
identification_number: params.identificationNumber,
|
|
28
|
+
birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
|
|
29
|
+
email: params.email,
|
|
30
|
+
telephone: params.phone,
|
|
31
|
+
});
|
|
32
|
+
return response.data;
|
|
33
|
+
};
|
|
34
|
+
const externalEnrollment = async (params) => {
|
|
35
|
+
const path = '/external-enrollment';
|
|
36
|
+
const response = await makeRequest('POST', path, {
|
|
37
|
+
identification_number: params.identificationNumber,
|
|
38
|
+
birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
|
|
39
|
+
email: params.email,
|
|
40
|
+
telephone: params.phone,
|
|
41
|
+
password: params.password,
|
|
42
|
+
email_code: params.emailCode,
|
|
43
|
+
telephone_code: params.phoneCode,
|
|
44
|
+
});
|
|
45
|
+
return response.data;
|
|
46
|
+
};
|
|
47
|
+
const getExternalVerificationCode = async (params) => {
|
|
48
|
+
const path = '/send-external-verification-code';
|
|
49
|
+
await makeRequest('POST', path, {
|
|
50
|
+
identification_number: params.identificationNumber,
|
|
51
|
+
birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
|
|
52
|
+
channel: params.channel,
|
|
53
|
+
});
|
|
54
|
+
return;
|
|
55
|
+
};
|
|
56
|
+
const externalResetPassword = async (params) => {
|
|
57
|
+
const path = '/external-reset';
|
|
58
|
+
const response = await makeRequest('POST', path, {
|
|
59
|
+
identification_number: params.identificationNumber,
|
|
60
|
+
birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
|
|
61
|
+
password: params.password,
|
|
62
|
+
email_code: params.emailCode,
|
|
63
|
+
telephone_code: params.phoneCode,
|
|
64
|
+
});
|
|
65
|
+
return response.data;
|
|
66
|
+
};
|
|
67
|
+
return {
|
|
68
|
+
externalLogin: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalLoginParams]), schemas_1.doc24Schemas.externalLoginResponse, externalLogin),
|
|
69
|
+
preExternalEnrollment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.preExternalEnrollmentParams]), zod_1.any(), preExternalEnrollment),
|
|
70
|
+
externalEnrollment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalEnrollmentParams]), zod_1.any(), externalEnrollment),
|
|
71
|
+
getExternalVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalVerificationCodeParams]), zod_1.any(), getExternalVerificationCode),
|
|
72
|
+
externalResetPassword: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalResetPasswordParams]), zod_1.any(), externalResetPassword),
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
exports.getExternalMethods = getExternalMethods;
|
package/lib/baseSdk/index.js
CHANGED
|
@@ -8,12 +8,15 @@ const schemas_1 = require("../schemas");
|
|
|
8
8
|
const utils_1 = require("../utils");
|
|
9
9
|
const diagnostica_1 = require("./diagnostica");
|
|
10
10
|
const user_1 = require("./user");
|
|
11
|
+
const external_1 = require("./external");
|
|
11
12
|
const getBaseSdk = async (url, credentials) => {
|
|
12
13
|
const makeRequest = await request_1.getRequestFactory(url, credentials);
|
|
13
14
|
const diagnosticaMethods = diagnostica_1.getDiagnosticaMethods(makeRequest);
|
|
15
|
+
const externalMethods = external_1.getExternalMethods(makeRequest);
|
|
14
16
|
const userMethods = user_1.getUserMethods(makeRequest, url, credentials);
|
|
15
17
|
const baseSdk = {
|
|
16
18
|
...diagnosticaMethods,
|
|
19
|
+
...externalMethods,
|
|
17
20
|
...userMethods,
|
|
18
21
|
getProfessional: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.professional, async (professionalId) => {
|
|
19
22
|
const path = `/professional/${professionalId}`;
|
package/lib/baseSdk/user.js
CHANGED
|
@@ -120,7 +120,7 @@ const getUserMethods = (makeRequest, url, credentials) => {
|
|
|
120
120
|
return {
|
|
121
121
|
declareUser: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.declareUserParams]), schemas_1.doc24Schemas.declareUserResponse, declareUser),
|
|
122
122
|
getUserId: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.user]), zod_1.number(), getUserId),
|
|
123
|
-
getVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.
|
|
123
|
+
getVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.verificationCodeParams]), zod_1.void(), getVerificationCode),
|
|
124
124
|
getUserInstance: validation_1.validateFunction(zod_1.tuple([zod_1.union([schemas_1.doc24Schemas.user, zod_1.number()])]),
|
|
125
125
|
// TODO: validate?
|
|
126
126
|
zod_1.any(), getUserInstance),
|
package/lib/index.d.ts
CHANGED
|
@@ -186,5 +186,164 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
|
|
|
186
186
|
gender: "m" | "f";
|
|
187
187
|
birthday: Date;
|
|
188
188
|
}) => Promise<void>;
|
|
189
|
+
externalLogin: (params: {
|
|
190
|
+
password: string;
|
|
191
|
+
user: string;
|
|
192
|
+
}) => Promise<{
|
|
193
|
+
firstName: string;
|
|
194
|
+
lastName: string;
|
|
195
|
+
countryId: string;
|
|
196
|
+
gender: "m" | "f";
|
|
197
|
+
phone: string;
|
|
198
|
+
email: string;
|
|
199
|
+
birthday: Date;
|
|
200
|
+
identificationNumber: string;
|
|
201
|
+
}>;
|
|
202
|
+
preExternalEnrollment: (params: ({
|
|
203
|
+
birthdate: Date;
|
|
204
|
+
identificationNumber: string;
|
|
205
|
+
} & {
|
|
206
|
+
phone: string;
|
|
207
|
+
email: string;
|
|
208
|
+
}) | ({
|
|
209
|
+
birthdate: Date;
|
|
210
|
+
identificationNumber: string;
|
|
211
|
+
} & {
|
|
212
|
+
phone?: undefined;
|
|
213
|
+
email: string;
|
|
214
|
+
}) | ({
|
|
215
|
+
birthdate: Date;
|
|
216
|
+
identificationNumber: string;
|
|
217
|
+
} & {
|
|
218
|
+
email?: undefined;
|
|
219
|
+
phone: string;
|
|
220
|
+
})) => Promise<void>;
|
|
221
|
+
externalEnrollment: (params: ({
|
|
222
|
+
birthdate: Date;
|
|
223
|
+
identificationNumber: string;
|
|
224
|
+
} & {
|
|
225
|
+
phone: string;
|
|
226
|
+
email: string;
|
|
227
|
+
} & {
|
|
228
|
+
password: string;
|
|
229
|
+
} & {
|
|
230
|
+
emailCode: string;
|
|
231
|
+
phoneCode: string;
|
|
232
|
+
}) | ({
|
|
233
|
+
birthdate: Date;
|
|
234
|
+
identificationNumber: string;
|
|
235
|
+
} & {
|
|
236
|
+
phone: string;
|
|
237
|
+
email: string;
|
|
238
|
+
} & {
|
|
239
|
+
password: string;
|
|
240
|
+
} & {
|
|
241
|
+
phoneCode?: undefined;
|
|
242
|
+
emailCode: string;
|
|
243
|
+
}) | ({
|
|
244
|
+
birthdate: Date;
|
|
245
|
+
identificationNumber: string;
|
|
246
|
+
} & {
|
|
247
|
+
phone: string;
|
|
248
|
+
email: string;
|
|
249
|
+
} & {
|
|
250
|
+
password: string;
|
|
251
|
+
} & {
|
|
252
|
+
emailCode?: undefined;
|
|
253
|
+
phoneCode: string;
|
|
254
|
+
}) | ({
|
|
255
|
+
birthdate: Date;
|
|
256
|
+
identificationNumber: string;
|
|
257
|
+
} & {
|
|
258
|
+
phone?: undefined;
|
|
259
|
+
email: string;
|
|
260
|
+
} & {
|
|
261
|
+
password: string;
|
|
262
|
+
} & {
|
|
263
|
+
emailCode: string;
|
|
264
|
+
phoneCode: string;
|
|
265
|
+
}) | ({
|
|
266
|
+
birthdate: Date;
|
|
267
|
+
identificationNumber: string;
|
|
268
|
+
} & {
|
|
269
|
+
phone?: undefined;
|
|
270
|
+
email: string;
|
|
271
|
+
} & {
|
|
272
|
+
password: string;
|
|
273
|
+
} & {
|
|
274
|
+
phoneCode?: undefined;
|
|
275
|
+
emailCode: string;
|
|
276
|
+
}) | ({
|
|
277
|
+
birthdate: Date;
|
|
278
|
+
identificationNumber: string;
|
|
279
|
+
} & {
|
|
280
|
+
phone?: undefined;
|
|
281
|
+
email: string;
|
|
282
|
+
} & {
|
|
283
|
+
password: string;
|
|
284
|
+
} & {
|
|
285
|
+
emailCode?: undefined;
|
|
286
|
+
phoneCode: string;
|
|
287
|
+
}) | ({
|
|
288
|
+
birthdate: Date;
|
|
289
|
+
identificationNumber: string;
|
|
290
|
+
} & {
|
|
291
|
+
email?: undefined;
|
|
292
|
+
phone: string;
|
|
293
|
+
} & {
|
|
294
|
+
password: string;
|
|
295
|
+
} & {
|
|
296
|
+
emailCode: string;
|
|
297
|
+
phoneCode: string;
|
|
298
|
+
}) | ({
|
|
299
|
+
birthdate: Date;
|
|
300
|
+
identificationNumber: string;
|
|
301
|
+
} & {
|
|
302
|
+
email?: undefined;
|
|
303
|
+
phone: string;
|
|
304
|
+
} & {
|
|
305
|
+
password: string;
|
|
306
|
+
} & {
|
|
307
|
+
phoneCode?: undefined;
|
|
308
|
+
emailCode: string;
|
|
309
|
+
}) | ({
|
|
310
|
+
birthdate: Date;
|
|
311
|
+
identificationNumber: string;
|
|
312
|
+
} & {
|
|
313
|
+
email?: undefined;
|
|
314
|
+
phone: string;
|
|
315
|
+
} & {
|
|
316
|
+
password: string;
|
|
317
|
+
} & {
|
|
318
|
+
emailCode?: undefined;
|
|
319
|
+
phoneCode: string;
|
|
320
|
+
})) => Promise<any>;
|
|
321
|
+
getExternalVerificationCode: (params: {
|
|
322
|
+
birthdate: Date;
|
|
323
|
+
channel: "1" | "2";
|
|
324
|
+
identificationNumber: string;
|
|
325
|
+
}) => Promise<void>;
|
|
326
|
+
externalResetPassword: (params: ({
|
|
327
|
+
birthdate: Date;
|
|
328
|
+
password: string;
|
|
329
|
+
identificationNumber: string;
|
|
330
|
+
} & {
|
|
331
|
+
emailCode: string;
|
|
332
|
+
phoneCode: string;
|
|
333
|
+
}) | ({
|
|
334
|
+
birthdate: Date;
|
|
335
|
+
password: string;
|
|
336
|
+
identificationNumber: string;
|
|
337
|
+
} & {
|
|
338
|
+
phoneCode?: undefined;
|
|
339
|
+
emailCode: string;
|
|
340
|
+
}) | ({
|
|
341
|
+
birthdate: Date;
|
|
342
|
+
password: string;
|
|
343
|
+
identificationNumber: string;
|
|
344
|
+
} & {
|
|
345
|
+
emailCode?: undefined;
|
|
346
|
+
phoneCode: string;
|
|
347
|
+
})) => Promise<any>;
|
|
189
348
|
}>;
|
|
190
349
|
export type { Doc24 } from './types';
|
package/lib/schemas.d.ts
CHANGED
|
@@ -278,8 +278,10 @@ export declare const doc24Schemas: {
|
|
|
278
278
|
date: import("zod").ZodOptional<import("zod").ZodDate>;
|
|
279
279
|
startHour: import("zod").ZodOptional<import("zod").ZodString>;
|
|
280
280
|
finishHour: import("zod").ZodOptional<import("zod").ZodString>;
|
|
281
|
+
language: import("zod").ZodOptional<import("zod").ZodString>;
|
|
281
282
|
}, "strip", import("zod").ZodTypeAny, {
|
|
282
283
|
date?: Date | undefined;
|
|
284
|
+
language?: string | undefined;
|
|
283
285
|
professionalId?: number | undefined;
|
|
284
286
|
offset?: number | undefined;
|
|
285
287
|
limit?: number | undefined;
|
|
@@ -288,6 +290,7 @@ export declare const doc24Schemas: {
|
|
|
288
290
|
finishHour?: string | undefined;
|
|
289
291
|
}, {
|
|
290
292
|
date?: Date | undefined;
|
|
293
|
+
language?: string | undefined;
|
|
291
294
|
professionalId?: number | undefined;
|
|
292
295
|
offset?: number | undefined;
|
|
293
296
|
limit?: number | undefined;
|
|
@@ -1111,7 +1114,7 @@ export declare const doc24Schemas: {
|
|
|
1111
1114
|
authorizationCode: string | null;
|
|
1112
1115
|
authorizationCodeExpiration: Date | null;
|
|
1113
1116
|
}>>;
|
|
1114
|
-
|
|
1117
|
+
verificationCodeParams: import("zod").ZodObject<{
|
|
1115
1118
|
identificationType: import("zod").ZodNumber;
|
|
1116
1119
|
identificationValue: import("zod").ZodString;
|
|
1117
1120
|
channel: import("zod").ZodEnum<["1", "2"]>;
|
|
@@ -1338,4 +1341,238 @@ export declare const doc24Schemas: {
|
|
|
1338
1341
|
code?: string | undefined;
|
|
1339
1342
|
channel?: "1" | "2" | undefined;
|
|
1340
1343
|
}>;
|
|
1344
|
+
externalLoginParams: import("zod").ZodObject<{
|
|
1345
|
+
user: import("zod").ZodString;
|
|
1346
|
+
password: import("zod").ZodString;
|
|
1347
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1348
|
+
password: string;
|
|
1349
|
+
user: string;
|
|
1350
|
+
}, {
|
|
1351
|
+
password: string;
|
|
1352
|
+
user: string;
|
|
1353
|
+
}>;
|
|
1354
|
+
externalLoginResponse: import("zod").ZodObject<{
|
|
1355
|
+
firstName: import("zod").ZodString;
|
|
1356
|
+
lastName: import("zod").ZodString;
|
|
1357
|
+
countryId: import("zod").ZodString;
|
|
1358
|
+
birthday: import("zod").ZodDate;
|
|
1359
|
+
identificationNumber: import("zod").ZodString;
|
|
1360
|
+
gender: import("zod").ZodEnum<["m", "f"]>;
|
|
1361
|
+
email: import("zod").ZodString;
|
|
1362
|
+
phone: import("zod").ZodString;
|
|
1363
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1364
|
+
firstName: string;
|
|
1365
|
+
lastName: string;
|
|
1366
|
+
countryId: string;
|
|
1367
|
+
gender: "m" | "f";
|
|
1368
|
+
phone: string;
|
|
1369
|
+
email: string;
|
|
1370
|
+
birthday: Date;
|
|
1371
|
+
identificationNumber: string;
|
|
1372
|
+
}, {
|
|
1373
|
+
firstName: string;
|
|
1374
|
+
lastName: string;
|
|
1375
|
+
countryId: string;
|
|
1376
|
+
gender: "m" | "f";
|
|
1377
|
+
phone: string;
|
|
1378
|
+
email: string;
|
|
1379
|
+
birthday: Date;
|
|
1380
|
+
identificationNumber: string;
|
|
1381
|
+
}>;
|
|
1382
|
+
preExternalEnrollmentParams: import("zod").ZodIntersection<import("zod").ZodObject<{
|
|
1383
|
+
identificationNumber: import("zod").ZodString;
|
|
1384
|
+
birthdate: import("zod").ZodDate;
|
|
1385
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1386
|
+
birthdate: Date;
|
|
1387
|
+
identificationNumber: string;
|
|
1388
|
+
}, {
|
|
1389
|
+
birthdate: Date;
|
|
1390
|
+
identificationNumber: string;
|
|
1391
|
+
}>, import("zod").ZodEffects<import("zod").ZodUnion<[import("zod").ZodObject<{
|
|
1392
|
+
email: import("zod").ZodString;
|
|
1393
|
+
phone: import("zod").ZodString;
|
|
1394
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1395
|
+
phone: string;
|
|
1396
|
+
email: string;
|
|
1397
|
+
}, {
|
|
1398
|
+
phone: string;
|
|
1399
|
+
email: string;
|
|
1400
|
+
}>, import("zod").ZodObject<{
|
|
1401
|
+
email: import("zod").ZodString;
|
|
1402
|
+
phone: import("zod").ZodUndefined;
|
|
1403
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1404
|
+
phone?: undefined;
|
|
1405
|
+
email: string;
|
|
1406
|
+
}, {
|
|
1407
|
+
phone?: undefined;
|
|
1408
|
+
email: string;
|
|
1409
|
+
}>, import("zod").ZodObject<{
|
|
1410
|
+
email: import("zod").ZodUndefined;
|
|
1411
|
+
phone: import("zod").ZodString;
|
|
1412
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1413
|
+
email?: undefined;
|
|
1414
|
+
phone: string;
|
|
1415
|
+
}, {
|
|
1416
|
+
email?: undefined;
|
|
1417
|
+
phone: string;
|
|
1418
|
+
}>]>, {
|
|
1419
|
+
phone: string;
|
|
1420
|
+
email: string;
|
|
1421
|
+
} | {
|
|
1422
|
+
phone?: undefined;
|
|
1423
|
+
email: string;
|
|
1424
|
+
} | {
|
|
1425
|
+
email?: undefined;
|
|
1426
|
+
phone: string;
|
|
1427
|
+
}>>;
|
|
1428
|
+
externalEnrollmentParams: import("zod").ZodIntersection<import("zod").ZodIntersection<import("zod").ZodIntersection<import("zod").ZodObject<{
|
|
1429
|
+
identificationNumber: import("zod").ZodString;
|
|
1430
|
+
birthdate: import("zod").ZodDate;
|
|
1431
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1432
|
+
birthdate: Date;
|
|
1433
|
+
identificationNumber: string;
|
|
1434
|
+
}, {
|
|
1435
|
+
birthdate: Date;
|
|
1436
|
+
identificationNumber: string;
|
|
1437
|
+
}>, import("zod").ZodEffects<import("zod").ZodUnion<[import("zod").ZodObject<{
|
|
1438
|
+
email: import("zod").ZodString;
|
|
1439
|
+
phone: import("zod").ZodString;
|
|
1440
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1441
|
+
phone: string;
|
|
1442
|
+
email: string;
|
|
1443
|
+
}, {
|
|
1444
|
+
phone: string;
|
|
1445
|
+
email: string;
|
|
1446
|
+
}>, import("zod").ZodObject<{
|
|
1447
|
+
email: import("zod").ZodString;
|
|
1448
|
+
phone: import("zod").ZodUndefined;
|
|
1449
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1450
|
+
phone?: undefined;
|
|
1451
|
+
email: string;
|
|
1452
|
+
}, {
|
|
1453
|
+
phone?: undefined;
|
|
1454
|
+
email: string;
|
|
1455
|
+
}>, import("zod").ZodObject<{
|
|
1456
|
+
email: import("zod").ZodUndefined;
|
|
1457
|
+
phone: import("zod").ZodString;
|
|
1458
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1459
|
+
email?: undefined;
|
|
1460
|
+
phone: string;
|
|
1461
|
+
}, {
|
|
1462
|
+
email?: undefined;
|
|
1463
|
+
phone: string;
|
|
1464
|
+
}>]>, {
|
|
1465
|
+
phone: string;
|
|
1466
|
+
email: string;
|
|
1467
|
+
} | {
|
|
1468
|
+
phone?: undefined;
|
|
1469
|
+
email: string;
|
|
1470
|
+
} | {
|
|
1471
|
+
email?: undefined;
|
|
1472
|
+
phone: string;
|
|
1473
|
+
}>>, import("zod").ZodObject<{
|
|
1474
|
+
password: import("zod").ZodString;
|
|
1475
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1476
|
+
password: string;
|
|
1477
|
+
}, {
|
|
1478
|
+
password: string;
|
|
1479
|
+
}>>, import("zod").ZodEffects<import("zod").ZodUnion<[import("zod").ZodObject<{
|
|
1480
|
+
emailCode: import("zod").ZodString;
|
|
1481
|
+
phoneCode: import("zod").ZodString;
|
|
1482
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1483
|
+
emailCode: string;
|
|
1484
|
+
phoneCode: string;
|
|
1485
|
+
}, {
|
|
1486
|
+
emailCode: string;
|
|
1487
|
+
phoneCode: string;
|
|
1488
|
+
}>, import("zod").ZodObject<{
|
|
1489
|
+
emailCode: import("zod").ZodString;
|
|
1490
|
+
phoneCode: import("zod").ZodUndefined;
|
|
1491
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1492
|
+
phoneCode?: undefined;
|
|
1493
|
+
emailCode: string;
|
|
1494
|
+
}, {
|
|
1495
|
+
phoneCode?: undefined;
|
|
1496
|
+
emailCode: string;
|
|
1497
|
+
}>, import("zod").ZodObject<{
|
|
1498
|
+
emailCode: import("zod").ZodUndefined;
|
|
1499
|
+
phoneCode: import("zod").ZodString;
|
|
1500
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1501
|
+
emailCode?: undefined;
|
|
1502
|
+
phoneCode: string;
|
|
1503
|
+
}, {
|
|
1504
|
+
emailCode?: undefined;
|
|
1505
|
+
phoneCode: string;
|
|
1506
|
+
}>]>, {
|
|
1507
|
+
emailCode: string;
|
|
1508
|
+
phoneCode: string;
|
|
1509
|
+
} | {
|
|
1510
|
+
phoneCode?: undefined;
|
|
1511
|
+
emailCode: string;
|
|
1512
|
+
} | {
|
|
1513
|
+
emailCode?: undefined;
|
|
1514
|
+
phoneCode: string;
|
|
1515
|
+
}>>;
|
|
1516
|
+
externalVerificationCodeParams: import("zod").ZodObject<{
|
|
1517
|
+
identificationNumber: import("zod").ZodString;
|
|
1518
|
+
birthdate: import("zod").ZodDate;
|
|
1519
|
+
channel: import("zod").ZodEnum<["1", "2"]>;
|
|
1520
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1521
|
+
birthdate: Date;
|
|
1522
|
+
channel: "1" | "2";
|
|
1523
|
+
identificationNumber: string;
|
|
1524
|
+
}, {
|
|
1525
|
+
birthdate: Date;
|
|
1526
|
+
channel: "1" | "2";
|
|
1527
|
+
identificationNumber: string;
|
|
1528
|
+
}>;
|
|
1529
|
+
externalResetPasswordParams: import("zod").ZodIntersection<import("zod").ZodObject<{
|
|
1530
|
+
identificationNumber: import("zod").ZodString;
|
|
1531
|
+
birthdate: import("zod").ZodDate;
|
|
1532
|
+
password: import("zod").ZodString;
|
|
1533
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1534
|
+
birthdate: Date;
|
|
1535
|
+
password: string;
|
|
1536
|
+
identificationNumber: string;
|
|
1537
|
+
}, {
|
|
1538
|
+
birthdate: Date;
|
|
1539
|
+
password: string;
|
|
1540
|
+
identificationNumber: string;
|
|
1541
|
+
}>, import("zod").ZodEffects<import("zod").ZodUnion<[import("zod").ZodObject<{
|
|
1542
|
+
emailCode: import("zod").ZodString;
|
|
1543
|
+
phoneCode: import("zod").ZodString;
|
|
1544
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1545
|
+
emailCode: string;
|
|
1546
|
+
phoneCode: string;
|
|
1547
|
+
}, {
|
|
1548
|
+
emailCode: string;
|
|
1549
|
+
phoneCode: string;
|
|
1550
|
+
}>, import("zod").ZodObject<{
|
|
1551
|
+
emailCode: import("zod").ZodString;
|
|
1552
|
+
phoneCode: import("zod").ZodUndefined;
|
|
1553
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1554
|
+
phoneCode?: undefined;
|
|
1555
|
+
emailCode: string;
|
|
1556
|
+
}, {
|
|
1557
|
+
phoneCode?: undefined;
|
|
1558
|
+
emailCode: string;
|
|
1559
|
+
}>, import("zod").ZodObject<{
|
|
1560
|
+
emailCode: import("zod").ZodUndefined;
|
|
1561
|
+
phoneCode: import("zod").ZodString;
|
|
1562
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1563
|
+
emailCode?: undefined;
|
|
1564
|
+
phoneCode: string;
|
|
1565
|
+
}, {
|
|
1566
|
+
emailCode?: undefined;
|
|
1567
|
+
phoneCode: string;
|
|
1568
|
+
}>]>, {
|
|
1569
|
+
emailCode: string;
|
|
1570
|
+
phoneCode: string;
|
|
1571
|
+
} | {
|
|
1572
|
+
phoneCode?: undefined;
|
|
1573
|
+
emailCode: string;
|
|
1574
|
+
} | {
|
|
1575
|
+
emailCode?: undefined;
|
|
1576
|
+
phoneCode: string;
|
|
1577
|
+
}>>;
|
|
1341
1578
|
};
|
package/lib/schemas.js
CHANGED
|
@@ -174,7 +174,7 @@ const coverageInfo = zod_1.object({
|
|
|
174
174
|
authorizationCode: zod_1.string().nullable(),
|
|
175
175
|
authorizationCodeExpiration: zod_1.date().nullable(),
|
|
176
176
|
}).nullable();
|
|
177
|
-
const
|
|
177
|
+
const verificationCodeParams = zod_1.object({
|
|
178
178
|
identificationType: zod_1.number(),
|
|
179
179
|
identificationValue: zod_1.string(),
|
|
180
180
|
channel: zod_1.enum(['1', '2']),
|
|
@@ -212,6 +212,47 @@ const declareUserResponse = zod_1.object({
|
|
|
212
212
|
patientId: zod_1.number().nullable(),
|
|
213
213
|
userId: zod_1.number(),
|
|
214
214
|
}));
|
|
215
|
+
const externalLoginParams = zod_1.object({
|
|
216
|
+
user: zod_1.string(),
|
|
217
|
+
password: zod_1.string(),
|
|
218
|
+
});
|
|
219
|
+
const externalLoginResponse = zod_1.object({
|
|
220
|
+
firstName: zod_1.string(),
|
|
221
|
+
lastName: zod_1.string(),
|
|
222
|
+
countryId: zod_1.string(),
|
|
223
|
+
birthday: zod_1.date(),
|
|
224
|
+
identificationNumber: zod_1.string(),
|
|
225
|
+
gender,
|
|
226
|
+
email: zod_1.string().email(),
|
|
227
|
+
phone: zod_1.string(),
|
|
228
|
+
});
|
|
229
|
+
const emailOrPhone = zod_1.union([
|
|
230
|
+
zod_1.object({ email: zod_1.string(), phone: zod_1.string() }),
|
|
231
|
+
zod_1.object({ email: zod_1.string(), phone: zod_1.undefined() }),
|
|
232
|
+
zod_1.object({ email: zod_1.undefined(), phone: zod_1.string() }),
|
|
233
|
+
]).refine((data) => data.email || data.phone, 'Either phone or email is required');
|
|
234
|
+
const preExternalEnrollmentParams = zod_1.object({
|
|
235
|
+
identificationNumber: zod_1.string(),
|
|
236
|
+
birthdate: zod_1.date(),
|
|
237
|
+
}).and(emailOrPhone);
|
|
238
|
+
const emailOrPhoneCode = zod_1.union([
|
|
239
|
+
zod_1.object({ emailCode: zod_1.string(), phoneCode: zod_1.string() }),
|
|
240
|
+
zod_1.object({ emailCode: zod_1.string(), phoneCode: zod_1.undefined() }),
|
|
241
|
+
zod_1.object({ emailCode: zod_1.undefined(), phoneCode: zod_1.string() }),
|
|
242
|
+
]).refine((data) => data.emailCode || data.phoneCode, 'Either phone code or email code is required');
|
|
243
|
+
const externalEnrollmentParams = preExternalEnrollmentParams
|
|
244
|
+
.and(zod_1.object({ password: zod_1.string() }))
|
|
245
|
+
.and(emailOrPhoneCode);
|
|
246
|
+
const externalVerificationCodeParams = zod_1.object({
|
|
247
|
+
identificationNumber: zod_1.string(),
|
|
248
|
+
birthdate: zod_1.date(),
|
|
249
|
+
channel: zod_1.enum(['1', '2']),
|
|
250
|
+
});
|
|
251
|
+
const externalResetPasswordParams = zod_1.object({
|
|
252
|
+
identificationNumber: zod_1.string(),
|
|
253
|
+
birthdate: zod_1.date(),
|
|
254
|
+
password: zod_1.string(),
|
|
255
|
+
}).and(emailOrPhoneCode);
|
|
215
256
|
exports.doc24Schemas = {
|
|
216
257
|
sdkCredentials,
|
|
217
258
|
sdkParams: zod_1.object({ url: zod_1.string(), credentials: sdkCredentials }),
|
|
@@ -230,6 +271,7 @@ exports.doc24Schemas = {
|
|
|
230
271
|
date: zod_1.date().optional(),
|
|
231
272
|
startHour: zod_1.string().optional(),
|
|
232
273
|
finishHour: zod_1.string().optional(),
|
|
274
|
+
language: zod_1.string().optional(),
|
|
233
275
|
}),
|
|
234
276
|
scheduleParameters: zod_1.union([
|
|
235
277
|
appointmentScheduleParameters,
|
|
@@ -330,10 +372,16 @@ exports.doc24Schemas = {
|
|
|
330
372
|
diagnosticaPatient,
|
|
331
373
|
diagnosticaDeepLinkResponse,
|
|
332
374
|
coverageInfo,
|
|
333
|
-
|
|
375
|
+
verificationCodeParams,
|
|
334
376
|
declareUserParams,
|
|
335
377
|
declareUserResponse,
|
|
336
378
|
declarePatientParams,
|
|
337
379
|
declarePatientResponse,
|
|
338
380
|
verificationParams,
|
|
381
|
+
externalLoginParams,
|
|
382
|
+
externalLoginResponse,
|
|
383
|
+
preExternalEnrollmentParams,
|
|
384
|
+
externalEnrollmentParams,
|
|
385
|
+
externalVerificationCodeParams,
|
|
386
|
+
externalResetPasswordParams,
|
|
339
387
|
};
|
package/lib/types.d.ts
CHANGED
|
@@ -29,12 +29,18 @@ export declare namespace Doc24 {
|
|
|
29
29
|
type DiagnosticaPatient = TypeOf<typeof doc24Schemas.diagnosticaPatient>;
|
|
30
30
|
type DiagnosticaHistoryAppointment = TypeOf<typeof doc24Schemas.diagnosticaHistoryAppointment>;
|
|
31
31
|
type DiagnosticaDeepLinkResponse = TypeOf<typeof doc24Schemas.diagnosticaDeepLinkResponse>;
|
|
32
|
-
type
|
|
32
|
+
type VerificationCodeParams = TypeOf<typeof doc24Schemas.verificationCodeParams>;
|
|
33
33
|
type DeclareUserParams = TypeOf<typeof doc24Schemas.declareUserParams>;
|
|
34
34
|
type DeclareUserResponse = TypeOf<typeof doc24Schemas.declareUserResponse>;
|
|
35
35
|
type DeclarePatientParams = TypeOf<typeof doc24Schemas.declarePatientParams>;
|
|
36
36
|
type DeclarePatientResponse = TypeOf<typeof doc24Schemas.declarePatientResponse>;
|
|
37
37
|
type VerificationParams = TypeOf<typeof doc24Schemas.verificationParams>;
|
|
38
|
+
type ExternalLoginParams = TypeOf<typeof doc24Schemas.externalLoginParams>;
|
|
39
|
+
type ExternalLoginResponse = TypeOf<typeof doc24Schemas.externalLoginResponse>;
|
|
40
|
+
type PreExternalEnrollmentParams = TypeOf<typeof doc24Schemas.preExternalEnrollmentParams>;
|
|
41
|
+
type ExternalEnrollmentParams = TypeOf<typeof doc24Schemas.externalEnrollmentParams>;
|
|
42
|
+
type ExternalVerificationCodeParams = TypeOf<typeof doc24Schemas.externalVerificationCodeParams>;
|
|
43
|
+
type ExternalResetPasswordParams = TypeOf<typeof doc24Schemas.externalResetPasswordParams>;
|
|
38
44
|
type BaseSdk = {
|
|
39
45
|
declareUser: (params: DeclareUserParams) => Promise<DeclareUserResponse>;
|
|
40
46
|
getUserId: (user: User) => Promise<number>;
|
|
@@ -43,10 +49,15 @@ export declare namespace Doc24 {
|
|
|
43
49
|
getAvailableScheduleClinics: () => Promise<AvailableScheduleClinics>;
|
|
44
50
|
enroll: (params: EnrollmentParams) => Promise<void>;
|
|
45
51
|
getCoverageInfo: (identificationValue: string) => Promise<CoverageInfo>;
|
|
46
|
-
getVerificationCode: (params:
|
|
52
|
+
getVerificationCode: (params: VerificationCodeParams) => Promise<void>;
|
|
47
53
|
getDiagnosticaHistory: (patient: DiagnosticaPatientFilter, from: Date, to: Date) => Promise<DiagnosticaHistoryAppointment[]>;
|
|
48
54
|
getDiagnosticaDeepLink: (kiosk: string, user: DiagnosticaUser, patient: DiagnosticaPatient) => Promise<DiagnosticaDeepLinkResponse>;
|
|
49
55
|
getDiagnosticaAccess: (kiosk: string, user: DiagnosticaUser, patient: DiagnosticaPatient) => Promise<void>;
|
|
56
|
+
externalLogin: (params: ExternalLoginParams) => Promise<ExternalLoginResponse>;
|
|
57
|
+
preExternalEnrollment: (params: PreExternalEnrollmentParams) => Promise<void>;
|
|
58
|
+
externalEnrollment: (params: ExternalEnrollmentParams) => Promise<any>;
|
|
59
|
+
getExternalVerificationCode: (params: ExternalVerificationCodeParams) => Promise<void>;
|
|
60
|
+
externalResetPassword: (params: ExternalResetPasswordParams) => Promise<any>;
|
|
50
61
|
};
|
|
51
62
|
type UserSdk = {
|
|
52
63
|
declarePatient: (params: DeclarePatientParams) => Promise<DeclarePatientResponse>;
|
|
@@ -2,6 +2,7 @@ import { RequestMaker } from '../request';
|
|
|
2
2
|
export declare const getScheduleMethods: (makeRequest: RequestMaker) => {
|
|
3
3
|
getSchedule: (patientId: number, specialtyId: number, filter?: {
|
|
4
4
|
date?: Date | undefined;
|
|
5
|
+
language?: string | undefined;
|
|
5
6
|
professionalId?: number | undefined;
|
|
6
7
|
offset?: number | undefined;
|
|
7
8
|
limit?: number | undefined;
|
package/lib/userSdk/schedule.js
CHANGED
|
@@ -7,7 +7,7 @@ const validation_1 = require("../request/validation");
|
|
|
7
7
|
const schemas_1 = require("../schemas");
|
|
8
8
|
const utils_1 = require("../utils");
|
|
9
9
|
const getScheduleMethods = (makeRequest) => {
|
|
10
|
-
const getScheduleDates =
|
|
10
|
+
const getScheduleDates = async (patientId, filter = {}) => {
|
|
11
11
|
const mappedFilter = {
|
|
12
12
|
specialty_id: filter.specialtyId,
|
|
13
13
|
professional_id: filter.professionalId,
|
|
@@ -15,8 +15,9 @@ const getScheduleMethods = (makeRequest) => {
|
|
|
15
15
|
const path = `/schedule/dates/${patientId}/${JSON.stringify(mappedFilter)}`;
|
|
16
16
|
const response = await makeRequest('GET', path);
|
|
17
17
|
return response.data.available_dates.map((o) => utils_1.parseDate(o.date));
|
|
18
|
-
}
|
|
19
|
-
const getSchedule =
|
|
18
|
+
};
|
|
19
|
+
const getSchedule = async (patientId, specialtyId, filter = {}) => {
|
|
20
|
+
var _a;
|
|
20
21
|
const mappedFilter = {
|
|
21
22
|
id_professional: filter.professionalId,
|
|
22
23
|
offset: filter.offset,
|
|
@@ -25,6 +26,7 @@ const getScheduleMethods = (makeRequest) => {
|
|
|
25
26
|
date: filter.date && date_fns_1.format(filter.date, 'yyyy-MM-dd'),
|
|
26
27
|
start_hour: filter.startHour,
|
|
27
28
|
finish_hour: filter.finishHour,
|
|
29
|
+
language: (_a = filter.language) !== null && _a !== void 0 ? _a : 'ES',
|
|
28
30
|
};
|
|
29
31
|
const path = `/schedule/availability/${patientId}/${specialtyId}/${JSON.stringify(mappedFilter)}`;
|
|
30
32
|
const response = await makeRequest('GET', path);
|
|
@@ -47,8 +49,8 @@ const getScheduleMethods = (makeRequest) => {
|
|
|
47
49
|
ranking: a.ranking,
|
|
48
50
|
length: a.length,
|
|
49
51
|
}));
|
|
50
|
-
}
|
|
51
|
-
const getAppointment =
|
|
52
|
+
};
|
|
53
|
+
const getAppointment = async (appointmentId) => {
|
|
52
54
|
const path = `/appointment/${appointmentId}`;
|
|
53
55
|
const response = await makeRequest('GET', path);
|
|
54
56
|
return {
|
|
@@ -56,8 +58,8 @@ const getScheduleMethods = (makeRequest) => {
|
|
|
56
58
|
professionalId: response.data.professional_id,
|
|
57
59
|
date: utils_1.parseDateTime(`${response.data.date} ${response.data.hour}`),
|
|
58
60
|
};
|
|
59
|
-
}
|
|
60
|
-
const getAppointmentByVcToken =
|
|
61
|
+
};
|
|
62
|
+
const getAppointmentByVcToken = async (vcToken) => {
|
|
61
63
|
const path = `/appointmentByToken/${vcToken}`;
|
|
62
64
|
const response = await makeRequest('GET', path);
|
|
63
65
|
return {
|
|
@@ -65,12 +67,12 @@ const getScheduleMethods = (makeRequest) => {
|
|
|
65
67
|
professionalId: response.data.professional_id,
|
|
66
68
|
date: utils_1.parseDateTime(`${response.data.date} ${response.data.hour}`),
|
|
67
69
|
};
|
|
68
|
-
}
|
|
70
|
+
};
|
|
69
71
|
return {
|
|
70
|
-
getSchedule,
|
|
71
|
-
getScheduleDates,
|
|
72
|
-
getAppointment,
|
|
73
|
-
getAppointmentByVcToken,
|
|
72
|
+
getSchedule: validation_1.validateFunction(zod_1.tuple([zod_1.number(), zod_1.number(), schemas_1.doc24Schemas.scheduleFilter.optional()]), zod_1.array(schemas_1.doc24Schemas.availableAppointment), getSchedule),
|
|
73
|
+
getScheduleDates: validation_1.validateFunction(zod_1.tuple([zod_1.number(), schemas_1.doc24Schemas.scheduleAvailabilityFilter]), zod_1.array(zod_1.date()), getScheduleDates),
|
|
74
|
+
getAppointment: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.appointment, getAppointment),
|
|
75
|
+
getAppointmentByVcToken: validation_1.validateFunction(zod_1.tuple([zod_1.string()]), schemas_1.doc24Schemas.appointment, getAppointmentByVcToken),
|
|
74
76
|
};
|
|
75
77
|
};
|
|
76
78
|
exports.getScheduleMethods = getScheduleMethods;
|