@integraciones_doc24/sdk 0.38.0 → 0.38.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.
@@ -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" | "NN";
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" | "NN";
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" | "NN";
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" | "NN";
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" | "NN";
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", "NN"]>;
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", "NN"]>;
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" | "NN";
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" | "NN";
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", "NN"]>;
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" | "NN";
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" | "NN";
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", "NN"]>;
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" | "NN";
951
+ identificationType: "dni" | "ndi" | "passport" | "credential" | "nn";
952
952
  identificationValue: string;
953
953
  gender: "m" | "f";
954
954
  }, {
955
- identificationType: "dni" | "ndi" | "passport" | "credential" | "NN";
955
+ identificationType: "dni" | "ndi" | "passport" | "credential" | "nn";
956
956
  identificationValue: string;
957
957
  gender: "m" | "f";
958
958
  }>;
@@ -1113,13 +1113,13 @@ export declare const doc24Schemas: {
1113
1113
  authorizationCodeExpiration: Date | null;
1114
1114
  }>>;
1115
1115
  emergencyIdentificaiton: import("zod").ZodObject<{
1116
- identificationType: import("zod").ZodLiteral<"NN">;
1116
+ identificationType: import("zod").ZodLiteral<"nn">;
1117
1117
  identificationValue: import("zod").ZodString;
1118
1118
  }, "strip", import("zod").ZodTypeAny, {
1119
- identificationType: "NN";
1119
+ identificationType: "nn";
1120
1120
  identificationValue: string;
1121
1121
  }, {
1122
- identificationType: "NN";
1122
+ identificationType: "nn";
1123
1123
  identificationValue: string;
1124
1124
  }>;
1125
1125
  };
package/lib/schemas.js CHANGED
@@ -8,7 +8,7 @@ const identificationType = zod_1.enum([
8
8
  'ndi',
9
9
  'passport',
10
10
  'credential',
11
- 'NN',
11
+ 'nn',
12
12
  ]);
13
13
  const sdkCredentials = zod_1.object({ iss: zod_1.string(), key: zod_1.string() });
14
14
  const basePersonData = zod_1.object({
@@ -179,8 +179,8 @@ const coverageInfo = zod_1.object({
179
179
  authorizationCodeExpiration: zod_1.date().nullable(),
180
180
  }).nullable();
181
181
  const emergencyIdentificaiton = zod_1.object({
182
- identificationType: zod_1.literal('NN'),
183
- identificationValue: zod_1.string().uuid(),
182
+ identificationType: zod_1.literal('nn'),
183
+ identificationValue: zod_1.string(),
184
184
  });
185
185
  exports.doc24Schemas = {
186
186
  identificationType,
package/lib/test.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const test: () => Promise<void>;
package/lib/test.js ADDED
@@ -0,0 +1,40 @@
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
+ identificationType: 'nn',
17
+ identificationValue: 'jhYuPe9wu8WmSUroB4tLq8',
18
+ countryId: 'AR',
19
+ birthdate: new Date(),
20
+ gender: 'm',
21
+ phone: '',
22
+ email: 'nomail@diagnostica.com.ar',
23
+ });
24
+ console.log(userSdk.userId);
25
+ const res = await userSdk.updateEmergencyPatient({
26
+ identificationType: 'nn',
27
+ identificationValue: 'jhYuPe9wu8WmSUroB4tLq8',
28
+ }, {
29
+ firstName: 'Test',
30
+ lastName: 'Emergency',
31
+ identificationType: 'dni',
32
+ identificationValue: '37972512',
33
+ countryId: 'AR',
34
+ birthdate: new Date(),
35
+ gender: 'm',
36
+ });
37
+ console.log(res);
38
+ };
39
+ exports.test = test;
40
+ exports.test();
@@ -3,22 +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" | "NN";
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
12
  updateEmergencyPatient: (emergencyIdentification: {
13
- identificationType: "NN";
13
+ identificationType: "nn";
14
14
  identificationValue: string;
15
15
  }, patient: {
16
16
  firstName: string;
17
17
  lastName: string;
18
- identificationType: "dni" | "ndi" | "passport" | "credential" | "NN";
18
+ identificationType: "dni" | "ndi" | "passport" | "credential" | "nn";
19
19
  identificationValue: string;
20
20
  gender: "m" | "f";
21
21
  countryId: string;
22
22
  birthdate: Date;
23
- }) => Promise<any>;
23
+ }) => Promise<number>;
24
24
  };
@@ -30,18 +30,17 @@ const getPatientMethods = (makeRequest) => {
30
30
  identification_value: patient.identificationValue,
31
31
  birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
32
32
  gender: patient.gender.toUpperCase(),
33
- country_id: patient.countryId,
34
33
  };
35
34
  const response = await makeRequest('POST', '/update-emergency-patient', {
36
- nn_identification_type: emergencyIdentificaiton.identificationType,
35
+ nn_identification_type: utils_1.getIndetificationTypeId(emergencyIdentificaiton.identificationType),
37
36
  nn_identification_value: emergencyIdentificaiton.identificationValue,
38
37
  user_data: mappedPatient,
39
38
  });
40
- return response.data;
39
+ return response.data.patient_id;
41
40
  };
42
41
  return {
43
42
  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),
43
+ updateEmergencyPatient: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.emergencyIdentificaiton, schemas_1.doc24Schemas.patient]), zod_1.number(), updateEmergencyPatient),
45
44
  };
46
45
  };
47
46
  exports.getPatientMethods = getPatientMethods;
package/lib/utils.js CHANGED
@@ -16,7 +16,7 @@ const getIndetificationTypeId = (type) => {
16
16
  return 5;
17
17
  if (type === 'credential')
18
18
  return 999;
19
- if (type === 'NN')
19
+ if (type === 'nn')
20
20
  return 1000;
21
21
  throw new Error('Invalid identificationType');
22
22
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integraciones_doc24/sdk",
3
- "version": "0.38.0",
3
+ "version": "0.38.2",
4
4
  "publishConfig": {
5
5
  "tag": "0.x"
6
6
  },