@rxap/config 19.2.0 → 19.3.0-dev.1

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.
Files changed (129) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/compodoc/changelog.html +10 -0
  3. package/compodoc/dependencies.html +2 -2
  4. package/compodoc/injectables/ConfigService.html +145 -93
  5. package/compodoc/interfaces/ConfigLoadOptions.html +209 -58
  6. package/compodoc/js/search/search_index.js +2 -2
  7. package/compodoc/miscellaneous/enumerations.html +53 -0
  8. package/compodoc/miscellaneous/functions.html +60 -9
  9. package/compodoc/miscellaneous/typealiases.html +21 -0
  10. package/compodoc/miscellaneous/variables.html +185 -0
  11. package/compodoc/properties.html +1 -1
  12. package/docs/documentation.json +1443 -720
  13. package/docs/html/assets/hierarchy.js +1 -1
  14. package/docs/html/assets/navigation.js +1 -1
  15. package/docs/html/assets/search.js +1 -1
  16. package/docs/html/classes/ConfigLoaderService.html +2 -2
  17. package/docs/html/classes/ConfigService.html +6 -6
  18. package/docs/html/classes/ConfigTestingService.html +2 -2
  19. package/docs/html/enums/ConfigLoadMethod.html +5 -0
  20. package/docs/html/enums/ConfigLoadingStrategy.html +2 -2
  21. package/docs/html/functions/ProvideConfig.html +1 -1
  22. package/docs/html/functions/dnsLookup.html +1 -1
  23. package/docs/html/functions/dnsResolver.html +1 -1
  24. package/docs/html/functions/fetchCidContent.html +1 -1
  25. package/docs/html/functions/fetchCidContentAsJson.html +1 -1
  26. package/docs/html/functions/fetchCidContentViaHttp.html +1 -1
  27. package/docs/html/functions/fetchContentViaHttp.html +1 -1
  28. package/docs/html/functions/localPathIpfsGateway.html +1 -0
  29. package/docs/html/functions/localSubDomainIpfsGateway.html +1 -0
  30. package/docs/html/functions/raceSuccess.html +2 -2
  31. package/docs/html/functions/storachaIpfsGateway.html +1 -0
  32. package/docs/html/functions/w3sIpfsGateway.html +1 -0
  33. package/docs/html/hierarchy.html +1 -1
  34. package/docs/html/index.html +2 -2
  35. package/docs/html/interfaces/AppsNavigationConfig.html +2 -2
  36. package/docs/html/interfaces/Config.html +2 -2
  37. package/docs/html/interfaces/ConfigLoadOptions.html +11 -5
  38. package/docs/html/interfaces/LogoConfig.html +2 -2
  39. package/docs/html/interfaces/NavigationConfig.html +2 -2
  40. package/docs/html/interfaces/Oauth2Config.html +2 -2
  41. package/docs/html/interfaces/i18nConfig.html +2 -2
  42. package/docs/html/modules.html +1 -1
  43. package/docs/html/types/AnySchema.html +1 -1
  44. package/docs/html/types/IpfsGatewayFunction.html +1 -0
  45. package/docs/html/types/Join.html +1 -1
  46. package/docs/html/types/LanguagesConfig.html +1 -1
  47. package/docs/html/types/Leaves.html +1 -1
  48. package/docs/html/types/NoInferType.html +1 -1
  49. package/docs/html/types/Paths.html +1 -1
  50. package/docs/html/variables/RXAP_CONFIG.html +1 -1
  51. package/docs/html/variables/defaultDnsServers.html +1 -0
  52. package/docs/html/variables/defaultIpfsGatewayServers.html +1 -0
  53. package/docs/markdown/README.md +1 -1
  54. package/docs/markdown/classes/ConfigLoaderService.md +7 -7
  55. package/docs/markdown/classes/ConfigService.md +22 -22
  56. package/docs/markdown/classes/ConfigTestingService.md +8 -8
  57. package/docs/markdown/enumerations/ConfigLoadMethod.md +41 -0
  58. package/docs/markdown/enumerations/ConfigLoadingStrategy.md +4 -4
  59. package/docs/markdown/functions/ProvideConfig.md +2 -2
  60. package/docs/markdown/functions/dnsLookup.md +3 -3
  61. package/docs/markdown/functions/dnsResolver.md +2 -2
  62. package/docs/markdown/functions/fetchCidContent.md +7 -3
  63. package/docs/markdown/functions/fetchCidContentAsJson.md +8 -4
  64. package/docs/markdown/functions/fetchCidContentViaHttp.md +7 -3
  65. package/docs/markdown/functions/fetchContentViaHttp.md +2 -2
  66. package/docs/markdown/functions/localPathIpfsGateway.md +21 -0
  67. package/docs/markdown/functions/localSubDomainIpfsGateway.md +21 -0
  68. package/docs/markdown/functions/raceSuccess.md +2 -2
  69. package/docs/markdown/functions/storachaIpfsGateway.md +21 -0
  70. package/docs/markdown/functions/w3sIpfsGateway.md +21 -0
  71. package/docs/markdown/globals.md +10 -2
  72. package/docs/markdown/interfaces/AppsNavigationConfig.md +12 -12
  73. package/docs/markdown/interfaces/Config.md +6 -6
  74. package/docs/markdown/interfaces/ConfigLoadOptions.md +45 -13
  75. package/docs/markdown/interfaces/LogoConfig.md +5 -5
  76. package/docs/markdown/interfaces/NavigationConfig.md +9 -9
  77. package/docs/markdown/interfaces/Oauth2Config.md +3 -3
  78. package/docs/markdown/interfaces/i18nConfig.md +4 -4
  79. package/docs/markdown/type-aliases/AnySchema.md +2 -2
  80. package/docs/markdown/type-aliases/IpfsGatewayFunction.md +21 -0
  81. package/docs/markdown/type-aliases/Join.md +2 -2
  82. package/docs/markdown/type-aliases/LanguagesConfig.md +2 -2
  83. package/docs/markdown/type-aliases/Leaves.md +2 -2
  84. package/docs/markdown/type-aliases/NoInferType.md +2 -2
  85. package/docs/markdown/type-aliases/Paths.md +2 -2
  86. package/docs/markdown/variables/RXAP_CONFIG.md +2 -2
  87. package/docs/markdown/variables/defaultDnsServers.md +11 -0
  88. package/docs/markdown/variables/defaultIpfsGatewayServers.md +11 -0
  89. package/docs/wiki/Class.ConfigLoaderService.md +6 -6
  90. package/docs/wiki/Class.ConfigService.md +21 -21
  91. package/docs/wiki/Class.ConfigTestingService.md +7 -7
  92. package/docs/wiki/Enumeration.ConfigLoadMethod.md +37 -0
  93. package/docs/wiki/Enumeration.ConfigLoadingStrategy.md +3 -3
  94. package/docs/wiki/Function.ProvideConfig.md +1 -1
  95. package/docs/wiki/Function.dnsLookup.md +2 -2
  96. package/docs/wiki/Function.dnsResolver.md +1 -1
  97. package/docs/wiki/Function.fetchCidContent.md +6 -2
  98. package/docs/wiki/Function.fetchCidContentAsJson.md +7 -3
  99. package/docs/wiki/Function.fetchCidContentViaHttp.md +6 -2
  100. package/docs/wiki/Function.fetchContentViaHttp.md +1 -1
  101. package/docs/wiki/Function.localPathIpfsGateway.md +17 -0
  102. package/docs/wiki/Function.localSubDomainIpfsGateway.md +17 -0
  103. package/docs/wiki/Function.raceSuccess.md +1 -1
  104. package/docs/wiki/Function.storachaIpfsGateway.md +17 -0
  105. package/docs/wiki/Function.w3sIpfsGateway.md +17 -0
  106. package/docs/wiki/Interface.AppsNavigationConfig.md +11 -11
  107. package/docs/wiki/Interface.Config.md +5 -5
  108. package/docs/wiki/Interface.ConfigLoadOptions.md +44 -12
  109. package/docs/wiki/Interface.LogoConfig.md +4 -4
  110. package/docs/wiki/Interface.NavigationConfig.md +8 -8
  111. package/docs/wiki/Interface.Oauth2Config.md +2 -2
  112. package/docs/wiki/Interface.i18nConfig.md +3 -3
  113. package/docs/wiki/TypeAlias.AnySchema.md +1 -1
  114. package/docs/wiki/TypeAlias.IpfsGatewayFunction.md +17 -0
  115. package/docs/wiki/TypeAlias.Join.md +1 -1
  116. package/docs/wiki/TypeAlias.LanguagesConfig.md +1 -1
  117. package/docs/wiki/TypeAlias.Leaves.md +1 -1
  118. package/docs/wiki/TypeAlias.NoInferType.md +1 -1
  119. package/docs/wiki/TypeAlias.Paths.md +1 -1
  120. package/docs/wiki/Variable.RXAP_CONFIG.md +1 -1
  121. package/docs/wiki/Variable.defaultDnsServers.md +7 -0
  122. package/docs/wiki/Variable.defaultIpfsGatewayServers.md +7 -0
  123. package/docs/wiki/_Sidebar.md +8 -0
  124. package/docs/wiki/globals.md +9 -1
  125. package/fesm2022/rxap-config.mjs +112 -74
  126. package/fesm2022/rxap-config.mjs.map +1 -1
  127. package/lib/config.service.d.ts +18 -0
  128. package/lib/utilities.d.ts +10 -3
  129. package/package.json +6 -6
