@integraciones_doc24/sdk 1.14.5 → 1.15.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.
@@ -174,33 +174,4 @@ export declare const getExternalMethods: (makeRequest: RequestMaker) => {
174
174
  emailCode?: undefined;
175
175
  phoneCode: string;
176
176
  })) => Promise<any>;
177
- getExternalStudiesHistoryLink: (patient: {
178
- identificationType: "DNI";
179
- identificationValue: string;
180
- birthdate: Date;
181
- gender: "m" | "f";
182
- }) => Promise<string | null>;
183
- getExternalAppointmentsLink: (identificationValue: string, birthdate: Date) => Promise<string | null>;
184
- getExternalAppointments: () => Promise<{
185
- date: Date;
186
- birthdate: Date;
187
- appointment: string;
188
- id: number;
189
- specialty: string;
190
- patientName: string;
191
- clinic: string;
192
- professionalName: string;
193
- modality: string;
194
- }[]>;
195
- cancelExternalAppointment: (appointmentId: {
196
- date: Date;
197
- birthdate: Date;
198
- appointment: string;
199
- id: number;
200
- specialty: string;
201
- patientName: string;
202
- clinic: string;
203
- professionalName: string;
204
- modality: string;
205
- }) => Promise<void>;
206
177
  };
@@ -5,7 +5,6 @@ const date_fns_1 = require("date-fns");
5
5
  const zod_1 = require("zod");
6
6
  const validation_1 = require("../request/validation");
7
7
  const schemas_1 = require("../schemas");
8
- const utils_1 = require("../utils");
9
8
  const getExternalMethods = (makeRequest) => {
10
9
  const externalLogin = async ({ user, password, }) => {
11
10
  const path = '/external-login';
@@ -85,50 +84,6 @@ const getExternalMethods = (makeRequest) => {
85
84
  });
86
85
  return response.data;
87
86
  };
88
- const getExternalStudiesHistoryLink = async (patient) => {
89
- var _a, _b;
90
- const path = '/history-external-studies';
91
- const response = await makeRequest('POST', path, {
92
- patient: mapPatientData(patient),
93
- });
94
- return (_b = (_a = response.data.info) === null || _a === void 0 ? void 0 : _a.link) !== null && _b !== void 0 ? _b : null;
95
- };
96
- const getExternalAppointmentsLink = async (identificationValue, birthdate) => {
97
- const path = `/external-appointments-link/${identificationValue}/${date_fns_1.format(birthdate, 'yyyy-MM-dd')}`;
98
- const response = await makeRequest('GET', path);
99
- return response.data.link;
100
- };
101
- const getExternalAppointments = async () => {
102
- const path = '/external-appointments';
103
- const response = await makeRequest('GET', path);
104
- return response.data.appointments.map((a) => ({
105
- id: a.appointment_id,
106
- patientName: a.patient_name,
107
- birthdate: utils_1.parseDate(a.birthdate),
108
- appointment: a.appointment,
109
- clinic: a.clinic,
110
- professionalName: a.professional,
111
- date: utils_1.parseDateTime(`${a.day} ${a.hour}:00`),
112
- specialty: a.specialty,
113
- modality: a.modality,
114
- }));
115
- };
116
- const cancelExternalAppointment = async (appointment) => {
117
- const path = `/cancel-external-appointment`;
118
- await makeRequest('POST', path, {
119
- appointment_id: appointment.id,
120
- patient_name: appointment.patientName,
121
- birthdate: date_fns_1.format(appointment.birthdate, 'yyyy-MM-dd'),
122
- appointment: appointment.appointment,
123
- clinic: appointment.clinic,
124
- professional: appointment.professionalName,
125
- day: date_fns_1.format(appointment.date, 'yyyy-MM-dd'),
126
- hour: date_fns_1.format(appointment.date, 'HH:mm'),
127
- specialty: appointment.specialty,
128
- modality: appointment.modality,
129
- });
130
- return;
131
- };
132
87
  return {
133
88
  externalLogin: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalLoginParams]), schemas_1.doc24Schemas.externalLoginResponse, externalLogin),
134
89
  preExternalEnrollment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.preExternalEnrollmentParams]), zod_1.void(), preExternalEnrollment),
@@ -136,18 +91,6 @@ const getExternalMethods = (makeRequest) => {
136
91
  sendExternalVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.sendExternalVerificationCodeParams]), zod_1.void(), sendExternalVerificationCode),
137
92
  verifyExternalVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.verifyExternalVerificationCodeParams]), zod_1.any(), verifyExternalVerificationCode),
138
93
  externalResetPassword: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalResetPasswordParams]), zod_1.any(), externalResetPassword),
