@integraciones_doc24/sdk 1.6.0 → 1.7.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.
- package/lib/baseSdk/external.d.ts +143 -4
- package/lib/baseSdk/external.js +22 -0
- package/lib/index.d.ts +144 -5
- package/lib/schemas.d.ts +165 -13
- package/lib/schemas.js +25 -3
- package/lib/types.d.ts +7 -2
- package/package.json +1 -1
|
@@ -3,21 +3,160 @@ export declare const getExternalMethods: (makeRequest: RequestMaker) => {
|
|
|
3
3
|
externalLogin: (params: {
|
|
4
4
|
password: string;
|
|
5
5
|
user: string;
|
|
6
|
-
}) => Promise<
|
|
7
|
-
|
|
6
|
+
}) => Promise<{
|
|
7
|
+
firstName: string;
|
|
8
|
+
lastName: string;
|
|
9
|
+
countryId: string;
|
|
10
|
+
gender: "m" | "f";
|
|
11
|
+
phone: string;
|
|
12
|
+
email: string;
|
|
13
|
+
birthday: Date;
|
|
14
|
+
identificationNumber: string;
|
|
15
|
+
}>;
|
|
16
|
+
preExternalEnrollment: (params: ({
|
|
8
17
|
birthdate: Date;
|
|
18
|
+
identificationNumber: string;
|
|
19
|
+
} & {
|
|
9
20
|
phone: string;
|
|
10
21
|
email: string;
|
|
22
|
+
}) | ({
|
|
23
|
+
birthdate: Date;
|
|
11
24
|
identificationNumber: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
25
|
+
} & {
|
|
26
|
+
phone?: undefined;
|
|
27
|
+
email: string;
|
|
28
|
+
}) | ({
|
|
29
|
+
birthdate: Date;
|
|
30
|
+
identificationNumber: string;
|
|
31
|
+
} & {
|
|
32
|
+
email?: undefined;
|
|
33
|
+
phone: string;
|
|
34
|
+
})) => Promise<any>;
|
|
35
|
+
externalEnrollment: (params: ({
|
|
14
36
|
birthdate: Date;
|
|
37
|
+
identificationNumber: string;
|
|
38
|
+
} & {
|
|
39
|
+
phone: string;
|
|
40
|
+
email: string;
|
|
41
|
+
} & {
|
|
42
|
+
password: string;
|
|
43
|
+
} & {
|
|
44
|
+
emailCode: string;
|
|
45
|
+
phoneCode: string;
|
|
46
|
+
}) | ({
|
|
47
|
+
birthdate: Date;
|
|
48
|
+
identificationNumber: string;
|
|
49
|
+
} & {
|
|
15
50
|
phone: string;
|
|
16
51
|
email: string;
|
|
52
|
+
} & {
|
|
53
|
+
password: string;
|
|
54
|
+
} & {
|
|
55
|
+
phoneCode?: undefined;
|
|
56
|
+
emailCode: string;
|
|
57
|
+
}) | ({
|
|
58
|
+
birthdate: Date;
|
|
59
|
+
identificationNumber: string;
|
|
60
|
+
} & {
|
|
61
|
+
phone: string;
|
|
62
|
+
email: string;
|
|
63
|
+
} & {
|
|
64
|
+
password: string;
|
|
65
|
+
} & {
|
|
66
|
+
emailCode?: undefined;
|
|
67
|
+
phoneCode: string;
|
|
68
|
+
}) | ({
|
|
69
|
+
birthdate: Date;
|
|
70
|
+
identificationNumber: string;
|
|
71
|
+
} & {
|
|
72
|
+
phone?: undefined;
|
|
73
|
+
email: string;
|
|
74
|
+
} & {
|
|
75
|
+
password: string;
|
|
76
|
+
} & {
|
|
77
|
+
emailCode: string;
|
|
78
|
+
phoneCode: string;
|
|
79
|
+
}) | ({
|
|
80
|
+
birthdate: Date;
|
|
81
|
+
identificationNumber: string;
|
|
82
|
+
} & {
|
|
83
|
+
phone?: undefined;
|
|
84
|
+
email: string;
|
|
85
|
+
} & {
|
|
86
|
+
password: string;
|
|
87
|
+
} & {
|
|
88
|
+
phoneCode?: undefined;
|
|
89
|
+
emailCode: string;
|
|
90
|
+
}) | ({
|
|
91
|
+
birthdate: Date;
|
|
92
|
+
identificationNumber: string;
|
|
93
|
+
} & {
|
|
94
|
+
phone?: undefined;
|
|
95
|
+
email: string;
|
|
96
|
+
} & {
|
|
97
|
+
password: string;
|
|
98
|
+
} & {
|
|
99
|
+
emailCode?: undefined;
|
|
100
|
+
phoneCode: string;
|
|
101
|
+
}) | ({
|
|
102
|
+
birthdate: Date;
|
|
17
103
|
identificationNumber: string;
|
|
104
|
+
} & {
|
|
105
|
+
email?: undefined;
|
|
106
|
+
phone: string;
|
|
107
|
+
} & {
|
|
108
|
+
password: string;
|
|
18
109
|
} & {
|
|
19
110
|
emailCode: string;
|
|
20
111
|
phoneCode: string;
|
|
112
|
+
}) | ({
|
|
113
|
+
birthdate: Date;
|
|
114
|
+
identificationNumber: string;
|
|
115
|
+
} & {
|
|
116
|
+
email?: undefined;
|
|
117
|
+
phone: string;
|
|
118
|
+
} & {
|
|
21
119
|
password: string;
|
|
120
|
+
} & {
|
|
121
|
+
phoneCode?: undefined;
|
|
122
|
+
emailCode: string;
|
|
123
|
+
}) | ({
|
|
124
|
+
birthdate: Date;
|
|
125
|
+
identificationNumber: string;
|
|
126
|
+
} & {
|
|
127
|
+
email?: undefined;
|
|
128
|
+
phone: string;
|
|
129
|
+
} & {
|
|
130
|
+
password: string;
|
|
131
|
+
} & {
|
|
132
|
+
emailCode?: undefined;
|
|
133
|
+
phoneCode: string;
|
|
134
|
+
})) => Promise<any>;
|
|
135
|
+
getExternalVerificationCode: (params: {
|
|
136
|
+
birthdate: Date;
|
|
137
|
+
channel: "1" | "2";
|
|
138
|
+
identificationNumber: string;
|
|
22
139
|
}) => Promise<any>;
|
|
140
|
+
externalResetPassword: (params: ({
|
|
141
|
+
birthdate: Date;
|
|
142
|
+
password: string;
|
|
143
|
+
identificationNumber: string;
|
|
144
|
+
} & {
|
|
145
|
+
emailCode: string;
|
|
146
|
+
phoneCode: string;
|
|
147
|
+
}) | ({
|
|
148
|
+
birthdate: Date;
|
|
149
|
+
password: string;
|
|
150
|
+
identificationNumber: string;
|
|
151
|
+
} & {
|
|
152
|
+
phoneCode?: undefined;
|
|
153
|
+
emailCode: string;
|
|
154
|
+
}) | ({
|
|
155
|
+
birthdate: Date;
|
|
156
|
+
password: string;
|
|
157
|
+
identificationNumber: string;
|
|
158
|
+
} & {
|
|
159
|
+
emailCode?: undefined;
|
|
160
|
+
phoneCode: string;
|
|
161
|
+
})) => Promise<any>;
|
|
23
162
|
};
|
package/lib/baseSdk/external.js
CHANGED
|
@@ -38,9 +38,29 @@ const getExternalMethods = (makeRequest) => {
|
|
|
38
38
|
birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
|
|
39
39
|
email: params.email,
|
|
40
40
|
telephone: params.phone,
|
|
41
|
+
password: params.password,
|
|
41
42
|
email_code: params.emailCode,
|
|
42
43
|
telephone_code: params.phoneCode,
|
|
44
|
+
});
|
|
45
|
+
return response.data;
|
|
46
|
+
};
|
|
47
|
+
const getExternalVerificationCode = async (params) => {
|
|
48
|
+
const path = '/send-external-verification-code';
|
|
49
|
+
await makeRequest('POST', path, {
|
|
50
|
+
identification_number: params.identificationNumber,
|
|
51
|
+
birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
|
|
52
|
+
channel: params.channel,
|
|
53
|
+
});
|
|
54
|
+
return;
|
|
55
|
+
};
|
|
56
|
+
const externalResetPassword = async (params) => {
|
|
57
|
+
const path = '/external-reset';
|
|
58
|
+
const response = await makeRequest('POST', path, {
|
|
59
|
+
identification_number: params.identificationNumber,
|
|
60
|
+
birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
|
|
43
61
|
password: params.password,
|
|
62
|
+
email_code: params.emailCode,
|
|
63
|
+
telephone_code: params.phoneCode,
|
|
44
64
|
});
|
|
45
65
|
return response.data;
|
|
46
66
|
};
|
|
@@ -48,6 +68,8 @@ const getExternalMethods = (makeRequest) => {
|
|
|
48
68
|
externalLogin: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalLoginParams]), schemas_1.doc24Schemas.externalLoginResponse, externalLogin),
|
|
49
69
|
preExternalEnrollment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.preExternalEnrollmentParams]), zod_1.any(), preExternalEnrollment),
|
|
50
70
|
externalEnrollment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalEnrollmentParams]), zod_1.any(), externalEnrollment),
|
|
71
|
+
getExternalVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalVerificationCodeParams]), zod_1.any(), getExternalVerificationCode),
|
|
72
|
+
externalResetPassword: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalResetPasswordParams]), zod_1.any(), externalResetPassword),
|
|
51
73
|
};
|
|
52
74
|
};
|
|
53
75
|
exports.getExternalMethods = getExternalMethods;
|
package/lib/index.d.ts
CHANGED
|
@@ -189,22 +189,161 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
|
|
|
189
189
|
externalLogin: (params: {
|
|
190
190
|
password: string;
|
|
191
191
|
user: string;
|
|
192
|
-
}) => Promise<
|
|
193
|
-
|
|
192
|
+
}) => Promise<{
|
|
193
|
+
firstName: string;
|
|
194
|
+
lastName: string;
|
|
195
|
+
countryId: string;
|
|
196
|
+
gender: "m" | "f";
|
|
197
|
+
phone: string;
|
|
198
|
+
email: string;
|
|
199
|
+
birthday: Date;
|
|
200
|
+
identificationNumber: string;
|
|
201
|
+
}>;
|
|
202
|
+
preExternalEnrollment: (params: ({
|
|
194
203
|
birthdate: Date;
|
|
204
|
+
identificationNumber: string;
|
|
205
|
+
} & {
|
|
195
206
|
phone: string;
|
|
196
207
|
email: string;
|
|
208
|
+
}) | ({
|
|
209
|
+
birthdate: Date;
|
|
210
|
+
identificationNumber: string;
|
|
211
|
+
} & {
|
|
212
|
+
phone?: undefined;
|
|
213
|
+
email: string;
|
|
214
|
+
}) | ({
|
|
215
|
+
birthdate: Date;
|
|
197
216
|
identificationNumber: string;
|
|
198
|
-
}
|
|
199
|
-
|
|
217
|
+
} & {
|
|
218
|
+
email?: undefined;
|
|
219
|
+
phone: string;
|
|
220
|
+
})) => Promise<void>;
|
|
221
|
+
externalEnrollment: (params: ({
|
|
200
222
|
birthdate: Date;
|
|
223
|
+
identificationNumber: string;
|
|
224
|
+
} & {
|
|
201
225
|
phone: string;
|
|
202
226
|
email: string;
|
|
227
|
+
} & {
|
|
228
|
+
password: string;
|
|
229
|
+
} & {
|
|
230
|
+
emailCode: string;
|
|
231
|
+
phoneCode: string;
|
|
232
|
+
}) | ({
|
|
233
|
+
birthdate: Date;
|
|
203
234
|
identificationNumber: string;
|
|
204
235
|
} & {
|
|
236
|
+
phone: string;
|
|
237
|
+
email: string;
|
|
238
|
+
} & {
|
|
239
|
+
password: string;
|
|
240
|
+
} & {
|
|
241
|
+
phoneCode?: undefined;
|
|
205
242
|
emailCode: string;
|
|
243
|
+
}) | ({
|
|
244
|
+
birthdate: Date;
|
|
245
|
+
identificationNumber: string;
|
|
246
|
+
} & {
|
|
247
|
+
phone: string;
|
|
248
|
+
email: string;
|
|
249
|
+
} & {
|
|
250
|
+
password: string;
|
|
251
|
+
} & {
|
|
252
|
+
emailCode?: undefined;
|
|
206
253
|
phoneCode: string;
|
|
254
|
+
}) | ({
|
|
255
|
+
birthdate: Date;
|
|
256
|
+
identificationNumber: string;
|
|
257
|
+
} & {
|
|
258
|
+
phone?: undefined;
|
|
259
|
+
email: string;
|
|
260
|
+
} & {
|
|
207
261
|
password: string;
|
|
208
|
-
}
|
|
262
|
+
} & {
|
|
263
|
+
emailCode: string;
|
|
264
|
+
phoneCode: string;
|
|
265
|
+
}) | ({
|
|
266
|
+
birthdate: Date;
|
|
267
|
+
identificationNumber: string;
|
|
268
|
+
} & {
|
|
269
|
+
phone?: undefined;
|
|
270
|
+
email: string;
|
|
271
|
+
} & {
|
|
272
|
+
password: string;
|
|
273
|
+
} & {
|
|
274
|
+
phoneCode?: undefined;
|
|
275
|
+
emailCode: string;
|
|
276
|
+
}) | ({
|
|
277
|
+
birthdate: Date;
|
|
278
|
+
identificationNumber: string;
|
|
279
|
+
} & {
|
|
280
|
+
phone?: undefined;
|
|
281
|
+
email: string;
|
|
282
|
+
} & {
|
|
283
|
+
password: string;
|
|
284
|
+
} & {
|
|
285
|
+
emailCode?: undefined;
|
|
286
|
+
phoneCode: string;
|
|
287
|
+
}) | ({
|
|
288
|
+
birthdate: Date;
|
|
289
|
+
identificationNumber: string;
|
|
290
|
+
} & {
|
|
291
|
+
email?: undefined;
|
|
292
|
+
phone: string;
|
|
293
|
+
} & {
|
|
294
|
+
password: string;
|
|
295
|
+
} & {
|
|
296
|
+
emailCode: string;
|
|
297
|
+
phoneCode: string;
|
|
298
|
+
}) | ({
|
|
299
|
+
birthdate: Date;
|
|
300
|
+
identificationNumber: string;
|
|
301
|
+
} & {
|
|
302
|
+
email?: undefined;
|
|
303
|
+
phone: string;
|
|
304
|
+
} & {
|
|
305
|
+
password: string;
|
|
306
|
+
} & {
|
|
307
|
+
phoneCode?: undefined;
|
|
308
|
+
emailCode: string;
|
|
309
|
+
}) | ({
|
|
310
|
+
birthdate: Date;
|
|
311
|
+
identificationNumber: string;
|
|
312
|
+
} & {
|
|
313
|
+
email?: undefined;
|
|
314
|
+
phone: string;
|
|
315
|
+
} & {
|
|
316
|
+
password: string;
|
|
317
|
+
} & {
|
|
318
|
+
emailCode?: undefined;
|
|
319
|
+
phoneCode: string;
|
|
320
|
+
})) => Promise<any>;
|
|
321
|
+
getExternalVerificationCode: (params: {
|
|
322
|
+
birthdate: Date;
|
|
323
|
+
channel: "1" | "2";
|
|
324
|
+
identificationNumber: string;
|
|
325
|
+
}) => Promise<void>;
|
|
326
|
+
externalResetPassword: (params: ({
|
|
327
|
+
birthdate: Date;
|
|
328
|
+
password: string;
|
|
329
|
+
identificationNumber: string;
|
|
330
|
+
} & {
|
|
331
|
+
emailCode: string;
|
|
332
|
+
phoneCode: string;
|
|
333
|
+
}) | ({
|
|
334
|
+
birthdate: Date;
|
|
335
|
+
password: string;
|
|
336
|
+
identificationNumber: string;
|
|
337
|
+
} & {
|
|
338
|
+
phoneCode?: undefined;
|
|
339
|
+
emailCode: string;
|
|
340
|
+
}) | ({
|
|
341
|
+
birthdate: Date;
|
|
342
|
+
password: string;
|
|
343
|
+
identificationNumber: string;
|
|
344
|
+
} & {
|
|
345
|
+
emailCode?: undefined;
|
|
346
|
+
phoneCode: string;
|
|
347
|
+
})) => Promise<any>;
|
|
209
348
|
}>;
|
|
210
349
|
export type { Doc24 } from './types';
|
package/lib/schemas.d.ts
CHANGED
|
@@ -1379,48 +1379,200 @@ export declare const doc24Schemas: {
|
|
|
1379
1379
|
birthday: Date;
|
|
1380
1380
|
identificationNumber: string;
|
|
1381
1381
|
}>;
|
|
1382
|
-
preExternalEnrollmentParams: import("zod").ZodObject<{
|
|
1382
|
+
preExternalEnrollmentParams: import("zod").ZodIntersection<import("zod").ZodObject<{
|
|
1383
1383
|
identificationNumber: import("zod").ZodString;
|
|
1384
1384
|
birthdate: import("zod").ZodDate;
|
|
1385
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1386
|
+
birthdate: Date;
|
|
1387
|
+
identificationNumber: string;
|
|
1388
|
+
}, {
|
|
1389
|
+
birthdate: Date;
|
|
1390
|
+
identificationNumber: string;
|
|
1391
|
+
}>, import("zod").ZodEffects<import("zod").ZodUnion<[import("zod").ZodObject<{
|
|
1385
1392
|
email: import("zod").ZodString;
|
|
1386
1393
|
phone: import("zod").ZodString;
|
|
1387
1394
|
}, "strip", import("zod").ZodTypeAny, {
|
|
1388
|
-
birthdate: Date;
|
|
1389
1395
|
phone: string;
|
|
1390
1396
|
email: string;
|
|
1391
|
-
identificationNumber: string;
|
|
1392
1397
|
}, {
|
|
1393
|
-
birthdate: Date;
|
|
1394
1398
|
phone: string;
|
|
1395
1399
|
email: string;
|
|
1396
|
-
|
|
1397
|
-
}>;
|
|
1398
|
-
externalEnrollmentParams: import("zod").ZodIntersection<import("zod").ZodObject<{
|
|
1399
|
-
identificationNumber: import("zod").ZodString;
|
|
1400
|
-
birthdate: import("zod").ZodDate;
|
|
1400
|
+
}>, import("zod").ZodObject<{
|
|
1401
1401
|
email: import("zod").ZodString;
|
|
1402
|
+
phone: import("zod").ZodUndefined;
|
|
1403
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1404
|
+
phone?: undefined;
|
|
1405
|
+
email: string;
|
|
1406
|
+
}, {
|
|
1407
|
+
phone?: undefined;
|
|
1408
|
+
email: string;
|
|
1409
|
+
}>, import("zod").ZodObject<{
|
|
1410
|
+
email: import("zod").ZodUndefined;
|
|
1402
1411
|
phone: import("zod").ZodString;
|
|
1403
1412
|
}, "strip", import("zod").ZodTypeAny, {
|
|
1404
|
-
|
|
1413
|
+
email?: undefined;
|
|
1405
1414
|
phone: string;
|
|
1415
|
+
}, {
|
|
1416
|
+
email?: undefined;
|
|
1417
|
+
phone: string;
|
|
1418
|
+
}>]>, {
|
|
1419
|
+
phone: string;
|
|
1420
|
+
email: string;
|
|
1421
|
+
} | {
|
|
1422
|
+
phone?: undefined;
|
|
1406
1423
|
email: string;
|
|
1424
|
+
} | {
|
|
1425
|
+
email?: undefined;
|
|
1426
|
+
phone: string;
|
|
1427
|
+
}>>;
|
|
1428
|
+
externalEnrollmentParams: import("zod").ZodIntersection<import("zod").ZodIntersection<import("zod").ZodIntersection<import("zod").ZodObject<{
|
|
1429
|
+
identificationNumber: import("zod").ZodString;
|
|
1430
|
+
birthdate: import("zod").ZodDate;
|
|
1431
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1432
|
+
birthdate: Date;
|
|
1407
1433
|
identificationNumber: string;
|
|
1408
1434
|
}, {
|
|
1409
1435
|
birthdate: Date;
|
|
1436
|
+
identificationNumber: string;
|
|
1437
|
+
}>, import("zod").ZodEffects<import("zod").ZodUnion<[import("zod").ZodObject<{
|
|
1438
|
+
email: import("zod").ZodString;
|
|
1439
|
+
phone: import("zod").ZodString;
|
|
1440
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1410
1441
|
phone: string;
|
|
1411
1442
|
email: string;
|
|
1412
|
-
|
|
1443
|
+
}, {
|
|
1444
|
+
phone: string;
|
|
1445
|
+
email: string;
|
|
1446
|
+
}>, import("zod").ZodObject<{
|
|
1447
|
+
email: import("zod").ZodString;
|
|
1448
|
+
phone: import("zod").ZodUndefined;
|
|
1449
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1450
|
+
phone?: undefined;
|
|
1451
|
+
email: string;
|
|
1452
|
+
}, {
|
|
1453
|
+
phone?: undefined;
|
|
1454
|
+
email: string;
|
|
1413
1455
|
}>, import("zod").ZodObject<{
|
|
1456
|
+
email: import("zod").ZodUndefined;
|
|
1457
|
+
phone: import("zod").ZodString;
|
|
1458
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1459
|
+
email?: undefined;
|
|
1460
|
+
phone: string;
|
|
1461
|
+
}, {
|
|
1462
|
+
email?: undefined;
|
|
1463
|
+
phone: string;
|
|
1464
|
+
}>]>, {
|
|
1465
|
+
phone: string;
|
|
1466
|
+
email: string;
|
|
1467
|
+
} | {
|
|
1468
|
+
phone?: undefined;
|
|
1469
|
+
email: string;
|
|
1470
|
+
} | {
|
|
1471
|
+
email?: undefined;
|
|
1472
|
+
phone: string;
|
|
1473
|
+
}>>, import("zod").ZodObject<{
|
|
1474
|
+
password: import("zod").ZodString;
|
|
1475
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1476
|
+
password: string;
|
|
1477
|
+
}, {
|
|
1478
|
+
password: string;
|
|
1479
|
+
}>>, import("zod").ZodEffects<import("zod").ZodUnion<[import("zod").ZodObject<{
|
|
1414
1480
|
emailCode: import("zod").ZodString;
|
|
1415
1481
|
phoneCode: import("zod").ZodString;
|
|
1416
|
-
password: import("zod").ZodString;
|
|
1417
1482
|
}, "strip", import("zod").ZodTypeAny, {
|
|
1418
1483
|
emailCode: string;
|
|
1419
1484
|
phoneCode: string;
|
|
1420
|
-
password: string;
|
|
1421
1485
|
}, {
|
|
1422
1486
|
emailCode: string;
|
|
1423
1487
|
phoneCode: string;
|
|
1488
|
+
}>, import("zod").ZodObject<{
|
|
1489
|
+
emailCode: import("zod").ZodString;
|
|
1490
|
+
phoneCode: import("zod").ZodUndefined;
|
|
1491
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1492
|
+
phoneCode?: undefined;
|
|
1493
|
+
emailCode: string;
|
|
1494
|
+
}, {
|
|
1495
|
+
phoneCode?: undefined;
|
|
1496
|
+
emailCode: string;
|
|
1497
|
+
}>, import("zod").ZodObject<{
|
|
1498
|
+
emailCode: import("zod").ZodUndefined;
|
|
1499
|
+
phoneCode: import("zod").ZodString;
|
|
1500
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1501
|
+
emailCode?: undefined;
|
|
1502
|
+
phoneCode: string;
|
|
1503
|
+
}, {
|
|
1504
|
+
emailCode?: undefined;
|
|
1505
|
+
phoneCode: string;
|
|
1506
|
+
}>]>, {
|
|
1507
|
+
emailCode: string;
|
|
1508
|
+
phoneCode: string;
|
|
1509
|
+
} | {
|
|
1510
|
+
phoneCode?: undefined;
|
|
1511
|
+
emailCode: string;
|
|
1512
|
+
} | {
|
|
1513
|
+
emailCode?: undefined;
|
|
1514
|
+
phoneCode: string;
|
|
1515
|
+
}>>;
|
|
1516
|
+
externalVerificationCodeParams: import("zod").ZodObject<{
|
|
1517
|
+
identificationNumber: import("zod").ZodString;
|
|
1518
|
+
birthdate: import("zod").ZodDate;
|
|
1519
|
+
channel: import("zod").ZodEnum<["1", "2"]>;
|
|
1520
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1521
|
+
birthdate: Date;
|
|
1522
|
+
channel: "1" | "2";
|
|
1523
|
+
identificationNumber: string;
|
|
1524
|
+
}, {
|
|
1525
|
+
birthdate: Date;
|
|
1526
|
+
channel: "1" | "2";
|
|
1527
|
+
identificationNumber: string;
|
|
1528
|
+
}>;
|
|
1529
|
+
externalResetPasswordParams: import("zod").ZodIntersection<import("zod").ZodObject<{
|
|
1530
|
+
identificationNumber: import("zod").ZodString;
|
|
1531
|
+
birthdate: import("zod").ZodDate;
|
|
1532
|
+
password: import("zod").ZodString;
|
|
1533
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1534
|
+
birthdate: Date;
|
|
1535
|
+
password: string;
|
|
1536
|
+
identificationNumber: string;
|
|
1537
|
+
}, {
|
|
1538
|
+
birthdate: Date;
|
|
1424
1539
|
password: string;
|
|
1540
|
+
identificationNumber: string;
|
|
1541
|
+
}>, import("zod").ZodEffects<import("zod").ZodUnion<[import("zod").ZodObject<{
|
|
1542
|
+
emailCode: import("zod").ZodString;
|
|
1543
|
+
phoneCode: import("zod").ZodString;
|
|
1544
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1545
|
+
emailCode: string;
|
|
1546
|
+
phoneCode: string;
|
|
1547
|
+
}, {
|
|
1548
|
+
emailCode: string;
|
|
1549
|
+
phoneCode: string;
|
|
1550
|
+
}>, import("zod").ZodObject<{
|
|
1551
|
+
emailCode: import("zod").ZodString;
|
|
1552
|
+
phoneCode: import("zod").ZodUndefined;
|
|
1553
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1554
|
+
phoneCode?: undefined;
|
|
1555
|
+
emailCode: string;
|
|
1556
|
+
}, {
|
|
1557
|
+
phoneCode?: undefined;
|
|
1558
|
+
emailCode: string;
|
|
1559
|
+
}>, import("zod").ZodObject<{
|
|
1560
|
+
emailCode: import("zod").ZodUndefined;
|
|
1561
|
+
phoneCode: import("zod").ZodString;
|
|
1562
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1563
|
+
emailCode?: undefined;
|
|
1564
|
+
phoneCode: string;
|
|
1565
|
+
}, {
|
|
1566
|
+
emailCode?: undefined;
|
|
1567
|
+
phoneCode: string;
|
|
1568
|
+
}>]>, {
|
|
1569
|
+
emailCode: string;
|
|
1570
|
+
phoneCode: string;
|
|
1571
|
+
} | {
|
|
1572
|
+
phoneCode?: undefined;
|
|
1573
|
+
emailCode: string;
|
|
1574
|
+
} | {
|
|
1575
|
+
emailCode?: undefined;
|
|
1576
|
+
phoneCode: string;
|
|
1425
1577
|
}>>;
|
|
1426
1578
|
};
|
package/lib/schemas.js
CHANGED
|
@@ -226,13 +226,33 @@ const externalLoginResponse = zod_1.object({
|
|
|
226
226
|
email: zod_1.string().email(),
|
|
227
227
|
phone: zod_1.string(),
|
|
228
228
|
});
|
|
229
|
+
const emailOrPhone = zod_1.union([
|
|
230
|
+
zod_1.object({ email: zod_1.string(), phone: zod_1.string() }),
|
|
231
|
+
zod_1.object({ email: zod_1.string(), phone: zod_1.undefined() }),
|
|
232
|
+
zod_1.object({ email: zod_1.undefined(), phone: zod_1.string() }),
|
|
233
|
+
]).refine((data) => data.email || data.phone, 'Either phone or email is required');
|
|
229
234
|
const preExternalEnrollmentParams = zod_1.object({
|
|
230
235
|
identificationNumber: zod_1.string(),
|
|
231
236
|
birthdate: zod_1.date(),
|
|
232
|
-
|
|
233
|
-
|
|
237
|
+
}).and(emailOrPhone);
|
|
238
|
+
const emailOrPhoneCode = zod_1.union([
|
|
239
|
+
zod_1.object({ emailCode: zod_1.string(), phoneCode: zod_1.string() }),
|
|
240
|
+
zod_1.object({ emailCode: zod_1.string(), phoneCode: zod_1.undefined() }),
|
|
241
|
+
zod_1.object({ emailCode: zod_1.undefined(), phoneCode: zod_1.string() }),
|
|
242
|
+
]).refine((data) => data.emailCode || data.phoneCode, 'Either phone code or email code is required');
|
|
243
|
+
const externalEnrollmentParams = preExternalEnrollmentParams
|
|
244
|
+
.and(zod_1.object({ password: zod_1.string() }))
|
|
245
|
+
.and(emailOrPhoneCode);
|
|
246
|
+
const externalVerificationCodeParams = zod_1.object({
|
|
247
|
+
identificationNumber: zod_1.string(),
|
|
248
|
+
birthdate: zod_1.date(),
|
|
249
|
+
channel: zod_1.enum(['1', '2']),
|
|
234
250
|
});
|
|
235
|
-
const
|
|
251
|
+
const externalResetPasswordParams = zod_1.object({
|
|
252
|
+
identificationNumber: zod_1.string(),
|
|
253
|
+
birthdate: zod_1.date(),
|
|
254
|
+
password: zod_1.string(),
|
|
255
|
+
}).and(emailOrPhoneCode);
|
|
236
256
|
exports.doc24Schemas = {
|
|
237
257
|
sdkCredentials,
|
|
238
258
|
sdkParams: zod_1.object({ url: zod_1.string(), credentials: sdkCredentials }),
|
|
@@ -362,4 +382,6 @@ exports.doc24Schemas = {
|
|
|
362
382
|
externalLoginResponse,
|
|
363
383
|
preExternalEnrollmentParams,
|
|
364
384
|
externalEnrollmentParams,
|
|
385
|
+
externalVerificationCodeParams,
|
|
386
|
+
externalResetPasswordParams,
|
|
365
387
|
};
|
package/lib/types.d.ts
CHANGED
|
@@ -36,8 +36,11 @@ export declare namespace Doc24 {
|
|
|
36
36
|
type DeclarePatientResponse = TypeOf<typeof doc24Schemas.declarePatientResponse>;
|
|
37
37
|
type VerificationParams = TypeOf<typeof doc24Schemas.verificationParams>;
|
|
38
38
|
type ExternalLoginParams = TypeOf<typeof doc24Schemas.externalLoginParams>;
|
|
39
|
+
type ExternalLoginResponse = TypeOf<typeof doc24Schemas.externalLoginResponse>;
|
|
39
40
|
type PreExternalEnrollmentParams = TypeOf<typeof doc24Schemas.preExternalEnrollmentParams>;
|
|
40
41
|
type ExternalEnrollmentParams = TypeOf<typeof doc24Schemas.externalEnrollmentParams>;
|
|
42
|
+
type ExternalVerificationCodeParams = TypeOf<typeof doc24Schemas.externalVerificationCodeParams>;
|
|
43
|
+
type ExternalResetPasswordParams = TypeOf<typeof doc24Schemas.externalResetPasswordParams>;
|
|
41
44
|
type BaseSdk = {
|
|
42
45
|
declareUser: (params: DeclareUserParams) => Promise<DeclareUserResponse>;
|
|
43
46
|
getUserId: (user: User) => Promise<number>;
|
|
@@ -50,9 +53,11 @@ export declare namespace Doc24 {
|
|
|
50
53
|
getDiagnosticaHistory: (patient: DiagnosticaPatientFilter, from: Date, to: Date) => Promise<DiagnosticaHistoryAppointment[]>;
|
|
51
54
|
getDiagnosticaDeepLink: (kiosk: string, user: DiagnosticaUser, patient: DiagnosticaPatient) => Promise<DiagnosticaDeepLinkResponse>;
|
|
52
55
|
getDiagnosticaAccess: (kiosk: string, user: DiagnosticaUser, patient: DiagnosticaPatient) => Promise<void>;
|
|
53
|
-
externalLogin: (params: ExternalLoginParams) => Promise<
|
|
54
|
-
preExternalEnrollment: (params: PreExternalEnrollmentParams) => Promise<
|
|
56
|
+
externalLogin: (params: ExternalLoginParams) => Promise<ExternalLoginResponse>;
|
|
57
|
+
preExternalEnrollment: (params: PreExternalEnrollmentParams) => Promise<void>;
|
|
55
58
|
externalEnrollment: (params: ExternalEnrollmentParams) => Promise<any>;
|
|
59
|
+
getExternalVerificationCode: (params: ExternalVerificationCodeParams) => Promise<void>;
|
|
60
|
+
externalResetPassword: (params: ExternalResetPasswordParams) => Promise<any>;
|
|
56
61
|
};
|
|
57
62
|
type UserSdk = {
|
|
58
63
|
declarePatient: (params: DeclarePatientParams) => Promise<DeclarePatientResponse>;
|