ndhm-hrp 2.0.4 → 2.1.3
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/config.d.ts +9 -0
- package/lib/classes/config.d.ts.map +1 -0
- package/lib/classes/config.js +9 -0
- package/lib/classes/config.js.map +1 -0
- package/lib/classes/discovery.d.ts +1 -1
- package/lib/classes/discovery.d.ts.map +1 -1
- package/lib/classes/discovery.js +4 -4
- package/lib/classes/discovery.js.map +1 -1
- package/lib/classes/header.d.ts +42 -4
- package/lib/classes/header.d.ts.map +1 -1
- package/lib/classes/header.js +58 -4
- package/lib/classes/header.js.map +1 -1
- package/lib/classes/link.d.ts +43 -1
- package/lib/classes/link.d.ts.map +1 -1
- package/lib/classes/link.js +44 -3
- package/lib/classes/link.js.map +1 -1
- package/lib/classes/register.d.ts +7 -1
- package/lib/classes/register.d.ts.map +1 -1
- package/lib/classes/register.js +12 -0
- package/lib/classes/register.js.map +1 -1
- package/lib/classes/userAuth.d.ts +6 -3
- package/lib/classes/userAuth.d.ts.map +1 -1
- package/lib/classes/userAuth.js +7 -9
- package/lib/classes/userAuth.js.map +1 -1
- package/package.json +2 -2
- package/lib/classes/patient.d.ts +0 -27
- package/lib/classes/patient.d.ts.map +0 -1
- package/lib/classes/patient.js +0 -83
- package/lib/classes/patient.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/classes/config.ts"],"names":[],"mappings":"AACI,QAAA,MAAM,OAAO;;;;;;EAGH,CAAA;AAGV,OAAQ,EAAC,OAAO,EAAC,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.X_CM_ID = void 0;
|
|
4
|
+
const X_CM_ID = [
|
|
5
|
+
{ "id": "sbx", "url": "https://dev.abdm.gov.in/" },
|
|
6
|
+
{ "id": "ndhm", "url": "https://dev.abdm.gov.in/" }
|
|
7
|
+
];
|
|
8
|
+
exports.X_CM_ID = X_CM_ID;
|
|
9
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/classes/config.ts"],"names":[],"mappings":";;;AACI,MAAM,OAAO,GAAG;IACZ,EAAC,IAAI,EAAG,KAAK,EAAE,KAAK,EAAG,0BAA0B,EAAC;IAClD,EAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,0BAA0B,EAAC;CAC3C,CAAA;AAGD,0BAAO"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Header from "./header";
|
|
2
2
|
export default class Discovery extends Header {
|
|
3
|
-
constructor(_baseUrl: string, _accessToken: string
|
|
3
|
+
constructor(_baseUrl: string, _accessToken: string);
|
|
4
4
|
onDiscovery: (config: {
|
|
5
5
|
transactionId: string;
|
|
6
6
|
patientReferenceNumber: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../src/classes/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAC;AAI9B,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,MAAM;
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../src/classes/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAC;AAI9B,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,MAAM;gBAC/B,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAIlD,WAAW,WAAkB;QAC3B,aAAa,EAAE,MAAM,CAAC;QACtB,sBAAsB,EAAE,MAAM,CAAC;QAC/B,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE;YAAE,iBAAiB,EAAE,MAAM,CAAC;YAAC,SAAS,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QACjE,SAAS,EAAE,MAAM,EAAE,CAAA;QACnB,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAA;KAClB;;;;;;;;iCALoC,MAAM;yBAAa,MAAM;;;;;;;;;;;OAkC7D;CAEF"}
|
package/lib/classes/discovery.js
CHANGED
|
@@ -16,8 +16,8 @@ const header_1 = __importDefault(require("./header"));
|
|
|
16
16
|
const uuid_1 = require("uuid");
|
|
17
17
|
const request_1 = __importDefault(require("./request"));
|
|
18
18
|
class Discovery extends header_1.default {
|
|
19
|
-
constructor(_baseUrl, _accessToken
|
|
20
|
-
super(_baseUrl, _accessToken
|
|
19
|
+
constructor(_baseUrl, _accessToken) {
|
|
20
|
+
super(_baseUrl, _accessToken);
|
|
21
21
|
this.onDiscovery = (config) => __awaiter(this, void 0, void 0, function* () {
|
|
22
22
|
const url = `${this.baseUrl}gateway/v0.5/care-contexts/on-discover`;
|
|
23
23
|
const body = {
|
|
@@ -35,11 +35,11 @@ class Discovery extends header_1.default {
|
|
|
35
35
|
"message": config.errMessage
|
|
36
36
|
},
|
|
37
37
|
"resp": {
|
|
38
|
-
"requestId":
|
|
38
|
+
"requestId": config.requestId
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
yield new request_1.default().request({
|
|
42
|
-
"headers": this.headers, "method": "POST", "requestBody": body, "url": url
|
|
42
|
+
"headers": this.headers(config.patientReferenceNumber), "method": "POST", "requestBody": body, "url": url
|
|
43
43
|
});
|
|
44
44
|
return body;
|
|
45
45
|
});
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"discovery.js","sourceRoot":"","sources":["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
* this is request url for gateway consent manger
|
|
4
|
+
*/
|
|
5
|
+
baseUrl: string;
|
|
6
|
+
/**
|
|
7
|
+
* cmid header in request
|
|
8
|
+
*/
|
|
9
|
+
xCmId: string;
|
|
10
|
+
/**
|
|
11
|
+
* actual header object in request
|
|
12
|
+
*/
|
|
13
|
+
private headersObject;
|
|
14
|
+
/**
|
|
15
|
+
* access token form client id and client token
|
|
16
|
+
*/
|
|
3
17
|
protected accessToken: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param baseUrl this is gateway url for sendng request
|
|
21
|
+
* @param _accessToken dervied from cleant is and client secret
|
|
22
|
+
*/
|
|
23
|
+
constructor(baseUrl: string, _accessToken: string);
|
|
24
|
+
/**
|
|
25
|
+
* header is reset from class wide variables set
|
|
26
|
+
* i.e accessToken and xCmId:
|
|
27
|
+
*/
|
|
28
|
+
headers(healthId: string): any;
|
|
29
|
+
/**
|
|
30
|
+
* This sets the cmid from healthid
|
|
31
|
+
* @param healthId healthid with CM id has ro passed
|
|
32
|
+
*/
|
|
33
|
+
setXCmId(healthId: string): void;
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @param cmidmatch the
|
|
37
|
+
*/
|
|
38
|
+
setBaseUrl(cmid: string): void;
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* @returns this tbase url of class
|
|
42
|
+
*/
|
|
43
|
+
getBaseUrl(): string;
|
|
44
|
+
getXCmId(): string;
|
|
7
45
|
}
|
|
8
46
|
//# sourceMappingURL=header.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../src/classes/header.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../src/classes/header.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,OAAO,OAAO,MAAM;IACvB;;OAEG;IACI,OAAO,EAAE,MAAM,CAAK;IAC3B;;OAEG;IACI,KAAK,EAAE,MAAM,CAAK;IAEzB;;OAEG;IACH,OAAO,CAAC,aAAa,CAAG;IACxB;;OAEG;IACH,SAAS,CAAC,WAAW,EAAE,MAAM,CAAC;IAE9B;;;;OAIG;gBACS,OAAO,EAAC,MAAM,EAAE,YAAY,EAAE,MAAM;IAMhD;;;OAGG;IACH,OAAO,CAAE,QAAQ,EAAC,MAAM,GAAE,GAAG;IAW7B;;;OAGG;IACF,QAAQ,CAAC,QAAQ,EAAC,MAAM;IAMzB;;;OAGG;IACF,UAAU,CAAC,IAAI,EAAC,MAAM;IAOvB;;;OAGG;IACH,UAAU,IAAG,MAAM;IAInB,QAAQ,IAAG,MAAM;CAGpB"}
|
package/lib/classes/header.js
CHANGED
|
@@ -1,15 +1,69 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const config_1 = require("./config");
|
|
3
4
|
class Header {
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param baseUrl this is gateway url for sendng request
|
|
8
|
+
* @param _accessToken dervied from cleant is and client secret
|
|
9
|
+
*/
|
|
10
|
+
constructor(baseUrl, _accessToken) {
|
|
11
|
+
/**
|
|
12
|
+
* this is request url for gateway consent manger
|
|
13
|
+
*/
|
|
14
|
+
this.baseUrl = "";
|
|
15
|
+
/**
|
|
16
|
+
* cmid header in request
|
|
17
|
+
*/
|
|
18
|
+
this.xCmId = "";
|
|
19
|
+
/**
|
|
20
|
+
* actual header object in request
|
|
21
|
+
*/
|
|
22
|
+
this.headersObject = {};
|
|
6
23
|
this.accessToken = _accessToken;
|
|
7
|
-
this.
|
|
8
|
-
|
|
24
|
+
this.baseUrl = baseUrl;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* header is reset from class wide variables set
|
|
28
|
+
* i.e accessToken and xCmId:
|
|
29
|
+
*/
|
|
30
|
+
headers(healthId) {
|
|
31
|
+
this.setXCmId(healthId);
|
|
32
|
+
this.setBaseUrl(this.xCmId);
|
|
33
|
+
this.headersObject = {
|
|
9
34
|
"Content-Type": "application/json",
|
|
10
35
|
"Authorization": `Bearer ${this.accessToken}`,
|
|
11
36
|
"X-CM-ID": this.xCmId
|
|
12
37
|
};
|
|
38
|
+
return this.headersObject;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* This sets the cmid from healthid
|
|
42
|
+
* @param healthId healthid with CM id has ro passed
|
|
43
|
+
*/
|
|
44
|
+
setXCmId(healthId) {
|
|
45
|
+
let index = healthId.lastIndexOf("@");
|
|
46
|
+
this.xCmId = healthId.substring(index + 1);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
* @param cmidmatch the
|
|
51
|
+
*/
|
|
52
|
+
setBaseUrl(cmid) {
|
|
53
|
+
let url = config_1.X_CM_ID.filter(el => el.id == cmid)[0].url;
|
|
54
|
+
if (url) {
|
|
55
|
+
this.baseUrl = url;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
*
|
|
60
|
+
* @returns this tbase url of class
|
|
61
|
+
*/
|
|
62
|
+
getBaseUrl() {
|
|
63
|
+
return this.baseUrl;
|
|
64
|
+
}
|
|
65
|
+
getXCmId() {
|
|
66
|
+
return this.xCmId;
|
|
13
67
|
}
|
|
14
68
|
}
|
|
15
69
|
exports.default = Header;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header.js","sourceRoot":"","sources":["../../src/classes/header.ts"],"names":[],"mappings":";;AAAA,MAAqB,MAAM;
|
|
1
|
+
{"version":3,"file":"header.js","sourceRoot":"","sources":["../../src/classes/header.ts"],"names":[],"mappings":";;AAAA,qCAAgC;AAChC,MAAqB,MAAM;IAmBvB;;;;OAIG;IACH,YAAY,OAAc,EAAE,YAAoB;QAvBhD;;WAEG;QACI,YAAO,GAAU,EAAE,CAAC;QAC3B;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
2
|
+
declare type HI_TYPES = "DiagnosticReportRecord" | "DischargeSummaryRecord" | "HealthDocumentRecord" | "ImmunizationRecord" | "OPConsultRecord" | "PrescriptionRecord" | "WellnessRecord";
|
|
2
3
|
export default class Link extends Header {
|
|
3
|
-
constructor(_baseUrl: string, _accessToken: string
|
|
4
|
+
constructor(_baseUrl: string, _accessToken: string);
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param config healthis with Xcmid
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
4
10
|
AddContext: (config: {
|
|
11
|
+
healthId: string;
|
|
5
12
|
careContextAccessToken: string;
|
|
6
13
|
patientId: string;
|
|
7
14
|
patinetDisplay: string;
|
|
@@ -22,5 +29,40 @@ export default class Link extends Header {
|
|
|
22
29
|
};
|
|
23
30
|
};
|
|
24
31
|
}>;
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
* @param config
|
|
35
|
+
* @healthId Patient's Identifier for which the new health data is added (It can be ABDM id or ABDM number)
|
|
36
|
+
* @careContextReference Care Context reference under which the new health data is added
|
|
37
|
+
* @patientReference Patient's reference (An identifier with which the patient is registered on HIP)
|
|
38
|
+
* @hiTypes Types of health information documents that have been added ("DiagnosticReportRecord" | "DischargeSummaryRecord" | "HealthDocumentRecord" | "ImmunizationRecord" | "OPConsultRecord" | "PrescriptionRecord" | "WellnessRecord")
|
|
39
|
+
* @date in iso format at UTC A date when the health information was created/added on the HIP Note: This API shouldn't be called if the new heath data of is added/created under new care context.
|
|
40
|
+
*/
|
|
41
|
+
notify: (config: {
|
|
42
|
+
healthId: string;
|
|
43
|
+
patientReference: any;
|
|
44
|
+
careContextReference: any;
|
|
45
|
+
hiTypes: HI_TYPES[];
|
|
46
|
+
date: string;
|
|
47
|
+
hipId: string;
|
|
48
|
+
}) => Promise<{
|
|
49
|
+
requestId: string;
|
|
50
|
+
timestamp: string;
|
|
51
|
+
notification: {
|
|
52
|
+
patient: {
|
|
53
|
+
id: string;
|
|
54
|
+
};
|
|
55
|
+
careContext: {
|
|
56
|
+
patientReference: any;
|
|
57
|
+
careContextReference: any;
|
|
58
|
+
};
|
|
59
|
+
hiTypes: HI_TYPES[];
|
|
60
|
+
date: string;
|
|
61
|
+
hip: {
|
|
62
|
+
id: string;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
}>;
|
|
25
66
|
}
|
|
67
|
+
export {};
|
|
26
68
|
//# sourceMappingURL=link.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/classes/link.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,MAAM;gBACxB,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/classes/link.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,aAAK,QAAQ,GAAG,wBAAwB,GAAG,wBAAwB,GAAG,sBAAsB,GAAG,oBAAoB,GAAG,iBAAiB,GAAG,oBAAoB,GAAG,gBAAgB,CAAA;AAEjL,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,MAAM;gBACxB,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAIlD;;;;OAIG;IACH,UAAU,WAAkB;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,sBAAsB,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAC;QAAC,kBAAkB,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;;;OA6B7K;IACD;;;;;;;;OAQG;IAEH,MAAM,WAAkB;QACpB,QAAQ,EAAE,MAAM,CAAC;QAAC,gBAAgB,EAAE,GAAG,CAAC;QAAC,oBAAoB,EAAE,GAAG,CAAC;QAAC,OAAO,EAAE,QAAQ,EAAE,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KACvH;;;;;;;;;;;;;;;;;OA8BA;CAGJ"}
|
package/lib/classes/link.js
CHANGED
|
@@ -16,9 +16,15 @@ const uuid_1 = require("uuid");
|
|
|
16
16
|
const request_1 = __importDefault(require("./request"));
|
|
17
17
|
const header_1 = __importDefault(require("./header"));
|
|
18
18
|
class Link extends header_1.default {
|
|
19
|
-
constructor(_baseUrl, _accessToken
|
|
20
|
-
super(_baseUrl, _accessToken
|
|
19
|
+
constructor(_baseUrl, _accessToken) {
|
|
20
|
+
super(_baseUrl, _accessToken);
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @param config healthis with Xcmid
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
21
26
|
this.AddContext = (config) => __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const headers = this.headers(config.healthId);
|
|
22
28
|
const url = `${this.baseUrl}gateway/v0.5/links/link/add-contexts`;
|
|
23
29
|
const body = {
|
|
24
30
|
"requestId": (0, uuid_1.v4)(),
|
|
@@ -38,7 +44,42 @@ class Link extends header_1.default {
|
|
|
38
44
|
}
|
|
39
45
|
};
|
|
40
46
|
yield new request_1.default().request({
|
|
41
|
-
"headers":
|
|
47
|
+
"headers": headers, "method": "POST", "requestBody": body, "url": url
|
|
48
|
+
});
|
|
49
|
+
return body;
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* @param config
|
|
54
|
+
* @healthId Patient's Identifier for which the new health data is added (It can be ABDM id or ABDM number)
|
|
55
|
+
* @careContextReference Care Context reference under which the new health data is added
|
|
56
|
+
* @patientReference Patient's reference (An identifier with which the patient is registered on HIP)
|
|
57
|
+
* @hiTypes Types of health information documents that have been added ("DiagnosticReportRecord" | "DischargeSummaryRecord" | "HealthDocumentRecord" | "ImmunizationRecord" | "OPConsultRecord" | "PrescriptionRecord" | "WellnessRecord")
|
|
58
|
+
* @date in iso format at UTC A date when the health information was created/added on the HIP Note: This API shouldn't be called if the new heath data of is added/created under new care context.
|
|
59
|
+
*/
|
|
60
|
+
this.notify = (config) => __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
const headers = this.headers(config.healthId);
|
|
62
|
+
const url = `${this.baseUrl}gateway/v0.5/links/link/notify`;
|
|
63
|
+
const body = {
|
|
64
|
+
"requestId": (0, uuid_1.v4)(),
|
|
65
|
+
"timestamp": new Date().toISOString(),
|
|
66
|
+
"notification": {
|
|
67
|
+
"patient": {
|
|
68
|
+
"id": config.healthId
|
|
69
|
+
},
|
|
70
|
+
"careContext": {
|
|
71
|
+
"patientReference": config.patientReference,
|
|
72
|
+
"careContextReference": config.careContextReference
|
|
73
|
+
},
|
|
74
|
+
"hiTypes": config.hiTypes,
|
|
75
|
+
"date": config.date,
|
|
76
|
+
"hip": {
|
|
77
|
+
"id": config.hipId
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
yield new request_1.default().request({
|
|
82
|
+
"headers": headers, "method": "POST", "requestBody": body, "url": url
|
|
42
83
|
});
|
|
43
84
|
return body;
|
|
44
85
|
});
|
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;
|
|
1
|
+
{"version":3,"file":"link.js","sourceRoot":"","sources":["../../src/classes/link.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+BAAoC;AACpC,wDAAgC;AAChC,sDAA8B;AAI9B,MAAqB,IAAK,SAAQ,gBAAM;IACpC,YAAY,QAAgB,EAAE,YAAoB;QAC9C,KAAK,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAA;QAGjC;;;;WAIG;QACH,eAAU,GAAG,CAA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AAE,MAAM,CAAC,gBAAgB;wBAC3C,sBAAsB,EAAE,MAAM,CAAC,oBAAoB;qBACtD;oBACD,SAAS,EAAE,MAAM,CAAC,OAAO;oBACzB,MAAM,EAAE,MAAM,CAAC,IAAI;oBACnB,KAAK,EAAE;wBACH,IAAI,EAAE,MAAM,CAAC,KAAK;qBACrB;iBACJ;aACJ,CAAA;YAED,MAAM,IAAI,iBAAO,EAAE,CAAC,OAAO,CAAC;gBACxB,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG;aACxE,CAAC,CAAA;YAEF,OAAO,IAAI,CAAA;QAGf,CAAC,CAAA,CAAA;IA/ED,CAAC;CAkFJ;AArFD,uBAqFC"}
|
|
@@ -26,7 +26,13 @@ export default class Register {
|
|
|
26
26
|
"name": string;
|
|
27
27
|
"type": string;
|
|
28
28
|
"active": boolean;
|
|
29
|
-
"alias":
|
|
29
|
+
"alias": any;
|
|
30
30
|
}) => Promise<any>;
|
|
31
|
+
registerAndGetAccessToken: (config: {
|
|
32
|
+
endpointUrl: string;
|
|
33
|
+
facilityId: string;
|
|
34
|
+
facilityName: string;
|
|
35
|
+
facilityType: string;
|
|
36
|
+
}) => Promise<string>;
|
|
31
37
|
}
|
|
32
38
|
//# sourceMappingURL=register.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/classes/register.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,OAAO,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,OAAO,CAAS;gBAEZ,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAmC;IAMpG;;;OAGG;IACH,cAAc,QAAa,QAAQ,GAAG,CAAC,CAetC;IAED;;;;;OAKG;IACH,mBAAmB,gBAAuB,MAAM,eAAe,MAAM,KAAG,QAAQ,GAAG,CAAC,CAYnF;IAED;;;;;OAKG;IACH,gBAAgB,gBAAuB,MAAM,UAAU;QACnD,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAA;QACd,MAAM,EAAE,MAAM,CAAA;QACd,QAAQ,EAAE,OAAO,CAAA;QACjB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/classes/register.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,OAAO,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,OAAO,CAAS;gBAEZ,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAmC;IAMpG;;;OAGG;IACH,cAAc,QAAa,QAAQ,GAAG,CAAC,CAetC;IAED;;;;;OAKG;IACH,mBAAmB,gBAAuB,MAAM,eAAe,MAAM,KAAG,QAAQ,GAAG,CAAC,CAYnF;IAED;;;;;OAKG;IACH,gBAAgB,gBAAuB,MAAM,UAAU;QACnD,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAA;QACd,MAAM,EAAE,MAAM,CAAA;QACd,QAAQ,EAAE,OAAO,CAAA;QACjB,OAAO,EAAE,GAAG,CAAA;KACf,KAAG,QAAQ,GAAG,CAAC,CAiBf;IAED,yBAAyB,WAAkB;QACvC,WAAW,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KACtF,KAAG,QAAQ,MAAM,CAAC,CAclB;CAIJ"}
|
package/lib/classes/register.js
CHANGED
|
@@ -66,6 +66,18 @@ class Register {
|
|
|
66
66
|
"headers": headers, "requestBody": body, method: "PUT", "url": url
|
|
67
67
|
});
|
|
68
68
|
});
|
|
69
|
+
this.registerAndGetAccessToken = (config) => __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
const accesstoken = (yield this.getAccessToken().then(res => JSON.parse(res))).accessToken;
|
|
71
|
+
yield this.updateHealthcareUrl(accesstoken, config.endpointUrl);
|
|
72
|
+
yield this.registerFacility(accesstoken, {
|
|
73
|
+
"active": true,
|
|
74
|
+
"alias": ["Eg"],
|
|
75
|
+
"id": config.facilityId,
|
|
76
|
+
"name": config.facilityName,
|
|
77
|
+
"type": config.facilityType
|
|
78
|
+
});
|
|
79
|
+
return accesstoken;
|
|
80
|
+
});
|
|
69
81
|
this.clientID = _cleintId;
|
|
70
82
|
this.clinetSecrete = _clientSecrete;
|
|
71
83
|
this.baseUrl = _baseUrl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../src/classes/register.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,wDAAgC;AAEhC,MAAqB,QAAQ;IAKzB,YAAY,SAAiB,EAAE,cAAsB,EAAE,WAAmB,0BAA0B;QAMpG;;;WAGG;QACH,mBAAc,GAAG,GAAuB,EAAE;YACtC,MAAM,IAAI,GAAG;gBACT,UAAU,EAAE,IAAI,CAAC,QAAQ;gBACzB,cAAc,EAAE,IAAI,CAAC,aAAa;aACrC,CAAA;YAED,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,uBAAuB,CAAA;YAClD,MAAM,OAAO,GAAG;gBACZ,cAAc,EAAE,kBAAkB;aACrC,CAAA;YAED,OAAO,IAAI,iBAAO,EAAE,CAAC,OAAO,CAAC;gBACzB,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM;aACxE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QAE5B,CAAC,CAAA,CAAA;QAED;;;;;WAKG;QACH,wBAAmB,GAAG,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S,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG;aACrE,CAAC,CAAA;QAIN,CAAC,CAAA,CAAA;QAED,8BAAyB,GAAG,CAAO,MAElC,EAAmB,EAAE;YAClB,MAAM,WAAW,GAAG,CAAC,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAA;YAC1F,MAAM,IAAI,CAAC,mBAAmB,CAAC,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,CAAA;YAE/D,MAAM,IAAI,CAAC,gBAAgB,CAAC,WAAW,EACnC;gBACI,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,CAAC,IAAI,CAAC;gBACf,IAAI,EAAE,MAAM,CAAC,UAAU;gBACvB,MAAM,EAAE,MAAM,CAAC,YAAY;gBAC3B,MAAM,EAAE,MAAM,CAAC,YAAY;aAC9B,CAAC,CAAA;YACN,OAAO,WAAW,CAAC;QAEvB,CAAC,CAAA,CAAA;QA7FG,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC1B,IAAI,CAAC,aAAa,GAAG,cAAc,CAAC;QACpC,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC;IAC5B,CAAC;CA8FJ;AAvGD,2BAuGC"}
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import Header from "./header";
|
|
2
|
+
declare type Purpose = "KYC_AND_LINK" | "KYC" | "LINK";
|
|
2
3
|
export default class UserAuth extends Header {
|
|
3
|
-
constructor(_baseUrl: string, _accessToken: string
|
|
4
|
+
constructor(_baseUrl: string, _accessToken: string);
|
|
4
5
|
fetchModes: (config: {
|
|
5
6
|
healthId: string;
|
|
6
7
|
hipId: string;
|
|
7
8
|
hipType: string;
|
|
8
|
-
purpose:
|
|
9
|
+
purpose: Purpose;
|
|
9
10
|
}) => Promise<any>;
|
|
10
11
|
init: (config: {
|
|
11
12
|
healthId: string;
|
|
12
13
|
hipId: string;
|
|
13
14
|
hipType: string;
|
|
14
|
-
purpose:
|
|
15
|
+
purpose: Purpose;
|
|
15
16
|
authMode: "MOBILE_OTP" | "DEMOGRAPHICS" | "AADHAAR_OTP";
|
|
16
17
|
}) => Promise<any>;
|
|
17
18
|
confirm: (config: {
|
|
19
|
+
healthId: string;
|
|
18
20
|
transactionId: string;
|
|
19
21
|
authCode?: string;
|
|
20
22
|
demographic?: {
|
|
@@ -44,4 +46,5 @@ export default class UserAuth extends Header {
|
|
|
44
46
|
};
|
|
45
47
|
}>;
|
|
46
48
|
}
|
|
49
|
+
export {};
|
|
47
50
|
//# sourceMappingURL=userAuth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userAuth.d.ts","sourceRoot":"","sources":["../../src/classes/userAuth.ts"],"names":[],"mappings":"AAGA,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,MAAM;gBAC5B,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM
|
|
1
|
+
{"version":3,"file":"userAuth.d.ts","sourceRoot":"","sources":["../../src/classes/userAuth.ts"],"names":[],"mappings":"AAGA,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,aAAK,OAAO,GAAG,cAAc,GAAG,KAAK,GAAG,MAAM,CAAA;AAG9C,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,MAAM;gBAC5B,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAIlD,UAAU,WAAiB;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,KAAG,QAAQ,GAAG,CAAC,CAsB/G;IAGD,IAAI,WAAkB;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,YAAY,GAAG,cAAc,GAAG,aAAa,CAAA;KAAE,KAAG,QAAQ,GAAG,CAAC,CAuBnK;IAGD,OAAO,WAAkB;QAAE,QAAQ,EAAC,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAE;QAAC,WAAW,CAAC,EAAE;YACjG,MAAM,EAAE,MAAM,CAAC;YACf,QAAQ,EAAE,MAAM,CAAC;YACjB,aAAa,EAAE,MAAM,CAAC;YACtB,YAAY,EAAE;gBACZ,MAAM,EAAE,QAAQ,CAAC;gBACjB,OAAO,EAAE,MAAM,CAAA;aAChB,CAAA;SACJ,CAAA;KAAE;;;;;;;;;;;;;;;;OA2BF;CAIJ"}
|
package/lib/classes/userAuth.js
CHANGED
|
@@ -16,9 +16,10 @@ const uuid_1 = require("uuid");
|
|
|
16
16
|
const request_1 = __importDefault(require("./request"));
|
|
17
17
|
const header_1 = __importDefault(require("./header"));
|
|
18
18
|
class UserAuth extends header_1.default {
|
|
19
|
-
constructor(_baseUrl, _accessToken
|
|
20
|
-
super(_baseUrl, _accessToken
|
|
19
|
+
constructor(_baseUrl, _accessToken) {
|
|
20
|
+
super(_baseUrl, _accessToken);
|
|
21
21
|
this.fetchModes = (config) => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const headers = this.headers(config.healthId);
|
|
22
23
|
const url = `${this.baseUrl}gateway/v0.5/users/auth/fetch-modes`;
|
|
23
24
|
const body = {
|
|
24
25
|
"requestId": (0, uuid_1.v4)(),
|
|
@@ -33,11 +34,12 @@ class UserAuth extends header_1.default {
|
|
|
33
34
|
}
|
|
34
35
|
};
|
|
35
36
|
yield new request_1.default().request({
|
|
36
|
-
"headers":
|
|
37
|
+
"headers": headers, "method": "POST", "requestBody": body, "url": url
|
|
37
38
|
});
|
|
38
39
|
return body;
|
|
39
40
|
});
|
|
40
41
|
this.init = (config) => __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
const headers = this.headers(config.healthId);
|
|
41
43
|
const url = `${this.baseUrl}gateway/v0.5/users/auth/init`;
|
|
42
44
|
const body = {
|
|
43
45
|
"requestId": (0, uuid_1.v4)(),
|
|
@@ -53,18 +55,14 @@ class UserAuth extends header_1.default {
|
|
|
53
55
|
}
|
|
54
56
|
};
|
|
55
57
|
yield new request_1.default().request({
|
|
56
|
-
"headers":
|
|
58
|
+
"headers": headers, "method": "POST", "requestBody": body, "url": url
|
|
57
59
|
});
|
|
58
60
|
return body;
|
|
59
61
|
});
|
|
60
62
|
this.confirm = (config) => __awaiter(this, void 0, void 0, function* () {
|
|
61
63
|
var _a, _b, _c, _d, _e;
|
|
64
|
+
const headers = this.headers(config.healthId);
|
|
62
65
|
const url = `${this.baseUrl}gateway/v0.5/users/auth/confirm`;
|
|
63
|
-
const headers = {
|
|
64
|
-
"Content-Type": "application/json",
|
|
65
|
-
"Authorization": `Bearer ${this.accessToken}`,
|
|
66
|
-
"X-CM-ID": this.xCmId
|
|
67
|
-
};
|
|
68
66
|
const body = {
|
|
69
67
|
"requestId": (0, uuid_1.v4)(),
|
|
70
68
|
"timestamp": new Date().toISOString(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userAuth.js","sourceRoot":"","sources":["../../src/classes/userAuth.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,+BAAoC;AACpC,wDAAgC;AAChC,sDAA8B;
|
|
1
|
+
{"version":3,"file":"userAuth.js","sourceRoot":"","sources":["../../src/classes/userAuth.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,+BAAoC;AACpC,wDAAgC;AAChC,sDAA8B;AAK9B,MAAqB,QAAS,SAAQ,gBAAM;IACxC,YAAY,QAAgB,EAAE,YAAoB;QAC9C,KAAK,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAA;Q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A;QAEf,CAAC,CAAA,CAAA;IAxFD,CAAC;CA4FJ;AA/FD,2BA+FC"}
|
package/package.json
CHANGED
package/lib/classes/patient.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
declare type purpose = "KYC" | "LINK" | "KYC_AND_LINK";
|
|
2
|
-
declare type hipType = "HIP" | "HIU";
|
|
3
|
-
declare type xCmId = "sbx" | "ndhm";
|
|
4
|
-
export default class Patient {
|
|
5
|
-
private baseUrl;
|
|
6
|
-
constructor(_baseUrl: string);
|
|
7
|
-
hipVerifyPatinetByHealthId: (config: {
|
|
8
|
-
accessToken: string;
|
|
9
|
-
healthId: string;
|
|
10
|
-
hipId: string;
|
|
11
|
-
hipType: hipType;
|
|
12
|
-
purpose: purpose;
|
|
13
|
-
xCmId: xCmId;
|
|
14
|
-
}) => Promise<any>;
|
|
15
|
-
hipPPatinetInit: (config: {
|
|
16
|
-
accessToken: string;
|
|
17
|
-
healthId: string;
|
|
18
|
-
hipId: string;
|
|
19
|
-
hipType: hipType;
|
|
20
|
-
purpose: purpose;
|
|
21
|
-
heathId: string;
|
|
22
|
-
authMode: string;
|
|
23
|
-
xCmId: xCmId;
|
|
24
|
-
}) => Promise<any>;
|
|
25
|
-
}
|
|
26
|
-
export {};
|
|
27
|
-
//# sourceMappingURL=patient.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"patient.d.ts","sourceRoot":"","sources":["../../src/classes/patient.ts"],"names":[],"mappings":"AAKA,aAAK,OAAO,GAAG,KAAK,GAAG,MAAM,GAAG,cAAc,CAAA;AAC9C,aAAK,OAAO,GAAG,KAAK,GAAG,KAAK,CAAA;AAC5B,aAAK,KAAK,GAAG,KAAK,GAAG,MAAM,CAAA;AAC3B,MAAM,CAAC,OAAO,OAAO,OAAO;IACxB,OAAO,CAAC,OAAO,CAAS;gBACZ,QAAQ,EAAE,MAAM;IAI5B,0BAA0B,WAAmB;QACxC,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,OAAO,CAAC;QACjB,SAAU,OAAO,CAAC;QAClB,OAAQ,KAAK,CAAA;KACb,KAAG,QAAQ,GAAG,CAAC,CAwCf;IAEL,eAAe,WAAkB;QAC7B,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,OAAO,CAAA;QAChB,SAAU,OAAO,CAAA;QACjB,OAAO,EAAG,MAAM,CAAA;QAChB,QAAQ,EAAG,MAAM,CAAC;QAClB,OAAQ,KAAK,CAAA;KAChB,KAAG,QAAQ,GAAG,CAAC,CAgCX;CAEJ"}
|
package/lib/classes/patient.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const uuid_1 = require("uuid");
|
|
16
|
-
const axios_1 = __importDefault(require("axios"));
|
|
17
|
-
class Patient {
|
|
18
|
-
constructor(_baseUrl) {
|
|
19
|
-
this.hipVerifyPatinetByHealthId = (config) => __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
try {
|
|
21
|
-
const url = `${this.baseUrl}gateway/v0.5/users/auth/fetch-modes`;
|
|
22
|
-
const headers = {
|
|
23
|
-
"Content-Type": "application/json",
|
|
24
|
-
"Authorization": `Bearer ${config.accessToken}`,
|
|
25
|
-
"X-CM-ID": config.xCmId
|
|
26
|
-
};
|
|
27
|
-
const requestBody = {
|
|
28
|
-
"requestId": (0, uuid_1.v4)(),
|
|
29
|
-
"timestamp": new Date().toISOString(),
|
|
30
|
-
"query": {
|
|
31
|
-
"id": config.healthId,
|
|
32
|
-
"purpose": config.purpose,
|
|
33
|
-
"requester": {
|
|
34
|
-
"type": config.hipType,
|
|
35
|
-
"id": config.hipId
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
const body = JSON.stringify(requestBody);
|
|
40
|
-
let result = yield (0, axios_1.default)({
|
|
41
|
-
"headers": headers,
|
|
42
|
-
"url": url,
|
|
43
|
-
"data": body,
|
|
44
|
-
"method": "POST"
|
|
45
|
-
}).then(res => res.data);
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
throw error;
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
this.hipPPatinetInit = (config) => __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
const url = `${this.baseUrl}gateway/v0.5/users/auth/init`;
|
|
53
|
-
const headers = {
|
|
54
|
-
"Content-Type": "application/json",
|
|
55
|
-
"Authorization": `Bearer ${config.accessToken}`,
|
|
56
|
-
"X-CM-ID": config.xCmId
|
|
57
|
-
};
|
|
58
|
-
const requestBody = {
|
|
59
|
-
"requestId": (0, uuid_1.v4)(),
|
|
60
|
-
"timestamp": new Date().toISOString(),
|
|
61
|
-
"query": {
|
|
62
|
-
"id": config.healthId,
|
|
63
|
-
"purpose": config.purpose,
|
|
64
|
-
"authMode": config.authMode,
|
|
65
|
-
"requester": {
|
|
66
|
-
"type": config.hipType,
|
|
67
|
-
"id": config.hipId,
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
const body = JSON.stringify(requestBody);
|
|
72
|
-
let result = yield (0, axios_1.default)({
|
|
73
|
-
"headers": headers,
|
|
74
|
-
"url": url,
|
|
75
|
-
"data": body,
|
|
76
|
-
"method": "POST"
|
|
77
|
-
}).then(res => res.data);
|
|
78
|
-
});
|
|
79
|
-
this.baseUrl = _baseUrl;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
exports.default = Patient;
|
|
83
|
-
//# sourceMappingURL=patient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"patient.js","sourceRoot":"","sources":["../../src/classes/patient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAEA,+BAAoC;AACpC,kDAA2B;AAK3B,MAAqB,OAAO;IAExB,YAAY,QAAgB;QAI5B,+BAA0B,GAAG,CAAO,MAO/B,EAAgB,EAAE;YACf,IAAI;gBACA,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,qCAAqC,CAAC;gBACjE,MAAM,OAAO,GAAG;oBACZ,cAAc,EAAE,kBAAkB;oBAClC,eAAe,EAAE,UAAU,MAAM,CAAC,WAAW,EAAE;oBAC/C,SAAS,EAAE,MAAM,CAAC,KAAK;iBAC1B,CAAA;gBACD,MAAM,WAAW,GAAG;oBAChB,WAAW,EAAE,IAAA,SAAM,GAAE;oBACrB,WAAW,EAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;oBACtC,OAAO,EAAE;wBACL,IAAI,EAAE,MAAM,CAAC,QAAQ;wBACrB,SAAS,EAAE,MAAM,CAAC,OAAO;wBACzB,WAAW,EAAE;4BACT,MAAM,EAAE,MAAM,CAAC,OAAO;4BACtB,IAAI,EAAE,MAAM,CAAC,KAAK;yBACrB;qBAEJ;iBACJ,CAAA;gBAED,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAA;gBAExC,IAAI,MAA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