gdc-sdk-front-ts 0.6.2 → 0.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (396) hide show
  1. package/README.md +36 -8
  2. package/dist/ProfileManager.d.ts +22 -0
  3. package/dist/ProfileManager.js +155 -0
  4. package/dist/gdc-common-utils-ts/src/AesManager.d.ts +27 -0
  5. package/dist/gdc-common-utils-ts/src/AesManager.js +64 -0
  6. package/dist/gdc-common-utils-ts/src/CryptographyService.d.ts +76 -0
  7. package/dist/gdc-common-utils-ts/src/CryptographyService.js +401 -0
  8. package/dist/gdc-common-utils-ts/src/constants/actor-session.d.ts +40 -0
  9. package/dist/gdc-common-utils-ts/src/constants/actor-session.js +40 -0
  10. package/dist/gdc-common-utils-ts/src/constants/communication.d.ts +28 -0
  11. package/dist/gdc-common-utils-ts/src/constants/communication.js +14 -0
  12. package/dist/gdc-common-utils-ts/src/constants/cryptography.d.ts +58 -0
  13. package/dist/gdc-common-utils-ts/src/constants/cryptography.js +49 -0
  14. package/dist/gdc-common-utils-ts/src/constants/dataspace-discovery.d.ts +11 -0
  15. package/dist/gdc-common-utils-ts/src/constants/dataspace-discovery.js +11 -0
  16. package/dist/gdc-common-utils-ts/src/constants/dataspace-protocol.d.ts +27 -0
  17. package/dist/gdc-common-utils-ts/src/constants/dataspace-protocol.js +27 -0
  18. package/dist/gdc-common-utils-ts/src/constants/device.d.ts +16 -0
  19. package/dist/gdc-common-utils-ts/src/constants/device.js +15 -0
  20. package/dist/gdc-common-utils-ts/src/constants/did-services.d.ts +42 -0
  21. package/dist/gdc-common-utils-ts/src/constants/did-services.js +40 -0
  22. package/dist/gdc-common-utils-ts/src/constants/eu-countries.d.ts +36 -0
  23. package/dist/gdc-common-utils-ts/src/constants/eu-countries.js +69 -0
  24. package/dist/gdc-common-utils-ts/src/constants/fhir-code-systems.d.ts +12 -0
  25. package/dist/gdc-common-utils-ts/src/constants/fhir-code-systems.js +12 -0
  26. package/dist/gdc-common-utils-ts/src/constants/fhir-resource-types.d.ts +52 -0
  27. package/dist/gdc-common-utils-ts/src/constants/fhir-resource-types.js +33 -0
  28. package/dist/gdc-common-utils-ts/src/constants/fhir-versions.d.ts +10 -0
  29. package/dist/gdc-common-utils-ts/src/constants/fhir-versions.js +10 -0
  30. package/dist/gdc-common-utils-ts/src/constants/healthcare.d.ts +496 -0
  31. package/dist/gdc-common-utils-ts/src/constants/healthcare.js +274 -0
  32. package/dist/gdc-common-utils-ts/src/constants/hl7-roles.d.ts +44 -0
  33. package/dist/gdc-common-utils-ts/src/constants/hl7-roles.js +208 -0
  34. package/dist/gdc-common-utils-ts/src/constants/index.d.ts +21 -0
  35. package/dist/gdc-common-utils-ts/src/constants/index.js +21 -0
  36. package/dist/gdc-common-utils-ts/src/constants/network.d.ts +25 -0
  37. package/dist/gdc-common-utils-ts/src/constants/network.js +17 -0
  38. package/dist/gdc-common-utils-ts/src/constants/schemaorg.d.ts +175 -0
  39. package/dist/gdc-common-utils-ts/src/constants/schemaorg.js +261 -0
  40. package/dist/gdc-common-utils-ts/src/constants/sectors.d.ts +24 -0
  41. package/dist/gdc-common-utils-ts/src/constants/sectors.js +24 -0
  42. package/dist/gdc-common-utils-ts/src/constants/service-capabilities.d.ts +82 -0
  43. package/dist/gdc-common-utils-ts/src/constants/service-capabilities.js +105 -0
  44. package/dist/gdc-common-utils-ts/src/constants/smart.d.ts +12 -0
  45. package/dist/gdc-common-utils-ts/src/constants/smart.js +12 -0
  46. package/dist/gdc-common-utils-ts/src/constants/urn.d.ts +11 -0
  47. package/dist/gdc-common-utils-ts/src/constants/urn.js +11 -0
  48. package/dist/gdc-common-utils-ts/src/constants/verifiable-credentials.d.ts +34 -0
  49. package/dist/gdc-common-utils-ts/src/constants/verifiable-credentials.js +42 -0
  50. package/dist/gdc-common-utils-ts/src/constants/vital-signs.d.ts +75 -0
  51. package/dist/gdc-common-utils-ts/src/constants/vital-signs.js +33 -0
  52. package/dist/gdc-common-utils-ts/src/examples/api-flow-examples.d.ts +15 -0
  53. package/dist/gdc-common-utils-ts/src/examples/api-flow-examples.js +16 -0
  54. package/dist/gdc-common-utils-ts/src/examples/communication-bundle-session.d.ts +22 -0
  55. package/dist/gdc-common-utils-ts/src/examples/communication-bundle-session.js +81 -0
  56. package/dist/gdc-common-utils-ts/src/examples/consent-access.d.ts +30 -0
  57. package/dist/gdc-common-utils-ts/src/examples/consent-access.js +121 -0
  58. package/dist/gdc-common-utils-ts/src/examples/contract-examples.d.ts +15 -0
  59. package/dist/gdc-common-utils-ts/src/examples/contract-examples.js +16 -0
  60. package/dist/gdc-common-utils-ts/src/examples/dataspace-discovery.d.ts +98 -0
  61. package/dist/gdc-common-utils-ts/src/examples/dataspace-discovery.js +141 -0
  62. package/dist/gdc-common-utils-ts/src/examples/frontend-session.d.ts +13 -0
  63. package/dist/gdc-common-utils-ts/src/examples/frontend-session.js +24 -0
  64. package/dist/gdc-common-utils-ts/src/examples/ica-activation-proof.d.ts +64 -0
  65. package/dist/gdc-common-utils-ts/src/examples/ica-activation-proof.js +77 -0
  66. package/dist/gdc-common-utils-ts/src/examples/index.d.ts +14 -0
  67. package/dist/gdc-common-utils-ts/src/examples/index.js +14 -0
  68. package/dist/gdc-common-utils-ts/src/examples/individual-controller.d.ts +100 -0
  69. package/dist/gdc-common-utils-ts/src/examples/individual-controller.js +71 -0
  70. package/dist/gdc-common-utils-ts/src/examples/lifecycle.d.ts +505 -0
  71. package/dist/gdc-common-utils-ts/src/examples/lifecycle.js +291 -0
  72. package/dist/gdc-common-utils-ts/src/examples/organization-controller.d.ts +163 -0
  73. package/dist/gdc-common-utils-ts/src/examples/organization-controller.js +93 -0
  74. package/dist/gdc-common-utils-ts/src/examples/professional.d.ts +228 -0
  75. package/dist/gdc-common-utils-ts/src/examples/professional.js +324 -0
  76. package/dist/gdc-common-utils-ts/src/examples/related-person.d.ts +10 -0
  77. package/dist/gdc-common-utils-ts/src/examples/related-person.js +13 -0
  78. package/dist/gdc-common-utils-ts/src/examples/relationship-access.d.ts +11 -0
  79. package/dist/gdc-common-utils-ts/src/examples/relationship-access.js +96 -0
  80. package/dist/gdc-common-utils-ts/src/examples/shared.d.ts +220 -0
  81. package/dist/gdc-common-utils-ts/src/examples/shared.js +191 -0
  82. package/dist/gdc-common-utils-ts/src/hmac.d.ts +14 -0
  83. package/dist/gdc-common-utils-ts/src/hmac.js +24 -0
  84. package/dist/gdc-common-utils-ts/src/i18n/clinical-sections.i18n.d.ts +6 -0
  85. package/dist/gdc-common-utils-ts/src/i18n/clinical-sections.i18n.js +15 -0
  86. package/dist/gdc-common-utils-ts/src/i18n/role-codes.i18n.d.ts +4 -0
  87. package/dist/gdc-common-utils-ts/src/i18n/role-codes.i18n.js +13 -0
  88. package/dist/gdc-common-utils-ts/src/index.d.ts +10 -0
  89. package/dist/gdc-common-utils-ts/src/index.js +10 -0
  90. package/dist/gdc-common-utils-ts/src/interfaces/Cryptography.types.d.ts +139 -0
  91. package/dist/gdc-common-utils-ts/src/interfaces/Cryptography.types.js +8 -0
  92. package/dist/gdc-common-utils-ts/src/interfaces/ICryptoHelper.d.ts +28 -0
  93. package/dist/gdc-common-utils-ts/src/interfaces/ICryptoHelper.js +3 -0
  94. package/dist/gdc-common-utils-ts/src/interfaces/ICryptography.d.ts +154 -0
  95. package/dist/gdc-common-utils-ts/src/interfaces/ICryptography.js +3 -0
  96. package/dist/gdc-common-utils-ts/src/models/actor-session.d.ts +9 -0
  97. package/dist/gdc-common-utils-ts/src/models/actor-session.js +3 -0
  98. package/dist/gdc-common-utils-ts/src/models/aes.d.ts +85 -0
  99. package/dist/gdc-common-utils-ts/src/models/aes.js +10 -0
  100. package/dist/gdc-common-utils-ts/src/models/auth.d.ts +35 -0
  101. package/dist/gdc-common-utils-ts/src/models/auth.js +3 -0
  102. package/dist/gdc-common-utils-ts/src/models/bundle.d.ts +153 -0
  103. package/dist/gdc-common-utils-ts/src/models/bundle.js +25 -0
  104. package/dist/gdc-common-utils-ts/src/models/clinical-sections.d.ts +36 -0
  105. package/dist/gdc-common-utils-ts/src/models/clinical-sections.en.d.ts +150 -0
  106. package/dist/gdc-common-utils-ts/src/models/clinical-sections.en.js +104 -0
  107. package/dist/gdc-common-utils-ts/src/models/clinical-sections.js +32 -0
  108. package/dist/gdc-common-utils-ts/src/models/clinical-workbook-summary.d.ts +126 -0
  109. package/dist/gdc-common-utils-ts/src/models/clinical-workbook-summary.js +67 -0
  110. package/dist/gdc-common-utils-ts/src/models/comm.d.ts +56 -0
  111. package/dist/gdc-common-utils-ts/src/models/comm.js +4 -0
  112. package/dist/gdc-common-utils-ts/src/models/confidential-job.d.ts +78 -0
  113. package/dist/gdc-common-utils-ts/src/models/confidential-job.js +20 -0
  114. package/dist/gdc-common-utils-ts/src/models/confidential-message.d.ts +97 -0
  115. package/dist/gdc-common-utils-ts/src/models/confidential-message.js +4 -0
  116. package/dist/gdc-common-utils-ts/src/models/confidential-storage.d.ts +134 -0
  117. package/dist/gdc-common-utils-ts/src/models/confidential-storage.js +3 -0
  118. package/dist/gdc-common-utils-ts/src/models/consent-access.d.ts +79 -0
  119. package/dist/gdc-common-utils-ts/src/models/consent-access.js +2 -0
  120. package/dist/gdc-common-utils-ts/src/models/consent-rule.d.ts +122 -0
  121. package/dist/gdc-common-utils-ts/src/models/consent-rule.js +22 -0
  122. package/dist/gdc-common-utils-ts/src/models/crypto.d.ts +35 -0
  123. package/dist/gdc-common-utils-ts/src/models/crypto.js +3 -0
  124. package/dist/gdc-common-utils-ts/src/models/dataspace-discovery-defaults.d.ts +79 -0
  125. package/dist/gdc-common-utils-ts/src/models/dataspace-discovery-defaults.js +2 -0
  126. package/dist/gdc-common-utils-ts/src/models/dataspace-discovery.d.ts +68 -0
  127. package/dist/gdc-common-utils-ts/src/models/dataspace-discovery.js +9 -0
  128. package/dist/gdc-common-utils-ts/src/models/dataspace-protocol.d.ts +14 -0
  129. package/dist/gdc-common-utils-ts/src/models/dataspace-protocol.js +2 -0
  130. package/dist/gdc-common-utils-ts/src/models/device-license.d.ts +134 -0
  131. package/dist/gdc-common-utils-ts/src/models/device-license.js +3 -0
  132. package/dist/gdc-common-utils-ts/src/models/did.d.ts +108 -0
  133. package/dist/gdc-common-utils-ts/src/models/did.js +3 -0
  134. package/dist/gdc-common-utils-ts/src/models/fhir-documents.d.ts +101 -0
  135. package/dist/gdc-common-utils-ts/src/models/fhir-documents.js +3 -0
  136. package/dist/gdc-common-utils-ts/src/models/identity-bootstrap.d.ts +104 -0
  137. package/dist/gdc-common-utils-ts/src/models/identity-bootstrap.js +2 -0
  138. package/dist/gdc-common-utils-ts/src/models/index.d.ts +42 -0
  139. package/dist/gdc-common-utils-ts/src/models/index.js +42 -0
  140. package/dist/gdc-common-utils-ts/src/models/indexing.d.ts +11 -0
  141. package/dist/gdc-common-utils-ts/src/models/indexing.js +18 -0
  142. package/dist/gdc-common-utils-ts/src/models/interoperable-claims/allergy-intolerance-claims.d.ts +24 -0
  143. package/dist/gdc-common-utils-ts/src/models/interoperable-claims/allergy-intolerance-claims.js +36 -0
  144. package/dist/gdc-common-utils-ts/src/models/interoperable-claims/communication-claims.d.ts +53 -0
  145. package/dist/gdc-common-utils-ts/src/models/interoperable-claims/communication-claims.js +55 -0
  146. package/dist/gdc-common-utils-ts/src/models/interoperable-claims/condition-claims.d.ts +14 -0
  147. package/dist/gdc-common-utils-ts/src/models/interoperable-claims/condition-claims.js +25 -0
  148. package/dist/gdc-common-utils-ts/src/models/interoperable-claims/device-use-statement-claims.d.ts +13 -0
  149. package/dist/gdc-common-utils-ts/src/models/interoperable-claims/device-use-statement-claims.js +23 -0
  150. package/dist/gdc-common-utils-ts/src/models/interoperable-claims/document-reference-claims.d.ts +36 -0
  151. package/dist/gdc-common-utils-ts/src/models/interoperable-claims/document-reference-claims.js +89 -0
  152. package/dist/gdc-common-utils-ts/src/models/interoperable-claims/medication-statement-claims.d.ts +341 -0
  153. package/dist/gdc-common-utils-ts/src/models/interoperable-claims/medication-statement-claims.js +204 -0
  154. package/dist/gdc-common-utils-ts/src/models/interoperable-claims/types.d.ts +9 -0
  155. package/dist/gdc-common-utils-ts/src/models/interoperable-claims/types.js +3 -0
  156. package/dist/gdc-common-utils-ts/src/models/interoperable-claims.d.ts +5 -0
  157. package/dist/gdc-common-utils-ts/src/models/interoperable-claims.js +7 -0
  158. package/dist/gdc-common-utils-ts/src/models/issue.d.ts +57 -0
  159. package/dist/gdc-common-utils-ts/src/models/issue.js +75 -0
  160. package/dist/gdc-common-utils-ts/src/models/jsonapi.d.ts +13 -0
  161. package/dist/gdc-common-utils-ts/src/models/jsonapi.js +3 -0
  162. package/dist/gdc-common-utils-ts/src/models/jwe.d.ts +120 -0
  163. package/dist/gdc-common-utils-ts/src/models/jwe.js +3 -0
  164. package/dist/gdc-common-utils-ts/src/models/jwk.d.ts +39 -0
  165. package/dist/gdc-common-utils-ts/src/models/jwk.js +3 -0
  166. package/dist/gdc-common-utils-ts/src/models/jws.d.ts +35 -0
  167. package/dist/gdc-common-utils-ts/src/models/jws.js +3 -0
  168. package/dist/gdc-common-utils-ts/src/models/jwt.d.ts +9 -0
  169. package/dist/gdc-common-utils-ts/src/models/jwt.js +3 -0
  170. package/dist/gdc-common-utils-ts/src/models/loinc-document-ontology.d.ts +55 -0
  171. package/dist/gdc-common-utils-ts/src/models/loinc-document-ontology.js +58 -0
  172. package/dist/gdc-common-utils-ts/src/models/oidc4ida.common.model.d.ts +33 -0
  173. package/dist/gdc-common-utils-ts/src/models/oidc4ida.common.model.js +3 -0
  174. package/dist/gdc-common-utils-ts/src/models/oidc4ida.document.model.d.ts +50 -0
  175. package/dist/gdc-common-utils-ts/src/models/oidc4ida.document.model.js +3 -0
  176. package/dist/gdc-common-utils-ts/src/models/oidc4ida.electronicRecord.model.d.ts +67 -0
  177. package/dist/gdc-common-utils-ts/src/models/oidc4ida.electronicRecord.model.js +3 -0
  178. package/dist/gdc-common-utils-ts/src/models/oidc4ida.evidence.model.d.ts +51 -0
  179. package/dist/gdc-common-utils-ts/src/models/oidc4ida.evidence.model.js +5 -0
  180. package/dist/gdc-common-utils-ts/src/models/openid-device.d.ts +119 -0
  181. package/dist/gdc-common-utils-ts/src/models/openid-device.js +3 -0
  182. package/dist/gdc-common-utils-ts/src/models/operation-outcome.d.ts +26 -0
  183. package/dist/gdc-common-utils-ts/src/models/operation-outcome.js +3 -0
  184. package/dist/gdc-common-utils-ts/src/models/params.d.ts +133 -0
  185. package/dist/gdc-common-utils-ts/src/models/params.js +3 -0
  186. package/dist/gdc-common-utils-ts/src/models/relationship-access.d.ts +160 -0
  187. package/dist/gdc-common-utils-ts/src/models/relationship-access.js +21 -0
  188. package/dist/gdc-common-utils-ts/src/models/resource-document.d.ts +14 -0
  189. package/dist/gdc-common-utils-ts/src/models/resource-document.js +3 -0
  190. package/dist/gdc-common-utils-ts/src/models/response.d.ts +1 -0
  191. package/dist/gdc-common-utils-ts/src/models/response.js +3 -0
  192. package/dist/gdc-common-utils-ts/src/models/urlPath.d.ts +58 -0
  193. package/dist/gdc-common-utils-ts/src/models/urlPath.js +76 -0
  194. package/dist/gdc-common-utils-ts/src/models/verifiable-credential.d.ts +45 -0
  195. package/dist/gdc-common-utils-ts/src/models/verifiable-credential.js +8 -0
  196. package/dist/gdc-common-utils-ts/src/storage/IVaultRepository.d.ts +53 -0
  197. package/dist/gdc-common-utils-ts/src/storage/IVaultRepository.js +25 -0
  198. package/dist/gdc-common-utils-ts/src/storage/VaultMemRepository.d.ts +30 -0
  199. package/dist/gdc-common-utils-ts/src/storage/VaultMemRepository.js +81 -0
  200. package/dist/gdc-common-utils-ts/src/storage/index.d.ts +3 -0
  201. package/dist/gdc-common-utils-ts/src/storage/index.js +4 -0
  202. package/dist/gdc-common-utils-ts/src/utils/activation-policy.d.ts +86 -0
  203. package/dist/gdc-common-utils-ts/src/utils/activation-policy.js +218 -0
  204. package/dist/gdc-common-utils-ts/src/utils/activation-request.d.ts +81 -0
  205. package/dist/gdc-common-utils-ts/src/utils/activation-request.js +99 -0
  206. package/dist/gdc-common-utils-ts/src/utils/actor.d.ts +18 -0
  207. package/dist/gdc-common-utils-ts/src/utils/actor.js +36 -0
  208. package/dist/gdc-common-utils-ts/src/utils/base-convert.d.ts +60 -0
  209. package/dist/gdc-common-utils-ts/src/utils/base-convert.js +104 -0
  210. package/dist/gdc-common-utils-ts/src/utils/baseN.d.ts +35 -0
  211. package/dist/gdc-common-utils-ts/src/utils/baseN.js +174 -0
  212. package/dist/gdc-common-utils-ts/src/utils/bundle-query.d.ts +35 -0
  213. package/dist/gdc-common-utils-ts/src/utils/bundle-query.js +177 -0
  214. package/dist/gdc-common-utils-ts/src/utils/bundle.d.ts +13 -0
  215. package/dist/gdc-common-utils-ts/src/utils/bundle.js +39 -0
  216. package/dist/gdc-common-utils-ts/src/utils/clinical-resource-converters.d.ts +64 -0
  217. package/dist/gdc-common-utils-ts/src/utils/clinical-resource-converters.js +279 -0
  218. package/dist/gdc-common-utils-ts/src/utils/clinical-resource-view.d.ts +55 -0
  219. package/dist/gdc-common-utils-ts/src/utils/clinical-resource-view.js +291 -0
  220. package/dist/gdc-common-utils-ts/src/utils/communication-bundle-session.d.ts +110 -0
  221. package/dist/gdc-common-utils-ts/src/utils/communication-bundle-session.js +326 -0
  222. package/dist/gdc-common-utils-ts/src/utils/communication-document-reference.d.ts +41 -0
  223. package/dist/gdc-common-utils-ts/src/utils/communication-document-reference.js +170 -0
  224. package/dist/gdc-common-utils-ts/src/utils/communication-fhir-r4.d.ts +41 -0
  225. package/dist/gdc-common-utils-ts/src/utils/communication-fhir-r4.js +215 -0
  226. package/dist/gdc-common-utils-ts/src/utils/communication-identity.d.ts +152 -0
  227. package/dist/gdc-common-utils-ts/src/utils/communication-identity.js +121 -0
  228. package/dist/gdc-common-utils-ts/src/utils/consent-claim-helpers.d.ts +79 -0
  229. package/dist/gdc-common-utils-ts/src/utils/consent-claim-helpers.js +213 -0
  230. package/dist/gdc-common-utils-ts/src/utils/consent.d.ts +218 -0
  231. package/dist/gdc-common-utils-ts/src/utils/consent.js +679 -0
  232. package/dist/gdc-common-utils-ts/src/utils/content.d.ts +55 -0
  233. package/dist/gdc-common-utils-ts/src/utils/content.js +60 -0
  234. package/dist/gdc-common-utils-ts/src/utils/dataspace-discovery-defaults.d.ts +130 -0
  235. package/dist/gdc-common-utils-ts/src/utils/dataspace-discovery-defaults.js +307 -0
  236. package/dist/gdc-common-utils-ts/src/utils/dataspace-discovery.d.ts +235 -0
  237. package/dist/gdc-common-utils-ts/src/utils/dataspace-discovery.js +482 -0
  238. package/dist/gdc-common-utils-ts/src/utils/dataspace-protocol.d.ts +66 -0
  239. package/dist/gdc-common-utils-ts/src/utils/dataspace-protocol.js +109 -0
  240. package/dist/gdc-common-utils-ts/src/utils/did-resolution.d.ts +60 -0
  241. package/dist/gdc-common-utils-ts/src/utils/did-resolution.js +173 -0
  242. package/dist/gdc-common-utils-ts/src/utils/did.d.ts +124 -0
  243. package/dist/gdc-common-utils-ts/src/utils/did.js +204 -0
  244. package/dist/gdc-common-utils-ts/src/utils/didcomm-submit-policy.d.ts +10 -0
  245. package/dist/gdc-common-utils-ts/src/utils/didcomm-submit-policy.js +15 -0
  246. package/dist/gdc-common-utils-ts/src/utils/didcomm-submit.d.ts +48 -0
  247. package/dist/gdc-common-utils-ts/src/utils/didcomm-submit.js +81 -0
  248. package/dist/gdc-common-utils-ts/src/utils/didcomm.d.ts +60 -0
  249. package/dist/gdc-common-utils-ts/src/utils/didcomm.js +78 -0
  250. package/dist/gdc-common-utils-ts/src/utils/discovery-normalization.d.ts +28 -0
  251. package/dist/gdc-common-utils-ts/src/utils/discovery-normalization.js +64 -0
  252. package/dist/gdc-common-utils-ts/src/utils/fhir-cid.d.ts +60 -0
  253. package/dist/gdc-common-utils-ts/src/utils/fhir-cid.js +152 -0
  254. package/dist/gdc-common-utils-ts/src/utils/fhir-validator.d.ts +61 -0
  255. package/dist/gdc-common-utils-ts/src/utils/fhir-validator.js +91 -0
  256. package/dist/gdc-common-utils-ts/src/utils/format-converter.d.ts +21 -0
  257. package/dist/gdc-common-utils-ts/src/utils/format-converter.js +109 -0
  258. package/dist/gdc-common-utils-ts/src/utils/index.d.ts +39 -0
  259. package/dist/gdc-common-utils-ts/src/utils/index.js +39 -0
  260. package/dist/gdc-common-utils-ts/src/utils/individual-form-pdf.d.ts +55 -0
  261. package/dist/gdc-common-utils-ts/src/utils/individual-form-pdf.js +191 -0
  262. package/dist/gdc-common-utils-ts/src/utils/jwt.d.ts +53 -0
  263. package/dist/gdc-common-utils-ts/src/utils/jwt.js +154 -0
  264. package/dist/gdc-common-utils-ts/src/utils/manager-error.d.ts +15 -0
  265. package/dist/gdc-common-utils-ts/src/utils/manager-error.js +21 -0
  266. package/dist/gdc-common-utils-ts/src/utils/medication-claim-helpers.d.ts +56 -0
  267. package/dist/gdc-common-utils-ts/src/utils/medication-claim-helpers.js +127 -0
  268. package/dist/gdc-common-utils-ts/src/utils/multibase58.d.ts +13 -0
  269. package/dist/gdc-common-utils-ts/src/utils/multibase58.js +40 -0
  270. package/dist/gdc-common-utils-ts/src/utils/multibasehash.d.ts +8 -0
  271. package/dist/gdc-common-utils-ts/src/utils/multibasehash.js +23 -0
  272. package/dist/gdc-common-utils-ts/src/utils/normalize-uuid.d.ts +1 -0
  273. package/dist/gdc-common-utils-ts/src/utils/normalize-uuid.js +35 -0
  274. package/dist/gdc-common-utils-ts/src/utils/normalize.d.ts +16 -0
  275. package/dist/gdc-common-utils-ts/src/utils/normalize.js +40 -0
  276. package/dist/gdc-common-utils-ts/src/utils/object-convert.d.ts +20 -0
  277. package/dist/gdc-common-utils-ts/src/utils/object-convert.js +51 -0
  278. package/dist/gdc-common-utils-ts/src/utils/smart-scope.d.ts +28 -0
  279. package/dist/gdc-common-utils-ts/src/utils/smart-scope.js +29 -0
  280. package/dist/gdc-common-utils-ts/src/utils/string-convert.d.ts +24 -0
  281. package/dist/gdc-common-utils-ts/src/utils/string-convert.js +62 -0
  282. package/dist/gdc-common-utils-ts/src/utils/string-utils.d.ts +25 -0
  283. package/dist/gdc-common-utils-ts/src/utils/string-utils.js +66 -0
  284. package/dist/gdc-common-utils-ts/src/utils/url.d.ts +26 -0
  285. package/dist/gdc-common-utils-ts/src/utils/url.js +44 -0
  286. package/dist/gdc-common-utils-ts/src/utils/vp-token.d.ts +139 -0
  287. package/dist/gdc-common-utils-ts/src/utils/vp-token.js +256 -0
  288. package/dist/gdc-sdk-core-ts/src/actor-model.d.ts +56 -0
  289. package/dist/gdc-sdk-core-ts/src/actor-model.js +112 -0
  290. package/dist/gdc-sdk-core-ts/src/app-identity.d.ts +80 -0
  291. package/dist/gdc-sdk-core-ts/src/app-identity.js +147 -0
  292. package/dist/gdc-sdk-core-ts/src/bootstrap-facade.d.ts +165 -0
  293. package/dist/gdc-sdk-core-ts/src/bootstrap-facade.js +191 -0
  294. package/dist/gdc-sdk-core-ts/src/communication-bundle-contracts.d.ts +112 -0
  295. package/dist/gdc-sdk-core-ts/src/communication-bundle-contracts.js +185 -0
  296. package/dist/gdc-sdk-core-ts/src/communication-bundle-resources.d.ts +32 -0
  297. package/dist/gdc-sdk-core-ts/src/communication-bundle-resources.js +215 -0
  298. package/dist/gdc-sdk-core-ts/src/communication-consent-mutation-contract.d.ts +55 -0
  299. package/dist/gdc-sdk-core-ts/src/communication-consent-mutation-contract.js +190 -0
  300. package/dist/gdc-sdk-core-ts/src/communication-document-facade.d.ts +55 -0
  301. package/dist/gdc-sdk-core-ts/src/communication-document-facade.js +194 -0
  302. package/dist/gdc-sdk-core-ts/src/communication-draft.d.ts +104 -0
  303. package/dist/gdc-sdk-core-ts/src/communication-draft.js +143 -0
  304. package/dist/gdc-sdk-core-ts/src/communication-outbox.d.ts +49 -0
  305. package/dist/gdc-sdk-core-ts/src/communication-outbox.js +62 -0
  306. package/dist/gdc-sdk-core-ts/src/communication-resource-helpers.d.ts +180 -0
  307. package/dist/gdc-sdk-core-ts/src/communication-resource-helpers.js +455 -0
  308. package/dist/gdc-sdk-core-ts/src/consent-access.d.ts +73 -0
  309. package/dist/gdc-sdk-core-ts/src/consent-access.js +109 -0
  310. package/dist/gdc-sdk-core-ts/src/consent-claim-helpers.d.ts +5 -0
  311. package/dist/gdc-sdk-core-ts/src/consent-claim-helpers.js +6 -0
  312. package/dist/gdc-sdk-core-ts/src/consent-communication-operations.d.ts +82 -0
  313. package/dist/gdc-sdk-core-ts/src/consent-communication-operations.js +135 -0
  314. package/dist/gdc-sdk-core-ts/src/did-resolution-session.d.ts +33 -0
  315. package/dist/gdc-sdk-core-ts/src/did-resolution-session.js +56 -0
  316. package/dist/gdc-sdk-core-ts/src/discovery-facade.d.ts +84 -0
  317. package/dist/gdc-sdk-core-ts/src/discovery-facade.js +24 -0
  318. package/dist/gdc-sdk-core-ts/src/identity-model.d.ts +46 -0
  319. package/dist/gdc-sdk-core-ts/src/identity-model.js +2 -0
  320. package/dist/gdc-sdk-core-ts/src/identity-store.d.ts +83 -0
  321. package/dist/gdc-sdk-core-ts/src/identity-store.js +51 -0
  322. package/dist/gdc-sdk-core-ts/src/index.d.ts +23 -0
  323. package/dist/gdc-sdk-core-ts/src/index.js +24 -0
  324. package/dist/gdc-sdk-core-ts/src/medication-claim-helpers.d.ts +5 -0
  325. package/dist/gdc-sdk-core-ts/src/medication-claim-helpers.js +6 -0
  326. package/dist/gdc-sdk-core-ts/src/polling-model.d.ts +35 -0
  327. package/dist/gdc-sdk-core-ts/src/polling-model.js +24 -0
  328. package/dist/gdc-sdk-core-ts/src/relationship-access.d.ts +40 -0
  329. package/dist/gdc-sdk-core-ts/src/relationship-access.js +150 -0
  330. package/dist/gdc-sdk-core-ts/src/session-model.d.ts +134 -0
  331. package/dist/gdc-sdk-core-ts/src/session-model.js +2 -0
  332. package/dist/gdc-sdk-core-ts/src/smart-endpoint-resolver.d.ts +19 -0
  333. package/dist/gdc-sdk-core-ts/src/smart-endpoint-resolver.js +19 -0
  334. package/dist/gdc-sdk-core-ts/src/vital-signs.d.ts +38 -0
  335. package/dist/gdc-sdk-core-ts/src/vital-signs.js +155 -0
  336. package/dist/gdc-sdk-front-ts/src/ClientSDK.d.ts +99 -0
  337. package/dist/gdc-sdk-front-ts/src/ClientSDK.js +177 -0
  338. package/dist/gdc-sdk-front-ts/src/ProfileManager.d.ts +140 -0
  339. package/dist/gdc-sdk-front-ts/src/ProfileManager.js +76 -0
  340. package/dist/gdc-sdk-front-ts/src/ProfileRegistry.d.ts +11 -0
  341. package/dist/gdc-sdk-front-ts/src/ProfileRegistry.js +26 -0
  342. package/dist/gdc-sdk-front-ts/src/VerifierService.d.ts +6 -0
  343. package/dist/gdc-sdk-front-ts/src/VerifierService.js +10 -0
  344. package/dist/gdc-sdk-front-ts/src/actor-session.d.ts +2 -0
  345. package/dist/gdc-sdk-front-ts/src/actor-session.js +2 -0
  346. package/dist/gdc-sdk-front-ts/src/capabilityMapper.d.ts +8 -0
  347. package/dist/gdc-sdk-front-ts/src/capabilityMapper.js +28 -0
  348. package/dist/gdc-sdk-front-ts/src/consent-claim-helpers.d.ts +4 -0
  349. package/dist/gdc-sdk-front-ts/src/consent-claim-helpers.js +5 -0
  350. package/dist/gdc-sdk-front-ts/src/discovery/DataspaceDiscoveryClient.d.ts +54 -0
  351. package/dist/gdc-sdk-front-ts/src/discovery/DataspaceDiscoveryClient.js +85 -0
  352. package/dist/gdc-sdk-front-ts/src/discovery/index.d.ts +3 -0
  353. package/dist/gdc-sdk-front-ts/src/discovery/index.js +4 -0
  354. package/dist/gdc-sdk-front-ts/src/discovery/mappers.d.ts +29 -0
  355. package/dist/gdc-sdk-front-ts/src/discovery/mappers.js +60 -0
  356. package/dist/gdc-sdk-front-ts/src/discovery/types.d.ts +83 -0
  357. package/dist/gdc-sdk-front-ts/src/discovery/types.js +2 -0
  358. package/dist/gdc-sdk-front-ts/src/index.d.ts +15 -0
  359. package/dist/gdc-sdk-front-ts/src/index.js +16 -0
  360. package/dist/gdc-sdk-front-ts/src/medication-claim-helpers.d.ts +4 -0
  361. package/dist/gdc-sdk-front-ts/src/medication-claim-helpers.js +5 -0
  362. package/dist/gdc-sdk-front-ts/src/roleRegistry.d.ts +19 -0
  363. package/dist/gdc-sdk-front-ts/src/roleRegistry.js +2 -0
  364. package/dist/gdc-sdk-front-ts/src/runtime-contracts.d.ts +22 -0
  365. package/dist/gdc-sdk-front-ts/src/runtime-contracts.js +7 -0
  366. package/dist/gdc-sdk-front-ts/src/services.d.ts +167 -0
  367. package/dist/gdc-sdk-front-ts/src/services.js +78 -0
  368. package/dist/gdc-sdk-front-ts/src/session-descriptor.d.ts +11 -0
  369. package/dist/gdc-sdk-front-ts/src/session-descriptor.js +8 -0
  370. package/dist/gdc-sdk-front-ts/src/types.d.ts +11 -0
  371. package/dist/gdc-sdk-front-ts/src/types.js +1 -0
  372. package/dist/index.d.ts +8 -0
  373. package/dist/index.js +8 -0
  374. package/dist/medication-claim-helpers.d.ts +4 -0
  375. package/dist/medication-claim-helpers.js +5 -0
  376. package/dist/orchestration/client-port.d.ts +161 -0
  377. package/dist/orchestration/client-port.js +26 -0
  378. package/dist/orchestration/facades.d.ts +65 -0
  379. package/dist/orchestration/facades.js +142 -0
  380. package/dist/orchestration/host-onboarding-sdk.d.ts +9 -0
  381. package/dist/orchestration/host-onboarding-sdk.js +16 -0
  382. package/dist/orchestration/individual-controller-sdk.d.ts +18 -0
  383. package/dist/orchestration/individual-controller-sdk.js +43 -0
  384. package/dist/orchestration/individual-member-sdk.d.ts +8 -0
  385. package/dist/orchestration/individual-member-sdk.js +13 -0
  386. package/dist/orchestration/organization-controller-sdk.d.ts +11 -0
  387. package/dist/orchestration/organization-controller-sdk.js +22 -0
  388. package/dist/orchestration/organization-employee-sdk.d.ts +8 -0
  389. package/dist/orchestration/organization-employee-sdk.js +13 -0
  390. package/dist/orchestration/personal-sdk.d.ts +13 -0
  391. package/dist/orchestration/personal-sdk.js +28 -0
  392. package/dist/orchestration/professional-sdk.d.ts +10 -0
  393. package/dist/orchestration/professional-sdk.js +19 -0
  394. package/dist/services.d.ts +58 -10
  395. package/dist/services.js +88 -5
  396. package/package.json +3 -3
