@metriport/commonwell-cert-runner 1.26.18 → 2.0.0-alpha.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 (131) hide show
  1. package/README.md +213 -73
  2. package/dist/env.d.ts +16 -0
  3. package/dist/env.d.ts.map +1 -0
  4. package/dist/env.js +20 -0
  5. package/dist/env.js.map +1 -0
  6. package/dist/flows/contribution/binary.d.ts +11 -0
  7. package/dist/flows/contribution/binary.d.ts.map +1 -0
  8. package/dist/flows/contribution/binary.js +23 -0
  9. package/dist/flows/contribution/binary.js.map +1 -0
  10. package/dist/flows/contribution/contribution-server.d.ts +8 -0
  11. package/dist/flows/contribution/contribution-server.d.ts.map +1 -0
  12. package/dist/flows/contribution/contribution-server.js +174 -0
  13. package/dist/flows/contribution/contribution-server.js.map +1 -0
  14. package/dist/flows/contribution/document-reference.d.ts +9 -0
  15. package/dist/flows/contribution/document-reference.d.ts.map +1 -0
  16. package/dist/flows/contribution/document-reference.js +92 -0
  17. package/dist/flows/contribution/document-reference.js.map +1 -0
  18. package/dist/flows/contribution/token.d.ts +4 -0
  19. package/dist/flows/contribution/token.d.ts.map +1 -0
  20. package/dist/flows/contribution/token.js +79 -0
  21. package/dist/flows/contribution/token.js.map +1 -0
  22. package/dist/flows/document-consumption.d.ts +20 -0
  23. package/dist/flows/document-consumption.d.ts.map +1 -0
  24. package/dist/flows/document-consumption.js +150 -0
  25. package/dist/flows/document-consumption.js.map +1 -0
  26. package/dist/flows/document-contribution.d.ts +39 -0
  27. package/dist/flows/document-contribution.d.ts.map +1 -0
  28. package/dist/flows/document-contribution.js +214 -0
  29. package/dist/flows/document-contribution.js.map +1 -0
  30. package/dist/flows/link-management.d.ts +8 -0
  31. package/dist/flows/link-management.d.ts.map +1 -0
  32. package/dist/flows/link-management.js +178 -0
  33. package/dist/flows/link-management.js.map +1 -0
  34. package/dist/flows/org-management.d.ts +13 -0
  35. package/dist/flows/org-management.d.ts.map +1 -0
  36. package/dist/flows/org-management.js +149 -0
  37. package/dist/flows/org-management.js.map +1 -0
  38. package/dist/flows/patient-management.d.ts +15 -0
  39. package/dist/flows/patient-management.d.ts.map +1 -0
  40. package/dist/flows/patient-management.js +189 -0
  41. package/dist/flows/patient-management.js.map +1 -0
  42. package/dist/index.d.ts +0 -1
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +31 -58
  45. package/dist/index.js.map +1 -1
  46. package/dist/payloads/patient-carin.d.ts +3 -0
  47. package/dist/payloads/patient-carin.d.ts.map +1 -0
  48. package/dist/payloads/patient-carin.js +34 -0
  49. package/dist/payloads/patient-carin.js.map +1 -0
  50. package/dist/payloads/patient-connie.d.ts +3 -0
  51. package/dist/payloads/patient-connie.d.ts.map +1 -0
  52. package/dist/payloads/patient-connie.js +34 -0
  53. package/dist/payloads/patient-connie.js.map +1 -0
  54. package/dist/payloads/patient-crane.d.ts +3 -0
  55. package/dist/payloads/patient-crane.d.ts.map +1 -0
  56. package/dist/payloads/patient-crane.js +31 -0
  57. package/dist/payloads/patient-crane.js.map +1 -0
  58. package/dist/payloads/patient-mary.d.ts +3 -0
  59. package/dist/payloads/patient-mary.d.ts.map +1 -0
  60. package/dist/payloads/patient-mary.js +25 -0
  61. package/dist/payloads/patient-mary.js.map +1 -0
  62. package/dist/payloads/patient-richard.d.ts +3 -0
  63. package/dist/payloads/patient-richard.d.ts.map +1 -0
  64. package/dist/payloads/patient-richard.js +25 -0
  65. package/dist/payloads/patient-richard.js.map +1 -0
  66. package/dist/payloads/patient-robert.d.ts +3 -0
  67. package/dist/payloads/patient-robert.d.ts.map +1 -0
  68. package/dist/payloads/patient-robert.js +25 -0
  69. package/dist/payloads/patient-robert.js.map +1 -0
  70. package/dist/payloads/patient-shirley.d.ts +3 -0
  71. package/dist/payloads/patient-shirley.d.ts.map +1 -0
  72. package/dist/payloads/patient-shirley.js +31 -0
  73. package/dist/payloads/patient-shirley.js.map +1 -0
  74. package/dist/payloads/patient-tracy.d.ts +3 -0
  75. package/dist/payloads/patient-tracy.d.ts.map +1 -0
  76. package/dist/payloads/patient-tracy.js +31 -0
  77. package/dist/payloads/patient-tracy.js.map +1 -0
  78. package/dist/payloads/probable-patient-sina.d.ts +3 -0
  79. package/dist/payloads/probable-patient-sina.d.ts.map +1 -0
  80. package/dist/payloads/probable-patient-sina.js +35 -0
  81. package/dist/payloads/probable-patient-sina.js.map +1 -0
  82. package/dist/payloads.d.ts +17 -298
  83. package/dist/payloads.d.ts.map +1 -1
  84. package/dist/payloads.js +116 -200
  85. package/dist/payloads.js.map +1 -1
  86. package/dist/single-commands/create-patient.d.ts +5 -0
  87. package/dist/single-commands/create-patient.d.ts.map +1 -0
  88. package/dist/single-commands/create-patient.js +56 -0
  89. package/dist/single-commands/create-patient.js.map +1 -0
  90. package/dist/single-commands/delete-patient.d.ts +5 -0
  91. package/dist/single-commands/delete-patient.d.ts.map +1 -0
  92. package/dist/single-commands/delete-patient.js +51 -0
  93. package/dist/single-commands/delete-patient.js.map +1 -0
  94. package/dist/single-commands/document-parse.d.ts +9 -0
  95. package/dist/single-commands/document-parse.d.ts.map +1 -0
  96. package/dist/single-commands/document-parse.js +53 -0
  97. package/dist/single-commands/document-parse.js.map +1 -0
  98. package/dist/single-commands/get-patient-links.d.ts +5 -0
  99. package/dist/single-commands/get-patient-links.d.ts.map +1 -0
  100. package/dist/single-commands/get-patient-links.js +52 -0
  101. package/dist/single-commands/get-patient-links.js.map +1 -0
  102. package/dist/single-commands/get-patient.d.ts +5 -0
  103. package/dist/single-commands/get-patient.d.ts.map +1 -0
  104. package/dist/single-commands/get-patient.js +52 -0
  105. package/dist/single-commands/get-patient.js.map +1 -0
  106. package/dist/single-commands/init-contrib-server.d.ts +5 -0
  107. package/dist/single-commands/init-contrib-server.d.ts.map +1 -0
  108. package/dist/single-commands/init-contrib-server.js +61 -0
  109. package/dist/single-commands/init-contrib-server.js.map +1 -0
  110. package/dist/single-commands/patient-create.d.ts +10 -0
  111. package/dist/single-commands/patient-create.d.ts.map +1 -0
  112. package/dist/single-commands/patient-create.js +61 -0
  113. package/dist/single-commands/patient-create.js.map +1 -0
  114. package/dist/single-commands/patient-delete.d.ts +12 -0
  115. package/dist/single-commands/patient-delete.d.ts.map +1 -0
  116. package/dist/single-commands/patient-delete.js +58 -0
  117. package/dist/single-commands/patient-delete.js.map +1 -0
  118. package/dist/single-commands/patient-get-links.d.ts +10 -0
  119. package/dist/single-commands/patient-get-links.d.ts.map +1 -0
  120. package/dist/single-commands/patient-get-links.js +57 -0
  121. package/dist/single-commands/patient-get-links.js.map +1 -0
  122. package/dist/single-commands/patient-get.d.ts +10 -0
  123. package/dist/single-commands/patient-get.d.ts.map +1 -0
  124. package/dist/single-commands/patient-get.js +57 -0
  125. package/dist/single-commands/patient-get.js.map +1 -0
  126. package/dist/util.d.ts +5 -0
  127. package/dist/util.d.ts.map +1 -1
  128. package/dist/util.js +40 -1
  129. package/dist/util.js.map +1 -1
  130. package/package.json +8 -7
  131. package/data/doc-contrib-payload +0 -1
