ndhm-hrp 2.1.36 → 2.1.39
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/classes/discovery.js +15 -14
- package/lib/classes/discovery.js.map +1 -1
- package/lib/classes/link.d.ts +25 -0
- package/lib/classes/link.d.ts.map +1 -1
- package/lib/classes/link.js +39 -0
- package/lib/classes/link.js.map +1 -1
- package/lib/classes/request.d.ts +0 -6
- package/lib/classes/request.d.ts.map +1 -1
- package/lib/classes/request.js +1 -23
- package/lib/classes/request.js.map +1 -1
- package/package.json +1 -1
package/lib/classes/discovery.js
CHANGED
|
@@ -26,8 +26,9 @@ class Discovery extends header_1.default {
|
|
|
26
26
|
this.onDiscovery = (config) => __awaiter(this, void 0, void 0, function* () {
|
|
27
27
|
const headers = this.headers(config.healthId);
|
|
28
28
|
const url = `${this.baseUrl}gateway/v0.5/care-contexts/on-discover`;
|
|
29
|
-
const phrurl =
|
|
30
|
-
|
|
29
|
+
// const phrurl =
|
|
30
|
+
// "https://phrdev.ndhm.gov.in/gateway/v0.5/care-contexts/on-discover";
|
|
31
|
+
// const devurl = `https://webhook.site/2bbc9a81-e5ec-4555-bb83-c211974df004/gateway/v0.5/care-contexts/on-discover`;
|
|
31
32
|
const body = {
|
|
32
33
|
requestId: (0, uuid_1.v4)(),
|
|
33
34
|
timestamp: new Date().toISOString(),
|
|
@@ -48,24 +49,24 @@ class Discovery extends header_1.default {
|
|
|
48
49
|
message: config.errMessage || "Error occured",
|
|
49
50
|
};
|
|
50
51
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
});
|
|
52
|
+
// await new Request().request({
|
|
53
|
+
// headers: headers,
|
|
54
|
+
// method: "POST",
|
|
55
|
+
// requestBody: body,
|
|
56
|
+
// url: phrurl,
|
|
57
|
+
// });
|
|
57
58
|
yield new request_1.default().request({
|
|
58
59
|
headers: headers,
|
|
59
60
|
method: "POST",
|
|
60
61
|
requestBody: body,
|
|
61
62
|
url: url,
|
|
62
63
|
});
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
});
|
|
64
|
+
// await new Request().request({
|
|
65
|
+
// headers: headers,
|
|
66
|
+
// method: "POST",
|
|
67
|
+
// requestBody: body,
|
|
68
|
+
// url: devurl,
|
|
69
|
+
// });
|
|
69
70
|
return body;
|
|
70
71
|
});
|
|
71
72
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.js","sourceRoot":"","sources":["../../src/classes/discovery.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,sDAA8B;AAC9B,+BAAoC;AACpC,wDAAgC;AAEhC,MAAqB,SAAU,SAAQ,gBAAM;IAC3C,YAAY,QAAgB,EAAE,YAAoB;QAChD,KAAK,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QAEhC;;;;WAIG;QACH,gBAAW,GAAG,CAAO,MAUpB,EAAE,EAAE;YACH,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC9C,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,wCAAwC,CAAC;YACpE,
|
|
1
|
+
{"version":3,"file":"discovery.js","sourceRoot":"","sources":["../../src/classes/discovery.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,sDAA8B;AAC9B,+BAAoC;AACpC,wDAAgC;AAEhC,MAAqB,SAAU,SAAQ,gBAAM;IAC3C,YAAY,QAAgB,EAAE,YAAoB;QAChD,KAAK,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QAEhC;;;;WAIG;QACH,gBAAW,GAAG,CAAO,MAUpB,EAAE,EAAE;YACH,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC9C,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,wCAAwC,CAAC;YACpE,iBAAiB;YACjB,yEAAyE;YACzE,qHAAqH;YACrH,MAAM,IAAI,GAAQ;gBAChB,SAAS,EAAE,IAAA,SAAM,GAAE;gBACnB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACnC,aAAa,EAAE,MAAM,CAAC,aAAa;gBACnC,OAAO,EAAE;oBACP,eAAe,EAAE,MAAM,CAAC,sBAAsB;oBAC9C,OAAO,EAAE,MAAM,CAAC,cAAc;oBAC9B,YAAY,EAAE,MAAM,CAAC,YAAY;oBACjC,SAAS,EAAE,MAAM,CAAC,SAAS;iBAC5B;gBAED,IAAI,EAAE;oBACJ,SAAS,EAAE,MAAM,CAAC,SAAS;iBAC5B;aACF,CAAC;YACF,IAAI,MAAM,CAAC,OAAO,EAAE;gBAClB,IAAI,CAAC,KAAK,GAAG;oBACX,IAAI,EAAE,MAAM,CAAC,OAAO;oBACpB,OAAO,EAAE,MAAM,CAAC,UAAU,IAAI,eAAe;iBAC9C,CAAC;aACH;YAED,gCAAgC;YAChC,sBAAsB;YACtB,oBAAoB;YACpB,uBAAuB;YACvB,iBAAiB;YACjB,MAAM;YAEN,MAAM,IAAI,iBAAO,EAAE,CAAC,OAAO,CAAC;gBAC1B,OAAO,EAAE,OAAO;gBAChB,MAAM,EAAE,MAAM;gBACd,WAAW,EAAE,IAAI;gBACjB,GAAG,EAAE,GAAG;aACT,CAAC,CAAC;YAEH,gCAAgC;YAChC,sBAAsB;YACtB,oBAAoB;YACpB,uBAAuB;YACvB,iBAAiB;YACjB,MAAM;YAEN,OAAO,IAAI,CAAC;QACd,CAAC,CAAA,CAAC;IAlEF,CAAC;CAmEF;AAtED,4BAsEC"}
|
package/lib/classes/link.d.ts
CHANGED
|
@@ -29,6 +29,31 @@ export default class Link extends Header {
|
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
31
|
}>;
|
|
32
|
+
/**
|
|
33
|
+
* Result of patient care-context link request from HIP end. This happens in context of previous discovery of patient found at HIP end, therefore the link requests ought to be in reference to the patient reference and care-context references previously returned by the HIP. The correlation of discovery and link request is maintained through the transactionId. HIP should have
|
|
34
|
+
* @param config
|
|
35
|
+
*
|
|
36
|
+
* Validated transactionId in the request to check whether there was a discovery done previously, and the link request corresponds to returned patient care care context references
|
|
37
|
+
Before returning the response, HIP should have sent an authentication request to the patient(eg: OTP verification)
|
|
38
|
+
HIP should communicate the mode of authentication of a successful request
|
|
39
|
+
HIP subsequently should expect the token passed via /link/confirm against the link.referenceNumber passed in this call
|
|
40
|
+
The error section in the body, represents the potential errors that may have occurred. Possible reasons:
|
|
41
|
+
|
|
42
|
+
Patient reference number is invalid
|
|
43
|
+
Care context reference numbers are invalid
|
|
44
|
+
*/
|
|
45
|
+
onInit: (config: {
|
|
46
|
+
healthId: string;
|
|
47
|
+
transactionId: string;
|
|
48
|
+
referenceNumber: string;
|
|
49
|
+
communicationHint: string;
|
|
50
|
+
communicationExpiry?: string;
|
|
51
|
+
requestId: string;
|
|
52
|
+
error?: {
|
|
53
|
+
code: number;
|
|
54
|
+
message: string;
|
|
55
|
+
};
|
|
56
|
+
}) => Promise<any>;
|
|
32
57
|
/**
|
|
33
58
|
*This API is called by HIP only when there is new health data is added/created for a patient and under a care context that is already linked with patient's Health Account. HIP can send following things in this API to notify the Consent Manager about the new health data added:
|
|
34
59
|
* @param config
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/classes/link.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,aAAK,QAAQ,GACT,gBAAgB,GAChB,kBAAkB,GAClB,cAAc,GACd,oBAAoB,GACpB,kBAAkB,GAClB,sBAAsB,GACtB,gBAAgB,CAAC;AAErB,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,MAAM;gBAC1B,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAIlD;;;;OAIG;IACH,UAAU,WAA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ACjB,gBAAgB,EAAE,GAAG,CAAC;QACtB,oBAAoB,EAAE,GAAG,CAAC;QAC1B,OAAO,EAAE,QAAQ,EAAE,CAAC;QACpB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;KACf;;;;;;;;;;;;;;;;;OA8BC;CACH"}
|
package/lib/classes/link.js
CHANGED
|
@@ -51,6 +51,45 @@ class Link extends header_1.default {
|
|
|
51
51
|
});
|
|
52
52
|
return body;
|
|
53
53
|
});
|
|
54
|
+
/**
|
|
55
|
+
* Result of patient care-context link request from HIP end. This happens in context of previous discovery of patient found at HIP end, therefore the link requests ought to be in reference to the patient reference and care-context references previously returned by the HIP. The correlation of discovery and link request is maintained through the transactionId. HIP should have
|
|
56
|
+
* @param config
|
|
57
|
+
*
|
|
58
|
+
* Validated transactionId in the request to check whether there was a discovery done previously, and the link request corresponds to returned patient care care context references
|
|
59
|
+
Before returning the response, HIP should have sent an authentication request to the patient(eg: OTP verification)
|
|
60
|
+
HIP should communicate the mode of authentication of a successful request
|
|
61
|
+
HIP subsequently should expect the token passed via /link/confirm against the link.referenceNumber passed in this call
|
|
62
|
+
The error section in the body, represents the potential errors that may have occurred. Possible reasons:
|
|
63
|
+
|
|
64
|
+
Patient reference number is invalid
|
|
65
|
+
Care context reference numbers are invalid
|
|
66
|
+
*/
|
|
67
|
+
this.onInit = (config) => __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
const headers = this.headers(config.healthId);
|
|
69
|
+
const url = `${this.baseUrl}gateway/v0.5/links/link/on-init`;
|
|
70
|
+
const body = {
|
|
71
|
+
requestId: (0, uuid_1.v4)(),
|
|
72
|
+
timestamp: new Date().toISOString(),
|
|
73
|
+
transactionId: config.transactionId,
|
|
74
|
+
link: {
|
|
75
|
+
referenceNumber: config.referenceNumber,
|
|
76
|
+
authenticationType: "DIRECT",
|
|
77
|
+
meta: {
|
|
78
|
+
communicationMedium: "MOBILE",
|
|
79
|
+
communicationHint: config.communicationHint,
|
|
80
|
+
communicationExpiry: config.communicationExpiry ||
|
|
81
|
+
new Date(new Date().getTime() + 10 * 60000).toISOString(),
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
resp: {
|
|
85
|
+
requestId: config.requestId,
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
if (config.error) {
|
|
89
|
+
body.error = config.error;
|
|
90
|
+
}
|
|
91
|
+
return body;
|
|
92
|
+
});
|
|
54
93
|
/**
|
|
55
94
|
*This API is called by HIP only when there is new health data is added/created for a patient and under a care context that is already linked with patient's Health Account. HIP can send following things in this API to notify the Consent Manager about the new health data added:
|
|
56
95
|
* @param config
|
package/lib/classes/link.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.js","sourceRoot":"","sources":["../../src/classes/link.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+BAAoC;AACpC,wDAAgC;AAChC,sDAA8B;AAW9B,MAAqB,IAAK,SAAQ,gBAAM;IACtC,YAAY,QAAgB,EAAE,YAAoB;QAChD,KAAK,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QAGhC;;;;WAIG;QACH,eAAU,GAAG,CAAO,MAOnB,EAAE,EAAE;YACH,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC9C,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,sCAAsC,CAAC;YAClE,MAAM,IAAI,GAAG;gBACX,SAAS,EAAE,IAAA,SAAM,GAAE;gBACnB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACnC,IAAI,EAAE;oBACJ,WAAW,EAAE,MAAM,CAAC,sBAAsB;oBAC1C,OAAO,EAAE;wBACP,eAAe,EAAE,MAAM,CAAC,SAAS;wBACjC,OAAO,EAAE,MAAM,CAAC,cAAc;wBAC9B,YAAY,EAAE;4BACZ;gCACE,eAAe,EAAE,MAAM,CAAC,aAAa;gCACrC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,CAAC,OAAO,mCAAmC,CAAC;YAC/D,MAAM,IAAI,GAAG;gBACX,SAAS,EAAE,IAAA,SAAM,GAAE;gBACnB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACnC,YAAY,EAAE;oBACZ,OAAO,EAAE;wBACP,EAAE,EAAE,MAAM,CAAC,QAAQ;qBACpB;oBACD,WAAW,EAAE;wBACX,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;wBACzC,oBAAoB,EAAE,MAAM,CAAC,oBAAoB;qBAClD;oBACD,OAAO,EAAE,MAAM,CAAC,OAAO;oBACvB,IAAI,EAAE,MAAM,CAAC,IAAI;oBACjB,GAAG,EAAE;wBACH,EAAE,EAAE,MAAM,CAAC,KAAK;qBACjB;iBACF;aACF,CAAC;YAEF,MAAM,IAAI,iBAAO,EAAE,CAAC,OAAO,CAAC;gBAC1B,OAAO,EAAE,OAAO;gBAChB,MAAM,EAAE,MAAM;gBACd,WAAW,EAAE,IAAI;gBACjB,GAAG,EAAE,GAAG;aACT,CAAC,CAAC;YAEH,OAAO,IAAI,CAAC;QACd,CAAC,CAAA,CAAC;IAlJF,CAAC;CAmJF;AAtJD,uBAsJC"}
|
package/lib/classes/request.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/classes/request.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/classes/request.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,OAAO,OAAO,OAAO;IACpB,OAAO,CAAC,MAAM,EAAE;QACpB,OAAO,EAAE,GAAG,CAAC;QACb,WAAW,EAAE,GAAG,CAAC;QACjB,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;KACrD,GAAG,OAAO,CAAC,GAAG,CAAC;CAqBjB"}
|
package/lib/classes/request.js
CHANGED
|
@@ -12,10 +12,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const axios_1 = __importDefault(require("axios"));
|
|
16
15
|
const request_1 = __importDefault(require("request"));
|
|
17
16
|
class Request {
|
|
18
|
-
|
|
17
|
+
request(config) {
|
|
19
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20
19
|
const body = JSON.stringify(config.requestBody);
|
|
21
20
|
return new Promise((resolve, reject) => {
|
|
@@ -35,27 +34,6 @@ class Request {
|
|
|
35
34
|
});
|
|
36
35
|
});
|
|
37
36
|
}
|
|
38
|
-
request(config) {
|
|
39
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
const body = JSON.stringify(config.requestBody);
|
|
41
|
-
return new Promise((resolve, reject) => {
|
|
42
|
-
(0, axios_1.default)({
|
|
43
|
-
method: config.method,
|
|
44
|
-
headers: config.headers,
|
|
45
|
-
url: config.url,
|
|
46
|
-
data: body,
|
|
47
|
-
})
|
|
48
|
-
.then((res) => {
|
|
49
|
-
console.log(res.data);
|
|
50
|
-
resolve(res.data);
|
|
51
|
-
})
|
|
52
|
-
.catch((err) => {
|
|
53
|
-
console.log(err);
|
|
54
|
-
reject(err);
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
37
|
}
|
|
60
38
|
exports.default = Request;
|
|
61
39
|
//# sourceMappingURL=request.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/classes/request.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/classes/request.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,sDAA8B;AAC9B,MAAqB,OAAO;IACpB,OAAO,CAAC,MAKb;;YACC,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;YAEhD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBACrC,IAAA,iBAAO,EACL;oBACE,OAAO,EAAE,MAAM,CAAC,OAAO;oBACvB,IAAI,EAAE,IAAI;oBACV,GAAG,EAAE,MAAM,CAAC,GAAG;oBACf,MAAM,EAAE,MAAM,CAAC,MAAM;iBACtB,EACD,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;oBACX,IAAI,GAAG,EAAE;wBACP,MAAM,CAAC,GAAG,CAAC,CAAC;qBACb;yBAAM;wBACL,OAAO,CAAC,GAAG,CAAC,CAAC;qBACd;gBACH,CAAC,CACF,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;KAAA;CACF;AA3BD,0BA2BC"}
|