@integraciones_doc24/sdk 0.35.1 → 0.36.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 (245) hide show
  1. package/lib/baseSdk/diagnostica.d.ts +1 -1
  2. package/lib/baseSdk/user.d.ts +1 -1
  3. package/lib/index.d.ts +3 -3
  4. package/lib/schemas.d.ts +10 -10
  5. package/lib/schemas.js +1 -1
  6. package/lib/userSdk/patients.d.ts +1 -1
  7. package/lib/utils.d.ts +1 -1
  8. package/lib/utils.js +2 -0
  9. package/package.json +1 -1
  10. package/lib/lib/baseSdk/diagnostica.d.ts +0 -11
  11. package/lib/lib/baseSdk/diagnostica.js +0 -79
  12. package/lib/lib/baseSdk/index.d.ts +0 -161
  13. package/lib/lib/baseSdk/index.js +0 -66
  14. package/lib/lib/baseSdk/user.d.ts +0 -41
  15. package/lib/lib/baseSdk/user.js +0 -130
  16. package/lib/lib/index.d.ts +0 -182
  17. package/lib/lib/index.js +0 -22
  18. package/lib/lib/lib/baseSdk/diagnostica.d.ts +0 -6
  19. package/lib/lib/lib/baseSdk/diagnostica.js +0 -79
  20. package/lib/lib/lib/baseSdk/index.d.ts +0 -51
  21. package/lib/lib/lib/baseSdk/index.js +0 -66
  22. package/lib/lib/lib/baseSdk/user.d.ts +0 -9
  23. package/lib/lib/lib/baseSdk/user.js +0 -130
  24. package/lib/lib/lib/index.d.ts +0 -168
  25. package/lib/lib/lib/index.js +0 -22
  26. package/lib/lib/lib/lib/baseSdk/diagnostica.d.ts +0 -6
  27. package/lib/lib/lib/lib/baseSdk/diagnostica.js +0 -79
  28. package/lib/lib/lib/lib/baseSdk/index.d.ts +0 -14
  29. package/lib/lib/lib/lib/baseSdk/index.js +0 -66
  30. package/lib/lib/lib/lib/baseSdk/user.d.ts +0 -9
  31. package/lib/lib/lib/lib/baseSdk/user.js +0 -130
  32. package/lib/lib/lib/lib/index.d.ts +0 -58
  33. package/lib/lib/lib/lib/index.js +0 -22
  34. package/lib/lib/lib/lib/request/index.d.ts +0 -2
  35. package/lib/lib/lib/lib/request/index.js +0 -26
  36. package/lib/lib/lib/lib/request/token.d.ts +0 -2
  37. package/lib/lib/lib/lib/request/token.js +0 -34
  38. package/lib/lib/lib/lib/request/validation.d.ts +0 -10
  39. package/lib/lib/lib/lib/request/validation.js +0 -28
  40. package/lib/lib/lib/lib/schemas.d.ts +0 -1334
  41. package/lib/lib/lib/lib/schemas.js +0 -325
  42. package/lib/lib/lib/lib/test.d.ts +0 -1
  43. package/lib/lib/lib/lib/test.js +0 -55
  44. package/lib/lib/lib/lib/types.d.ts +0 -1
  45. package/lib/lib/lib/lib/types.js +0 -2
  46. package/lib/lib/lib/lib/userSdk/chat.d.ts +0 -9
  47. package/lib/lib/lib/lib/userSdk/chat.js +0 -98
  48. package/lib/lib/lib/lib/userSdk/index.d.ts +0 -24
  49. package/lib/lib/lib/lib/userSdk/index.js +0 -27
  50. package/lib/lib/lib/lib/userSdk/patients.d.ts +0 -5
  51. package/lib/lib/lib/lib/userSdk/patients.js +0 -55
  52. package/lib/lib/lib/lib/userSdk/schedule.d.ts +0 -7
  53. package/lib/lib/lib/lib/userSdk/schedule.js +0 -76
  54. package/lib/lib/lib/lib/userSdk/specialties.d.ts +0 -4
  55. package/lib/lib/lib/lib/userSdk/specialties.js +0 -19
  56. package/lib/lib/lib/lib/userSdk/videoVisit.d.ts +0 -10
  57. package/lib/lib/lib/lib/userSdk/videoVisit.js +0 -147
  58. package/lib/lib/lib/lib/utils.d.ts +0 -4
  59. package/lib/lib/lib/lib/utils.js +0 -19
  60. package/lib/lib/lib/lib/webhook/index.d.ts +0 -8
  61. package/lib/lib/lib/lib/webhook/index.js +0 -55
  62. package/lib/lib/lib/lib/webhook/responses.d.ts +0 -36
  63. package/lib/lib/lib/lib/webhook/responses.js +0 -42
  64. package/lib/lib/lib/lib/webhook/token.d.ts +0 -2
  65. package/lib/lib/lib/lib/webhook/token.js +0 -23
  66. package/lib/lib/lib/request/index.d.ts +0 -2
  67. package/lib/lib/lib/request/index.js +0 -26
  68. package/lib/lib/lib/request/token.d.ts +0 -2
  69. package/lib/lib/lib/request/token.js +0 -34
  70. package/lib/lib/lib/request/validation.d.ts +0 -10
  71. package/lib/lib/lib/request/validation.js +0 -28
  72. package/lib/lib/lib/schemas.d.ts +0 -1334
  73. package/lib/lib/lib/schemas.js +0 -325
  74. package/lib/lib/lib/src/baseSdk/diagnostica.d.ts +0 -6
  75. package/lib/lib/lib/src/baseSdk/diagnostica.js +0 -79
  76. package/lib/lib/lib/src/baseSdk/index.d.ts +0 -51
  77. package/lib/lib/lib/src/baseSdk/index.js +0 -66
  78. package/lib/lib/lib/src/baseSdk/user.d.ts +0 -9
  79. package/lib/lib/lib/src/baseSdk/user.js +0 -130
  80. package/lib/lib/lib/src/index.d.ts +0 -169
  81. package/lib/lib/lib/src/index.js +0 -22
  82. package/lib/lib/lib/src/request/index.d.ts +0 -2
  83. package/lib/lib/lib/src/request/index.js +0 -26
  84. package/lib/lib/lib/src/request/token.d.ts +0 -2
  85. package/lib/lib/lib/src/request/token.js +0 -34
  86. package/lib/lib/lib/src/request/validation.d.ts +0 -10
  87. package/lib/lib/lib/src/request/validation.js +0 -28
  88. package/lib/lib/lib/src/schemas.d.ts +0 -1340
  89. package/lib/lib/lib/src/schemas.js +0 -325
  90. package/lib/lib/lib/src/types.d.ts +0 -1
  91. package/lib/lib/lib/src/types.js +0 -2
  92. package/lib/lib/lib/src/userSdk/chat.d.ts +0 -9
  93. package/lib/lib/lib/src/userSdk/chat.js +0 -98
  94. package/lib/lib/lib/src/userSdk/index.d.ts +0 -102
  95. package/lib/lib/lib/src/userSdk/index.js +0 -27
  96. package/lib/lib/lib/src/userSdk/patients.d.ts +0 -5
  97. package/lib/lib/lib/src/userSdk/patients.js +0 -55
  98. package/lib/lib/lib/src/userSdk/schedule.d.ts +0 -7
  99. package/lib/lib/lib/src/userSdk/schedule.js +0 -76
  100. package/lib/lib/lib/src/userSdk/specialties.d.ts +0 -4
  101. package/lib/lib/lib/src/userSdk/specialties.js +0 -19
  102. package/lib/lib/lib/src/userSdk/videoVisit.d.ts +0 -10
  103. package/lib/lib/lib/src/userSdk/videoVisit.js +0 -147
  104. package/lib/lib/lib/src/utils.d.ts +0 -4
  105. package/lib/lib/lib/src/utils.js +0 -19
  106. package/lib/lib/lib/src/webhook/index.d.ts +0 -8
  107. package/lib/lib/lib/src/webhook/index.js +0 -55
  108. package/lib/lib/lib/src/webhook/responses.d.ts +0 -36
  109. package/lib/lib/lib/src/webhook/responses.js +0 -42
  110. package/lib/lib/lib/src/webhook/token.d.ts +0 -2
  111. package/lib/lib/lib/src/webhook/token.js +0 -23
  112. package/lib/lib/lib/test.d.ts +0 -1
  113. package/lib/lib/lib/test.js +0 -55
  114. package/lib/lib/lib/types.d.ts +0 -1
  115. package/lib/lib/lib/types.js +0 -2
  116. package/lib/lib/lib/userSdk/chat.d.ts +0 -9
  117. package/lib/lib/lib/userSdk/chat.js +0 -98
  118. package/lib/lib/lib/userSdk/index.d.ts +0 -102
  119. package/lib/lib/lib/userSdk/index.js +0 -27
  120. package/lib/lib/lib/userSdk/patients.d.ts +0 -5
  121. package/lib/lib/lib/userSdk/patients.js +0 -55
  122. package/lib/lib/lib/userSdk/schedule.d.ts +0 -7
  123. package/lib/lib/lib/userSdk/schedule.js +0 -76
  124. package/lib/lib/lib/userSdk/specialties.d.ts +0 -4
  125. package/lib/lib/lib/userSdk/specialties.js +0 -19
  126. package/lib/lib/lib/userSdk/videoVisit.d.ts +0 -10
  127. package/lib/lib/lib/userSdk/videoVisit.js +0 -147
  128. package/lib/lib/lib/utils.d.ts +0 -4
  129. package/lib/lib/lib/utils.js +0 -19
  130. package/lib/lib/lib/webhook/index.d.ts +0 -8
  131. package/lib/lib/lib/webhook/index.js +0 -55
  132. package/lib/lib/lib/webhook/responses.d.ts +0 -36
  133. package/lib/lib/lib/webhook/responses.js +0 -42
  134. package/lib/lib/lib/webhook/token.d.ts +0 -2
  135. package/lib/lib/lib/webhook/token.js +0 -23
  136. package/lib/lib/request/index.d.ts +0 -2
  137. package/lib/lib/request/index.js +0 -26
  138. package/lib/lib/request/token.d.ts +0 -2
  139. package/lib/lib/request/token.js +0 -34
  140. package/lib/lib/request/validation.d.ts +0 -10
  141. package/lib/lib/request/validation.js +0 -28
  142. package/lib/lib/schemas.d.ts +0 -1334
  143. package/lib/lib/schemas.js +0 -325
  144. package/lib/lib/src/baseSdk/diagnostica.d.ts +0 -11
  145. package/lib/lib/src/baseSdk/diagnostica.js +0 -79
  146. package/lib/lib/src/baseSdk/index.d.ts +0 -162
  147. package/lib/lib/src/baseSdk/index.js +0 -66
  148. package/lib/lib/src/baseSdk/user.d.ts +0 -41
  149. package/lib/lib/src/baseSdk/user.js +0 -130
  150. package/lib/lib/src/index.d.ts +0 -183
  151. package/lib/lib/src/index.js +0 -22
  152. package/lib/lib/src/request/index.d.ts +0 -2
  153. package/lib/lib/src/request/index.js +0 -26
  154. package/lib/lib/src/request/token.d.ts +0 -2
  155. package/lib/lib/src/request/token.js +0 -34
  156. package/lib/lib/src/request/validation.d.ts +0 -10
  157. package/lib/lib/src/request/validation.js +0 -28
  158. package/lib/lib/src/schemas.d.ts +0 -1340
  159. package/lib/lib/src/schemas.js +0 -325
  160. package/lib/lib/src/types.d.ts +0 -1
  161. package/lib/lib/src/types.js +0 -2
  162. package/lib/lib/src/userSdk/chat.d.ts +0 -9
  163. package/lib/lib/src/userSdk/chat.js +0 -98
  164. package/lib/lib/src/userSdk/index.d.ts +0 -241
  165. package/lib/lib/src/userSdk/index.js +0 -27
  166. package/lib/lib/src/userSdk/patients.d.ts +0 -13
  167. package/lib/lib/src/userSdk/patients.js +0 -55
  168. package/lib/lib/src/userSdk/schedule.d.ts +0 -15
  169. package/lib/lib/src/userSdk/schedule.js +0 -76
  170. package/lib/lib/src/userSdk/specialties.d.ts +0 -4
  171. package/lib/lib/src/userSdk/specialties.js +0 -19
  172. package/lib/lib/src/userSdk/videoVisit.d.ts +0 -72
  173. package/lib/lib/src/userSdk/videoVisit.js +0 -147
  174. package/lib/lib/src/utils.d.ts +0 -4
  175. package/lib/lib/src/utils.js +0 -19
  176. package/lib/lib/src/webhook/index.d.ts +0 -8
  177. package/lib/lib/src/webhook/index.js +0 -55
  178. package/lib/lib/src/webhook/responses.d.ts +0 -36
  179. package/lib/lib/src/webhook/responses.js +0 -42
  180. package/lib/lib/src/webhook/token.d.ts +0 -2
  181. package/lib/lib/src/webhook/token.js +0 -23
  182. package/lib/lib/test.d.ts +0 -1
  183. package/lib/lib/test.js +0 -55
  184. package/lib/lib/types.d.ts +0 -1
  185. package/lib/lib/types.js +0 -2
  186. package/lib/lib/userSdk/chat.d.ts +0 -9
  187. package/lib/lib/userSdk/chat.js +0 -98
  188. package/lib/lib/userSdk/index.d.ts +0 -240
  189. package/lib/lib/userSdk/index.js +0 -27
  190. package/lib/lib/userSdk/patients.d.ts +0 -13
  191. package/lib/lib/userSdk/patients.js +0 -55
  192. package/lib/lib/userSdk/schedule.d.ts +0 -15
  193. package/lib/lib/userSdk/schedule.js +0 -76
  194. package/lib/lib/userSdk/specialties.d.ts +0 -4
  195. package/lib/lib/userSdk/specialties.js +0 -19
  196. package/lib/lib/userSdk/videoVisit.d.ts +0 -72
  197. package/lib/lib/userSdk/videoVisit.js +0 -147
  198. package/lib/lib/utils.d.ts +0 -4
  199. package/lib/lib/utils.js +0 -19
  200. package/lib/lib/webhook/index.d.ts +0 -8
  201. package/lib/lib/webhook/index.js +0 -55
  202. package/lib/lib/webhook/responses.d.ts +0 -36
  203. package/lib/lib/webhook/responses.js +0 -42
  204. package/lib/lib/webhook/token.d.ts +0 -2
  205. package/lib/lib/webhook/token.js +0 -23
  206. package/lib/src/baseSdk/diagnostica.d.ts +0 -54
  207. package/lib/src/baseSdk/diagnostica.js +0 -79
  208. package/lib/src/baseSdk/index.d.ts +0 -2
  209. package/lib/src/baseSdk/index.js +0 -66
  210. package/lib/src/baseSdk/user.d.ts +0 -89
  211. package/lib/src/baseSdk/user.js +0 -130
  212. package/lib/src/index.d.ts +0 -188
  213. package/lib/src/index.js +0 -22
  214. package/lib/src/request/index.d.ts +0 -3
  215. package/lib/src/request/index.js +0 -26
  216. package/lib/src/request/token.d.ts +0 -2
  217. package/lib/src/request/token.js +0 -34
  218. package/lib/src/request/validation.d.ts +0 -10
  219. package/lib/src/request/validation.js +0 -28
  220. package/lib/src/schemas.d.ts +0 -1311
  221. package/lib/src/schemas.js +0 -325
  222. package/lib/src/types.d.ts +0 -124
  223. package/lib/src/types.js +0 -2
  224. package/lib/src/userSdk/chat.d.ts +0 -57
  225. package/lib/src/userSdk/chat.js +0 -98
  226. package/lib/src/userSdk/index.d.ts +0 -2
  227. package/lib/src/userSdk/index.js +0 -27
  228. package/lib/src/userSdk/patients.d.ts +0 -33
  229. package/lib/src/userSdk/patients.js +0 -55
  230. package/lib/src/userSdk/schedule.d.ts +0 -44
  231. package/lib/src/userSdk/schedule.js +0 -76
  232. package/lib/src/userSdk/specialties.d.ts +0 -7
  233. package/lib/src/userSdk/specialties.js +0 -19
  234. package/lib/src/userSdk/videoVisit.d.ts +0 -111
  235. package/lib/src/userSdk/videoVisit.js +0 -147
  236. package/lib/src/utils.d.ts +0 -4
  237. package/lib/src/utils.js +0 -19
  238. package/lib/src/webhook/index.d.ts +0 -2
  239. package/lib/src/webhook/index.js +0 -55
  240. package/lib/src/webhook/responses.d.ts +0 -35
  241. package/lib/src/webhook/responses.js +0 -42
  242. package/lib/src/webhook/token.d.ts +0 -2
  243. package/lib/src/webhook/token.js +0 -23
  244. package/lib/test.d.ts +0 -1
  245. package/lib/test.js +0 -21
