@integraciones_doc24/sdk 1.8.3 → 1.9.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 +16 -2
- package/lib/baseSdk/external.d.ts +7 -1
- package/lib/baseSdk/external.js +13 -2
- package/lib/baseSdk/user.d.ts +2 -2
- package/lib/baseSdk/user.js +2 -2
- package/lib/index.d.ts +9 -3
- package/lib/schemas.d.ts +22 -5
- package/lib/schemas.js +10 -8
- package/lib/types.d.ts +7 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -73,14 +73,14 @@ type SdkParams = {
|
|
|
73
73
|
credentials: SdkCredentials;
|
|
74
74
|
};
|
|
75
75
|
type BaseSdk = {
|
|
76
|
-
declareUser: (params: DeclareUserParams) => Promise<
|
|
76
|
+
declareUser: (params: DeclareUserParams) => Promise<DeclareUserResponse>;
|
|
77
77
|
getUserId: (user: User) => Promise<number>;
|
|
78
78
|
getUserInstance: (user: User | number) => Promise<UserSdk>;
|
|
79
79
|
getProfessional: (professionalId: number) => Promise<Professional>;
|
|
80
80
|
getAvailableScheduleClinics: () => Promise<AvailableScheduleClinics>;
|
|
81
81
|
enroll: (params: EnrollmentParams) => Promise<void>;
|
|
82
82
|
getCoverageInfo: (identificationValue: string) => Promise<CoverageInfo>;
|
|
83
|
-
|
|
83
|
+
sendVerificationCode: (params: SendVerificationCodeParams) => Promise<void>;
|
|
84
84
|
getDiagnosticaHistory: (
|
|
85
85
|
patient: DiagnosticaPatientFilter,
|
|
86
86
|
from: Date,
|
|
@@ -96,6 +96,20 @@ type BaseSdk = {
|
|
|
96
96
|
user: DiagnosticaUser,
|
|
97
97
|
patient: DiagnosticaPatient,
|
|
98
98
|
) => Promise<void>;
|
|
99
|
+
externalLogin: (
|
|
100
|
+
params: ExternalLoginParams,
|
|
101
|
+
) => Promise<ExternalLoginResponse>;
|
|
102
|
+
preExternalEnrollment: (params: PreExternalEnrollmentParams) => Promise<void>;
|
|
103
|
+
externalEnrollment: (
|
|
104
|
+
params: ExternalEnrollmentParams,
|
|
105
|
+
) => Promise<ExternalLoginResponse>;
|
|
106
|
+
sendExternalVerificationCode: (
|
|
107
|
+
params: SendExternalVerificationCodeParams,
|
|
108
|
+
) => Promise<void>;
|
|
109
|
+
verifyExternalVerificationCode: (
|
|
110
|
+
params: VerifyExternalVerificationCodeParams,
|
|
111
|
+
) => Promise<any>;
|
|
112
|
+
externalResetPassword: (params: ExternalResetPasswordParams) => Promise<any>;
|
|
99
113
|
};
|
|
100
114
|
|
|
101
115
|
type RequestHandlerParams = {
|
|
@@ -141,7 +141,13 @@ export declare const getExternalMethods: (makeRequest: RequestMaker) => {
|
|
|
141
141
|
birthday: Date;
|
|
142
142
|
identificationNumber: string;
|
|
143
143
|
}>;
|
|
144
|
-
|
|
144
|
+
sendExternalVerificationCode: (params: {
|
|
145
|
+
birthdate: Date;
|
|
146
|
+
channel: "1" | "2";
|
|
147
|
+
identificationNumber: string;
|
|
148
|
+
}) => Promise<any>;
|
|
149
|
+
verifyExternalVerificationCode: (params: {
|
|
150
|
+
code: string;
|
|
145
151
|
birthdate: Date;
|
|
146
152
|
channel: "1" | "2";
|
|
147
153
|
identificationNumber: string;
|
package/lib/baseSdk/external.js
CHANGED
|
@@ -54,7 +54,7 @@ const getExternalMethods = (makeRequest) => {
|
|
|
54
54
|
phone: info.telephone,
|
|
55
55
|
};
|
|
56
56
|
};
|
|
57
|
-
const
|
|
57
|
+
const sendExternalVerificationCode = async (params) => {
|
|
58
58
|
const path = '/send-external-verification-code';
|
|
59
59
|
await makeRequest('POST', path, {
|
|
60
60
|
identification_number: params.identificationNumber,
|
|
@@ -63,6 +63,16 @@ const getExternalMethods = (makeRequest) => {
|
|
|
63
63
|
});
|
|
64
64
|
return;
|
|
65
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
|
+
};
|
|
66
76
|
const externalResetPassword = async (params) => {
|
|
67
77
|
const path = '/external-reset';
|
|
68
78
|
const response = await makeRequest('POST', path, {
|
|
@@ -78,7 +88,8 @@ const getExternalMethods = (makeRequest) => {
|
|
|
78
88
|
externalLogin: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalLoginParams]), schemas_1.doc24Schemas.externalLoginResponse, externalLogin),
|
|
79
89
|
preExternalEnrollment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.preExternalEnrollmentParams]), zod_1.void(), preExternalEnrollment),
|
|
80
90
|
externalEnrollment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalEnrollmentParams]), schemas_1.doc24Schemas.externalLoginResponse, externalEnrollment),
|
|
81
|
-
|
|
91
|
+
sendExternalVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.sendExternalVerificationCodeParams]), zod_1.any(), sendExternalVerificationCode),
|
|
92
|
+
verifyExternalVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.verifyExternalVerificationCodeParams]), zod_1.any(), verifyExternalVerificationCode),
|
|
82
93
|
externalResetPassword: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalResetPasswordParams]), zod_1.any(), externalResetPassword),
|
|
83
94
|
};
|
|
84
95
|
};
|
package/lib/baseSdk/user.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export declare const getUserMethods: (makeRequest: RequestMaker, url: string, cr
|
|
|
38
38
|
phone: string;
|
|
39
39
|
email: string;
|
|
40
40
|
}) => Promise<number>;
|
|
41
|
-
|
|
41
|
+
sendVerificationCode: (params: {
|
|
42
42
|
identificationType: number;
|
|
43
43
|
identificationValue: string;
|
|
44
44
|
channel: "1" | "2";
|
|
@@ -60,8 +60,8 @@ export declare const getUserMethods: (makeRequest: RequestMaker, url: string, cr
|
|
|
60
60
|
birthdate: Date;
|
|
61
61
|
gender: "m" | "f";
|
|
62
62
|
email: string;
|
|
63
|
-
startDate: Date;
|
|
64
63
|
identificationNumber: string;
|
|
64
|
+
startDate: Date;
|
|
65
65
|
plan: string;
|
|
66
66
|
}) => Promise<void>;
|
|
67
67
|
getCoverageInfo: (identificationValue: string) => Promise<{
|
package/lib/baseSdk/user.js
CHANGED
|
@@ -54,7 +54,7 @@ const getUserMethods = (makeRequest, url, credentials) => {
|
|
|
54
54
|
});
|
|
55
55
|
return response.data.user_id;
|
|
56
56
|
};
|
|
57
|
-
const
|
|
57
|
+
const sendVerificationCode = async (params) => {
|
|
58
58
|
const path = '/send-verification-code';
|
|
59
59
|
const mappedParams = {
|
|
60
60
|
identification_type: params.identificationType,
|
|
@@ -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
|
-
|
|
123
|
+
sendVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.sendVerificationCodeParams]), zod_1.void(), sendVerificationCode),
|
|
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
|
@@ -102,8 +102,8 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
|
|
|
102
102
|
birthdate: Date;
|
|
103
103
|
gender: "m" | "f";
|
|
104
104
|
email: string;
|
|
105
|
-
startDate: Date;
|
|
106
105
|
identificationNumber: string;
|
|
106
|
+
startDate: Date;
|
|
107
107
|
plan: string;
|
|
108
108
|
}) => Promise<void>;
|
|
109
109
|
getCoverageInfo: (identificationValue: string) => Promise<{
|
|
@@ -130,7 +130,7 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
|
|
|
130
130
|
authorizationCode: string | null;
|
|
131
131
|
authorizationCodeExpiration: Date | null;
|
|
132
132
|
} | null>;
|
|
133
|
-
|
|
133
|
+
sendVerificationCode: (params: {
|
|
134
134
|
identificationType: number;
|
|
135
135
|
identificationValue: string;
|
|
136
136
|
channel: "1" | "2";
|
|
@@ -327,11 +327,17 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
|
|
|
327
327
|
birthday: Date;
|
|
328
328
|
identificationNumber: string;
|
|
329
329
|
}>;
|
|
330
|
-
|
|
330
|
+
sendExternalVerificationCode: (params: {
|
|
331
331
|
birthdate: Date;
|
|
332
332
|
channel: "1" | "2";
|
|
333
333
|
identificationNumber: string;
|
|
334
334
|
}) => Promise<void>;
|
|
335
|
+
verifyExternalVerificationCode: (params: {
|
|
336
|
+
code: string;
|
|
337
|
+
birthdate: Date;
|
|
338
|
+
channel: "1" | "2";
|
|
339
|
+
identificationNumber: string;
|
|
340
|
+
}) => Promise<any>;
|
|
335
341
|
externalResetPassword: (params: ({
|
|
336
342
|
birthdate: Date;
|
|
337
343
|
password: string;
|
package/lib/schemas.d.ts
CHANGED
|
@@ -935,8 +935,8 @@ export declare const doc24Schemas: {
|
|
|
935
935
|
birthdate: Date;
|
|
936
936
|
gender: "m" | "f";
|
|
937
937
|
email: string;
|
|
938
|
-
startDate: Date;
|
|
939
938
|
identificationNumber: string;
|
|
939
|
+
startDate: Date;
|
|
940
940
|
plan: string;
|
|
941
941
|
}, {
|
|
942
942
|
firstName: string;
|
|
@@ -944,8 +944,8 @@ export declare const doc24Schemas: {
|
|
|
944
944
|
birthdate: Date;
|
|
945
945
|
gender: "m" | "f";
|
|
946
946
|
email: string;
|
|
947
|
-
startDate: Date;
|
|
948
947
|
identificationNumber: string;
|
|
948
|
+
startDate: Date;
|
|
949
949
|
plan: string;
|
|
950
950
|
}>;
|
|
951
951
|
diagnosticaPatientFilter: import("zod").ZodObject<{
|
|
@@ -1117,7 +1117,7 @@ export declare const doc24Schemas: {
|
|
|
1117
1117
|
authorizationCode: string | null;
|
|
1118
1118
|
authorizationCodeExpiration: Date | null;
|
|
1119
1119
|
}>>;
|
|
1120
|
-
|
|
1120
|
+
sendVerificationCodeParams: import("zod").ZodObject<{
|
|
1121
1121
|
identificationType: import("zod").ZodNumber;
|
|
1122
1122
|
identificationValue: import("zod").ZodString;
|
|
1123
1123
|
channel: import("zod").ZodEnum<["1", "2"]>;
|
|
@@ -1334,7 +1334,7 @@ export declare const doc24Schemas: {
|
|
|
1334
1334
|
patientId: number | null;
|
|
1335
1335
|
askCode: false;
|
|
1336
1336
|
}>]>;
|
|
1337
|
-
|
|
1337
|
+
verificationCodeParams: import("zod").ZodObject<{
|
|
1338
1338
|
channel: import("zod").ZodOptional<import("zod").ZodEnum<["1", "2"]>>;
|
|
1339
1339
|
code: import("zod").ZodOptional<import("zod").ZodString>;
|
|
1340
1340
|
}, "strip", import("zod").ZodTypeAny, {
|
|
@@ -1516,7 +1516,7 @@ export declare const doc24Schemas: {
|
|
|
1516
1516
|
emailCode?: undefined;
|
|
1517
1517
|
phoneCode: string;
|
|
1518
1518
|
}>>;
|
|
1519
|
-
|
|
1519
|
+
sendExternalVerificationCodeParams: import("zod").ZodObject<{
|
|
1520
1520
|
identificationNumber: import("zod").ZodString;
|
|
1521
1521
|
birthdate: import("zod").ZodDate;
|
|
1522
1522
|
channel: import("zod").ZodEnum<["1", "2"]>;
|
|
@@ -1529,6 +1529,23 @@ export declare const doc24Schemas: {
|
|
|
1529
1529
|
channel: "1" | "2";
|
|
1530
1530
|
identificationNumber: string;
|
|
1531
1531
|
}>;
|
|
1532
|
+
verifyExternalVerificationCodeParams: import("zod").ZodObject<import("zod").extendShape<{
|
|
1533
|
+
identificationNumber: import("zod").ZodString;
|
|
1534
|
+
birthdate: import("zod").ZodDate;
|
|
1535
|
+
channel: import("zod").ZodEnum<["1", "2"]>;
|
|
1536
|
+
}, {
|
|
1537
|
+
code: import("zod").ZodString;
|
|
1538
|
+
}>, "strip", import("zod").ZodTypeAny, {
|
|
1539
|
+
code: string;
|
|
1540
|
+
birthdate: Date;
|
|
1541
|
+
channel: "1" | "2";
|
|
1542
|
+
identificationNumber: string;
|
|
1543
|
+
}, {
|
|
1544
|
+
code: string;
|
|
1545
|
+
birthdate: Date;
|
|
1546
|
+
channel: "1" | "2";
|
|
1547
|
+
identificationNumber: string;
|
|
1548
|
+
}>;
|
|
1532
1549
|
externalResetPasswordParams: import("zod").ZodIntersection<import("zod").ZodObject<{
|
|
1533
1550
|
identificationNumber: import("zod").ZodString;
|
|
1534
1551
|
birthdate: import("zod").ZodDate;
|
package/lib/schemas.js
CHANGED
|
@@ -175,21 +175,21 @@ const coverageInfo = zod_1.object({
|
|
|
175
175
|
authorizationCode: zod_1.string().nullable(),
|
|
176
176
|
authorizationCodeExpiration: zod_1.date().nullable(),
|
|
177
177
|
}).nullable();
|
|
178
|
-
const
|
|
178
|
+
const sendVerificationCodeParams = zod_1.object({
|
|
179
179
|
identificationType: zod_1.number(),
|
|
180
180
|
identificationValue: zod_1.string(),
|
|
181
181
|
channel: zod_1.enum(['1', '2']),
|
|
182
182
|
});
|
|
183
|
-
const
|
|
183
|
+
const verificationCodeParams = zod_1.object({
|
|
184
184
|
channel: zod_1.enum(['1', '2']).optional(),
|
|
185
185
|
code: zod_1.string().optional(),
|
|
186
186
|
});
|
|
187
187
|
const declareUserParams = zod_1.object({
|
|
188
188
|
user,
|
|
189
|
-
}).and(
|
|
189
|
+
}).and(verificationCodeParams);
|
|
190
190
|
const declarePatientParams = zod_1.object({
|
|
191
191
|
patient,
|
|
192
|
-
}).and(
|
|
192
|
+
}).and(verificationCodeParams);
|
|
193
193
|
const declarePatientResponse = zod_1.object({
|
|
194
194
|
userInfo: zod_1.object({
|
|
195
195
|
firstName: zod_1.string(),
|
|
@@ -244,11 +244,12 @@ const emailOrPhoneCode = zod_1.union([
|
|
|
244
244
|
const externalEnrollmentParams = preExternalEnrollmentParams
|
|
245
245
|
.and(zod_1.object({ password: zod_1.string() }))
|
|
246
246
|
.and(emailOrPhoneCode);
|
|
247
|
-
const
|
|
247
|
+
const sendExternalVerificationCodeParams = zod_1.object({
|
|
248
248
|
identificationNumber: zod_1.string(),
|
|
249
249
|
birthdate: zod_1.date(),
|
|
250
250
|
channel: zod_1.enum(['1', '2']),
|
|
251
251
|
});
|
|
252
|
+
const verifyExternalVerificationCodeParams = sendExternalVerificationCodeParams.extend({ code: zod_1.string() });
|
|
252
253
|
const externalResetPasswordParams = zod_1.object({
|
|
253
254
|
identificationNumber: zod_1.string(),
|
|
254
255
|
birthdate: zod_1.date(),
|
|
@@ -373,16 +374,17 @@ exports.doc24Schemas = {
|
|
|
373
374
|
diagnosticaPatient,
|
|
374
375
|
diagnosticaDeepLinkResponse,
|
|
375
376
|
coverageInfo,
|
|
376
|
-
|
|
377
|
+
sendVerificationCodeParams,
|
|
377
378
|
declareUserParams,
|
|
378
379
|
declareUserResponse,
|
|
379
380
|
declarePatientParams,
|
|
380
381
|
declarePatientResponse,
|
|
381
|
-
|
|
382
|
+
verificationCodeParams,
|
|
382
383
|
externalLoginParams,
|
|
383
384
|
externalLoginResponse,
|
|
384
385
|
preExternalEnrollmentParams,
|
|
385
386
|
externalEnrollmentParams,
|
|
386
|
-
|
|
387
|
+
sendExternalVerificationCodeParams,
|
|
388
|
+
verifyExternalVerificationCodeParams,
|
|
387
389
|
externalResetPasswordParams,
|
|
388
390
|
};
|
package/lib/types.d.ts
CHANGED
|
@@ -29,17 +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 SendVerificationCodeParams = TypeOf<typeof doc24Schemas.sendVerificationCodeParams>;
|
|
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
|
-
type
|
|
37
|
+
type VerificationCodeParams = TypeOf<typeof doc24Schemas.verificationCodeParams>;
|
|
38
38
|
type ExternalLoginParams = TypeOf<typeof doc24Schemas.externalLoginParams>;
|
|
39
39
|
type ExternalLoginResponse = TypeOf<typeof doc24Schemas.externalLoginResponse>;
|
|
40
40
|
type PreExternalEnrollmentParams = TypeOf<typeof doc24Schemas.preExternalEnrollmentParams>;
|
|
41
41
|
type ExternalEnrollmentParams = TypeOf<typeof doc24Schemas.externalEnrollmentParams>;
|
|
42
|
-
type
|
|
42
|
+
type SendExternalVerificationCodeParams = TypeOf<typeof doc24Schemas.sendExternalVerificationCodeParams>;
|
|
43
|
+
type VerifyExternalVerificationCodeParams = TypeOf<typeof doc24Schemas.verifyExternalVerificationCodeParams>;
|
|
43
44
|
type ExternalResetPasswordParams = TypeOf<typeof doc24Schemas.externalResetPasswordParams>;
|
|
44
45
|
type BaseSdk = {
|
|
45
46
|
declareUser: (params: DeclareUserParams) => Promise<DeclareUserResponse>;
|
|
@@ -49,14 +50,15 @@ export declare namespace Doc24 {
|
|
|
49
50
|
getAvailableScheduleClinics: () => Promise<AvailableScheduleClinics>;
|
|
50
51
|
enroll: (params: EnrollmentParams) => Promise<void>;
|
|
51
52
|
getCoverageInfo: (identificationValue: string) => Promise<CoverageInfo>;
|
|
52
|
-
|
|
53
|
+
sendVerificationCode: (params: SendVerificationCodeParams) => Promise<void>;
|
|
53
54
|
getDiagnosticaHistory: (patient: DiagnosticaPatientFilter, from: Date, to: Date) => Promise<DiagnosticaHistoryAppointment[]>;
|
|
54
55
|
getDiagnosticaDeepLink: (kiosk: string, user: DiagnosticaUser, patient: DiagnosticaPatient) => Promise<DiagnosticaDeepLinkResponse>;
|
|
55
56
|
getDiagnosticaAccess: (kiosk: string, user: DiagnosticaUser, patient: DiagnosticaPatient) => Promise<void>;
|
|
56
57
|
externalLogin: (params: ExternalLoginParams) => Promise<ExternalLoginResponse>;
|
|
57
58
|
preExternalEnrollment: (params: PreExternalEnrollmentParams) => Promise<void>;
|
|
58
59
|
externalEnrollment: (params: ExternalEnrollmentParams) => Promise<ExternalLoginResponse>;
|
|
59
|
-
|
|
60
|
+
sendExternalVerificationCode: (params: SendExternalVerificationCodeParams) => Promise<void>;
|
|
61
|
+
verifyExternalVerificationCode: (params: VerifyExternalVerificationCodeParams) => Promise<any>;
|
|
60
62
|
externalResetPassword: (params: ExternalResetPasswordParams) => Promise<any>;
|
|
61
63
|
};
|
|
62
64
|
type UserSdk = {
|