@oystehr/sdk 3.0.7 → 3.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/README.md +5 -5
  2. package/dist/cjs/index.cjs +273 -228
  3. package/dist/cjs/index.cjs.map +1 -1
  4. package/dist/cjs/index.min.cjs +1 -1
  5. package/dist/cjs/index.min.cjs.map +1 -1
  6. package/dist/cjs/resources/classes/application.d.ts +6 -6
  7. package/dist/cjs/resources/classes/charge.d.ts +1 -1
  8. package/dist/cjs/resources/classes/conversation.d.ts +6 -6
  9. package/dist/cjs/resources/classes/developer.d.ts +14 -7
  10. package/dist/cjs/resources/classes/erx.d.ts +9 -1
  11. package/dist/cjs/resources/classes/fax.d.ts +4 -4
  12. package/dist/cjs/resources/classes/fhir.d.ts +1 -1
  13. package/dist/cjs/resources/classes/m2m.d.ts +15 -8
  14. package/dist/cjs/resources/classes/messaging.d.ts +1 -1
  15. package/dist/cjs/resources/classes/paymentMethod.d.ts +1 -1
  16. package/dist/cjs/resources/classes/project.d.ts +10 -3
  17. package/dist/cjs/resources/classes/rcm.d.ts +4 -4
  18. package/dist/cjs/resources/classes/role.d.ts +6 -6
  19. package/dist/cjs/resources/classes/secret.d.ts +1 -1
  20. package/dist/cjs/resources/classes/telemed.d.ts +2 -2
  21. package/dist/cjs/resources/classes/transactionalSMS.d.ts +2 -2
  22. package/dist/cjs/resources/classes/user.d.ts +15 -8
  23. package/dist/cjs/resources/classes/version.d.ts +1 -1
  24. package/dist/cjs/resources/classes/z3.d.ts +7 -7
  25. package/dist/cjs/resources/classes/zambda.d.ts +9 -9
  26. package/dist/cjs/resources/classes/zambdaLogStream.d.ts +4 -4
  27. package/dist/cjs/resources/types/AccessPolicy.d.ts +8 -3
  28. package/dist/cjs/resources/types/ChargeIssueParams.d.ts +1 -1
  29. package/dist/cjs/resources/types/ChargeStatusParams.d.ts +1 -1
  30. package/dist/cjs/resources/types/DeveloperListV2Params.d.ts +2 -2
  31. package/dist/cjs/resources/types/FaxSendParams.d.ts +1 -1
  32. package/dist/cjs/resources/types/M2mListV2Params.d.ts +2 -2
  33. package/dist/cjs/resources/types/M2mRotateSecretResponse.d.ts +1 -1
  34. package/dist/cjs/resources/types/RcmEligibilityCheckParams.d.ts +1 -1
  35. package/dist/cjs/resources/types/RoleUpdateParams.d.ts +0 -4
  36. package/dist/cjs/resources/types/TelemedCreateMeetingParams.d.ts +1 -1
  37. package/dist/cjs/resources/types/UserListV2Params.d.ts +2 -2
  38. package/dist/cjs/resources/types/ZambdaCreateParams.d.ts +1 -1
  39. package/dist/cjs/resources/types/ZambdaFunction.d.ts +1 -1
  40. package/dist/cjs/resources/types/ZambdaUpdateParams.d.ts +2 -2
  41. package/dist/esm/index.min.js +1 -1
  42. package/dist/esm/index.min.js.map +1 -1
  43. package/dist/esm/resources/classes/application.d.ts +6 -6
  44. package/dist/esm/resources/classes/application.js +20 -17
  45. package/dist/esm/resources/classes/application.js.map +1 -1
  46. package/dist/esm/resources/classes/charge.d.ts +1 -1
  47. package/dist/esm/resources/classes/charge.js +9 -6
  48. package/dist/esm/resources/classes/charge.js.map +1 -1
  49. package/dist/esm/resources/classes/conversation.d.ts +6 -6
  50. package/dist/esm/resources/classes/conversation.js +17 -14
  51. package/dist/esm/resources/classes/conversation.js.map +1 -1
  52. package/dist/esm/resources/classes/developer.d.ts +14 -7
  53. package/dist/esm/resources/classes/developer.js +18 -15
  54. package/dist/esm/resources/classes/developer.js.map +1 -1
  55. package/dist/esm/resources/classes/erx.d.ts +9 -1
  56. package/dist/esm/resources/classes/erx.js +13 -10
  57. package/dist/esm/resources/classes/erx.js.map +1 -1
  58. package/dist/esm/resources/classes/fax.d.ts +4 -4
  59. package/dist/esm/resources/classes/fax.js +13 -10
  60. package/dist/esm/resources/classes/fax.js.map +1 -1
  61. package/dist/esm/resources/classes/fhir.d.ts +1 -1
  62. package/dist/esm/resources/classes/fhir.js +3 -4
  63. package/dist/esm/resources/classes/fhir.js.map +1 -1
  64. package/dist/esm/resources/classes/index.js +2 -2
  65. package/dist/esm/resources/classes/index.js.map +1 -1
  66. package/dist/esm/resources/classes/m2m.d.ts +15 -8
  67. package/dist/esm/resources/classes/m2m.js +20 -17
  68. package/dist/esm/resources/classes/m2m.js.map +1 -1
  69. package/dist/esm/resources/classes/messaging.d.ts +1 -1
  70. package/dist/esm/resources/classes/messaging.js +8 -5
  71. package/dist/esm/resources/classes/messaging.js.map +1 -1
  72. package/dist/esm/resources/classes/paymentMethod.d.ts +1 -1
  73. package/dist/esm/resources/classes/paymentMethod.js +11 -8
  74. package/dist/esm/resources/classes/paymentMethod.js.map +1 -1
  75. package/dist/esm/resources/classes/project.d.ts +10 -3
  76. package/dist/esm/resources/classes/project.js +10 -7
  77. package/dist/esm/resources/classes/project.js.map +1 -1
  78. package/dist/esm/resources/classes/rcm.d.ts +4 -4
  79. package/dist/esm/resources/classes/rcm.js +13 -10
  80. package/dist/esm/resources/classes/rcm.js.map +1 -1
  81. package/dist/esm/resources/classes/role.d.ts +6 -6
  82. package/dist/esm/resources/classes/role.js +17 -14
  83. package/dist/esm/resources/classes/role.js.map +1 -1
  84. package/dist/esm/resources/classes/secret.d.ts +1 -1
  85. package/dist/esm/resources/classes/secret.js +11 -8
  86. package/dist/esm/resources/classes/secret.js.map +1 -1
  87. package/dist/esm/resources/classes/telemed.d.ts +2 -2
  88. package/dist/esm/resources/classes/telemed.js +10 -7
  89. package/dist/esm/resources/classes/telemed.js.map +1 -1
  90. package/dist/esm/resources/classes/transactionalSMS.d.ts +2 -2
  91. package/dist/esm/resources/classes/transactionalSMS.js +9 -6
  92. package/dist/esm/resources/classes/transactionalSMS.js.map +1 -1
  93. package/dist/esm/resources/classes/user.d.ts +15 -8
  94. package/dist/esm/resources/classes/user.js +20 -17
  95. package/dist/esm/resources/classes/user.js.map +1 -1
  96. package/dist/esm/resources/classes/version.d.ts +1 -1
  97. package/dist/esm/resources/classes/version.js +8 -5
  98. package/dist/esm/resources/classes/version.js.map +1 -1
  99. package/dist/esm/resources/classes/z3.d.ts +7 -7
  100. package/dist/esm/resources/classes/z3.js +19 -16
  101. package/dist/esm/resources/classes/z3.js.map +1 -1
  102. package/dist/esm/resources/classes/zambda.d.ts +9 -9
  103. package/dist/esm/resources/classes/zambda.js +23 -20
  104. package/dist/esm/resources/classes/zambda.js.map +1 -1
  105. package/dist/esm/resources/classes/zambdaLogStream.d.ts +4 -4
  106. package/dist/esm/resources/classes/zambdaLogStream.js +13 -10
  107. package/dist/esm/resources/classes/zambdaLogStream.js.map +1 -1
  108. package/dist/esm/resources/types/AccessPolicy.d.ts +8 -3
  109. package/dist/esm/resources/types/ChargeIssueParams.d.ts +1 -1
  110. package/dist/esm/resources/types/ChargeStatusParams.d.ts +1 -1
  111. package/dist/esm/resources/types/DeveloperListV2Params.d.ts +2 -2
  112. package/dist/esm/resources/types/FaxSendParams.d.ts +1 -1
  113. package/dist/esm/resources/types/M2mListV2Params.d.ts +2 -2
  114. package/dist/esm/resources/types/M2mRotateSecretResponse.d.ts +1 -1
  115. package/dist/esm/resources/types/RcmEligibilityCheckParams.d.ts +1 -1
  116. package/dist/esm/resources/types/RoleUpdateParams.d.ts +0 -4
  117. package/dist/esm/resources/types/TelemedCreateMeetingParams.d.ts +1 -1
  118. package/dist/esm/resources/types/UserListV2Params.d.ts +2 -2
  119. package/dist/esm/resources/types/ZambdaCreateParams.d.ts +1 -1
  120. package/dist/esm/resources/types/ZambdaFunction.d.ts +1 -1
  121. package/dist/esm/resources/types/ZambdaUpdateParams.d.ts +2 -2
  122. package/package.json +1 -1
  123. package/src/resources/classes/application.ts +18 -14
  124. package/src/resources/classes/charge.ts +3 -3
  125. package/src/resources/classes/conversation.ts +11 -11
  126. package/src/resources/classes/developer.ts +30 -13
  127. package/src/resources/classes/erx.ts +29 -7
  128. package/src/resources/classes/fax.ts +7 -7
  129. package/src/resources/classes/fhir.ts +1 -1
  130. package/src/resources/classes/index.ts +2 -2
  131. package/src/resources/classes/m2m.ts +29 -15
  132. package/src/resources/classes/messaging.ts +2 -2
  133. package/src/resources/classes/paymentMethod.ts +5 -5
  134. package/src/resources/classes/project.ts +22 -5
  135. package/src/resources/classes/rcm.ts +7 -7
  136. package/src/resources/classes/role.ts +11 -11
  137. package/src/resources/classes/secret.ts +5 -5
  138. package/src/resources/classes/telemed.ts +8 -4
  139. package/src/resources/classes/transactionalSMS.ts +3 -3
  140. package/src/resources/classes/user.ts +32 -15
  141. package/src/resources/classes/version.ts +2 -2
  142. package/src/resources/classes/z3.ts +13 -13
  143. package/src/resources/classes/zambda.ts +17 -17
  144. package/src/resources/classes/zambdaLogStream.ts +7 -7
  145. package/src/resources/types/AccessPolicy.ts +12 -3
  146. package/src/resources/types/ChargeIssueParams.ts +1 -1
  147. package/src/resources/types/ChargeStatusParams.ts +1 -1
  148. package/src/resources/types/DeveloperListV2Params.ts +2 -2
  149. package/src/resources/types/FaxSendParams.ts +1 -1
  150. package/src/resources/types/M2mListV2Params.ts +2 -2
  151. package/src/resources/types/M2mRotateSecretResponse.ts +1 -1
  152. package/src/resources/types/RcmEligibilityCheckParams.ts +1 -1
  153. package/src/resources/types/RoleUpdateParams.ts +0 -4
  154. package/src/resources/types/TelemedCreateMeetingParams.ts +1 -1
  155. package/src/resources/types/UserListV2Params.ts +2 -2
  156. package/src/resources/types/ZambdaCreateParams.ts +1 -1
  157. package/src/resources/types/ZambdaFunction.ts +1 -1
  158. package/src/resources/types/ZambdaUpdateParams.ts +2 -2
  159. package/dist/esm/node_modules/tslib/package.json +0 -1
  160. package/dist/esm/node_modules/tslib/tslib.es6.js +0 -34
  161. package/dist/esm/node_modules/tslib/tslib.es6.js.map +0 -1
