@oystehr/sdk 4.1.4 → 4.1.6
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/dist/cjs/index.min.cjs +1 -1
- package/dist/cjs/index.min.cjs.map +1 -1
- package/dist/cjs/resources/classes/erx.cjs +27 -3
- package/dist/cjs/resources/classes/erx.cjs.map +1 -1
- package/dist/cjs/resources/classes/erx.d.ts +29 -3
- package/dist/cjs/resources/classes/fax.cjs +10 -0
- package/dist/cjs/resources/classes/fax.cjs.map +1 -1
- package/dist/cjs/resources/classes/fax.d.ts +9 -1
- package/dist/cjs/resources/types/Application.d.ts +4 -0
- package/dist/cjs/resources/types/FaxGetConfigurationResponse.d.ts +13 -0
- package/dist/cjs/resources/types/ZambdaCreateParams.d.ts +1 -1
- package/dist/cjs/resources/types/ZambdaUpdateParams.d.ts +1 -1
- package/dist/cjs/resources/types/index.d.ts +1 -0
- package/dist/esm/index.min.js +1 -1
- package/dist/esm/index.min.js.map +1 -1
- package/dist/esm/resources/classes/erx.d.ts +29 -3
- package/dist/esm/resources/classes/erx.js +27 -3
- package/dist/esm/resources/classes/erx.js.map +1 -1
- package/dist/esm/resources/classes/fax.d.ts +9 -1
- package/dist/esm/resources/classes/fax.js +10 -0
- package/dist/esm/resources/classes/fax.js.map +1 -1
- package/dist/esm/resources/types/Application.d.ts +4 -0
- package/dist/esm/resources/types/FaxGetConfigurationResponse.d.ts +13 -0
- package/dist/esm/resources/types/ZambdaCreateParams.d.ts +1 -1
- package/dist/esm/resources/types/ZambdaUpdateParams.d.ts +1 -1
- package/dist/esm/resources/types/index.d.ts +1 -0
- package/package.json +2 -2
- package/src/resources/classes/erx.ts +31 -3
- package/src/resources/classes/fax.ts +17 -1
- package/src/resources/types/Application.ts +4 -0
- package/src/resources/types/FaxGetConfigurationResponse.ts +15 -0
- package/src/resources/types/ZambdaCreateParams.ts +1 -1
- package/src/resources/types/ZambdaUpdateParams.ts +1 -1
- package/src/resources/types/index.ts +1 -0
|
@@ -12,72 +12,96 @@ class Erx extends client.SDKResource {
|
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Search for allergens.
|
|
15
|
+
* Action: `eRx:SearchAllergen`
|
|
16
|
+
* Access Policy Resource: `eRx:Allergen`
|
|
15
17
|
*/
|
|
16
18
|
searchAllergens(params, request) {
|
|
17
19
|
return this.request('/allergen', 'get', this.#baseUrlThunk.bind(this))(params, request);
|
|
18
20
|
}
|
|
19
21
|
/**
|
|
20
22
|
* Search for medications.
|
|
23
|
+
* Action: `eRx:SearchMedication`
|
|
24
|
+
* Access Policy Resource: `eRx:Medication`
|
|
21
25
|
*/
|
|
22
26
|
searchMedications(params, request) {
|
|
23
27
|
return this.request('/medication', 'get', this.#baseUrlThunk.bind(this))(params, request);
|
|
24
28
|
}
|
|
25
29
|
/**
|
|
26
30
|
* Get eRx configuration for project.
|
|
31
|
+
* Action: `eRx:GetConfiguration`
|
|
32
|
+
* Access Policy Resource: `eRx:Configuration`
|
|
27
33
|
*/
|
|
28
34
|
getConfiguration(request) {
|
|
29
35
|
return this.request('/config', 'get', this.#baseUrlThunk.bind(this))(request);
|
|
30
36
|
}
|
|
31
37
|
/**
|
|
32
|
-
*
|
|
38
|
+
* Check for drug-allergy interactions for a patient. This endpoint requires the patient's allergies to be synced with the upstream eRx provider.
|
|
39
|
+
* Action: `eRx:Check`
|
|
40
|
+
* Access Policy Resource: `eRx:Interaction`
|
|
33
41
|
*/
|
|
34
42
|
checkAllergyInteractions(params, request) {
|
|
35
43
|
return this.request('/patient/{patientId}/interactions/allergy', 'get', this.#baseUrlThunk.bind(this))(params, request);
|
|
36
44
|
}
|
|
37
45
|
/**
|
|
38
|
-
*
|
|
46
|
+
* Check for drug-drug interactions for a patient. This endpoint requires the patient's medications to be synced with the upstream eRx provider.
|
|
47
|
+
* Action: `eRx:Check`
|
|
48
|
+
* Access Policy Resource: `eRx:Interaction`
|
|
39
49
|
*/
|
|
40
50
|
checkMedicationInteractions(params, request) {
|
|
41
51
|
return this.request('/patient/{patientId}/interactions/medication', 'get', this.#baseUrlThunk.bind(this))(params, request);
|
|
42
52
|
}
|
|
43
53
|
/**
|
|
44
|
-
*
|
|
54
|
+
* Check for drug-allergy and drug-drug interactions with a specific drug for a patient. This endpoint requires the patient's allergies and medications to be synced with the upstream eRx provider.
|
|
55
|
+
* Action: `eRx:Check`
|
|
56
|
+
* Access Policy Resource: `eRx:Interaction`
|
|
45
57
|
*/
|
|
46
58
|
checkPrecheckInteractions(params, request) {
|
|
47
59
|
return this.request('/patient/{patientId}/interactions/precheck/{drugId}', 'get', this.#baseUrlThunk.bind(this))(params, request);
|
|
48
60
|
}
|
|
49
61
|
/**
|
|
50
62
|
* Cancel prescription for patient.
|
|
63
|
+
* Action: `eRx:CancelPrescription`
|
|
64
|
+
* Access Policy Resource: `eRx:Prescription`
|
|
51
65
|
*/
|
|
52
66
|
cancelPrescription(params, request) {
|
|
53
67
|
return this.request('/patient/{patientId}/prescriptions/{medicationRequestId}', 'delete', this.#baseUrlThunk.bind(this))(params, request);
|
|
54
68
|
}
|
|
55
69
|
/**
|
|
56
70
|
* Syncs demographic, allergy, and medication data for a patient with the upstream eRx provider.
|
|
71
|
+
* Action: `eRx:SyncPatient`
|
|
72
|
+
* Access Policy Resource: `eRx:Patient`
|
|
57
73
|
*/
|
|
58
74
|
syncPatient(params, request) {
|
|
59
75
|
return this.request('/patient/{patientId}/sync', 'post', this.#baseUrlThunk.bind(this))(params, request);
|
|
60
76
|
}
|
|
61
77
|
/**
|
|
62
78
|
* Create an SSO link for a practitioner. This link can be used to log in to the eRx service as the specified practitioner.
|
|
79
|
+
* Action: `eRx:Connect`
|
|
80
|
+
* Access Policy Resource: `eRx:SSO`
|
|
63
81
|
*/
|
|
64
82
|
connectPractitioner(params, request) {
|
|
65
83
|
return this.request('/practitioner/connect', 'get', this.#baseUrlThunk.bind(this))(params, request);
|
|
66
84
|
}
|
|
67
85
|
/**
|
|
68
86
|
* Check eRx enrollment for a practitioner.
|
|
87
|
+
* Action: `eRx:Read`
|
|
88
|
+
* Access Policy Resource: `eRx:Enrollment`
|
|
69
89
|
*/
|
|
70
90
|
checkPractitionerEnrollment(params, request) {
|
|
71
91
|
return this.request('/practitioner/{practitionerId}', 'get', this.#baseUrlThunk.bind(this))(params, request);
|
|
72
92
|
}
|
|
73
93
|
/**
|
|
74
94
|
* Enroll a practitioner in the eRx service.
|
|
95
|
+
* Action: `eRx:Create`
|
|
96
|
+
* Access Policy Resource: `eRx:Enrollment`
|
|
75
97
|
*/
|
|
76
98
|
enrollPractitioner(params, request) {
|
|
77
99
|
return this.request('/practitioner/{practitionerId}', 'post', this.#baseUrlThunk.bind(this))(params, request);
|
|
78
100
|
}
|
|
79
101
|
/**
|
|
80
102
|
* Unenroll a practitioner from the eRx service.
|
|
103
|
+
* Action: `eRx:Delete`
|
|
104
|
+
* Access Policy Resource: `eRx:Enrollment`
|
|
81
105
|
*/
|
|
82
106
|
unenrollPractitioner(params, request) {
|
|
83
107
|
return this.request('/practitioner/{practitionerId}', 'delete', this.#baseUrlThunk.bind(this))(params, request);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"erx.cjs","sources":["../../../../src/resources/classes/erx.ts"],"sourcesContent":["// AUTOGENERATED -- DO NOT EDIT\n\nimport {\n ErxCancelPrescriptionParams,\n ErxCheckAllergyInteractionsParams,\n ErxCheckAllergyInteractionsResponse,\n ErxCheckMedicationInteractionsParams,\n ErxCheckMedicationInteractionsResponse,\n ErxCheckPractitionerEnrollmentParams,\n ErxCheckPractitionerEnrollmentResponse,\n ErxCheckPrecheckInteractionsParams,\n ErxCheckPrecheckInteractionsResponse,\n ErxConnectPractitionerParams,\n ErxConnectPractitionerResponse,\n ErxEnrollPractitionerParams,\n ErxGetConfigurationResponse,\n ErxSearchAllergensParams,\n ErxSearchAllergensResponse,\n ErxSearchMedicationsParams,\n ErxSearchMedicationsResponse,\n ErxSyncPatientParams,\n ErxUnenrollPractitionerParams,\n OystehrClientRequest,\n} from '../..';\nimport { SDKResource } from '../../client/client';\nimport { OystehrConfig } from '../../config';\n\nexport class Erx extends SDKResource {\n constructor(config: OystehrConfig) {\n super(config);\n }\n #baseUrlThunk(): string {\n return this.config.services?.['erxApiUrl'] ?? 'https://erx-api.zapehr.com/v3';\n }\n /**\n * Search for allergens.\n */\n searchAllergens(\n params: ErxSearchAllergensParams,\n request?: OystehrClientRequest\n ): Promise<ErxSearchAllergensResponse> {\n return this.request('/allergen', 'get', this.#baseUrlThunk.bind(this))(params, request);\n }\n /**\n * Search for medications.\n */\n searchMedications(\n params: ErxSearchMedicationsParams,\n request?: OystehrClientRequest\n ): Promise<ErxSearchMedicationsResponse> {\n return this.request('/medication', 'get', this.#baseUrlThunk.bind(this))(params, request);\n }\n /**\n * Get eRx configuration for project.\n */\n getConfiguration(request?: OystehrClientRequest): Promise<ErxGetConfigurationResponse> {\n return this.request('/config', 'get', this.#baseUrlThunk.bind(this))(request);\n }\n /**\n *
|
|
1
|
+
{"version":3,"file":"erx.cjs","sources":["../../../../src/resources/classes/erx.ts"],"sourcesContent":["// AUTOGENERATED -- DO NOT EDIT\n\nimport {\n ErxCancelPrescriptionParams,\n ErxCheckAllergyInteractionsParams,\n ErxCheckAllergyInteractionsResponse,\n ErxCheckMedicationInteractionsParams,\n ErxCheckMedicationInteractionsResponse,\n ErxCheckPractitionerEnrollmentParams,\n ErxCheckPractitionerEnrollmentResponse,\n ErxCheckPrecheckInteractionsParams,\n ErxCheckPrecheckInteractionsResponse,\n ErxConnectPractitionerParams,\n ErxConnectPractitionerResponse,\n ErxEnrollPractitionerParams,\n ErxGetConfigurationResponse,\n ErxSearchAllergensParams,\n ErxSearchAllergensResponse,\n ErxSearchMedicationsParams,\n ErxSearchMedicationsResponse,\n ErxSyncPatientParams,\n ErxUnenrollPractitionerParams,\n OystehrClientRequest,\n} from '../..';\nimport { SDKResource } from '../../client/client';\nimport { OystehrConfig } from '../../config';\n\nexport class Erx extends SDKResource {\n constructor(config: OystehrConfig) {\n super(config);\n }\n #baseUrlThunk(): string {\n return this.config.services?.['erxApiUrl'] ?? 'https://erx-api.zapehr.com/v3';\n }\n /**\n * Search for allergens.\n * Action: `eRx:SearchAllergen`\n * Access Policy Resource: `eRx:Allergen`\n */\n searchAllergens(\n params: ErxSearchAllergensParams,\n request?: OystehrClientRequest\n ): Promise<ErxSearchAllergensResponse> {\n return this.request('/allergen', 'get', this.#baseUrlThunk.bind(this))(params, request);\n }\n /**\n * Search for medications.\n * Action: `eRx:SearchMedication`\n * Access Policy Resource: `eRx:Medication`\n */\n searchMedications(\n params: ErxSearchMedicationsParams,\n request?: OystehrClientRequest\n ): Promise<ErxSearchMedicationsResponse> {\n return this.request('/medication', 'get', this.#baseUrlThunk.bind(this))(params, request);\n }\n /**\n * Get eRx configuration for project.\n * Action: `eRx:GetConfiguration`\n * Access Policy Resource: `eRx:Configuration`\n */\n getConfiguration(request?: OystehrClientRequest): Promise<ErxGetConfigurationResponse> {\n return this.request('/config', 'get', this.#baseUrlThunk.bind(this))(request);\n }\n /**\n * Check for drug-allergy interactions for a patient. This endpoint requires the patient's allergies to be synced with the upstream eRx provider.\n * Action: `eRx:Check`\n * Access Policy Resource: `eRx:Interaction`\n */\n checkAllergyInteractions(\n params: ErxCheckAllergyInteractionsParams,\n request?: OystehrClientRequest\n ): Promise<ErxCheckAllergyInteractionsResponse> {\n return this.request(\n '/patient/{patientId}/interactions/allergy',\n 'get',\n this.#baseUrlThunk.bind(this)\n )(params, request);\n }\n /**\n * Check for drug-drug interactions for a patient. This endpoint requires the patient's medications to be synced with the upstream eRx provider.\n * Action: `eRx:Check`\n * Access Policy Resource: `eRx:Interaction`\n */\n checkMedicationInteractions(\n params: ErxCheckMedicationInteractionsParams,\n request?: OystehrClientRequest\n ): Promise<ErxCheckMedicationInteractionsResponse> {\n return this.request(\n '/patient/{patientId}/interactions/medication',\n 'get',\n this.#baseUrlThunk.bind(this)\n )(params, request);\n }\n /**\n * Check for drug-allergy and drug-drug interactions with a specific drug for a patient. This endpoint requires the patient's allergies and medications to be synced with the upstream eRx provider.\n * Action: `eRx:Check`\n * Access Policy Resource: `eRx:Interaction`\n */\n checkPrecheckInteractions(\n params: ErxCheckPrecheckInteractionsParams,\n request?: OystehrClientRequest\n ): Promise<ErxCheckPrecheckInteractionsResponse> {\n return this.request(\n '/patient/{patientId}/interactions/precheck/{drugId}',\n 'get',\n this.#baseUrlThunk.bind(this)\n )(params, request);\n }\n /**\n * Cancel prescription for patient.\n * Action: `eRx:CancelPrescription`\n * Access Policy Resource: `eRx:Prescription`\n */\n cancelPrescription(params: ErxCancelPrescriptionParams, request?: OystehrClientRequest): Promise<void> {\n return this.request(\n '/patient/{patientId}/prescriptions/{medicationRequestId}',\n 'delete',\n this.#baseUrlThunk.bind(this)\n )(params, request);\n }\n /**\n * Syncs demographic, allergy, and medication data for a patient with the upstream eRx provider.\n * Action: `eRx:SyncPatient`\n * Access Policy Resource: `eRx:Patient`\n */\n syncPatient(params: ErxSyncPatientParams, request?: OystehrClientRequest): Promise<void> {\n return this.request('/patient/{patientId}/sync', 'post', this.#baseUrlThunk.bind(this))(params, request);\n }\n /**\n * Create an SSO link for a practitioner. This link can be used to log in to the eRx service as the specified practitioner.\n * Action: `eRx:Connect`\n * Access Policy Resource: `eRx:SSO`\n */\n connectPractitioner(\n params: ErxConnectPractitionerParams,\n request?: OystehrClientRequest\n ): Promise<ErxConnectPractitionerResponse>;\n /**\n * Create an SSO link for a practitioner. This link can be used to log in to the eRx service as the specified practitioner.\n * Action: `eRx:Connect`\n * Access Policy Resource: `eRx:SSO`\n */\n connectPractitioner(request?: OystehrClientRequest): Promise<ErxConnectPractitionerResponse>;\n /**\n * Create an SSO link for a practitioner. This link can be used to log in to the eRx service as the specified practitioner.\n * Action: `eRx:Connect`\n * Access Policy Resource: `eRx:SSO`\n */\n connectPractitioner(\n params?: ErxConnectPractitionerParams | OystehrClientRequest,\n request?: OystehrClientRequest\n ): Promise<ErxConnectPractitionerResponse> {\n return this.request('/practitioner/connect', 'get', this.#baseUrlThunk.bind(this))(params, request);\n }\n /**\n * Check eRx enrollment for a practitioner.\n * Action: `eRx:Read`\n * Access Policy Resource: `eRx:Enrollment`\n */\n checkPractitionerEnrollment(\n params: ErxCheckPractitionerEnrollmentParams,\n request?: OystehrClientRequest\n ): Promise<ErxCheckPractitionerEnrollmentResponse> {\n return this.request('/practitioner/{practitionerId}', 'get', this.#baseUrlThunk.bind(this))(params, request);\n }\n /**\n * Enroll a practitioner in the eRx service.\n * Action: `eRx:Create`\n * Access Policy Resource: `eRx:Enrollment`\n */\n enrollPractitioner(params: ErxEnrollPractitionerParams, request?: OystehrClientRequest): Promise<void> {\n return this.request('/practitioner/{practitionerId}', 'post', this.#baseUrlThunk.bind(this))(params, request);\n }\n /**\n * Unenroll a practitioner from the eRx service.\n * Action: `eRx:Delete`\n * Access Policy Resource: `eRx:Enrollment`\n */\n unenrollPractitioner(params: ErxUnenrollPractitionerParams, request?: OystehrClientRequest): Promise<void> {\n return this.request('/practitioner/{practitionerId}', 'delete', this.#baseUrlThunk.bind(this))(params, request);\n }\n}\n"],"names":["SDKResource"],"mappings":";;;;AAAA;AA2BM,MAAO,GAAI,SAAQA,kBAAW,CAAA;AAClC,IAAA,WAAA,CAAY,MAAqB,EAAA;QAC/B,KAAK,CAAC,MAAM,CAAC,CAAC;KACf;IACD,aAAa,GAAA;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,WAAW,CAAC,IAAI,+BAA+B,CAAC;KAC/E;AACD;;;;AAIG;IACH,eAAe,CACb,MAAgC,EAChC,OAA8B,EAAA;QAE9B,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACzF;AACD;;;;AAIG;IACH,iBAAiB,CACf,MAAkC,EAClC,OAA8B,EAAA;QAE9B,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC3F;AACD;;;;AAIG;AACH,IAAA,gBAAgB,CAAC,OAA8B,EAAA;QAC7C,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;KAC/E;AACD;;;;AAIG;IACH,wBAAwB,CACtB,MAAyC,EACzC,OAA8B,EAAA;QAE9B,OAAO,IAAI,CAAC,OAAO,CACjB,2CAA2C,EAC3C,KAAK,EACL,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAC9B,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACpB;AACD;;;;AAIG;IACH,2BAA2B,CACzB,MAA4C,EAC5C,OAA8B,EAAA;QAE9B,OAAO,IAAI,CAAC,OAAO,CACjB,8CAA8C,EAC9C,KAAK,EACL,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAC9B,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACpB;AACD;;;;AAIG;IACH,yBAAyB,CACvB,MAA0C,EAC1C,OAA8B,EAAA;QAE9B,OAAO,IAAI,CAAC,OAAO,CACjB,qDAAqD,EACrD,KAAK,EACL,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAC9B,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACpB;AACD;;;;AAIG;IACH,kBAAkB,CAAC,MAAmC,EAAE,OAA8B,EAAA;QACpF,OAAO,IAAI,CAAC,OAAO,CACjB,0DAA0D,EAC1D,QAAQ,EACR,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAC9B,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACpB;AACD;;;;AAIG;IACH,WAAW,CAAC,MAA4B,EAAE,OAA8B,EAAA;QACtE,OAAO,IAAI,CAAC,OAAO,CAAC,2BAA2B,EAAE,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC1G;AAgBD;;;;AAIG;IACH,mBAAmB,CACjB,MAA4D,EAC5D,OAA8B,EAAA;QAE9B,OAAO,IAAI,CAAC,OAAO,CAAC,uBAAuB,EAAE,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACrG;AACD;;;;AAIG;IACH,2BAA2B,CACzB,MAA4C,EAC5C,OAA8B,EAAA;QAE9B,OAAO,IAAI,CAAC,OAAO,CAAC,gCAAgC,EAAE,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC9G;AACD;;;;AAIG;IACH,kBAAkB,CAAC,MAAmC,EAAE,OAA8B,EAAA;QACpF,OAAO,IAAI,CAAC,OAAO,CAAC,gCAAgC,EAAE,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC/G;AACD;;;;AAIG;IACH,oBAAoB,CAAC,MAAqC,EAAE,OAA8B,EAAA;QACxF,OAAO,IAAI,CAAC,OAAO,CAAC,gCAAgC,EAAE,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACjH;AACF;;;;"}
|
|
@@ -6,54 +6,80 @@ export declare class Erx extends SDKResource {
|
|
|
6
6
|
constructor(config: OystehrConfig);
|
|
7
7
|
/**
|
|
8
8
|
* Search for allergens.
|
|
9
|
+
* Action: `eRx:SearchAllergen`
|
|
10
|
+
* Access Policy Resource: `eRx:Allergen`
|
|
9
11
|
*/
|
|
10
12
|
searchAllergens(params: ErxSearchAllergensParams, request?: OystehrClientRequest): Promise<ErxSearchAllergensResponse>;
|
|
11
13
|
/**
|
|
12
14
|
* Search for medications.
|
|
15
|
+
* Action: `eRx:SearchMedication`
|
|
16
|
+
* Access Policy Resource: `eRx:Medication`
|
|
13
17
|
*/
|
|
14
18
|
searchMedications(params: ErxSearchMedicationsParams, request?: OystehrClientRequest): Promise<ErxSearchMedicationsResponse>;
|
|
15
19
|
/**
|
|
16
20
|
* Get eRx configuration for project.
|
|
21
|
+
* Action: `eRx:GetConfiguration`
|
|
22
|
+
* Access Policy Resource: `eRx:Configuration`
|
|
17
23
|
*/
|
|
18
24
|
getConfiguration(request?: OystehrClientRequest): Promise<ErxGetConfigurationResponse>;
|
|
19
25
|
/**
|
|
20
|
-
*
|
|
26
|
+
* Check for drug-allergy interactions for a patient. This endpoint requires the patient's allergies to be synced with the upstream eRx provider.
|
|
27
|
+
* Action: `eRx:Check`
|
|
28
|
+
* Access Policy Resource: `eRx:Interaction`
|
|
21
29
|
*/
|
|
22
30
|
checkAllergyInteractions(params: ErxCheckAllergyInteractionsParams, request?: OystehrClientRequest): Promise<ErxCheckAllergyInteractionsResponse>;
|
|
23
31
|
/**
|
|
24
|
-
*
|
|
32
|
+
* Check for drug-drug interactions for a patient. This endpoint requires the patient's medications to be synced with the upstream eRx provider.
|
|
33
|
+
* Action: `eRx:Check`
|
|
34
|
+
* Access Policy Resource: `eRx:Interaction`
|
|
25
35
|
*/
|
|
26
36
|
checkMedicationInteractions(params: ErxCheckMedicationInteractionsParams, request?: OystehrClientRequest): Promise<ErxCheckMedicationInteractionsResponse>;
|
|
27
37
|
/**
|
|
28
|
-
*
|
|
38
|
+
* Check for drug-allergy and drug-drug interactions with a specific drug for a patient. This endpoint requires the patient's allergies and medications to be synced with the upstream eRx provider.
|
|
39
|
+
* Action: `eRx:Check`
|
|
40
|
+
* Access Policy Resource: `eRx:Interaction`
|
|
29
41
|
*/
|
|
30
42
|
checkPrecheckInteractions(params: ErxCheckPrecheckInteractionsParams, request?: OystehrClientRequest): Promise<ErxCheckPrecheckInteractionsResponse>;
|
|
31
43
|
/**
|
|
32
44
|
* Cancel prescription for patient.
|
|
45
|
+
* Action: `eRx:CancelPrescription`
|
|
46
|
+
* Access Policy Resource: `eRx:Prescription`
|
|
33
47
|
*/
|
|
34
48
|
cancelPrescription(params: ErxCancelPrescriptionParams, request?: OystehrClientRequest): Promise<void>;
|
|
35
49
|
/**
|
|
36
50
|
* Syncs demographic, allergy, and medication data for a patient with the upstream eRx provider.
|
|
51
|
+
* Action: `eRx:SyncPatient`
|
|
52
|
+
* Access Policy Resource: `eRx:Patient`
|
|
37
53
|
*/
|
|
38
54
|
syncPatient(params: ErxSyncPatientParams, request?: OystehrClientRequest): Promise<void>;
|
|
39
55
|
/**
|
|
40
56
|
* Create an SSO link for a practitioner. This link can be used to log in to the eRx service as the specified practitioner.
|
|
57
|
+
* Action: `eRx:Connect`
|
|
58
|
+
* Access Policy Resource: `eRx:SSO`
|
|
41
59
|
*/
|
|
42
60
|
connectPractitioner(params: ErxConnectPractitionerParams, request?: OystehrClientRequest): Promise<ErxConnectPractitionerResponse>;
|
|
43
61
|
/**
|
|
44
62
|
* Create an SSO link for a practitioner. This link can be used to log in to the eRx service as the specified practitioner.
|
|
63
|
+
* Action: `eRx:Connect`
|
|
64
|
+
* Access Policy Resource: `eRx:SSO`
|
|
45
65
|
*/
|
|
46
66
|
connectPractitioner(request?: OystehrClientRequest): Promise<ErxConnectPractitionerResponse>;
|
|
47
67
|
/**
|
|
48
68
|
* Check eRx enrollment for a practitioner.
|
|
69
|
+
* Action: `eRx:Read`
|
|
70
|
+
* Access Policy Resource: `eRx:Enrollment`
|
|
49
71
|
*/
|
|
50
72
|
checkPractitionerEnrollment(params: ErxCheckPractitionerEnrollmentParams, request?: OystehrClientRequest): Promise<ErxCheckPractitionerEnrollmentResponse>;
|
|
51
73
|
/**
|
|
52
74
|
* Enroll a practitioner in the eRx service.
|
|
75
|
+
* Action: `eRx:Create`
|
|
76
|
+
* Access Policy Resource: `eRx:Enrollment`
|
|
53
77
|
*/
|
|
54
78
|
enrollPractitioner(params: ErxEnrollPractitionerParams, request?: OystehrClientRequest): Promise<void>;
|
|
55
79
|
/**
|
|
56
80
|
* Unenroll a practitioner from the eRx service.
|
|
81
|
+
* Action: `eRx:Delete`
|
|
82
|
+
* Access Policy Resource: `eRx:Enrollment`
|
|
57
83
|
*/
|
|
58
84
|
unenrollPractitioner(params: ErxUnenrollPractitionerParams, request?: OystehrClientRequest): Promise<void>;
|
|
59
85
|
}
|
|
@@ -30,6 +30,16 @@ class Fax extends client.SDKResource {
|
|
|
30
30
|
onboard(request) {
|
|
31
31
|
return this.request('/onboard', 'post', this.#baseUrlThunk.bind(this))(request);
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Get fax service configuration.
|
|
35
|
+
*
|
|
36
|
+
* Access Policy Requirements:
|
|
37
|
+
* Action: `Fax:GetConfiguration`
|
|
38
|
+
* Access Policy Resource: `Fax:Configuration`
|
|
39
|
+
*/
|
|
40
|
+
getConfiguration(request) {
|
|
41
|
+
return this.request('/config', 'get', this.#baseUrlThunk.bind(this))(request);
|
|
42
|
+
}
|
|
33
43
|
/**
|
|
34
44
|
* Send a fax. Oystehr's [fax sending](https://docs.oystehr.com/oystehr/services/fax/send/) feature makes it easy to send a fax to a chosen recipient with a single API call. You can use this feature to send referrals, medical records, prescriptions, and other documents that require fax transmission e.g. for HIPAA compliance.
|
|
35
45
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fax.cjs","sources":["../../../../src/resources/classes/fax.ts"],"sourcesContent":["// AUTOGENERATED -- DO NOT EDIT\n\nimport {
|
|
1
|
+
{"version":3,"file":"fax.cjs","sources":["../../../../src/resources/classes/fax.ts"],"sourcesContent":["// AUTOGENERATED -- DO NOT EDIT\n\nimport {\n FaxGetConfigurationResponse,\n FaxOnboardResponse,\n FaxSendParams,\n FaxSendResponse,\n OystehrClientRequest,\n} from '../..';\nimport { SDKResource } from '../../client/client';\nimport { OystehrConfig } from '../../config';\n\nexport class Fax extends SDKResource {\n constructor(config: OystehrConfig) {\n super(config);\n }\n #baseUrlThunk(): string {\n return this.config.services?.['faxApiUrl'] ?? 'https://fax-api.zapehr.com/v1';\n }\n /**\n * Offboard a fax number. Oystehr's [offboard](https://docs.oystehr.com/oystehr/services/fax/number/) feature makes it easy to stop using the fax service and release the project's assigned fax number with a single API call. Please note there is no way to guarantee getting the same number back again, so if you think this can break your project in any way we recommend not offboarding and avoid sending faxes until you're sure.\n *\n * Access Policy Requirements:\n * Action: `Fax:Offboard`\n * Access Policy Resource: `Fax:Number`\n */\n offboard(request?: OystehrClientRequest): Promise<void> {\n return this.request('/offboard', 'post', this.#baseUrlThunk.bind(this))(request);\n }\n /**\n * Onboard a fax number. Oystehr's [onboard](https://docs.oystehr.com/oystehr/services/fax/number/) feature makes it easy to start using the fax service and purchase a new fax number for your project with a single API call.\n *\n * Access Policy Requirements:\n * Action: `Fax:Onboard`\n * Access Policy Resource: `Fax:Number`\n */\n onboard(request?: OystehrClientRequest): Promise<FaxOnboardResponse> {\n return this.request('/onboard', 'post', this.#baseUrlThunk.bind(this))(request);\n }\n /**\n * Get fax service configuration.\n *\n * Access Policy Requirements:\n * Action: `Fax:GetConfiguration`\n * Access Policy Resource: `Fax:Configuration`\n */\n getConfiguration(request?: OystehrClientRequest): Promise<FaxGetConfigurationResponse> {\n return this.request('/config', 'get', this.#baseUrlThunk.bind(this))(request);\n }\n /**\n * Send a fax. Oystehr's [fax sending](https://docs.oystehr.com/oystehr/services/fax/send/) feature makes it easy to send a fax to a chosen recipient with a single API call. You can use this feature to send referrals, medical records, prescriptions, and other documents that require fax transmission e.g. for HIPAA compliance.\n *\n * Access Policy Requirements:\n * Action: `Fax:Send`\n * Access Policy Resource: `Fax:Fax`\n */\n send(params: FaxSendParams, request?: OystehrClientRequest): Promise<FaxSendResponse> {\n return this.request('/send', 'post', this.#baseUrlThunk.bind(this))(params, request);\n }\n}\n"],"names":["SDKResource"],"mappings":";;;;AAAA;AAYM,MAAO,GAAI,SAAQA,kBAAW,CAAA;AAClC,IAAA,WAAA,CAAY,MAAqB,EAAA;QAC/B,KAAK,CAAC,MAAM,CAAC,CAAC;KACf;IACD,aAAa,GAAA;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,WAAW,CAAC,IAAI,+BAA+B,CAAC;KAC/E;AACD;;;;;;AAMG;AACH,IAAA,QAAQ,CAAC,OAA8B,EAAA;QACrC,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;KAClF;AACD;;;;;;AAMG;AACH,IAAA,OAAO,CAAC,OAA8B,EAAA;QACpC,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;KACjF;AACD;;;;;;AAMG;AACH,IAAA,gBAAgB,CAAC,OAA8B,EAAA;QAC7C,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;KAC/E;AACD;;;;;;AAMG;IACH,IAAI,CAAC,MAAqB,EAAE,OAA8B,EAAA;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACtF;AACF;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FaxOnboardResponse, FaxSendParams, FaxSendResponse, OystehrClientRequest } from '../..';
|
|
1
|
+
import { FaxGetConfigurationResponse, FaxOnboardResponse, FaxSendParams, FaxSendResponse, OystehrClientRequest } from '../..';
|
|
2
2
|
import { SDKResource } from '../../client/client';
|
|
3
3
|
import { OystehrConfig } from '../../config';
|
|
4
4
|
export declare class Fax extends SDKResource {
|
|
@@ -20,6 +20,14 @@ export declare class Fax extends SDKResource {
|
|
|
20
20
|
* Access Policy Resource: `Fax:Number`
|
|
21
21
|
*/
|
|
22
22
|
onboard(request?: OystehrClientRequest): Promise<FaxOnboardResponse>;
|
|
23
|
+
/**
|
|
24
|
+
* Get fax service configuration.
|
|
25
|
+
*
|
|
26
|
+
* Access Policy Requirements:
|
|
27
|
+
* Action: `Fax:GetConfiguration`
|
|
28
|
+
* Access Policy Resource: `Fax:Configuration`
|
|
29
|
+
*/
|
|
30
|
+
getConfiguration(request?: OystehrClientRequest): Promise<FaxGetConfigurationResponse>;
|
|
23
31
|
/**
|
|
24
32
|
* Send a fax. Oystehr's [fax sending](https://docs.oystehr.com/oystehr/services/fax/send/) feature makes it easy to send a fax to a chosen recipient with a single API call. You can use this feature to send referrals, medical records, prescriptions, and other documents that require fax transmission e.g. for HIPAA compliance.
|
|
25
33
|
*
|
|
@@ -8,6 +8,10 @@ export interface Application {
|
|
|
8
8
|
* The Application's OAuth 2.0 client identifier.
|
|
9
9
|
*/
|
|
10
10
|
clientId: string;
|
|
11
|
+
/**
|
|
12
|
+
* The Application's connection name for use with frontend components.
|
|
13
|
+
*/
|
|
14
|
+
connectionName?: string;
|
|
11
15
|
/**
|
|
12
16
|
* A description of the application to help you differentiate it from other applications in the project. This value is not displayed to end users.
|
|
13
17
|
*/
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Successfully retrieved fax service configuration.
|
|
3
|
+
*/
|
|
4
|
+
export interface FaxGetConfigurationResponse {
|
|
5
|
+
/**
|
|
6
|
+
* True if the project is configured with the fax service.
|
|
7
|
+
*/
|
|
8
|
+
configured: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* An array of fax numbers assigned to your project in E.164 format.
|
|
11
|
+
*/
|
|
12
|
+
faxNumbers?: string[];
|
|
13
|
+
}
|
|
@@ -12,7 +12,7 @@ export interface ZambdaCreateParams {
|
|
|
12
12
|
/**
|
|
13
13
|
* The runtime to use for the Zambda Function.
|
|
14
14
|
*/
|
|
15
|
-
runtime: '
|
|
15
|
+
runtime: 'nodejs20.x' | 'nodejs22.x' | 'python3.13' | 'python3.12' | 'java21' | 'dotnet9' | 'ruby3.3';
|
|
16
16
|
/**
|
|
17
17
|
* The amount of memory in MB to allocate to the Zambda Function. If not specified, a system default (1024MB) will be used. Min: 128MB, Max: 10240MB.
|
|
18
18
|
*/
|
|
@@ -12,7 +12,7 @@ export interface ZambdaUpdateParams {
|
|
|
12
12
|
/**
|
|
13
13
|
* The runtime to use for the Zambda Function.
|
|
14
14
|
*/
|
|
15
|
-
runtime?: '
|
|
15
|
+
runtime?: 'nodejs20.x' | 'nodejs22.x' | 'python3.13' | 'python3.12' | 'java21' | 'dotnet9' | 'ruby3.3';
|
|
16
16
|
/**
|
|
17
17
|
* The amount of memory in MB to allocate to the Zambda Function. If not specified, a system default (1024MB) will be used. Min: 128MB, Max: 10240MB.
|
|
18
18
|
*/
|
|
@@ -165,6 +165,7 @@ export * from './ZambdaLogStreamSearchResponse';
|
|
|
165
165
|
export * from './ZambdaLogStreamGetParams';
|
|
166
166
|
export * from './ZambdaLogStreamGetResponse';
|
|
167
167
|
export * from './FaxOnboardResponse';
|
|
168
|
+
export * from './FaxGetConfigurationResponse';
|
|
168
169
|
export * from './FaxSendParams';
|
|
169
170
|
export * from './FaxSendResponse';
|
|
170
171
|
export * from './LabRouteListResponse';
|
package/dist/esm/index.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{v4 as e}from"uuid";class t extends Error{code;constructor({message:e,code:s,cause:r}){super(e,{cause:r}),Object.setPrototypeOf(this,t.prototype),this.code=s,this.name="OystehrSdkError"}toString(){return`${this.name}: ${this.message} (code: ${this.code})`}toJSON(){return{name:this.name,message:this.message,code:this.code,cause:this.cause}}}function s(e){const t=[];for(const s of e.issue??[])s.details&&s.details.text&&t.push(s.details.text);return t.length||t.push("Unknown FHIR error"),t.join(",")}class r extends t{cause;constructor({error:e,code:t}){super({message:s(e),code:t}),Object.setPrototypeOf(this,r.prototype),this.cause=e,this.name="OystehrFHIRError"}toJSON(){return{name:this.name,message:this.message,code:this.code,cause:this.cause}}}const i=[408,429,500,502,503,504],n=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT","UND_ERR_CONNECT_TIMEOUT","UND_ERR_HEADERS_TIMEOUT","UND_ERR_HEADERS_TIMEOUT","UND_ERR_SOCKET"];class h{config;constructor(e){this.config=e}request(e,s,r){return async(i,n)=>{const h=()=>this.config;try{return await o(r,h,e,s)(i,n)}catch(e){const s=e;throw new t({message:s.message,code:s.code,cause:s.cause})}}}fhirRequest(e,s){return async(i,n)=>{try{const t=()=>this.config.services?.fhirApiUrl??"https://fhir-api.zapehr.com",r=()=>this.config;return await o(t,r,e,s)(i,n)}catch(e){const s=e;if("string"==typeof s.message)throw new t({message:s.message,code:s.code,cause:s.cause});throw new r({error:s.message,code:s.code})}}}}function a(e){return"accessToken"in e}function o(s,r,h,o){return async(c,p)=>{const l=c&&!p&&!Array.isArray(c)&&a(c)?{}:c??{},d=c&&!p&&!Array.isArray(c)&&a(c)?c:p,b=o.toLowerCase(),m=r(),g=m.fetch??fetch,f=d?.accessToken??m.accessToken,U=d?.projectId??r().projectId;let T=h,k=l;if(!Array.isArray(l)){const[e,s]=function(e,s){const r={...s},i=e.replace(/\{([^}]+)\}/g,((e,i)=>{if(delete r[i],i.match(/^.*\+$/))return s[i]+"";if(!s[i]||""===s[i])throw new t({message:`Required path parameter is an empty string: ${i}`,code:400});return s[i]?encodeURIComponent(s[i]+""):""})),n=Object.keys(r),h=n.length?n.reduce(((e,t)=>({...e,[t]:r[t]})),{}):{};return[i,h]}(h,l);T=e,k=s}T=T.replace(/^\//,"");const q=s(),y=q.endsWith("/")?q:q+"/",v=new URL(T,y);let j;if(Array.isArray(k))j=JSON.stringify(k);else if(Object.keys(k).length)if("get"===b)u(k,v.searchParams);else if("application/x-www-form-urlencoded"===d?.contentType){const e=new URLSearchParams;u(k,e),j=e.toString()}else j=JSON.stringify(k);else"application/x-www-form-urlencoded"!==d?.contentType&&"post"===b&&(j="{}");const w=Object.assign(U?{"x-zapehr-project-id":U,"x-oystehr-project-id":U}:{},{"content-type":d?.contentType??"application/json"},f?{Authorization:`Bearer ${f}`}:{},d?.ifMatch?{"If-Match":d.ifMatch}:{},{"x-oystehr-request-id":d?.requestId??e()}),x={retries:m.retry?.retries??3,jitter:m.retry?.jitter??20,delay:m.retry?.delay??100,onRetry:m.retry?.onRetry,retryOn:[...m.retry?.retryOn??[],...i]};return x.retryOn.push(...i),async function(e,t){let s;for(const r of Array.from({length:(t.retries??0)+1},((e,t)=>t)))try{return await e(r)}catch(e){let i=!1;if("response"in e){const r=e;i=t.retryOn.includes(r.code),s={message:e.message,code:e.code}}else if(s=e,"code"in e&&"string"==typeof e.code){const t=e;i=n.includes(t.code)}if(!i)break;const h=Math.floor(Math.random()*(t.jitter+1));await new Promise((e=>setTimeout(e,t.delay+h))),t.onRetry&&r!==(t.retries??0)&&t.onRetry(r+1)}throw s}((async()=>{const e=await g(new Request(v,{method:b.toUpperCase(),body:j,headers:w})),t=e.body?await e.text():null;let s;try{s=t&&(e.headers.get("content-type")?.includes("application/json")||e.headers.get("content-type")?.includes("application/fhir+json"))?JSON.parse(t):null}catch(e){s=null}if(!e.ok||e.status>=400){throw{message:s?.output?.message??s?.message??s??t??e.statusText,code:s?.output?.code??s?.code??e.status,response:e}}return s}),x)}}function u(e,t){for(const[s,r]of Object.entries(e))Array.isArray(r)?r.forEach((e=>t.append(s,e))):t.append(s,r)}class c extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}list(e){return this.request("/application","get",this.#e.bind(this))(e)}create(e,t){return this.request("/application","post",this.#e.bind(this))(e,t)}get(e,t){return this.request("/application/{id}","get",this.#e.bind(this))(e,t)}update(e,t){return this.request("/application/{id}","patch",this.#e.bind(this))(e,t)}delete(e,t){return this.request("/application/{id}","delete",this.#e.bind(this))(e,t)}rotateSecret(e,t){return this.request("/application/{id}/rotate-secret","post",this.#e.bind(this))(e,t)}revokeRefreshToken(e,t){return this.request("/application/{id}/revoke-refresh-token","post",this.#e.bind(this))(e,t)}revokeAccessToken(e,t){return this.request("/application/{id}/revoke-access-token","post",this.#e.bind(this))(e,t)}}class p extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}issue(e,t){return this.request("/payment/charge/issue","post",this.#e.bind(this))(e,t)}status(e,t){return this.request("/payment/charge/status","post",this.#e.bind(this))(e,t)}}const l="https://extensions.fhir.zapehr.com/encounter-virtual-service-pre-release",d="addressString";function b(e){if(function(e){return Object.hasOwn(e,"virtualService")}(e)){const t=e.virtualService?.find((e=>"https://fhir.zapehr.com/virtual-service-type"===e.channelType?.system));return t?.addressString}if(!e.extension)return;const t=e.extension.find((e=>e.url===l));if(!t?.extension)return;const s=t.extension?.find((e=>e.url===d))?.valueString;return s}class m extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}ENCOUNTER_VS_EXTENSION_URL=l;ENCOUNTER_VS_EXTENSION_RELATIVE_URL=d;getConversationIdFromEncounter=b;create(e,t){return this.request("/messaging/conversation","post",this.#e.bind(this))(e,t)}getToken(e){return this.request("/messaging/conversation/token","get",this.#e.bind(this))(e)}addParticipant(e,t){return this.request("/messaging/conversation/{conversationId}/participant","post",this.#e.bind(this))(e,t)}removeParticipant(e,t){return this.request("/messaging/conversation/{conversationId}/participant","delete",this.#e.bind(this))(e,t)}message(e,t){return this.request("/messaging/conversation/{conversationId}/message","post",this.#e.bind(this))(e,t)}}class g extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}get(e,t){return this.request("/developer/{id}","get",this.#e.bind(this))(e,t)}update(e,t){return this.request("/developer/{id}","patch",this.#e.bind(this))(e,t)}delete(e,t){return this.request("/developer/{id}","delete",this.#e.bind(this))(e,t)}invite(e,t){return this.request("/developer/invite","post",this.#e.bind(this))(e,t)}list(e){return this.request("/developer","get",this.#e.bind(this))(e)}listV2(e,t){return this.request("/developer/v2/list","get",this.#e.bind(this))(e,t)}}class f extends h{constructor(e){super(e)}#e(){return this.config.services?.erxApiUrl??"https://erx-api.zapehr.com/v3"}searchAllergens(e,t){return this.request("/allergen","get",this.#e.bind(this))(e,t)}searchMedications(e,t){return this.request("/medication","get",this.#e.bind(this))(e,t)}getConfiguration(e){return this.request("/config","get",this.#e.bind(this))(e)}checkAllergyInteractions(e,t){return this.request("/patient/{patientId}/interactions/allergy","get",this.#e.bind(this))(e,t)}checkMedicationInteractions(e,t){return this.request("/patient/{patientId}/interactions/medication","get",this.#e.bind(this))(e,t)}checkPrecheckInteractions(e,t){return this.request("/patient/{patientId}/interactions/precheck/{drugId}","get",this.#e.bind(this))(e,t)}cancelPrescription(e,t){return this.request("/patient/{patientId}/prescriptions/{medicationRequestId}","delete",this.#e.bind(this))(e,t)}syncPatient(e,t){return this.request("/patient/{patientId}/sync","post",this.#e.bind(this))(e,t)}connectPractitioner(e,t){return this.request("/practitioner/connect","get",this.#e.bind(this))(e,t)}checkPractitionerEnrollment(e,t){return this.request("/practitioner/{practitionerId}","get",this.#e.bind(this))(e,t)}enrollPractitioner(e,t){return this.request("/practitioner/{practitionerId}","post",this.#e.bind(this))(e,t)}unenrollPractitioner(e,t){return this.request("/practitioner/{practitionerId}","delete",this.#e.bind(this))(e,t)}}class U extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}syncPatient(e,t){return this.request("/erx/sync-patient/{patientId}","post",this.#e.bind(this))(e,t)}allergySearch(e,t){return this.request("/erx/allergy/search","get",this.#e.bind(this))(e,t)}cancelOrder(e,t){return this.request("/erx/cancel-order","post",this.#e.bind(this))(e,t)}cancelPrescription(e,t){return this.request("/erx/cancel-prescription","post",this.#e.bind(this))(e,t)}medicationSearch(e,t){return this.request("/erx/medication/search","get",this.#e.bind(this))(e,t)}}class T extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}medicationSearch(e,t){return this.request("/erx/v2/medication/search","get",this.#e.bind(this))(e,t)}}class k extends h{constructor(e){super(e)}#e(){return this.config.services?.faxApiUrl??"https://fax-api.zapehr.com/v1"}offboard(e){return this.request("/offboard","post",this.#e.bind(this))(e)}onboard(e){return this.request("/onboard","post",this.#e.bind(this))(e)}send(e,t){return this.request("/send","post",this.#e.bind(this))(e,t)}}async function q(e,t){const{resourceType:s,params:r}=e;let i;r&&(i=Object.entries(r).reduce(((e,[t,s])=>(e[s.name]||(e[s.name]=[]),e[s.name].push(s.value),e)),{}));const n=await this.fhirRequest(`/${s}/_search`,"POST")(i,{...t,contentType:"application/x-www-form-urlencoded"});return{...n,entry:n.entry,unbundle:function(){return this.entry?.map((e=>e.resource)).filter((e=>void 0!==e))??[]}}}async function y(e,t){const{resourceType:s}=e;return this.fhirRequest(`/${s}`,"POST")(e,t)}async function v({resourceType:e,id:t},s){return this.fhirRequest(`/${e}/${t}`,"GET")({},s)}async function j(e,t){const{id:s,resourceType:r}=e;return this.fhirRequest(`/${r}/${s}`,"PUT")(e,{...t,ifMatch:t?.optimisticLockingVersionId?`W/"${t.optimisticLockingVersionId}"`:void 0})}async function w({resourceType:e,id:t,operations:s},r){return this.fhirRequest(`/${e}/${t}`,"PATCH")(s,{...r,contentType:"application/json-patch+json",ifMatch:r?.optimisticLockingVersionId?`W/"${r.optimisticLockingVersionId}"`:void 0})}async function x({resourceType:e,id:t},s){return this.fhirRequest(`/${e}/${t}`,"DELETE")({},s)}async function z({resourceType:e,id:t,versionId:s},r){return this.fhirRequest(`/${e}/${t}/_history${s?`/${s}`:""}`,"GET")({},r)}function A(e){const{method:t,url:s}=e,r={request:{method:t,url:s}};if(s.split("?").length>1){const[e,t]=s.split("?"),i=t.split("&").map((e=>{const[t,s]=e.split("=");return{name:t,value:s}})).reduce(((e,{name:t,value:s})=>t?(e[t]||(e[t]=[]),e[t].push(s),e):e),{}),n=new URLSearchParams;u(i,n),r.request.url=`${e}?${n.toString()}`}if(["GET","DELETE","HEAD"].includes(t))return r;if("PUT"===t){const{resource:t}=e;return{request:{...r.request,ifMatch:e.ifMatch},resource:t}}if("PATCH"===t)return"resource"in e?{request:{...r.request,ifMatch:e.ifMatch},resource:e.resource}:{...r,resource:{resourceType:"Binary",contentType:"application/json-patch+json",data:Buffer.from(JSON.stringify(e.operations),"utf8").toString("base64")}};if("POST"===t){const{resource:t,fullUrl:s}=e;return{...r,resource:t,fullUrl:s}}throw new Error("Unrecognized method")}function E(e){return async function(t,s){return this.fhirRequest("/","POST")({resourceType:"Bundle",type:e,entry:t.requests.map(A)},s)}}const S=E("batch"),I=E("transaction");function P(e,t){const s=[];if(e.line&&s.push(...e.line),e.city||e.state||e.postalCode){const t=[];e.city&&t.push(e.city),e.state&&t.push(e.state),e.postalCode&&t.push(e.postalCode),s.push(t.join(", "))}return e.use&&(t?.all||t?.use)&&s.push("["+e.use+"]"),s.join(t?.lineSeparator||", ").trim()}function O(e,t){const s=[];return e.prefix&&!1!==t?.prefix&&s.push(...e.prefix),e.given&&s.push(...e.given),e.family&&s.push(e.family),e.suffix&&!1!==t?.suffix&&s.push(...e.suffix),e.use&&(t?.all||t?.use)&&s.push("["+e.use+"]"),s.join(" ").trim()}class R extends h{constructor(e){super(e)}#e(){return this.config.services?.fhirApiUrl??"https://fhir-api.zapehr.com"}search=q;create=y;get=v;update=j;patch=w;delete=x;history=z;batch=S;transaction=I;formatAddress=P;formatHumanName=O}class N extends h{constructor(e){super(e)}#e(){return this.config.services?.labApiUrl??"https://labs-api.zapehr.com/v1"}routeList(e){return this.request("/route","get",this.#e.bind(this))(e)}routeCreate(e,t){return this.request("/route","post",this.#e.bind(this))(e,t)}routeDelete(e,t){return this.request("/route/{routeGuid}","delete",this.#e.bind(this))(e,t)}orderableItemList(e,t){return this.request("/orderableItem","get",this.#e.bind(this))(e,t)}orderableItemQuestionnaireGet(e,t){return this.request("/canonical-questionnaire/lab/{labGuid}/compendium/{compendiumVersion}/item/{itemCode}/questionnaire","get",this.#e.bind(this))(e,t)}orderSubmit(e,t){return this.request("/submit","post",this.#e.bind(this))(e,t)}}class M extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}list(e){return this.request("/m2m","get",this.#e.bind(this))(e)}create(e,t){return this.request("/m2m","post",this.#e.bind(this))(e,t)}me(e){return this.request("/m2m/me","get",this.#e.bind(this))(e)}get(e,t){return this.request("/m2m/{id}","get",this.#e.bind(this))(e,t)}update(e,t){return this.request("/m2m/{id}","patch",this.#e.bind(this))(e,t)}delete(e,t){return this.request("/m2m/{id}","delete",this.#e.bind(this))(e,t)}rotateSecret(e,t){return this.request("/m2m/{id}/rotate-secret","post",this.#e.bind(this))(e,t)}listV2(e,t){return this.request("/m2m/v2/list","get",this.#e.bind(this))(e,t)}}class $ extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}getMessagingConfig(e){return this.request("/messaging/config","get",this.#e.bind(this))(e)}}class C extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}setUp(e,t){return this.request("/payment/payment-method/setup","post",this.#e.bind(this))(e,t)}setDefault(e,t){return this.request("/payment/payment-method/set-default","post",this.#e.bind(this))(e,t)}delete(e,t){return this.request("/payment/payment-method","delete",this.#e.bind(this))(e,t)}list(e,t){return this.request("/payment/payment-method/list","post",this.#e.bind(this))(e,t)}}class _ extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}get(e){return this.request("/project","get",this.#e.bind(this))(e)}update(e,t){return this.request("/project","patch",this.#e.bind(this))(e,t)}}class L extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}eligibilityCheck(e,t){return this.request("/rcm/eligibility-check","post",this.#e.bind(this))(e,t)}validateProfessionalClaim(e,t){return this.request("/rcm/professional-claim/validate","post",this.#e.bind(this))(e,t)}submitProfessionalClaim(e,t){return this.request("/rcm/professional-claim/submit","post",this.#e.bind(this))(e,t)}}class V extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}list(e){return this.request("/iam/role","get",this.#e.bind(this))(e)}create(e,t){return this.request("/iam/role","post",this.#e.bind(this))(e,t)}get(e,t){return this.request("/iam/role/{roleId}","get",this.#e.bind(this))(e,t)}update(e,t){return this.request("/iam/role/{roleId}","patch",this.#e.bind(this))(e,t)}delete(e,t){return this.request("/iam/role/{roleId}","delete",this.#e.bind(this))(e,t)}}class D extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}list(e){return this.request("/secret","get",this.#e.bind(this))(e)}set(e,t){return this.request("/secret","post",this.#e.bind(this))(e,t)}get(e,t){return this.request("/secret/{name}","get",this.#e.bind(this))(e,t)}delete(e,t){return this.request("/secret/{name}","delete",this.#e.bind(this))(e,t)}}class F extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}createMeeting(e,t){return this.request("/telemed/v2/meeting","post",this.#e.bind(this))(e,t)}joinMeeting(e,t){return this.request("/telemed/v2/meeting/{encounterId}/join","get",this.#e.bind(this))(e,t)}}class H extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}send(e,t){return this.request("/messaging/transactional-sms/send","post",this.#e.bind(this))(e,t)}}class B extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}me(e){return this.request("/user/me","get",this.#e.bind(this))(e)}get(e,t){return this.request("/user/{id}","get",this.#e.bind(this))(e,t)}update(e,t){return this.request("/user/{id}","patch",this.#e.bind(this))(e,t)}delete(e,t){return this.request("/user/{id}","delete",this.#e.bind(this))(e,t)}resetMfa(e,t){return this.request("/user/{id}/reset-mfa","post",this.#e.bind(this))(e,t)}invite(e,t){return this.request("/user/invite","post",this.#e.bind(this))(e,t)}list(e){return this.request("/user","get",this.#e.bind(this))(e)}listV2(e,t){return this.request("/user/v2/list","get",this.#e.bind(this))(e,t)}}class G extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}get(e){return this.request("/version","get",this.#e.bind(this))(e)}}function J(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}async function W({bucketName:e,"objectPath+":t,file:s}){const r=await this.request("/z3/{bucketName}/{objectPath+}","post",J.bind(this))({action:"upload",bucketName:e,"objectPath+":t});await fetch(r.signedUrl,{method:"PUT",body:s})}async function X({bucketName:e,"objectPath+":t}){const s=await this.request("/z3/{bucketName}/{objectPath+}","post",J.bind(this))({action:"download",bucketName:e,"objectPath+":t}),r=await fetch(s.signedUrl,{method:"GET"});if(!r.ok)throw new Error("Failed to download file");return r.arrayBuffer()}async function Z(e){let s,r;const i=new URL(e.url);if("z3:"===i.protocol){const e=i.pathname.split("/").slice(1);s=i.hostname,r=e.join("/")}else{if(!i.href.startsWith(this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"))throw new t({message:"Invalid Z3 URL",code:400});{const e=i.pathname.split("/").slice(3);s=e[0],r=e.slice(1).join("/")}}const n={action:"upload",bucketName:s,"objectPath+":r};return this.request("/z3/{bucketName}/{objectPath+}","post",J.bind(this))(n)}class K extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}uploadFile=W;downloadFile=X;getPresignedUrlForZ3Url=Z;listBuckets(e){return this.request("/z3","get",this.#e.bind(this))(e)}createBucket(e,t){return this.request("/z3/{bucketName}","put",this.#e.bind(this))(e,t)}deleteBucket(e,t){return this.request("/z3/{bucketName}","delete",this.#e.bind(this))(e,t)}listObjects(e,t){return this.request("/z3/{bucketName}/{objectPath+}","get",this.#e.bind(this))(e,t)}getPresignedUrl(e,t){return this.request("/z3/{bucketName}/{objectPath+}","post",this.#e.bind(this))(e,t)}deleteObject(e,t){return this.request("/z3/{bucketName}/{objectPath+}","delete",this.#e.bind(this))(e,t)}}function Q(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}async function Y({id:e,file:t,filename:s}){const r=await this.request("/zambda/{id}/s3-upload","post",Q.bind(this))({id:e,filename:s});await fetch(r.signedUrl,{method:"PUT",body:t})}class ee extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}uploadFile=Y;list(e){return this.request("/zambda","get",this.#e.bind(this))(e)}create(e,t){return this.request("/zambda","post",this.#e.bind(this))(e,t)}get(e,t){return this.request("/zambda/{id}","get",this.#e.bind(this))(e,t)}update(e,t){return this.request("/zambda/{id}","patch",this.#e.bind(this))(e,t)}delete(e,t){return this.request("/zambda/{id}","delete",this.#e.bind(this))(e,t)}execute(e,t){return this.request("/zambda/{id}/execute","post",this.#e.bind(this))(e,t)}executePublic(e,t){return this.request("/zambda/{id}/execute-public","post",this.#e.bind(this))(e,t)}s3Upload(e,t){return this.request("/zambda/{id}/s3-upload","post",this.#e.bind(this))(e,t)}}class te extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}list(e,t){return this.request("/zambda/{id}/logStream","post",this.#e.bind(this))(e,t)}search(e,t){return this.request("/zambda/{id}/logStream/search","post",this.#e.bind(this))(e,t)}get(e,t){return this.request("/zambda/{id}/logStream/{logStreamName}","post",this.#e.bind(this))(e,t)}}let se=class{config;application;developer;m2m;messaging;conversation;transactionalSMS;paymentMethod;charge;project;rcm;erxV1;erxV2;role;secret;telemed;user;version;z3;zambda;zambdaLogStream;fax;lab;erx;fhir;constructor(e){this.config=e,this.config.services??={},this.config.services.projectApiUrl??=e.projectApiUrl,this.config.services.fhirApiUrl??=e.fhirApiUrl,this.application=new c(e),this.developer=new g(e),this.m2m=new M(e),this.messaging=new $(e),this.conversation=new m(e),this.transactionalSMS=new H(e),this.paymentMethod=new C(e),this.charge=new p(e),this.project=new _(e),this.rcm=new L(e),this.erxV1=new U(e),this.erxV2=new T(e),this.role=new V(e),this.secret=new D(e),this.telemed=new F(e),this.user=new B(e),this.version=new G(e),this.z3=new K(e),this.zambda=new ee(e),this.zambdaLogStream=new te(e),this.fax=new k(e),this.lab=new N(e),this.erx=new f(e),this.fhir=new R(e)}};class re extends se{static OystehrFHIRError=r;static OystehrSdkError=t}export{re as default};
|
|
1
|
+
import{v4 as e}from"uuid";class t extends Error{code;constructor({message:e,code:s,cause:r}){super(e,{cause:r}),Object.setPrototypeOf(this,t.prototype),this.code=s,this.name="OystehrSdkError"}toString(){return`${this.name}: ${this.message} (code: ${this.code})`}toJSON(){return{name:this.name,message:this.message,code:this.code,cause:this.cause}}}function s(e){const t=[];for(const s of e.issue??[])s.details&&s.details.text&&t.push(s.details.text);return t.length||t.push("Unknown FHIR error"),t.join(",")}class r extends t{cause;constructor({error:e,code:t}){super({message:s(e),code:t}),Object.setPrototypeOf(this,r.prototype),this.cause=e,this.name="OystehrFHIRError"}toJSON(){return{name:this.name,message:this.message,code:this.code,cause:this.cause}}}const i=[408,429,500,502,503,504],n=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT","UND_ERR_CONNECT_TIMEOUT","UND_ERR_HEADERS_TIMEOUT","UND_ERR_HEADERS_TIMEOUT","UND_ERR_SOCKET"];class h{config;constructor(e){this.config=e}request(e,s,r){return async(i,n)=>{const h=()=>this.config;try{return await o(r,h,e,s)(i,n)}catch(e){const s=e;throw new t({message:s.message,code:s.code,cause:s.cause})}}}fhirRequest(e,s){return async(i,n)=>{try{const t=()=>this.config.services?.fhirApiUrl??"https://fhir-api.zapehr.com",r=()=>this.config;return await o(t,r,e,s)(i,n)}catch(e){const s=e;if("string"==typeof s.message)throw new t({message:s.message,code:s.code,cause:s.cause});throw new r({error:s.message,code:s.code})}}}}function a(e){return"accessToken"in e}function o(s,r,h,o){return async(c,p)=>{const l=c&&!p&&!Array.isArray(c)&&a(c)?{}:c??{},d=c&&!p&&!Array.isArray(c)&&a(c)?c:p,b=o.toLowerCase(),m=r(),g=m.fetch??fetch,f=d?.accessToken??m.accessToken,U=d?.projectId??r().projectId;let T=h,k=l;if(!Array.isArray(l)){const[e,s]=function(e,s){const r={...s},i=e.replace(/\{([^}]+)\}/g,((e,i)=>{if(delete r[i],i.match(/^.*\+$/))return s[i]+"";if(!s[i]||""===s[i])throw new t({message:`Required path parameter is an empty string: ${i}`,code:400});return s[i]?encodeURIComponent(s[i]+""):""})),n=Object.keys(r),h=n.length?n.reduce(((e,t)=>({...e,[t]:r[t]})),{}):{};return[i,h]}(h,l);T=e,k=s}T=T.replace(/^\//,"");const q=s(),y=q.endsWith("/")?q:q+"/",v=new URL(T,y);let j;if(Array.isArray(k))j=JSON.stringify(k);else if(Object.keys(k).length)if("get"===b)u(k,v.searchParams);else if("application/x-www-form-urlencoded"===d?.contentType){const e=new URLSearchParams;u(k,e),j=e.toString()}else j=JSON.stringify(k);else"application/x-www-form-urlencoded"!==d?.contentType&&"post"===b&&(j="{}");const w=Object.assign(U?{"x-zapehr-project-id":U,"x-oystehr-project-id":U}:{},{"content-type":d?.contentType??"application/json"},f?{Authorization:`Bearer ${f}`}:{},d?.ifMatch?{"If-Match":d.ifMatch}:{},{"x-oystehr-request-id":d?.requestId??e()}),x={retries:m.retry?.retries??3,jitter:m.retry?.jitter??20,delay:m.retry?.delay??100,onRetry:m.retry?.onRetry,retryOn:[...m.retry?.retryOn??[],...i]};return x.retryOn.push(...i),async function(e,t){let s;for(const r of Array.from({length:(t.retries??0)+1},((e,t)=>t)))try{return await e(r)}catch(e){let i=!1;if("response"in e){const r=e;i=t.retryOn.includes(r.code),s={message:e.message,code:e.code}}else if(s=e,"code"in e&&"string"==typeof e.code){const t=e;i=n.includes(t.code)}if(!i)break;const h=Math.floor(Math.random()*(t.jitter+1));await new Promise((e=>setTimeout(e,t.delay+h))),t.onRetry&&r!==(t.retries??0)&&t.onRetry(r+1)}throw s}((async()=>{const e=await g(new Request(v,{method:b.toUpperCase(),body:j,headers:w})),t=e.body?await e.text():null;let s;try{s=t&&(e.headers.get("content-type")?.includes("application/json")||e.headers.get("content-type")?.includes("application/fhir+json"))?JSON.parse(t):null}catch(e){s=null}if(!e.ok||e.status>=400){throw{message:s?.output?.message??s?.message??s??t??e.statusText,code:s?.output?.code??s?.code??e.status,response:e}}return s}),x)}}function u(e,t){for(const[s,r]of Object.entries(e))Array.isArray(r)?r.forEach((e=>t.append(s,e))):t.append(s,r)}class c extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}list(e){return this.request("/application","get",this.#e.bind(this))(e)}create(e,t){return this.request("/application","post",this.#e.bind(this))(e,t)}get(e,t){return this.request("/application/{id}","get",this.#e.bind(this))(e,t)}update(e,t){return this.request("/application/{id}","patch",this.#e.bind(this))(e,t)}delete(e,t){return this.request("/application/{id}","delete",this.#e.bind(this))(e,t)}rotateSecret(e,t){return this.request("/application/{id}/rotate-secret","post",this.#e.bind(this))(e,t)}revokeRefreshToken(e,t){return this.request("/application/{id}/revoke-refresh-token","post",this.#e.bind(this))(e,t)}revokeAccessToken(e,t){return this.request("/application/{id}/revoke-access-token","post",this.#e.bind(this))(e,t)}}class p extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}issue(e,t){return this.request("/payment/charge/issue","post",this.#e.bind(this))(e,t)}status(e,t){return this.request("/payment/charge/status","post",this.#e.bind(this))(e,t)}}const l="https://extensions.fhir.zapehr.com/encounter-virtual-service-pre-release",d="addressString";function b(e){if(function(e){return Object.hasOwn(e,"virtualService")}(e)){const t=e.virtualService?.find((e=>"https://fhir.zapehr.com/virtual-service-type"===e.channelType?.system));return t?.addressString}if(!e.extension)return;const t=e.extension.find((e=>e.url===l));if(!t?.extension)return;const s=t.extension?.find((e=>e.url===d))?.valueString;return s}class m extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}ENCOUNTER_VS_EXTENSION_URL=l;ENCOUNTER_VS_EXTENSION_RELATIVE_URL=d;getConversationIdFromEncounter=b;create(e,t){return this.request("/messaging/conversation","post",this.#e.bind(this))(e,t)}getToken(e){return this.request("/messaging/conversation/token","get",this.#e.bind(this))(e)}addParticipant(e,t){return this.request("/messaging/conversation/{conversationId}/participant","post",this.#e.bind(this))(e,t)}removeParticipant(e,t){return this.request("/messaging/conversation/{conversationId}/participant","delete",this.#e.bind(this))(e,t)}message(e,t){return this.request("/messaging/conversation/{conversationId}/message","post",this.#e.bind(this))(e,t)}}class g extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}get(e,t){return this.request("/developer/{id}","get",this.#e.bind(this))(e,t)}update(e,t){return this.request("/developer/{id}","patch",this.#e.bind(this))(e,t)}delete(e,t){return this.request("/developer/{id}","delete",this.#e.bind(this))(e,t)}invite(e,t){return this.request("/developer/invite","post",this.#e.bind(this))(e,t)}list(e){return this.request("/developer","get",this.#e.bind(this))(e)}listV2(e,t){return this.request("/developer/v2/list","get",this.#e.bind(this))(e,t)}}class f extends h{constructor(e){super(e)}#e(){return this.config.services?.erxApiUrl??"https://erx-api.zapehr.com/v3"}searchAllergens(e,t){return this.request("/allergen","get",this.#e.bind(this))(e,t)}searchMedications(e,t){return this.request("/medication","get",this.#e.bind(this))(e,t)}getConfiguration(e){return this.request("/config","get",this.#e.bind(this))(e)}checkAllergyInteractions(e,t){return this.request("/patient/{patientId}/interactions/allergy","get",this.#e.bind(this))(e,t)}checkMedicationInteractions(e,t){return this.request("/patient/{patientId}/interactions/medication","get",this.#e.bind(this))(e,t)}checkPrecheckInteractions(e,t){return this.request("/patient/{patientId}/interactions/precheck/{drugId}","get",this.#e.bind(this))(e,t)}cancelPrescription(e,t){return this.request("/patient/{patientId}/prescriptions/{medicationRequestId}","delete",this.#e.bind(this))(e,t)}syncPatient(e,t){return this.request("/patient/{patientId}/sync","post",this.#e.bind(this))(e,t)}connectPractitioner(e,t){return this.request("/practitioner/connect","get",this.#e.bind(this))(e,t)}checkPractitionerEnrollment(e,t){return this.request("/practitioner/{practitionerId}","get",this.#e.bind(this))(e,t)}enrollPractitioner(e,t){return this.request("/practitioner/{practitionerId}","post",this.#e.bind(this))(e,t)}unenrollPractitioner(e,t){return this.request("/practitioner/{practitionerId}","delete",this.#e.bind(this))(e,t)}}class U extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}syncPatient(e,t){return this.request("/erx/sync-patient/{patientId}","post",this.#e.bind(this))(e,t)}allergySearch(e,t){return this.request("/erx/allergy/search","get",this.#e.bind(this))(e,t)}cancelOrder(e,t){return this.request("/erx/cancel-order","post",this.#e.bind(this))(e,t)}cancelPrescription(e,t){return this.request("/erx/cancel-prescription","post",this.#e.bind(this))(e,t)}medicationSearch(e,t){return this.request("/erx/medication/search","get",this.#e.bind(this))(e,t)}}class T extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}medicationSearch(e,t){return this.request("/erx/v2/medication/search","get",this.#e.bind(this))(e,t)}}class k extends h{constructor(e){super(e)}#e(){return this.config.services?.faxApiUrl??"https://fax-api.zapehr.com/v1"}offboard(e){return this.request("/offboard","post",this.#e.bind(this))(e)}onboard(e){return this.request("/onboard","post",this.#e.bind(this))(e)}getConfiguration(e){return this.request("/config","get",this.#e.bind(this))(e)}send(e,t){return this.request("/send","post",this.#e.bind(this))(e,t)}}async function q(e,t){const{resourceType:s,params:r}=e;let i;r&&(i=Object.entries(r).reduce(((e,[t,s])=>(e[s.name]||(e[s.name]=[]),e[s.name].push(s.value),e)),{}));const n=await this.fhirRequest(`/${s}/_search`,"POST")(i,{...t,contentType:"application/x-www-form-urlencoded"});return{...n,entry:n.entry,unbundle:function(){return this.entry?.map((e=>e.resource)).filter((e=>void 0!==e))??[]}}}async function y(e,t){const{resourceType:s}=e;return this.fhirRequest(`/${s}`,"POST")(e,t)}async function v({resourceType:e,id:t},s){return this.fhirRequest(`/${e}/${t}`,"GET")({},s)}async function j(e,t){const{id:s,resourceType:r}=e;return this.fhirRequest(`/${r}/${s}`,"PUT")(e,{...t,ifMatch:t?.optimisticLockingVersionId?`W/"${t.optimisticLockingVersionId}"`:void 0})}async function w({resourceType:e,id:t,operations:s},r){return this.fhirRequest(`/${e}/${t}`,"PATCH")(s,{...r,contentType:"application/json-patch+json",ifMatch:r?.optimisticLockingVersionId?`W/"${r.optimisticLockingVersionId}"`:void 0})}async function x({resourceType:e,id:t},s){return this.fhirRequest(`/${e}/${t}`,"DELETE")({},s)}async function z({resourceType:e,id:t,versionId:s},r){return this.fhirRequest(`/${e}/${t}/_history${s?`/${s}`:""}`,"GET")({},r)}function A(e){const{method:t,url:s}=e,r={request:{method:t,url:s}};if(s.split("?").length>1){const[e,t]=s.split("?"),i=t.split("&").map((e=>{const[t,s]=e.split("=");return{name:t,value:s}})).reduce(((e,{name:t,value:s})=>t?(e[t]||(e[t]=[]),e[t].push(s),e):e),{}),n=new URLSearchParams;u(i,n),r.request.url=`${e}?${n.toString()}`}if(["GET","DELETE","HEAD"].includes(t))return r;if("PUT"===t){const{resource:t}=e;return{request:{...r.request,ifMatch:e.ifMatch},resource:t}}if("PATCH"===t)return"resource"in e?{request:{...r.request,ifMatch:e.ifMatch},resource:e.resource}:{...r,resource:{resourceType:"Binary",contentType:"application/json-patch+json",data:Buffer.from(JSON.stringify(e.operations),"utf8").toString("base64")}};if("POST"===t){const{resource:t,fullUrl:s}=e;return{...r,resource:t,fullUrl:s}}throw new Error("Unrecognized method")}function E(e){return async function(t,s){return this.fhirRequest("/","POST")({resourceType:"Bundle",type:e,entry:t.requests.map(A)},s)}}const S=E("batch"),I=E("transaction");function P(e,t){const s=[];if(e.line&&s.push(...e.line),e.city||e.state||e.postalCode){const t=[];e.city&&t.push(e.city),e.state&&t.push(e.state),e.postalCode&&t.push(e.postalCode),s.push(t.join(", "))}return e.use&&(t?.all||t?.use)&&s.push("["+e.use+"]"),s.join(t?.lineSeparator||", ").trim()}function O(e,t){const s=[];return e.prefix&&!1!==t?.prefix&&s.push(...e.prefix),e.given&&s.push(...e.given),e.family&&s.push(e.family),e.suffix&&!1!==t?.suffix&&s.push(...e.suffix),e.use&&(t?.all||t?.use)&&s.push("["+e.use+"]"),s.join(" ").trim()}class R extends h{constructor(e){super(e)}#e(){return this.config.services?.fhirApiUrl??"https://fhir-api.zapehr.com"}search=q;create=y;get=v;update=j;patch=w;delete=x;history=z;batch=S;transaction=I;formatAddress=P;formatHumanName=O}class N extends h{constructor(e){super(e)}#e(){return this.config.services?.labApiUrl??"https://labs-api.zapehr.com/v1"}routeList(e){return this.request("/route","get",this.#e.bind(this))(e)}routeCreate(e,t){return this.request("/route","post",this.#e.bind(this))(e,t)}routeDelete(e,t){return this.request("/route/{routeGuid}","delete",this.#e.bind(this))(e,t)}orderableItemList(e,t){return this.request("/orderableItem","get",this.#e.bind(this))(e,t)}orderableItemQuestionnaireGet(e,t){return this.request("/canonical-questionnaire/lab/{labGuid}/compendium/{compendiumVersion}/item/{itemCode}/questionnaire","get",this.#e.bind(this))(e,t)}orderSubmit(e,t){return this.request("/submit","post",this.#e.bind(this))(e,t)}}class M extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}list(e){return this.request("/m2m","get",this.#e.bind(this))(e)}create(e,t){return this.request("/m2m","post",this.#e.bind(this))(e,t)}me(e){return this.request("/m2m/me","get",this.#e.bind(this))(e)}get(e,t){return this.request("/m2m/{id}","get",this.#e.bind(this))(e,t)}update(e,t){return this.request("/m2m/{id}","patch",this.#e.bind(this))(e,t)}delete(e,t){return this.request("/m2m/{id}","delete",this.#e.bind(this))(e,t)}rotateSecret(e,t){return this.request("/m2m/{id}/rotate-secret","post",this.#e.bind(this))(e,t)}listV2(e,t){return this.request("/m2m/v2/list","get",this.#e.bind(this))(e,t)}}class C extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}getMessagingConfig(e){return this.request("/messaging/config","get",this.#e.bind(this))(e)}}class $ extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}setUp(e,t){return this.request("/payment/payment-method/setup","post",this.#e.bind(this))(e,t)}setDefault(e,t){return this.request("/payment/payment-method/set-default","post",this.#e.bind(this))(e,t)}delete(e,t){return this.request("/payment/payment-method","delete",this.#e.bind(this))(e,t)}list(e,t){return this.request("/payment/payment-method/list","post",this.#e.bind(this))(e,t)}}class _ extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}get(e){return this.request("/project","get",this.#e.bind(this))(e)}update(e,t){return this.request("/project","patch",this.#e.bind(this))(e,t)}}class L extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}eligibilityCheck(e,t){return this.request("/rcm/eligibility-check","post",this.#e.bind(this))(e,t)}validateProfessionalClaim(e,t){return this.request("/rcm/professional-claim/validate","post",this.#e.bind(this))(e,t)}submitProfessionalClaim(e,t){return this.request("/rcm/professional-claim/submit","post",this.#e.bind(this))(e,t)}}class V extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}list(e){return this.request("/iam/role","get",this.#e.bind(this))(e)}create(e,t){return this.request("/iam/role","post",this.#e.bind(this))(e,t)}get(e,t){return this.request("/iam/role/{roleId}","get",this.#e.bind(this))(e,t)}update(e,t){return this.request("/iam/role/{roleId}","patch",this.#e.bind(this))(e,t)}delete(e,t){return this.request("/iam/role/{roleId}","delete",this.#e.bind(this))(e,t)}}class D extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}list(e){return this.request("/secret","get",this.#e.bind(this))(e)}set(e,t){return this.request("/secret","post",this.#e.bind(this))(e,t)}get(e,t){return this.request("/secret/{name}","get",this.#e.bind(this))(e,t)}delete(e,t){return this.request("/secret/{name}","delete",this.#e.bind(this))(e,t)}}class F extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}createMeeting(e,t){return this.request("/telemed/v2/meeting","post",this.#e.bind(this))(e,t)}joinMeeting(e,t){return this.request("/telemed/v2/meeting/{encounterId}/join","get",this.#e.bind(this))(e,t)}}class H extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}send(e,t){return this.request("/messaging/transactional-sms/send","post",this.#e.bind(this))(e,t)}}class B extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}me(e){return this.request("/user/me","get",this.#e.bind(this))(e)}get(e,t){return this.request("/user/{id}","get",this.#e.bind(this))(e,t)}update(e,t){return this.request("/user/{id}","patch",this.#e.bind(this))(e,t)}delete(e,t){return this.request("/user/{id}","delete",this.#e.bind(this))(e,t)}resetMfa(e,t){return this.request("/user/{id}/reset-mfa","post",this.#e.bind(this))(e,t)}invite(e,t){return this.request("/user/invite","post",this.#e.bind(this))(e,t)}list(e){return this.request("/user","get",this.#e.bind(this))(e)}listV2(e,t){return this.request("/user/v2/list","get",this.#e.bind(this))(e,t)}}class G extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}get(e){return this.request("/version","get",this.#e.bind(this))(e)}}function J(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}async function W({bucketName:e,"objectPath+":t,file:s}){const r=await this.request("/z3/{bucketName}/{objectPath+}","post",J.bind(this))({action:"upload",bucketName:e,"objectPath+":t});await fetch(r.signedUrl,{method:"PUT",body:s})}async function X({bucketName:e,"objectPath+":t}){const s=await this.request("/z3/{bucketName}/{objectPath+}","post",J.bind(this))({action:"download",bucketName:e,"objectPath+":t}),r=await fetch(s.signedUrl,{method:"GET"});if(!r.ok)throw new Error("Failed to download file");return r.arrayBuffer()}async function Z(e){let s,r;const i=new URL(e.url);if("z3:"===i.protocol){const e=i.pathname.split("/").slice(1);s=i.hostname,r=e.join("/")}else{if(!i.href.startsWith(this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"))throw new t({message:"Invalid Z3 URL",code:400});{const e=i.pathname.split("/").slice(3);s=e[0],r=e.slice(1).join("/")}}const n={action:"upload",bucketName:s,"objectPath+":r};return this.request("/z3/{bucketName}/{objectPath+}","post",J.bind(this))(n)}class K extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}uploadFile=W;downloadFile=X;getPresignedUrlForZ3Url=Z;listBuckets(e){return this.request("/z3","get",this.#e.bind(this))(e)}createBucket(e,t){return this.request("/z3/{bucketName}","put",this.#e.bind(this))(e,t)}deleteBucket(e,t){return this.request("/z3/{bucketName}","delete",this.#e.bind(this))(e,t)}listObjects(e,t){return this.request("/z3/{bucketName}/{objectPath+}","get",this.#e.bind(this))(e,t)}getPresignedUrl(e,t){return this.request("/z3/{bucketName}/{objectPath+}","post",this.#e.bind(this))(e,t)}deleteObject(e,t){return this.request("/z3/{bucketName}/{objectPath+}","delete",this.#e.bind(this))(e,t)}}function Q(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}async function Y({id:e,file:t,filename:s}){const r=await this.request("/zambda/{id}/s3-upload","post",Q.bind(this))({id:e,filename:s});await fetch(r.signedUrl,{method:"PUT",body:t})}class ee extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}uploadFile=Y;list(e){return this.request("/zambda","get",this.#e.bind(this))(e)}create(e,t){return this.request("/zambda","post",this.#e.bind(this))(e,t)}get(e,t){return this.request("/zambda/{id}","get",this.#e.bind(this))(e,t)}update(e,t){return this.request("/zambda/{id}","patch",this.#e.bind(this))(e,t)}delete(e,t){return this.request("/zambda/{id}","delete",this.#e.bind(this))(e,t)}execute(e,t){return this.request("/zambda/{id}/execute","post",this.#e.bind(this))(e,t)}executePublic(e,t){return this.request("/zambda/{id}/execute-public","post",this.#e.bind(this))(e,t)}s3Upload(e,t){return this.request("/zambda/{id}/s3-upload","post",this.#e.bind(this))(e,t)}}class te extends h{constructor(e){super(e)}#e(){return this.config.services?.projectApiUrl??"https://project-api.zapehr.com/v1"}list(e,t){return this.request("/zambda/{id}/logStream","post",this.#e.bind(this))(e,t)}search(e,t){return this.request("/zambda/{id}/logStream/search","post",this.#e.bind(this))(e,t)}get(e,t){return this.request("/zambda/{id}/logStream/{logStreamName}","post",this.#e.bind(this))(e,t)}}let se=class{config;application;developer;m2m;messaging;conversation;transactionalSMS;paymentMethod;charge;project;rcm;erxV1;erxV2;role;secret;telemed;user;version;z3;zambda;zambdaLogStream;fax;lab;erx;fhir;constructor(e){this.config=e,this.config.services??={},this.config.services.projectApiUrl??=e.projectApiUrl,this.config.services.fhirApiUrl??=e.fhirApiUrl,this.application=new c(e),this.developer=new g(e),this.m2m=new M(e),this.messaging=new C(e),this.conversation=new m(e),this.transactionalSMS=new H(e),this.paymentMethod=new $(e),this.charge=new p(e),this.project=new _(e),this.rcm=new L(e),this.erxV1=new U(e),this.erxV2=new T(e),this.role=new V(e),this.secret=new D(e),this.telemed=new F(e),this.user=new B(e),this.version=new G(e),this.z3=new K(e),this.zambda=new ee(e),this.zambdaLogStream=new te(e),this.fax=new k(e),this.lab=new N(e),this.erx=new f(e),this.fhir=new R(e)}};class re extends se{static OystehrFHIRError=r;static OystehrSdkError=t}export{re as default};
|
|
2
2
|
//# sourceMappingURL=index.min.js.map
|