@icure/api 7.1.34 → 7.1.35

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 (148) hide show
  1. package/icc-api/api/IccAuthApi.d.ts +1 -0
  2. package/icc-api/api/IccAuthApi.js +1 -0
  3. package/icc-api/api/IccAuthApi.js.map +1 -1
  4. package/icc-x-api/index.d.ts +22 -29
  5. package/icc-x-api/index.js +60 -38
  6. package/icc-x-api/index.js.map +1 -1
  7. package/package.json +1 -1
  8. package/test/icc-api/api/IccDocumentApi.d.ts +1 -0
  9. package/test/icc-api/api/IccDocumentApi.js +200 -0
  10. package/test/icc-api/api/IccDocumentApi.js.map +1 -0
  11. package/test/icc-api/api/IccGroupApi.d.ts +1 -0
  12. package/test/icc-api/api/IccGroupApi.js +50 -0
  13. package/test/icc-api/api/IccGroupApi.js.map +1 -0
  14. package/test/icc-api/api/IccRoleApi.d.ts +1 -0
  15. package/test/icc-api/api/IccRoleApi.js +34 -0
  16. package/test/icc-api/api/IccRoleApi.js.map +1 -0
  17. package/test/icc-api/api/IccUserApi.d.ts +1 -0
  18. package/test/icc-api/api/IccUserApi.js +80 -0
  19. package/test/icc-api/api/IccUserApi.js.map +1 -0
  20. package/test/icc-api/e2e/IccCalendarItemApi.d.ts +1 -0
  21. package/test/icc-api/e2e/IccCalendarItemApi.js +45 -0
  22. package/test/icc-api/e2e/IccCalendarItemApi.js.map +1 -0
  23. package/test/icc-api/model/modelHelpersTest.d.ts +1 -0
  24. package/test/icc-api/model/modelHelpersTest.js +45 -0
  25. package/test/icc-api/model/modelHelpersTest.js.map +1 -0
  26. package/test/icc-x-api/auth/group-switch-test.d.ts +1 -0
  27. package/test/icc-x-api/auth/group-switch-test.js +81 -0
  28. package/test/icc-x-api/auth/group-switch-test.js.map +1 -0
  29. package/test/icc-x-api/auth/jwt-concurrency-test.d.ts +2 -0
  30. package/test/icc-x-api/auth/jwt-concurrency-test.js +113 -0
  31. package/test/icc-x-api/auth/jwt-concurrency-test.js.map +1 -0
  32. package/test/icc-x-api/auth/smart-auth-provider-test.d.ts +1 -0
  33. package/test/icc-x-api/auth/smart-auth-provider-test.js +222 -0
  34. package/test/icc-x-api/auth/smart-auth-provider-test.js.map +1 -0
  35. package/test/icc-x-api/crypto/KeyManager-test.d.ts +1 -0
  36. package/test/icc-x-api/crypto/KeyManager-test.js +225 -0
  37. package/test/icc-x-api/crypto/KeyManager-test.js.map +1 -0
  38. package/test/icc-x-api/crypto/concurrency.d.ts +1 -0
  39. package/test/icc-x-api/crypto/concurrency.js +35 -0
  40. package/test/icc-x-api/crypto/concurrency.js.map +1 -0
  41. package/test/icc-x-api/crypto/crypto-utils.d.ts +1 -0
  42. package/test/icc-x-api/crypto/crypto-utils.js +80 -0
  43. package/test/icc-x-api/crypto/crypto-utils.js.map +1 -0
  44. package/test/icc-x-api/crypto/cryptoTest.d.ts +2 -0
  45. package/test/icc-x-api/crypto/cryptoTest.js +275 -0
  46. package/test/icc-x-api/crypto/cryptoTest.js.map +1 -0
  47. package/test/icc-x-api/crypto/delegate-ci-to-patient-with-missing-keys-test.d.ts +1 -0
  48. package/test/icc-x-api/crypto/delegate-ci-to-patient-with-missing-keys-test.js +132 -0
  49. package/test/icc-x-api/crypto/delegate-ci-to-patient-with-missing-keys-test.js.map +1 -0
  50. package/test/icc-x-api/crypto/full-crypto-test.d.ts +1 -0
  51. package/test/icc-x-api/crypto/full-crypto-test.js +458 -0
  52. package/test/icc-x-api/crypto/full-crypto-test.js.map +1 -0
  53. package/test/icc-x-api/crypto/shamir.d.ts +2 -0
  54. package/test/icc-x-api/crypto/shamir.js +156 -0
  55. package/test/icc-x-api/crypto/shamir.js.map +1 -0
  56. package/test/icc-x-api/crypto/share-to-newly-created-patient-from-hcp.d.ts +1 -0
  57. package/test/icc-x-api/crypto/share-to-newly-created-patient-from-hcp.js +75 -0
  58. package/test/icc-x-api/crypto/share-to-newly-created-patient-from-hcp.js.map +1 -0
  59. package/test/icc-x-api/data-compatibility-test-7to6.d.ts +1 -0
  60. package/test/icc-x-api/data-compatibility-test-7to6.js +343 -0
  61. package/test/icc-x-api/data-compatibility-test-7to6.js.map +1 -0
  62. package/test/icc-x-api/entity-with-attachments-api-test.d.ts +1 -0
  63. package/test/icc-x-api/entity-with-attachments-api-test.js +142 -0
  64. package/test/icc-x-api/entity-with-attachments-api-test.js.map +1 -0
  65. package/test/icc-x-api/filters/filters.d.ts +1 -0
  66. package/test/icc-x-api/filters/filters.js +49 -0
  67. package/test/icc-x-api/filters/filters.js.map +1 -0
  68. package/test/icc-x-api/icc-accesslog-x-api.d.ts +1 -0
  69. package/test/icc-x-api/icc-accesslog-x-api.js +121 -0
  70. package/test/icc-x-api/icc-accesslog-x-api.js.map +1 -0
  71. package/test/icc-x-api/icc-auth-api.d.ts +1 -0
  72. package/test/icc-x-api/icc-auth-api.js +46 -0
  73. package/test/icc-x-api/icc-auth-api.js.map +1 -0
  74. package/test/icc-x-api/icc-calendar-item-x-api.d.ts +1 -0
  75. package/test/icc-x-api/icc-calendar-item-x-api.js +146 -0
  76. package/test/icc-x-api/icc-calendar-item-x-api.js.map +1 -0
  77. package/test/icc-x-api/icc-contact-x-api.d.ts +1 -0
  78. package/test/icc-x-api/icc-contact-x-api.js +311 -0
  79. package/test/icc-x-api/icc-contact-x-api.js.map +1 -0
  80. package/test/icc-x-api/icc-form-x-api.d.ts +1 -0
  81. package/test/icc-x-api/icc-form-x-api.js +331 -0
  82. package/test/icc-x-api/icc-form-x-api.js.map +1 -0
  83. package/test/icc-x-api/icc-helement-x-api-test.d.ts +1 -0
  84. package/test/icc-x-api/icc-helement-x-api-test.js +158 -0
  85. package/test/icc-x-api/icc-helement-x-api-test.js.map +1 -0
  86. package/test/icc-x-api/icc-invoice-x-api.d.ts +1 -0
  87. package/test/icc-x-api/icc-invoice-x-api.js +115 -0
  88. package/test/icc-x-api/icc-invoice-x-api.js.map +1 -0
  89. package/test/icc-x-api/icc-maintenance-task-x-api-test.d.ts +1 -0
  90. package/test/icc-x-api/icc-maintenance-task-x-api-test.js +230 -0
  91. package/test/icc-x-api/icc-maintenance-task-x-api-test.js.map +1 -0
  92. package/test/icc-x-api/icc-patient-x-api-test.d.ts +1 -0
  93. package/test/icc-x-api/icc-patient-x-api-test.js +169 -0
  94. package/test/icc-x-api/icc-patient-x-api-test.js.map +1 -0
  95. package/test/icc-x-api/icc-time-table-x-api.d.ts +1 -0
  96. package/test/icc-x-api/icc-time-table-x-api.js +110 -0
  97. package/test/icc-x-api/icc-time-table-x-api.js.map +1 -0
  98. package/test/icc-x-api/icc-user-x-api-test.d.ts +1 -0
  99. package/test/icc-x-api/icc-user-x-api-test.js +108 -0
  100. package/test/icc-x-api/icc-user-x-api-test.js.map +1 -0
  101. package/test/icc-x-api/icureapi-group-test.d.ts +1 -0
  102. package/test/icc-x-api/icureapi-group-test.js +130 -0
  103. package/test/icc-x-api/icureapi-group-test.js.map +1 -0
  104. package/test/icc-x-api/patient-user.d.ts +2 -0
  105. package/test/icc-x-api/patient-user.js +117 -0
  106. package/test/icc-x-api/patient-user.js.map +1 -0
  107. package/test/icc-x-api/storage/storage.d.ts +1 -0
  108. package/test/icc-x-api/storage/storage.js +50 -0
  109. package/test/icc-x-api/storage/storage.js.map +1 -0
  110. package/test/icc-x-api/subscription-apis.d.ts +2 -0
  111. package/test/icc-x-api/subscription-apis.js +498 -0
  112. package/test/icc-x-api/subscription-apis.js.map +1 -0
  113. package/test/icc-x-api/test-api-no-parent.d.ts +1 -0
  114. package/test/icc-x-api/test-api-no-parent.js +79 -0
  115. package/test/icc-x-api/test-api-no-parent.js.map +1 -0
  116. package/test/icc-x-api/test-legacy-data-support.d.ts +1 -0
  117. package/test/icc-x-api/test-legacy-data-support.js +231 -0
  118. package/test/icc-x-api/test-legacy-data-support.js.map +1 -0
  119. package/test/icc-x-api/utils/crypto-utils-test.d.ts +1 -0
  120. package/test/icc-x-api/utils/crypto-utils-test.js +586 -0
  121. package/test/icc-x-api/utils/crypto-utils-test.js.map +1 -0
  122. package/test/icc-x-api/utils/graph-test.d.ts +1 -0
  123. package/test/icc-x-api/utils/graph-test.js +54 -0
  124. package/test/icc-x-api/utils/graph-test.js.map +1 -0
  125. package/test/support/CSM-185.d.ts +1 -0
  126. package/test/support/CSM-185.js +120 -0
  127. package/test/support/CSM-185.js.map +1 -0
  128. package/test/support/CSM-87.d.ts +0 -0
  129. package/test/support/CSM-87.js +21 -0
  130. package/test/support/CSM-87.js.map +1 -0
  131. package/test/support/CSM-93.d.ts +1 -0
  132. package/test/support/CSM-93.js +111 -0
  133. package/test/support/CSM-93.js.map +1 -0
  134. package/test/utils/TestApi.d.ts +3 -0
  135. package/test/utils/TestApi.js +27 -0
  136. package/test/utils/TestApi.js.map +1 -0
  137. package/test/utils/TestCollectionUtils.d.ts +1 -0
  138. package/test/utils/TestCollectionUtils.js +109 -0
  139. package/test/utils/TestCollectionUtils.js.map +1 -0
  140. package/test/utils/TestCryptoStrategies.d.ts +37 -0
  141. package/test/utils/TestCryptoStrategies.js +72 -0
  142. package/test/utils/TestCryptoStrategies.js.map +1 -0
  143. package/test/utils/TestStorage.d.ts +31 -0
  144. package/test/utils/TestStorage.js +88 -0
  145. package/test/utils/TestStorage.js.map +1 -0
  146. package/test/utils/test_utils.d.ts +60 -0
  147. package/test/utils/test_utils.js +313 -0
  148. package/test/utils/test_utils.js.map +1 -0
