@integraciones_doc24/sdk 0.37.4 → 0.38.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.
@@ -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;
@@ -945,14 +945,14 @@ export declare const doc24Schemas: {
945
945
  }>;
946
946
  diagnosticaPatientFilter: import("zod").ZodObject<{
947
947
  gender: import("zod").ZodEnum<["m", "f"]>;
948
- identificationType: import("zod").ZodEnum<["dni", "ndi", "passport", "credential"]>;
948
+ identificationType: import("zod").ZodEnum<["dni", "ndi", "passport", "credential", "nn"]>;
949
949
  identificationValue: import("zod").ZodString;
950
950
  }, "strip", import("zod").ZodTypeAny, {
951
- identificationType: "dni" | "ndi" | "passport" | "credential";
951
+ identificationType: "dni" | "ndi" | "passport" | "credential" | "nn";
952
952
  identificationValue: string;
953
953
  gender: "m" | "f";
954
954
  }, {
955
- identificationType: "dni" | "ndi" | "passport" | "credential";
955
+ identificationType: "dni" | "ndi" | "passport" | "credential" | "nn";
956
956
  identificationValue: string;
957
957
  gender: "m" | "f";
958
958
  }>;
@@ -1112,4 +1112,14 @@ export declare const doc24Schemas: {
1112
1112
  authorizationCode: string | null;
1113
1113
  authorizationCodeExpiration: Date | null;
1114
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
+ }>;
1115
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(),
@@ -172,6 +178,10 @@ const coverageInfo = zod_1.object({
172
178
  authorizationCode: zod_1.string().nullable(),
173
179
  authorizationCodeExpiration: zod_1.date().nullable(),
174
180
  }).nullable();
181
+ const emergencyIdentificaiton = zod_1.object({
182
+ identificationType: zod_1.literal('nn'),
183
+ identificationValue: zod_1.string().uuid(),
184
+ });
175
185
  exports.doc24Schemas = {
176
186
  identificationType,
177
187
  sdkCredentials,
@@ -291,4 +301,5 @@ exports.doc24Schemas = {
291
301
  diagnosticaPatient,
292
302
  diagnosticaDeepLinkResponse,
293
303
  coverageInfo,
304
+ emergencyIdentificaiton,
294
305
  };
package/lib/test.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const test: () => Promise<import("./types").Doc24.UserSdk>;
package/lib/test.js ADDED
@@ -0,0 +1,26 @@
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
+ },
12
+ });
13
+ const userSdk = await baseSdk.getUserInstance({
14
+ firstName: '-',
15
+ lastName: '-',
16
+ birthdate: new Date(),
17
+ email: 'nomail@diagnostica.com.ar',
18
+ phone: '',
19
+ gender: 'm',
20
+ identificationValue: '',
21
+ identificationType: 'nn',
22
+ countryId: 'AR',
23
+ });
24
+ return userSdk;
25
+ };
26
+ exports.test = test;
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;
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.4",
3
+ "version": "0.38.1",
4
4
  "publishConfig": {
5
5
  "tag": "0.x"
6
6
  },