package/README.md CHANGED
@@ -1,107 +1,247 @@
1
- # `commonwell-cert-runner`
1
+ # CommonWell Certification Runner
2
2
 
3
- CommonWell Certification Runner by Metriport Inc.
3
+ A comprehensive tool by Metriport Inc. for running through CommonWell Alliance certification test cases and validating your integration with the CommonWell network.
4
4
 
5
- Tool to run through Edge System CommonWell certification test cases.
5
+ ## What It Does
6
6
 
7
- ## Install
7
+ The CommonWell Certification Runner automates the testing of CommonWell API integration across five main certification areas:
8
8
 
9
- To install the program, execute the following command on your terminal:
9
+ ### 1. Organization Management (`org-management.ts`)
10
10
 
11
- `npm i -g @metriport/commonwell-cert-runner`
11
+ - Creates, retrieves, updates, and manages CommonWell organizations
12
+ - Handles certificate management (add, replace, delete certificates)
13
+ - Validates organization CRUD operations
14
+ - Tests member-level organization management APIs
12
15
 
13
- Note: you may have to run the command with `sudo`.
16
+ ### 2. Patient Management (`patient-management.ts`)
14
17
 
15
- ## Usage
18
+ - Creates and updates patients with test demographics
19
+ - Tests patient merge operations
20
+ - Validates patient deletion workflows
21
+ - Uses predefined test patients (Tracy Crane, Connie Carin)
22
+ - Automatically cleans up test patients after execution
23
+
24
+ ### 3. Link Management (`link-management.ts`)
25
+
26
+ - Tests patient linking and unlinking operations
27
+ - Validates probable link detection and management
28
+ - Tests link reset functionality
29
+ - Uses demographic matching to find potential patient links
30
+
31
+ ### 4. Document Consumption (`document-consumption.ts`)
32
+
33
+ - Queries for external documents on test patients
34
+ - Downloads and stores document references and contents
35
+ - Tests document retrieval workflows
36
+ - Supports multiple document statuses (current, superseded, entered-in-error)
37
+
38
+ ### 5. Document Contribution (`document-contribution.ts`)
39
+
40
+ - Tests document contribution workflows between organizations
41
+ - Creates patients on both contributor and consumer organizations
42
+ - Links patients across organizations
43
+ - Initializes HTTP server for document contribution responses
44
+ - Validates end-to-end document sharing
45
+ - Requires a public URL to respond to the requests from CommonWell (reverse proxy -
46
+ see `src/flows/document-contribution.ts`).
47
+
48
+ ## Requirements
49
+
50
+ ### Prerequisites
51
+
52
+ - Node.js 18+
53
+ - npm or yarn package manager
54
+ - CommonWell Alliance membership and credentials
55
+
56
+ ### CommonWell Credentials
57
+
58
+ You need the following credentials from CommonWell:
59
+
60
+ **Member Organization (Service Adopter):**
61
+
62
+ - Member ID and OID
63
+ - Member name
64
+ - RSA private key and certificate for member operations
65
+
66
+ **Organization (Your Organization):**
67
+
68
+ - Organization OID
69
+ - Organization name
70
+ - RSA private key and certificate for organization operations
71
+ - Gateway endpoint configuration
72
+ - OAuth 2.0 credentials for document contribution
73
+
74
+ ## Installation
16
75
 
