@metriport/commonwell-cert-runner 1.0.3 → 1.0.4

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/README.md CHANGED
@@ -57,7 +57,9 @@ Display help for command.
57
57
 
58
58
  `npm run build`: builds the package
59
59
 
60
- `npm run local`: installs the package globally and runs it
60
+ `npm start`: runs the local code pointing to `./.env`
61
+
62
+ (optionally) `npm run install-local`: installs the package globally from the local source
61
63
 
62
64
  ```
63
65
  ,▄,
package/lib/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  #!/usr/bin/env node
2
- export {};
2
+ import { Command } from "commander";
3
+ export declare const program: Command;
package/lib/index.js CHANGED
@@ -10,23 +10,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  });
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.program = void 0;
13
14
  const commonwell_sdk_1 = require("@metriport/commonwell-sdk");
14
- const nanoid = require("nanoid");
15
- const dotenv = require("dotenv");
16
15
  const commander_1 = require("commander");
16
+ const dotenv = require("dotenv");
17
+ const org_management_1 = require("./org-management");
18
+ const person_management_1 = require("./person-management");
19
+ const patient_management_1 = require("./patient-management");
20
+ const link_management_1 = require("./link-management");
21
+ const util_1 = require("./util");
17
22
  function metriportBanner() {
18
23
  return `
19
24
  ,▄,
20
25
  ▄▓███▌
21
26
  ▄▀╙ ▀▓▀ ²▄
22
- ▄└ ╙▌
23
- ,▀ ╨▄
24
- ▌ ║
25
-
26
-
27
- ,▓██▄ ╔███▄
28
- ╙███▌ ▀███▀
29
- ▀▄
27
+ ▄└ ╙▌
28
+ ,▀ ╨▄
29
+ ▌ ║
30
+
31
+
32
+ ,▓██▄ ╔███▄
33
+ ╙███▌ ▀███▀
34
+ ▀▄
30
35
  ▀╗▄ ,▄
31
36
  '╙▀▀▀▀▀╙''
32
37
 
