@integraciones_doc24/sdk 0.27.0 → 0.29.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.js +15 -0
- package/lib/index.d.ts +10 -0
- package/lib/schemas.d.ts +31 -0
- package/lib/schemas.js +12 -0
- package/lib/types.d.ts +2 -0
- package/lib/userSdk/schedule.d.ts +1 -0
- package/lib/userSdk/schedule.js +2 -1
- 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
|
@@ -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: {
|
|
@@ -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,
|
|
@@ -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
|
@@ -18,7 +18,7 @@ const getScheduleMethods = (makeRequest) => {
|
|
|
18
18
|
});
|
|
19
19
|
const getSchedule = validation_1.validateFunction(zod_1.tuple([zod_1.number(), zod_1.number(), schemas_1.doc24Schemas.scheduleFilter.optional()]), zod_1.array(schemas_1.doc24Schemas.availableAppointment), async (patientId, specialtyId, filter = {}) => {
|
|
20
20
|
const mappedFilter = {
|
|
21
|
-
|
|
21
|
+
id_professional: filter.professionalId,
|
|
22
22
|
offset: filter.offset,
|
|
23
23
|
limit: filter.limit,
|
|
24
24
|
week_day: filter.weekDay,
|
|
@@ -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) => {
|