generio-sdk 1.0.2

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 ADDED
@@ -0,0 +1,3 @@
1
+ # generio-sdk
2
+
3
+ SDK library for Generio.
@@ -0,0 +1,99 @@
1
+ //#region src/models/RecognizeExaminationInputModel.d.ts
2
+ interface RecognizeExaminationInputModel {
3
+ modality: string;
4
+ studyDescription?: string;
5
+ bodyPartExamined?: string;
6
+ }
7
+ //#endregion
8
+ //#region src/models/RecognizeExaminationOutputModel.d.ts
9
+ interface RecognizeExaminationOutputModel {
10
+ isSuccess: boolean;
11
+ examinationElementId?: number;
12
+ sectionId?: number;
13
+ url?: string;
14
+ }
15
+ //#endregion
16
+ //#region src/models/SetExtParamsInputModel.d.ts
17
+ interface SetExtParamsInputModel {
18
+ keyValues: KeyValueModel[];
19
+ }
20
+ interface KeyValueModel {
21
+ key: string;
22
+ value: string;
23
+ }
24
+ //#endregion
25
+ //#region src/models/SetExtParamsOutputModel.d.ts
26
+ interface SetExtParamsOutputModel {
27
+ isSuccess: boolean;
28
+ message: string;
29
+ }
30
+ //#endregion
31
+ //#region src/models/SendMeasurementsOutputModel.d.ts
32
+ interface SendMeasurementsOutputModel {}
33
+ //#endregion
34
+ //#region src/models/SendMeasurementsInputModel.d.ts
35
+ interface SendMeasurementsInputModel {
36
+ measurements: MeasurementModel[];
37
+ }
38
+ interface MeasurementModel {
39
+ value: string;
40
+ unit: string;
41
+ tool: string;
42
+ objectId?: string;
43
+ sopInstanceUId?: string;
44
+ seriesInstanceUId?: string;
45
+ seriesNumber?: string;
46
+ instanceNumber?: string;
47
+ }
48
+ //#endregion
49
+ //#region src/models/GetExtParamValueByStudyInstanceUIdInputModel.d.ts
50
+ interface GetExtParamValueByStudyInstanceUIdInputModel {
51
+ studyInstanceUId: string;
52
+ extParam: string;
53
+ }
54
+ //#endregion
55
+ //#region src/models/GetExtParamValueByStudyInstanceUIdOutputModel.d.ts
56
+ interface GetExtParamValueByStudyInstanceUIdOutputModel {
57
+ examinationId: number;
58
+ studyInstanceUId: string;
59
+ extParam: string;
60
+ value: string;
61
+ }
62
+ //#endregion
63
+ //#region src/models/GetExaminationMessageOutputModel.d.ts
64
+ interface GetExaminationMessageOutputModel {
65
+ examinationMessage: string;
66
+ }
67
+ //#endregion
68
+ //#region src/models/SignInInputModel.d.ts
69
+ interface SignInInputModel {
70
+ email: string;
71
+ password: string;
72
+ }
73
+ //#endregion
74
+ //#region src/models/SignInOutputModel.d.ts
75
+ interface SignInOutputModel {
76
+ isSuccess: boolean;
77
+ message?: string;
78
+ }
79
+ //#endregion
80
+ //#region src/index.d.ts
81
+ type HandlerType = (event: {
82
+ source: Window | null;
83
+ origin: string;
84
+ data: any;
85
+ }) => Promise<void>;
86
+ declare const GENERIO_ORIGIN = "https://gener.io";
87
+ declare function recognizeExamination(model: RecognizeExaminationInputModel, win: Window): Promise<RecognizeExaminationOutputModel>;
88
+ declare function setExtParams(model: SetExtParamsInputModel, win: Window): Promise<SetExtParamsOutputModel>;
89
+ declare function sendMeasurements(model: SendMeasurementsInputModel, win: Window): Promise<SendMeasurementsOutputModel>;
90
+ declare function getExtParamValueByStudyInstanceUId(model: GetExtParamValueByStudyInstanceUIdInputModel, win: Window): Promise<GetExtParamValueByStudyInstanceUIdOutputModel>;
91
+ declare function getExaminationMessage(win: Window): Promise<GetExaminationMessageOutputModel>;
92
+ declare function signIn(model: SignInInputModel): Promise<SignInOutputModel>;
93
+ declare function isSignedIn(): Promise<boolean>;
94
+ declare function signOut(): void;
95
+ declare function getUserEmail(): string | null;
96
+ declare function setupGenerioReadyListener(handler: HandlerType): void;
97
+ declare const generioReadyHandler: HandlerType;
98
+ //#endregion
99
+ export { GENERIO_ORIGIN, GetExaminationMessageOutputModel, GetExtParamValueByStudyInstanceUIdInputModel, GetExtParamValueByStudyInstanceUIdOutputModel, KeyValueModel, MeasurementModel, RecognizeExaminationInputModel, RecognizeExaminationOutputModel, SendMeasurementsInputModel, SendMeasurementsOutputModel, SetExtParamsInputModel, SetExtParamsOutputModel, SignInInputModel, SignInOutputModel, generioReadyHandler, getExaminationMessage, getExtParamValueByStudyInstanceUId, getUserEmail, isSignedIn, recognizeExamination, sendMeasurements, setExtParams, setupGenerioReadyListener, signIn, signOut };
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ import e from"post-robot";const t=`https://gener.io`;async function n(n,r){let{data:i}=await e.send(r,`recognizeExamination`,n,{domain:t});return i}async function r(n,r){let{data:i}=await e.send(r,`setExtParams`,n,{domain:t});return i}async function i(n,r){let{data:i}=await e.send(r,`sendMeasurements`,n,{domain:t});return i}async function a(n,r){let{data:i}=await e.send(r,`getExtParamValueByStudyInstanceUId`,n,{domain:t});return i}async function o(n){let{data:r}=await e.send(n,`getExaminationMessage`,void 0,{domain:t});return r}async function s(e){let t=await fetch(`https://gener.io/api/cookiesAuth/signIn`,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`},body:JSON.stringify({email:e.email,password:e.password})});return t.ok?(localStorage.setItem(`generio-signed-in`,`true`),localStorage.setItem(`generio-user-email`,e.email),{isSuccess:!0}):{isSuccess:!1,message:`Sign in failed with status ${t.status}`}}async function c(){return localStorage.getItem(`generio-signed-in`)===`true`&&localStorage.getItem(`generio-user-email`)!==null}function l(){localStorage.removeItem(`generio-signed-in`),localStorage.removeItem(`generio-user-email`)}function u(){return localStorage.getItem(`generio-user-email`)}function d(n){e.on(`generioReady`,{domain:t},e=>n(e))}const f=async({source:e,origin:t,data:n})=>{console.log(`Generio is ready:`,t,n),await r({keyValues:[{key:`mr_protocol`,value:`mr_protocol test`}]},e)};export{t as GENERIO_ORIGIN,f as generioReadyHandler,o as getExaminationMessage,a as getExtParamValueByStudyInstanceUId,u as getUserEmail,c as isSignedIn,n as recognizeExamination,i as sendMeasurements,r as setExtParams,d as setupGenerioReadyListener,s as signIn,l as signOut};
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "generio-sdk",
3
+ "version": "1.0.2",
4
+ "description": "SDK library for generio integration",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "keywords": [
8
+ "generio",
9
+ "sdk",
10
+ "models",
11
+ "post-robot"
12
+ ],
13
+ "homepage": "https://gener.io",
14
+ "bugs": {
15
+ "url": "https://github.com/author/library/issues"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/author/library.git"
20
+ },
21
+ "author": "Štefan Varga <stefan.varga@gener.io>",
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "main": "./dist/index.js",
26
+ "module": "./dist/index.js",
27
+ "types": "./dist/index.d.ts",
28
+ "exports": {
29
+ ".": "./dist/index.js",
30
+ "./package.json": "./package.json"
31
+ },
32
+ "scripts": {
33
+ "build": "tsdown",
34
+ "dev": "tsdown --watch",
35
+ "test": "vitest",
36
+ "typecheck": "tsc --noEmit"
37
+ },
38
+ "devDependencies": {
39
+ "@types/node": "^24.9.1",
40
+ "@types/post-robot": "^10.0.6",
41
+ "bumpp": "^10.3.1",
42
+ "tsdown": "^0.15.11",
43
+ "typescript": "^5.9.3",
44
+ "vitest": "^4.0.4"
45
+ },
46
+ "dependencies": {
47
+ "post-robot": "^8.0.32"
48
+ }
49
+ }