oro-sdk 7.5.0 → 8.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.
- package/dist/client.d.ts +5 -0
- package/dist/oro-sdk.cjs.development.js +626 -587
- package/dist/oro-sdk.cjs.development.js.map +1 -1
- package/dist/oro-sdk.cjs.production.min.js +1 -1
- package/dist/oro-sdk.cjs.production.min.js.map +1 -1
- package/dist/oro-sdk.esm.js +626 -587
- package/dist/oro-sdk.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/client.ts +20 -0
- package/src/helpers/patient-registration.ts +13 -14
package/package.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"version": "
|
2
|
+
"version": "8.1.0",
|
3
3
|
"main": "dist/index.js",
|
4
4
|
"typings": "dist/index.d.ts",
|
5
5
|
"files": [
|
@@ -55,8 +55,8 @@
|
|
55
55
|
"form-data": "^4.0.0",
|
56
56
|
"formdata-node": "^4.3.1",
|
57
57
|
"idb-keyval": "^5.0.6",
|
58
|
-
"oro-sdk-apis": "~
|
58
|
+
"oro-sdk-apis": "~8.0.0",
|
59
59
|
"oro-toolbox": "0.0.6",
|
60
60
|
"uuid": "^8.3.2"
|
61
61
|
}
|
62
|
-
}
|
62
|
+
}
|
package/src/client.ts
CHANGED
@@ -203,6 +203,26 @@ export class OroClient {
|
|
203
203
|
return await this.guardClient.identityGet(userUuid)
|
204
204
|
}
|
205
205
|
|
206
|
+
/**
|
207
|
+
* Creates a lockbox and decrypts the created grant for that lockbox
|
208
|
+
* @returns the grant to the created lockbox
|
209
|
+
*/
|
210
|
+
public async lockboxCreate(): Promise<Grant> {
|
211
|
+
if (!this.rsa) {
|
212
|
+
if (this.authenticationCallback) {
|
213
|
+
this.authenticationCallback(new IncompleteAuthentication())
|
214
|
+
}
|
215
|
+
throw new IncompleteAuthentication()
|
216
|
+
}
|
217
|
+
return this.vaultClient
|
218
|
+
.lockboxCreate()
|
219
|
+
.then((grant) => decryptGrants([grant], this.rsa!))
|
220
|
+
.then((grants) => {
|
221
|
+
if (grants.length <= 0 || !grants[0].lockboxUuid) throw new MissingGrant()
|
222
|
+
return grants[0]
|
223
|
+
})
|
224
|
+
}
|
225
|
+
|
206
226
|
/**
|
207
227
|
* Will attempt to recover an existing login session and set back
|
208
228
|
* the private key in scope
|
@@ -83,7 +83,7 @@ export async function registerPatient(
|
|
83
83
|
const stepsTotalNum = 9
|
84
84
|
let currentStep: number
|
85
85
|
|
86
|
-
// toggle all changed statuses if this workflow has previous/revision data
|
86
|
+
// toggle all changed statuses if this workflow has previous/revision data
|
87
87
|
workflow = detectChangesInWorkflowAnswers(workflow)
|
88
88
|
|
89
89
|
for (; retry > 0; retry--) {
|
@@ -173,10 +173,10 @@ export async function registerPatient(
|
|
173
173
|
oroClient,
|
174
174
|
onProgress
|
175
175
|
? {
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
176
|
+
onProgress,
|
177
|
+
currentStep,
|
178
|
+
stepsTotalNum,
|
179
|
+
}
|
180
180
|
: undefined
|
181
181
|
).catch((err) => {
|
182
182
|
console.error('[SDK: registration] Some errors happened during image upload', err)
|
@@ -297,7 +297,7 @@ async function getOrCreatePatientLockbox(oroClient: OroClient): Promise<Uuid> {
|
|
297
297
|
console.log('The grant has already been created, skipping lockbox create step')
|
298
298
|
return grants[0].lockboxUuid!
|
299
299
|
} else {
|
300
|
-
let lockboxResponse = await oroClient.
|
300
|
+
let lockboxResponse = await oroClient.lockboxCreate().catch((err) => {
|
301
301
|
console.error('Error while creating lockbox', err)
|
302
302
|
throw err
|
303
303
|
})
|
@@ -306,7 +306,7 @@ async function getOrCreatePatientLockbox(oroClient: OroClient): Promise<Uuid> {
|
|
306
306
|
await oroClient.guardClient.setTokens({ accessToken: tokens.accessToken, refreshToken: tokens.refreshToken })
|
307
307
|
await oroClient.guardClient.whoAmI(true)
|
308
308
|
|
309
|
-
return lockboxResponse.lockboxUuid
|
309
|
+
return lockboxResponse.lockboxUuid!
|
310
310
|
}
|
311
311
|
}
|
312
312
|
|
@@ -413,17 +413,16 @@ async function storePatientData(
|
|
413
413
|
{ consultationId },
|
414
414
|
{ withNotification: false, forceReplace: false, updateMedicalStatus: false }
|
415
415
|
// the only data that needs to include an email notification
|
416
|
-
)
|
416
|
+
)
|
417
|
+
)
|
417
418
|
)
|
418
419
|
break
|
419
420
|
case ConsultType.Onboard:
|
420
421
|
case ConsultType.Refill:
|
421
422
|
default:
|
422
|
-
break
|
423
|
+
break
|
423
424
|
}
|
424
|
-
return Promise
|
425
|
-
.all(patientDataPromises)
|
426
|
-
.then((dataUuids) => dataUuids.flat())
|
425
|
+
return Promise.all(patientDataPromises).then((dataUuids) => dataUuids.flat())
|
427
426
|
}
|
428
427
|
|
429
428
|
async function storeImageAliases(
|
@@ -477,11 +476,11 @@ async function storeImageAliases(
|
|
477
476
|
Math.round(
|
478
477
|
((progress.currentStep + 1) / progress.stepsTotalNum -
|
479
478
|
progress.currentStep / progress.stepsTotalNum) *
|
480
|
-
|
479
|
+
100
|
481
480
|
) / 100
|
482
481
|
progress.onProgress(
|
483
482
|
progress.currentStep / progress.stepsTotalNum +
|
484
|
-
|
483
|
+
progressStepValue * (storedImagesNum / totalImagesNum),
|
485
484
|
'store_images',
|
486
485
|
{
|
487
486
|
storedImagesNum,
|