@@ -0,0 +1,455 @@
1
+ // Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
2
+ import { ResourceTypesFhirR4, } from 'gdc-common-utils-ts/constants/fhir-resource-types';
3
+ import { FhirVersions, } from 'gdc-common-utils-ts/constants/fhir-versions';
4
+ function cloneRecord(value) {
5
+ return JSON.parse(JSON.stringify(value));
6
+ }
7
+ function isPlainObject(value) {
8
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
9
+ }
10
+ function toArray(value) {
11
+ if (value === undefined)
12
+ return [];
13
+ return Array.isArray(value) ? [...value] : [value];
14
+ }
15
+ function encodeBase64Utf8(value) {
16
+ const anyGlobal = globalThis;
17
+ if (anyGlobal.Buffer) {
18
+ return anyGlobal.Buffer.from(value, 'utf8').toString('base64');
19
+ }
20
+ if (typeof anyGlobal.btoa === 'function') {
21
+ const utf8 = encodeURIComponent(value).replace(/%([0-9A-F]{2})/g, (_, hex) => String.fromCharCode(Number.parseInt(hex, 16)));
22
+ return anyGlobal.btoa(utf8);
23
+ }
24
+ throw new Error('No base64 encoder available in this runtime.');
25
+ }
26
+ function decodeBase64Utf8(value) {
27
+ const anyGlobal = globalThis;
28
+ if (anyGlobal.Buffer) {
29
+ return anyGlobal.Buffer.from(value, 'base64').toString('utf8');
30
+ }
31
+ if (typeof anyGlobal.atob === 'function') {
32
+ const decoded = anyGlobal.atob(value);
33
+ const percentEncoded = decoded
34
+ .split('')
35
+ .map((char) => `%${char.charCodeAt(0).toString(16).padStart(2, '0')}`)
36
+ .join('');
37
+ return decodeURIComponent(percentEncoded);
38
+ }
39
+ throw new Error('No base64 decoder available in this runtime.');
40
+ }
41
+ function extractCodingToken(coding) {
42
+ if (!coding)
43
+ return undefined;
44
+ const system = typeof coding.system === 'string' ? coding.system.trim() : '';
45
+ const code = typeof coding.code === 'string' ? coding.code.trim() : '';
46
+ if (system && code)
47
+ return `${system}|${code}`;
48
+ return code || undefined;
49
+ }
50
+ function getFirstCodingToken(value) {
51
+ const coding = (Array.isArray(value) ? value : [])
52
+ .flatMap((item) => (isPlainObject(item) && Array.isArray(item.coding) ? item.coding : []))
53
+ .find(isPlainObject);
54
+ return extractCodingToken(coding);
55
+ }
56
+ function getCanonicalDate(resource) {
57
+ const candidates = [
58
+ resource.effectiveDateTime,
59
+ resource.issued,
60
+ resource.authoredOn,
61
+ resource.performedDateTime,
62
+ resource.recordedDate,
63
+ resource.date,
64
+ resource.sent,
65
+ ];
66
+ for (const candidate of candidates) {
67
+ if (typeof candidate === 'string' && candidate.trim())
68
+ return candidate.trim();
69
+ }
70
+ return undefined;
71
+ }
72
+ function buildAttachmentFromResource(resource, options = {}) {
73
+ const attachment = {
74
+ contentType: options.contentType || 'application/fhir+json',
75
+ };
76
+ if (options.title)
77
+ attachment.title = options.title;
78
+ if (options.url)
79
+ attachment.url = options.url;
80
+ if (options.dataBase64) {
81
+ attachment.data = options.dataBase64;
82
+ }
83
+ else {
84
+ attachment.data = encodeBase64Utf8(JSON.stringify(resource));
85
+ }
86
+ return attachment;
87
+ }
88
+ function parseAttachmentResource(attachment) {
89
+ if (!attachment)
90
+ return undefined;
91
+ if (typeof attachment.data !== 'string' || !attachment.data.trim())
92
+ return undefined;
93
+ try {
94
+ const parsed = JSON.parse(decodeBase64Utf8(attachment.data));
95
+ return isPlainObject(parsed) ? parsed : undefined;
96
+ }
97
+ catch {
98
+ return undefined;
99
+ }
100
+ }
101
+ function getPayloadAttachment(payload) {
102
+ const contentAttachment = payload.contentAttachment;
103
+ return isPlainObject(contentAttachment) ? contentAttachment : undefined;
104
+ }
105
+ function getPayloadReference(payload) {
106
+ const contentReference = payload.contentReference;
107
+ if (!isPlainObject(contentReference))
108
+ return undefined;
109
+ return typeof contentReference.reference === 'string' ? contentReference.reference : undefined;
110
+ }
111
+ function getCommunicationNoteTexts(communication) {
112
+ return Array.isArray(communication.note)
113
+ ? communication.note
114
+ .map((item) => (isPlainObject(item) && typeof item.text === 'string' ? item.text.trim() : ''))
115
+ .filter(Boolean)
116
+ : [];
117
+ }
118
+ function ensureCommunicationResource(communication) {
119
+ if (communication.resourceType !== ResourceTypesFhirR4.Communication) {
120
+ throw new TypeError('Expected a FHIR Communication resource.');
121
+ }
122
+ return communication;
123
+ }
124
+ function buildCategory(category) {
125
+ if (!category || category.length === 0)
126
+ return undefined;
127
+ const categoryItems = [...category];
128
+ const codings = categoryItems
129
+ .map((item) => {
130
+ if (typeof item === 'string') {
131
+ const [system, code] = item.includes('|') ? item.split('|', 2) : ['', item];
132
+ return code ? { system: system || undefined, code } : undefined;
133
+ }
134
+ if (item && typeof item.code === 'string' && item.code.trim()) {
135
+ return { system: item.system, code: item.code };
136
+ }
137
+ return undefined;
138
+ })
139
+ .filter((item) => Boolean(item));
140
+ return codings.length ? [{ coding: codings }] : undefined;
141
+ }
142
+ function resolveNoteText(options) {
143
+ const value = typeof options.noteText === 'string' ? options.noteText.trim() : '';
144
+ return value || undefined;
145
+ }
146
+ function appendNoteText(communication, noteText) {
147
+ if (!noteText || !noteText.trim())
148
+ return communication;
149
+ const next = cloneRecord(communication);
150
+ const notes = Array.isArray(next.note) ? [...next.note] : [];
151
+ notes.push({ text: noteText.trim() });
152
+ next.note = notes;
153
+ return next;
154
+ }
155
+ function appendPayload(communication, payloadEntry) {
156
+ const next = cloneRecord(communication);
157
+ const payload = Array.isArray(next.payload) ? [...next.payload] : [];
158
+ payload.push(payloadEntry);
159
+ next.payload = payload;
160
+ return next;
161
+ }
162
+ /**
163
+ * Creates a minimal FHIR `Communication` resource ready to receive payloads.
164
+ *
165
+ * @param options.subject Subject reference carried by `Communication.subject.reference`.
166
+ * @param options.sender Optional sender reference.
167
+ * @param options.recipient Optional recipient reference or references.
168
+ * @param options.sent Optional sent timestamp.
169
+ * @param options.status Optional FHIR communication status. Defaults to `completed`.
170
+ * @param options.category Optional coding tokens or coding descriptors.
171
+ * @param options.noteText Optional message note text. FHIR allows markdown here.
172
+ * @param options.claims Optional `resource.meta.claims` payload to preserve.
173
+ */
174
+ export function createCommunicationResource(options) {
175
+ const communication = {
176
+ resourceType: ResourceTypesFhirR4.Communication,
177
+ status: options.status || 'completed',
178
+ subject: { reference: options.subject },
179
+ };
180
+ if (options.sender)
181
+ communication.sender = { reference: options.sender };
182
+ if (options.recipient) {
183
+ communication.recipient = toArray(options.recipient).map((reference) => ({ reference }));
184
+ }
185
+ if (options.sent)
186
+ communication.sent = options.sent;
187
+ const category = buildCategory(options.category);
188
+ if (category)
189
+ communication.category = category;
190
+ const noteText = resolveNoteText(options);
191
+ if (noteText) {
192
+ communication.note = [{ text: noteText }];
193
+ }
194
+ if (options.claims) {
195
+ communication.meta = { claims: cloneRecord(options.claims) };
196
+ }
197
+ return communication;
198
+ }
199
+ /**
200
+ * Wraps a FHIR `Communication` into a batch message payload suitable for
201
+ * the legacy/FHIR ingestion routes used by the GW.
202
+ *
203
+ * @param communication FHIR `Communication` resource to submit.
204
+ * @param options.thid Optional thread id for the envelope.
205
+ * @param options.jti Optional envelope id.
206
+ * @param options.iss Optional issuer DID.
207
+ * @param options.aud Optional audience DID.
208
+ * @param options.requestUrl Optional FHIR batch request URL.
209
+ * @param options.entryType Optional business type for the batch entry.
210
+ * @param options.messageType Optional outer message MIME type.
211
+ * @param options.fhirVersion Optional FHIR version parameter used in the MIME type.
212
+ */
213
+ export function buildCommunicationBatchMessage(communication, options = {}) {
214
+ const communicationResource = ensureCommunicationResource(communication);
215
+ const thid = options.thid || `communication-${Date.now()}`;
216
+ const fhirVersion = options.fhirVersion || FhirVersions.R4;
217
+ return {
218
+ ...(options.jti ? { jti: options.jti } : {}),
219
+ ...(options.iss ? { iss: options.iss } : {}),
220
+ ...(options.aud ? { aud: options.aud } : {}),
221
+ thid,
222
+ type: options.messageType || `application/fhir+json; fhirVersion=${fhirVersion}`,
223
+ body: {
224
+ resourceType: ResourceTypesFhirR4.Bundle,
225
+ type: 'batch',
226
+ entry: [
227
+ {
228
+ request: {
229
+ method: 'POST',
230
+ url: options.requestUrl || `individual/org.hl7.fhir.r4/${ResourceTypesFhirR4.Communication}`,
231
+ },
232
+ type: options.entryType || 'Communication-ingestion-request-v1.0',
233
+ resource: cloneRecord(communicationResource),
234
+ },
235
+ ],
236
+ },
237
+ };
238
+ }
239
+ /**
240
+ * Adds a FHIR resource as a `Communication.payload` attachment.
241
+ *
242
+ * When `options.asDocumentReference` is enabled, the resource is first
243
+ * wrapped into a FHIR `DocumentReference` whose `content.attachment`
244
+ * contains the serialized resource.
245
+ *
246
+ * @param communication Target FHIR `Communication` resource.
247
+ * @param resource FHIR resource to attach.
248
+ * @param options.noteText Optional note text appended to `Communication.note`. FHIR allows markdown here.
249
+ * @param options.asDocumentReference Whether to wrap the resource into `DocumentReference`.
250
+ * @param options.documentReferenceIdentifier Optional `DocumentReference.identifier`.
251
+ * @param options.attachmentTitle Optional attachment filename/title.
252
+ * @param options.attachmentContentType Optional attachment MIME type.
253
+ * @param options.documentDescription Optional `DocumentReference.description`.
254
+ * @param options.documentDate Optional `DocumentReference.date`.
255
+ * @param options.documentSubject Optional `DocumentReference.subject.reference`.
256
+ */
257
+ export function addFhirResourceToCommunication(communication, resource, options = {}) {
258
+ const nextCommunication = ensureCommunicationResource(communication);
259
+ const subjectReference = options.documentSubject
260
+ || (typeof nextCommunication.subject?.reference === 'string'
261
+ ? String(nextCommunication.subject.reference)
262
+ : undefined);
263
+ let payloadEntry;
264
+ if (options.asDocumentReference) {
265
+ const documentReference = {
266
+ resourceType: ResourceTypesFhirR4.DocumentReference,
267
+ content: [{
268
+ attachment: buildAttachmentFromResource(resource, {
269
+ contentType: options.attachmentContentType || 'application/fhir+json',
270
+ title: options.attachmentTitle || `${String(resource.resourceType || 'resource').toLowerCase()}.json`,
271
+ }),
272
+ }],
273
+ };
274
+ if (subjectReference)
275
+ documentReference.subject = { reference: subjectReference };
276
+ if (options.documentDate || getCanonicalDate(resource)) {
277
+ documentReference.date = options.documentDate || getCanonicalDate(resource);
278
+ }
279
+ if (options.documentDescription)
280
+ documentReference.description = options.documentDescription;
281
+ if (options.documentReferenceIdentifier) {
282
+ documentReference.identifier = [{ value: options.documentReferenceIdentifier }];
283
+ }
284
+ payloadEntry = {
285
+ contentAttachment: buildAttachmentFromResource(documentReference, {
286
+ contentType: 'application/fhir+json',
287
+ title: options.attachmentTitle || 'document-reference.json',
288
+ }),
289
+ };
290
+ }
291
+ else {
292
+ payloadEntry = {
293
+ contentAttachment: buildAttachmentFromResource(resource, {
294
+ contentType: options.attachmentContentType || 'application/fhir+json',
295
+ title: options.attachmentTitle || `${String(resource.resourceType || 'resource').toLowerCase()}.json`,
296
+ }),
297
+ };
298
+ }
299
+ return appendNoteText(appendPayload(nextCommunication, payloadEntry), resolveNoteText(options));
300
+ }
301
+ /**
302
+ * Adds a claims-only pseudo-resource into `Communication.payload`.
303
+ *
304
+ * The resource is created with `resourceType` plus `resource.meta.claims`
305
+ * and then attached using the same logic as `addFhirResourceToCommunication(...)`.
306
+ *
307
+ * @param communication Target FHIR `Communication` resource.
308
+ * @param resourceType FHIR `resourceType` name to materialize.
309
+ * @param claims Canonical interoperable claims to place under `meta.claims`.
310
+ * @param options Attachment/document wrapping options.
311
+ */
312
+ export function addClaimsResourceToCommunication(communication, resourceType, claims, options = {}) {
313
+ const resource = {
314
+ resourceType,
315
+ meta: {
316
+ claims: cloneRecord(claims),
317
+ },
318
+ };
319
+ return addFhirResourceToCommunication(communication, resource, options);
320
+ }
321
+ /**
322
+ * Resolves every `Communication.payload[]` entry into a normalized shape.
323
+ *
324
+ * The resolver abstracts:
325
+ * - direct resource attachment
326
+ * - embedded `DocumentReference`
327
+ * - embedded `Bundle document`
328
+ * - best-effort note text associated to the payload slot
329
+ *
330
+ * @param communication FHIR `Communication` resource to inspect.
331
+ */
332
+ export function resolveCommunicationPayloads(communication) {
333
+ const communicationResource = ensureCommunicationResource(communication);
334
+ const payload = Array.isArray(communicationResource.payload) ? communicationResource.payload : [];
335
+ const noteTexts = getCommunicationNoteTexts(communicationResource);
336
+ return payload.map((item, index) => {
337
+ const payloadEntry = isPlainObject(item) ? item : {};
338
+ const attachment = getPayloadAttachment(payloadEntry);
339
+ const directResource = parseAttachmentResource(attachment);
340
+ if (directResource?.resourceType === ResourceTypesFhirR4.DocumentReference) {
341
+ const documentReference = directResource;
342
+ const contentEntries = Array.isArray(documentReference.content)
343
+ ? documentReference.content
344
+ : [];
345
+ const innerAttachment = contentEntries.length
346
+ ? contentEntries
347
+ .map((contentItem) => (isPlainObject(contentItem) ? contentItem.attachment : undefined))
348
+ .find(isPlainObject)
349
+ : undefined;
350
+ const innerResource = parseAttachmentResource(innerAttachment);
351
+ return {
352
+ payloadIndex: index,
353
+ payloadType: attachment ? 'attachment' : 'reference',
354
+ documentReference,
355
+ bundle: innerResource?.resourceType === ResourceTypesFhirR4.Bundle ? innerResource : undefined,
356
+ resource: innerResource,
357
+ noteText: noteTexts[index] || noteTexts[0],
358
+ };
359
+ }
360
+ return {
361
+ payloadIndex: index,
362
+ payloadType: attachment ? 'attachment' : 'reference',
363
+ bundle: directResource?.resourceType === ResourceTypesFhirR4.Bundle ? directResource : undefined,
364
+ resource: directResource,
365
+ noteText: noteTexts[index] || noteTexts[0],
366
+ ...(getPayloadReference(payloadEntry) ? { documentReference: { reference: getPayloadReference(payloadEntry) } } : {}),
367
+ };
368
+ });
369
+ }
370
+ /**
371
+ * Returns the first FHIR `Bundle document` reachable from a `Communication`.
372
+ *
373
+ * It transparently supports direct bundle attachments and bundles wrapped
374
+ * inside `DocumentReference.content.attachment`.
375
+ *
376
+ * @param communication FHIR `Communication` resource to inspect.
377
+ */
378
+ export function getFirstBundleDocumentFromCommunication(communication) {
379
+ return resolveCommunicationPayloads(communication).find((entry) => entry.bundle)?.bundle;
380
+ }
381
+ /**
382
+ * Extracts concrete FHIR resources from a `Bundle.entry[].resource` list.
383
+ *
384
+ * @param bundle FHIR `Bundle` document.
385
+ */
386
+ export function getBundleDocumentEntries(bundle) {
387
+ if (!bundle || bundle.resourceType !== ResourceTypesFhirR4.Bundle || !Array.isArray(bundle.entry))
388
+ return [];
389
+ return bundle.entry
390
+ .map((entry) => (isPlainObject(entry) && isPlainObject(entry.resource) ? entry.resource : undefined))
391
+ .filter((resource) => Boolean(resource));
392
+ }
393
+ /**
394
+ * Returns bundle resources filtered by `resourceType`.
395
+ *
396
+ * @param bundle FHIR `Bundle` document.
397
+ * @param resourceType FHIR `resourceType` name to keep.
398
+ */
399
+ export function getBundleDocumentResourcesByType(bundle, resourceType) {
400
+ return getBundleDocumentEntries(bundle).filter((resource) => resource.resourceType === resourceType);
401
+ }
402
+ /**
403
+ * Extracts `MedicationStatement.meta.claims` rows from the first document
404
+ * bundle found inside a `Communication`.
405
+ *
406
+ * @param communication FHIR `Communication` resource to inspect.
407
+ */
408
+ export function getMedicationClaimsFromCommunicationDocument(communication) {
409
+ const bundle = getFirstBundleDocumentFromCommunication(communication);
410
+ return getBundleDocumentResourcesByType(bundle, ResourceTypesFhirR4.MedicationStatement)
411
+ .map((resource) => (isPlainObject(resource.meta) && isPlainObject(resource.meta.claims)
412
+ ? cloneRecord(resource.meta.claims)
413
+ : {}))
414
+ .filter((claims) => Object.keys(claims).length > 0);
415
+ }
416
+ /**
417
+ * Sorts FHIR resources by their first canonical clinical date descending.
418
+ *
419
+ * The helper inspects common date fields such as `effectiveDateTime`,
420
+ * `issued`, `authoredOn`, `performedDateTime`, `recordedDate`, `date`, and `sent`.
421
+ *
422
+ * @param resources Resources to sort.
423
+ */
424
+ export function sortFhirResourcesByDateDescending(resources) {
425
+ return [...resources].sort((left, right) => {
426
+ const leftDate = getCanonicalDate(left) || '';
427
+ const rightDate = getCanonicalDate(right) || '';
428
+ return rightDate.localeCompare(leftDate);
429
+ });
430
+ }
431
+ /**
432
+ * Returns `Observation` resources from a communication document filtered by code.
433
+ *
434
+ * Accepted filter values may be bare codes or `<system>|<code>` tokens.
435
+ *
436
+ * @param communication FHIR `Communication` resource to inspect.
437
+ * @param filter.code Optional single code filter.
438
+ * @param filter.codes Optional list of accepted codes.
439
+ */
440
+ export function getObservationsByCodeFromCommunicationDocument(communication, filter) {
441
+ const accepted = new Set([filter.code, ...(filter.codes || [])]
442
+ .filter((value) => Boolean(value && value.trim()))
443
+ .map((value) => value.trim()));
444
+ const bundle = getFirstBundleDocumentFromCommunication(communication);
445
+ const observations = getBundleDocumentResourcesByType(bundle, ResourceTypesFhirR4.Observation);
446
+ if (!accepted.size)
447
+ return observations;
448
+ return observations.filter((resource) => {
449
+ const codeToken = getFirstCodingToken(resource.code?.coding ? [{ coding: resource.code.coding }] : []);
450
+ const categoryToken = getFirstCodingToken(resource.category);
451
+ return Boolean((codeToken && accepted.has(codeToken))
452
+ || (codeToken && accepted.has(codeToken.split('|').pop() || ''))
453
+ || (categoryToken && accepted.has(categoryToken)));
454
+ });
455
+ }
@@ -0,0 +1,73 @@
1
+ import type { ActiveConsentView, ConsentActorDescriptor, ConsentCoverageRequest, ConsentRuleMatch, EffectiveAccessEvaluation, MissingPermissionSet } from 'gdc-common-utils-ts/models/consent-access';
2
+ import type { ConsentRule } from 'gdc-common-utils-ts/models/consent-rule';
3
+ import type { BundleSearchQuery, CommunicationInput } from './communication-bundle-contracts.js';
4
+ export type PermissionRequestCommunicationInput = Readonly<{
5
+ subject: string;
6
+ requester: ConsentActorDescriptor;
7
+ requesterRole?: string;
8
+ purpose?: string;
9
+ missing: MissingPermissionSet;
10
+ communicationIdentifier?: string;
11
+ thid?: string;
12
+ sender?: string;
13
+ recipient?: string | string[];
14
+ justification?: string;
15
+ documentContentCid?: string;
16
+ }>;
17
+ export type PermissionRequestCommunicationLookup = Readonly<{
18
+ subject: string;
19
+ communicationIdentifier?: string;
20
+ thid?: string;
21
+ contentCid?: string;
22
+ }>;
23
+ /**
24
+ * Runtime-neutral interface for subject consent providers.
25
+ */
26
+ export interface ActiveConsentProvider {
27
+ getActiveConsentsForSubject(subject: string): Promise<ConsentRule[]>;
28
+ }
29
+ /**
30
+ * Fetches active consent rules for a subject from an injected provider and
31
+ * groups them by target family for controller-facing inspection.
32
+ *
33
+ * @param provider Consent provider abstraction.
34
+ * @param subject Subject identifier whose active consents must be loaded.
35
+ * @param now Optional evaluation timestamp.
36
+ */
37
+ export declare function groupConsentsForControllerView(provider: ActiveConsentProvider, subject: string, now?: string | Date): Promise<ActiveConsentView>;
38
+ /**
39
+ * Evaluates requested access against the full active consent set for a subject.
40
+ *
41
+ * @param provider Consent provider abstraction.
42
+ * @param request Access request to evaluate.
43
+ */
44
+ export declare function evaluateRequestedAccess(provider: ActiveConsentProvider, request: ConsentCoverageRequest): Promise<EffectiveAccessEvaluation>;
45
+ /**
46
+ * Returns the missing-permission projection for a consent evaluation.
47
+ *
48
+ * @param evaluation Result returned by `evaluateRequestedAccess(...)` or `evaluateConsentCoverage(...)`.
49
+ */
50
+ export declare function getMissingPermissions(evaluation: EffectiveAccessEvaluation): MissingPermissionSet;
51
+ /**
52
+ * Builds the canonical `Communication` payload used to request additional
53
+ * subject-controlled permissions when the current SMART request is not covered.
54
+ *
55
+ * Push/email/SMS remain notification channels around this canonical
56
+ * `Communication`, not the primary contract.
57
+ *
58
+ * @param input Permission-request details to encode.
59
+ */
60
+ export declare function buildPermissionRequestCommunication(input: PermissionRequestCommunicationInput): CommunicationInput;
61
+ /**
62
+ * Builds a canonical subject-scoped `Bundle/_search` query for recovering a
63
+ * permission-request `Communication` by stable identifiers.
64
+ *
65
+ * Retrieval keys supported by the current helper:
66
+ * - `Communication.identifier`
67
+ * - `thid`
68
+ * - `DocumentReference.contenthash` (`z<base58>` CID)
69
+ *
70
+ * @param input Stable lookup keys for the permission request.
71
+ */
72
+ export declare function buildPermissionRequestCommunicationLookupQuery(input: PermissionRequestCommunicationLookup): BundleSearchQuery;
73
+ export type { ActiveConsentView, ConsentActorDescriptor, ConsentCoverageRequest, ConsentRuleMatch, EffectiveAccessEvaluation, MissingPermissionSet, };
@@ -0,0 +1,109 @@
1
+ // Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
2
+ import { evaluateConsentCoverage, groupActiveConsentsByTarget, } from 'gdc-common-utils-ts/utils/consent';
3
+ import { ResourceTypesFhirR4 } from 'gdc-common-utils-ts/constants/fhir-resource-types';
4
+ import { CommunicationClaim } from 'gdc-common-utils-ts/models/interoperable-claims/communication-claims';
5
+ /**
6
+ * Fetches active consent rules for a subject from an injected provider and
7
+ * groups them by target family for controller-facing inspection.
8
+ *
9
+ * @param provider Consent provider abstraction.
10
+ * @param subject Subject identifier whose active consents must be loaded.
11
+ * @param now Optional evaluation timestamp.
12
+ */
13
+ export async function groupConsentsForControllerView(provider, subject, now) {
14
+ const rules = await provider.getActiveConsentsForSubject(subject);
15
+ return groupActiveConsentsByTarget(rules, { subject, now });
16
+ }
17
+ /**
18
+ * Evaluates requested access against the full active consent set for a subject.
19
+ *
20
+ * @param provider Consent provider abstraction.
21
+ * @param request Access request to evaluate.
22
+ */
23
+ export async function evaluateRequestedAccess(provider, request) {
24
+ const rules = await provider.getActiveConsentsForSubject(String(request.subject || '').trim());
25
+ return evaluateConsentCoverage(rules, request);
26
+ }
27
+ /**
28
+ * Returns the missing-permission projection for a consent evaluation.
29
+ *
30
+ * @param evaluation Result returned by `evaluateRequestedAccess(...)` or `evaluateConsentCoverage(...)`.
31
+ */
32
+ export function getMissingPermissions(evaluation) {
33
+ return evaluation.missing;
34
+ }
35
+ function compact(values) {
36
+ return values.map((value) => String(value || '').trim()).filter(Boolean);
37
+ }
38
+ /**
39
+ * Builds the canonical `Communication` payload used to request additional
40
+ * subject-controlled permissions when the current SMART request is not covered.
41
+ *
42
+ * Push/email/SMS remain notification channels around this canonical
43
+ * `Communication`, not the primary contract.
44
+ *
45
+ * @param input Permission-request details to encode.
46
+ */
47
+ export function buildPermissionRequestCommunication(input) {
48
+ const requester = input.requester;
49
+ const requesterTargets = compact([
50
+ requester.did,
51
+ requester.email,
52
+ requester.phone,
53
+ requester.organizationDid,
54
+ requester.organizationUrl,
55
+ requester.jurisdiction,
56
+ ]);
57
+ const text = input.justification
58
+ || `Missing consent coverage for ${input.missing.sections.join(', ') || 'requested sections'}`
59
+ + `${input.missing.resourceTypes.length ? ` and ${input.missing.resourceTypes.join(', ')}` : ''}.`;
60
+ const claims = {
61
+ '@context': 'org.hl7.fhir.r4',
62
+ [CommunicationClaim.Identifier]: input.communicationIdentifier,
63
+ [CommunicationClaim.Subject]: input.subject,
64
+ [CommunicationClaim.Recipient]: input.recipient,
65
+ [CommunicationClaim.Sender]: input.sender,
66
+ 'AccessRequest.requester-target': requesterTargets.join(','),
67
+ 'AccessRequest.requester-role': input.requesterRole,
68
+ 'AccessRequest.purpose': input.purpose,
69
+ 'AccessRequest.missing-sections': input.missing.sections.join(','),
70
+ 'AccessRequest.missing-resource-types': input.missing.resourceTypes.join(','),
71
+ 'AccessRequest.document-content-cid': input.documentContentCid,
72
+ };
73
+ return {
74
+ thid: input.thid,
75
+ subject: input.subject,
76
+ sender: input.sender,
77
+ recipient: input.recipient,
78
+ category: ['permission-request'],
79
+ text,
80
+ claims,
81
+ };
82
+ }
83
+ /**
84
+ * Builds a canonical subject-scoped `Bundle/_search` query for recovering a
85
+ * permission-request `Communication` by stable identifiers.
86
+ *
87
+ * Retrieval keys supported by the current helper:
88
+ * - `Communication.identifier`
89
+ * - `thid`
90
+ * - `DocumentReference.contenthash` (`z<base58>` CID)
91
+ *
92
+ * @param input Stable lookup keys for the permission request.
93
+ */
94
+ export function buildPermissionRequestCommunicationLookupQuery(input) {
95
+ const searchParams = {};
96
+ if (input.communicationIdentifier)
97
+ searchParams[CommunicationClaim.Identifier] = input.communicationIdentifier;
98
+ if (input.contentCid)
99
+ searchParams['DocumentReference.contenthash'] = input.contentCid;
100
+ return {
101
+ subject: input.subject,
102
+ includedTypes: [
103
+ ResourceTypesFhirR4.Communication,
104
+ ResourceTypesFhirR4.DocumentReference,
105
+ ],
106
+ thid: input.thid,
107
+ searchParams,
108
+ };
109
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Re-export consent claim helpers from common-utils so SDK CORE consumers can
3
+ * discover and use the canonical get/set/add consent claim APIs from one place.
4
+ */
5
+ export { addActorIdentifierList, addActorRoleList, addActors, addCategories, addCategoryList, addClaimValues, addPurposeList, addPurposes, addRoles, addSections, getActorIdentifierList, getActorRoleList, getActors, getCategories, getCategoryList, getClaimValues, getConsentDate, getConsentIdentifier, getConsentPeriodEnd, getConsentPeriodStart, getPurposeList, getPurposes, getRoles, getSections, removeActorIdentifierList, removeActorRoleList, removeActors, removeCategories, removeCategoryList, removeClaimValues, removePurposeList, removePurposes, removeRoles, removeSections, setActorIdentifierList, setActorRoleList, setActors, setCategories, setCategoryList, setClaimValues, setConsentDate, setConsentIdentifier, setConsentPeriodEnd, setConsentPeriodStart, setPurposeList, setPurposes, setRoles, setSections, type InteroperableClaims as ConsentInteroperableClaims, } from 'gdc-common-utils-ts';
@@ -0,0 +1,6 @@
1
+ // Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
2
+ /**
3
+ * Re-export consent claim helpers from common-utils so SDK CORE consumers can
4
+ * discover and use the canonical get/set/add consent claim APIs from one place.
5
+ */
6
+ export { addActorIdentifierList, addActorRoleList, addActors, addCategories, addCategoryList, addClaimValues, addPurposeList, addPurposes, addRoles, addSections, getActorIdentifierList, getActorRoleList, getActors, getCategories, getCategoryList, getClaimValues, getConsentDate, getConsentIdentifier, getConsentPeriodEnd, getConsentPeriodStart, getPurposeList, getPurposes, getRoles, getSections, removeActorIdentifierList, removeActorRoleList, removeActors, removeCategories, removeCategoryList, removeClaimValues, removePurposeList, removePurposes, removeRoles, removeSections, setActorIdentifierList, setActorRoleList, setActors, setCategories, setCategoryList, setClaimValues, setConsentDate, setConsentIdentifier, setConsentPeriodEnd, setConsentPeriodStart, setPurposeList, setPurposes, setRoles, setSections, } from 'gdc-common-utils-ts';