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