ndhm-hrp 2.2.19 → 2.2.20
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/nhcx/JWEHelper.d.ts +13 -0
- package/lib/classes/nhcx/JWEHelper.d.ts.map +1 -0
- package/lib/classes/nhcx/JWEHelper.js +68 -0
- package/lib/classes/nhcx/JWEHelper.js.map +1 -0
- package/lib/classes/nhcx/interfaces.d.ts +13 -0
- package/lib/classes/nhcx/interfaces.d.ts.map +1 -0
- package/lib/classes/nhcx/interfaces.js +11 -0
- package/lib/classes/nhcx/interfaces.js.map +1 -0
- package/lib/index.d.ts +2 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -8
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/lib/classes/nhcx/hcx.Encrypt_old.d.ts +0 -16
- package/lib/classes/nhcx/hcx.Encrypt_old.d.ts.map +0 -1
- package/lib/classes/nhcx/hcx.Encrypt_old.js +0 -34
- package/lib/classes/nhcx/hcx.Encrypt_old.js.map +0 -1
- package/lib/classes/nhcx/hcx_incomming.d.ts +0 -17
- package/lib/classes/nhcx/hcx_incomming.d.ts.map +0 -1
- package/lib/classes/nhcx/hcx_incomming.js +0 -62
- package/lib/classes/nhcx/hcx_incomming.js.map +0 -1
- package/lib/classes/nhcx/hcx_outgoing.d.ts +0 -36
- package/lib/classes/nhcx/hcx_outgoing.d.ts.map +0 -1
- package/lib/classes/nhcx/hcx_outgoing.js +0 -118
- package/lib/classes/nhcx/hcx_outgoing.js.map +0 -1
- package/lib/classes/nhcx/utils/Constants.d.ts +0 -55
- package/lib/classes/nhcx/utils/Constants.d.ts.map +0 -1
- package/lib/classes/nhcx/utils/Constants.js +0 -83
- package/lib/classes/nhcx/utils/Constants.js.map +0 -1
- package/lib/classes/nhcx/utils/JWEHelper.d.ts +0 -12
- package/lib/classes/nhcx/utils/JWEHelper.d.ts.map +0 -1
- package/lib/classes/nhcx/utils/JWEHelper.js +0 -45
- package/lib/classes/nhcx/utils/JWEHelper.js.map +0 -1
- package/lib/classes/nhcx/utils/Nhcx_opertions.d.ts +0 -20
- package/lib/classes/nhcx/utils/Nhcx_opertions.d.ts.map +0 -1
- package/lib/classes/nhcx/utils/Nhcx_opertions.js +0 -22
- package/lib/classes/nhcx/utils/Nhcx_opertions.js.map +0 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HcxProtectedHeaders } from "./interfaces";
|
|
2
|
+
export default class JWEHelper {
|
|
3
|
+
static encrypt(options: {
|
|
4
|
+
cert: string;
|
|
5
|
+
headers: HcxProtectedHeaders;
|
|
6
|
+
payload: any;
|
|
7
|
+
}): Promise<string>;
|
|
8
|
+
static decrypt(option: {
|
|
9
|
+
cert: string;
|
|
10
|
+
payload: string;
|
|
11
|
+
}): Promise<any>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=JWEHelper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JWEHelper.d.ts","sourceRoot":"","sources":["../../../src/classes/nhcx/JWEHelper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAMnD,MAAM,CAAC,OAAO,OAAO,SAAS;WACf,OAAO,CAAC,OAAO,EAAC;QAC3B,IAAI,EAAC,MAAM,CAAC;QACZ,OAAO,EAAC,mBAAmB,CAAC;QAC5B,OAAO,EAAC,GAAG,CAAC;KACb;WA6BY,OAAO,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;CA0B/D"}
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
var keyData;
|
|
21
|
+
if (options.cert.startsWith("-----BEGIN CERTIFICATE-----")) {
|
|
22
|
+
keyData = options.cert;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
// keyData = await (await axios.default.get(cert)).data;
|
|
26
|
+
}
|
|
27
|
+
if (!(keyData && options.headers && options.payload))
|
|
28
|
+
throw new Error("Invalid Input");
|
|
29
|
+
let key = yield JWK.asKey(keyData, "pem");
|
|
30
|
+
const buffer = Buffer.from(JSON.stringify(options.payload));
|
|
31
|
+
const fields = Object.assign({ alg: "RSA-OAEP-256" }, options.headers);
|
|
32
|
+
const encrypted = yield JWE.createEncrypt({
|
|
33
|
+
"format": "compact",
|
|
34
|
+
"contentAlg": "A256GCM",
|
|
35
|
+
fields: fields
|
|
36
|
+
}, key)
|
|
37
|
+
.update(buffer)
|
|
38
|
+
.final();
|
|
39
|
+
console.log(encrypted);
|
|
40
|
+
return encrypted;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
static decrypt(option) {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
const keyData = option.cert;
|
|
46
|
+
if (!keyData.startsWith("-----BEGIN PRIVATE KEY-----")) {
|
|
47
|
+
throw new Error("Invalid private key provided");
|
|
48
|
+
}
|
|
49
|
+
// Convert the private key to a JWK key object
|
|
50
|
+
const privateKey = yield JWK.asKey(keyData, "pem");
|
|
51
|
+
try {
|
|
52
|
+
// Parse and decrypt the payload using the private key directly
|
|
53
|
+
const decrypted = yield JWE.createDecrypt(privateKey).decrypt(option.payload);
|
|
54
|
+
// Extract and parse the decrypted plaintext
|
|
55
|
+
const payloadString = decrypted.plaintext.toString();
|
|
56
|
+
const payloadObject = JSON.parse(payloadString);
|
|
57
|
+
console.log("Decrypted Payload:", payloadObject);
|
|
58
|
+
return payloadObject;
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
console.error("Decryption failed:", error);
|
|
62
|
+
throw error;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.default = JWEHelper;
|
|
68
|
+
//# sourceMappingURL=JWEHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JWEHelper.js","sourceRoot":"","sources":["../../../src/classes/nhcx/JWEHelper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,0DAA6B;AAE7B,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,mBAAI,CAAC;AAKjC,MAAqB,SAAS;IAC5B,MAAM,CAAO,OAAO,CAAC,OAIpB;;YAEC,IAAI,OAAO,CAAC;YACZ,IAAI,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,6BAA6B,CAAC,EAAE;gBAC1D,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;aACxB;iBAAM;gBACL,wDAAwD;aACzD;YAED,IAAI,CAAC,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,eA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B,EAAE,aAAa,CAAC,CAAC;gBACjD,OAAO,aAAa,CAAC;aACtB;YAAC,OAAO,KAAK,EAAE;gBACd,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;gBAC3C,MAAM,KAAK,CAAC;aACb;QACH,CAAC;KAAA;CAEF;AA5DD,4BA4DC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const HcxStatus: readonly ["request.initiated", "request.queued", "response.complete", "response.partial", "response.error"];
|
|
2
|
+
export interface HcxProtectedHeaders {
|
|
3
|
+
"x-hcx-api_call_id": string;
|
|
4
|
+
"x-hcx-workflow_id": string;
|
|
5
|
+
"x-hcx-request_id": string;
|
|
6
|
+
"x-hcx-status": typeof HcxStatus[number];
|
|
7
|
+
"x-hcx-timestamp": string;
|
|
8
|
+
"x-hcx-sender_code": string;
|
|
9
|
+
"x-hcx-recipient_code": string;
|
|
10
|
+
"x-hcx-correlation_id": string;
|
|
11
|
+
"x-hcx-ben-abha-id": string;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/classes/nhcx/interfaces.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,6GAMV,CAAA;AAGX,MAAM,WAAa,mBAAmB;IACnC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC;IACzC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,mBAAmB,EAAG,MAAM,CAAA;CAC7B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HcxStatus = void 0;
|
|
4
|
+
exports.HcxStatus = [
|
|
5
|
+
"request.initiated",
|
|
6
|
+
"request.queued",
|
|
7
|
+
"response.complete",
|
|
8
|
+
"response.partial",
|
|
9
|
+
"response.error"
|
|
10
|
+
];
|
|
11
|
+
//# sourceMappingURL=interfaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/classes/nhcx/interfaces.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG;IACrB,mBAAmB;IACnB,gBAAgB;IAChB,mBAAmB;IACnB,kBAAkB;IAClB,gBAAgB;CACR,CAAA"}
|
package/lib/index.d.ts
CHANGED
|
@@ -12,9 +12,7 @@ import ConsentRequest, { PurposeArray, CONSENTFLOW_REQUEST_INIT } from "./classe
|
|
|
12
12
|
import SubscriptionRequest, { HIU_SUBSCRIPTION_REQUEST, HIU_SUBSCRIPTION_REQUEST_ON_NOTIFY } from "./classes/subscription-request";
|
|
13
13
|
import Subscriptions, { HIU_SUBSCRIPTIONS_ON_NOTIFY } from "./classes/subscriptions";
|
|
14
14
|
export { Register, UserAuth, Link, Discovery, ConsentFlow, Profile, AbhaNumber, DataFlow, HealthInformation, STATUS_RESPONSES_HEALTH_INFORMATION_NOTIFY, ConsentRequest, Patients, PurposeArray, HIU_CM_REQUEST, CONSENTFLOW_REQUEST_INIT, HIU_SUBSCRIPTION_REQUEST, HIU_SUBSCRIPTION_REQUEST_ON_NOTIFY, SubscriptionRequest, Subscriptions, HIU_SUBSCRIPTIONS_ON_NOTIFY, };
|
|
15
|
-
export { default as JWEHelper } from "./classes/nhcx/
|
|
15
|
+
export { default as JWEHelper } from "./classes/nhcx/JWEHelper";
|
|
16
16
|
export { default as Participant } from "./classes/nhcx/Particpant";
|
|
17
|
-
export {
|
|
18
|
-
export { default as NhcxIncommingRequest } from "./classes/nhcx/hcx_incomming";
|
|
19
|
-
export { default as Nhcx_opertions } from "./classes/nhcx/utils/Nhcx_opertions";
|
|
17
|
+
export { HcxProtectedHeaders } from "./classes/nhcx/interfaces";
|
|
20
18
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,oBAAoB,CAAC;AAC1C,OAAO,QAAQ,MAAM,oBAAoB,CAAC;AAC1C,OAAO,IAAI,MAAM,gBAAgB,CAAC;AAClC,OAAO,SAAS,MAAM,qBAAqB,CAAC;AAC5C,OAAO,WAAW,MAAM,wBAAwB,CAAC;AACjD,OAAO,OAAO,MAAM,mBAAmB,CAAC;AACxC,OAAO,UAAU,MAAM,gBAAgB,CAAC;AACxC,OAAO,QAAQ,MAAM,qBAAqB,CAAC;AAC3C,OAAO,QAAQ,MAAM,oBAAoB,CAAC;AAC1C,OAAO,iBAAiB,EAAE,EAAC,cAAc,EAAE,0CAA0C,EAAC,MAAM,8BAA8B,CAAC;AAC3H,OAAO,cAAc,EAAE,EAAC,YAAY,EAAE,wBAAwB,EAAC,MAAM,2BAA2B,CAAC;AACjG,OAAO,mBAAmB,EAAE,EAAC,wBAAwB,EAAE,kCAAkC,EAAC,MAAM,gCAAgC,CAAC;AACjI,OAAO,aAAa,EAAE,EAAC,2BAA2B,EAAC,MAAO,yBAAyB,CAAC;AAMpF,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,SAAS,EACT,WAAW,EACX,OAAO,EACP,UAAU,EACV,QAAQ,EACR,iBAAiB,EACjB,0CAA0C,EAC1C,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,wBAAwB,EACxB,wBAAwB,EACxB,kCAAkC,EAClC,mBAAmB,EACnB,aAAa,EACb,2BAA2B,GAI5B,CAAC;AAGF,OAAO,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/lib/index.js
CHANGED
|
@@ -22,7 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.
|
|
25
|
+
exports.Participant = exports.JWEHelper = exports.Subscriptions = exports.SubscriptionRequest = exports.PurposeArray = exports.Patients = exports.ConsentRequest = exports.HealthInformation = exports.DataFlow = exports.AbhaNumber = exports.Profile = exports.ConsentFlow = exports.Discovery = exports.Link = exports.UserAuth = exports.Register = void 0;
|
|
26
26
|
const register_1 = __importDefault(require("./classes/register"));
|
|
27
27
|
exports.Register = register_1.default;
|
|
28
28
|
const userAuth_1 = __importDefault(require("./classes/userAuth"));
|
|
@@ -50,14 +50,8 @@ const subscription_request_1 = __importDefault(require("./classes/subscription-r
|
|
|
50
50
|
exports.SubscriptionRequest = subscription_request_1.default;
|
|
51
51
|
const subscriptions_1 = __importDefault(require("./classes/subscriptions"));
|
|
52
52
|
exports.Subscriptions = subscriptions_1.default;
|
|
53
|
-
var JWEHelper_1 = require("./classes/nhcx/
|
|
53
|
+
var JWEHelper_1 = require("./classes/nhcx/JWEHelper");
|
|
54
54
|
Object.defineProperty(exports, "JWEHelper", { enumerable: true, get: function () { return __importDefault(JWEHelper_1).default; } });
|
|
55
55
|
var Particpant_1 = require("./classes/nhcx/Particpant");
|
|
56
56
|
Object.defineProperty(exports, "Participant", { enumerable: true, get: function () { return __importDefault(Particpant_1).default; } });
|
|
57
|
-
var hcx_outgoing_1 = require("./classes/nhcx/hcx_outgoing");
|
|
58
|
-
Object.defineProperty(exports, "NhcxOutGoingRequest", { enumerable: true, get: function () { return __importDefault(hcx_outgoing_1).default; } });
|
|
59
|
-
var hcx_incomming_1 = require("./classes/nhcx/hcx_incomming");
|
|
60
|
-
Object.defineProperty(exports, "NhcxIncommingRequest", { enumerable: true, get: function () { return __importDefault(hcx_incomming_1).default; } });
|
|
61
|
-
var Nhcx_opertions_1 = require("./classes/nhcx/utils/Nhcx_opertions");
|
|
62
|
-
Object.defineProperty(exports, "Nhcx_opertions", { enumerable: true, get: function () { return __importDefault(Nhcx_opertions_1).default; } });
|
|
63
57
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kEAA0C;AAmBxC,mBAnBK,kBAAQ,CAmBL;AAlBV,kEAA0C;AAmBxC,mBAnBK,kBAAQ,CAmBL;AAlBV,0DAAkC;AAmBhC,eAnBK,cAAI,CAmBL;AAlBN,oEAA4C;AAmB1C,oBAnBK,mBAAS,CAmBL;AAlBX,0EAAiD;AAmB/C,sBAnBK,sBAAW,CAmBL;AAlBb,gEAAwC;AAmBtC,kBAnBK,iBAAO,CAmBL;AAlBT,0DAAwC;AAmBtC,qBAnBK,cAAU,CAmBL;AAlBZ,oEAA2C;AAmBzC,mBAnBK,mBAAQ,CAmBL;AAlBV,kEAA0C;AAsBxC,mBAtBK,kBAAQ,CAsBL;AArBV,sFAA2H;AAkBzH,4BAlBK,4BAAiB,CAkBL;AAjBnB,6EAAiG;AAmB/F,yBAnBK,yBAAc,CAmBL;AAEd,6FArBsB,8BAAY,OAqBtB;AApBd,0FAAiI;AAyB/H,8BAzBK,8BAAmB,CAyBL;AAxBrB,4EAAoF;AAyBlF,wBAzBK,uBAAa,CAyBL;AAQf,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kEAA0C;AAmBxC,mBAnBK,kBAAQ,CAmBL;AAlBV,kEAA0C;AAmBxC,mBAnBK,kBAAQ,CAmBL;AAlBV,0DAAkC;AAmBhC,eAnBK,cAAI,CAmBL;AAlBN,oEAA4C;AAmB1C,oBAnBK,mBAAS,CAmBL;AAlBX,0EAAiD;AAmB/C,sBAnBK,sBAAW,CAmBL;AAlBb,gEAAwC;AAmBtC,kBAnBK,iBAAO,CAmBL;AAlBT,0DAAwC;AAmBtC,qBAnBK,cAAU,CAmBL;AAlBZ,oEAA2C;AAmBzC,mBAnBK,mBAAQ,CAmBL;AAlBV,kEAA0C;AAsBxC,mBAtBK,kBAAQ,CAsBL;AArBV,sFAA2H;AAkBzH,4BAlBK,4BAAiB,CAkBL;AAjBnB,6EAAiG;AAmB/F,yBAnBK,yBAAc,CAmBL;AAEd,6FArBsB,8BAAY,OAqBtB;AApBd,0FAAiI;AAyB/H,8BAzBK,8BAAmB,CAyBL;AAxBrB,4EAAoF;AAyBlF,wBAzBK,uBAAa,CAyBL;AAQf,sDAA6D;AAArD,uHAAA,OAAO,OAAa;AAC5B,wDAAkE;AAAzD,0HAAA,OAAO,OAAe"}
|
package/package.json
CHANGED
|
@@ -1,16 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,34 +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
|
-
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,62 +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 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;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;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"}
|
|
@@ -1,36 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,118 +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 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
|
|
@@ -1 +0,0 @@
|
|
|
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,+BA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KFLOW_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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,83 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,CAA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iB;YACjB,gBAAgB;YAChB,gBAAgB;YAChB,iBAAiB;SAClB,CAAC;QACF,SAAI,GAAG,MAAM,CAAC;QACd,YAAO,GAAG,SAAS,CAAC;QACpB,iBAAY,GAAG,cAAc,CAAC;QAC9B,uBAAkB,GAAG,kBAAkB,CAAC;QACxC,qBAAgB,GAAG,iBAAiB,CAAC;QACrC,mBAAc,GAAG,cAAc,CAAC;QAChC,aAAQ,GAAG,UAAU,CAAC;QACtB,aAAQ,GAAG,UAAU,CAAC;QACtB,2BAAsB,GAAG,sBAAsB,CAAC;QAChD,qBAAgB,GAAG,eAAe,CAAC;QACnC,uBAAkB,GAAG,iBAAiB,CAAC;QAEvC,4BAAuB,GAAG,uBAAuB,CAAC;QAClD,2BAAsB,GAAG,sBAAsB,CAAC;QAChD,2BAAsB,GAAG,sBAAsB,CAAC;IAClD,CAAC;CAAA;AAjFH,4BAiFG"}
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,45 +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 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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,22 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|