17
- After installation, create a `.env` file defining the following variables:
18
-
19
- - `COMMONWELL_ORG_NAME`: the organization that will be making the requests.
20
- - `COMMONWELL_OID`: the organization ID.
21
- - `COMMONWELL_SANDBOX_ORG_NAME`: the organization on sandbox for patient management and document contribution
22
- - should be configured with your FHIR server and OAuth 2 data on Commonwell management portal
23
- - `COMMONWELL_SANDBOX_OID`: the ID of the organization above
24
- - `COMMONWELL_ORG_PRIVATE_KEY`: the RSA256 private key corresponding to the specified organization.
25
- - `COMMONWELL_ORG_CERTIFICATE`: the public certificate/key corresponding to the private key.
26
- - `COMMONWELL_MEMBER_OID`: the member ID for organization management
27
- - `COMMONWELL_MEMBER_PRIVATE_KEY`: the RSA256 private key corresponding to the specified member management organization.
28
- - `COMMONWELL_MEMBER_CERTIFICATE`: the public certificate/key corresponding to the private key.
29
- - `DOCUMENT_PATIENT_FIRST_NAME`: the first name of a patient created along with the sandbox that has a document associated
30
- - `DOCUMENT_PATIENT_LAST_NAME`: their last name
31
- - `DOCUMENT_PATIENT_DATE_OF_BIRTH`: their date of birth on the format YYYY-MM-DD
32
- - `DOCUMENT_PATIENT_GENDER`: their gender (M|F)
33
- - `DOCUMENT_PATIENT_ZIP`: their address zip code
34
- - `DOCUMENT_CONTRIBUTION_ORGANIZATION_ID`: organization suffix for the document contribution flow (usually in the format
35
- "2.dddddd", with 'd' being a digit)
36
- - `DOCUMENT_CONTRIBUTION_PATIENT_FIRST_NAME`: the first name of the patient to be created on the organization used for the
37
- document contribution flow - same for the properties below [optional, defaults to the same name from the document patient
38
- above]
39
- - `DOCUMENT_CONTRIBUTION_PATIENT_LAST_NAME`
40
- - `DOCUMENT_CONTRIBUTION_PATIENT_DATE_OF_BIRTH`
41
- - `DOCUMENT_CONTRIBUTION_PATIENT_GENDER`
42
- - `DOCUMENT_CONTRIBUTION_PATIENT_ZIP`
43
- - `DOCUMENT_CONTRIBUTION_URL`: the url of the server where the documents are stored
44
- - `DOCUMENT_CONTRIBUTION_FHIRURL`: the direct url of the FHIR server where the documents are stored, with no authentication required
45
- - `DOCUMENT_CONTRIBUTION_AUTH_URL`: the url of the server used to authenticate document contribution requests
46
- - `DOCUMENT_CONTRIBUTION_CLIENT_ID`: the client OAuth ID to authenticate document contribution requests
47
- - `DOCUMENT_CONTRIBUTION_CLIENT_SECRET`: the client OAuth secret to authenticate document contribution requests
48
-
49
- flow - must exist on the sandbox organization
50
-
51
- Example file content looks like:
76
+ ### Global Installation
52
77
 
78
+ ```bash
79
+ npm install -g @metriport/commonwell-cert-runner
53
80
  ```
