@okta/okta-auth-js 6.3.1 → 6.3.2

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.
@@ -49,7 +49,6 @@ import { BroadcastChannel, createLeaderElection } from 'broadcast-channel';
49
49
  import PCancelable from 'p-cancelable';
50
50
  import _entriesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/entries';
51
51
  import crossFetch from 'cross-fetch';
52
- import NodeCache from 'node-cache';
53
52
  import _Object$fromEntries from '@babel/runtime-corejs3/core-js-stable/object/from-entries';
54
53
  import { JSONPath } from 'jsonpath-plus';
55
54
  import _includesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/includes';
@@ -4570,93 +4569,13 @@ function fetchRequest(method, url, args) {
4570
4569
  });
4571
4570
  }
4572
4571
 
4573
- var sharedStorage = typeof NodeCache === 'function' ? new NodeCache() : null;
4574
- var ServerCookies = function () {
4575
- function ServerCookies(nodeCache) {
4576
- _classCallCheck(this, ServerCookies);
4577
- this.nodeCache = nodeCache;
4578
- }
4579
- _createClass(ServerCookies, [{
4580
- key: "set",
4581
- value: function set(name, value, expiresAt) {
4582
- if (!!Date.parse(expiresAt)) {
4583
- var ttl = (Date.parse(expiresAt) - Date.now()) / 1000;
4584
- this.nodeCache.set(name, value, ttl);
4585
- } else {
4586
- this.nodeCache.set(name, value);
4587
- }
4588
- return this.get(name);
4589
- }
4590
- }, {
4591
- key: "get",
4592
- value: function get(name) {
4593
- return this.nodeCache.get(name);
4594
- }
4595
- }, {
4596
- key: "delete",
4597
- value: function _delete(name) {
4598
- return this.nodeCache.del(name);
4599
- }
4600
- }]);
4601
- return ServerCookies;
4602
- }();
4603
- var ServerStorage = function () {
4604
- function ServerStorage(nodeCache) {
4605
- _classCallCheck(this, ServerStorage);
4606
- this.nodeCache = nodeCache;
4607
- this.storage = new ServerCookies(nodeCache);
4608
- }
4609
- _createClass(ServerStorage, [{
4610
- key: "testStorageType",
4611
- value: function testStorageType(storageType) {
4612
- var supported = false;
4613
- switch (storageType) {
4614
- case 'memory':
4615
- supported = true;
4616
- break;
4617
- }
4618
- return supported;
4619
- }
4620
- }, {
4621
- key: "getStorageByType",
4622
- value: function getStorageByType(storageType) {
4623
- var storageProvider;
4624
- switch (storageType) {
4625
- case 'memory':
4626
- storageProvider = this.getStorage();
4627
- break;
4628
- default:
4629
- throw new AuthSdkError("Unrecognized storage option: ".concat(storageType));
4630
- }
4631
- return storageProvider;
4632
- }
4633
- }, {
4634
- key: "findStorageType",
4635
- value: function findStorageType() {
4636
- return 'memory';
4637
- }
4638
- }, {
4639
- key: "getHttpCache",
4640
- value: function getHttpCache() {
4641
- return null;
4642
- }
4643
- }, {
4644
- key: "getStorage",
4645
- value: function getStorage() {
4646
- var _this = this;
4647
- return {
4648
- getItem: this.nodeCache.get,
4649
- setItem: function setItem(key, value) {
4650
- _this.nodeCache.set(key, value, '2200-01-01T00:00:00.000Z');
4651
- }
4652
- };
4653
- }
4654
- }]);
4655
- return ServerStorage;
4656
- }();
4657
- var serverStorage = new ServerStorage(sharedStorage);
4658
-
4659
- var BROWSER_STORAGE = {
4572
+ function getStorage() {
4573
+ var storageUtil$1 = _Object$assign({}, storageUtil, {
4574
+ inMemoryStore: {}
4575
+ });
4576
+ return storageUtil$1;
4577
+ }
4578
+ var STORAGE_MANAGER_OPTIONS = {
4660
4579
  token: {
4661
4580
  storageTypes: ['localStorage', 'sessionStorage', 'cookie']
4662
4581
  },
@@ -4673,17 +4592,7 @@ var BROWSER_STORAGE = {
4673
4592
  storageTypes: ['localStorage']
4674
4593
  }
4675
4594
  };
4676
- var SERVER_STORAGE = {
4677
- token: {
4678
- storageTypes: ['memory']
4679
- },
4680
- cache: {
4681
- storageTypes: ['memory']
4682
- },
4683
- transaction: {
4684
- storageTypes: ['memory']
4685
- }
4686
- };
4595
+ var enableSharedStorage = true;
4687
4596
  function getCookieSettings() {
4688
4597
  var args = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4689
4598
  var isHTTPS = arguments.length > 1 ? arguments[1] : undefined;
@@ -4703,26 +4612,18 @@ function getCookieSettings() {
4703
4612
  }
4704
4613
  return cookieSettings;
4705
4614
  }
4615
+
4706
4616
  function getDefaultOptions() {
4707
- var storageUtil$1;
4708
- if (isBrowser()) {
4709
- storageUtil$1 = _Object$assign({}, storageUtil, {
4710
- inMemoryStore: {}
4711
- });
4712
- } else {
4713
- storageUtil$1 = serverStorage;
4714
- }
4715
- var storageManager = isBrowser() ? BROWSER_STORAGE : SERVER_STORAGE;
4716
- var enableSharedStorage = isBrowser() ? true : false;
4717
- return {
4617
+ var options = {
4718
4618
  devMode: false,
4719
4619
  httpRequestClient: fetchRequest,
4720
- storageUtil: storageUtil$1,
4721
- storageManager: storageManager,
4620
+ storageUtil: getStorage(),
4621
+ storageManager: STORAGE_MANAGER_OPTIONS,
4722
4622
  transactionManager: {
4723
4623
  enableSharedStorage: enableSharedStorage
4724
4624
  }
4725
4625
  };
4626
+ return options;
4726
4627
  }
4727
4628
  function mergeOptions(options, args) {
4728
4629
  return _Object$assign({}, options, removeNils(args), {
@@ -4759,7 +4660,7 @@ function buildOptions() {
4759
4660
  devMode: !!args.devMode,
4760
4661
  storageManager: args.storageManager,
4761
4662
  transactionManager: args.transactionManager,
4762
- cookies: isBrowser() ? getCookieSettings(args, isHTTPS()) : args.cookies,
4663
+ cookies: getCookieSettings(args, isHTTPS()),
4763
4664
  flow: args.flow,
4764
4665
  codeChallenge: args.codeChallenge,
4765
4666
  codeChallengeMethod: args.codeChallengeMethod,
@@ -8671,7 +8572,7 @@ function createGlobalRequestInterceptor(sdk) {
8671
8572
  var OktaUserAgent = function () {
8672
8573
  function OktaUserAgent() {
8673
8574
  _classCallCheck(this, OktaUserAgent);
8674
- this.environments = ["okta-auth-js/".concat("6.3.1")];
8575
+ this.environments = ["okta-auth-js/".concat("6.3.2")];
8675
8576
  }
8676
8577
  _createClass(OktaUserAgent, [{
8677
8578
  key: "addEnvironment",
@@ -8689,7 +8590,7 @@ var OktaUserAgent = function () {
8689
8590
  }, {
8690
8591
  key: "getVersion",
8691
8592
  value: function getVersion() {
8692
- return "6.3.1";
8593
+ return "6.3.2";
8693
8594
  }
8694
8595
  }, {
8695
8596
  key: "maybeAddNodeEnvironment",