ndhm-hrp 2.1.55 → 2.1.59
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/abha.d.ts +58 -0
- package/lib/classes/abha.d.ts.map +1 -0
- package/lib/classes/abha.js +98 -0
- package/lib/classes/abha.js.map +1 -0
- package/lib/classes/consent-flow.d.ts +19 -0
- package/lib/classes/consent-flow.d.ts.map +1 -0
- package/lib/classes/consent-flow.js +64 -0
- package/lib/classes/consent-flow.js.map +1 -0
- package/lib/classes/data-flow.d.ts +19 -0
- package/lib/classes/data-flow.d.ts.map +1 -0
- package/lib/classes/data-flow.js +64 -0
- package/lib/classes/data-flow.js.map +1 -0
- package/lib/classes/discovery.d.ts +24 -0
- package/lib/classes/discovery.d.ts.map +1 -0
- package/lib/classes/discovery.js +60 -0
- package/lib/classes/discovery.js.map +1 -0
- package/lib/classes/header.d.ts +41 -0
- package/lib/classes/header.d.ts.map +1 -0
- package/lib/classes/header.js +55 -0
- package/lib/classes/header.js.map +1 -0
- package/lib/classes/health-information.d.ts +31 -0
- package/lib/classes/health-information.d.ts.map +1 -0
- package/lib/classes/health-information.js +73 -0
- package/lib/classes/health-information.js.map +1 -0
- package/lib/classes/link.d.ts +115 -0
- package/lib/classes/link.d.ts.map +1 -0
- package/lib/classes/link.js +180 -0
- package/lib/classes/link.js.map +1 -0
- package/lib/classes/profile.d.ts +16 -0
- package/lib/classes/profile.d.ts.map +1 -0
- package/lib/classes/profile.js +64 -0
- package/lib/classes/profile.js.map +1 -0
- package/lib/classes/register.d.ts +38 -0
- package/lib/classes/register.d.ts.map +1 -0
- package/lib/classes/register.js +87 -0
- package/lib/classes/register.js.map +1 -0
- package/lib/classes/request.d.ts +9 -0
- package/lib/classes/request.d.ts.map +1 -0
- package/lib/classes/request.js +39 -0
- package/lib/classes/request.js.map +1 -0
- package/lib/classes/userAuth.d.ts +50 -0
- package/lib/classes/userAuth.d.ts.map +1 -0
- package/lib/classes/userAuth.js +91 -0
- package/lib/classes/userAuth.js.map +1 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +25 -0
- package/lib/index.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export default class AbhaNumber {
|
|
2
|
+
private abhaBaseUrl;
|
|
3
|
+
private headers;
|
|
4
|
+
constructor(_accessToken: string, abhaBaseUrl: string);
|
|
5
|
+
generatAadhaareOTP: (aadhaar: number) => Promise<{
|
|
6
|
+
txnId: string;
|
|
7
|
+
}>;
|
|
8
|
+
aadharVerifyOtp: (options: {
|
|
9
|
+
otp: string;
|
|
10
|
+
txnId: string;
|
|
11
|
+
restrictions?: string;
|
|
12
|
+
}) => Promise<{
|
|
13
|
+
txnId: string;
|
|
14
|
+
}>;
|
|
15
|
+
generateMobileOtp: (mobile: string, txnId: string) => Promise<{
|
|
16
|
+
txnId: string;
|
|
17
|
+
}>;
|
|
18
|
+
verifyMobileOtp: (otp: string, txnId: string) => Promise<{
|
|
19
|
+
txnId: string;
|
|
20
|
+
}>;
|
|
21
|
+
createHealthIdWithPreVerified: (options: {
|
|
22
|
+
email: string;
|
|
23
|
+
firstName: string;
|
|
24
|
+
healthId: string;
|
|
25
|
+
lastName: string;
|
|
26
|
+
middleName: string;
|
|
27
|
+
password: string;
|
|
28
|
+
profilePhoto: string;
|
|
29
|
+
txnId: string;
|
|
30
|
+
}) => Promise<{
|
|
31
|
+
authMethods: ["AADHAAR_OTP"];
|
|
32
|
+
dayOfBirth: string;
|
|
33
|
+
districtCode: string;
|
|
34
|
+
districtName: string;
|
|
35
|
+
email: string;
|
|
36
|
+
firstName: string;
|
|
37
|
+
gender: string;
|
|
38
|
+
healthId: string;
|
|
39
|
+
healthIdNumber: string;
|
|
40
|
+
kycPhoto: string;
|
|
41
|
+
lastName: string;
|
|
42
|
+
middleName: string;
|
|
43
|
+
mobile: string;
|
|
44
|
+
monthOfBirth: string;
|
|
45
|
+
name: string;
|
|
46
|
+
new: true;
|
|
47
|
+
stateCode: string;
|
|
48
|
+
stateName: string;
|
|
49
|
+
tags: {
|
|
50
|
+
additionalProp1: string;
|
|
51
|
+
additionalProp2: string;
|
|
52
|
+
additionalProp3: string;
|
|
53
|
+
};
|
|
54
|
+
token: string;
|
|
55
|
+
yearOfBirth: string;
|
|
56
|
+
}>;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=abha.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abha.d.ts","sourceRoot":"","sources":["../../src/classes/abha.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,OAAO,CAAM;gBAET,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;IAQrD,kBAAkB,YACP,MAAM,KACd,QAAQ;QACT,KAAK,EAAE,MAAM,CAAC;KACf,CAAC,CAcA;IAEF,eAAe,YAAmB;QAChC,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,KAAG,QAAQ;QACV,KAAK,EAAE,MAAM,CAAC;KACf,CAAC,CAkBA;IAEF,iBAAiB,WACP,MAAM,SACP,MAAM;eAEN,MAAM;OAkBb;IAEF,eAAe,QACR,MAAM,SACJ,MAAM;eAEN,MAAM;OAkBb;IAEF,6BAA6B,YAAmB;QAC9C,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,YAAY,EAAE,MAAM,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;KACf,KAAG,QAAQ;QACV,WAAW,EAAE,CAAC,aAAa,CAAC,CAAC;QAC7B,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;QACrB,YAAY,EAAE,MAAM,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,cAAc,EAAE,MAAM,CAAC;QACvB,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC;QACf,YAAY,EAAE,MAAM,CAAC;QACrB,MAAM,MAAM,CAAC;QACb,GAAG,EAAE,IAAI,CAAC;QACV,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE;YACJ,eAAe,EAAE,MAAM,CAAC;YACxB,eAAe,EAAE,MAAM,CAAC;YACxB,eAAe,EAAE,MAAM,CAAC;SACzB,CAAC;QACF,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC,CAcA;CACH"}
|
|
@@ -0,0 +1,98 @@
|
|
|
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 request_1 = __importDefault(require("./request"));
|
|
16
|
+
class AbhaNumber {
|
|
17
|
+
constructor(_accessToken, abhaBaseUrl) {
|
|
18
|
+
this.generatAadhaareOTP = (aadhaar) => __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
const url = `${this.abhaBaseUrl}/v1/registration/aadhaar/generateOtp`;
|
|
20
|
+
const body = {
|
|
21
|
+
aadhaar: aadhaar,
|
|
22
|
+
};
|
|
23
|
+
const res = yield new request_1.default().request({
|
|
24
|
+
headers: this.headers,
|
|
25
|
+
method: "POST",
|
|
26
|
+
requestBody: body,
|
|
27
|
+
url: url,
|
|
28
|
+
});
|
|
29
|
+
const ret = JSON.parse(JSON.stringify(res));
|
|
30
|
+
return JSON.parse(ret.body);
|
|
31
|
+
});
|
|
32
|
+
this.aadharVerifyOtp = (options) => __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const url = `${this.abhaBaseUrl}/v1/registration/aadhaar/verifyOTP`;
|
|
34
|
+
const body = {
|
|
35
|
+
otp: options.otp,
|
|
36
|
+
restrictions: options.restrictions,
|
|
37
|
+
txnId: options.txnId,
|
|
38
|
+
};
|
|
39
|
+
const res = yield new request_1.default().request({
|
|
40
|
+
headers: this.headers,
|
|
41
|
+
method: "POST",
|
|
42
|
+
requestBody: body,
|
|
43
|
+
url: url,
|
|
44
|
+
});
|
|
45
|
+
const ret = JSON.parse(JSON.stringify(res));
|
|
46
|
+
return JSON.parse(ret.body);
|
|
47
|
+
});
|
|
48
|
+
this.generateMobileOtp = (mobile, txnId) => __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
const url = `${this.abhaBaseUrl}/v1/registration/aadhaar/generateMobileOTP`;
|
|
50
|
+
const body = {
|
|
51
|
+
mobile: mobile,
|
|
52
|
+
txnId: txnId,
|
|
53
|
+
};
|
|
54
|
+
const res = yield new request_1.default().request({
|
|
55
|
+
headers: this.headers,
|
|
56
|
+
method: "POST",
|
|
57
|
+
requestBody: body,
|
|
58
|
+
url: url,
|
|
59
|
+
});
|
|
60
|
+
const ret = JSON.parse(JSON.stringify(res));
|
|
61
|
+
return JSON.parse(ret.body);
|
|
62
|
+
});
|
|
63
|
+
this.verifyMobileOtp = (otp, txnId) => __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
const url = `${this.abhaBaseUrl}/v1/registration/aadhaar/verifyMobileOTP`;
|
|
65
|
+
const body = {
|
|
66
|
+
otp: otp,
|
|
67
|
+
txnId: txnId,
|
|
68
|
+
};
|
|
69
|
+
const res = yield new request_1.default().request({
|
|
70
|
+
headers: this.headers,
|
|
71
|
+
method: "POST",
|
|
72
|
+
requestBody: body,
|
|
73
|
+
url: url,
|
|
74
|
+
});
|
|
75
|
+
const ret = JSON.parse(JSON.stringify(res));
|
|
76
|
+
return JSON.parse(ret.body);
|
|
77
|
+
});
|
|
78
|
+
this.createHealthIdWithPreVerified = (options) => __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
const url = `${this.abhaBaseUrl}/v1/registration/aadhaar/createHealthIdWithPreVerified`;
|
|
80
|
+
const body = options;
|
|
81
|
+
const res = yield new request_1.default().request({
|
|
82
|
+
headers: this.headers,
|
|
83
|
+
method: "POST",
|
|
84
|
+
requestBody: body,
|
|
85
|
+
url: url,
|
|
86
|
+
});
|
|
87
|
+
const ret = JSON.parse(JSON.stringify(res));
|
|
88
|
+
return JSON.parse(ret.body);
|
|
89
|
+
});
|
|
90
|
+
this.headers = {
|
|
91
|
+
"Content-Type": "application/json",
|
|
92
|
+
Authorization: `Bearer ${_accessToken}`,
|
|
93
|
+
};
|
|
94
|
+
this.abhaBaseUrl = abhaBaseUrl;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
exports.default = AbhaNumber;
|
|
98
|
+
//# sourceMappingURL=abha.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abha.js","sourceRoot":"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CAAC,CAAA,CAAC;QAEF,kCAA6B,GAAG,CAAO,OAStC,EA0BE,EAAE;YACH,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,WAAW,wDAAwD,CAAC;YAExF,MAAM,IAAI,GAAG,OAAO,CAAC;YAErB,MAAM,GAAG,GAAG,MAAM,IAAI,iBAAO,EAAE,CAAC,OAAO,CAAC;gBACtC,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,MAAM,EAAE,MAAM;gBACd,WAAW,EAAE,IAAI;gBACjB,GAAG,EAAE,GAAG;aACT,CAAC,CAAC;YAEH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;YAC5C,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC9B,CAAC,CAAA,CAAC;QAtJA,IAAI,CAAC,OAAO,GAAG;YACb,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,UAAU,YAAY,EAAE;SACxC,CAAC;QACF,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;CAkJF;AA5JD,6BA4JC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Header from "./header";
|
|
2
|
+
export default class ConsentFlow extends Header {
|
|
3
|
+
constructor(_baseUrl: string, _accessToken: string);
|
|
4
|
+
/**
|
|
5
|
+
* This API is called by HIP as acknowledgement to notification of consents, in cases of consent revocation and expiration.
|
|
6
|
+
* @param config.healthId: string; phradddress or ABHA addrress of patient
|
|
7
|
+
* @param config.consentId: string; consent id recive by notify callback
|
|
8
|
+
* @param config.requestId: string; request id as recived by notify callback
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
onhipNotify: (config: {
|
|
12
|
+
healthId: string;
|
|
13
|
+
consentId: string;
|
|
14
|
+
requestId: string;
|
|
15
|
+
errCode?: string;
|
|
16
|
+
errMessage?: string;
|
|
17
|
+
}) => Promise<any>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=consent-flow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consent-flow.d.ts","sourceRoot":"","sources":["../../src/classes/consent-flow.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAC;AAI9B,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,MAAM;gBACjC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAGlD;;;;;;OAMG;IACH,WAAW,WAAkB;QAC3B,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,kBAsCC;CACH"}
|
|
@@ -0,0 +1,64 @@
|
|
|
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 header_1 = __importDefault(require("./header"));
|
|
16
|
+
const uuid_1 = require("uuid");
|
|
17
|
+
const request_1 = __importDefault(require("./request"));
|
|
18
|
+
class ConsentFlow extends header_1.default {
|
|
19
|
+
constructor(_baseUrl, _accessToken) {
|
|
20
|
+
super(_baseUrl, _accessToken);
|
|
21
|
+
/**
|
|
22
|
+
* This API is called by HIP as acknowledgement to notification of consents, in cases of consent revocation and expiration.
|
|
23
|
+
* @param config.healthId: string; phradddress or ABHA addrress of patient
|
|
24
|
+
* @param config.consentId: string; consent id recive by notify callback
|
|
25
|
+
* @param config.requestId: string; request id as recived by notify callback
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
this.onhipNotify = (config) => __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
try {
|
|
30
|
+
const headers = this.headers(config.healthId);
|
|
31
|
+
const url = `${this.baseUrl}gateway/v0.5/consents/hip/on-notify`;
|
|
32
|
+
const body = {
|
|
33
|
+
requestId: (0, uuid_1.v4)(),
|
|
34
|
+
timestamp: new Date().toISOString(),
|
|
35
|
+
acknowledgement: {
|
|
36
|
+
status: "OK",
|
|
37
|
+
consentId: config.consentId,
|
|
38
|
+
},
|
|
39
|
+
resp: {
|
|
40
|
+
requestId: config.requestId,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
if (config.errCode) {
|
|
44
|
+
body.error = {
|
|
45
|
+
code: config.errCode,
|
|
46
|
+
message: config.errMessage || "Error occured",
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const res = yield new request_1.default().request({
|
|
50
|
+
headers: headers,
|
|
51
|
+
method: "POST",
|
|
52
|
+
requestBody: body,
|
|
53
|
+
url: url,
|
|
54
|
+
});
|
|
55
|
+
return body;
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
console.log(error);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.default = ConsentFlow;
|
|
64
|
+
//# sourceMappingURL=consent-flow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consent-flow.js","sourceRoot":"","sources":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,8BAwDC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Header from "./header";
|
|
2
|
+
export default class DataFlow extends Header {
|
|
3
|
+
constructor(_baseUrl: string, _accessToken: string);
|
|
4
|
+
/**
|
|
5
|
+
* API called by HIP to acknowledge Health information request receipt. Either the hiRequest or error must be specified. hiRequest element returns the same transactionId as before with a status indicating that the request is acknowledged.
|
|
6
|
+
* @param config.healthId: string; phradddress or ABHA addrress of patient
|
|
7
|
+
* @param config.transactionId: string; trasactionID recived by request callback
|
|
8
|
+
* @param config.requestId: string; request id as recived by notify callback
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
onhipRequest: (config: {
|
|
12
|
+
healthId: string;
|
|
13
|
+
transactionId: string;
|
|
14
|
+
requestId: string;
|
|
15
|
+
errCode?: string;
|
|
16
|
+
errMessage?: string;
|
|
17
|
+
}) => Promise<any>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=data-flow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-flow.d.ts","sourceRoot":"","sources":["../../src/classes/data-flow.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAC;AAI9B,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,MAAM;gBAC9B,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAGlD;;;;;;OAMG;IACH,YAAY,WAAkB;QAC5B,QAAQ,EAAE,MAAM,CAAC;QACjB,aAAa,EAAE,MAAM,CAAC;QACtB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,kBAoCC;CACH"}
|
|
@@ -0,0 +1,64 @@
|
|
|
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 header_1 = __importDefault(require("./header"));
|
|
16
|
+
const uuid_1 = require("uuid");
|
|
17
|
+
const request_1 = __importDefault(require("./request"));
|
|
18
|
+
class DataFlow extends header_1.default {
|
|
19
|
+
constructor(_baseUrl, _accessToken) {
|
|
20
|
+
super(_baseUrl, _accessToken);
|
|
21
|
+
/**
|
|
22
|
+
* API called by HIP to acknowledge Health information request receipt. Either the hiRequest or error must be specified. hiRequest element returns the same transactionId as before with a status indicating that the request is acknowledged.
|
|
23
|
+
* @param config.healthId: string; phradddress or ABHA addrress of patient
|
|
24
|
+
* @param config.transactionId: string; trasactionID recived by request callback
|
|
25
|
+
* @param config.requestId: string; request id as recived by notify callback
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
this.onhipRequest = (config) => __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
try {
|
|
30
|
+
const headers = this.headers(config.healthId);
|
|
31
|
+
const url = `${this.baseUrl}gateway/v0.5/health-information/hip/on-request`;
|
|
32
|
+
const body = {
|
|
33
|
+
requestId: (0, uuid_1.v4)(),
|
|
34
|
+
timestamp: new Date().toISOString(),
|
|
35
|
+
hiRequest: {
|
|
36
|
+
transactionId: config.transactionId,
|
|
37
|
+
sessionStatus: "ACKNOWLEDGED",
|
|
38
|
+
},
|
|
39
|
+
resp: {
|
|
40
|
+
requestId: config.requestId,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
if (config.errCode) {
|
|
44
|
+
body.error = {
|
|
45
|
+
code: config.errCode,
|
|
46
|
+
message: config.errMessage || "Error occured",
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const res = yield new request_1.default().request({
|
|
50
|
+
headers: headers,
|
|
51
|
+
method: "POST",
|
|
52
|
+
requestBody: body,
|
|
53
|
+
url: url,
|
|
54
|
+
});
|
|
55
|
+
return body;
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
console.log(error);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.default = DataFlow;
|
|
64
|
+
//# sourceMappingURL=data-flow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-flow.js","sourceRoot":"","sources":["../../src/classes/data-flow.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,sDAA8B;AAC9B,+BAAoC;AACpC,wDAAgC;AAEhC,MAAqB,QAAS,SAAQ,gBAAM;IAC1C,YAAY,QAAgB,EAAE,YAAoB;QAChD,KAAK,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QAEhC;;;;;;WAMG;QACH,iBAAY,GAAG,CAAO,MAMrB,EAAE,EAAE;YACH,IAAI;gBACF,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;gBAC9C,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,gDAAgD,CAAC;gBAE5E,MAAM,IAAI,GAAQ;oBAChB,SAAS,EAAE,IAAA,SAAM,GAAE;oBACnB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;oBACnC,SAAS,EAAE;wBACT,aAAa,EAAE,MAAM,CAAC,aAAa;wBACnC,aAAa,EAAE,cAAc;qBAC9B;oBAED,IAAI,EAAE;wBACJ,SAAS,EAAE,MAAM,CAAC,SAAS;qBAC5B;iBACF,CAAC;gBAEF,IAAI,MAAM,CAAC,OAAO,EAAE;oBAClB,IAAI,CAAC,KAAK,GAAG;wBACX,IAAI,EAAE,MAAM,CAAC,OAAO;wBACpB,OAAO,EAAE,MAAM,CAAC,UAAU,IAAI,eAAe;qBAC9C,CAAC;iBACH;gBAED,MAAM,GAAG,GAAG,MAAM,IAAI,iBAAO,EAAE,CAAC,OAAO,CAAC;oBACtC,OAAO,EAAE,OAAO;oBAChB,MAAM,EAAE,MAAM;oBACd,WAAW,EAAE,IAAI;oBACjB,GAAG,EAAE,GAAG;iBACT,CAAC,CAAC;gBAEH,OAAO,IAAI,CAAC;aACb;YAAC,OAAO,KAAK,EAAE;gBACd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;aACpB;QACH,CAAC,CAAA,CAAC;IAlDF,CAAC;CAmDF;AAtDD,2BAsDC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import Header from "./header";
|
|
2
|
+
export default class Discovery extends Header {
|
|
3
|
+
constructor(_baseUrl: string, _accessToken: string);
|
|
4
|
+
/**
|
|
5
|
+
* Result of patient care-context discovery request at HIP end. If a matching patient found with zero or more care contexts associated, it is specified as result attribute. If the prior discovery request, resulted in errors then it is specified in the error attribute. Reasons of errors can be
|
|
6
|
+
* @param config body
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
onDiscovery: (config: {
|
|
10
|
+
transactionId: string;
|
|
11
|
+
patientReferenceNumber: string;
|
|
12
|
+
patientDisplay: string;
|
|
13
|
+
careContexts: {
|
|
14
|
+
referenceNumber: string;
|
|
15
|
+
display: string;
|
|
16
|
+
}[];
|
|
17
|
+
matchedBy: string[];
|
|
18
|
+
errCode?: string;
|
|
19
|
+
errMessage?: string;
|
|
20
|
+
requestId: string;
|
|
21
|
+
healthId: string;
|
|
22
|
+
}) => Promise<any>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=discovery.d.ts.map
|
|
@@ -0,0 +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;gBAC/B,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAGlD;;;;OAIG;IACH,WAAW,WAAkB;QAC3B,aAAa,EAAE,MAAM,CAAC;QACtB,sBAAsB,EAAE,MAAM,CAAC;QAC/B,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE;YAAE,eAAe,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QAC7D,SAAS,EAAE,MAAM,EAAE,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;KAClB,kBAiCC;CACH"}
|
|
@@ -0,0 +1,60 @@
|
|
|
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 header_1 = __importDefault(require("./header"));
|
|
16
|
+
const uuid_1 = require("uuid");
|
|
17
|
+
const request_1 = __importDefault(require("./request"));
|
|
18
|
+
class Discovery extends header_1.default {
|
|
19
|
+
constructor(_baseUrl, _accessToken) {
|
|
20
|
+
super(_baseUrl, _accessToken);
|
|
21
|
+
/**
|
|
22
|
+
* Result of patient care-context discovery request at HIP end. If a matching patient found with zero or more care contexts associated, it is specified as result attribute. If the prior discovery request, resulted in errors then it is specified in the error attribute. Reasons of errors can be
|
|
23
|
+
* @param config body
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
this.onDiscovery = (config) => __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const headers = this.headers(config.healthId);
|
|
28
|
+
const url = `${this.baseUrl}gateway/v0.5/care-contexts/on-discover`;
|
|
29
|
+
const body = {
|
|
30
|
+
requestId: (0, uuid_1.v4)(),
|
|
31
|
+
timestamp: new Date().toISOString(),
|
|
32
|
+
transactionId: config.transactionId,
|
|
33
|
+
patient: {
|
|
34
|
+
referenceNumber: config.patientReferenceNumber,
|
|
35
|
+
display: config.patientDisplay,
|
|
36
|
+
careContexts: config.careContexts,
|
|
37
|
+
matchedBy: config.matchedBy,
|
|
38
|
+
},
|
|
39
|
+
resp: {
|
|
40
|
+
requestId: config.requestId,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
if (config.errCode) {
|
|
44
|
+
body.error = {
|
|
45
|
+
code: config.errCode,
|
|
46
|
+
message: config.errMessage || "Error occured",
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
yield new request_1.default().request({
|
|
50
|
+
headers: headers,
|
|
51
|
+
method: "POST",
|
|
52
|
+
requestBody: body,
|
|
53
|
+
url: url,
|
|
54
|
+
});
|
|
55
|
+
return body;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.default = Discovery;
|
|
60
|
+
//# sourceMappingURL=discovery.js.map
|
|
@@ -0,0 +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;YAChE,MAAM,IAAI,GAAQ;gBACpB,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,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;IAjDF,CAAC;CAkDF;AArDD,4BAqDC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export default class Header {
|
|
2
|
+
/**
|
|
3
|
+
* 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
|
+
*/
|
|
17
|
+
protected accessToken: string;
|
|
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
|
+
* @returns this tbase url of class
|
|
37
|
+
*/
|
|
38
|
+
getBaseUrl(): string;
|
|
39
|
+
getXCmId(): string;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../src/classes/header.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,OAAO,OAAO,MAAM;IACzB;;OAEG;IAEI,OAAO,EAAE,MAAM,CAAE;IACxB;;OAEG;IACI,KAAK,EAAE,MAAM,CAAM;IAE1B;;OAEG;IACH,OAAO,CAAC,aAAa,CAAM;IAC3B;;OAEG;IACH,SAAS,CAAC,WAAW,EAAE,MAAM,CAAC;IAE9B;;;;OAIG;gBACS,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAKjD;;;OAGG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG;IAU9B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM;IAKzB;;;OAGG;IACH,UAAU,IAAI,MAAM;IAIpB,QAAQ,IAAI,MAAM;CAGnB"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// import { X_CM_ID } from "./config";
|
|
4
|
+
class Header {
|
|
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
|
+
* cmid header in request
|
|
13
|
+
*/
|
|
14
|
+
this.xCmId = "";
|
|
15
|
+
/**
|
|
16
|
+
* actual header object in request
|
|
17
|
+
*/
|
|
18
|
+
this.headersObject = {};
|
|
19
|
+
this.accessToken = _accessToken;
|
|
20
|
+
this.baseUrl = baseUrl;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* header is reset from class wide variables set
|
|
24
|
+
* i.e accessToken and xCmId:
|
|
25
|
+
*/
|
|
26
|
+
headers(healthId) {
|
|
27
|
+
this.setXCmId(healthId);
|
|
28
|
+
this.headersObject = {
|
|
29
|
+
"Content-Type": "application/json",
|
|
30
|
+
Authorization: `Bearer ${this.accessToken}`,
|
|
31
|
+
"X-CM-ID": this.xCmId,
|
|
32
|
+
};
|
|
33
|
+
return this.headersObject;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* This sets the cmid from healthid
|
|
37
|
+
* @param healthId healthid with CM id has ro passed
|
|
38
|
+
*/
|
|
39
|
+
setXCmId(healthId) {
|
|
40
|
+
let index = healthId.lastIndexOf("@");
|
|
41
|
+
this.xCmId = healthId.substring(index + 1);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @returns this tbase url of class
|
|
46
|
+
*/
|
|
47
|
+
getBaseUrl() {
|
|
48
|
+
return this.baseUrl;
|
|
49
|
+
}
|
|
50
|
+
getXCmId() {
|
|
51
|
+
return this.xCmId;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.default = Header;
|
|
55
|
+
//# sourceMappingURL=header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header.js","sourceRoot":"","sources":["../../src/classes/header.ts"],"names":[],"mappings":";;AAAA,sCAAsC;AACtC,MAAqB,MAAM;IAoBzB;;;;OAIG;IACH,YAAY,OAAe,EAAE,YAAoB;QAnBjD;;WAEG;QACI,UAAK,GAAW,EAAE,CAAC;QAE1B;;WAEG;QACK,kBAAa,GAAG,EAAE,CAAC;QAYzB,IAAI,CAAC,WAAW,GAAG,YAAY,CAAC;QAChC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED;;;OAGG;IACH,OAAO,CAAC,QAAgB;QACtB,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACxB,IAAI,CAAC,aAAa,GAAG;YACnB,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,UAAU,IAAI,CAAC,WAAW,EAAE;YAC3C,SAAS,EAAE,IAAI,CAAC,KAAK;SACtB,CAAC;QACF,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACH,QAAQ,CAAC,QAAgB;QACvB,IAAI,KAAK,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACtC,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;IAC7C,CAAC;IAED;;;OAGG;IACH,UAAU;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;CACF;AAhED,yBAgEC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import Header from "./header";
|
|
2
|
+
export interface STATUS_RESPONSES_HEALTH_INFORMATION_NOTIFY {
|
|
3
|
+
"careContextReference": string;
|
|
4
|
+
"hiStatus": "DELIVERED" | "OK" | "ERRORED";
|
|
5
|
+
"description": string;
|
|
6
|
+
}
|
|
7
|
+
export default class HealthInformation extends Header {
|
|
8
|
+
constructor(_baseUrl: string, _accessToken: string);
|
|
9
|
+
/**
|
|
10
|
+
* * API called by HIU and HIP during data-transfer.
|
|
11
|
+
* HIP on transfer of data would send sessionStatus - one of [TRANSFERRED, FAILED]
|
|
12
|
+
* HIP would also send hiStatus for each careContextReference - on of [DELIVERED, ERRORED]
|
|
13
|
+
* HIU on receipt of data would send sessionStatus - one of [TRANSFERRED, FAILED]. For example, FAILED when if data was not sent or if invalid data was sent
|
|
14
|
+
* HIU would also send hiStatus for each careContextReference - one of [OK, ERRORED]
|
|
15
|
+
* @param config
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
notify: (config: {
|
|
19
|
+
healthId: string;
|
|
20
|
+
consentId: string;
|
|
21
|
+
transactionId: string;
|
|
22
|
+
notifer: "HIU" | "HIP";
|
|
23
|
+
notifierId: string;
|
|
24
|
+
hipId: string;
|
|
25
|
+
sessionStatus: "TRANSFERRED" | "FAILED";
|
|
26
|
+
errCode?: string;
|
|
27
|
+
errMessage?: string;
|
|
28
|
+
statusResponses: STATUS_RESPONSES_HEALTH_INFORMATION_NOTIFY[];
|
|
29
|
+
}) => Promise<any>;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=health-information.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health-information.d.ts","sourceRoot":"","sources":["../../src/classes/health-information.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAC;AAI9B,MAAM,WAAW,0CAA0C;IACzD,sBAAsB,EAAE,MAAM,CAAC;IAC/B,UAAU,EAAE,WAAW,GAAE,IAAI,GAAG,SAAS,CAAC;IAC1C,aAAa,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,MAAM;gBACvC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAIlD;;;;;;;;OAQG;IACH,MAAM,WAAkB;QACtB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,aAAa,EAAG,MAAM,CAAA;QACtB,OAAO,EAAG,KAAK,GAAG,KAAK,CAAC;QACxB,UAAU,EAAG,MAAM,CAAC;QACpB,KAAK,EAAG,MAAM,CAAC;QACf,aAAa,EAAG,aAAa,GAAG,QAAQ,CAAE;QAC1C,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,eAAe,EAAC,0CAA0C,EAAE,CAAA;KAC7D,kBA6CC;CACH"}
|