oro-sdk 3.5.0 → 3.7.0

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.5.0",
2
+ "version": "3.7.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.40.0",
57
+ "oro-sdk-apis": "1.42.0",
58
58
  "oro-toolbox": "0.0.6",
59
59
  "uuid": "^8.3.2"
60
60
  }
package/src/client.ts CHANGED
@@ -83,7 +83,7 @@ export class OroClient {
83
83
  public workflowClient: WorkflowService,
84
84
  public diagnosisClient: DiagnosisService,
85
85
  private authenticationCallback?: (err: Error) => void
86
- ) { }
86
+ ) {}
87
87
 
88
88
  /**
89
89
  * clears the vaultIndex and cached metadata grants
@@ -280,6 +280,7 @@ export class OroClient {
280
280
  * @param consult
281
281
  * @param workflow
282
282
  * @param recoveryQA
283
+ * @param indexSearch create search index for the consultation if true
283
284
  * @returns
284
285
  */
285
286
  public async registerPatient(
@@ -289,10 +290,11 @@ export class OroClient {
289
290
  recoveryQA?: {
290
291
  recoverySecurityQuestions: string[]
291
292
  recoverySecurityAnswers: string[]
292
- }
293
+ },
294
+ indexSearch: boolean = true
293
295
  ): Promise<RegisterPatientOutput> {
294
296
  if (!this.rsa) throw IncompleteAuthentication
295
- return registerPatient(patientUuid, consult, workflow, this, this.toolbox.uuid(), recoveryQA)
297
+ return registerPatient(patientUuid, consult, workflow, this, this.toolbox.uuid(), recoveryQA, indexSearch)
296
298
  }
297
299
 
298
300
  /**
@@ -391,18 +393,18 @@ export class OroClient {
391
393
  }))
392
394
  .map(
393
395
  (e: IndexConsultLockbox) =>
394
- ({
395
- uuid: e.uuid,
396
- timestamp: e.timestamp,
397
- uniqueHash: e.uniqueHash,
398
- encryptedIndexEntry: CryptoRSA.jsonWithPubEncryptToBase64(
399
- {
400
- consultationId: e.consultationId,
401
- grant: e.grant,
402
- },
403
- rsaPub
404
- ),
405
- } as EncryptedIndexEntry)
396
+ ({
397
+ uuid: e.uuid,
398
+ timestamp: e.timestamp,
399
+ uniqueHash: e.uniqueHash,
400
+ encryptedIndexEntry: CryptoRSA.jsonWithPubEncryptToBase64(
401
+ {
402
+ consultationId: e.consultationId,
403
+ grant: e.grant,
404
+ },
405
+ rsaPub
406
+ ),
407
+ } as EncryptedIndexEntry)
406
408
  )
407
409
  break
408
410
  //// DEPRECATED : REMOVE ME : BEGIN ///////////////////////////////////////////
@@ -424,18 +426,18 @@ export class OroClient {
424
426
  )
425
427
  .map(
426
428
  (e: IndexConsultLockbox) =>
427
- ({
428
- uuid: e.uuid,
429
- timestamp: e.timestamp,
430
- uniqueHash: e.uniqueHash,
431
- encryptedIndexEntry: CryptoRSA.jsonWithPubEncryptToBase64(
432
- {
433
- consultationId: e.consultationId,
434
- grant: e.grant,
435
- },
436
- rsaPub
437
- ),
438
- } as EncryptedIndexEntry)
429
+ ({
430
+ uuid: e.uuid,
431
+ timestamp: e.timestamp,
432
+ uniqueHash: e.uniqueHash,
433
+ encryptedIndexEntry: CryptoRSA.jsonWithPubEncryptToBase64(
434
+ {
435
+ consultationId: e.consultationId,
436
+ grant: e.grant,
437
+ },
438
+ rsaPub
439
+ ),
440
+ } as EncryptedIndexEntry)
439
441
  )
440
442
  break
441
443
  //// DEPRECATED : REMOVE ME : END ///////////////////////////////////////////
@@ -785,14 +787,15 @@ export class OroClient {
785
787
 
786
788
  // if there is a filter to apply, then the grant can be retrieved from the vault index, otherwise, all grants are fetched
787
789
  // Note: will work only if the filter being applied is exclusively a consult id
788
- const grantsByConsultLockbox = filter ? (
789
- await this.vaultClient.vaultIndexGet([IndexKey.ConsultationLockbox], [filter.consultationId])
790
- .then((res) => res[IndexKey.ConsultationLockbox])
791
- .catch((e) => {
792
- console.error(e)
793
- return []
794
- })
795
- ) : undefined
790
+ const grantsByConsultLockbox = filter
791
+ ? await this.vaultClient
792
+ .vaultIndexGet([IndexKey.ConsultationLockbox], [filter.consultationId])
793
+ .then((res) => res[IndexKey.ConsultationLockbox])
794
+ .catch((e) => {
795
+ console.error(e)
796
+ return []
797
+ })
798
+ : undefined
796
799
  const decryptedConsults = decryptConsultLockboxGrants(grantsByConsultLockbox ?? [], this.rsa)
797
800
  if (decryptedConsults.length > 0) {
798
801
  console.info('[sdk:index] Grants found in user`s constant time secure index')
@@ -50,6 +50,7 @@ const MAX_RETRIES = 15
50
50
  * @param oroClient
51
51
  * @param masterKey
52
52
  * @param recoveryQA
53
+ * @param indexSearch create search index for the consultation if true
53
54
  * @returns the successful registration
54
55
  */
55
56
  export async function registerPatient(
@@ -61,7 +62,8 @@ export async function registerPatient(
61
62
  recoveryQA?: {
62
63
  recoverySecurityQuestions: string[]
63
64
  recoverySecurityAnswers: string[]
64
- }
65
+ },
66
+ indexSearch: boolean = true
65
67
  ): Promise<RegisterPatientOutput> {
66
68
  let consult: Consult | undefined = undefined
67
69
  let lockboxUuid: Uuid | undefined = undefined
@@ -191,14 +193,17 @@ export async function registerPatient(
191
193
 
192
194
  await Promise.all([...grantPromises, ...consultIndexPromises])
193
195
 
194
- await buildConsultSearchIndex(consult, workflow, oroClient).catch((err) => {
195
- console.error(
196
- '[SDK: registration] personal information not found or another error occured during search indexing',
197
- err
198
- )
199
- if (retry <= 1) return // this statement is to avoid failing the registration due to the failure in search indexing the consult, this practically implements a soft retry
200
- errorsThrown.push(err)
201
- })
196
+
197
+ if(indexSearch) {
198
+ await buildConsultSearchIndex(consult, workflow, oroClient).catch((err) => {
199
+ console.error(
200
+ '[SDK: registration] personal information not found or another error occured during search indexing',
201
+ err
202
+ )
203
+ if (retry <= 1) return // this statement is to avoid failing the registration due to the failure in search indexing the consult, this practically implements a soft retry
204
+ errorsThrown.push(err)
205
+ })
206
+ }
202
207
 
203
208
  if (errorsThrown.length > 0) throw errorsThrown
204
209
 
@@ -510,4 +515,4 @@ export async function buildConsultSearchIndex(consult: Consult, workflow: Workfl
510
515
  }
511
516
 
512
517
  await oroClient.searchClient.index(consult.uuid, terms)
513
- }
518
+ }
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.