139
- getExternalStudiesHistoryLink: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalPatient]), zod_1.string().nullable(), getExternalStudiesHistoryLink),
140
- getExternalAppointmentsLink: validation_1.validateFunction(zod_1.tuple([zod_1.string(), zod_1.date()]), zod_1.string().nullable(), getExternalAppointmentsLink),
141
- getExternalAppointments: validation_1.validateFunction(zod_1.tuple([]), zod_1.array(schemas_1.doc24Schemas.externalAppointment), getExternalAppointments),
142
- cancelExternalAppointment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalAppointment]), zod_1.void(), cancelExternalAppointment),
143
94
  };
144
95
  };
145
96
  exports.getExternalMethods = getExternalMethods;
146
- const mapPatientData = (patient) => {
147
- return {
148
- birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
149
- id_type: 'dni',
150
- id_value: patient.identificationValue,
151
- gender: patient.gender.toLocaleUpperCase(),
152
- };
153
- };
package/lib/index.d.ts CHANGED
@@ -360,34 +360,5 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
360
360
  emailCode?: undefined;
361
361
  phoneCode: string;
362
362
  })) => Promise<any>;
363
- getExternalStudiesHistoryLink: (patient: {
364
- identificationType: "DNI";
365
- identificationValue: string;
366
- birthdate: Date;
367
- gender: "m" | "f";
368
- }) => Promise<string | null>;
369
- getExternalAppointmentsLink: (identificationValue: string, birthdate: Date) => Promise<string | null>;
370
- getExternalAppointments: () => Promise<{
371
- date: Date;
372
- birthdate: Date;
373
- appointment: string;
374
- id: number;
375
- specialty: string;
376
- patientName: string;
377
- clinic: string;
378
- professionalName: string;
379
- modality: string;
380
- }[]>;
381
- cancelExternalAppointment: (appointmentId: {
382
- date: Date;
383
- birthdate: Date;
384
- appointment: string;
385
- id: number;
386
- specialty: string;
387
- patientName: string;
388
- clinic: string;
389
- professionalName: string;
390
- modality: string;
391
- }) => Promise<void>;
392
363
  }>;
393
364
  export type { Doc24 } from './types';
package/lib/schemas.d.ts CHANGED
@@ -1701,6 +1701,7 @@ export declare const doc24Schemas: {
1701
1701
  }>;
1702
1702
  externalAppointment: import("zod").ZodObject<{
1703
1703
  id: import("zod").ZodNumber;
1704
+ patientIdentification: import("zod").ZodOptional<import("zod").ZodString>;
1704
1705
  patientName: import("zod").ZodString;
1705
1706
  birthdate: import("zod").ZodDate;
1706
1707
  appointment: import("zod").ZodString;
@@ -1710,6 +1711,7 @@ export declare const doc24Schemas: {
1710
1711
  specialty: import("zod").ZodString;
1711
1712
  modality: import("zod").ZodString;
1712
1713
  }, "strip", import("zod").ZodTypeAny, {
1714
+ patientIdentification?: string | undefined;
1713
1715
  date: Date;
1714
1716
  birthdate: Date;
1715
1717
  appointment: string;
@@ -1720,6 +1722,7 @@ export declare const doc24Schemas: {
1720
1722
  professionalName: string;
1721
1723
  modality: string;
1722
1724
  }, {
1725
+ patientIdentification?: string | undefined;
1723
1726
  date: Date;
1724
1727
  birthdate: Date;
1725
1728
  appointment: string;
package/lib/schemas.js CHANGED
@@ -288,6 +288,7 @@ const externalPatient = zod_1.object({
288
288
  });
289
289
  const externalAppointment = zod_1.object({
290
290
  id: zod_1.number(),
291
+ patientIdentification: zod_1.string().optional(),
291
292
  patientName: zod_1.string(),
292
293
  birthdate: zod_1.date(),
293
294
  appointment: zod_1.string(),
package/lib/types.d.ts CHANGED
@@ -63,10 +63,6 @@ export declare namespace Doc24 {
63
63
  sendExternalVerificationCode: (params: SendExternalVerificationCodeParams) => Promise<void>;
64
64
  verifyExternalVerificationCode: (params: VerifyExternalVerificationCodeParams) => Promise<any>;
65
65
  externalResetPassword: (params: ExternalResetPasswordParams) => Promise<any>;
66
- getExternalStudiesHistoryLink: (patient: ExternalPatient) => Promise<string | null>;
67
- getExternalAppointmentsLink: (identificationValue: string, birthdate: Date) => Promise<string | null>;
68
- getExternalAppointments: () => Promise<ExternalAppointment[]>;
69
- cancelExternalAppointment: (appointmentId: ExternalAppointment) => Promise<void>;
70
66
  };
71
67
  type UserSdk = {
72
68
  declarePatient: (params: DeclarePatientParams) => Promise<DeclarePatientResponse>;
@@ -90,6 +86,10 @@ export declare namespace Doc24 {
90
86
  getChatPosts: (chatId: number) => Promise<ChatPost[]>;
91
87
  cancelChat: (chatId: number) => Promise<void>;
92
88
  sendChatMessage: (chatId: number, message: string) => Promise<number>;
89
+ getExternalStudiesHistoryLink: (patient: ExternalPatient) => Promise<string | null>;
90
+ getExternalAppointmentsLink: (identificationValue: string, birthdate: Date) => Promise<string | null>;
91
+ getExternalAppointments: () => Promise<ExternalAppointment[]>;
92
+ cancelExternalAppointment: (appointmentId: ExternalAppointment) => Promise<void>;
93
93
  userId: number;
94
94
  };
95
95
  namespace Webhook {
@@ -0,0 +1,34 @@
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";
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
+ };
@@ -0,0 +1,70 @@
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_name: appointment.patientName,
44
+ birthdate: date_fns_1.format(appointment.birthdate, 'yyyy-MM-dd'),
45
+ appointment: appointment.appointment,
46
+ clinic: appointment.clinic,
47
+ professional: appointment.professionalName,
48
+ day: date_fns_1.format(appointment.date, 'yyyy-MM-dd'),
49
+ hour: date_fns_1.format(appointment.date, 'HH:mm'),
50
+ specialty: appointment.specialty,
51
+ modality: appointment.modality,
52
+ });
53
+ return;
54
+ };
55
+ return {
56
+ getExternalStudiesHistoryLink: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalPatient]), zod_1.string().nullable(), getExternalStudiesHistoryLink),
57
+ getExternalAppointmentsLink: validation_1.validateFunction(zod_1.tuple([zod_1.string(), zod_1.date()]), zod_1.string().nullable(), getExternalAppointmentsLink),
58
+ getExternalAppointments: validation_1.validateFunction(zod_1.tuple([]), zod_1.array(schemas_1.doc24Schemas.externalAppointment), getExternalAppointments),
59
+ cancelExternalAppointment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalAppointment]), zod_1.void(), cancelExternalAppointment),
60
+ };
61
+ };
62
+ exports.getExternalMethods = getExternalMethods;
63
+ const mapPatientData = (patient) => {
64
+ return {
65
+ birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
66
+ id_type: 'dni',
67
+ id_value: patient.identificationValue,
68
+ gender: patient.gender.toLocaleUpperCase(),
69
+ };
70
+ };
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.userSdk = void 0;
4
4
  const request_1 = require("../request");
