@integraciones_doc24/sdk 1.2.0 → 1.3.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.
Files changed (94) hide show
  1. package/lib/baseSdk/diagnostica.d.ts +6 -6
  2. package/lib/baseSdk/index.js +5 -1
  3. package/lib/baseSdk/user.d.ts +4 -52
  4. package/lib/baseSdk/user.js +25 -67
  5. package/lib/index.d.ts +16 -45
  6. package/lib/lib/lib/lib/baseSdk/diagnostica.d.ts +6 -0
  7. package/lib/lib/lib/lib/baseSdk/diagnostica.js +79 -0
  8. package/lib/lib/lib/lib/baseSdk/index.d.ts +14 -0
  9. package/lib/lib/lib/lib/baseSdk/index.js +66 -0
  10. package/lib/lib/lib/lib/baseSdk/user.d.ts +9 -0
  11. package/lib/lib/lib/lib/baseSdk/user.js +130 -0
  12. package/lib/lib/lib/lib/index.d.ts +58 -0
  13. package/lib/lib/lib/lib/index.js +22 -0
  14. package/lib/lib/lib/lib/request/index.d.ts +2 -0
  15. package/lib/lib/lib/lib/request/index.js +26 -0
  16. package/lib/lib/lib/lib/request/token.d.ts +2 -0
  17. package/lib/lib/lib/lib/request/token.js +34 -0
  18. package/lib/lib/lib/lib/request/validation.d.ts +10 -0
  19. package/lib/lib/lib/lib/request/validation.js +28 -0
  20. package/lib/lib/lib/lib/schemas.d.ts +1334 -0
  21. package/lib/lib/lib/lib/schemas.js +325 -0
  22. package/lib/lib/lib/lib/test.d.ts +1 -0
  23. package/lib/lib/lib/lib/test.js +55 -0
  24. package/lib/lib/lib/lib/types.d.ts +1 -0
  25. package/lib/lib/lib/lib/types.js +2 -0
  26. package/lib/lib/lib/lib/userSdk/chat.d.ts +9 -0
  27. package/lib/lib/lib/lib/userSdk/chat.js +98 -0
  28. package/lib/lib/lib/lib/userSdk/index.d.ts +24 -0
  29. package/lib/lib/lib/lib/userSdk/index.js +27 -0
  30. package/lib/lib/lib/lib/userSdk/patients.d.ts +5 -0
  31. package/lib/lib/lib/lib/userSdk/patients.js +55 -0
  32. package/lib/lib/lib/lib/userSdk/schedule.d.ts +7 -0
  33. package/lib/lib/lib/lib/userSdk/schedule.js +76 -0
  34. package/lib/lib/lib/lib/userSdk/specialties.d.ts +4 -0
  35. package/lib/lib/lib/lib/userSdk/specialties.js +19 -0
  36. package/lib/lib/lib/lib/userSdk/videoVisit.d.ts +10 -0
  37. package/lib/lib/lib/lib/userSdk/videoVisit.js +147 -0
  38. package/lib/lib/lib/lib/utils.d.ts +4 -0
  39. package/lib/lib/lib/lib/utils.js +19 -0
  40. package/lib/lib/lib/lib/webhook/index.d.ts +8 -0
  41. package/lib/lib/lib/lib/webhook/index.js +55 -0
  42. package/lib/lib/lib/lib/webhook/responses.d.ts +36 -0
  43. package/lib/lib/lib/lib/webhook/responses.js +42 -0
  44. package/lib/lib/lib/lib/webhook/token.d.ts +2 -0
  45. package/lib/lib/lib/lib/webhook/token.js +23 -0
  46. package/lib/lib/lib/src/baseSdk/diagnostica.d.ts +6 -0
  47. package/lib/lib/lib/src/baseSdk/diagnostica.js +79 -0
  48. package/lib/lib/lib/src/baseSdk/index.d.ts +51 -0
  49. package/lib/lib/lib/src/baseSdk/index.js +66 -0
  50. package/lib/lib/lib/src/baseSdk/user.d.ts +9 -0
  51. package/lib/lib/lib/src/baseSdk/user.js +130 -0
  52. package/lib/lib/lib/src/index.d.ts +169 -0
  53. package/lib/lib/lib/src/index.js +22 -0
  54. package/lib/lib/lib/src/request/index.d.ts +2 -0
  55. package/lib/lib/lib/src/request/index.js +26 -0
  56. package/lib/lib/lib/src/request/token.d.ts +2 -0
  57. package/lib/lib/lib/src/request/token.js +34 -0
  58. package/lib/lib/lib/src/request/validation.d.ts +10 -0
  59. package/lib/lib/lib/src/request/validation.js +28 -0
  60. package/lib/lib/lib/src/schemas.d.ts +1340 -0
  61. package/lib/lib/lib/src/schemas.js +325 -0
  62. package/lib/lib/lib/src/types.d.ts +1 -0
  63. package/lib/lib/lib/src/types.js +2 -0
  64. package/lib/lib/lib/src/userSdk/chat.d.ts +9 -0
  65. package/lib/lib/lib/src/userSdk/chat.js +98 -0
  66. package/lib/lib/lib/src/userSdk/index.d.ts +102 -0
  67. package/lib/lib/lib/src/userSdk/index.js +27 -0
  68. package/lib/lib/lib/src/userSdk/patients.d.ts +5 -0
  69. package/lib/lib/lib/src/userSdk/patients.js +55 -0
  70. package/lib/lib/lib/src/userSdk/schedule.d.ts +7 -0
  71. package/lib/lib/lib/src/userSdk/schedule.js +76 -0
  72. package/lib/lib/lib/src/userSdk/specialties.d.ts +4 -0
  73. package/lib/lib/lib/src/userSdk/specialties.js +19 -0
  74. package/lib/lib/lib/src/userSdk/videoVisit.d.ts +10 -0
  75. package/lib/lib/lib/src/userSdk/videoVisit.js +147 -0
  76. package/lib/lib/lib/src/utils.d.ts +4 -0
  77. package/lib/lib/lib/src/utils.js +19 -0
  78. package/lib/lib/lib/src/webhook/index.d.ts +8 -0
  79. package/lib/lib/lib/src/webhook/index.js +55 -0
  80. package/lib/lib/lib/src/webhook/responses.d.ts +36 -0
  81. package/lib/lib/lib/src/webhook/responses.js +42 -0
  82. package/lib/lib/lib/src/webhook/token.d.ts +2 -0
  83. package/lib/lib/lib/src/webhook/token.js +23 -0
  84. package/lib/schemas.d.ts +30 -236
  85. package/lib/schemas.js +2 -34
  86. package/lib/test.js +1 -36
  87. package/lib/types.d.ts +2 -11
  88. package/lib/userSdk/chat.d.ts +1 -1
  89. package/lib/userSdk/patients.d.ts +2 -23
  90. package/lib/userSdk/patients.js +6 -34
  91. package/lib/userSdk/videoVisit.d.ts +2 -2
  92. package/lib/utils.d.ts +1 -1
  93. package/lib/utils.js +3 -3
  94. package/package.json +1 -1
