oro-sdk 3.16.0 → 3.19.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.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.16.0",
2
+ "version": "3.19.0",
3
3
  "main": "dist/index.js",
4
4
  "typings": "dist/index.d.ts",
5
5
  "files": [
@@ -54,7 +54,7 @@
54
54
  "form-data": "^4.0.0",
55
55
  "formdata-node": "^4.3.1",
56
56
  "idb-keyval": "^5.0.6",
57
- "oro-sdk-apis": "1.50.0",
57
+ "oro-sdk-apis": "1.52.0",
58
58
  "oro-toolbox": "0.0.6",
59
59
  "uuid": "^8.3.2"
60
60
  }
package/src/client.ts CHANGED
@@ -702,6 +702,8 @@ export class OroClient {
702
702
 
703
703
  // We're using the account role to determine the way a grant is accessed
704
704
  let currentAccountRole = await this.getAccountRole()
705
+ if (currentAccountRole.length === 1 && currentAccountRole[0] === OtherRoleType.User)
706
+ return []
705
707
 
706
708
  if ([OtherRoleType.Patient, OtherRoleType.User].every(requiredRole => currentAccountRole.includes(requiredRole))) {
707
709
  let encryptedGrants
@@ -269,13 +269,19 @@ async function getOrCreatePatientLockbox(oroClient: OroClient): Promise<Uuid> {
269
269
  if (grants.length > 0) {
270
270
  console.log('The grant has already been created, skipping lockbox create step')
271
271
  return grants[0].lockboxUuid!
272
- } else
273
- return (
272
+ } else {
273
+ let lockboxResponse =
274
274
  await oroClient.vaultClient.lockboxCreate().catch((err) => {
275
275
  console.error('Error while creating lockbox', err)
276
276
  throw err
277
277
  })
278
- ).lockboxUuid
278
+ // Since the creation of a lockbox will change the scope of a user, we will force refresh the tokens
279
+ let tokens = await oroClient.guardClient.authRefresh()
280
+ await oroClient.guardClient.setTokens({ accessToken: tokens.accessToken, refreshToken: tokens.refreshToken })
281
+ await oroClient.guardClient.whoAmI(true)
282
+
283
+ return lockboxResponse.lockboxUuid
284
+ }
279
285
  }
280
286
 
281
287
  /**
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2021 ORO Health Inc.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.