@phenyxhealth/sdk 1.0.5 → 1.0.7
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/README.md +8 -8
- package/package.json +1 -1
- package/src/controllers/doctors.js +1 -1
- package/src/controllers/global.js +2 -2
- package/src/controllers/linacs.js +1 -1
- package/src/index.js +3 -3
- package/types/index.d.ts +10 -9
package/README.md
CHANGED
|
@@ -14,9 +14,9 @@ npm install @phenyxhealth/sdk
|
|
|
14
14
|
## Inicio Rápido
|
|
15
15
|
|
|
16
16
|
```javascript
|
|
17
|
-
import {
|
|
17
|
+
import { PhenyxSDK } from "@phenyxhealth/sdk";
|
|
18
18
|
|
|
19
|
-
const api = new
|
|
19
|
+
const api = new PhenyxSDK();
|
|
20
20
|
|
|
21
21
|
// Autenticación
|
|
22
22
|
await api.login({
|
|
@@ -300,14 +300,14 @@ const token = api.getToken(); // Obtiene el token JWT actual
|
|
|
300
300
|
|
|
301
301
|
```javascript
|
|
302
302
|
import {
|
|
303
|
-
|
|
303
|
+
PhenyxSDK,
|
|
304
304
|
beSureDoctorExists,
|
|
305
305
|
beSureLinacsExists,
|
|
306
306
|
checkGlobals,
|
|
307
307
|
} from "@phenyxhealth/sdk";
|
|
308
308
|
|
|
309
309
|
const setupClinic = async () => {
|
|
310
|
-
const api = new
|
|
310
|
+
const api = new PhenyxSDK();
|
|
311
311
|
|
|
312
312
|
// Autenticación
|
|
313
313
|
await api.login({
|
|
@@ -341,10 +341,10 @@ setupClinic();
|
|
|
341
341
|
### Ejemplo 2: Crear y Procesar Paciente
|
|
342
342
|
|
|
343
343
|
```javascript
|
|
344
|
-
import {
|
|
344
|
+
import { PhenyxSDK, today } from "@phenyxhealth/sdk";
|
|
345
345
|
|
|
346
346
|
const processPatient = async () => {
|
|
347
|
-
const api = new
|
|
347
|
+
const api = new PhenyxSDK();
|
|
348
348
|
await api.login({
|
|
349
349
|
/* credentials */
|
|
350
350
|
});
|
|
@@ -400,9 +400,9 @@ try {
|
|
|
400
400
|
El SDK incluye definiciones TypeScript completas:
|
|
401
401
|
|
|
402
402
|
```typescript
|
|
403
|
-
import {
|
|
403
|
+
import { PhenyxSDK, PatientData, HumanResourceData } from "@phenyxhealth/sdk";
|
|
404
404
|
|
|
405
|
-
const api:
|
|
405
|
+
const api: PhenyxSDK = new PhenyxSDK();
|
|
406
406
|
|
|
407
407
|
const patient: PatientData = await api.getPatient("id");
|
|
408
408
|
const doctors: HumanResourceData[] = await api.getHumanResources();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phenyxhealth/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "SDK oficial para PhenyxHealth - Sistema integral de gestión de radioterapia. Incluye gestión de pacientes, recursos humanos, equipos médicos y configuración global.",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Valida que los médicos especificados existan en el sistema
|
|
3
3
|
* Si no existen, los crea automáticamente
|
|
4
|
-
* @param {
|
|
4
|
+
* @param {PhenyxSDK} apiInstance - Instancia autenticada de PhenyxSDK
|
|
5
5
|
* @param {Array} toBe - Array de objetos médico con {name, hrGroup}
|
|
6
6
|
* @param {string} toBe[].name - Nombre del médico
|
|
7
7
|
* @param {string} toBe[].hrGroup - Grupo de recursos humanos ('RadOnc' o 'MedPhys')
|
|
@@ -3,7 +3,7 @@ import { getContrastingColor } from '../utils/colors.js';
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Valida que los valores globales especificados existan en el sistema
|
|
6
|
-
* @param {
|
|
6
|
+
* @param {PhenyxSDK} apiInstance - Instancia autenticada de PhenyxSDK
|
|
7
7
|
* @param {Object} mustBe - Configuración global requerida
|
|
8
8
|
* @param {string} mustBe.name - Nombre del tipo global
|
|
9
9
|
* @param {Object} [mustBe.values={}] - Valores que deben existir
|
|
@@ -43,7 +43,7 @@ const checkGlobals = async (apiInstance, mustBe, extraValues = []) => {
|
|
|
43
43
|
/**
|
|
44
44
|
* Asegura que elementos específicos existan en una lista global
|
|
45
45
|
* Si no existen, los crea automáticamente
|
|
46
|
-
* @param {
|
|
46
|
+
* @param {PhenyxSDK} apiInstance - Instancia autenticada de PhenyxSDK
|
|
47
47
|
* @param {Object} currentList - Lista global actual
|
|
48
48
|
* @param {string} currentList.id - ID de la lista global
|
|
49
49
|
* @param {string} currentList.name - Nombre de la lista global
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Valida que los LINACs especificados existan en el sistema
|
|
3
3
|
* Si no existen, los crea automáticamente
|
|
4
|
-
* @param {
|
|
4
|
+
* @param {PhenyxSDK} apiInstance - Instancia autenticada de PhenyxSDK
|
|
5
5
|
* @param {Array<string>} toBe - Array con nombres de LINACs que deben existir
|
|
6
6
|
* @returns {Promise<Array>} Lista actualizada de LINACs
|
|
7
7
|
* @example
|
package/src/index.js
CHANGED
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
12
|
* // Importar las funciones principales
|
|
13
|
-
* import {
|
|
13
|
+
* import { PhenyxSDK, beSureDoctorExists, today } from '@phenyxhealth/sdk';
|
|
14
14
|
*
|
|
15
15
|
* // Crear instancia y autenticar
|
|
16
|
-
* const api = new
|
|
16
|
+
* const api = new PhenyxSDK();
|
|
17
17
|
* await api.login({
|
|
18
18
|
* apiHost: 'https://demo.phenyxhealth.com',
|
|
19
19
|
* user: 'admin',
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
29
|
// Exportaciones principales
|
|
30
|
-
export { default as
|
|
30
|
+
export { default as PhenyxSDK } from './PhenyxApi.js';
|
|
31
31
|
|
|
32
32
|
// Controladores de validación
|
|
33
33
|
export { checkGlobals, beSureGlobalExists } from './controllers/global.js';
|
package/types/index.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ declare module "@phenyxhealth/sdk" {
|
|
|
37
37
|
birthDate: string;
|
|
38
38
|
sendingDepartmentId?: string;
|
|
39
39
|
cei9Id?: string;
|
|
40
|
+
cei10Id?: string;
|
|
40
41
|
[key: string]: any;
|
|
41
42
|
}
|
|
42
43
|
|
|
@@ -221,7 +222,6 @@ declare module "@phenyxhealth/sdk" {
|
|
|
221
222
|
sendingDepartment: GlobalType;
|
|
222
223
|
cei9: GlobalType;
|
|
223
224
|
cei10: GlobalType;
|
|
224
|
-
cei10: GlobalType;
|
|
225
225
|
treatmentClass: GlobalType;
|
|
226
226
|
treatmentSubClass: GlobalType;
|
|
227
227
|
treatmentTechnique: GlobalType;
|
|
@@ -494,54 +494,55 @@ declare module "@phenyxhealth/sdk" {
|
|
|
494
494
|
|
|
495
495
|
/**
|
|
496
496
|
* Valida que los médicos existan en el sistema, los crea si no existen
|
|
497
|
-
* @param apiInstance Instancia de
|
|
497
|
+
* @param apiInstance Instancia de PhenyxSDK autenticada
|
|
498
498
|
* @param toBe Array de médicos a validar
|
|
499
499
|
* @returns Promise con array de recursos humanos actualizados
|
|
500
500
|
*/
|
|
501
501
|
export function beSureDoctorExists(
|
|
502
|
-
apiInstance:
|
|
502
|
+
apiInstance: PhenyxSDK,
|
|
503
503
|
toBe: DoctorValidation[],
|
|
504
504
|
): Promise<HumanResourceData[]>;
|
|
505
505
|
|
|
506
506
|
/**
|
|
507
507
|
* Valida que los LINACs existan en el sistema, los crea si no existen
|
|
508
|
-
* @param apiInstance Instancia de
|
|
508
|
+
* @param apiInstance Instancia de PhenyxSDK autenticada
|
|
509
509
|
* @param toBe Array de nombres de LINACs
|
|
510
510
|
* @returns Promise con array de LINACs actualizados
|
|
511
511
|
*/
|
|
512
512
|
export function beSureLinacsExists(
|
|
513
|
-
apiInstance:
|
|
513
|
+
apiInstance: PhenyxSDK,
|
|
514
514
|
toBe: string[],
|
|
515
515
|
): Promise<ResourceData[]>;
|
|
516
516
|
|
|
517
517
|
/**
|
|
518
518
|
* Valida información global, añade valores faltantes
|
|
519
|
-
* @param apiInstance Instancia de
|
|
519
|
+
* @param apiInstance Instancia de PhenyxSDK autenticada
|
|
520
520
|
* @param mustBe Configuración global requerida
|
|
521
521
|
* @param extraValues Valores adicionales opcionales
|
|
522
522
|
* @returns Promise que resuelve cuando se valida
|
|
523
523
|
*/
|
|
524
524
|
export function checkGlobals(
|
|
525
|
-
apiInstance:
|
|
525
|
+
apiInstance: PhenyxSDK,
|
|
526
526
|
mustBe: GlobalType,
|
|
527
527
|
extraValues?: string[],
|
|
528
528
|
): Promise<void>;
|
|
529
529
|
|
|
530
530
|
/**
|
|
531
531
|
* Asegura que elementos globales existan
|
|
532
|
-
* @param apiInstance Instancia de
|
|
532
|
+
* @param apiInstance Instancia de PhenyxSDK autenticada
|
|
533
533
|
* @param currentList Lista actual de elementos
|
|
534
534
|
* @param toBeList Lista de elementos que deben existir
|
|
535
535
|
* @returns Promise que resuelve cuando se valida
|
|
536
536
|
*/
|
|
537
537
|
export function beSureGlobalExists(
|
|
538
|
-
apiInstance:
|
|
538
|
+
apiInstance: PhenyxSDK,
|
|
539
539
|
currentList: GlobalInfo,
|
|
540
540
|
toBeList: string[],
|
|
541
541
|
): Promise<void>;
|
|
542
542
|
|
|
543
543
|
// ==================== EXPORT DEFAULT ====================
|
|
544
544
|
|
|
545
|
+
export { PhenyxApi as PhenyxSDK };
|
|
545
546
|
export default PhenyxApi;
|
|
546
547
|
}
|
|
547
548
|
|