ndhm-hrp 2.1.115 → 2.2.0

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.
Files changed (32) hide show
  1. package/lib/classes/nhcx/Particpant.d.ts +119 -0
  2. package/lib/classes/nhcx/Particpant.d.ts.map +1 -0
  3. package/lib/classes/nhcx/Particpant.js +152 -0
  4. package/lib/classes/nhcx/Particpant.js.map +1 -0
  5. package/lib/classes/nhcx/hcx.Encrypt_old.d.ts +16 -0
  6. package/lib/classes/nhcx/hcx.Encrypt_old.d.ts.map +1 -0
  7. package/lib/classes/nhcx/hcx.Encrypt_old.js +34 -0
  8. package/lib/classes/nhcx/hcx.Encrypt_old.js.map +1 -0
  9. package/lib/classes/nhcx/hcx_incomming.d.ts +17 -0
  10. package/lib/classes/nhcx/hcx_incomming.d.ts.map +1 -0
  11. package/lib/classes/nhcx/hcx_incomming.js +62 -0
  12. package/lib/classes/nhcx/hcx_incomming.js.map +1 -0
  13. package/lib/classes/nhcx/hcx_outgoing.d.ts +36 -0
  14. package/lib/classes/nhcx/hcx_outgoing.d.ts.map +1 -0
  15. package/lib/classes/nhcx/hcx_outgoing.js +118 -0
  16. package/lib/classes/nhcx/hcx_outgoing.js.map +1 -0
  17. package/lib/classes/nhcx/utils/Constants.d.ts +55 -0
  18. package/lib/classes/nhcx/utils/Constants.d.ts.map +1 -0
  19. package/lib/classes/nhcx/utils/Constants.js +83 -0
  20. package/lib/classes/nhcx/utils/Constants.js.map +1 -0
  21. package/lib/classes/nhcx/utils/JWEHelper.d.ts +12 -0
  22. package/lib/classes/nhcx/utils/JWEHelper.d.ts.map +1 -0
  23. package/lib/classes/nhcx/utils/JWEHelper.js +45 -0
  24. package/lib/classes/nhcx/utils/JWEHelper.js.map +1 -0
  25. package/lib/classes/nhcx/utils/Nhcx_opertions.d.ts +20 -0
  26. package/lib/classes/nhcx/utils/Nhcx_opertions.d.ts.map +1 -0
  27. package/lib/classes/nhcx/utils/Nhcx_opertions.js +22 -0
  28. package/lib/classes/nhcx/utils/Nhcx_opertions.js.map +1 -0
  29. package/lib/classes/profile.d.ts.map +1 -1
  30. package/lib/classes/profile.js +2 -1
  31. package/lib/classes/profile.js.map +1 -1
  32. package/package.json +1 -1
