@integraciones_doc24/sdk 1.3.0 → 1.4.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.d.ts +6 -6
- package/lib/baseSdk/user.d.ts +52 -4
- package/lib/baseSdk/user.js +67 -25
- package/lib/index.d.ts +45 -16
- package/lib/schemas.d.ts +236 -30
- package/lib/schemas.js +34 -2
- package/lib/types.d.ts +11 -2
- package/lib/userSdk/chat.d.ts +1 -1
- package/lib/userSdk/patients.d.ts +23 -2
- package/lib/userSdk/patients.js +33 -5
- package/lib/userSdk/videoVisit.d.ts +2 -2
- package/lib/utils.d.ts +1 -1
- package/lib/utils.js +3 -3
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -80,7 +80,7 @@ type BaseSdk = {
|
|
|
80
80
|
getAvailableScheduleClinics: () => Promise<AvailableScheduleClinics>;
|
|
81
81
|
enroll: (params: EnrollmentParams) => Promise<void>;
|
|
82
82
|
getConverageInfo: (identificationValue: string) => Promise<CoverageInfo>;
|
|
83
|
-
|
|
83
|
+
getVerificationCode: (params: getVerificationCodeParams) => Promise<void>;
|
|
84
84
|
getDiagnosticaHistory: (
|
|
85
85
|
patient: DiagnosticaPatientFilter,
|
|
86
86
|
from: Date,
|
|
@@ -11,22 +11,22 @@ export declare const getDiagnosticaMethods: (makeRequest: RequestMaker) => {
|
|
|
11
11
|
deepLink: string;
|
|
12
12
|
}[]>;
|
|
13
13
|
getDiagnosticaDeepLink: (kiosk: string, user: {
|
|
14
|
-
language: string;
|
|
15
14
|
firstName: string;
|
|
16
15
|
lastName: string;
|
|
17
|
-
birthday: Date;
|
|
18
16
|
identificationType: "dni";
|
|
19
17
|
identificationValue: string;
|
|
20
18
|
gender: "m" | "f";
|
|
21
19
|
phone: string;
|
|
22
20
|
email: string;
|
|
21
|
+
language: string;
|
|
22
|
+
birthday: Date;
|
|
23
23
|
}, patient: {
|
|
24
24
|
firstName: string;
|
|
25
25
|
lastName: string;
|
|
26
|
-
birthday: Date;
|
|
27
26
|
identificationType: "dni";
|
|
28
27
|
identificationValue: string;
|
|
29
28
|
gender: "m" | "f";
|
|
29
|
+
birthday: Date;
|
|
30
30
|
}) => Promise<{
|
|
31
31
|
forwardingRequired: true;
|
|
32
32
|
deepLink: string;
|
|
@@ -34,21 +34,21 @@ export declare const getDiagnosticaMethods: (makeRequest: RequestMaker) => {
|
|
|
34
34
|
forwardingRequired: false;
|
|
35
35
|
}>;
|
|
36
36
|
getDiagnosticaAccess: (kiosk: string, user: {
|
|
37
|
-
language: string;
|
|
38
37
|
firstName: string;
|
|
39
38
|
lastName: string;
|
|
40
|
-
birthday: Date;
|
|
41
39
|
identificationType: "dni";
|
|
42
40
|
identificationValue: string;
|
|
43
41
|
gender: "m" | "f";
|
|
44
42
|
phone: string;
|
|
45
43
|
email: string;
|
|
44
|
+
language: string;
|
|
45
|
+
birthday: Date;
|
|
46
46
|
}, patient: {
|
|
47
47
|
firstName: string;
|
|
48
48
|
lastName: string;
|
|
49
|
-
birthday: Date;
|
|
50
49
|
identificationType: "dni";
|
|
51
50
|
identificationValue: string;
|
|
52
51
|
gender: "m" | "f";
|
|
52
|
+
birthday: Date;
|
|
53
53
|
}) => Promise<void>;
|
|
54
54
|
};
|
package/lib/baseSdk/user.d.ts
CHANGED
|
@@ -1,25 +1,73 @@
|
|
|
1
1
|
import { RequestMaker } from '../request';
|
|
2
2
|
import { Doc24 } from '../types';
|
|
3
3
|
export declare const getUserMethods: (makeRequest: RequestMaker, url: string, credentials: Doc24.SdkCredentials) => {
|
|
4
|
-
declareUser: (
|
|
4
|
+
declareUser: (params: {
|
|
5
|
+
user: {
|
|
6
|
+
firstName: string;
|
|
7
|
+
lastName: string;
|
|
8
|
+
identificationType: "ndi" | "passport" | "credential";
|
|
9
|
+
identificationValue: string;
|
|
10
|
+
countryId: string;
|
|
11
|
+
birthdate: Date;
|
|
12
|
+
gender: "m" | "f";
|
|
13
|
+
phone: string;
|
|
14
|
+
email: string;
|
|
15
|
+
};
|
|
16
|
+
} & {
|
|
17
|
+
code?: string | undefined;
|
|
18
|
+
channel?: "1" | "2" | undefined;
|
|
19
|
+
}) => Promise<{
|
|
20
|
+
patientId: number | null;
|
|
21
|
+
userInfo: {
|
|
22
|
+
phone: string;
|
|
23
|
+
email: string;
|
|
24
|
+
} | null;
|
|
25
|
+
askCode: boolean;
|
|
26
|
+
userId: number;
|
|
27
|
+
}>;
|
|
28
|
+
getUserId: (user: {
|
|
5
29
|
firstName: string;
|
|
6
30
|
lastName: string;
|
|
7
31
|
identificationType: "ndi" | "passport" | "credential";
|
|
8
32
|
identificationValue: string;
|
|
33
|
+
countryId: string;
|
|
34
|
+
birthdate: Date;
|
|
9
35
|
gender: "m" | "f";
|
|
10
36
|
phone: string;
|
|
11
37
|
email: string;
|
|
38
|
+
}) => Promise<number>;
|
|
39
|
+
getVerificationCode: (params: {
|
|
40
|
+
identificationType: "ndi" | "passport" | "credential";
|
|
41
|
+
identificationValue: string;
|
|
42
|
+
channel: "1" | "2";
|
|
43
|
+
}) => Promise<any>;
|
|
44
|
+
getUserInstance: (user: number | {
|
|
45
|
+
firstName: string;
|
|
46
|
+
lastName: string;
|
|
47
|
+
identificationType: "ndi" | "passport" | "credential";
|
|
48
|
+
identificationValue: string;
|
|
12
49
|
countryId: string;
|
|
13
50
|
birthdate: Date;
|
|
51
|
+
gender: "m" | "f";
|
|
52
|
+
phone: string;
|
|
53
|
+
email: string;
|
|
14
54
|
}) => Promise<any>;
|
|
15
|
-
|
|
16
|
-
|
|
55
|
+
enroll: (params: {
|
|
56
|
+
firstName: string;
|
|
57
|
+
lastName: string;
|
|
58
|
+
birthdate: Date;
|
|
59
|
+
gender: "m" | "f";
|
|
60
|
+
email: string;
|
|
61
|
+
startDate: Date;
|
|
62
|
+
identificationNumber: string;
|
|
63
|
+
plan: string;
|
|
64
|
+
}) => Promise<void>;
|
|
17
65
|
getConverageInfo: (identificationValue: string) => Promise<{
|
|
18
66
|
firstName: string | null;
|
|
19
67
|
lastName: string | null;
|
|
68
|
+
birthdate: Date;
|
|
20
69
|
gender: "m" | "f";
|
|
21
70
|
email: string | null;
|
|
22
|
-
birthdate: Date;
|
|
23
71
|
identificationNumber: string;
|
|
24
72
|
plan: string | null;
|
|
25
73
|
financerId: number | null;
|
package/lib/baseSdk/user.js
CHANGED
|
@@ -8,11 +8,39 @@ const schemas_1 = require("../schemas");
|
|
|
8
8
|
const userSdk_1 = require("../userSdk");
|
|
9
9
|
const utils_1 = require("../utils");
|
|
10
10
|
const getUserMethods = (makeRequest, url, credentials) => {
|
|
11
|
+
const declareUser = async ({ user, channel, code, }) => {
|
|
12
|
+
const path = '/user';
|
|
13
|
+
const mappedUser = {
|
|
14
|
+
lastname: user.lastName,
|
|
15
|
+
firstname: user.firstName,
|
|
16
|
+
identification_type: utils_1.getIdetificationTypeId(user.identificationType),
|
|
17
|
+
identification_value: user.identificationValue,
|
|
18
|
+
birthdate: date_fns_1.format(user.birthdate, 'yyyy-MM-dd'),
|
|
19
|
+
gender: user.gender.toUpperCase(),
|
|
20
|
+
phone: user.phone,
|
|
21
|
+
email: user.email,
|
|
22
|
+
country_id: user.countryId,
|
|
23
|
+
};
|
|
24
|
+
const parsedChannel = channel ? parseInt(channel) : channel;
|
|
25
|
+
const response = await makeRequest('POST', path, {
|
|
26
|
+
user_data: mappedUser,
|
|
27
|
+
channel: parsedChannel,
|
|
28
|
+
code,
|
|
29
|
+
});
|
|
30
|
+
const mappedResponse = {
|
|
31
|
+
userId: response.data.user_id,
|
|
32
|
+
patientId: response.data.patient_id,
|
|
33
|
+
userInfo: response.data.user_info,
|
|
34
|
+
askCode: response.data.ask_code,
|
|
35
|
+
};
|
|
36
|
+
return mappedResponse;
|
|
37
|
+
};
|
|
11
38
|
const getUserId = async (user) => {
|
|
39
|
+
const path = '/search-user';
|
|
12
40
|
const mappedUser = {
|
|
13
41
|
lastname: user.lastName,
|
|
14
42
|
firstname: user.firstName,
|
|
15
|
-
identification_type: utils_1.
|
|
43
|
+
identification_type: utils_1.getIdetificationTypeId(user.identificationType),
|
|
16
44
|
identification_value: user.identificationValue,
|
|
17
45
|
birthdate: date_fns_1.format(user.birthdate, 'yyyy-MM-dd'),
|
|
18
46
|
gender: user.gender.toUpperCase(),
|
|
@@ -20,12 +48,41 @@ const getUserMethods = (makeRequest, url, credentials) => {
|
|
|
20
48
|
email: user.email,
|
|
21
49
|
country_id: user.countryId,
|
|
22
50
|
};
|
|
23
|
-
const response = await makeRequest('POST',
|
|
51
|
+
const response = await makeRequest('POST', path, {
|
|
24
52
|
user_data: mappedUser,
|
|
25
53
|
});
|
|
26
54
|
return response.data.user_id;
|
|
27
55
|
};
|
|
28
|
-
const
|
|
56
|
+
const getVerificationCode = async (params) => {
|
|
57
|
+
const path = '/send-verification-code';
|
|
58
|
+
const mappedParams = {
|
|
59
|
+
identification_type: utils_1.getIdetificationTypeId(params.identificationType),
|
|
60
|
+
identification_value: params.identificationValue,
|
|
61
|
+
channel: parseInt(params.channel),
|
|
62
|
+
};
|
|
63
|
+
await makeRequest('POST', path, mappedParams);
|
|
64
|
+
};
|
|
65
|
+
const getUserInstance = async (user) => {
|
|
66
|
+
const userId = typeof user === 'number' ? user : await getUserId(user);
|
|
67
|
+
return userSdk_1.userSdk(url, credentials, userId);
|
|
68
|
+
};
|
|
69
|
+
const enroll = async (params) => {
|
|
70
|
+
const path = `/enrollment`;
|
|
71
|
+
const mappedUser = {
|
|
72
|
+
firstname: params.firstName,
|
|
73
|
+
lastname: params.lastName,
|
|
74
|
+
gender: params.gender.toUpperCase(),
|
|
75
|
+
identification_number: params.identificationNumber,
|
|
76
|
+
birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
|
|
77
|
+
email: params.email,
|
|
78
|
+
plan: params.plan,
|
|
79
|
+
start_date: date_fns_1.format(params.startDate, 'yyyy-MM-dd'),
|
|
80
|
+
};
|
|
81
|
+
await makeRequest('POST', path, {
|
|
82
|
+
user_data: mappedUser,
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
const getConverageInfo = async (identificationValue) => {
|
|
29
86
|
const path = `/info-coverage/${identificationValue}`;
|
|
30
87
|
const response = await makeRequest('GET', path);
|
|
31
88
|
const raw = response.data.info;
|
|
@@ -58,31 +115,16 @@ const getUserMethods = (makeRequest, url, credentials) => {
|
|
|
58
115
|
: null,
|
|
59
116
|
};
|
|
60
117
|
return mappedCoverageInfo;
|
|
61
|
-
}
|
|
118
|
+
};
|
|
62
119
|
return {
|
|
63
|
-
declareUser: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.
|
|
120
|
+
declareUser: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.declareUserParams]), schemas_1.doc24Schemas.declareUserResponse, declareUser),
|
|
121
|
+
getUserId: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.user]), zod_1.number(), getUserId),
|
|
122
|
+
getVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.getVerificationCodeParams]), zod_1.void(), getVerificationCode),
|
|
64
123
|
getUserInstance: validation_1.validateFunction(zod_1.tuple([zod_1.union([schemas_1.doc24Schemas.user, zod_1.number()])]),
|
|
65
124
|
// TODO: validate?
|
|
66
|
-
zod_1.any(),
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}),
|
|
70
|
-
enroll: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.enrollmentParams]), zod_1.void(), async (params) => {
|
|
71
|
-
const path = `/enrollment`;
|
|
72
|
-
await makeRequest('POST', path, {
|
|
73
|
-
user_data: {
|
|
74
|
-
firstname: params.firstName,
|
|
75
|
-
lastname: params.lastName,
|
|
76
|
-
gender: params.gender.toUpperCase(),
|
|
77
|
-
identification_number: params.identificationNumber,
|
|
78
|
-
birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
|
|
79
|
-
email: params.email,
|
|
80
|
-
plan: params.plan,
|
|
81
|
-
start_date: date_fns_1.format(params.startDate, 'yyyy-MM-dd'),
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
}),
|
|
85
|
-
getConverageInfo,
|
|
125
|
+
zod_1.any(), getUserInstance),
|
|
126
|
+
enroll: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.enrollmentParams]), zod_1.void(), enroll),
|
|
127
|
+
getConverageInfo: validation_1.validateFunction(zod_1.tuple([zod_1.string()]), schemas_1.doc24Schemas.coverageInfo, getConverageInfo),
|
|
86
128
|
};
|
|
87
129
|
};
|
|
88
130
|
exports.getUserMethods = getUserMethods;
|
package/lib/index.d.ts
CHANGED
|
@@ -5,37 +5,61 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
|
|
|
5
5
|
eventHandlers: Doc24.Webhook.Events;
|
|
6
6
|
baseAddress: string;
|
|
7
7
|
}) => Promise<Doc24.Webhook.Handler>;
|
|
8
|
-
declareUser: (
|
|
8
|
+
declareUser: (params: {
|
|
9
|
+
user: {
|
|
10
|
+
firstName: string;
|
|
11
|
+
lastName: string;
|
|
12
|
+
identificationType: "ndi" | "passport" | "credential";
|
|
13
|
+
identificationValue: string;
|
|
14
|
+
countryId: string;
|
|
15
|
+
birthdate: Date;
|
|
16
|
+
gender: "m" | "f";
|
|
17
|
+
phone: string;
|
|
18
|
+
email: string;
|
|
19
|
+
};
|
|
20
|
+
} & {
|
|
21
|
+
code?: string | undefined;
|
|
22
|
+
channel?: "1" | "2" | undefined;
|
|
23
|
+
}) => Promise<{
|
|
24
|
+
patientId: number | null;
|
|
25
|
+
userInfo: {
|
|
26
|
+
phone: string;
|
|
27
|
+
email: string;
|
|
28
|
+
} | null;
|
|
29
|
+
askCode: boolean;
|
|
30
|
+
userId: number;
|
|
31
|
+
}>;
|
|
32
|
+
getUserId: (user: {
|
|
9
33
|
firstName: string;
|
|
10
34
|
lastName: string;
|
|
11
35
|
identificationType: "ndi" | "passport" | "credential";
|
|
12
36
|
identificationValue: string;
|
|
37
|
+
countryId: string;
|
|
38
|
+
birthdate: Date;
|
|
13
39
|
gender: "m" | "f";
|
|
14
40
|
phone: string;
|
|
15
41
|
email: string;
|
|
16
|
-
countryId: string;
|
|
17
|
-
birthdate: Date;
|
|
18
42
|
}) => Promise<number>;
|
|
19
43
|
getUserInstance: (user: number | {
|
|
20
44
|
firstName: string;
|
|
21
45
|
lastName: string;
|
|
22
46
|
identificationType: "ndi" | "passport" | "credential";
|
|
23
47
|
identificationValue: string;
|
|
48
|
+
countryId: string;
|
|
49
|
+
birthdate: Date;
|
|
24
50
|
gender: "m" | "f";
|
|
25
51
|
phone: string;
|
|
26
52
|
email: string;
|
|
27
|
-
countryId: string;
|
|
28
|
-
birthdate: Date;
|
|
29
53
|
}) => Promise<Doc24.UserSdk>;
|
|
30
54
|
getProfessional: (professionalId: number) => Promise<{
|
|
31
|
-
id: number;
|
|
32
|
-
logoUrl: string;
|
|
33
55
|
firstName: string;
|
|
34
56
|
lastName: string;
|
|
57
|
+
birthdate: Date;
|
|
35
58
|
gender: "m" | "f";
|
|
36
59
|
phone: string | null;
|
|
37
60
|
email: string;
|
|
38
|
-
|
|
61
|
+
id: number;
|
|
62
|
+
logoUrl: string;
|
|
39
63
|
specialties: {
|
|
40
64
|
id: number;
|
|
41
65
|
description: string;
|
|
@@ -73,9 +97,9 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
|
|
|
73
97
|
enroll: (params: {
|
|
74
98
|
firstName: string;
|
|
75
99
|
lastName: string;
|
|
100
|
+
birthdate: Date;
|
|
76
101
|
gender: "m" | "f";
|
|
77
102
|
email: string;
|
|
78
|
-
birthdate: Date;
|
|
79
103
|
startDate: Date;
|
|
80
104
|
identificationNumber: string;
|
|
81
105
|
plan: string;
|
|
@@ -83,9 +107,9 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
|
|
|
83
107
|
getConverageInfo: (identificationValue: string) => Promise<{
|
|
84
108
|
firstName: string | null;
|
|
85
109
|
lastName: string | null;
|
|
110
|
+
birthdate: Date;
|
|
86
111
|
gender: "m" | "f";
|
|
87
112
|
email: string | null;
|
|
88
|
-
birthdate: Date;
|
|
89
113
|
identificationNumber: string;
|
|
90
114
|
plan: string | null;
|
|
91
115
|
financerId: number | null;
|
|
@@ -104,6 +128,11 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
|
|
|
104
128
|
authorizationCode: string | null;
|
|
105
129
|
authorizationCodeExpiration: Date | null;
|
|
106
130
|
} | null>;
|
|
131
|
+
getVerificationCode: (params: {
|
|
132
|
+
identificationType: "ndi" | "passport" | "credential";
|
|
133
|
+
identificationValue: string;
|
|
134
|
+
channel: "1" | "2";
|
|
135
|
+
}) => Promise<any>;
|
|
107
136
|
getDiagnosticaHistory: (patient: {
|
|
108
137
|
identificationType: "ndi" | "passport" | "credential";
|
|
109
138
|
identificationValue: string;
|
|
@@ -115,22 +144,22 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
|
|
|
115
144
|
deepLink: string;
|
|
116
145
|
}[]>;
|
|
117
146
|
getDiagnosticaDeepLink: (kiosk: string, user: {
|
|
118
|
-
language: string;
|
|
119
147
|
firstName: string;
|
|
120
148
|
lastName: string;
|
|
121
|
-
birthday: Date;
|
|
122
149
|
identificationType: "dni";
|
|
123
150
|
identificationValue: string;
|
|
124
151
|
gender: "m" | "f";
|
|
125
152
|
phone: string;
|
|
126
153
|
email: string;
|
|
154
|
+
language: string;
|
|
155
|
+
birthday: Date;
|
|
127
156
|
}, patient: {
|
|
128
157
|
firstName: string;
|
|
129
158
|
lastName: string;
|
|
130
|
-
birthday: Date;
|
|
131
159
|
identificationType: "dni";
|
|
132
160
|
identificationValue: string;
|
|
133
161
|
gender: "m" | "f";
|
|
162
|
+
birthday: Date;
|
|
134
163
|
}) => Promise<{
|
|
135
164
|
forwardingRequired: true;
|
|
136
165
|
deepLink: string;
|
|
@@ -138,22 +167,22 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
|
|
|
138
167
|
forwardingRequired: false;
|
|
139
168
|
}>;
|
|
140
169
|
getDiagnosticaAccess: (kiosk: string, user: {
|
|
141
|
-
language: string;
|
|
142
170
|
firstName: string;
|
|
143
171
|
lastName: string;
|
|
144
|
-
birthday: Date;
|
|
145
172
|
identificationType: "dni";
|
|
146
173
|
identificationValue: string;
|
|
147
174
|
gender: "m" | "f";
|
|
148
175
|
phone: string;
|
|
149
176
|
email: string;
|
|
177
|
+
language: string;
|
|
178
|
+
birthday: Date;
|
|
150
179
|
}, patient: {
|
|
151
180
|
firstName: string;
|
|
152
181
|
lastName: string;
|
|
153
|
-
birthday: Date;
|
|
154
182
|
identificationType: "dni";
|
|
155
183
|
identificationValue: string;
|
|
156
184
|
gender: "m" | "f";
|
|
185
|
+
birthday: Date;
|
|
157
186
|
}) => Promise<void>;
|
|
158
187
|
}>;
|
|
159
188
|
export type { Doc24 } from './types';
|
package/lib/schemas.d.ts
CHANGED
|
@@ -51,21 +51,21 @@ export declare const doc24Schemas: {
|
|
|
51
51
|
lastName: string;
|
|
52
52
|
identificationType: "ndi" | "passport" | "credential";
|
|
53
53
|
identificationValue: string;
|
|
54
|
+
countryId: string;
|
|
55
|
+
birthdate: Date;
|
|
54
56
|
gender: "m" | "f";
|
|
55
57
|
phone: string;
|
|
56
58
|
email: string;
|
|
57
|
-
countryId: string;
|
|
58
|
-
birthdate: Date;
|
|
59
59
|
}, {
|
|
60
60
|
firstName: string;
|
|
61
61
|
lastName: string;
|
|
62
62
|
identificationType: "ndi" | "passport" | "credential";
|
|
63
63
|
identificationValue: string;
|
|
64
|
+
countryId: string;
|
|
65
|
+
birthdate: Date;
|
|
64
66
|
gender: "m" | "f";
|
|
65
67
|
phone: string;
|
|
66
68
|
email: string;
|
|
67
|
-
countryId: string;
|
|
68
|
-
birthdate: Date;
|
|
69
69
|
}>;
|
|
70
70
|
patient: import("zod").ZodObject<{
|
|
71
71
|
firstName: import("zod").ZodString;
|
|
@@ -80,17 +80,17 @@ export declare const doc24Schemas: {
|
|
|
80
80
|
lastName: string;
|
|
81
81
|
identificationType: "ndi" | "passport" | "credential";
|
|
82
82
|
identificationValue: string;
|
|
83
|
-
gender: "m" | "f";
|
|
84
83
|
countryId: string;
|
|
85
84
|
birthdate: Date;
|
|
85
|
+
gender: "m" | "f";
|
|
86
86
|
}, {
|
|
87
87
|
firstName: string;
|
|
88
88
|
lastName: string;
|
|
89
89
|
identificationType: "ndi" | "passport" | "credential";
|
|
90
90
|
identificationValue: string;
|
|
91
|
-
gender: "m" | "f";
|
|
92
91
|
countryId: string;
|
|
93
92
|
birthdate: Date;
|
|
93
|
+
gender: "m" | "f";
|
|
94
94
|
}>;
|
|
95
95
|
specialtyMode: import("zod").ZodEnum<["appointment", "chat", "instant"]>;
|
|
96
96
|
specialty: import("zod").ZodObject<{
|
|
@@ -353,13 +353,13 @@ export declare const doc24Schemas: {
|
|
|
353
353
|
email: import("zod").ZodNullable<import("zod").ZodString>;
|
|
354
354
|
phone: import("zod").ZodNullable<import("zod").ZodString>;
|
|
355
355
|
}, "strip", import("zod").ZodTypeAny, {
|
|
356
|
-
id: number;
|
|
357
356
|
phone: string | null;
|
|
358
357
|
email: string | null;
|
|
359
|
-
}, {
|
|
360
358
|
id: number;
|
|
359
|
+
}, {
|
|
361
360
|
phone: string | null;
|
|
362
361
|
email: string | null;
|
|
362
|
+
id: number;
|
|
363
363
|
}>;
|
|
364
364
|
vcToken: import("zod").ZodString;
|
|
365
365
|
appointment: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
@@ -399,9 +399,9 @@ export declare const doc24Schemas: {
|
|
|
399
399
|
patientId: number;
|
|
400
400
|
creationDate: Date;
|
|
401
401
|
user: {
|
|
402
|
-
id: number;
|
|
403
402
|
phone: string | null;
|
|
404
403
|
email: string | null;
|
|
404
|
+
id: number;
|
|
405
405
|
};
|
|
406
406
|
vcToken: string;
|
|
407
407
|
}, {
|
|
@@ -419,9 +419,9 @@ export declare const doc24Schemas: {
|
|
|
419
419
|
patientId: number;
|
|
420
420
|
creationDate: Date;
|
|
421
421
|
user: {
|
|
422
|
-
id: number;
|
|
423
422
|
phone: string | null;
|
|
424
423
|
email: string | null;
|
|
424
|
+
id: number;
|
|
425
425
|
};
|
|
426
426
|
vcToken: string;
|
|
427
427
|
}>;
|
|
@@ -671,14 +671,14 @@ export declare const doc24Schemas: {
|
|
|
671
671
|
brief: string;
|
|
672
672
|
}>;
|
|
673
673
|
}, "strip", import("zod").ZodTypeAny, {
|
|
674
|
-
id: number;
|
|
675
|
-
logoUrl: string;
|
|
676
674
|
firstName: string;
|
|
677
675
|
lastName: string;
|
|
676
|
+
birthdate: Date;
|
|
678
677
|
gender: "m" | "f";
|
|
679
678
|
phone: string | null;
|
|
680
679
|
email: string;
|
|
681
|
-
|
|
680
|
+
id: number;
|
|
681
|
+
logoUrl: string;
|
|
682
682
|
specialties: {
|
|
683
683
|
id: number;
|
|
684
684
|
description: string;
|
|
@@ -694,14 +694,14 @@ export declare const doc24Schemas: {
|
|
|
694
694
|
brief: string;
|
|
695
695
|
};
|
|
696
696
|
}, {
|
|
697
|
-
id: number;
|
|
698
|
-
logoUrl: string;
|
|
699
697
|
firstName: string;
|
|
700
698
|
lastName: string;
|
|
699
|
+
birthdate: Date;
|
|
701
700
|
gender: "m" | "f";
|
|
702
701
|
phone: string | null;
|
|
703
702
|
email: string;
|
|
704
|
-
|
|
703
|
+
id: number;
|
|
704
|
+
logoUrl: string;
|
|
705
705
|
specialties: {
|
|
706
706
|
id: number;
|
|
707
707
|
description: string;
|
|
@@ -815,13 +815,13 @@ export declare const doc24Schemas: {
|
|
|
815
815
|
firstName: import("zod").ZodString;
|
|
816
816
|
lastName: import("zod").ZodString;
|
|
817
817
|
}, "strip", import("zod").ZodTypeAny, {
|
|
818
|
-
id: number;
|
|
819
818
|
firstName: string;
|
|
820
819
|
lastName: string;
|
|
821
|
-
}, {
|
|
822
820
|
id: number;
|
|
821
|
+
}, {
|
|
823
822
|
firstName: string;
|
|
824
823
|
lastName: string;
|
|
824
|
+
id: number;
|
|
825
825
|
}>;
|
|
826
826
|
patientLastPost: import("zod").ZodNullable<import("zod").ZodDate>;
|
|
827
827
|
professional: import("zod").ZodObject<{
|
|
@@ -853,9 +853,9 @@ export declare const doc24Schemas: {
|
|
|
853
853
|
}, "strip", import("zod").ZodTypeAny, {
|
|
854
854
|
id: number;
|
|
855
855
|
patient: {
|
|
856
|
-
id: number;
|
|
857
856
|
firstName: string;
|
|
858
857
|
lastName: string;
|
|
858
|
+
id: number;
|
|
859
859
|
};
|
|
860
860
|
professional: {
|
|
861
861
|
id: number;
|
|
@@ -877,9 +877,9 @@ export declare const doc24Schemas: {
|
|
|
877
877
|
}, {
|
|
878
878
|
id: number;
|
|
879
879
|
patient: {
|
|
880
|
-
id: number;
|
|
881
880
|
firstName: string;
|
|
882
881
|
lastName: string;
|
|
882
|
+
id: number;
|
|
883
883
|
};
|
|
884
884
|
professional: {
|
|
885
885
|
id: number;
|
|
@@ -927,18 +927,18 @@ export declare const doc24Schemas: {
|
|
|
927
927
|
}, "strip", import("zod").ZodTypeAny, {
|
|
928
928
|
firstName: string;
|
|
929
929
|
lastName: string;
|
|
930
|
+
birthdate: Date;
|
|
930
931
|
gender: "m" | "f";
|
|
931
932
|
email: string;
|
|
932
|
-
birthdate: Date;
|
|
933
933
|
startDate: Date;
|
|
934
934
|
identificationNumber: string;
|
|
935
935
|
plan: string;
|
|
936
936
|
}, {
|
|
937
937
|
firstName: string;
|
|
938
938
|
lastName: string;
|
|
939
|
+
birthdate: Date;
|
|
939
940
|
gender: "m" | "f";
|
|
940
941
|
email: string;
|
|
941
|
-
birthdate: Date;
|
|
942
942
|
startDate: Date;
|
|
943
943
|
identificationNumber: string;
|
|
944
944
|
plan: string;
|
|
@@ -984,25 +984,25 @@ export declare const doc24Schemas: {
|
|
|
984
984
|
email: import("zod").ZodString;
|
|
985
985
|
language: import("zod").ZodString;
|
|
986
986
|
}>, "strip", import("zod").ZodTypeAny, {
|
|
987
|
-
language: string;
|
|
988
987
|
firstName: string;
|
|
989
988
|
lastName: string;
|
|
990
|
-
birthday: Date;
|
|
991
989
|
identificationType: "dni";
|
|
992
990
|
identificationValue: string;
|
|
993
991
|
gender: "m" | "f";
|
|
994
992
|
phone: string;
|
|
995
993
|
email: string;
|
|
996
|
-
}, {
|
|
997
994
|
language: string;
|
|
995
|
+
birthday: Date;
|
|
996
|
+
}, {
|
|
998
997
|
firstName: string;
|
|
999
998
|
lastName: string;
|
|
1000
|
-
birthday: Date;
|
|
1001
999
|
identificationType: "dni";
|
|
1002
1000
|
identificationValue: string;
|
|
1003
1001
|
gender: "m" | "f";
|
|
1004
1002
|
phone: string;
|
|
1005
1003
|
email: string;
|
|
1004
|
+
language: string;
|
|
1005
|
+
birthday: Date;
|
|
1006
1006
|
}>;
|
|
1007
1007
|
diagnosticaPatient: import("zod").ZodObject<{
|
|
1008
1008
|
firstName: import("zod").ZodString;
|
|
@@ -1014,17 +1014,17 @@ export declare const doc24Schemas: {
|
|
|
1014
1014
|
}, "strip", import("zod").ZodTypeAny, {
|
|
1015
1015
|
firstName: string;
|
|
1016
1016
|
lastName: string;
|
|
1017
|
-
birthday: Date;
|
|
1018
1017
|
identificationType: "dni";
|
|
1019
1018
|
identificationValue: string;
|
|
1020
1019
|
gender: "m" | "f";
|
|
1020
|
+
birthday: Date;
|
|
1021
1021
|
}, {
|
|
1022
1022
|
firstName: string;
|
|
1023
1023
|
lastName: string;
|
|
1024
|
-
birthday: Date;
|
|
1025
1024
|
identificationType: "dni";
|
|
1026
1025
|
identificationValue: string;
|
|
1027
1026
|
gender: "m" | "f";
|
|
1027
|
+
birthday: Date;
|
|
1028
1028
|
}>;
|
|
1029
1029
|
diagnosticaDeepLinkResponse: import("zod").ZodUnion<[import("zod").ZodObject<{
|
|
1030
1030
|
forwardingRequired: import("zod").ZodLiteral<true>;
|
|
@@ -1068,9 +1068,9 @@ export declare const doc24Schemas: {
|
|
|
1068
1068
|
}, "strip", import("zod").ZodTypeAny, {
|
|
1069
1069
|
firstName: string | null;
|
|
1070
1070
|
lastName: string | null;
|
|
1071
|
+
birthdate: Date;
|
|
1071
1072
|
gender: "m" | "f";
|
|
1072
1073
|
email: string | null;
|
|
1073
|
-
birthdate: Date;
|
|
1074
1074
|
identificationNumber: string;
|
|
1075
1075
|
plan: string | null;
|
|
1076
1076
|
financerId: number | null;
|
|
@@ -1091,9 +1091,9 @@ export declare const doc24Schemas: {
|
|
|
1091
1091
|
}, {
|
|
1092
1092
|
firstName: string | null;
|
|
1093
1093
|
lastName: string | null;
|
|
1094
|
+
birthdate: Date;
|
|
1094
1095
|
gender: "m" | "f";
|
|
1095
1096
|
email: string | null;
|
|
1096
|
-
birthdate: Date;
|
|
1097
1097
|
identificationNumber: string;
|
|
1098
1098
|
plan: string | null;
|
|
1099
1099
|
financerId: number | null;
|
|
@@ -1112,4 +1112,210 @@ export declare const doc24Schemas: {
|
|
|
1112
1112
|
authorizationCode: string | null;
|
|
1113
1113
|
authorizationCodeExpiration: Date | null;
|
|
1114
1114
|
}>>;
|
|
1115
|
+
getVerificationCodeParams: import("zod").ZodObject<{
|
|
1116
|
+
identificationType: import("zod").ZodEnum<["ndi", "passport", "credential"]>;
|
|
1117
|
+
identificationValue: import("zod").ZodString;
|
|
1118
|
+
channel: import("zod").ZodEnum<["1", "2"]>;
|
|
1119
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1120
|
+
identificationType: "ndi" | "passport" | "credential";
|
|
1121
|
+
identificationValue: string;
|
|
1122
|
+
channel: "1" | "2";
|
|
1123
|
+
}, {
|
|
1124
|
+
identificationType: "ndi" | "passport" | "credential";
|
|
1125
|
+
identificationValue: string;
|
|
1126
|
+
channel: "1" | "2";
|
|
1127
|
+
}>;
|
|
1128
|
+
declareUserParams: import("zod").ZodIntersection<import("zod").ZodObject<{
|
|
1129
|
+
user: import("zod").ZodObject<import("zod").extendShape<{
|
|
1130
|
+
firstName: import("zod").ZodString;
|
|
1131
|
+
lastName: import("zod").ZodString;
|
|
1132
|
+
identificationType: import("zod").ZodEnum<["ndi", "passport", "credential"]>;
|
|
1133
|
+
identificationValue: import("zod").ZodString;
|
|
1134
|
+
countryId: import("zod").ZodString;
|
|
1135
|
+
birthdate: import("zod").ZodDate;
|
|
1136
|
+
gender: import("zod").ZodEnum<["m", "f"]>;
|
|
1137
|
+
}, {
|
|
1138
|
+
phone: import("zod").ZodString;
|
|
1139
|
+
email: import("zod").ZodString;
|
|
1140
|
+
}>, "strip", import("zod").ZodTypeAny, {
|
|
1141
|
+
firstName: string;
|
|
1142
|
+
lastName: string;
|
|
1143
|
+
identificationType: "ndi" | "passport" | "credential";
|
|
1144
|
+
identificationValue: string;
|
|
1145
|
+
countryId: string;
|
|
1146
|
+
birthdate: Date;
|
|
1147
|
+
gender: "m" | "f";
|
|
1148
|
+
phone: string;
|
|
1149
|
+
email: string;
|
|
1150
|
+
}, {
|
|
1151
|
+
firstName: string;
|
|
1152
|
+
lastName: string;
|
|
1153
|
+
identificationType: "ndi" | "passport" | "credential";
|
|
1154
|
+
identificationValue: string;
|
|
1155
|
+
countryId: string;
|
|
1156
|
+
birthdate: Date;
|
|
1157
|
+
gender: "m" | "f";
|
|
1158
|
+
phone: string;
|
|
1159
|
+
email: string;
|
|
1160
|
+
}>;
|
|
1161
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1162
|
+
user: {
|
|
1163
|
+
firstName: string;
|
|
1164
|
+
lastName: string;
|
|
1165
|
+
identificationType: "ndi" | "passport" | "credential";
|
|
1166
|
+
identificationValue: string;
|
|
1167
|
+
countryId: string;
|
|
1168
|
+
birthdate: Date;
|
|
1169
|
+
gender: "m" | "f";
|
|
1170
|
+
phone: string;
|
|
1171
|
+
email: string;
|
|
1172
|
+
};
|
|
1173
|
+
}, {
|
|
1174
|
+
user: {
|
|
1175
|
+
firstName: string;
|
|
1176
|
+
lastName: string;
|
|
1177
|
+
identificationType: "ndi" | "passport" | "credential";
|
|
1178
|
+
identificationValue: string;
|
|
1179
|
+
countryId: string;
|
|
1180
|
+
birthdate: Date;
|
|
1181
|
+
gender: "m" | "f";
|
|
1182
|
+
phone: string;
|
|
1183
|
+
email: string;
|
|
1184
|
+
};
|
|
1185
|
+
}>, import("zod").ZodObject<{
|
|
1186
|
+
channel: import("zod").ZodOptional<import("zod").ZodEnum<["1", "2"]>>;
|
|
1187
|
+
code: import("zod").ZodOptional<import("zod").ZodString>;
|
|
1188
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1189
|
+
code?: string | undefined;
|
|
1190
|
+
channel?: "1" | "2" | undefined;
|
|
1191
|
+
}, {
|
|
1192
|
+
code?: string | undefined;
|
|
1193
|
+
channel?: "1" | "2" | undefined;
|
|
1194
|
+
}>>;
|
|
1195
|
+
declareUserResponse: import("zod").ZodObject<import("zod").extendShape<{
|
|
1196
|
+
patientId: import("zod").ZodNullable<import("zod").ZodNumber>;
|
|
1197
|
+
userInfo: import("zod").ZodNullable<import("zod").ZodObject<{
|
|
1198
|
+
email: import("zod").ZodString;
|
|
1199
|
+
phone: import("zod").ZodString;
|
|
1200
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1201
|
+
phone: string;
|
|
1202
|
+
email: string;
|
|
1203
|
+
}, {
|
|
1204
|
+
phone: string;
|
|
1205
|
+
email: string;
|
|
1206
|
+
}>>;
|
|
1207
|
+
askCode: import("zod").ZodBoolean;
|
|
1208
|
+
}, {
|
|
1209
|
+
userId: import("zod").ZodNumber;
|
|
1210
|
+
}>, "strip", import("zod").ZodTypeAny, {
|
|
1211
|
+
patientId: number | null;
|
|
1212
|
+
userInfo: {
|
|
1213
|
+
phone: string;
|
|
1214
|
+
email: string;
|
|
1215
|
+
} | null;
|
|
1216
|
+
askCode: boolean;
|
|
1217
|
+
userId: number;
|
|
1218
|
+
}, {
|
|
1219
|
+
patientId: number | null;
|
|
1220
|
+
userInfo: {
|
|
1221
|
+
phone: string;
|
|
1222
|
+
email: string;
|
|
1223
|
+
} | null;
|
|
1224
|
+
askCode: boolean;
|
|
1225
|
+
userId: number;
|
|
1226
|
+
}>;
|
|
1227
|
+
declarePatientParams: import("zod").ZodIntersection<import("zod").ZodObject<{
|
|
1228
|
+
patient: import("zod").ZodObject<{
|
|
1229
|
+
firstName: import("zod").ZodString;
|
|
1230
|
+
lastName: import("zod").ZodString;
|
|
1231
|
+
identificationType: import("zod").ZodEnum<["ndi", "passport", "credential"]>;
|
|
1232
|
+
identificationValue: import("zod").ZodString;
|
|
1233
|
+
countryId: import("zod").ZodString;
|
|
1234
|
+
birthdate: import("zod").ZodDate;
|
|
1235
|
+
gender: import("zod").ZodEnum<["m", "f"]>;
|
|
1236
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1237
|
+
firstName: string;
|
|
1238
|
+
lastName: string;
|
|
1239
|
+
identificationType: "ndi" | "passport" | "credential";
|
|
1240
|
+
identificationValue: string;
|
|
1241
|
+
countryId: string;
|
|
1242
|
+
birthdate: Date;
|
|
1243
|
+
gender: "m" | "f";
|
|
1244
|
+
}, {
|
|
1245
|
+
firstName: string;
|
|
1246
|
+
lastName: string;
|
|
1247
|
+
identificationType: "ndi" | "passport" | "credential";
|
|
1248
|
+
identificationValue: string;
|
|
1249
|
+
countryId: string;
|
|
1250
|
+
birthdate: Date;
|
|
1251
|
+
gender: "m" | "f";
|
|
1252
|
+
}>;
|
|
1253
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1254
|
+
patient: {
|
|
1255
|
+
firstName: string;
|
|
1256
|
+
lastName: string;
|
|
1257
|
+
identificationType: "ndi" | "passport" | "credential";
|
|
1258
|
+
identificationValue: string;
|
|
1259
|
+
countryId: string;
|
|
1260
|
+
birthdate: Date;
|
|
1261
|
+
gender: "m" | "f";
|
|
1262
|
+
};
|
|
1263
|
+
}, {
|
|
1264
|
+
patient: {
|
|
1265
|
+
firstName: string;
|
|
1266
|
+
lastName: string;
|
|
1267
|
+
identificationType: "ndi" | "passport" | "credential";
|
|
1268
|
+
identificationValue: string;
|
|
1269
|
+
countryId: string;
|
|
1270
|
+
birthdate: Date;
|
|
1271
|
+
gender: "m" | "f";
|
|
1272
|
+
};
|
|
1273
|
+
}>, import("zod").ZodObject<{
|
|
1274
|
+
channel: import("zod").ZodOptional<import("zod").ZodEnum<["1", "2"]>>;
|
|
1275
|
+
code: import("zod").ZodOptional<import("zod").ZodString>;
|
|
1276
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1277
|
+
code?: string | undefined;
|
|
1278
|
+
channel?: "1" | "2" | undefined;
|
|
1279
|
+
}, {
|
|
1280
|
+
code?: string | undefined;
|
|
1281
|
+
channel?: "1" | "2" | undefined;
|
|
1282
|
+
}>>;
|
|
1283
|
+
declarePatientResponse: import("zod").ZodObject<{
|
|
1284
|
+
patientId: import("zod").ZodNullable<import("zod").ZodNumber>;
|
|
1285
|
+
userInfo: import("zod").ZodNullable<import("zod").ZodObject<{
|
|
1286
|
+
email: import("zod").ZodString;
|
|
1287
|
+
phone: import("zod").ZodString;
|
|
1288
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1289
|
+
phone: string;
|
|
1290
|
+
email: string;
|
|
1291
|
+
}, {
|
|
1292
|
+
phone: string;
|
|
1293
|
+
email: string;
|
|
1294
|
+
}>>;
|
|
1295
|
+
askCode: import("zod").ZodBoolean;
|
|
1296
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1297
|
+
patientId: number | null;
|
|
1298
|
+
userInfo: {
|
|
1299
|
+
phone: string;
|
|
1300
|
+
email: string;
|
|
1301
|
+
} | null;
|
|
1302
|
+
askCode: boolean;
|
|
1303
|
+
}, {
|
|
1304
|
+
patientId: number | null;
|
|
1305
|
+
userInfo: {
|
|
1306
|
+
phone: string;
|
|
1307
|
+
email: string;
|
|
1308
|
+
} | null;
|
|
1309
|
+
askCode: boolean;
|
|
1310
|
+
}>;
|
|
1311
|
+
verificationParams: import("zod").ZodObject<{
|
|
1312
|
+
channel: import("zod").ZodOptional<import("zod").ZodEnum<["1", "2"]>>;
|
|
1313
|
+
code: import("zod").ZodOptional<import("zod").ZodString>;
|
|
1314
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1315
|
+
code?: string | undefined;
|
|
1316
|
+
channel?: "1" | "2" | undefined;
|
|
1317
|
+
}, {
|
|
1318
|
+
code?: string | undefined;
|
|
1319
|
+
channel?: "1" | "2" | undefined;
|
|
1320
|
+
}>;
|
|
1115
1321
|
};
|
package/lib/schemas.js
CHANGED
|
@@ -14,6 +14,8 @@ const basePersonData = zod_1.object({
|
|
|
14
14
|
birthdate: zod_1.date(),
|
|
15
15
|
gender,
|
|
16
16
|
});
|
|
17
|
+
const patient = basePersonData;
|
|
18
|
+
const user = basePersonData.extend({ phone: zod_1.string(), email: zod_1.string() });
|
|
17
19
|
const specialtyMode = zod_1.enum(['appointment', 'chat', 'instant']);
|
|
18
20
|
const specialty = zod_1.object({
|
|
19
21
|
id: zod_1.number(),
|
|
@@ -172,12 +174,36 @@ const coverageInfo = zod_1.object({
|
|
|
172
174
|
authorizationCode: zod_1.string().nullable(),
|
|
173
175
|
authorizationCodeExpiration: zod_1.date().nullable(),
|
|
174
176
|
}).nullable();
|
|
177
|
+
const getVerificationCodeParams = zod_1.object({
|
|
178
|
+
identificationType,
|
|
179
|
+
identificationValue: zod_1.string(),
|
|
180
|
+
channel: zod_1.enum(['1', '2']),
|
|
181
|
+
});
|
|
182
|
+
const verificationParams = zod_1.object({
|
|
183
|
+
channel: zod_1.enum(['1', '2']).optional(),
|
|
184
|
+
code: zod_1.string().optional(),
|
|
185
|
+
});
|
|
186
|
+
const declareUserParams = zod_1.object({
|
|
187
|
+
user,
|
|
188
|
+
}).and(verificationParams);
|
|
189
|
+
const declarePatientParams = zod_1.object({
|
|
190
|
+
patient,
|
|
191
|
+
}).and(verificationParams);
|
|
192
|
+
const declarePatientResponse = zod_1.object({
|
|
193
|
+
patientId: zod_1.number().nullable(),
|
|
194
|
+
userInfo: zod_1.object({
|
|
195
|
+
email: zod_1.string(),
|
|
196
|
+
phone: zod_1.string(),
|
|
197
|
+
}).nullable(),
|
|
198
|
+
askCode: zod_1.boolean(),
|
|
199
|
+
});
|
|
200
|
+
const declareUserResponse = declarePatientResponse.extend({ userId: zod_1.number() });
|
|
175
201
|
exports.doc24Schemas = {
|
|
176
202
|
identificationType,
|
|
177
203
|
sdkCredentials,
|
|
178
204
|
sdkParams: zod_1.object({ url: zod_1.string(), credentials: sdkCredentials }),
|
|
179
|
-
user
|
|
180
|
-
patient
|
|
205
|
+
user,
|
|
206
|
+
patient,
|
|
181
207
|
specialtyMode,
|
|
182
208
|
specialty,
|
|
183
209
|
scheduleAvailabilityFilter,
|
|
@@ -291,4 +317,10 @@ exports.doc24Schemas = {
|
|
|
291
317
|
diagnosticaPatient,
|
|
292
318
|
diagnosticaDeepLinkResponse,
|
|
293
319
|
coverageInfo,
|
|
320
|
+
getVerificationCodeParams,
|
|
321
|
+
declareUserParams,
|
|
322
|
+
declareUserResponse,
|
|
323
|
+
declarePatientParams,
|
|
324
|
+
declarePatientResponse,
|
|
325
|
+
verificationParams,
|
|
294
326
|
};
|
package/lib/types.d.ts
CHANGED
|
@@ -30,19 +30,28 @@ export declare namespace Doc24 {
|
|
|
30
30
|
type DiagnosticaPatient = TypeOf<typeof doc24Schemas.diagnosticaPatient>;
|
|
31
31
|
type DiagnosticaHistoryAppointment = TypeOf<typeof doc24Schemas.diagnosticaHistoryAppointment>;
|
|
32
32
|
type DiagnosticaDeepLinkResponse = TypeOf<typeof doc24Schemas.diagnosticaDeepLinkResponse>;
|
|
33
|
+
type getVerificationCodeParams = TypeOf<typeof doc24Schemas.getVerificationCodeParams>;
|
|
34
|
+
type DeclareUserParams = TypeOf<typeof doc24Schemas.declareUserParams>;
|
|
35
|
+
type DeclareUserResponse = TypeOf<typeof doc24Schemas.declareUserResponse>;
|
|
36
|
+
type DeclarePatientParams = TypeOf<typeof doc24Schemas.declarePatientParams>;
|
|
37
|
+
type DeclarePatientResponse = TypeOf<typeof doc24Schemas.declarePatientResponse>;
|
|
38
|
+
type VerificationParams = TypeOf<typeof doc24Schemas.verificationParams>;
|
|
33
39
|
type BaseSdk = {
|
|
34
|
-
declareUser: (
|
|
40
|
+
declareUser: (params: DeclareUserParams) => Promise<DeclareUserResponse>;
|
|
41
|
+
getUserId: (user: User) => Promise<number>;
|
|
35
42
|
getUserInstance: (user: User | number) => Promise<UserSdk>;
|
|
36
43
|
getProfessional: (professionalId: number) => Promise<Professional>;
|
|
37
44
|
getAvailableScheduleClinics: () => Promise<AvailableScheduleClinics>;
|
|
38
45
|
enroll: (params: EnrollmentParams) => Promise<void>;
|
|
39
46
|
getConverageInfo: (identificationValue: string) => Promise<CoverageInfo>;
|
|
47
|
+
getVerificationCode: (params: getVerificationCodeParams) => Promise<any>;
|
|
40
48
|
getDiagnosticaHistory: (patient: DiagnosticaPatientFilter, from: Date, to: Date) => Promise<DiagnosticaHistoryAppointment[]>;
|
|
41
49
|
getDiagnosticaDeepLink: (kiosk: string, user: DiagnosticaUser, patient: DiagnosticaPatient) => Promise<DiagnosticaDeepLinkResponse>;
|
|
42
50
|
getDiagnosticaAccess: (kiosk: string, user: DiagnosticaUser, patient: DiagnosticaPatient) => Promise<void>;
|
|
43
51
|
};
|
|
44
52
|
type UserSdk = {
|
|
45
|
-
declarePatient: (
|
|
53
|
+
declarePatient: (params: DeclarePatientParams) => Promise<DeclarePatientResponse>;
|
|
54
|
+
getPatientId: (patient: Patient) => Promise<number>;
|
|
46
55
|
getSpecialties: (mode: SpecialtyMode, language: string) => Promise<Specialty[]>;
|
|
47
56
|
getScheduleDates: (patientId: number, filter?: ScheduleAvailabilityFilter) => Promise<Date[]>;
|
|
48
57
|
getSchedule: (patientId: number, specialtyId: number, filter?: ScheduleFilter) => Promise<AvailableAppointment[]>;
|
package/lib/userSdk/chat.d.ts
CHANGED
|
@@ -24,9 +24,9 @@ export declare const getChatMethods: (makeRequest: RequestMaker) => {
|
|
|
24
24
|
getPatientChats: (patientId: number) => Promise<{
|
|
25
25
|
id: number;
|
|
26
26
|
patient: {
|
|
27
|
-
id: number;
|
|
28
27
|
firstName: string;
|
|
29
28
|
lastName: string;
|
|
29
|
+
id: number;
|
|
30
30
|
};
|
|
31
31
|
professional: {
|
|
32
32
|
id: number;
|
|
@@ -1,12 +1,33 @@
|
|
|
1
1
|
import { RequestMaker } from '../request';
|
|
2
2
|
export declare const getPatientMethods: (makeRequest: RequestMaker) => {
|
|
3
|
-
declarePatient: (
|
|
3
|
+
declarePatient: (params: {
|
|
4
|
+
patient: {
|
|
5
|
+
firstName: string;
|
|
6
|
+
lastName: string;
|
|
7
|
+
identificationType: "ndi" | "passport" | "credential";
|
|
8
|
+
identificationValue: string;
|
|
9
|
+
countryId: string;
|
|
10
|
+
birthdate: Date;
|
|
11
|
+
gender: "m" | "f";
|
|
12
|
+
};
|
|
13
|
+
} & {
|
|
14
|
+
code?: string | undefined;
|
|
15
|
+
channel?: "1" | "2" | undefined;
|
|
16
|
+
}) => Promise<{
|
|
17
|
+
patientId: number | null;
|
|
18
|
+
userInfo: {
|
|
19
|
+
phone: string;
|
|
20
|
+
email: string;
|
|
21
|
+
} | null;
|
|
22
|
+
askCode: boolean;
|
|
23
|
+
}>;
|
|
24
|
+
getPatientId: (patient: {
|
|
4
25
|
firstName: string;
|
|
5
26
|
lastName: string;
|
|
6
27
|
identificationType: "ndi" | "passport" | "credential";
|
|
7
28
|
identificationValue: string;
|
|
8
|
-
gender: "m" | "f";
|
|
9
29
|
countryId: string;
|
|
10
30
|
birthdate: Date;
|
|
31
|
+
gender: "m" | "f";
|
|
11
32
|
}) => Promise<number>;
|
|
12
33
|
};
|
package/lib/userSdk/patients.js
CHANGED
|
@@ -7,21 +7,49 @@ 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 =
|
|
10
|
+
const declarePatient = async ({ patient, channel, code, }) => {
|
|
11
|
+
const path = '/patient';
|
|
11
12
|
const mappedPatient = {
|
|
12
13
|
lastname: patient.lastName,
|
|
13
14
|
firstname: patient.firstName,
|
|
14
|
-
identification_type: utils_1.
|
|
15
|
+
identification_type: utils_1.getIdetificationTypeId(patient.identificationType),
|
|
15
16
|
identification_value: patient.identificationValue,
|
|
16
17
|
birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
|
|
17
18
|
gender: patient.gender.toUpperCase(),
|
|
18
19
|
country_id: patient.countryId,
|
|
19
20
|
};
|
|
20
|
-
const
|
|
21
|
+
const parsedChannel = channel ? parseInt(channel) : channel;
|
|
22
|
+
const response = await makeRequest('POST', path, {
|
|
23
|
+
user_data: mappedPatient,
|
|
24
|
+
channel: parsedChannel,
|
|
25
|
+
code,
|
|
26
|
+
});
|
|
27
|
+
const mappedResponse = {
|
|
28
|
+
patientId: response.data.patient_id,
|
|
29
|
+
userInfo: response.data.user_info,
|
|
30
|
+
askCode: response.data.ask_code,
|
|
31
|
+
};
|
|
32
|
+
return mappedResponse;
|
|
33
|
+
};
|
|
34
|
+
const getPatientId = async (patient) => {
|
|
35
|
+
const path = '/search-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, {
|
|
21
46
|
user_data: mappedPatient,
|
|
22
47
|
});
|
|
23
48
|
return response.data.patient_id;
|
|
24
|
-
}
|
|
25
|
-
return {
|
|
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
|
+
};
|
|
26
54
|
};
|
|
27
55
|
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;
|
|
36
35
|
phone: string | null;
|
|
37
36
|
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;
|
|
57
56
|
phone: string | null;
|
|
58
57
|
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 getIdetificationTypeId: (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.getIdetificationTypeId = 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 getIdetificationTypeId = (type) => {
|
|
11
11
|
if (type === 'ndi')
|
|
12
12
|
return 6;
|
|
13
13
|
if (type === 'passport')
|
|
@@ -16,4 +16,4 @@ const getIndetificationTypeId = (type) => {
|
|
|
16
16
|
return 999;
|
|
17
17
|
throw new Error('Invalid identificationType');
|
|
18
18
|
};
|
|
19
|
-
exports.
|
|
19
|
+
exports.getIdetificationTypeId = getIdetificationTypeId;
|
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@integraciones_doc24/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"publishConfig": {
|
|
5
|
-
"tag": "
|
|
5
|
+
"tag": "latest"
|
|
6
6
|
},
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"build": "tsc",
|
|
11
|
-
"prepublish": "npm run build"
|
|
11
|
+
"prepublish": "npm run build",
|
|
12
|
+
"test": "npx tsx test"
|
|
12
13
|
},
|
|
13
14
|
"keywords": [],
|
|
14
15
|
"author": "",
|