@integraciones_doc24/sdk 0.38.1 → 0.39.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/schemas.d.ts CHANGED
@@ -1112,7 +1112,7 @@ export declare const doc24Schemas: {
1112
1112
  authorizationCode: string | null;
1113
1113
  authorizationCodeExpiration: Date | null;
1114
1114
  }>>;
1115
- emergencyIdentificaiton: import("zod").ZodObject<{
1115
+ oldIdentificaiton: import("zod").ZodObject<{
1116
1116
  identificationType: import("zod").ZodLiteral<"nn">;
1117
1117
  identificationValue: import("zod").ZodString;
1118
1118
  }, "strip", import("zod").ZodTypeAny, {
package/lib/schemas.js CHANGED
@@ -178,9 +178,9 @@ const coverageInfo = zod_1.object({
178
178
  authorizationCode: zod_1.string().nullable(),
179
179
  authorizationCodeExpiration: zod_1.date().nullable(),
180
180
  }).nullable();
181
- const emergencyIdentificaiton = zod_1.object({
181
+ const oldIdentificaiton = zod_1.object({
182
182
  identificationType: zod_1.literal('nn'),
183
- identificationValue: zod_1.string().uuid(),
183
+ identificationValue: zod_1.string(),
184
184
  });
185
185
  exports.doc24Schemas = {
186
186
  identificationType,
@@ -301,5 +301,5 @@ exports.doc24Schemas = {
301
301
  diagnosticaPatient,
302
302
  diagnosticaDeepLinkResponse,
303
303
  coverageInfo,
304
- emergencyIdentificaiton,
304
+ oldIdentificaiton,
305
305
  };
package/lib/test.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const test: () => Promise<import("./types").Doc24.UserSdk>;
1
+ export declare const test: () => Promise<void>;
package/lib/test.js CHANGED
@@ -10,17 +10,36 @@ const test = async () => {
10
10
  key: 'gS2J78V0Zw8XiZJPGC9RS8TlECgqM2TmVtOzNAZbqputgmtc',
11
11
  },
12
12
  });
13
- const userSdk = await baseSdk.getUserInstance({
13
+ const userId = await baseSdk.getUserInstance({
14
14
  firstName: '-',
15
15
  lastName: '-',
16
- birthdate: new Date(),
17
- email: 'nomail@diagnostica.com.ar',
18
- phone: '',
19
- gender: 'm',
20
- identificationValue: '',
21
16
  identificationType: 'nn',
17
+ identificationValue: 'jhYuPe9wu8WmSUroB4tLq8',
18
+ // identificationValue: '6511a9d659bbdfce7385dfda',
22
19
  countryId: 'AR',
20
+ birthdate: new Date('2023-09-25'),
21
+ gender: 'm',
22
+ phone: '',
23
+ email: 'nomail@diagnostica.com.ar',
23
24
  });
24
- return userSdk;
25
+ console.log(userId.userId);
26
+ // const userSdk = await baseSdk.getUserInstance(20892);
27
+ // const res = await userSdk.updatePatient(
28
+ // {
29
+ // identificationType: 'nn',
30
+ // identificationValue: 'jhYuPe9wu8WmSUroB4tLq8',
31
+ // },
32
+ // {
33
+ // firstName: 'Test',
34
+ // lastName: 'Emergency',
35
+ // identificationType: 'dni',
36
+ // identificationValue: '37972512',
37
+ // countryId: 'AR',
38
+ // birthdate: new Date(),
39
+ // gender: 'm',
40
+ // },
41
+ // );
42
+ // console.log(res);
25
43
  };
26
44
  exports.test = test;
45
+ exports.test();
package/lib/types.d.ts CHANGED
@@ -30,7 +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
+ type OldIdentificaiton = TypeOf<typeof doc24Schemas.oldIdentificaiton>;
34
34
  type BaseSdk = {
35
35
  declareUser: (user: User) => Promise<number>;
36
36
  getUserInstance: (user: User | number) => Promise<UserSdk>;
@@ -44,7 +44,7 @@ export declare namespace Doc24 {
44
44
  };
45
45
  type UserSdk = {
46
46
  declarePatient: (patient: Patient) => Promise<number>;
47
- updateEmergencyPatient: (emergencyIdentification: EmergencyIdentificaiton, patient: Patient) => Promise<number>;
47
+ updatePatient: (oldIdentification: OldIdentificaiton, patient: Patient) => Promise<number>;
48
48
  getSpecialties: (mode: SpecialtyMode, language: string) => Promise<Specialty[]>;
49
49
  getScheduleDates: (patientId: number, filter?: ScheduleAvailabilityFilter) => Promise<Date[]>;
50
50
  getSchedule: (patientId: number, specialtyId: number, filter?: ScheduleFilter) => Promise<AvailableAppointment[]>;
@@ -9,7 +9,7 @@ export declare const getPatientMethods: (makeRequest: RequestMaker) => {
9
9
  countryId: string;
10
10
  birthdate: Date;
11
11
  }) => Promise<number>;
12
- updateEmergencyPatient: (emergencyIdentification: {
12
+ updatePatient: (oldIdentification: {
13
13
  identificationType: "nn";
14
14
  identificationValue: string;
15
15
  }, patient: {
@@ -20,5 +20,5 @@ export declare const getPatientMethods: (makeRequest: RequestMaker) => {
20
20
  gender: "m" | "f";
21
21
  countryId: string;
22
22
  birthdate: Date;
23
- }) => Promise<any>;
23
+ }) => Promise<number>;
24
24
  };
@@ -22,7 +22,7 @@ const getPatientMethods = (makeRequest) => {
22
22
  });
23
23
  return response.data.patient_id;
24
24
  };
25
- const updateEmergencyPatient = async (emergencyIdentificaiton, patient) => {
25
+ const updatePatient = async (oldIdentificaiton, patient) => {
26
26
  const mappedPatient = {
27
27
  lastname: patient.lastName,
28
28
  firstname: patient.firstName,
@@ -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
- const response = await makeRequest('POST', '/update-emergency-patient', {
36
- nn_identification_type: emergencyIdentificaiton.identificationType,
37
- nn_identification_value: emergencyIdentificaiton.identificationValue,
34
+ const response = await makeRequest('POST', '/update-patient', {
35
+ old_identification_type: utils_1.getIndetificationTypeId(oldIdentificaiton.identificationType),
36
+ old_identification_value: oldIdentificaiton.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
+ updatePatient: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.oldIdentificaiton, schemas_1.doc24Schemas.patient]), zod_1.number(), updatePatient),
45
44
  };
46
45
  };
47
46
  exports.getPatientMethods = getPatientMethods;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integraciones_doc24/sdk",
3
- "version": "0.38.1",
3
+ "version": "0.39.0",
4
4
  "publishConfig": {
5
5
  "tag": "0.x"
6
6
  },