oro-sdk-apis 5.16.0 → 6.0.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/models/practice.d.ts +2 -0
 - package/dist/oro-sdk-apis.cjs.development.js +57 -42
 - package/dist/oro-sdk-apis.cjs.development.js.map +1 -1
 - package/dist/oro-sdk-apis.cjs.production.min.js +1 -1
 - package/dist/oro-sdk-apis.cjs.production.min.js.map +1 -1
 - package/dist/oro-sdk-apis.esm.js +57 -42
 - package/dist/oro-sdk-apis.esm.js.map +1 -1
 - package/dist/services/apisPracticeManager.d.ts +6 -0
 - package/package.json +1 -1
 - package/src/models/practice.ts +3 -1
 - package/src/services/apisPracticeManager.ts +22 -18
 
| 
         @@ -385,6 +385,7 @@ export interface PracticeWorkflow { 
     | 
|
| 
       385 
385 
     | 
    
         
             
                uuidWorkflow: string;
         
     | 
| 
       386 
386 
     | 
    
         
             
                typeWorkflow: WorkflowType;
         
     | 
| 
       387 
387 
     | 
    
         
             
                tagSpecialty?: string;
         
     | 
| 
      
 388 
     | 
    
         
            +
                associatedWorkflowUuid?: string;
         
     | 
| 
       388 
389 
     | 
    
         
             
            }
         
     | 
| 
       389 
