@icure/api 5.0.37 → 5.1.0

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 (233) hide show
  1. package/icc-api/api/IccAccesslogApi.d.ts +3 -1
  2. package/icc-api/api/IccAccesslogApi.js +9 -8
  3. package/icc-api/api/IccAccesslogApi.js.map +1 -1
  4. package/icc-api/api/IccAgendaApi.d.ts +3 -1
  5. package/icc-api/api/IccAgendaApi.js +9 -8
  6. package/icc-api/api/IccAgendaApi.js.map +1 -1
  7. package/icc-api/api/IccAnonymousAccessApi.d.ts +3 -1
  8. package/icc-api/api/IccAnonymousAccessApi.js +5 -4
  9. package/icc-api/api/IccAnonymousAccessApi.js.map +1 -1
  10. package/icc-api/api/IccApplicationsettingsApi.d.ts +3 -1
  11. package/icc-api/api/IccApplicationsettingsApi.js +5 -4
  12. package/icc-api/api/IccApplicationsettingsApi.js.map +1 -1
  13. package/icc-api/api/IccArticleApi.d.ts +3 -1
  14. package/icc-api/api/IccArticleApi.js +7 -6
  15. package/icc-api/api/IccArticleApi.js.map +1 -1
  16. package/icc-api/api/IccAuthApi.d.ts +10 -0
  17. package/icc-api/api/IccAuthApi.js +25 -1
  18. package/icc-api/api/IccAuthApi.js.map +1 -1
  19. package/icc-api/api/IccBeefactApi.d.ts +3 -1
  20. package/icc-api/api/IccBeefactApi.js +3 -2
  21. package/icc-api/api/IccBeefactApi.js.map +1 -1
  22. package/icc-api/api/IccBekmehrApi.d.ts +3 -1
  23. package/icc-api/api/IccBekmehrApi.js +29 -28
  24. package/icc-api/api/IccBekmehrApi.js.map +1 -1
  25. package/icc-api/api/IccBemikronoApi.d.ts +3 -1
  26. package/icc-api/api/IccBemikronoApi.js +10 -9
  27. package/icc-api/api/IccBemikronoApi.js.map +1 -1
  28. package/icc-api/api/IccBeresultexportApi.d.ts +3 -1
  29. package/icc-api/api/IccBeresultexportApi.js +5 -4
  30. package/icc-api/api/IccBeresultexportApi.js.map +1 -1
  31. package/icc-api/api/IccBeresultimportApi.d.ts +3 -1
  32. package/icc-api/api/IccBeresultimportApi.js +5 -4
  33. package/icc-api/api/IccBeresultimportApi.js.map +1 -1
  34. package/icc-api/api/IccBesamv2Api.d.ts +3 -1
  35. package/icc-api/api/IccBesamv2Api.js +35 -34
  36. package/icc-api/api/IccBesamv2Api.js.map +1 -1
  37. package/icc-api/api/IccCalendarItemApi.d.ts +3 -1
  38. package/icc-api/api/IccCalendarItemApi.js +14 -13
  39. package/icc-api/api/IccCalendarItemApi.js.map +1 -1
  40. package/icc-api/api/IccCalendarItemTypeApi.d.ts +3 -1
  41. package/icc-api/api/IccCalendarItemTypeApi.js +8 -7
  42. package/icc-api/api/IccCalendarItemTypeApi.js.map +1 -1
  43. package/icc-api/api/IccClassificationApi.d.ts +3 -1
  44. package/icc-api/api/IccClassificationApi.js +10 -9
  45. package/icc-api/api/IccClassificationApi.js.map +1 -1
  46. package/icc-api/api/IccClassificationTemplateApi.d.ts +3 -1
  47. package/icc-api/api/IccClassificationTemplateApi.js +10 -9
  48. package/icc-api/api/IccClassificationTemplateApi.js.map +1 -1
  49. package/icc-api/api/IccCodeApi.d.ts +3 -1
  50. package/icc-api/api/IccCodeApi.js +18 -17
  51. package/icc-api/api/IccCodeApi.js.map +1 -1
  52. package/icc-api/api/IccContactApi.d.ts +3 -2
  53. package/icc-api/api/IccContactApi.js +30 -32
  54. package/icc-api/api/IccContactApi.js.map +1 -1
  55. package/icc-api/api/IccDeviceApi.d.ts +3 -1
  56. package/icc-api/api/IccDeviceApi.js +20 -19
  57. package/icc-api/api/IccDeviceApi.js.map +1 -1
  58. package/icc-api/api/IccDoctemplateApi.d.ts +3 -1
  59. package/icc-api/api/IccDoctemplateApi.js +15 -14
  60. package/icc-api/api/IccDoctemplateApi.js.map +1 -1
  61. package/icc-api/api/IccDocumentApi.d.ts +33 -1
  62. package/icc-api/api/IccDocumentApi.js +86 -18
  63. package/icc-api/api/IccDocumentApi.js.map +1 -1
  64. package/icc-api/api/IccDocumentTemplateApi.d.ts +3 -1
  65. package/icc-api/api/IccDocumentTemplateApi.js +15 -14
  66. package/icc-api/api/IccDocumentTemplateApi.js.map +1 -1
  67. package/icc-api/api/IccEntityrefApi.d.ts +3 -1
  68. package/icc-api/api/IccEntityrefApi.js +4 -3
  69. package/icc-api/api/IccEntityrefApi.js.map +1 -1
  70. package/icc-api/api/IccEntitytemplateApi.d.ts +3 -1
  71. package/icc-api/api/IccEntitytemplateApi.js +13 -12
  72. package/icc-api/api/IccEntitytemplateApi.js.map +1 -1
  73. package/icc-api/api/IccFormApi.d.ts +3 -1
  74. package/icc-api/api/IccFormApi.js +26 -25
  75. package/icc-api/api/IccFormApi.js.map +1 -1
  76. package/icc-api/api/IccFrontendmigrationApi.d.ts +3 -1
  77. package/icc-api/api/IccFrontendmigrationApi.js +8 -7
  78. package/icc-api/api/IccFrontendmigrationApi.js.map +1 -1
  79. package/icc-api/api/IccGroupApi.d.ts +3 -1
  80. package/icc-api/api/IccGroupApi.js +18 -17
  81. package/icc-api/api/IccGroupApi.js.map +1 -1
  82. package/icc-api/api/IccHcpartyApi.d.ts +3 -1
  83. package/icc-api/api/IccHcpartyApi.js +24 -23
  84. package/icc-api/api/IccHcpartyApi.js.map +1 -1
  85. package/icc-api/api/IccHelementApi.d.ts +3 -1
  86. package/icc-api/api/IccHelementApi.js +15 -14
  87. package/icc-api/api/IccHelementApi.js.map +1 -1
  88. package/icc-api/api/IccIcureApi.d.ts +3 -1
  89. package/icc-api/api/IccIcureApi.js +18 -17
  90. package/icc-api/api/IccIcureApi.js.map +1 -1
  91. package/icc-api/api/IccInsuranceApi.d.ts +3 -1
  92. package/icc-api/api/IccInsuranceApi.js +9 -8
  93. package/icc-api/api/IccInsuranceApi.js.map +1 -1
  94. package/icc-api/api/IccInvoiceApi.d.ts +3 -1
  95. package/icc-api/api/IccInvoiceApi.js +33 -32
  96. package/icc-api/api/IccInvoiceApi.js.map +1 -1
  97. package/icc-api/api/IccKeywordApi.d.ts +3 -1
  98. package/icc-api/api/IccKeywordApi.js +8 -7
  99. package/icc-api/api/IccKeywordApi.js.map +1 -1
  100. package/icc-api/api/IccMaintenanceTaskApi.d.ts +3 -1
  101. package/icc-api/api/IccMaintenanceTaskApi.js +7 -6
  102. package/icc-api/api/IccMaintenanceTaskApi.js.map +1 -1
  103. package/icc-api/api/IccMedexApi.d.ts +3 -1
  104. package/icc-api/api/IccMedexApi.js +3 -2
  105. package/icc-api/api/IccMedexApi.js.map +1 -1
  106. package/icc-api/api/IccMedicallocationApi.d.ts +3 -1
  107. package/icc-api/api/IccMedicallocationApi.js +7 -6
  108. package/icc-api/api/IccMedicallocationApi.js.map +1 -1
  109. package/icc-api/api/IccMessageApi.d.ts +3 -1
  110. package/icc-api/api/IccMessageApi.js +21 -20
  111. package/icc-api/api/IccMessageApi.js.map +1 -1
  112. package/icc-api/api/IccPatientApi.d.ts +3 -1
  113. package/icc-api/api/IccPatientApi.js +36 -35
  114. package/icc-api/api/IccPatientApi.js.map +1 -1
  115. package/icc-api/api/IccPermissionApi.d.ts +3 -1
  116. package/icc-api/api/IccPermissionApi.js +3 -2
  117. package/icc-api/api/IccPermissionApi.js.map +1 -1
  118. package/icc-api/api/IccPlaceApi.d.ts +3 -1
  119. package/icc-api/api/IccPlaceApi.js +7 -6
  120. package/icc-api/api/IccPlaceApi.js.map +1 -1
  121. package/icc-api/api/IccPubsubApi.d.ts +3 -1
  122. package/icc-api/api/IccPubsubApi.js +6 -5
  123. package/icc-api/api/IccPubsubApi.js.map +1 -1
  124. package/icc-api/api/IccReceiptApi.d.ts +3 -1
  125. package/icc-api/api/IccReceiptApi.js +9 -8
  126. package/icc-api/api/IccReceiptApi.js.map +1 -1
  127. package/icc-api/api/IccReplicationApi.d.ts +3 -1
  128. package/icc-api/api/IccReplicationApi.js +6 -5
  129. package/icc-api/api/IccReplicationApi.js.map +1 -1
  130. package/icc-api/api/IccTarificationApi.d.ts +3 -1
  131. package/icc-api/api/IccTarificationApi.js +10 -9
  132. package/icc-api/api/IccTarificationApi.js.map +1 -1
  133. package/icc-api/api/IccTimeTableApi.d.ts +3 -1
  134. package/icc-api/api/IccTimeTableApi.js +8 -7
  135. package/icc-api/api/IccTimeTableApi.js.map +1 -1
  136. package/icc-api/api/IccTmpApi.d.ts +3 -1
  137. package/icc-api/api/IccTmpApi.js +73 -72
  138. package/icc-api/api/IccTmpApi.js.map +1 -1
  139. package/icc-api/api/IccUserApi.d.ts +3 -1
  140. package/icc-api/api/IccUserApi.js +28 -27
  141. package/icc-api/api/IccUserApi.js.map +1 -1
  142. package/icc-api/api/XHR.d.ts +2 -1
  143. package/icc-api/api/XHR.js +45 -59
  144. package/icc-api/api/XHR.js.map +1 -1
  145. package/icc-api/model/AuthenticationResponse.d.ts +2 -0
  146. package/icc-api/model/AuthenticationResponse.js.map +1 -1
  147. package/icc-api/model/DataAttachment.d.ts +30 -0
  148. package/icc-api/model/DataAttachment.js +24 -0
  149. package/icc-api/model/DataAttachment.js.map +1 -0
  150. package/icc-api/model/DeletedAttachment.d.ts +33 -0
  151. package/icc-api/model/DeletedAttachment.js +24 -0
  152. package/icc-api/model/DeletedAttachment.js.map +1 -0
  153. package/icc-api/model/Document.d.ts +17 -5
  154. package/icc-api/model/Document.js.map +1 -1
  155. package/icc-api/model/RefreshTokenExpiredError.d.ts +3 -0
  156. package/icc-api/model/RefreshTokenExpiredError.js +10 -0
  157. package/icc-api/model/RefreshTokenExpiredError.js.map +1 -0
  158. package/icc-x-api/auth/AuthService.d.ts +16 -0
  159. package/icc-x-api/auth/AuthService.js +3 -0
  160. package/icc-x-api/auth/AuthService.js.map +1 -0
  161. package/icc-x-api/auth/AuthenticationProvider.d.ts +22 -0
  162. package/icc-x-api/auth/AuthenticationProvider.js +41 -0
  163. package/icc-x-api/auth/AuthenticationProvider.js.map +1 -0
  164. package/icc-x-api/auth/BasicAuthService.d.ts +12 -0
  165. package/icc-x-api/auth/BasicAuthService.js +26 -0
  166. package/icc-x-api/auth/BasicAuthService.js.map +1 -0
  167. package/icc-x-api/auth/EnsembleAuthService.d.ts +17 -0
  168. package/icc-x-api/auth/EnsembleAuthService.js +60 -0
  169. package/icc-x-api/auth/EnsembleAuthService.js.map +1 -0
  170. package/icc-x-api/auth/JwtAuthService.d.ts +19 -0
  171. package/icc-x-api/auth/JwtAuthService.js +96 -0
  172. package/icc-x-api/auth/JwtAuthService.js.map +1 -0
  173. package/icc-x-api/auth/NoAuthService.d.ts +8 -0
  174. package/icc-x-api/auth/NoAuthService.js +30 -0
  175. package/icc-x-api/auth/NoAuthService.js.map +1 -0
  176. package/icc-x-api/icc-accesslog-x-api.d.ts +2 -1
  177. package/icc-x-api/icc-accesslog-x-api.js +2 -2
  178. package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
  179. package/icc-x-api/icc-bekmehr-x-api.d.ts +2 -1
  180. package/icc-x-api/icc-bekmehr-x-api.js +2 -2
  181. package/icc-x-api/icc-bekmehr-x-api.js.map +1 -1
  182. package/icc-x-api/icc-calendar-item-x-api.d.ts +2 -1
  183. package/icc-x-api/icc-calendar-item-x-api.js +2 -2
  184. package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
  185. package/icc-x-api/icc-classification-x-api.d.ts +2 -1
  186. package/icc-x-api/icc-classification-x-api.js +2 -2
  187. package/icc-x-api/icc-classification-x-api.js.map +1 -1
  188. package/icc-x-api/icc-code-x-api.d.ts +2 -1
  189. package/icc-x-api/icc-code-x-api.js +2 -2
  190. package/icc-x-api/icc-code-x-api.js.map +1 -1
  191. package/icc-x-api/icc-contact-x-api.d.ts +2 -1
  192. package/icc-x-api/icc-contact-x-api.js +2 -2
  193. package/icc-x-api/icc-contact-x-api.js.map +1 -1
  194. package/icc-x-api/icc-doctemplate-x-api.d.ts +3 -1
  195. package/icc-x-api/icc-doctemplate-x-api.js +4 -3
  196. package/icc-x-api/icc-doctemplate-x-api.js.map +1 -1
  197. package/icc-x-api/icc-document-x-api.d.ts +3 -1
  198. package/icc-x-api/icc-document-x-api.js +4 -3
  199. package/icc-x-api/icc-document-x-api.js.map +1 -1
  200. package/icc-x-api/icc-form-x-api.d.ts +2 -1
  201. package/icc-x-api/icc-form-x-api.js +2 -2
  202. package/icc-x-api/icc-form-x-api.js.map +1 -1
  203. package/icc-x-api/icc-hcparty-x-api.d.ts +2 -1
  204. package/icc-x-api/icc-hcparty-x-api.js +2 -2
  205. package/icc-x-api/icc-hcparty-x-api.js.map +1 -1
  206. package/icc-x-api/icc-helement-x-api.d.ts +2 -1
  207. package/icc-x-api/icc-helement-x-api.js +2 -2
  208. package/icc-x-api/icc-helement-x-api.js.map +1 -1
  209. package/icc-x-api/icc-invoice-x-api.d.ts +2 -1
  210. package/icc-x-api/icc-invoice-x-api.js +2 -2
  211. package/icc-x-api/icc-invoice-x-api.js.map +1 -1
  212. package/icc-x-api/icc-maintenance-task-x-api.d.ts +2 -1
  213. package/icc-x-api/icc-maintenance-task-x-api.js +2 -2
  214. package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
  215. package/icc-x-api/icc-message-x-api.d.ts +2 -1
  216. package/icc-x-api/icc-message-x-api.js +2 -2
  217. package/icc-x-api/icc-message-x-api.js.map +1 -1
  218. package/icc-x-api/icc-patient-x-api.d.ts +2 -1
  219. package/icc-x-api/icc-patient-x-api.js +2 -2
  220. package/icc-x-api/icc-patient-x-api.js.map +1 -1
  221. package/icc-x-api/icc-receipt-x-api.d.ts +2 -1
  222. package/icc-x-api/icc-receipt-x-api.js +2 -2
  223. package/icc-x-api/icc-receipt-x-api.js.map +1 -1
  224. package/icc-x-api/icc-time-table-x-api.d.ts +2 -1
  225. package/icc-x-api/icc-time-table-x-api.js +2 -2
  226. package/icc-x-api/icc-time-table-x-api.js.map +1 -1
  227. package/icc-x-api/icc-user-x-api.d.ts +2 -1
  228. package/icc-x-api/icc-user-x-api.js +2 -2
  229. package/icc-x-api/icc-user-x-api.js.map +1 -1
  230. package/icc-x-api/index.d.ts +0 -4
  231. package/icc-x-api/index.js +30 -33
  232. package/icc-x-api/index.js.map +1 -1
  233. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"XHR.js","sourceRoot":"","sources":["../../../icc-api/api/XHR.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sDAA6C;AAE7C,IAAiB,GAAG,CA6JnB;AA7JD,WAAiB,GAAG;IAClB,MAAa,MAAM;QAIjB,YAAY,MAAc,EAAE,IAAY;YACtC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;YACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAClB,CAAC;KACF;IARY,UAAM,SAQlB,CAAA;IAED,MAAa,IAAI;QAKf,YAAY,MAAc,EAAE,WAAmB,EAAE,IAA8B;YAC7E,IAAI,CAAC,UAAU,GAAG,MAAM,CAAA;YACxB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;YAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAClB,CAAC;KACF;IAVY,QAAI,OAUhB,CAAA;IAED,MAAa,QAAS,SAAQ,KAAK;QAOjC,YAAY,GAAW,EAAE,OAAe,EAAE,MAAc,EAAE,SAAiB,EAAE,OAAgB;YAC3F,KAAK,CAAC,OAAO,CAAC,CAAA;YACd,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;YACd,IAAI,CAAC,UAAU,GAAG,MAAM,CAAA;YACxB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;YACtB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;YAC1B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACxB,CAAC;KACF;IAfY,YAAQ,WAepB,CAAA;IAED,SAAS,gBAAgB,CACvB,GAAW,EACX,IAAiB,EACjB,OAAO,GAAG,KAAK,EACf,YAA2E,OAAO,MAAM,KAAK,WAAW;QACtG,CAAC,CAAC,MAAM,CAAC,KAAK;QACd,CAAC,CAAC,OAAO,IAAI,KAAK,WAAW;YAC7B,CAAC,CAAC,IAAI,CAAC,KAAK;YACZ,CAAC,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Helper'\n\nexport namespace XHR {\n export class Header {\n header: string\n data: string\n\n constructor(header: string, data: string) {\n this.header = header\n this.data = data\n }\n }\n\n export class Data {\n statusCode: number\n contentType: string\n body: JSON | Array<JSON> | any //stream bytes|json|array<json>\n\n constructor(status: number, contentType: string, body: JSON | Array<JSON> | any) {\n this.statusCode = status\n this.contentType = contentType\n this.body = body\n }\n }\n\n export class XHRError extends Error {\n statusCode: number\n errorCode: string\n headers: Headers\n message: string\n url: string\n\n constructor(url: string, message: string, status: number, errorCode: string, headers: Headers) {\n super(message)\n this.url = url\n this.statusCode = status\n this.message = message\n this.errorCode = errorCode\n this.headers = headers\n }\n }\n\n function fetchWithTimeout(\n url: string,\n init: RequestInit,\n timeout = 10000,\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch\n ): Promise<Response> {\n return new Promise((resolve, reject) => {\n // Set timeout timer\n let timer = setTimeout(() => reject({ message: 'Request timed out', status: 'Request timed out' }), timeout)\n fetchImpl(url, init)\n .then((response) => {\n clearTimeout(timer)\n resolve(response)\n })\n .catch((err) => {\n clearTimeout(timer)\n reject(err)\n })\n })\n }\n\n export function sendCommand(\n method: string,\n url: string,\n headers: Array<Header> | null,\n data: string | any = '',\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch,\n contentTypeOverride?: 'application/json' | 'text/plain' | 'application/octet-stream',\n forceAuthentication = false\n ): Promise<Data> {\n const forceSendAuthorization = forceAuthentication || headers?.find((it) => it.header?.toLowerCase() === 'force-authentication')?.data === 'true'\n const contentType = headers && headers.find((it) => (it.header ? it.header.toLowerCase() === 'content-type' : false))\n const clientTimeout = headers && headers.find((it) => (it.header ? it.header.toUpperCase() === 'X-CLIENT-SIDE-TIMEOUT' : false))\n const timeout = clientTimeout ? Number(clientTimeout.data) : 600000\n return fetchWithTimeout(\n url,\n Object.assign(\n {\n method: method,\n credentials: 'include' as RequestCredentials,\n headers: (headers ?? [])\n .filter(\n (h) =>\n (forceSendAuthorization || h.header.toLowerCase() !== 'authorization') &&\n (h.header?.toLowerCase() !== 'content-type' || h.data !== 'multipart/form-data') &&\n h.header?.toUpperCase() !== 'X-CLIENT-SIDE-TIMEOUT' &&\n h.header?.toLowerCase() !== 'force-authentication'\n )\n .reduce(\n (acc: { [key: string]: string }, h) => {\n acc[h.header] = h.data\n return acc\n },\n { 'X-Requested-With': 'XMLHttpRequest' }\n ),\n },\n method === 'POST' || method === 'PUT'\n ? {\n body:\n !contentType || contentType.data === 'application/json'\n ? JSON.stringify(data, (k, v) => {\n return v instanceof ArrayBuffer || v instanceof Uint8Array ? ua2b64(v) : v\n })\n : data,\n }\n : {}\n ),\n timeout,\n fetchImpl\n )\n .catch(async (e) => {\n if (!forceSendAuthorization) {\n //Might be due to a 401\n return {\n status: 401,\n statusText: e.message,\n arrayBuffer: () => Promise.resolve(new ArrayBuffer(0)),\n json: () => Promise.resolve({}),\n text: () => Promise.resolve(''),\n headers: new Headers(),\n }\n } else {\n throw e\n }\n })\n .then(async function (response) {\n if (response.status === 401 && !forceSendAuthorization) {\n return sendCommand(method, url, headers, data, fetchImpl, contentTypeOverride, true)\n } else {\n if (response.status >= 400) {\n const error: {\n error: string\n message: string\n status: number\n } = { error: response.statusText, message: await response.text(), status: response.status }\n console.warn(`XHR Error: ${error.status} - ${error.error}`, error.message)\n throw new XHRError(url, error.message, error.status, error.error, response.headers)\n }\n const ct = contentTypeOverride || response.headers.get('content-type') || 'text/plain'\n return (\n ct.startsWith('application/json')\n ? response.json()\n : ct.startsWith('application/xml') || ct.startsWith('text/')\n ? response.text()\n : response.arrayBuffer()\n ).then((d) => new Data(response.status, ct, d))\n }\n })\n }\n}\n"]}
