@oystehr/sdk 3.0.9 → 3.0.11
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/config.d.ts +1 -0
- package/dist/cjs/index.cjs +75 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.min.cjs +1 -1
- package/dist/cjs/index.min.cjs.map +1 -1
- package/dist/cjs/resources/classes/index.d.ts +2 -0
- package/dist/cjs/resources/classes/lab.d.ts +63 -0
- package/dist/cjs/resources/classes/project.d.ts +1 -1
- package/dist/cjs/resources/types/LabOrderSubmitParams.d.ts +11 -0
- package/dist/cjs/resources/types/LabOrderableItemListParams.d.ts +11 -0
- package/dist/cjs/resources/types/LabOrderableItemListResponse.d.ts +134 -0
- package/dist/cjs/resources/types/LabOrderableItemQuestionnaireGetParams.d.ts +6 -0
- package/dist/cjs/resources/types/LabOrderableItemQuestionnaireGetResponse.d.ts +5 -0
- package/dist/cjs/resources/types/LabRouteCreateParams.d.ts +41 -0
- package/dist/cjs/resources/types/LabRouteDeleteParams.d.ts +4 -0
- package/dist/cjs/resources/types/LabRouteListResponse.d.ts +17 -0
- package/dist/cjs/resources/types/ZambdaExecuteResult.d.ts +3 -1
- package/dist/cjs/resources/types/index.d.ts +8 -0
- package/dist/esm/config.d.ts +1 -0
- package/dist/esm/index.min.js +1 -1
- package/dist/esm/index.min.js.map +1 -1
- package/dist/esm/node_modules/tslib/package.json +1 -0
- package/dist/esm/node_modules/tslib/tslib.es6.js +40 -0
- package/dist/esm/node_modules/tslib/tslib.es6.js.map +1 -0
- package/dist/esm/resources/classes/index.d.ts +2 -0
- package/dist/esm/resources/classes/index.js +2 -0
- package/dist/esm/resources/classes/index.js.map +1 -1
- package/dist/esm/resources/classes/lab.d.ts +63 -0
- package/dist/esm/resources/classes/lab.js +78 -0
- package/dist/esm/resources/classes/lab.js.map +1 -0
- package/dist/esm/resources/classes/project.d.ts +1 -1
- package/dist/esm/resources/classes/project.js +1 -1
- package/dist/esm/resources/classes/project.js.map +1 -1
- package/dist/esm/resources/types/LabOrderSubmitParams.d.ts +11 -0
- package/dist/esm/resources/types/LabOrderableItemListParams.d.ts +11 -0
- package/dist/esm/resources/types/LabOrderableItemListResponse.d.ts +134 -0
- package/dist/esm/resources/types/LabOrderableItemQuestionnaireGetParams.d.ts +6 -0
- package/dist/esm/resources/types/LabOrderableItemQuestionnaireGetResponse.d.ts +5 -0
- package/dist/esm/resources/types/LabRouteCreateParams.d.ts +41 -0
- package/dist/esm/resources/types/LabRouteDeleteParams.d.ts +4 -0
- package/dist/esm/resources/types/LabRouteListResponse.d.ts +17 -0
- package/dist/esm/resources/types/ZambdaExecuteResult.d.ts +3 -1
- package/dist/esm/resources/types/index.d.ts +8 -0
- package/package.json +2 -2
- package/src/config.ts +1 -0
- package/src/resources/classes/index.ts +3 -0
- package/src/resources/classes/lab.ts +113 -0
- package/src/resources/classes/project.ts +1 -1
- package/src/resources/types/LabOrderSubmitParams.ts +13 -0
- package/src/resources/types/LabOrderableItemListParams.ts +13 -0
- package/src/resources/types/LabOrderableItemListResponse.ts +136 -0
- package/src/resources/types/LabOrderableItemQuestionnaireGetParams.ts +8 -0
- package/src/resources/types/LabOrderableItemQuestionnaireGetResponse.ts +7 -0
- package/src/resources/types/LabRouteCreateParams.ts +43 -0
- package/src/resources/types/LabRouteDeleteParams.ts +6 -0
- package/src/resources/types/LabRouteListResponse.ts +19 -0
- package/src/resources/types/ZambdaExecuteResult.ts +8 -1
- package/src/resources/types/index.ts +8 -0
|
@@ -6,6 +6,7 @@ import { Developer } from './developer';
|
|
|
6
6
|
import { Erx } from './erx';
|
|
7
7
|
import { Fax } from './fax';
|
|
8
8
|
import { Fhir } from './fhir';
|
|
9
|
+
import { Lab } from './lab';
|
|
9
10
|
import { M2m } from './m2m';
|
|
10
11
|
import { Messaging } from './messaging';
|
|
11
12
|
import { PaymentMethod } from './paymentMethod';
|
|
@@ -42,6 +43,7 @@ export declare class Oystehr {
|
|
|
42
43
|
readonly zambda: Zambda;
|
|
43
44
|
readonly zambdaLogStream: ZambdaLogStream;
|
|
44
45
|
readonly fax: Fax;
|
|
46
|
+
readonly lab: Lab;
|
|
45
47
|
readonly fhir: Fhir;
|
|
46
48
|
constructor(config: OystehrConfig);
|
|
47
49
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { LabOrderableItemListParams, LabOrderableItemListResponse, LabOrderableItemQuestionnaireGetParams, LabOrderableItemQuestionnaireGetResponse, LabOrderSubmitParams, LabRouteCreateParams, LabRouteDeleteParams, LabRouteListResponse, OystehrClientRequest } from '../..';
|
|
2
|
+
import { SDKResource } from '../../client/client';
|
|
3
|
+
import { OystehrConfig } from '../../config';
|
|
4
|
+
export declare class Lab extends SDKResource {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(config: OystehrConfig);
|
|
7
|
+
/**
|
|
8
|
+
* Gets a list of Routes associated with the project. Returns an empty list if no Routes are found.
|
|
9
|
+
*
|
|
10
|
+
* Access Policy Requirements:
|
|
11
|
+
* Action: `Lab:GetRoutes`
|
|
12
|
+
* Access Policy Resource: `Lab:Route`
|
|
13
|
+
*/
|
|
14
|
+
routeList(request?: OystehrClientRequest): Promise<LabRouteListResponse>;
|
|
15
|
+
/**
|
|
16
|
+
* Create a route. A Route represents that a lab and particular customer have a relationship, and a Route is necessary to submit an order to a lab. See [Route](https://docs.oystehr.com/oystehr/services/lab/onboarding-a-lab/#create-route) for more details.
|
|
17
|
+
*
|
|
18
|
+
* Access Policy Requirements:
|
|
19
|
+
* Action: `Lab:CreateRoute`
|
|
20
|
+
* Access Policy Resource: `Lab:Route`
|
|
21
|
+
*/
|
|
22
|
+
routeCreate(params: LabRouteCreateParams, request?: OystehrClientRequest): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Delete a route. Deleting a Route will permanently remove the `routeGuid`. Orders can no longer be submitted to this lab until a new Route is created. See [Route](https://docs.oystehr.com/oystehr/services/lab/onboarding-a-lab/#delete-route) for more details.
|
|
25
|
+
*
|
|
26
|
+
* Access Policy Requirements:
|
|
27
|
+
* Action: `Lab:DeleteRoute`
|
|
28
|
+
* Access Policy Resource: `Lab:Route`
|
|
29
|
+
*/
|
|
30
|
+
routeDelete(params: LabRouteDeleteParams, request?: OystehrClientRequest): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Returns list of active orderable items for the latest compendium version. Page size is default 25 and max 100 items. See [orderable item Search](https://docs.oystehr.com/oystehr/services/lab/explore-the-compendium/#orderable-item-search) for more details.
|
|
33
|
+
*
|
|
34
|
+
* Access Policy Requirements:
|
|
35
|
+
* Action: `Lab:SearchOrderableItems`
|
|
36
|
+
* Access Policy Resource: `Lab:OrderableItem`
|
|
37
|
+
*/
|
|
38
|
+
orderableItemList(params: LabOrderableItemListParams, request?: OystehrClientRequest): Promise<LabOrderableItemListResponse>;
|
|
39
|
+
/**
|
|
40
|
+
* Returns list of active orderable items for the latest compendium version. Page size is default 25 and max 100 items. See [orderable item Search](https://docs.oystehr.com/oystehr/services/lab/explore-the-compendium/#orderable-item-search) for more details.
|
|
41
|
+
*
|
|
42
|
+
* Access Policy Requirements:
|
|
43
|
+
* Action: `Lab:SearchOrderableItems`
|
|
44
|
+
* Access Policy Resource: `Lab:OrderableItem`
|
|
45
|
+
*/
|
|
46
|
+
orderableItemList(request?: OystehrClientRequest): Promise<LabOrderableItemListResponse>;
|
|
47
|
+
/**
|
|
48
|
+
* Retrieve the AOE (Answer on Entry) Questionnaire for the given orderable item. The orderable item is defined by its labGuid, compendiumVersion, and itemCode. See [AOE](https://docs.oystehr.com/oystehr/services/lab/explore-the-compendium/#AOE) for more details.
|
|
49
|
+
*
|
|
50
|
+
* Access Policy Requirements:
|
|
51
|
+
* Action: `Lab:SearchOrderableItems`
|
|
52
|
+
* Access Policy Resource: `Lab:OrderableItem`
|
|
53
|
+
*/
|
|
54
|
+
orderableItemQuestionnaireGet(params: LabOrderableItemQuestionnaireGetParams, request?: OystehrClientRequest): Promise<LabOrderableItemQuestionnaireGetResponse>;
|
|
55
|
+
/**
|
|
56
|
+
* Submit a lab order. Oystehr's [Submit Lab](https://docs.oystehr.com/oystehr/services/lab/submit-an-order/) feature allows users to submit a well configured ServiceRequest to an external lab. In order to successfully submit an order, a [Route](https://docs.oystehr.com/oystehr/services/lab/onboarding-a-lab/#create-route) to and Organization representing that lab must exist.
|
|
57
|
+
*
|
|
58
|
+
* Access Policy Requirements:
|
|
59
|
+
* Action: `Lab:SubmitOrder`
|
|
60
|
+
* Access Policy Resource: `Lab:Order`
|
|
61
|
+
*/
|
|
62
|
+
orderSubmit(params: LabOrderSubmitParams, request?: OystehrClientRequest): Promise<void>;
|
|
63
|
+
}
|
|
@@ -5,7 +5,7 @@ export declare class Project extends SDKResource {
|
|
|
5
5
|
#private;
|
|
6
6
|
constructor(config: OystehrConfig);
|
|
7
7
|
/**
|
|
8
|
-
* Get the Project settings for a Project. Developers must specify a [project ID](https://docs.oystehr.com/oystehr/core-documentation/authenticating-api-requests/#x-
|
|
8
|
+
* Get the Project settings for a Project. Developers must specify a [project ID](https://docs.oystehr.com/oystehr/core-documentation/authenticating-api-requests/#x-oystehr-project-id-header) in the header. A Project is the logically-isolated instance of Oystehr that segments your data from other Projects. [Projects](https://docs.oystehr.com/oystehr/services/project/) are completely independent from each other, having their own separate [FHIR store](https://docs.oystehr.com/oystehr/services/fhir/basics/), [Applications](https://docs.oystehr.com/oystehr/services/app/applications/), [Users](https://docs.oystehr.com/oystehr/services/app/users/), etc .
|
|
9
9
|
*
|
|
10
10
|
* Access Policy Action: `Project:GetProjectInfo`
|
|
11
11
|
* Access Policy Resource: `Project:Settings`
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface LabOrderSubmitParams {
|
|
2
|
+
primaryId?: string;
|
|
3
|
+
/**
|
|
4
|
+
* Provided by the lab, indicates a financial relationship between the lab and the customer.
|
|
5
|
+
*/
|
|
6
|
+
accountNumber: string;
|
|
7
|
+
/**
|
|
8
|
+
* Valid ServiceRequest FHIR resource representing an order. See [Submit Lab](https://docs.oystehr.com/oystehr/services/lab/submit-an-order/) for more details.
|
|
9
|
+
*/
|
|
10
|
+
serviceRequest: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface LabOrderableItemListParams {
|
|
2
|
+
cursor?: string;
|
|
3
|
+
itemCodes?: string;
|
|
4
|
+
itemCptCodes?: string;
|
|
5
|
+
itemLoincs?: string;
|
|
6
|
+
itemNames?: string;
|
|
7
|
+
labIds?: string;
|
|
8
|
+
limit?: number;
|
|
9
|
+
sort?: 'itemCodes' | 'itemLoincs' | 'itemNames' | 'labIds';
|
|
10
|
+
sortOrder?: 'asc' | 'desc';
|
|
11
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { Questionnaire } from 'fhir/r4b';
|
|
2
|
+
/**
|
|
3
|
+
* orderable item results
|
|
4
|
+
*/
|
|
5
|
+
export interface LabOrderableItemListResponse {
|
|
6
|
+
orderableItems?: {
|
|
7
|
+
/**
|
|
8
|
+
* Identifying lab information and compendium version
|
|
9
|
+
*/
|
|
10
|
+
lab?: {
|
|
11
|
+
/**
|
|
12
|
+
* Identifying labGuid pertaining to the specific result
|
|
13
|
+
*/
|
|
14
|
+
labGuid?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Name of lab
|
|
17
|
+
*/
|
|
18
|
+
labName?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Description of lab
|
|
21
|
+
*/
|
|
22
|
+
labType?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Current compendium version for given lab
|
|
25
|
+
*/
|
|
26
|
+
compendiumVersion?: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Specific orderable item details
|
|
30
|
+
*/
|
|
31
|
+
item?: {
|
|
32
|
+
/**
|
|
33
|
+
* Code uniquely identifying the orderable item for the given lab and compendium version
|
|
34
|
+
*/
|
|
35
|
+
itemCode?: string;
|
|
36
|
+
/**
|
|
37
|
+
* LOINC code associated with this orderable item.
|
|
38
|
+
*/
|
|
39
|
+
itemLoinc?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Type of orderable item
|
|
42
|
+
*/
|
|
43
|
+
itemType?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Name of the orderable item.
|
|
46
|
+
*/
|
|
47
|
+
itemName?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Unique name of the orderable item. Typically a combination of the itemCode and itemName
|
|
50
|
+
*/
|
|
51
|
+
uniqueName?: string;
|
|
52
|
+
/**
|
|
53
|
+
* List of the sample(s) that must be collected for this orderable item
|
|
54
|
+
*/
|
|
55
|
+
specimens?: {
|
|
56
|
+
/**
|
|
57
|
+
* Description of container necessary to store the sample.
|
|
58
|
+
*/
|
|
59
|
+
container?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Volume of the specimen to be collected
|
|
62
|
+
*/
|
|
63
|
+
volume?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Minimum volume of specimen below which teh test is not performable
|
|
66
|
+
*/
|
|
67
|
+
minimumVolume?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Instructions for storing the specimen after collection
|
|
70
|
+
*/
|
|
71
|
+
storageRequirements?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Instructions for how to collect the sample
|
|
74
|
+
*/
|
|
75
|
+
collectionInstructions?: string;
|
|
76
|
+
}[];
|
|
77
|
+
/**
|
|
78
|
+
* List of the component(s) comprising this orderable item
|
|
79
|
+
*/
|
|
80
|
+
components?: {
|
|
81
|
+
/**
|
|
82
|
+
* Description of container necessary to store the sample.
|
|
83
|
+
*/
|
|
84
|
+
componentItemCode?: string;
|
|
85
|
+
/**
|
|
86
|
+
* Name of component
|
|
87
|
+
*/
|
|
88
|
+
name?: string;
|
|
89
|
+
/**
|
|
90
|
+
* LOINC code identifying the component
|
|
91
|
+
*/
|
|
92
|
+
loinc?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Unit of measurement
|
|
95
|
+
*/
|
|
96
|
+
uom?: string;
|
|
97
|
+
/**
|
|
98
|
+
* Reference range associated with the component
|
|
99
|
+
*/
|
|
100
|
+
range?: string;
|
|
101
|
+
/**
|
|
102
|
+
* Type of the component, such as List, Numeric, Free Text
|
|
103
|
+
*/
|
|
104
|
+
type?: string;
|
|
105
|
+
}[];
|
|
106
|
+
/**
|
|
107
|
+
* Array of CPT codes associated with the orderable item
|
|
108
|
+
*/
|
|
109
|
+
cptCodes?: {
|
|
110
|
+
/**
|
|
111
|
+
* CPT Code used for billing for medical services and procedures
|
|
112
|
+
*/
|
|
113
|
+
cptCode?: string;
|
|
114
|
+
/**
|
|
115
|
+
* Number of billable units
|
|
116
|
+
*/
|
|
117
|
+
serviceUnitsCount?: number;
|
|
118
|
+
}[];
|
|
119
|
+
/**
|
|
120
|
+
* Answer On Entry Questionnaire. See FHIR Questionnaire for schema
|
|
121
|
+
*/
|
|
122
|
+
aoe?: Questionnaire;
|
|
123
|
+
};
|
|
124
|
+
}[];
|
|
125
|
+
/**
|
|
126
|
+
* Pagination details
|
|
127
|
+
*/
|
|
128
|
+
metadata?: {
|
|
129
|
+
/**
|
|
130
|
+
* Cursor to include in subsequent request for next page of results. Will be null if there are no more results.
|
|
131
|
+
*/
|
|
132
|
+
nextCursor?: string;
|
|
133
|
+
};
|
|
134
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export interface LabRouteCreateParams {
|
|
2
|
+
primaryId?: string;
|
|
3
|
+
/**
|
|
4
|
+
* Provided by the lab, indicates a financial relationship between the lab and the customer.
|
|
5
|
+
*/
|
|
6
|
+
accountNumber: string;
|
|
7
|
+
/**
|
|
8
|
+
* Unique identifier of a lab. Searchable via orderable item Search.
|
|
9
|
+
*/
|
|
10
|
+
labGuid: string;
|
|
11
|
+
/**
|
|
12
|
+
* Name of the Primary (Practice or Provider depending on the Route). Required for certain labs. See [Create Route](https://docs.oystehr.com/oystehr/services/lab/onboarding-a-lab/#create-route) for more details.
|
|
13
|
+
*/
|
|
14
|
+
primaryName?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Address of the Primary. Required for certain labs. See [Create Route](https://docs.oystehr.com/oystehr/services/lab/onboarding-a-lab/#create-route) for more details.
|
|
17
|
+
*/
|
|
18
|
+
primaryAddress?: {
|
|
19
|
+
address1: string;
|
|
20
|
+
address2?: string;
|
|
21
|
+
city: string;
|
|
22
|
+
stateProvinceCode: string;
|
|
23
|
+
postalCode: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* String representing accepted End User License Agreement Version. Required for certain labs. See [Create Route](https://docs.oystehr.com/oystehr/services/lab/onboarding-a-lab/#create-route) for more details.
|
|
27
|
+
*/
|
|
28
|
+
eulaVersion?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Name of individual who accepted the End User License Agreement. Required for certain labs. See [Create Route](https://docs.oystehr.com/oystehr/services/lab/onboarding-a-lab/#create-route) for more details.
|
|
31
|
+
*/
|
|
32
|
+
eulaAccepterFullName?: string;
|
|
33
|
+
/**
|
|
34
|
+
* ISO string representing when the End User License Agreement was accepted. Required for certain labs. See [Create Route](https://docs.oystehr.com/oystehr/services/lab/onboarding-a-lab/#create-route) for more details.
|
|
35
|
+
*/
|
|
36
|
+
eulaAcceptanceDateTimeUtc?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Site ID for the Primary. ClientSiteID is assigned by the lab. This disambiguates instances where the same Account Number is used across multiple physical locations. Required for certain labs. See [Create Route](https://docs.oystehr.com/oystehr/services/lab/onboarding-a-lab/#create-route) for more details.
|
|
39
|
+
*/
|
|
40
|
+
clientSiteId?: string;
|
|
41
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* List of Routes associated with the calling projectId.
|
|
3
|
+
*/
|
|
4
|
+
export type LabRouteListResponse = {
|
|
5
|
+
/**
|
|
6
|
+
* Unique identifier of the created Route.
|
|
7
|
+
*/
|
|
8
|
+
routeGuid?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Unique identifier of a lab. Searchable via orderable item Search
|
|
11
|
+
*/
|
|
12
|
+
labGuid?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Provided by the lab, indicates a financial relationship between the lab and the customer.
|
|
15
|
+
*/
|
|
16
|
+
accountNumber?: string;
|
|
17
|
+
}[];
|
|
@@ -164,3 +164,11 @@ export * from './ZambdaLogStreamGetParams';
|
|
|
164
164
|
export * from './ZambdaLogStreamGetResponse';
|
|
165
165
|
export * from './FaxSendParams';
|
|
166
166
|
export * from './FaxSendResponse';
|
|
167
|
+
export * from './LabRouteListResponse';
|
|
168
|
+
export * from './LabRouteCreateParams';
|
|
169
|
+
export * from './LabRouteDeleteParams';
|
|
170
|
+
export * from './LabOrderableItemListParams';
|
|
171
|
+
export * from './LabOrderableItemListResponse';
|
|
172
|
+
export * from './LabOrderableItemQuestionnaireGetParams';
|
|
173
|
+
export * from './LabOrderableItemQuestionnaireGetResponse';
|
|
174
|
+
export * from './LabOrderSubmitParams';
|
package/dist/esm/config.d.ts
CHANGED
package/dist/esm/index.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{v4 as t}from"uuid";class e extends Error{constructor({message:t,code:i,cause:s}){super(t,{cause:s}),Object.setPrototypeOf(this,e.prototype),this.code=i,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 i(t){var e;const i=[];for(const s of null!==(e=t.issue)&&void 0!==e?e:[])s.details&&s.details.text&&i.push(s.details.text);return i.length||i.push("Unknown FHIR error"),i.join(",")}class s extends e{constructor({error:t,code:e}){super({message:i(t),code:e}),Object.setPrototypeOf(this,s.prototype),this.cause=t,this.name="OystehrFHIRError"}toJSON(){return{name:this.name,message:this.message,code:this.code,cause:this.cause}}}function r(t,e,i,s){return new(i||(i=Promise))((function(r,n){function o(t){try{c(s.next(t))}catch(t){n(t)}}function u(t){try{c(s.throw(t))}catch(t){n(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,u)}c((s=s.apply(t,e||[])).next())}))}function n(t,e,i,s){if("a"===i&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?s:"a"===i?s.call(t):s?s.value:e.get(t)}"function"==typeof SuppressedError&&SuppressedError;const o=[408,429,500,502,503,504],u=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT","UND_ERR_CONNECT_TIMEOUT","UND_ERR_HEADERS_TIMEOUT","UND_ERR_HEADERS_TIMEOUT","UND_ERR_SOCKET"];class c{constructor(t){this.config=t}request(t,i,s){return(n,o)=>r(this,void 0,void 0,(function*(){const r=()=>this.config;try{return yield h(s,r,t,i)(n,o)}catch(t){const i=t;throw new e({message:i.message,code:i.code,cause:i.cause})}}))}fhirRequest(t,i){return(n,o)=>r(this,void 0,void 0,(function*(){try{const e=()=>{var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.fhirApiUrl)&&void 0!==e?e:"https://fhir-api.zapehr.com"},s=()=>this.config;return yield h(e,s,t,i)(n,o)}catch(t){const i=t;if("string"==typeof i.message)throw new e({message:i.message,code:i.code,cause:i.cause});throw new s({error:i.message,code:i.code})}}))}}function a(t){return"accessToken"in t}function h(i,s,n,c){return(h,l)=>r(this,void 0,void 0,(function*(){var p,v,m,f,g,b,y,j,q,w,S,U,k,O,x;const T=h&&!l&&!Array.isArray(h)&&a(h)?{}:null!==(p=h)&&void 0!==p?p:{},E=h&&!l&&!Array.isArray(h)&&a(h)?h:l,z=c.toLowerCase(),A=s(),R=null!==(v=A.fetch)&&void 0!==v?v:fetch,P=null!==(m=null==E?void 0:E.accessToken)&&void 0!==m?m:A.accessToken,N=null!==(f=null==E?void 0:E.projectId)&&void 0!==f?f:s().projectId;let I=n,W=T;if(!Array.isArray(T)){const[t,i]=function(t,i){const s=Object.assign({},i),r=t.replace(/\{([^}]+)\}/g,((t,r)=>{if(delete s[r],r.match(/^.*\+$/))return i[r]+"";if(!i[r]||""===i[r])throw new e({message:`Required path parameter is an empty string: ${r}`,code:400});return i[r]?encodeURIComponent(i[r]+""):""})),n=Object.keys(s),o=n.length?n.reduce(((t,e)=>Object.assign(Object.assign({},t),{[e]:s[e]})),{}):{};return[r,o]}(n,T);I=t,W=i}I=I.replace(/^\//,"");const $=i(),C=$.endsWith("/")?$:$+"/",_=new URL(I,C);let L;if(Array.isArray(W))L=JSON.stringify(W);else if(Object.keys(W).length)if("get"===z)d(W,_.searchParams);else if("application/x-www-form-urlencoded"===(null==E?void 0:E.contentType)){const t=new URLSearchParams;d(W,t),L=t.toString()}else L=JSON.stringify(W);else"application/x-www-form-urlencoded"!==(null==E?void 0:E.contentType)&&"post"===z&&(L="{}");const M=Object.assign(N?{"x-zapehr-project-id":N,"x-oystehr-project-id":N}:{},{"content-type":null!==(g=null==E?void 0:E.contentType)&&void 0!==g?g:"application/json"},P?{Authorization:`Bearer ${P}`}:{},(null==E?void 0:E.ifMatch)?{"If-Match":E.ifMatch}:{},{"x-oystehr-request-id":null!==(b=null==E?void 0:E.requestId)&&void 0!==b?b:t()}),D={retries:null!==(j=null===(y=A.retry)||void 0===y?void 0:y.retries)&&void 0!==j?j:3,jitter:null!==(w=null===(q=A.retry)||void 0===q?void 0:q.jitter)&&void 0!==w?w:20,delay:null!==(U=null===(S=A.retry)||void 0===S?void 0:S.delay)&&void 0!==U?U:100,onRetry:null===(k=A.retry)||void 0===k?void 0:k.onRetry,retryOn:[...null!==(x=null===(O=A.retry)||void 0===O?void 0:O.retryOn)&&void 0!==x?x:[],...o]};return D.retryOn.push(...o),function(t,e){var i,s;return r(this,void 0,void 0,(function*(){let r;for(const n of Array.from({length:(null!==(i=e.retries)&&void 0!==i?i:0)+1},((t,e)=>e)))try{return yield t(n)}catch(t){let i=!1;if("response"in t){const s=t;i=e.retryOn.includes(s.code),r={message:t.message,code:t.code}}else if(r=t,"code"in t&&"string"==typeof t.code){const e=t;i=u.includes(e.code)}if(!i)break;const o=Math.floor(Math.random()*(e.jitter+1));yield new Promise((t=>setTimeout(t,e.delay+o))),e.onRetry&&n!==(null!==(s=e.retries)&&void 0!==s?s:0)&&e.onRetry(n+1)}throw r}))}((()=>r(this,void 0,void 0,(function*(){var t,e,i,s,r,n;const o=yield R(new Request(_,{method:z.toUpperCase(),body:L,headers:M})),u=o.body?yield o.text():null;let c;try{c=u&&((null===(t=o.headers.get("content-type"))||void 0===t?void 0:t.includes("application/json"))||(null===(e=o.headers.get("content-type"))||void 0===e?void 0:e.includes("application/fhir+json")))?JSON.parse(u):null}catch(t){c=null}if(!o.ok||o.status>=400){throw{message:null!==(r=null!==(s=null!==(i=null==c?void 0:c.message)&&void 0!==i?i:c)&&void 0!==s?s:u)&&void 0!==r?r:o.statusText,code:null!==(n=null==c?void 0:c.code)&&void 0!==n?n:o.status,response:o}}return c}))),D)}))}function d(t,e){for(const[i,s]of Object.entries(t))Array.isArray(s)?s.forEach((t=>e.append(i,t))):e.append(i,s)}var l,p,v,m;class f extends c{constructor(t){super(t),l.add(this)}list(t){return this.request("/application","get",n(this,l,"m",p).bind(this))(t)}create(t,e){return this.request("/application","post",n(this,l,"m",p).bind(this))(t,e)}get(t,e){return this.request("/application/{id}","get",n(this,l,"m",p).bind(this))(t,e)}update(t,e){return this.request("/application/{id}","patch",n(this,l,"m",p).bind(this))(t,e)}delete(t,e){return this.request("/application/{id}","delete",n(this,l,"m",p).bind(this))(t,e)}rotateSecret(t,e){return this.request("/application/{id}/rotate-secret","post",n(this,l,"m",p).bind(this))(t,e)}revokeRefreshToken(t,e){return this.request("/application/{id}/revoke-refresh-token","post",n(this,l,"m",p).bind(this))(t,e)}revokeAccessToken(t,e){return this.request("/application/{id}/revoke-access-token","post",n(this,l,"m",p).bind(this))(t,e)}}l=new WeakSet,p=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class g extends c{constructor(t){super(t),v.add(this)}issue(t,e){return this.request("/payment/charge/issue","post",n(this,v,"m",m).bind(this))(t,e)}status(t,e){return this.request("/payment/charge/status","post",n(this,v,"m",m).bind(this))(t,e)}}v=new WeakSet,m=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};const b="https://extensions.fhir.zapehr.com/encounter-virtual-service-pre-release",y="addressString";function j(t){var e,i,s;if(function(t){return Object.hasOwn(t,"virtualService")}(t)){const i=null===(e=t.virtualService)||void 0===e?void 0:e.find((t=>{var e;return"https://fhir.zapehr.com/virtual-service-type"===(null===(e=t.channelType)||void 0===e?void 0:e.system)}));return null==i?void 0:i.addressString}if(!t.extension)return;const r=t.extension.find((t=>t.url===b));if(!(null==r?void 0:r.extension))return;return null===(s=null===(i=r.extension)||void 0===i?void 0:i.find((t=>t.url===y)))||void 0===s?void 0:s.valueString}var q,w,S,U,k,O,x,T;class E extends c{constructor(t){super(t),q.add(this),this.ENCOUNTER_VS_EXTENSION_URL=b,this.ENCOUNTER_VS_EXTENSION_RELATIVE_URL=y,this.getConversationIdFromEncounter=j}create(t,e){return this.request("/messaging/conversation","post",n(this,q,"m",w).bind(this))(t,e)}getToken(t){return this.request("/messaging/conversation/token","get",n(this,q,"m",w).bind(this))(t)}addParticipant(t,e){return this.request("/messaging/conversation/{conversationId}/participant","post",n(this,q,"m",w).bind(this))(t,e)}removeParticipant(t,e){return this.request("/messaging/conversation/{conversationId}/participant","delete",n(this,q,"m",w).bind(this))(t,e)}message(t,e){return this.request("/messaging/conversation/{conversationId}/message","post",n(this,q,"m",w).bind(this))(t,e)}}q=new WeakSet,w=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class z extends c{constructor(t){super(t),S.add(this)}get(t,e){return this.request("/developer/{id}","get",n(this,S,"m",U).bind(this))(t,e)}update(t,e){return this.request("/developer/{id}","patch",n(this,S,"m",U).bind(this))(t,e)}delete(t,e){return this.request("/developer/{id}","delete",n(this,S,"m",U).bind(this))(t,e)}invite(t,e){return this.request("/developer/invite","post",n(this,S,"m",U).bind(this))(t,e)}list(t){return this.request("/developer","get",n(this,S,"m",U).bind(this))(t)}listV2(t,e){return this.request("/developer/v2/list","get",n(this,S,"m",U).bind(this))(t,e)}}S=new WeakSet,U=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class A extends c{constructor(t){super(t),k.add(this)}syncPatient(t,e){return this.request("/erx/sync-patient/{patientId}","post",n(this,k,"m",O).bind(this))(t,e)}allergySearch(t,e){return this.request("/erx/allergy/search","get",n(this,k,"m",O).bind(this))(t,e)}cancelOrder(t,e){return this.request("/erx/cancel-order","post",n(this,k,"m",O).bind(this))(t,e)}cancelPrescription(t,e){return this.request("/erx/cancel-prescription","post",n(this,k,"m",O).bind(this))(t,e)}medicationSearch(t,e){return this.request("/erx/medication/search","get",n(this,k,"m",O).bind(this))(t,e)}medicationSearchV2(t,e){return this.request("/erx/v2/medication/search","get",n(this,k,"m",O).bind(this))(t,e)}}k=new WeakSet,O=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class R extends c{constructor(t){super(t),x.add(this)}offboard(t){return this.request("/offboard","post",n(this,x,"m",T).bind(this))(t)}onboard(t){return this.request("/onboard","post",n(this,x,"m",T).bind(this))(t)}send(t,e){return this.request("/send","post",n(this,x,"m",T).bind(this))(t,e)}}function P(t,e){return r(this,void 0,void 0,(function*(){const{resourceType:i,params:s}=t;let r;s&&(r=Object.entries(s).reduce(((t,[e,i])=>(t[i.name]||(t[i.name]=[]),t[i.name].push(i.value),t)),{}));const n=yield this.fhirRequest(`/${i}/_search`,"POST")(r,Object.assign(Object.assign({},e),{contentType:"application/x-www-form-urlencoded"}));return Object.assign(Object.assign({},n),{entry:n.entry,unbundle:function(){var t,e;return null!==(e=null===(t=this.entry)||void 0===t?void 0:t.map((t=>t.resource)).filter((t=>void 0!==t)))&&void 0!==e?e:[]}})}))}function N(t,e){return r(this,void 0,void 0,(function*(){const{resourceType:i}=t;return this.fhirRequest(`/${i}`,"POST")(t,e)}))}function I({resourceType:t,id:e},i){return r(this,void 0,void 0,(function*(){return this.fhirRequest(`/${t}/${e}`,"GET")({},i)}))}function W(t,e){return r(this,void 0,void 0,(function*(){const{id:i,resourceType:s}=t;return this.fhirRequest(`/${s}/${i}`,"PUT")(t,Object.assign(Object.assign({},e),{ifMatch:(null==e?void 0:e.optimisticLockingVersionId)?`W/"${e.optimisticLockingVersionId}"`:void 0}))}))}function $({resourceType:t,id:e,operations:i},s){return r(this,void 0,void 0,(function*(){return this.fhirRequest(`/${t}/${e}`,"PATCH")(i,Object.assign(Object.assign({},s),{contentType:"application/json-patch+json",ifMatch:(null==s?void 0:s.optimisticLockingVersionId)?`W/"${s.optimisticLockingVersionId}"`:void 0}))}))}function C({resourceType:t,id:e},i){return r(this,void 0,void 0,(function*(){return this.fhirRequest(`/${t}/${e}`,"DELETE")({},i)}))}function _({resourceType:t,id:e,versionId:i},s){return r(this,void 0,void 0,(function*(){return this.fhirRequest(`/${t}/${e}/_history${i?`/${i}`:""}`,"GET")({},s)}))}function L(t){const{method:e,url:i}=t,s={request:{method:e,url:i}};if(i.split("?").length>1){const[t,e]=i.split("?"),r=e.split("&").map((t=>{const[e,i]=t.split("=");return{name:e,value:i}})).reduce(((t,{name:e,value:i})=>e?(t[e]||(t[e]=[]),t[e].push(i),t):t),{}),n=new URLSearchParams;d(r,n),s.request.url=`${t}?${n.toString()}`}if(["GET","DELETE","HEAD"].includes(e))return s;if("PUT"===e){const{resource:e}=t;return Object.assign(Object.assign({},s),{resource:e})}if("PATCH"===e)return"resource"in t?Object.assign(Object.assign({},s),{resource:t.resource}):Object.assign(Object.assign({},s),{resource:{resourceType:"Binary",contentType:"application/json-patch+json",data:Buffer.from(JSON.stringify(t.operations),"utf8").toString("base64")}});if("POST"===e){const{resource:e,fullUrl:i}=t;return Object.assign(Object.assign({},s),{resource:e,fullUrl:i})}throw new Error("Unrecognized method")}function M(t){return function(e,i){return r(this,void 0,void 0,(function*(){return this.fhirRequest("/","POST")({resourceType:"Bundle",type:t,entry:e.requests.map(L)},i)}))}}x=new WeakSet,T=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.faxApiUrl)&&void 0!==e?e:"https://fax-api.zapehr.com/v1"};const D=M("batch"),V=M("transaction");function F(t,e){const i=[];if(t.line&&i.push(...t.line),t.city||t.state||t.postalCode){const e=[];t.city&&e.push(t.city),t.state&&e.push(t.state),t.postalCode&&e.push(t.postalCode),i.push(e.join(", "))}return t.use&&((null==e?void 0:e.all)||(null==e?void 0:e.use))&&i.push("["+t.use+"]"),i.join((null==e?void 0:e.lineSeparator)||", ").trim()}function H(t,e){const i=[];return t.prefix&&!1!==(null==e?void 0:e.prefix)&&i.push(...t.prefix),t.given&&i.push(...t.given),t.family&&i.push(t.family),t.suffix&&!1!==(null==e?void 0:e.suffix)&&i.push(...t.suffix),t.use&&((null==e?void 0:e.all)||(null==e?void 0:e.use))&&i.push("["+t.use+"]"),i.join(" ").trim()}var B,J,G,X,Z,K,Q,Y,tt,et,it,st,rt,nt,ot,ut,ct,at,ht,dt,lt,pt,vt,mt,ft,gt,bt,yt,jt;class qt extends c{constructor(t){super(t),B.add(this),this.search=P,this.create=N,this.get=I,this.update=W,this.patch=$,this.delete=C,this.history=_,this.batch=D,this.transaction=V,this.formatAddress=F,this.formatHumanName=H}}B=new WeakSet;class wt extends c{constructor(t){super(t),J.add(this)}list(t){return this.request("/m2m","get",n(this,J,"m",G).bind(this))(t)}create(t,e){return this.request("/m2m","post",n(this,J,"m",G).bind(this))(t,e)}get(t,e){return this.request("/m2m/{id}","get",n(this,J,"m",G).bind(this))(t,e)}update(t,e){return this.request("/m2m/{id}","patch",n(this,J,"m",G).bind(this))(t,e)}delete(t,e){return this.request("/m2m/{id}","delete",n(this,J,"m",G).bind(this))(t,e)}rotateSecret(t,e){return this.request("/m2m/{id}/rotate-secret","post",n(this,J,"m",G).bind(this))(t,e)}listV2(t,e){return this.request("/m2m/v2/list","get",n(this,J,"m",G).bind(this))(t,e)}}J=new WeakSet,G=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class St extends c{constructor(t){super(t),X.add(this)}getMessagingConfig(t){return this.request("/messaging/config","get",n(this,X,"m",Z).bind(this))(t)}}X=new WeakSet,Z=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class Ut extends c{constructor(t){super(t),K.add(this)}setUp(t,e){return this.request("/payment/payment-method/setup","post",n(this,K,"m",Q).bind(this))(t,e)}setDefault(t,e){return this.request("/payment/payment-method/set-default","post",n(this,K,"m",Q).bind(this))(t,e)}delete(t,e){return this.request("/payment/payment-method","delete",n(this,K,"m",Q).bind(this))(t,e)}list(t,e){return this.request("/payment/payment-method/list","post",n(this,K,"m",Q).bind(this))(t,e)}}K=new WeakSet,Q=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class kt extends c{constructor(t){super(t),Y.add(this)}get(t){return this.request("/project","get",n(this,Y,"m",tt).bind(this))(t)}update(t,e){return this.request("/project","patch",n(this,Y,"m",tt).bind(this))(t,e)}}Y=new WeakSet,tt=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class Ot extends c{constructor(t){super(t),et.add(this)}eligibilityCheck(t,e){return this.request("/rcm/eligibility-check","post",n(this,et,"m",it).bind(this))(t,e)}validateProfessionalClaim(t,e){return this.request("/rcm/professional-claim/validate","post",n(this,et,"m",it).bind(this))(t,e)}submitProfessionalClaim(t,e){return this.request("/rcm/professional-claim/submit","post",n(this,et,"m",it).bind(this))(t,e)}}et=new WeakSet,it=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class xt extends c{constructor(t){super(t),st.add(this)}list(t){return this.request("/iam/role","get",n(this,st,"m",rt).bind(this))(t)}create(t,e){return this.request("/iam/role","post",n(this,st,"m",rt).bind(this))(t,e)}get(t,e){return this.request("/iam/role/{roleId}","get",n(this,st,"m",rt).bind(this))(t,e)}update(t,e){return this.request("/iam/role/{roleId}","patch",n(this,st,"m",rt).bind(this))(t,e)}delete(t,e){return this.request("/iam/role/{roleId}","delete",n(this,st,"m",rt).bind(this))(t,e)}}st=new WeakSet,rt=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class Tt extends c{constructor(t){super(t),nt.add(this)}list(t){return this.request("/secret","get",n(this,nt,"m",ot).bind(this))(t)}set(t,e){return this.request("/secret","post",n(this,nt,"m",ot).bind(this))(t,e)}get(t,e){return this.request("/secret/{name}","get",n(this,nt,"m",ot).bind(this))(t,e)}delete(t,e){return this.request("/secret/{name}","delete",n(this,nt,"m",ot).bind(this))(t,e)}}nt=new WeakSet,ot=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class Et extends c{constructor(t){super(t),ut.add(this)}createMeeting(t,e){return this.request("/telemed/v2/meeting","post",n(this,ut,"m",ct).bind(this))(t,e)}joinMeeting(t,e){return this.request("/telemed/v2/meeting/{encounterId}/join","get",n(this,ut,"m",ct).bind(this))(t,e)}}ut=new WeakSet,ct=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class zt extends c{constructor(t){super(t),at.add(this)}send(t,e){return this.request("/messaging/transactional-sms/send","post",n(this,at,"m",ht).bind(this))(t,e)}}at=new WeakSet,ht=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class At extends c{constructor(t){super(t),dt.add(this)}me(t){return this.request("/user/me","get",n(this,dt,"m",lt).bind(this))(t)}get(t,e){return this.request("/user/{id}","get",n(this,dt,"m",lt).bind(this))(t,e)}update(t,e){return this.request("/user/{id}","patch",n(this,dt,"m",lt).bind(this))(t,e)}delete(t,e){return this.request("/user/{id}","delete",n(this,dt,"m",lt).bind(this))(t,e)}invite(t,e){return this.request("/user/invite","post",n(this,dt,"m",lt).bind(this))(t,e)}list(t){return this.request("/user","get",n(this,dt,"m",lt).bind(this))(t)}listV2(t,e){return this.request("/user/v2/list","get",n(this,dt,"m",lt).bind(this))(t,e)}}dt=new WeakSet,lt=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class Rt extends c{constructor(t){super(t),pt.add(this)}get(t){return this.request("/version","get",n(this,pt,"m",vt).bind(this))(t)}}function Pt(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"}function Nt({bucketName:t,"objectPath+":e,file:i}){return r(this,void 0,void 0,(function*(){const s=yield this.request("/z3/{bucketName}/{objectPath+}","post",Pt.bind(this))({action:"upload",bucketName:t,"objectPath+":e});yield fetch(s.signedUrl,{method:"PUT",body:i})}))}function It({bucketName:t,"objectPath+":e}){return r(this,void 0,void 0,(function*(){const i=yield this.request("/z3/{bucketName}/{objectPath+}","post",Pt.bind(this))({action:"download",bucketName:t,"objectPath+":e}),s=yield fetch(i.signedUrl,{method:"GET"});if(!s.ok)throw new Error("Failed to download file");return s.arrayBuffer()}))}function Wt(t){var i,s;return r(this,void 0,void 0,(function*(){let r,n;const o=new URL(t.url);if("z3:"===o.protocol){const t=o.pathname.split("/").slice(1);r=o.hostname,n=t.join("/")}else{if(!o.href.startsWith(null!==(s=null===(i=this.config.services)||void 0===i?void 0:i.projectApiUrl)&&void 0!==s?s:"https://project-api.zapehr.com/v1"))throw new e({message:"Invalid Z3 URL",code:400});{const t=o.pathname.split("/").slice(3);r=t[0],n=t.slice(1).join("/")}}const u={action:"upload",bucketName:r,"objectPath+":n};return this.request("/z3/{bucketName}/{objectPath+}","post",Pt.bind(this))(u)}))}pt=new WeakSet,vt=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class $t extends c{constructor(t){super(t),mt.add(this),this.uploadFile=Nt,this.downloadFile=It,this.getPresignedUrlForZ3Url=Wt}listBuckets(t){return this.request("/z3","get",n(this,mt,"m",ft).bind(this))(t)}createBucket(t,e){return this.request("/z3/{bucketName}","put",n(this,mt,"m",ft).bind(this))(t,e)}deleteBucket(t,e){return this.request("/z3/{bucketName}","delete",n(this,mt,"m",ft).bind(this))(t,e)}listObjects(t,e){return this.request("/z3/{bucketName}/{objectPath+}","get",n(this,mt,"m",ft).bind(this))(t,e)}getPresignedUrl(t,e){return this.request("/z3/{bucketName}/{objectPath+}","post",n(this,mt,"m",ft).bind(this))(t,e)}deleteObject(t,e){return this.request("/z3/{bucketName}/{objectPath+}","delete",n(this,mt,"m",ft).bind(this))(t,e)}}function Ct(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"}function _t({id:t,file:e,filename:i}){return r(this,void 0,void 0,(function*(){const s=yield this.request("/zambda/{id}/s3-upload","post",Ct.bind(this))({id:t,filename:i});yield fetch(s.signedUrl,{method:"PUT",body:e})}))}mt=new WeakSet,ft=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class Lt extends c{constructor(t){super(t),gt.add(this),this.uploadFile=_t}list(t){return this.request("/zambda","get",n(this,gt,"m",bt).bind(this))(t)}create(t,e){return this.request("/zambda","post",n(this,gt,"m",bt).bind(this))(t,e)}get(t,e){return this.request("/zambda/{id}","get",n(this,gt,"m",bt).bind(this))(t,e)}update(t,e){return this.request("/zambda/{id}","patch",n(this,gt,"m",bt).bind(this))(t,e)}delete(t,e){return this.request("/zambda/{id}","delete",n(this,gt,"m",bt).bind(this))(t,e)}execute(t,e){return this.request("/zambda/{id}/execute","post",n(this,gt,"m",bt).bind(this))(t,e)}executePublic(t,e){return this.request("/zambda/{id}/execute-public","post",n(this,gt,"m",bt).bind(this))(t,e)}s3Upload(t,e){return this.request("/zambda/{id}/s3-upload","post",n(this,gt,"m",bt).bind(this))(t,e)}}gt=new WeakSet,bt=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class Mt extends c{constructor(t){super(t),yt.add(this)}list(t,e){return this.request("/zambda/{id}/logStream","post",n(this,yt,"m",jt).bind(this))(t,e)}search(t,e){return this.request("/zambda/{id}/logStream/search","post",n(this,yt,"m",jt).bind(this))(t,e)}get(t,e){return this.request("/zambda/{id}/logStream/{logStreamName}","post",n(this,yt,"m",jt).bind(this))(t,e)}}yt=new WeakSet,jt=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};let Dt=class{constructor(t){var e,i,s,r,n,o;this.config=t,null!==(e=(r=this.config).services)&&void 0!==e||(r.services={}),null!==(i=(n=this.config.services).projectApiUrl)&&void 0!==i||(n.projectApiUrl=t.projectApiUrl),null!==(s=(o=this.config.services).fhirApiUrl)&&void 0!==s||(o.fhirApiUrl=t.fhirApiUrl),this.application=new f(t),this.developer=new z(t),this.m2m=new wt(t),this.messaging=new St(t),this.conversation=new E(t),this.transactionalSMS=new zt(t),this.paymentMethod=new Ut(t),this.charge=new g(t),this.project=new kt(t),this.rcm=new Ot(t),this.erx=new A(t),this.role=new xt(t),this.secret=new Tt(t),this.telemed=new Et(t),this.user=new At(t),this.version=new Rt(t),this.z3=new $t(t),this.zambda=new Lt(t),this.zambdaLogStream=new Mt(t),this.fax=new R(t),this.fhir=new qt(t)}};class Vt extends Dt{}Vt.OystehrFHIRError=s,Vt.OystehrSdkError=e;export{Vt as default};
|
|
1
|
+
import{v4 as t}from"uuid";class e extends Error{constructor({message:t,code:i,cause:s}){super(t,{cause:s}),Object.setPrototypeOf(this,e.prototype),this.code=i,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 i(t){var e;const i=[];for(const s of null!==(e=t.issue)&&void 0!==e?e:[])s.details&&s.details.text&&i.push(s.details.text);return i.length||i.push("Unknown FHIR error"),i.join(",")}class s extends e{constructor({error:t,code:e}){super({message:i(t),code:e}),Object.setPrototypeOf(this,s.prototype),this.cause=t,this.name="OystehrFHIRError"}toJSON(){return{name:this.name,message:this.message,code:this.code,cause:this.cause}}}function r(t,e,i,s){return new(i||(i=Promise))((function(r,n){function o(t){try{c(s.next(t))}catch(t){n(t)}}function u(t){try{c(s.throw(t))}catch(t){n(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,u)}c((s=s.apply(t,e||[])).next())}))}function n(t,e,i,s){if("a"===i&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?s:"a"===i?s.call(t):s?s.value:e.get(t)}"function"==typeof SuppressedError&&SuppressedError;const o=[408,429,500,502,503,504],u=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT","UND_ERR_CONNECT_TIMEOUT","UND_ERR_HEADERS_TIMEOUT","UND_ERR_HEADERS_TIMEOUT","UND_ERR_SOCKET"];class c{constructor(t){this.config=t}request(t,i,s){return(n,o)=>r(this,void 0,void 0,(function*(){const r=()=>this.config;try{return yield a(s,r,t,i)(n,o)}catch(t){const i=t;throw new e({message:i.message,code:i.code,cause:i.cause})}}))}fhirRequest(t,i){return(n,o)=>r(this,void 0,void 0,(function*(){try{const e=()=>{var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.fhirApiUrl)&&void 0!==e?e:"https://fhir-api.zapehr.com"},s=()=>this.config;return yield a(e,s,t,i)(n,o)}catch(t){const i=t;if("string"==typeof i.message)throw new e({message:i.message,code:i.code,cause:i.cause});throw new s({error:i.message,code:i.code})}}))}}function h(t){return"accessToken"in t}function a(i,s,n,c){return(a,l)=>r(this,void 0,void 0,(function*(){var p,v,m,f,b,g,y,j,q,w,S,U,k,x,O;const T=a&&!l&&!Array.isArray(a)&&h(a)?{}:null!==(p=a)&&void 0!==p?p:{},E=a&&!l&&!Array.isArray(a)&&h(a)?a:l,z=c.toLowerCase(),A=s(),R=null!==(v=A.fetch)&&void 0!==v?v:fetch,P=null!==(m=null==E?void 0:E.accessToken)&&void 0!==m?m:A.accessToken,N=null!==(f=null==E?void 0:E.projectId)&&void 0!==f?f:s().projectId;let I=n,W=T;if(!Array.isArray(T)){const[t,i]=function(t,i){const s=Object.assign({},i),r=t.replace(/\{([^}]+)\}/g,((t,r)=>{if(delete s[r],r.match(/^.*\+$/))return i[r]+"";if(!i[r]||""===i[r])throw new e({message:`Required path parameter is an empty string: ${r}`,code:400});return i[r]?encodeURIComponent(i[r]+""):""})),n=Object.keys(s),o=n.length?n.reduce(((t,e)=>Object.assign(Object.assign({},t),{[e]:s[e]})),{}):{};return[r,o]}(n,T);I=t,W=i}I=I.replace(/^\//,"");const $=i(),C=$.endsWith("/")?$:$+"/",_=new URL(I,C);let L;if(Array.isArray(W))L=JSON.stringify(W);else if(Object.keys(W).length)if("get"===z)d(W,_.searchParams);else if("application/x-www-form-urlencoded"===(null==E?void 0:E.contentType)){const t=new URLSearchParams;d(W,t),L=t.toString()}else L=JSON.stringify(W);else"application/x-www-form-urlencoded"!==(null==E?void 0:E.contentType)&&"post"===z&&(L="{}");const M=Object.assign(N?{"x-zapehr-project-id":N,"x-oystehr-project-id":N}:{},{"content-type":null!==(b=null==E?void 0:E.contentType)&&void 0!==b?b:"application/json"},P?{Authorization:`Bearer ${P}`}:{},(null==E?void 0:E.ifMatch)?{"If-Match":E.ifMatch}:{},{"x-oystehr-request-id":null!==(g=null==E?void 0:E.requestId)&&void 0!==g?g:t()}),D={retries:null!==(j=null===(y=A.retry)||void 0===y?void 0:y.retries)&&void 0!==j?j:3,jitter:null!==(w=null===(q=A.retry)||void 0===q?void 0:q.jitter)&&void 0!==w?w:20,delay:null!==(U=null===(S=A.retry)||void 0===S?void 0:S.delay)&&void 0!==U?U:100,onRetry:null===(k=A.retry)||void 0===k?void 0:k.onRetry,retryOn:[...null!==(O=null===(x=A.retry)||void 0===x?void 0:x.retryOn)&&void 0!==O?O:[],...o]};return D.retryOn.push(...o),function(t,e){var i,s;return r(this,void 0,void 0,(function*(){let r;for(const n of Array.from({length:(null!==(i=e.retries)&&void 0!==i?i:0)+1},((t,e)=>e)))try{return yield t(n)}catch(t){let i=!1;if("response"in t){const s=t;i=e.retryOn.includes(s.code),r={message:t.message,code:t.code}}else if(r=t,"code"in t&&"string"==typeof t.code){const e=t;i=u.includes(e.code)}if(!i)break;const o=Math.floor(Math.random()*(e.jitter+1));yield new Promise((t=>setTimeout(t,e.delay+o))),e.onRetry&&n!==(null!==(s=e.retries)&&void 0!==s?s:0)&&e.onRetry(n+1)}throw r}))}((()=>r(this,void 0,void 0,(function*(){var t,e,i,s,r,n;const o=yield R(new Request(_,{method:z.toUpperCase(),body:L,headers:M})),u=o.body?yield o.text():null;let c;try{c=u&&((null===(t=o.headers.get("content-type"))||void 0===t?void 0:t.includes("application/json"))||(null===(e=o.headers.get("content-type"))||void 0===e?void 0:e.includes("application/fhir+json")))?JSON.parse(u):null}catch(t){c=null}if(!o.ok||o.status>=400){throw{message:null!==(r=null!==(s=null!==(i=null==c?void 0:c.message)&&void 0!==i?i:c)&&void 0!==s?s:u)&&void 0!==r?r:o.statusText,code:null!==(n=null==c?void 0:c.code)&&void 0!==n?n:o.status,response:o}}return c}))),D)}))}function d(t,e){for(const[i,s]of Object.entries(t))Array.isArray(s)?s.forEach((t=>e.append(i,t))):e.append(i,s)}var l,p,v,m;class f extends c{constructor(t){super(t),l.add(this)}list(t){return this.request("/application","get",n(this,l,"m",p).bind(this))(t)}create(t,e){return this.request("/application","post",n(this,l,"m",p).bind(this))(t,e)}get(t,e){return this.request("/application/{id}","get",n(this,l,"m",p).bind(this))(t,e)}update(t,e){return this.request("/application/{id}","patch",n(this,l,"m",p).bind(this))(t,e)}delete(t,e){return this.request("/application/{id}","delete",n(this,l,"m",p).bind(this))(t,e)}rotateSecret(t,e){return this.request("/application/{id}/rotate-secret","post",n(this,l,"m",p).bind(this))(t,e)}revokeRefreshToken(t,e){return this.request("/application/{id}/revoke-refresh-token","post",n(this,l,"m",p).bind(this))(t,e)}revokeAccessToken(t,e){return this.request("/application/{id}/revoke-access-token","post",n(this,l,"m",p).bind(this))(t,e)}}l=new WeakSet,p=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class b extends c{constructor(t){super(t),v.add(this)}issue(t,e){return this.request("/payment/charge/issue","post",n(this,v,"m",m).bind(this))(t,e)}status(t,e){return this.request("/payment/charge/status","post",n(this,v,"m",m).bind(this))(t,e)}}v=new WeakSet,m=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};const g="https://extensions.fhir.zapehr.com/encounter-virtual-service-pre-release",y="addressString";function j(t){var e,i,s;if(function(t){return Object.hasOwn(t,"virtualService")}(t)){const i=null===(e=t.virtualService)||void 0===e?void 0:e.find((t=>{var e;return"https://fhir.zapehr.com/virtual-service-type"===(null===(e=t.channelType)||void 0===e?void 0:e.system)}));return null==i?void 0:i.addressString}if(!t.extension)return;const r=t.extension.find((t=>t.url===g));if(!(null==r?void 0:r.extension))return;return null===(s=null===(i=r.extension)||void 0===i?void 0:i.find((t=>t.url===y)))||void 0===s?void 0:s.valueString}var q,w,S,U,k,x,O,T;class E extends c{constructor(t){super(t),q.add(this),this.ENCOUNTER_VS_EXTENSION_URL=g,this.ENCOUNTER_VS_EXTENSION_RELATIVE_URL=y,this.getConversationIdFromEncounter=j}create(t,e){return this.request("/messaging/conversation","post",n(this,q,"m",w).bind(this))(t,e)}getToken(t){return this.request("/messaging/conversation/token","get",n(this,q,"m",w).bind(this))(t)}addParticipant(t,e){return this.request("/messaging/conversation/{conversationId}/participant","post",n(this,q,"m",w).bind(this))(t,e)}removeParticipant(t,e){return this.request("/messaging/conversation/{conversationId}/participant","delete",n(this,q,"m",w).bind(this))(t,e)}message(t,e){return this.request("/messaging/conversation/{conversationId}/message","post",n(this,q,"m",w).bind(this))(t,e)}}q=new WeakSet,w=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class z extends c{constructor(t){super(t),S.add(this)}get(t,e){return this.request("/developer/{id}","get",n(this,S,"m",U).bind(this))(t,e)}update(t,e){return this.request("/developer/{id}","patch",n(this,S,"m",U).bind(this))(t,e)}delete(t,e){return this.request("/developer/{id}","delete",n(this,S,"m",U).bind(this))(t,e)}invite(t,e){return this.request("/developer/invite","post",n(this,S,"m",U).bind(this))(t,e)}list(t){return this.request("/developer","get",n(this,S,"m",U).bind(this))(t)}listV2(t,e){return this.request("/developer/v2/list","get",n(this,S,"m",U).bind(this))(t,e)}}S=new WeakSet,U=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class A extends c{constructor(t){super(t),k.add(this)}syncPatient(t,e){return this.request("/erx/sync-patient/{patientId}","post",n(this,k,"m",x).bind(this))(t,e)}allergySearch(t,e){return this.request("/erx/allergy/search","get",n(this,k,"m",x).bind(this))(t,e)}cancelOrder(t,e){return this.request("/erx/cancel-order","post",n(this,k,"m",x).bind(this))(t,e)}cancelPrescription(t,e){return this.request("/erx/cancel-prescription","post",n(this,k,"m",x).bind(this))(t,e)}medicationSearch(t,e){return this.request("/erx/medication/search","get",n(this,k,"m",x).bind(this))(t,e)}medicationSearchV2(t,e){return this.request("/erx/v2/medication/search","get",n(this,k,"m",x).bind(this))(t,e)}}k=new WeakSet,x=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class R extends c{constructor(t){super(t),O.add(this)}offboard(t){return this.request("/offboard","post",n(this,O,"m",T).bind(this))(t)}onboard(t){return this.request("/onboard","post",n(this,O,"m",T).bind(this))(t)}send(t,e){return this.request("/send","post",n(this,O,"m",T).bind(this))(t,e)}}function P(t,e){return r(this,void 0,void 0,(function*(){const{resourceType:i,params:s}=t;let r;s&&(r=Object.entries(s).reduce(((t,[e,i])=>(t[i.name]||(t[i.name]=[]),t[i.name].push(i.value),t)),{}));const n=yield this.fhirRequest(`/${i}/_search`,"POST")(r,Object.assign(Object.assign({},e),{contentType:"application/x-www-form-urlencoded"}));return Object.assign(Object.assign({},n),{entry:n.entry,unbundle:function(){var t,e;return null!==(e=null===(t=this.entry)||void 0===t?void 0:t.map((t=>t.resource)).filter((t=>void 0!==t)))&&void 0!==e?e:[]}})}))}function N(t,e){return r(this,void 0,void 0,(function*(){const{resourceType:i}=t;return this.fhirRequest(`/${i}`,"POST")(t,e)}))}function I({resourceType:t,id:e},i){return r(this,void 0,void 0,(function*(){return this.fhirRequest(`/${t}/${e}`,"GET")({},i)}))}function W(t,e){return r(this,void 0,void 0,(function*(){const{id:i,resourceType:s}=t;return this.fhirRequest(`/${s}/${i}`,"PUT")(t,Object.assign(Object.assign({},e),{ifMatch:(null==e?void 0:e.optimisticLockingVersionId)?`W/"${e.optimisticLockingVersionId}"`:void 0}))}))}function $({resourceType:t,id:e,operations:i},s){return r(this,void 0,void 0,(function*(){return this.fhirRequest(`/${t}/${e}`,"PATCH")(i,Object.assign(Object.assign({},s),{contentType:"application/json-patch+json",ifMatch:(null==s?void 0:s.optimisticLockingVersionId)?`W/"${s.optimisticLockingVersionId}"`:void 0}))}))}function C({resourceType:t,id:e},i){return r(this,void 0,void 0,(function*(){return this.fhirRequest(`/${t}/${e}`,"DELETE")({},i)}))}function _({resourceType:t,id:e,versionId:i},s){return r(this,void 0,void 0,(function*(){return this.fhirRequest(`/${t}/${e}/_history${i?`/${i}`:""}`,"GET")({},s)}))}function L(t){const{method:e,url:i}=t,s={request:{method:e,url:i}};if(i.split("?").length>1){const[t,e]=i.split("?"),r=e.split("&").map((t=>{const[e,i]=t.split("=");return{name:e,value:i}})).reduce(((t,{name:e,value:i})=>e?(t[e]||(t[e]=[]),t[e].push(i),t):t),{}),n=new URLSearchParams;d(r,n),s.request.url=`${t}?${n.toString()}`}if(["GET","DELETE","HEAD"].includes(e))return s;if("PUT"===e){const{resource:e}=t;return Object.assign(Object.assign({},s),{resource:e})}if("PATCH"===e)return"resource"in t?Object.assign(Object.assign({},s),{resource:t.resource}):Object.assign(Object.assign({},s),{resource:{resourceType:"Binary",contentType:"application/json-patch+json",data:Buffer.from(JSON.stringify(t.operations),"utf8").toString("base64")}});if("POST"===e){const{resource:e,fullUrl:i}=t;return Object.assign(Object.assign({},s),{resource:e,fullUrl:i})}throw new Error("Unrecognized method")}function M(t){return function(e,i){return r(this,void 0,void 0,(function*(){return this.fhirRequest("/","POST")({resourceType:"Bundle",type:t,entry:e.requests.map(L)},i)}))}}O=new WeakSet,T=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.faxApiUrl)&&void 0!==e?e:"https://fax-api.zapehr.com/v1"};const D=M("batch"),V=M("transaction");function F(t,e){const i=[];if(t.line&&i.push(...t.line),t.city||t.state||t.postalCode){const e=[];t.city&&e.push(t.city),t.state&&e.push(t.state),t.postalCode&&e.push(t.postalCode),i.push(e.join(", "))}return t.use&&((null==e?void 0:e.all)||(null==e?void 0:e.use))&&i.push("["+t.use+"]"),i.join((null==e?void 0:e.lineSeparator)||", ").trim()}function H(t,e){const i=[];return t.prefix&&!1!==(null==e?void 0:e.prefix)&&i.push(...t.prefix),t.given&&i.push(...t.given),t.family&&i.push(t.family),t.suffix&&!1!==(null==e?void 0:e.suffix)&&i.push(...t.suffix),t.use&&((null==e?void 0:e.all)||(null==e?void 0:e.use))&&i.push("["+t.use+"]"),i.join(" ").trim()}var B,G,J,X,Z,K,Q,Y,tt,et,it,st,rt,nt,ot,ut,ct,ht,at,dt,lt,pt,vt,mt,ft,bt,gt,yt,jt,qt,wt;class St extends c{constructor(t){super(t),B.add(this),this.search=P,this.create=N,this.get=I,this.update=W,this.patch=$,this.delete=C,this.history=_,this.batch=D,this.transaction=V,this.formatAddress=F,this.formatHumanName=H}}B=new WeakSet;class Ut extends c{constructor(t){super(t),G.add(this)}routeList(t){return this.request("/route","get",n(this,G,"m",J).bind(this))(t)}routeCreate(t,e){return this.request("/route","post",n(this,G,"m",J).bind(this))(t,e)}routeDelete(t,e){return this.request("/route/{routeGuid}","delete",n(this,G,"m",J).bind(this))(t,e)}orderableItemList(t,e){return this.request("/orderableItem","get",n(this,G,"m",J).bind(this))(t,e)}orderableItemQuestionnaireGet(t,e){return this.request("/canonical-questionnaire/lab/{labGuid}/compendium/{compendiumVersion}/item/{itemCode}/questionnaire","get",n(this,G,"m",J).bind(this))(t,e)}orderSubmit(t,e){return this.request("/submit","post",n(this,G,"m",J).bind(this))(t,e)}}G=new WeakSet,J=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.labApiUrl)&&void 0!==e?e:"https://labs-api.zapehr.com/v1"};class kt extends c{constructor(t){super(t),X.add(this)}list(t){return this.request("/m2m","get",n(this,X,"m",Z).bind(this))(t)}create(t,e){return this.request("/m2m","post",n(this,X,"m",Z).bind(this))(t,e)}get(t,e){return this.request("/m2m/{id}","get",n(this,X,"m",Z).bind(this))(t,e)}update(t,e){return this.request("/m2m/{id}","patch",n(this,X,"m",Z).bind(this))(t,e)}delete(t,e){return this.request("/m2m/{id}","delete",n(this,X,"m",Z).bind(this))(t,e)}rotateSecret(t,e){return this.request("/m2m/{id}/rotate-secret","post",n(this,X,"m",Z).bind(this))(t,e)}listV2(t,e){return this.request("/m2m/v2/list","get",n(this,X,"m",Z).bind(this))(t,e)}}X=new WeakSet,Z=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class xt extends c{constructor(t){super(t),K.add(this)}getMessagingConfig(t){return this.request("/messaging/config","get",n(this,K,"m",Q).bind(this))(t)}}K=new WeakSet,Q=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class Ot extends c{constructor(t){super(t),Y.add(this)}setUp(t,e){return this.request("/payment/payment-method/setup","post",n(this,Y,"m",tt).bind(this))(t,e)}setDefault(t,e){return this.request("/payment/payment-method/set-default","post",n(this,Y,"m",tt).bind(this))(t,e)}delete(t,e){return this.request("/payment/payment-method","delete",n(this,Y,"m",tt).bind(this))(t,e)}list(t,e){return this.request("/payment/payment-method/list","post",n(this,Y,"m",tt).bind(this))(t,e)}}Y=new WeakSet,tt=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class Tt extends c{constructor(t){super(t),et.add(this)}get(t){return this.request("/project","get",n(this,et,"m",it).bind(this))(t)}update(t,e){return this.request("/project","patch",n(this,et,"m",it).bind(this))(t,e)}}et=new WeakSet,it=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class Et extends c{constructor(t){super(t),st.add(this)}eligibilityCheck(t,e){return this.request("/rcm/eligibility-check","post",n(this,st,"m",rt).bind(this))(t,e)}validateProfessionalClaim(t,e){return this.request("/rcm/professional-claim/validate","post",n(this,st,"m",rt).bind(this))(t,e)}submitProfessionalClaim(t,e){return this.request("/rcm/professional-claim/submit","post",n(this,st,"m",rt).bind(this))(t,e)}}st=new WeakSet,rt=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class zt extends c{constructor(t){super(t),nt.add(this)}list(t){return this.request("/iam/role","get",n(this,nt,"m",ot).bind(this))(t)}create(t,e){return this.request("/iam/role","post",n(this,nt,"m",ot).bind(this))(t,e)}get(t,e){return this.request("/iam/role/{roleId}","get",n(this,nt,"m",ot).bind(this))(t,e)}update(t,e){return this.request("/iam/role/{roleId}","patch",n(this,nt,"m",ot).bind(this))(t,e)}delete(t,e){return this.request("/iam/role/{roleId}","delete",n(this,nt,"m",ot).bind(this))(t,e)}}nt=new WeakSet,ot=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class At extends c{constructor(t){super(t),ut.add(this)}list(t){return this.request("/secret","get",n(this,ut,"m",ct).bind(this))(t)}set(t,e){return this.request("/secret","post",n(this,ut,"m",ct).bind(this))(t,e)}get(t,e){return this.request("/secret/{name}","get",n(this,ut,"m",ct).bind(this))(t,e)}delete(t,e){return this.request("/secret/{name}","delete",n(this,ut,"m",ct).bind(this))(t,e)}}ut=new WeakSet,ct=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class Rt extends c{constructor(t){super(t),ht.add(this)}createMeeting(t,e){return this.request("/telemed/v2/meeting","post",n(this,ht,"m",at).bind(this))(t,e)}joinMeeting(t,e){return this.request("/telemed/v2/meeting/{encounterId}/join","get",n(this,ht,"m",at).bind(this))(t,e)}}ht=new WeakSet,at=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class Pt extends c{constructor(t){super(t),dt.add(this)}send(t,e){return this.request("/messaging/transactional-sms/send","post",n(this,dt,"m",lt).bind(this))(t,e)}}dt=new WeakSet,lt=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class Nt extends c{constructor(t){super(t),pt.add(this)}me(t){return this.request("/user/me","get",n(this,pt,"m",vt).bind(this))(t)}get(t,e){return this.request("/user/{id}","get",n(this,pt,"m",vt).bind(this))(t,e)}update(t,e){return this.request("/user/{id}","patch",n(this,pt,"m",vt).bind(this))(t,e)}delete(t,e){return this.request("/user/{id}","delete",n(this,pt,"m",vt).bind(this))(t,e)}invite(t,e){return this.request("/user/invite","post",n(this,pt,"m",vt).bind(this))(t,e)}list(t){return this.request("/user","get",n(this,pt,"m",vt).bind(this))(t)}listV2(t,e){return this.request("/user/v2/list","get",n(this,pt,"m",vt).bind(this))(t,e)}}pt=new WeakSet,vt=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class It extends c{constructor(t){super(t),mt.add(this)}get(t){return this.request("/version","get",n(this,mt,"m",ft).bind(this))(t)}}function Wt(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"}function $t({bucketName:t,"objectPath+":e,file:i}){return r(this,void 0,void 0,(function*(){const s=yield this.request("/z3/{bucketName}/{objectPath+}","post",Wt.bind(this))({action:"upload",bucketName:t,"objectPath+":e});yield fetch(s.signedUrl,{method:"PUT",body:i})}))}function Ct({bucketName:t,"objectPath+":e}){return r(this,void 0,void 0,(function*(){const i=yield this.request("/z3/{bucketName}/{objectPath+}","post",Wt.bind(this))({action:"download",bucketName:t,"objectPath+":e}),s=yield fetch(i.signedUrl,{method:"GET"});if(!s.ok)throw new Error("Failed to download file");return s.arrayBuffer()}))}function _t(t){var i,s;return r(this,void 0,void 0,(function*(){let r,n;const o=new URL(t.url);if("z3:"===o.protocol){const t=o.pathname.split("/").slice(1);r=o.hostname,n=t.join("/")}else{if(!o.href.startsWith(null!==(s=null===(i=this.config.services)||void 0===i?void 0:i.projectApiUrl)&&void 0!==s?s:"https://project-api.zapehr.com/v1"))throw new e({message:"Invalid Z3 URL",code:400});{const t=o.pathname.split("/").slice(3);r=t[0],n=t.slice(1).join("/")}}const u={action:"upload",bucketName:r,"objectPath+":n};return this.request("/z3/{bucketName}/{objectPath+}","post",Wt.bind(this))(u)}))}mt=new WeakSet,ft=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class Lt extends c{constructor(t){super(t),bt.add(this),this.uploadFile=$t,this.downloadFile=Ct,this.getPresignedUrlForZ3Url=_t}listBuckets(t){return this.request("/z3","get",n(this,bt,"m",gt).bind(this))(t)}createBucket(t,e){return this.request("/z3/{bucketName}","put",n(this,bt,"m",gt).bind(this))(t,e)}deleteBucket(t,e){return this.request("/z3/{bucketName}","delete",n(this,bt,"m",gt).bind(this))(t,e)}listObjects(t,e){return this.request("/z3/{bucketName}/{objectPath+}","get",n(this,bt,"m",gt).bind(this))(t,e)}getPresignedUrl(t,e){return this.request("/z3/{bucketName}/{objectPath+}","post",n(this,bt,"m",gt).bind(this))(t,e)}deleteObject(t,e){return this.request("/z3/{bucketName}/{objectPath+}","delete",n(this,bt,"m",gt).bind(this))(t,e)}}function Mt(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"}function Dt({id:t,file:e,filename:i}){return r(this,void 0,void 0,(function*(){const s=yield this.request("/zambda/{id}/s3-upload","post",Mt.bind(this))({id:t,filename:i});yield fetch(s.signedUrl,{method:"PUT",body:e})}))}bt=new WeakSet,gt=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class Vt extends c{constructor(t){super(t),yt.add(this),this.uploadFile=Dt}list(t){return this.request("/zambda","get",n(this,yt,"m",jt).bind(this))(t)}create(t,e){return this.request("/zambda","post",n(this,yt,"m",jt).bind(this))(t,e)}get(t,e){return this.request("/zambda/{id}","get",n(this,yt,"m",jt).bind(this))(t,e)}update(t,e){return this.request("/zambda/{id}","patch",n(this,yt,"m",jt).bind(this))(t,e)}delete(t,e){return this.request("/zambda/{id}","delete",n(this,yt,"m",jt).bind(this))(t,e)}execute(t,e){return this.request("/zambda/{id}/execute","post",n(this,yt,"m",jt).bind(this))(t,e)}executePublic(t,e){return this.request("/zambda/{id}/execute-public","post",n(this,yt,"m",jt).bind(this))(t,e)}s3Upload(t,e){return this.request("/zambda/{id}/s3-upload","post",n(this,yt,"m",jt).bind(this))(t,e)}}yt=new WeakSet,jt=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};class Ft extends c{constructor(t){super(t),qt.add(this)}list(t,e){return this.request("/zambda/{id}/logStream","post",n(this,qt,"m",wt).bind(this))(t,e)}search(t,e){return this.request("/zambda/{id}/logStream/search","post",n(this,qt,"m",wt).bind(this))(t,e)}get(t,e){return this.request("/zambda/{id}/logStream/{logStreamName}","post",n(this,qt,"m",wt).bind(this))(t,e)}}qt=new WeakSet,wt=function(){var t,e;return null!==(e=null===(t=this.config.services)||void 0===t?void 0:t.projectApiUrl)&&void 0!==e?e:"https://project-api.zapehr.com/v1"};let Ht=class{constructor(t){var e,i,s,r,n,o;this.config=t,null!==(e=(r=this.config).services)&&void 0!==e||(r.services={}),null!==(i=(n=this.config.services).projectApiUrl)&&void 0!==i||(n.projectApiUrl=t.projectApiUrl),null!==(s=(o=this.config.services).fhirApiUrl)&&void 0!==s||(o.fhirApiUrl=t.fhirApiUrl),this.application=new f(t),this.developer=new z(t),this.m2m=new kt(t),this.messaging=new xt(t),this.conversation=new E(t),this.transactionalSMS=new Pt(t),this.paymentMethod=new Ot(t),this.charge=new b(t),this.project=new Tt(t),this.rcm=new Et(t),this.erx=new A(t),this.role=new zt(t),this.secret=new At(t),this.telemed=new Rt(t),this.user=new Nt(t),this.version=new It(t),this.z3=new Lt(t),this.zambda=new Vt(t),this.zambdaLogStream=new Ft(t),this.fax=new R(t),this.lab=new Ut(t),this.fhir=new St(t)}};class Bt extends Ht{}Bt.OystehrFHIRError=s,Bt.OystehrSdkError=e;export{Bt as default};
|
|
2
2
|
//# sourceMappingURL=index.min.js.map
|