@@ -189,6 +189,20 @@
189
189
  fromUrls
190
190
  </a>
191
191
  </li>
192
+ <li>
193
+ <span class="modifier">Optional</span>
194
+ <a href="#ipfsGatewayServers"
195
+ >
196
+ ipfsGatewayServers
197
+ </a>
198
+ </li>
199
+ <li>
200
+ <span class="modifier">Optional</span>
201
+ <a href="#order"
202
+ >
203
+ order
204
+ </a>
205
+ </li>
192
206
  <li>
193
207
  <span class="modifier">Optional</span>
194
208
  <a href="#schema"
@@ -506,6 +520,91 @@ If true, uses <code>location.hostname</code>. If a string, uses that domain.</p>
506
520
 
507
521
 
508
522
 
523
+ </tbody>
524
+ </table>
525
+ <table class="table table-sm table-bordered">
526
+ <tbody>
527
+ <tr>
528
+ <td class="col-md-4">
529
+ <a name="ipfsGatewayServers"></a>
530
+ <span class="name "><b>ipfsGatewayServers</b>
531
+ <a href="#ipfsGatewayServers">
532
+ <span class="icon ion-ios-link"></span>
533
+ </a>
534
+ </span>
535
+ </td>
536
+ </tr>
537
+ <tr>
538
+ <td class="col-md-4">
539
+ <code>ipfsGatewayServers: <code>Array&lt;string&gt;</code>
540
+ </code>
541
+ </td>
542
+ </tr>
543
+
544
+
545
+ <tr>
546
+ <td class="col-md-4">
547
+ <i>Type : </i> <code>Array&lt;string&gt;</code>
548
+
549
+ </td>
550
+ </tr>
551
+
552
+ <tr>
553
+ <td class="col-md-4">
554
+ <i>Optional</i>
555
+ </td>
556
+ </tr>
557
+
558
+
559
+
560
+
561
+ </tbody>
562
+ </table>
563
+ <table class="table table-sm table-bordered">
564
+ <tbody>
565
+ <tr>
566
+ <td class="col-md-4">
567
+ <a name="order"></a>
568
+ <span class="name "><b>order</b>
569
+ <a href="#order">
570
+ <span class="icon ion-ios-link"></span>
571
+ </a>
572
+ </span>
573
+ </td>
574
+ </tr>
575
+ <tr>
576
+ <td class="col-md-4">
577
+ <code>order: <code><a href="../interfaces/Config.html" target="_self" >ConfigLoadMethod[]</a></code>
578
+ </code>
579
+ </td>
580
+ </tr>
581
+
582
+
583
+ <tr>
584
+ <td class="col-md-4">
585
+ <i>Type : </i> <code><a href="../interfaces/Config.html" target="_self" >ConfigLoadMethod[]</a></code>
586
+
587
+ </td>
588
+ </tr>
589
+
590
+ <tr>
591
+ <td class="col-md-4">
592
+ <i>Optional</i>
593
+ </td>
594
+ </tr>
595
+
596
+
597
+
598
+
599
+ <tr>
600
+ <td class="col-md-4">
601
+ <div class="io-description"><p>Defines the order and subset of config sources to load.
602
+ If not specified, defaults to: [FROM_URLS, FROM_LOCAL_STORAGE, FROM_URL_PARAM, FROM_CID]</p>
603
+ <p>Note: static config is always merged first, and Overwrites are always merged last.
604
+ Note: fromDns is not a source itself - it resolves the CID for FROM_CID.</p>
605
+ </div>
606
+ </td>
607
+ </tr>
509
608
  </tbody>
