@integraciones_doc24/sdk 0.39.4 → 0.39.5
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 +93 -83
- package/package.json +1 -1
- package/lib/baseSdk/diagnostica.d.ts +0 -54
- package/lib/baseSdk/diagnostica.js +0 -79
- package/lib/baseSdk/external.d.ts +0 -177
- package/lib/baseSdk/external.js +0 -96
- package/lib/baseSdk/index.d.ts +0 -2
- package/lib/baseSdk/index.js +0 -70
- package/lib/baseSdk/user.d.ts +0 -41
- package/lib/baseSdk/user.js +0 -88
- package/lib/index.d.ts +0 -159
- package/lib/index.js +0 -22
- package/lib/request/index.d.ts +0 -3
- package/lib/request/index.js +0 -26
- package/lib/request/token.d.ts +0 -2
- package/lib/request/token.js +0 -34
- package/lib/request/validation.d.ts +0 -10
- package/lib/request/validation.js +0 -28
- package/lib/schemas.d.ts +0 -1125
- package/lib/schemas.js +0 -307
- package/lib/types.d.ts +0 -118
- package/lib/types.js +0 -2
- package/lib/userSdk/chat.d.ts +0 -57
- package/lib/userSdk/chat.js +0 -98
- package/lib/userSdk/external.d.ts +0 -34
- package/lib/userSdk/external.js +0 -71
- package/lib/userSdk/index.d.ts +0 -2
- package/lib/userSdk/index.js +0 -27
- package/lib/userSdk/patients.d.ts +0 -24
- package/lib/userSdk/patients.js +0 -46
- package/lib/userSdk/schedule.d.ts +0 -44
- package/lib/userSdk/schedule.js +0 -76
- package/lib/userSdk/specialties.d.ts +0 -7
- package/lib/userSdk/specialties.js +0 -19
- package/lib/userSdk/videoVisit.d.ts +0 -111
- package/lib/userSdk/videoVisit.js +0 -147
- package/lib/utils.d.ts +0 -4
- package/lib/utils.js +0 -27
- package/lib/webhook/index.d.ts +0 -2
- package/lib/webhook/index.js +0 -55
- package/lib/webhook/responses.d.ts +0 -35
- package/lib/webhook/responses.js +0 -42
- package/lib/webhook/token.d.ts +0 -2
- package/lib/webhook/token.js +0 -23
package/lib/schemas.js
DELETED
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.doc24Schemas = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const gender = zod_1.enum(['m', 'f']);
|
|
6
|
-
const identificationType = zod_1.enum([
|
|
7
|
-
'dni',
|
|
8
|
-
'ndi',
|
|
9
|
-
'passport',
|
|
10
|
-
'credential',
|
|
11
|
-
'nn',
|
|
12
|
-
'cpf',
|
|
13
|
-
'rg',
|
|
14
|
-
]);
|
|
15
|
-
const sdkCredentials = zod_1.object({ iss: zod_1.string(), key: zod_1.string() });
|
|
16
|
-
const basePersonData = zod_1.object({
|
|
17
|
-
firstName: zod_1.string(),
|
|
18
|
-
lastName: zod_1.string(),
|
|
19
|
-
identificationType,
|
|
20
|
-
identificationValue: zod_1.string(),
|
|
21
|
-
countryId: zod_1.string(),
|
|
22
|
-
birthdate: zod_1.date(),
|
|
23
|
-
gender,
|
|
24
|
-
});
|
|
25
|
-
const specialtyMode = zod_1.enum(['appointment', 'chat', 'instant']);
|
|
26
|
-
const specialty = zod_1.object({
|
|
27
|
-
id: zod_1.number(),
|
|
28
|
-
description: zod_1.string(),
|
|
29
|
-
});
|
|
30
|
-
const scheduleAvailabilityFilter = zod_1.object({
|
|
31
|
-
specialtyId: zod_1.number().optional(),
|
|
32
|
-
professionalId: zod_1.number().optional(),
|
|
33
|
-
});
|
|
34
|
-
const availableAppointment = zod_1.object({
|
|
35
|
-
id: zod_1.number().or(zod_1.string()),
|
|
36
|
-
date: zod_1.date(),
|
|
37
|
-
clinicId: zod_1.number(),
|
|
38
|
-
professional: zod_1.object({
|
|
39
|
-
id: zod_1.number(),
|
|
40
|
-
fullName: zod_1.string(),
|
|
41
|
-
logoUrl: zod_1.string(),
|
|
42
|
-
}),
|
|
43
|
-
cost: zod_1.string(),
|
|
44
|
-
specialty: specialty,
|
|
45
|
-
type: specialtyMode,
|
|
46
|
-
atentions: zod_1.number(),
|
|
47
|
-
ranking: zod_1.unknown(),
|
|
48
|
-
length: zod_1.number().nullish(),
|
|
49
|
-
});
|
|
50
|
-
const appointment = zod_1.object({
|
|
51
|
-
id: zod_1.number(),
|
|
52
|
-
professionalId: zod_1.number(),
|
|
53
|
-
date: zod_1.date(),
|
|
54
|
-
});
|
|
55
|
-
const availableScheduleClinics = zod_1.object({
|
|
56
|
-
specialties: specialty.array(),
|
|
57
|
-
specialtiesER: specialty.array(),
|
|
58
|
-
professionals: zod_1.object({
|
|
59
|
-
id: zod_1.number(),
|
|
60
|
-
fullName: zod_1.string(),
|
|
61
|
-
clinicId: zod_1.number(),
|
|
62
|
-
specialties: specialty.array(),
|
|
63
|
-
}).array(),
|
|
64
|
-
});
|
|
65
|
-
const baseScheduleParameters = zod_1.object({
|
|
66
|
-
patientId: zod_1.number(),
|
|
67
|
-
specialtyId: zod_1.number(),
|
|
68
|
-
language: zod_1.string(),
|
|
69
|
-
details: zod_1.string(),
|
|
70
|
-
extraInfo: zod_1.any(),
|
|
71
|
-
});
|
|
72
|
-
const appointmentScheduleParameters = baseScheduleParameters.extend({
|
|
73
|
-
type: zod_1.literal('appointment'),
|
|
74
|
-
appointmentId: zod_1.number().or(zod_1.string()),
|
|
75
|
-
});
|
|
76
|
-
const instantScheduleParameters = baseScheduleParameters.extend({
|
|
77
|
-
type: zod_1.literal('instant'),
|
|
78
|
-
});
|
|
79
|
-
const chatroomAvailabilityFilter = zod_1.object({
|
|
80
|
-
limit: zod_1.number().optional(),
|
|
81
|
-
offset: zod_1.number().optional(),
|
|
82
|
-
});
|
|
83
|
-
const chatParameters = zod_1.object({
|
|
84
|
-
patientId: zod_1.number(),
|
|
85
|
-
chatroomId: zod_1.number(),
|
|
86
|
-
language: zod_1.string(),
|
|
87
|
-
specialtyId: zod_1.number(),
|
|
88
|
-
});
|
|
89
|
-
const availableChatroom = zod_1.object({
|
|
90
|
-
id: zod_1.number(),
|
|
91
|
-
professional: zod_1.object({
|
|
92
|
-
id: zod_1.number(),
|
|
93
|
-
fullName: zod_1.string(),
|
|
94
|
-
logoUrl: zod_1.string(),
|
|
95
|
-
}),
|
|
96
|
-
specialty: zod_1.object({ id: zod_1.number(), description: zod_1.string() }),
|
|
97
|
-
});
|
|
98
|
-
const chatDetails = zod_1.object({
|
|
99
|
-
id: zod_1.number(),
|
|
100
|
-
chatRoomId: zod_1.number(),
|
|
101
|
-
startDate: zod_1.date(),
|
|
102
|
-
lastEventDate: zod_1.date(),
|
|
103
|
-
closureDate: zod_1.date().nullable(),
|
|
104
|
-
patient: zod_1.object({
|
|
105
|
-
id: zod_1.number(),
|
|
106
|
-
firstName: zod_1.string(),
|
|
107
|
-
lastName: zod_1.string(),
|
|
108
|
-
}),
|
|
109
|
-
patientLastPost: zod_1.date().nullable(),
|
|
110
|
-
professional: zod_1.object({
|
|
111
|
-
id: zod_1.number(),
|
|
112
|
-
fullName: zod_1.string(),
|
|
113
|
-
logoUrl: zod_1.string(),
|
|
114
|
-
}),
|
|
115
|
-
professionalLastPost: zod_1.date().nullable(),
|
|
116
|
-
specialty: zod_1.object({ id: zod_1.number(), description: zod_1.string() }),
|
|
117
|
-
status: zod_1.string(),
|
|
118
|
-
paymentStatus: zod_1.string(),
|
|
119
|
-
});
|
|
120
|
-
const chatPost = zod_1.object({
|
|
121
|
-
id: zod_1.number(),
|
|
122
|
-
userType: zod_1.enum(['patient', 'professional']),
|
|
123
|
-
message: zod_1.string(),
|
|
124
|
-
date: zod_1.date(),
|
|
125
|
-
});
|
|
126
|
-
const enrollmentParams = zod_1.object({
|
|
127
|
-
firstName: zod_1.string(),
|
|
128
|
-
lastName: zod_1.string(),
|
|
129
|
-
gender: gender,
|
|
130
|
-
identificationNumber: zod_1.string(),
|
|
131
|
-
birthdate: zod_1.date(),
|
|
132
|
-
email: zod_1.string().email(),
|
|
133
|
-
plan: zod_1.string(),
|
|
134
|
-
startDate: zod_1.date(),
|
|
135
|
-
});
|
|
136
|
-
const diagnosticaHistoryAppointment = zod_1.object({
|
|
137
|
-
date: zod_1.date(),
|
|
138
|
-
location: zod_1.string(),
|
|
139
|
-
exams: zod_1.string().array(),
|
|
140
|
-
deepLink: zod_1.string().url(),
|
|
141
|
-
});
|
|
142
|
-
const diagnosticaPatient = zod_1.object({
|
|
143
|
-
firstName: zod_1.string(),
|
|
144
|
-
lastName: zod_1.string(),
|
|
145
|
-
birthday: zod_1.date(),
|
|
146
|
-
identificationType: zod_1.literal('dni'),
|
|
147
|
-
identificationValue: zod_1.string(),
|
|
148
|
-
gender: gender,
|
|
149
|
-
});
|
|
150
|
-
const diagnosticaUser = diagnosticaPatient.merge(zod_1.object({
|
|
151
|
-
phone: zod_1.string(),
|
|
152
|
-
email: zod_1.string().email(),
|
|
153
|
-
language: zod_1.string(),
|
|
154
|
-
}));
|
|
155
|
-
const diagnosticaDeepLinkResponse = zod_1.object({
|
|
156
|
-
forwardingRequired: zod_1.literal(true),
|
|
157
|
-
deepLink: zod_1.string().url(),
|
|
158
|
-
}).or(zod_1.object({ forwardingRequired: zod_1.literal(false) }));
|
|
159
|
-
const coverageInfo = zod_1.object({
|
|
160
|
-
financerId: zod_1.number().nullable(),
|
|
161
|
-
defaultAffiliationId: zod_1.number().nullable(),
|
|
162
|
-
plan: zod_1.string().nullable(),
|
|
163
|
-
identificationNumber: zod_1.string(),
|
|
164
|
-
credentialNumber: zod_1.string().nullable(),
|
|
165
|
-
lastName: zod_1.string().nullable(),
|
|
166
|
-
firstName: zod_1.string().nullable(),
|
|
167
|
-
birthdate: zod_1.date(),
|
|
168
|
-
financerPlanId: zod_1.number().nullable(),
|
|
169
|
-
gender,
|
|
170
|
-
brand: zod_1.number().nullable(),
|
|
171
|
-
holderIdentificationNumber: zod_1.string().nullable(),
|
|
172
|
-
copaymentValue: zod_1.number().nullable(),
|
|
173
|
-
mobilePhone: zod_1.string().nullable(),
|
|
174
|
-
company: zod_1.string().nullable(),
|
|
175
|
-
email: zod_1.string().email().nullable(),
|
|
176
|
-
dischargeDate: zod_1.date().nullable(),
|
|
177
|
-
leavingDate: zod_1.date().nullable(),
|
|
178
|
-
identificacion_tributaria: zod_1.string().nullable(),
|
|
179
|
-
deregistrationDate: zod_1.date().nullable(),
|
|
180
|
-
authorizationCode: zod_1.string().nullable(),
|
|
181
|
-
authorizationCodeExpiration: zod_1.date().nullable(),
|
|
182
|
-
}).nullable();
|
|
183
|
-
const oldIdentificaiton = zod_1.object({
|
|
184
|
-
identificationType,
|
|
185
|
-
identificationValue: zod_1.string(),
|
|
186
|
-
});
|
|
187
|
-
exports.doc24Schemas = {
|
|
188
|
-
identificationType,
|
|
189
|
-
sdkCredentials,
|
|
190
|
-
sdkParams: zod_1.object({ url: zod_1.string(), credentials: sdkCredentials }),
|
|
191
|
-
user: basePersonData.extend({ phone: zod_1.string(), email: zod_1.string() }),
|
|
192
|
-
patient: basePersonData,
|
|
193
|
-
specialtyMode,
|
|
194
|
-
specialty,
|
|
195
|
-
scheduleAvailabilityFilter,
|
|
196
|
-
availableAppointment,
|
|
197
|
-
availableScheduleClinics,
|
|
198
|
-
scheduleFilter: zod_1.object({
|
|
199
|
-
professionalId: zod_1.number().optional(),
|
|
200
|
-
offset: zod_1.number().optional(),
|
|
201
|
-
limit: zod_1.number().optional(),
|
|
202
|
-
weekDay: zod_1.number().optional(),
|
|
203
|
-
date: zod_1.date().optional(),
|
|
204
|
-
startHour: zod_1.string().optional(),
|
|
205
|
-
finishHour: zod_1.string().optional(),
|
|
206
|
-
}),
|
|
207
|
-
scheduleParameters: zod_1.union([
|
|
208
|
-
appointmentScheduleParameters,
|
|
209
|
-
instantScheduleParameters,
|
|
210
|
-
]),
|
|
211
|
-
videoVisit: zod_1.object({
|
|
212
|
-
id: zod_1.number().nullable(),
|
|
213
|
-
creationDate: zod_1.date(),
|
|
214
|
-
patientId: zod_1.number(),
|
|
215
|
-
user: zod_1.object({
|
|
216
|
-
id: zod_1.number(),
|
|
217
|
-
email: zod_1.string().nullable(),
|
|
218
|
-
phone: zod_1.string().nullable(),
|
|
219
|
-
}),
|
|
220
|
-
vcToken: zod_1.string(),
|
|
221
|
-
appointment: zod_1.object({
|
|
222
|
-
id: zod_1.number(),
|
|
223
|
-
date: zod_1.date(),
|
|
224
|
-
}).optional(),
|
|
225
|
-
videoVisit: zod_1.object({
|
|
226
|
-
id: zod_1.number(),
|
|
227
|
-
status: zod_1.string(),
|
|
228
|
-
}).optional(),
|
|
229
|
-
paymentStatus: zod_1.string().optional(),
|
|
230
|
-
atentionId: zod_1.number().optional(),
|
|
231
|
-
}),
|
|
232
|
-
videoVisitDetails: zod_1.object({
|
|
233
|
-
id: zod_1.number(),
|
|
234
|
-
status: zod_1.string(),
|
|
235
|
-
paymentStatus: zod_1.string(),
|
|
236
|
-
professional: zod_1.object({
|
|
237
|
-
id: zod_1.number(),
|
|
238
|
-
fullName: zod_1.string(),
|
|
239
|
-
}).optional(),
|
|
240
|
-
patient: zod_1.object({
|
|
241
|
-
fullName: zod_1.string(),
|
|
242
|
-
firstAccessDate: zod_1.date(),
|
|
243
|
-
lastAccessDate: zod_1.date(),
|
|
244
|
-
}),
|
|
245
|
-
finishDate: zod_1.date().nullable(),
|
|
246
|
-
retries: zod_1.number(),
|
|
247
|
-
language: zod_1.string(),
|
|
248
|
-
appointment: zod_1.object({ id: zod_1.number(), date: zod_1.date() }).nullable(),
|
|
249
|
-
report: zod_1.object({
|
|
250
|
-
motive: zod_1.string().nullable(),
|
|
251
|
-
actualDesease: zod_1.string().nullable(),
|
|
252
|
-
indications: zod_1.string().nullable(),
|
|
253
|
-
alertSigns: zod_1.string().nullable(),
|
|
254
|
-
extendedMotive: zod_1.string().nullable(),
|
|
255
|
-
diagnose: zod_1.array(zod_1.object({ description: zod_1.string(), code: zod_1.string() })),
|
|
256
|
-
}),
|
|
257
|
-
pdf: zod_1.object({
|
|
258
|
-
atention: zod_1.string().optional(),
|
|
259
|
-
labs: zod_1.string().optional(),
|
|
260
|
-
otherExams: zod_1.string().optional(),
|
|
261
|
-
images: zod_1.string().optional(),
|
|
262
|
-
medication: zod_1.array(zod_1.any()),
|
|
263
|
-
}),
|
|
264
|
-
files: zod_1.array(zod_1.object({ name: zod_1.string(), url: zod_1.string().url() })),
|
|
265
|
-
}),
|
|
266
|
-
activeVideoVisitData: zod_1.object({
|
|
267
|
-
consultationId: zod_1.number(),
|
|
268
|
-
patientId: zod_1.number(),
|
|
269
|
-
vcToken: zod_1.string(),
|
|
270
|
-
}),
|
|
271
|
-
professional: zod_1.object({
|
|
272
|
-
id: zod_1.number(),
|
|
273
|
-
firstName: zod_1.string(),
|
|
274
|
-
lastName: zod_1.string(),
|
|
275
|
-
birthdate: zod_1.date(),
|
|
276
|
-
gender,
|
|
277
|
-
email: zod_1.string(),
|
|
278
|
-
phone: zod_1.string().nullable(),
|
|
279
|
-
logoUrl: zod_1.string(),
|
|
280
|
-
matriculation: zod_1.array(zod_1.object({ number: zod_1.string(), type: zod_1.string() })),
|
|
281
|
-
specialties: zod_1.array(specialty),
|
|
282
|
-
degree: zod_1.string(),
|
|
283
|
-
languages: zod_1.array(zod_1.string()),
|
|
284
|
-
resume: zod_1.object({
|
|
285
|
-
link: zod_1.string(),
|
|
286
|
-
brief: zod_1.string(),
|
|
287
|
-
}),
|
|
288
|
-
}),
|
|
289
|
-
appointment,
|
|
290
|
-
chatroomAvailabilityFilter,
|
|
291
|
-
chatParameters,
|
|
292
|
-
availableChatroom,
|
|
293
|
-
chatDetails,
|
|
294
|
-
chatPost,
|
|
295
|
-
enrollmentParams,
|
|
296
|
-
diagnosticaPatientFilter: zod_1.object({
|
|
297
|
-
gender,
|
|
298
|
-
identificationType,
|
|
299
|
-
identificationValue: zod_1.string(),
|
|
300
|
-
}),
|
|
301
|
-
diagnosticaHistoryAppointment,
|
|
302
|
-
diagnosticaUser,
|
|
303
|
-
diagnosticaPatient,
|
|
304
|
-
diagnosticaDeepLinkResponse,
|
|
305
|
-
coverageInfo,
|
|
306
|
-
oldIdentificaiton,
|
|
307
|
-
};
|
package/lib/types.d.ts
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { TypeOf } from 'zod';
|
|
2
|
-
import { doc24Schemas } from './schemas';
|
|
3
|
-
export declare namespace Doc24 {
|
|
4
|
-
type IdentificationType = TypeOf<typeof doc24Schemas.identificationType>;
|
|
5
|
-
type SdkCredentials = TypeOf<typeof doc24Schemas.sdkCredentials>;
|
|
6
|
-
type SdkParams = TypeOf<typeof doc24Schemas.sdkParams>;
|
|
7
|
-
type User = TypeOf<typeof doc24Schemas.user>;
|
|
8
|
-
type Patient = TypeOf<typeof doc24Schemas.patient>;
|
|
9
|
-
type Specialty = TypeOf<typeof doc24Schemas.specialty>;
|
|
10
|
-
type ScheduleAvailabilityFilter = TypeOf<typeof doc24Schemas.scheduleAvailabilityFilter>;
|
|
11
|
-
type AvailableAppointment = TypeOf<typeof doc24Schemas.availableAppointment>;
|
|
12
|
-
type AvailableScheduleClinics = TypeOf<typeof doc24Schemas.availableScheduleClinics>;
|
|
13
|
-
type ScheduleFilter = TypeOf<typeof doc24Schemas.scheduleFilter>;
|
|
14
|
-
type ScheduleParameters = TypeOf<typeof doc24Schemas.scheduleParameters>;
|
|
15
|
-
type VideoVisit = TypeOf<typeof doc24Schemas.videoVisit>;
|
|
16
|
-
type VideoVisitDetails = TypeOf<typeof doc24Schemas.videoVisitDetails>;
|
|
17
|
-
type ActiveVideoVisitData = TypeOf<typeof doc24Schemas.activeVideoVisitData>;
|
|
18
|
-
type SpecialtyMode = TypeOf<typeof doc24Schemas.specialtyMode>;
|
|
19
|
-
type Professional = TypeOf<typeof doc24Schemas.professional>;
|
|
20
|
-
type Appointment = TypeOf<typeof doc24Schemas.appointment>;
|
|
21
|
-
type ChatroomAvailabilityFilter = TypeOf<typeof doc24Schemas.chatroomAvailabilityFilter>;
|
|
22
|
-
type AvailableChatroom = TypeOf<typeof doc24Schemas.availableChatroom>;
|
|
23
|
-
type ChatParameters = TypeOf<typeof doc24Schemas.chatParameters>;
|
|
24
|
-
type ChatDetails = TypeOf<typeof doc24Schemas.chatDetails>;
|
|
25
|
-
type ChatPost = TypeOf<typeof doc24Schemas.chatPost>;
|
|
26
|
-
type EnrollmentParams = TypeOf<typeof doc24Schemas.enrollmentParams>;
|
|
27
|
-
type CoverageInfo = TypeOf<typeof doc24Schemas.coverageInfo>;
|
|
28
|
-
type DiagnosticaPatientFilter = TypeOf<typeof doc24Schemas.diagnosticaPatientFilter>;
|
|
29
|
-
type DiagnosticaUser = TypeOf<typeof doc24Schemas.diagnosticaUser>;
|
|
30
|
-
type DiagnosticaPatient = TypeOf<typeof doc24Schemas.diagnosticaPatient>;
|
|
31
|
-
type DiagnosticaHistoryAppointment = TypeOf<typeof doc24Schemas.diagnosticaHistoryAppointment>;
|
|
32
|
-
type DiagnosticaDeepLinkResponse = TypeOf<typeof doc24Schemas.diagnosticaDeepLinkResponse>;
|
|
33
|
-
type OldIdentificaiton = TypeOf<typeof doc24Schemas.oldIdentificaiton>;
|
|
34
|
-
type BaseSdk = {
|
|
35
|
-
declareUser: (user: User) => Promise<number>;
|
|
36
|
-
getUserInstance: (user: User | number) => Promise<UserSdk>;
|
|
37
|
-
getProfessional: (professionalId: number) => Promise<Professional>;
|
|
38
|
-
getAvailableScheduleClinics: () => Promise<AvailableScheduleClinics>;
|
|
39
|
-
enroll: (params: EnrollmentParams) => Promise<void>;
|
|
40
|
-
getConverageInfo: (identificationValue: string) => Promise<CoverageInfo>;
|
|
41
|
-
getDiagnosticaHistory: (patient: DiagnosticaPatientFilter, from: Date, to: Date) => Promise<DiagnosticaHistoryAppointment[]>;
|
|
42
|
-
getDiagnosticaDeepLink: (kiosk: string, user: DiagnosticaUser, patient: DiagnosticaPatient) => Promise<DiagnosticaDeepLinkResponse>;
|
|
43
|
-
getDiagnosticaAccess: (kiosk: string, user: DiagnosticaUser, patient: DiagnosticaPatient) => Promise<void>;
|
|
44
|
-
};
|
|
45
|
-
type UserSdk = {
|
|
46
|
-
declarePatient: (patient: Patient) => Promise<number>;
|
|
47
|
-
updatePatient: (oldIdentification: OldIdentificaiton, patient: Patient) => Promise<number>;
|
|
48
|
-
getSpecialties: (mode: SpecialtyMode, language: string) => Promise<Specialty[]>;
|
|
49
|
-
getScheduleDates: (patientId: number, filter?: ScheduleAvailabilityFilter) => Promise<Date[]>;
|
|
50
|
-
getSchedule: (patientId: number, specialtyId: number, filter?: ScheduleFilter) => Promise<AvailableAppointment[]>;
|
|
51
|
-
getAppointment: (appointmentId: number) => Promise<Appointment>;
|
|
52
|
-
getAppointmentByVcToken: (vcToken: string) => Promise<Appointment>;
|
|
53
|
-
scheduleVideoVisit: (params: ScheduleParameters) => Promise<string>;
|
|
54
|
-
cancelVideoVisit: (vcToken: string) => Promise<void>;
|
|
55
|
-
getVideoVisit: (vcToken: string, patientId: number) => Promise<VideoVisit>;
|
|
56
|
-
getVideoVisitDetails: (vcId: number) => Promise<VideoVisitDetails>;
|
|
57
|
-
getVideoVisitLink: (vcToken: string, patientId: number) => Promise<string | null>;
|
|
58
|
-
getPatientVideoVisitHistory: (patientId: number) => Promise<VideoVisit[]>;
|
|
59
|
-
getActiveVideoVisits: () => Promise<ActiveVideoVisitData[]>;
|
|
60
|
-
getAvailableChatrooms: (patientId: number, specialtyId: number, filter: ChatroomAvailabilityFilter) => Promise<AvailableChatroom[]>;
|
|
61
|
-
createNewChat: (chatParameters: ChatParameters) => Promise<number>;
|
|
62
|
-
getPatientChats: (patientId: number) => Promise<ChatDetails[]>;
|
|
63
|
-
getChatPosts: (chatId: number) => Promise<ChatPost[]>;
|
|
64
|
-
cancelChat: (chatId: number) => Promise<void>;
|
|
65
|
-
sendChatMessage: (chatId: number, message: string) => Promise<number>;
|
|
66
|
-
userId: number;
|
|
67
|
-
};
|
|
68
|
-
namespace Webhook {
|
|
69
|
-
type StatusChangeEventStatus = 'S' | 'C' | 'F' | 'A' | 'D' | 'L';
|
|
70
|
-
type InvitationStatusChangeEvent = {
|
|
71
|
-
status: StatusChangeEventStatus;
|
|
72
|
-
changeDate: Date;
|
|
73
|
-
vcToken: string;
|
|
74
|
-
patientId: number;
|
|
75
|
-
professionalId: number;
|
|
76
|
-
appointmentId: number;
|
|
77
|
-
};
|
|
78
|
-
type ConsultationStatusChangeEvent = {
|
|
79
|
-
id: number;
|
|
80
|
-
invitationId: number;
|
|
81
|
-
status: StatusChangeEventStatus;
|
|
82
|
-
changeDate: Date;
|
|
83
|
-
vcToken?: string;
|
|
84
|
-
patientId?: number;
|
|
85
|
-
};
|
|
86
|
-
type AppointmentStatusChangeEvent = {
|
|
87
|
-
id: number;
|
|
88
|
-
status: StatusChangeEventStatus;
|
|
89
|
-
changeDate: Date;
|
|
90
|
-
};
|
|
91
|
-
type ChatUpdateEvent = {
|
|
92
|
-
id: number;
|
|
93
|
-
status: 'active' | 'ended';
|
|
94
|
-
patientId: number;
|
|
95
|
-
professionalId: number;
|
|
96
|
-
date: Date;
|
|
97
|
-
};
|
|
98
|
-
type Events = {
|
|
99
|
-
onInvitationStatusChange?: (event: InvitationStatusChangeEvent) => void;
|
|
100
|
-
onConsultationStatusChange?: (event: ConsultationStatusChangeEvent) => void;
|
|
101
|
-
onAppointmentStatusChange?: (event: AppointmentStatusChangeEvent) => void;
|
|
102
|
-
onChatUpdate?: (event: ChatUpdateEvent) => void;
|
|
103
|
-
};
|
|
104
|
-
type Request = {
|
|
105
|
-
headers: Record<string, string>;
|
|
106
|
-
body: unknown;
|
|
107
|
-
query: unknown;
|
|
108
|
-
};
|
|
109
|
-
type Response = {
|
|
110
|
-
status: {
|
|
111
|
-
code: number;
|
|
112
|
-
message?: string;
|
|
113
|
-
};
|
|
114
|
-
data: unknown;
|
|
115
|
-
};
|
|
116
|
-
type Handler = (request: Doc24.Webhook.Request) => Promise<Doc24.Webhook.Response>;
|
|
117
|
-
}
|
|
118
|
-
}
|
package/lib/types.js
DELETED
package/lib/userSdk/chat.d.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { RequestMaker } from '../request';
|
|
2
|
-
export declare const getChatMethods: (makeRequest: RequestMaker) => {
|
|
3
|
-
getAvailableChatrooms: (patientId: number, specialtyId: number, filter: {
|
|
4
|
-
offset?: number | undefined;
|
|
5
|
-
limit?: number | undefined;
|
|
6
|
-
}) => Promise<{
|
|
7
|
-
id: number;
|
|
8
|
-
professional: {
|
|
9
|
-
id: number;
|
|
10
|
-
fullName: string;
|
|
11
|
-
logoUrl: string;
|
|
12
|
-
};
|
|
13
|
-
specialty: {
|
|
14
|
-
id: number;
|
|
15
|
-
description: string;
|
|
16
|
-
};
|
|
17
|
-
}[]>;
|
|
18
|
-
createNewChat: (chatParameters: {
|
|
19
|
-
patientId: number;
|
|
20
|
-
specialtyId: number;
|
|
21
|
-
language: string;
|
|
22
|
-
chatroomId: number;
|
|
23
|
-
}) => Promise<number>;
|
|
24
|
-
getPatientChats: (patientId: number) => Promise<{
|
|
25
|
-
id: number;
|
|
26
|
-
patient: {
|
|
27
|
-
id: number;
|
|
28
|
-
firstName: string;
|
|
29
|
-
lastName: string;
|
|
30
|
-
};
|
|
31
|
-
professional: {
|
|
32
|
-
id: number;
|
|
33
|
-
fullName: string;
|
|
34
|
-
logoUrl: string;
|
|
35
|
-
};
|
|
36
|
-
status: string;
|
|
37
|
-
specialty: {
|
|
38
|
-
id: number;
|
|
39
|
-
description: string;
|
|
40
|
-
};
|
|
41
|
-
paymentStatus: string;
|
|
42
|
-
chatRoomId: number;
|
|
43
|
-
startDate: Date;
|
|
44
|
-
lastEventDate: Date;
|
|
45
|
-
closureDate: Date | null;
|
|
46
|
-
patientLastPost: Date | null;
|
|
47
|
-
professionalLastPost: Date | null;
|
|
48
|
-
}[]>;
|
|
49
|
-
getChatPosts: (chatId: number) => Promise<{
|
|
50
|
-
date: Date;
|
|
51
|
-
message: string;
|
|
52
|
-
id: number;
|
|
53
|
-
userType: "patient" | "professional";
|
|
54
|
-
}[]>;
|
|
55
|
-
cancelChat: (chatId: number) => Promise<void>;
|
|
56
|
-
sendChatMessage: (chatId: number, message: string) => Promise<number>;
|
|
57
|
-
};
|
package/lib/userSdk/chat.js
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getChatMethods = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const validation_1 = require("../request/validation");
|
|
6
|
-
const schemas_1 = require("../schemas");
|
|
7
|
-
const utils_1 = require("../utils");
|
|
8
|
-
const getChatMethods = (makeRequest) => {
|
|
9
|
-
const getAvailableChatrooms = validation_1.validateFunction(zod_1.tuple([zod_1.number(), zod_1.number(), schemas_1.doc24Schemas.chatroomAvailabilityFilter]), zod_1.array(schemas_1.doc24Schemas.availableChatroom), async (patientId, specialtyId, filter) => {
|
|
10
|
-
const path = `/chatroom/availability/${patientId}/${specialtyId}/${JSON.stringify(filter)}`;
|
|
11
|
-
const response = await makeRequest('GET', path);
|
|
12
|
-
return response.data.available_chatrooms.map((r) => ({
|
|
13
|
-
id: r.chatroom_id,
|
|
14
|
-
professional: {
|
|
15
|
-
id: r.professional_id,
|
|
16
|
-
fullName: r.professional,
|
|
17
|
-
logoUrl: r.logo,
|
|
18
|
-
},
|
|
19
|
-
specialty: {
|
|
20
|
-
id: r.specialty_id,
|
|
21
|
-
description: r.specialty,
|
|
22
|
-
},
|
|
23
|
-
}));
|
|
24
|
-
});
|
|
25
|
-
const createNewChat = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.chatParameters]), zod_1.number(), async (parameters) => {
|
|
26
|
-
const path = `/chatroom/visit`;
|
|
27
|
-
const response = await makeRequest('POST', path, {
|
|
28
|
-
chatroom_data: {
|
|
29
|
-
patient_id: parameters.patientId,
|
|
30
|
-
chatroom_id: parameters.chatroomId,
|
|
31
|
-
language: parameters.language.toLocaleUpperCase(),
|
|
32
|
-
specialty_id: parameters.specialtyId,
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
return response.data.chat_id;
|
|
36
|
-
});
|
|
37
|
-
const getPatientChats = validation_1.validateFunction(zod_1.tuple([zod_1.number()]), zod_1.array(schemas_1.doc24Schemas.chatDetails), async (patientId) => {
|
|
38
|
-
const path = `/chatroom/visits/${patientId}`;
|
|
39
|
-
const response = await makeRequest('GET', path);
|
|
40
|
-
return response.data.chatroom_visits.map((c) => ({
|
|
41
|
-
id: c.chat_id,
|
|
42
|
-
chatRoomId: c.chatroom_id,
|
|
43
|
-
status: c.status,
|
|
44
|
-
paymentStatus: c.payment_status,
|
|
45
|
-
startDate: utils_1.parseDateTime(c.start_date),
|
|
46
|
-
lastEventDate: utils_1.parseDateTime(c.fecha_ultimo_evento),
|
|
47
|
-
closureDate: c.closure_date && utils_1.parseDateTime(c.closure_date),
|
|
48
|
-
patient: {
|
|
49
|
-
id: c.patient_id,
|
|
50
|
-
firstName: c.patient_name,
|
|
51
|
-
lastName: c.patient_lastname,
|
|
52
|
-
},
|
|
53
|
-
patientLastPost: c.patient_last_post && utils_1.parseDateTime(c.patient_last_post),
|
|
54
|
-
professional: {
|
|
55
|
-
id: c.professional_id,
|
|
56
|
-
fullName: c.professional,
|
|
57
|
-
logoUrl: c.logo,
|
|
58
|
-
},
|
|
59
|
-
professionalLastPost: c.professional_last_post && utils_1.parseDateTime(c.professional_last_post),
|
|
60
|
-
specialty: {
|
|
61
|
-
id: c.specialty_id,
|
|
62
|
-
description: c.specialty,
|
|
63
|
-
},
|
|
64
|
-
}));
|
|
65
|
-
});
|
|
66
|
-
const getChatPosts = validation_1.validateFunction(zod_1.tuple([zod_1.number()]), zod_1.array(schemas_1.doc24Schemas.chatPost), async (chatId) => {
|
|
67
|
-
const path = `/chatroom/visit/${chatId}`;
|
|
68
|
-
const response = await makeRequest('GET', path);
|
|
69
|
-
return JSON.parse(response.data.posts).map((p) => ({
|
|
70
|
-
id: p.post_id,
|
|
71
|
-
message: p.post,
|
|
72
|
-
date: utils_1.parseDateTime(p.post_date),
|
|
73
|
-
userType: p.user_type === 'P' ? 'patient' : 'professional',
|
|
74
|
-
}));
|
|
75
|
-
});
|
|
76
|
-
const cancelChat = validation_1.validateFunction(zod_1.tuple([zod_1.number()]), zod_1.void(), async (chatId) => {
|
|
77
|
-
const path = `/chatroom/visit/${chatId}`;
|
|
78
|
-
await makeRequest('DELETE', path);
|
|
79
|
-
return;
|
|
80
|
-
});
|
|
81
|
-
const sendChatMessage = validation_1.validateFunction(zod_1.tuple([zod_1.number(), zod_1.string()]), zod_1.number(), async (chatId, message) => {
|
|
82
|
-
const path = `/chatroom/post`;
|
|
83
|
-
const response = await makeRequest('POST', path, {
|
|
84
|
-
chat_id: chatId,
|
|
85
|
-
message,
|
|
86
|
-
});
|
|
87
|
-
return response.data.post_id;
|
|
88
|
-
});
|
|
89
|
-
return {
|
|
90
|
-
getAvailableChatrooms,
|
|
91
|
-
createNewChat,
|
|
92
|
-
getPatientChats,
|
|
93
|
-
getChatPosts,
|
|
94
|
-
cancelChat,
|
|
95
|
-
sendChatMessage,
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
exports.getChatMethods = getChatMethods;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { RequestMaker } from '../request';
|
|
2
|
-
export declare const getExternalMethods: (makeRequest: RequestMaker) => {
|
|
3
|
-
getExternalStudiesHistoryLink: (patient: {
|
|
4
|
-
identificationType: "DNI";
|
|
5
|
-
identificationValue: string;
|
|
6
|
-
birthdate: Date;
|
|
7
|
-
gender: "m" | "f" | "o";
|
|
8
|
-
}) => Promise<string | null>;
|
|
9
|
-
getExternalAppointmentsLink: (identificationValue: string, birthdate: Date) => Promise<string | null>;
|
|
10
|
-
getExternalAppointments: () => Promise<{
|
|
11
|
-
patientIdentification?: string | undefined;
|
|
12
|
-
date: Date;
|
|
13
|
-
birthdate: Date;
|
|
14
|
-
appointment: string;
|
|
15
|
-
id: number;
|
|
16
|
-
specialty: string;
|
|
17
|
-
patientName: string;
|
|
18
|
-
clinic: string;
|
|
19
|
-
professionalName: string;
|
|
20
|
-
modality: string;
|
|
21
|
-
}[]>;
|
|
22
|
-
cancelExternalAppointment: (appointmentId: {
|
|
23
|
-
patientIdentification?: string | undefined;
|
|
24
|
-
date: Date;
|
|
25
|
-
birthdate: Date;
|
|
26
|
-
appointment: string;
|
|
27
|
-
id: number;
|
|
28
|
-
specialty: string;
|
|
29
|
-
patientName: string;
|
|
30
|
-
clinic: string;
|
|
31
|
-
professionalName: string;
|
|
32
|
-
modality: string;
|
|
33
|
-
}) => Promise<void>;
|
|
34
|
-
};
|
package/lib/userSdk/external.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getExternalMethods = void 0;
|
|
4
|
-
const date_fns_1 = require("date-fns");
|
|
5
|
-
const zod_1 = require("zod");
|
|
6
|
-
const validation_1 = require("../request/validation");
|
|
7
|
-
const schemas_1 = require("../schemas");
|
|
8
|
-
const utils_1 = require("../utils");
|
|
9
|
-
const getExternalMethods = (makeRequest) => {
|
|
10
|
-
const getExternalStudiesHistoryLink = async (patient) => {
|
|
11
|
-
var _a, _b;
|
|
12
|
-
const path = '/history-external-studies';
|
|
13
|
-
const response = await makeRequest('POST', path, {
|
|
14
|
-
patient: mapPatientData(patient),
|
|
15
|
-
});
|
|
16
|
-
return (_b = (_a = response.data.info) === null || _a === void 0 ? void 0 : _a.link) !== null && _b !== void 0 ? _b : null;
|
|
17
|
-
};
|
|
18
|
-
const getExternalAppointmentsLink = async (identificationValue, birthdate) => {
|
|
19
|
-
const path = `/external-appointments-link/${identificationValue}/${date_fns_1.format(birthdate, 'yyyy-MM-dd')}`;
|
|
20
|
-
const response = await makeRequest('GET', path);
|
|
21
|
-
return response.data.link;
|
|
22
|
-
};
|
|
23
|
-
const getExternalAppointments = async () => {
|
|
24
|
-
const path = '/external-appointments';
|
|
25
|
-
const response = await makeRequest('GET', path);
|
|
26
|
-
return response.data.appointments.map((a) => ({
|
|
27
|
-
id: a.appointment_id,
|
|
28
|
-
patientIdentification: a.patient_id,
|
|
29
|
-
patientName: a.patient_name,
|
|
30
|
-
birthdate: utils_1.parseDate(a.birthdate),
|
|
31
|
-
appointment: a.appointment,
|
|
32
|
-
clinic: a.clinic,
|
|
33
|
-
professionalName: a.professional,
|
|
34
|
-
date: utils_1.parseDateTime(`${a.day} ${a.hour}:00`),
|
|
35
|
-
specialty: a.specialty,
|
|
36
|
-
modality: a.modality,
|
|
37
|
-
}));
|
|
38
|
-
};
|
|
39
|
-
const cancelExternalAppointment = async (appointment) => {
|
|
40
|
-
const path = `/cancel-external-appointment`;
|
|
41
|
-
await makeRequest('POST', path, {
|
|
42
|
-
appointment_id: appointment.id,
|
|
43
|
-
patient_id: appointment.patientIdentification,
|
|
44
|
-
patient_name: appointment.patientName,
|
|
45
|
-
birthdate: date_fns_1.format(appointment.birthdate, 'yyyy-MM-dd'),
|
|
46
|
-
appointment: appointment.appointment,
|
|
47
|
-
clinic: appointment.clinic,
|
|
48
|
-
professional: appointment.professionalName,
|
|
49
|
-
day: date_fns_1.format(appointment.date, 'yyyy-MM-dd'),
|
|
50
|
-
hour: date_fns_1.format(appointment.date, 'HH:mm'),
|
|
51
|
-
specialty: appointment.specialty,
|
|
52
|
-
modality: appointment.modality,
|
|
53
|
-
});
|
|
54
|
-
return;
|
|
55
|
-
};
|
|
56
|
-
return {
|
|
57
|
-
getExternalStudiesHistoryLink: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalPatient]), zod_1.string().nullable(), getExternalStudiesHistoryLink),
|
|
58
|
-
getExternalAppointmentsLink: validation_1.validateFunction(zod_1.tuple([zod_1.string(), zod_1.date()]), zod_1.string().nullable(), getExternalAppointmentsLink),
|
|
59
|
-
getExternalAppointments: validation_1.validateFunction(zod_1.tuple([]), zod_1.array(schemas_1.doc24Schemas.externalAppointment), getExternalAppointments),
|
|
60
|
-
cancelExternalAppointment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalAppointment]), zod_1.void(), cancelExternalAppointment),
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
exports.getExternalMethods = getExternalMethods;
|
|
64
|
-
const mapPatientData = (patient) => {
|
|
65
|
-
return {
|
|
66
|
-
birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
|
|
67
|
-
id_type: 'dni',
|
|
68
|
-
id_value: patient.identificationValue,
|
|
69
|
-
gender: patient.gender.toLocaleUpperCase(),
|
|
70
|
-
};
|
|
71
|
-
};
|