390 
     | 
    
         
             
            export declare type PracticeWorkflowWithTagSpecialty = PracticeWorkflow & {
         
     | 
| 
       390 
391 
     | 
    
         
             
                tagSpecialty: string;
         
     | 
| 
         @@ -407,6 +408,7 @@ export interface PracticePlan { 
     | 
|
| 
       407 
408 
     | 
    
         
             
                dateCreatedAt: Date;
         
     | 
| 
       408 
409 
     | 
    
         
             
                dateUpdateAt: Date;
         
     | 
| 
       409 
410 
     | 
    
         
             
                ratePerThousandOverride: number;
         
     | 
| 
      
 411 
     | 
    
         
            +
                activateFollowUp: boolean;
         
     | 
| 
       410 
412 
     | 
    
         
             
            }
         
     | 
| 
       411 
413 
     | 
    
         
             
            export declare enum StripePriceType {
         
     | 
| 
       412 
414 
     | 
    
         
             
                Default = "Default",
         
     | 
| 
         @@ -650,6 +650,9 @@ var ApisPracticeManager = /*#__PURE__*/function () { 
     | 
|
| 
       650 
650 
     | 
    
         
             
                this.getAuthTokenCbk = getAuthTokenCbk;
         
     | 
| 
       651 
651 
     | 
    
         
             
                this.useLocalStorage = useLocalStorage;
         
     | 
| 
       652 
652 
     | 
    
         
             
                this.practiceInstances = new Map();
         
     | 
| 
      
 653 
     | 
    
         
            +
                // The refreshInstance will be a single instance that is used to refresh the tokens of others this way it will not interfere with requests made by other services 
         
     | 
| 
      
 654 
     | 
    
         
            +
                var newPracticeInstance = init(this.serviceCollReq, undefined, this.useLocalStorage);
         
     | 
| 
      
 655 
     | 
    
         
            +
                this.practiceInstances.set('refreshInstance', newPracticeInstance);
         
     | 
| 
       653 
656 
     | 
    
         
             
              }
         
     | 
| 
       654 
657 
     | 
    
         
             
              /**
         
     | 
| 
       655 
658 
     | 
    
         
             
               * This function is used to get a `ServiceCollection` associated to a practice. If missing, it will initialize a new `ServiceCollection`.
         
     | 
| 
         @@ -660,64 +663,76 @@ var ApisPracticeManager = /*#__PURE__*/function () { 
     | 
|
| 
       660 
663 
     | 
    
         
             
              _proto.get =
         
     | 
| 
       661 
664 
     | 
    
         
             
              /*#__PURE__*/
         
     | 
| 
       662 
665 
     | 
    
         
             
              function () {
         
     | 
| 
       663 
     | 
    
         
            -
                var _get = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function  
     | 
| 
      
 666 
     | 
    
         
            +
                var _get = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(practiceUuid) {
         
     | 
| 
       664 
667 
     | 
    
         
             
                  var _this = this;
         
     | 
| 
       665 
     | 
    
         
            -
                  var cacheKey, practiceInstance, newPracticeInstance 
     | 
| 
       666 
     | 
    
         
            -
                  return _regeneratorRuntime().wrap(function  
     | 
| 
       667 
     | 
    
         
            -
                    while (1) switch ( 
     | 
| 
      
 668 
     | 
    
         
            +
                  var cacheKey, practiceInstance, newPracticeInstance;
         
     | 
| 
      
 669 
     | 
    
         
            +
                  return _regeneratorRuntime().wrap(function _callee$(_context) {
         
     | 
| 
      
 670 
     | 
    
         
            +
                    while (1) switch (_context.prev = _context.next) {
         
     | 
| 
       668 
671 
     | 
    
         
             
                      case 0:
         
     | 
| 
       669 
672 
     | 
    
         
             
                        cacheKey = practiceUuid != null ? practiceUuid : 'none';
         
     | 
| 
       670 
673 
     | 
    
         
             
                        practiceInstance = this.practiceInstances.get(cacheKey);
         
     | 
| 
       671 
674 
     | 
    
         
             
                        if (!practiceInstance) {
         
     | 
| 
       672 
     | 
    
         
            -
                           
     | 
| 
      
 675 
     | 
    
         
            +
                          _context.next = 4;
         
     | 
| 
       673 
676 
     | 
    
         
             
                          break;
         
     | 
| 
       674 
677 
     | 
    
         
             
                        }
         
     | 
| 
       675 
     | 
    
         
            -
                        return  
     | 
| 
      
 678 
     | 
    
         
            +
                        return _context.abrupt("return", practiceInstance);
         
     | 
| 
       676 
679 
     | 
    
         
             
                      case 4:
         
     | 
| 
       677 
     | 
    
         
            -
                        newPracticeInstance = init(this.serviceCollReq, undefined, this.useLocalStorage); 
     | 
| 
       678 
     | 
    
         
            -
                         
     | 
| 
       679 
     | 
    
         
            -
                           
     | 
| 
       680 
     | 
    
         
            -
             
     | 
| 
       681 
     | 
    
         
            -
                              while (1) switch (_context.prev = _context.next) {
         
     | 
| 
       682 
     | 
    
         
            -
                                case 0:
         
     | 
| 
       683 
     | 
    
         
            -
                                  if (!newPracticeInstance.guardService) {
         
     | 
| 
       684 
     | 
    
         
            -
                                    _context.next = 7;
         
     | 
| 
       685 
     | 
    
         
            -
                                    break;
         
     | 
| 
       686 
     | 
    
         
            -
                                  }
         
     | 
| 
       687 
     | 
    
         
            -
                                  console.log("\x1B[36m[Auth] Refresh auth called (practiceUuid: " + practiceUuid + ")\x1B[36m");
         
     | 
| 
       688 
     | 
    
         
            -
                                  _context.next = 4;
         
     | 
| 
       689 
     | 
    
         
            -
                                  return _this.getAuthTokenCbk(newPracticeInstance.guardService, practiceUuid);
         
     | 
| 
       690 
     | 
    
         
            -
                                case 4:
         
     | 
| 
       691 
     | 
    
         
            -
                                  return _context.abrupt("return", _context.sent);
         
     | 
| 
       692 
     | 
    
         
            -
                                case 7:
         
     | 
| 
       693 
     | 
    
         
            -
                                  throw Error('[Auth] Unable to refresh token guard service is undefined');
         
     | 
| 
       694 
     | 
    
         
            -
                                case 8:
         
     | 
| 
       695 
     | 
    
         
            -
                                case "end":
         
     | 
| 
       696 
     | 
    
         
            -
                                  return _context.stop();
         
     | 
| 
       697 
     | 
    
         
            -
                              }
         
     | 
| 
       698 
     | 
    
         
            -
                            }, _callee);
         
     | 
| 
       699 
     | 
    
         
            -
                          }));
         
     | 
| 
       700 
     | 
    
         
            -
                          return function authTokenFunc() {
         
     | 
| 
       701 
     | 
    
         
            -
                            return _ref.apply(this, arguments);
         
     | 
| 
       702 
     | 
    
         
            -
                          };
         
     | 
| 
       703 
     | 
    
         
            -
                        }(); // Initialize the M2M token
         
     | 
| 
       704 
     | 
    
         
            -
                        _context2.next = 8;
         
     | 
| 
       705 
     | 
    
         
            -
                        return authTokenFunc();
         
     | 
| 
       706 
     | 
    
         
            -
                      case 8:
         
     | 
| 
       707 
     | 
    
         
            -
                        // Set the refresh tokens callback
         
     | 
| 
       708 
     | 
    
         
            -
                        newPracticeInstance.apiService.setAuthRefreshFn(authTokenFunc);
         
     | 
| 
      
 680 
     | 
    
         
            +
                        newPracticeInstance = init(this.serviceCollReq, undefined, this.useLocalStorage);
         
     | 
| 
      
 681 
     | 
    
         
            +
                        newPracticeInstance.apiService.setAuthRefreshFn(function () {
         
     | 
| 
      
 682 
     | 
    
         
            +
                          return _this.authTokenFunc(practiceUuid);
         
     | 
| 
      
 683 
     | 
    
         
            +
                        });
         
     | 
| 
       709 
684 
     | 
    
         
             
                        this.practiceInstances.set(cacheKey, newPracticeInstance);
         
     | 
| 
       710 
     | 
    
         
            -
                        return  
     | 
| 
       711 
     | 
    
         
            -
                      case  
     | 
| 
      
 685 
     | 
    
         
            +
                        return _context.abrupt("return", newPracticeInstance);
         
     | 
| 
      
 686 
     | 
    
         
            +
                      case 8:
         
     | 
| 
       712 
687 
     | 
    
         
             
                      case "end":
         
     | 
| 
       713 
     | 
    
         
            -
                        return  
     | 
| 
      
 688 
     | 
    
         
            +
                        return _context.stop();
         
     | 
| 
       714 
689 
     | 
    
         
             
                    }
         
     | 
| 
       715 
     | 
    
         
            -
                  },  
     | 
| 
      
 690 
     | 
    
         
            +
                  }, _callee, this);
         
     | 