510
609
  </table>
511
610
  <table class="table table-sm table-bordered">
@@ -699,6 +798,13 @@ export enum ConfigLoadingStrategy {
699
798
  FIFO &#x3D; &#x27;fifo&#x27;,
700
799
  }
701
800
 
801
+ export enum ConfigLoadMethod {
802
+ FROM_URLS &#x3D; &#x27;fromUrls&#x27;,
803
+ FROM_LOCAL_STORAGE &#x3D; &#x27;fromLocalStorage&#x27;,
804
+ FROM_URL_PARAM &#x3D; &#x27;fromUrlParam&#x27;,
805
+ FROM_CID &#x3D; &#x27;fromCid&#x27;,
806
+ }
807
+
702
808
  export interface ConfigLoadOptions {
703
809
  fromUrlParam?: string | boolean;
704
810
  fromUrls?: boolean;
@@ -720,8 +826,17 @@ export interface ConfigLoadOptions {
720
826
  */
721
827
  fromCid?: string;
722
828
  fetchCidContent?: (cid: string, path?: string) &#x3D;&gt; Promise&lt;Blob | null&gt;;
829
+ ipfsGatewayServers?: Array&lt;(cid: string) &#x3D;&gt; string&gt;;
723
830
  dnsServers?: string[];
724
831
  strategy?: ConfigLoadingStrategy;
832
+ /**
833
+ * Defines the order and subset of config sources to load.
834
+ * If not specified, defaults to: [FROM_URLS, FROM_LOCAL_STORAGE, FROM_URL_PARAM, FROM_CID]
835
+ *
836
+ * Note: static config is always merged first, and Overwrites are always merged last.
837
+ * Note: fromDns is not a source itself - it resolves the CID for FROM_CID.
838
+ */
839
+ order?: ConfigLoadMethod[];
725
840
  }
726
841
 
727
842
  @Injectable({
@@ -794,81 +909,60 @@ export class ConfigService&lt;Config extends Record&lt;string, any&gt; &#x3D; Re
794
909
  }
795
910
  }
796
911
 
912
+ // Always merge static config first
797
913
  config &#x3D; deepMerge(config, options?.static ?? {});
798
- let done &#x3D; false;
799
914
 
800
- if (!done &amp;&amp; options?.fromUrls !&#x3D;&#x3D; false) {
801
- try {
802
- config &#x3D; deepMerge(config, await this.loadConfigFromUrls(options, environment));
803
- if (options.strategy &#x3D;&#x3D;&#x3D; ConfigLoadingStrategy.FIFO) {
804
- done &#x3D; true;
805
- }
806
- } catch (error: any) {
807
- if (options.strategy !&#x3D;&#x3D; ConfigLoadingStrategy.FIFO) {
808
- console.error(&#x27;Could not load config from urls&#x27;, error);
809
- throw error;
810
- } else {
811
- console.warn(&#x27;Could not load config from urls: &#x27; + error.message + &#x27;. Will try next strategy.&#x27;);
812
- }
813
- }
814
- }
915
+ // Determine the order of config sources to load
916
+ const order &#x3D; options.order ?? [
917
+ ConfigLoadMethod.FROM_URLS,
918
+ ConfigLoadMethod.FROM_LOCAL_STORAGE,
919
+ ConfigLoadMethod.FROM_URL_PARAM,
920
+ ConfigLoadMethod.FROM_CID,
921
+ ];
815
922
 
816
- if (!done &amp;&amp; options?.fromLocalStorage !&#x3D;&#x3D; false) {
817
- try {
818
- config &#x3D; deepMerge(config, this.loadConfigFromLocalStorage(options));
819
- if (options.strategy &#x3D;&#x3D;&#x3D; ConfigLoadingStrategy.FIFO) {
820
- done &#x3D; true;
821
- }
822
- } catch (error: any) {
823
- if (options.strategy !&#x3D;&#x3D; ConfigLoadingStrategy.FIFO) {
824
- console.error(&#x27;Could not load config from local storage&#x27;, error);
825
- throw error;
826
- } else {
827
- console.warn(&#x27;Could not load config from local storage: &#x27; + error.message + &#x27;. Will try next strategy.&#x27;);
828
- }
829
- }
923
+ // If fromDns is enabled and FROM_CID is in the order, resolve CID first
924
+ if (options.fromDns &amp;&amp; order.includes(ConfigLoadMethod.FROM_CID) &amp;&amp; !options.fromCid) {
925
+ await this.loadConfigFromDns(options as any);
830
926
  }
831
927
 
832
- if (!done &amp;&amp; options?.fromUrlParam) {
833
- try {
834
- config &#x3D; deepMerge(config, this.loadConfigFromUrlParam(options as any));
835
- if (options.strategy &#x3D;&#x3D;&#x3D; ConfigLoadingStrategy.FIFO) {
836
- done &#x3D; true;
837
- }
838
- } catch (error: any) {
839
- if (options.strategy !&#x3D;&#x3D; ConfigLoadingStrategy.FIFO) {
840
- console.error(&#x27;Could not load config from url param&#x27;, error);
841
- throw error;
842
- } else {
843
- console.warn(&#x27;Could not load config from url param: &#x27; + error.message + &#x27;. Will try next strategy.&#x27;);
844
- }
928
+ // Load configs from sources in the specified order
929
+ let done &#x3D; false;
930
+ for (const method of order) {
931
+ if (done) {
932
+ break;
845
933
  }
846
- }
847
934
 
848
- if (!done &amp;&amp; options?.fromDns) {
849
- await this.loadConfigFromDns(options as any);
850
- }
935
+ // Check if the source is enabled
936
+ if (!this.isSourceEnabled(options, method)) {
937
+ continue;
938
+ }
851
939
 
852
- if (!done &amp;&amp; options?.fromCid) {
853
940
  try {
854
- config &#x3D; deepMerge(config, await this.loadConfigFromCid(options as any));
941
+ const loadedConfig &#x3D; await this.loadConfigFromMethod(method, options, environment);
942
+ if (loadedConfig) {
943
+ config &#x3D; deepMerge(config, loadedConfig);
944
+ }
945
+
946
+ // If using FIFO strategy, stop after first successful load
855
947
  if (options.strategy &#x3D;&#x3D;&#x3D; ConfigLoadingStrategy.FIFO) {
856
948
  done &#x3D; true;
857
949
  }
858
950
  } catch (error: any) {
951
+ const methodName &#x3D; this.getMethodName(method);
859
952
  if (options.strategy !&#x3D;&#x3D; ConfigLoadingStrategy.FIFO) {
860
- console.error(&#x27;Could not load config from cid&#x27;, error);
953
+ console.error(&#x60;Could not load config from ${methodName}&#x60;, error);
861
954
  throw error;
862
955
  } else {
863
- console.warn(&#x27;Could not load config from cid: &#x27; + error.message + &#x27;. Will try next strategy.&#x27;);
956
+ console.warn(&#x60;Could not load config from ${methodName}: ${error.message}. Will try next strategy.&#x60;);
864
957
  }
865
958
  }
866
959
  }
867
960
 
868
- if (!done) {
961
+ if (!done &amp;&amp; order.length &gt; 0) {
869
962
  console.warn(&#x27;No config loading strategy succeeded. Using default config.&#x27;);
870
963
  }
871
964
 
965
+ // Always merge overwrites last
872
966
  config &#x3D; deepMerge(config, this.Overwrites);
873
967
 
874
968
  console.debug(&#x27;app config&#x27;, config);
@@ -876,6 +970,55 @@ export class ConfigService&lt;Config extends Record&lt;string, any&gt; &#x3D; Re
876
970
  this.Config &#x3D; config;
877
971
  }
878
972
 
973
+ private static isSourceEnabled(options: ConfigLoadOptions, method: ConfigLoadMethod): boolean {
974
+ switch (method) {
975
+ case ConfigLoadMethod.FROM_URLS:
976
+ return options.fromUrls !&#x3D;&#x3D; false;
977
+ case ConfigLoadMethod.FROM_LOCAL_STORAGE:
978
+ return options.fromLocalStorage !&#x3D;&#x3D; false;
979
+ case ConfigLoadMethod.FROM_URL_PARAM:
980
+ return !!options.fromUrlParam;
981
+ case ConfigLoadMethod.FROM_CID:
982
+ return !!options.fromCid;
983
+ default:
984
+ return false;
985
+ }
986
+ }
987
+
988
+ private static async loadConfigFromMethod(
989
+ method: ConfigLoadMethod,
990
+ options: ConfigLoadOptions,
991
+ environment?: Environment,
992
+ ): Promise&lt;any&gt; {
993
+ switch (method) {
994
+ case ConfigLoadMethod.FROM_URLS:
995
+ return await this.loadConfigFromUrls(options, environment);
996
+ case ConfigLoadMethod.FROM_LOCAL_STORAGE:
997
+ return this.loadConfigFromLocalStorage(options);
998
+ case ConfigLoadMethod.FROM_URL_PARAM:
999
+ return this.loadConfigFromUrlParam(options as any);
1000
+ case ConfigLoadMethod.FROM_CID:
1001
+ return await this.loadConfigFromCid(options as any);
1002
+ default:
1003
+ return null;
1004
+ }
1005
+ }
1006
+
1007
+ private static getMethodName(method: ConfigLoadMethod): string {
1008
+ switch (method) {
1009
+ case ConfigLoadMethod.FROM_URLS:
1010
+ return &#x27;urls&#x27;;
1011
+ case ConfigLoadMethod.FROM_LOCAL_STORAGE:
1012
+ return &#x27;local storage&#x27;;
1013
+ case ConfigLoadMethod.FROM_URL_PARAM:
1014
+ return &#x27;url param&#x27;;
1015
+ case ConfigLoadMethod.FROM_CID:
1016
+ return &#x27;cid&#x27;;
1017
+ default:
1018
+ return &#x27;unknown&#x27;;
1019
+ }
1020
+ }
1021
+
879
1022
  private static loadConfigFromUrlParam(options: ConfigLoadOptions &amp; { fromUrlParam: string | true }) {
880
1023
  const param &#x3D; typeof options.fromUrlParam &#x3D;&#x3D;&#x3D; &#x27;string&#x27; ? options.fromUrlParam : &#x27;config&#x27;;
881
1024
  return this.LoadConfigDefaultFromUrlParam(param);
@@ -918,8 +1061,18 @@ export class ConfigService&lt;Config extends Record&lt;string, any&gt; &#x3D; Re
918
1061
 
919
1062
  private static async loadConfigFromCid(options: ConfigLoadOptions &amp; { fromCid: string | boolean }) {
920
1063
  console.debug(&#x27;Loading config from CID: &#x27;, options.fromCid);
1064
+ const ipfsGatewayFunctions &#x3D; options.ipfsGatewayServers ?? [];
1065
+ if (!ipfsGatewayFunctions.length) {
1066
+ console.warn(&#x27;No IPFS gateway servers provided for fetching content from CID&#x27;);
1067
+ return;
1068
+ }
921
1069
  try {
922
- const cidContent &#x3D; await fetchCidContentAsJson(options.fromCid, undefined, options.fetchCidContent);
1070
+ const cidContent &#x3D; await fetchCidContentAsJson(
1071
+ options.fromCid,
1072
+ undefined,
1073
+ options.fetchCidContent,
1074
+ ipfsGatewayFunctions
1075
+ );
923
1076
  if (cidContent &amp;&amp; typeof cidContent &#x3D;&#x3D;&#x3D; &#x27;object&#x27;) {
924
1077
  console.log(&#x60;Merging configuration from CID ${options.fromCid}.&#x60;, cidContent);
925
1078
  // Merge CID content into the existing config object
@@ -939,11 +1092,9 @@ export class ConfigService&lt;Config extends Record&lt;string, any&gt; &#x3D; Re
939
1092
  private static async loadConfigFromDns(options: ConfigLoadOptions &amp; { fromDns: string | boolean }) {
940
1093
  console.debug(&#x27;Loading config from DNS&#x27;);
941
1094
  const dnsServers &#x3D; options.dnsServers ?? [];
942
- if (dnsServers.length &#x3D;&#x3D;&#x3D; 0) {
943
- dnsServers.push(
944
- &#x27;https://dns.google/resolve&#x27;,
945
- &#x27;https://cloudflare-dns.com/dns-query&#x27;
946
- );
1095
+ if (!dnsServers.length) {
1096
+ console.warn(&#x27;No DNS servers provided for DNS lookup&#x27;);
1097
+ return;
947
1098
  }
948
1099
  let domain &#x3D; location.hostname;
949
1100
  if (typeof options.fromDns &#x3D;&#x3D;&#x3D; &#x27;string&#x27;) {