phenoml 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (300) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/Client.d.ts +10 -4
  3. package/dist/cjs/Client.js +17 -7
  4. package/dist/cjs/api/resources/agent/client/Client.d.ts +12 -8
  5. package/dist/cjs/api/resources/agent/client/Client.js +15 -7
  6. package/dist/cjs/api/resources/agent/client/requests/AgentChatRequest.d.ts +0 -3
  7. package/dist/cjs/api/resources/agent/client/requests/index.d.ts +0 -2
  8. package/dist/cjs/api/resources/agent/resources/prompts/client/Client.d.ts +5 -5
  9. package/dist/cjs/api/resources/agent/resources/prompts/client/Client.js +6 -2
  10. package/dist/cjs/api/resources/agent/{client/requests → types}/AgentCreateRequest.d.ts +14 -12
  11. package/dist/cjs/api/resources/agent/types/AgentTemplate.d.ts +14 -4
  12. package/dist/cjs/api/resources/agent/types/index.d.ts +1 -4
  13. package/dist/cjs/api/resources/agent/types/index.js +1 -4
  14. package/dist/cjs/api/resources/authtoken/client/Client.d.ts +3 -3
  15. package/dist/cjs/api/resources/authtoken/client/Client.js +1 -1
  16. package/dist/cjs/api/resources/authtoken/resources/auth/client/Client.d.ts +2 -2
  17. package/dist/cjs/api/resources/authtoken/resources/auth/client/Client.js +1 -1
  18. package/dist/cjs/api/resources/cohort/client/Client.d.ts +5 -5
  19. package/dist/cjs/api/resources/cohort/client/Client.js +6 -2
  20. package/dist/cjs/api/resources/construe/client/Client.d.ts +5 -5
  21. package/dist/cjs/api/resources/construe/client/Client.js +6 -2
  22. package/dist/cjs/api/resources/fhir/client/Client.d.ts +293 -0
  23. package/dist/cjs/api/resources/fhir/client/Client.js +674 -0
  24. package/dist/cjs/api/resources/fhir/client/index.d.ts +2 -0
  25. package/dist/cjs/api/resources/fhir/client/index.js +17 -0
  26. package/dist/cjs/api/resources/fhir/client/requests/FhirCreateRequest.d.ts +18 -0
  27. package/dist/cjs/api/resources/fhir/client/requests/FhirDeleteRequest.d.ts +13 -0
  28. package/dist/cjs/api/resources/fhir/client/requests/FhirExecuteBundleRequest.d.ts +47 -0
  29. package/dist/cjs/api/resources/fhir/client/requests/FhirPatchRequest.d.ts +69 -0
  30. package/dist/cjs/api/resources/fhir/client/requests/FhirSearchRequest.d.ts +26 -0
  31. package/dist/cjs/api/resources/fhir/client/requests/FhirUpsertRequest.d.ts +19 -0
  32. package/dist/cjs/api/resources/fhir/client/requests/FhirUpsertRequest.js +5 -0
  33. package/dist/cjs/api/resources/fhir/client/requests/index.d.ts +6 -0
  34. package/dist/cjs/api/resources/fhir/client/requests/index.js +2 -0
  35. package/dist/cjs/api/resources/fhir/errors/BadRequestError.d.ts +8 -0
  36. package/dist/cjs/api/resources/fhir/errors/BadRequestError.js +52 -0
  37. package/dist/cjs/api/resources/fhir/errors/InternalServerError.d.ts +8 -0
  38. package/dist/cjs/api/resources/fhir/errors/InternalServerError.js +52 -0
  39. package/dist/cjs/api/resources/fhir/errors/NotFoundError.d.ts +8 -0
  40. package/dist/cjs/api/resources/fhir/errors/NotFoundError.js +52 -0
  41. package/dist/cjs/api/resources/fhir/errors/UnauthorizedError.d.ts +8 -0
  42. package/dist/cjs/api/resources/fhir/errors/UnauthorizedError.js +52 -0
  43. package/dist/cjs/api/resources/fhir/errors/index.d.ts +4 -0
  44. package/dist/cjs/api/resources/fhir/errors/index.js +20 -0
  45. package/dist/cjs/api/resources/fhir/index.d.ts +3 -0
  46. package/dist/cjs/api/resources/fhir/index.js +19 -0
  47. package/dist/cjs/api/resources/fhir/types/ErrorResponse.d.ts +14 -0
  48. package/dist/cjs/api/resources/fhir/types/ErrorResponse.js +5 -0
  49. package/dist/cjs/api/resources/fhir/types/FhirBundle.d.ts +57 -0
  50. package/dist/cjs/api/resources/fhir/types/FhirBundle.js +25 -0
  51. package/dist/cjs/api/resources/fhir/types/FhirPatchRequestBodyItem.d.ts +26 -0
  52. package/dist/cjs/api/resources/fhir/types/FhirPatchRequestBodyItem.js +17 -0
  53. package/dist/cjs/api/resources/fhir/types/FhirResource.d.ts +27 -0
  54. package/dist/cjs/api/resources/fhir/types/FhirResource.js +5 -0
  55. package/dist/cjs/api/resources/fhir/types/FhirSearchResponse.d.ts +5 -0
  56. package/dist/cjs/api/resources/fhir/types/FhirSearchResponse.js +5 -0
  57. package/dist/cjs/api/resources/fhir/types/index.d.ts +5 -0
  58. package/dist/cjs/api/resources/fhir/types/index.js +21 -0
  59. package/dist/cjs/api/resources/fhirProvider/client/Client.d.ts +161 -0
  60. package/dist/cjs/api/resources/fhirProvider/client/Client.js +596 -0
  61. package/dist/cjs/api/resources/fhirProvider/client/index.d.ts +2 -0
  62. package/dist/cjs/api/resources/fhirProvider/client/index.js +17 -0
  63. package/dist/cjs/api/resources/fhirProvider/client/requests/FhirProviderAddAuthConfigRequest.d.ts +20 -0
  64. package/dist/cjs/api/resources/fhirProvider/client/requests/FhirProviderAddAuthConfigRequest.js +5 -0
  65. package/dist/cjs/api/resources/fhirProvider/client/requests/FhirProviderCreateRequest.d.ts +30 -0
  66. package/dist/cjs/api/resources/fhirProvider/client/requests/FhirProviderCreateRequest.js +5 -0
  67. package/dist/cjs/api/resources/fhirProvider/client/requests/FhirProviderRemoveAuthConfigRequest.d.ts +13 -0
  68. package/dist/cjs/api/resources/fhirProvider/client/requests/FhirProviderRemoveAuthConfigRequest.js +5 -0
  69. package/dist/cjs/api/resources/fhirProvider/client/requests/FhirProviderSetActiveAuthConfigRequest.d.ts +13 -0
  70. package/dist/cjs/api/resources/fhirProvider/client/requests/FhirProviderSetActiveAuthConfigRequest.js +5 -0
  71. package/dist/cjs/api/resources/fhirProvider/client/requests/index.d.ts +4 -0
  72. package/dist/cjs/api/resources/fhirProvider/client/requests/index.js +2 -0
  73. package/dist/cjs/api/resources/fhirProvider/errors/BadRequestError.d.ts +8 -0
  74. package/dist/cjs/api/resources/fhirProvider/errors/BadRequestError.js +52 -0
  75. package/dist/cjs/api/resources/fhirProvider/errors/ForbiddenError.d.ts +8 -0
  76. package/dist/cjs/api/resources/fhirProvider/errors/ForbiddenError.js +52 -0
  77. package/dist/cjs/api/resources/fhirProvider/errors/InternalServerError.d.ts +8 -0
  78. package/dist/cjs/api/resources/fhirProvider/errors/InternalServerError.js +52 -0
  79. package/dist/cjs/api/resources/fhirProvider/errors/NotFoundError.d.ts +8 -0
  80. package/dist/cjs/api/resources/fhirProvider/errors/NotFoundError.js +52 -0
  81. package/dist/cjs/api/resources/fhirProvider/errors/UnauthorizedError.d.ts +8 -0
  82. package/dist/cjs/api/resources/fhirProvider/errors/UnauthorizedError.js +52 -0
  83. package/dist/cjs/api/resources/fhirProvider/errors/index.d.ts +5 -0
  84. package/dist/cjs/api/resources/fhirProvider/errors/index.js +21 -0
  85. package/dist/cjs/api/resources/fhirProvider/index.d.ts +3 -0
  86. package/dist/cjs/api/resources/fhirProvider/index.js +19 -0
  87. package/dist/cjs/api/resources/fhirProvider/types/AuthMethod.d.ts +14 -0
  88. package/dist/cjs/api/resources/fhirProvider/types/AuthMethod.js +13 -0
  89. package/dist/cjs/api/resources/fhirProvider/types/FhirProviderAuthConfig.d.ts +22 -0
  90. package/dist/cjs/api/resources/fhirProvider/types/FhirProviderAuthConfig.js +5 -0
  91. package/dist/cjs/api/resources/fhirProvider/types/FhirProviderDeleteResponse.d.ts +7 -0
  92. package/dist/cjs/api/resources/fhirProvider/types/FhirProviderDeleteResponse.js +5 -0
  93. package/dist/cjs/api/resources/fhirProvider/types/FhirProviderListResponse.d.ts +9 -0
  94. package/dist/cjs/api/resources/fhirProvider/types/FhirProviderListResponse.js +5 -0
  95. package/dist/cjs/api/resources/fhirProvider/types/FhirProviderRemoveAuthConfigResponse.d.ts +9 -0
  96. package/dist/cjs/api/resources/fhirProvider/types/FhirProviderRemoveAuthConfigResponse.js +5 -0
  97. package/dist/cjs/api/resources/fhirProvider/types/FhirProviderResponse.d.ts +9 -0
  98. package/dist/cjs/api/resources/fhirProvider/types/FhirProviderResponse.js +5 -0
  99. package/dist/cjs/api/resources/fhirProvider/types/FhirProviderSetActiveAuthConfigResponse.d.ts +9 -0
  100. package/dist/cjs/api/resources/fhirProvider/types/FhirProviderSetActiveAuthConfigResponse.js +5 -0
  101. package/dist/cjs/api/resources/fhirProvider/types/FhirProviderTemplate.d.ts +25 -0
  102. package/dist/cjs/api/resources/fhirProvider/types/FhirProviderTemplate.js +5 -0
  103. package/dist/cjs/api/resources/fhirProvider/types/FhirQueryResponse.d.ts +19 -0
  104. package/dist/cjs/api/resources/fhirProvider/types/FhirQueryResponse.js +5 -0
  105. package/dist/cjs/api/resources/fhirProvider/types/JsonWebKey.d.ts +20 -0
  106. package/dist/cjs/api/resources/fhirProvider/types/JsonWebKey.js +5 -0
  107. package/dist/cjs/api/resources/fhirProvider/types/Provider.d.ts +17 -0
  108. package/dist/cjs/api/resources/{agent/types/ProviderType.js → fhirProvider/types/Provider.js} +8 -4
  109. package/dist/cjs/api/resources/fhirProvider/types/ServiceAccountKey.d.ts +19 -0
  110. package/dist/cjs/api/resources/fhirProvider/types/ServiceAccountKey.js +5 -0
  111. package/dist/cjs/api/resources/fhirProvider/types/SmartConfiguration.d.ts +18 -0
  112. package/dist/cjs/api/resources/fhirProvider/types/SmartConfiguration.js +5 -0
  113. package/dist/cjs/api/resources/fhirProvider/types/index.d.ts +13 -0
  114. package/dist/cjs/api/resources/fhirProvider/types/index.js +29 -0
  115. package/dist/cjs/api/resources/index.d.ts +2 -0
  116. package/dist/cjs/api/resources/index.js +3 -1
  117. package/dist/cjs/api/resources/lang2Fhir/client/Client.d.ts +5 -5
  118. package/dist/cjs/api/resources/lang2Fhir/client/Client.js +6 -2
  119. package/dist/cjs/api/resources/tools/client/Client.d.ts +6 -6
  120. package/dist/cjs/api/resources/tools/client/Client.js +7 -3
  121. package/dist/cjs/api/resources/tools/client/requests/CohortRequest.d.ts +3 -17
  122. package/dist/cjs/api/resources/tools/client/requests/CohortRequest.js +0 -10
  123. package/dist/cjs/api/resources/tools/client/requests/Lang2FhirAndCreateRequest.d.ts +2 -14
  124. package/dist/cjs/api/resources/tools/client/requests/Lang2FhirAndCreateRequest.js +0 -6
  125. package/dist/cjs/api/resources/tools/client/requests/Lang2FhirAndSearchRequest.d.ts +2 -16
  126. package/dist/cjs/api/resources/tools/client/requests/Lang2FhirAndSearchRequest.js +0 -10
  127. package/dist/cjs/api/resources/tools/resources/mcpServer/client/Client.d.ts +5 -5
  128. package/dist/cjs/api/resources/tools/resources/mcpServer/client/Client.js +6 -2
  129. package/dist/cjs/api/resources/tools/resources/mcpServer/resources/tools/client/Client.d.ts +5 -5
  130. package/dist/cjs/api/resources/tools/resources/mcpServer/resources/tools/client/Client.js +6 -2
  131. package/dist/cjs/api/resources/tools/types/index.d.ts +0 -1
  132. package/dist/cjs/api/resources/tools/types/index.js +0 -1
  133. package/dist/cjs/core/fetcher/Fetcher.d.ts +1 -1
  134. package/dist/cjs/core/fetcher/requestWithRetries.js +44 -8
  135. package/dist/cjs/core/headers.d.ts +2 -2
  136. package/dist/cjs/version.d.ts +1 -1
  137. package/dist/cjs/version.js +1 -1
  138. package/dist/esm/Client.d.mts +10 -4
  139. package/dist/esm/Client.mjs +13 -3
  140. package/dist/esm/api/resources/agent/client/Client.d.mts +12 -8
  141. package/dist/esm/api/resources/agent/client/Client.mjs +15 -7
  142. package/dist/esm/api/resources/agent/client/requests/AgentChatRequest.d.mts +0 -3
  143. package/dist/esm/api/resources/agent/client/requests/index.d.mts +0 -2
  144. package/dist/esm/api/resources/agent/resources/prompts/client/Client.d.mts +5 -5
  145. package/dist/esm/api/resources/agent/resources/prompts/client/Client.mjs +6 -2
  146. package/dist/esm/api/resources/agent/{client/requests → types}/AgentCreateRequest.d.mts +14 -12
  147. package/dist/esm/api/resources/agent/types/AgentTemplate.d.mts +14 -4
  148. package/dist/esm/api/resources/agent/types/index.d.mts +1 -4
  149. package/dist/esm/api/resources/agent/types/index.mjs +1 -4
  150. package/dist/esm/api/resources/authtoken/client/Client.d.mts +3 -3
  151. package/dist/esm/api/resources/authtoken/client/Client.mjs +1 -1
  152. package/dist/esm/api/resources/authtoken/resources/auth/client/Client.d.mts +2 -2
  153. package/dist/esm/api/resources/authtoken/resources/auth/client/Client.mjs +1 -1
  154. package/dist/esm/api/resources/cohort/client/Client.d.mts +5 -5
  155. package/dist/esm/api/resources/cohort/client/Client.mjs +6 -2
  156. package/dist/esm/api/resources/construe/client/Client.d.mts +5 -5
  157. package/dist/esm/api/resources/construe/client/Client.mjs +6 -2
  158. package/dist/esm/api/resources/fhir/client/Client.d.mts +293 -0
  159. package/dist/esm/api/resources/fhir/client/Client.mjs +637 -0
  160. package/dist/esm/api/resources/fhir/client/index.d.mts +2 -0
  161. package/dist/esm/api/resources/fhir/client/index.mjs +1 -0
  162. package/dist/esm/api/resources/fhir/client/requests/FhirCreateRequest.d.mts +18 -0
  163. package/dist/esm/api/resources/fhir/client/requests/FhirDeleteRequest.d.mts +13 -0
  164. package/dist/esm/api/resources/fhir/client/requests/FhirExecuteBundleRequest.d.mts +47 -0
  165. package/dist/esm/api/resources/fhir/client/requests/FhirPatchRequest.d.mts +69 -0
  166. package/dist/esm/api/resources/fhir/client/requests/FhirSearchRequest.d.mts +26 -0
  167. package/dist/esm/api/resources/fhir/client/requests/FhirUpsertRequest.d.mts +19 -0
  168. package/dist/esm/api/resources/fhir/client/requests/FhirUpsertRequest.mjs +4 -0
  169. package/dist/esm/api/resources/fhir/client/requests/index.d.mts +6 -0
  170. package/dist/esm/api/resources/fhir/client/requests/index.mjs +1 -0
  171. package/dist/esm/api/resources/fhir/errors/BadRequestError.d.mts +8 -0
  172. package/dist/esm/api/resources/fhir/errors/BadRequestError.mjs +15 -0
  173. package/dist/esm/api/resources/fhir/errors/InternalServerError.d.mts +8 -0
  174. package/dist/esm/api/resources/fhir/errors/InternalServerError.mjs +15 -0
  175. package/dist/esm/api/resources/fhir/errors/NotFoundError.d.mts +8 -0
  176. package/dist/esm/api/resources/fhir/errors/NotFoundError.mjs +15 -0
  177. package/dist/esm/api/resources/fhir/errors/UnauthorizedError.d.mts +8 -0
  178. package/dist/esm/api/resources/fhir/errors/UnauthorizedError.mjs +15 -0
  179. package/dist/esm/api/resources/fhir/errors/index.d.mts +4 -0
  180. package/dist/esm/api/resources/fhir/errors/index.mjs +4 -0
  181. package/dist/esm/api/resources/fhir/index.d.mts +3 -0
  182. package/dist/esm/api/resources/fhir/index.mjs +3 -0
  183. package/dist/esm/api/resources/fhir/types/ErrorResponse.d.mts +14 -0
  184. package/dist/esm/api/resources/fhir/types/ErrorResponse.mjs +4 -0
  185. package/dist/esm/api/resources/fhir/types/FhirBundle.d.mts +57 -0
  186. package/dist/esm/api/resources/fhir/types/FhirBundle.mjs +22 -0
  187. package/dist/esm/api/resources/fhir/types/FhirPatchRequestBodyItem.d.mts +26 -0
  188. package/dist/esm/api/resources/fhir/types/FhirPatchRequestBodyItem.mjs +14 -0
  189. package/dist/esm/api/resources/fhir/types/FhirResource.d.mts +27 -0
  190. package/dist/esm/api/resources/fhir/types/FhirResource.mjs +4 -0
  191. package/dist/esm/api/resources/fhir/types/FhirSearchResponse.d.mts +5 -0
  192. package/dist/esm/api/resources/fhir/types/FhirSearchResponse.mjs +4 -0
  193. package/dist/esm/api/resources/fhir/types/index.d.mts +5 -0
  194. package/dist/esm/api/resources/fhir/types/index.mjs +5 -0
  195. package/dist/esm/api/resources/fhirProvider/client/Client.d.mts +161 -0
  196. package/dist/esm/api/resources/fhirProvider/client/Client.mjs +559 -0
  197. package/dist/esm/api/resources/fhirProvider/client/index.d.mts +2 -0
  198. package/dist/esm/api/resources/fhirProvider/client/index.mjs +1 -0
  199. package/dist/esm/api/resources/fhirProvider/client/requests/FhirProviderAddAuthConfigRequest.d.mts +20 -0
  200. package/dist/esm/api/resources/fhirProvider/client/requests/FhirProviderAddAuthConfigRequest.mjs +4 -0
  201. package/dist/esm/api/resources/fhirProvider/client/requests/FhirProviderCreateRequest.d.mts +30 -0
  202. package/dist/esm/api/resources/fhirProvider/client/requests/FhirProviderCreateRequest.mjs +4 -0
  203. package/dist/esm/api/resources/fhirProvider/client/requests/FhirProviderRemoveAuthConfigRequest.d.mts +13 -0
  204. package/dist/esm/api/resources/fhirProvider/client/requests/FhirProviderRemoveAuthConfigRequest.mjs +4 -0
  205. package/dist/esm/api/resources/fhirProvider/client/requests/FhirProviderSetActiveAuthConfigRequest.d.mts +13 -0
  206. package/dist/esm/api/resources/fhirProvider/client/requests/FhirProviderSetActiveAuthConfigRequest.mjs +4 -0
  207. package/dist/esm/api/resources/fhirProvider/client/requests/index.d.mts +4 -0
  208. package/dist/esm/api/resources/fhirProvider/client/requests/index.mjs +1 -0
  209. package/dist/esm/api/resources/fhirProvider/errors/BadRequestError.d.mts +8 -0
  210. package/dist/esm/api/resources/fhirProvider/errors/BadRequestError.mjs +15 -0
  211. package/dist/esm/api/resources/fhirProvider/errors/ForbiddenError.d.mts +8 -0
  212. package/dist/esm/api/resources/fhirProvider/errors/ForbiddenError.mjs +15 -0
  213. package/dist/esm/api/resources/fhirProvider/errors/InternalServerError.d.mts +8 -0
  214. package/dist/esm/api/resources/fhirProvider/errors/InternalServerError.mjs +15 -0
  215. package/dist/esm/api/resources/fhirProvider/errors/NotFoundError.d.mts +8 -0
  216. package/dist/esm/api/resources/fhirProvider/errors/NotFoundError.mjs +15 -0
  217. package/dist/esm/api/resources/fhirProvider/errors/UnauthorizedError.d.mts +8 -0
  218. package/dist/esm/api/resources/fhirProvider/errors/UnauthorizedError.mjs +15 -0
  219. package/dist/esm/api/resources/fhirProvider/errors/index.d.mts +5 -0
  220. package/dist/esm/api/resources/fhirProvider/errors/index.mjs +5 -0
  221. package/dist/esm/api/resources/fhirProvider/index.d.mts +3 -0
  222. package/dist/esm/api/resources/fhirProvider/index.mjs +3 -0
  223. package/dist/esm/api/resources/fhirProvider/types/AuthMethod.d.mts +14 -0
  224. package/dist/esm/api/resources/fhirProvider/types/AuthMethod.mjs +10 -0
  225. package/dist/esm/api/resources/fhirProvider/types/FhirProviderAuthConfig.d.mts +22 -0
  226. package/dist/esm/api/resources/fhirProvider/types/FhirProviderAuthConfig.mjs +4 -0
  227. package/dist/esm/api/resources/fhirProvider/types/FhirProviderDeleteResponse.d.mts +7 -0
  228. package/dist/esm/api/resources/fhirProvider/types/FhirProviderDeleteResponse.mjs +4 -0
  229. package/dist/esm/api/resources/fhirProvider/types/FhirProviderListResponse.d.mts +9 -0
  230. package/dist/esm/api/resources/fhirProvider/types/FhirProviderListResponse.mjs +4 -0
  231. package/dist/esm/api/resources/fhirProvider/types/FhirProviderRemoveAuthConfigResponse.d.mts +9 -0
  232. package/dist/esm/api/resources/fhirProvider/types/FhirProviderRemoveAuthConfigResponse.mjs +4 -0
  233. package/dist/esm/api/resources/fhirProvider/types/FhirProviderResponse.d.mts +9 -0
  234. package/dist/esm/api/resources/fhirProvider/types/FhirProviderResponse.mjs +4 -0
  235. package/dist/esm/api/resources/fhirProvider/types/FhirProviderSetActiveAuthConfigResponse.d.mts +9 -0
  236. package/dist/esm/api/resources/fhirProvider/types/FhirProviderSetActiveAuthConfigResponse.mjs +4 -0
  237. package/dist/esm/api/resources/fhirProvider/types/FhirProviderTemplate.d.mts +25 -0
  238. package/dist/esm/api/resources/fhirProvider/types/FhirProviderTemplate.mjs +4 -0
  239. package/dist/esm/api/resources/fhirProvider/types/FhirQueryResponse.d.mts +19 -0
  240. package/dist/esm/api/resources/fhirProvider/types/FhirQueryResponse.mjs +4 -0
  241. package/dist/esm/api/resources/fhirProvider/types/JsonWebKey.d.mts +20 -0
  242. package/dist/esm/api/resources/fhirProvider/types/JsonWebKey.mjs +4 -0
  243. package/dist/esm/api/resources/fhirProvider/types/Provider.d.mts +17 -0
  244. package/dist/esm/api/resources/{agent/types/ProviderType.mjs → fhirProvider/types/Provider.mjs} +7 -3
  245. package/dist/esm/api/resources/fhirProvider/types/ServiceAccountKey.d.mts +19 -0
  246. package/dist/esm/api/resources/fhirProvider/types/ServiceAccountKey.mjs +4 -0
  247. package/dist/esm/api/resources/fhirProvider/types/SmartConfiguration.d.mts +18 -0
  248. package/dist/esm/api/resources/fhirProvider/types/SmartConfiguration.mjs +4 -0
  249. package/dist/esm/api/resources/fhirProvider/types/index.d.mts +13 -0
  250. package/dist/esm/api/resources/fhirProvider/types/index.mjs +13 -0
  251. package/dist/esm/api/resources/index.d.mts +2 -0
  252. package/dist/esm/api/resources/index.mjs +2 -0
  253. package/dist/esm/api/resources/lang2Fhir/client/Client.d.mts +5 -5
  254. package/dist/esm/api/resources/lang2Fhir/client/Client.mjs +6 -2
  255. package/dist/esm/api/resources/tools/client/Client.d.mts +6 -6
  256. package/dist/esm/api/resources/tools/client/Client.mjs +7 -3
  257. package/dist/esm/api/resources/tools/client/requests/CohortRequest.d.mts +3 -17
  258. package/dist/esm/api/resources/tools/client/requests/CohortRequest.mjs +1 -9
  259. package/dist/esm/api/resources/tools/client/requests/Lang2FhirAndCreateRequest.d.mts +2 -14
  260. package/dist/esm/api/resources/tools/client/requests/Lang2FhirAndCreateRequest.mjs +0 -6
  261. package/dist/esm/api/resources/tools/client/requests/Lang2FhirAndSearchRequest.d.mts +2 -16
  262. package/dist/esm/api/resources/tools/client/requests/Lang2FhirAndSearchRequest.mjs +1 -9
  263. package/dist/esm/api/resources/tools/resources/mcpServer/client/Client.d.mts +5 -5
  264. package/dist/esm/api/resources/tools/resources/mcpServer/client/Client.mjs +6 -2
  265. package/dist/esm/api/resources/tools/resources/mcpServer/resources/tools/client/Client.d.mts +5 -5
  266. package/dist/esm/api/resources/tools/resources/mcpServer/resources/tools/client/Client.mjs +6 -2
  267. package/dist/esm/api/resources/tools/types/index.d.mts +0 -1
  268. package/dist/esm/api/resources/tools/types/index.mjs +0 -1
  269. package/dist/esm/core/fetcher/Fetcher.d.mts +1 -1
  270. package/dist/esm/core/fetcher/requestWithRetries.mjs +44 -8
  271. package/dist/esm/core/headers.d.mts +2 -2
  272. package/dist/esm/version.d.mts +1 -1
  273. package/dist/esm/version.mjs +1 -1
  274. package/package.json +2 -3
  275. package/reference.md +1090 -4
  276. package/LICENSE +0 -21
  277. package/dist/cjs/api/resources/agent/client/requests/AgentUpdateRequest.d.ts +0 -25
  278. package/dist/cjs/api/resources/agent/types/AgentFhirConfig.d.ts +0 -12
  279. package/dist/cjs/api/resources/agent/types/AgentProvider.d.ts +0 -11
  280. package/dist/cjs/api/resources/agent/types/ChatFhirClientConfig.d.ts +0 -12
  281. package/dist/cjs/api/resources/agent/types/ProviderType.d.ts +0 -13
  282. package/dist/cjs/api/resources/tools/types/FhirClientConfig.d.ts +0 -12
  283. package/dist/esm/api/resources/agent/client/requests/AgentUpdateRequest.d.mts +0 -25
  284. package/dist/esm/api/resources/agent/types/AgentFhirConfig.d.mts +0 -12
  285. package/dist/esm/api/resources/agent/types/AgentProvider.d.mts +0 -11
  286. package/dist/esm/api/resources/agent/types/ChatFhirClientConfig.d.mts +0 -12
  287. package/dist/esm/api/resources/agent/types/ProviderType.d.mts +0 -13
  288. package/dist/esm/api/resources/tools/types/FhirClientConfig.d.mts +0 -12
  289. /package/dist/cjs/api/resources/agent/{client/requests → types}/AgentCreateRequest.js +0 -0
  290. /package/dist/cjs/api/resources/{agent/client/requests/AgentUpdateRequest.js → fhir/client/requests/FhirCreateRequest.js} +0 -0
  291. /package/dist/cjs/api/resources/{agent/types/AgentFhirConfig.js → fhir/client/requests/FhirDeleteRequest.js} +0 -0
  292. /package/dist/cjs/api/resources/{agent/types/AgentProvider.js → fhir/client/requests/FhirExecuteBundleRequest.js} +0 -0
  293. /package/dist/cjs/api/resources/{agent/types/ChatFhirClientConfig.js → fhir/client/requests/FhirPatchRequest.js} +0 -0
  294. /package/dist/cjs/api/resources/{tools/types/FhirClientConfig.js → fhir/client/requests/FhirSearchRequest.js} +0 -0
  295. /package/dist/esm/api/resources/agent/{client/requests → types}/AgentCreateRequest.mjs +0 -0
  296. /package/dist/esm/api/resources/{agent/client/requests/AgentUpdateRequest.mjs → fhir/client/requests/FhirCreateRequest.mjs} +0 -0
  297. /package/dist/esm/api/resources/{agent/types/AgentFhirConfig.mjs → fhir/client/requests/FhirDeleteRequest.mjs} +0 -0
  298. /package/dist/esm/api/resources/{agent/types/AgentProvider.mjs → fhir/client/requests/FhirExecuteBundleRequest.mjs} +0 -0
  299. /package/dist/esm/api/resources/{agent/types/ChatFhirClientConfig.mjs → fhir/client/requests/FhirPatchRequest.mjs} +0 -0
  300. /package/dist/esm/api/resources/{tools/types/FhirClientConfig.mjs → fhir/client/requests/FhirSearchRequest.mjs} +0 -0