| 
       716 
691 
     | 
    
         
             
                }));
         
     | 
| 
       717 
692 
     | 
    
         
             
                function get(_x) {
         
     | 
| 
       718 
693 
     | 
    
         
             
                  return _get.apply(this, arguments);
         
     | 
| 
       719 
694 
     | 
    
         
             
                }
         
     | 
| 
       720 
695 
     | 
    
         
             
                return get;
         
     | 
| 
      
 696 
     | 
    
         
            +
              }()
         
     | 
| 
      
 697 
     | 
    
         
            +
              /**
         
     | 
| 
      
 698 
     | 
    
         
            +
               * Uses the refresh intance to fetch a new auth token for the given practice
         
     | 
| 
      
 699 
     | 
    
         
            +
               * @param practiceUuid the uuid of the practice or key of a specific instance
         
     | 
| 
      
 700 
     | 
    
         
            +
               * @returns a new authentication token
         
     | 
| 
      
 701 
     | 
    
         
            +
               */
         
     | 
| 
      
 702 
     | 
    
         
            +
              ;
         
     | 
| 
      
 703 
     | 
    
         
            +
              _proto.authTokenFunc =
         
     | 
| 
      
 704 
     | 
    
         
            +
              /*#__PURE__*/
         
     | 
| 
      
 705 
     | 
    
         
            +
              function () {
         
     | 
| 
      
 706 
     | 
    
         
            +
                var _authTokenFunc = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(practiceUuidOrInstanceName) {
         
     | 
| 
      
 707 
     | 
    
         
            +
                  var newPracticeInstance;
         
     | 
| 
      
 708 
     | 
    
         
            +
                  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
         
     | 
| 
      
 709 
     | 
    
         
            +
                    while (1) switch (_context2.prev = _context2.next) {
         
     | 
| 
      
 710 
     | 
    
         
            +
                      case 0:
         
     | 
| 
      
 711 
     | 
    
         
            +
                        _context2.next = 2;
         
     | 
| 
      
 712 
     | 
    
         
            +
                        return this.get('refreshInstance');
         
     | 
| 
      
 713 
     | 
    
         
            +
                      case 2:
         
     | 
| 
      
 714 
     | 
    
         
            +
                        newPracticeInstance = _context2.sent;
         
     | 
| 
      
 715 
     | 
    
         
            +
                        if (!newPracticeInstance.guardService) {
         
     | 
| 
      
 716 
     | 
    
         
            +
                          _context2.next = 10;
         
     | 
| 
      
 717 
     | 
    
         
            +
                          break;
         
     | 
| 
      
 718 
     | 
    
         
            +
                        }
         
     | 
| 
      
 719 
     | 
    
         
            +
                        console.log("\x1B[36m[Auth] Refresh auth called (practiceUuid: " + practiceUuidOrInstanceName + ")\x1B[36m");
         
     | 
| 
      
 720 
     | 
    
         
            +
                        _context2.next = 7;
         
     | 
| 
      
 721 
     | 
    
         
            +
                        return this.getAuthTokenCbk(newPracticeInstance.guardService, practiceUuidOrInstanceName);
         
     | 
| 
      
 722 
     | 
    
         
            +
                      case 7:
         
     | 
| 
      
 723 
     | 
    
         
            +
                        return _context2.abrupt("return", _context2.sent);
         
     | 
| 
      
 724 
     | 
    
         
            +
                      case 10:
         
     | 
| 
      
 725 
     | 
    
         
            +
                        throw Error('[Auth] Unable to refresh token guard service is undefined');
         
     | 
| 
      
 726 
     | 
    
         
            +
                      case 11:
         
     | 
| 
      
 727 
     | 
    
         
            +
                      case "end":
         
     | 
| 
      
 728 
     | 
    
         
            +
                        return _context2.stop();
         
     | 
| 
      
 729 
     | 
    
         
            +
                    }
         
     | 
| 
      
 730 
     | 
    
         
            +
                  }, _callee2, this);
         
     | 
| 
      
 731 
     | 
    
         
            +
                }));
         
     | 
| 
      
 732 
     | 
    
         
            +
                function authTokenFunc(_x2) {
         
     | 
| 
      
 733 
     | 
    
         
            +
                  return _authTokenFunc.apply(this, arguments);
         
     | 
| 
      
 734 
     | 
    
         
            +
                }
         
     | 
| 
      
 735 
     | 
    
         
            +
                return authTokenFunc;
         
     | 
| 
       721 
736 
     | 
    
         
             
              }();
         
     | 
| 
       722 
737 
     | 
    
         
             
              return ApisPracticeManager;
         
     | 
| 
       723 
738 
     | 
    
         
             
            }();
         
     |