@@ -14,6 +14,7 @@ import { AuthenticationResponse } from '../model/AuthenticationResponse';
14
14
  import { LoginCredentials } from '../model/LoginCredentials';
15
15
  import { AuthenticationProvider } from '../../icc-x-api/auth/AuthenticationProvider';
16
16
  export declare enum OAuthThirdParty {
17
+ BE_FAS = "be.fas",
17
18
  GOOGLE = "google",
18
19
  MICROSOFT = "microsoft",
19
20
  APPLE = "apple",
@@ -18,6 +18,7 @@ const AuthenticationProvider_1 = require("../../icc-x-api/auth/AuthenticationPro
18
18
  const IccRestApiPath_1 = require("./IccRestApiPath");
19
19
  var OAuthThirdParty;
20
20
  (function (OAuthThirdParty) {
21
+ OAuthThirdParty["BE_FAS"] = "be.fas";
21
22
  OAuthThirdParty["GOOGLE"] = "google";
22
23
  OAuthThirdParty["MICROSOFT"] = "microsoft";
23
24
  OAuthThirdParty["APPLE"] = "apple";
@@ -1 +1 @@
1
- {"version":3,"file":"IccAuthApi.js","sourceRoot":"","sources":["../../../icc-api/api/IccAuthApi.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;GAUG;AACH,+BAA2B;AAC3B,4EAAwE;AAExE,wFAA8G;AAC9G,qDAAiD;AAEjD,IAAY,eAMX;AAND,WAAY,eAAe;IACzB,oCAAiB,CAAA;IACjB,0CAAuB,CAAA;IACvB,kCAAe,CAAA;IACf,wCAAqB,CAAA;IACrB,oCAAiB,CAAA;AACnB,CAAC,EANW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAM1B;AAED,MAAa,UAAU;IAMrB,YACE,IAAY,EACZ,OAAY,EACZ,sBAA+C,EAC/C,SAAyE;QAEzE,IAAI,CAAC,IAAI,GAAG,IAAA,+BAAc,EAAC,IAAI,CAAC,CAAA;QAChC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,SAAG,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QAC7E,IAAI,CAAC,sBAAsB,GAAG,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,IAAI,iDAAwB,EAAE,CAAA;QAChH,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAC5B,CAAC;IAED,UAAU,CAAC,CAAoB;QAC7B,IAAI,CAAC,OAAO,GAAG,CAAC,CAAA;IAClB,CAAC;IAED,WAAW,CAAC,CAAe;QACzB,MAAM,CAAC,CAAA;IACT,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,IAAuB;QAC3B,I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D,gCAuOC","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 { XHR } from './XHR'\nimport { AuthenticationResponse } from '../model/AuthenticationResponse'\nimport { LoginCredentials } from '../model/LoginCredentials'\nimport { AuthenticationProvider, NoAuthenticationProvider } from '../../icc-x-api/auth/AuthenticationProvider'\nimport { iccRestApiPath } from './IccRestApiPath'\n\nexport enum OAuthThirdParty {\n GOOGLE = 'google',\n MICROSOFT = 'microsoft',\n APPLE = 'apple',\n LINKEDIN = 'linkedin',\n GITHUB = 'github',\n}\n\nexport class IccAuthApi {\n host: string\n headers: Array<XHR.Header>\n authenticationProvider: AuthenticationProvider\n fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>\n\n constructor(\n host: string,\n headers: any,\n authenticationProvider?: AuthenticationProvider,\n fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>\n ) {\n this.host = iccRestApiPath(host)\n this.headers = Object.keys(headers).map((k) => new XHR.Header(k, headers[k]))\n this.authenticationProvider = !!authenticationProvider ? authenticationProvider : new NoAuthenticationProvider()\n this.fetchImpl = fetchImpl\n }\n\n setHeaders(h: Array<XHR.Header>) {\n this.headers = h\n }\n\n handleError(e: XHR.XHRError): never {\n throw e\n }\n\n /**\n * Check login using groupId/userId and password\n * @summary check\n * @param body\n */\n check(body?: LoginCredentials): Promise<AuthenticationResponse> {\n let _body = null\n _body = body\n\n const _url = this.host + `/auth/check` + '?ts=' + new Date().getTime()\n let headers = this.headers\n headers = headers\n .filter((h) => h.header !== 'Content-Type' && h.header?.toLowerCase() !== 'authorization')\n .concat(new XHR.Header('Content-Type', 'application/json'))\n return XHR.sendCommand('POST', _url, headers, _body, this.fetchImpl)\n .then((doc) => new AuthenticationResponse(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Login using username and password\n * @summary login\n * @param body\n * @param groupId the group id where to login to.\n * @param duration the duration of the returned JWT authentication token, in seconds.\n */\n login(body?: LoginCredentials, groupId?: string, duration?: number): Promise<AuthenticationResponse> {\n let _body = null\n _body = body\n\n const _url = this.host + `/auth/login` + '?ts=' + new Date().getTime() + (groupId ? `&groupId=${encodeURIComponent(String(groupId))}` : '') + (!!duration ? `&duration=${duration}` : '')\n let headers = this.headers\n headers = headers\n .filter((h) => h.header !== 'Content-Type' && h.header?.toLowerCase() !== 'authorization')\n .concat(new XHR.Header('Content-Type', 'application/json'))\n return XHR.sendCommand('POST', _url, headers, _body, this.fetchImpl, undefined)\n .then((doc) => new AuthenticationResponse(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Login using third party OAuth provider token\n * @summary login\n * @param thirdParty The third party OAuth service used to authenticate the user\n * @param token The token returned by the third party OAuth service\n */\n loginWithThirdPartyToken(thirdParty: string, token: string): Promise<AuthenticationResponse> {\n let _body = null\n _body = token\n\n const _url = this.host + `/auth/login/${thirdParty}` + '?ts=' + new Date().getTime()\n let headers = this.headers\n headers = headers\n .filter((h) => h.header !== 'Content-Type' && h.header?.toLowerCase() !== 'authorization')\n .concat(new XHR.Header('Content-Type', 'application/json'))\n .concat(new XHR.Header('token', token))\n return XHR.sendCommand('POST', _url, headers, null, this.fetchImpl, undefined)\n .then((doc) => new AuthenticationResponse(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Logout\n * @summary logout\n */\n logout(): Promise<AuthenticationResponse> {\n let _body = null\n\n const _url = this.host + `/auth/logout` + '?ts=' + new Date().getTime()\n let headers = this.headers\n return XHR.sendCommand(\n 'GET',\n _url,\n headers.filter((h) => h.header?.toLowerCase() !== 'authorization'),\n _body,\n this.fetchImpl,\n undefined,\n this.authenticationProvider.getAuthService()\n )\n .then((doc) => new AuthenticationResponse(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Logout\n * @summary logout\n */\n logoutPost(): Promise<AuthenticationResponse> {\n let _body = null\n\n const _url = this.host + `/auth/logout` + '?ts=' + new Date().getTime()\n let headers = this.headers\n return XHR.sendCommand(\n 'POST',\n _url,\n headers.filter((h) => h.header?.toLowerCase() !== 'authorization'),\n _body,\n this.fetchImpl,\n undefined,\n this.authenticationProvider.getAuthService()\n )\n .then((doc) => new AuthenticationResponse(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Get token for subsequent operation\n * @summary token\n * @param method\n * @param path\n */\n token(method: string, path: string): Promise<string> {\n let _body = null\n\n const _url = this.host + `/auth/token/${encodeURIComponent(String(method))}/${encodeURIComponent(String(path))}` + '?ts=' + new Date().getTime()\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => JSON.parse(JSON.stringify(doc.body)) as string)\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Gets a new authentication and refresh JWT for a different group\n */\n switchGroup(refreshJWT: string, groupId: string): Promise<AuthenticationResponse> {\n let _body = null\n\n const _url = this.host + `/auth/switch/${encodeURIComponent(String(groupId))}` + '?ts=' + new Date().getTime()\n let headers = [...this.headers, new XHR.Header('Refresh-Token', refreshJWT)]\n return XHR.sendCommand(\n 'POST',\n _url,\n headers.filter((h) => h.header?.toLowerCase() !== 'authorization'),\n _body,\n this.fetchImpl\n )\n .then((doc) => new AuthenticationResponse(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Gets a new authentication JWT using the refresh JWT\n * @summary refresh\n */\n refreshAuthenticationJWT(refreshJWT: string): Promise<AuthenticationResponse> {\n let _body = null\n\n const _url = this.host + `/auth/refresh` + '?ts=' + new Date().getTime()\n let headers = [...this.headers, new XHR.Header('Refresh-Token', refreshJWT)]\n return XHR.sendCommand(\n 'POST',\n _url,\n headers.filter((h) => h.header?.toLowerCase() !== 'authorization'),\n _body,\n this.fetchImpl\n )\n .then((doc) => new AuthenticationResponse(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Switch groups using the refresh JWT\n * @summary switch groups\n */\n switchGroupUsingRefreshJWT(groupId: string): Promise<AuthenticationResponse> {\n return this.authenticationProvider.getIcureTokens().then((tokens) => {\n let _body = null\n const _url = this.host + `/auth/switch/${encodeURIComponent(String(groupId))}` + '?ts=' + new Date().getTime()\n\n const refreshToken = tokens?.refreshToken\n if (!refreshToken) {\n throw new Error('No refresh token found')\n }\n let headers = [...this.headers, new XHR.Header('Refresh-Token', refreshToken)]\n return XHR.sendCommand(\n 'POST',\n _url,\n headers.filter((h) => h.header?.toLowerCase() !== 'authorization'),\n _body,\n this.fetchImpl\n )\n .then((doc) => new AuthenticationResponse(doc.body as JSON))\n .catch((err) => this.handleError(err))\n })\n }\n\n /**\n * Invalidates a refresh JWT\n * @summary invalidate\n */\n invalidateRefreshJWT(refreshJWT: string): Promise<AuthenticationResponse> {\n let _body = null\n\n const _url = this.host + `/auth/invalidate` + '?ts=' + new Date().getTime()\n let headers = [...this.headers, new XHR.Header('Refresh-Token', refreshJWT)]\n return XHR.sendCommand(\n 'POST',\n _url,\n headers.filter((h) => h.header?.toLowerCase() !== 'authorization'),\n _body,\n this.fetchImpl\n )\n .then((doc) => new AuthenticationResponse(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n}\n"]}
1
+ {"version":3,"file":"IccAuthApi.js","sourceRoot":"","sources":["../../../icc-api/api/IccAuthApi.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;GAUG;AACH,+BAA2B;AAC3B,4EAAwE;AAExE,wFAA8G;AAC9G,qDAAiD;AAEjD,IAAY,eAOX;AAPD,WAAY,eAAe;IACzB,oCAAiB,CAAA;IACjB,oCAAiB,CAAA;IACjB,0CAAuB,CAAA;IACvB,kCAAe,CAAA;IACf,wCAAqB,CAAA;IACrB,oCAAiB,CAAA;AACnB,CAAC,EAPW,eAAe,GAAf,uBAAe,KAAf,uBA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AG,IAAI,CAAA;QAEhB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,kBAAkB,GAAG,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAA;QAC3E,IAAI,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,IAAI,SAAG,CAAC,MAAM,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC,CAAA;QAC5E,OAAO,SAAG,CAAC,WAAW,CACpB,MAAM,EACN,IAAI,EACJ,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,WAAC,OAAA,CAAA,MAAA,CAAC,CAAC,MAAM,0CAAE,WAAW,EAAE,MAAK,eAAe,CAAA,EAAA,CAAC,EAClE,KAAK,EACL,IAAI,CAAC,SAAS,CACf;aACE,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,+CAAsB,CAAC,GAAG,CAAC,IAAY,CAAC,CAAC;aAC3D,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;IAC1C,CAAC;CACF;AAvOD,gCAuOC","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 { XHR } from './XHR'\nimport { AuthenticationResponse } from '../model/AuthenticationResponse'\nimport { LoginCredentials } from '../model/LoginCredentials'\nimport { AuthenticationProvider, NoAuthenticationProvider } from '../../icc-x-api/auth/AuthenticationProvider'\nimport { iccRestApiPath } from './IccRestApiPath'\n\nexport enum OAuthThirdParty {\n BE_FAS = 'be.fas',\n GOOGLE = 'google',\n MICROSOFT = 'microsoft',\n APPLE = 'apple',\n LINKEDIN = 'linkedin',\n GITHUB = 'github',\n}\n\nexport class IccAuthApi {\n host: string\n headers: Array<XHR.Header>\n authenticationProvider: AuthenticationProvider\n fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>\n\n constructor(\n host: string,\n headers: any,\n authenticationProvider?: AuthenticationProvider,\n fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>\n ) {\n this.host = iccRestApiPath(host)\n this.headers = Object.keys(headers).map((k) => new XHR.Header(k, headers[k]))\n this.authenticationProvider = !!authenticationProvider ? authenticationProvider : new NoAuthenticationProvider()\n this.fetchImpl = fetchImpl\n }\n\n setHeaders(h: Array<XHR.Header>) {\n this.headers = h\n }\n\n handleError(e: XHR.XHRError): never {\n throw e\n }\n\n /**\n * Check login using groupId/userId and password\n * @summary check\n * @param body\n */\n check(body?: LoginCredentials): Promise<AuthenticationResponse> {\n let _body = null\n _body = body\n\n const _url = this.host + `/auth/check` + '?ts=' + new Date().getTime()\n let headers = this.headers\n headers = headers\n .filter((h) => h.header !== 'Content-Type' && h.header?.toLowerCase() !== 'authorization')\n .concat(new XHR.Header('Content-Type', 'application/json'))\n return XHR.sendCommand('POST', _url, headers, _body, this.fetchImpl)\n .then((doc) => new AuthenticationResponse(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Login using username and password\n * @summary login\n * @param body\n * @param groupId the group id where to login to.\n * @param duration the duration of the returned JWT authentication token, in seconds.\n */\n login(body?: LoginCredentials, groupId?: string, duration?: number): Promise<AuthenticationResponse> {\n let _body = null\n _body = body\n\n const _url = this.host + `/auth/login` + '?ts=' + new Date().getTime() + (groupId ? `&groupId=${encodeURIComponent(String(groupId))}` : '') + (!!duration ? `&duration=${duration}` : '')\n let headers = this.headers\n headers = headers\n .filter((h) => h.header !== 'Content-Type' && h.header?.toLowerCase() !== 'authorization')\n .concat(new XHR.Header('Content-Type', 'application/json'))\n return XHR.sendCommand('POST', _url, headers, _body, this.fetchImpl, undefined)\n .then((doc) => new AuthenticationResponse(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Login using third party OAuth provider token\n * @summary login\n * @param thirdParty The third party OAuth service used to authenticate the user\n * @param token The token returned by the third party OAuth service\n */\n loginWithThirdPartyToken(thirdParty: string, token: string): Promise<AuthenticationResponse> {\n let _body = null\n _body = token\n\n const _url = this.host + `/auth/login/${thirdParty}` + '?ts=' + new Date().getTime()\n let headers = this.headers\n headers = headers\n .filter((h) => h.header !== 'Content-Type' && h.header?.toLowerCase() !== 'authorization')\n .concat(new XHR.Header('Content-Type', 'application/json'))\n .concat(new XHR.Header('token', token))\n return XHR.sendCommand('POST', _url, headers, null, this.fetchImpl, undefined)\n .then((doc) => new AuthenticationResponse(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Logout\n * @summary logout\n */\n logout(): Promise<AuthenticationResponse> {\n let _body = null\n\n const _url = this.host + `/auth/logout` + '?ts=' + new Date().getTime()\n let headers = this.headers\n return XHR.sendCommand(\n 'GET',\n _url,\n headers.filter((h) => h.header?.toLowerCase() !== 'authorization'),\n _body,\n this.fetchImpl,\n undefined,\n this.authenticationProvider.getAuthService()\n )\n .then((doc) => new AuthenticationResponse(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Logout\n * @summary logout\n */\n logoutPost(): Promise<AuthenticationResponse> {\n let _body = null\n\n const _url = this.host + `/auth/logout` + '?ts=' + new Date().getTime()\n let headers = this.headers\n return XHR.sendCommand(\n 'POST',\n _url,\n headers.filter((h) => h.header?.toLowerCase() !== 'authorization'),\n _body,\n this.fetchImpl,\n undefined,\n this.authenticationProvider.getAuthService()\n )\n .then((doc) => new AuthenticationResponse(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Get token for subsequent operation\n * @summary token\n * @param method\n * @param path\n */\n token(method: string, path: string): Promise<string> {\n let _body = null\n\n const _url = this.host + `/auth/token/${encodeURIComponent(String(method))}/${encodeURIComponent(String(path))}` + '?ts=' + new Date().getTime()\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => JSON.parse(JSON.stringify(doc.body)) as string)\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Gets a new authentication and refresh JWT for a different group\n */\n switchGroup(refreshJWT: string, groupId: string): Promise<AuthenticationResponse> {\n let _body = null\n\n const _url = this.host + `/auth/switch/${encodeURIComponent(String(groupId))}` + '?ts=' + new Date().getTime()\n let headers = [...this.headers, new XHR.Header('Refresh-Token', refreshJWT)]\n return XHR.sendCommand(\n 'POST',\n _url,\n headers.filter((h) => h.header?.toLowerCase() !== 'authorization'),\n _body,\n this.fetchImpl\n )\n .then((doc) => new AuthenticationResponse(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Gets a new authentication JWT using the refresh JWT\n * @summary refresh\n */\n refreshAuthenticationJWT(refreshJWT: string): Promise<AuthenticationResponse> {\n let _body = null\n\n const _url = this.host + `/auth/refresh` + '?ts=' + new Date().getTime()\n let headers = [...this.headers, new XHR.Header('Refresh-Token', refreshJWT)]\n return XHR.sendCommand(\n 'POST',\n _url,\n headers.filter((h) => h.header?.toLowerCase() !== 'authorization'),\n _body,\n this.fetchImpl\n )\n .then((doc) => new AuthenticationResponse(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Switch groups using the refresh JWT\n * @summary switch groups\n */\n switchGroupUsingRefreshJWT(groupId: string): Promise<AuthenticationResponse> {\n return this.authenticationProvider.getIcureTokens().then((tokens) => {\n let _body = null\n const _url = this.host + `/auth/switch/${encodeURIComponent(String(groupId))}` + '?ts=' + new Date().getTime()\n\n const refreshToken = tokens?.refreshToken\n if (!refreshToken) {\n throw new Error('No refresh token found')\n }\n let headers = [...this.headers, new XHR.Header('Refresh-Token', refreshToken)]\n return XHR.sendCommand(\n 'POST',\n _url,\n headers.filter((h) => h.header?.toLowerCase() !== 'authorization'),\n _body,\n this.fetchImpl\n )\n .then((doc) => new AuthenticationResponse(doc.body as JSON))\n .catch((err) => this.handleError(err))\n })\n }\n\n /**\n * Invalidates a refresh JWT\n * @summary invalidate\n */\n invalidateRefreshJWT(refreshJWT: string): Promise<AuthenticationResponse> {\n let _body = null\n\n const _url = this.host + `/auth/invalidate` + '?ts=' + new Date().getTime()\n let headers = [...this.headers, new XHR.Header('Refresh-Token', refreshJWT)]\n return XHR.sendCommand(\n 'POST',\n _url,\n headers.filter((h) => h.header?.toLowerCase() !== 'authorization'),\n _body,\n this.fetchImpl\n )\n .then((doc) => new AuthenticationResponse(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n}\n"]}
@@ -401,26 +401,6 @@ export interface IcureApi extends Apis {
401
401
  */
402
402
  switchGroup(newGroupId: string): Promise<IcureApi>;
403
403
  }
404
- /**
405
- * Main entry point for the iCure API. Provides entity-specific sub-apis and some general methods which are not related to a specific entity.
406
- */
407
- export interface IcureApi extends Apis {
408
- /**
409
- * Get the information on groups that the current user can access and the current group that this api instance is working on.
410
- * Note that the values you will get for `availableGroups` may differ from the values you would get if you call {@link IccUserApi.getMatchingUsers}
411
- * on {@link Apis.userApi}, since the latter is specialised on the specific instance of the user in `currentGroup`.
412
- */
413
- getGroupsInfo(): Promise<{
414
- currentGroup: UserGroup | undefined;
415
- availableGroups: UserGroup[];
416
- }>;
417
- /**
418
- * Switches the api to allow the user to work on a different group.
419
- * @param newGroupId the id of the group to switch to.
420
- * @return a new api for the specified group.
421
- */
422
- switchGroup(newGroupId: string): Promise<IcureApi>;
423
- }
424
404
  export declare namespace IcureApi {
425
405
  /**
426
406
  * Initialises a new instance of the iCure API.
@@ -447,13 +427,26 @@ export interface IcureBasicApi extends BasicApis {
447
427
  */
448
428
  switchGroup(newGroupId: string): Promise<IcureBasicApi>;
449
429
  }
450
- /**
451
- * @experimental This function still needs development and will be changed
452
- * Build apis which do not need crypto and can be used by non-data-owner users
453
- */
454
- export declare const BasicApis: (host: string, authenticationOptions: AuthenticationDetails | AuthenticationProvider, crypto?: Crypto, fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>, options?: {
455
- headers?: {
430
+ export interface IcureBasicApiOptions {
431
+ /**
432
+ * Additional headers to use on each request made by the iCure api.
433
+ * @default no additional headers
434
+ */
435
+ readonly headers?: {
456
436
  [headerName: string]: string;
457
- } | undefined;
458
- groupSelector?: ((availableGroupsInfo: UserGroup[]) => Promise<string>) | undefined;
459
- }) => Promise<IcureBasicApi>;
437
+ };
438
+ /**
439
+ * Each user may exist in multiple groups, but an instance of {@link IcureApi} is specialised for a single group. This function allows you to decide
440
+ * the group to use for a given user. This functions will be called only if a user exists in at least 2 groups, takes in input the information on
441
+ * the groups the user can access (in no specific order) and must return the id of one of these groups.
442
+ * @default takes the first group provided. The group chosen by this method may vary between different instantiations of the {@link IcureApi} even
443
+ * if for the same user and if the groups available for the user do not change.
444
+ */
445
+ readonly groupSelector?: (availableGroupsInfo: UserGroup[]) => Promise<string>;
446
+ }
447
+ export declare namespace IcureBasicApi {
448
+ /**
449
+ * Initialises a new instance of the iCure API.
450
+ */
451
+ function initialise(host: string, authenticationOptions: AuthenticationDetails | AuthenticationProvider, fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>, options?: IcureBasicApiOptions): Promise<IcureBasicApi>;
452
+ }
@@ -23,7 +23,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
23
23
  });
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.BasicApis = exports.IcureApi = exports.EncryptedFieldsConfig = exports.AuthSecretType = exports.KeyStorageImpl = exports.LocalStorageImpl = void 0;
26
+ exports.IcureBasicApi = exports.IcureApi = exports.EncryptedFieldsConfig = exports.AuthSecretType = exports.KeyStorageImpl = exports.LocalStorageImpl = void 0;
27
27
  const icc_api_1 = require("../icc-api");
28
28
  const icc_user_x_api_1 = require("./icc-user-x-api");
29
29
  const icc_crypto_x_api_1 = require("./icc-crypto-x-api");
@@ -458,43 +458,43 @@ class IcureApiImpl {
458
458
  class IcureBasicApiImpl {
459
459
  get agendaApi() {
460
460
  var _a;
461
- return (_a = this._agendaApi) !== null && _a !== void 0 ? _a : (this._agendaApi = new icc_api_1.IccAgendaApi(this.host, this.headers, this.groupSpecificAuthenticationProvider, this.fetch));
461
+ return (_a = this._agendaApi) !== null && _a !== void 0 ? _a : (this._agendaApi = new icc_api_1.IccAgendaApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch));
462
462
  }
463
463
  get authApi() {
464
464
  var _a;
465
- return (_a = this._authApi) !== null && _a !== void 0 ? _a : (this._authApi = new icc_api_1.IccAuthApi(this.host, this.headers, this.groupSpecificAuthenticationProvider, this.fetch));
465
+ return (_a = this._authApi) !== null && _a !== void 0 ? _a : (this._authApi = new icc_api_1.IccAuthApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch));
466
466
  }
467
467
  get codeApi() {
468
468
  var _a;
469
- return (_a = this._codeApi) !== null && _a !== void 0 ? _a : (this._codeApi = new icc_code_x_api_1.IccCodeXApi(this.host, this.headers, this.groupSpecificAuthenticationProvider, this.fetch));
469
+ return (_a = this._codeApi) !== null && _a !== void 0 ? _a : (this._codeApi = new icc_code_x_api_1.IccCodeXApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch));
470
470
  }
471
471
  get deviceApi() {
472
472
  var _a;
473
- return ((_a = this._deviceApi) !== null && _a !== void 0 ? _a : (this._deviceApi = new icc_device_x_api_1.IccDeviceXApi(this.host, this.headers, this.groupSpecificAuthenticationProvider, this.userApi, this.authApi, this.fetch)));
473
+ return ((_a = this._deviceApi) !== null && _a !== void 0 ? _a : (this._deviceApi = new icc_device_x_api_1.IccDeviceXApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.userApi, this.authApi, this.fetch)));
474
474
  }
