@integraciones_doc24/sdk 1.2.0 → 1.3.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/diagnostica.d.ts +6 -6
- package/lib/baseSdk/index.js +5 -1
- package/lib/baseSdk/user.d.ts +4 -52
- package/lib/baseSdk/user.js +25 -67
- package/lib/index.d.ts +16 -45
- package/lib/lib/lib/lib/baseSdk/diagnostica.d.ts +6 -0
- package/lib/lib/lib/lib/baseSdk/diagnostica.js +79 -0
- package/lib/lib/lib/lib/baseSdk/index.d.ts +14 -0
- package/lib/lib/lib/lib/baseSdk/index.js +66 -0
- package/lib/lib/lib/lib/baseSdk/user.d.ts +9 -0
- package/lib/lib/lib/lib/baseSdk/user.js +130 -0
- package/lib/lib/lib/lib/index.d.ts +58 -0
- package/lib/lib/lib/lib/index.js +22 -0
- package/lib/lib/lib/lib/request/index.d.ts +2 -0
- package/lib/lib/lib/lib/request/index.js +26 -0
- package/lib/lib/lib/lib/request/token.d.ts +2 -0
- package/lib/lib/lib/lib/request/token.js +34 -0
- package/lib/lib/lib/lib/request/validation.d.ts +10 -0
- package/lib/lib/lib/lib/request/validation.js +28 -0
- package/lib/lib/lib/lib/schemas.d.ts +1334 -0
- package/lib/lib/lib/lib/schemas.js +325 -0
- package/lib/lib/lib/lib/test.d.ts +1 -0
- package/lib/lib/lib/lib/test.js +55 -0
- package/lib/lib/lib/lib/types.d.ts +1 -0
- package/lib/lib/lib/lib/types.js +2 -0
- package/lib/lib/lib/lib/userSdk/chat.d.ts +9 -0
- package/lib/lib/lib/lib/userSdk/chat.js +98 -0
- package/lib/lib/lib/lib/userSdk/index.d.ts +24 -0
- package/lib/lib/lib/lib/userSdk/index.js +27 -0
- package/lib/lib/lib/lib/userSdk/patients.d.ts +5 -0
- package/lib/lib/lib/lib/userSdk/patients.js +55 -0
- package/lib/lib/lib/lib/userSdk/schedule.d.ts +7 -0
- package/lib/lib/lib/lib/userSdk/schedule.js +76 -0
- package/lib/lib/lib/lib/userSdk/specialties.d.ts +4 -0
- package/lib/lib/lib/lib/userSdk/specialties.js +19 -0
- package/lib/lib/lib/lib/userSdk/videoVisit.d.ts +10 -0
- package/lib/lib/lib/lib/userSdk/videoVisit.js +147 -0
- package/lib/lib/lib/lib/utils.d.ts +4 -0
- package/lib/lib/lib/lib/utils.js +19 -0
- package/lib/lib/lib/lib/webhook/index.d.ts +8 -0
- package/lib/lib/lib/lib/webhook/index.js +55 -0
- package/lib/lib/lib/lib/webhook/responses.d.ts +36 -0
- package/lib/lib/lib/lib/webhook/responses.js +42 -0
- package/lib/lib/lib/lib/webhook/token.d.ts +2 -0
- package/lib/lib/lib/lib/webhook/token.js +23 -0
- package/lib/lib/lib/src/baseSdk/diagnostica.d.ts +6 -0
- package/lib/lib/lib/src/baseSdk/diagnostica.js +79 -0
- package/lib/lib/lib/src/baseSdk/index.d.ts +51 -0
- package/lib/lib/lib/src/baseSdk/index.js +66 -0
- package/lib/lib/lib/src/baseSdk/user.d.ts +9 -0
- package/lib/lib/lib/src/baseSdk/user.js +130 -0
- package/lib/lib/lib/src/index.d.ts +169 -0
- package/lib/lib/lib/src/index.js +22 -0
- package/lib/lib/lib/src/request/index.d.ts +2 -0
- package/lib/lib/lib/src/request/index.js +26 -0
- package/lib/lib/lib/src/request/token.d.ts +2 -0
- package/lib/lib/lib/src/request/token.js +34 -0
- package/lib/lib/lib/src/request/validation.d.ts +10 -0
- package/lib/lib/lib/src/request/validation.js +28 -0
- package/lib/lib/lib/src/schemas.d.ts +1340 -0
- package/lib/lib/lib/src/schemas.js +325 -0
- package/lib/lib/lib/src/types.d.ts +1 -0
- package/lib/lib/lib/src/types.js +2 -0
- package/lib/lib/lib/src/userSdk/chat.d.ts +9 -0
- package/lib/lib/lib/src/userSdk/chat.js +98 -0
- package/lib/lib/lib/src/userSdk/index.d.ts +102 -0
- package/lib/lib/lib/src/userSdk/index.js +27 -0
- package/lib/lib/lib/src/userSdk/patients.d.ts +5 -0
- package/lib/lib/lib/src/userSdk/patients.js +55 -0
- package/lib/lib/lib/src/userSdk/schedule.d.ts +7 -0
- package/lib/lib/lib/src/userSdk/schedule.js +76 -0
- package/lib/lib/lib/src/userSdk/specialties.d.ts +4 -0
- package/lib/lib/lib/src/userSdk/specialties.js +19 -0
- package/lib/lib/lib/src/userSdk/videoVisit.d.ts +10 -0
- package/lib/lib/lib/src/userSdk/videoVisit.js +147 -0
- package/lib/lib/lib/src/utils.d.ts +4 -0
- package/lib/lib/lib/src/utils.js +19 -0
- package/lib/lib/lib/src/webhook/index.d.ts +8 -0
- package/lib/lib/lib/src/webhook/index.js +55 -0
- package/lib/lib/lib/src/webhook/responses.d.ts +36 -0
- package/lib/lib/lib/src/webhook/responses.js +42 -0
- package/lib/lib/lib/src/webhook/token.d.ts +2 -0
- package/lib/lib/lib/src/webhook/token.js +23 -0
- package/lib/schemas.d.ts +30 -236
- package/lib/schemas.js +2 -34
- package/lib/test.js +1 -36
- package/lib/types.d.ts +2 -11
- package/lib/userSdk/chat.d.ts +1 -1
- package/lib/userSdk/patients.d.ts +2 -23
- package/lib/userSdk/patients.js +6 -34
- package/lib/userSdk/videoVisit.d.ts +2 -2
- package/lib/utils.d.ts +1 -1
- package/lib/utils.js +3 -3
- package/package.json +1 -1
package/lib/userSdk/patients.js
CHANGED
|
@@ -7,49 +7,21 @@ const validation_1 = require("../request/validation");
|
|
|
7
7
|
const schemas_1 = require("../schemas");
|
|
8
8
|
const utils_1 = require("../utils");
|
|
9
9
|
const getPatientMethods = (makeRequest) => {
|
|
10
|
-
const declarePatient =
|
|
11
|
-
const path = '/patient';
|
|
10
|
+
const declarePatient = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.patient]), zod_1.number(), async (patient) => {
|
|
12
11
|
const mappedPatient = {
|
|
13
12
|
lastname: patient.lastName,
|
|
14
13
|
firstname: patient.firstName,
|
|
15
|
-
identification_type: utils_1.
|
|
14
|
+
identification_type: utils_1.getIndetificationTypeId(patient.identificationType),
|
|
16
15
|
identification_value: patient.identificationValue,
|
|
17
16
|
birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
|
|
18
17
|
gender: patient.gender.toUpperCase(),
|
|
19
18
|
country_id: patient.countryId,
|
|
20
19
|
};
|
|
21
|
-
const
|
|
22
|
-
const response = await makeRequest('POST', path, {
|
|
20
|
+
const response = await makeRequest('POST', '/patient', {
|
|
23
21
|
user_data: mappedPatient,
|
|
24
|
-
channel: parsedChannel,
|
|
25
|
-
code,
|
|
26
22
|
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
askCode: response.data.ask_code,
|
|
31
|
-
};
|
|
32
|
-
return mappedResponse;
|
|
33
|
-
};
|
|
34
|
-
const getPatientId = async (patient) => {
|
|
35
|
-
const path = '/patient';
|
|
36
|
-
const mappedPatient = {
|
|
37
|
-
lastname: patient.lastName,
|
|
38
|
-
firstname: patient.firstName,
|
|
39
|
-
identification_type: utils_1.getIdetificationTypeId(patient.identificationType),
|
|
40
|
-
identification_value: patient.identificationValue,
|
|
41
|
-
birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
|
|
42
|
-
gender: patient.gender.toUpperCase(),
|
|
43
|
-
country_id: patient.countryId,
|
|
44
|
-
};
|
|
45
|
-
const response = await makeRequest('POST', path, {
|
|
46
|
-
user_data: mappedPatient,
|
|
47
|
-
});
|
|
48
|
-
return response.data.user_id;
|
|
49
|
-
};
|
|
50
|
-
return {
|
|
51
|
-
declarePatient: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.declarePatientParams]), schemas_1.doc24Schemas.declarePatientResponse, declarePatient),
|
|
52
|
-
getPatientId: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.patient]), zod_1.number(), getPatientId),
|
|
53
|
-
};
|
|
23
|
+
return response.data.patient_id;
|
|
24
|
+
});
|
|
25
|
+
return { declarePatient };
|
|
54
26
|
};
|
|
55
27
|
exports.getPatientMethods = getPatientMethods;
|
|
@@ -32,9 +32,9 @@ export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
|
|
|
32
32
|
patientId: number;
|
|
33
33
|
creationDate: Date;
|
|
34
34
|
user: {
|
|
35
|
+
id: number;
|
|
35
36
|
phone: string | null;
|
|
36
37
|
email: string | null;
|
|
37
|
-
id: number;
|
|
38
38
|
};
|
|
39
39
|
vcToken: string;
|
|
40
40
|
}>;
|
|
@@ -53,9 +53,9 @@ export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
|
|
|
53
53
|
patientId: number;
|
|
54
54
|
creationDate: Date;
|
|
55
55
|
user: {
|
|
56
|
+
id: number;
|
|
56
57
|
phone: string | null;
|
|
57
58
|
email: string | null;
|
|
58
|
-
id: number;
|
|
59
59
|
};
|
|
60
60
|
vcToken: string;
|
|
61
61
|
}[]>;
|
package/lib/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Doc24 } from '.';
|
|
2
2
|
export declare const parseDate: (str: string) => Date;
|
|
3
3
|
export declare const parseDateTime: (str: string) => Date;
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const getIndetificationTypeId: (type: Doc24.IdentificationType) => 6 | 5 | 999;
|
package/lib/utils.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getIndetificationTypeId = exports.parseDateTime = exports.parseDate = void 0;
|
|
4
4
|
const date_fns_1 = require("date-fns");
|
|
5
5
|
const timeZone = '-03';
|
|
6
6
|
const parseDate = (str) => exports.parseDateTime(`${str} 00:00:00`);
|
|
7
7
|
exports.parseDate = parseDate;
|
|
8
8
|
const parseDateTime = (str) => date_fns_1.parse(`${str} ${timeZone}`, 'yyyy-MM-dd HH:mm:ss X', new Date());
|
|
9
9
|
exports.parseDateTime = parseDateTime;
|
|
10
|
-
const
|
|
10
|
+
const getIndetificationTypeId = (type) => {
|
|
11
11
|
if (type === 'ndi')
|
|
12
12
|
return 6;
|
|
13
13
|
if (type === 'passport')
|
|
@@ -16,4 +16,4 @@ const getIdetificationTypeId = (type) => {
|
|
|
16
16
|
return 999;
|
|
17
17
|
throw new Error('Invalid identificationType');
|
|
18
18
|
};
|
|
19
|
-
exports.
|
|
19
|
+
exports.getIndetificationTypeId = getIndetificationTypeId;
|