@@ -3,8 +3,8 @@ import { SDKResource } from '../../client/client';
3
3
  import { OystehrConfig } from '../../config';
4
4
  import * as ext from './z3-ext';
5
5
  export declare class Z3 extends SDKResource {
6
+ #private;
6
7
  constructor(config: OystehrConfig);
7
- baseUrlThunk(): string;
8
8
  /**
9
9
  * Uploads a file to the bucket and key. Files should be Blobs.
10
10
  * @param params upload file params
@@ -23,42 +23,42 @@ export declare class Z3 extends SDKResource {
23
23
  */
24
24
  getPresignedUrlForZ3Url: typeof ext.getPresignedUrlForZ3Url;
25
25
  /**
26
- * List all Z3 Buckets. [Z3](https://docs.oystehr.com/services/z3/) is Oystehr's built-in and fully integrated solution for file storage.
26
+ * List all Z3 Buckets. [Z3](https://docs.oystehr.com/oystehr/services/z3/) is Oystehr's built-in and fully integrated solution for file storage.
27
27
  *
28
28
  * Access Policy Action: `Z3:ListBuckets`
29
29
  * Access Policy Resource: `Z3:BucketName`
30
30
  */
31
31
  listBuckets(request?: OystehrClientRequest): Promise<Z3ListBucketsResponse>;
32
32
  /**
33
- * Create a Z3 Bucket with the provided name. [Z3](https://docs.oystehr.com/services/z3/) is Oystehr's built-in and fully integrated solution for file storage.
33
+ * Create a Z3 Bucket with the provided name. [Z3](https://docs.oystehr.com/oystehr/services/z3/) is Oystehr's built-in and fully integrated solution for file storage.
34
34
  *
35
35
  * Access Policy Action: `Z3:CreateBucket`
36
36
  * Access Policy Resource: `Z3:BucketName`
37
37
  */
38
38
  createBucket(params: Z3CreateBucketParams, request?: OystehrClientRequest): Promise<Z3CreateBucketResponse>;
39
39
  /**
40
- * Delete the Z3 Bucket with the provided name. [Z3](https://docs.oystehr.com/services/z3/) is Oystehr's built-in and fully integrated solution for file storage.
40
+ * Delete the Z3 Bucket with the provided name. [Z3](https://docs.oystehr.com/oystehr/services/z3/) is Oystehr's built-in and fully integrated solution for file storage.
41
41
  *
42
42
  * Access Policy Action: `Z3:DeleteBucket`
43
43
  * Access Policy Resource: `Z3:BucketName`
44
44
  */
45
45
  deleteBucket(params: Z3DeleteBucketParams, request?: OystehrClientRequest): Promise<void>;
46
46
  /**
47
- * List all Z3 Objects at the provided path in the Bucket with the provided name [Z3](https://docs.oystehr.com/services/z3/) is Oystehr's built-in and fully integrated solution for file storage.
47
+ * List all Z3 Objects at the provided path in the Bucket with the provided name [Z3](https://docs.oystehr.com/oystehr/services/z3/) is Oystehr's built-in and fully integrated solution for file storage.
48
48
  *
49
49
  * Access Policy Action: `Z3:ListObjects`
50
50
  * Access Policy Resource: `Z3:BucketName:ObjectPath`
51
51
  */
52
52
  listObjects(params: Z3ListObjectsParams, request?: OystehrClientRequest): Promise<Z3ListObjectsResponse>;
53
53
  /**
54
- * Get a link for downloading or uploading a Z3 Object to the provided path in the Bucket with the provided name. [Z3](https://docs.oystehr.com/services/z3/) is Oystehr's built-in and fully integrated solution for file storage.
54
+ * Get a link for downloading or uploading a Z3 Object to the provided path in the Bucket with the provided name. [Z3](https://docs.oystehr.com/oystehr/services/z3/) is Oystehr's built-in and fully integrated solution for file storage.
55
55
  *
56
56
  * Access Policy Action: `Z3:PutObject` or `Z3:GetObject`
57
57
  * Access Policy Resource: `Z3:BucketName:ObjectPath`
58
58
  */
59
59
  getPresignedUrl(params: Z3GetPresignedUrlParams, request?: OystehrClientRequest): Promise<Z3GetPresignedUrlResponse>;
60
60
  /**
61
- * Delete the Z3 Object at the provided path in the Bucket with the provided name. [Z3](https://docs.oystehr.com/services/z3/) is Oystehr's built-in and fully integrated solution for file storage.
61
+ * Delete the Z3 Object at the provided path in the Bucket with the provided name. [Z3](https://docs.oystehr.com/oystehr/services/z3/) is Oystehr's built-in and fully integrated solution for file storage.
62
62
  *
63
63
  * Access Policy Action: `Z3:DeleteObject`
64
64
  * Access Policy Resource: `Z3:BucketName:ObjectPath`
@@ -3,59 +3,59 @@ import { SDKResource } from '../../client/client';
3
3
  import { OystehrConfig } from '../../config';
4
4
  import * as ext from './zambda-ext';
5
5
  export declare class Zambda extends SDKResource {
6
+ #private;
6
7
  constructor(config: OystehrConfig);
7
- baseUrlThunk(): string;
8
8
  uploadFile: typeof ext.uploadFile;
9
9
  /**
10
- * Get a list of all Zambda Functions in the Project. [Zambdas](https://docs.oystehr.com/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services.
10
+ * Get a list of all Zambda Functions in the Project. [Zambdas](https://docs.oystehr.com/oystehr/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services.
11
11
  *
12
12
  * Access Policy Action: `Zambda:ListAllFunctions`
13
13
  * Access Policy Resource: `Zambda:Function`
14
14
  */
15
15
  list(request?: OystehrClientRequest): Promise<ZambdaListResponse>;
16
16
  /**
17
- * Create a new Zambda Function. [Zambdas](https://docs.oystehr.com/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services.
17
+ * Create a new Zambda Function. [Zambdas](https://docs.oystehr.com/oystehr/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services.
18
18
  *
19
19
  * Access Policy Action: `Zambda:CreateFunction`
20
20
  * Access Policy Resource: `Zambda:Function`
21
21
  */
22
22
  create(params: ZambdaCreateParams, request?: OystehrClientRequest): Promise<ZambdaCreateResponse>;
23
23
  /**
24
- * Get the Zambda Function with the provided ID or name. [Zambdas](https://docs.oystehr.com/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services.
24
+ * Get the Zambda Function with the provided ID or name. [Zambdas](https://docs.oystehr.com/oystehr/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services.
25
25
  *
26
26
  * Access Policy Action: `Zambda:GetFunction`
27
27
  * Access Policy Resource: `Zambda:Function`
28
28
  */
29
29
  get(params: ZambdaGetParams, request?: OystehrClientRequest): Promise<ZambdaGetResponse>;
30
30
  /**
31
- * Update the Zambda Function with the provided ID or name. [Zambdas](https://docs.oystehr.com/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services.
31
+ * Update the Zambda Function with the provided ID or name. [Zambdas](https://docs.oystehr.com/oystehr/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services.
32
32
  *
33
33
  * Access Policy Action: `Zambda:UpdateFunction`
34
34
  * Access Policy Resource: `Zambda:Function`
35
35
  */
36
36
  update(params: ZambdaUpdateParams, request?: OystehrClientRequest): Promise<ZambdaUpdateResponse>;
37
37
  /**
38
- * Delete the Zambda Function with the provided ID or name. [Zambdas](https://docs.oystehr.com/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services.
38
+ * Delete the Zambda Function with the provided ID or name. [Zambdas](https://docs.oystehr.com/oystehr/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services.
39
39
  *
40
40
  * Access Policy Action: `Zambda:DeleteFunction`
41
41
  * Access Policy Resource: `Zambda:Function`
42
42
  */
43
43
  delete(params: ZambdaDeleteParams, request?: OystehrClientRequest): Promise<void>;
44
44
  /**
45
- * Execute the [Authenticated Zambda Function](https://docs.oystehr.com/services/zambda/types/authenticated/) with the provided ID. [Zambdas](https://docs.oystehr.com/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services.
45
+ * Execute the [Authenticated Zambda Function](https://docs.oystehr.com/oystehr/services/zambda/types/authenticated/) with the provided ID. [Zambdas](https://docs.oystehr.com/oystehr/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services.
46
46
  *
47
47
  * Access Policy Action: `Zambda:InvokeFunction`
48
48
  * Access Policy Resource: `Zambda:Function`
49
49
  */
50
50
  execute(params: ZambdaExecuteParams, request?: OystehrClientRequest): Promise<ZambdaExecuteResponse>;
51
51
  /**
52
- * Execute the [Public Zambda Function](https://docs.oystehr.com/services/zambda/types/public/) with the provided ID. [Zambdas](https://docs.oystehr.com/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services.
52
+ * Execute the [Public Zambda Function](https://docs.oystehr.com/oystehr/services/zambda/types/public/) with the provided ID. [Zambdas](https://docs.oystehr.com/oystehr/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services.
53
53
  *
54
54
  * Execute a zambda that has method http_open. This endpoint is public so there are no access policy requirements.
55
55
  */
56
56
  executePublic(params: ZambdaExecutePublicParams, request?: OystehrClientRequest): Promise<ZambdaExecutePublicResponse>;
57
57
  /**
58
- * Returns a URL that is used to deploy code to the Zambda Function with the provided ID. [Zambdas](https://docs.oystehr.com/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services.
58
+ * Returns a URL that is used to deploy code to the Zambda Function with the provided ID. [Zambdas](https://docs.oystehr.com/oystehr/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services.
59
59
  *
60
60
  * Access Policy Action: `Zambda:UpdateFunction`
61
61
  * Access Policy Resource: `Zambda:Function`
@@ -2,24 +2,24 @@ import { OystehrClientRequest, ZambdaLogStreamGetParams, ZambdaLogStreamGetRespo
2
2
  import { SDKResource } from '../../client/client';
3
3
  import { OystehrConfig } from '../../config';
4
4
  export declare class ZambdaLogStream extends SDKResource {
5
+ #private;
5
6
  constructor(config: OystehrConfig);
6
- baseUrlThunk(): string;
7
7
  /**
8
- * Get the log streams for the Zambda Function with the provided ID. [Zambdas](https://docs.oystehr.com/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services.
8
+ * Get the log streams for the Zambda Function with the provided ID. [Zambdas](https://docs.oystehr.com/oystehr/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services.
9
9
  *
10
10
  * Access Policy Action: `Zambda:ReadLogs`
11
11
  * Access Policy Resource: `Zambda:Function`
12
12
  */
13
13
  list(params: ZambdaLogStreamListParams, request?: OystehrClientRequest): Promise<ZambdaLogStreamListResponse>;
14
14
  /**
15
- * Get all logs for the Zambda Function with the provided ID, filtered by any of: text in messages, minimum start date, and/or maximum end date. [Zambdas](https://docs.oystehr.com/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services.
15
+ * Get all logs for the Zambda Function with the provided ID, filtered by any of: text in messages, minimum start date, and/or maximum end date. [Zambdas](https://docs.oystehr.com/oystehr/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services.
16
16
  *
17
17
  * Access Policy Action: `Zambda:ReadLogs`
18
18
  * Access Policy Resource: `Zambda:Function`
19
19
  */
20
20
  search(params: ZambdaLogStreamSearchParams, request?: OystehrClientRequest): Promise<ZambdaLogStreamSearchResponse>;
21
21
  /**
22
- * Get the logs from the specified log stream for the Zambda Function with the provided ID. [Zambdas](https://docs.oystehr.com/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services.
22
+ * Get the logs from the specified log stream for the Zambda Function with the provided ID. [Zambdas](https://docs.oystehr.com/oystehr/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services.
23
23
  *
24
24
  * Access Policy Action: `Zambda:ReadLogs`
25
25
  * Access Policy Resource: `Zambda:Function`
@@ -1,7 +1,12 @@
1
1
  export interface AccessPolicy {
2
2
  rule: {
3
- resource?: string[];
4
- action?: string[];
5
- effect?: 'Allow' | 'Deny';
3
+ resource: string | string[];
4
+ action: string | string[];
5
+ effect: 'Allow' | 'Deny';
6
+ condition?: {
7
+ [k: string]: any;
8
+ } | {
9
+ [k: string]: any;
10
+ }[] | string | string[];
6
11
  }[];
7
12
  }
@@ -2,5 +2,5 @@ export interface ChargeIssueParams {
2
2
  /**
3
3
  * An ID reference to a FHIR Encounter resource in the format: `some-uuid`.
4
4
  */
5
- encounterId?: string;
5
+ encounterId: string;
6
6
  }