5
5
  const chat_1 = require("./chat");
6
+ const external_1 = require("./external");
6
7
  const patients_1 = require("./patients");
7
8
  const schedule_1 = require("./schedule");
8
9
  const specialties_1 = require("./specialties");
@@ -14,12 +15,14 @@ const userSdk = async (url, credentials, userId) => {
14
15
  const scheduleMethods = schedule_1.getScheduleMethods(makeRequest);
15
16
  const videoVisitMethods = videoVisit_1.getVideoVisitMethods(makeRequest);
16
17
  const chatMethods = chat_1.getChatMethods(makeRequest);
18
+ const externalMethods = external_1.getExternalMethods(makeRequest);
17
19
  const sdk = {
18
20
  ...patientMethods,
19
21
  ...specialtyMethods,
20
22
  ...scheduleMethods,
21
23
  ...videoVisitMethods,
22
24
  ...chatMethods,
25
+ ...externalMethods,
23
26
  userId,
24
27
  };
25
28
  return sdk;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integraciones_doc24/sdk",
3
- "version": "1.14.5",
3
+ "version": "1.15.1",
4
4
  "publishConfig": {
5
5
  "tag": "latest"
6
6
  },
package/lib/test.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare const test: () => Promise<void>;
package/lib/test.js DELETED
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.test = void 0;
4
- const _1 = require(".");
5
- const test = async () => {
6
- const baseSdk = await _1.doc24Sdk({
7
- url: 'https://tapi.doc24.com.ar/ws/sdk',
8
- credentials: {
9
- // iss: 'Diagnostica',
10
- // key: 'gS2J78V0Zw8XiZJPGC9RS8TlECgqM2TmVtOzNAZbqputgmtc',
11
- iss: 'wehealthy',
12
- key: '33Ypv5jQ1VTr1KcOImdBhPnoRDqmPlYR3JWbrlUim9U=',
13
- },
14
- });
15
- const userSdk = await baseSdk.getUserInstance(14735);
16
- const spe = await userSdk.getSpecialties('instant', 'ES');
17
- console.log(spe);
18
- // const userSdk = await baseSdk.getUserInstance(20892);
19
- // const res = await userSdk.updatePatient(
20
- // {
21
- // identificationType: 'nn',
22
- // identificationValue: 'jhYuPe9wu8WmSUroB4tLq8',
23
- // },
24
- // {
25
- // firstName: 'Test',
26
- // lastName: 'Emergency',
27
- // identificationType: 'dni',
28
- // identificationValue: '37972512',
29
- // countryId: 'AR',
30
- // birthdate: new Date(),
31
- // gender: 'm',
32
- // },
33
- // );
34
- // console.log(res);
35
- };
36
- exports.test = test;
37
- exports.test();