@integraciones_doc24/sdk 0.37.3 → 0.38.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.
@@ -1,7 +1,7 @@
1
1
  import { RequestMaker } from '../request';
2
2
  export declare const getDiagnosticaMethods: (makeRequest: RequestMaker) => {
3
3
  getDiagnosticaHistory: (patient: {
4
- identificationType: "dni" | "ndi" | "passport" | "credential";
4
+ identificationType: "dni" | "ndi" | "passport" | "credential" | "NN";
5
5
  identificationValue: string;
6
6
  gender: "m" | "f";
7
7
  }, from: Date, to: Date) => Promise<{
@@ -4,7 +4,7 @@ export declare const getUserMethods: (makeRequest: RequestMaker, url: string, cr
4
4
  declareUser: (user: {
5
5
  firstName: string;
6
6
  lastName: string;
7
- identificationType: "dni" | "ndi" | "passport" | "credential";
7
+ identificationType: "dni" | "ndi" | "passport" | "credential" | "NN";
8
8
  identificationValue: string;
9
9
  gender: "m" | "f";
10
10
  phone: string;
package/lib/index.d.ts CHANGED
@@ -8,7 +8,7 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
8
8
  declareUser: (user: {
9
9
  firstName: string;
10
10
  lastName: string;
11
- identificationType: "dni" | "ndi" | "passport" | "credential";
11
+ identificationType: "dni" | "ndi" | "passport" | "credential" | "NN";
12
12
  identificationValue: string;
13
13
  gender: "m" | "f";
14
14
  phone: string;
@@ -19,7 +19,7 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
19
19
  getUserInstance: (user: number | {
20
20
  firstName: string;
21
21
  lastName: string;
22
- identificationType: "dni" | "ndi" | "passport" | "credential";
22
+ identificationType: "dni" | "ndi" | "passport" | "credential" | "NN";
23
23
  identificationValue: string;
24
24
  gender: "m" | "f";
25
25
  phone: string;
@@ -105,7 +105,7 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
105
105
  authorizationCodeExpiration: Date | null;
106
106
  } | null>;
107
107
  getDiagnosticaHistory: (patient: {
108
- identificationType: "dni" | "ndi" | "passport" | "credential";
108
+ identificationType: "dni" | "ndi" | "passport" | "credential" | "NN";
109
109
  identificationValue: string;
110
110
  gender: "m" | "f";
111
111
  }, from: Date, to: Date) => Promise<{
package/lib/schemas.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export declare const doc24Schemas: {
2
- identificationType: import("zod").ZodEnum<["dni", "ndi", "passport", "credential"]>;
2
+ identificationType: import("zod").ZodEnum<["dni", "ndi", "passport", "credential", "NN"]>;
3
3
  sdkCredentials: import("zod").ZodObject<{
4
4
  iss: import("zod").ZodString;
5
5
  key: import("zod").ZodString;
@@ -38,7 +38,7 @@ export declare const doc24Schemas: {
38
38
  user: import("zod").ZodObject<import("zod").extendShape<{
39
39
  firstName: import("zod").ZodString;
40
40
  lastName: import("zod").ZodString;
41
- identificationType: import("zod").ZodEnum<["dni", "ndi", "passport", "credential"]>;
41
+ identificationType: import("zod").ZodEnum<["dni", "ndi", "passport", "credential", "NN"]>;
42
42
  identificationValue: import("zod").ZodString;
43
43
  countryId: import("zod").ZodString;
44
44
  birthdate: import("zod").ZodDate;
@@ -49,7 +49,7 @@ export declare const doc24Schemas: {
49
49
  }>, "strip", import("zod").ZodTypeAny, {
50
50
  firstName: string;
51
51
  lastName: string;
52
- identificationType: "dni" | "ndi" | "passport" | "credential";
52
+ identificationType: "dni" | "ndi" | "passport" | "credential" | "NN";
53
53
  identificationValue: string;
54
54
  gender: "m" | "f";
55
55
  phone: string;
@@ -59,7 +59,7 @@ export declare const doc24Schemas: {
59
59
  }, {
60
60
  firstName: string;
61
61
  lastName: string;
62
- identificationType: "dni" | "ndi" | "passport" | "credential";
62
+ identificationType: "dni" | "ndi" | "passport" | "credential" | "NN";
63
63
  identificationValue: string;
64
64
  gender: "m" | "f";
65
65
  phone: string;
@@ -70,7 +70,7 @@ export declare const doc24Schemas: {
70
70
  patient: import("zod").ZodObject<{
71
71
  firstName: import("zod").ZodString;
72
72
  lastName: import("zod").ZodString;
73
- identificationType: import("zod").ZodEnum<["dni", "ndi", "passport", "credential"]>;
73
+ identificationType: import("zod").ZodEnum<["dni", "ndi", "passport", "credential", "NN"]>;
74
74
  identificationValue: import("zod").ZodString;
75
75
  countryId: import("zod").ZodString;
76
76
  birthdate: import("zod").ZodDate;
@@ -78,7 +78,7 @@ export declare const doc24Schemas: {
78
78
  }, "strip", import("zod").ZodTypeAny, {
79
79
  firstName: string;
80
80
  lastName: string;
81
- identificationType: "dni" | "ndi" | "passport" | "credential";
81
+ identificationType: "dni" | "ndi" | "passport" | "credential" | "NN";
82
82
  identificationValue: string;
83
83
  gender: "m" | "f";
84
84
  countryId: string;
@@ -86,7 +86,7 @@ export declare const doc24Schemas: {
86
86
  }, {
87
87
  firstName: string;
88
88
  lastName: string;
89
- identificationType: "dni" | "ndi" | "passport" | "credential";
89
+ identificationType: "dni" | "ndi" | "passport" | "credential" | "NN";
90
90
  identificationValue: string;
91
91
  gender: "m" | "f";
92
92
  countryId: string;
@@ -302,15 +302,11 @@ export declare const doc24Schemas: {
302
302
  language: import("zod").ZodString;
303
303
  details: import("zod").ZodString;
304
304
  extraInfo: import("zod").ZodAny;
305
- kioskId: import("zod").ZodOptional<import("zod").ZodString>;
306
- kioskName: import("zod").ZodOptional<import("zod").ZodString>;
307
305
  }, {
308
306
  type: import("zod").ZodLiteral<"appointment">;
309
307
  appointmentId: import("zod").ZodUnion<[import("zod").ZodNumber, import("zod").ZodString]>;
310
308
  }>, "strip", import("zod").ZodTypeAny, {
311
309
  extraInfo?: any;
312
- kioskId?: string | undefined;
313
- kioskName?: string | undefined;
314
310
  type: "appointment";
315
311
  patientId: number;
316
312
  specialtyId: number;
@@ -319,8 +315,6 @@ export declare const doc24Schemas: {
319
315
  appointmentId: string | number;
320
316
  }, {
321
317
  extraInfo?: any;
322
- kioskId?: string | undefined;
323
- kioskName?: string | undefined;
324
318
  type: "appointment";
325
319
  patientId: number;
326
320
  specialtyId: number;
@@ -333,14 +327,10 @@ export declare const doc24Schemas: {
333
327
  language: import("zod").ZodString;
334
328
  details: import("zod").ZodString;
335
329
  extraInfo: import("zod").ZodAny;
336
- kioskId: import("zod").ZodOptional<import("zod").ZodString>;
337
- kioskName: import("zod").ZodOptional<import("zod").ZodString>;
338
330
  }, {
339
331
  type: import("zod").ZodLiteral<"instant">;
340
332
  }>, "strip", import("zod").ZodTypeAny, {
341
333
  extraInfo?: any;
342
- kioskId?: string | undefined;
343
- kioskName?: string | undefined;
344
334
  type: "instant";
345
335
  patientId: number;
346
336
  specialtyId: number;
@@ -348,8 +338,6 @@ export declare const doc24Schemas: {
348
338
  details: string;
349
339
  }, {
350
340
  extraInfo?: any;
351
- kioskId?: string | undefined;
352
- kioskName?: string | undefined;
353
341
  type: "instant";
354
342
  patientId: number;
355
343
  specialtyId: number;
@@ -957,14 +945,14 @@ export declare const doc24Schemas: {
957
945
  }>;
958
946
  diagnosticaPatientFilter: import("zod").ZodObject<{
959
947
  gender: import("zod").ZodEnum<["m", "f"]>;
960
- identificationType: import("zod").ZodEnum<["dni", "ndi", "passport", "credential"]>;
948
+ identificationType: import("zod").ZodEnum<["dni", "ndi", "passport", "credential", "NN"]>;
961
949
  identificationValue: import("zod").ZodString;
962
950
  }, "strip", import("zod").ZodTypeAny, {
963
- identificationType: "dni" | "ndi" | "passport" | "credential";
951
+ identificationType: "dni" | "ndi" | "passport" | "credential" | "NN";
964
952
  identificationValue: string;
965
953
  gender: "m" | "f";
966
954
  }, {
967
- identificationType: "dni" | "ndi" | "passport" | "credential";
955
+ identificationType: "dni" | "ndi" | "passport" | "credential" | "NN";
968
956
  identificationValue: string;
969
957
  gender: "m" | "f";
970
958
  }>;
@@ -1124,4 +1112,14 @@ export declare const doc24Schemas: {
1124
1112
  authorizationCode: string | null;
1125
1113
  authorizationCodeExpiration: Date | null;
1126
1114
  }>>;
1115
+ emergencyIdentificaiton: import("zod").ZodObject<{
1116
+ identificationType: import("zod").ZodLiteral<"NN">;
1117
+ identificationValue: import("zod").ZodString;
1118
+ }, "strip", import("zod").ZodTypeAny, {
1119
+ identificationType: "NN";
1120
+ identificationValue: string;
1121
+ }, {
1122
+ identificationType: "NN";
1123
+ identificationValue: string;
1124
+ }>;
1127
1125
  };
package/lib/schemas.js CHANGED
@@ -3,7 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.doc24Schemas = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const gender = zod_1.enum(['m', 'f']);
6
- const identificationType = zod_1.enum(['dni', 'ndi', 'passport', 'credential']);
6
+ const identificationType = zod_1.enum([
7
+ 'dni',
8
+ 'ndi',
9
+ 'passport',
10
+ 'credential',
11
+ 'NN',
12
+ ]);
7
13
  const sdkCredentials = zod_1.object({ iss: zod_1.string(), key: zod_1.string() });
8
14
  const basePersonData = zod_1.object({
9
15
  firstName: zod_1.string(),
@@ -60,8 +66,6 @@ const baseScheduleParameters = zod_1.object({
60
66
  language: zod_1.string(),
61
67
  details: zod_1.string(),
62
68
  extraInfo: zod_1.any(),
63
- kioskId: zod_1.string().optional(),
64
- kioskName: zod_1.string().optional(),
65
69
  });
66
70
  const appointmentScheduleParameters = baseScheduleParameters.extend({
67
71
  type: zod_1.literal('appointment'),
@@ -174,6 +178,10 @@ const coverageInfo = zod_1.object({
174
178
  authorizationCode: zod_1.string().nullable(),
175
179
  authorizationCodeExpiration: zod_1.date().nullable(),
176
180
  }).nullable();
181
+ const emergencyIdentificaiton = zod_1.object({
182
+ identificationType: zod_1.literal('NN'),
183
+ identificationValue: zod_1.string().uuid(),
184
+ });
177
185
  exports.doc24Schemas = {
178
186
  identificationType,
179
187
  sdkCredentials,
@@ -293,4 +301,5 @@ exports.doc24Schemas = {
293
301
  diagnosticaPatient,
294
302
  diagnosticaDeepLinkResponse,
295
303
  coverageInfo,
304
+ emergencyIdentificaiton,
296
305
  };
package/lib/types.d.ts CHANGED
@@ -30,6 +30,7 @@ export declare namespace Doc24 {
30
30
  type DiagnosticaPatient = TypeOf<typeof doc24Schemas.diagnosticaPatient>;
31
31
  type DiagnosticaHistoryAppointment = TypeOf<typeof doc24Schemas.diagnosticaHistoryAppointment>;
32
32
  type DiagnosticaDeepLinkResponse = TypeOf<typeof doc24Schemas.diagnosticaDeepLinkResponse>;
33
+ type EmergencyIdentificaiton = TypeOf<typeof doc24Schemas.emergencyIdentificaiton>;
33
34
  type BaseSdk = {
34
35
  declareUser: (user: User) => Promise<number>;
35
36
  getUserInstance: (user: User | number) => Promise<UserSdk>;
@@ -43,6 +44,7 @@ export declare namespace Doc24 {
43
44
  };
44
45
  type UserSdk = {
45
46
  declarePatient: (patient: Patient) => Promise<number>;
47
+ updateEmergencyPatient: (emergencyIdentification: EmergencyIdentificaiton, patient: Patient) => Promise<number>;
46
48
  getSpecialties: (mode: SpecialtyMode, language: string) => Promise<Specialty[]>;
47
49
  getScheduleDates: (patientId: number, filter?: ScheduleAvailabilityFilter) => Promise<Date[]>;
48
50
  getSchedule: (patientId: number, specialtyId: number, filter?: ScheduleFilter) => Promise<AvailableAppointment[]>;
@@ -3,10 +3,22 @@ export declare const getPatientMethods: (makeRequest: RequestMaker) => {
3
3
  declarePatient: (patient: {
4
4
  firstName: string;
5
5
  lastName: string;
6
- identificationType: "dni" | "ndi" | "passport" | "credential";
6
+ identificationType: "dni" | "ndi" | "passport" | "credential" | "NN";
7
7
  identificationValue: string;
8
8
  gender: "m" | "f";
9
9
  countryId: string;
10
10
  birthdate: Date;
11
11
  }) => Promise<number>;
12
+ updateEmergencyPatient: (emergencyIdentification: {
13
+ identificationType: "NN";
14
+ identificationValue: string;
15
+ }, patient: {
16
+ firstName: string;
17
+ lastName: string;
18
+ identificationType: "dni" | "ndi" | "passport" | "credential" | "NN";
19
+ identificationValue: string;
20
+ gender: "m" | "f";
21
+ countryId: string;
22
+ birthdate: Date;
23
+ }) => Promise<any>;
12
24
  };
@@ -7,7 +7,7 @@ const validation_1 = require("../request/validation");
7
7
  const schemas_1 = require("../schemas");
8
8
  const utils_1 = require("../utils");
9
9
  const getPatientMethods = (makeRequest) => {
10
- const declarePatient = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.patient]), zod_1.number(), async (patient) => {
10
+ const declarePatient = async (patient) => {
11
11
  const mappedPatient = {
12
12
  lastname: patient.lastName,
13
13
  firstname: patient.firstName,
@@ -21,7 +21,27 @@ const getPatientMethods = (makeRequest) => {
21
21
  user_data: mappedPatient,
22
22
  });
23
23
  return response.data.patient_id;
24
- });
25
- return { declarePatient };
24
+ };
25
+ const updateEmergencyPatient = async (emergencyIdentificaiton, patient) => {
26
+ const mappedPatient = {
27
+ lastname: patient.lastName,
28
+ firstname: patient.firstName,
29
+ identification_type: utils_1.getIndetificationTypeId(patient.identificationType),
30
+ identification_value: patient.identificationValue,
31
+ birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
32
+ gender: patient.gender.toUpperCase(),
33
+ country_id: patient.countryId,
34
+ };
35
+ const response = await makeRequest('POST', '/update-emergency-patient', {
36
+ nn_identification_type: emergencyIdentificaiton.identificationType,
37
+ nn_identification_value: emergencyIdentificaiton.identificationValue,
38
+ user_data: mappedPatient,
39
+ });
40
+ return response.data;
41
+ };
42
+ return {
43
+ declarePatient: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.patient]), zod_1.number(), declarePatient),
44
+ updateEmergencyPatient: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.emergencyIdentificaiton, schemas_1.doc24Schemas.patient]), zod_1.any(), updateEmergencyPatient),
45
+ };
26
46
  };
27
47
  exports.getPatientMethods = getPatientMethods;
@@ -2,8 +2,6 @@ import { RequestMaker } from '../request';
2
2
  export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
3
3
  scheduleVideoVisit: (params: {
4
4
  extraInfo?: any;
5
- kioskId?: string | undefined;
6
- kioskName?: string | undefined;
7
5
  type: "appointment";
8
6
  patientId: number;
9
7
  specialtyId: number;
@@ -12,8 +10,6 @@ export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
12
10
  appointmentId: string | number;
13
11
  } | {
14
12
  extraInfo?: any;
15
- kioskId?: string | undefined;
16
- kioskName?: string | undefined;
17
13
  type: "instant";
18
14
  patientId: number;
19
15
  specialtyId: number;
@@ -20,8 +20,6 @@ const getVideoVisitMethods = (makeRequest) => {
20
20
  language: params.language.toUpperCase(),
21
21
  details: params.details,
22
22
  extra_info: params.extraInfo,
23
- kiosk_id: params.kioskId,
24
- kiosk_name: params.kioskName,
25
23
  };
26
24
  const response = await makeRequest('POST', '/video-visit', mappedParams);
27
25
  return response.data.vc_token;
package/lib/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { Doc24 } from '.';
2
2
  export declare const parseDate: (str: string) => Date;
3
3
  export declare const parseDateTime: (str: string) => Date;
4
- export declare const getIndetificationTypeId: (type: Doc24.IdentificationType) => 1 | 6 | 5 | 999;
4
+ export declare const getIndetificationTypeId: (type: Doc24.IdentificationType) => 1 | 6 | 5 | 999 | 1000;
package/lib/utils.js CHANGED
@@ -16,6 +16,8 @@ const getIndetificationTypeId = (type) => {
16
16
  return 5;
17
17
  if (type === 'credential')
18
18
  return 999;
19
+ if (type === 'NN')
20
+ return 1000;
19
21
  throw new Error('Invalid identificationType');
20
22
  };
21
23
  exports.getIndetificationTypeId = getIndetificationTypeId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integraciones_doc24/sdk",
3
- "version": "0.37.3",
3
+ "version": "0.38.0",
4
4
  "publishConfig": {
5
5
  "tag": "0.x"
6
6
  },