@@ -0,0 +1,119 @@
1
+ declare const roles: readonly ["10001", "10002", "10003", "10004", "10005", "10006", "10007", "10008"];
2
+ declare type Role = (typeof roles)[number];
3
+ interface CREATE_OPTIONS {
4
+ linked_registry_codes?: string[];
5
+ registryid?: string;
6
+ participant_name: string;
7
+ /** Required for only payers expple "PMJAY" */
8
+ scheme_code?: string;
9
+ state: string;
10
+ district: string;
11
+ roles?: Role[];
12
+ primaryEmail: string;
13
+ additionalEmail?: string[];
14
+ phone?: string[];
15
+ additionalMobile?: string[];
16
+ primaryMobile: string;
17
+ signing_cert_path?: string;
18
+ encryption_cert?: string;
19
+ endpoint_url?: string;
20
+ address: {
21
+ description: "Physical address of the facility including its geolocation";
22
+ default_address: {
23
+ description: "Default address details";
24
+ street: string;
25
+ city: string;
26
+ state: string;
27
+ postal_code?: string;
28
+ country: string;
29
+ latitude?: string;
30
+ longitude?: string;
31
+ };
32
+ };
33
+ payment_details: {
34
+ description: "Default payment details (UPI or A/C Number + IFSC Code)";
35
+ default_payment: {
36
+ description: "Default payment details";
37
+ UPI: string;
38
+ account_number: string;
39
+ ifsc_code: string;
40
+ };
41
+ };
42
+ }
43
+ declare const orgStatus: readonly ["Created", "Active", "InActive", "Blocked"];
44
+ declare type OrgStatus = (typeof orgStatus)[number];
45
+ interface UPDATE_OPTION extends CREATE_OPTIONS {
46
+ participant_code: string;
47
+ status: OrgStatus[];
48
+ }
49
+ export default class Participant {
50
+ private url;
51
+ private privateKey;
52
+ private publicKey;
53
+ private endpointUrl;
54
+ private accessToken;
55
+ private heeder;
56
+ constructor(options: {
57
+ _accessToken: string;
58
+ url: string;
59
+ privateKey: string;
60
+ publicKey: string;
61
+ endpointUrl: string;
62
+ });
63
+ create(options: CREATE_OPTIONS): Promise<{
64
+ participant_code: string;
65
+ }>;
66
+ update(options: UPDATE_OPTION): Promise<any>;
67
+ fetchPartipants(partipitantType: "PROVIDER" | "PAYER"): Promise<import("axios").AxiosResponse<unknown, any>>;
68
+ fetchCert(participantId: string): Promise<any>;
69
+ search(participantId: string): Promise<UPDATE_OPTION>;
70
+ /**
71
+ * This method links abha to polices
72
+ * @param options
73
+ * @returns
74
+ */
75
+ linkPolicyesToAbha(options: {
76
+ requestid: string;
77
+ abhanumber: string;
78
+ mobilenumber: string;
79
+ memberid: string;
80
+ payerid: "string";
81
+ policies: {
82
+ productid: string;
83
+ productname: string;
84
+ }[];
85
+ processingid: string;
86
+ }): Promise<{
87
+ result: string;
88
+ errormessage?: {
89
+ errorcode: string;
90
+ errordescription: string;
91
+ };
92
+ }>;
93
+ /**
94
+ * This method gets all policies connected to mobile/abha
95
+ * @param options
96
+ * @returns
97
+ */
98
+ getPolicies(options: {
99
+ identifiertype: "MobileNo" | "AbhaNumber" | "MemberId";
100
+ identifiervalue: string;
101
+ }): Promise<{
102
+ participantdetails: {
103
+ participantcode: string;
104
+ participantname: string;
105
+ }[];
106
+ }>;
107
+ /**
108
+ * Updates partcipants cert and endpoint url
109
+ * @param options
110
+ * @returns
111
+ */
112
+ participantCertUpdtae(options: {
113
+ participantcode: string;
114
+ encryptioncert: string;
115
+ endpointurl: string;
116
+ }): Promise<any>;
117
+ }
118
+ export {};
119
+ //# sourceMappingURL=Particpant.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Particpant.d.ts","sourceRoot":"","sources":["../../../src/classes/nhcx/Particpant.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,KAAK,mFASD,CAAC;AACX,aAAK,IAAI,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnC,UAAU,cAAc;IACtB,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBA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AC;IAWF;;;;OAIG;IACG,WAAW,CAAC,OAAO,EAAE;QACzB,cAAc,EAAE,UAAU,GAAG,YAAY,GAAG,UAAU,CAAC;QACvD,eAAe,EAAE,MAAM,CAAC;KACzB,GAAG,OAAO,CAAC;QACV,kBAAkB,EAAE;YAClB,eAAe,EAAE,MAAM,CAAC;YACxB,eAAe,EAAE,MAAM,CAAC;SACzB,EAAE,CAAC;KACL,CAAC;IAWF;;;;OAIG;IACG,qBAAqB,CAAC,OAAO,EAAE;QACnC,eAAe,EAAE,MAAM,CAAC;QACxB,cAAc,EAAE,MAAM,CAAC;QACvB,WAAW,EAAE,MAAM,CAAC;KACrB;CAUF"}
@@ -0,0 +1,152 @@
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
+ const roles = [
18
+ "10001",
19
+ "10002",
20
+ "10003",
21
+ "10004",
22
+ "10005",
23
+ "10006",
24
+ "10007",
25
+ "10008",
26
+ ];
27
+ const orgStatus = ["Created", "Active", "InActive", "Blocked"];
28
+ class Participant {
29
+ constructor(options) {
30
+ this.url = "";
31
+ this.privateKey = "";
32
+ this.publicKey = "";
33
+ this.endpointUrl = "";
34
+ this.accessToken = "";
35
+ this.heeder = {
36
+ Accept: "application/json",
37
+ "Content-Type": "application/json",
38
+ uid: (0, uuid_1.v4)(),
39
+ bearer_auth: `Bearer ${this.accessToken}`,
40
+ };
41
+ this.accessToken = options._accessToken;
42
+ this.heeder = {
43
+ Accept: "application/json",
44
+ "Content-Type": "application/json",
45
+ uid: (0, uuid_1.v4)(),
46
+ bearer_auth: `Bearer ${this.accessToken}`,
47
+ };
48
+ this.url = options.url;
49
+ this.privateKey = options.privateKey;
50
+ this.publicKey = options.publicKey;
51
+ this.url = options.url;
52
+ this.endpointUrl = options.endpointUrl;
53
+ }
54
+ create(options) {
55
+ return __awaiter(this, void 0, void 0, function* () {
56
+ if (!options.endpoint_url) {
57
+ options.endpoint_url = this.endpointUrl;
58
+ }
59
+ const resp = yield axios_1.default.post(`${this.url}/participant/create`, options, {
60
+ headers: this.heeder,
61
+ });
62
+ return resp.data;
63
+ });
64
+ }
65
+ update(options) {
66
+ return __awaiter(this, void 0, void 0, function* () {
67
+ if (!options.endpoint_url) {
68
+ options.endpoint_url = this.endpointUrl;
69
+ }
70
+ const resp = yield axios_1.default.post(`${this.url}/participant/update`, options, {
71
+ headers: this.heeder,
72
+ });
73
+ return resp.data;
74
+ });
75
+ }
76
+ fetchPartipants(partipitantType) {
77
+ return __awaiter(this, void 0, void 0, function* () {
78
+ const body = {
79
+ role: partipitantType,
80
+ fromdate: `01/01/1970`,
81
+ todate: `01/01/${new Date().getFullYear() + 1}`,
82
+ };
83
+ const resp = yield axios_1.default.post(`${this.url}/fetch/participants/list`, body, {
84
+ headers: this.heeder,
85
+ });
86
+ return resp;
87
+ });
88
+ }
89
+ fetchCert(participantId) {
90
+ return __awaiter(this, void 0, void 0, function* () {
91
+ const body = {
92
+ participantid: participantId,
93
+ };
94
+ const resp = yield axios_1.default.post(`${this.url}/fetch/certs`, body, {
95
+ headers: this.heeder,
96
+ });
97
+ return resp.data;
98
+ });
99
+ }
100
+ search(participantId) {
101
+ return __awaiter(this, void 0, void 0, function* () {
102
+ const body = {
103
+ participant_code: participantId,
104
+ };
105
+ const resp = yield axios_1.default.post(`${this.url}/participant/search`, body, {
106
+ headers: this.heeder,
107
+ });
108
+ return resp.data;
109
+ });
110
+ }
111
+ /**
112
+ * This method links abha to polices
113
+ * @param options
114
+ * @returns
115
+ */
116
+ linkPolicyesToAbha(options) {
117
+ return __awaiter(this, void 0, void 0, function* () {
118
+ const resp = yield axios_1.default.post(`${this.url}/participant/link/abha/policy`, options, {
119
+ headers: this.heeder,
120
+ });
121
+ return resp.data;
122
+ });
123
+ }
124
+ /**
125
+ * This method gets all policies connected to mobile/abha
126
+ * @param options
127
+ * @returns
128
+ */
129
+ getPolicies(options) {
130
+ return __awaiter(this, void 0, void 0, function* () {
131
+ const resp = yield axios_1.default.post(`${this.url}/participant/get/policies`, options, {
132
+ headers: this.heeder,
133
+ });
134
+ return resp;
135
+ });
136
+ }
137
+ /**
138
+ * Updates partcipants cert and endpoint url
139
+ * @param options
140
+ * @returns
141
+ */
142
+ participantCertUpdtae(options) {
143
+ return __awaiter(this, void 0, void 0, function* () {
144
+ const resp = yield axios_1.default.post(`${this.url}/v2/participant/update`, options, {
145
+ headers: this.heeder,
146
+ });
147
+ return resp.data;
148
+ });
149
+ }
150
+ }
151
+ exports.default = Participant;
152
+ //# sourceMappingURL=Particpant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Particpant.js","sourceRoot":"","sources":["../../../src/classes/nhcx/Particpant.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+BAAoC;AACpC,kDAA0B;AAE1B,MAAM,KAAK,GAAG;IACZ,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;CACC,CAAC;AA6CX,MAAM,SAAS,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,CAAU,CAAC;AAaxE,MAAqB,WAAW;IAc9B,YAAY,OAMX;QAnBO,QAAG,GAAG,EAAE,CAAA;QACR,eAAU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CAAC;KAAA;IAED;;;;OAIG;IACG,kBAAkB,CAAC,OAWxB;;YAOC,MAAM,IAAI,GAAQ,MAAM,eAAK,CAAC,IAAI,CAChC,GAAG,IAAI,CAAC,GAAG,+BAA+B,EAC1C,OAAO,EACP;gBACE,OAAO,EAAE,IAAI,CAAC,MAAa;aAC5B,CACF,CAAC;YACF,OAAO,IAAI,CAAC,IAAI,CAAC;QACnB,CAAC;KAAA;IAED;;;;OAIG;IACG,WAAW,CAAC,OAGjB;;YAMC,MAAM,IAAI,GAAQ,MAAM,eAAK,CAAC,IAAI,CAChC,GAAG,IAAI,CAAC,GAAG,2BAA2B,EACtC,OAAO,EACP;gBACE,OAAO,EAAE,IAAI,CAAC,MAAa;aAC5B,CACF,CAAC;YACF,OAAO,IAAI,CAAC;QACd,CAAC;KAAA;IAED;;;;OAIG;IACG,qBAAqB,CAAC,OAI3B;;YACC,MAAM,IAAI,GAAQ,MAAM,eAAK,CAAC,IAAI,CAChC,GAAG,IAAI,CAAC,GAAG,wBAAwB,EACnC,OAAO,EACP;gBACE,OAAO,EAAE,IAAI,CAAC,MAAa;aAC5B,CACF,CAAC;YACF,OAAO,IAAI,CAAC,IAAI,CAAC;QACnB,CAAC;KAAA;CACF;AAhLD,8BAgLC"}
@@ -0,0 +1,16 @@
1
+ interface EncryptOptions {
2
+ cert: string;
3
+ headers: Record<string, any>;
4
+ payload: Record<string, any>;
5
+ format?: "compact" | "general" | "flattened" | undefined;
6
+ contentAlg?: string;
7
+ alg?: string;
8
+ }
9
+ interface DecryptOptions {
10
+ cert: string;
11
+ payload: string;
12
+ }
13
+ declare const encrypt: ({ cert, headers, payload, format, contentAlg, alg }: EncryptOptions) => Promise<any>;
14
+ declare const decrypt: ({ cert, payload }: DecryptOptions) => Promise<any>;
15
+ export { encrypt, decrypt };
16
+ //# sourceMappingURL=hcx.Encrypt_old.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hcx.Encrypt_old.d.ts","sourceRoot":"","sources":["../../../src/classes/nhcx/hcx.Encrypt_old.ts"],"names":[],"mappings":"AAEA,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAAC;IACzD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,QAAA,MAAM,OAAO,wDAOV,cAAc,KAAG,QAAQ,GAAG,CAO9B,CAAC;AAEF,QAAA,MAAM,OAAO,sBAA6B,cAAc,KAAG,QAAQ,GAAG,CAOrE,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC"}
@@ -0,0 +1,34 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.decrypt = exports.encrypt = void 0;
13
+ const node_jose_1 = require("node-jose");
14
+ const encrypt = ({ cert, headers, payload, format = 'compact', contentAlg = "A256GCM", alg = "RSA-OAEP-256" }) => __awaiter(void 0, void 0, void 0, function* () {
15
+ if (!(cert && headers && payload))
16
+ throw new Error('Invalid Input');
17
+ let key = yield node_jose_1.JWK.asKey(cert, "pem");
18
+ const buffer = Buffer.from(JSON.stringify(payload));
19
+ const fields = Object.assign({ alg }, headers);
20
+ const encrypted = yield node_jose_1.JWE.createEncrypt({ format, contentAlg, fields }, key).update(buffer).final();
21
+ return encrypted;
22
+ });
23
+ exports.encrypt = encrypt;
24
+ const decrypt = ({ cert, payload }) => __awaiter(void 0, void 0, void 0, function* () {
25
+ if (!(cert && payload))
26
+ throw new Error('Invalid Input');
27
+ let keystore = node_jose_1.JWK.createKeyStore();
28
+ yield keystore.add(yield node_jose_1.JWK.asKey(cert, "pem"));
29
+ let parsedPayload = node_jose_1.parse.compact(payload);
30
+ let decrypted = yield parsedPayload.perform(keystore);
31
+ return decrypted;
32
+ });
33
+ exports.decrypt = decrypt;
34
+ //# sourceMappingURL=hcx.Encrypt_old.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hcx.Encrypt_old.js","sourceRoot":"","sources":["../../../src/classes/nhcx/hcx.Encrypt_old.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAA4C;AAgB5C,MAAM,OAAO,GAAG,CAAO,EACrB,IAAI,EACJ,OAAO,EACP,OAAO,EACP,MAAM,GAAG,SAAS,EAClB,UAAU,GAAG,SAAS,EACtB,GAAG,GAAG,cAAc,EACL,EAAgB,EAAE;IACjC,IAAI,CAAC,CAAC,IAAI,IAAI,OAAO,IAAI,OAAO,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;IACpE,IAAI,GAAG,GAAG,MAAM,eAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACvC,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;IACpD,MAAM,MAAM,mBAAK,GAAG,IAAK,OAAO,CAAE,CAAC;IACnC,MAAM,SAAS,GAAG,MAAM,eAAG,CAAC,aAAa,CAAC,EAAE,MAAM,EAAG,UAAU,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,CAAC;IACvG,OAAO,SAAS,CAAC;AACnB,CAAC,CAAA,CAAC;AAWO,0BAAO;AAThB,MAAM,OAAO,GAAG,CAAO,EAAE,IAAI,EAAE,OAAO,EAAkB,EAAgB,EAAE;IACxE,IAAI,CAAC,CAAC,IAAI,IAAI,OAAO,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;IACzD,IAAI,QAAQ,GAAG,eAAG,CAAC,cAAc,EAAE,CAAC;IACpC,MAAM,QAAQ,CAAC,GAAG,CAAC,MAAM,eAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;IACjD,IAAI,aAAa,GAAG,iBAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3C,IAAI,SAAS,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACtD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAA,CAAC;AAEgB,0BAAO"}
@@ -0,0 +1,17 @@
1
+ export default class NhcxIncommingRequest {
2
+ private encryptionPrivateKey;
3
+ private Constants;
4
+ private output;
5
+ private headers;
6
+ private payload;
7
+ constructor(options: {
8
+ encryptionPrivateKey: string;
9
+ });
10
+ validateRequest(jwePayload: any): boolean;
11
+ process(options: {
12
+ payload: any;
13
+ publicCert: string;
14
+ privateKey: string;
15
+ }): Promise<any>;
16
+ }
17
+ //# sourceMappingURL=hcx_incomming.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hcx_incomming.d.ts","sourceRoot":"","sources":["../../../src/classes/nhcx/hcx_incomming.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,OAAO,OAAO,oBAAoB;IACvC,OAAO,CAAC,oBAAoB,CAAS;IACrC,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,OAAO,CAAM;IACrB,OAAO,CAAC,OAAO,CAAM;gBAET,OAAO,EAAE;QACnB,oBAAoB,EAAE,MAAM,CAAC;KAC9B;IASD,eAAe,CAAC,UAAU,EAAE,GAAG;IAkBzB,OAAO,CAAC,OAAO,EAAC;QAAC,OAAO,EAAE,GAAG,CAAC;QAAC,UAAU,EAAC,MAAM,CAAC;QAAC,UAAU,EAAC,MAAM,CAAA;KAAC;CAmB3E"}
@@ -0,0 +1,62 @@
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 Constants_1 = __importDefault(require("./utils/Constants"));
16
+ const JWEHelper_1 = __importDefault(require("./utils/JWEHelper"));
17
+ const node_jose_1 = __importDefault(require("node-jose"));
18
+ const { JWK, JWE, parse } = node_jose_1.default;
19
+ class NhcxIncommingRequest {
20
+ constructor(options) {
21
+ this.encryptionPrivateKey = options.encryptionPrivateKey;
22
+ this.headers = null;
23
+ this.payload = null;
24
+ this.output = {};
25
+ this.Constants = new Constants_1.default();
26
+ }
27
+ validateRequest(jwePayload) {
28
+ if (typeof jwePayload !== "object") {
29
+ if ("payload" in jwePayload) {
30
+ return true;
31
+ }
32
+ else {
33
+ const error = new Error();
34
+ error.message = "Incommeing reuest does not conatin payload";
35
+ error.name = "invalid Payload";
36
+ throw error;
37
+ }
38
+ }
39
+ else {
40
+ const error = new Error();
41
+ error.message = "Incommeing reuest no body object";
42
+ error.name = "invalid Payload";
43
+ throw error;
44
+ }
45
+ }
46
+ process(options) {
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ // this.validateRequest(payload);
49
+ let decryptedPayload = yield JWEHelper_1.default.decrypt({
50
+ privateKey: options.privateKey,
51
+ payload: options.payload.payload,
52
+ });
53
+ let ret = JSON.parse(decryptedPayload);
54
+ if (ret && ret.type == "Buffer") {
55
+ ret = JSON.parse(Buffer.from(ret).toString("utf8"));
56
+ }
57
+ return ret;
58
+ });
59
+ }
60
+ }
61
+ exports.default = NhcxIncommingRequest;
62
+ //# sourceMappingURL=hcx_incomming.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hcx_incomming.js","sourceRoot":"","sources":["../../../src/classes/nhcx/hcx_incomming.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,kEAA0C;AAC1C,kEAA2C;AAE3C,0DAA6B;AAC7B,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,mBAAI,CAAC;AAEjC,MAAqB,oBAAoB;IAOvC,YAAY,OAEX;QACC,IAAI,CAAC,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC;QAEzD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,IAAI,mBAAS,EAAE,CAAC;IACnC,CAAC;IAED,eAAe,CAAC,UAAe;QAC7B,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;YAClC,IAAI,SAAS,IAAI,UAAU,EAAE;gBAC3B,OAAO,IAAI,CAAC;aACb;iBAAM;gBACL,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC;gBAC1B,KAAK,CAAC,OAAO,GAAG,4CAA4C,CAAC;gBAC7D,KAAK,CAAC,IAAI,GAAG,iBAAiB,CAAC;gBAC/B,MAAM,KAAK,CAAC;aACb;SACF;aAAM;YACL,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC;YAC1B,KAAK,CAAC,OAAO,GAAG,kCAAkC,CAAC;YACnD,KAAK,CAAC,IAAI,GAAG,iBAAiB,CAAC;YAC/B,MAAM,KAAK,CAAC;SACb;IACH,CAAC;IAEK,OAAO,CAAC,OAA4D;;YACxE,iCAAiC;YAEjC,IAAI,gBAAgB,GAAG,MAAM,mBAAS,CAAC,OAAO,CAAC;gBAC7C,UAAU,EAAE,OAAO,CAAC,UAAU;gBAC9B,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,OAAO;aACjC,CAAC,CAAC;YAEJ,IAAI,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAA;YACtC,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,IAAI,QAAQ,EAAE;gBAChC,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAA;aACpD;YAED,OAAO,GAAG,CAAA;QAEV,CAAC;KAAA;CAIF;AAvDD,uCAuDC"}
@@ -0,0 +1,36 @@
1
+ declare const xHcxStatus: readonly ["request.initiate", "request.retry", "response.success", "response.fail", "response.sender_not_supported", "response.unhandled", "response.request_retry"];
2
+ declare type XHCXStatus = (typeof xHcxStatus)[number];
3
+ export default class NhcxOutGoingRequest {
4
+ private Constants;
5
+ private participantCode;
6
+ private protocolBasePath;
7
+ private accessToken;
8
+ constructor(options: {
9
+ participantCode: string;
10
+ protocolBasePath: string;
11
+ accessToken: string;
12
+ });
13
+ private createHeader;
14
+ private encryptPayload;
15
+ private initializeHCXCall;
16
+ process(options: {
17
+ fhirPayload: any;
18
+ recipientCode: any;
19
+ operation: any;
20
+ apiCallId?: any;
21
+ correlationId?: any;
22
+ workflowId?: any;
23
+ receipantPublicCert: any;
24
+ xHcxStatus: XHCXStatus;
25
+ }): Promise<{
26
+ payload: {
27
+ encrypted: string;
28
+ headers: {
29
+ [x: number]: any;
30
+ };
31
+ } | undefined;
32
+ response: import("axios").AxiosResponse<unknown, any> | undefined;
33
+ }>;
34
+ }
35
+ export {};
36
+ //# sourceMappingURL=hcx_outgoing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hcx_outgoing.d.ts","sourceRoot":"","sources":["../../../src/classes/nhcx/hcx_outgoing.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,UAAU,sKAQN,CAAC;AACX,aAAK,UAAU,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9C,MAAM,CAAC,OAAO,OAAO,mBAAmB;IACtC,OAAO,CAAC,SAAS,CAAM;IACvB,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,WAAW,CAAS;gBAChB,OAAO,EAAE;QACnB,eAAe,EAAE,MAAM,CAAC;QACxB,gBAAgB,EAAE,MAAM,CAAC;QACzB,WAAW,EAAE,MAAM,CAAC;KACrB;IAOD,OAAO,CAAC,YAAY;YAwBN,cAAc;YAsCd,iBAAiB;IAuBzB,OAAO,CAAC,OAAO,EAAE;QACrB,WAAW,EAAE,GAAG,CAAC;QACjB,aAAa,EAAE,GAAG,CAAC;QACnB,SAAS,EAAE,GAAG,CAAC;QACf,SAAS,CAAC,EAAE,GAAG,CAAC;QAChB,aAAa,CAAC,EAAE,GAAG,CAAC;QACpB,UAAU,CAAC,EAAE,GAAG,CAAC;QACjB,mBAAmB,EAAE,GAAG,CAAC;QACzB,UAAU,EAAE,UAAU,CAAC;KACxB;;;;;;;;;CA+BF"}
@@ -0,0 +1,118 @@
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 JWEHelper_1 = __importDefault(require("./utils/JWEHelper"));
17
+ const Constants_1 = __importDefault(require("./utils/Constants"));
18
+ const axios_1 = __importDefault(require("axios"));
19
+ const xHcxStatus = [
20
+ "request.initiate",
21
+ "request.retry",
22
+ "response.success",
23
+ "response.fail",
24
+ "response.sender_not_supported",
25
+ "response.unhandled",
26
+ "response.request_retry",
27
+ ];
28
+ class NhcxOutGoingRequest {
29
+ constructor(options) {
30
+ this.Constants = new Constants_1.default();
31
+ this.participantCode = options.participantCode;
32
+ this.protocolBasePath = options.protocolBasePath;
33
+ this.accessToken = options.accessToken;
34
+ }
35
+ createHeader(options) {
36
+ const headers = {
37
+ [this.Constants.ALG]: "RSA-OAEP",
38
+ [this.Constants.ENC]: "A256GCM",
39
+ [this.Constants.HCX_API_CALL_ID]: options.apiCallId || (0, uuid_1.v4)(),
40
+ [this.Constants.HCX_TIMESTAMP]: new Date().toISOString(),
41
+ };
42
+ headers[this.Constants.HCX_SENDER_CODE] = this.participantCode;
43
+ headers[this.Constants.HCX_RECIPIENT_CODE] = options.recipientCode;
44
+ headers[this.Constants.HCX_CORRELATION_ID] =
45
+ options.correlationId || (0, uuid_1.v4)();
46
+ headers[this.Constants.WORKFLOW_ID] = options.workflowId || (0, uuid_1.v4)();
47
+ headers[this.Constants.HCX_STATUS] = options.xHcxStatus;
48
+ return headers;
49
+ }
50
+ encryptPayload(options) {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ try {
53
+ const headers = this.createHeader({
54
+ recipientCode: options.recipientCode,
55
+ correlationId: options.correlationId,
56
+ workflowId: options.workflowId,
57
+ apiCallId: options.apiCallId,
58
+ xHcxStatus: options.xHcxStatus,
59
+ });
60
+ if (typeof options.fhirPayload !== "object") {
61
+ throw new Error("Fhir payload must be an object");
62
+ }
63
+ const publicCert = options.receipantPublicCert;
64
+ const encrypted = yield JWEHelper_1.default.encrypt({
65
+ cert: publicCert,
66
+ headers,
67
+ payload: options.fhirPayload,
68
+ });
69
+ return { encrypted, headers };
70
+ }
71
+ catch (error) {
72
+ console.error(`Error in encryptPayload: ${error.message}\n${error.stack}`);
73
+ }
74
+ });
75
+ }
76
+ initializeHCXCall(operation, jwePayload, accessToken, headers) {
77
+ return __awaiter(this, void 0, void 0, function* () {
78
+ try {
79
+ const url = `${this.protocolBasePath}${operation}`;
80
+ const payload = JSON.stringify({ payload: jwePayload });
81
+ headers = Object.assign(Object.assign({}, headers), { bearer_auth: `Bearer ${accessToken}`,
82
+ // Authorization: `Bearer ${accessToken}`,
83
+ "Content-Type": "application/json" });
84
+ const response = yield axios_1.default.post(url, payload, { headers });
85
+ return response;
86
+ }
87
+ catch (error) {
88
+ console.error(`Initialize HCX: ${error}`);
89
+ }
90
+ });
91
+ }
92
+ process(options) {
93
+ return __awaiter(this, void 0, void 0, function* () {
94
+ try {
95
+ const encryptedPayload = yield this.encryptPayload({
96
+ apiCallId: options.apiCallId,
97
+ correlationId: options.correlationId,
98
+ fhirPayload: options.fhirPayload,
99
+ receipantPublicCert: options.receipantPublicCert,
100
+ recipientCode: options.recipientCode,
101
+ workflowId: options.workflowId,
102
+ xHcxStatus: options.xHcxStatus
103
+ });
104
+ const response = yield this.initializeHCXCall(options.operation, encryptedPayload === null || encryptedPayload === void 0 ? void 0 : encryptedPayload.encrypted, this.accessToken, encryptedPayload === null || encryptedPayload === void 0 ? void 0 : encryptedPayload.headers);
105
+ return {
106
+ payload: encryptedPayload,
107
+ response,
108
+ };
109
+ }
110
+ catch (error) {
111
+ console.error(`Error in process: ${error}`);
112
+ throw new Error("Processing failed.");
113
+ }
114
+ });
115
+ }
116
+ }
117
+ exports.default = NhcxOutGoingRequest;
118
+ //# sourceMappingURL=hcx_outgoing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hcx_outgoing.js","sourceRoot":"","sources":["../../../src/classes/nhcx/hcx_outgoing.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+BAAoC;AACpC,kEAA4C;AAC5C,kEAA0C;AAC1C,kDAA0B;AAE1B,MAAM,UAAU,GAAG;IACjB,kBAAkB;IAClB,eAAe;IACf,kBAAkB;IAClB,eAAe;IACf,+BAA+B;IAC/B,oBAAoB;IACpB,wBAAwB;CAChB,CAAC;AAGX,MAAqB,mBAAmB;IAKtC,YAAY,OAIX;QACC,IAAI,CAAC,SAAS,GAAG,IAAI,mBAAS,EAAE,CAAC;QACjC,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;QAC/C,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;QACjD,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IACzC,CAAC;IAEO,YAAY,CAAC,OAMpB;QACC,MAAM,OAAO,GAAG;YACd,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,UAAU;YAChC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,SAAS;YAC/B,CAAC,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC,SAAS,IAAI,IAAA,SAAM,GAAE;YAC/D,CAAC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACzD,CAAC;QAEF,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,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gBAAgB,uBAAhB,gBAAgB,CAAE,OAAO,CAE1B,CAAC;gBAEF,OAAO;oBACL,OAAO,EAAE,gBAAgB;oBACzB,QAAQ;iBACT,CAAC;aACH;YAAC,OAAO,KAAK,EAAE;gBACd,OAAO,CAAC,KAAK,CAAC,qBAAqB,KAAK,EAAE,CAAC,CAAC;gBAE5C,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;aACvC;QACH,CAAC;KAAA;CACF;AA7ID,sCA6IC"}
@@ -0,0 +1,55 @@
1
+ export default class Constants {
2
+ HCX_SENDER_CODE: string;
3
+ HCX_RECIPIENT_CODE: string;
4
+ HCX_API_CALL_ID: string;
5
+ HCX_CORRELATION_ID: string;
6
+ WORKFLOW_ID: string;
7
+ /**request.initiate request.retry response.success response.fail response.sender_not_supported response.unhandled
8
+ response.request_retry */
9
+ HCX_STATUS: string;
10
+ HCX_TIMESTAMP: string;
11
+ STATUS: string;
12
+ ALG: string;
13
+ ENC: string;
14
+ ERROR: string;
15
+ A256GCM: string;
16
+ RSA_OAEP: string;
17
+ AUTHORIZATION: string;
18
+ ENCRYPTION_CERT: string;
19
+ PAYLOAD: string;
20
+ FHIR_PAYLOAD: string;
21
+ HEADERS: string;
22
+ RESPONSE_OBJ: string;
23
+ TIMESTAMP: string;
24
+ API_CALL_ID: string;
25
+ CORRELATION_ID: string;
26
+ DEBUG_FLAG: string;
27
+ ERROR_DETAILS: string;
28
+ DEBUG_DETAILS: string;
29
+ REDIRECT_STATUS: string;
30
+ COMPLETE_STATUS: string;
31
+ PARTIAL_STATUS: string;
32
+ PROTOCOL_PAYLOAD_LENGTH: number;
33
+ REDIRECT_TO: string;
34
+ DEBUG_FLAG_VALUES: string[];
35
+ REQUEST_STATUS_VALUES: string[];
36
+ ERROR_DETAILS_VALUES: string[];
37
+ ERROR_RESPONSE: string;
38
+ RECIPIENT_ERROR_VALUES: string[];
39
+ RESPONSE_STATUS_VALUES: string[];
40
+ CODE: string;
41
+ MESSAGE: string;
42
+ PARTICIPANTS: string;
43
+ PROTOCOL_BASE_PATH: string;
44
+ PARTICIPANT_CODE: string;
45
+ AUTH_BASE_PATH: string;
46
+ USERNAME: string;
47
+ PASSWORD: string;
48
+ ENCRYPTION_PRIVATE_KEY: string;
49
+ HCX_IG_BASE_PATH: string;
50
+ NRCES_IG_BASE_PATH: string;
51
+ FHIR_VALIDATION_ENABLED: string;
52
+ INCOMING_REQUEST_CLASS: string;
53
+ OUTGOING_REQUEST_CLASS: string;
54
+ }
55
+ //# sourceMappingURL=Constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Constants.d.ts","sourceRoot":"","sources":["../../../../src/classes/nhcx/utils/Constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,OAAO,SAAS;IAC1B,eAAe,SAAuB;IACtC,kBAAkB,SAA0B;IAC5C,eAAe,SAAsB;IACrC,kBAAkB,SAA0B;IAC5C,WAAW,SAAuB;IAClC;yBACqB;IACrB,UAAU,SAAiB;IAC3B,aAAa,SAAqB;IAClC,MAAM,SAAkB;IACxB,GAAG,SAAS;IACZ,GAAG,SAAS;IACZ,KAAK,SAAW;IAChB,OAAO,SAAa;IACpB,QAAQ,SAAc;IACtB,aAAa,SAAmB;IAChC,eAAe,SAAqB;IACpC,OAAO,SAAa;IACpB,YAAY,SAAiB;IAC7B,OAAO,SAAa;IACpB,YAAY,SAAiB;IAC7B,SAAS,SAAe;IACxB,WAAW,SAAiB;IAC5B,cAAc,SAAoB;IAElC,UAAU,SAAsB;IAChC,aAAa,SAAyB;IACtC,aAAa,SAAyB;IACtC,eAAe,SAAuB;IACtC,eAAe,SAAuB;IACtC,cAAc,SAAsB;IAEpC,uBAAuB,SAAK;IAC5B,WAAW,SAAuB;IAClC,iBAAiB,WAA8B;IAC/C,qBAAqB,WAA4C;IACjE,oBAAoB,WAAgC;IACpD,cAAc,SAAoB;IAGlC,sBAAsB,WAkBpB;IACF,sBAAsB,WAKpB;IACF,IAAI,SAAU;IACd,OAAO,SAAa;IACpB,YAAY,SAAkB;IAC9B,kBAAkB,SAAsB;IACxC,gBAAgB,SAAqB;IACrC,cAAc,SAAkB;IAChC,QAAQ,SAAc;IACtB,QAAQ,SAAc;IACtB,sBAAsB,SAA0B;IAChD,gBAAgB,SAAmB;IACnC,kBAAkB,SAAqB;IAEvC,uBAAuB,SAA2B;IAClD,sBAAsB,SAA0B;IAChD,sBAAsB,SAA0B;CACjD"}
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class Constants {
4
+ constructor() {
5
+ this.HCX_SENDER_CODE = "x-hcx-sender_code";
6
+ this.HCX_RECIPIENT_CODE = "x-hcx-recipient_code";
7
+ this.HCX_API_CALL_ID = "x-hcx-request_id";
8
+ this.HCX_CORRELATION_ID = "x-hcx-correlation_id";
9
+ this.WORKFLOW_ID = "x-hcx-workflow_id";
10
+ /**request.initiate request.retry response.success response.fail response.sender_not_supported response.unhandled
11
+ response.request_retry */
12
+ this.HCX_STATUS = "x-hcx-status";
13
+ this.HCX_TIMESTAMP = "x-hcx-timestamp";
14
+ this.STATUS = "x-hcx-status";
15
+ this.ALG = "alg";
16
+ this.ENC = "enc";
17
+ this.ERROR = "error";
18
+ this.A256GCM = "A256GCM";
19
+ this.RSA_OAEP = "RSA-OAEP";
20
+ this.AUTHORIZATION = "Authorization";
21
+ this.ENCRYPTION_CERT = "encryption_cert";
22
+ this.PAYLOAD = "payload";
23
+ this.FHIR_PAYLOAD = "fhirPayload";
24
+ this.HEADERS = "headers";
25
+ this.RESPONSE_OBJ = "responseObj";
26
+ this.TIMESTAMP = "timestamp";
27
+ this.API_CALL_ID = "api_call_id";
28
+ this.CORRELATION_ID = "correlation_id";
29
+ this.DEBUG_FLAG = "x-hcx-debug_flag";
30
+ this.ERROR_DETAILS = "x-hcx-error_details";
31
+ this.DEBUG_DETAILS = "x-hcx-debug_details";
32
+ this.REDIRECT_STATUS = "response.redirect";
33
+ this.COMPLETE_STATUS = "response.complete";
34
+ this.PARTIAL_STATUS = "response.partial";
35
+ this.PROTOCOL_PAYLOAD_LENGTH = 5;
36
+ this.REDIRECT_TO = "x-hcx-redirect_to";
37
+ this.DEBUG_FLAG_VALUES = ["Error", "Info", "Debug"];
38
+ this.REQUEST_STATUS_VALUES = ["request.queued", "request.dispatched"];
39
+ this.ERROR_DETAILS_VALUES = ["code", "message", "trace"];
40
+ this.ERROR_RESPONSE = "response.error";
41
+ this.RECIPIENT_ERROR_VALUES = [
42
+ "ERR_INVALID_ENCRYPTION",
43
+ "ERR_INVALID_PAYLOAD",
44
+ "ERR_WRONG_DOMAIN_PAYLOAD",
45
+ "ERR_INVALID_DOMAIN_PAYLOAD",
46
+ "ERR_SENDER_NOT_SUPPORTED",
47
+ "ERR_SERVICE_UNAVAILABLE",
48
+ "ERR_DOMAIN_PROCESSING",
49
+ "ERR_MANDATORY_HEADER_MISSING",
50
+ "ERR_INVALID_API_CALL_ID",
51
+ "ERR_INVALID_CORRELATION_ID",
52
+ "ERR_INVALID_TIMESTAMP",
53
+ "ERR_INVALID_REDIRECT_TO",
54
+ "ERR_INVALID_STATUS",
55
+ "ERR_INVALID_DEBUG_FLAG",
56
+ "ERR_INVALID_ERROR_DETAILS",
57
+ "ERR_INVALID_DEBUG_DETAILS",
58
+ "ERR_INVALID_WORKFLOW_ID",
59
+ ];
60
+ this.RESPONSE_STATUS_VALUES = [
61
+ "COMPLETE_STATUS",
62
+ "PARTIAL_STATUS",
63
+ "ERROR_RESPONSE",
64
+ "REDIRECT_STATUS",
65
+ ];
66
+ this.CODE = "code";
67
+ this.MESSAGE = "message";
68
+ this.PARTICIPANTS = "participants";
69
+ this.PROTOCOL_BASE_PATH = "protocolBasePath";
70
+ this.PARTICIPANT_CODE = "participantCode";
71
+ this.AUTH_BASE_PATH = "authBasePath";
72
+ this.USERNAME = "username";
73
+ this.PASSWORD = "password";
74
+ this.ENCRYPTION_PRIVATE_KEY = "encryptionPrivateKey";
75
+ this.HCX_IG_BASE_PATH = "hcxIGBasePath";
76
+ this.NRCES_IG_BASE_PATH = "nrcesIGBasePath";
77
+ this.FHIR_VALIDATION_ENABLED = "fhirValidationEnabled";
78
+ this.INCOMING_REQUEST_CLASS = "incomingRequestClass";
79
+ this.OUTGOING_REQUEST_CLASS = "outgoingRequestClass";
80
+ }
81
+ }
82
+ exports.default = Constants;
83
+ //# sourceMappingURL=Constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../../../src/classes/nhcx/utils/Constants.ts"],"names":[],"mappings":";;AAAA,MAAqB,SAAS;IAA9B;QACI,oBAAe,GAAG,mBAAmB,CAAC;QACtC,uBAAkB,GAAG,sBAAsB,CAAC;QAC5C,oBAAe,GAAG,kBAAkB,CAAC;QACrC,uBAAkB,GAAG,sBAAsB,CAAC;QAC5C,gBAAW,GAAG,mBAAmB,CAAC;QAClC;6BACqB;QACrB,eAAU,GAAG,cAAc,CAAA;QAC3B,kBAAa,GAAG,iBAAiB,CAAC;QAClC,WAAM,GAAG,cAAc,CAAC;QACxB,QAAG,GAAG,KAAK,CAAC;QACZ,QAAG,GAAG,KAAK,CAAC;QACZ,UAAK,GAAG,OAAO,CAAC;QAChB,YAAO,GAAG,SAAS,CAAC;QACpB,aAAQ,GAAG,UAAU,CAAC;QACtB,kBAAa,GAAG,eAAe,CAAC;QAChC,oBAAe,GAAG,iBAAiB,CAAC;QACpC,YAAO,GAAG,SAAS,CAAC;QACpB,iBAAY,GAAG,aAAa,CAAC;QAC7B,YAAO,GAAG,SAAS,CAAC;QACpB,iBAAY,GAAG,aAAa,CAAC;QAC7B,cAAS,GAAG,WAAW,CAAC;QACxB,gBAAW,GAAG,aAAa,CAAC;QAC5B,mBAAc,GAAG,gBAAgB,CAAC;QAElC,eAAU,GAAG,kBAAkB,CAAC;QAChC,kBAAa,GAAG,qBAAqB,CAAC;QACtC,kBAAa,GAAG,qBAAqB,CAAC;QACtC,oBAAe,GAAG,mBAAmB,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;AAjFH,4BAiFG"}
@@ -0,0 +1,12 @@
1
+ export default class JWEHelper {
2
+ static encrypt(options: {
3
+ cert: any;
4
+ headers: any;
5
+ payload: any;
6
+ }): Promise<string>;
7
+ static decrypt(options: {
8
+ privateKey: string;
9
+ payload: string;
10
+ }): Promise<string>;
11
+ }
12
+ //# sourceMappingURL=JWEHelper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JWEHelper.d.ts","sourceRoot":"","sources":["../../../../src/classes/nhcx/utils/JWEHelper.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,OAAO,OAAO,SAAS;WACf,OAAO,CAAC,OAAO,EAAE;QAC5B,IAAI,EAAE,GAAG,CAAC;QACV,OAAO,EAAE,GAAG,CAAC;QACb,OAAO,EAAE,GAAG,CAAC;KAEd;WAiBY,OAAO,CAAC,OAAO,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;CAStE"}
@@ -0,0 +1,45 @@
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 node_jose_1 = __importDefault(require("node-jose"));
16
+ const { JWK, JWE, parse } = node_jose_1.default;
17
+ class JWEHelper {
18
+ static encrypt(options) {
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ const format = "compact";
21
+ const contentAlg = "A256GCM";
22
+ const alg = "RSA-OAEP-256";
23
+ if (!(options.cert && options.headers && options.payload))
24
+ throw new Error("Invalid Input");
25
+ let key = yield JWK.asKey(options.cert, "pem");
26
+ // const buffer = Buffer.from(JSON.stringify(options.payload));
27
+ const fields = Object.assign({ alg }, options.headers);
28
+ const encrypted = yield JWE.createEncrypt({ format, contentAlg, fields }, key)
29
+ .update(JSON.stringify(options.payload))
30
+ .final();
31
+ return encrypted;
32
+ });
33
+ }
34
+ static decrypt(options) {
35
+ return __awaiter(this, void 0, void 0, function* () {
36
+ if (!(options.privateKey && options.payload))
37
+ throw new Error("Invalid Input");
38
+ const privateKey = yield node_jose_1.default.JWK.asKey(options.privateKey, 'pem');
39
+ const decrypted = yield node_jose_1.default.JWE.createDecrypt(privateKey).decrypt(options.payload);
40
+ return decrypted.payload.toString();
41
+ });
42
+ }
43
+ }
44
+ exports.default = JWEHelper;
45
+ //# sourceMappingURL=JWEHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JWEHelper.js","sourceRoot":"","sources":["../../../../src/classes/nhcx/utils/JWEHelper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,0DAA6B;AAC7B,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,mBAAI,CAAC;AAGjC,MAAqB,SAAS;IAC5B,MAAM,CAAO,OAAO,CAAC,OAKpB;;YACC,MAAM,MAAM,GAAG,SAAS,CAAA;YACxB,MAAM,UAAU,GAAG,SAAS,CAAA;YAC5B,MAAM,GAAG,GAAE,cAAc,CAAA;YACzB,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;YAC5F,IAAI,GAAG,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YAC/C,+DAA+D;YAC/D,MAAM,MAAM,mBAAK,GAAG,IAAK,OAAO,CAAC,OAAO,CAAE,CAAC;YAC3C,MAAM,SAAS,GAAG,MAAM,GAAG,CAAC,aAAa,CACvC,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,EAC9B,GAAG,CACJ;iBACE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;iBACvC,KAAK,EAAE,CAAC;YACX,OAAO,SAAS,CAAC;QACnB,CAAC;KAAA;IAED,MAAM,CAAO,OAAO,CAAC,OAAgD;;YACnE,IAAI,CAAC,CAAC,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;YAE/E,MAAM,UAAU,GAAG,MAAM,mBAAI,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;YACnE,MAAM,SAAS,GAAG,MAAM,mBAAI,CAAC,GAAG,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAEpF,OAAO,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;QACtC,CAAC;KAAA;CAEF;AAhCD,4BAgCC"}
@@ -0,0 +1,20 @@
1
+ declare const NhcxOperations: Readonly<{
2
+ COVERAGE_ELIGIBILITY_CHECK: string;
3
+ COVERAGE_ELIGIBILITY_ON_CHECK: string;
4
+ PRE_AUTH_SUBMIT: string;
5
+ PRE_AUTH_ON_SUBMIT: string;
6
+ CLAIM_SUBMIT: string;
7
+ CLAIM_ON_SUBMIT: string;
8
+ PAYMENT_NOTICE_REQUEST: string;
9
+ PAYMENT_NOTICE_ON_REQUEST: string;
10
+ HCX_STATUS: string;
11
+ HCX_ON_STATUS: string;
12
+ COMMUNICATION_REQUEST: string;
13
+ COMMUNICATION_ON_REQUEST: string;
14
+ PREDETERMINATION_SUBMIT: string;
15
+ PREDETERMINATION_ON_SUBMIT: string;
16
+ EOB_FETCH: string;
17
+ EOB_ON_FETCH: string;
18
+ }>;
19
+ export default NhcxOperations;
20
+ //# sourceMappingURL=Nhcx_opertions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Nhcx_opertions.d.ts","sourceRoot":"","sources":["../../../../src/classes/nhcx/utils/Nhcx_opertions.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;EAiBhB,CAAC;AAGH,eAAe,cAAc,CAAA"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const NhcxOperations = Object.freeze({
4
+ COVERAGE_ELIGIBILITY_CHECK: "/v1/coverageeligibility/check",
5
+ COVERAGE_ELIGIBILITY_ON_CHECK: "/v1/coverageeligibility/on_check",
6
+ PRE_AUTH_SUBMIT: "/preauth/submit",
7
+ PRE_AUTH_ON_SUBMIT: "/preauth/on_submit",
8
+ CLAIM_SUBMIT: "/claim/submit",
9
+ CLAIM_ON_SUBMIT: "/claim/on_submit",
10
+ PAYMENT_NOTICE_REQUEST: "/paymentnotice/request",
11
+ PAYMENT_NOTICE_ON_REQUEST: "/paymentnotice/on_request",
12
+ HCX_STATUS: "/hcx/status",
13
+ HCX_ON_STATUS: "/hcx/on_status",
14
+ COMMUNICATION_REQUEST: "/communication/request",
15
+ COMMUNICATION_ON_REQUEST: "/communication/on_request",
16
+ PREDETERMINATION_SUBMIT: "/predetermination/submit",
17
+ PREDETERMINATION_ON_SUBMIT: "/predetermination/on_submit",
18
+ EOB_FETCH: "/eob/fetch",
19
+ EOB_ON_FETCH: "/eob/on_fetch"
20
+ });
21
+ exports.default = NhcxOperations;
22
+ //# sourceMappingURL=Nhcx_opertions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Nhcx_opertions.js","sourceRoot":"","sources":["../../../../src/classes/nhcx/utils/Nhcx_opertions.ts"],"names":[],"mappings":";;AAAA,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC;IACjC,0BAA0B,EAAE,+BAA+B;IAC3D,6BAA6B,EAAE,kCAAkC;IACjE,eAAe,EAAE,iBAAiB;IAClC,kBAAkB,EAAE,oBAAoB;IACxC,YAAY,EAAE,eAAe;IAC7B,eAAe,EAAE,kBAAkB;IACnC,sBAAsB,EAAE,wBAAwB;IAChD,yBAAyB,EAAE,2BAA2B;IACtD,UAAU,EAAE,aAAa;IACzB,aAAa,EAAE,gBAAgB;IAC/B,qBAAqB,EAAE,wBAAwB;IAC/C,wBAAwB,EAAE,2BAA2B;IACrD,uBAAuB,EAAE,0BAA0B;IACnD,0BAA0B,EAAE,6BAA6B;IACzD,SAAS,EAAE,YAAY;IACvB,YAAY,EAAE,eAAe;CAC9B,CAAC,CAAC;AAGH,kBAAe,cAAc,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/classes/profile.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAC;AAI9B,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,MAAM;gBAC7B,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAGlD;;;;OAIG;IACH,SAAS,WAAkB;QACzB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAG,MAAM,CAAC;KACtB,kBAqCC;CACH"}
1
+ {"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/classes/profile.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAC;AAI9B,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,MAAM;gBAC7B,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAGlD;;;;OAIG;IACH,SAAS,WAAkB;QACzB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAG,MAAM,CAAC;KACtB,kBAsCC;CACH"}
@@ -25,7 +25,8 @@ class Profile extends header_1.default {
25
25
  */
26
26
  this.onProfile = (config) => __awaiter(this, void 0, void 0, function* () {
27
27
  const headers = this.headers(config.healthId);
28
- const url = `${this.baseUrl}gateway/v0.5/patients/profile/on-share`;
28
+ // const url = `${this.baseUrl}gateway/v0.5/patients/profile/on-share`;
29
+ const url = `${this.baseUrl}gateway/1.0/patients/profile/on-share`;
29
30
  const body = {
30
31
  requestId: (0, uuid_1.v4)(),
31
32
  timestamp: new Date().toISOString(),
@@ -1 +1 @@
1
- {"version":3,"file":"profile.js","sourceRoot":"","sources":["../../src/classes/profile.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,sDAA8B;AAC9B,+BAAoC;AACpC,wDAAgC;AAEhC,MAAqB,OAAQ,SAAQ,gBAAM;IACzC,YAAY,QAAgB,EAAE,YAAoB;QAChD,KAAK,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QAEhC;;;;WAIG;QACH,cAAS,GAAG,CAAO,MAMlB,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;YAEpE,MAAM,IAAI,GAAQ;gBAChB,SAAS,EAAE,IAAA,SAAM,GAAE;gBACnB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACnC,eAAe,EAAE;oBACf,MAAM,EAAE,SAAS;oBACjB,QAAQ,EAAE,MAAM,CAAC,QAAQ;oBACzB,WAAW,EAAC,MAAM,CAAC,WAAW;iBAC/B;g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AAS,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;YAID,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;YAKH,OAAO,IAAI,CAAC;QAEd,CAAC,CAAA,CAAC;IAlDF,CAAC;CAmDF;AAtDD,0BAsDC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ndhm-hrp",
3
- "version": "2.1.115",
3
+ "version": "2.2.0",
4
4
  "description": "This is ndhm-hpr",
5
5
  "main": "lib/index.js",
6
6
  "directories": {