oro-sdk 3.17.0 → 3.18.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +21 -0
- package/dist/oro-sdk.cjs.development.js +55 -28
- 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 +55 -28
- package/dist/oro-sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +2 -0
- package/src/helpers/patient-registration.ts +9 -3
package/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
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.
|
@@ -439,7 +439,7 @@ function _asyncToGenerator(fn) {
|
|
439
439
|
}
|
440
440
|
|
441
441
|
function _extends() {
|
442
|
-
_extends = Object.assign
|
442
|
+
_extends = Object.assign || function (target) {
|
443
443
|
for (var i = 1; i < arguments.length; i++) {
|
444
444
|
var source = arguments[i];
|
445
445
|
|
@@ -452,6 +452,7 @@ function _extends() {
|
|
452
452
|
|
453
453
|
return target;
|
454
454
|
};
|
455
|
+
|
455
456
|
return _extends.apply(this, arguments);
|
456
457
|
}
|
457
458
|
|
@@ -481,17 +482,18 @@ function _inheritsLoose(subClass, superClass) {
|
|
481
482
|
}
|
482
483
|
|
483
484
|
function _getPrototypeOf(o) {
|
484
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf
|
485
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
485
486
|
return o.__proto__ || Object.getPrototypeOf(o);
|
486
487
|
};
|
487
488
|
return _getPrototypeOf(o);
|
488
489
|
}
|
489
490
|
|
490
491
|
function _setPrototypeOf(o, p) {
|
491
|
-
_setPrototypeOf = Object.setPrototypeOf
|
492
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
492
493
|
o.__proto__ = p;
|
493
494
|
return o;
|
494
495
|
};
|
496
|
+
|
495
497
|
return _setPrototypeOf(o, p);
|
496
498
|
}
|
497
499
|
|
@@ -510,7 +512,7 @@ function _isNativeReflectConstruct() {
|
|
510
512
|
|
511
513
|
function _construct(Parent, args, Class) {
|
512
514
|
if (_isNativeReflectConstruct()) {
|
513
|
-
_construct = Reflect.construct
|
515
|
+
_construct = Reflect.construct;
|
514
516
|
} else {
|
515
517
|
_construct = function _construct(Parent, args, Class) {
|
516
518
|
var a = [null];
|
@@ -625,7 +627,7 @@ var personalMetaToPrefix = (_personalMetaToPrefix = {}, _personalMetaToPrefix[in
|
|
625
627
|
*/
|
626
628
|
|
627
629
|
function identificationToPersonalInformations(data, category) {
|
628
|
-
var _data
|
630
|
+
var _data$;
|
629
631
|
|
630
632
|
var prefix = personalMetaToPrefix[category];
|
631
633
|
return {
|
@@ -635,7 +637,7 @@ function identificationToPersonalInformations(data, category) {
|
|
635
637
|
name: data[prefix + "Name"],
|
636
638
|
phone: data[prefix + "Phone"],
|
637
639
|
zip: data[prefix + "Zip"],
|
638
|
-
hid: (_data = data[prefix + "HID"]) != null ? _data : data[prefix + "ID"],
|
640
|
+
hid: (_data$ = data[prefix + "HID"]) != null ? _data$ : data[prefix + "ID"],
|
639
641
|
pharmacy: data[prefix + "Pharmacy"],
|
640
642
|
address: data[prefix + "Address"]
|
641
643
|
};
|
@@ -1623,7 +1625,7 @@ function getOrCreatePatientLockbox(_x10) {
|
|
1623
1625
|
|
1624
1626
|
function _getOrCreatePatientLockbox() {
|
1625
1627
|
_getOrCreatePatientLockbox = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(oroClient) {
|
1626
|
-
var grants;
|
1628
|
+
var grants, lockboxResponse, tokens;
|
1627
1629
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
1628
1630
|
while (1) {
|
1629
1631
|
switch (_context6.prev = _context6.next) {
|
@@ -1650,9 +1652,26 @@ function _getOrCreatePatientLockbox() {
|
|
1650
1652
|
});
|
1651
1653
|
|
1652
1654
|
case 10:
|
1653
|
-
|
1655
|
+
lockboxResponse = _context6.sent;
|
1656
|
+
_context6.next = 13;
|
1657
|
+
return oroClient.guardClient.authRefresh();
|
1654
1658
|
|
1655
|
-
case
|
1659
|
+
case 13:
|
1660
|
+
tokens = _context6.sent;
|
1661
|
+
_context6.next = 16;
|
1662
|
+
return oroClient.guardClient.setTokens({
|
1663
|
+
accessToken: tokens.accessToken,
|
1664
|
+
refreshToken: tokens.refreshToken
|
1665
|
+
});
|
1666
|
+
|
1667
|
+
case 16:
|
1668
|
+
_context6.next = 18;
|
1669
|
+
return oroClient.guardClient.whoAmI(true);
|
1670
|
+
|
1671
|
+
case 18:
|
1672
|
+
return _context6.abrupt("return", lockboxResponse.lockboxUuid);
|
1673
|
+
|
1674
|
+
case 19:
|
1656
1675
|
case "end":
|
1657
1676
|
return _context6.stop();
|
1658
1677
|
}
|
@@ -3241,54 +3260,62 @@ var OroClient = /*#__PURE__*/function () {
|
|
3241
3260
|
case 7:
|
3242
3261
|
currentAccountRole = _context20.sent;
|
3243
3262
|
|
3263
|
+
if (!(currentAccountRole.length === 1 && currentAccountRole[0] === initApis.OtherRoleType.User)) {
|
3264
|
+
_context20.next = 10;
|
3265
|
+
break;
|
3266
|
+
}
|
3267
|
+
|
3268
|
+
return _context20.abrupt("return", []);
|
3269
|
+
|
3270
|
+
case 10:
|
3244
3271
|
if (![initApis.OtherRoleType.Patient, initApis.OtherRoleType.User].every(function (requiredRole) {
|
3245
3272
|
return currentAccountRole.includes(requiredRole);
|
3246
3273
|
})) {
|
3247
|
-
_context20.next =
|
3274
|
+
_context20.next = 26;
|
3248
3275
|
break;
|
3249
3276
|
}
|
3250
3277
|
|
3251
3278
|
if (!filter) {
|
3252
|
-
_context20.next =
|
3279
|
+
_context20.next = 17;
|
3253
3280
|
break;
|
3254
3281
|
}
|
3255
3282
|
|
3256
|
-
_context20.next =
|
3283
|
+
_context20.next = 14;
|
3257
3284
|
return filterGrantsWithLockboxMetadata(this, filter);
|
3258
3285
|
|
3259
|
-
case
|
3286
|
+
case 14:
|
3260
3287
|
encryptedGrants = _context20.sent;
|
3261
|
-
_context20.next =
|
3288
|
+
_context20.next = 20;
|
3262
3289
|
break;
|
3263
3290
|
|
3264
|
-
case
|
3265
|
-
_context20.next =
|
3291
|
+
case 17:
|
3292
|
+
_context20.next = 19;
|
3266
3293
|
return this.vaultClient.grantsGet();
|
3267
3294
|
|
3268
|
-
case
|
3295
|
+
case 19:
|
3269
3296
|
encryptedGrants = _context20.sent.grants;
|
3270
3297
|
|
3271
|
-
case
|
3272
|
-
_context20.next =
|
3298
|
+
case 20:
|
3299
|
+
_context20.next = 22;
|
3273
3300
|
return decryptGrants(encryptedGrants, this.rsa);
|
3274
3301
|
|
3275
|
-
case
|
3302
|
+
case 22:
|
3276
3303
|
decryptedGrants = _context20.sent;
|
3277
3304
|
// sets the cached grant
|
3278
3305
|
this.cachedMetadataGrants[filterString] = decryptedGrants;
|
3279
3306
|
console.info('[sdk:grant] Found grant for patient');
|
3280
3307
|
return _context20.abrupt("return", decryptedGrants);
|
3281
3308
|
|
3282
|
-
case
|
3309
|
+
case 26:
|
3283
3310
|
if (filter) {
|
3284
|
-
_context20.next =
|
3311
|
+
_context20.next = 28;
|
3285
3312
|
break;
|
3286
3313
|
}
|
3287
3314
|
|
3288
3315
|
throw MissingGrantFilter;
|
3289
3316
|
|
3290
|
-
case
|
3291
|
-
_context20.next =
|
3317
|
+
case 28:
|
3318
|
+
_context20.next = 30;
|
3292
3319
|
return this.vaultClient.vaultIndexGet([initApis.IndexKey.ConsultationLockbox], [filter.consultationId]).then(function (res) {
|
3293
3320
|
return res[initApis.IndexKey.ConsultationLockbox];
|
3294
3321
|
})["catch"](function (e) {
|
@@ -3296,12 +3323,12 @@ var OroClient = /*#__PURE__*/function () {
|
|
3296
3323
|
return [];
|
3297
3324
|
});
|
3298
3325
|
|
3299
|
-
case
|
3326
|
+
case 30:
|
3300
3327
|
grantsByConsultLockbox = _context20.sent;
|
3301
3328
|
decryptedConsults = decryptConsultLockboxGrants(grantsByConsultLockbox != null ? grantsByConsultLockbox : [], this.rsa);
|
3302
3329
|
|
3303
3330
|
if (!(decryptedConsults.length > 0)) {
|
3304
|
-
_context20.next =
|
3331
|
+
_context20.next = 36;
|
3305
3332
|
break;
|
3306
3333
|
}
|
3307
3334
|
|
@@ -3309,10 +3336,10 @@ var OroClient = /*#__PURE__*/function () {
|
|
3309
3336
|
this.cachedMetadataGrants[filterString] = decryptedConsults;
|
3310
3337
|
return _context20.abrupt("return", this.cachedMetadataGrants[filterString]);
|
3311
3338
|
|
3312
|
-
case
|
3339
|
+
case 36:
|
3313
3340
|
return _context20.abrupt("return", []);
|
3314
3341
|
|
3315
|
-
case
|
3342
|
+
case 37:
|
3316
3343
|
case "end":
|
3317
3344
|
return _context20.stop();
|
3318
3345
|
}
|