1
+ {"version":3,"file":"XHR.js","sourceRoot":"","sources":["../../../icc-api/api/XHR.ts"],"names":[],"mappings":";;;;;;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4BAC/B,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE;4BACjB,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC;gCAC5D,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE;gCACjB,CAAC,CAAC,QAAQ,CAAC,WAAW,EAAE,CAC3B,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAA;qBAChD;gBACH,CAAC;aAAA,CAAC,CAAA;QACJ,CAAC;KAAA;IA3EqB,eAAW,cA2EhC,CAAA;AACH,CAAC,EA7IgB,GAAG,GAAH,WAAG,KAAH,WAAG,QA6InB","sourcesContent":["import { ua2b64 } from '../model/ModelHelper'\nimport { NoAuthService } from '../../icc-x-api/auth/NoAuthService'\nimport { AuthService } from '../../icc-x-api/auth/AuthService'\n\nexport namespace XHR {\n export class Header {\n header: string\n data: string\n\n constructor(header: string, data: string) {\n this.header = header\n this.data = data\n }\n }\n\n export class Data {\n statusCode: number\n contentType: string\n body: JSON | Array<JSON> | any //stream bytes|json|array<json>\n\n constructor(status: number, contentType: string, body: JSON | Array<JSON> | any) {\n this.statusCode = status\n this.contentType = contentType\n this.body = body\n }\n }\n\n export class XHRError extends Error {\n statusCode: number\n errorCode: string\n headers: Headers\n message: string\n url: string\n\n constructor(url: string, message: string, status: number, errorCode: string, headers: Headers) {\n super(message)\n this.url = url\n this.statusCode = status\n this.message = message\n this.errorCode = errorCode\n this.headers = headers\n }\n }\n\n function fetchWithTimeout(\n url: string,\n init: RequestInit,\n timeout = 10000,\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch\n ): Promise<Response> {\n return new Promise((resolve, reject) => {\n // Set timeout timer\n let timer = setTimeout(() => reject({ message: 'Request timed out', status: 'Request timed out' }), timeout)\n fetchImpl(url, init)\n .then((response) => {\n clearTimeout(timer)\n resolve(response)\n })\n .catch((err) => {\n clearTimeout(timer)\n reject(err)\n })\n })\n }\n\n export async function sendCommand(\n method: string,\n url: string,\n headers: Array<Header> | null,\n data: string | any = '',\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch,\n contentTypeOverride?: 'application/json' | 'text/plain' | 'application/octet-stream',\n headerProvider: AuthService = new NoAuthService()\n ): Promise<Data> {\n const authHeaders = await headerProvider.getAuthHeaders()\n const contentType = headers && headers.find((it) => (it.header ? it.header.toLowerCase() === 'content-type' : false))\n const clientTimeout = headers && headers.find((it) => (it.header ? it.header.toUpperCase() === 'X-CLIENT-SIDE-TIMEOUT' : false))\n const timeout = clientTimeout ? Number(clientTimeout.data) : 600000\n return fetchWithTimeout(\n url,\n Object.assign(\n {\n method: method,\n credentials: 'include' as RequestCredentials,\n headers: (headers ?? [])\n .concat(authHeaders)\n .filter(\n (h) =>\n (h.header?.toLowerCase() !== 'content-type' || h.data !== 'multipart/form-data') &&\n h.header?.toUpperCase() !== 'X-CLIENT-SIDE-TIMEOUT' &&\n h.header?.toLowerCase() !== 'force-authentication'\n )\n .reduce(\n (acc: { [key: string]: string }, h) => {\n acc[h.header] = h.data\n return acc\n },\n { 'X-Requested-With': 'XMLHttpRequest' }\n ),\n },\n method === 'POST' || method === 'PUT'\n ? {\n body:\n !contentType || contentType.data === 'application/json'\n ? JSON.stringify(data, (k, v) => {\n return v instanceof ArrayBuffer || v instanceof Uint8Array ? ua2b64(v) : v\n })\n : data,\n }\n : {}\n ),\n timeout,\n fetchImpl\n ).then(async function (response) {\n if (response.status === 401) {\n headerProvider.invalidateHeader(new XHRError(url, await response.text(), response.status, response.statusText, response.headers))\n return sendCommand(method, url, headers, data, fetchImpl, contentTypeOverride, headerProvider)\n } else if (response.status >= 400) {\n const error: {\n error: string\n message: string\n status: number\n } = { error: response.statusText, message: await response.text(), status: response.status }\n console.warn(`XHR Error: ${error.status} - ${error.error}`, error.message)\n throw new XHRError(url, error.message, error.status, error.error, response.headers)\n } else {\n const ct = contentTypeOverride || response.headers.get('content-type') || 'text/plain'\n return (\n ct.startsWith('application/json')\n ? response.json()\n : ct.startsWith('application/xml') || ct.startsWith('text/')\n ? response.text()\n : response.arrayBuffer()\n ).then((d) => new Data(response.status, ct, d))\n }\n })\n }\n}\n"]}
@@ -18,4 +18,6 @@ export declare class AuthenticationResponse {
18
18
  reason?: string;
19
19
  successful?: boolean;
20
20
  username?: string;
21
+ token?: string;
22
+ refreshToken?: string;
21
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AuthenticationResponse.js","sourceRoot":"","sources":["../../../icc-api/model/AuthenticationResponse.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAEH,MAAa,sBAAsB;IACjC,YAAY,IAAgB;QAC1B,MAAM,CAAC,MAAM,CAAC,IAA8B,EAAE,IAAI,CAAC,CAAA;IACrD,CAAC;CASF;AAZD,wDAYC","sourcesContent":["/**\n * iCure Data Stack API Documentation\n * The iCure Data Stack Application API is the native interface to iCure. This version is obsolete, please use v2.\n *\n * OpenAPI spec version: v1\n *\n *\n * NOTE: This class is auto generated by the swagger code generator program.\n * https://github.com/swagger-api/swagger-codegen.git\n * Do not edit the class manually.\n */\n\nexport class AuthenticationResponse {\n constructor(json: JSON | any) {\n Object.assign(this as AuthenticationResponse, json)\n }\n\n groupId?: string\n userId?: string\n dataOwnerId?: string\n healthcarePartyId?: string\n reason?: string\n successful?: boolean\n username?: string\n}\n"]}
1
+ {"version":3,"file":"AuthenticationResponse.js","sourceRoot":"","sources":["../../../icc-api/model/AuthenticationResponse.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAEH,MAAa,sBAAsB;IACjC,YAAY,IAAgB;QAC1B,MAAM,CAAC,MAAM,CAAC,IAA8B,EAAE,IAAI,CAAC,CAAA;IACrD,CAAC;CAWF;AAdD,wDAcC","sourcesContent":["/**\n * iCure Data Stack API Documentation\n * The iCure Data Stack Application API is the native interface to iCure. This version is obsolete, please use v2.\n *\n * OpenAPI spec version: v1\n *\n *\n * NOTE: This class is auto generated by the swagger code generator program.\n * https://github.com/swagger-api/swagger-codegen.git\n * Do not edit the class manually.\n */\n\nexport class AuthenticationResponse {\n constructor(json: JSON | any) {\n Object.assign(this as AuthenticationResponse, json)\n }\n\n groupId?: string\n userId?: string\n dataOwnerId?: string\n healthcarePartyId?: string\n reason?: string\n successful?: boolean\n username?: string\n token?: string\n refreshToken?: string\n}\n"]}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * iCure Data Stack API Documentation
3
+ * The iCure Data Stack Application API is the native interface to iCure. This version is obsolete, please use v2.
4
+ *
5
+ * OpenAPI spec version: v1
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by the swagger code generator program.
9
+ * https://github.com/swagger-api/swagger-codegen.git
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ * Represent an attachment holding some additional data for an entity.
14
+ */
15
+ export declare class DataAttachment {
16
+ constructor(json: JSON | any);
17
+ /**
18
+ * Id of the attachment, if stored as a couchdb attachment
19
+ */
20
+ couchDbAttachmentId?: string;
21
+ /**
22
+ * Id of the attachment, if stored using the object storage service
23
+ */
24
+ objectStoreAttachmentId?: string;
25
+ /**
26
+ * The Uniform Type Identifiers (https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_conc/understand_utis_conc.html#//apple_ref/doc/uid/TP40001319-CH202-CHDHIJDE) of the attachment.
27
+ * This is an array to allow representing a priority, but each UTI must be unique.
28
+ */
29
+ utis?: Array<string>;
30
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ /**
3
+ * iCure Data Stack API Documentation
4
+ * The iCure Data Stack Application API is the native interface to iCure. This version is obsolete, please use v2.
5
+ *
6
+ * OpenAPI spec version: v1
7
+ *
8
+ *
9
+ * NOTE: This class is auto generated by the swagger code generator program.
10
+ * https://github.com/swagger-api/swagger-codegen.git
11
+ * Do not edit the class manually.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.DataAttachment = void 0;
15
+ /**
16
+ * Represent an attachment holding some additional data for an entity.
17
+ */
18
+ class DataAttachment {
19
+ constructor(json) {
20
+ Object.assign(this, json);
21
+ }
22
+ }
23
+ exports.DataAttachment = DataAttachment;
24
+ //# sourceMappingURL=DataAttachment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataAttachment.js","sourceRoot":"","sources":["../../../icc-api/model/DataAttachment.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAEH;;GAEG;AACH,MAAa,cAAc;IACzB,YAAY,IAAgB;QAC1B,MAAM,CAAC,MAAM,CAAC,IAAsB,EAAE,IAAI,CAAC,CAAA;IAC7C,CAAC;CAeF;AAlBD,wCAkBC","sourcesContent":["/**\n * iCure Data Stack API Documentation\n * The iCure Data Stack Application API is the native interface to iCure. This version is obsolete, please use v2.\n *\n * OpenAPI spec version: v1\n *\n *\n * NOTE: This class is auto generated by the swagger code generator program.\n * https://github.com/swagger-api/swagger-codegen.git\n * Do not edit the class manually.\n */\n\n/**\n * Represent an attachment holding some additional data for an entity.\n */\nexport class DataAttachment {\n constructor(json: JSON | any) {\n Object.assign(this as DataAttachment, json)\n }\n\n /**\n * Id of the attachment, if stored as a couchdb attachment\n */\n couchDbAttachmentId?: string\n /**\n * Id of the attachment, if stored using the object storage service\n */\n objectStoreAttachmentId?: string\n /**\n * The Uniform Type Identifiers (https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_conc/understand_utis_conc.html#//apple_ref/doc/uid/TP40001319-CH202-CHDHIJDE) of the attachment.\n * This is an array to allow representing a priority, but each UTI must be unique.\n */\n utis?: Array<string>\n}\n"]}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * iCure Data Stack API Documentation
3
+ * The iCure Data Stack Application API is the native interface to iCure. This version is obsolete, please use v2.
4
+ *
5
+ * OpenAPI spec version: v1
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by the swagger code generator program.
9
+ * https://github.com/swagger-api/swagger-codegen.git
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ * Represents an attachment which was deleted from an entity.
14
+ */
15
+ export declare class DeletedAttachment {
16
+ constructor(json: JSON | any);
17
+ /**
18
+ * If the attachment was stored as a couchdb attachment this holds the id of the attachment, else null.
19
+ */
20
+ couchDbAttachmentId?: string;
21
+ /**
22
+ * If the attachment was stored using the object storage service this holds the id of the attachment, else null.
23
+ */
24
+ objectStoreAttachmentId?: string;
25
+ /**
26
+ * If the attachment was associated to a key this was its key, else null.
27
+ */
28
+ key?: string;
29
+ /**
30
+ * Instant the attachment was deleted, as epoch timestamp in ms.
31
+ */
32
+ deletionTime?: number;
33
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ /**
3
+ * iCure Data Stack API Documentation
4
+ * The iCure Data Stack Application API is the native interface to iCure. This version is obsolete, please use v2.
5
+ *
6
+ * OpenAPI spec version: v1
7
+ *
8
+ *
9
+ * NOTE: This class is auto generated by the swagger code generator program.
10
+ * https://github.com/swagger-api/swagger-codegen.git
11
+ * Do not edit the class manually.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.DeletedAttachment = void 0;
15
+ /**
16
+ * Represents an attachment which was deleted from an entity.
17
+ */
18
+ class DeletedAttachment {
19
+ constructor(json) {
20
+ Object.assign(this, json);
21
+ }
22
+ }
23
+ exports.DeletedAttachment = DeletedAttachment;
24
+ //# sourceMappingURL=DeletedAttachment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeletedAttachment.js","sourceRoot":"","sources":["../../../icc-api/model/DeletedAttachment.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAEH;;GAEG;AACH,MAAa,iBAAiB;IAC5B,YAAY,IAAgB;QAC1B,MAAM,CAAC,MAAM,CAAC,IAAyB,EAAE,IAAI,CAAC,CAAA;IAChD,CAAC;CAmBF;AAtBD,8CAsBC","sourcesContent":["/**\n * iCure Data Stack API Documentation\n * The iCure Data Stack Application API is the native interface to iCure. This version is obsolete, please use v2.\n *\n * OpenAPI spec version: v1\n *\n *\n * NOTE: This class is auto generated by the swagger code generator program.\n * https://github.com/swagger-api/swagger-codegen.git\n * Do not edit the class manually.\n */\n\n/**\n * Represents an attachment which was deleted from an entity.\n */\nexport class DeletedAttachment {\n constructor(json: JSON | any) {\n Object.assign(this as DeletedAttachment, json)\n }\n\n /**\n * If the attachment was stored as a couchdb attachment this holds the id of the attachment, else null.\n */\n couchDbAttachmentId?: string\n /**\n * If the attachment was stored using the object storage service this holds the id of the attachment, else null.\n */\n objectStoreAttachmentId?: string\n /**\n * If the attachment was associated to a key this was its key, else null.\n */\n key?: string\n\n /**\n * Instant the attachment was deleted, as epoch timestamp in ms.\n */\n deletionTime?: number\n}\n"]}
@@ -11,6 +11,8 @@
11
11
  */
12
12
  import { CodeStub } from './CodeStub';
13
13
  import { Delegation } from './Delegation';
14
+ import { DataAttachment } from './DataAttachment';
15
+ import { DeletedAttachment } from './DeletedAttachment';
14
16
  export declare class Document {
15
17
  constructor(json: JSON | any);
16
18
  /**
@@ -57,10 +59,6 @@ export declare class Document {
57
59
  * hard delete (unix epoch in ms) timestamp of the object. Filled automatically when deletePatient is called.
58
60
  */
59
61
  deletionDate?: number;
60
- /**
61
- * Reference in object store
62
- */
63
- objectStoreReference?: string;
64
62
  /**
65
63
  * Location of the document
66
64
  */
@@ -114,9 +112,23 @@ export declare class Document {
114
112
  */
115
113
  openingContactId?: string;
116
114
  /**
117
- * Id of attachment to this document
115
+ * Id of the main attachment of this document, if stored as a couchdb attachment
118
116
  */
119
117
  attachmentId?: string;
118
+ /**
119
+ * Id of the main attachment of this document, if stored using the object storage service
120
+ */
121
+ objectStoreReference?: string;
122
+ /**
123
+ * Secondary attachments for this document
124
+ */
125
+ secondaryAttachments?: {
126
+ [key: string]: DataAttachment;
127
+ };
128
+ /**
129
+ * Information on past attachments for this document
130
+ */
131
+ deletedAttachments?: Array<DeletedAttachment>;
120
132
  encryptedAttachment?: ArrayBuffer;
121
133
  decryptedAttachment?: ArrayBuffer;
122
134
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Document.js","sourceRoot":"","sources":["../../../icc-api/model/Document.ts"],"names":[],"mappings":";;;AAcA;;GAEG;AACH,+CAAuC;AACvC,MAAa,QAAQ;IACnB,YAAY,IAAgB;QAC1B,MAAM,CAAC,MAAM,CACX,IAAgB,EAChB,IAAI,EACJ,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,mBAAmB,EAAE,IAAA,qBAAO,EAAC,IAAI,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAC1F,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,mBAAmB,EAAE,IAAA,qBAAO,EAAC,IAAI,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAC3F,CAAA;IACH,CAAC;CAgIF;AAxID,4BAwIC;AACD,WAAiB,QAAQ;IAEV,6BAAoB,GAAG;QAClC,KAAK,EAAE,OAA+B;QACtC,IAAI,EAAE,MAA8B;KACrC,CAAA;IAyCY,yBAAgB,GAAG;QAC9B,SAAS,EAAE,WAA+B;QAC1C,KAAK,EAAE,OAA2B;QAClC,SAAS,EAAE,YAAgC;QAC3C,YAAY,EAAE,cAAkC;QAChD,eAAe,EAAE,iBAAqC;QACtD,aAAa,EAAE,eAAmC;QAClD,KAAK,EAAE,OAA2B;QAClC,OAAO,EAAE,SAA6B;QACtC,KAAK,EAAE,OAA2B;QAClC,SAAS,EAAE,WAA+B;QAC1C,eAAe,EAAE,iBAAqC;QACtD,qBAAqB,EAAE,yBAA6C;QACpE,sBAAsB,EAAE,0BAA8C;QACtE,uBAAuB,EAAE,2BAA+C;QACxE,wBAAwB,EAAE,4BAAgD;QAC1E,qBAAqB,EAAE,yBAA6C;QACpE,YAAY,EAAE,cAAkC;QAChD,YAAY,EAAE,cAAkC;QAChD,UAAU,EAAE,YAAgC;QAC5C,SAAS,EAAE,WAA+B;QAC1C,uBAAuB,EAAE,yBAA6C;QACtE,uBAAuB,EAAE,yBAA6C;QACtE,IAAI,EAAE,MAA0B;QAChC,YAAY,EAAE,cAAkC;QAChD,0BAA0B,EAAE,4BAAgD;QAC5E,YAAY,EAAE,cAAkC;QAChD,eAAe,EAAE,iBAAqC;QACtD,oBAAoB,EAAE,sBAA0C;QAChE,2BAA2B,EAAE,6BAAiD;QAC9E,QAAQ,EAAE,UAA8B;QACxC,MAAM,EAAE,QAA4B;QACpC,OAAO,EAAE,SAA6B;QACtC,MAAM,EAAE,QAA4B;QACpC,MAAM,EAAE,QAA4B;QACpC,cAAc,EAAE,gBAAoC;QACpD,QAAQ,EAAE,UAA8B;QACxC,aAAa,EAAE,gBAAoC;QACnD,mBAAmB,EAAE,qBAAyC;QAC9D,WAAW,EAAE,aAAiC;KAC/C,CAAA;IAWY,2BAAkB,GAAG;QAChC,KAAK,EAAE,OAA6B;QACpC,SAAS,EAAE,WAAiC;QAC5C,aAAa,EAAE,gBAAsC;QACrD,QAAQ,EAAE,UAAgC;QAC1C,gBAAgB,EAAE,mBAAyC;QAC3D,MAAM,EAAE,QAA8B;QACtC,QAAQ,EAAE,UAAgC;QAC1C,IAAI,EAAE,MAA4B;QAClC,SAAS,EAAE,WAAiC;KAC7C,CAAA;AACH,CAAC,EA5GgB,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QA4GxB","sourcesContent":["/**\n * iCure Data Stack API Documentation\n * The iCure Data Stack Application API is the native interface to iCure. This version is obsolete, please use v2.\n *\n * OpenAPI spec version: v1\n *\n *\n * NOTE: This class is auto generated by the swagger code generator program.\n * https://github.com/swagger-api/swagger-codegen.git\n * Do not edit the class manually.\n */\nimport { CodeStub } from './CodeStub'\nimport { Delegation } from './Delegation'\n\n/**\n * This entity is a root level object. It represents a Document. It is serialized in JSON and saved in the underlying CouchDB database.\n */\nimport { b64_2ab } from './ModelHelper'\nexport class Document {\n constructor(json: JSON | any) {\n Object.assign(\n this as Document,\n json,\n json.encryptedAttachment ? { encryptedAttachment: b64_2ab(json.encryptedAttachment) } : {},\n json.decryptedAttachment ? { decryptedAttachment: b64_2ab(json.decryptedAttachment) } : {}\n )\n }\n\n /**\n * The Id of the document. We encourage using either a v4 UUID or a HL7 Id.\n */\n id?: string\n /**\n * The revision of the document in the database, used for conflict management / optimistic locking.\n */\n rev?: string\n /**\n * The timestamp (unix epoch in ms) of creation of this entity, will be filled automatically if missing. Not enforced by the application server.\n */\n created?: number\n /**\n * The date (unix epoch in ms) of the latest modification of this entity, will be filled automatically if missing. Not enforced by the application server.\n */\n modified?: number\n /**\n * The id of the User that has created this entity, will be filled automatically if missing. Not enforced by the application server.\n */\n author?: string\n /**\n * The id of the HealthcareParty that is responsible for this entity, will be filled automatically if missing. Not enforced by the application server.\n */\n responsible?: string\n /**\n * The id of the medical location where this entity was created.\n */\n medicalLocationId?: string\n /**\n * A tag is an item from a codification system that qualifies an entity as being member of a certain class, whatever the value it might have taken. If the tag qualifies the content of a field, it means that whatever the content of the field, the tag will always apply. For example, the label of a field is qualified using a tag. LOINC is a codification system typically used for tags.\n */\n tags?: Array<CodeStub>\n /**\n * A code is an item from a codification system that qualifies the content of this entity. SNOMED-CT, ICPC-2 or ICD-10 codifications systems can be used for codes\n */\n codes?: Array<CodeStub>\n /**\n * Soft delete (unix epoch in ms) timestamp of the object.\n */\n endOfLife?: number\n /**\n * hard delete (unix epoch in ms) timestamp of the object. Filled automatically when deletePatient is called.\n */\n deletionDate?: number\n /**\n * Reference in object store\n */\n objectStoreReference?: string\n /**\n * Location of the document\n */\n documentLocation?: Document.DocumentLocationEnum\n /**\n * The type of document, ex: admission, clinical path, document report,invoice, etc.\n */\n documentType?: Document.DocumentTypeEnum\n /**\n * The status of the development of the document. Ex: Draft, finalized, reviewed, signed, etc.\n */\n documentStatus?: Document.DocumentStatusEnum\n /**\n * When the document is stored in an external repository, this is the uri of the document in that repository\n */\n externalUri?: string\n /**\n * The main Uniform Type Identifier of the document (https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_conc/understand_utis_conc.html#//apple_ref/doc/uid/TP40001319-CH202-CHDHIJDE)\n */\n mainUti?: string\n /**\n * Name of the document\n */\n name?: string\n /**\n * The document version\n */\n version?: string\n /**\n * Extra Uniform Type Identifiers\n */\n otherUtis?: Array<string>\n /**\n * The ICureDocument (Form, Contact, ...) that has been used to generate the document\n */\n storedICureDocumentId?: string\n /**\n * A unique external id (from another external source).\n */\n externalUuid?: string\n /**\n * Size of the document file\n */\n size?: number\n /**\n * Hashed version of the document\n */\n hash?: string\n /**\n * Id of the contact during which the document was created\n */\n openingContactId?: string\n /**\n * Id of attachment to this document\n */\n attachmentId?: string\n encryptedAttachment?: ArrayBuffer\n decryptedAttachment?: ArrayBuffer\n /**\n * The secretForeignKeys are filled at the to many end of a one to many relationship (for example inside Contact for the Patient -> Contacts relationship). Used when we want to find all contacts for a specific patient. These keys are in clear. You can have several to partition the medical document space.\n */\n secretForeignKeys?: Array<string>\n /**\n * The secretForeignKeys are filled at the to many end of a one to many relationship (for example inside Contact for the Patient -> Contacts relationship). Used when we want to find the patient for a specific contact. These keys are the encrypted id (using the hcParty key for the delegate) that can be found in clear inside the patient. ids encrypted using the hcParty keys.\n */\n cryptedForeignKeys?: { [key: string]: Array<Delegation> }\n /**\n * When a document is created, the responsible generates a cryptographically random master key (never to be used for something else than referencing from other entities). He/she encrypts it using his own AES exchange key and stores it as a delegation. The responsible is thus always in the delegations as well\n */\n delegations?: { [key: string]: Array<Delegation> }\n /**\n * When a document needs to be encrypted, the responsible generates a cryptographically random master key (different from the delegation key, never to appear in clear anywhere in the db. He/she encrypts it using his own AES exchange key and stores it as a delegation\n */\n encryptionKeys?: { [key: string]: Array<Delegation> }\n /**\n * The base64 encoded data of this object, formatted as JSON and encrypted in AES using the random master key from encryptionKeys.\n */\n encryptedSelf?: string\n}\nexport namespace Document {\n export type DocumentLocationEnum = 'annex' | 'body'\n export const DocumentLocationEnum = {\n Annex: 'annex' as DocumentLocationEnum,\n Body: 'body' as DocumentLocationEnum,\n }\n export type DocumentTypeEnum =\n | 'admission'\n | 'alert'\n | 'bvt_sample'\n | 'clinicalpath'\n | 'clinicalsummary'\n | 'contactreport'\n | 'quote'\n | 'invoice'\n | 'death'\n | 'discharge'\n | 'dischargereport'\n | 'ebirth_baby_medicalform'\n | 'ebirth_baby_notification'\n | 'ebirth_mother_medicalform'\n | 'ebirth_mother_notification'\n | 'ecare_safe_consultation'\n | 'epidemiology'\n | 'intervention'\n | 'labrequest'\n | 'labresult'\n | 'medicaladvisoragreement'\n | 'medicationschemeelement'\n | 'note'\n | 'notification'\n | 'pharmaceuticalprescription'\n | 'prescription'\n | 'productdelivery'\n | 'quickdischargereport'\n | 'radiationexposuremonitoring'\n | 'referral'\n | 'report'\n | 'request'\n | 'result'\n | 'sumehr'\n | 'telemonitoring'\n | 'template'\n | 'template_admin'\n | 'treatmentsuspension'\n | 'vaccination'\n export const DocumentTypeEnum = {\n Admission: 'admission' as DocumentTypeEnum,\n Alert: 'alert' as DocumentTypeEnum,\n BvtSample: 'bvt_sample' as DocumentTypeEnum,\n Clinicalpath: 'clinicalpath' as DocumentTypeEnum,\n Clinicalsummary: 'clinicalsummary' as DocumentTypeEnum,\n Contactreport: 'contactreport' as DocumentTypeEnum,\n Quote: 'quote' as DocumentTypeEnum,\n Invoice: 'invoice' as DocumentTypeEnum,\n Death: 'death' as DocumentTypeEnum,\n Discharge: 'discharge' as DocumentTypeEnum,\n Dischargereport: 'dischargereport' as DocumentTypeEnum,\n EbirthBabyMedicalform: 'ebirth_baby_medicalform' as DocumentTypeEnum,\n EbirthBabyNotification: 'ebirth_baby_notification' as DocumentTypeEnum,\n EbirthMotherMedicalform: 'ebirth_mother_medicalform' as DocumentTypeEnum,\n EbirthMotherNotification: 'ebirth_mother_notification' as DocumentTypeEnum,\n EcareSafeConsultation: 'ecare_safe_consultation' as DocumentTypeEnum,\n Epidemiology: 'epidemiology' as DocumentTypeEnum,\n Intervention: 'intervention' as DocumentTypeEnum,\n Labrequest: 'labrequest' as DocumentTypeEnum,\n Labresult: 'labresult' as DocumentTypeEnum,\n Medicaladvisoragreement: 'medicaladvisoragreement' as DocumentTypeEnum,\n Medicationschemeelement: 'medicationschemeelement' as DocumentTypeEnum,\n Note: 'note' as DocumentTypeEnum,\n Notification: 'notification' as DocumentTypeEnum,\n Pharmaceuticalprescription: 'pharmaceuticalprescription' as DocumentTypeEnum,\n Prescription: 'prescription' as DocumentTypeEnum,\n Productdelivery: 'productdelivery' as DocumentTypeEnum,\n Quickdischargereport: 'quickdischargereport' as DocumentTypeEnum,\n Radiationexposuremonitoring: 'radiationexposuremonitoring' as DocumentTypeEnum,\n Referral: 'referral' as DocumentTypeEnum,\n Report: 'report' as DocumentTypeEnum,\n Request: 'request' as DocumentTypeEnum,\n Result: 'result' as DocumentTypeEnum,\n Sumehr: 'sumehr' as DocumentTypeEnum,\n Telemonitoring: 'telemonitoring' as DocumentTypeEnum,\n Template: 'template' as DocumentTypeEnum,\n TemplateAdmin: 'template_admin' as DocumentTypeEnum,\n Treatmentsuspension: 'treatmentsuspension' as DocumentTypeEnum,\n Vaccination: 'vaccination' as DocumentTypeEnum,\n }\n export type DocumentStatusEnum =\n | 'draft'\n | 'finalized'\n | 'pending_review'\n | 'reviewed'\n | 'pending_signature'\n | 'signed'\n | 'canceled'\n | 'sent'\n | 'delivered'\n export const DocumentStatusEnum = {\n Draft: 'draft' as DocumentStatusEnum,\n Finalized: 'finalized' as DocumentStatusEnum,\n PendingReview: 'pending_review' as DocumentStatusEnum,\n Reviewed: 'reviewed' as DocumentStatusEnum,\n PendingSignature: 'pending_signature' as DocumentStatusEnum,\n Signed: 'signed' as DocumentStatusEnum,\n Canceled: 'canceled' as DocumentStatusEnum,\n Sent: 'sent' as DocumentStatusEnum,\n Delivered: 'delivered' as DocumentStatusEnum,\n }\n}\n"]}
1
+ {"version":3,"file":"Document.js","sourceRoot":"","sources":["../../../icc-api/model/Document.ts"],"names":[],"mappings":";;;AAgBA;;GAEG;AACH,+CAAuC;AACvC,MAAa,QAAQ;IACnB,YAAY,IAAgB;QAC1B,MAAM,CAAC,MAAM,CACX,IAAgB,EAChB,IAAI,EACJ,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,mBAAmB,EAAE,IAAA,qBAAO,EAAC,IAAI,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAC1F,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,mBAAmB,EAAE,IAAA,qBAAO,EAAC,IAAI,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAC3F,CAAA;IACH,CAAC;CAwIF;AAhJD,4BAgJC;AACD,WAAiB,QAAQ;IAEV,6BAAoB,GAAG;QAClC,KAAK,EAAE,OAA+B;QACtC,IAAI,EAAE,MAA8B;KACrC,CAAA;IAyCY,yBAAgB,GAAG;QAC9B,SAAS,EAAE,WAA+B;QAC1C,KAAK,EAAE,OAA2B;QAClC,SAAS,EAAE,YAAgC;QAC3C,YAAY,EAAE,cAAkC;QAChD,eAAe,EAAE,iBAAqC;QACtD,aAAa,EAAE,eAAmC;QAClD,KAAK,EAAE,OAA2B;QAClC,OAAO,EAAE,SAA6B;QACtC,KAAK,EAAE,OAA2B;QAClC,SAAS,EAAE,WAA+B;QAC1C,eAAe,EAAE,iBAAqC;QACtD,qBAAqB,EAAE,yBAA6C;QACpE,sBAAsB,EAAE,0BAA8C;QACtE,uBAAuB,EAAE,2BAA+C;QACxE,wBAAwB,EAAE,4BAAgD;QAC1E,qBAAqB,EAAE,yBAA6C;QACpE,YAAY,EAAE,cAAkC;QAChD,YAAY,EAAE,cAAkC;QAChD,UAAU,EAAE,YAAgC;QAC5C,SAAS,EAAE,WAA+B;QAC1C,uBAAuB,EAAE,yBAA6C;QACtE,uBAAuB,EAAE,yBAA6C;QACtE,IAAI,EAAE,MAA0B;QAChC,YAAY,EAAE,cAAkC;QAChD,0BAA0B,EAAE,4BAAgD;QAC5E,YAAY,EAAE,cAAkC;QAChD,eAAe,EAAE,iBAAqC;QACtD,oBAAoB,EAAE,sBAA0C;QAChE,2BAA2B,EAAE,6BAAiD;QAC9E,QAAQ,EAAE,UAA8B;QACxC,MAAM,EAAE,QAA4B;QACpC,OAAO,EAAE,SAA6B;QACtC,MAAM,EAAE,QAA4B;QACpC,MAAM,EAAE,QAA4B;QACpC,cAAc,EAAE,gBAAoC;QACpD,QAAQ,EAAE,UAA8B;QACxC,aAAa,EAAE,gBAAoC;QACnD,mBAAmB,EAAE,qBAAyC;QAC9D,WAAW,EAAE,aAAiC;KAC/C,CAAA;IAWY,2BAAkB,GAAG;QAChC,KAAK,EAAE,OAA6B;QACpC,SAAS,EAAE,WAAiC;QAC5C,aAAa,EAAE,gBAAsC;QACrD,QAAQ,EAAE,UAAgC;QAC1C,gBAAgB,EAAE,mBAAyC;QAC3D,MAAM,EAAE,QAA8B;QACtC,QAAQ,EAAE,UAAgC;QAC1C,IAAI,EAAE,MAA4B;QAClC,SAAS,EAAE,WAAiC;KAC7C,CAAA;AACH,CAAC,EA5GgB,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QA4GxB","sourcesContent":["/**\n * iCure Data Stack API Documentation\n * The iCure Data Stack Application API is the native interface to iCure. This version is obsolete, please use v2.\n *\n * OpenAPI spec version: v1\n *\n *\n * NOTE: This class is auto generated by the swagger code generator program.\n * https://github.com/swagger-api/swagger-codegen.git\n * Do not edit the class manually.\n */\nimport { CodeStub } from './CodeStub'\nimport { Delegation } from './Delegation'\nimport { DataAttachment } from './DataAttachment'\nimport { DeletedAttachment } from './DeletedAttachment'\n\n/**\n * This entity is a root level object. It represents a Document. It is serialized in JSON and saved in the underlying CouchDB database.\n */\nimport { b64_2ab } from './ModelHelper'\nexport class Document {\n constructor(json: JSON | any) {\n Object.assign(\n this as Document,\n json,\n json.encryptedAttachment ? { encryptedAttachment: b64_2ab(json.encryptedAttachment) } : {},\n json.decryptedAttachment ? { decryptedAttachment: b64_2ab(json.decryptedAttachment) } : {}\n )\n }\n\n /**\n * The Id of the document. We encourage using either a v4 UUID or a HL7 Id.\n */\n id?: string\n /**\n * The revision of the document in the database, used for conflict management / optimistic locking.\n */\n rev?: string\n /**\n * The timestamp (unix epoch in ms) of creation of this entity, will be filled automatically if missing. Not enforced by the application server.\n */\n created?: number\n /**\n * The date (unix epoch in ms) of the latest modification of this entity, will be filled automatically if missing. Not enforced by the application server.\n */\n modified?: number\n /**\n * The id of the User that has created this entity, will be filled automatically if missing. Not enforced by the application server.\n */\n author?: string\n /**\n * The id of the HealthcareParty that is responsible for this entity, will be filled automatically if missing. Not enforced by the application server.\n */\n responsible?: string\n /**\n * The id of the medical location where this entity was created.\n */\n medicalLocationId?: string\n /**\n * A tag is an item from a codification system that qualifies an entity as being member of a certain class, whatever the value it might have taken. If the tag qualifies the content of a field, it means that whatever the content of the field, the tag will always apply. For example, the label of a field is qualified using a tag. LOINC is a codification system typically used for tags.\n */\n tags?: Array<CodeStub>\n /**\n * A code is an item from a codification system that qualifies the content of this entity. SNOMED-CT, ICPC-2 or ICD-10 codifications systems can be used for codes\n */\n codes?: Array<CodeStub>\n /**\n * Soft delete (unix epoch in ms) timestamp of the object.\n */\n endOfLife?: number\n /**\n * hard delete (unix epoch in ms) timestamp of the object. Filled automatically when deletePatient is called.\n */\n deletionDate?: number\n /**\n * Location of the document\n */\n documentLocation?: Document.DocumentLocationEnum\n /**\n * The type of document, ex: admission, clinical path, document report,invoice, etc.\n */\n documentType?: Document.DocumentTypeEnum\n /**\n * The status of the development of the document. Ex: Draft, finalized, reviewed, signed, etc.\n */\n documentStatus?: Document.DocumentStatusEnum\n /**\n * When the document is stored in an external repository, this is the uri of the document in that repository\n */\n externalUri?: string\n /**\n * The main Uniform Type Identifier of the document (https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_conc/understand_utis_conc.html#//apple_ref/doc/uid/TP40001319-CH202-CHDHIJDE)\n */\n mainUti?: string\n /**\n * Name of the document\n */\n name?: string\n /**\n * The document version\n */\n version?: string\n /**\n * Extra Uniform Type Identifiers\n */\n otherUtis?: Array<string>\n /**\n * The ICureDocument (Form, Contact, ...) that has been used to generate the document\n */\n storedICureDocumentId?: string\n /**\n * A unique external id (from another external source).\n */\n externalUuid?: string\n /**\n * Size of the document file\n */\n size?: number\n /**\n * Hashed version of the document\n */\n hash?: string\n /**\n * Id of the contact during which the document was created\n */\n openingContactId?: string\n /**\n * Id of the main attachment of this document, if stored as a couchdb attachment\n */\n attachmentId?: string\n /**\n * Id of the main attachment of this document, if stored using the object storage service\n */\n objectStoreReference?: string\n /**\n * Secondary attachments for this document\n */\n secondaryAttachments?: { [key: string]: DataAttachment }\n /**\n * Information on past attachments for this document\n */\n deletedAttachments?: Array<DeletedAttachment>\n encryptedAttachment?: ArrayBuffer\n decryptedAttachment?: ArrayBuffer\n /**\n * The secretForeignKeys are filled at the to many end of a one to many relationship (for example inside Contact for the Patient -> Contacts relationship). Used when we want to find all contacts for a specific patient. These keys are in clear. You can have several to partition the medical document space.\n */\n secretForeignKeys?: Array<string>\n /**\n * The secretForeignKeys are filled at the to many end of a one to many relationship (for example inside Contact for the Patient -> Contacts relationship). Used when we want to find the patient for a specific contact. These keys are the encrypted id (using the hcParty key for the delegate) that can be found in clear inside the patient. ids encrypted using the hcParty keys.\n */\n cryptedForeignKeys?: { [key: string]: Array<Delegation> }\n /**\n * When a document is created, the responsible generates a cryptographically random master key (never to be used for something else than referencing from other entities). He/she encrypts it using his own AES exchange key and stores it as a delegation. The responsible is thus always in the delegations as well\n */\n delegations?: { [key: string]: Array<Delegation> }\n /**\n * When a document needs to be encrypted, the responsible generates a cryptographically random master key (different from the delegation key, never to appear in clear anywhere in the db. He/she encrypts it using his own AES exchange key and stores it as a delegation\n */\n encryptionKeys?: { [key: string]: Array<Delegation> }\n /**\n * The base64 encoded data of this object, formatted as JSON and encrypted in AES using the random master key from encryptionKeys.\n */\n encryptedSelf?: string\n}\nexport namespace Document {\n export type DocumentLocationEnum = 'annex' | 'body'\n export const DocumentLocationEnum = {\n Annex: 'annex' as DocumentLocationEnum,\n Body: 'body' as DocumentLocationEnum,\n }\n export type DocumentTypeEnum =\n | 'admission'\n | 'alert'\n | 'bvt_sample'\n | 'clinicalpath'\n | 'clinicalsummary'\n | 'contactreport'\n | 'quote'\n | 'invoice'\n | 'death'\n | 'discharge'\n | 'dischargereport'\n | 'ebirth_baby_medicalform'\n | 'ebirth_baby_notification'\n | 'ebirth_mother_medicalform'\n | 'ebirth_mother_notification'\n | 'ecare_safe_consultation'\n | 'epidemiology'\n | 'intervention'\n | 'labrequest'\n | 'labresult'\n | 'medicaladvisoragreement'\n | 'medicationschemeelement'\n | 'note'\n | 'notification'\n | 'pharmaceuticalprescription'\n | 'prescription'\n | 'productdelivery'\n | 'quickdischargereport'\n | 'radiationexposuremonitoring'\n | 'referral'\n | 'report'\n | 'request'\n | 'result'\n | 'sumehr'\n | 'telemonitoring'\n | 'template'\n | 'template_admin'\n | 'treatmentsuspension'\n | 'vaccination'\n export const DocumentTypeEnum = {\n Admission: 'admission' as DocumentTypeEnum,\n Alert: 'alert' as DocumentTypeEnum,\n BvtSample: 'bvt_sample' as DocumentTypeEnum,\n Clinicalpath: 'clinicalpath' as DocumentTypeEnum,\n Clinicalsummary: 'clinicalsummary' as DocumentTypeEnum,\n Contactreport: 'contactreport' as DocumentTypeEnum,\n Quote: 'quote' as DocumentTypeEnum,\n Invoice: 'invoice' as DocumentTypeEnum,\n Death: 'death' as DocumentTypeEnum,\n Discharge: 'discharge' as DocumentTypeEnum,\n Dischargereport: 'dischargereport' as DocumentTypeEnum,\n EbirthBabyMedicalform: 'ebirth_baby_medicalform' as DocumentTypeEnum,\n EbirthBabyNotification: 'ebirth_baby_notification' as DocumentTypeEnum,\n EbirthMotherMedicalform: 'ebirth_mother_medicalform' as DocumentTypeEnum,\n EbirthMotherNotification: 'ebirth_mother_notification' as DocumentTypeEnum,\n EcareSafeConsultation: 'ecare_safe_consultation' as DocumentTypeEnum,\n Epidemiology: 'epidemiology' as DocumentTypeEnum,\n Intervention: 'intervention' as DocumentTypeEnum,\n Labrequest: 'labrequest' as DocumentTypeEnum,\n Labresult: 'labresult' as DocumentTypeEnum,\n Medicaladvisoragreement: 'medicaladvisoragreement' as DocumentTypeEnum,\n Medicationschemeelement: 'medicationschemeelement' as DocumentTypeEnum,\n Note: 'note' as DocumentTypeEnum,\n Notification: 'notification' as DocumentTypeEnum,\n Pharmaceuticalprescription: 'pharmaceuticalprescription' as DocumentTypeEnum,\n Prescription: 'prescription' as DocumentTypeEnum,\n Productdelivery: 'productdelivery' as DocumentTypeEnum,\n Quickdischargereport: 'quickdischargereport' as DocumentTypeEnum,\n Radiationexposuremonitoring: 'radiationexposuremonitoring' as DocumentTypeEnum,\n Referral: 'referral' as DocumentTypeEnum,\n Report: 'report' as DocumentTypeEnum,\n Request: 'request' as DocumentTypeEnum,\n Result: 'result' as DocumentTypeEnum,\n Sumehr: 'sumehr' as DocumentTypeEnum,\n Telemonitoring: 'telemonitoring' as DocumentTypeEnum,\n Template: 'template' as DocumentTypeEnum,\n TemplateAdmin: 'template_admin' as DocumentTypeEnum,\n Treatmentsuspension: 'treatmentsuspension' as DocumentTypeEnum,\n Vaccination: 'vaccination' as DocumentTypeEnum,\n }\n export type DocumentStatusEnum =\n | 'draft'\n | 'finalized'\n | 'pending_review'\n | 'reviewed'\n | 'pending_signature'\n | 'signed'\n | 'canceled'\n | 'sent'\n | 'delivered'\n export const DocumentStatusEnum = {\n Draft: 'draft' as DocumentStatusEnum,\n Finalized: 'finalized' as DocumentStatusEnum,\n PendingReview: 'pending_review' as DocumentStatusEnum,\n Reviewed: 'reviewed' as DocumentStatusEnum,\n PendingSignature: 'pending_signature' as DocumentStatusEnum,\n Signed: 'signed' as DocumentStatusEnum,\n Canceled: 'canceled' as DocumentStatusEnum,\n Sent: 'sent' as DocumentStatusEnum,\n Delivered: 'delivered' as DocumentStatusEnum,\n }\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export declare class RefreshTokenExpiredError extends Error {
2
+ constructor();
3
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RefreshTokenExpiredError = void 0;
4
+ class RefreshTokenExpiredError extends Error {
5
+ constructor() {
6
+ super('The refresh JWT expired, you must login again');
7
+ }
8
+ }
9
+ exports.RefreshTokenExpiredError = RefreshTokenExpiredError;
10
+ //# sourceMappingURL=RefreshTokenExpiredError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RefreshTokenExpiredError.js","sourceRoot":"","sources":["../../../icc-api/model/RefreshTokenExpiredError.ts"],"names":[],"mappings":";;;AAAA,MAAa,wBAAyB,SAAQ,KAAK;IACjD;QACE,KAAK,CAAC,+CAA+C,CAAC,CAAA;IACxD,CAAC;CACF;AAJD,4DAIC","sourcesContent":["export class RefreshTokenExpiredError extends Error {\n constructor() {\n super('The refresh JWT expired, you must login again')\n }\n}\n"]}
@@ -0,0 +1,16 @@
1
+ import { XHR } from '../../icc-api/api/XHR';
2
+ import Header = XHR.Header;
3
+ export interface AuthService {
4
+ /**
5
+ * This method returns the headers needed to authenticate the user.
6
+ * It can throw an error if is not possible to get the headers.
7
+ * @return an array of headers for authentication.
8
+ */
9
+ getAuthHeaders(): Promise<Array<Header>>;
10
+ /**
11
+ * If the headers are invalidated, you can set the error to throw
12
+ * the next time the headers are requested.
13
+ * @param error the error to throw
14
+ */
15
+ invalidateHeader(error: Error): void;
16
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=AuthService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthService.js","sourceRoot":"","sources":["../../../icc-x-api/auth/AuthService.ts"],"names":[],"mappings":"","sourcesContent":["import { XHR } from '../../icc-api/api/XHR'\nimport Header = XHR.Header\n\nexport interface AuthService {\n /**\n * This method returns the headers needed to authenticate the user.\n * It can throw an error if is not possible to get the headers.\n * @return an array of headers for authentication.\n */\n getAuthHeaders(): Promise<Array<Header>>\n\n /**\n * If the headers are invalidated, you can set the error to throw\n * the next time the headers are requested.\n * @param error the error to throw\n */\n invalidateHeader(error: Error): void\n}\n"]}
@@ -0,0 +1,22 @@
1
+ import { AuthService } from './AuthService';
2
+ import { IccAuthApi } from '../../icc-api';
3
+ export interface AuthenticationProvider {
4
+ getAuthService(): AuthService;
5
+ }
6
+ export declare class EnsembleAuthenticationProvider implements AuthenticationProvider {
7
+ private authApi;
8
+ private username;
9
+ private password;
10
+ private jwtTimeout;
11
+ private readonly basicAuth;
12
+ private jwtAuth;
13
+ private suspensionEnd;
14
+ constructor(authApi: IccAuthApi, username: string, password: string, jwtTimeout?: number);
15
+ getAuthService(): AuthService;
16
+ }
17
+ export declare class BasicAuthenticationProvider implements AuthenticationProvider {
18
+ private username;
19
+ private password;
20
+ constructor(username: string, password: string);
21
+ getAuthService(): AuthService;
22
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BasicAuthenticationProvider = exports.EnsembleAuthenticationProvider = void 0;
4
+ const EnsembleAuthService_1 = require("./EnsembleAuthService");
5
+ const JwtAuthService_1 = require("./JwtAuthService");
6
+ const NoAuthService_1 = require("./NoAuthService");
7
+ const BasicAuthService_1 = require("./BasicAuthService");
8
+ class EnsembleAuthenticationProvider {
9
+ constructor(authApi, username, password, jwtTimeout = 3600) {
10
+ this.authApi = authApi;
11
+ this.username = username;
12
+ this.password = password;
13
+ this.jwtTimeout = jwtTimeout;
14
+ this.jwtAuth = new JwtAuthService_1.JwtAuthService(this.authApi, this.username, this.password);
15
+ this.basicAuth = new BasicAuthService_1.BasicAuthService(this.username, this.password);
16
+ }
17
+ getAuthService() {
18
+ // If the jwtAuth is in an error state, it instantiates a new one,
19
+ // but it will not use it until the suspension ends
20
+ if (this.jwtAuth.isInErrorState()) {
21
+ console.warn('Error state in JWT, I will skip it');
22
+ this.jwtAuth = new JwtAuthService_1.JwtAuthService(this.authApi, this.username, this.password);
23
+ this.suspensionEnd = new Date(new Date().getTime() + this.jwtTimeout * 1000);
24
+ }
25
+ return !!this.suspensionEnd && new Date() <= this.suspensionEnd
26
+ ? new EnsembleAuthService_1.EnsembleAuthService(null, new NoAuthService_1.NoAuthService(), this.basicAuth)
27
+ : new EnsembleAuthService_1.EnsembleAuthService(this.jwtAuth, new NoAuthService_1.NoAuthService(), this.basicAuth);
28
+ }
29
+ }
30
+ exports.EnsembleAuthenticationProvider = EnsembleAuthenticationProvider;
31
+ class BasicAuthenticationProvider {
32
+ constructor(username, password) {
33
+ this.username = username;
34
+ this.password = password;
35
+ }
36
+ getAuthService() {
37
+ return new BasicAuthService_1.BasicAuthService(this.username, this.password);
38
+ }
39
+ }
40
+ exports.BasicAuthenticationProvider = BasicAuthenticationProvider;
41
+ //# sourceMappingURL=AuthenticationProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthenticationProvider.js","sourceRoot":"","sources":["../../../icc-x-api/auth/AuthenticationProvider.ts"],"names":[],"mappings":";;;AAEA,+DAA2D;AAC3D,qDAAiD;AACjD,mDAA+C;AAC/C,yDAAqD;AAMrD,MAAa,8BAA8B;IAKzC,YAAoB,OAAmB,EAAU,QAAgB,EAAU,QAAgB,EAAU,aAAqB,IAAI;QAA1G,YAAO,GAAP,OAAO,CAAY;QAAU,aAAQ,GAAR,QAAQ,CAAQ;QAAU,aAAQ,GAAR,QAAQ,CAAQ;QAAU,eAAU,GAAV,UAAU,CAAe;QAC5H,IAAI,CAAC,OAAO,GAAG,IAAI,+BAAc,CAAC,IAAI,CAAC,OAAO,EAAE,IAA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Api } from '../../icc-api'\nimport { EnsembleAuthService } from './EnsembleAuthService'\nimport { JwtAuthService } from './JwtAuthService'\nimport { NoAuthService } from './NoAuthService'\nimport { BasicAuthService } from './BasicAuthService'\n\nexport interface AuthenticationProvider {\n getAuthService(): AuthService\n}\n\nexport class EnsembleAuthenticationProvider implements AuthenticationProvider {\n private readonly basicAuth: BasicAuthService\n private jwtAuth: JwtAuthService\n private suspensionEnd: Date | undefined\n\n constructor(private authApi: IccAuthApi, private username: string, private password: string, private jwtTimeout: number = 3600) {\n this.jwtAuth = new JwtAuthService(this.authApi, this.username, this.password)\n this.basicAuth = new BasicAuthService(this.username, this.password)\n }\n\n getAuthService(): AuthService {\n // If the jwtAuth is in an error state, it instantiates a new one,\n // but it will not use it until the suspension ends\n if (this.jwtAuth.isInErrorState()) {\n console.warn('Error state in JWT, I will skip it')\n this.jwtAuth = new JwtAuthService(this.authApi, this.username, this.password)\n this.suspensionEnd = new Date(new Date().getTime() + this.jwtTimeout * 1000)\n }\n\n return !!this.suspensionEnd && new Date() <= this.suspensionEnd\n ? new EnsembleAuthService(null, new NoAuthService(), this.basicAuth)\n : new EnsembleAuthService(this.jwtAuth, new NoAuthService(), this.basicAuth)\n }\n}\n\nexport class BasicAuthenticationProvider implements AuthenticationProvider {\n constructor(private username: string, private password: string) {}\n\n getAuthService(): AuthService {\n return new BasicAuthService(this.username, this.password)\n }\n}\n"]}
@@ -0,0 +1,12 @@
1
+ import { AuthService } from './AuthService';
2
+ import { XHR } from '../../icc-api/api/XHR';
3
+ import Header = XHR.Header;
4
+ export declare class BasicAuthService implements AuthService {
5
+ private username;
6
+ private password;
7
+ private error;
8
+ constructor(username: string, password: string);
9
+ getAuthHeaders(): Promise<Array<Header>>;
10
+ private _base64Encode;
11
+ invalidateHeader(error: Error): void;
12
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BasicAuthService = void 0;
4
+ const XHR_1 = require("../../icc-api/api/XHR");
5
+ var Header = XHR_1.XHR.Header;
6
+ class BasicAuthService {
7
+ constructor(username, password) {
8
+ this.username = username;
9
+ this.password = password;
10
+ this.error = null;
11
+ }
12
+ getAuthHeaders() {
13
+ if (!!this.error) {
14
+ throw this.error;
15
+ }
16
+ return Promise.resolve([new Header('Authorization', `Basic ${this._base64Encode(`${this.username}:${this.password}`)}`)]);
17
+ }
18
+ _base64Encode(decodedString) {
19
+ return Buffer.from(decodedString).toString('base64');
20
+ }
21
+ invalidateHeader(error) {
22
+ this.error = error;
23
+ }
24
+ }
25
+ exports.BasicAuthService = BasicAuthService;
26
+ //# sourceMappingURL=BasicAuthService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BasicAuthService.js","sourceRoot":"","sources":["../../../icc-x-api/auth/BasicAuthService.ts"],"names":[],"mappings":";;;AACA,+CAA2C;AAC3C,IAAO,MAAM,GAAG,SAAG,CAAC,MAAM,CAAA;AAE1B,MAAa,gBAAgB;IAG3B,YAAoB,QAAgB,EAAU,QAAgB;QAA1C,aAAQ,GAAR,QAAQ,CAAQ;QAAU,aAAQ,GAAR,QAAQ,CAAQ;QAFtD,UAAK,GAAiB,IAAI,CAAA;IAE+B,CAAC;IAElE,cAAc;QACZ,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE;YAChB,MAAM,IAAI,CAAC,KAAK,CAAA;SACjB;QACD,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,MAAM,CAAC,eAAe,EAAE,SAAS,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;IAC3H,CAAC;IAEO,aAAa,CAAC,aAAqB;QACzC,OAAO,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;IACtD,CAAC;IAED,gBAAgB,CAAC,KAAY;QAC3B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;CACF;AAnBD,4CAmBC","sourcesContent":["import { AuthService } from './AuthService'\nimport { XHR } from '../../icc-api/api/XHR'\nimport Header = XHR.Header\n\nexport class BasicAuthService implements AuthService {\n private error: Error | null = null\n\n constructor(private username: string, private password: string) {}\n\n getAuthHeaders(): Promise<Array<Header>> {\n if (!!this.error) {\n throw this.error\n }\n return Promise.resolve([new Header('Authorization', `Basic ${this._base64Encode(`${this.username}:${this.password}`)}`)])\n }\n\n private _base64Encode(decodedString: string): string {\n return Buffer.from(decodedString).toString('base64')\n }\n\n invalidateHeader(error: Error): void {\n this.error = error\n }\n}\n"]}
@@ -0,0 +1,17 @@
1
+ import { AuthService } from './AuthService';
2
+ import { XHR } from '../../icc-api/api/XHR';
3
+ import { JwtAuthService } from './JwtAuthService';
4
+ import { NoAuthService } from './NoAuthService';
5
+ import { BasicAuthService } from './BasicAuthService';
6
+ import Header = XHR.Header;
7
+ export declare class EnsembleAuthService implements AuthService {
8
+ private readonly jwtAuth;
9
+ private readonly sessionAuth;
10
+ private readonly basicAuth;
11
+ private currentState;
12
+ private error;
13
+ private stateMap;
14
+ constructor(jwtAuth: JwtAuthService | null, sessionAuth: NoAuthService, basicAuth: BasicAuthService);
15
+ getAuthHeaders(): Promise<Array<Header>>;
16
+ invalidateHeader(error: Error): void;
17
+ }
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.EnsembleAuthService = void 0;
13
+ class EnsembleAuthService {
14
+ constructor(jwtAuth, sessionAuth, basicAuth) {
15
+ this.jwtAuth = jwtAuth;
16
+ this.sessionAuth = sessionAuth;
17
+ this.basicAuth = basicAuth;
18
+ this.error = null;
19
+ this.stateMap = {
20
+ start: { state: null, next: 'jwt' },
21
+ jwt: { state: this.jwtAuth, next: 'session' },
22
+ session: { state: this.sessionAuth, next: 'basic' },
23
+ basic: { state: this.basicAuth, next: null },
24
+ };
25
+ this.currentState = 'start';
26
+ }
27
+ getAuthHeaders() {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ this.currentState = !!this.currentState ? this.stateMap[this.currentState].next : this.currentState;
30
+ if (!!this.currentState) {
31
+ // If I have a state I return the headers, otherwise I return empty headers
32
+ // And delegate the responsibility of handling the error to the next call
33
+ return !!this.stateMap[this.currentState].state
34
+ ? this.stateMap[this.currentState].state.getAuthHeaders().catch((e) => {
35
+ // If I get an error, it is also responsibility of the next call, but I give a warning
36
+ console.warn(e.message);
37
+ this.error = e;
38
+ return [];
39
+ })
40
+ : Promise.resolve([]);
41
+ }
42
+ else if (!!this.error) {
43
+ // If I have no more states, I throw the last error or a default one
44
+ throw this.error;
45
+ }
46
+ else {
47
+ throw new Error('Cannot authenticate');
48
+ }
49
+ });
50
+ }
51
+ invalidateHeader(error) {
52
+ var _a;
53
+ this.error = error;
54
+ if (!!this.currentState) {
55
+ (_a = this.stateMap[this.currentState].state) === null || _a === void 0 ? void 0 : _a.invalidateHeader(error);
56
+ }
57
+ }
58
+ }
59
+ exports.EnsembleAuthService = EnsembleAuthService;
60
+ //# sourceMappingURL=EnsembleAuthService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EnsembleAuthService.js","sourceRoot":"","sources":["../../../icc-x-api/auth/EnsembleAuthService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAOA,MAAa,mBAAmB;IAK9B,YACmB,OAA8B,EAC9B,WAA0B,EA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;oBACJ,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;aACxB;iBAAM,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE;gBACvB,oEAAoE;gBACpE,MAAM,IAAI,CAAC,KAAK,CAAA;aACjB;iBAAM;gBACL,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;aACvC;QACH,CAAC;KAAA;IAED,gBAAgB,CAAC,KAAY;;QAC3B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE;YACvB,MAAA,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,KAAK,0CAAE,gBAAgB,CAAC,KAAK,CAAC,CAAA;SAChE;IACH,CAAC;CACF;AA/CD,kDA+CC","sourcesContent":["import { AuthService } from './AuthService'\nimport { XHR } from '../../icc-api/api/XHR'\nimport { JwtAuthService } from './JwtAuthService'\nimport { NoAuthService } from './NoAuthService'\nimport { BasicAuthService } from './BasicAuthService'\nimport Header = XHR.Header\n\nexport class EnsembleAuthService implements AuthService {\n private currentState: string | null\n private error: Error | null = null\n private stateMap: { [key: string]: { state: AuthService | null; next: string | null } }\n\n constructor(\n private readonly jwtAuth: JwtAuthService | null,\n private readonly sessionAuth: NoAuthService,\n private readonly basicAuth: BasicAuthService\n ) {\n this.stateMap = {\n start: { state: null, next: 'jwt' },\n jwt: { state: this.jwtAuth, next: 'session' },\n session: { state: this.sessionAuth, next: 'basic' },\n basic: { state: this.basicAuth, next: null },\n }\n this.currentState = 'start'\n }\n\n async getAuthHeaders(): Promise<Array<Header>> {\n this.currentState = !!this.currentState ? this.stateMap[this.currentState].next : this.currentState\n\n if (!!this.currentState) {\n // If I have a state I return the headers, otherwise I return empty headers\n // And delegate the responsibility of handling the error to the next call\n return !!this.stateMap[this.currentState].state\n ? this.stateMap[this.currentState].state!.getAuthHeaders().catch((e) => {\n // If I get an error, it is also responsibility of the next call, but I give a warning\n console.warn(e.message)\n this.error = e\n return []\n })\n : Promise.resolve([])\n } else if (!!this.error) {\n // If I have no more states, I throw the last error or a default one\n throw this.error\n } else {\n throw new Error('Cannot authenticate')\n }\n }\n\n invalidateHeader(error: Error): void {\n this.error = error\n if (!!this.currentState) {\n this.stateMap[this.currentState].state?.invalidateHeader(error)\n }\n }\n}\n"]}
@@ -0,0 +1,19 @@
1
+ import { AuthService } from './AuthService';
2
+ import { XHR } from '../../icc-api/api/XHR';
3
+ import { IccAuthApi } from '../../icc-api';
4
+ import Header = XHR.Header;
5
+ export declare class JwtAuthService implements AuthService {
6
+ private authApi;
7
+ private username;
8
+ private password;
9
+ private _error;
10
+ private _currentPromise;
11
+ constructor(authApi: IccAuthApi, username: string, password: string);
12
+ getAuthHeaders(): Promise<Array<Header>>;
13
+ private _refreshAuthJwt;
14
+ private _loginAndGetTokens;
15
+ private _isJwtExpired;
16
+ private _base64Decode;
17
+ invalidateHeader(error: Error): void;
18
+ isInErrorState(): boolean;
19
+ }