@@ -0,0 +1,674 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
39
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
40
+ return new (P || (P = Promise))(function (resolve, reject) {
41
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
42
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
43
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
44
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
45
+ });
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.Fhir = void 0;
49
+ const environments = __importStar(require("../../../../environments.js"));
50
+ const core = __importStar(require("../../../../core/index.js"));
51
+ const phenoml = __importStar(require("../../../index.js"));
52
+ const json_js_1 = require("../../../../core/json.js");
53
+ const headers_js_1 = require("../../../../core/headers.js");
54
+ const errors = __importStar(require("../../../../errors/index.js"));
55
+ class Fhir {
56
+ constructor(_options = {}) {
57
+ this._options = _options;
58
+ }
59
+ /**
60
+ * Retrieves FHIR resources from the specified provider. Supports both individual resource retrieval and search operations based on the FHIR path and query parameters.
61
+ *
62
+ * The request is proxied to the configured FHIR server with appropriate authentication headers.
63
+ *
64
+ * @param {string} fhirProviderId - The ID of the FHIR provider to use. Can be either:
65
+ * - A UUID representing the provider ID
66
+ * - A provider name (legacy support - will just use the most recently updated provider with this name)
67
+ * @param {string} fhirPath - The FHIR resource path to operate on. This follows FHIR RESTful API conventions.
68
+ * Examples:
69
+ * - "Patient" (for resource type operations)
70
+ * - "Patient/123" (for specific resource operations)
71
+ * - "Patient/123/_history" (for history operations)
72
+ * @param {phenoml.fhir.FhirSearchRequest} request
73
+ * @param {Fhir.RequestOptions} requestOptions - Request-specific configuration.
74
+ *
75
+ * @throws {@link phenoml.fhir.BadRequestError}
76
+ * @throws {@link phenoml.fhir.UnauthorizedError}
77
+ * @throws {@link phenoml.fhir.NotFoundError}
78
+ * @throws {@link phenoml.fhir.InternalServerError}
79
+ *
80
+ * @example
81
+ * await client.fhir.search("550e8400-e29b-41d4-a716-446655440000", "Patient", {
82
+ * "X-Phenoml-On-Behalf-Of": "user@example.com"
83
+ * })
84
+ */
85
+ search(fhirProviderId, fhirPath, request = {}, requestOptions) {
86
+ return core.HttpResponsePromise.fromPromise(this.__search(fhirProviderId, fhirPath, request, requestOptions));
87
+ }
88
+ __search(fhirProviderId_1, fhirPath_1) {
89
+ return __awaiter(this, arguments, void 0, function* (fhirProviderId, fhirPath, request = {}, requestOptions) {
90
+ var _a, _b, _c, _d;
91
+ const { query_parameters: queryParameters, "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf } = request;
92
+ const _queryParams = {};
93
+ if (queryParameters != null) {
94
+ _queryParams["query_parameters"] = (0, json_js_1.toJson)(queryParameters);
95
+ }
96
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
97
+ Authorization: yield this._getAuthorizationHeader(),
98
+ "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf != null ? phenomlOnBehalfOf : undefined,
99
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
100
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
101
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.phenomlEnvironment.Default, `fhir-provider/${encodeURIComponent(fhirProviderId)}/fhir/${encodeURIComponent(fhirPath)}`),
102
+ method: "GET",
103
+ headers: _headers,
104
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
105
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
106
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
107
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
108
+ });
109
+ if (_response.ok) {
110
+ return { data: _response.body, rawResponse: _response.rawResponse };
111
+ }
112
+ if (_response.error.reason === "status-code") {
113
+ switch (_response.error.statusCode) {
114
+ case 400:
115
+ throw new phenoml.fhir.BadRequestError(_response.error.body, _response.rawResponse);
116
+ case 401:
117
+ throw new phenoml.fhir.UnauthorizedError(_response.error.body, _response.rawResponse);
118
+ case 404:
119
+ throw new phenoml.fhir.NotFoundError(_response.error.body, _response.rawResponse);
120
+ case 500:
121
+ throw new phenoml.fhir.InternalServerError(_response.error.body, _response.rawResponse);
122
+ default:
123
+ throw new errors.phenomlError({
124
+ statusCode: _response.error.statusCode,
125
+ body: _response.error.body,
126
+ rawResponse: _response.rawResponse,
127
+ });
128
+ }
129
+ }
130
+ switch (_response.error.reason) {
131
+ case "non-json":
132
+ throw new errors.phenomlError({
133
+ statusCode: _response.error.statusCode,
134
+ body: _response.error.rawBody,
135
+ rawResponse: _response.rawResponse,
136
+ });
137
+ case "timeout":
138
+ throw new errors.phenomlTimeoutError("Timeout exceeded when calling GET /fhir-provider/{fhir_provider_id}/fhir/{fhir_path}.");
139
+ case "unknown":
140
+ throw new errors.phenomlError({
141
+ message: _response.error.errorMessage,
142
+ rawResponse: _response.rawResponse,
143
+ });
144
+ }
145
+ });
146
+ }
147
+ /**
148
+ * Creates a new FHIR resource on the specified provider. The request body should contain a valid FHIR resource in JSON format.
149
+ *
150
+ * The request is proxied to the configured FHIR server with appropriate authentication headers.
151
+ *
152
+ * @param {string} fhirProviderId - The ID of the FHIR provider to use. Can be either:
153
+ * - A UUID representing the provider ID
154
+ * - A provider name (legacy support - will just use the most recently updated provider with this name)
155
+ * @param {string} fhirPath - The FHIR resource path to operate on. This follows FHIR RESTful API conventions.
156
+ * Examples:
157
+ * - "Patient" (for resource type operations)
158
+ * - "Patient/123" (for specific resource operations)
159
+ * - "Patient/123/_history" (for history operations)
160
+ * @param {phenoml.fhir.FhirCreateRequest} request
161
+ * @param {Fhir.RequestOptions} requestOptions - Request-specific configuration.
162
+ *
163
+ * @throws {@link phenoml.fhir.BadRequestError}
164
+ * @throws {@link phenoml.fhir.UnauthorizedError}
165
+ * @throws {@link phenoml.fhir.InternalServerError}
166
+ *
167
+ * @example
168
+ * await client.fhir.create("550e8400-e29b-41d4-a716-446655440000", "Patient", {
169
+ * "X-Phenoml-On-Behalf-Of": "user@example.com",
170
+ * body: {
171
+ * resourceType: "Patient"
172
+ * }
173
+ * })
174
+ */
175
+ create(fhirProviderId, fhirPath, request, requestOptions) {
176
+ return core.HttpResponsePromise.fromPromise(this.__create(fhirProviderId, fhirPath, request, requestOptions));
177
+ }
178
+ __create(fhirProviderId, fhirPath, request, requestOptions) {
179
+ return __awaiter(this, void 0, void 0, function* () {
180
+ var _a, _b, _c, _d;
181
+ const { "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf, body: _body } = request;
182
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
183
+ Authorization: yield this._getAuthorizationHeader(),
184
+ "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf != null ? phenomlOnBehalfOf : undefined,
185
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
186
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
187
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.phenomlEnvironment.Default, `fhir-provider/${encodeURIComponent(fhirProviderId)}/fhir/${encodeURIComponent(fhirPath)}`),
188
+ method: "POST",
189
+ headers: _headers,
190
+ contentType: "application/fhir+json",
191
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
192
+ requestType: "json",
193
+ body: _body,
194
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
195
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
196
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
197
+ });
198
+ if (_response.ok) {
199
+ return { data: _response.body, rawResponse: _response.rawResponse };
200
+ }
201
+ if (_response.error.reason === "status-code") {
202
+ switch (_response.error.statusCode) {
203
+ case 400:
204
+ throw new phenoml.fhir.BadRequestError(_response.error.body, _response.rawResponse);
205
+ case 401:
206
+ throw new phenoml.fhir.UnauthorizedError(_response.error.body, _response.rawResponse);
207
+ case 500:
208
+ throw new phenoml.fhir.InternalServerError(_response.error.body, _response.rawResponse);
209
+ default:
210
+ throw new errors.phenomlError({
211
+ statusCode: _response.error.statusCode,
212
+ body: _response.error.body,
213
+ rawResponse: _response.rawResponse,
214
+ });
215
+ }
216
+ }
217
+ switch (_response.error.reason) {
218
+ case "non-json":
219
+ throw new errors.phenomlError({
220
+ statusCode: _response.error.statusCode,
221
+ body: _response.error.rawBody,
222
+ rawResponse: _response.rawResponse,
223
+ });
224
+ case "timeout":
225
+ throw new errors.phenomlTimeoutError("Timeout exceeded when calling POST /fhir-provider/{fhir_provider_id}/fhir/{fhir_path}.");
226
+ case "unknown":
227
+ throw new errors.phenomlError({
228
+ message: _response.error.errorMessage,
229
+ rawResponse: _response.rawResponse,
230
+ });
231
+ }
232
+ });
233
+ }
234
+ /**
235
+ * Creates or updates a FHIR resource on the specified provider. If the resource exists, it will be updated; otherwise, it will be created.
236
+ *
237
+ * The request is proxied to the configured FHIR server with appropriate authentication headers.
238
+ *
239
+ * @param {string} fhirProviderId - The ID of the FHIR provider to use. Can be either:
240
+ * - A UUID representing the provider ID
241
+ * - A provider name (legacy support - will just use the most recently updated provider with this name)
242
+ * @param {string} fhirPath - The FHIR resource path to operate on. This follows FHIR RESTful API conventions.
243
+ * Examples:
244
+ * - "Patient" (for resource type operations)
245
+ * - "Patient/123" (for specific resource operations)
246
+ * - "Patient/123/_history" (for history operations)
247
+ * @param {phenoml.fhir.FhirUpsertRequest} request
248
+ * @param {Fhir.RequestOptions} requestOptions - Request-specific configuration.
249
+ *
250
+ * @throws {@link phenoml.fhir.BadRequestError}
251
+ * @throws {@link phenoml.fhir.UnauthorizedError}
252
+ * @throws {@link phenoml.fhir.InternalServerError}
253
+ *
254
+ * @example
255
+ * await client.fhir.upsert("550e8400-e29b-41d4-a716-446655440000", "Patient", {
256
+ * "X-Phenoml-On-Behalf-Of": "user@example.com",
257
+ * body: {
258
+ * resourceType: "Patient",
259
+ * id: "123"
260
+ * }
261
+ * })
262
+ */
263
+ upsert(fhirProviderId, fhirPath, request, requestOptions) {
264
+ return core.HttpResponsePromise.fromPromise(this.__upsert(fhirProviderId, fhirPath, request, requestOptions));
265
+ }
266
+ __upsert(fhirProviderId, fhirPath, request, requestOptions) {
267
+ return __awaiter(this, void 0, void 0, function* () {
268
+ var _a, _b, _c, _d;
269
+ const { "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf, body: _body } = request;
270
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
271
+ Authorization: yield this._getAuthorizationHeader(),
272
+ "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf != null ? phenomlOnBehalfOf : undefined,
273
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
274
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
275
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.phenomlEnvironment.Default, `fhir-provider/${encodeURIComponent(fhirProviderId)}/fhir/${encodeURIComponent(fhirPath)}`),
276
+ method: "PUT",
277
+ headers: _headers,
278
+ contentType: "application/fhir+json",
279
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
280
+ requestType: "json",
281
+ body: _body,
282
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
283
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
284
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
285
+ });
286
+ if (_response.ok) {
287
+ return { data: _response.body, rawResponse: _response.rawResponse };
288
+ }
289
+ if (_response.error.reason === "status-code") {
290
+ switch (_response.error.statusCode) {
291
+ case 400:
292
+ throw new phenoml.fhir.BadRequestError(_response.error.body, _response.rawResponse);
293
+ case 401:
294
+ throw new phenoml.fhir.UnauthorizedError(_response.error.body, _response.rawResponse);
295
+ case 500:
296
+ throw new phenoml.fhir.InternalServerError(_response.error.body, _response.rawResponse);
297
+ default:
298
+ throw new errors.phenomlError({
299
+ statusCode: _response.error.statusCode,
300
+ body: _response.error.body,
301
+ rawResponse: _response.rawResponse,
302
+ });
303
+ }
304
+ }
305
+ switch (_response.error.reason) {
306
+ case "non-json":
307
+ throw new errors.phenomlError({
308
+ statusCode: _response.error.statusCode,
309
+ body: _response.error.rawBody,
310
+ rawResponse: _response.rawResponse,
311
+ });
312
+ case "timeout":
313
+ throw new errors.phenomlTimeoutError("Timeout exceeded when calling PUT /fhir-provider/{fhir_provider_id}/fhir/{fhir_path}.");
314
+ case "unknown":
315
+ throw new errors.phenomlError({
316
+ message: _response.error.errorMessage,
317
+ rawResponse: _response.rawResponse,
318
+ });
319
+ }
320
+ });
321
+ }
322
+ /**
323
+ * Deletes a FHIR resource from the specified provider.
324
+ *
325
+ * The request is proxied to the configured FHIR server with appropriate authentication headers.
326
+ *
327
+ * @param {string} fhirProviderId - The ID of the FHIR provider to use. Can be either:
328
+ * - A UUID representing the provider ID
329
+ * - A provider name (legacy support - will just use the most recently updated provider with this name)
330
+ * @param {string} fhirPath - The FHIR resource path to operate on. This follows FHIR RESTful API conventions.
331
+ * Examples:
332
+ * - "Patient" (for resource type operations)
333
+ * - "Patient/123" (for specific resource operations)
334
+ * - "Patient/123/_history" (for history operations)
335
+ * @param {phenoml.fhir.FhirDeleteRequest} request
336
+ * @param {Fhir.RequestOptions} requestOptions - Request-specific configuration.
337
+ *
338
+ * @throws {@link phenoml.fhir.BadRequestError}
339
+ * @throws {@link phenoml.fhir.UnauthorizedError}
340
+ * @throws {@link phenoml.fhir.NotFoundError}
341
+ * @throws {@link phenoml.fhir.InternalServerError}
342
+ *
343
+ * @example
344
+ * await client.fhir.delete("550e8400-e29b-41d4-a716-446655440000", "Patient", {
345
+ * "X-Phenoml-On-Behalf-Of": "user@example.com"
346
+ * })
347
+ */
348
+ delete(fhirProviderId, fhirPath, request = {}, requestOptions) {
349
+ return core.HttpResponsePromise.fromPromise(this.__delete(fhirProviderId, fhirPath, request, requestOptions));
350
+ }
351
+ __delete(fhirProviderId_1, fhirPath_1) {
352
+ return __awaiter(this, arguments, void 0, function* (fhirProviderId, fhirPath, request = {}, requestOptions) {
353
+ var _a, _b, _c, _d;
354
+ const { "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf } = request;
355
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
356
+ Authorization: yield this._getAuthorizationHeader(),
357
+ "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf != null ? phenomlOnBehalfOf : undefined,
358
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
359
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
360
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.phenomlEnvironment.Default, `fhir-provider/${encodeURIComponent(fhirProviderId)}/fhir/${encodeURIComponent(fhirPath)}`),
361
+ method: "DELETE",
362
+ headers: _headers,
363
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
364
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
365
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
366
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
367
+ });
368
+ if (_response.ok) {
369
+ return { data: _response.body, rawResponse: _response.rawResponse };
370
+ }
371
+ if (_response.error.reason === "status-code") {
372
+ switch (_response.error.statusCode) {
373
+ case 400:
374
+ throw new phenoml.fhir.BadRequestError(_response.error.body, _response.rawResponse);
375
+ case 401:
376
+ throw new phenoml.fhir.UnauthorizedError(_response.error.body, _response.rawResponse);
377
+ case 404:
378
+ throw new phenoml.fhir.NotFoundError(_response.error.body, _response.rawResponse);
379
+ case 500:
380
+ throw new phenoml.fhir.InternalServerError(_response.error.body, _response.rawResponse);
381
+ default:
382
+ throw new errors.phenomlError({
383
+ statusCode: _response.error.statusCode,
384
+ body: _response.error.body,
385
+ rawResponse: _response.rawResponse,
386
+ });
387
+ }
388
+ }
389
+ switch (_response.error.reason) {
390
+ case "non-json":
391
+ throw new errors.phenomlError({
392
+ statusCode: _response.error.statusCode,
393
+ body: _response.error.rawBody,
394
+ rawResponse: _response.rawResponse,
395
+ });
396
+ case "timeout":
397
+ throw new errors.phenomlTimeoutError("Timeout exceeded when calling DELETE /fhir-provider/{fhir_provider_id}/fhir/{fhir_path}.");
398
+ case "unknown":
399
+ throw new errors.phenomlError({
400
+ message: _response.error.errorMessage,
401
+ rawResponse: _response.rawResponse,
402
+ });
403
+ }
404
+ });
405
+ }
406
+ /**
407
+ * Partially updates a FHIR resource on the specified provider using JSON Patch operations as defined in RFC 6902.
408
+ *
409
+ * The request body should contain an array of JSON Patch operations. Each operation specifies:
410
+ * - `op`: The operation type (add, remove, replace, move, copy, test)
411
+ * - `path`: JSON Pointer to the target location in the resource
412
+ * - `value`: The value to use (required for add, replace, and test operations)
413
+ *
414
+ * The request is proxied to the configured FHIR server with appropriate authentication headers.
415
+ *
416
+ * @param {string} fhirProviderId - The ID of the FHIR provider to use. Can be either:
417
+ * - A UUID representing the provider ID
418
+ * - A provider name (legacy support - will just use the most recently updated provider with this name)
419
+ * @param {string} fhirPath - The FHIR resource path to operate on. This follows FHIR RESTful API conventions.
420
+ * Examples:
421
+ * - "Patient" (for resource type operations)
422
+ * - "Patient/123" (for specific resource operations)
423
+ * - "Patient/123/_history" (for history operations)
424
+ * @param {phenoml.fhir.FhirPatchRequest} request
425
+ * @param {Fhir.RequestOptions} requestOptions - Request-specific configuration.
426
+ *
427
+ * @throws {@link phenoml.fhir.BadRequestError}
428
+ * @throws {@link phenoml.fhir.UnauthorizedError}
429
+ * @throws {@link phenoml.fhir.NotFoundError}
430
+ * @throws {@link phenoml.fhir.InternalServerError}
431
+ *
432
+ * @example
433
+ * await client.fhir.patch("550e8400-e29b-41d4-a716-446655440000", "Patient", {
434
+ * "X-Phenoml-On-Behalf-Of": "user@example.com",
435
+ * body: [{
436
+ * op: "replace",
437
+ * path: "/name/0/family",
438
+ * value: "NewFamilyName"
439
+ * }]
440
+ * })
441
+ *
442
+ * @example
443
+ * await client.fhir.patch("550e8400-e29b-41d4-a716-446655440000", "Patient", {
444
+ * "X-Phenoml-On-Behalf-Of": "user@example.com",
445
+ * body: [{
446
+ * op: "add",
447
+ * path: "/telecom/-",
448
+ * value: {
449
+ * "system": "phone",
450
+ * "value": "+1-555-123-4567",
451
+ * "use": "home"
452
+ * }
453
+ * }]
454
+ * })
455
+ *
456
+ * @example
457
+ * await client.fhir.patch("550e8400-e29b-41d4-a716-446655440000", "Patient", {
458
+ * "X-Phenoml-On-Behalf-Of": "user@example.com",
459
+ * body: [{
460
+ * op: "replace",
461
+ * path: "/name/0/family",
462
+ * value: "Smith"
463
+ * }, {
464
+ * op: "add",
465
+ * path: "/telecom/-",
466
+ * value: {
467
+ * "system": "email",
468
+ * "value": "john.smith@example.com"
469
+ * }
470
+ * }, {
471
+ * op: "remove",
472
+ * path: "/address/0"
473
+ * }]
474
+ * })
475
+ *
476
+ * @example
477
+ * await client.fhir.patch("550e8400-e29b-41d4-a716-446655440000", "Patient", {
478
+ * "X-Phenoml-On-Behalf-Of": "user@example.com",
479
+ * body: [{
480
+ * op: "test",
481
+ * path: "/gender",
482
+ * value: "male"
483
+ * }, {
484
+ * op: "replace",
485
+ * path: "/gender",
486
+ * value: "female"
487
+ * }]
488
+ * })
489
+ */
490
+ patch(fhirProviderId, fhirPath, request, requestOptions) {
491
+ return core.HttpResponsePromise.fromPromise(this.__patch(fhirProviderId, fhirPath, request, requestOptions));
492
+ }
493
+ __patch(fhirProviderId, fhirPath, request, requestOptions) {
494
+ return __awaiter(this, void 0, void 0, function* () {
495
+ var _a, _b, _c, _d;
496
+ const { "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf, body: _body } = request;
497
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
498
+ Authorization: yield this._getAuthorizationHeader(),
499
+ "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf != null ? phenomlOnBehalfOf : undefined,
500
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
501
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
502
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.phenomlEnvironment.Default, `fhir-provider/${encodeURIComponent(fhirProviderId)}/fhir/${encodeURIComponent(fhirPath)}`),
503
+ method: "PATCH",
504
+ headers: _headers,
505
+ contentType: "application/json-patch+json",
506
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
507
+ requestType: "json",
508
+ body: _body,
509
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
510
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
511
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
512
+ });
513
+ if (_response.ok) {
514
+ return { data: _response.body, rawResponse: _response.rawResponse };
515
+ }
516
+ if (_response.error.reason === "status-code") {
517
+ switch (_response.error.statusCode) {
518
+ case 400:
519
+ throw new phenoml.fhir.BadRequestError(_response.error.body, _response.rawResponse);
520
+ case 401:
521
+ throw new phenoml.fhir.UnauthorizedError(_response.error.body, _response.rawResponse);
522
+ case 404:
523
+ throw new phenoml.fhir.NotFoundError(_response.error.body, _response.rawResponse);
524
+ case 500:
525
+ throw new phenoml.fhir.InternalServerError(_response.error.body, _response.rawResponse);
526
+ default:
527
+ throw new errors.phenomlError({
528
+ statusCode: _response.error.statusCode,
529
+ body: _response.error.body,
530
+ rawResponse: _response.rawResponse,
531
+ });
532
+ }
533
+ }
534
+ switch (_response.error.reason) {
535
+ case "non-json":
536
+ throw new errors.phenomlError({
537
+ statusCode: _response.error.statusCode,
538
+ body: _response.error.rawBody,
539
+ rawResponse: _response.rawResponse,
540
+ });
541
+ case "timeout":
542
+ throw new errors.phenomlTimeoutError("Timeout exceeded when calling PATCH /fhir-provider/{fhir_provider_id}/fhir/{fhir_path}.");
543
+ case "unknown":
544
+ throw new errors.phenomlError({
545
+ message: _response.error.errorMessage,
546
+ rawResponse: _response.rawResponse,
547
+ });
548
+ }
549
+ });
550
+ }
551
+ /**
552
+ * Executes a FHIR Bundle transaction or batch operation on the specified provider. This allows multiple FHIR resources to be processed in a single request.
553
+ *
554
+ * The request body should contain a valid FHIR Bundle resource with transaction or batch type.
555
+ *
556
+ * The request is proxied to the configured FHIR server with appropriate authentication headers.
557
+ *
558
+ * @param {string} fhirProviderId - The ID of the FHIR provider to use. Can be either:
559
+ * - A UUID representing the provider ID
560
+ * - A provider name (legacy support - will just use the most recently updated provider with this name)
561
+ * @param {phenoml.fhir.FhirExecuteBundleRequest} request
562
+ * @param {Fhir.RequestOptions} requestOptions - Request-specific configuration.
563
+ *
564
+ * @throws {@link phenoml.fhir.BadRequestError}
565
+ * @throws {@link phenoml.fhir.UnauthorizedError}
566
+ * @throws {@link phenoml.fhir.InternalServerError}
567
+ *
568
+ * @example
569
+ * await client.fhir.executeBundle("550e8400-e29b-41d4-a716-446655440000", {
570
+ * "X-Phenoml-On-Behalf-Of": "user@example.com",
571
+ * body: {
572
+ * resourceType: "Bundle",
573
+ * entry: [{
574
+ * resource: {
575
+ * "resourceType": "Patient",
576
+ * "name": [
577
+ * {
578
+ * "family": "Doe",
579
+ * "given": [
580
+ * "John"
581
+ * ]
582
+ * }
583
+ * ]
584
+ * },
585
+ * request: {
586
+ * method: "POST",
587
+ * url: "Patient"
588
+ * }
589
+ * }, {
590
+ * resource: {
591
+ * "resourceType": "Observation",
592
+ * "status": "final",
593
+ * "subject": {
594
+ * "reference": "Patient/123"
595
+ * }
596
+ * },
597
+ * request: {
598
+ * method: "POST",
599
+ * url: "Observation"
600
+ * }
601
+ * }]
602
+ * }
603
+ * })
604
+ */
605
+ executeBundle(fhirProviderId, request, requestOptions) {
606
+ return core.HttpResponsePromise.fromPromise(this.__executeBundle(fhirProviderId, request, requestOptions));
607
+ }
608
+ __executeBundle(fhirProviderId, request, requestOptions) {
609
+ return __awaiter(this, void 0, void 0, function* () {
610
+ var _a, _b, _c, _d;
611
+ const { "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf, body: _body } = request;
612
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
613
+ Authorization: yield this._getAuthorizationHeader(),
614
+ "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf != null ? phenomlOnBehalfOf : undefined,
615
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
616
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
617
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.phenomlEnvironment.Default, `fhir-provider/${encodeURIComponent(fhirProviderId)}/fhir`),
618
+ method: "POST",
619
+ headers: _headers,
620
+ contentType: "application/fhir+json",
621
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
622
+ requestType: "json",
623
+ body: _body,
624
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
625
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
626
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
627
+ });
628
+ if (_response.ok) {
629
+ return { data: _response.body, rawResponse: _response.rawResponse };
630
+ }
631
+ if (_response.error.reason === "status-code") {
632
+ switch (_response.error.statusCode) {
633
+ case 400:
634
+ throw new phenoml.fhir.BadRequestError(_response.error.body, _response.rawResponse);
635
+ case 401:
636
+ throw new phenoml.fhir.UnauthorizedError(_response.error.body, _response.rawResponse);
637
+ case 500:
638
+ throw new phenoml.fhir.InternalServerError(_response.error.body, _response.rawResponse);
639
+ default:
640
+ throw new errors.phenomlError({
641
+ statusCode: _response.error.statusCode,
642
+ body: _response.error.body,
643
+ rawResponse: _response.rawResponse,
644
+ });
645
+ }
646
+ }
647
+ switch (_response.error.reason) {
648
+ case "non-json":
649
+ throw new errors.phenomlError({
650
+ statusCode: _response.error.statusCode,
651
+ body: _response.error.rawBody,
652
+ rawResponse: _response.rawResponse,
653
+ });
654
+ case "timeout":
655
+ throw new errors.phenomlTimeoutError("Timeout exceeded when calling POST /fhir-provider/{fhir_provider_id}/fhir.");
656
+ case "unknown":
657
+ throw new errors.phenomlError({
658
+ message: _response.error.errorMessage,
659
+ rawResponse: _response.rawResponse,
660
+ });
661
+ }
662
+ });
663
+ }
664
+ _getAuthorizationHeader() {
665
+ return __awaiter(this, void 0, void 0, function* () {
666
+ const bearer = yield core.Supplier.get(this._options.token);
667
+ if (bearer != null) {
668
+ return `Bearer ${bearer}`;
669
+ }
670
+ return undefined;
671
+ });
672
+ }
673
+ }
674
+ exports.Fhir = Fhir;