@@ -2,5 +2,5 @@ export interface ChargeStatusParams {
2
2
  /**
3
3
  * An ID reference to a FHIR Encounter resource in the format: `some-uuid`.
4
4
  */
5
- encounterId?: string;
5
+ encounterId: string;
6
6
  }
@@ -6,6 +6,6 @@ export interface DeveloperListV2Params {
6
6
  roleId?: string;
7
7
  cursor?: string;
8
8
  limit?: number;
9
- sort?: string;
10
- sortOrder?: string;
9
+ sort?: 'id' | 'name' | 'email' | 'phoneNumber' | 'createdAt';
10
+ sortOrder?: 'asc' | 'desc';
11
11
  }
@@ -12,7 +12,7 @@ export interface FaxSendParams {
12
12
  */
13
13
  recipient: string;
14
14
  /**
15
- * The sender of the fax. This must be a valid FHIR HealthcareService, Organization, Patient, Practitioner, PractitionerRole, or RelatedPerson relative reference in the format: `the-resource-type/some-valid-uuid`. This reference must be a valid resource and have your [onboarded fax number](https://docs.oystehr.com/services/fax/number/) in the `telecom` field with a `system` of `fax`.
15
+ * The sender of the fax. This must be a valid FHIR HealthcareService, Organization, Patient, Practitioner, PractitionerRole, or RelatedPerson relative reference in the format: `the-resource-type/some-valid-uuid`. This reference must be a valid resource and have your [onboarded fax number](https://docs.oystehr.com/oystehr/services/fax/number/) in the `telecom` field with a `system` of `fax`.
16
16
  */
17
17
  sender: string;
18
18
  }