@@ -7,49 +7,21 @@ 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 = async ({ patient, channel, code, }) => {
11
- const path = '/patient';
10
+ const declarePatient = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.patient]), zod_1.number(), async (patient) => {
12
11
  const mappedPatient = {
13
12
  lastname: patient.lastName,
14
13
  firstname: patient.firstName,
15
- identification_type: utils_1.getIdetificationTypeId(patient.identificationType),
14
+ identification_type: utils_1.getIndetificationTypeId(patient.identificationType),
16
15
  identification_value: patient.identificationValue,
17
16
  birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
18
17
  gender: patient.gender.toUpperCase(),
19
18
  country_id: patient.countryId,
20
19
  };
21
- const parsedChannel = channel ? parseInt(channel) : channel;
22
- const response = await makeRequest('POST', path, {
20
+ const response = await makeRequest('POST', '/patient', {
23
21
  user_data: mappedPatient,
24
- channel: parsedChannel,
25
- code,
26
22
  });
27
- const mappedResponse = {
28
- patientId: response.data.patient_id,
29
- userInfo: response.data.user_info,
30
- askCode: response.data.ask_code,
31
- };
32
- return mappedResponse;
33
- };
34
- const getPatientId = async (patient) => {
35
- const path = '/patient';
36
- const mappedPatient = {
37
- lastname: patient.lastName,
38
- firstname: patient.firstName,
39
- identification_type: utils_1.getIdetificationTypeId(patient.identificationType),
40
- identification_value: patient.identificationValue,
41
- birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
42
- gender: patient.gender.toUpperCase(),
43
- country_id: patient.countryId,
44
- };
45
- const response = await makeRequest('POST', path, {
46
- user_data: mappedPatient,
47
- });
48
- return response.data.user_id;
49
- };
50
- return {
51
- declarePatient: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.declarePatientParams]), schemas_1.doc24Schemas.declarePatientResponse, declarePatient),
52
- getPatientId: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.patient]), zod_1.number(), getPatientId),
53
- };
23
+ return response.data.patient_id;
24
+ });
25
+ return { declarePatient };
54
26
  };
55
27
  exports.getPatientMethods = getPatientMethods;
@@ -32,9 +32,9 @@ export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
32
32
  patientId: number;
33
33
  creationDate: Date;
34
34
  user: {
35
+ id: number;
35
36
  phone: string | null;
36
37
  email: string | null;
37
- id: number;
38
38
  };
39
39
  vcToken: string;
40
40
  }>;
@@ -53,9 +53,9 @@ export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
53
53
  patientId: number;
54
54
  creationDate: Date;
55
55
  user: {
56
+ id: number;
56
57
  phone: string | null;
57
58
  email: string | null;
58
- id: number;
59
59
  };
60
60
  vcToken: string;
61
61
  }[]>;
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 getIdetificationTypeId: (type: Doc24.IdentificationType) => 6 | 5 | 999;
4
+ export declare const getIndetificationTypeId: (type: Doc24.IdentificationType) => 6 | 5 | 999;
package/lib/utils.js CHANGED
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getIdetificationTypeId = exports.parseDateTime = exports.parseDate = void 0;
3
+ exports.getIndetificationTypeId = exports.parseDateTime = exports.parseDate = void 0;
4
4
  const date_fns_1 = require("date-fns");
5
5
  const timeZone = '-03';
6
6
  const parseDate = (str) => exports.parseDateTime(`${str} 00:00:00`);
7
7
  exports.parseDate = parseDate;
8
8
  const parseDateTime = (str) => date_fns_1.parse(`${str} ${timeZone}`, 'yyyy-MM-dd HH:mm:ss X', new Date());
9
9
  exports.parseDateTime = parseDateTime;
10
- const getIdetificationTypeId = (type) => {
10
+ const getIndetificationTypeId = (type) => {
11
11
  if (type === 'ndi')
12
12
  return 6;
13
13
  if (type === 'passport')
@@ -16,4 +16,4 @@ const getIdetificationTypeId = (type) => {
16
16
  return 999;
17
17
  throw new Error('Invalid identificationType');
18
18
  };
19
- exports.getIdetificationTypeId = getIdetificationTypeId;
19
+ exports.getIndetificationTypeId = getIndetificationTypeId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integraciones_doc24/sdk",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "publishConfig": {
5
5
  "tag": "1.x"
6
6
  },