@@ -35,14 +40,16 @@ function metriportBanner() {
35
40
  CommonWell Cert Runner
36
41
  `;
37
42
  }
38
- const program = new commander_1.Command();
39
- program
43
+ exports.program = new commander_1.Command();
44
+ exports.program
40
45
  .name("cw-cert-runner")
41
46
  .description("Tool to run through Edge System CommonWell certification test cases.")
42
47
  .requiredOption(`--env-file <file-path>`, `Absolute path to the .env file containing required config. Example required file contents:
43
48
 
44
49
  COMMONWELL_ORG_NAME=Metriport
45
50
  COMMONWELL_OID=2.16.840.1.113883.3.9621
51
+ COMMONWELL_SANDBOX_ORG_NAME=Metriport-OrgA-1617
52
+ COMMONWELL_SANDBOX_OID=2.16.840.1.113883.3.3330.8889429.1617.1
46
53
  COMMONWELL_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----
47
54
  fkadsjhfhdsakjfhdsakhfkdsahfadshfkhdsfhdsakfdhafkashdfkjhalsdkjf
48
55
  -----END PRIVATE KEY-----
@@ -58,107 +65,28 @@ asdlkfjladsjflkjdaslkfjdsafjadslfjasdlkfjdsaklfjdkalfjdslfjalkjs
58
65
  function main() {
59
66
  return __awaiter(this, void 0, void 0, function* () {
60
67
  console.log(metriportBanner());
61
- program.parse();
62
- const options = program.opts();
68
+ exports.program.parse();
69
+ const options = exports.program.opts();
63
70
  dotenv.config({ path: options.envFile });
64
- const commonwellPrivateKey = process.env.COMMONWELL_PRIVATE_KEY;
65
- const commonwellCert = process.env.COMMONWELL_CERTIFICATE;
66
- const commonwellOID = process.env.COMMONWELL_OID;
67
- const commonwellOrgName = process.env.COMMONWELL_ORG_NAME;
71
+ const commonwellPrivateKey = (0, util_1.getEnvOrFail)("COMMONWELL_PRIVATE_KEY");
72
+ const commonwellCert = (0, util_1.getEnvOrFail)("COMMONWELL_CERTIFICATE");
73
+ const commonwellOID = (0, util_1.getEnvOrFail)("COMMONWELL_OID");
74
+ const commonwellOrgName = (0, util_1.getEnvOrFail)("COMMONWELL_ORG_NAME");
68
75
  const commonWell = new commonwell_sdk_1.CommonWell(commonwellCert, commonwellPrivateKey, commonwellOrgName, commonwellOID, commonwell_sdk_1.APIMode.integration);
76
+ const commonwellSandboxOID = (0, util_1.getEnvOrFail)("COMMONWELL_SANDBOX_OID");
77
+ const commonwellSandboxOrgName = (0, util_1.getEnvOrFail)("COMMONWELL_SANDBOX_ORG_NAME");
78
+ const commonWellSandbox = new commonwell_sdk_1.CommonWell(commonwellCert, commonwellPrivateKey, commonwellSandboxOrgName, commonwellSandboxOID, commonwell_sdk_1.APIMode.integration);
79
+ const commonwellMemberOID = (0, util_1.getEnvOrFail)("COMMONWELL_MEMBER_OID");
80
+ const commonWellMember = new commonwell_sdk_1.CommonWell(commonwellCert, commonwellPrivateKey, commonwellOrgName, commonwellMemberOID, commonwell_sdk_1.APIMode.integration);
69
81
  const queryMeta = {
70
82
  purposeOfUse: commonwell_sdk_1.PurposeOfUse.TREATMENT,
71
83
  role: "ict",
72
84
  subjectId: "admin",
73
85
  };
74
- const caDriversLicenseUri = "urn:oid:2.16.840.1.113883.4.3.6";
75
- const driversLicenseId = nanoid.nanoid();
76
- let personStrongId = {
77
- details: {
78
- address: [
79
- {
80
- use: commonwell_sdk_1.AddressUseCodes.home,
81
- zip: "94041",
82
- state: "CA",
83
- line: ["335 Pioneer Way"],
84
- city: "Mountain View",
85
- },
86
- ],
87
- name: [
88
- {
89
- use: commonwell_sdk_1.NameUseCodes.usual,
90
- given: ["Paul"],
91
- family: ["Greyham"],
92
- },
93
- ],
94
- gender: {
95
- code: "M",
96
- },
97
- birthDate: "1980-04-20T00:00:00Z",
98
- identifier: [
99
- {
100
- use: commonwell_sdk_1.IdentifierUseCodes.usual,
101
- key: driversLicenseId,
102
- system: caDriversLicenseUri,
103
- period: {
104
- start: "1996-04-20T00:00:00Z",
105
- },
106
- },
107
- ],
108
- },
109
- };
110
- const respC1a = yield commonWell.enrollPerson(queryMeta, personStrongId);
111
- console.log(respC1a);
112
- let person = {
113
- details: {
114
- address: [
115
- {
116
- use: commonwell_sdk_1.AddressUseCodes.home,
117
- zip: "94111",
118
- state: "CA",
119
- line: ["755 Sansome Street"],
120
- city: "San Francisco",
121
- },
122
- ],
123
- name: [
124
- {
125
- use: commonwell_sdk_1.NameUseCodes.usual,
126
- given: ["Mary"],
127
- family: ["Jane"],
128
- },
129
- ],
130
- gender: {
131
- code: "F",
132
- },
133
- birthDate: "2000-04-20T00:00:00Z",
134
- },
135
- };
136
- const respC1b = yield commonWell.enrollPerson(queryMeta, person);
137
- console.log(respC1b);
138
- const respC2a = yield commonWell.searchPerson(queryMeta, driversLicenseId, caDriversLicenseUri);
139
- console.log(respC2a);
140
- const personId = (0, commonwell_sdk_1.getId)(respC1a);
141
- personStrongId.details.name[0].family[0] = "Graham";
142
- const respC3a = yield commonWell.updatePerson(queryMeta, personStrongId, personId);
143
- console.log(respC3a);
144
- const personId2 = (0, commonwell_sdk_1.getId)(respC1b);
145
- const driversLicenseId2 = nanoid.nanoid();
146
- person.details.identifier = [
147
- {
148
- use: commonwell_sdk_1.IdentifierUseCodes.usual,
149
- key: driversLicenseId2,
150
- system: caDriversLicenseUri,
151
- period: {
152
- start: "2016-04-20T00:00:00Z",
153
- },
154
- },
155
- ];
156
- const respC3b = yield commonWell.updatePerson(queryMeta, person, personId2);
157
- console.log(respC3b);
158
- const respC6a = yield commonWell.unenrollPerson(queryMeta, personId2);
159
- console.log(respC6a);
160
- yield commonWell.deletePerson(queryMeta, personId);
161
- yield commonWell.deletePerson(queryMeta, personId2);
86
+ yield (0, org_management_1.orgManagement)(commonWellMember, queryMeta);
87
+ yield (0, person_management_1.personManagement)(commonWell, queryMeta);
88
+ yield (0, patient_management_1.patientManagement)(commonWell, commonWellSandbox, queryMeta);
89
+ yield (0, link_management_1.linkManagement)(commonWell, queryMeta);
162
90
  });
163
91
  }
164
92
  main();
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,8DAUmC;AACnC,iCAAiC;AACjC,iCAAiC;AACjC,yCAAoC;AAEpC,SAAS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AM,UAAU,GAAG,IAAI,2BAAU,CAC/B,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,wBAAO,CAAC,WAAW,CACpB,CAAC;QAGF,MAAM,oBAAoB,GAAG,IAAA,mBAAY,EAAC,wBAAwB,CAAC,CAAC;QACpE,MAAM,wBAAwB,GAAG,IAAA,mBAAY,EAAC,6BAA6B,CAAC,CAAC;QAE7E,MAAM,iBAAiB,GAAG,IAAI,2BAAU,CACtC,cAAc,EACd,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,EACpB,wBAAO,CAAC,WAAW,CACpB,CAAC;QAGF,MAAM,mBAAmB,GAAG,IAAA,mBAAY,EAAC,uBAAuB,CAAC,CAAC;QAElE,MAAM,gBAAgB,GAAG,IAAI,2BAAU,CACrC,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,wBAAO,CAAC,WAAW,CACpB,CAAC;QAEF,MAAM,SAAS,GAAoB;YACjC,YAAY,EAAE,6BAAY,CAAC,SAAS;YACpC,IAAI,EAAE,KAAK;YACX,SAAS,EAAE,OAAO;SACnB,CAAC;QAIF,MAAM,IAAA,8BAAa,EAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC;QACjD,MAAM,IAAA,oCAAgB,EAAC,UAAU,EAAE,SAAS,CAAC,CAAC;QAC9C,MAAM,IAAA,sCAAiB,EAAC,UAAU,EAAE,iBAAiB,EAAE,SAAS,CAAC,CAAC;QAClE,MAAM,IAAA,gCAAc,EAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IAC9C,CAAC;CAAA;AAED,IAAI,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import { CommonWell, RequestMetadata } from "@metriport/commonwell-sdk";
3
+ export declare function linkManagement(commonWell: CommonWell, queryMeta: RequestMetadata): Promise<void>;
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
+ return new (P || (P = Promise))(function (resolve, reject) {
6
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10
+ });
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.linkManagement = void 0;
14
+ const commonwell_sdk_1 = require("@metriport/commonwell-sdk");
15
+ const payloads_1 = require("./payloads");
16
+ function linkManagement(commonWell, queryMeta) {
17
+ return __awaiter(this, void 0, void 0, function* () {
18
+ console.log(`>>> ​C5a : Link a Patient to a Person upgrading from LOLA 1 to LOLA 2.`);
19
+ const person = yield commonWell.enrollPerson(queryMeta, payloads_1.personStrongId);
20
+ const personId = (0, commonwell_sdk_1.getId)(person);
21
+ const respPatient = yield commonWell.registerPatient(queryMeta, payloads_1.patient);
22
+ const patientId = (0, commonwell_sdk_1.getIdTrailingSlash)(respPatient);
23
+ const referenceLink = respPatient._links.self.href;
24
+ const respC5a = yield commonWell.patientLink(queryMeta, personId, referenceLink);
25
+ console.log(respC5a);
26
+ console.log(`>>> ​C5b : ​Upgrade Patient link from LOLA 2 to LOLA 3 (with Strong ID).`);
27
+ const respC5b = yield commonWell.updatePatientLink(queryMeta, respC5a._links.self.href, respPatient._links.self.href, payloads_1.identifier);
28
+ console.log(respC5b);
29
+ console.log(`>>> ​C5c : ​Downgrade Patient link from LOLA 3 to LOLA 2 (without Strong ID).`);
30
+ const respC5c = yield commonWell.updatePatientLink(queryMeta, respC5a._links.self.href, respPatient._links.self.href, null);
31
+ console.log(respC5c);
32
+ console.log(`>>> ​C5a : ​Delete Patient/Person link that exists as LOLA 2.`);
33
+ yield commonWell.deletePatientLink(queryMeta, respC5c._links.self.href);
34
+ yield commonWell.deletePerson(queryMeta, personId);
35
+ yield commonWell.deletePatient(queryMeta, patientId);
36
+ });
37
+ }
38
+ exports.linkManagement = linkManagement;
39
+ //# sourceMappingURL=link-management.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link-management.js","sourceRoot":"","sources":["../src/link-management.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,8DAAmG;AAEnG,yCAAiE;AAKjE,SAAsB,cAAc,CAAC,UAAsB,EAAE,SAA0B;;QAErF,OAAO,CAAC,GAAG,CAAC,wEAAwE,CAAC,CAAC;QACtF,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,YAAY,CAAC,SAAS,EAAE,yBAAc,CAAC,CAAC;QACxE,MAAM,QAAQ,GAAG,IAAA,sBAAK,EAAC,MAAM,CAAC,CAAC;QAE/B,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,eAAe,CAAC,SAAS,EAAE,kBAAO,CAAC,CAAC;QACzE,MAAM,SAAS,GAAG,IAAA,mCAAkB,EAAC,WAAW,CAAC,CAAC;QAClD,MAAM,aAAa,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;QACnD,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,WAAW,CAAC,SAAS,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC;QACjF,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAErB,OAAO,CAAC,GAAG,CAAC,0EAA0E,CAAC,CAAC;QACxF,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,iBAAiB,CAChD,SAAS,EACT,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EACxB,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAC5B,qBAAU,CACX,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAErB,OAAO,CAAC,GAAG,CAAC,+EAA+E,CAAC,CAAC;QAC7F,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,iBAAiB,CAChD,SAAS,EACT,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EACxB,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAC5B,IAAI,CACL,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAErB,OAAO,CAAC,GAAG,CAAC,+DAA+D,CAAC,CAAC;QAC7E,MAAM,UAAU,CAAC,iBAAiB,CAAC,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAGxE,MAAM,UAAU,CAAC,YAAY,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QACnD,MAAM,UAAU,CAAC,aAAa,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACvD,CAAC;CAAA;AApCD,wCAoCC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import { CommonWell, RequestMetadata } from "@metriport/commonwell-sdk";
3
+ export declare function orgManagement(commonWell: CommonWell, queryMeta: RequestMetadata): Promise<void>;
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
+ return new (P || (P = Promise))(function (resolve, reject) {
6
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10
+ });
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.orgManagement = void 0;
14
+ const commonwell_sdk_1 = require("@metriport/commonwell-sdk");
15
+ const payloads_1 = require("./payloads");
16
+ function orgManagement(commonWell, queryMeta) {
17
+ return __awaiter(this, void 0, void 0, function* () {
18
+ console.log(`>>> Create an org`);
19
+ const respCreateOrg = yield commonWell.createOrg(queryMeta, payloads_1.organization);
20
+ console.log(respCreateOrg);
21
+ console.log(`>>> Update an org`);
22
+ payloads_1.organization.locations[0].city = "Miami";
23
+ const orgId = (0, commonwell_sdk_1.getIdTrailingSlash)(respCreateOrg);
24
+ const respUpdateOrg = yield commonWell.updateOrg(queryMeta, payloads_1.organization, orgId);
25
+ console.log(respUpdateOrg);
26
+ console.log(`>>> Get all orgs`);
27
+ const respGetAllOrgs = yield commonWell.getAllOrgs(queryMeta);
28
+ console.log(respGetAllOrgs);
29
+ console.log(`>>> Get one org`);
30
+ const respGetOneOrg = yield commonWell.getOneOrg(queryMeta, orgId);
31
+ console.log(respGetOneOrg);
32
+ console.log(`>>> Add certificate to org`);
33
+ const respAddCertificateToOrg = yield commonWell.addCertificateToOrg(queryMeta, payloads_1.certificate, orgId);
34
+ console.log(respAddCertificateToOrg);
35
+ console.log(`>>> Replace certificate for org`);
36
+ const respReplaceCertificateForOrg = yield commonWell.replaceCertificateForOrg(queryMeta, payloads_1.certificate, orgId);
37
+ console.log(respReplaceCertificateForOrg);
38
+ console.log(`>>> Get certificate from org`);
39
+ const respGetCertificateFromOrg = yield commonWell.getCertificateFromOrg(queryMeta, orgId);
40
+ console.log(respGetCertificateFromOrg);
41
+ console.log(`>>> Get certificate from org (by thumprint)`);
42
+ const respGetCertificateFromOrgByThumbprint = yield commonWell.getCertificateFromOrgByThumbprint(queryMeta, orgId, payloads_1.thumbprint);
43
+ console.log(respGetCertificateFromOrgByThumbprint);
44
+ console.log(`>>> Get certificate from org (by thumprint & purpose)`);
45
+ const respGetCertificateFromOrgByThumbprintAndPurpose = yield commonWell.getCertificateFromOrgByThumbprintAndPurpose(queryMeta, orgId, payloads_1.thumbprint, payloads_1.certificate.Certificates[0].purpose);
46
+ console.log(respGetCertificateFromOrgByThumbprintAndPurpose);
47
+ console.log(`>>> Delete certificate from org`);
48
+ yield commonWell.deleteCertificateFromOrg(queryMeta, orgId, payloads_1.thumbprint, payloads_1.certificate.Certificates[0].purpose);
49
+ console.log("Certificate deleted");
50
+ });
51
+ }
52
+ exports.orgManagement = orgManagement;
53
+ //# sourceMappingURL=org-management.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"org-management.js","sourceRoot":"","sources":["../src/org-management.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,8DAA4F;AAE5F,yCAAmE;AAKnE,SAAsB,aAAa,CAAC,UAAsB,EAAE,SAA0B;;QACpF,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;QACjC,MAAM,aAAa,GAAG,MAAM,UAAU,CAAC,SAAS,CAAC,SAAS,EAAE,uBAAY,CAAC,CAAC;QAC1E,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAE3B,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;QACjC,uBAAY,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,OAAO,CAAC;QACzC,MAAM,KAAK,GAAG,IAAA,mCAAkB,EAAC,aAAa,CAAC,CAAC;QAChD,MAAM,aAAa,GAAG,MAAM,UAAU,CAAC,SAAS,CAAC,SAAS,EAAE,uBAAY,EAAE,KAAK,CAAC,CAAC;QACjF,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAE3B,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAChC,MAAM,cAAc,GAAG,MAAM,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAC9D,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QAE5B,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAC/B,MAAM,aAAa,GAAG,MAAM,UAAU,CAAC,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QACnE,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAE3B,OAAO,CAAC,GAAG,CAAC,4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CAAC,qBAAqB,CAAC,CAAC;IACrC,CAAC;CAAA;AAjED,sCAiEC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import { CommonWell, RequestMetadata } from "@metriport/commonwell-sdk";
3
+ export declare function patientManagement(commonWell: CommonWell, commonwellSandbox: CommonWell, queryMeta: RequestMetadata): Promise<void>;
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
+ return new (P || (P = Promise))(function (resolve, reject) {
6
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10
+ });
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.patientManagement = void 0;
14
+ const commonwell_sdk_1 = require("@metriport/commonwell-sdk");
15
+ const lodash_1 = require("lodash");
16
+ const payloads_1 = require("./payloads");
17
+ const util_1 = require("./util");
18
+ const commonwellSandboxOID = (0, util_1.getEnvOrFail)("COMMONWELL_SANDBOX_OID");
19
+ const commonwellSandboxOrgName = (0, util_1.getEnvOrFail)("COMMONWELL_SANDBOX_ORG_NAME");
20
+ function patientManagement(commonWell, commonwellSandbox, queryMeta) {
21
+ return __awaiter(this, void 0, void 0, function* () {
22
+ console.log(`>>> D1b: Register a new Patient`);
23
+ const respD1b = yield commonWell.registerPatient(queryMeta, payloads_1.patient);
24
+ console.log(respD1b);
25
+ console.log(`>>> D2a: Update demographics for a local Patient `);
26
+ payloads_1.patient.details.name[0].family[0] = "Graham";
27
+ const patientId = (0, commonwell_sdk_1.getIdTrailingSlash)(respD1b);
28
+ const respD2a = yield commonWell.updatePatient(queryMeta, payloads_1.patient, patientId);
29
+ console.log(respD2a);
30
+ console.log(`>>> D3a: ​Search for a Patient`);
31
+ const respD3a = yield commonWell.searchPatient(queryMeta, payloads_1.patient.details.name[0].given[0], payloads_1.patient.details.name[0].family[0], payloads_1.patient.details.birthDate, payloads_1.patient.details.gender.code, payloads_1.patient.details.address[0].zip);
32
+ console.log(respD3a);
33
+ console.log(`>>> D4a: Merge two Patient records`);
34
+ const respPatient2 = yield commonWell.registerPatient(queryMeta, payloads_1.mergePatient);
35
+ const patientId2 = (0, commonwell_sdk_1.getIdTrailingSlash)(respPatient2);
36
+ const referenceLink = respD1b._links.self.href;
37
+ yield commonWell.mergePatients(queryMeta, patientId2, referenceLink);
38
+ console.log("D4a successful");
39
+ console.log(`>>> D5a: Retrieve network links`);
40
+ const person = yield commonWell.enrollPerson(queryMeta, payloads_1.personStrongId);
41
+ const personId = (0, commonwell_sdk_1.getId)(person);
42
+ yield commonWell.patientLink(queryMeta, personId, referenceLink);
43
+ let payloadSandboxPatient = (0, lodash_1.cloneDeep)(payloads_1.patient);
44
+ payloadSandboxPatient.identifier[0].system = `urn:oid:${commonwellSandboxOID}`;
45
+ payloadSandboxPatient.identifier[0].assigner = commonwellSandboxOrgName;
46
+ payloadSandboxPatient.identifier[0].label = commonwellSandboxOrgName;
47
+ const sandboxPatient = yield commonwellSandbox.registerPatient(queryMeta, payloadSandboxPatient);
48
+ const sandboxPatientId = (0, commonwell_sdk_1.getIdTrailingSlash)(sandboxPatient);
49
+ const sandboxReferenceLink = sandboxPatient._links.self.href;
50
+ yield commonwellSandbox.patientLink(queryMeta, personId, sandboxReferenceLink);
51
+ yield commonWell.searchPersonByPatientDemo(queryMeta, patientId);
52
+ const respD5a = yield commonWell.getPatientsLinks(queryMeta, patientId);
53
+ console.log(respD5a);
54
+ console.log(`>>> D6a: Upgrade link from LOLA 1 to LOLA 2`);
55
+ const getLola1Link = respD5a._embedded.networkLink.find(link => link.assuranceLevel === commonwell_sdk_1.LOLA.level_1);
56
+ const respD6a = yield commonWell.upgradeOrDowngradePatientLink(queryMeta, getLola1Link._links.upgrade.href);
57
+ console.log(respD6a);
58
+ console.log(`>>> D6b: Downgrade link from LOLA 2 to LOLA 0`);
59
+ const respD6b = yield commonWell.upgradeOrDowngradePatientLink(queryMeta, respD6a._links.downgrade.href);
60
+ console.log(respD6b);
61
+ console.log(`>>> Delete created patients.`);
62
+ yield commonWell.deletePerson(queryMeta, personId);
63
+ yield commonWell.deletePatient(queryMeta, patientId);
64
+ yield commonwellSandbox.deletePatient(queryMeta, sandboxPatientId);
65
+ });
66
+ }
67
+ exports.patientManagement = patientManagement;
68
+ //# sourceMappingURL=patient-management.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"patient-management.js","sourceRoot":"","sources":["../src/patient-management.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,8DAMmC;AACnC,mCAAmC;AAEnC,yCAAmE;AAEnE,iCAAsC;AAEtC,MAAM,oBAAoB,GAAG,IAAA,mBAAY,EAAC,wBAAwB,CAAC,CAAC;AACpE,MAAM,wBAAwB,GAAG,IAAA,mBAAY,EAAC,6BAA6B,CAAC,CAAC;AAK7E,SAAsB,iBAAiB,CACrC,UAAsB,EACtB,iBAA6B,EAC7B,SAA0B;;QAG1B,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;QAC/C,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,eAAe,CAAC,SAAS,EAAE,kBAAO,CAAC,CAAC;QACrE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAErB,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC;QACjE,kBAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC;QAC7C,MAAM,SAAS,GAAG,IAAA,mCAAkB,EAAC,OAAO,CAAC,CAAC;QAC9C,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,aAAa,CAA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,OAAO,CAAC,CAAC;QAErB,OAAO,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;QAC7D,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,6BAA6B,CAC5D,SAAS,EACT,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAC9B,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAGrB,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;QAG5C,MAAM,UAAU,CAAC,YAAY,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QACnD,MAAM,UAAU,CAAC,aAAa,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACrD,MAAM,iBAAiB,CAAC,aAAa,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;IACrE,CAAC;CAAA;AAjFD,8CAiFC"}
@@ -0,0 +1,115 @@
1
+ #!/usr/bin/env node
2
+ import { AddressUseCodes, IdentifierUseCodes, NameUseCodes, Person } from "@metriport/commonwell-sdk";
3
+ export declare const caDriversLicenseUri = "urn:oid:2.16.840.1.113883.4.3.6";
4
+ export declare const driversLicenseId: string;
5
+ export declare const identifier: {
6
+ use: IdentifierUseCodes;
7
+ key: string;
8
+ system: string;
9
+ period: {
10
+ start: string;
11
+ };
12
+ };
13
+ export declare const personStrongId: Person;
14
+ export declare const personNoStrongId: Person;
15
+ export declare const patient: {
16
+ identifier: {
17
+ use: string;
18
+ label: string;
19
+ system: string;
20
+ key: string;
21
+ assigner: string;
22
+ }[];
23
+ details: {
24
+ address: {
25
+ use: AddressUseCodes;
26
+ zip: string;
27
+ state: string;
28
+ line: string[];
29
+ city: string;
30
+ }[];
31
+ name: {
32
+ use: NameUseCodes;
33
+ given: string[];
34
+ family: string[];
35
+ }[];
36
+ gender: {
37
+ code: string;
38
+ };
39
+ birthDate: string;
40
+ identifier: {
41
+ use: IdentifierUseCodes;
42
+ key: string;
43
+ system: string;
44
+ period: {
45
+ start: string;
46
+ };
47
+ }[];
48
+ };
49
+ };
50
+ export declare const mergePatient: {
51
+ identifier: {
52
+ use: string;
53
+ label: string;
54
+ system: string;
55
+ key: string;
56
+ assigner: string;
57
+ }[];
58
+ details: {
59
+ address: {
60
+ use: AddressUseCodes;
61
+ zip: string;
62
+ state: string;
63
+ line: string[];
64
+ city: string;
65
+ }[];
66
+ name: {
67
+ use: NameUseCodes;
68
+ given: string[];
69
+ family: string[];
70
+ }[];
71
+ gender: {
72
+ code: string;
73
+ };
74
+ birthDate: string;
75
+ };
76
+ };
77
+ export declare const organization: {
78
+ organizationId: string;
79
+ homeCommunityId: string;
80
+ name: string;
81
+ displayName: string;
82
+ memberName: string;
83
+ type: string;
84
+ patientIdAssignAuthority: string;
85
+ securityTokenKeyType: string;
86
+ isActive: boolean;
87
+ locations: {
88
+ address1: string;
89
+ address2: string;
90
+ city: string;
91
+ state: string;
92
+ postalCode: string;
93
+ country: string;
94
+ phone: string;
95
+ fax: string;
96
+ email: string;
97
+ }[];
98
+ technicalContacts: {
99
+ name: string;
100
+ title: string;
101
+ email: string;
102
+ phone: string;
103
+ }[];
104
+ };
105
+ export declare const thumbprint: string;
106
+ export declare const certificate: {
107
+ Certificates: {
108
+ startDate: string;
109
+ endDate: string;
110
+ expirationDate: string;
111
+ thumbprint: string;
112
+ content: string;
113
+ purpose: string;
114
+ }[];
115
+ };
@@ -0,0 +1,151 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.certificate = exports.thumbprint = exports.organization = exports.mergePatient = exports.patient = exports.personNoStrongId = exports.personStrongId = exports.identifier = exports.driversLicenseId = exports.caDriversLicenseUri = void 0;
5
+ const commonwell_sdk_1 = require("@metriport/commonwell-sdk");
6
+ const nanoid = require("nanoid");
7
+ const crypto_1 = require("crypto");
8
+ const unique_names_generator_1 = require("unique-names-generator");
9
+ const util_1 = require("./util");
10
+ const commonwellOID = (0, util_1.getEnvOrFail)("COMMONWELL_OID");
11
+ const commonwellCertificateContent = (0, util_1.getEnvOrFail)("COMMONWELL_CERTIFICATE_CONTENT");
12
+ const commonwellCertificate = (0, util_1.getEnvOrFail)("COMMONWELL_CERTIFICATE");
13
+ const commonwellOrgName = (0, util_1.getEnvOrFail)("COMMONWELL_ORG_NAME");
14
+ exports.caDriversLicenseUri = "urn:oid:2.16.840.1.113883.4.3.6";
15
+ exports.driversLicenseId = nanoid.nanoid();
16
+ exports.identifier = {
17
+ use: commonwell_sdk_1.IdentifierUseCodes.usual,
18
+ key: exports.driversLicenseId,
19
+ system: exports.caDriversLicenseUri,
20
+ period: {
21
+ start: "1996-04-20T00:00:00Z",
22
+ },
23
+ };
24
+ const mainDetails = {
25
+ address: [
26
+ {
27
+ use: commonwell_sdk_1.AddressUseCodes.home,
28
+ zip: "94041",
29
+ state: "CA",
30
+ line: ["335 Pioneer Way"],
31
+ city: "Mountain View",
32
+ },
33
+ ],
34
+ name: [
35
+ {
36
+ use: commonwell_sdk_1.NameUseCodes.usual,
37
+ given: ["Paul"],
38
+ family: ["Greyham"],
39
+ },
40
+ ],
41
+ gender: {
42
+ code: "M",
43
+ },
44
+ birthDate: "1980-04-20T00:00:00Z",
45
+ identifier: [exports.identifier],
46
+ };
47
+ const secondaryDetails = {
48
+ address: [
49
+ {
50
+ use: commonwell_sdk_1.AddressUseCodes.home,
51
+ zip: "94111",
52
+ state: "CA",
53
+ line: ["755 Sansome Street"],
54
+ city: "San Francisco",
55
+ },
56
+ ],
57
+ name: [
58
+ {
59
+ use: commonwell_sdk_1.NameUseCodes.usual,
60
+ given: ["Mary"],
61
+ family: ["Jane"],
62
+ },
63
+ ],
64
+ gender: {
65
+ code: "F",
66
+ },
67
+ birthDate: "2000-04-20T00:00:00Z",
68
+ };
69
+ exports.personStrongId = {
70
+ details: Object.assign(Object.assign({}, mainDetails), { identifier: [exports.identifier] }),
71
+ };
72
+ exports.personNoStrongId = {
73
+ details: secondaryDetails,
74
+ };
75
+ exports.patient = {
76
+ identifier: [
77
+ {
78
+ use: "unspecified",
79
+ label: commonwellOrgName,
80
+ system: `urn:oid:${commonwellOID}`,
81
+ key: nanoid.nanoid(),
82
+ assigner: commonwellOrgName,
83
+ },
84
+ ],
85
+ details: mainDetails,
86
+ };
87
+ exports.mergePatient = {
88
+ identifier: [
89
+ {
90
+ use: "unspecified",
91
+ label: commonwellOrgName,
92
+ system: `urn:oid:${commonwellOID}`,
93
+ key: nanoid.nanoid(),
94
+ assigner: commonwellOrgName,
95
+ },
96
+ ],
97
+ details: secondaryDetails,
98
+ };
99
+ const appendOrgId = nanoid.customAlphabet("1234567890", 18)();
100
+ const shortName = (0, unique_names_generator_1.uniqueNamesGenerator)({
101
+ dictionaries: [unique_names_generator_1.adjectives, unique_names_generator_1.colors, unique_names_generator_1.animals],
102
+ separator: "-",
103
+ length: 3,
104
+ });
105
+ exports.organization = {
106
+ organizationId: `urn:oid:${commonwellOID}.${appendOrgId}`,
107
+ homeCommunityId: `urn:oid:${commonwellOID}.${appendOrgId}`,
108
+ name: shortName,
109
+ displayName: shortName,
110
+ memberName: "Metriport",
111
+ type: "Hospital",
112
+ patientIdAssignAuthority: `urn:oid:${commonwellOID}.${appendOrgId}`,
113
+ securityTokenKeyType: "BearerKey",
114
+ isActive: true,
115
+ locations: [
116
+ {
117
+ address1: "1 Main Street",
118
+ address2: "PO Box 123",
119
+ city: "Denver",
120
+ state: "CO",
121
+ postalCode: "80001",
122
+ country: "USA",
123
+ phone: "303-555-1212",
124
+ fax: "303-555-1212",
125
+ email: "here@dummymail.com",
126
+ },
127
+ ],
128
+ technicalContacts: [
129
+ {
130
+ name: "Technician",
131
+ title: "TechnicalContact",
132
+ email: "technicalContact@dummymail.com",
133
+ phone: "303-555-1212",
134
+ },
135
+ ],
136
+ };
137
+ const x509 = new crypto_1.X509Certificate(commonwellCertificate);
138
+ exports.thumbprint = x509.fingerprint;
139
+ exports.certificate = {
140
+ Certificates: [
141
+ {
142
+ startDate: "2022-12-31T11:46:29Z",
143
+ endDate: "2023-03-31T12:46:28Z",
144
+ expirationDate: "2023-03-31T12:46:28Z",
145
+ thumbprint: exports.thumbprint,
146
+ content: commonwellCertificateContent,
147
+ purpose: "Authentication",
148
+ },
149
+ ],
150
+ };
151
+ //# sourceMappingURL=payloads.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payloads.js","sourceRoot":"","sources":["../src/payloads.ts"],"names":[],"mappings":";;;;AACA,8DAKmC;AACnC,iCAAiC;AACjC,mCAAyC;AAEzC,mEAA2F;AAC3F,iCAAsC;AAEtC,MAAM,aAAa,GAAG,IAAA,mBAAY,EAAC,gBAAgB,CAAC,CAAC;AACrD,MAAM,4BAA4B,GAAG,IAAA,mBAAY,EAAC,gCAAgC,CAAC,CAAC;AACpF,MAAM,qBAAqB,GAAG,IAAA,mBAAY,EAAC,wBAAwB,CAAC,CAAC;AACrE,MAAM,iBAAiB,GAAG,IAAA,mBAAY,EAAC,qBAAqB,CAAC,CAAC;AAGjD,QAAA,mBAAmB,GAAG,iCAAiC,CAAC;AACxD,QAAA,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;AAEnC,QAAA,UAAU,GAAG;IACxB,GAAG,EAAE,mCAAkB,CAAC,KAAK;IAC7B,GAAG,EAAE,wBAAgB;IACrB,MAAM,EAAE,2BAAmB;IAC3B,MAAM,EAAE;QACN,KAAK,EAAE,sBAAsB;KAC9B;CACF,CAAC;AAEF,MAAM,WAAW,GAAG;IAClB,OAAO,EAAE;QACP;YACE,GAAG,EAAE,gCAAe,CAAC,IAAI;YACzB,GAAG,EAAE,OAAO;YACZ,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,CAAC,iBAAiB,CAAC;YACzB,IAAI,EAAE,eAAe;SACtB;KACF;IACD,IAAI,EAAE;QACJ;YACE,GAAG,EAAE,6BAAY,CAAC,KAAK;YACvB,KAAK,EAAE,CAAC,MAAM,CAAC;YACf,MAAM,EAAE,CAAC,SAAS,CAAC;SACpB;KACF;IACD,MAAM,EAAE;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,4BAA4B;YACrC,OAAO,EAAE,gBAAgB;SAC1B;KACF;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import { CommonWell, RequestMetadata } from "@metriport/commonwell-sdk";
3
+ export declare function personManagement(commonWell: CommonWell, queryMeta: RequestMetadata): Promise<void>;
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
+ return new (P || (P = Promise))(function (resolve, reject) {
6
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10
+ });
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.personManagement = void 0;
14
+ const commonwell_sdk_1 = require("@metriport/commonwell-sdk");
15
+ const nanoid = require("nanoid");
16
+ const payloads_1 = require("./payloads");
17
+ function personManagement(commonWell, queryMeta) {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ console.log(`>>> C1a: Enroll a Person with a Strong ID`);
20
+ const respC1a = yield commonWell.enrollPerson(queryMeta, payloads_1.personStrongId);
21
+ console.log(respC1a);
22
+ console.log(`>>> C1b: Enroll a Person without a Strong ID`);
23
+ const respC1b = yield commonWell.enrollPerson(queryMeta, payloads_1.personNoStrongId);
24
+ console.log(respC1b);
25
+ console.log(`>>> C2a: Search for a Person using the Strong ID`);
26
+ const respC2a = yield commonWell.searchPerson(queryMeta, payloads_1.driversLicenseId, payloads_1.caDriversLicenseUri);
27
+ console.log(respC2a);
28
+ console.log(`>>> C2b: Search for a Person using the local Patient demographics.`);
29
+ const personId = (0, commonwell_sdk_1.getId)(respC1a);
30
+ const newPatient = yield commonWell.registerPatient(queryMeta, payloads_1.patient);
31
+ const patientId = (0, commonwell_sdk_1.getIdTrailingSlash)(newPatient);
32
+ const respC2b = yield commonWell.searchPersonByPatientDemo(queryMeta, patientId);
33
+ console.log(respC2b);
34
+ console.log(`>>> C3a: Update a Person with an existing Strong ID by updating their demographics and/or Strong ID`);
35
+ payloads_1.personStrongId.details.name[0].family[0] = "Graham";
36
+ const respC3a = yield commonWell.updatePerson(queryMeta, payloads_1.personStrongId, personId);
37
+ console.log(respC3a);
38
+ console.log(`>>> C3b: Update a Person without a Strong ID by updating their demographics and/or by adding a Strong ID`);
39
+ const personId2 = (0, commonwell_sdk_1.getId)(respC1b);
40
+ const driversLicenseId2 = nanoid.nanoid();
41
+ payloads_1.personNoStrongId.details.identifier = [
42
+ {
43
+ use: commonwell_sdk_1.IdentifierUseCodes.usual,
44
+ key: driversLicenseId2,
45
+ system: payloads_1.caDriversLicenseUri,
46
+ period: {
47
+ start: "2016-04-20T00:00:00Z",
48
+ },
49
+ },
50
+ ];
51
+ const respC3b = yield commonWell.updatePerson(queryMeta, payloads_1.personNoStrongId, personId2);
52
+ console.log(respC3b);
53
+ console.log(`>>> C4a: Search for patients matching the Person demographics.`);
54
+ const respC4a = yield commonWell.patientMatch(queryMeta, personId);
55
+ console.log(respC4a);
56
+ console.log(`>>> C6a: Unenroll a Person who is active`);
57
+ const respC6a = yield commonWell.unenrollPerson(queryMeta, personId2);
58
+ console.log(respC6a);
59
+ console.log(`>>> C7a: Delete a Person who was previously enrolled with or without a Strong ID and at least one patient link.`);
60
+ yield commonWell.deletePerson(queryMeta, personId);
61
+ yield commonWell.deletePerson(queryMeta, personId2);
62
+ yield commonWell.deletePatient(queryMeta, patientId);
63
+ });
64
+ }
65
+ exports.personManagement = personManagement;
66
+ //# sourceMappingURL=person-management.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"person-management.js","sourceRoot":"","sources":["../src/person-management.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,8D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AC,aAAa,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACvD,CAAC;CAAA;AApED,4CAoEC"}
package/lib/util.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function getEnvOrFail(name: any): string;
package/lib/util.js ADDED
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getEnvOrFail = void 0;
4
+ const dotenv = require("dotenv");
5
+ dotenv.config();
6
+ function getEnvOrFail(name) {
7
+ const value = process.env[name];
8
+ if (!value || value.trim().length < 1)
9
+ throw new Error(`Missing env var ${name}`);
10
+ return value;
11
+ }
12
+ exports.getEnvOrFail = getEnvOrFail;
13
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AACjC,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,SAAgB,YAAY,CAAC,IAAI;IAC/B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAEhC,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,EAAE,CAAC,CAAC;IAClF,OAAO,KAAK,CAAC;AACf,CAAC;AALD,oCAKC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metriport/commonwell-cert-runner",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Tool to run through Edge System CommonWell certification test cases - by Metriport Inc.",
5
5
  "author": "Metriport Inc. <contact@metriport.com>",