54
- COMMONWELL_ORG_NAME=Metriport
55
- COMMONWELL_OID=2.16.840.1.113883.3.9621
56
- COMMONWELL_SANDBOX_ORG_NAME=Metriport-OrgA-1620
57
- COMMONWELL_SANDBOX_OID=2.16.840.1.113883.3.3330.8889429.1620.1
58
- COMMONWELL_ORG_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----
59
- ...
60
- -----END PRIVATE KEY-----"
61
- COMMONWELL_ORG_CERTIFICATE="-----BEGIN CERTIFICATE-----
81
+
82
+ ### Local Development
83
+
84
+ ```bash
85
+ git clone <repository>
86
+ cd packages/commonwell-cert-runner
87
+ npm install
88
+ npm run build
89
+ ```
90
+
91
+ ## Configuration
92
+
93
+ Create a `.env` file with the following required variables:
94
+
95
+ ### Member Organization Configuration
96
+
97
+ ```env
98
+ # Member (Service Adopter) credentials
99
+ CW_MEMBER_ID=your-member-id
100
+ CW_MEMBER_OID=1.2.3.4.5.678
101
+ CW_MEMBER_NAME=Your Member Name
102
+ CW_MEMBER_CERTIFICATE="-----BEGIN CERTIFICATE-----
62
103
  ...
63
104
  -----END CERTIFICATE-----"
64
- COMMONWELL_MEMBER_OID=1.3.6.1.4.1.18.12.29.2022.945
65
- COMMONWELL_ORG_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----
105
+ CW_MEMBER_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----
66
106
  ...
67
107
  -----END PRIVATE KEY-----"
68
- COMMONWELL_ORG_CERTIFICATE="-----BEGIN CERTIFICATE-----
108
+ ```
109
+
110
+ ### Organization Configuration
111
+
112
+ ```env
113
+ # Your organization credentials
114
+ CW_ORG_CERTIFICATE="-----BEGIN CERTIFICATE-----
69
115
  ...
70
116
  -----END CERTIFICATE-----"
71
- DOCUMENT_PATIENT_FIRST_NAME="Stephen"
72
- DOCUMENT_PATIENT_LAST_NAME="Pujols1234"
73
- DOCUMENT_PATIENT_DATE_OF_BIRTH="1955-10-23"
74
- DOCUMENT_PATIENT_GENDER="M"
75
- DOCUMENT_PATIENT_ZIP="62732"
76
- # This is optional, if not set the runner will attempt to create the patient above on the sandbox org
77
- DOCUMENT_CONTRIBUTION_PATIENT_ID=<patient-id>%5E%5E%5Eurn%3aoid%3a<org-id>
117
+ CW_ORG_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----
118
+ ...
119
+ -----END PRIVATE KEY-----"
120
+ CW_ORG_GATEWAY_ENDPOINT=https://your-gateway.example.com/fhir
121
+ CW_ORG_GATEWAY_AUTHORIZATION_SERVER_ENDPOINT=https://auth.example.com/oauth/token
122
+ CW_ORG_GATEWAY_AUTHORIZATION_CLIENT_ID=your-client-id
123
+ CW_ORG_GATEWAY_AUTHORIZATION_CLIENT_SECRET=your-client-secret
124
+
125
+ # Optional: Use existing organization instead of creating new one
126
+ CW_ORG_ID=1.2.3.4.5.678.5.123
78
127
  ```
79
128
 
80
- After the file is created, you can run execute following command on your terminal to run the program:
129
+ ### Contribution Server Configuration
81
130
 
82
- `cw-cert-runner --env-file "/path/to/created/env/file/.env"`
131
+ These configuration variables are used to configure the contribution server. This
132
+ should be a public URL that is accessible from the CommonWell network. See
133
+ item #5. Document Contribution above for more details.
83
134
 
84
- ## Options
135
+ ```env
136
+ CONTRIB_SERVER_URL=https://your-contrib-server.example.com/with/path
137
+ CONTRIB_SERVER_PORT=8088
138
+ ```
85
139
 
86
- `--env-file <file-path>`
140
+ ## Usage
141
+
142
+ ### Run Complete Certification Suite
143
+
144
+ ```bash
145
+ cw-cert-runner
146
+ ```
147
+
148
+ ## Entry Points
149
+
150
+ ### Main Entry Point
151
+
152
+ - **File**: `src/index.ts`
153
+ - **Function**: `main()`
154
+ - **Purpose**: Orchestrates the complete certification flow
155
+
156
+ ### Individual Flow Entry Points
157
+
158
+ If you want to run individual flows, you can comment out the other flows in `src/index.ts`.
159
+
160
+ 1. **Organization Management**: `src/flows/org-management.ts`
161
+
162
+ - `orgManagement()`: Complete org management flow
163
+ - `getOneOrg()`: Retrieve specific organization
164
+ - `initApiForExistingOrg()`: Initialize API for existing org
165
+
166
+ 2. **Patient Management**: `src/flows/patient-management.ts`
167
+
168
+ - `patientManagement()`: Complete patient management flow
169
+
170
+ 3. **Link Management**: `src/flows/link-management.ts`
171
+
172
+ - `linkManagement()`: Complete link management flow
173
+
174
+ 4. **Document Consumption**: `src/flows/document-consumption.ts`
87
175
 
88
- Absolute path to the .env file containing required config.
176
+ - `documentConsumption()`: Complete document consumption flow
177
+ - `queryDocuments()`: Query documents for a patient
178
+ - `retrieveDocument()`: Download specific document
89
179
 
90
- `-V, --version`
180
+ 5. **Document Contribution**: `src/flows/document-contribution.ts`
181
+ - `documentContribution()`: Complete document contribution flow
91
182
 
92
- Output the version number.
183
+ ### Single Commands
93
184
 
94
- `-h, --help`
185
+ For targeted testing, use individual commands in `src/single-commands/`:
95
186
 