@@ -1,168 +0,0 @@
1
- export var __esModule: boolean;
2
- export function doc24Sdk(params: any): Promise<{
3
- getRequestHandler: (params: any) => Promise<(request: any) => Promise<{
4
- status: {
5
- code: number;
6
- message: string;
7
- };
8
- data: unknown;
9
- }>>;
10
- getProfessional: (...params: any) => Promise<{
11
- id: any;
12
- firstName: any;
13
- lastName: any;
14
- birthdate: Date;
15
- gender: any;
16
- email: any;
17
- phone: any;
18
- logoUrl: any;
19
- matriculation: any;
20
- specialties: any;
21
- degree: any;
22
- languages: any;
23
- resume: {
24
- link: any;
25
- brief: any;
26
- };
27
- }>;
28
- getAvailableScheduleClinics: () => Promise<{
29
- specialties: any;
30
- specialtiesER: any;
31
- professionals: any;
32
- }>;
33
- declareUser: (params: {
34
- code?: string | undefined;
35
- channel?: "1" | "2" | undefined;
36
- user: {
37
- firstName: string;
38
- lastName: string;
39
- identificationType: "ndi" | "passport" | "credential";
40
- identificationValue: string;
41
- countryId: string;
42
- birthdate: Date;
43
- gender: "m" | "f";
44
- phone: string;
45
- email: string;
46
- };
47
- }) => Promise<{
48
- patientId: number | null;
49
- userInfo: {
50
- phone: string;
51
- email: string;
52
- };
53
- askCode: boolean;
54
- userId: number;
55
- }>;
56
- getUserId: (user: {
57
- firstName: string;
58
- lastName: string;
59
- identificationType: "ndi" | "passport" | "credential";
60
- identificationValue: string;
61
- countryId: string;
62
- birthdate: Date;
63
- gender: "m" | "f";
64
- phone: string;
65
- email: string;
66
- }) => Promise<number>;
67
- sendVerificationCode: (params: {
68
- identificationType: "ndi" | "passport" | "credential";
69
- identificationValue: string;
70
- channel: "1" | "2";
71
- }) => Promise<any>;
72
- getUserInstance: (user: number | {
73
- firstName: string;
74
- lastName: string;
75
- identificationType: "ndi" | "passport" | "credential";
76
- identificationValue: string;
77
- countryId: string;
78
- birthdate: Date;
79
- gender: "m" | "f";
80
- phone: string;
81
- email: string;
82
- }) => Promise<any>;
83
- enroll: (params: {
84
- firstName: string;
85
- lastName: string;
86
- birthdate: Date;
87
- gender: "m" | "f";
88
- email: string;
89
- startDate: Date;
90
- identificationNumber: string;
91
- plan: string;
92
- }) => Promise<void>;
93
- getConverageInfo: (identificationValue: string) => Promise<{
94
- firstName: string | null;
95
- lastName: string | null;
96
- birthdate: Date;
97
- gender: "m" | "f";
98
- email: string | null;
99
- identificationNumber: string;
100
- plan: string | null;
101
- financerId: number | null;
102
- defaultAffiliationId: number | null;
103
- credentialNumber: string | null;
104
- financerPlanId: number | null;
105
- brand: number | null;
106
- holderIdentificationNumber: string | null;
107
- copaymentValue: number | null;
108
- mobilePhone: string | null;
109
- company: string | null;
110
- dischargeDate: Date | null;
111
- leavingDate: Date | null;
112
- identificacion_tributaria: string | null;
113
- deregistrationDate: Date | null;
114
- authorizationCode: string | null;
115
- authorizationCodeExpiration: Date | null;
116
- } | null>;
117
- getDiagnosticaHistory: (patient: {
118
- identificationType: "ndi" | "passport" | "credential";
119
- identificationValue: string;
120
- gender: "m" | "f";
121
- }, from: Date, to: Date) => Promise<{
122
- date: Date;
123
- location: string;
124
- exams: string[];
125
- deepLink: string;
126
- }[]>;
127
- getDiagnosticaDeepLink: (kiosk: string, user: {
128
- firstName: string;
129
- lastName: string;
130
- identificationType: "dni";
131
- identificationValue: string;
132
- gender: "m" | "f";
133
- phone: string;
134
- email: string;
135
- language: string;
136
- birthday: Date;
137
- }, patient: {
138
- firstName: string;
139
- lastName: string;
140
- identificationType: "dni";
141
- identificationValue: string;
142
- gender: "m" | "f";
143
- birthday: Date;
144
- }) => Promise<{
145
- forwardingRequired: true;
146
- deepLink: string;
147
- } | {
148
- forwardingRequired: false;
149
- }>;
150
- getDiagnosticaAccess: (kiosk: string, user: {
151
- firstName: string;
152
- lastName: string;
153
- identificationType: "dni";
154
- identificationValue: string;
155
- gender: "m" | "f";
156
- phone: string;
157
- email: string;
158
- language: string;
159
- birthday: Date;
160
- }, patient: {
161
- firstName: string;
162
- lastName: string;
163
- identificationType: "dni";
164
- identificationValue: string;
165
- gender: "m" | "f";
166
- birthday: Date;
167
- }) => Promise<void>;
168
- }>;
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.doc24Sdk = void 0;
4
- const webhook_1 = require("./webhook");
5
- const baseSdk_1 = require("./baseSdk");
6
- const request_1 = require("./request");
7
- const doc24Sdk = async (params) => {
8
- const baseSdk = await baseSdk_1.getBaseSdk(params.url, params.credentials);
9
- const makeRequest = await request_1.getRequestFactory(params.url, params.credentials);
10
- return {
11
- ...baseSdk,
12
- getRequestHandler: async (params) => {
13
- await makeRequest('PUT', '/webhook', {
14
- url: params.baseAddress,
15
- issuer: params.credentials.iss,
16
- secret: params.credentials.key,
17
- });
18
- return webhook_1.getRequestHandler(params.credentials, baseSdk, params.eventHandlers);
19
- },
20
- };
21
- };
22
- exports.doc24Sdk = doc24Sdk;
@@ -1,6 +0,0 @@
1
- export var __esModule: boolean;
2
- export function getDiagnosticaMethods(makeRequest: any): {
3
- getDiagnosticaHistory: (...params: any[]) => Promise<any>;
4
- getDiagnosticaDeepLink: (...params: any[]) => Promise<any>;
5
- getDiagnosticaAccess: (...params: any[]) => Promise<any>;
6
- };
@@ -1,79 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDiagnosticaMethods = 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 getDiagnosticaMethods = (makeRequest) => {
9
- const getDiagnosticaHistory = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.diagnosticaPatientFilter, zod_1.date(), zod_1.date()]), schemas_1.doc24Schemas.diagnosticaHistoryAppointment.array(), async (patient, from, to) => {
10
- const path = '/history-diagnostica';
11
- const response = await makeRequest('POST', path, {
12
- patient: {
13
- gender: patient.gender,
14
- id_type: patient.identificationType === 'ndi'
15
- ? 'DNI'
16
- : patient.identificationType,
17
- id_value: patient.identificationValue,
18
- },
19
- dateFrom: from.toISOString(),
20
- dateTo: to.toISOString(),
21
- });
22
- const list = response.data.info;
23
- return list.map((i) => ({
24
- date: new Date(Date.parse(i.date)),
25
- location: i.location,
26
- exams: i.exams,
27
- deepLink: i.deeplink,
28
- }));
29
- });
30
- const getDiagnosticaDeepLink = validation_1.validateFunction(zod_1.tuple([
31
- zod_1.string(),
32
- schemas_1.doc24Schemas.diagnosticaUser,
33
- schemas_1.doc24Schemas.diagnosticaPatient,
34
- ]), schemas_1.doc24Schemas.diagnosticaDeepLinkResponse, async (kiosk, user, patient) => {
35
- const path = '/deeplink-diagnostica';
36
- const response = await makeRequest('POST', path, {
37
- kiosk,
38
- user: mapUserData(user),
39
- patient: mapPatientData(patient),
40
- });
41
- const data = response.data.info.data;
42
- if (data.forwarding_required)
43
- return { forwardingRequired: true, deepLink: data.deeplink };
44
- return { forwardingRequired: false };
45
- });
46
- const getDiagnosticaAccess = validation_1.validateFunction(zod_1.tuple([
47
- zod_1.string(),
48
- schemas_1.doc24Schemas.diagnosticaUser,
49
- schemas_1.doc24Schemas.diagnosticaPatient,
50
- ]), zod_1.void(), async (kiosk, user, patient) => {
51
- const path = '/access-diagnostica';
52
- await makeRequest('POST', path, {
53
- kiosk,
54
- user: mapUserData(user),
55
- patient: mapPatientData(patient),
56
- });
57
- return;
58
- });
59
- return { getDiagnosticaHistory, getDiagnosticaDeepLink, getDiagnosticaAccess };
60
- };
61
- exports.getDiagnosticaMethods = getDiagnosticaMethods;
62
- const mapPatientData = (patient) => {
63
- return {
64
- name: patient.firstName,
65
- surname: patient.lastName,
66
- birthday: date_fns_1.format(patient.birthday, 'yyyy-MM-dd'),
67
- id_type: 'DNI',
68
- id_value: patient.identificationValue,
69
- gender: patient.gender.toLocaleUpperCase(),
70
- };
71
- };
72
- const mapUserData = (user) => {
73
- return {
74
- ...mapPatientData(user),
75
- phone: user.phone,
76
- email: user.email,
77
- language: user.language,
78
- };
79
- };
@@ -1,14 +0,0 @@
1
- export var __esModule: boolean;
2
- export function getBaseSdk(url: any, credentials: any): Promise<{
3
- getProfessional: (...params: any[]) => Promise<any>;
4
- getAvailableScheduleClinics: (...params: any[]) => Promise<any>;
5
- declareUser: (...params: any[]) => Promise<any>;
6
- getUserId: (...params: any[]) => Promise<any>;
7
- sendVerificationCode: (...params: any[]) => Promise<any>;
8
- getUserInstance: (...params: any[]) => Promise<any>;
9
- enroll: (...params: any[]) => Promise<any>;
10
- getConverageInfo: (...params: any[]) => Promise<any>;
11
- getDiagnosticaHistory: (...params: any[]) => Promise<any>;
12
- getDiagnosticaDeepLink: (...params: any[]) => Promise<any>;
13
- getDiagnosticaAccess: (...params: any[]) => Promise<any>;
14
- }>;
@@ -1,66 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getBaseSdk = void 0;
4
- const zod_1 = require("zod");
5
- const request_1 = require("../request");
6
- const validation_1 = require("../request/validation");
7
- const schemas_1 = require("../schemas");
8
- const utils_1 = require("../utils");
9
- const diagnostica_1 = require("./diagnostica");
10
- const user_1 = require("./user");
11
- const getBaseSdk = async (url, credentials) => {
12
- const makeRequest = await request_1.getRequestFactory(url, credentials);
13
- const diagnosticaMethods = diagnostica_1.getDiagnosticaMethods(makeRequest);
14
- const userMethods = user_1.getUserMethods(makeRequest, url, credentials);
15
- const baseSdk = {
16
- ...diagnosticaMethods,
17
- ...userMethods,
18
- getProfessional: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.professional, async (professionalId) => {
19
- const path = `/professional/${professionalId}`;
20
- const response = await makeRequest('GET', path);
21
- const raw = response.data;
22
- return {
23
- id: raw.professional_id,
24
- firstName: raw.name,
25
- lastName: raw.lastname,
26
- birthdate: utils_1.parseDate(raw.birthdate),
27
- gender: raw.gender.toLowerCase(),
28
- email: raw.email,
29
- phone: raw.phone,
30
- logoUrl: raw.image,
31
- matriculation: raw.matriculation,
32
- specialties: raw.specialties.map((s) => ({
33
- id: s.specialty_id,
34
- description: s.specialty,
35
- })),
36
- degree: raw.degree,
37
- languages: raw.languages.map((l) => l.languages),
38
- resume: {
39
- link: raw.resume_link,
40
- brief: raw.resume_brief,
41
- },
42
- };
43
- }),
44
- getAvailableScheduleClinics: validation_1.validateFunction(zod_1.tuple([]), schemas_1.doc24Schemas.availableScheduleClinics, async () => {
45
- const path = `/schedule/clinics`;
46
- const response = await makeRequest('GET', path);
47
- const mapSpeciality = (s) => ({
48
- id: s.id_especialidad,
49
- description: s.especialidad,
50
- });
51
- const mapped = {
52
- specialties: response.data.specialties.map(mapSpeciality),
53
- specialtiesER: response.data.specialties_er.map(mapSpeciality),
54
- professionals: response.data.professionals.map((p) => ({
55
- id: p.id_profesional,
56
- fullName: p.denominacion,
57
- clinicId: p.id_consultorio,
58
- specialties: p.especialidades.map(mapSpeciality),
59
- })),
60
- };
61
- return mapped;
62
- }),
63
- };
64
- return baseSdk;
65
- };
66
- exports.getBaseSdk = getBaseSdk;
@@ -1,9 +0,0 @@
1
- export var __esModule: boolean;
2
- export function getUserMethods(makeRequest: any, url: any, credentials: any): {
3
- declareUser: (...params: any[]) => Promise<any>;
4
- getUserId: (...params: any[]) => Promise<any>;
5
- sendVerificationCode: (...params: any[]) => Promise<any>;
6
- getUserInstance: (...params: any[]) => Promise<any>;
7
- enroll: (...params: any[]) => Promise<any>;
8
- getConverageInfo: (...params: any[]) => Promise<any>;
9
- };
@@ -1,130 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getUserMethods = 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 userSdk_1 = require("../userSdk");
9
- const utils_1 = require("../utils");
10
- const getUserMethods = (makeRequest, url, credentials) => {
11
- const declareUser = async ({ user, channel, code, }) => {
12
- const path = '/user';
13
- const mappedUser = {
14
- lastname: user.lastName,
15
- firstname: user.firstName,
16
- identification_type: utils_1.getIdetificationTypeId(user.identificationType),
17
- identification_value: user.identificationValue,
18
- birthdate: date_fns_1.format(user.birthdate, 'yyyy-MM-dd'),
19
- gender: user.gender.toUpperCase(),
20
- phone: user.phone,
21
- email: user.email,
22
- country_id: user.countryId,
23
- };
24
- const parsedChannel = channel ? parseInt(channel) : channel;
25
- const response = await makeRequest('POST', path, {
26
- user_data: mappedUser,
27
- channel: parsedChannel,
28
- code,
29
- });
30
- const mappedResponse = {
31
- userId: response.data.user_id,
32
- patientId: response.data.patient_id,
33
- userInfo: response.data.user_info,
34
- askCode: response.data.ask_code,
35
- };
36
- return mappedResponse;
37
- };
38
- const getUserId = async (user) => {
39
- const path = '/user';
40
- const mappedUser = {
41
- lastname: user.lastName,
42
- firstname: user.firstName,
43
- identification_type: utils_1.getIdetificationTypeId(user.identificationType),
44
- identification_value: user.identificationValue,
45
- birthdate: date_fns_1.format(user.birthdate, 'yyyy-MM-dd'),
46
- gender: user.gender.toUpperCase(),
47
- phone: user.phone,
48
- email: user.email,
49
- country_id: user.countryId,
50
- };
51
- const response = await makeRequest('POST', path, {
52
- user_data: mappedUser,
53
- });
54
- return response.data.user_id;
55
- };
56
- const sendVerificationCode = async (params) => {
57
- const path = '/send-verification-code';
58
- const mappedParams = {
59
- identification_type: utils_1.getIdetificationTypeId(params.identificationType),
60
- identification_value: params.identificationValue,
61
- channel: parseInt(params.channel),
62
- };
63
- await makeRequest('POST', path, mappedParams);
64
- };
65
- const getUserInstance = async (user) => {
66
- const userId = typeof user === 'number' ? user : await getUserId(user);
67
- return userSdk_1.userSdk(url, credentials, userId);
68
- };
69
- const enroll = async (params) => {
70
- const path = `/enrollment`;
71
- const mappedUser = {
72
- firstname: params.firstName,
73
- lastname: params.lastName,
74
- gender: params.gender.toUpperCase(),
75
- identification_number: params.identificationNumber,
76
- birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
77
- email: params.email,
78
- plan: params.plan,
79
- start_date: date_fns_1.format(params.startDate, 'yyyy-MM-dd'),
80
- };
81
- await makeRequest('POST', path, {
82
- user_data: mappedUser,
83
- });
84
- };
85
- const getConverageInfo = async (identificationValue) => {
86
- const path = `/info-coverage/${identificationValue}`;
87
- const response = await makeRequest('GET', path);
88
- const raw = response.data.info;
89
- const mappedCoverageInfo = {
90
- financerId: raw.id_financiador,
91
- defaultAffiliationId: raw.id_afiliacion_default,
92
- plan: raw.plan,
93
- identificationNumber: raw.nro_documento,
94
- credentialNumber: raw.nro_credencial,
95
- lastName: raw.apellido,
96
- firstName: raw.nombre,
97
- birthdate: utils_1.parseDate(raw.fecha_nacimiento),
98
- financerPlanId: raw.id_financiador_plan,
99
- gender: raw.sexo.toLowerCase(),
100
- brand: raw.brand,
101
- holderIdentificationNumber: raw.nro_documento_titular,
102
- copaymentValue: raw.valor_copago,
103
- mobilePhone: raw.telefono_movil,
104
- company: raw.empresa,
105
- email: raw.email,
106
- dischargeDate: raw.fecha_alta ? utils_1.parseDateTime(raw.fecha_alta) : null,
107
- leavingDate: raw.fecha_baja ? utils_1.parseDateTime(raw.fecha_baja) : null,
108
- identificacion_tributaria: raw.identificacion_tributaria,
109
- deregistrationDate: raw.fecha_baja_padron
110
- ? utils_1.parseDateTime(raw.fecha_baja_padron)
111
- : null,
112
- authorizationCode: raw.codigo_autorizacion,
113
- authorizationCodeExpiration: raw.codigo_autorizacion_vencimiento
114
- ? utils_1.parseDateTime(raw.codigo_autorizacion_vencimiento)
115
- : null,
116
- };
117
- return mappedCoverageInfo;
118
- };
119
- return {
120
- declareUser: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.declareUserParams]), schemas_1.doc24Schemas.declareUserResponse, declareUser),
121
- getUserId: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.user]), zod_1.number(), getUserId),
122
- sendVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.sendVerificationCodeParams]), zod_1.void(), sendVerificationCode),
123
- getUserInstance: validation_1.validateFunction(zod_1.tuple([zod_1.union([schemas_1.doc24Schemas.user, zod_1.number()])]),
124
- // TODO: validate?
125
- zod_1.any(), getUserInstance),
126
- enroll: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.enrollmentParams]), zod_1.void(), enroll),
127
- getConverageInfo: validation_1.validateFunction(zod_1.tuple([zod_1.string()]), schemas_1.doc24Schemas.coverageInfo, getConverageInfo),
128
- };
129
- };
130
- exports.getUserMethods = getUserMethods;
@@ -1,58 +0,0 @@
1
- export var __esModule: boolean;
2
- export function doc24Sdk(params: any): Promise<{
3
- getRequestHandler: (params: any) => Promise<(request: any) => Promise<{
4
- status: {
5
- code: number;
6
- message: string;
7
- };
8
- data: any;
9
- }>>;
10
- getProfessional: (...params: any[]) => Promise<any>;
11
- getAvailableScheduleClinics: (...params: any[]) => Promise<any>;
12
- declareUser: (params_0?: {
13
- user: any;
14
- channel: any;
15
- code: any;
16
- } | undefined) => Promise<{
17
- userId: any;
18
- patientId: any;
19
- userInfo: any;
20
- askCode: any;
21
- }>;
22
- getUserId: (user?: any) => Promise<any>;
23
- sendVerificationCode: (params?: any) => Promise<void>;
24
- getUserInstance: (user?: any) => Promise<any>;
25
- enroll: (params?: any) => Promise<void>;
26
- getConverageInfo: (identificationValue?: any) => Promise<{
27
- firstName: string | null;
28
- lastName: string | null;
29
- birthdate: Date;
30
- gender: "m" | "f";
31
- email: string | null;
32
- identificationNumber: string;
33
- plan: string | null;
34
- financerId: number | null;
35
- defaultAffiliationId: number | null;
36
- credentialNumber: string | null;
37
- financerPlanId: number | null;
38
- brand: number | null;
39
- holderIdentificationNumber: string | null;
40
- copaymentValue: number | null;
41
- mobilePhone: string | null;
42
- company: string | null;
43
- dischargeDate: Date | null;
44
- leavingDate: Date | null;
45
- identificacion_tributaria: string | null;
46
- deregistrationDate: Date | null;
47
- authorizationCode: string | null;
48
- authorizationCodeExpiration: Date | null;
49
- } | null>;
50
- getDiagnosticaHistory: (...params: any) => Promise<any>;
51
- getDiagnosticaDeepLink: (...params: any) => Promise<{
52
- forwardingRequired: true;
53
- deepLink: string;
54
- } | {
55
- forwardingRequired: false;
56
- }>;
57
- getDiagnosticaAccess: (...params: any) => Promise<void>;
58
- }>;
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.doc24Sdk = void 0;
4
- const webhook_1 = require("./webhook");
5
- const baseSdk_1 = require("./baseSdk");
6
- const request_1 = require("./request");
7
- const doc24Sdk = async (params) => {
8
- const baseSdk = await baseSdk_1.getBaseSdk(params.url, params.credentials);
9
- const makeRequest = await request_1.getRequestFactory(params.url, params.credentials);
10
- return {
11
- ...baseSdk,
12
- getRequestHandler: async (params) => {
13
- await makeRequest('PUT', '/webhook', {
14
- url: params.baseAddress,
15
- issuer: params.credentials.iss,
16
- secret: params.credentials.key,
17
- });
18
- return webhook_1.getRequestHandler(params.credentials, baseSdk, params.eventHandlers);
19
- },
20
- };
21
- };
22
- exports.doc24Sdk = doc24Sdk;
@@ -1,2 +0,0 @@
1
- export var __esModule: boolean;
2
- export function getRequestFactory(url: any, credentials: any, userId: any): Promise<(method: any, path: any, body: any) => Promise<any>>;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getRequestFactory = void 0;
7
- const axios_1 = __importDefault(require("axios"));
8
- const token_1 = require("./token");
9
- const debug_1 = __importDefault(require("debug"));
10
- const debugRequest = debug_1.default('doc24Sdk:request');
11
- const getRequestFactory = async (url, credentials, userId) => {
12
- const makeRequest = async (method, path, body) => {
13
- const token = await token_1.getToken(credentials, body ? JSON.stringify(body) : undefined, userId);
14
- const fullUrl = url + path;
15
- const result = await axios_1.default({
16
- method,
17
- url: fullUrl,
18
- headers: { Authentication: token },
19
- data: body,
20
- });
21
- debugRequest({ url: fullUrl, response: result.data, body });
22
- return result.data;
23
- };
24
- return makeRequest;
25
- };
26
- exports.getRequestFactory = getRequestFactory;
@@ -1,2 +0,0 @@
1
- export var __esModule: boolean;
2
- export function getToken(credentials: any, bodyAsJson: any, userId: any): Promise<any>;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getToken = void 0;
7
- const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
8
- const crypto_1 = __importDefault(require("crypto"));
9
- const tokenLifeTimeInSeconds = 500 * 60;
10
- const getToken = async (credentials, bodyAsJson, userId) => {
11
- const tokenData = {
12
- msg_sig: createSignature(credentials.key, bodyAsJson),
13
- user_id: userId,
14
- };
15
- const encodedToken = await makeJwt(tokenData, credentials.key, {
16
- expiresIn: tokenLifeTimeInSeconds,
17
- issuer: credentials.iss,
18
- });
19
- return encodedToken;
20
- };
21
- exports.getToken = getToken;
22
- const makeJwt = (payload, key, options = {}) => new Promise((resolve, reject) => jsonwebtoken_1.default.sign(payload, key, options, (err, token) => {
23
- if (err || !token)
24
- return reject(err);
25
- resolve(token);
26
- }));
27
- const createSignature = (secret, bodyAsJson) => {
28
- //TODO: verify this, seems wrong
29
- const realSecret = bodyAsJson ? secret : 'true';
30
- const realBody = bodyAsJson !== null && bodyAsJson !== void 0 ? bodyAsJson : secret;
31
- const hmac = crypto_1.default.createHmac('sha256', realSecret);
32
- hmac.update(realBody);
33
- return hmac.digest('base64');
34
- };
@@ -1,10 +0,0 @@
1
- export var __esModule: boolean;
2
- export class ParametersValidationError extends Error {
3
- constructor(details: any);
4
- details: any;
5
- }
6
- export class ResponseValidationError extends Error {
7
- constructor(details: any);
8
- details: any;
9
- }
10
- export function validateFunction(inValidation: any, outValidation: any, fn: any): (...params: any[]) => Promise<any>;