6
6
  "homepage": "https://metriport.com/",
@@ -20,13 +20,14 @@
20
20
  "repository": {
21
21
  "url": "https://github.com/metriport/metriport.git",
22
22
  "type": "git",
23
- "directory": "pkgs/packages/commonwell-cert-runner"
23
+ "directory": "packages/packages/commonwell-cert-runner"
24
24
  },
25
25
  "scripts": {
26
26
  "tsc": "tsc",
27
27
  "test": "echo \"Error: run tests from root\" && exit 1",
28
28
  "build": "tsc -p .",
29
- "local": "sudo npm i -g && cw-cert-runner"
29
+ "install-local": "sudo npm i -g",
30
+ "start": "ts-node src/index.ts --env-file .env"
30
31
  },
31
32
  "bin": {
32
33
  "cw-cert-runner": "lib/index.js"
@@ -41,10 +42,12 @@
41
42
  "typescript": "^4.9.4"
42
43
  },
43
44
  "dependencies": {
44
- "@metriport/commonwell-sdk": "^1.0.3",
45
+ "@metriport/commonwell-sdk": "^1.1.0",
45
46
  "commander": "^9.5.0",
46
47
  "dotenv": "^16.0.3",
47
- "nanoid": "^3.3.4"
48
+ "lodash": "^4.17.21",
49
+ "nanoid": "^3.3.4",
50
+ "unique-names-generator": "^4.7.1"
48
51
  },
49
- "gitHead": "3f89c1e0d39ed55e180444335ff446e8c67bf8fa"
52
+ "gitHead": "1dec9673091bde1088841caf74acae00bda41919"
50
53
  }