@integraciones_doc24/sdk 0.42.1 → 0.42.2

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.
@@ -69,7 +69,7 @@ export declare const getConsultationMethods: (url: string, credentials: Doc24.Sd
69
69
  motivo_extendido_consulta: string;
70
70
  presencial_requerida: string;
71
71
  derivada: string;
72
- derivada_id_especialidad: string;
72
+ derivada_id_especialidad: string | number;
73
73
  derivada_presencial_obligatoria: string;
74
74
  derivada_comentarios: string | null;
75
75
  diagnostico: any[];
package/lib/index.d.ts CHANGED
@@ -173,7 +173,7 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
173
173
  motivo_extendido_consulta: string;
174
174
  presencial_requerida: string;
175
175
  derivada: string;
176
- derivada_id_especialidad: string;
176
+ derivada_id_especialidad: string | number;
177
177
  derivada_presencial_obligatoria: string;
178
178
  derivada_comentarios: string | null;
179
179
  diagnostico: any[];
package/lib/schemas.d.ts CHANGED
@@ -731,7 +731,7 @@ export declare const doc24Schemas: {
731
731
  motivo_extendido_consulta: import("zod").ZodString;
732
732
  presencial_requerida: import("zod").ZodString;
733
733
  derivada: import("zod").ZodString;
734
- derivada_id_especialidad: import("zod").ZodString;
734
+ derivada_id_especialidad: import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodNumber]>;
735
735
  derivada_presencial_obligatoria: import("zod").ZodString;
736
736
  derivada_comentarios: import("zod").ZodNullable<import("zod").ZodString>;
737
737
  diagnostico: import("zod").ZodArray<import("zod").ZodAny, "many">;
@@ -836,7 +836,7 @@ export declare const doc24Schemas: {
836
836
  motivo_extendido_consulta: string;
837
837
  presencial_requerida: string;
838
838
  derivada: string;
839
- derivada_id_especialidad: string;
839
+ derivada_id_especialidad: string | number;
840
840
  derivada_presencial_obligatoria: string;
841
841
  derivada_comentarios: string | null;
842
842
  diagnostico: any[];
@@ -931,7 +931,7 @@ export declare const doc24Schemas: {
931
931
  motivo_extendido_consulta: string;
932
932
  presencial_requerida: string;
933
933
  derivada: string;
934
- derivada_id_especialidad: string;
934
+ derivada_id_especialidad: string | number;
935
935
  derivada_presencial_obligatoria: string;
936
936
  derivada_comentarios: string | null;
937
937
  diagnostico: any[];
package/lib/schemas.js CHANGED
@@ -256,7 +256,7 @@ const consultation = zod_1.object({
256
256
  motivo_extendido_consulta: zod_1.string(),
257
257
  presencial_requerida: zod_1.string(),
258
258
  derivada: zod_1.string(),
259
- derivada_id_especialidad: zod_1.string(),
259
+ derivada_id_especialidad: zod_1.union([zod_1.string(), zod_1.number()]),
260
260
  derivada_presencial_obligatoria: zod_1.string(),
261
261
  derivada_comentarios: zod_1.string().nullable(),
262
262
  diagnostico: zod_1.array(zod_1.any()),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integraciones_doc24/sdk",
3
- "version": "0.42.1",
3
+ "version": "0.42.2",
4
4
  "publishConfig": {
5
5
  "tag": "0.x"
6
6
  },
@@ -1,177 +0,0 @@
1
- import { RequestMaker } from '../request';
2
- export declare const getExternalMethods: (makeRequest: RequestMaker) => {
3
- externalLogin: (params: {
4
- user: string;
5
- password: string;
6
- }) => Promise<{
7
- gender?: "m" | "f" | "o" | undefined;
8
- firstName: string;
9
- lastName: string;
10
- countryId: string;
11
- phone: string;
12
- email: string;
13
- birthday: Date;
14
- identificationNumber: string;
15
- }>;
16
- preExternalEnrollment: (params: ({
17
- birthdate: Date;
18
- identificationNumber: string;
19
- } & {
20
- phone: string;
21
- email: string;
22
- }) | ({
23
- birthdate: Date;
24
- identificationNumber: string;
25
- } & {
26
- phone?: undefined;
27
- email: string;
28
- }) | ({
29
- birthdate: Date;
30
- identificationNumber: string;
31
- } & {
32
- email?: undefined;
33
- phone: string;
34
- })) => Promise<void>;
35
- externalEnrollment: (params: ({
36
- birthdate: Date;
37
- identificationNumber: string;
38
- } & {
39
- phone: string;
40
- email: string;
41
- } & {
42
- password: string;
43
- } & {
44
- emailCode: string;
45
- phoneCode: string;
46
- }) | ({
47
- birthdate: Date;
48
- identificationNumber: string;
49
- } & {
50
- phone: string;
51
- email: string;
52
- } & {
53
- password: string;
54
- } & {
55
- phoneCode?: undefined;
56
- emailCode: string;
57
- }) | ({
58
- birthdate: Date;
59
- identificationNumber: string;
60
- } & {
61
- phone: string;
62
- email: string;
63
- } & {
64
- password: string;
65
- } & {
66
- emailCode?: undefined;
67
- phoneCode: string;
68
- }) | ({
69
- birthdate: Date;
70
- identificationNumber: string;
71
- } & {
72
- phone?: undefined;
73
- email: string;
74
- } & {
75
- password: string;
76
- } & {
77
- emailCode: string;
78
- phoneCode: string;
79
- }) | ({
80
- birthdate: Date;
81
- identificationNumber: string;
82
- } & {
83
- phone?: undefined;
84
- email: string;
85
- } & {
86
- password: string;
87
- } & {
88
- phoneCode?: undefined;
89
- emailCode: string;
90
- }) | ({
91
- birthdate: Date;
92
- identificationNumber: string;
93
- } & {
94
- phone?: undefined;
95
- email: string;
96
- } & {
97
- password: string;
98
- } & {
99
- emailCode?: undefined;
100
- phoneCode: string;
101
- }) | ({
102
- birthdate: Date;
103
- identificationNumber: string;
104
- } & {
105
- email?: undefined;
106
- phone: string;
107
- } & {
108
- password: string;
109
- } & {
110
- emailCode: string;
111
- phoneCode: string;
112
- }) | ({
113
- birthdate: Date;
114
- identificationNumber: string;
115
- } & {
116
- email?: undefined;
117
- phone: string;
118
- } & {
119
- password: string;
120
- } & {
121
- phoneCode?: undefined;
122
- emailCode: string;
123
- }) | ({
124
- birthdate: Date;
125
- identificationNumber: string;
126
- } & {
127
- email?: undefined;
128
- phone: string;
129
- } & {
130
- password: string;
131
- } & {
132
- emailCode?: undefined;
133
- phoneCode: string;
134
- })) => Promise<{
135
- gender?: "m" | "f" | "o" | undefined;
136
- firstName: string;
137
- lastName: string;
138
- countryId: string;
139
- phone: string;
140
- email: string;
141
- birthday: Date;
142
- identificationNumber: string;
143
- }>;
144
- sendExternalVerificationCode: (params: {
145
- birthdate: Date;
146
- channel: "1" | "2";
147
- identificationNumber: string;
148
- }) => Promise<void>;
149
- verifyExternalVerificationCode: (params: {
150
- code: string;
151
- birthdate: Date;
152
- channel: "1" | "2";
153
- identificationNumber: string;
154
- }) => Promise<any>;
155
- externalResetPassword: (params: ({
156
- birthdate: Date;
157
- password: string;
158
- identificationNumber: string;
159
- } & {
160
- emailCode: string;
161
- phoneCode: string;
162
- }) | ({
163
- birthdate: Date;
164
- password: string;
165
- identificationNumber: string;
166
- } & {
167
- phoneCode?: undefined;
168
- emailCode: string;
169
- }) | ({
170
- birthdate: Date;
171
- password: string;
172
- identificationNumber: string;
173
- } & {
174
- emailCode?: undefined;
175
- phoneCode: string;
176
- })) => Promise<any>;
177
- };
@@ -1,96 +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 getExternalMethods = (makeRequest) => {
9
- const externalLogin = async ({ user, password, }) => {
10
- const path = '/external-login';
11
- const response = await makeRequest('POST', path, { user, password });
12
- const info = response.data.login_info;
13
- return {
14
- firstName: info.firstname,
15
- lastName: info.lastname,
16
- countryId: info.country_id,
17
- birthday: new Date(Date.parse(info.birthdate)),
18
- identificationNumber: info.identification_number,
19
- gender: info.gender.toLowerCase(),
20
- email: info.email,
21
- phone: info.telephone,
22
- };
23
- };
24
- const preExternalEnrollment = async (params) => {
25
- const path = '/pre-external-enrollment';
26
- await makeRequest('POST', path, {
27
- identification_number: params.identificationNumber,
28
- birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
29
- email: params.email,
30
- telephone: params.phone,
31
- });
32
- return;
33
- };
34
- const externalEnrollment = async (params) => {
35
- const path = '/external-enrollment';
36
- const response = await makeRequest('POST', path, {
37
- identification_number: params.identificationNumber,
38
- birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
39
- email: params.email,
40
- telephone: params.phone,
41
- password: params.password,
42
- email_code: params.emailCode,
43
- telephone_code: params.phoneCode,
44
- });
45
- const info = response.data.info;
46
- return {
47
- firstName: info.firstname,
48
- lastName: info.lastname,
49
- countryId: info.country_id,
50
- birthday: new Date(Date.parse(info.birthdate)),
51
- identificationNumber: info.identification_number,
52
- gender: info.gender.toLowerCase(),
53
- email: info.email,
54
- phone: info.telephone,
55
- };
56
- };
57
- const sendExternalVerificationCode = async (params) => {
58
- const path = '/send-external-verification-code';
59
- await makeRequest('POST', path, {
60
- identification_number: params.identificationNumber,
61
- birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
62
- channel: params.channel,
63
- });
64
- return;
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
- };
76
- const externalResetPassword = async (params) => {
77
- const path = '/external-reset';
78
- const response = await makeRequest('POST', path, {
79
- identification_number: params.identificationNumber,
80
- birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
81
- password: params.password,
82
- email_code: params.emailCode,
83
- telephone_code: params.phoneCode,
84
- });
85
- return response.data;
86
- };
87
- return {
88
- externalLogin: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalLoginParams]), schemas_1.doc24Schemas.externalLoginResponse, externalLogin),
89
- preExternalEnrollment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.preExternalEnrollmentParams]), zod_1.void(), preExternalEnrollment),
90
- externalEnrollment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalEnrollmentParams]), schemas_1.doc24Schemas.externalLoginResponse, externalEnrollment),
91
- sendExternalVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.sendExternalVerificationCodeParams]), zod_1.void(), sendExternalVerificationCode),
92
- verifyExternalVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.verifyExternalVerificationCodeParams]), zod_1.any(), verifyExternalVerificationCode),
93
- externalResetPassword: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalResetPasswordParams]), zod_1.any(), externalResetPassword),
94
- };
95
- };
96
- exports.getExternalMethods = getExternalMethods;
@@ -1,21 +0,0 @@
1
- import { RequestMaker } from '../request';
2
- export declare const getBinahWellnessMethods: (makeRequest: RequestMaker) => {
3
- getBinahWellnessLink: (body: {
4
- patientId: number;
5
- socket: {
6
- device: string;
7
- provider: string;
8
- socketUrl: string;
9
- callbackUrl: string;
10
- socketAuthToken: string;
11
- };
12
- }) => Promise<{
13
- data: {
14
- info: {
15
- link: string;
16
- };
17
- timestamp: string;
18
- };
19
- signature: string;
20
- }>;
21
- };
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getBinahWellnessMethods = void 0;
4
- const zod_1 = require("zod");
5
- const schemas_1 = require("../schemas");
6
- const validation_1 = require("../request/validation");
7
- const getBinahWellnessMethods = (makeRequest) => {
8
- const getBinahWellnessLink = async (body) => {
9
- const path = `/wellness-test`;
10
- const response = await makeRequest('POST', path, {
11
- patient_id: body.patientId,
12
- socket: body.socket,
13
- });
14
- return response;
15
- };
16
- return {
17
- getBinahWellnessLink: validation_1.validateFunction(zod_1.tuple([zod_1.any()]), schemas_1.doc24Schemas.binahWellnessResponse, getBinahWellnessLink),
18
- };
19
- };
20
- exports.getBinahWellnessMethods = getBinahWellnessMethods;
@@ -1,34 +0,0 @@
1
- import { RequestMaker } from '../request';
2
- export declare const getExternalMethods: (makeRequest: RequestMaker) => {
3
- getExternalStudiesHistoryLink: (patient: {
4
- gender?: "m" | "f" | "o" | undefined;
5
- identificationType: "DNI";
6
- identificationValue: string;
7
- birthdate: Date;
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
- };
@@ -1,72 +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
- var _a;
66
- return {
67
- birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
68
- id_type: 'dni',
69
- id_value: patient.identificationValue,
70
- gender: (_a = patient.gender) === null || _a === void 0 ? void 0 : _a.toLocaleUpperCase(),
71
- };
72
- };