96
- Display help for command.
187
+ - `init-contrib-server.ts`: Initialize document contribution server
188
+ - `patient-create.ts`: Create a single patient
189
+ - `patient-get.ts`: Retrieve a patient
190
+ - `patient-delete.ts`: Delete a patient
191
+ - `patient-get-links.ts`: Get patient links
192
+ - `document-parse.ts`: Parse document responses
193
+
194
+ ### Console Output
195
+
196
+ The runner provides detailed console output including:
197
+
198
+ - Transaction IDs for each API call
199
+ - Request/response payloads
200
+ - Success/failure status for each operation
201
+ - Patient IDs and document references
202
+
203
+ ### File Output
204
+
205
+ Documents are downloaded to:
206
+
207
+ - `./downloads-consumption/`: Document consumption downloads
208
+ - `./downloads-contribution/`: Document contribution downloads
209
+
210
+ ### Error Handling
211
+
212
+ - Failed flows are logged with transaction IDs
213
+ - Stack traces are preserved for debugging
214
+ - Graceful cleanup of test data
215
+
216
+ ## Troubleshooting
217
+
218
+ ### Common Issues
219
+
220
+ 1. **Certificate Errors**: Ensure certificates are properly formatted with newlines
221
+ 2. **OAuth Errors**: Verify client credentials and endpoints
222
+ 3. **Patient Not Found**: Check patient demographics match test data
223
+ 4. **Document Download Failures**: Verify document URLs are accessible
97
224
 
98
225
  ## Development
99
226
 
100
- `npm run build`: builds the package
227
+ ```bash
228
+ npm install # only has to be run once
229
+ npm run build # run to build
230
+ npm start # runs the code pointing to `./.env`
231
+ ```
232
+
233
+ ## License
234
+
235
+ MIT License - see LICENSE file for details.
236
+
237
+ ## Support
238
+
239
+ For issues and questions:
101
240
 
102
- `npm start`: runs the local code pointing to `./.env`
241
+ - GitHub Issues: https://github.com/metriport/metriport/issues
242
+ - Email: contact@metriport.com
103
243
 
104
- (optionally) `npm run install-local`: installs the package globally from the local source
244
+ ---
105
245
 