475
475
  get entityReferenceApi() {
476
476
  var _a;
477
- return ((_a = this._entityReferenceApi) !== null && _a !== void 0 ? _a : (this._entityReferenceApi = new icc_api_1.IccEntityrefApi(this.host, this.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
477
+ return ((_a = this._entityReferenceApi) !== null && _a !== void 0 ? _a : (this._entityReferenceApi = new icc_api_1.IccEntityrefApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
478
478
  }
479
479
  get groupApi() {
480
480
  var _a;
481
- return (_a = this._groupApi) !== null && _a !== void 0 ? _a : (this._groupApi = new icc_api_1.IccGroupApi(this.host, this.headers, this.groupSpecificAuthenticationProvider, this.fetch));
481
+ return (_a = this._groupApi) !== null && _a !== void 0 ? _a : (this._groupApi = new icc_api_1.IccGroupApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch));
482
482
  }
483
483
  get healthcarePartyApi() {
484
484
  var _a;
485
- return ((_a = this._healthcarePartyApi) !== null && _a !== void 0 ? _a : (this._healthcarePartyApi = new icc_hcparty_x_api_1.IccHcpartyXApi(this.host, this.headers, this.groupSpecificAuthenticationProvider, this.authApi, this.fetch)));
485
+ return ((_a = this._healthcarePartyApi) !== null && _a !== void 0 ? _a : (this._healthcarePartyApi = new icc_hcparty_x_api_1.IccHcpartyXApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.authApi, this.fetch)));
486
486
  }
487
487
  get insuranceApi() {
488
488
  var _a;
489
- return ((_a = this._insuranceApi) !== null && _a !== void 0 ? _a : (this._insuranceApi = new icc_api_1.IccInsuranceApi(this.host, this.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
489
+ return ((_a = this._insuranceApi) !== null && _a !== void 0 ? _a : (this._insuranceApi = new icc_api_1.IccInsuranceApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
490
490
  }
491
491
  get permissionApi() {
492
492
  var _a;
493
- return ((_a = this._permissionApi) !== null && _a !== void 0 ? _a : (this._permissionApi = new icc_api_1.IccPermissionApi(this.host, this.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
493
+ return ((_a = this._permissionApi) !== null && _a !== void 0 ? _a : (this._permissionApi = new icc_api_1.IccPermissionApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
494
494
  }
495
495
  get userApi() {
496
496
  var _a;
497
- return ((_a = this._userApi) !== null && _a !== void 0 ? _a : (this._userApi = new icc_user_x_api_1.IccUserXApi(this.host, this.headers, this.groupSpecificAuthenticationProvider, this.authApi, this.fetch)));
497
+ return ((_a = this._userApi) !== null && _a !== void 0 ? _a : (this._userApi = new icc_user_x_api_1.IccUserXApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.authApi, this.fetch)));
498
498
  }
499
499
  getGroupsInfo() {
500
500
  return __awaiter(this, void 0, void 0, function* () {
@@ -506,11 +506,11 @@ class IcureBasicApiImpl {
506
506
  }
507
507
  get patientApi() {
508
508
  var _a;
509
- return (_a = this._patientApi) !== null && _a !== void 0 ? _a : (this._patientApi = new icc_api_1.IccPatientApi(this.host, this.headers, this.groupSpecificAuthenticationProvider, this.fetch));
509
+ return (_a = this._patientApi) !== null && _a !== void 0 ? _a : (this._patientApi = new icc_api_1.IccPatientApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch));
510
510
  }
511
511
  get roleApi() {
512
512
  var _a;
513
- return (_a = this._roleApi) !== null && _a !== void 0 ? _a : (this._roleApi = new IccRoleApi_1.IccRoleApi(this.host, this.headers, this.groupSpecificAuthenticationProvider, this.fetch));
513
+ return (_a = this._roleApi) !== null && _a !== void 0 ? _a : (this._roleApi = new IccRoleApi_1.IccRoleApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch));
514
514
  }
515
515
  switchGroup(newGroupId) {
516
516
  var _a;
@@ -519,41 +519,63 @@ class IcureBasicApiImpl {
519
519
  throw new Error('Cannot switch group: the backend environment does not support multiple groups.');
520
520
  const availableGroups = yield this.latestGroupsRequest;
521
521
  const switchedProviderInfo = yield this.groupSpecificAuthenticationProvider.switchGroup(newGroupId, availableGroups);
522
- return new IcureBasicApiImpl(this.host, switchedProviderInfo.switchedProvider, this.fetch, (_a = this.grouplessUserApi) !== null && _a !== void 0 ? _a : (switchedProviderInfo.isGroupLocked ? this.userApi : undefined), availableGroups, availableGroups.find((x) => x.groupId === newGroupId), this.headers);
522
+ return new IcureBasicApiImpl(this.host, switchedProviderInfo.switchedProvider, this.fetch, (_a = this.grouplessUserApi) !== null && _a !== void 0 ? _a : (switchedProviderInfo.isGroupLocked ? this.userApi : undefined), availableGroups, availableGroups.find((x) => x.groupId === newGroupId), this.params);
523
523
  });
524
524
  }
525
- constructor(host, groupSpecificAuthenticationProvider, fetch, grouplessUserApi, latestMatches, currentGroupInfo, headers) {
525
+ constructor(host, groupSpecificAuthenticationProvider, fetch, grouplessUserApi, latestMatches, currentGroupInfo, params) {
526
526
  this.host = host;
527
527
  this.groupSpecificAuthenticationProvider = groupSpecificAuthenticationProvider;
528
528
  this.fetch = fetch;
529
529
  this.grouplessUserApi = grouplessUserApi;
530
530
  this.currentGroupInfo = currentGroupInfo;
531
- this.headers = headers;
531
+ this.params = params;
532
532
  this.latestGroupsRequest = Promise.resolve(latestMatches);
533
533
  }
534
534
  }
535
- /**
536
- * @experimental This function still needs development and will be changed
537
- * Build apis which do not need crypto and can be used by non-data-owner users
538
- */
539
- const BasicApis = function (host, authenticationOptions, crypto = typeof window !== 'undefined' ? window.crypto : typeof self !== 'undefined' ? self.crypto : {}, fetchImpl = typeof window !== 'undefined'
540
- ? window.fetch
541
- : typeof self !== 'undefined'
542
- ? self.fetch
543
- : fetch, options = {}) {
544
- var _a, _b, _c;
545
- return __awaiter(this, void 0, void 0, function* () {
546
- const grouplessAuthenticationProvider = yield getAuthenticationProvider(host, authenticationOptions, (_a = options.headers) !== null && _a !== void 0 ? _a : {}, fetchImpl);
547
- const grouplessUserApi = new icc_api_1.IccUserApi(host, options.headers, grouplessAuthenticationProvider, fetchImpl);
548
- const matches = yield getMatchesOrEmpty(grouplessUserApi);
549
- const chosenGroupId = matches.length > 1 && !!options.groupSelector ? yield options.groupSelector(matches) : (_b = matches[0]) === null || _b === void 0 ? void 0 : _b.groupId;
550
- const groupSpecificAuthenticationProviderInfo = matches.length > 1 && chosenGroupId
551
- ? yield grouplessAuthenticationProvider.switchGroup(chosenGroupId, matches)
552
- : { switchedProvider: grouplessAuthenticationProvider, isGroupLocked: false };
553
- return new IcureBasicApiImpl(host, grouplessAuthenticationProvider, fetch, groupSpecificAuthenticationProviderInfo.isGroupLocked ? grouplessUserApi : undefined, matches, matches.find((match) => match.groupId === chosenGroupId), (_c = options.headers) !== null && _c !== void 0 ? _c : {});
554
- });
555
- };
556
- exports.BasicApis = BasicApis;
535
+ var IcureBasicApiOptions;
536
+ (function (IcureBasicApiOptions) {
537
+ let Defaults;
538
+ (function (Defaults) {
539
+ Defaults.headers = {};
540
+ })(Defaults = IcureBasicApiOptions.Defaults || (IcureBasicApiOptions.Defaults = {}));
541
+ class WithDefaults {
542
+ constructor(custom) {
543
+ var _a, _b;
544
+ this.headers = (_a = custom.headers) !== null && _a !== void 0 ? _a : Defaults.headers;
545
+ this.groupSelector = (_b = custom.groupSelector) !== null && _b !== void 0 ? _b : ((groups) => Promise.resolve(groups[0].groupId));
546
+ }
547
+ }
548
+ IcureBasicApiOptions.WithDefaults = WithDefaults;
549
+ })(IcureBasicApiOptions || (IcureBasicApiOptions = {}));
550
+ var IcureBasicApi;
551
+ (function (IcureBasicApi) {
552
+ /**
553
+ * Initialises a new instance of the iCure API.
554
+ */
555
+ function initialise(host, authenticationOptions, fetchImpl = typeof window !== 'undefined'
556
+ ? window.fetch
557
+ : typeof self !== 'undefined'
558
+ ? self.fetch
559
+ : fetch, options = {}) {
560
+ var _a, _b;
561
+ return __awaiter(this, void 0, void 0, function* () {
562
+ const params = new IcureBasicApiOptions.WithDefaults(options);
563
+ const grouplessAuthenticationProvider = yield getAuthenticationProvider(host, authenticationOptions, (_a = params.headers) !== null && _a !== void 0 ? _a : {}, fetchImpl);
564
+ const grouplessUserApi = new icc_api_1.IccUserApi(host, params.headers, grouplessAuthenticationProvider, fetchImpl);
565
+ const matches = yield getMatchesOrEmpty(grouplessUserApi);
566
+ const chosenGroupId = matches.length > 1 ? yield params.groupSelector(matches) : (_b = matches[0]) === null || _b === void 0 ? void 0 : _b.groupId;
567
+ /*TODO
568
+ * On new very new users switching the authentication provider to a specific group may fail and block the user for too many requests. This is
569
+ * probably linked to replication of the user in the fallback database.
570
+ */
571
+ const groupSpecificAuthenticationProviderInfo = matches.length > 1 && chosenGroupId
572
+ ? yield grouplessAuthenticationProvider.switchGroup(chosenGroupId, matches)
573
+ : { switchedProvider: grouplessAuthenticationProvider, isGroupLocked: false };
574
+ return new IcureBasicApiImpl(host, groupSpecificAuthenticationProviderInfo.switchedProvider, fetch, groupSpecificAuthenticationProviderInfo.isGroupLocked ? grouplessUserApi : undefined, matches, matches.find((match) => match.groupId === chosenGroupId), params);
575
+ });
576
+ }
577
+ IcureBasicApi.initialise = initialise;
578
+ })(IcureBasicApi = exports.IcureBasicApi || (exports.IcureBasicApi = {}));
557
579
  function getMatchesOrEmpty(userApi) {
558
580
  return __awaiter(this, void 0, void 0, function* () {
559
581
  try {