@integraciones_doc24/sdk 1.16.39 → 1.16.40
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 +225 -225
- package/lib/baseSdk/diagnostica.d.ts +54 -54
- package/lib/baseSdk/diagnostica.js +82 -82
- package/lib/baseSdk/external.d.ts +177 -177
- package/lib/baseSdk/external.js +96 -96
- package/lib/baseSdk/index.d.ts +2 -2
- package/lib/baseSdk/index.js +80 -80
- package/lib/baseSdk/integrationError.d.ts +16 -16
- package/lib/baseSdk/integrationError.js +33 -33
- package/lib/baseSdk/user.d.ts +115 -115
- package/lib/baseSdk/user.js +136 -136
- package/lib/index.d.ts +416 -416
- package/lib/index.js +22 -22
- package/lib/request/index.d.ts +4 -4
- package/lib/request/index.js +32 -32
- package/lib/request/token.d.ts +2 -2
- package/lib/request/token.js +34 -34
- package/lib/request/validation.d.ts +10 -10
- package/lib/request/validation.js +28 -28
- package/lib/schemas.d.ts +2813 -2757
- package/lib/schemas.js +601 -594
- package/lib/types.d.ts +178 -177
- package/lib/types.js +2 -2
- package/lib/userSdk/binah.d.ts +21 -21
- package/lib/userSdk/binah.js +20 -20
- package/lib/userSdk/chat.d.ts +57 -57
- package/lib/userSdk/chat.js +98 -98
- package/lib/userSdk/external.d.ts +34 -34
- package/lib/userSdk/external.js +72 -72
- package/lib/userSdk/index.d.ts +2 -2
- package/lib/userSdk/index.js +33 -33
- package/lib/userSdk/patients.d.ts +62 -60
- package/lib/userSdk/patients.js +93 -91
- package/lib/userSdk/schedule.d.ts +59 -59
- package/lib/userSdk/schedule.js +90 -90
- package/lib/userSdk/specialties.d.ts +19 -19
- package/lib/userSdk/specialties.js +48 -48
- package/lib/userSdk/videoVisit.d.ts +225 -225
- package/lib/userSdk/videoVisit.js +283 -283
- package/lib/utils.d.ts +4 -4
- package/lib/utils.js +68 -68
- package/lib/webhook/index.d.ts +2 -2
- package/lib/webhook/index.js +67 -67
- package/lib/webhook/responses.d.ts +35 -35
- package/lib/webhook/responses.js +42 -42
- package/lib/webhook/token.d.ts +2 -2
- package/lib/webhook/token.js +23 -23
- package/package.json +37 -37
package/lib/baseSdk/external.js
CHANGED
|
@@ -1,96 +1,96 @@
|
|
|
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.toLowerCase(),
|
|
20
|
-
email: info.email,
|
|
21
|
-
phone: info.telephone,
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
const preExternalEnrollment = async (params) => {
|
|
25
|
-
const path = '/pre-external-enrollment';
|
|
26
|
-
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;
|
|
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
|
-
const info = response.data.info;
|
|
46
|
-
return {
|
|
47
|
-
firstName: info.firstname,
|
|
48
|
-
lastName: info.lastname,
|
|
49
|
-
countryId: info.country_id,
|
|
50
|
-
birthday: new Date(Date.parse(info.birthdate)),
|
|
51
|
-
identificationNumber: info.identification_number,
|
|
52
|
-
gender: info.gender.toLowerCase(),
|
|
53
|
-
email: info.email,
|
|
54
|
-
phone: info.telephone,
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
const sendExternalVerificationCode = async (params) => {
|
|
58
|
-
const path = '/send-external-verification-code';
|
|
59
|
-
await makeRequest('POST', path, {
|
|
60
|
-
identification_number: params.identificationNumber,
|
|
61
|
-
birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
|
|
62
|
-
channel: params.channel,
|
|
63
|
-
});
|
|
64
|
-
return;
|
|
65
|
-
};
|
|
66
|
-
const verifyExternalVerificationCode = async (params) => {
|
|
67
|
-
const path = '/verify-external-verification-code';
|
|
68
|
-
const response = await makeRequest('POST', path, {
|
|
69
|
-
identification_number: params.identificationNumber,
|
|
70
|
-
birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
|
|
71
|
-
channel: params.channel,
|
|
72
|
-
code: params.code,
|
|
73
|
-
});
|
|
74
|
-
return response.data;
|
|
75
|
-
};
|
|
76
|
-
const externalResetPassword = async (params) => {
|
|
77
|
-
const path = '/external-reset';
|
|
78
|
-
const response = await makeRequest('POST', path, {
|
|
79
|
-
identification_number: params.identificationNumber,
|
|
80
|
-
birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
|
|
81
|
-
password: params.password,
|
|
82
|
-
email_code: params.emailCode,
|
|
83
|
-
telephone_code: params.phoneCode,
|
|
84
|
-
});
|
|
85
|
-
return response.data;
|
|
86
|
-
};
|
|
87
|
-
return {
|
|
88
|
-
externalLogin: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalLoginParams]), schemas_1.doc24Schemas.externalLoginResponse, externalLogin),
|
|
89
|
-
preExternalEnrollment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.preExternalEnrollmentParams]), zod_1.void(), preExternalEnrollment),
|
|
90
|
-
externalEnrollment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalEnrollmentParams]), schemas_1.doc24Schemas.externalLoginResponse, externalEnrollment),
|
|
91
|
-
sendExternalVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.sendExternalVerificationCodeParams]), zod_1.void(), sendExternalVerificationCode),
|
|
92
|
-
verifyExternalVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.verifyExternalVerificationCodeParams]), zod_1.any(), verifyExternalVerificationCode),
|
|
93
|
-
externalResetPassword: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalResetPasswordParams]), zod_1.any(), externalResetPassword),
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
exports.getExternalMethods = getExternalMethods;
|
|
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.toLowerCase(),
|
|
20
|
+
email: info.email,
|
|
21
|
+
phone: info.telephone,
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
const preExternalEnrollment = async (params) => {
|
|
25
|
+
const path = '/pre-external-enrollment';
|
|
26
|
+
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;
|
|
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
|
+
const info = response.data.info;
|
|
46
|
+
return {
|
|
47
|
+
firstName: info.firstname,
|
|
48
|
+
lastName: info.lastname,
|
|
49
|
+
countryId: info.country_id,
|
|
50
|
+
birthday: new Date(Date.parse(info.birthdate)),
|
|
51
|
+
identificationNumber: info.identification_number,
|
|
52
|
+
gender: info.gender.toLowerCase(),
|
|
53
|
+
email: info.email,
|
|
54
|
+
phone: info.telephone,
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
const sendExternalVerificationCode = async (params) => {
|
|
58
|
+
const path = '/send-external-verification-code';
|
|
59
|
+
await makeRequest('POST', path, {
|
|
60
|
+
identification_number: params.identificationNumber,
|
|
61
|
+
birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
|
|
62
|
+
channel: params.channel,
|
|
63
|
+
});
|
|
64
|
+
return;
|
|
65
|
+
};
|
|
66
|
+
const verifyExternalVerificationCode = async (params) => {
|
|
67
|
+
const path = '/verify-external-verification-code';
|
|
68
|
+
const response = await makeRequest('POST', path, {
|
|
69
|
+
identification_number: params.identificationNumber,
|
|
70
|
+
birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
|
|
71
|
+
channel: params.channel,
|
|
72
|
+
code: params.code,
|
|
73
|
+
});
|
|
74
|
+
return response.data;
|
|
75
|
+
};
|
|
76
|
+
const externalResetPassword = async (params) => {
|
|
77
|
+
const path = '/external-reset';
|
|
78
|
+
const response = await makeRequest('POST', path, {
|
|
79
|
+
identification_number: params.identificationNumber,
|
|
80
|
+
birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
|
|
81
|
+
password: params.password,
|
|
82
|
+
email_code: params.emailCode,
|
|
83
|
+
telephone_code: params.phoneCode,
|
|
84
|
+
});
|
|
85
|
+
return response.data;
|
|
86
|
+
};
|
|
87
|
+
return {
|
|
88
|
+
externalLogin: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalLoginParams]), schemas_1.doc24Schemas.externalLoginResponse, externalLogin),
|
|
89
|
+
preExternalEnrollment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.preExternalEnrollmentParams]), zod_1.void(), preExternalEnrollment),
|
|
90
|
+
externalEnrollment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalEnrollmentParams]), schemas_1.doc24Schemas.externalLoginResponse, externalEnrollment),
|
|
91
|
+
sendExternalVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.sendExternalVerificationCodeParams]), zod_1.void(), sendExternalVerificationCode),
|
|
92
|
+
verifyExternalVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.verifyExternalVerificationCodeParams]), zod_1.any(), verifyExternalVerificationCode),
|
|
93
|
+
externalResetPassword: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalResetPasswordParams]), zod_1.any(), externalResetPassword),
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
exports.getExternalMethods = getExternalMethods;
|
package/lib/baseSdk/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Doc24 } from '../types';
|
|
2
|
-
export declare const getBaseSdk: (url: string, credentials: Doc24.SdkCredentials) => Promise<Doc24.BaseSdk>;
|
|
1
|
+
import { Doc24 } from '../types';
|
|
2
|
+
export declare const getBaseSdk: (url: string, credentials: Doc24.SdkCredentials) => Promise<Doc24.BaseSdk>;
|
package/lib/baseSdk/index.js
CHANGED
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getBaseSdk = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const request_1 = require("../request");
|
|
6
|
-
const validation_1 = require("../request/validation");
|
|
7
|
-
const schemas_1 = require("../schemas");
|
|
8
|
-
const utils_1 = require("../utils");
|
|
9
|
-
const diagnostica_1 = require("./diagnostica");
|
|
10
|
-
const user_1 = require("./user");
|
|
11
|
-
const external_1 = require("./external");
|
|
12
|
-
const integrationError_1 = require("./integrationError");
|
|
13
|
-
const getBaseSdk = async (url, credentials) => {
|
|
14
|
-
const makeRequest = await request_1.getRequestFactory(url, credentials);
|
|
15
|
-
const diagnosticaMethods = diagnostica_1.getDiagnosticaMethods(makeRequest);
|
|
16
|
-
const externalMethods = external_1.getExternalMethods(makeRequest);
|
|
17
|
-
const userMethods = user_1.getUserMethods(makeRequest, url, credentials);
|
|
18
|
-
const integrationErrorMethods = integrationError_1.getIntegrationErrorMethods(makeRequest);
|
|
19
|
-
const baseSdk = {
|
|
20
|
-
...diagnosticaMethods,
|
|
21
|
-
...externalMethods,
|
|
22
|
-
...integrationErrorMethods,
|
|
23
|
-
...userMethods,
|
|
24
|
-
getProfessional: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.professional, async (professionalId) => {
|
|
25
|
-
var _a;
|
|
26
|
-
const path = `/professional/${professionalId}`;
|
|
27
|
-
const response = await makeRequest('GET', path);
|
|
28
|
-
const raw = response.data;
|
|
29
|
-
return {
|
|
30
|
-
id: raw.professional_id,
|
|
31
|
-
firstName: raw.name,
|
|
32
|
-
lastName: raw.lastname,
|
|
33
|
-
birthdate: utils_1.parseDate(raw.birthdate),
|
|
34
|
-
gender: (_a = raw.gender) === null || _a === void 0 ? void 0 : _a.toLowerCase(),
|
|
35
|
-
email: raw.email,
|
|
36
|
-
phone: raw.phone,
|
|
37
|
-
logoUrl: raw.image,
|
|
38
|
-
matriculation: raw.matriculation,
|
|
39
|
-
specialties: raw.specialties.map((s) => ({
|
|
40
|
-
id: s.specialty_id,
|
|
41
|
-
description: s.specialty,
|
|
42
|
-
})),
|
|
43
|
-
degree: raw.degree,
|
|
44
|
-
languages: raw.languages.map((l) => l.languages),
|
|
45
|
-
resume: {
|
|
46
|
-
link: raw.resume_link,
|
|
47
|
-
brief: raw.resume_brief,
|
|
48
|
-
},
|
|
49
|
-
consultation_value: raw.consultation_value,
|
|
50
|
-
hasAvailability: raw.hasAvailability,
|
|
51
|
-
status: raw.status,
|
|
52
|
-
};
|
|
53
|
-
}),
|
|
54
|
-
getAvailableScheduleClinics: validation_1.validateFunction(zod_1.tuple([]), schemas_1.doc24Schemas.availableScheduleClinics, async () => {
|
|
55
|
-
const path = `/schedule/clinics`;
|
|
56
|
-
const response = await makeRequest('GET', path);
|
|
57
|
-
const mapSpeciality = (s) => ({
|
|
58
|
-
id: s.id_especialidad,
|
|
59
|
-
description: s.especialidad,
|
|
60
|
-
});
|
|
61
|
-
const mapSpecialityER = (s) => ({
|
|
62
|
-
id: s.specialty_id,
|
|
63
|
-
description: s.specialty,
|
|
64
|
-
});
|
|
65
|
-
const mapped = {
|
|
66
|
-
specialties: response.data.specialties.map(mapSpeciality),
|
|
67
|
-
specialtiesER: response.data.specialties_er.map(mapSpecialityER),
|
|
68
|
-
professionals: response.data.professionals.map((p) => ({
|
|
69
|
-
id: p.id_profesional,
|
|
70
|
-
fullName: p.denominacion,
|
|
71
|
-
clinicId: p.id_consultorio,
|
|
72
|
-
specialties: p.especialidades.map(mapSpeciality),
|
|
73
|
-
})),
|
|
74
|
-
};
|
|
75
|
-
return mapped;
|
|
76
|
-
}),
|
|
77
|
-
};
|
|
78
|
-
return baseSdk;
|
|
79
|
-
};
|
|
80
|
-
exports.getBaseSdk = getBaseSdk;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBaseSdk = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const request_1 = require("../request");
|
|
6
|
+
const validation_1 = require("../request/validation");
|
|
7
|
+
const schemas_1 = require("../schemas");
|
|
8
|
+
const utils_1 = require("../utils");
|
|
9
|
+
const diagnostica_1 = require("./diagnostica");
|
|
10
|
+
const user_1 = require("./user");
|
|
11
|
+
const external_1 = require("./external");
|
|
12
|
+
const integrationError_1 = require("./integrationError");
|
|
13
|
+
const getBaseSdk = async (url, credentials) => {
|
|
14
|
+
const makeRequest = await request_1.getRequestFactory(url, credentials);
|
|
15
|
+
const diagnosticaMethods = diagnostica_1.getDiagnosticaMethods(makeRequest);
|
|
16
|
+
const externalMethods = external_1.getExternalMethods(makeRequest);
|
|
17
|
+
const userMethods = user_1.getUserMethods(makeRequest, url, credentials);
|
|
18
|
+
const integrationErrorMethods = integrationError_1.getIntegrationErrorMethods(makeRequest);
|
|
19
|
+
const baseSdk = {
|
|
20
|
+
...diagnosticaMethods,
|
|
21
|
+
...externalMethods,
|
|
22
|
+
...integrationErrorMethods,
|
|
23
|
+
...userMethods,
|
|
24
|
+
getProfessional: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.professional, async (professionalId) => {
|
|
25
|
+
var _a;
|
|
26
|
+
const path = `/professional/${professionalId}`;
|
|
27
|
+
const response = await makeRequest('GET', path);
|
|
28
|
+
const raw = response.data;
|
|
29
|
+
return {
|
|
30
|
+
id: raw.professional_id,
|
|
31
|
+
firstName: raw.name,
|
|
32
|
+
lastName: raw.lastname,
|
|
33
|
+
birthdate: utils_1.parseDate(raw.birthdate),
|
|
34
|
+
gender: (_a = raw.gender) === null || _a === void 0 ? void 0 : _a.toLowerCase(),
|
|
35
|
+
email: raw.email,
|
|
36
|
+
phone: raw.phone,
|
|
37
|
+
logoUrl: raw.image,
|
|
38
|
+
matriculation: raw.matriculation,
|
|
39
|
+
specialties: raw.specialties.map((s) => ({
|
|
40
|
+
id: s.specialty_id,
|
|
41
|
+
description: s.specialty,
|
|
42
|
+
})),
|
|
43
|
+
degree: raw.degree,
|
|
44
|
+
languages: raw.languages.map((l) => l.languages),
|
|
45
|
+
resume: {
|
|
46
|
+
link: raw.resume_link,
|
|
47
|
+
brief: raw.resume_brief,
|
|
48
|
+
},
|
|
49
|
+
consultation_value: raw.consultation_value,
|
|
50
|
+
hasAvailability: raw.hasAvailability,
|
|
51
|
+
status: raw.status,
|
|
52
|
+
};
|
|
53
|
+
}),
|
|
54
|
+
getAvailableScheduleClinics: validation_1.validateFunction(zod_1.tuple([]), schemas_1.doc24Schemas.availableScheduleClinics, async () => {
|
|
55
|
+
const path = `/schedule/clinics`;
|
|
56
|
+
const response = await makeRequest('GET', path);
|
|
57
|
+
const mapSpeciality = (s) => ({
|
|
58
|
+
id: s.id_especialidad,
|
|
59
|
+
description: s.especialidad,
|
|
60
|
+
});
|
|
61
|
+
const mapSpecialityER = (s) => ({
|
|
62
|
+
id: s.specialty_id,
|
|
63
|
+
description: s.specialty,
|
|
64
|
+
});
|
|
65
|
+
const mapped = {
|
|
66
|
+
specialties: response.data.specialties.map(mapSpeciality),
|
|
67
|
+
specialtiesER: response.data.specialties_er.map(mapSpecialityER),
|
|
68
|
+
professionals: response.data.professionals.map((p) => ({
|
|
69
|
+
id: p.id_profesional,
|
|
70
|
+
fullName: p.denominacion,
|
|
71
|
+
clinicId: p.id_consultorio,
|
|
72
|
+
specialties: p.especialidades.map(mapSpeciality),
|
|
73
|
+
})),
|
|
74
|
+
};
|
|
75
|
+
return mapped;
|
|
76
|
+
}),
|
|
77
|
+
};
|
|
78
|
+
return baseSdk;
|
|
79
|
+
};
|
|
80
|
+
exports.getBaseSdk = getBaseSdk;
|
|
@@ -1,16 +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
|
-
};
|
|
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
|
+
};
|
|
@@ -1,33 +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;
|
|
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;
|