@@ -5,6 +5,6 @@ export interface M2mListV2Params {
5
5
  roleId?: string;
6
6
  cursor?: string;
7
7
  limit?: number;
8
- sort?: string;
9
- sortOrder?: string;
8
+ sort?: 'id' | 'name' | 'email' | 'phoneNumber' | 'createdAt';
9
+ sortOrder?: 'asc' | 'desc';
10
10
  }
@@ -2,5 +2,5 @@
2
2
  * M2M Client secret rotated
3
3
  */
4
4
  export interface M2mRotateSecretResponse {
5
- secret?: string;
5
+ secret: string;
6
6
  }
@@ -2,5 +2,5 @@ export interface RcmEligibilityCheckParams {
2
2
  /**
3
3
  * Identifier of the CoverageEligibilityRequest that the eligibility check will reference.
4
4
  */
5
- eligibilityRequestId?: string;
5
+ eligibilityRequestId: string;
6
6
  }
@@ -1,9 +1,5 @@
1
1
  import { AccessPolicy } from './AccessPolicy';
2
2
  export interface RoleUpdateParams {
3
- /**
4
- * The unique id of the role
5
- */
6
- id?: string;
7
3
  /**
8
4
  * The name of the role.
9
5
  */
@@ -3,5 +3,5 @@ export interface TelemedCreateMeetingParams {
3
3
  /**
4
4
  * Well formed Encounter with the https://extensions.fhir.oystehr.com/encounter-other-participants extension specified optionally.
5
5
  */
6
- encounter?: Encounter;
6
+ encounter: Encounter;
7
7
  }
@@ -6,6 +6,6 @@ export interface UserListV2Params {
6
6
  roleId?: string;
7
7
  cursor?: string;
8
8
  limit?: number;
9
- sort?: string;
10
- sortOrder?: string;
9
+ sort?: 'id' | 'name' | 'email' | 'phoneNumber' | 'createdAt';
10
+ sortOrder?: 'asc' | 'desc';
11
11
  }
@@ -5,7 +5,7 @@ export interface ZambdaCreateParams {
5
5
  */
6
6
  name: string;
7
7
  /**
8
- * The trigger method for the Zambda Function determines how the Function is invoked. Learn more about the different types here, https://docs.oystehr.com/services/zambda/#types-of-zambdas.
8
+ * The trigger method for the Zambda Function determines how the Function is invoked. Learn more about the different types here, https://docs.oystehr.com/oystehr/services/zambda/#types-of-zambdas.
9
9
  */
10
10
  triggerMethod?: 'http_auth' | 'http_open' | 'subscription' | 'cron';
11
11
  schedule?: ZambdaSchedule;
@@ -14,7 +14,7 @@ export interface ZambdaFunction {
14
14
  */
15
15
  status: 'Draft' | 'Pending' | 'Active' | 'Failed' | 'Inactive' | 'Validating';
16
16
  /**
17
- * The trigger method for the Zambda Function determines how the Function is invoked. Learn more about the different types here, https://docs.oystehr.com/services/zambda/#types-of-zambdas.
17
+ * The trigger method for the Zambda Function determines how the Function is invoked. Learn more about the different types here, https://docs.oystehr.com/oystehr/services/zambda/#types-of-zambdas.
18
18
  */
19
19
  triggerMethod: 'http_auth' | 'http_open' | 'subscription' | 'cron';
20
20
  schedule?: ZambdaSchedule;
@@ -5,13 +5,13 @@ export interface ZambdaUpdateParams {
5
5
  */
6
6
  name?: string;
7
7
  /**
8
- * The trigger method for the Zambda Function determines how the Function is invoked. Learn more about the different types here, https://docs.oystehr.com/services/zambda/#types-of-zambdas.
8
+ * The trigger method for the Zambda Function determines how the Function is invoked. Learn more about the different types here, https://docs.oystehr.com/oystehr/services/zambda/#types-of-zambdas.
9
9
  */
10
10
  triggerMethod?: 'http_auth' | 'http_open' | 'subscription' | 'cron';
11
11
  schedule?: ZambdaSchedule;
12
12
  /**
13
13
  * The runtime to use for the Zambda Function. This property is optional and defaults to "nodejs20.x".
14
14
  */
15
- runtime?: 'nodejs18.x' | 'nodejs20.x';
15
+ runtime?: 'nodejs18.x' | 'nodejs20.x' | 'nodejs22.x';
16
16
  id: string;
17
17
  }
@@ -1,2 +1,2 @@
1
- import{v4 as e}from"uuid";class t extends Error{constructor({message:e,code:s,cause:i}){super(e,{cause:i}),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){var t;const s=[];for(const i of null!==(t=e.issue)&&void 0!==t?t:[])i.details&&i.details.text&&s.push(i.details.text);return s.length||s.push("Unknown FHIR error"),s.join(",")}class i extends t{constructor({error:e,code:t}){super({message:s(e),code:t}),Object.setPrototypeOf(this,i.prototype),this.cause=e,this.name="OystehrFHIRError"}toJSON(){return{name:this.name,message:this.message,code:this.code,cause:this.cause}}}function r(e,t,s,i){return new(s||(s=Promise))((function(r,n){function o(e){try{h(i.next(e))}catch(e){n(e)}}function u(e){try{h(i.throw(e))}catch(e){n(e)}}function h(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,u)}h((i=i.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const n=[408,429,500,502,503,504],o=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT","UND_ERR_CONNECT_TIMEOUT","UND_ERR_HEADERS_TIMEOUT","UND_ERR_HEADERS_TIMEOUT","UND_ERR_SOCKET"];class u{constructor(e){this.config=e}request(e,s,i){return(n,o)=>r(this,void 0,void 0,(function*(){const r=()=>this.config;try{return yield a(i,r,e,s)(n,o)}catch(e){const s=e;throw new t({message:s.message,code:s.code,cause:s.cause})}}))}fhirRequest(e,s){return(n,o)=>r(this,void 0,void 0,(function*(){try{const t=()=>{var e,t;return null!==(t=null===(e=this.config.services)||void 0===e?void 0:e.fhirApiUrl)&&void 0!==t?t:"https://fhir-api.zapehr.com"},i=()=>this.config;return yield a(t,i,e,s)(n,o)}catch(e){const s=e;if("string"==typeof s.message)throw new t({message:s.message,code:s.code,cause:s.cause});throw new i({error:s.message,code:s.code})}}))}}function h(e){return"accessToken"in e}function a(s,i,u,a){return(l,d)=>r(this,void 0,void 0,(function*(){var p,v,b,m,f,g,U,T,k,y,j,q,O,x,w;const z=l&&!d&&!Array.isArray(l)&&h(l)?{}:null!==(p=l)&&void 0!==p?p:{},E=l&&!d&&!Array.isArray(l)&&h(l)?l:d,A=a.toLowerCase(),S=i(),R=null!==(v=S.fetch)&&void 0!==v?v:fetch,N=null!==(b=null==E?void 0:E.accessToken)&&void 0!==b?b:S.accessToken,P=null!==(m=null==E?void 0:E.projectId)&&void 0!==m?m:i().projectId;let I=u,$=z;if(!Array.isArray(z)){const[e,s]=function(e,s){const i=Object.assign({},s),r=e.replace(/\{([^}]+)\}/g,((e,r)=>{if(delete i[r],r.match(/^.*\+$/))return s[r]+"";if(!s[r]||""===s[r])throw new t({message:`Required path parameter is an empty string: ${r}`,code:400});return s[r]?encodeURIComponent(s[r]+""):""})),n=Object.keys(i),o=n.length?n.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:i[t]})),{}):{};return[r,o]}(u,z);I=e,$=s}I=I.replace(/^\//,"");const C=s(),_=C.endsWith("/")?C:C+"/",L=new URL(I,_);let M;if(Array.isArray($))M=JSON.stringify($);else if(Object.keys($).length)if("get"===A)c($,L.searchParams);else if("application/x-www-form-urlencoded"===(null==E?void 0:E.contentType)){const e=new URLSearchParams;c($,e),M=e.toString()}else M=JSON.stringify($);else"application/x-www-form-urlencoded"!==(null==E?void 0:E.contentType)&&"post"===A&&(M="{}");const D=Object.assign(P?{"x-zapehr-project-id":P,"x-oystehr-project-id":P}:{},{"content-type":null!==(f=null==E?void 0:E.contentType)&&void 0!==f?f:"application/json"},N?{Authorization:`Bearer ${N}`}:{},(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:e()}),V={retries:null!==(T=null===(U=S.retry)||void 0===U?void 0:U.retries)&&void 0!==T?T:3,jitter:null!==(y=null===(k=S.retry)||void 0===k?void 0:k.jitter)&&void 0!==y?y:20,delay:null!==(q=null===(j=S.retry)||void 0===j?void 0:j.delay)&&void 0!==q?q:100,onRetry:null===(O=S.retry)||void 0===O?void 0:O.onRetry,retryOn:[...null!==(w=null===(x=S.retry)||void 0===x?void 0:x.retryOn)&&void 0!==w?w:[],...n]};return V.retryOn.push(...n),function(e,t){var s,i;return r(this,void 0,void 0,(function*(){let r;for(const n of Array.from({length:(null!==(s=t.retries)&&void 0!==s?s:0)+1},((e,t)=>t)))try{return yield e(n)}catch(e){let s=!1;if("response"in e){const i=e;s=t.retryOn.includes(i.code),r={message:e.message,code:e.code}}else if(r=e,"code"in e&&"string"==typeof e.code){const t=e;s=o.includes(t.code)}if(!s)break;const u=Math.floor(Math.random()*(t.jitter+1));yield new Promise((e=>setTimeout(e,t.delay+u))),t.onRetry&&n!==(null!==(i=t.retries)&&void 0!==i?i:0)&&t.onRetry(n+1)}throw r}))}((()=>r(this,void 0,void 0,(function*(){var e,t,s,i,r,n;const o=yield R(new Request(L,{method:A.toUpperCase(),body:M,headers:D})),u=o.body?yield o.text():null;let h;try{h=u&&((null===(e=o.headers.get("content-type"))||void 0===e?void 0:e.includes("application/json"))||(null===(t=o.headers.get("content-type"))||void 0===t?void 0:t.includes("application/fhir+json")))?JSON.parse(u):null}catch(e){h=null}if(!o.ok||o.status>=400){throw{message:null!==(r=null!==(i=null!==(s=null==h?void 0:h.message)&&void 0!==s?s:h)&&void 0!==i?i:u)&&void 0!==r?r:o.statusText,code:null!==(n=null==h?void 0:h.code)&&void 0!==n?n:o.status,response:o}}return h}))),V)}))}function c(e,t){for(const[s,i]of Object.entries(e))Array.isArray(i)?i.forEach((e=>t.append(s,e))):t.append(s,i)}class l extends u{constructor(e){super(e)}baseUrlThunk(){var e,t;return null!==(t=null===(e=this.config.services)||void 0===e?void 0:e.projectApiUrl)&&void 0!==t?t:"https://project-api.zapehr.com/v1"}list(e){return this.request("/application","get",this.baseUrlThunk.bind(this))(e)}create(e,t){return this.request("/application","post",this.baseUrlThunk.bind(this))(e,t)}get(e,t){return this.request("/application/{id}","get",this.baseUrlThunk.bind(this))(e,t)}update(e,t){return this.request("/application/{id}","patch",this.baseUrlThunk.bind(this))(e,t)}delete(e,t){return this.request("/application/{id}","delete",this.baseUrlThunk.bind(this))(e,t)}rotateSecret(e,t){return this.request("/application/{id}/rotate-secret","post",this.baseUrlThunk.bind(this))(e,t)}revokeRefreshToken(e,t){return this.request("/application/{id}/revoke-refresh-token","post",this.baseUrlThunk.bind(this))(e,t)}revokeAccessToken(e,t){return this.request("/application/{id}/revoke-access-token","post",this.baseUrlThunk.bind(this))(e,t)}}class d extends u{constructor(e){super(e)}baseUrlThunk(){var e,t;return null!==(t=null===(e=this.config.services)||void 0===e?void 0:e.projectApiUrl)&&void 0!==t?t:"https://project-api.zapehr.com/v1"}issue(e,t){return this.request("/payment/charge/issue","post",this.baseUrlThunk.bind(this))(e,t)}status(e,t){return this.request("/payment/charge/status","post",this.baseUrlThunk.bind(this))(e,t)}}const p="https://extensions.fhir.zapehr.com/encounter-virtual-service-pre-release",v="addressString";function b(e){var t,s,i;if(function(e){return Object.hasOwn(e,"virtualService")}(e)){const s=null===(t=e.virtualService)||void 0===t?void 0:t.find((e=>{var t;return"https://fhir.zapehr.com/virtual-service-type"===(null===(t=e.channelType)||void 0===t?void 0:t.system)}));return null==s?void 0:s.addressString}if(!e.extension)return;const r=e.extension.find((e=>e.url===p));if(!(null==r?void 0:r.extension))return;return null===(i=null===(s=r.extension)||void 0===s?void 0:s.find((e=>e.url===v)))||void 0===i?void 0:i.valueString}class m extends u{constructor(e){super(e),this.ENCOUNTER_VS_EXTENSION_URL=p,this.ENCOUNTER_VS_EXTENSION_RELATIVE_URL=v,this.getConversationIdFromEncounter=b}baseUrlThunk(){var e,t;return null!==(t=null===(e=this.config.services)||void 0===e?void 0:e.projectApiUrl)&&void 0!==t?t:"https://project-api.zapehr.com/v1"}create(e,t){return this.request("/messaging/conversation","post",this.baseUrlThunk.bind(this))(e,t)}getToken(e){return this.request("/messaging/conversation/token","get",this.baseUrlThunk.bind(this))(e)}addParticipant(e,t){return this.request("/messaging/conversation/{conversationId}/participant","post",this.baseUrlThunk.bind(this))(e,t)}removeParticipant(e,t){return this.request("/messaging/conversation/{conversationId}/participant","delete",this.baseUrlThunk.bind(this))(e,t)}message(e,t){return this.request("/messaging/conversation/{conversationId}/message","post",this.baseUrlThunk.bind(this))(e,t)}}class f extends u{constructor(e){super(e)}baseUrlThunk(){var e,t;return null!==(t=null===(e=this.config.services)||void 0===e?void 0:e.projectApiUrl)&&void 0!==t?t:"https://project-api.zapehr.com/v1"}get(e,t){return this.request("/developer/{id}","get",this.baseUrlThunk.bind(this))(e,t)}update(e,t){return this.request("/developer/{id}","patch",this.baseUrlThunk.bind(this))(e,t)}delete(e,t){return this.request("/developer/{id}","delete",this.baseUrlThunk.bind(this))(e,t)}invite(e,t){return this.request("/developer/invite","post",this.baseUrlThunk.bind(this))(e,t)}list(e){return this.request("/developer","get",this.baseUrlThunk.bind(this))(e)}listV2(e,t){return this.request("/developer/v2/list","get",this.baseUrlThunk.bind(this))(e,t)}}class g extends u{constructor(e){super(e)}baseUrlThunk(){var e,t;return null!==(t=null===(e=this.config.services)||void 0===e?void 0:e.projectApiUrl)&&void 0!==t?t:"https://project-api.zapehr.com/v1"}syncPatient(e,t){return this.request("/erx/sync-patient/{patientId}","post",this.baseUrlThunk.bind(this))(e,t)}allergySearch(e,t){return this.request("/erx/allergy/search","get",this.baseUrlThunk.bind(this))(e,t)}cancelOrder(e,t){return this.request("/erx/cancel-order","post",this.baseUrlThunk.bind(this))(e,t)}cancelPrescription(e,t){return this.request("/erx/cancel-prescription","post",this.baseUrlThunk.bind(this))(e,t)}medicationSearch(e,t){return this.request("/erx/medication/search","get",this.baseUrlThunk.bind(this))(e,t)}medicationSearchV2(e,t){return this.request("/erx/v2/medication/search","get",this.baseUrlThunk.bind(this))(e,t)}}class U extends u{constructor(e){super(e)}baseUrlThunk(){var e,t;return null!==(t=null===(e=this.config.services)||void 0===e?void 0:e.faxApiUrl)&&void 0!==t?t:"https://fax-api.zapehr.com/v1"}offboard(e){return this.request("/offboard","post",this.baseUrlThunk.bind(this))(e)}onboard(e){return this.request("/onboard","post",this.baseUrlThunk.bind(this))(e)}send(e,t){return this.request("/send","post",this.baseUrlThunk.bind(this))(e,t)}}function T(e,t){return r(this,void 0,void 0,(function*(){const{resourceType:s,params:i}=e;let r;i&&(r=Object.entries(i).reduce(((e,[t,s])=>(e[s.name]||(e[s.name]=[]),e[s.name].push(s.value),e)),{}));const n=yield this.fhirRequest(`/${s}/_search`,"POST")(r,Object.assign(Object.assign({},t),{contentType:"application/x-www-form-urlencoded"}));return Object.assign(Object.assign({},n),{entry:n.entry,unbundle:function(){var e,t;return null!==(t=null===(e=this.entry)||void 0===e?void 0:e.map((e=>e.resource)).filter((e=>void 0!==e)))&&void 0!==t?t:[]}})}))}function k(e,t){return r(this,void 0,void 0,(function*(){const{resourceType:s}=e;return this.fhirRequest(`/${s}`,"POST")(e,t)}))}function y({resourceType:e,id:t},s){return r(this,void 0,void 0,(function*(){return this.fhirRequest(`/${e}/${t}`,"GET")({},s)}))}function j(e,t){return r(this,void 0,void 0,(function*(){const{id:s,resourceType:i}=e;return this.fhirRequest(`/${i}/${s}`,"PUT")(e,Object.assign(Object.assign({},t),{ifMatch:(null==t?void 0:t.optimisticLockingVersionId)?`W/"${t.optimisticLockingVersionId}"`:void 0}))}))}function q({resourceType:e,id:t,operations:s},i){return r(this,void 0,void 0,(function*(){return this.fhirRequest(`/${e}/${t}`,"PATCH")(s,Object.assign(Object.assign({},i),{contentType:"application/json-patch+json",ifMatch:(null==i?void 0:i.optimisticLockingVersionId)?`W/"${i.optimisticLockingVersionId}"`:void 0}))}))}function O({resourceType:e,id:t},s){return r(this,void 0,void 0,(function*(){return this.fhirRequest(`/${e}/${t}`,"DELETE")({},s)}))}function x({resourceType:e,id:t,versionId:s},i){return r(this,void 0,void 0,(function*(){return this.fhirRequest(`/${e}/${t}/_history${s?`/${s}`:""}`,"GET")({},i)}))}function w(e){const{method:t,url:s}=e,i={request:{method:t,url:s}};if(s.split("?").length>1){const[e,t]=s.split("?"),r=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;c(r,n),i.request.url=`${e}?${n.toString()}`}if(["GET","DELETE","HEAD"].includes(t))return i;if("PUT"===t){const{resource:t}=e;return Object.assign(Object.assign({},i),{resource:t})}if("PATCH"===t)return"resource"in e?Object.assign(Object.assign({},i),{resource:e.resource}):Object.assign(Object.assign({},i),{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 Object.assign(Object.assign({},i),{resource:t,fullUrl:s})}throw new Error("Unrecognized method")}function z(e){return function(t,s){return r(this,void 0,void 0,(function*(){return this.fhirRequest("/","POST")({resourceType:"Bundle",type:e,entry:t.requests.map(w)},s)}))}}const E=z("batch"),A=z("transaction");function S(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&&((null==t?void 0:t.all)||(null==t?void 0:t.use))&&s.push("["+e.use+"]"),s.join((null==t?void 0:t.lineSeparator)||", ").trim()}function R(e,t){const s=[];return e.prefix&&!1!==(null==t?void 0:t.prefix)&&s.push(...e.prefix),e.given&&s.push(...e.given),e.family&&s.push(e.family),e.suffix&&!1!==(null==t?void 0:t.suffix)&&s.push(...e.suffix),e.use&&((null==t?void 0:t.all)||(null==t?void 0:t.use))&&s.push("["+e.use+"]"),s.join(" ").trim()}class N extends u{constructor(e){super(e),this.search=T,this.create=k,this.get=y,this.update=j,this.patch=q,this.delete=O,this.history=x,this.batch=E,this.transaction=A,this.formatAddress=S,this.formatHumanName=R}baseUrlThunk(){var e,t;return null!==(t=null===(e=this.config.services)||void 0===e?void 0:e.fhirApiUrl)&&void 0!==t?t:"https://fhir-api.zapehr.com"}}class P extends u{constructor(e){super(e)}baseUrlThunk(){var e,t;return null!==(t=null===(e=this.config.services)||void 0===e?void 0:e.projectApiUrl)&&void 0!==t?t:"https://project-api.zapehr.com/v1"}list(e){return this.request("/m2m","get",this.baseUrlThunk.bind(this))(e)}create(e,t){return this.request("/m2m","post",this.baseUrlThunk.bind(this))(e,t)}get(e,t){return this.request("/m2m/{id}","get",this.baseUrlThunk.bind(this))(e,t)}update(e,t){return this.request("/m2m/{id}","patch",this.baseUrlThunk.bind(this))(e,t)}delete(e,t){return this.request("/m2m/{id}","delete",this.baseUrlThunk.bind(this))(e,t)}rotateSecret(e,t){return this.request("/m2m/{id}/rotate-secret","post",this.baseUrlThunk.bind(this))(e,t)}listV2(e,t){return this.request("/m2m/v2/list","get",this.baseUrlThunk.bind(this))(e,t)}}class I extends u{constructor(e){super(e)}baseUrlThunk(){var e,t;return null!==(t=null===(e=this.config.services)||void 0===e?void 0:e.projectApiUrl)&&void 0!==t?t:"https://project-api.zapehr.com/v1"}getMessagingConfig(e){return this.request("/messaging/config","get",this.baseUrlThunk.bind(this))(e)}}class $ extends u{constructor(e){super(e)}baseUrlThunk(){var e,t;return null!==(t=null===(e=this.config.services)||void 0===e?void 0:e.projectApiUrl)&&void 0!==t?t:"https://project-api.zapehr.com/v1"}setUp(e,t){return this.request("/payment/payment-method/setup","post",this.baseUrlThunk.bind(this))(e,t)}setDefault(e,t){return this.request("/payment/payment-method/set-default","post",this.baseUrlThunk.bind(this))(e,t)}delete(e,t){return this.request("/payment/payment-method","delete",this.baseUrlThunk.bind(this))(e,t)}list(e,t){return this.request("/payment/payment-method/list","post",this.baseUrlThunk.bind(this))(e,t)}}class C extends u{constructor(e){super(e)}baseUrlThunk(){var e,t;return null!==(t=null===(e=this.config.services)||void 0===e?void 0:e.projectApiUrl)&&void 0!==t?t:"https://project-api.zapehr.com/v1"}get(e){return this.request("/project","get",this.baseUrlThunk.bind(this))(e)}update(e,t){return this.request("/project","patch",this.baseUrlThunk.bind(this))(e,t)}}class _ extends u{constructor(e){super(e)}baseUrlThunk(){var e,t;return null!==(t=null===(e=this.config.services)||void 0===e?void 0:e.projectApiUrl)&&void 0!==t?t:"https://project-api.zapehr.com/v1"}eligibilityCheck(e,t){return this.request("/rcm/eligibility-check","post",this.baseUrlThunk.bind(this))(e,t)}validateProfessionalClaim(e,t){return this.request("/rcm/professional-claim/validate","post",this.baseUrlThunk.bind(this))(e,t)}submitProfessionalClaim(e,t){return this.request("/rcm/professional-claim/submit","post",this.baseUrlThunk.bind(this))(e,t)}}class L extends u{constructor(e){super(e)}baseUrlThunk(){var e,t;return null!==(t=null===(e=this.config.services)||void 0===e?void 0:e.projectApiUrl)&&void 0!==t?t:"https://project-api.zapehr.com/v1"}list(e){return this.request("/iam/role","get",this.baseUrlThunk.bind(this))(e)}create(e,t){return this.request("/iam/role","post",this.baseUrlThunk.bind(this))(e,t)}get(e,t){return this.request("/iam/role/{roleId}","get",this.baseUrlThunk.bind(this))(e,t)}update(e,t){return this.request("/iam/role/{roleId}","patch",this.baseUrlThunk.bind(this))(e,t)}delete(e,t){return this.request("/iam/role/{roleId}","delete",this.baseUrlThunk.bind(this))(e,t)}}class M extends u{constructor(e){super(e)}baseUrlThunk(){var e,t;return null!==(t=null===(e=this.config.services)||void 0===e?void 0:e.projectApiUrl)&&void 0!==t?t:"https://project-api.zapehr.com/v1"}list(e){return this.request("/secret","get",this.baseUrlThunk.bind(this))(e)}set(e,t){return this.request("/secret","post",this.baseUrlThunk.bind(this))(e,t)}get(e,t){return this.request("/secret/{name}","get",this.baseUrlThunk.bind(this))(e,t)}delete(e,t){return this.request("/secret/{name}","delete",this.baseUrlThunk.bind(this))(e,t)}}class D extends u{constructor(e){super(e)}baseUrlThunk(){var e,t;return null!==(t=null===(e=this.config.services)||void 0===e?void 0:e.projectApiUrl)&&void 0!==t?t:"https://project-api.zapehr.com/v1"}createMeeting(e,t){return this.request("/telemed/v2/meeting","post",this.baseUrlThunk.bind(this))(e,t)}joinMeeting(e,t){return this.request("/telemed/v2/meeting/{encounterId}/join","get",this.baseUrlThunk.bind(this))(e,t)}}class V extends u{constructor(e){super(e)}baseUrlThunk(){var e,t;return null!==(t=null===(e=this.config.services)||void 0===e?void 0:e.projectApiUrl)&&void 0!==t?t:"https://project-api.zapehr.com/v1"}send(e,t){return this.request("/messaging/transactional-sms/send","post",this.baseUrlThunk.bind(this))(e,t)}}class F extends u{constructor(e){super(e)}baseUrlThunk(){var e,t;return null!==(t=null===(e=this.config.services)||void 0===e?void 0:e.projectApiUrl)&&void 0!==t?t:"https://project-api.zapehr.com/v1"}me(e){return this.request("/user/me","get",this.baseUrlThunk.bind(this))(e)}get(e,t){return this.request("/user/{id}","get",this.baseUrlThunk.bind(this))(e,t)}update(e,t){return this.request("/user/{id}","patch",this.baseUrlThunk.bind(this))(e,t)}delete(e,t){return this.request("/user/{id}","delete",this.baseUrlThunk.bind(this))(e,t)}invite(e,t){return this.request("/user/invite","post",this.baseUrlThunk.bind(this))(e,t)}list(e){return this.request("/user","get",this.baseUrlThunk.bind(this))(e)}listV2(e,t){return this.request("/user/v2/list","get",this.baseUrlThunk.bind(this))(e,t)}}class H extends u{constructor(e){super(e)}baseUrlThunk(){var e,t;return null!==(t=null===(e=this.config.services)||void 0===e?void 0:e.projectApiUrl)&&void 0!==t?t:"https://project-api.zapehr.com/v1"}get(e){return this.request("/version","get",this.baseUrlThunk.bind(this))(e)}}function B(){var e,t;return null!==(t=null===(e=this.config.services)||void 0===e?void 0:e.projectApiUrl)&&void 0!==t?t:"https://project-api.zapehr.com/v1"}function J({bucketName:e,"objectPath+":t,file:s}){return r(this,void 0,void 0,(function*(){const i=yield this.request("/z3/{bucketName}/{objectPath+}","post",B.bind(this))({action:"upload",bucketName:e,"objectPath+":t});yield fetch(i.signedUrl,{method:"PUT",body:s})}))}function G({bucketName:e,"objectPath+":t}){return r(this,void 0,void 0,(function*(){const s=yield this.request("/z3/{bucketName}/{objectPath+}","post",B.bind(this))({action:"download",bucketName:e,"objectPath+":t}),i=yield fetch(s.signedUrl,{method:"GET"});if(!i.ok)throw new Error("Failed to download file");return i.arrayBuffer()}))}function W(e){var s,i;return r(this,void 0,void 0,(function*(){let r,n;const o=new URL(e.url);if("z3:"===o.protocol){const e=o.pathname.split("/").slice(1);r=o.hostname,n=e.join("/")}else{if(!o.href.startsWith(null!==(i=null===(s=this.config.services)||void 0===s?void 0:s.projectApiUrl)&&void 0!==i?i:"https://project-api.zapehr.com/v1"))throw new t({message:"Invalid Z3 URL",code:400});{const e=o.pathname.split("/").slice(3);r=e[0],n=e.slice(1).join("/")}}const u={action:"upload",bucketName:r,"objectPath+":n};return this.request("/z3/{bucketName}/{objectPath+}","post",B.bind(this))(u)}))}class X extends u{constructor(e){super(e),this.uploadFile=J,this.downloadFile=G,this.getPresignedUrlForZ3Url=W}baseUrlThunk(){var e,t;return null!==(t=null===(e=this.config.services)||void 0===e?void 0:e.projectApiUrl)&&void 0!==t?t:"https://project-api.zapehr.com/v1"}listBuckets(e){return this.request("/z3","get",this.baseUrlThunk.bind(this))(e)}createBucket(e,t){return this.request("/z3/{bucketName}","put",this.baseUrlThunk.bind(this))(e,t)}deleteBucket(e,t){return this.request("/z3/{bucketName}","delete",this.baseUrlThunk.bind(this))(e,t)}listObjects(e,t){return this.request("/z3/{bucketName}/{objectPath+}","get",this.baseUrlThunk.bind(this))(e,t)}getPresignedUrl(e,t){return this.request("/z3/{bucketName}/{objectPath+}","post",this.baseUrlThunk.bind(this))(e,t)}deleteObject(e,t){return this.request("/z3/{bucketName}/{objectPath+}","delete",this.baseUrlThunk.bind(this))(e,t)}}function Z(){var e,t;return null!==(t=null===(e=this.config.services)||void 0===e?void 0:e.projectApiUrl)&&void 0!==t?t:"https://project-api.zapehr.com/v1"}function K({id:e,file:t,filename:s}){return r(this,void 0,void 0,(function*(){const i=yield this.request("/zambda/{id}/s3-upload","post",Z.bind(this))({id:e,filename:s});yield fetch(i.signedUrl,{method:"PUT",body:t})}))}class Q extends u{constructor(e){super(e),this.uploadFile=K}baseUrlThunk(){var e,t;return null!==(t=null===(e=this.config.services)||void 0===e?void 0:e.projectApiUrl)&&void 0!==t?t:"https://project-api.zapehr.com/v1"}list(e){return this.request("/zambda","get",this.baseUrlThunk.bind(this))(e)}create(e,t){return this.request("/zambda","post",this.baseUrlThunk.bind(this))(e,t)}get(e,t){return this.request("/zambda/{id}","get",this.baseUrlThunk.bind(this))(e,t)}update(e,t){return this.request("/zambda/{id}","patch",this.baseUrlThunk.bind(this))(e,t)}delete(e,t){return this.request("/zambda/{id}","delete",this.baseUrlThunk.bind(this))(e,t)}execute(e,t){return this.request("/zambda/{id}/execute","post",this.baseUrlThunk.bind(this))(e,t)}executePublic(e,t){return this.request("/zambda/{id}/execute-public","post",this.baseUrlThunk.bind(this))(e,t)}s3Upload(e,t){return this.request("/zambda/{id}/s3-upload","post",this.baseUrlThunk.bind(this))(e,t)}}class Y extends u{constructor(e){super(e)}baseUrlThunk(){var e,t;return null!==(t=null===(e=this.config.services)||void 0===e?void 0:e.projectApiUrl)&&void 0!==t?t:"https://project-api.zapehr.com/v1"}list(e,t){return this.request("/zambda/{id}/logStream","post",this.baseUrlThunk.bind(this))(e,t)}search(e,t){return this.request("/zambda/{id}/logStream/search","post",this.baseUrlThunk.bind(this))(e,t)}get(e,t){return this.request("/zambda/{id}/logStream/{logStreamName}","post",this.baseUrlThunk.bind(this))(e,t)}}let ee=class{constructor(e){var t,s,i,r,n,o;this.config=e,null!==(t=(r=this.config).services)&&void 0!==t||(r.services={}),null!==(s=(n=this.config.services).projectApiUrl)&&void 0!==s||(n.projectApiUrl=e.projectApiUrl),null!==(i=(o=this.config.services).fhirApiUrl)&&void 0!==i||(o.fhirApiUrl=e.fhirApiUrl),this.application=new l(e),this.developer=new f(e),this.m2m=new P(e),this.messaging=new I(e),this.conversation=new m(e),this.transactionalSMS=new V(e),this.paymentMethod=new $(e),this.charge=new d(e),this.project=new C(e),this.rcm=new _(e),this.erx=new g(e),this.role=new L(e),this.secret=new M(e),this.telemed=new D(e),this.user=new F(e),this.version=new H(e),this.z3=new X(e),this.zambda=new Q(e),this.zambdaLogStream=new Y(e),this.fax=new U(e),this.fhir=new N(e)}};class te extends ee{}te.OystehrFHIRError=i,te.OystehrSdkError=t;export{te 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 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};
2
2
  //# sourceMappingURL=index.min.js.map