@integraciones_doc24/sdk 0.27.1 → 0.29.1
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.js +15 -0
- package/lib/index.d.ts +11 -1
- package/lib/schemas.d.ts +34 -3
- package/lib/schemas.js +13 -1
- package/lib/types.d.ts +2 -0
- package/lib/userSdk/schedule.d.ts +1 -0
- package/lib/userSdk/schedule.js +1 -0
- package/package.json +1 -1
package/lib/baseSdk.js
CHANGED
|
@@ -79,6 +79,21 @@ const getBaseSdk = async (url, credentials) => {
|
|
|
79
79
|
};
|
|
80
80
|
return mapped;
|
|
81
81
|
}),
|
|
82
|
+
enroll: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.enrollmentParams]), zod_1.void(), async (params) => {
|
|
83
|
+
const path = `/enrollment`;
|
|
84
|
+
await makeRequest('POST', path, {
|
|
85
|
+
user_data: {
|
|
86
|
+
firstname: params.firstName,
|
|
87
|
+
lastname: params.lastName,
|
|
88
|
+
gender: params.gender.toUpperCase(),
|
|
89
|
+
identification_number: params.identificationNumber,
|
|
90
|
+
birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
|
|
91
|
+
email: params.email,
|
|
92
|
+
plan: params.plan,
|
|
93
|
+
start_date: date_fns_1.format(params.startDate, 'yyyy-MM-dd'),
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
}),
|
|
82
97
|
};
|
|
83
98
|
return baseSdk;
|
|
84
99
|
};
|
package/lib/index.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
|
|
|
34
34
|
lastName: string;
|
|
35
35
|
birthdate: Date;
|
|
36
36
|
gender: "m" | "f";
|
|
37
|
-
phone: string;
|
|
37
|
+
phone: string | null;
|
|
38
38
|
email: string;
|
|
39
39
|
specialties: {
|
|
40
40
|
id: number;
|
|
@@ -66,5 +66,15 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
|
|
|
66
66
|
}[];
|
|
67
67
|
}[];
|
|
68
68
|
}>;
|
|
69
|
+
enroll: (params: {
|
|
70
|
+
firstName: string;
|
|
71
|
+
lastName: string;
|
|
72
|
+
birthdate: Date;
|
|
73
|
+
gender: "m" | "f";
|
|
74
|
+
email: string;
|
|
75
|
+
startDate: Date;
|
|
76
|
+
identificationNumber: string;
|
|
77
|
+
plan: string;
|
|
78
|
+
}) => Promise<void>;
|
|
69
79
|
}>;
|
|
70
80
|
export type { Doc24 } from './types';
|
package/lib/schemas.d.ts
CHANGED
|
@@ -144,9 +144,11 @@ export declare const doc24Schemas: {
|
|
|
144
144
|
type: import("zod").ZodEnum<["appointment", "chat", "instant"]>;
|
|
145
145
|
atentions: import("zod").ZodNumber;
|
|
146
146
|
ranking: import("zod").ZodUnknown;
|
|
147
|
+
length: import("zod").ZodNullable<import("zod").ZodNumber>;
|
|
147
148
|
}, "strip", import("zod").ZodTypeAny, {
|
|
148
149
|
ranking?: unknown;
|
|
149
150
|
date: Date;
|
|
151
|
+
length: number | null;
|
|
150
152
|
type: "appointment" | "chat" | "instant";
|
|
151
153
|
id: string | number;
|
|
152
154
|
professional: {
|
|
@@ -164,6 +166,7 @@ export declare const doc24Schemas: {
|
|
|
164
166
|
}, {
|
|
165
167
|
ranking?: unknown;
|
|
166
168
|
date: Date;
|
|
169
|
+
length: number | null;
|
|
167
170
|
type: "appointment" | "chat" | "instant";
|
|
168
171
|
id: string | number;
|
|
169
172
|
professional: {
|
|
@@ -615,7 +618,7 @@ export declare const doc24Schemas: {
|
|
|
615
618
|
birthdate: import("zod").ZodDate;
|
|
616
619
|
gender: import("zod").ZodEnum<["m", "f"]>;
|
|
617
620
|
email: import("zod").ZodString;
|
|
618
|
-
phone: import("zod").ZodString
|
|
621
|
+
phone: import("zod").ZodNullable<import("zod").ZodString>;
|
|
619
622
|
logoUrl: import("zod").ZodString;
|
|
620
623
|
matriculation: import("zod").ZodArray<import("zod").ZodObject<{
|
|
621
624
|
number: import("zod").ZodString;
|
|
@@ -656,7 +659,7 @@ export declare const doc24Schemas: {
|
|
|
656
659
|
lastName: string;
|
|
657
660
|
birthdate: Date;
|
|
658
661
|
gender: "m" | "f";
|
|
659
|
-
phone: string;
|
|
662
|
+
phone: string | null;
|
|
660
663
|
email: string;
|
|
661
664
|
specialties: {
|
|
662
665
|
id: number;
|
|
@@ -679,7 +682,7 @@ export declare const doc24Schemas: {
|
|
|
679
682
|
lastName: string;
|
|
680
683
|
birthdate: Date;
|
|
681
684
|
gender: "m" | "f";
|
|
682
|
-
phone: string;
|
|
685
|
+
phone: string | null;
|
|
683
686
|
email: string;
|
|
684
687
|
specialties: {
|
|
685
688
|
id: number;
|
|
@@ -894,4 +897,32 @@ export declare const doc24Schemas: {
|
|
|
894
897
|
id: number;
|
|
895
898
|
userType: "patient" | "professional";
|
|
896
899
|
}>;
|
|
900
|
+
enrollmentParams: import("zod").ZodObject<{
|
|
901
|
+
firstName: import("zod").ZodString;
|
|
902
|
+
lastName: import("zod").ZodString;
|
|
903
|
+
gender: import("zod").ZodEnum<["m", "f"]>;
|
|
904
|
+
identificationNumber: import("zod").ZodString;
|
|
905
|
+
birthdate: import("zod").ZodDate;
|
|
906
|
+
email: import("zod").ZodString;
|
|
907
|
+
plan: import("zod").ZodString;
|
|
908
|
+
startDate: import("zod").ZodDate;
|
|
909
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
910
|
+
firstName: string;
|
|
911
|
+
lastName: string;
|
|
912
|
+
birthdate: Date;
|
|
913
|
+
gender: "m" | "f";
|
|
914
|
+
email: string;
|
|
915
|
+
startDate: Date;
|
|
916
|
+
identificationNumber: string;
|
|
917
|
+
plan: string;
|
|
918
|
+
}, {
|
|
919
|
+
firstName: string;
|
|
920
|
+
lastName: string;
|
|
921
|
+
birthdate: Date;
|
|
922
|
+
gender: "m" | "f";
|
|
923
|
+
email: string;
|
|
924
|
+
startDate: Date;
|
|
925
|
+
identificationNumber: string;
|
|
926
|
+
plan: string;
|
|
927
|
+
}>;
|
|
897
928
|
};
|
package/lib/schemas.js
CHANGED
|
@@ -37,6 +37,7 @@ const availableAppointment = zod_1.object({
|
|
|
37
37
|
type: specialtyMode,
|
|
38
38
|
atentions: zod_1.number(),
|
|
39
39
|
ranking: zod_1.unknown(),
|
|
40
|
+
length: zod_1.number().nullable(),
|
|
40
41
|
});
|
|
41
42
|
const appointment = zod_1.object({
|
|
42
43
|
id: zod_1.number(),
|
|
@@ -113,6 +114,16 @@ const chatPost = zod_1.object({
|
|
|
113
114
|
message: zod_1.string(),
|
|
114
115
|
date: zod_1.date(),
|
|
115
116
|
});
|
|
117
|
+
const enrollmentParams = zod_1.object({
|
|
118
|
+
firstName: zod_1.string(),
|
|
119
|
+
lastName: zod_1.string(),
|
|
120
|
+
gender: gender,
|
|
121
|
+
identificationNumber: zod_1.string(),
|
|
122
|
+
birthdate: zod_1.date(),
|
|
123
|
+
email: zod_1.string().email(),
|
|
124
|
+
plan: zod_1.string(),
|
|
125
|
+
startDate: zod_1.date(),
|
|
126
|
+
});
|
|
116
127
|
exports.doc24Schemas = {
|
|
117
128
|
identificationType,
|
|
118
129
|
sdkCredentials,
|
|
@@ -204,7 +215,7 @@ exports.doc24Schemas = {
|
|
|
204
215
|
birthdate: zod_1.date(),
|
|
205
216
|
gender,
|
|
206
217
|
email: zod_1.string(),
|
|
207
|
-
phone: zod_1.string(),
|
|
218
|
+
phone: zod_1.string().nullable(),
|
|
208
219
|
logoUrl: zod_1.string(),
|
|
209
220
|
matriculation: zod_1.array(zod_1.object({ number: zod_1.string(), type: zod_1.string() })),
|
|
210
221
|
specialties: zod_1.array(specialty),
|
|
@@ -221,4 +232,5 @@ exports.doc24Schemas = {
|
|
|
221
232
|
availableChatroom,
|
|
222
233
|
chatDetails,
|
|
223
234
|
chatPost,
|
|
235
|
+
enrollmentParams,
|
|
224
236
|
};
|
package/lib/types.d.ts
CHANGED
|
@@ -23,11 +23,13 @@ export declare namespace Doc24 {
|
|
|
23
23
|
type ChatParameters = TypeOf<typeof doc24Schemas.chatParameters>;
|
|
24
24
|
type ChatDetails = TypeOf<typeof doc24Schemas.chatDetails>;
|
|
25
25
|
type ChatPost = TypeOf<typeof doc24Schemas.chatPost>;
|
|
26
|
+
type EnrollmentParams = TypeOf<typeof doc24Schemas.enrollmentParams>;
|
|
26
27
|
type BaseSdk = {
|
|
27
28
|
declareUser: (user: User) => Promise<number>;
|
|
28
29
|
getUserInstance: (user: User | number) => Promise<UserSdk>;
|
|
29
30
|
getProfessional: (professionalId: number) => Promise<Professional>;
|
|
30
31
|
getAvailableScheduleClinics: () => Promise<AvailableScheduleClinics>;
|
|
32
|
+
enroll: (params: EnrollmentParams) => Promise<void>;
|
|
31
33
|
};
|
|
32
34
|
type UserSdk = {
|
|
33
35
|
declarePatient: (patient: Patient) => Promise<number>;
|
package/lib/userSdk/schedule.js
CHANGED
|
@@ -45,6 +45,7 @@ const getScheduleMethods = (makeRequest) => {
|
|
|
45
45
|
type: a.type === 'P' ? 'appointment' : a.type === 'T' ? 'chat' : 'instant',
|
|
46
46
|
atentions: a.atentions,
|
|
47
47
|
ranking: a.ranking,
|
|
48
|
+
length: a.length,
|
|
48
49
|
}));
|
|
49
50
|
});
|
|
50
51
|
const getAppointment = validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.appointment, async (appointmentId) => {
|