106
246
  ```
107
247
  ,▄,
package/dist/env.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ export declare const memberId: string;
2
+ export declare const memberOID: string;
3
+ export declare const memberName: string;
4
+ export declare const memberCertificateString: string;
5
+ export declare const memberPrivateKeyString: string;
6
+ export declare const orgCertificateString: string;
7
+ export declare const orgPrivateKeyString: string;
8
+ export declare const orgGatewayEndpoint: string;
9
+ export declare const orgGatewayAuthorizationServerEndpoint: string;
10
+ export declare const orgGatewayAuthorizationClientId: string;
11
+ export declare const orgGatewayAuthorizationClientSecret: string;
12
+ /** If set, the cert runner will use this org and not try to create a new one. */
13
+ export declare const existingOrgId: string | undefined;
14
+ export declare const contribServerUrl: string;
15
+ export declare const contribServerPort: number;
16
+ //# sourceMappingURL=env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,QAA+B,CAAC;AACrD,eAAO,MAAM,SAAS,QAAgC,CAAC;AACvD,eAAO,MAAM,UAAU,QAAiC,CAAC;AACzD,eAAO,MAAM,uBAAuB,QAAwC,CAAC;AAC7E,eAAO,MAAM,sBAAsB,QAAwC,CAAC;AAE5E,eAAO,MAAM,oBAAoB,QAAqC,CAAC;AACvE,eAAO,MAAM,mBAAmB,QAAqC,CAAC;AACtE,eAAO,MAAM,kBAAkB,QAA0C,CAAC;AAC1E,eAAO,MAAM,qCAAqC,QAEjD,CAAC;AACF,eAAO,MAAM,+BAA+B,QAE3C,CAAC;AACF,eAAO,MAAM,mCAAmC,QAE/C,CAAC;AACF,iFAAiF;AACjF,eAAO,MAAM,aAAa,oBAAsB,CAAC;AAEjD,eAAO,MAAM,gBAAgB,QAAqC,CAAC;AACnE,eAAO,MAAM,iBAAiB,QAAgD,CAAC"}
package/dist/env.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.contribServerPort = exports.contribServerUrl = exports.existingOrgId = exports.orgGatewayAuthorizationClientSecret = exports.orgGatewayAuthorizationClientId = exports.orgGatewayAuthorizationServerEndpoint = exports.orgGatewayEndpoint = exports.orgPrivateKeyString = exports.orgCertificateString = exports.memberPrivateKeyString = exports.memberCertificateString = exports.memberName = exports.memberOID = exports.memberId = void 0;
4
+ const util_1 = require("./util");
5
+ exports.memberId = (0, util_1.getEnvOrFail)("CW_MEMBER_ID");
6
+ exports.memberOID = (0, util_1.getEnvOrFail)("CW_MEMBER_OID");
7
+ exports.memberName = (0, util_1.getEnvOrFail)("CW_MEMBER_NAME");
8
+ exports.memberCertificateString = (0, util_1.getEnvOrFail)("CW_MEMBER_CERTIFICATE");
9
+ exports.memberPrivateKeyString = (0, util_1.getEnvOrFail)("CW_MEMBER_PRIVATE_KEY");
10
+ exports.orgCertificateString = (0, util_1.getEnvOrFail)("CW_ORG_CERTIFICATE");
11
+ exports.orgPrivateKeyString = (0, util_1.getEnvOrFail)("CW_ORG_PRIVATE_KEY");
12
+ exports.orgGatewayEndpoint = (0, util_1.getEnvOrFail)("CW_ORG_GATEWAY_ENDPOINT");
13
+ exports.orgGatewayAuthorizationServerEndpoint = (0, util_1.getEnvOrFail)("CW_ORG_GATEWAY_AUTHORIZATION_SERVER_ENDPOINT");
14
+ exports.orgGatewayAuthorizationClientId = (0, util_1.getEnvOrFail)("CW_ORG_GATEWAY_AUTHORIZATION_CLIENT_ID");
15
+ exports.orgGatewayAuthorizationClientSecret = (0, util_1.getEnvOrFail)("CW_ORG_GATEWAY_AUTHORIZATION_CLIENT_SECRET");
16
+ /** If set, the cert runner will use this org and not try to create a new one. */
17
+ exports.existingOrgId = (0, util_1.getEnv)("CW_ORG_ID");
18
+ exports.contribServerUrl = (0, util_1.getEnvOrFail)("CONTRIB_SERVER_URL");
19
+ exports.contribServerPort = parseInt((0, util_1.getEnvOrFail)("CONTRIB_SERVER_PORT"));
20
+ //# sourceMappingURL=env.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":";;;AAAA,iCAA8C;AAEjC,QAAA,QAAQ,GAAG,IAAA,mBAAY,EAAC,cAAc,CAAC,CAAC;AACxC,QAAA,SAAS,GAAG,IAAA,mBAAY,EAAC,eAAe,CAAC,CAAC;AAC1C,QAAA,UAAU,GAAG,IAAA,mBAAY,EAAC,gBAAgB,CAAC,CAAC;AAC5C,QAAA,uBAAuB,GAAG,IAAA,mBAAY,EAAC,uBAAuB,CAAC,CAAC;AAChE,QAAA,sBAAsB,GAAG,IAAA,mBAAY,EAAC,uBAAuB,CAAC,CAAC;AAE/D,QAAA,oBAAoB,GAAG,IAAA,mBAAY,EAAC,oBAAoB,CAAC,CAAC;AAC1D,QAAA,mBAAmB,GAAG,IAAA,mBAAY,EAAC,oBAAoB,CAAC,CAAC;AACzD,QAAA,kBAAkB,GAAG,IAAA,mBAAY,EAAC,yBAAyB,CAAC,CAAC;AAC7D,QAAA,qCAAqC,GAAG,IAAA,mBAAY,EAC/D,8CAA8C,CAC/C,CAAC;AACW,QAAA,+BAA+B,GAAG,IAAA,mBAAY,EACzD,wCAAwC,CACzC,CAAC;AACW,QAAA,mCAAmC,GAAG,IAAA,mBAAY,EAC7D,4CAA4C,CAC7C,CAAC;AACF,iFAAiF;AACpE,QAAA,aAAa,GAAG,IAAA,aAAM,EAAC,WAAW,CAAC,CAAC;AAEpC,QAAA,gBAAgB,GAAG,IAAA,mBAAY,EAAC,oBAAoB,CAAC,CAAC;AACtD,QAAA,iBAAiB,GAAG,QAAQ,CAAC,IAAA,mBAAY,EAAC,qBAAqB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ export declare function makeBinary({ binaryId, contentType, contents: contentsParam, }?: {
2
+ binaryId?: string;
3
+ contentType?: string;
4
+ contents?: string;
5
+ }): {
6
+ resourceType: string;
7
+ id: string;
8
+ contentType: string;
9
+ data: string;
10
+ };
11
+ //# sourceMappingURL=binary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binary.d.ts","sourceRoot":"","sources":["../../../src/flows/contribution/binary.ts"],"names":[],"mappings":"AAKA,wBAAgB,UAAU,CAAC,EACzB,QAAmB,EACnB,WAA+B,EAC/B,QAAQ,EAAE,aAAa,GACxB,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO;;;;;EAUrE"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.makeBinary = void 0;
7
+ const shared_1 = require("@metriport/shared");
8
+ const fs_1 = __importDefault(require("fs"));
9
+ const nanoid_1 = require("nanoid");
10
+ const path_1 = __importDefault(require("path"));
11
+ function makeBinary({ binaryId = (0, nanoid_1.nanoid)(), contentType = "application/xml", contents: contentsParam, } = {}) {
12
+ const contents = contentsParam ?? fs_1.default.readFileSync(path_1.default.join(__dirname, "ccda.xml"), "utf8");
13
+ const encodedData = (0, shared_1.stringToBase64)(contents);
14
+ const binary = {
15
+ resourceType: "Binary",
16
+ id: `${binaryId}`,
17
+ contentType,
18
+ data: `${encodedData}`,
19
+ };
20
+ return binary;
21
+ }
22
+ exports.makeBinary = makeBinary;
23
+ //# sourceMappingURL=binary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binary.js","sourceRoot":"","sources":["../../../src/flows/contribution/binary.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAmD;AACnD,4CAAoB;AACpB,mCAAgC;AAChC,gDAAwB;AAExB,SAAgB,UAAU,CAAC,EACzB,QAAQ,GAAG,IAAA,eAAM,GAAE,EACnB,WAAW,GAAG,iBAAiB,EAC/B,QAAQ,EAAE,aAAa,MAC2C,EAAE;IACpE,MAAM,QAAQ,GAAG,aAAa,IAAI,YAAE,CAAC,YAAY,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,CAAC;IAC5F,MAAM,WAAW,GAAG,IAAA,uBAAc,EAAC,QAAQ,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG;QACb,YAAY,EAAE,QAAQ;QACtB,EAAE,EAAE,GAAG,QAAQ,EAAE;QACjB,WAAW;QACX,IAAI,EAAE,GAAG,WAAW,EAAE;KACvB,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC;AAdD,gCAcC"}
@@ -0,0 +1,8 @@
1
+ import { CommonWell } from "@metriport/commonwell-sdk";
2
+ /**
3
+ * Initialize the HTTP server for the contribution flow.
4
+ *
5
+ * @param commonWellParam - The CommonWell instance to use for the contribution flow.
6
+ */
7
+ export declare function initContributionHttpServer(commonWellParam: CommonWell): Promise<void>;
8
+ //# sourceMappingURL=contribution-server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contribution-server.d.ts","sourceRoot":"","sources":["../../../src/flows/contribution/contribution-server.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAkJvD;;;;GAIG;AACH,wBAAsB,0BAA0B,CAAC,eAAe,EAAE,UAAU,iBAO3E"}
@@ -0,0 +1,174 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.initContributionHttpServer = void 0;
30
+ const dotenv = __importStar(require("dotenv"));
31
+ dotenv.config();
32
+ // Keep dotenv import/setup before all other imports
33
+ const faker_1 = require("@faker-js/faker");
34
+ const bundle_1 = require("@metriport/core/external/fhir/bundle/bundle");
35
+ const express_1 = __importDefault(require("express"));
36
+ const env_1 = require("../../env");
37
+ const binary_1 = require("./binary");
38
+ const document_reference_1 = require("./document-reference");
39
+ const token_1 = require("./token");
40
+ /**
41
+ * The contribution server is a simple HTTP server that handles requests from CommonWell
42
+ * to support the contribution flow.
43
+ *
44
+ * It is used to:
45
+ * - generate the OAuth 2.0 token (POST /oauth/token)
46
+ * - return the list of documents for a given patient (GET /oauth/fhir/DocumentReference)
47
+ * - return the document (GET /oauth/fhir/Binary/:id)
48
+ *
49
+ * See the function initContributionHttpServer() further down for the initialization.
50
+ */
51
+ let commonWell;
52
+ const app = (0, express_1.default)();
53
+ app.use(express_1.default.urlencoded({ extended: false, limit: "2mb" }));
54
+ app.use(express_1.default.json({ limit: "2mb" }));
55
+ /**
56
+ * Endpoint to generate OAuth 2.0 token
57
+ */
58
+ app.post("/oauth/token", express_1.default.urlencoded({ extended: true }), (req, res) => {
59
+ try {
60
+ console.log(`\nToken request`);
61
+ console.log(`>>> Headers: ${JSON.stringify(req.headers, null, 2)}`);
62
+ console.log(`>>> Path: ${req.path}`);
63
+ console.log(`>>> Query: ${JSON.stringify(req.query, null, 2)}`);
64
+ console.log(`>>> Body: ${JSON.stringify(req.body, null, 2)}`);
65
+ const accessToken = (0, token_1.makeToken)(req, commonWell.oid, commonWell.orgName);
66
+ const oauthResponse = {
67
+ access_token: accessToken,
68
+ token_type: "Bearer",
69
+ };
70
+ res.status(200).json(oauthResponse);
71
+ }
72
+ catch (error) {
73
+ console.log("Token generation failed:", error);
74
+ res.status(400).json({
75
+ error: "invalid_request",
76
+ error_description: error instanceof Error ? error.message : "Unknown error",
77
+ });
78
+ }
79
+ });
80
+ /**
81
+ * Endpoint to retrieve a DocumentReference resource.
82
+ *
83
+ * Query params provided by CW v2:
84
+ * "_include": [
85
+ * "DocumentReference:subject",
86
+ * "DocumentReference:patient",
87
+ * "DocumentReference:author",
88
+ * "DocumentReference:custodian",
89
+ * "DocumentReference:authenticator",
90
+ * "DocumentReference:encounter"
91
+ * ],
92
+ * "subject": "<org-oid>|<patient-id>",
93
+ * "patient": "<org-oid>|<patient-id>",
94
+ */
95
+ app.get("/oauth/fhir/DocumentReference", async (req, res) => {
96
+ console.log(`\nDocumentReference request`);
97
+ console.log(`>>> Headers: ${JSON.stringify(req.headers, null, 2)}`);
98
+ console.log(`>>> Path: ${req.path}`);
99
+ console.log(`>>> Query: ${JSON.stringify(req.query, null, 2)}`);
100
+ console.log(`>>> Body: ${JSON.stringify(req.body, null, 2)}`);
101
+ if (!(0, token_1.verifySignature)(req)) {
102
+ console.log(`Token verification failed`);
103
+ res.sendStatus(401);
104
+ return;
105
+ }
106
+ console.log(`Token verification successful!!!`);
107
+ const patientId = (req.query.patient ?? req.query.subject ?? "").toString();
108
+ if (!patientId) {
109
+ console.log(`>>> No patient ID found in query`);
110
+ res.status(400).json(buildResponseMessage("No patient ID found in query"));
111
+ return;
112
+ }
113
+ const binaryId = faker_1.faker.string.uuid();
114
+ const docRef = (0, document_reference_1.makeDocumentReference)({
115
+ memberOID: env_1.memberOID,
116
+ orgId: commonWell.oid,
117
+ orgName: commonWell.orgName,
118
+ patientId,
119
+ docUrl: env_1.contribServerUrl,
120
+ binaryId,
121
+ });
122
+ const entry = (0, bundle_1.buildBundleEntry)(docRef);
123
+ const respPayload = (0, bundle_1.buildSearchSetBundle)([entry]);
124
+ res.status(200).json(respPayload);
125
+ });
126
+ /**
127
+ * Endpoint to retrieve a document. This is called after the DocumentReference endpoint,
128
+ * with the ID being the binaryId present on the DocumentReference resource returned by
129
+ * that endpoint.
130
+ */
131
+ app.get("/oauth/fhir/Binary/:id", async (req, res) => {
132
+ console.log(`\nBinary request`);
133
+ console.log(`>>> Headers: ${JSON.stringify(req.headers, null, 2)}`);
134
+ console.log(`>>> Path: ${req.path}`);
135
+ console.log(`>>> Query: ${JSON.stringify(req.query, null, 2)}`);
136
+ console.log(`>>> Body: ${JSON.stringify(req.body, null, 2)}`);
137
+ if (!(0, token_1.verifySignature)(req)) {
138
+ console.log(`Token verification failed`);
139
+ res.sendStatus(401);
140
+ return;
141
+ }
142
+ console.log(`Token verification successful!!!`);
143
+ const binary = (0, binary_1.makeBinary)();
144
+ res.status(200).json(binary);
145
+ });
146
+ app.use(express_1.default.json({ limit: "2mb" }));
147
+ app.all("*", async (req, res) => {
148
+ console.log(`\nNOT FOUND`);
149
+ console.log(`>>> Headers: ${JSON.stringify(req.headers, null, 2)}`);
150
+ console.log(`>>> Path: ${req.path}`);
151
+ console.log(`>>> Query: ${JSON.stringify(req.query, null, 2)}`);
152
+ console.log(`>>> Body: ${JSON.stringify(req.body, null, 2)}`);
153
+ res.sendStatus(404);
154
+ });
155
+ /**
156
+ * Initialize the HTTP server for the contribution flow.
157
+ *
158
+ * @param commonWellParam - The CommonWell instance to use for the contribution flow.
159
+ */
160
+ async function initContributionHttpServer(commonWellParam) {
161
+ commonWell = commonWellParam;
162
+ const port = env_1.contribServerPort;
163
+ app.listen(port, "0.0.0.0", async () => {
164
+ console.log(`[server]: HTTP server is running on port ${port}`);
165
+ });
166
+ }
167
+ exports.initContributionHttpServer = initContributionHttpServer;
168
+ function buildResponseMessage(message) {
169
+ return {
170
+ resourceType: "OperationOutcome",
171
+ issue: [{ severity: "error", code: "invalid", details: { text: message } }],
172
+ };
173
+ }
174
+ //# sourceMappingURL=contribution-server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contribution-server.js","sourceRoot":"","sources":["../../../src/flows/contribution/contribution-server.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AACjC,MAAM,CAAC,MAAM,EAAE,CAAC;AAChB,oDAAoD;AACpD,2CAAwC;AAExC,wEAGqD;AACrD,sDAAkE;AAClE,mCAA2E;AAC3E,qCAAsC;AACtC,6DAA6D;AAC7D,mCAAqD;AAErD;;;;;;;;;;GAUG;AACH,IAAI,UAAsB,CAAC;AAE3B,MAAM,GAAG,GAAgB,IAAA,iBAAO,GAAE,CAAC;AAEnC,GAAG,CAAC,GAAG,CAAC,iBAAO,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;AAC/D,GAAG,CAAC,GAAG,CAAC,iBAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;AAExC;;GAEG;AACH,GAAG,CAAC,IAAI,CACN,cAAc,EACd,iBAAO,CAAC,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C,CAAC;AACL,CAAC;AAPD,gEAOC;AAED,SAAS,oBAAoB,CAAC,OAAe;IAC3C,OAAO;QACL,YAAY,EAAE,kBAAkB;QAChC,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC;KAC5E,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ export declare function makeDocumentReference({ memberOID, orgId, orgName, patientId, docUrl, binaryId, }: {
2
+ memberOID: string;
3
+ orgId: string;
4
+ orgName: string;
5
+ patientId: string;
6
+ docUrl: string;
7
+ binaryId: string;
8
+ }): any;
9
+ //# sourceMappingURL=document-reference.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-reference.d.ts","sourceRoot":"","sources":["../../../src/flows/contribution/document-reference.ts"],"names":[],"mappings":"AAEA,wBAAgB,qBAAqB,CAAC,EACpC,SAAS,EACT,KAAK,EACL,OAAO,EACP,SAAS,EACT,MAAM,EACN,QAAQ,GACT,EAAE;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,OAqFA"}